@unbrained/pm-cli 2026.5.14 → 2026.5.24

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 (436) hide show
  1. package/.claude-plugin/marketplace.json +4 -4
  2. package/AGENTS.md +78 -457
  3. package/CHANGELOG.md +71 -0
  4. package/CONTRIBUTING.md +1 -0
  5. package/README.md +8 -6
  6. package/dist/cli/argv-utils.js +4 -1
  7. package/dist/cli/argv-utils.js.map +1 -1
  8. package/dist/cli/bootstrap-args.js +4 -1
  9. package/dist/cli/bootstrap-args.js.map +1 -1
  10. package/dist/cli/commander-usage.js +19 -1
  11. package/dist/cli/commander-usage.js.map +1 -1
  12. package/dist/cli/commands/activity.js +4 -1
  13. package/dist/cli/commands/activity.js.map +1 -1
  14. package/dist/cli/commands/aggregate.js +5 -2
  15. package/dist/cli/commands/aggregate.js.map +1 -1
  16. package/dist/cli/commands/annotation-command.d.ts +49 -0
  17. package/dist/cli/commands/annotation-command.js +135 -0
  18. package/dist/cli/commands/annotation-command.js.map +1 -0
  19. package/dist/cli/commands/append.js +5 -6
  20. package/dist/cli/commands/append.js.map +1 -1
  21. package/dist/cli/commands/calendar.js +5 -5
  22. package/dist/cli/commands/calendar.js.map +1 -1
  23. package/dist/cli/commands/claim.d.ts +3 -0
  24. package/dist/cli/commands/claim.js +29 -23
  25. package/dist/cli/commands/claim.js.map +1 -1
  26. package/dist/cli/commands/close.js +63 -8
  27. package/dist/cli/commands/close.js.map +1 -1
  28. package/dist/cli/commands/comments-audit.js +4 -1
  29. package/dist/cli/commands/comments-audit.js.map +1 -1
  30. package/dist/cli/commands/comments.d.ts +5 -0
  31. package/dist/cli/commands/comments.js +29 -116
  32. package/dist/cli/commands/comments.js.map +1 -1
  33. package/dist/cli/commands/completion.js +198 -15
  34. package/dist/cli/commands/completion.js.map +1 -1
  35. package/dist/cli/commands/config.js +4 -1
  36. package/dist/cli/commands/config.js.map +1 -1
  37. package/dist/cli/commands/context.js +21 -13
  38. package/dist/cli/commands/context.js.map +1 -1
  39. package/dist/cli/commands/contracts.d.ts +9 -0
  40. package/dist/cli/commands/contracts.js +314 -64
  41. package/dist/cli/commands/contracts.js.map +1 -1
  42. package/dist/cli/commands/create.js +77 -48
  43. package/dist/cli/commands/create.js.map +1 -1
  44. package/dist/cli/commands/dedupe-audit.js +9 -3
  45. package/dist/cli/commands/dedupe-audit.js.map +1 -1
  46. package/dist/cli/commands/delete.d.ts +3 -0
  47. package/dist/cli/commands/delete.js +11 -7
  48. package/dist/cli/commands/delete.js.map +1 -1
  49. package/dist/cli/commands/deps.js +4 -1
  50. package/dist/cli/commands/deps.js.map +1 -1
  51. package/dist/cli/commands/docs.d.ts +1 -0
  52. package/dist/cli/commands/docs.js +6 -7
  53. package/dist/cli/commands/docs.js.map +1 -1
  54. package/dist/cli/commands/event-validation-messages.d.ts +3 -0
  55. package/dist/cli/commands/event-validation-messages.js +44 -0
  56. package/dist/cli/commands/event-validation-messages.js.map +1 -0
  57. package/dist/cli/commands/extension.d.ts +3 -1
  58. package/dist/cli/commands/extension.js +259 -52
  59. package/dist/cli/commands/extension.js.map +1 -1
  60. package/dist/cli/commands/files.js +8 -12
  61. package/dist/cli/commands/files.js.map +1 -1
  62. package/dist/cli/commands/gc.js +19 -3
  63. package/dist/cli/commands/gc.js.map +1 -1
  64. package/dist/cli/commands/get.d.ts +10 -5
  65. package/dist/cli/commands/get.js +135 -20
  66. package/dist/cli/commands/get.js.map +1 -1
  67. package/dist/cli/commands/guide.js +6 -8
  68. package/dist/cli/commands/guide.js.map +1 -1
  69. package/dist/cli/commands/health.d.ts +14 -0
  70. package/dist/cli/commands/health.js +269 -67
  71. package/dist/cli/commands/health.js.map +1 -1
  72. package/dist/cli/commands/history-redact.d.ts +50 -0
  73. package/dist/cli/commands/history-redact.js +476 -0
  74. package/dist/cli/commands/history-redact.js.map +1 -0
  75. package/dist/cli/commands/history-repair.d.ts +33 -0
  76. package/dist/cli/commands/history-repair.js +166 -0
  77. package/dist/cli/commands/history-repair.js.map +1 -0
  78. package/dist/cli/commands/history.d.ts +4 -0
  79. package/dist/cli/commands/history.js +12 -79
  80. package/dist/cli/commands/history.js.map +1 -1
  81. package/dist/cli/commands/index.d.ts +5 -1
  82. package/dist/cli/commands/index.js +9 -2
  83. package/dist/cli/commands/index.js.map +1 -1
  84. package/dist/cli/commands/init-agent-guidance.d.ts +31 -0
  85. package/dist/cli/commands/init-agent-guidance.js +336 -0
  86. package/dist/cli/commands/init-agent-guidance.js.map +1 -0
  87. package/dist/cli/commands/init.d.ts +42 -0
  88. package/dist/cli/commands/init.js +96 -1
  89. package/dist/cli/commands/init.js.map +1 -1
  90. package/dist/cli/commands/learnings.js +22 -118
  91. package/dist/cli/commands/learnings.js.map +1 -1
  92. package/dist/cli/commands/linked-test-entry.d.ts +3 -0
  93. package/dist/cli/commands/linked-test-entry.js +62 -0
  94. package/dist/cli/commands/linked-test-entry.js.map +1 -0
  95. package/dist/cli/commands/list.d.ts +1 -0
  96. package/dist/cli/commands/list.js +72 -38
  97. package/dist/cli/commands/list.js.map +1 -1
  98. package/dist/cli/commands/metadata-normalizers.js +4 -1
  99. package/dist/cli/commands/metadata-normalizers.js.map +1 -1
  100. package/dist/cli/commands/normalize.js +4 -1
  101. package/dist/cli/commands/normalize.js.map +1 -1
  102. package/dist/cli/commands/notes.js +22 -118
  103. package/dist/cli/commands/notes.js.map +1 -1
  104. package/dist/cli/commands/plan.d.ts +121 -0
  105. package/dist/cli/commands/plan.js +1137 -0
  106. package/dist/cli/commands/plan.js.map +1 -0
  107. package/dist/cli/commands/reindex.js +4 -1
  108. package/dist/cli/commands/reindex.js.map +1 -1
  109. package/dist/cli/commands/restore.js +9 -49
  110. package/dist/cli/commands/restore.js.map +1 -1
  111. package/dist/cli/commands/schema.d.ts +31 -0
  112. package/dist/cli/commands/schema.js +98 -0
  113. package/dist/cli/commands/schema.js.map +1 -0
  114. package/dist/cli/commands/search.js +156 -40
  115. package/dist/cli/commands/search.js.map +1 -1
  116. package/dist/cli/commands/stats.js +4 -1
  117. package/dist/cli/commands/stats.js.map +1 -1
  118. package/dist/cli/commands/templates.d.ts +4 -0
  119. package/dist/cli/commands/templates.js +91 -16
  120. package/dist/cli/commands/templates.js.map +1 -1
  121. package/dist/cli/commands/test-all.js +6 -7
  122. package/dist/cli/commands/test-all.js.map +1 -1
  123. package/dist/cli/commands/test-runs.js +4 -1
  124. package/dist/cli/commands/test-runs.js.map +1 -1
  125. package/dist/cli/commands/test.d.ts +1 -0
  126. package/dist/cli/commands/test.js +9 -9
  127. package/dist/cli/commands/test.js.map +1 -1
  128. package/dist/cli/commands/update-many.js +6 -7
  129. package/dist/cli/commands/update-many.js.map +1 -1
  130. package/dist/cli/commands/update.js +204 -103
  131. package/dist/cli/commands/update.js.map +1 -1
  132. package/dist/cli/commands/upgrade.js +6 -3
  133. package/dist/cli/commands/upgrade.js.map +1 -1
  134. package/dist/cli/commands/validate.d.ts +3 -1
  135. package/dist/cli/commands/validate.js +44 -64
  136. package/dist/cli/commands/validate.js.map +1 -1
  137. package/dist/cli/error-guidance.js +99 -6
  138. package/dist/cli/error-guidance.js.map +1 -1
  139. package/dist/cli/extension-command-help.d.ts +0 -1
  140. package/dist/cli/extension-command-help.js +4 -12
  141. package/dist/cli/extension-command-help.js.map +1 -1
  142. package/dist/cli/extension-command-options.d.ts +1 -0
  143. package/dist/cli/extension-command-options.js +108 -6
  144. package/dist/cli/extension-command-options.js.map +1 -1
  145. package/dist/cli/guide-topics.js +4 -1
  146. package/dist/cli/guide-topics.js.map +1 -1
  147. package/dist/cli/help-content.d.ts +0 -1
  148. package/dist/cli/help-content.js +46 -22
  149. package/dist/cli/help-content.js.map +1 -1
  150. package/dist/cli/help-json-payload.d.ts +1 -0
  151. package/dist/cli/help-json-payload.js +35 -2
  152. package/dist/cli/help-json-payload.js.map +1 -1
  153. package/dist/cli/main.js +214 -30
  154. package/dist/cli/main.js.map +1 -1
  155. package/dist/cli/migration-gates.js +4 -1
  156. package/dist/cli/migration-gates.js.map +1 -1
  157. package/dist/cli/register-list-query.d.ts +1 -1
  158. package/dist/cli/register-list-query.js +75 -29
  159. package/dist/cli/register-list-query.js.map +1 -1
  160. package/dist/cli/register-mutation.d.ts +1 -1
  161. package/dist/cli/register-mutation.js +430 -38
  162. package/dist/cli/register-mutation.js.map +1 -1
  163. package/dist/cli/register-operations.js +47 -10
  164. package/dist/cli/register-operations.js.map +1 -1
  165. package/dist/cli/register-setup.js +47 -25
  166. package/dist/cli/register-setup.js.map +1 -1
  167. package/dist/cli/registration-helpers.d.ts +0 -2
  168. package/dist/cli/registration-helpers.js +21 -40
  169. package/dist/cli/registration-helpers.js.map +1 -1
  170. package/dist/cli/shared-parsers.js +4 -1
  171. package/dist/cli/shared-parsers.js.map +1 -1
  172. package/dist/cli/telemetry-flush.js +4 -1
  173. package/dist/cli/telemetry-flush.js.map +1 -1
  174. package/dist/cli.js +65 -3
  175. package/dist/cli.js.map +1 -1
  176. package/dist/core/extensions/extension-types.js +4 -1
  177. package/dist/core/extensions/extension-types.js.map +1 -1
  178. package/dist/core/extensions/index.d.ts +0 -1
  179. package/dist/core/extensions/index.js +4 -13
  180. package/dist/core/extensions/index.js.map +1 -1
  181. package/dist/core/extensions/item-fields.js +4 -1
  182. package/dist/core/extensions/item-fields.js.map +1 -1
  183. package/dist/core/extensions/loader.js +78 -60
  184. package/dist/core/extensions/loader.js.map +1 -1
  185. package/dist/core/extensions/runtime-registrations.js +4 -1
  186. package/dist/core/extensions/runtime-registrations.js.map +1 -1
  187. package/dist/core/fs/fs-utils.js +4 -1
  188. package/dist/core/fs/fs-utils.js.map +1 -1
  189. package/dist/core/fs/index.js +4 -1
  190. package/dist/core/fs/index.js.map +1 -1
  191. package/dist/core/fs/path-utils.d.ts +1 -0
  192. package/dist/core/fs/path-utils.js +12 -0
  193. package/dist/core/fs/path-utils.js.map +1 -0
  194. package/dist/core/history/drift-scan.d.ts +11 -0
  195. package/dist/core/history/drift-scan.js +67 -0
  196. package/dist/core/history/drift-scan.js.map +1 -0
  197. package/dist/core/history/history-stream-policy.js +4 -1
  198. package/dist/core/history/history-stream-policy.js.map +1 -1
  199. package/dist/core/history/history.js +4 -1
  200. package/dist/core/history/history.js.map +1 -1
  201. package/dist/core/history/index.js +4 -1
  202. package/dist/core/history/index.js.map +1 -1
  203. package/dist/core/history/replay.d.ts +82 -0
  204. package/dist/core/history/replay.js +249 -0
  205. package/dist/core/history/replay.js.map +1 -0
  206. package/dist/core/item/id.js +4 -1
  207. package/dist/core/item/id.js.map +1 -1
  208. package/dist/core/item/index.js +4 -1
  209. package/dist/core/item/index.js.map +1 -1
  210. package/dist/core/item/item-format.js +250 -8
  211. package/dist/core/item/item-format.js.map +1 -1
  212. package/dist/core/item/item-type-definition.d.ts +52 -0
  213. package/dist/core/item/item-type-definition.js +123 -0
  214. package/dist/core/item/item-type-definition.js.map +1 -0
  215. package/dist/core/item/parent-reference-policy.js +4 -1
  216. package/dist/core/item/parent-reference-policy.js.map +1 -1
  217. package/dist/core/item/parse.js +34 -3
  218. package/dist/core/item/parse.js.map +1 -1
  219. package/dist/core/item/priority.d.ts +23 -0
  220. package/dist/core/item/priority.js +55 -0
  221. package/dist/core/item/priority.js.map +1 -0
  222. package/dist/core/item/sprint-release-format.js +4 -1
  223. package/dist/core/item/sprint-release-format.js.map +1 -1
  224. package/dist/core/item/status.d.ts +14 -1
  225. package/dist/core/item/status.js +24 -1
  226. package/dist/core/item/status.js.map +1 -1
  227. package/dist/core/item/toon-decode.d.ts +19 -0
  228. package/dist/core/item/toon-decode.js +69 -0
  229. package/dist/core/item/toon-decode.js.map +1 -0
  230. package/dist/core/item/type-registry.js +15 -83
  231. package/dist/core/item/type-registry.js.map +1 -1
  232. package/dist/core/lock/index.js +4 -1
  233. package/dist/core/lock/index.js.map +1 -1
  234. package/dist/core/lock/lock.js +4 -1
  235. package/dist/core/lock/lock.js.map +1 -1
  236. package/dist/core/output/output.d.ts +4 -0
  237. package/dist/core/output/output.js +47 -6
  238. package/dist/core/output/output.js.map +1 -1
  239. package/dist/core/packages/manifest.d.ts +1 -0
  240. package/dist/core/packages/manifest.js +6 -8
  241. package/dist/core/packages/manifest.js.map +1 -1
  242. package/dist/core/packages/root.d.ts +3 -0
  243. package/dist/core/packages/root.js +51 -0
  244. package/dist/core/packages/root.js.map +1 -0
  245. package/dist/core/schema/item-types-file.d.ts +85 -0
  246. package/dist/core/schema/item-types-file.js +243 -0
  247. package/dist/core/schema/item-types-file.js.map +1 -0
  248. package/dist/core/schema/runtime-field-filters.js +4 -1
  249. package/dist/core/schema/runtime-field-filters.js.map +1 -1
  250. package/dist/core/schema/runtime-field-values.js +4 -1
  251. package/dist/core/schema/runtime-field-values.js.map +1 -1
  252. package/dist/core/schema/runtime-schema.d.ts +2 -1
  253. package/dist/core/schema/runtime-schema.js +13 -8
  254. package/dist/core/schema/runtime-schema.js.map +1 -1
  255. package/dist/core/search/cache.js +7 -2
  256. package/dist/core/search/cache.js.map +1 -1
  257. package/dist/core/search/corpus.d.ts +2 -0
  258. package/dist/core/search/corpus.js +77 -2
  259. package/dist/core/search/corpus.js.map +1 -1
  260. package/dist/core/search/embedding-batches.js +21 -7
  261. package/dist/core/search/embedding-batches.js.map +1 -1
  262. package/dist/core/search/http-client.js +4 -1
  263. package/dist/core/search/http-client.js.map +1 -1
  264. package/dist/core/search/providers.js +4 -1
  265. package/dist/core/search/providers.js.map +1 -1
  266. package/dist/core/search/semantic-defaults.js +12 -3
  267. package/dist/core/search/semantic-defaults.js.map +1 -1
  268. package/dist/core/search/vector-stores.js +4 -1
  269. package/dist/core/search/vector-stores.js.map +1 -1
  270. package/dist/core/sentry/helpers.js +4 -1
  271. package/dist/core/sentry/helpers.js.map +1 -1
  272. package/dist/core/sentry/instrument.js +10 -13
  273. package/dist/core/sentry/instrument.js.map +1 -1
  274. package/dist/core/shared/author.d.ts +1 -0
  275. package/dist/core/shared/author.js +9 -0
  276. package/dist/core/shared/author.js.map +1 -0
  277. package/dist/core/shared/command-types.js +4 -1
  278. package/dist/core/shared/command-types.js.map +1 -1
  279. package/dist/core/shared/conflict-markers.js +4 -1
  280. package/dist/core/shared/conflict-markers.js.map +1 -1
  281. package/dist/core/shared/constants.d.ts +2 -2
  282. package/dist/core/shared/constants.js +24 -1
  283. package/dist/core/shared/constants.js.map +1 -1
  284. package/dist/core/shared/errors.js +4 -1
  285. package/dist/core/shared/errors.js.map +1 -1
  286. package/dist/core/shared/index.js +4 -1
  287. package/dist/core/shared/index.js.map +1 -1
  288. package/dist/core/shared/lazy-module.d.ts +1 -0
  289. package/dist/core/shared/lazy-module.js +11 -0
  290. package/dist/core/shared/lazy-module.js.map +1 -0
  291. package/dist/core/shared/levenshtein.js +4 -1
  292. package/dist/core/shared/levenshtein.js.map +1 -1
  293. package/dist/core/shared/option-alias-visibility.d.ts +44 -0
  294. package/dist/core/shared/option-alias-visibility.js +76 -0
  295. package/dist/core/shared/option-alias-visibility.js.map +1 -0
  296. package/dist/core/shared/primitives.js +4 -1
  297. package/dist/core/shared/primitives.js.map +1 -1
  298. package/dist/core/shared/serialization.js +4 -1
  299. package/dist/core/shared/serialization.js.map +1 -1
  300. package/dist/core/shared/text-normalization.d.ts +0 -1
  301. package/dist/core/shared/text-normalization.js +4 -4
  302. package/dist/core/shared/text-normalization.js.map +1 -1
  303. package/dist/core/shared/time.js +4 -1
  304. package/dist/core/shared/time.js.map +1 -1
  305. package/dist/core/store/front-matter-cache.js +8 -3
  306. package/dist/core/store/front-matter-cache.js.map +1 -1
  307. package/dist/core/store/index.js +4 -1
  308. package/dist/core/store/index.js.map +1 -1
  309. package/dist/core/store/item-format-migration.js +4 -1
  310. package/dist/core/store/item-format-migration.js.map +1 -1
  311. package/dist/core/store/item-store.d.ts +4 -0
  312. package/dist/core/store/item-store.js +133 -39
  313. package/dist/core/store/item-store.js.map +1 -1
  314. package/dist/core/store/paths.js +4 -1
  315. package/dist/core/store/paths.js.map +1 -1
  316. package/dist/core/store/settings-validator.d.ts +106 -0
  317. package/dist/core/store/settings-validator.js +279 -0
  318. package/dist/core/store/settings-validator.js.map +1 -0
  319. package/dist/core/store/settings.js +32 -331
  320. package/dist/core/store/settings.js.map +1 -1
  321. package/dist/core/telemetry/consent.js +4 -1
  322. package/dist/core/telemetry/consent.js.map +1 -1
  323. package/dist/core/telemetry/observability.d.ts +1 -1
  324. package/dist/core/telemetry/observability.js +11 -2
  325. package/dist/core/telemetry/observability.js.map +1 -1
  326. package/dist/core/telemetry/runtime.js +34 -6
  327. package/dist/core/telemetry/runtime.js.map +1 -1
  328. package/dist/core/test/background-runs.js +4 -1
  329. package/dist/core/test/background-runs.js.map +1 -1
  330. package/dist/core/test/item-test-run-tracking.js +4 -1
  331. package/dist/core/test/item-test-run-tracking.js.map +1 -1
  332. package/dist/mcp/server.js +182 -22
  333. package/dist/mcp/server.js.map +1 -1
  334. package/dist/sdk/cli-contracts/commander-mutation-options.js +10 -3
  335. package/dist/sdk/cli-contracts/commander-mutation-options.js.map +1 -1
  336. package/dist/sdk/cli-contracts/commander-types.js +4 -1
  337. package/dist/sdk/cli-contracts/commander-types.js.map +1 -1
  338. package/dist/sdk/cli-contracts.d.ts +13 -2
  339. package/dist/sdk/cli-contracts.js +410 -26
  340. package/dist/sdk/cli-contracts.js.map +1 -1
  341. package/dist/sdk/index.js +4 -1
  342. package/dist/sdk/index.js.map +1 -1
  343. package/dist/sdk/runtime.d.ts +25 -1
  344. package/dist/sdk/runtime.js +48 -2
  345. package/dist/sdk/runtime.js.map +1 -1
  346. package/dist/types/index.js +4 -1
  347. package/dist/types/index.js.map +1 -1
  348. package/dist/types.d.ts +92 -2
  349. package/dist/types.js +42 -1
  350. package/dist/types.js.map +1 -1
  351. package/docs/AGENT_GUIDE.md +23 -7
  352. package/docs/ARCHITECTURE.md +1 -1
  353. package/docs/CLAUDE_CODE_PLUGIN.md +10 -10
  354. package/docs/CODEX_PLUGIN.md +2 -2
  355. package/docs/COMMANDS.md +117 -12
  356. package/docs/CONFIGURATION.md +5 -2
  357. package/docs/EXTENSIONS.md +158 -814
  358. package/docs/QUICKSTART.md +11 -5
  359. package/docs/README.md +7 -6
  360. package/docs/RELEASING.md +13 -9
  361. package/docs/SDK.md +11 -2
  362. package/docs/TESTING.md +2 -2
  363. package/marketplace.json +3 -3
  364. package/package.json +15 -12
  365. package/packages/pm-beads/package.json +1 -1
  366. package/packages/pm-calendar/README.md +4 -2
  367. package/packages/pm-calendar/extensions/calendar/index.js +22 -3
  368. package/packages/pm-calendar/extensions/calendar/index.ts +22 -3
  369. package/packages/pm-calendar/extensions/calendar/runtime.js +26 -7
  370. package/packages/pm-calendar/extensions/calendar/runtime.ts +26 -7
  371. package/packages/pm-calendar/package.json +1 -1
  372. package/packages/pm-governance-audit/package.json +1 -1
  373. package/packages/pm-guide-shell/extensions/guide-shell/index.js +1 -1
  374. package/packages/pm-guide-shell/extensions/guide-shell/index.ts +1 -1
  375. package/packages/pm-guide-shell/package.json +1 -1
  376. package/packages/pm-linked-test-adapters/package.json +1 -1
  377. package/packages/pm-search-advanced/README.md +8 -0
  378. package/packages/pm-search-advanced/extensions/search-advanced/index.js +74 -0
  379. package/packages/pm-search-advanced/extensions/search-advanced/index.ts +75 -1
  380. package/packages/pm-search-advanced/extensions/search-advanced/runtime.js +67 -9
  381. package/packages/pm-search-advanced/extensions/search-advanced/runtime.ts +67 -9
  382. package/packages/pm-search-advanced/package.json +1 -1
  383. package/packages/pm-templates/README.md +1 -1
  384. package/packages/pm-templates/extensions/templates/runtime.js +11 -202
  385. package/packages/pm-templates/extensions/templates/runtime.ts +38 -230
  386. package/packages/pm-templates/package.json +1 -1
  387. package/packages/pm-todos/package.json +1 -1
  388. package/plugins/{pm-cli-claude → pm-claude}/.claude-plugin/plugin.json +2 -2
  389. package/plugins/{pm-cli-claude → pm-claude}/.mcp.json +1 -1
  390. package/plugins/{pm-cli-claude → pm-claude}/README.md +4 -4
  391. package/plugins/{pm-cli-claude → pm-claude}/agents/pm-coordinator.md +1 -1
  392. package/plugins/{pm-cli-claude → pm-claude}/commands/pm-init.md +10 -1
  393. package/plugins/{pm-cli-claude → pm-claude}/commands/pm-planner.md +18 -0
  394. package/plugins/{pm-cli-claude → pm-claude}/skills/pm-planner/SKILL.md +46 -1
  395. package/plugins/{pm-cli-codex → pm-codex}/.codex-plugin/plugin.json +3 -3
  396. package/plugins/{pm-cli-codex → pm-codex}/.mcp.json +1 -1
  397. package/plugins/{pm-cli-codex → pm-codex}/README.md +7 -4
  398. package/plugins/pm-codex/skills/pm-native/SKILL.md +81 -0
  399. package/scripts/finalize-build.mjs +28 -0
  400. package/scripts/prepare-build-cache.mjs +37 -0
  401. package/dist/core/output/command-aware.d.ts +0 -1
  402. package/dist/core/output/command-aware.js +0 -394
  403. package/dist/core/output/command-aware.js.map +0 -1
  404. package/plugins/pm-cli-codex/skills/pm-native/SKILL.md +0 -57
  405. /package/plugins/{pm-cli-claude → pm-claude}/agents/pm-delivery-chain.md +0 -0
  406. /package/plugins/{pm-cli-claude → pm-claude}/agents/pm-triage-agent.md +0 -0
  407. /package/plugins/{pm-cli-claude → pm-claude}/agents/pm-verification-agent.md +0 -0
  408. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-audit.md +0 -0
  409. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-calendar.md +0 -0
  410. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-close-task.md +0 -0
  411. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-developer.md +0 -0
  412. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-list.md +0 -0
  413. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-new.md +0 -0
  414. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-release.md +0 -0
  415. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-search.md +0 -0
  416. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-start-task.md +0 -0
  417. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-status.md +0 -0
  418. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-triage.md +0 -0
  419. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-workflow.md +0 -0
  420. /package/plugins/{pm-cli-claude → pm-claude}/hooks/hooks.json +0 -0
  421. /package/plugins/{pm-cli-claude → pm-claude}/hooks/session-start.mjs +0 -0
  422. /package/plugins/{pm-cli-claude → pm-claude}/scripts/pm-mcp-server.mjs +0 -0
  423. /package/plugins/{pm-cli-claude → pm-claude}/skills/pm-audit/SKILL.md +0 -0
  424. /package/plugins/{pm-cli-claude → pm-claude}/skills/pm-developer/SKILL.md +0 -0
  425. /package/plugins/{pm-cli-claude → pm-claude}/skills/pm-release/SKILL.md +0 -0
  426. /package/plugins/{pm-cli-claude → pm-claude}/skills/pm-workflow/SKILL.md +0 -0
  427. /package/plugins/{pm-cli-codex → pm-codex}/assets/pm-cli-small.svg +0 -0
  428. /package/plugins/{pm-cli-codex → pm-codex}/commands/pm-audit.md +0 -0
  429. /package/plugins/{pm-cli-codex → pm-codex}/commands/pm-close-task.md +0 -0
  430. /package/plugins/{pm-cli-codex → pm-codex}/commands/pm-start-task.md +0 -0
  431. /package/plugins/{pm-cli-codex → pm-codex}/scripts/pm-mcp-server.mjs +0 -0
  432. /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-auditor/SKILL.md +0 -0
  433. /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-auditor/agents/openai.yaml +0 -0
  434. /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-native/agents/openai.yaml +0 -0
  435. /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-release/SKILL.md +0 -0
  436. /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-release/agents/openai.yaml +0 -0
@@ -1,12 +1,14 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="478936e5-660a-5f89-b15d-93b37468c7ed")}catch(e){}}();
1
3
  import { EXIT_CODE, SETTINGS_DEFAULTS } from "../../core/shared/constants.js";
2
4
  import { PmCliError } from "../../core/shared/errors.js";
3
- import { activateExtensions, getActiveExtensionRegistrations, loadExtensions } from "../../core/extensions/index.js";
5
+ import { activateExtensions, getActiveExtensionRegistrations, loadExtensions, } from "../../core/extensions/index.js";
4
6
  import { pathExists } from "../../core/fs/fs-utils.js";
5
- import { commandOptionFlagLabel, resolveCommandOptionPolicyState, resolveItemTypeRegistry } from "../../core/item/type-registry.js";
7
+ import { commandOptionFlagLabel, resolveCommandOptionPolicyState, resolveItemTypeRegistry, } from "../../core/item/type-registry.js";
6
8
  import { resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, } from "../../core/schema/runtime-schema.js";
7
9
  import { getSettingsPath, resolvePmRoot } from "../../core/store/paths.js";
8
10
  import { readSettings } from "../../core/store/settings.js";
9
- import { ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS, ACTIVITY_FLAG_CONTRACTS, AGGREGATE_FLAG_CONTRACTS, APPEND_FLAG_CONTRACTS, CALENDAR_COMMANDER_STRING_OPTION_CONTRACTS, CALENDAR_FLAG_CONTRACTS, CLAIM_FLAG_CONTRACTS, CLOSE_TASK_FLAG_CONTRACTS, COMMENTS_FLAG_CONTRACTS, COMMENTS_AUDIT_FLAG_CONTRACTS, CLOSE_FLAG_CONTRACTS, COMPLETION_FLAG_CONTRACTS, CONFIG_FLAG_CONTRACTS, CONTRACTS_FLAG_CONTRACTS, CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS, CONTEXT_FLAG_CONTRACTS, CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, CREATE_COMMANDER_STRING_OPTION_CONTRACTS, CREATE_FLAG_CONTRACTS, DELETE_FLAG_CONTRACTS, DEPS_FLAG_CONTRACTS, DEDUPE_AUDIT_FLAG_CONTRACTS, DOCS_FLAG_CONTRACTS, EXTENSION_FLAG_CONTRACTS, FILES_FLAG_CONTRACTS, GC_FLAG_CONTRACTS, GUIDE_FLAG_CONTRACTS, GLOBAL_FLAG_CONTRACTS, HEALTH_FLAG_CONTRACTS, HISTORY_FLAG_CONTRACTS, LEARNINGS_FLAG_CONTRACTS, LIST_COMMANDER_STRING_OPTION_CONTRACTS, LIST_FILTER_FLAG_CONTRACTS, NORMALIZE_FLAG_CONTRACTS, NOTES_FLAG_CONTRACTS, PM_EXTENSION_CAPABILITY_CONTRACTS, PM_EXTENSION_POLICY_MODE_CONTRACTS, PM_EXTENSION_POLICY_SURFACE_CONTRACTS, PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS, PM_EXTENSION_SERVICE_NAME_CONTRACTS, PM_EXTENSION_TRUST_MODE_CONTRACTS, PM_CORE_COMMAND_NAMES, PM_TOOL_ACTIONS, PM_TOOL_PARAMETERS_SCHEMA, REINDEX_FLAG_CONTRACTS, RELEASE_FLAG_CONTRACTS, RESTORE_FLAG_CONTRACTS, SEARCH_COMMANDER_STRING_OPTION_CONTRACTS, SEARCH_FLAG_CONTRACTS, START_TASK_FLAG_CONTRACTS, PAUSE_TASK_FLAG_CONTRACTS, TEST_ALL_FLAG_CONTRACTS, TEST_FLAG_CONTRACTS, TEST_RUNS_FLAG_CONTRACTS, UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, UPDATE_COMMANDER_STRING_OPTION_CONTRACTS, UPDATE_FLAG_CONTRACTS, UPDATE_MANY_FLAG_CONTRACTS, UPGRADE_FLAG_CONTRACTS, VALIDATE_FLAG_CONTRACTS, compactFlagAliasContracts, } from "../../sdk/cli-contracts.js";
11
+ import { ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS, ACTIVITY_FLAG_CONTRACTS, AGGREGATE_FLAG_CONTRACTS, APPEND_FLAG_CONTRACTS, CALENDAR_COMMANDER_STRING_OPTION_CONTRACTS, CALENDAR_FLAG_CONTRACTS, CLAIM_FLAG_CONTRACTS, CLOSE_TASK_FLAG_CONTRACTS, COMMENTS_FLAG_CONTRACTS, COMMENTS_AUDIT_FLAG_CONTRACTS, CLOSE_FLAG_CONTRACTS, COMPLETION_FLAG_CONTRACTS, CONFIG_FLAG_CONTRACTS, CONTRACTS_FLAG_CONTRACTS, CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS, CONTEXT_FLAG_CONTRACTS, CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, CREATE_COMMANDER_STRING_OPTION_CONTRACTS, CREATE_FLAG_CONTRACTS, DELETE_FLAG_CONTRACTS, DEPS_FLAG_CONTRACTS, DEDUPE_AUDIT_FLAG_CONTRACTS, DOCS_FLAG_CONTRACTS, EXTENSION_FLAG_CONTRACTS, FILES_FLAG_CONTRACTS, GC_FLAG_CONTRACTS, GET_FLAG_CONTRACTS, GUIDE_FLAG_CONTRACTS, GLOBAL_FLAG_CONTRACTS, HEALTH_FLAG_CONTRACTS, HISTORY_FLAG_CONTRACTS, HISTORY_REDACT_FLAG_CONTRACTS, HISTORY_REPAIR_FLAG_CONTRACTS, INSTALL_FLAG_CONTRACTS, INIT_FLAG_CONTRACTS, LEARNINGS_FLAG_CONTRACTS, LIST_COMMANDER_STRING_OPTION_CONTRACTS, LIST_FILTER_FLAG_CONTRACTS, NORMALIZE_FLAG_CONTRACTS, NOTES_FLAG_CONTRACTS, PM_EXTENSION_CAPABILITY_CONTRACTS, PM_EXTENSION_POLICY_MODE_CONTRACTS, PM_EXTENSION_POLICY_SURFACE_CONTRACTS, PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS, PM_EXTENSION_SERVICE_NAME_CONTRACTS, PM_EXTENSION_TRUST_MODE_CONTRACTS, PLAN_FLAG_CONTRACTS, PM_CORE_COMMAND_NAMES, PM_TOOL_ACTIONS, PM_TOOL_PARAMETERS_SCHEMA, REINDEX_FLAG_CONTRACTS, RELEASE_FLAG_CONTRACTS, RESTORE_FLAG_CONTRACTS, SCHEMA_FLAG_CONTRACTS, SEARCH_COMMANDER_STRING_OPTION_CONTRACTS, SEARCH_FLAG_CONTRACTS, START_TASK_FLAG_CONTRACTS, PAUSE_TASK_FLAG_CONTRACTS, TEST_ALL_FLAG_CONTRACTS, TEST_FLAG_CONTRACTS, TEST_RUNS_FLAG_CONTRACTS, UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, UPDATE_COMMANDER_STRING_OPTION_CONTRACTS, UPDATE_FLAG_CONTRACTS, UPDATE_MANY_FLAG_CONTRACTS, UPGRADE_FLAG_CONTRACTS, VALIDATE_FLAG_CONTRACTS, compactFlagAliasContracts, } from "../../sdk/cli-contracts.js";
10
12
  const LIST_COMMAND_NAMES = new Set([
11
13
  "list",
12
14
  "list-all",
@@ -55,6 +57,38 @@ const PACKAGE_OWNED_COMMANDS = new Set([
55
57
  "test-runs stop",
56
58
  "test-runs resume",
57
59
  ]);
60
+ const PACKAGE_OWNED_COMMAND_INSTALL_HINTS = new Map([
61
+ ["cal", "calendar"],
62
+ ["calendar", "calendar"],
63
+ ["comments-audit", "governance-audit"],
64
+ ["completion", "guide-shell"],
65
+ ["completion-tags", "guide-shell"],
66
+ ["dedupe-audit", "governance-audit"],
67
+ ["guide", "guide-shell"],
68
+ ["normalize", "governance-audit"],
69
+ ["reindex", "search-advanced"],
70
+ ["templates", "templates"],
71
+ ["templates list", "templates"],
72
+ ["templates save", "templates"],
73
+ ["templates show", "templates"],
74
+ ["test-runs", "linked-test-adapters"],
75
+ ["test-runs list", "linked-test-adapters"],
76
+ ["test-runs status", "linked-test-adapters"],
77
+ ["test-runs logs", "linked-test-adapters"],
78
+ ["test-runs stop", "linked-test-adapters"],
79
+ ["test-runs resume", "linked-test-adapters"],
80
+ ]);
81
+ const CANONICAL_COMMAND_ALIASES = [
82
+ {
83
+ canonical: "context",
84
+ aliases: ["ctx"],
85
+ },
86
+ {
87
+ canonical: "package",
88
+ aliases: ["extension", "packages", "install"],
89
+ },
90
+ ];
91
+ const COMMAND_ALIAS_TO_CANONICAL = new Map(CANONICAL_COMMAND_ALIASES.flatMap((entry) => entry.aliases.map((alias) => [alias, entry.canonical])));
58
92
  function resolveActionCommandPath(action) {
59
93
  if (PM_CORE_COMMAND_NAMES.includes(action)) {
60
94
  return normalizeCommandPath(action);
@@ -77,11 +111,18 @@ function actionDescriptorMatchesSelectedCommand(descriptor, selectedCommand) {
77
111
  if (descriptor.command_path === null) {
78
112
  return false;
79
113
  }
80
- const commandPath = normalizeCommandPath(descriptor.command_path);
81
- if (commandPath === selectedCommand) {
82
- return true;
83
- }
84
- return commandPath.startsWith(`${selectedCommand} `);
114
+ return splitCommandPathAliases(descriptor.command_path).some((commandPath) => {
115
+ if (commandPath === selectedCommand) {
116
+ return true;
117
+ }
118
+ return commandPath.startsWith(`${selectedCommand} `);
119
+ });
120
+ }
121
+ function splitCommandPathAliases(commandPath) {
122
+ return commandPath
123
+ .split("|")
124
+ .map((entry) => normalizeCommandPath(entry))
125
+ .filter((entry) => entry.length > 0);
85
126
  }
86
127
  function resolveScopedCommandsFromActionDescriptors(descriptors, commandCatalog) {
87
128
  const commandSet = new Set(commandCatalog);
@@ -90,18 +131,19 @@ function resolveScopedCommandsFromActionDescriptors(descriptors, commandCatalog)
90
131
  if (!descriptor.command_path) {
91
132
  continue;
92
133
  }
93
- const commandPath = normalizeCommandPath(descriptor.command_path);
94
- const tokens = commandPath.split(" ").filter((entry) => entry.length > 0);
95
- if (tokens.length === 0) {
96
- continue;
97
- }
98
- for (let end = tokens.length; end > 0; end -= 1) {
99
- const candidate = tokens.slice(0, end).join(" ");
100
- if (!commandSet.has(candidate)) {
134
+ for (const commandPath of splitCommandPathAliases(descriptor.command_path)) {
135
+ const tokens = commandPath.split(" ").filter((entry) => entry.length > 0);
136
+ if (tokens.length === 0) {
101
137
  continue;
102
138
  }
103
- scoped.add(candidate);
104
- break;
139
+ for (let end = tokens.length; end > 0; end -= 1) {
140
+ const candidate = tokens.slice(0, end).join(" ");
141
+ if (!commandSet.has(candidate)) {
142
+ continue;
143
+ }
144
+ scoped.add(candidate);
145
+ break;
146
+ }
105
147
  }
106
148
  }
107
149
  return [...scoped].sort((left, right) => left.localeCompare(right));
@@ -197,8 +239,12 @@ function normalizeStringList(values) {
197
239
  function toExtensionFlagContract(definition) {
198
240
  const longName = toOptionalTrimmedString(definition.long);
199
241
  const shortName = toOptionalTrimmedString(definition.short);
200
- const normalizedLong = longName && longName.startsWith("--") && longName.length > 2 ? longName : null;
201
- const normalizedShort = shortName && shortName.startsWith("-") && !shortName.startsWith("--") ? shortName : null;
242
+ const normalizedLong = longName && longName.startsWith("--") && longName.length > 2
243
+ ? longName
244
+ : null;
245
+ const normalizedShort = shortName && shortName.startsWith("-") && !shortName.startsWith("--")
246
+ ? shortName
247
+ : null;
202
248
  const flag = normalizedLong ?? normalizedShort;
203
249
  if (!flag) {
204
250
  return null;
@@ -207,6 +253,28 @@ function toExtensionFlagContract(definition) {
207
253
  if (normalizedShort && normalizedLong) {
208
254
  contract.short = normalizedShort;
209
255
  }
256
+ const description = toOptionalTrimmedString(definition.description);
257
+ if (description) {
258
+ contract.description = description;
259
+ }
260
+ if (definition.required === true) {
261
+ contract.required = true;
262
+ }
263
+ if (definition.repeatable === true) {
264
+ contract.repeatable = true;
265
+ }
266
+ const valueName = toOptionalTrimmedString(definition.value_name);
267
+ if (valueName) {
268
+ contract.value_name = valueName;
269
+ }
270
+ const rawValueType = [
271
+ toOptionalTrimmedString(definition.value_type),
272
+ toOptionalTrimmedString(definition.type),
273
+ valueName ? "string" : null,
274
+ ].find((candidate) => candidate === "string" || candidate === "number" || candidate === "boolean");
275
+ if (rawValueType) {
276
+ contract.value_type = rawValueType;
277
+ }
210
278
  return contract;
211
279
  }
212
280
  function collectExtensionFlagContractsByCommand(registrations) {
@@ -253,7 +321,7 @@ function collectExtensionFlagContractsByCommand(registrations) {
253
321
  if (layerOrder !== 0) {
254
322
  return layerOrder;
255
323
  }
256
- return left.name.localeCompare(right.name);
324
+ return (left.name ?? "").localeCompare(right.name ?? "");
257
325
  }),
258
326
  });
259
327
  }
@@ -267,7 +335,8 @@ function collectExtensionCommandContracts(runtimeProbe) {
267
335
  if (command.length === 0) {
268
336
  continue;
269
337
  }
270
- const action = toOptionalTrimmedString(definition.action) ?? normalizeActionNameFromCommand(command);
338
+ const action = toOptionalTrimmedString(definition.action) ??
339
+ normalizeActionNameFromCommand(command);
271
340
  const args = Array.isArray(definition.arguments)
272
341
  ? definition.arguments
273
342
  .map((argument) => {
@@ -315,7 +384,9 @@ function collectExtensionCommandContracts(runtimeProbe) {
315
384
  if (definition) {
316
385
  contracts.push({
317
386
  ...definition,
318
- flags: definition.flags.length > 0 ? definition.flags : flagsByCommand.get(command)?.flags ?? [],
387
+ flags: definition.flags.length > 0
388
+ ? definition.flags
389
+ : (flagsByCommand.get(command)?.flags ?? []),
319
390
  });
320
391
  continue;
321
392
  }
@@ -343,11 +414,17 @@ function extensionSchemaPropertyNameFromFlag(flag) {
343
414
  return cleaned.length > 0 ? cleaned : null;
344
415
  }
345
416
  function buildExtensionActionSchemaBranch(contract) {
417
+ const commands = contract.command
418
+ .split("|")
419
+ .map((command) => command.trim())
420
+ .filter((command) => command.length > 0);
346
421
  const properties = {
347
422
  action: {
348
423
  type: "string",
349
424
  const: contract.action,
350
- description: contract.intent ?? contract.description ?? `Invoke extension command '${contract.command}'.`,
425
+ description: contract.intent ??
426
+ contract.description ??
427
+ `Invoke extension command '${contract.command}'.`,
351
428
  },
352
429
  };
353
430
  const required = ["action"];
@@ -356,13 +433,15 @@ function buildExtensionActionSchemaBranch(contract) {
356
433
  properties[argument.name] = {
357
434
  type: "array",
358
435
  items: { type: "string" },
359
- description: argument.description ?? `Variadic argument '${argument.name}' for extension action '${contract.action}'.`,
436
+ description: argument.description ??
437
+ `Variadic argument '${argument.name}' for extension action '${contract.action}'.`,
360
438
  };
361
439
  }
362
440
  else {
363
441
  properties[argument.name] = {
364
442
  type: "string",
365
- description: argument.description ?? `Argument '${argument.name}' for extension action '${contract.action}'.`,
443
+ description: argument.description ??
444
+ `Argument '${argument.name}' for extension action '${contract.action}'.`,
366
445
  };
367
446
  }
368
447
  if (argument.required) {
@@ -374,11 +453,16 @@ function buildExtensionActionSchemaBranch(contract) {
374
453
  if (!propertyName || properties[propertyName] !== undefined) {
375
454
  continue;
376
455
  }
377
- const isBooleanFlag = !flag.flag.includes(" ");
456
+ const valueType = flag.value_type ?? "boolean";
457
+ const schemaType = valueType === "boolean" ? "boolean" : valueType === "number" ? ["number", "string"] : "string";
378
458
  properties[propertyName] = {
379
- type: isBooleanFlag ? ["boolean", "string"] : "string",
380
- description: `Extension option '${flag.flag}' for action '${contract.action}'.`,
459
+ type: flag.repeatable ? "array" : schemaType,
460
+ ...(flag.repeatable ? { items: { type: schemaType } } : {}),
461
+ description: flag.description ?? `Extension option '${flag.flag}' for action '${contract.action}'.`,
381
462
  };
463
+ if (flag.required === true) {
464
+ required.push(propertyName);
465
+ }
382
466
  }
383
467
  return {
384
468
  type: "object",
@@ -386,9 +470,57 @@ function buildExtensionActionSchemaBranch(contract) {
386
470
  required,
387
471
  additionalProperties: true,
388
472
  "x-extension-source": contract.source,
389
- "x-extension-command": contract.command,
473
+ "x-extension-command": commands[0] ?? contract.command,
474
+ "x-extension-commands": commands,
390
475
  };
391
476
  }
477
+ function mergeExtensionFlagContract(existing, incoming) {
478
+ existing.description ??= incoming.description;
479
+ existing.value_name ??= incoming.value_name;
480
+ existing.value_type ??= incoming.value_type;
481
+ if (incoming.required === true) {
482
+ existing.required = true;
483
+ }
484
+ if (incoming.repeatable === true) {
485
+ existing.repeatable = true;
486
+ }
487
+ }
488
+ function mergeExtensionContractsByAction(contracts) {
489
+ const byAction = new Map();
490
+ for (const contract of contracts) {
491
+ const existing = byAction.get(contract.action);
492
+ if (!existing) {
493
+ byAction.set(contract.action, {
494
+ ...contract,
495
+ flags: [...contract.flags],
496
+ examples: [...contract.examples],
497
+ failure_hints: [...contract.failure_hints],
498
+ });
499
+ continue;
500
+ }
501
+ existing.command = [...new Set([existing.command, contract.command])]
502
+ .sort((left, right) => left.localeCompare(right))
503
+ .join("|");
504
+ existing.arguments = existing.arguments.length >= contract.arguments.length ? existing.arguments : contract.arguments;
505
+ const flagKeys = new Set(existing.flags.map((flag) => `${flag.flag}|${flag.short ?? ""}`));
506
+ for (const flag of contract.flags) {
507
+ const key = `${flag.flag}|${flag.short ?? ""}`;
508
+ if (!flagKeys.has(key)) {
509
+ flagKeys.add(key);
510
+ existing.flags.push(flag);
511
+ }
512
+ else {
513
+ const existingFlag = existing.flags.find((candidate) => `${candidate.flag}|${candidate.short ?? ""}` === key);
514
+ if (existingFlag) {
515
+ mergeExtensionFlagContract(existingFlag, flag);
516
+ }
517
+ }
518
+ }
519
+ existing.examples = [...new Set([...existing.examples, ...contract.examples])];
520
+ existing.failure_hints = [...new Set([...existing.failure_hints, ...contract.failure_hints])];
521
+ }
522
+ return [...byAction.values()].sort((left, right) => left.action.localeCompare(right.action));
523
+ }
392
524
  async function resolveRuntimeExtensionActionProbe(global) {
393
525
  const defaultPolicyState = {
394
526
  mode: SETTINGS_DEFAULTS.extensions.policy.mode,
@@ -401,6 +533,7 @@ async function resolveRuntimeExtensionActionProbe(global) {
401
533
  disabledReason: "extensions_disabled",
402
534
  commandDefinitions: [],
403
535
  flagRegistrations: [],
536
+ registrations: null,
404
537
  policyState: defaultPolicyState,
405
538
  };
406
539
  }
@@ -411,6 +544,7 @@ async function resolveRuntimeExtensionActionProbe(global) {
411
544
  disabledReason: null,
412
545
  commandDefinitions: [],
413
546
  flagRegistrations: [],
547
+ registrations: null,
414
548
  policyState: defaultPolicyState,
415
549
  };
416
550
  }
@@ -432,6 +566,7 @@ async function resolveRuntimeExtensionActionProbe(global) {
432
566
  disabledReason: null,
433
567
  commandDefinitions: activationResult.registrations.commands,
434
568
  flagRegistrations: activationResult.registrations.flags,
569
+ registrations: activationResult.registrations,
435
570
  policyState: {
436
571
  mode: loadResult.policy.mode,
437
572
  trust_mode: loadResult.policy.trust_mode,
@@ -445,6 +580,7 @@ async function resolveRuntimeExtensionActionProbe(global) {
445
580
  disabledReason: "extension_runtime_probe_failed",
446
581
  commandDefinitions: [],
447
582
  flagRegistrations: [],
583
+ registrations: null,
448
584
  policyState: defaultPolicyState,
449
585
  };
450
586
  }
@@ -474,7 +610,7 @@ function collectActionContractDescriptors(extensionContracts) {
474
610
  command_path: normalizeCommandPath(contract.command),
475
611
  });
476
612
  }
477
- return [...descriptors.values()].sort((left, right) => left.action.localeCompare(right.action));
613
+ return [...descriptors.values()].sort((left, right) => (left.action ?? "").localeCompare(right.action ?? ""));
478
614
  }
479
615
  function resolveActionAvailability(descriptor, runtimeProbe) {
480
616
  if (descriptor.provider === "core" && !descriptor.requires_extension) {
@@ -489,8 +625,10 @@ function resolveActionAvailability(descriptor, runtimeProbe) {
489
625
  cli_exposed: descriptor.command_path !== null,
490
626
  };
491
627
  }
492
- const commandPath = descriptor.command_path ? normalizeCommandPath(descriptor.command_path) : "";
493
- const extensionCommandAvailable = commandPath.length > 0 && runtimeProbe.handlers.has(commandPath);
628
+ const commandPaths = descriptor.command_path
629
+ ? splitCommandPathAliases(descriptor.command_path)
630
+ : [];
631
+ const extensionCommandAvailable = commandPaths.some((commandPath) => runtimeProbe.handlers.has(commandPath));
494
632
  const invocable = runtimeProbe.disabledReason === null && extensionCommandAvailable;
495
633
  return {
496
634
  action: descriptor.action,
@@ -498,7 +636,9 @@ function resolveActionAvailability(descriptor, runtimeProbe) {
498
636
  available: invocable,
499
637
  requires_extension: true,
500
638
  provider: "extension",
501
- disabled_reason: invocable ? null : runtimeProbe.disabledReason ?? "extension_command_not_registered",
639
+ disabled_reason: invocable
640
+ ? null
641
+ : (runtimeProbe.disabledReason ?? "extension_command_not_registered"),
502
642
  command_path: descriptor.command_path,
503
643
  cli_exposed: extensionCommandAvailable,
504
644
  policy_state: {
@@ -509,12 +649,20 @@ function resolveActionAvailability(descriptor, runtimeProbe) {
509
649
  };
510
650
  }
511
651
  function resolveCoreCommandFlags(command) {
652
+ if (command === "init") {
653
+ return INIT_FLAG_CONTRACTS;
654
+ }
512
655
  if (command === "config") {
513
656
  return CONFIG_FLAG_CONTRACTS;
514
657
  }
515
- if (command === "extension" || command === "package" || command === "packages" || command === "install") {
658
+ if (command === "extension" ||
659
+ command === "package" ||
660
+ command === "packages") {
516
661
  return EXTENSION_FLAG_CONTRACTS;
517
662
  }
663
+ if (command === "install") {
664
+ return INSTALL_FLAG_CONTRACTS;
665
+ }
518
666
  if (command === "create") {
519
667
  return CREATE_FLAG_CONTRACTS;
520
668
  }
@@ -536,6 +684,9 @@ function resolveCoreCommandFlags(command) {
536
684
  if (command === "context" || command === "ctx") {
537
685
  return CONTEXT_FLAG_CONTRACTS;
538
686
  }
687
+ if (command === "get") {
688
+ return GET_FLAG_CONTRACTS;
689
+ }
539
690
  if (command === "search") {
540
691
  return SEARCH_FLAG_CONTRACTS;
541
692
  }
@@ -557,6 +708,18 @@ function resolveCoreCommandFlags(command) {
557
708
  if (command === "history") {
558
709
  return HISTORY_FLAG_CONTRACTS;
559
710
  }
711
+ if (command === "history-redact") {
712
+ return HISTORY_REDACT_FLAG_CONTRACTS;
713
+ }
714
+ if (command === "history-repair") {
715
+ return HISTORY_REPAIR_FLAG_CONTRACTS;
716
+ }
717
+ if (command === "schema") {
718
+ return SCHEMA_FLAG_CONTRACTS;
719
+ }
720
+ if (command === "plan") {
721
+ return PLAN_FLAG_CONTRACTS;
722
+ }
560
723
  if (command === "restore") {
561
724
  return RESTORE_FLAG_CONTRACTS;
562
725
  }
@@ -682,13 +845,20 @@ function buildRuntimeFieldFlagContracts(fieldRegistry) {
682
845
  if (!primaryFlag) {
683
846
  continue;
684
847
  }
685
- const shortAlias = definition.cli_aliases.map((alias) => toRuntimeShortFlagToken(alias)).find((alias) => alias !== null);
848
+ const shortAlias = definition.cli_aliases
849
+ .map((alias) => toRuntimeShortFlagToken(alias))
850
+ .find((alias) => alias !== null);
686
851
  const longAliases = definition.cli_aliases
687
852
  .map((alias) => toRuntimeLongFlagToken(alias))
688
853
  .filter((alias) => alias !== null && alias !== primaryFlag);
689
854
  for (const command of definition.commands) {
690
- const bucket = buckets.get(command) ?? { flags: [], seen: new Set() };
691
- const primaryContract = shortAlias ? { flag: primaryFlag, short: shortAlias } : { flag: primaryFlag };
855
+ const bucket = buckets.get(command) ?? {
856
+ flags: [],
857
+ seen: new Set(),
858
+ };
859
+ const primaryContract = shortAlias
860
+ ? { flag: primaryFlag, short: shortAlias }
861
+ : { flag: primaryFlag };
692
862
  const primaryKey = `${primaryContract.flag}|${primaryContract.short ?? ""}`;
693
863
  if (!bucket.seen.has(primaryKey)) {
694
864
  bucket.seen.add(primaryKey);
@@ -727,8 +897,7 @@ function mergeFlagContracts(primary, secondary) {
727
897
  function buildCommandFlagSurface(commands, extensionFlagMap, runtimeFieldFlagMap) {
728
898
  return commands
729
899
  .map((command) => {
730
- const isCoreCommand = PM_CORE_COMMAND_NAMES.includes(command) &&
731
- !PACKAGE_OWNED_COMMANDS.has(command);
900
+ const isCoreCommand = PM_CORE_COMMAND_NAMES.includes(command) && !PACKAGE_OWNED_COMMANDS.has(command);
732
901
  const coreFlags = isCoreCommand ? resolveCoreCommandFlags(command) : [];
733
902
  const runtimeFlags = runtimeFieldFlagMap.get(normalizeCommandForRuntimeFieldFlags(command)) ?? [];
734
903
  const extensionFlags = extensionFlagMap.get(command);
@@ -748,6 +917,25 @@ function buildCommandFlagSurface(commands, extensionFlagMap, runtimeFieldFlagMap
748
917
  })
749
918
  .sort((left, right) => left.command.localeCompare(right.command));
750
919
  }
920
+ function compactCommandAliasSurface(commands) {
921
+ const commandSet = new Set(commands);
922
+ const result = [];
923
+ for (const command of commands) {
924
+ const canonical = COMMAND_ALIAS_TO_CANONICAL.get(command);
925
+ if (canonical && commandSet.has(canonical)) {
926
+ continue;
927
+ }
928
+ result.push(command);
929
+ }
930
+ return result;
931
+ }
932
+ function buildCommandAliasSurface(commands) {
933
+ const commandSet = new Set(commands);
934
+ return CANONICAL_COMMAND_ALIASES.map((entry) => ({
935
+ canonical: entry.canonical,
936
+ aliases: entry.aliases.filter((alias) => commandSet.has(alias)),
937
+ })).filter((entry) => commandSet.has(entry.canonical) && entry.aliases.length > 0);
938
+ }
751
939
  function buildCommanderAliasSurface() {
752
940
  return {
753
941
  create_string_options: CREATE_COMMANDER_STRING_OPTION_CONTRACTS,
@@ -762,7 +950,7 @@ function buildCommanderAliasSurface() {
762
950
  };
763
951
  }
764
952
  function resolveCreateRequiredOptionContract(typeDefinition, createMode) {
765
- const baseRequiredOptions = new Set(["title", "description", "type"]);
953
+ const baseRequiredOptions = new Set(["title", "type"]);
766
954
  if (createMode === "strict") {
767
955
  for (const field of typeDefinition.required_create_fields) {
768
956
  baseRequiredOptions.add(field);
@@ -773,8 +961,14 @@ function resolveCreateRequiredOptionContract(typeDefinition, createMode) {
773
961
  }
774
962
  const policyState = resolveCommandOptionPolicyState(typeDefinition, "create", baseRequiredOptions);
775
963
  const requiredOptionKeys = [...new Set(policyState.required)].sort((left, right) => left.localeCompare(right));
776
- const requiredFlags = [...new Set(requiredOptionKeys.map((option) => commandOptionFlagLabel("create", option)))].sort((left, right) => left.localeCompare(right));
777
- const requiredTypeOptions = [...new Set(typeDefinition.options.filter((option) => option.required === true).map((option) => option.key))].sort((left, right) => left.localeCompare(right));
964
+ const requiredFlags = [
965
+ ...new Set(requiredOptionKeys.map((option) => commandOptionFlagLabel("create", option))),
966
+ ].sort((left, right) => left.localeCompare(right));
967
+ const requiredTypeOptions = [
968
+ ...new Set(typeDefinition.options
969
+ .filter((option) => option.required === true)
970
+ .map((option) => option.key)),
971
+ ].sort((left, right) => left.localeCompare(right));
778
972
  return {
779
973
  required_option_keys: requiredOptionKeys,
780
974
  required_flags: requiredFlags,
@@ -841,7 +1035,19 @@ export async function runContracts(options, global) {
841
1035
  const flagsOnly = options.flagsOnly === true;
842
1036
  const availabilityOnly = options.availabilityOnly === true;
843
1037
  const runtimeOnly = options.runtimeOnly === true;
844
- const projectionFlagsEnabled = [schemaOnly, flagsOnly, availabilityOnly].filter((value) => value).length;
1038
+ const fullOutput = options.full === true;
1039
+ const unfilteredDefaultBriefMode = !fullOutput && !schemaOnly && !flagsOnly && !availabilityOnly && !selectedAction && !selectedCommand;
1040
+ // Agent token-cost guard: when no filter and no projection flag and not --full,
1041
+ // skip the giant schema oneOf union (the 200KB+ chunk). Restore via --full
1042
+ // or by scoping to a specific --command/--action.
1043
+ const omitUnfilteredSchema = unfilteredDefaultBriefMode;
1044
+ const omitUnfilteredCommandFlags = unfilteredDefaultBriefMode;
1045
+ const omitUnfilteredCommanderAliases = unfilteredDefaultBriefMode;
1046
+ const projectionFlagsEnabled = [
1047
+ schemaOnly,
1048
+ flagsOnly,
1049
+ availabilityOnly,
1050
+ ].filter((value) => value).length;
845
1051
  if (projectionFlagsEnabled > 1) {
846
1052
  throw new PmCliError("Choose only one projection flag: --schema-only, --flags-only, or --availability-only.", EXIT_CODE.USAGE);
847
1053
  }
@@ -853,15 +1059,16 @@ export async function runContracts(options, global) {
853
1059
  catch {
854
1060
  settings = structuredClone(SETTINGS_DEFAULTS);
855
1061
  }
856
- const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
1062
+ const runtimeProbe = await resolveRuntimeExtensionActionProbe(global);
1063
+ const typeRegistry = resolveItemTypeRegistry(settings, runtimeProbe.registrations ?? getActiveExtensionRegistrations());
857
1064
  const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
858
1065
  const runtimeFieldRegistry = resolveRuntimeFieldRegistry(settings.schema);
859
1066
  const runtimeFieldFlagMap = buildRuntimeFieldFlagContracts(runtimeFieldRegistry);
860
1067
  const createRequiredOptionContracts = buildCreateRequiredOptionContracts(typeRegistry);
861
- const runtimeProbe = await resolveRuntimeExtensionActionProbe(global);
862
1068
  const extensionContracts = collectExtensionCommandContracts(runtimeProbe);
1069
+ const mergedExtensionContracts = mergeExtensionContractsByAction(extensionContracts);
863
1070
  const extensionFlagMap = collectExtensionFlagContractsByCommand(runtimeProbe.flagRegistrations);
864
- const actionDescriptors = collectActionContractDescriptors(extensionContracts);
1071
+ const actionDescriptors = collectActionContractDescriptors(mergedExtensionContracts);
865
1072
  const actionNames = new Set(actionDescriptors.map((entry) => entry.action));
866
1073
  if (selectedAction && !actionNames.has(selectedAction)) {
867
1074
  throw new PmCliError(`Unknown action: "${options.action}".`, EXIT_CODE.USAGE);
@@ -869,7 +1076,7 @@ export async function runContracts(options, global) {
869
1076
  const commandCatalog = [
870
1077
  ...new Set([
871
1078
  ...PM_CORE_COMMAND_NAMES.filter((entry) => !PACKAGE_OWNED_COMMANDS.has(entry)),
872
- ...extensionContracts.map((entry) => entry.command),
1079
+ ...mergedExtensionContracts.flatMap((entry) => entry.command.split("|")),
873
1080
  ]),
874
1081
  ]
875
1082
  .map((entry) => normalizeCommandPath(entry))
@@ -877,6 +1084,16 @@ export async function runContracts(options, global) {
877
1084
  .sort((left, right) => left.localeCompare(right));
878
1085
  const commandNames = new Set(commandCatalog);
879
1086
  if (selectedCommand && !commandNames.has(selectedCommand)) {
1087
+ const packageHint = PACKAGE_OWNED_COMMAND_INSTALL_HINTS.get(selectedCommand);
1088
+ if (packageHint) {
1089
+ throw new PmCliError(`Unknown command: "${options.command}". Command "${selectedCommand}" is provided by the optional "${packageHint}" package. Run "pm install ${packageHint} --project" and retry.`, EXIT_CODE.USAGE, {
1090
+ examples: [`pm install ${packageHint} --project`, `pm contracts --command ${selectedCommand} --flags-only --json`],
1091
+ nextSteps: [`Install the optional package first: pm install ${packageHint} --project`],
1092
+ recovery: {
1093
+ suggested_retry: `pm install ${packageHint} --project`,
1094
+ },
1095
+ });
1096
+ }
880
1097
  throw new PmCliError(`Unknown command: "${options.command}".`, EXIT_CODE.USAGE);
881
1098
  }
882
1099
  const commandScopedDescriptors = selectedCommand
@@ -903,7 +1120,7 @@ export async function runContracts(options, global) {
903
1120
  return typeof actionConst === "string" ? actionConst : null;
904
1121
  })
905
1122
  .filter((entry) => entry !== null));
906
- const extensionBranches = extensionContracts
1123
+ const extensionBranches = mergedExtensionContracts
907
1124
  .filter((contract) => !schemaActionSet.has(contract.action))
908
1125
  .map((contract) => buildExtensionActionSchemaBranch(contract));
909
1126
  const mergedSchema = extensionBranches.length > 0
@@ -916,7 +1133,9 @@ export async function runContracts(options, global) {
916
1133
  ? commandScopedDescriptors.filter((descriptor) => descriptor.action === selectedAction)
917
1134
  : commandScopedDescriptors;
918
1135
  const allActionAvailability = scopedActionDescriptors.map((descriptor) => resolveActionAvailability(descriptor, runtimeProbe));
919
- const actionAvailability = runtimeOnly && !selectedAction ? allActionAvailability.filter((entry) => entry.invocable) : allActionAvailability;
1136
+ const actionAvailability = runtimeOnly && !selectedAction
1137
+ ? allActionAvailability.filter((entry) => entry.invocable)
1138
+ : allActionAvailability;
920
1139
  const actions = actionAvailability.map((entry) => entry.action);
921
1140
  const descriptorActionSet = new Set(actionDescriptors.map((descriptor) => descriptor.action));
922
1141
  let filteredSchema = selectedAction
@@ -936,14 +1155,23 @@ export async function runContracts(options, global) {
936
1155
  : selectedAction
937
1156
  ? resolveScopedCommandsFromActionDescriptors(scopedActionDescriptors, commandCatalog)
938
1157
  : commandCatalog;
1158
+ const outputCommands = flagsOnly && selectedCommand === undefined && selectedAction === undefined
1159
+ ? compactCommandAliasSurface(commands)
1160
+ : commands;
1161
+ const commandAliases = buildCommandAliasSurface(commands);
939
1162
  const extensionCommandContracts = selectedCommand
940
1163
  ? extensionContracts.filter((entry) => entry.command === selectedCommand)
941
1164
  : selectedAction
942
- ? extensionContracts.filter((entry) => commands.includes(normalizeCommandPath(entry.command)))
1165
+ ? extensionContracts.filter((entry) => outputCommands.includes(normalizeCommandPath(entry.command)))
943
1166
  : extensionContracts;
1167
+ const includeRuntimeContractSections = !(flagsOnly && !fullOutput);
944
1168
  const result = {
945
- schema_version: typeof mergedSchema["x-schema-version"] === "string" ? mergedSchema["x-schema-version"] : null,
946
- schema_id: typeof mergedSchema.$id === "string" ? mergedSchema.$id : null,
1169
+ schema_version: typeof mergedSchema["x-schema-version"] === "string"
1170
+ ? mergedSchema["x-schema-version"]
1171
+ : null,
1172
+ schema_id: typeof mergedSchema.$id === "string"
1173
+ ? mergedSchema.$id
1174
+ : null,
947
1175
  selected: {
948
1176
  action: selectedAction ?? null,
949
1177
  command: selectedCommand ?? null,
@@ -953,8 +1181,10 @@ export async function runContracts(options, global) {
953
1181
  runtime_only: runtimeOnly,
954
1182
  command_scoped: selectedCommand !== undefined,
955
1183
  },
956
- commands,
957
- runtime_schema: {
1184
+ commands: outputCommands,
1185
+ };
1186
+ if (includeRuntimeContractSections) {
1187
+ result.runtime_schema = {
958
1188
  statuses: statusRegistry.definitions.map((definition) => definition.id),
959
1189
  open_status: statusRegistry.open_status,
960
1190
  close_status: statusRegistry.close_status,
@@ -962,10 +1192,12 @@ export async function runContracts(options, global) {
962
1192
  types: [...typeRegistry.types],
963
1193
  fields_by_command: Object.fromEntries([...runtimeFieldRegistry.command_to_fields.entries()].map(([command, definitions]) => [
964
1194
  command,
965
- [...new Set(definitions.map((definition) => `--${definition.cli_flag}`))].sort((left, right) => left.localeCompare(right)),
1195
+ [
1196
+ ...new Set(definitions.map((definition) => `--${definition.cli_flag}`)),
1197
+ ].sort((left, right) => left.localeCompare(right)),
966
1198
  ])),
967
- },
968
- extension_contracts: {
1199
+ };
1200
+ result.extension_contracts = {
969
1201
  capabilities: [...PM_EXTENSION_CAPABILITY_CONTRACTS],
970
1202
  services: [...PM_EXTENSION_SERVICE_NAME_CONTRACTS],
971
1203
  policy_modes: [...PM_EXTENSION_POLICY_MODE_CONTRACTS],
@@ -978,22 +1210,40 @@ export async function runContracts(options, global) {
978
1210
  previous: ["v1"],
979
1211
  breaking_strategy: "versioned_breaking",
980
1212
  },
981
- },
982
- };
1213
+ };
1214
+ }
983
1215
  if (!flagsOnly) {
984
1216
  result.actions = actions;
985
1217
  result.action_availability = actionAvailability;
986
1218
  }
987
- if (includeSchemaSurface) {
1219
+ if (includeSchemaSurface && !omitUnfilteredSchema) {
988
1220
  result.schema = filteredSchema;
989
1221
  result.extension_commands = extensionCommandContracts;
990
1222
  }
1223
+ else if (includeSchemaSurface && omitUnfilteredSchema) {
1224
+ result.schema_omitted_reason = "unfiltered_default_brief";
1225
+ result.extension_commands = extensionCommandContracts;
1226
+ }
991
1227
  if (!schemaOnly && !availabilityOnly) {
992
- result.command_flags = buildCommandFlagSurface(commands, extensionFlagMap, runtimeFieldFlagMap);
1228
+ if (!omitUnfilteredCommandFlags) {
1229
+ result.command_flags = buildCommandFlagSurface(outputCommands, extensionFlagMap, runtimeFieldFlagMap);
1230
+ }
1231
+ else {
1232
+ result.command_flags_omitted_reason = "unfiltered_default_brief";
1233
+ }
1234
+ if (commandAliases.length > 0) {
1235
+ result.command_aliases = commandAliases;
1236
+ }
993
1237
  }
994
1238
  if (!schemaOnly && !flagsOnly && !availabilityOnly) {
995
- result.commander_aliases = buildCommanderAliasSurface();
1239
+ if (!omitUnfilteredCommanderAliases) {
1240
+ result.commander_aliases = buildCommanderAliasSurface();
1241
+ }
1242
+ else {
1243
+ result.commander_aliases_omitted_reason = "unfiltered_default_brief";
1244
+ }
996
1245
  }
997
1246
  return result;
998
1247
  }
999
- //# sourceMappingURL=contracts.js.map
1248
+ //# sourceMappingURL=contracts.js.map
1249
+ //# debugId=478936e5-660a-5f89-b15d-93b37468c7ed