@unbrained/pm-cli 2026.5.12 → 2026.5.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (407) hide show
  1. package/.claude-plugin/marketplace.json +4 -4
  2. package/AGENTS.md +78 -457
  3. package/CHANGELOG.md +22 -0
  4. package/CONTRIBUTING.md +1 -0
  5. package/PRD.md +7 -28
  6. package/README.md +8 -14
  7. package/dist/cli/argv-utils.js +4 -1
  8. package/dist/cli/argv-utils.js.map +1 -1
  9. package/dist/cli/bootstrap-args.js +4 -1
  10. package/dist/cli/bootstrap-args.js.map +1 -1
  11. package/dist/cli/commander-usage.js +32 -1
  12. package/dist/cli/commander-usage.js.map +1 -1
  13. package/dist/cli/commands/activity.js +23 -5
  14. package/dist/cli/commands/activity.js.map +1 -1
  15. package/dist/cli/commands/aggregate.js +5 -2
  16. package/dist/cli/commands/aggregate.js.map +1 -1
  17. package/dist/cli/commands/append.js +4 -1
  18. package/dist/cli/commands/append.js.map +1 -1
  19. package/dist/cli/commands/calendar.js +9 -3
  20. package/dist/cli/commands/calendar.js.map +1 -1
  21. package/dist/cli/commands/claim.d.ts +3 -0
  22. package/dist/cli/commands/claim.js +19 -3
  23. package/dist/cli/commands/claim.js.map +1 -1
  24. package/dist/cli/commands/close.js +4 -1
  25. package/dist/cli/commands/close.js.map +1 -1
  26. package/dist/cli/commands/comments-audit.js +4 -1
  27. package/dist/cli/commands/comments-audit.js.map +1 -1
  28. package/dist/cli/commands/comments.js +4 -1
  29. package/dist/cli/commands/comments.js.map +1 -1
  30. package/dist/cli/commands/completion.js +98 -2
  31. package/dist/cli/commands/completion.js.map +1 -1
  32. package/dist/cli/commands/config.js +4 -1
  33. package/dist/cli/commands/config.js.map +1 -1
  34. package/dist/cli/commands/context.js +19 -5
  35. package/dist/cli/commands/context.js.map +1 -1
  36. package/dist/cli/commands/contracts.d.ts +9 -0
  37. package/dist/cli/commands/contracts.js +205 -49
  38. package/dist/cli/commands/contracts.js.map +1 -1
  39. package/dist/cli/commands/create.js +88 -9
  40. package/dist/cli/commands/create.js.map +1 -1
  41. package/dist/cli/commands/dedupe-audit.js +4 -1
  42. package/dist/cli/commands/dedupe-audit.js.map +1 -1
  43. package/dist/cli/commands/delete.js +4 -1
  44. package/dist/cli/commands/delete.js.map +1 -1
  45. package/dist/cli/commands/deps.js +4 -1
  46. package/dist/cli/commands/deps.js.map +1 -1
  47. package/dist/cli/commands/docs.js +4 -1
  48. package/dist/cli/commands/docs.js.map +1 -1
  49. package/dist/cli/commands/extension.d.ts +7 -2
  50. package/dist/cli/commands/extension.js +360 -64
  51. package/dist/cli/commands/extension.js.map +1 -1
  52. package/dist/cli/commands/files.js +4 -1
  53. package/dist/cli/commands/files.js.map +1 -1
  54. package/dist/cli/commands/gc.js +4 -1
  55. package/dist/cli/commands/gc.js.map +1 -1
  56. package/dist/cli/commands/get.d.ts +7 -3
  57. package/dist/cli/commands/get.js +91 -18
  58. package/dist/cli/commands/get.js.map +1 -1
  59. package/dist/cli/commands/guide.js +6 -8
  60. package/dist/cli/commands/guide.js.map +1 -1
  61. package/dist/cli/commands/health.d.ts +4 -0
  62. package/dist/cli/commands/health.js +31 -8
  63. package/dist/cli/commands/health.js.map +1 -1
  64. package/dist/cli/commands/history-redact.d.ts +42 -0
  65. package/dist/cli/commands/history-redact.js +559 -0
  66. package/dist/cli/commands/history-redact.js.map +1 -0
  67. package/dist/cli/commands/history.d.ts +4 -0
  68. package/dist/cli/commands/history.js +14 -3
  69. package/dist/cli/commands/history.js.map +1 -1
  70. package/dist/cli/commands/index.d.ts +2 -8
  71. package/dist/cli/commands/index.js +6 -9
  72. package/dist/cli/commands/index.js.map +1 -1
  73. package/dist/cli/commands/init-agent-guidance.d.ts +31 -0
  74. package/dist/cli/commands/init-agent-guidance.js +336 -0
  75. package/dist/cli/commands/init-agent-guidance.js.map +1 -0
  76. package/dist/cli/commands/init.d.ts +14 -0
  77. package/dist/cli/commands/init.js +75 -1
  78. package/dist/cli/commands/init.js.map +1 -1
  79. package/dist/cli/commands/learnings.js +4 -1
  80. package/dist/cli/commands/learnings.js.map +1 -1
  81. package/dist/cli/commands/list.d.ts +1 -0
  82. package/dist/cli/commands/list.js +42 -18
  83. package/dist/cli/commands/list.js.map +1 -1
  84. package/dist/cli/commands/metadata-normalizers.js +4 -1
  85. package/dist/cli/commands/metadata-normalizers.js.map +1 -1
  86. package/dist/cli/commands/normalize.js +4 -1
  87. package/dist/cli/commands/normalize.js.map +1 -1
  88. package/dist/cli/commands/notes.js +4 -1
  89. package/dist/cli/commands/notes.js.map +1 -1
  90. package/dist/cli/commands/plan.d.ts +118 -0
  91. package/dist/cli/commands/plan.js +975 -0
  92. package/dist/cli/commands/plan.js.map +1 -0
  93. package/dist/cli/commands/reindex.d.ts +8 -0
  94. package/dist/cli/commands/reindex.js +100 -24
  95. package/dist/cli/commands/reindex.js.map +1 -1
  96. package/dist/cli/commands/restore.js +4 -1
  97. package/dist/cli/commands/restore.js.map +1 -1
  98. package/dist/cli/commands/search.js +58 -27
  99. package/dist/cli/commands/search.js.map +1 -1
  100. package/dist/cli/commands/stats.js +4 -1
  101. package/dist/cli/commands/stats.js.map +1 -1
  102. package/dist/cli/commands/templates.js +4 -1
  103. package/dist/cli/commands/templates.js.map +1 -1
  104. package/dist/cli/commands/test-all.js +4 -1
  105. package/dist/cli/commands/test-all.js.map +1 -1
  106. package/dist/cli/commands/test-runs.js +4 -1
  107. package/dist/cli/commands/test-runs.js.map +1 -1
  108. package/dist/cli/commands/test.js +4 -1
  109. package/dist/cli/commands/test.js.map +1 -1
  110. package/dist/cli/commands/update-many.js +4 -1
  111. package/dist/cli/commands/update-many.js.map +1 -1
  112. package/dist/cli/commands/update.js +114 -71
  113. package/dist/cli/commands/update.js.map +1 -1
  114. package/dist/cli/commands/upgrade.js +6 -3
  115. package/dist/cli/commands/upgrade.js.map +1 -1
  116. package/dist/cli/commands/validate.js +32 -4
  117. package/dist/cli/commands/validate.js.map +1 -1
  118. package/dist/cli/error-guidance.js +5 -2
  119. package/dist/cli/error-guidance.js.map +1 -1
  120. package/dist/cli/extension-command-help.js +4 -1
  121. package/dist/cli/extension-command-help.js.map +1 -1
  122. package/dist/cli/extension-command-options.js +4 -1
  123. package/dist/cli/extension-command-options.js.map +1 -1
  124. package/dist/cli/guide-topics.js +4 -1
  125. package/dist/cli/guide-topics.js.map +1 -1
  126. package/dist/cli/help-content.js +52 -33
  127. package/dist/cli/help-content.js.map +1 -1
  128. package/dist/cli/help-json-payload.js +4 -1
  129. package/dist/cli/help-json-payload.js.map +1 -1
  130. package/dist/cli/main.js +276 -32
  131. package/dist/cli/main.js.map +1 -1
  132. package/dist/cli/migration-gates.js +4 -1
  133. package/dist/cli/migration-gates.js.map +1 -1
  134. package/dist/cli/register-list-query.js +55 -150
  135. package/dist/cli/register-list-query.js.map +1 -1
  136. package/dist/cli/register-mutation.js +277 -261
  137. package/dist/cli/register-mutation.js.map +1 -1
  138. package/dist/cli/register-operations.js +62 -199
  139. package/dist/cli/register-operations.js.map +1 -1
  140. package/dist/cli/register-setup.js +55 -146
  141. package/dist/cli/register-setup.js.map +1 -1
  142. package/dist/cli/registration-helpers.d.ts +2 -2
  143. package/dist/cli/registration-helpers.js +11 -21
  144. package/dist/cli/registration-helpers.js.map +1 -1
  145. package/dist/cli/shared-parsers.js +4 -1
  146. package/dist/cli/shared-parsers.js.map +1 -1
  147. package/dist/cli/telemetry-flush.js +4 -1
  148. package/dist/cli/telemetry-flush.js.map +1 -1
  149. package/dist/cli.js +45 -3
  150. package/dist/cli.js.map +1 -1
  151. package/dist/core/extensions/extension-types.js +4 -1
  152. package/dist/core/extensions/extension-types.js.map +1 -1
  153. package/dist/core/extensions/index.js +4 -1
  154. package/dist/core/extensions/index.js.map +1 -1
  155. package/dist/core/extensions/item-fields.js +4 -1
  156. package/dist/core/extensions/item-fields.js.map +1 -1
  157. package/dist/core/extensions/loader.js +84 -54
  158. package/dist/core/extensions/loader.js.map +1 -1
  159. package/dist/core/extensions/runtime-registrations.js +4 -1
  160. package/dist/core/extensions/runtime-registrations.js.map +1 -1
  161. package/dist/core/fs/fs-utils.js +4 -1
  162. package/dist/core/fs/fs-utils.js.map +1 -1
  163. package/dist/core/fs/index.js +4 -1
  164. package/dist/core/fs/index.js.map +1 -1
  165. package/dist/core/history/history-stream-policy.js +4 -1
  166. package/dist/core/history/history-stream-policy.js.map +1 -1
  167. package/dist/core/history/history.js +4 -1
  168. package/dist/core/history/history.js.map +1 -1
  169. package/dist/core/history/index.js +4 -1
  170. package/dist/core/history/index.js.map +1 -1
  171. package/dist/core/item/id.js +4 -1
  172. package/dist/core/item/id.js.map +1 -1
  173. package/dist/core/item/index.js +4 -1
  174. package/dist/core/item/index.js.map +1 -1
  175. package/dist/core/item/item-format.js +241 -2
  176. package/dist/core/item/item-format.js.map +1 -1
  177. package/dist/core/item/parent-reference-policy.js +4 -1
  178. package/dist/core/item/parent-reference-policy.js.map +1 -1
  179. package/dist/core/item/parse.js +33 -3
  180. package/dist/core/item/parse.js.map +1 -1
  181. package/dist/core/item/sprint-release-format.js +4 -1
  182. package/dist/core/item/sprint-release-format.js.map +1 -1
  183. package/dist/core/item/status.js +4 -1
  184. package/dist/core/item/status.js.map +1 -1
  185. package/dist/core/item/type-registry.js +4 -1
  186. package/dist/core/item/type-registry.js.map +1 -1
  187. package/dist/core/lock/index.js +4 -1
  188. package/dist/core/lock/index.js.map +1 -1
  189. package/dist/core/lock/lock.js +4 -1
  190. package/dist/core/lock/lock.js.map +1 -1
  191. package/dist/core/output/command-aware.js +4 -1
  192. package/dist/core/output/command-aware.js.map +1 -1
  193. package/dist/core/output/output.d.ts +4 -0
  194. package/dist/core/output/output.js +47 -6
  195. package/dist/core/output/output.js.map +1 -1
  196. package/dist/core/packages/manifest.d.ts +27 -1
  197. package/dist/core/packages/manifest.js +87 -1
  198. package/dist/core/packages/manifest.js.map +1 -1
  199. package/dist/core/packages/root.d.ts +3 -0
  200. package/dist/core/packages/root.js +51 -0
  201. package/dist/core/packages/root.js.map +1 -0
  202. package/dist/core/schema/runtime-field-filters.js +4 -1
  203. package/dist/core/schema/runtime-field-filters.js.map +1 -1
  204. package/dist/core/schema/runtime-field-values.js +4 -1
  205. package/dist/core/schema/runtime-field-values.js.map +1 -1
  206. package/dist/core/schema/runtime-schema.js +4 -1
  207. package/dist/core/schema/runtime-schema.js.map +1 -1
  208. package/dist/core/search/cache.js +7 -2
  209. package/dist/core/search/cache.js.map +1 -1
  210. package/dist/core/search/corpus.d.ts +2 -0
  211. package/dist/core/search/corpus.js +77 -2
  212. package/dist/core/search/corpus.js.map +1 -1
  213. package/dist/core/search/embedding-batches.d.ts +13 -1
  214. package/dist/core/search/embedding-batches.js +40 -8
  215. package/dist/core/search/embedding-batches.js.map +1 -1
  216. package/dist/core/search/http-client.js +4 -1
  217. package/dist/core/search/http-client.js.map +1 -1
  218. package/dist/core/search/providers.js +4 -1
  219. package/dist/core/search/providers.js.map +1 -1
  220. package/dist/core/search/semantic-defaults.js +11 -2
  221. package/dist/core/search/semantic-defaults.js.map +1 -1
  222. package/dist/core/search/vector-stores.js +4 -1
  223. package/dist/core/search/vector-stores.js.map +1 -1
  224. package/dist/core/sentry/helpers.js +4 -1
  225. package/dist/core/sentry/helpers.js.map +1 -1
  226. package/dist/core/sentry/instrument.js +10 -13
  227. package/dist/core/sentry/instrument.js.map +1 -1
  228. package/dist/core/shared/command-types.js +4 -1
  229. package/dist/core/shared/command-types.js.map +1 -1
  230. package/dist/core/shared/conflict-markers.js +4 -1
  231. package/dist/core/shared/conflict-markers.js.map +1 -1
  232. package/dist/core/shared/constants.d.ts +2 -2
  233. package/dist/core/shared/constants.js +24 -1
  234. package/dist/core/shared/constants.js.map +1 -1
  235. package/dist/core/shared/errors.js +4 -1
  236. package/dist/core/shared/errors.js.map +1 -1
  237. package/dist/core/shared/index.js +4 -1
  238. package/dist/core/shared/index.js.map +1 -1
  239. package/dist/core/shared/levenshtein.js +4 -1
  240. package/dist/core/shared/levenshtein.js.map +1 -1
  241. package/dist/core/shared/primitives.js +4 -1
  242. package/dist/core/shared/primitives.js.map +1 -1
  243. package/dist/core/shared/serialization.js +4 -1
  244. package/dist/core/shared/serialization.js.map +1 -1
  245. package/dist/core/shared/text-normalization.js +4 -1
  246. package/dist/core/shared/text-normalization.js.map +1 -1
  247. package/dist/core/shared/time.js +4 -1
  248. package/dist/core/shared/time.js.map +1 -1
  249. package/dist/core/store/front-matter-cache.d.ts +8 -1
  250. package/dist/core/store/front-matter-cache.js +28 -14
  251. package/dist/core/store/front-matter-cache.js.map +1 -1
  252. package/dist/core/store/index.js +4 -1
  253. package/dist/core/store/index.js.map +1 -1
  254. package/dist/core/store/item-format-migration.js +4 -1
  255. package/dist/core/store/item-format-migration.js.map +1 -1
  256. package/dist/core/store/item-store.d.ts +2 -0
  257. package/dist/core/store/item-store.js +66 -3
  258. package/dist/core/store/item-store.js.map +1 -1
  259. package/dist/core/store/paths.js +4 -1
  260. package/dist/core/store/paths.js.map +1 -1
  261. package/dist/core/store/settings.js +39 -1
  262. package/dist/core/store/settings.js.map +1 -1
  263. package/dist/core/telemetry/consent.js +4 -1
  264. package/dist/core/telemetry/consent.js.map +1 -1
  265. package/dist/core/telemetry/observability.d.ts +1 -1
  266. package/dist/core/telemetry/observability.js +11 -2
  267. package/dist/core/telemetry/observability.js.map +1 -1
  268. package/dist/core/telemetry/runtime.js +31 -5
  269. package/dist/core/telemetry/runtime.js.map +1 -1
  270. package/dist/core/test/background-runs.js +4 -1
  271. package/dist/core/test/background-runs.js.map +1 -1
  272. package/dist/core/test/item-test-run-tracking.js +4 -1
  273. package/dist/core/test/item-test-run-tracking.js.map +1 -1
  274. package/dist/mcp/server.d.ts +8 -0
  275. package/dist/mcp/server.js +212 -53
  276. package/dist/mcp/server.js.map +1 -1
  277. package/dist/sdk/cli-contracts/commander-mutation-options.d.ts +7 -0
  278. package/dist/sdk/cli-contracts/commander-mutation-options.js +484 -0
  279. package/dist/sdk/cli-contracts/commander-mutation-options.js.map +1 -0
  280. package/dist/sdk/cli-contracts/commander-types.d.ts +21 -0
  281. package/dist/sdk/cli-contracts/commander-types.js +95 -0
  282. package/dist/sdk/cli-contracts/commander-types.js.map +1 -0
  283. package/dist/sdk/cli-contracts.d.ts +10 -17
  284. package/dist/sdk/cli-contracts.js +232 -282
  285. package/dist/sdk/cli-contracts.js.map +1 -1
  286. package/dist/sdk/index.d.ts +2 -1
  287. package/dist/sdk/index.js +5 -1
  288. package/dist/sdk/index.js.map +1 -1
  289. package/dist/sdk/runtime.d.ts +29 -0
  290. package/dist/sdk/runtime.js +31 -0
  291. package/dist/sdk/runtime.js.map +1 -0
  292. package/dist/types/index.js +4 -1
  293. package/dist/types/index.js.map +1 -1
  294. package/dist/types.d.ts +86 -2
  295. package/dist/types.js +34 -1
  296. package/dist/types.js.map +1 -1
  297. package/docs/AGENT_GUIDE.md +16 -6
  298. package/docs/CLAUDE_CODE_PLUGIN.md +10 -10
  299. package/docs/CODEX_PLUGIN.md +2 -2
  300. package/docs/COMMANDS.md +83 -8
  301. package/docs/CONFIGURATION.md +4 -1
  302. package/docs/EXTENSIONS.md +176 -807
  303. package/docs/QUICKSTART.md +12 -5
  304. package/docs/README.md +7 -6
  305. package/docs/RELEASING.md +6 -4
  306. package/docs/SDK.md +78 -441
  307. package/docs/TESTING.md +2 -2
  308. package/marketplace.json +3 -3
  309. package/package.json +7 -4
  310. package/packages/pm-beads/extensions/beads/index.js +90 -101
  311. package/packages/pm-beads/extensions/beads/index.ts +2 -2
  312. package/packages/pm-beads/extensions/beads/runtime.js +2 -17
  313. package/packages/pm-beads/extensions/beads/runtime.ts +41 -18
  314. package/packages/pm-beads/package.json +34 -1
  315. package/packages/pm-calendar/README.md +13 -0
  316. package/packages/pm-calendar/extensions/calendar/index.js +56 -0
  317. package/packages/pm-calendar/extensions/calendar/index.ts +62 -0
  318. package/packages/pm-calendar/extensions/calendar/manifest.json +7 -0
  319. package/packages/pm-calendar/extensions/calendar/runtime.js +114 -0
  320. package/packages/pm-calendar/extensions/calendar/runtime.ts +123 -0
  321. package/packages/pm-calendar/package.json +51 -0
  322. package/packages/pm-governance-audit/README.md +23 -0
  323. package/packages/pm-governance-audit/extensions/governance-audit/index.js +117 -0
  324. package/packages/pm-governance-audit/extensions/governance-audit/index.ts +118 -0
  325. package/packages/pm-governance-audit/extensions/governance-audit/manifest.json +7 -0
  326. package/packages/pm-governance-audit/extensions/governance-audit/runtime.js +159 -0
  327. package/packages/pm-governance-audit/extensions/governance-audit/runtime.ts +176 -0
  328. package/packages/pm-governance-audit/package.json +52 -0
  329. package/packages/pm-guide-shell/README.md +23 -0
  330. package/packages/pm-guide-shell/extensions/guide-shell/index.js +76 -0
  331. package/packages/pm-guide-shell/extensions/guide-shell/index.ts +81 -0
  332. package/packages/pm-guide-shell/extensions/guide-shell/manifest.json +7 -0
  333. package/packages/pm-guide-shell/extensions/guide-shell/runtime.js +263 -0
  334. package/packages/pm-guide-shell/extensions/guide-shell/runtime.ts +327 -0
  335. package/packages/pm-guide-shell/package.json +52 -0
  336. package/packages/pm-linked-test-adapters/README.md +24 -0
  337. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/index.js +101 -0
  338. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/index.ts +102 -0
  339. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/manifest.json +7 -0
  340. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/runtime.js +142 -0
  341. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/runtime.ts +173 -0
  342. package/packages/pm-linked-test-adapters/package.json +53 -0
  343. package/packages/pm-search-advanced/README.md +27 -0
  344. package/packages/pm-search-advanced/extensions/search-advanced/index.js +93 -0
  345. package/packages/pm-search-advanced/extensions/search-advanced/index.ts +94 -0
  346. package/packages/pm-search-advanced/extensions/search-advanced/manifest.json +7 -0
  347. package/packages/pm-search-advanced/extensions/search-advanced/runtime.js +120 -0
  348. package/packages/pm-search-advanced/extensions/search-advanced/runtime.ts +144 -0
  349. package/packages/pm-search-advanced/package.json +54 -0
  350. package/packages/pm-templates/README.md +20 -0
  351. package/packages/pm-templates/extensions/templates/index.js +101 -0
  352. package/packages/pm-templates/extensions/templates/index.ts +109 -0
  353. package/packages/pm-templates/extensions/templates/manifest.json +7 -0
  354. package/packages/pm-templates/extensions/templates/runtime.js +226 -0
  355. package/packages/pm-templates/extensions/templates/runtime.ts +283 -0
  356. package/packages/pm-templates/package.json +50 -0
  357. package/packages/pm-todos/extensions/todos/index.js +105 -116
  358. package/packages/pm-todos/extensions/todos/index.ts +3 -2
  359. package/packages/pm-todos/extensions/todos/runtime.js +2 -17
  360. package/packages/pm-todos/extensions/todos/runtime.ts +40 -18
  361. package/packages/pm-todos/package.json +35 -1
  362. package/plugins/{pm-cli-claude → pm-claude}/.claude-plugin/plugin.json +2 -2
  363. package/plugins/{pm-cli-claude → pm-claude}/.mcp.json +1 -1
  364. package/plugins/{pm-cli-claude → pm-claude}/README.md +4 -4
  365. package/plugins/{pm-cli-claude → pm-claude}/agents/pm-coordinator.md +1 -1
  366. package/plugins/{pm-cli-claude → pm-claude}/commands/pm-init.md +10 -1
  367. package/plugins/{pm-cli-claude → pm-claude}/commands/pm-planner.md +18 -0
  368. package/plugins/{pm-cli-claude → pm-claude}/scripts/pm-mcp-server.mjs +4 -2
  369. package/plugins/{pm-cli-claude → pm-claude}/skills/pm-planner/SKILL.md +46 -1
  370. package/plugins/{pm-cli-codex → pm-codex}/.codex-plugin/plugin.json +3 -3
  371. package/plugins/{pm-cli-codex → pm-codex}/.mcp.json +1 -1
  372. package/plugins/{pm-cli-codex → pm-codex}/README.md +7 -4
  373. package/plugins/{pm-cli-codex → pm-codex}/scripts/pm-mcp-server.mjs +4 -2
  374. package/plugins/pm-codex/skills/pm-native/SKILL.md +81 -0
  375. package/scripts/finalize-build.mjs +28 -0
  376. package/scripts/prepare-build-cache.mjs +37 -0
  377. package/plugins/pm-cli-codex/skills/pm-native/SKILL.md +0 -57
  378. /package/plugins/{pm-cli-claude → pm-claude}/agents/pm-delivery-chain.md +0 -0
  379. /package/plugins/{pm-cli-claude → pm-claude}/agents/pm-triage-agent.md +0 -0
  380. /package/plugins/{pm-cli-claude → pm-claude}/agents/pm-verification-agent.md +0 -0
  381. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-audit.md +0 -0
  382. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-calendar.md +0 -0
  383. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-close-task.md +0 -0
  384. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-developer.md +0 -0
  385. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-list.md +0 -0
  386. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-new.md +0 -0
  387. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-release.md +0 -0
  388. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-search.md +0 -0
  389. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-start-task.md +0 -0
  390. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-status.md +0 -0
  391. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-triage.md +0 -0
  392. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-workflow.md +0 -0
  393. /package/plugins/{pm-cli-claude → pm-claude}/hooks/hooks.json +0 -0
  394. /package/plugins/{pm-cli-claude → pm-claude}/hooks/session-start.mjs +0 -0
  395. /package/plugins/{pm-cli-claude → pm-claude}/skills/pm-audit/SKILL.md +0 -0
  396. /package/plugins/{pm-cli-claude → pm-claude}/skills/pm-developer/SKILL.md +0 -0
  397. /package/plugins/{pm-cli-claude → pm-claude}/skills/pm-release/SKILL.md +0 -0
  398. /package/plugins/{pm-cli-claude → pm-claude}/skills/pm-workflow/SKILL.md +0 -0
  399. /package/plugins/{pm-cli-codex → pm-codex}/assets/pm-cli-small.svg +0 -0
  400. /package/plugins/{pm-cli-codex → pm-codex}/commands/pm-audit.md +0 -0
  401. /package/plugins/{pm-cli-codex → pm-codex}/commands/pm-close-task.md +0 -0
  402. /package/plugins/{pm-cli-codex → pm-codex}/commands/pm-start-task.md +0 -0
  403. /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-auditor/SKILL.md +0 -0
  404. /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-auditor/agents/openai.yaml +0 -0
  405. /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-native/agents/openai.yaml +0 -0
  406. /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-release/SKILL.md +0 -0
  407. /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-release/agents/openai.yaml +0 -0
@@ -0,0 +1,226 @@
1
+ import fs from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { pathToFileURL } from "node:url";
4
+
5
+ const PM_PACKAGE_ROOT_ENV = "PM_CLI_PACKAGE_ROOT";
6
+ const sdk = await loadTemplatesSdkModule();
7
+ const {
8
+ CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS,
9
+ EXIT_CODE,
10
+ PmCliError,
11
+ getSettingsPath,
12
+ nowIso,
13
+ pathExists,
14
+ readFileIfExists,
15
+ resolvePmRoot,
16
+ writeFileAtomic,
17
+ } = sdk;
18
+
19
+ async function loadTemplatesSdkModule() {
20
+ const envRoot = process.env[PM_PACKAGE_ROOT_ENV];
21
+ if (typeof envRoot !== "string" || envRoot.trim().length === 0) {
22
+ throw new Error(
23
+ `builtin-templates requires ${PM_PACKAGE_ROOT_ENV} to locate core SDK runtime exports.`,
24
+ );
25
+ }
26
+ const modulePath = path.join(path.resolve(envRoot.trim()), "dist", "sdk", "index.js");
27
+ try {
28
+ const loaded = await import(pathToFileURL(modulePath).href);
29
+ if (
30
+ typeof loaded.resolvePmRoot === "function" &&
31
+ typeof loaded.pathExists === "function" &&
32
+ typeof loaded.PmCliError === "function" &&
33
+ Array.isArray(loaded.CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS)
34
+ ) {
35
+ return loaded;
36
+ }
37
+ } catch {
38
+ // Fall through to deterministic failure message below.
39
+ }
40
+ throw new Error(
41
+ `builtin-templates failed to load SDK runtime exports from ${modulePath}.`,
42
+ );
43
+ }
44
+
45
+ const TEMPLATE_DIRECTORY_NAME = "templates";
46
+ const TEMPLATE_FILE_EXTENSION = ".json";
47
+ const TEMPLATE_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
48
+ const TEMPLATE_OPTION_REPEATABLE_KEY_SET = new Set(CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS.map((entry) => entry.target));
49
+
50
+ function normalizeTemplateName(rawName) {
51
+ const name = rawName.trim();
52
+ if (!TEMPLATE_NAME_PATTERN.test(name)) {
53
+ throw new PmCliError(
54
+ `Invalid template name "${rawName}". Expected 1-64 characters matching [A-Za-z0-9][A-Za-z0-9._-]*.`,
55
+ EXIT_CODE.USAGE,
56
+ );
57
+ }
58
+ return name;
59
+ }
60
+
61
+ function templatesDirectory(pmRoot) {
62
+ return path.join(pmRoot, TEMPLATE_DIRECTORY_NAME);
63
+ }
64
+
65
+ function templatePath(pmRoot, normalizedName) {
66
+ return path.join(templatesDirectory(pmRoot), `${normalizedName}${TEMPLATE_FILE_EXTENSION}`);
67
+ }
68
+
69
+ async function ensureTrackerInitialized(pmRoot) {
70
+ if (!(await pathExists(getSettingsPath(pmRoot)))) {
71
+ throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
72
+ }
73
+ }
74
+
75
+ function sortTemplateOptions(options) {
76
+ return Object.fromEntries(Object.entries(options).sort(([left], [right]) => left.localeCompare(right)));
77
+ }
78
+
79
+ function extractTemplateOptions(rawOptions) {
80
+ const next = {};
81
+ for (const [key, value] of Object.entries(rawOptions)) {
82
+ if (value === undefined) {
83
+ continue;
84
+ }
85
+ if (TEMPLATE_OPTION_REPEATABLE_KEY_SET.has(key)) {
86
+ if (typeof value === "string") {
87
+ next[key] = [value];
88
+ continue;
89
+ }
90
+ if (!Array.isArray(value)) {
91
+ continue;
92
+ }
93
+ const values = value.filter((entry) => typeof entry === "string");
94
+ if (values.length > 0) {
95
+ next[key] = values;
96
+ }
97
+ continue;
98
+ }
99
+ if (typeof value === "string") {
100
+ next[key] = value;
101
+ continue;
102
+ }
103
+ if (Array.isArray(value) && value.every((entry) => typeof entry === "string")) {
104
+ next[key] = [...value];
105
+ }
106
+ }
107
+ return sortTemplateOptions(next);
108
+ }
109
+
110
+ function parseStoredTemplateOptions(rawOptions, templateName) {
111
+ if (typeof rawOptions !== "object" || rawOptions === null || Array.isArray(rawOptions)) {
112
+ throw new PmCliError(`Template "${templateName}" has invalid options payload.`, EXIT_CODE.GENERIC_FAILURE);
113
+ }
114
+ const normalized = {};
115
+ for (const [key, value] of Object.entries(rawOptions)) {
116
+ const normalizedKey = key.trim();
117
+ if (normalizedKey.length === 0) {
118
+ throw new PmCliError(`Template "${templateName}" contains an empty option key.`, EXIT_CODE.GENERIC_FAILURE);
119
+ }
120
+ if (typeof value === "string") {
121
+ normalized[normalizedKey] = value;
122
+ continue;
123
+ }
124
+ if (Array.isArray(value) && value.every((entry) => typeof entry === "string")) {
125
+ normalized[normalizedKey] = [...value];
126
+ continue;
127
+ }
128
+ throw new PmCliError(`Template "${templateName}" contains invalid value for option "${normalizedKey}".`, EXIT_CODE.GENERIC_FAILURE);
129
+ }
130
+ return sortTemplateOptions(normalized);
131
+ }
132
+
133
+ function parseStoredTemplateDocument(raw, normalizedName) {
134
+ let parsed;
135
+ try {
136
+ parsed = JSON.parse(raw);
137
+ } catch {
138
+ throw new PmCliError(`Template "${normalizedName}" contains invalid JSON.`, EXIT_CODE.GENERIC_FAILURE);
139
+ }
140
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
141
+ throw new PmCliError(`Template "${normalizedName}" has invalid document shape.`, EXIT_CODE.GENERIC_FAILURE);
142
+ }
143
+ const options = parseStoredTemplateOptions(parsed.options, normalizedName);
144
+ const now = nowIso();
145
+ return {
146
+ name: typeof parsed.name === "string" && parsed.name.trim().length > 0 ? parsed.name.trim() : normalizedName,
147
+ created_at: typeof parsed.created_at === "string" ? parsed.created_at : now,
148
+ updated_at: typeof parsed.updated_at === "string" ? parsed.updated_at : now,
149
+ options,
150
+ };
151
+ }
152
+
153
+ async function readStoredTemplateDocument(pmRoot, normalizedName) {
154
+ const raw = await readFileIfExists(templatePath(pmRoot, normalizedName));
155
+ if (raw === null) {
156
+ throw new PmCliError(`Template "${normalizedName}" not found`, EXIT_CODE.NOT_FOUND);
157
+ }
158
+ return parseStoredTemplateDocument(raw, normalizedName);
159
+ }
160
+
161
+ export async function runTemplatesSave(rawTemplateName, options, global) {
162
+ const pmRoot = resolvePmRoot(process.cwd(), global.path);
163
+ await ensureTrackerInitialized(pmRoot);
164
+ const normalizedName = normalizeTemplateName(rawTemplateName);
165
+ const nextOptions = extractTemplateOptions(options);
166
+ if (Object.keys(nextOptions).length === 0) {
167
+ throw new PmCliError("templates save requires at least one create option flag", EXIT_CODE.USAGE);
168
+ }
169
+
170
+ const now = nowIso();
171
+ const storedPath = templatePath(pmRoot, normalizedName);
172
+ let createdAt = now;
173
+ if (await pathExists(storedPath)) {
174
+ const existing = await readStoredTemplateDocument(pmRoot, normalizedName);
175
+ createdAt = existing.created_at;
176
+ }
177
+
178
+ const document = {
179
+ name: normalizedName,
180
+ created_at: createdAt,
181
+ updated_at: now,
182
+ options: nextOptions,
183
+ };
184
+ await fs.mkdir(templatesDirectory(pmRoot), { recursive: true });
185
+ await writeFileAtomic(storedPath, `${JSON.stringify(document, null, 2)}\n`);
186
+ return {
187
+ name: document.name,
188
+ created_at: document.created_at,
189
+ updated_at: document.updated_at,
190
+ path: storedPath,
191
+ options: document.options,
192
+ };
193
+ }
194
+
195
+ export async function runTemplatesList(global) {
196
+ const pmRoot = resolvePmRoot(process.cwd(), global.path);
197
+ await ensureTrackerInitialized(pmRoot);
198
+ const dirPath = templatesDirectory(pmRoot);
199
+ if (!(await pathExists(dirPath))) {
200
+ return { templates: [], count: 0 };
201
+ }
202
+ const entries = await fs.readdir(dirPath);
203
+ const templates = entries
204
+ .filter((entry) => entry.toLowerCase().endsWith(TEMPLATE_FILE_EXTENSION))
205
+ .map((entry) => entry.slice(0, -TEMPLATE_FILE_EXTENSION.length))
206
+ .filter((entry) => TEMPLATE_NAME_PATTERN.test(entry))
207
+ .sort((left, right) => left.localeCompare(right));
208
+ return {
209
+ templates,
210
+ count: templates.length,
211
+ };
212
+ }
213
+
214
+ export async function runTemplatesShow(rawTemplateName, global) {
215
+ const pmRoot = resolvePmRoot(process.cwd(), global.path);
216
+ await ensureTrackerInitialized(pmRoot);
217
+ const normalizedName = normalizeTemplateName(rawTemplateName);
218
+ const stored = await readStoredTemplateDocument(pmRoot, normalizedName);
219
+ return {
220
+ name: stored.name,
221
+ created_at: stored.created_at,
222
+ updated_at: stored.updated_at,
223
+ path: templatePath(pmRoot, normalizedName),
224
+ options: stored.options,
225
+ };
226
+ }
@@ -0,0 +1,283 @@
1
+ import fs from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { pathToFileURL } from "node:url";
4
+ import type { GlobalOptions } from "../../../../src/sdk/index.js";
5
+
6
+ const PM_PACKAGE_ROOT_ENV = "PM_CLI_PACKAGE_ROOT";
7
+
8
+ interface TemplatesSdkModule {
9
+ CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS: Array<{ target: string }>;
10
+ EXIT_CODE: {
11
+ USAGE: number;
12
+ NOT_FOUND: number;
13
+ GENERIC_FAILURE: number;
14
+ };
15
+ PmCliError: new (message: string, exitCode?: number) => Error;
16
+ getSettingsPath: (pmRoot: string) => string;
17
+ nowIso: () => string;
18
+ pathExists: (targetPath: string) => Promise<boolean>;
19
+ readFileIfExists: (targetPath: string) => Promise<string | null>;
20
+ resolvePmRoot: (cwd: string, overridePath?: string) => string;
21
+ writeFileAtomic: (targetPath: string, contents: string) => Promise<void>;
22
+ }
23
+
24
+ const sdk = await loadTemplatesSdkModule();
25
+ const {
26
+ CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS,
27
+ EXIT_CODE,
28
+ PmCliError,
29
+ getSettingsPath,
30
+ nowIso,
31
+ pathExists,
32
+ readFileIfExists,
33
+ resolvePmRoot,
34
+ writeFileAtomic,
35
+ } = sdk;
36
+
37
+ async function loadTemplatesSdkModule(): Promise<TemplatesSdkModule> {
38
+ const envRoot = process.env[PM_PACKAGE_ROOT_ENV];
39
+ if (typeof envRoot !== "string" || envRoot.trim().length === 0) {
40
+ throw new Error(
41
+ `builtin-templates requires ${PM_PACKAGE_ROOT_ENV} to locate core SDK runtime exports.`,
42
+ );
43
+ }
44
+ const modulePath = path.join(path.resolve(envRoot.trim()), "dist", "sdk", "index.js");
45
+ try {
46
+ const loaded = (await import(pathToFileURL(modulePath).href)) as Partial<TemplatesSdkModule>;
47
+ if (
48
+ typeof loaded.resolvePmRoot === "function" &&
49
+ typeof loaded.pathExists === "function" &&
50
+ typeof loaded.PmCliError === "function" &&
51
+ Array.isArray(loaded.CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS)
52
+ ) {
53
+ return loaded as TemplatesSdkModule;
54
+ }
55
+ } catch {
56
+ // Fall through to deterministic failure message below.
57
+ }
58
+ throw new Error(
59
+ `builtin-templates failed to load SDK runtime exports from ${modulePath}.`,
60
+ );
61
+ }
62
+
63
+ const TEMPLATE_DIRECTORY_NAME = "templates";
64
+ const TEMPLATE_FILE_EXTENSION = ".json";
65
+ const TEMPLATE_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
66
+ const TEMPLATE_OPTION_REPEATABLE_KEYS = CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS.map((entry) => entry.target);
67
+ const TEMPLATE_OPTION_REPEATABLE_KEY_SET = new Set<string>(TEMPLATE_OPTION_REPEATABLE_KEYS);
68
+
69
+ type TemplateOptionValue = string | string[];
70
+ export type CreateTemplateOptions = Record<string, TemplateOptionValue>;
71
+
72
+ interface StoredCreateTemplateDocument {
73
+ name: string;
74
+ created_at: string;
75
+ updated_at: string;
76
+ options: CreateTemplateOptions;
77
+ }
78
+
79
+ export interface TemplatesSaveResult {
80
+ name: string;
81
+ created_at: string;
82
+ updated_at: string;
83
+ path: string;
84
+ options: CreateTemplateOptions;
85
+ }
86
+
87
+ export interface TemplatesListResult {
88
+ templates: string[];
89
+ count: number;
90
+ }
91
+
92
+ export interface TemplatesShowResult {
93
+ name: string;
94
+ created_at: string;
95
+ updated_at: string;
96
+ path: string;
97
+ options: CreateTemplateOptions;
98
+ }
99
+
100
+ function normalizeTemplateName(rawName: string): string {
101
+ const name = rawName.trim();
102
+ if (!TEMPLATE_NAME_PATTERN.test(name)) {
103
+ throw new PmCliError(
104
+ `Invalid template name "${rawName}". Expected 1-64 characters matching [A-Za-z0-9][A-Za-z0-9._-]*.`,
105
+ EXIT_CODE.USAGE,
106
+ );
107
+ }
108
+ return name;
109
+ }
110
+
111
+ function templatesDirectory(pmRoot: string): string {
112
+ return path.join(pmRoot, TEMPLATE_DIRECTORY_NAME);
113
+ }
114
+
115
+ function templatePath(pmRoot: string, normalizedName: string): string {
116
+ return path.join(templatesDirectory(pmRoot), `${normalizedName}${TEMPLATE_FILE_EXTENSION}`);
117
+ }
118
+
119
+ async function ensureTrackerInitialized(pmRoot: string): Promise<void> {
120
+ if (!(await pathExists(getSettingsPath(pmRoot)))) {
121
+ throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
122
+ }
123
+ }
124
+
125
+ function sortTemplateOptions(options: CreateTemplateOptions): CreateTemplateOptions {
126
+ return Object.fromEntries(
127
+ Object.entries(options).sort(([left], [right]) => left.localeCompare(right)),
128
+ ) as CreateTemplateOptions;
129
+ }
130
+
131
+ function extractTemplateOptions(rawOptions: Record<string, unknown>): CreateTemplateOptions {
132
+ const next: CreateTemplateOptions = {};
133
+ for (const [key, value] of Object.entries(rawOptions)) {
134
+ if (value === undefined) {
135
+ continue;
136
+ }
137
+ if (TEMPLATE_OPTION_REPEATABLE_KEY_SET.has(key)) {
138
+ if (typeof value === "string") {
139
+ next[key] = [value];
140
+ continue;
141
+ }
142
+ if (!Array.isArray(value)) {
143
+ continue;
144
+ }
145
+ const values = value.filter((entry): entry is string => typeof entry === "string");
146
+ if (values.length > 0) {
147
+ next[key] = values;
148
+ }
149
+ continue;
150
+ }
151
+ if (typeof value === "string") {
152
+ next[key] = value;
153
+ continue;
154
+ }
155
+ if (Array.isArray(value) && value.every((entry) => typeof entry === "string")) {
156
+ next[key] = [...value];
157
+ }
158
+ }
159
+ return sortTemplateOptions(next);
160
+ }
161
+
162
+ function parseStoredTemplateOptions(rawOptions: unknown, templateName: string): CreateTemplateOptions {
163
+ if (typeof rawOptions !== "object" || rawOptions === null || Array.isArray(rawOptions)) {
164
+ throw new PmCliError(`Template "${templateName}" has invalid options payload.`, EXIT_CODE.GENERIC_FAILURE);
165
+ }
166
+ const normalized: CreateTemplateOptions = {};
167
+ for (const [key, value] of Object.entries(rawOptions as Record<string, unknown>)) {
168
+ const normalizedKey = key.trim();
169
+ if (normalizedKey.length === 0) {
170
+ throw new PmCliError(`Template "${templateName}" contains an empty option key.`, EXIT_CODE.GENERIC_FAILURE);
171
+ }
172
+ if (typeof value === "string") {
173
+ normalized[normalizedKey] = value;
174
+ continue;
175
+ }
176
+ if (Array.isArray(value) && value.every((entry) => typeof entry === "string")) {
177
+ normalized[normalizedKey] = [...value];
178
+ continue;
179
+ }
180
+ throw new PmCliError(`Template "${templateName}" contains invalid value for option "${normalizedKey}".`, EXIT_CODE.GENERIC_FAILURE);
181
+ }
182
+ return sortTemplateOptions(normalized);
183
+ }
184
+
185
+ function parseStoredTemplateDocument(raw: string, normalizedName: string): StoredCreateTemplateDocument {
186
+ let parsed: unknown;
187
+ try {
188
+ parsed = JSON.parse(raw) as unknown;
189
+ } catch {
190
+ throw new PmCliError(`Template "${normalizedName}" contains invalid JSON.`, EXIT_CODE.GENERIC_FAILURE);
191
+ }
192
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
193
+ throw new PmCliError(`Template "${normalizedName}" has invalid document shape.`, EXIT_CODE.GENERIC_FAILURE);
194
+ }
195
+ const record = parsed as Record<string, unknown>;
196
+ const options = parseStoredTemplateOptions(record.options, normalizedName);
197
+ const now = nowIso();
198
+ return {
199
+ name: typeof record.name === "string" && record.name.trim().length > 0 ? record.name.trim() : normalizedName,
200
+ created_at: typeof record.created_at === "string" ? record.created_at : now,
201
+ updated_at: typeof record.updated_at === "string" ? record.updated_at : now,
202
+ options,
203
+ };
204
+ }
205
+
206
+ async function readStoredTemplateDocument(pmRoot: string, normalizedName: string): Promise<StoredCreateTemplateDocument> {
207
+ const raw = await readFileIfExists(templatePath(pmRoot, normalizedName));
208
+ if (raw === null) {
209
+ throw new PmCliError(`Template "${normalizedName}" not found`, EXIT_CODE.NOT_FOUND);
210
+ }
211
+ return parseStoredTemplateDocument(raw, normalizedName);
212
+ }
213
+
214
+ export async function runTemplatesSave(
215
+ rawTemplateName: string,
216
+ options: Record<string, unknown>,
217
+ global: GlobalOptions,
218
+ ): Promise<TemplatesSaveResult> {
219
+ const pmRoot = resolvePmRoot(process.cwd(), global.path);
220
+ await ensureTrackerInitialized(pmRoot);
221
+ const normalizedName = normalizeTemplateName(rawTemplateName);
222
+ const nextOptions = extractTemplateOptions(options);
223
+ if (Object.keys(nextOptions).length === 0) {
224
+ throw new PmCliError("templates save requires at least one create option flag", EXIT_CODE.USAGE);
225
+ }
226
+
227
+ const now = nowIso();
228
+ const storedPath = templatePath(pmRoot, normalizedName);
229
+ let createdAt = now;
230
+ if (await pathExists(storedPath)) {
231
+ const existing = await readStoredTemplateDocument(pmRoot, normalizedName);
232
+ createdAt = existing.created_at;
233
+ }
234
+
235
+ const document: StoredCreateTemplateDocument = {
236
+ name: normalizedName,
237
+ created_at: createdAt,
238
+ updated_at: now,
239
+ options: nextOptions,
240
+ };
241
+ await fs.mkdir(templatesDirectory(pmRoot), { recursive: true });
242
+ await writeFileAtomic(storedPath, `${JSON.stringify(document, null, 2)}\n`);
243
+ return {
244
+ name: document.name,
245
+ created_at: document.created_at,
246
+ updated_at: document.updated_at,
247
+ path: storedPath,
248
+ options: document.options,
249
+ };
250
+ }
251
+
252
+ export async function runTemplatesList(global: GlobalOptions): Promise<TemplatesListResult> {
253
+ const pmRoot = resolvePmRoot(process.cwd(), global.path);
254
+ await ensureTrackerInitialized(pmRoot);
255
+ const dirPath = templatesDirectory(pmRoot);
256
+ if (!(await pathExists(dirPath))) {
257
+ return { templates: [], count: 0 };
258
+ }
259
+ const entries = await fs.readdir(dirPath);
260
+ const templates = entries
261
+ .filter((entry) => entry.toLowerCase().endsWith(TEMPLATE_FILE_EXTENSION))
262
+ .map((entry) => entry.slice(0, -TEMPLATE_FILE_EXTENSION.length))
263
+ .filter((entry) => TEMPLATE_NAME_PATTERN.test(entry))
264
+ .sort((left, right) => left.localeCompare(right));
265
+ return {
266
+ templates,
267
+ count: templates.length,
268
+ };
269
+ }
270
+
271
+ export async function runTemplatesShow(rawTemplateName: string, global: GlobalOptions): Promise<TemplatesShowResult> {
272
+ const pmRoot = resolvePmRoot(process.cwd(), global.path);
273
+ await ensureTrackerInitialized(pmRoot);
274
+ const normalizedName = normalizeTemplateName(rawTemplateName);
275
+ const stored = await readStoredTemplateDocument(pmRoot, normalizedName);
276
+ return {
277
+ name: stored.name,
278
+ created_at: stored.created_at,
279
+ updated_at: stored.updated_at,
280
+ path: templatePath(pmRoot, normalizedName),
281
+ options: stored.options,
282
+ };
283
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@unbrained/pm-templates",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "description": "First-party pm package for reusable create templates.",
7
+ "homepage": "https://github.com/unbraind/pm-cli/tree/main/packages/pm-templates#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/unbraind/pm-cli.git",
11
+ "directory": "packages/pm-templates"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/unbraind/pm-cli/issues"
15
+ },
16
+ "keywords": [
17
+ "pm-package",
18
+ "project-management",
19
+ "templates"
20
+ ],
21
+ "pm": {
22
+ "aliases": [
23
+ "templates"
24
+ ],
25
+ "extensions": [
26
+ "extensions/templates"
27
+ ],
28
+ "catalog": {
29
+ "display_name": "Create Templates",
30
+ "category": "workflow",
31
+ "summary": "Save, list, show, and apply reusable pm create option templates.",
32
+ "tags": [
33
+ "templates",
34
+ "create",
35
+ "workflow"
36
+ ],
37
+ "links": {
38
+ "docs": "https://github.com/unbraind/pm-cli/tree/main/packages/pm-templates#readme",
39
+ "repository": "https://github.com/unbraind/pm-cli/tree/main/packages/pm-templates",
40
+ "report": "https://github.com/unbraind/pm-cli/issues"
41
+ }
42
+ },
43
+ "docs": [
44
+ "README.md"
45
+ ],
46
+ "examples": [
47
+ "README.md"
48
+ ]
49
+ }
50
+ }