@unbrained/pm-cli 2026.9.7 → 2026.9.8

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 (718) hide show
  1. package/.agents/skills/pm-developer/SKILL.md +12 -4
  2. package/.agents/skills/pm-developer/references/MULTI_AGENT_MERGE.md +19 -10
  3. package/.agents/skills/pm-extensions/SKILL.md +6 -0
  4. package/.agents/skills/pm-sdk/SKILL.md +11 -2
  5. package/.agents/skills/pm-user/SKILL.md +5 -0
  6. package/.agents/skills/pm-user/references/ECOSYSTEM_PLANNING.md +95 -0
  7. package/.claude-plugin/marketplace.json +2 -2
  8. package/CHANGELOG.md +211 -181
  9. package/dist/cli/after-command-context-usage.js +1 -48
  10. package/dist/cli/argv-utils.js +1 -40
  11. package/dist/cli/bootstrap-args.js +1 -9
  12. package/dist/cli/bundle-integrity.js +2 -110
  13. package/dist/cli/commander-usage.js +11 -771
  14. package/dist/cli/commands/activity.js +1 -9
  15. package/dist/cli/commands/aggregate.js +1 -5
  16. package/dist/cli/commands/append.js +1 -5
  17. package/dist/cli/commands/claim.js +1 -5
  18. package/dist/cli/commands/close-many.js +1 -5
  19. package/dist/cli/commands/close.js +1 -9
  20. package/dist/cli/commands/comments.js +1 -5
  21. package/dist/cli/commands/config.js +1 -9
  22. package/dist/cli/commands/context.js +1 -9
  23. package/dist/cli/commands/contracts.js +1 -5
  24. package/dist/cli/commands/copy.js +1 -9
  25. package/dist/cli/commands/create.js +1 -9
  26. package/dist/cli/commands/delete.js +1 -9
  27. package/dist/cli/commands/deps.js +1 -9
  28. package/dist/cli/commands/docs.js +1 -9
  29. package/dist/cli/commands/duplicates.js +1 -9
  30. package/dist/cli/commands/eval.js +1 -9
  31. package/dist/cli/commands/extension/describe.js +1 -5
  32. package/dist/cli/commands/extension/scaffold.js +1 -5
  33. package/dist/cli/commands/extension/shared.js +1 -5
  34. package/dist/cli/commands/extension.js +1 -9
  35. package/dist/cli/commands/files.js +1 -9
  36. package/dist/cli/commands/focus.js +1 -9
  37. package/dist/cli/commands/gc.js +1 -9
  38. package/dist/cli/commands/get.js +1 -9
  39. package/dist/cli/commands/graph.js +1 -10
  40. package/dist/cli/commands/health.js +1 -9
  41. package/dist/cli/commands/history-compact.js +1 -10
  42. package/dist/cli/commands/history-redact.js +1 -11
  43. package/dist/cli/commands/history-repair.js +1 -10
  44. package/dist/cli/commands/history.js +1 -5
  45. package/dist/cli/commands/index.js +1 -58
  46. package/dist/cli/commands/init-agent-guidance.js +1 -9
  47. package/dist/cli/commands/init.js +1 -9
  48. package/dist/cli/commands/learnings.js +1 -5
  49. package/dist/cli/commands/lifecycle-transitions.js +1 -5
  50. package/dist/cli/commands/list.js +1 -9
  51. package/dist/cli/commands/merge.js +1 -11
  52. package/dist/cli/commands/next.js +1 -9
  53. package/dist/cli/commands/notes.js +1 -5
  54. package/dist/cli/commands/plan.js +1 -9
  55. package/dist/cli/commands/profile.js +1 -9
  56. package/dist/cli/commands/restore.js +1 -9
  57. package/dist/cli/commands/scheduling-shortcuts.js +1 -9
  58. package/dist/cli/commands/schema.js +1 -10
  59. package/dist/cli/commands/search.js +1 -9
  60. package/dist/cli/commands/stats.js +1 -9
  61. package/dist/cli/commands/telemetry.js +1 -9
  62. package/dist/cli/commands/test-all.js +1 -9
  63. package/dist/cli/commands/test-runs.js +1 -9
  64. package/dist/cli/commands/test.js +1 -9
  65. package/dist/cli/commands/update-many.js +1 -5
  66. package/dist/cli/commands/update.js +1 -9
  67. package/dist/cli/commands/upgrade.js +1 -5
  68. package/dist/cli/commands/validate.js +1 -15
  69. package/dist/cli/context-intent-invocation.js +1 -20
  70. package/dist/cli/description-stdin.js +1 -17
  71. package/dist/cli/error-guidance.js +1 -1353
  72. package/dist/cli/extension-command-help.js +5 -636
  73. package/dist/cli/extension-command-options.js +1 -427
  74. package/dist/cli/extension-recovery.js +1 -126
  75. package/dist/cli/help-content.js +2 -1001
  76. package/dist/cli/help-json-payload.js +4 -570
  77. package/dist/cli/main.d.ts +4 -0
  78. package/dist/cli/main.js +5 -2573
  79. package/dist/cli/migration-gates.js +1 -289
  80. package/dist/cli/public.js +1 -20
  81. package/dist/cli/register-annotations.js +1 -270
  82. package/dist/cli/register-assurance.js +1 -62
  83. package/dist/cli/register-files-lookup.js +1 -56
  84. package/dist/cli/register-history-activity.d.ts +8 -0
  85. package/dist/cli/register-history-activity.js +2 -0
  86. package/dist/cli/register-history-author.js +1 -38
  87. package/dist/cli/register-history-maintenance.d.ts +9 -0
  88. package/dist/cli/register-history-maintenance.js +2 -0
  89. package/dist/cli/register-list-query.js +10 -943
  90. package/dist/cli/register-mutation-options.js +1 -9
  91. package/dist/cli/register-mutation.js +19 -1893
  92. package/dist/cli/register-operations.js +1 -920
  93. package/dist/cli/register-setup.js +1 -716
  94. package/dist/cli/register-structured-mutation.js +1 -196
  95. package/dist/cli/registration-helpers.js +1 -5
  96. package/dist/cli/runtime-compatibility-boundary.js +4 -42
  97. package/dist/cli/schema-registration-helpers.js +1 -73
  98. package/dist/cli/search-refresh.js +1 -13
  99. package/dist/cli/stats-analytics-json.js +1 -68
  100. package/dist/cli/telemetry-flush.js +1 -10
  101. package/dist/cli-bundle/bundle-manifest.json +164 -156
  102. package/dist/cli-bundle/chunks/chunk-3BZZA6A3.js +5 -0
  103. package/dist/cli-bundle/chunks/chunk-AMRDVX36.js +235 -0
  104. package/dist/cli-bundle/chunks/chunk-DAM4CBBR.js +2202 -0
  105. package/dist/cli-bundle/chunks/{chunk-WYRZZ5ZE.js → chunk-DEZPZOQ7.js} +2 -2
  106. package/dist/cli-bundle/chunks/chunk-FLDWYEND.js +77 -0
  107. package/dist/cli-bundle/chunks/{chunk-NPN5I67J.js → chunk-G5ADGQ2D.js} +3 -3
  108. package/dist/cli-bundle/chunks/chunk-JAAEYHUA.js +2 -0
  109. package/dist/cli-bundle/chunks/{chunk-JX4DH4WC.js → chunk-KR3RP4FH.js} +3 -3
  110. package/dist/cli-bundle/chunks/chunk-LEZOUXG6.js +2 -0
  111. package/dist/cli-bundle/chunks/chunk-NSAPNEYH.js +2 -0
  112. package/dist/cli-bundle/chunks/chunk-QOEKOECV.js +29 -0
  113. package/dist/cli-bundle/chunks/chunk-RHSFOMHU.js +2 -0
  114. package/dist/cli-bundle/chunks/chunk-XOD2PCB6.js +20 -0
  115. package/dist/cli-bundle/chunks/{chunk-JT6XF6GE.js → chunk-YVEQ2AMO.js} +4 -4
  116. package/dist/cli-bundle/chunks/register-list-query-KSK3R63M.js +11 -0
  117. package/dist/cli-bundle/chunks/register-mutation-IQ5C7U6O.js +20 -0
  118. package/dist/cli-bundle/chunks/{register-operations-I5W3KMGB.js → register-operations-DWVHR2NC.js} +2 -2
  119. package/dist/cli-bundle/chunks/register-setup-BQ5SVD4B.js +2 -0
  120. package/dist/cli-bundle/focused-chunks/chunk-3WRPWLA7.js +3 -0
  121. package/dist/cli-bundle/focused-chunks/chunk-7MBUII7U.js +2 -0
  122. package/dist/cli-bundle/focused-chunks/chunk-COPBO5HW.js +8 -0
  123. package/dist/cli-bundle/focused-chunks/chunk-DUN4IXYN.js +20 -0
  124. package/dist/cli-bundle/focused-chunks/{chunk-LIJIA4TY.js → chunk-EE5QSM4Z.js} +3 -3
  125. package/dist/cli-bundle/focused-chunks/chunk-HJVARYM3.js +6 -0
  126. package/dist/cli-bundle/focused-chunks/chunk-IAUOUGVR.js +177 -0
  127. package/dist/cli-bundle/focused-chunks/chunk-KOOMJ54F.js +2 -0
  128. package/dist/cli-bundle/focused-chunks/chunk-MZDXX7JY.js +56 -0
  129. package/dist/cli-bundle/focused-chunks/{chunk-M6PBRFSH.js → chunk-OPFHFGDD.js} +2 -2
  130. package/dist/cli-bundle/focused-chunks/chunk-QHNETP77.js +9 -0
  131. package/dist/cli-bundle/focused-chunks/{chunk-3BZEOXLT.js → chunk-RMWES4M6.js} +2 -2
  132. package/dist/cli-bundle/focused-chunks/chunk-RXT4P5QH.js +10 -0
  133. package/dist/cli-bundle/focused-chunks/chunk-SDOL6FM2.js +12 -0
  134. package/dist/cli-bundle/focused-chunks/chunk-SQV4AAUC.js +2 -0
  135. package/dist/cli-bundle/focused-chunks/{chunk-PEFABF7E.js → chunk-WE3IUNIW.js} +3 -3
  136. package/dist/cli-bundle/focused-chunks/chunk-YALOUBWJ.js +2 -0
  137. package/dist/cli-bundle/main.js +20 -20
  138. package/dist/cli-bundle/sdk-authoring.js +1 -1
  139. package/dist/cli-bundle/sdk-contracts.js +2 -2
  140. package/dist/cli-bundle/sdk-core.js +29 -29
  141. package/dist/cli-bundle/sdk-governance.js +1 -1
  142. package/dist/cli-bundle/sdk-graph.js +1 -1
  143. package/dist/cli-bundle/sdk-merge.js +42 -42
  144. package/dist/cli-bundle/sdk-query.js +1 -1
  145. package/dist/cli-bundle/sdk-runtime.js +1 -1
  146. package/dist/cli-bundle/sdk-testing.js +1 -1
  147. package/dist/cli-bundle/sdk.js +11 -11
  148. package/dist/cli.js +1 -104
  149. package/dist/core/checkpoint/checkpoint-gc.js +1 -169
  150. package/dist/core/checkpoint/mutation-checkpoint.js +2 -133
  151. package/dist/core/config/nested-settings.js +1 -534
  152. package/dist/core/config/positional-value.js +1 -109
  153. package/dist/core/diagnostics/remediation.js +1 -506
  154. package/dist/core/extensions/activation-summary-markdown.js +2 -145
  155. package/dist/core/extensions/activation-summary.js +1 -92
  156. package/dist/core/extensions/activation-transaction.js +1 -46
  157. package/dist/core/extensions/capability-usage.js +1 -173
  158. package/dist/core/extensions/command-hook-context.js +1 -13
  159. package/dist/core/extensions/command-metadata-contract.js +1 -22
  160. package/dist/core/extensions/command-visibility-tier.js +1 -29
  161. package/dist/core/extensions/contribution-inventory.js +1 -173
  162. package/dist/core/extensions/exporter-output-contract.js +1 -66
  163. package/dist/core/extensions/extension-candidate.js +1 -18
  164. package/dist/core/extensions/extension-capability-aliases.js +1 -158
  165. package/dist/core/extensions/extension-hook-runtime.js +1 -699
  166. package/dist/core/extensions/extension-policy.js +1 -599
  167. package/dist/core/extensions/extension-registries.js +1 -62
  168. package/dist/core/extensions/extension-runtime-helpers.js +1 -33
  169. package/dist/core/extensions/extension-types.js +1 -102
  170. package/dist/core/extensions/flag-definition-validation.js +1 -52
  171. package/dist/core/extensions/flag-value-types.js +1 -64
  172. package/dist/core/extensions/index.js +1 -526
  173. package/dist/core/extensions/item-field-types.js +1 -39
  174. package/dist/core/extensions/item-fields.js +1 -261
  175. package/dist/core/extensions/loader.js +1 -2223
  176. package/dist/core/extensions/manifest-schema.js +1 -69
  177. package/dist/core/extensions/module-graph-snapshot.js +1 -33
  178. package/dist/core/extensions/preflight-ownership.js +1 -41
  179. package/dist/core/extensions/registration-validation.js +1 -82
  180. package/dist/core/extensions/registration-values.js +1 -209
  181. package/dist/core/extensions/reserved-host-flags.js +1 -36
  182. package/dist/core/extensions/runtime-registrations.js +1 -67
  183. package/dist/core/extensions/service-ownership.js +1 -19
  184. package/dist/core/extensions/version-compat.js +1 -216
  185. package/dist/core/fs/fs-utils.js +2 -158
  186. package/dist/core/fs/host-environment-errors.js +1 -141
  187. package/dist/core/fs/index.js +1 -9
  188. package/dist/core/fs/path-utils.js +1 -17
  189. package/dist/core/governance/content-fields.js +1 -160
  190. package/dist/core/governance/issue-codes.js +1 -151
  191. package/dist/core/governance/metadata-coverage.js +1 -358
  192. package/dist/core/history/drift-cache.js +3 -72
  193. package/dist/core/history/drift-scan.js +1 -342
  194. package/dist/core/history/event-classification.js +1 -109
  195. package/dist/core/history/event-index.js +8 -784
  196. package/dist/core/history/history-compact-bulk.js +1 -104
  197. package/dist/core/history/history-diff.js +1 -158
  198. package/dist/core/history/history-rewrite.d.ts +6 -1
  199. package/dist/core/history/history-rewrite.js +1 -107
  200. package/dist/core/history/history-storage-stats.js +1 -102
  201. package/dist/core/history/history-stream-policy.js +1 -62
  202. package/dist/core/history/history.js +2 -617
  203. package/dist/core/history/identity.js +1 -30
  204. package/dist/core/history/index.js +1 -9
  205. package/dist/core/history/projection.js +1 -196
  206. package/dist/core/history/read.d.ts +9 -0
  207. package/dist/core/history/read.js +1 -57
  208. package/dist/core/history/replay.js +2 -439
  209. package/dist/core/history/version-address.js +1 -32
  210. package/dist/core/history/workspace-history.js +2 -433
  211. package/dist/core/io/body-file.js +1 -62
  212. package/dist/core/io/bulk-ids-input.js +1 -112
  213. package/dist/core/item/actionability.js +1 -327
  214. package/dist/core/item/dependency-reference.js +1 -20
  215. package/dist/core/item/id.js +1 -112
  216. package/dist/core/item/index.js +1 -12
  217. package/dist/core/item/item-format-version.js +1 -78
  218. package/dist/core/item/item-format.js +5 -1473
  219. package/dist/core/item/item-record.js +1 -23
  220. package/dist/core/item/item-type-definition.js +1 -133
  221. package/dist/core/item/parent-reference-policy.js +1 -57
  222. package/dist/core/item/parse.js +2 -603
  223. package/dist/core/item/plan-lifecycle.js +1 -19
  224. package/dist/core/item/priority.js +1 -61
  225. package/dist/core/item/sprint-release-format.js +1 -38
  226. package/dist/core/item/status-filter.js +1 -115
  227. package/dist/core/item/status.js +1 -43
  228. package/dist/core/item/toon-decode.js +1 -29
  229. package/dist/core/item/type-registry.js +1 -715
  230. package/dist/core/item/type-synonyms.js +1 -38
  231. package/dist/core/lock/index.js +1 -9
  232. package/dist/core/lock/lock-gc.js +1 -240
  233. package/dist/core/lock/lock.js +3 -590
  234. package/dist/core/output/mutation-projection.js +1 -217
  235. package/dist/core/output/output-control.js +1 -25
  236. package/dist/core/output/output.js +11 -494
  237. package/dist/core/output/query-summary.js +1 -58
  238. package/dist/core/output/tabular.js +1 -77
  239. package/dist/core/packages/manifest.js +1 -244
  240. package/dist/core/packages/root.js +1 -84
  241. package/dist/core/profile/profile-describe.js +1 -83
  242. package/dist/core/profile/profile-lint.js +1 -415
  243. package/dist/core/profile/profile-plan.js +0 -0
  244. package/dist/core/profile/profile-presets.js +1 -370
  245. package/dist/core/reproducibility/context.js +1 -82
  246. package/dist/core/schema/fields-file.js +2 -288
  247. package/dist/core/schema/item-types-file.js +2 -296
  248. package/dist/core/schema/runtime-field-filters.js +1 -49
  249. package/dist/core/schema/runtime-field-values.js +1 -313
  250. package/dist/core/schema/runtime-schema.js +2 -826
  251. package/dist/core/schema/status-defs-file.js +2 -227
  252. package/dist/core/schema/status-token.js +1 -31
  253. package/dist/core/schema/type-inference.js +1 -95
  254. package/dist/core/schema/type-presets.js +1 -87
  255. package/dist/core/schema/type-workflows.js +1 -104
  256. package/dist/core/search/background-refresh.js +2 -286
  257. package/dist/core/search/bm25.js +1 -146
  258. package/dist/core/search/cache.js +2 -534
  259. package/dist/core/search/corpus.js +1 -311
  260. package/dist/core/search/embedding-batches.js +1 -163
  261. package/dist/core/search/eval.js +1 -225
  262. package/dist/core/search/http-client.js +1 -75
  263. package/dist/core/search/providers.js +1 -242
  264. package/dist/core/search/relevance.js +1 -244
  265. package/dist/core/search/semantic-defaults.js +1 -199
  266. package/dist/core/search/staleness.js +1 -30
  267. package/dist/core/search/vector-stores.js +2 -664
  268. package/dist/core/search/vectorization-metadata.js +1 -81
  269. package/dist/core/sentry/helpers.js +1 -272
  270. package/dist/core/sentry/instrument.js +1 -387
  271. package/dist/core/session/session-state.js +1 -260
  272. package/dist/core/shared/agent-session-context.js +1 -133
  273. package/dist/core/shared/author.js +1 -1172
  274. package/dist/core/shared/command-types.js +1 -4
  275. package/dist/core/shared/conflict-markers.js +1 -31
  276. package/dist/core/shared/constants.js +1 -405
  277. package/dist/core/shared/errors.js +1 -20
  278. package/dist/core/shared/html-entity-decode.js +1 -131
  279. package/dist/core/shared/index.js +1 -12
  280. package/dist/core/shared/item-metadata-contract.js +1 -89
  281. package/dist/core/shared/lazy-module.js +1 -16
  282. package/dist/core/shared/levenshtein.js +1 -61
  283. package/dist/core/shared/memo.js +1 -19
  284. package/dist/core/shared/numeric-parsers.js +1 -20
  285. package/dist/core/shared/option-alias-visibility.js +1 -67
  286. package/dist/core/shared/primitives.js +1 -127
  287. package/dist/core/shared/serial-queue.js +1 -79
  288. package/dist/core/shared/serialization.js +1 -210
  289. package/dist/core/shared/split-comma-list.js +1 -30
  290. package/dist/core/shared/text-normalization.js +1 -38
  291. package/dist/core/shared/time.js +1 -306
  292. package/dist/core/store/index.js +1 -12
  293. package/dist/core/store/item-format-migration.js +1 -125
  294. package/dist/core/store/item-metadata-cache.js +1 -1116
  295. package/dist/core/store/item-metadata-query-index.js +9 -394
  296. package/dist/core/store/item-metadata-read-work.js +1 -43
  297. package/dist/core/store/item-store.js +1 -693
  298. package/dist/core/store/paths.d.ts +1 -1
  299. package/dist/core/store/paths.js +1 -214
  300. package/dist/core/store/settings-read-cache.js +1 -85
  301. package/dist/core/store/settings-validator.js +1 -421
  302. package/dist/core/store/settings.js +3 -1309
  303. package/dist/core/store/tracker-preflight.js +1 -141
  304. package/dist/core/telemetry/consent.js +5 -108
  305. package/dist/core/telemetry/observability.js +1 -246
  306. package/dist/core/telemetry/runtime.js +4 -1988
  307. package/dist/core/test/background-runs.js +4 -945
  308. package/dist/core/test/item-test-run-tracking.js +1 -63
  309. package/dist/core/test/run-selectors.js +1 -120
  310. package/dist/core/validate/estimate-defaults.js +1 -89
  311. package/dist/core/validate/fix-planning.js +1 -189
  312. package/dist/core/validate/linked-artifact-reference.js +1 -36
  313. package/dist/core/validate/missing-by-type.js +1 -34
  314. package/dist/core/validate/missing-link-owners.js +1 -95
  315. package/dist/core/validate/stale-file-classification.js +1 -82
  316. package/dist/mcp/http-server.js +5 -448
  317. package/dist/mcp/legacy-adapter.js +1 -77
  318. package/dist/mcp/runtime-capabilities.js +1 -200
  319. package/dist/mcp/server.js +4 -1233
  320. package/dist/mcp/tool-definitions.js +1 -804
  321. package/dist/sdk/actionability.js +1 -13
  322. package/dist/sdk/agent/closed-domain-contracts.js +1 -161
  323. package/dist/sdk/agent/command-recovery.js +1 -59
  324. package/dist/sdk/agent/command-suggestions.js +1 -66
  325. package/dist/sdk/agent/create-option-policy.js +1 -31
  326. package/dist/sdk/agent/identity-config.js +1 -106
  327. package/dist/sdk/agent/item-addressing.js +1 -207
  328. package/dist/sdk/agent/refusal-closure-census.js +1 -151
  329. package/dist/sdk/agent/refusal-closure.js +1 -133
  330. package/dist/sdk/agent/refusal-corpus-contracts.js +1 -193
  331. package/dist/sdk/agent/refusal-reachability.js +1 -593
  332. package/dist/sdk/agent/subcommand-recovery.js +1 -83
  333. package/dist/sdk/agent/task-transcript-contracts.js +1 -197
  334. package/dist/sdk/agent/tracker-preflight-contracts.js +1 -126
  335. package/dist/sdk/agent-capability-contracts.js +1 -428
  336. package/dist/sdk/agent-session-context.js +1 -9
  337. package/dist/sdk/annotations.js +1 -448
  338. package/dist/sdk/author-attribution.js +1 -468
  339. package/dist/sdk/authoring.js +1 -20
  340. package/dist/sdk/cli-bootstrap.js +1 -838
  341. package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +1 -1
  342. package/dist/sdk/cli-contracts/agent-output-contracts.js +4 -476
  343. package/dist/sdk/cli-contracts/bootstrap-command-scanner.js +1 -79
  344. package/dist/sdk/cli-contracts/command-aliases.d.ts +4 -0
  345. package/dist/sdk/cli-contracts/command-aliases.js +1 -107
  346. package/dist/sdk/cli-contracts/command-exit-contracts.js +1 -151
  347. package/dist/sdk/cli-contracts/commander-mutation-options.js +1 -1081
  348. package/dist/sdk/cli-contracts/commander-types.js +1 -159
  349. package/dist/sdk/cli-contracts/completeness.js +1 -393
  350. package/dist/sdk/cli-contracts/enum-contracts.js +1 -222
  351. package/dist/sdk/cli-contracts/flag-contracts.js +1 -1947
  352. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -347
  353. package/dist/sdk/cli-contracts/grammar-contracts.js +1 -986
  354. package/dist/sdk/cli-contracts/registration-helpers.js +7 -990
  355. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +5 -0
  356. package/dist/sdk/cli-contracts/runtime-contracts.js +1 -2090
  357. package/dist/sdk/cli-contracts/schemas/assurance-definition.js +1 -324
  358. package/dist/sdk/cli-contracts/string-lists.js +1 -16
  359. package/dist/sdk/cli-contracts/tool-option-contracts.js +1 -461
  360. package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -2167
  361. package/dist/sdk/cli-contracts/tool-schema.d.ts +3 -1
  362. package/dist/sdk/cli-contracts/tool-schema.js +1 -1664
  363. package/dist/sdk/cli-contracts/typed-action-inputs.js +1 -4
  364. package/dist/sdk/cli-contracts.d.ts +1 -1
  365. package/dist/sdk/cli-contracts.js +1 -17
  366. package/dist/sdk/cli-program.js +1 -49
  367. package/dist/sdk/command-line.d.ts +2 -5
  368. package/dist/sdk/command-line.js +1 -78
  369. package/dist/sdk/comments.js +1 -133
  370. package/dist/sdk/compile-cache.js +1 -73
  371. package/dist/sdk/completion.js +157 -837
  372. package/dist/sdk/compose.js +1 -1090
  373. package/dist/sdk/config.js +1 -1204
  374. package/dist/sdk/context/recency.js +1 -33
  375. package/dist/sdk/context/semantic-session-attribution.js +1 -82
  376. package/dist/sdk/context/usage-egress.js +1 -29
  377. package/dist/sdk/context/usage-ledger.js +3 -185
  378. package/dist/sdk/context-intent-contracts.js +1 -709
  379. package/dist/sdk/context-intent-runtime.js +1 -115
  380. package/dist/sdk/context-packing.js +1 -218
  381. package/dist/sdk/context-relevance.js +1 -503
  382. package/dist/sdk/context-signal-store.js +2 -426
  383. package/dist/sdk/context-usage.js +1 -367
  384. package/dist/sdk/contracts.js +1 -23
  385. package/dist/sdk/core-governance.js +1 -14
  386. package/dist/sdk/core.js +1 -14
  387. package/dist/sdk/corpus-shape.js +1 -401
  388. package/dist/sdk/define.js +1 -220
  389. package/dist/sdk/dependencies.js +1 -718
  390. package/dist/sdk/dependency-flag-validation.js +1 -156
  391. package/dist/sdk/dependency-provenance.js +1 -135
  392. package/dist/sdk/docs.js +1 -14
  393. package/dist/sdk/duplicates.js +1 -40
  394. package/dist/sdk/environment/agent-environment.js +1 -466
  395. package/dist/sdk/environment/host-environment-errors.js +1 -8
  396. package/dist/sdk/environment/project-runtime-compatibility.js +1 -481
  397. package/dist/sdk/environment/source-context.js +1 -28
  398. package/dist/sdk/environment/tracker-preflight.js +1 -9
  399. package/dist/sdk/error-code-catalog.js +1 -153
  400. package/dist/sdk/error-runtime.js +1 -58
  401. package/dist/sdk/errors.js +1 -58
  402. package/dist/sdk/eval.js +1 -190
  403. package/dist/sdk/extension/author-manifest.js +1 -92
  404. package/dist/sdk/extension/bundled-catalog.js +1 -332
  405. package/dist/sdk/extension/concurrency.js +1 -25
  406. package/dist/sdk/extension/copy-scope.d.ts +2 -0
  407. package/dist/sdk/extension/copy-scope.js +2 -0
  408. package/dist/sdk/extension/custom-field-collisions.js +1 -30
  409. package/dist/sdk/extension/describe.js +3 -189
  410. package/dist/sdk/extension/doctor.js +1 -606
  411. package/dist/sdk/extension/install-plan.d.ts +69 -0
  412. package/dist/sdk/extension/install-plan.js +2 -0
  413. package/dist/sdk/extension/install-receipts.d.ts +7 -0
  414. package/dist/sdk/extension/install-receipts.js +2 -0
  415. package/dist/sdk/extension/install-runtime.js +3 -313
  416. package/dist/sdk/extension/install-snapshot.js +1 -66
  417. package/dist/sdk/extension/install-sources.js +5 -1057
  418. package/dist/sdk/extension/managed-state.js +2 -252
  419. package/dist/sdk/extension/migrations.js +2 -174
  420. package/dist/sdk/extension/output-ownership.js +1 -25
  421. package/dist/sdk/extension/runtime-summary.js +1 -18
  422. package/dist/sdk/extension/scaffold.js +4 -2308
  423. package/dist/sdk/extension/shared.js +1 -147
  424. package/dist/sdk/extension/source-resolution.js +1 -65
  425. package/dist/sdk/extension/update-check.js +1 -67
  426. package/dist/sdk/extension-command-context.js +1 -44
  427. package/dist/sdk/extension-contracts.js +1 -73
  428. package/dist/sdk/extension.d.ts +7 -2
  429. package/dist/sdk/extension.js +1 -2196
  430. package/dist/sdk/files.js +1 -535
  431. package/dist/sdk/flag-invocation-contracts.d.ts +0 -5
  432. package/dist/sdk/flag-invocation-contracts.js +1 -344
  433. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -2224
  434. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -2236
  435. package/dist/sdk/generated-error-code-catalog.js +1 -16
  436. package/dist/sdk/governance/assurance-action-contracts.js +1 -4
  437. package/dist/sdk/governance/assurance-action.js +1 -411
  438. package/dist/sdk/governance/assurance-limits.js +1 -10
  439. package/dist/sdk/governance/assurance-mutation-error.js +1 -81
  440. package/dist/sdk/governance/assurance-presets.js +1 -135
  441. package/dist/sdk/governance/assurance-runtime.js +1 -238
  442. package/dist/sdk/governance/assurance.js +4 -1182
  443. package/dist/sdk/governance/boundary-fixtures.js +1 -200
  444. package/dist/sdk/governance/coverage-assurance.js +1 -60
  445. package/dist/sdk/governance/defect-recurrence-coverage.js +1 -188
  446. package/dist/sdk/governance/defect-recurrence-graph.js +1 -120
  447. package/dist/sdk/governance/defect-recurrence-signals.js +1 -24
  448. package/dist/sdk/governance/defect-recurrence.js +1 -623
  449. package/dist/sdk/governance/extension-host-version.js +1 -115
  450. package/dist/sdk/governance/gc.js +1 -368
  451. package/dist/sdk/governance/health.js +1 -2367
  452. package/dist/sdk/governance/hierarchy-validation.js +1 -108
  453. package/dist/sdk/governance/linked-file-report.js +1 -71
  454. package/dist/sdk/governance/merge-receipt-history.js +1 -206
  455. package/dist/sdk/governance/provenance-health.js +1 -282
  456. package/dist/sdk/governance/reindex.js +4 -761
  457. package/dist/sdk/governance/stale-work.js +1 -82
  458. package/dist/sdk/governance/status-role-diagnostics.js +1 -35
  459. package/dist/sdk/governance/storage-integrity.js +1 -280
  460. package/dist/sdk/governance/tracked-runtime-cache.js +1 -106
  461. package/dist/sdk/governance/upgrade.js +2 -327
  462. package/dist/sdk/governance/validate-history-drift.js +1 -81
  463. package/dist/sdk/governance/validate-item-reader.js +1 -17
  464. package/dist/sdk/governance/validate-normalization.js +1 -36
  465. package/dist/sdk/governance/validate.js +1 -2261
  466. package/dist/sdk/governance/workspace-position.js +1 -163
  467. package/dist/sdk/governance.d.ts +1 -0
  468. package/dist/sdk/governance.js +1 -31
  469. package/dist/sdk/graph/adapter.js +1 -181
  470. package/dist/sdk/graph/analytics.js +1 -474
  471. package/dist/sdk/graph/assembly.js +1 -377
  472. package/dist/sdk/graph/cache.js +1 -160
  473. package/dist/sdk/graph/centrality.js +1 -258
  474. package/dist/sdk/graph/conformance.js +1 -130
  475. package/dist/sdk/graph/deadline-scheduling.d.ts +90 -0
  476. package/dist/sdk/graph/deadline-scheduling.js +2 -0
  477. package/dist/sdk/graph/durable-cache.d.ts +1 -1
  478. package/dist/sdk/graph/durable-cache.js +1 -361
  479. package/dist/sdk/graph/governance-contracts.js +1 -34
  480. package/dist/sdk/graph/governance.d.ts +13 -1
  481. package/dist/sdk/graph/governance.js +1 -735
  482. package/dist/sdk/graph/hierarchy-integrity.js +1 -310
  483. package/dist/sdk/graph/index.d.ts +3 -2
  484. package/dist/sdk/graph/index.js +1 -26
  485. package/dist/sdk/graph/lifecycle-coverage.d.ts +32 -0
  486. package/dist/sdk/graph/lifecycle-coverage.js +2 -0
  487. package/dist/sdk/graph/mutation-advisory.js +1 -176
  488. package/dist/sdk/graph/remediation.js +1 -197
  489. package/dist/sdk/graph/run.d.ts +15 -1
  490. package/dist/sdk/graph/run.js +1 -768
  491. package/dist/sdk/graph/scheduling.js +1 -124
  492. package/dist/sdk/graph/traversal.js +1 -284
  493. package/dist/sdk/graph/workspace-relationship-kind-registry.js +1 -27
  494. package/dist/sdk/graph.js +1 -15
  495. package/dist/sdk/guide-topics.js +1 -707
  496. package/dist/sdk/guide.js +1 -279
  497. package/dist/sdk/history/maintenance.d.ts +71 -0
  498. package/dist/sdk/history/maintenance.js +2 -0
  499. package/dist/sdk/history/salvage.js +2 -247
  500. package/dist/sdk/history/subject.d.ts +19 -0
  501. package/dist/sdk/history/subject.js +2 -0
  502. package/dist/sdk/history-analytics.js +1 -282
  503. package/dist/sdk/history-compact.js +1 -527
  504. package/dist/sdk/history-mcp.js +1 -68
  505. package/dist/sdk/history-provenance.js +1 -182
  506. package/dist/sdk/history-read.js +1 -96
  507. package/dist/sdk/history-redact.d.ts +1 -14
  508. package/dist/sdk/history-redact.js +1 -643
  509. package/dist/sdk/history-repair.d.ts +5 -0
  510. package/dist/sdk/history-repair.js +1 -657
  511. package/dist/sdk/improvement-ledger-validation.js +1 -62
  512. package/dist/sdk/improvement-ledger.js +2 -257
  513. package/dist/sdk/index.d.ts +4 -0
  514. package/dist/sdk/index.js +1 -183
  515. package/dist/sdk/init-agent-guidance.js +2 -496
  516. package/dist/sdk/init.js +2 -820
  517. package/dist/sdk/invocation-author.js +1 -39
  518. package/dist/sdk/item-children.js +1 -90
  519. package/dist/sdk/item-metadata-index.js +1 -15
  520. package/dist/sdk/item-schedule.js +1 -27
  521. package/dist/sdk/item-transaction.js +1 -396
  522. package/dist/sdk/learnings.js +1 -29
  523. package/dist/sdk/lifecycle/append.js +2 -53
  524. package/dist/sdk/lifecycle/claim.d.ts +2 -0
  525. package/dist/sdk/lifecycle/claim.js +1 -242
  526. package/dist/sdk/lifecycle/close-many.js +1 -438
  527. package/dist/sdk/lifecycle/close.js +1 -468
  528. package/dist/sdk/lifecycle/copy.js +1 -212
  529. package/dist/sdk/lifecycle/create.js +1 -1949
  530. package/dist/sdk/lifecycle/delete.js +1 -45
  531. package/dist/sdk/lifecycle/event-validation-messages.js +1 -91
  532. package/dist/sdk/lifecycle/focus.js +1 -91
  533. package/dist/sdk/lifecycle/hierarchy-mutation-lock.js +1 -24
  534. package/dist/sdk/lifecycle/legacy-none-tokens.js +1 -149
  535. package/dist/sdk/lifecycle/lifecycle-transitions.js +1 -40
  536. package/dist/sdk/lifecycle/mcp-actions.d.ts +2 -0
  537. package/dist/sdk/lifecycle/mcp-actions.js +1 -51
  538. package/dist/sdk/lifecycle/metadata-normalizers.js +1 -46
  539. package/dist/sdk/lifecycle/mutation-command-options.js +1 -9
  540. package/dist/sdk/lifecycle/plan.js +1 -1606
  541. package/dist/sdk/lifecycle/recurrence-parsers.js +1 -147
  542. package/dist/sdk/lifecycle/reopen.js +1 -68
  543. package/dist/sdk/lifecycle/repeatable-metadata-parsers.js +1 -143
  544. package/dist/sdk/lifecycle/restore.d.ts +1 -0
  545. package/dist/sdk/lifecycle/restore.js +1 -330
  546. package/dist/sdk/lifecycle/shared-unset-fields.js +1 -295
  547. package/dist/sdk/lifecycle/update-many.js +1 -861
  548. package/dist/sdk/lifecycle/update.js +1 -2136
  549. package/dist/sdk/lifecycle-completion.js +1 -92
  550. package/dist/sdk/lifecycle-policy.js +1 -120
  551. package/dist/sdk/linked-artifacts.js +1 -530
  552. package/dist/sdk/mcp/apps.js +4 -133
  553. package/dist/sdk/mcp/authorization.js +1 -404
  554. package/dist/sdk/mcp/discovery.js +1 -494
  555. package/dist/sdk/mcp/interactions.js +1 -336
  556. package/dist/sdk/mcp/protocol.d.ts +7 -0
  557. package/dist/sdk/mcp/protocol.js +1 -184
  558. package/dist/sdk/mcp/skills.js +1 -389
  559. package/dist/sdk/mcp/subscriptions.js +1 -211
  560. package/dist/sdk/mcp/tasks.js +2 -430
  561. package/dist/sdk/mcp/transport.js +1 -260
  562. package/dist/sdk/merge/abandoned-receipts.js +1 -46
  563. package/dist/sdk/merge/driver.js +1 -212
  564. package/dist/sdk/merge/index.js +1 -16
  565. package/dist/sdk/merge/install.js +3 -561
  566. package/dist/sdk/merge/receipt-file-boundary.js +1 -46
  567. package/dist/sdk/merge/receipt-operation.js +1 -96
  568. package/dist/sdk/merge/receipt-schema.js +1 -397
  569. package/dist/sdk/merge/receipts.js +4 -525
  570. package/dist/sdk/merge/reconcile.js +1 -352
  571. package/dist/sdk/merge/three-way.js +3 -775
  572. package/dist/sdk/merge.js +1 -10
  573. package/dist/sdk/mutation-events.js +1 -292
  574. package/dist/sdk/mutation-guard.js +1 -216
  575. package/dist/sdk/notes.js +1 -139
  576. package/dist/sdk/output-contracts.js +1 -172
  577. package/dist/sdk/output-projection.js +1 -430
  578. package/dist/sdk/output-token-accounting.js +1 -140
  579. package/dist/sdk/output.js +1 -64
  580. package/dist/sdk/ownership-source.js +1 -21
  581. package/dist/sdk/package-import-adapters.js +1 -442
  582. package/dist/sdk/package-migrations.js +1 -20
  583. package/dist/sdk/package-runtime-options.js +1 -80
  584. package/dist/sdk/pagination.js +1 -162
  585. package/dist/sdk/profile.js +1 -454
  586. package/dist/sdk/provenance.js +1 -258
  587. package/dist/sdk/public-surface.json +1 -1
  588. package/dist/sdk/query/activity.js +1 -401
  589. package/dist/sdk/query/aggregate.d.ts +16 -0
  590. package/dist/sdk/query/aggregate.js +1 -390
  591. package/dist/sdk/query/calendar.js +1 -964
  592. package/dist/sdk/query/complete-list.js +1 -215
  593. package/dist/sdk/query/context.js +1 -1702
  594. package/dist/sdk/query/duplicate-candidates.js +1 -70
  595. package/dist/sdk/query/get.js +1 -450
  596. package/dist/sdk/query/history.js +1 -186
  597. package/dist/sdk/query/item-filter-options.js +1 -9
  598. package/dist/sdk/query/light-metadata.js +1 -18
  599. package/dist/sdk/query/list-filter-shared.js +1 -81
  600. package/dist/sdk/query/list.js +1 -1304
  601. package/dist/sdk/query/multi-value-filters.js +1 -78
  602. package/dist/sdk/query/next.js +1 -513
  603. package/dist/sdk/query/parsers.js +1 -44
  604. package/dist/sdk/query/projection-contracts.js +1 -184
  605. package/dist/sdk/query/search-contracts.js +1 -230
  606. package/dist/sdk/query/search-pagination.js +1 -35
  607. package/dist/sdk/query/search-rendering.js +1 -105
  608. package/dist/sdk/query/search.js +2 -1987
  609. package/dist/sdk/query.js +1 -35
  610. package/dist/sdk/read-output/continuation.js +1 -194
  611. package/dist/sdk/read-output-budget.js +1 -135
  612. package/dist/sdk/read-output-contracts.js +1 -1225
  613. package/dist/sdk/read-output-rows.js +1 -186
  614. package/dist/sdk/read-output-session.js +1 -208
  615. package/dist/sdk/relationship-analytics.js +1 -410
  616. package/dist/sdk/relationship-context.js +1 -284
  617. package/dist/sdk/relationship-history.js +4 -519
  618. package/dist/sdk/relationship-kinds/contract.js +1 -22
  619. package/dist/sdk/relationship-migration.js +1 -77
  620. package/dist/sdk/relationships.js +1 -579
  621. package/dist/sdk/reproducibility/process.js +1 -87
  622. package/dist/sdk/runtime-action-aliases.js +1 -59
  623. package/dist/sdk/runtime-extended-actions.js +1 -177
  624. package/dist/sdk/runtime-input.js +1 -614
  625. package/dist/sdk/runtime-primitives.js +1 -84
  626. package/dist/sdk/runtime-public-contracts.js +1 -4
  627. package/dist/sdk/runtime-stats-options.js +1 -38
  628. package/dist/sdk/runtime.js +1 -1928
  629. package/dist/sdk/scheduling-shortcuts.js +1 -63
  630. package/dist/sdk/schema-migration.js +3 -856
  631. package/dist/sdk/schema.js +1 -1376
  632. package/dist/sdk/search-refresh-worker.js +1 -18
  633. package/dist/sdk/similarity-scoring.js +1 -53
  634. package/dist/sdk/similarity.js +1 -326
  635. package/dist/sdk/start-task-status.js +1 -14
  636. package/dist/sdk/stats.js +1 -270
  637. package/dist/sdk/structured-mutations.js +1 -580
  638. package/dist/sdk/telemetry-flush.js +1 -13
  639. package/dist/sdk/telemetry.js +1 -405
  640. package/dist/sdk/templates.js +2 -292
  641. package/dist/sdk/test/batch.js +2 -509
  642. package/dist/sdk/test/entry.js +1 -70
  643. package/dist/sdk/test/execution.js +6 -2211
  644. package/dist/sdk/test/linked-command-detection.js +1 -546
  645. package/dist/sdk/test/measurements.js +1 -91
  646. package/dist/sdk/test/parsers.js +1 -545
  647. package/dist/sdk/test/runs.js +1 -193
  648. package/dist/sdk/test/trust.js +2 -206
  649. package/dist/sdk/testing.js +4 -1391
  650. package/dist/sdk/traceability/runtime-files-lookup.js +1 -32
  651. package/dist/sdk/traceability/source-traceability.js +1 -292
  652. package/dist/sdk/tracker-root-discovery.js +1 -9
  653. package/dist/sdk/workspace-contracts-cache.js +1 -28
  654. package/dist/sdk/workspace-contracts.js +1 -33
  655. package/dist/sdk/workspace-memory.js +2 -318
  656. package/dist/sdk/workspace-recipe.js +1 -71
  657. package/dist/sdk/workspace-snapshot.js +4 -613
  658. package/dist/sdk/workspace-transaction-gc.js +1 -149
  659. package/dist/sdk/workspace-transaction.js +2 -363
  660. package/dist/sdk/workspace.js +3 -127
  661. package/dist/types/index.js +1 -9
  662. package/dist/types.js +1 -245
  663. package/docs/AGENT_GUIDE.md +1 -1
  664. package/docs/CONTEXT_ALGORITHM_PORTFOLIO.md +167 -0
  665. package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +9 -3
  666. package/docs/EXTENSIONS.md +1 -0
  667. package/docs/HISTORY_MAINTENANCE.md +125 -0
  668. package/docs/MCP_2026_07_28_CONFORMANCE.md +20 -10
  669. package/docs/PACKAGE_EVIDENCE.md +92 -0
  670. package/docs/PLANNING_MEASUREMENTS.md +183 -0
  671. package/docs/README.md +3 -0
  672. package/docs/SCRIPTING.md +21 -0
  673. package/docs/TESTING.md +23 -0
  674. package/docs/generated/FLAG_LEXICON_BUDGETS.md +5 -5
  675. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +2 -2
  676. package/marketplace.json +2 -2
  677. package/package.json +1 -1
  678. package/packages/pm-beads/package.json +1 -1
  679. package/packages/pm-calendar/package.json +1 -1
  680. package/packages/pm-command-kit/package.json +1 -1
  681. package/packages/pm-digital-twin/package.json +1 -1
  682. package/packages/pm-governance-audit/package.json +1 -1
  683. package/packages/pm-guide-shell/package.json +1 -1
  684. package/packages/pm-kanban/package.json +1 -1
  685. package/packages/pm-lifecycle-hooks/package.json +1 -1
  686. package/packages/pm-linked-test-adapters/package.json +1 -1
  687. package/packages/pm-search-advanced/package.json +1 -1
  688. package/packages/pm-templates/package.json +1 -1
  689. package/packages/pm-todos/package.json +1 -1
  690. package/packages/pm-vcs/package.json +1 -1
  691. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  692. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  693. package/scripts/finalize-build.mjs +45 -3
  694. package/dist/cli-bundle/chunks/chunk-AZDFJGH6.js +0 -9
  695. package/dist/cli-bundle/chunks/chunk-BAX2BYUW.js +0 -2111
  696. package/dist/cli-bundle/chunks/chunk-CKOL5U7J.js +0 -77
  697. package/dist/cli-bundle/chunks/chunk-OF76PSDQ.js +0 -5
  698. package/dist/cli-bundle/chunks/chunk-QUWFABDM.js +0 -232
  699. package/dist/cli-bundle/chunks/chunk-QWRRFYK3.js +0 -2
  700. package/dist/cli-bundle/chunks/chunk-RWWBOWJ5.js +0 -2
  701. package/dist/cli-bundle/chunks/chunk-WGAOYSYH.js +0 -40
  702. package/dist/cli-bundle/chunks/chunk-WI2AYPA7.js +0 -2
  703. package/dist/cli-bundle/chunks/register-list-query-5JL52D33.js +0 -11
  704. package/dist/cli-bundle/chunks/register-mutation-ZPG7KMVP.js +0 -20
  705. package/dist/cli-bundle/chunks/register-setup-H4SVAVX7.js +0 -2
  706. package/dist/cli-bundle/focused-chunks/chunk-AL5ON6K6.js +0 -2
  707. package/dist/cli-bundle/focused-chunks/chunk-CHC2IDXA.js +0 -6
  708. package/dist/cli-bundle/focused-chunks/chunk-CK6QFAPZ.js +0 -20
  709. package/dist/cli-bundle/focused-chunks/chunk-EZR3GHFE.js +0 -2
  710. package/dist/cli-bundle/focused-chunks/chunk-H2WJWK7L.js +0 -56
  711. package/dist/cli-bundle/focused-chunks/chunk-NTPY5GSO.js +0 -3
  712. package/dist/cli-bundle/focused-chunks/chunk-P5O7MP5Y.js +0 -2
  713. package/dist/cli-bundle/focused-chunks/chunk-PDMW2E36.js +0 -177
  714. package/dist/cli-bundle/focused-chunks/chunk-QTVCLMSZ.js +0 -6
  715. package/dist/cli-bundle/focused-chunks/chunk-QTZRBUYA.js +0 -8
  716. package/dist/cli-bundle/focused-chunks/chunk-SGQST3PQ.js +0 -12
  717. package/dist/cli-bundle/focused-chunks/chunk-UKHASMMP.js +0 -10
  718. package/dist/cli-bundle/focused-chunks/chunk-ZPEKQHOC.js +0 -2
@@ -1,415 +1,6 @@
1
- /**
2
- * @module cli/commands/completion
3
- *
4
- * Implements the pm completion command surface and its agent-facing runtime behavior.
5
- */
6
-
7
- !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]="4bf2b42b-91f3-5850-b1f1-d8a01525860c")}catch(e){}}();
8
- import { EXIT_CODE, PmCliError } from "./runtime-primitives.js";
9
- import { listPmCommandsForTier } from "./agent-capability-contracts.js";
10
- import { SCAFFOLD_CAPABILITIES } from "./extension/scaffold.js";
11
- import { AGGREGATE_FLAG_CONTRACTS, ACTIVITY_FLAG_CONTRACTS, APPEND_FLAG_CONTRACTS, CALENDAR_FLAG_CONTRACTS, CLOSE_MANY_FLAG_CONTRACTS, COMPLETION_FLAG_CONTRACTS, CONTRACTS_FLAG_CONTRACTS, CONTEXT_FLAG_CONTRACTS, COPY_FLAG_CONTRACTS, FOCUS_FLAG_CONTRACTS, MEET_FLAG_CONTRACTS, REMIND_FLAG_CONTRACTS, CREATE_FLAG_CONTRACTS, DEPS_FLAG_CONTRACTS, DUPLICATES_FLAG_CONTRACTS, EXTENSION_FLAG_CONTRACTS, GRAPH_FLAG_CONTRACTS, GET_FLAG_CONTRACTS, GUIDE_FLAG_CONTRACTS, GLOBAL_FLAG_CONTRACTS, HEALTH_FLAG_CONTRACTS, HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS, HISTORY_FLAG_CONTRACTS, INIT_FLAG_CONTRACTS, LIST_FILTER_FLAG_CONTRACTS, NEXT_FLAG_CONTRACTS, PM_COMMAND_ALIAS_CONTRACTS, PACKAGE_FLAG_CONTRACTS, PLAN_FLAG_CONTRACTS, SEARCH_FLAG_CONTRACTS, STATS_FLAG_CONTRACTS, EVENTS_FLAG_CONTRACTS, UPDATE_FLAG_CONTRACTS, UPDATE_MANY_FLAG_CONTRACTS, UPGRADE_FLAG_CONTRACTS, toCompletionFlagString, } from "./cli-contracts.js";
12
- import { BUILTIN_ITEM_TYPE_VALUES, STATUS_VALUES } from "../types/index.js";
13
- import { listGuideTopicIds } from "./guide-topics.js";
14
- const VALID_SHELLS = ["bash", "zsh", "fish"];
15
- const DEFAULT_ITEM_TYPES = [...BUILTIN_ITEM_TYPE_VALUES];
16
- const DEFAULT_STATUS_VALUES = [...STATUS_VALUES];
17
- const HIDDEN_COMMAND_ALIASES = new Set(PM_COMMAND_ALIAS_CONTRACTS.filter((contract) => contract.hidden).map((contract) => contract.alias));
18
- const ALL_COMMANDS = listPmCommandsForTier("full").filter((command) => !HIDDEN_COMMAND_ALIASES.has(command));
19
- const LIST_FLAGS = toCompletionFlagString(LIST_FILTER_FLAG_CONTRACTS);
20
- const AGGREGATE_FLAGS = toCompletionFlagString(AGGREGATE_FLAG_CONTRACTS);
21
- const APPEND_FLAGS = toCompletionFlagString(APPEND_FLAG_CONTRACTS);
22
- const COPY_FLAGS = toCompletionFlagString(COPY_FLAG_CONTRACTS);
23
- const FOCUS_FLAGS = toCompletionFlagString(FOCUS_FLAG_CONTRACTS);
24
- const MEET_FLAGS = toCompletionFlagString(MEET_FLAG_CONTRACTS);
25
- const REMIND_FLAGS = toCompletionFlagString(REMIND_FLAG_CONTRACTS);
26
- const CREATE_FLAGS = toCompletionFlagString(CREATE_FLAG_CONTRACTS);
27
- const GET_FLAGS = toCompletionFlagString(GET_FLAG_CONTRACTS);
28
- const UPDATE_FLAGS = toCompletionFlagString(UPDATE_FLAG_CONTRACTS);
29
- const UPDATE_MANY_FLAGS = toCompletionFlagString(UPDATE_MANY_FLAG_CONTRACTS);
30
- const CLOSE_MANY_FLAGS = toCompletionFlagString(CLOSE_MANY_FLAG_CONTRACTS);
31
- const ACTIVITY_FLAGS = toCompletionFlagString(ACTIVITY_FLAG_CONTRACTS);
32
- const HISTORY_FLAGS = toCompletionFlagString(HISTORY_FLAG_CONTRACTS);
33
- const HISTORY_AUTHOR_ACKNOWLEDGE_FLAGS = toCompletionFlagString(HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS, false);
34
- const EVENTS_FLAGS = toCompletionFlagString(EVENTS_FLAG_CONTRACTS);
35
- const CALENDAR_FLAGS = toCompletionFlagString(CALENDAR_FLAG_CONTRACTS);
36
- const CONTEXT_FLAGS = toCompletionFlagString(CONTEXT_FLAG_CONTRACTS);
37
- const NEXT_FLAGS = toCompletionFlagString(NEXT_FLAG_CONTRACTS);
38
- const DEPS_FLAGS = toCompletionFlagString(DEPS_FLAG_CONTRACTS);
39
- const DUPLICATES_FLAGS = toCompletionFlagString(DUPLICATES_FLAG_CONTRACTS);
40
- const GRAPH_FLAGS = toCompletionFlagString(GRAPH_FLAG_CONTRACTS);
41
- const GUIDE_FLAGS = toCompletionFlagString(GUIDE_FLAG_CONTRACTS);
42
- const SEARCH_FLAGS = toCompletionFlagString(SEARCH_FLAG_CONTRACTS);
43
- const STATS_FLAGS = toCompletionFlagString(STATS_FLAG_CONTRACTS);
44
- const HEALTH_FLAGS = toCompletionFlagString(HEALTH_FLAG_CONTRACTS);
45
- const INIT_FLAGS = toCompletionFlagString(INIT_FLAG_CONTRACTS);
46
- const CONTRACTS_FLAGS = toCompletionFlagString(CONTRACTS_FLAG_CONTRACTS);
47
- const PLAN_FLAGS = toCompletionFlagString(PLAN_FLAG_CONTRACTS);
48
- const PLAN_SUBCOMMANDS_LIST = "create show add-step update-step complete-step block-step reorder-step remove-step link unlink decision discovery validation resume approve materialize";
49
- const COMPLETION_FLAGS = toCompletionFlagString(COMPLETION_FLAG_CONTRACTS);
50
- const COMPLETION_SHELL_CHOICES = `${COMPLETION_FLAGS} bash zsh fish`;
51
- const GUIDE_TOPIC_CHOICES = joinCompletionValues(listGuideTopicIds());
52
- const EXTENSION_LIFECYCLE_ACTIONS = "init scaffold install uninstall explore manage describe reload doctor catalog adopt adopt-all activate deactivate migrate";
53
- const PACKAGE_LIFECYCLE_ACTIONS = `${EXTENSION_LIFECYCLE_ACTIONS} upgrade`;
54
- const EXTENSION_LIFECYCLE_FLAGS = toCompletionFlagString(EXTENSION_FLAG_CONTRACTS);
55
- const PACKAGE_LIFECYCLE_FLAGS = toCompletionFlagString(PACKAGE_FLAG_CONTRACTS);
56
- const UPGRADE_FLAGS = toCompletionFlagString(UPGRADE_FLAG_CONTRACTS);
57
- const MUTATION_FLAGS = "--author --message --force --json --quiet --no-changed-fields --id-only --pm-path --path --no-extensions --no-pager --profile --help";
58
- const DELETE_MUTATION_FLAGS = "--dry-run --author --message --force --json --quiet --no-changed-fields --id-only --pm-path --path --no-extensions --no-pager --profile --help";
59
- const CLOSE_MUTATION_FLAGS = "--author --message --validate-close --duplicate-of --force --json --quiet --no-changed-fields --id-only --pm-path --path --no-extensions --no-pager --profile --help";
60
- const RELEASE_MUTATION_FLAGS = "--author --message --force --json --quiet --no-changed-fields --id-only --pm-path --path --no-extensions --no-pager --profile --help";
61
- const COMMAND_COMPLETION_DESCRIPTIONS = [
62
- ["init", "Initialize pm storage for the current workspace"],
63
- ["config", "Read or update pm settings"],
64
- ["package", "Manage package lifecycle operations"],
65
- ["packages", "Alias for package"],
66
- ["create", "Create a new project management item"],
67
- ["copy", "Copy an existing item to a new ID"],
68
- ["focus", "Set/clear/show the session focused parent for new items"],
69
- ["list", "List active items with optional filters"],
70
- [
71
- "aggregate",
72
- "Aggregate grouped item counts and numeric stats for governance queries",
73
- ],
74
- ["duplicates", "Find bounded duplicate clusters across lifecycle statuses"],
75
- ["guide", "Browse local progressive-disclosure guides"],
76
- ["calendar", "Show calendar views for deadlines and reminders"],
77
- ["cal", "Alias for calendar"],
78
- ["context", "Show a token-efficient project context snapshot"],
79
- ["ctx", "Alias for context"],
80
- ["get", "Show item details by ID"],
81
- ["next", "Recommend the next actionable (unblocked, ready) work item"],
82
- ["search", "Search items with keyword, semantic, or hybrid modes"],
83
- ["reindex", "Rebuild search artifacts"],
84
- ["history", "Show item history entries"],
85
- [
86
- "history-compact",
87
- "Compact history streams into a synthetic baseline + retained tail",
88
- ],
89
- [
90
- "history-redact",
91
- "Redact sensitive literals/patterns and recompute history hashes",
92
- ],
93
- [
94
- "history-repair",
95
- "Re-anchor a drifted history chain so pm health/validate report ok",
96
- ],
97
- [
98
- "schema",
99
- "Manage custom item types and statuses in .agents/pm/schema/*.json",
100
- ],
101
- [
102
- "profile",
103
- "List, show, apply, and lint project profiles (archetype schema/config/template/package bundles)",
104
- ],
105
- [
106
- "plan",
107
- "Agent-optimized Plan item workflow (create/show/add-step/update-step/complete-step/link/approve/materialize)",
108
- ],
109
- ["activity", "Show recent activity across items"],
110
- ["restore", "Restore an item to an earlier state"],
111
- ["update", "Update item fields and metadata"],
112
- [
113
- "update-many",
114
- "Bulk-update matched items with dry-run and rollback checkpoints",
115
- ],
116
- ["close", "Close an item (reason requirement follows governance settings)"],
117
- [
118
- "close-many",
119
- "Bulk-close matched items with an optional shared reason and rollback checkpoint",
120
- ],
121
- ["delete", "Delete an item and record the change"],
122
- ["append", "Append text to an item body"],
123
- ["comments", "List or add comments for an item"],
124
- ["notes", "List or add notes for an item"],
125
- ["learnings", "List or add learnings for an item"],
126
- ["files", "Manage linked files"],
127
- ["docs", "Manage linked docs"],
128
- ["deps", "Show dependency relationships for an item"],
129
- ["graph", "Bounded graph traversal, analytics, and governance-audit queries"],
130
- ["test", "Manage linked tests and optionally run them"],
131
- ["test-all", "Run linked tests across matching items"],
132
- ["test-runs", "Manage background linked-test runs"],
133
- ["stats", "Show project tracker statistics"],
134
- ["health", "Show project tracker health checks"],
135
- ["validate", "Run standalone validation checks"],
136
- ["gc", "Clean optional cache artifacts"],
137
- ["contracts", "Show machine-readable command and schema contracts"],
138
- ["claim", "Claim an item for active work"],
139
- ["release", "Release the active claim for an item"],
140
- ["start-task", "Lifecycle alias to claim and set in_progress"],
141
- ["pause-task", "Lifecycle alias to reopen and release claim"],
142
- ["close-task", "Lifecycle alias to close and release claim"],
143
- ["meet", "Shortcut to create a Meeting with scheduling defaults"],
144
- ["event", "Shortcut to create an Event with scheduling defaults"],
145
- ["remind", "Shortcut to create a Reminder from a point in time"],
146
- ["templates", "Manage reusable create templates"],
147
- ["completion", "Generate shell completion"],
148
- ["help", "Display help for a command"],
149
- ];
150
- const FISH_COMMAND_DESCRIPTION_OVERRIDES = new Map([
151
- ["calendar", "Show deadline/reminder calendar views"],
152
- ["schema", "Inspect and manage runtime schema"],
153
- [
154
- "profile",
155
- "List, show, apply, and lint project profiles (archetype bundles)",
156
- ],
157
- [
158
- "plan",
159
- "Agent-optimized Plan workflow (create/show/add-step/update-step/complete-step/link/approve/materialize)",
160
- ],
161
- ["start-task", "Lifecycle alias to claim and set in-progress"],
162
- ]);
163
- const GLOBAL_FLAGS = GLOBAL_FLAG_CONTRACTS.flatMap((entry) => [
164
- entry.short,
165
- entry.flag,
166
- ...(entry.aliases ?? []),
167
- ])
168
- .filter((value) => Boolean(value))
169
- .join(" ");
170
- function joinCompletionValues(values) {
171
- return [
172
- ...new Set(values.map((value) => value.trim()).filter((value) => value.length > 0)),
173
- ]
174
- .sort((left, right) => left.localeCompare(right))
175
- .join(" ");
176
- }
177
- function joinCompletionValuesInOrder(values) {
178
- return [
179
- ...new Set(values.map((value) => value.trim()).filter((value) => value.length > 0)),
180
- ].join(" ");
181
- }
182
- function shellDoubleQuote(value) {
183
- return value
184
- .replaceAll("\\", "\\\\")
185
- .replaceAll('"', '\\"')
186
- .replaceAll("$", "\\$")
187
- .replaceAll("`", "\\`");
188
- }
189
- function completionTypeValues(itemTypes, runtime) {
190
- return joinCompletionValuesInOrder(itemTypes.length > 0
191
- ? itemTypes
192
- : (runtime.item_types ?? DEFAULT_ITEM_TYPES));
193
- }
194
- function completionStatusValues(runtime) {
195
- return joinCompletionValues(runtime.statuses ?? DEFAULT_STATUS_VALUES);
196
- }
197
- function mergeFlagStrings(baseFlags, runtimeFlags) {
198
- const merged = [
199
- ...baseFlags.split(/\s+/u).filter((value) => value.length > 0),
200
- ...(runtimeFlags ?? []),
201
- ];
202
- return joinCompletionValues(merged);
203
- }
204
- function normalizeRuntimeCompletionFlags(runtimeFlags) {
205
- const normalized = (runtimeFlags ?? [])
206
- .map((value) => value.trim())
207
- .filter((value) => value.startsWith("--") && value.length > 2)
208
- .map((value) => `--${value.slice(2).replaceAll("_", "-")}`);
209
- return [...new Set(normalized)].sort((left, right) => left.localeCompare(right));
210
- }
211
- function renderZshRuntimeFieldFlagSpecs(runtimeFlags) {
212
- const normalized = normalizeRuntimeCompletionFlags(runtimeFlags);
213
- if (normalized.length === 0) {
214
- return "";
215
- }
216
- return `${normalized.map((flag) => ` '${flag}[Runtime schema field flag]:value' \\`).join("\n")}\n`;
217
- }
218
- function renderZshArgumentSpecs(specs, options = {}) {
219
- const trailingContinuation = options.trailingContinuation ?? true;
220
- const lastSpecIndex = specs.length - 1;
221
- return specs
222
- .map((spec, index) => ` ${spec}${trailingContinuation || index !== lastSpecIndex ? " \\" : ""}`)
223
- .join("\n");
224
- }
225
- function renderZshCommandDescriptions() {
226
- return COMMAND_COMPLETION_DESCRIPTIONS.map(([command, description]) => ` '${command}:${description}'`).join("\n");
227
- }
228
- function renderFishCommandDescriptions() {
229
- return COMMAND_COMPLETION_DESCRIPTIONS.filter(([command]) => command !== "help")
230
- .map(([command, description]) => {
231
- const fishDescription = FISH_COMMAND_DESCRIPTION_OVERRIDES.get(command) ?? description;
232
- return `complete -c pm -n __pm_no_subcommand -a ${command.padEnd(16)} -d '${fishDescription}'`;
233
- })
234
- .join("\n");
235
- }
236
- function renderZshPresenceFilterSpecs(options) {
237
- const missingSpecs = [
238
- "reviewer-missing[Select only items missing reviewer]",
239
- "risk-missing[Select only items missing risk]",
240
- "confidence-missing[Select only items missing confidence]",
241
- "sprint-missing[Select only items missing sprint]",
242
- "release-missing[Select only items missing release]",
243
- ];
244
- const contentMissingAliasSpecs = options.includeContentMissingAliases === true
245
- ? [
246
- "files-missing[Alias for --no-files]",
247
- "docs-missing[Alias for --no-docs]",
248
- ]
249
- : [];
250
- const pairedSpecs = [
251
- [
252
- "has-notes[Select only items that have notes]",
253
- "no-notes[Select only items with no notes]",
254
- ],
255
- [
256
- "has-learnings[Select only items that have learnings]",
257
- "no-learnings[Select only items with no learnings]",
258
- ],
259
- [
260
- "has-files[Select only items that have linked files]",
261
- "no-files[Select only items with no linked files]",
262
- ],
263
- [
264
- "has-docs[Select only items that have linked docs]",
265
- "no-docs[Select only items with no linked docs]",
266
- ],
267
- [
268
- "has-tests[Select only items that have linked tests]",
269
- "no-tests[Select only items with no linked tests]",
270
- ],
271
- [
272
- "has-comments[Select only items that have comments]",
273
- "no-comments[Select only items with no comments]",
274
- ],
275
- [
276
- "has-deps[Select only items that have dependencies]",
277
- "no-deps[Select only items with no dependencies]",
278
- ],
279
- [
280
- "has-body[Select only items with non-empty body]",
281
- "empty-body[Select only items with empty body]",
282
- ],
283
- [
284
- "has-linked-command[Select only items that have a linked command]",
285
- "no-linked-command[Select only items with no linked command]",
286
- ],
287
- ];
288
- return renderZshArgumentSpecs([
289
- ...[...missingSpecs, ...contentMissingAliasSpecs].map((spec) => `'--${options.missingPrefix}${spec}'`),
290
- ...pairedSpecs.flatMap(([positive, negative]) => [
291
- `'--${options.pairedPrefix}${positive}'`,
292
- `'--${options.pairedPrefix}${negative}'`,
293
- ]),
294
- ]);
295
- }
296
- const ZSH_MUTATION_COLLECTION_ARGUMENT_SPECS = [
297
- "'--comment[Comment seed author=<value>,created_at=<iso|now>,text=<value>]:comment'",
298
- "'--note[Note seed author=<value>,created_at=<iso|now>,text=<value>]:note'",
299
- "'--learning[Learning seed author=<value>,created_at=<iso|now>,text=<value>]:learning'",
300
- "'--file[Linked file path=<value>,scope=<project|global>,note=<text>]:file'",
301
- "'--test[Linked test command=<value>,path=<value>,scope=<project|global>]:test'",
302
- "'--doc[Linked doc path=<value>,scope=<project|global>,note=<text>]:doc'",
303
- "'--reminder[Reminder entry at=<iso|relative>|date=<iso|relative>,text=<text>|title=<text>]:reminder'",
304
- "'--event[Event entry start=<iso|relative>,end=<iso|relative>,recur_*]:event'",
305
- "'--type-option[Type option key=value or key=<name>,value=<value>]:type_option'",
306
- "'--unset[Clear scalar metadata field by name]:field'",
307
- "'--replace-files[Atomically replace linked files with provided --file values]'",
308
- "'--replace-docs[Atomically replace linked docs with provided --doc values]'",
309
- "'--clear-deps[Clear dependency entries]'",
310
- "'--clear-comments[Clear comments]'",
311
- "'--clear-notes[Clear notes]'",
312
- "'--clear-learnings[Clear learnings]'",
313
- "'--clear-files[Clear linked files]'",
314
- "'--clear-tests[Clear linked tests]'",
315
- "'--clear-docs[Clear linked docs]'",
316
- "'--clear-reminders[Clear reminders]'",
317
- "'--clear-events[Clear events]'",
318
- "'--clear-type-options[Clear type options]'",
319
- ];
320
- function renderZshScheduleItemSpecs(kind) {
321
- const leadingSpecs = kind === "reminder"
322
- ? [
323
- "'--at[Reminder time (default +1d)]:at'",
324
- "'--text[Reminder text (defaults to title)]:text'",
325
- ]
326
- : [
327
- "'--start[Start time (ISO, now, or relative)]:start'",
328
- "'--duration[Duration from start (default 1h)]:duration'",
329
- "'--end[End time (overrides --duration)]:end'",
330
- "'--location[Location]:location'",
331
- "'--timezone[IANA timezone]:timezone'",
332
- "'--all-day[Mark as an all-day event]'",
333
- ];
334
- return renderZshArgumentSpecs([
335
- ...leadingSpecs,
336
- "'--parent[Parent item id]:parent'",
337
- "'--allow-missing-parent[Permit a parent id that does not exist yet]'",
338
- "'--tags[Comma-separated tags]:tags'",
339
- "'(-p --priority)'{-p,--priority}'[Priority (0-4)]:(0 1 2 3 4)'",
340
- "'(-b --body)'{-b,--body}'[Item body]:body'",
341
- "'(-d --description)'{-d,--description}'[Short description]:description'",
342
- "'--author[Mutation author]:author'",
343
- "'--message[History message]:message'",
344
- "'--json[Output JSON]'",
345
- "'--quiet[Suppress stdout]'",
346
- ], { trailingContinuation: false });
347
- }
348
- function renderZshBulkSelectionFilterSpecs(action, statusChoices, typeChoices, tagChoices) {
349
- return renderZshArgumentSpecs([
350
- `'--filter-status[Filter by status before ${action}]:(${statusChoices})'`,
351
- `'--filter-type[Filter by type before ${action}]:(${typeChoices})'`,
352
- `'--filter-tag[Filter by tag before ${action}]:(${tagChoices})'`,
353
- `'--filter-priority[Filter by priority before ${action}]:(0 1 2 3 4)'`,
354
- "'--filter-deadline-before[Filter by deadline upper bound]:deadline'",
355
- "'--filter-deadline-after[Filter by deadline lower bound]:deadline'",
356
- "'--filter-updated-after[Filter by updated_at lower bound (ISO/relative)]:timestamp'",
357
- "'--filter-updated-before[Filter by updated_at upper bound (ISO/relative)]:timestamp'",
358
- "'--filter-created-after[Filter by created_at lower bound (ISO/relative)]:timestamp'",
359
- "'--filter-created-before[Filter by created_at upper bound (ISO/relative)]:timestamp'",
360
- `'--filter-assignee[Filter by assignee before ${action}]:assignee'`,
361
- "'--filter-assignee-filter[Filter assignee presence]:(assigned unassigned)'",
362
- "'--filter-parent[Filter by parent item ID]:parent'",
363
- "'--filter-sprint[Filter by sprint]:sprint'",
364
- "'--filter-release[Filter by release]:release'",
365
- ]);
366
- }
367
- function renderFishRuntimeFieldFlagSpecs(commands, runtimeFlags) {
368
- const normalizedFlags = normalizeRuntimeCompletionFlags(runtimeFlags).map((flag) => flag.slice(2));
369
- if (commands.length === 0 || normalizedFlags.length === 0) {
370
- return "";
371
- }
372
- const lines = [];
373
- for (const command of commands) {
374
- for (const flag of normalizedFlags) {
375
- lines.push(`complete -c pm -n '__fish_seen_subcommand_from ${command}' -l ${flag} -d 'Runtime schema field flag' -r`);
376
- }
377
- }
378
- return `${lines.join("\n")}\n`;
379
- }
380
- function renderBashDynamicChoiceResolver(kind, command, fallback) {
381
- const envKind = kind.toUpperCase();
382
- const cacheVar = `PM_COMPLETION_${envKind}_CACHE`;
383
- const cacheTsVar = `PM_COMPLETION_${envKind}_CACHE_TS`;
384
- const ttlVar = `PM_COMPLETION_${envKind}_TTL`;
385
- const escapedFallback = shellDoubleQuote(fallback);
386
- return [
387
- `_pm_completion_${kind}_choices() {`,
388
- " local now ttl cache_ts resolved",
389
- ' now="$(date +%s 2>/dev/null || echo 0)"',
390
- ` ttl="\${${ttlVar}:-120}"`,
391
- ` cache_ts="\${${cacheTsVar}:-0}"`,
392
- ` if [[ -n "\${${cacheVar}:-}" && "$now" -ne 0 && $((now - cache_ts)) -lt "$ttl" ]]; then`,
393
- ` printf '%s\\n' "$${cacheVar}"`,
394
- " return 0",
395
- " fi",
396
- ` resolved="$(pm ${command} 2>/dev/null)"`,
397
- ' if [[ -z "$resolved" ]]; then',
398
- ` resolved="${escapedFallback}"`,
399
- " fi",
400
- ` ${cacheVar}="$resolved"`,
401
- ` ${cacheTsVar}="$now"`,
402
- ` printf '%s\\n' "$${cacheVar}"`,
403
- "}",
404
- ];
405
- }
406
- function renderZshDynamicChoiceResolver(kind, command, fallback) {
407
- const envKind = kind.toUpperCase();
408
- const cacheVar = `PM_COMPLETION_${envKind}_CACHE`;
409
- const cacheTsVar = `PM_COMPLETION_${envKind}_CACHE_TS`;
410
- const ttlVar = `PM_COMPLETION_${envKind}_TTL`;
411
- const escapedFallback = shellDoubleQuote(fallback);
412
- return `
1
+ !(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]="56fd6790-568a-5c97-ab94-4b645aaa3718")}catch(e2){}})();import{EXIT_CODE,PmCliError}from"./runtime-primitives.js";import{listPmCommandsForTier}from"./agent-capability-contracts.js";import{SCAFFOLD_CAPABILITIES}from"./extension/scaffold.js";import{AGGREGATE_FLAG_CONTRACTS,APPEND_FLAG_CONTRACTS,CALENDAR_FLAG_CONTRACTS,CLOSE_MANY_FLAG_CONTRACTS,COMPLETION_FLAG_CONTRACTS,CONTRACTS_FLAG_CONTRACTS,CONTEXT_FLAG_CONTRACTS,COPY_FLAG_CONTRACTS,FOCUS_FLAG_CONTRACTS,MEET_FLAG_CONTRACTS,REMIND_FLAG_CONTRACTS,CREATE_FLAG_CONTRACTS,DEPS_FLAG_CONTRACTS,DUPLICATES_FLAG_CONTRACTS,EXTENSION_FLAG_CONTRACTS,GRAPH_FLAG_CONTRACTS,GET_FLAG_CONTRACTS,GUIDE_FLAG_CONTRACTS,GLOBAL_FLAG_CONTRACTS,HEALTH_FLAG_CONTRACTS,HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS,HISTORY_FLAG_CONTRACTS,INIT_FLAG_CONTRACTS,LIST_FILTER_FLAG_CONTRACTS,NEXT_FLAG_CONTRACTS,PM_COMMAND_ALIAS_CONTRACTS,PM_HISTORY_COMMAND_ALIASES,resolveSubcommandFlagContractsForCommand,PACKAGE_FLAG_CONTRACTS,PLAN_FLAG_CONTRACTS,SEARCH_FLAG_CONTRACTS,STATS_FLAG_CONTRACTS,EVENTS_FLAG_CONTRACTS,UPDATE_FLAG_CONTRACTS,UPDATE_MANY_FLAG_CONTRACTS,UPGRADE_FLAG_CONTRACTS,toCompletionFlagString}from"./cli-contracts.js";import{BUILTIN_ITEM_TYPE_VALUES,STATUS_VALUES}from"../types/index.js";import{listGuideTopicIds}from"./guide-topics.js";import{enrichCliFlagInvocationContracts}from"./flag-invocation-contracts.js";import{GLOBAL_VALUE_CONSUMING_FLAGS}from"./cli-contracts/bootstrap-command-scanner.js";const VALID_SHELLS=["bash","zsh","fish"];const DEFAULT_ITEM_TYPES=[...BUILTIN_ITEM_TYPE_VALUES];const DEFAULT_STATUS_VALUES=[...STATUS_VALUES];const HIDDEN_COMMAND_ALIASES=new Set(PM_COMMAND_ALIAS_CONTRACTS.filter(contract=>contract.hidden).map(contract=>contract.alias));const ALL_COMMANDS=listPmCommandsForTier("full").filter(command=>!HIDDEN_COMMAND_ALIASES.has(command));const LIST_FLAGS=toCompletionFlagString(LIST_FILTER_FLAG_CONTRACTS);const AGGREGATE_FLAGS=toCompletionFlagString(AGGREGATE_FLAG_CONTRACTS);const APPEND_FLAGS=toCompletionFlagString(APPEND_FLAG_CONTRACTS);const COPY_FLAGS=toCompletionFlagString(COPY_FLAG_CONTRACTS);const RESTORE_INVOCATIONS=enrichCliFlagInvocationContracts("restore",resolveSubcommandFlagContractsForCommand("restore"));const FOCUS_FLAGS=toCompletionFlagString(FOCUS_FLAG_CONTRACTS);const MEET_FLAGS=toCompletionFlagString(MEET_FLAG_CONTRACTS);const REMIND_FLAGS=toCompletionFlagString(REMIND_FLAG_CONTRACTS);const CREATE_FLAGS=toCompletionFlagString(CREATE_FLAG_CONTRACTS);const GET_FLAGS=toCompletionFlagString(GET_FLAG_CONTRACTS);const UPDATE_FLAGS=toCompletionFlagString(UPDATE_FLAG_CONTRACTS);const UPDATE_MANY_FLAGS=toCompletionFlagString(UPDATE_MANY_FLAG_CONTRACTS);const CLOSE_MANY_FLAGS=toCompletionFlagString(CLOSE_MANY_FLAG_CONTRACTS);const HISTORY_LEAVES=PM_HISTORY_COMMAND_ALIASES.map(entry=>entry.canonical_argv[1]).join(" ");const HISTORY_OPERATION_FLAGS=PM_HISTORY_COMMAND_ALIASES.map(entry=>({...entry,flags:toCompletionFlagString(resolveSubcommandFlagContractsForCommand(entry.alias))}));const HISTORY_FLAGS=toCompletionFlagString(HISTORY_FLAG_CONTRACTS);const HISTORY_AUTHOR_ACKNOWLEDGE_FLAGS=toCompletionFlagString(HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS,false);const EVENTS_FLAGS=toCompletionFlagString(EVENTS_FLAG_CONTRACTS);const CALENDAR_FLAGS=toCompletionFlagString(CALENDAR_FLAG_CONTRACTS);const CONTEXT_FLAGS=toCompletionFlagString(CONTEXT_FLAG_CONTRACTS);const NEXT_FLAGS=toCompletionFlagString(NEXT_FLAG_CONTRACTS);const DEPS_FLAGS=toCompletionFlagString(DEPS_FLAG_CONTRACTS);const DUPLICATES_FLAGS=toCompletionFlagString(DUPLICATES_FLAG_CONTRACTS);const GRAPH_FLAGS=toCompletionFlagString(GRAPH_FLAG_CONTRACTS);const GUIDE_FLAGS=toCompletionFlagString(GUIDE_FLAG_CONTRACTS);const SEARCH_FLAGS=toCompletionFlagString(SEARCH_FLAG_CONTRACTS);const STATS_FLAGS=toCompletionFlagString(STATS_FLAG_CONTRACTS);const HEALTH_FLAGS=toCompletionFlagString(HEALTH_FLAG_CONTRACTS);const INIT_FLAGS=toCompletionFlagString(INIT_FLAG_CONTRACTS);const CONTRACTS_FLAGS=toCompletionFlagString(CONTRACTS_FLAG_CONTRACTS);const PLAN_FLAGS=toCompletionFlagString(PLAN_FLAG_CONTRACTS);const PLAN_SUBCOMMANDS_LIST="create show add-step update-step complete-step block-step reorder-step remove-step link unlink decision discovery validation resume approve materialize";const COMPLETION_FLAGS=toCompletionFlagString(COMPLETION_FLAG_CONTRACTS);const COMPLETION_SHELL_CHOICES=`${COMPLETION_FLAGS} bash zsh fish`;const GUIDE_TOPIC_CHOICES=joinCompletionValues(listGuideTopicIds());const EXTENSION_LIFECYCLE_ACTIONS="init scaffold install uninstall explore manage describe reload doctor catalog adopt adopt-all activate deactivate migrate";const PACKAGE_LIFECYCLE_ACTIONS=`${EXTENSION_LIFECYCLE_ACTIONS} upgrade`;const EXTENSION_LIFECYCLE_FLAGS=toCompletionFlagString(EXTENSION_FLAG_CONTRACTS);const PACKAGE_LIFECYCLE_FLAGS=toCompletionFlagString(PACKAGE_FLAG_CONTRACTS);const UPGRADE_FLAGS=toCompletionFlagString(UPGRADE_FLAG_CONTRACTS);const MUTATION_FLAGS="--author --message --force --json --quiet --no-changed-fields --id-only --pm-path --path --no-extensions --no-pager --profile --help";const DELETE_MUTATION_FLAGS="--dry-run --author --message --force --json --quiet --no-changed-fields --id-only --pm-path --path --no-extensions --no-pager --profile --help";const CLOSE_MUTATION_FLAGS="--author --message --validate-close --duplicate-of --force --json --quiet --no-changed-fields --id-only --pm-path --path --no-extensions --no-pager --profile --help";const RELEASE_MUTATION_FLAGS="--author --message --force --json --quiet --no-changed-fields --id-only --pm-path --path --no-extensions --no-pager --profile --help";const COMMAND_COMPLETION_DESCRIPTIONS=[["init","Initialize pm storage for the current workspace"],["config","Read or update pm settings"],["package","Manage package lifecycle operations"],["packages","Alias for package"],["create","Create a new project management item"],["copy","Copy an existing item to a new ID"],["focus","Set/clear/show the session focused parent for new items"],["list","List active items with optional filters"],["aggregate","Aggregate grouped item counts and numeric stats for governance queries"],["duplicates","Find bounded duplicate clusters across lifecycle statuses"],["guide","Browse local progressive-disclosure guides"],["calendar","Show calendar views for deadlines and reminders"],["cal","Alias for calendar"],["context","Show a token-efficient project context snapshot"],["ctx","Alias for context"],["get","Show item details by ID"],["next","Recommend the next actionable (unblocked, ready) work item"],["search","Search items with keyword, semantic, or hybrid modes"],["reindex","Rebuild search artifacts"],["history","Show item history entries"],["history-compact","Compact history streams into a synthetic baseline + retained tail"],["history-redact","Redact sensitive literals/patterns and recompute history hashes"],["history-repair","Re-anchor a drifted history chain so pm health/validate report ok"],["schema","Manage custom item types and statuses in .agents/pm/schema/*.json"],["profile","List, show, apply, and lint project profiles (archetype schema/config/template/package bundles)"],["plan","Agent-optimized Plan item workflow (create/show/add-step/update-step/complete-step/link/approve/materialize)"],["activity","Show recent activity across items"],["restore","Restore an item to an earlier state"],["update","Update item fields and metadata"],["update-many","Bulk-update matched items with dry-run and rollback checkpoints"],["close","Close an item (reason requirement follows governance settings)"],["close-many","Bulk-close matched items with an optional shared reason and rollback checkpoint"],["delete","Delete an item and record the change"],["append","Append text to an item body"],["comments","List or add comments for an item"],["notes","List or add notes for an item"],["learnings","List or add learnings for an item"],["files","Manage linked files"],["docs","Manage linked docs"],["deps","Show dependency relationships for an item"],["graph","Bounded graph traversal, analytics, and governance-audit queries"],["test","Manage linked tests and optionally run them"],["test-all","Run linked tests across matching items"],["test-runs","Manage background linked-test runs"],["stats","Show project tracker statistics"],["health","Show project tracker health checks"],["validate","Run standalone validation checks"],["gc","Clean optional cache artifacts"],["contracts","Show machine-readable command and schema contracts"],["claim","Claim an item for active work"],["release","Release the active claim for an item"],["start-task","Lifecycle alias to claim and set in_progress"],["pause-task","Lifecycle alias to reopen and release claim"],["close-task","Lifecycle alias to close and release claim"],["meet","Shortcut to create a Meeting with scheduling defaults"],["event","Shortcut to create an Event with scheduling defaults"],["remind","Shortcut to create a Reminder from a point in time"],["templates","Manage reusable create templates"],["completion","Generate shell completion"],["help","Display help for a command"]];const FISH_COMMAND_DESCRIPTION_OVERRIDES=new Map([["calendar","Show deadline/reminder calendar views"],["schema","Inspect and manage runtime schema"],["profile","List, show, apply, and lint project profiles (archetype bundles)"],["plan","Agent-optimized Plan workflow (create/show/add-step/update-step/complete-step/link/approve/materialize)"],["start-task","Lifecycle alias to claim and set in-progress"]]);const GLOBAL_FLAGS=GLOBAL_FLAG_CONTRACTS.flatMap(entry=>[entry.short,entry.flag,...entry.aliases??[]]).filter(value=>Boolean(value)).join(" ");const GLOBAL_COMPLETION_VALUE_PATTERNS=[...GLOBAL_VALUE_CONSUMING_FLAGS].join("|");const GLOBAL_COMPLETION_INLINE_PATTERNS=[...GLOBAL_VALUE_CONSUMING_FLAGS].map(flag=>`${flag}=*`).join("|");const GLOBAL_COMPLETION_SWITCH_PATTERNS=[...GLOBAL_FLAGS.split(" ").filter(flag=>!GLOBAL_VALUE_CONSUMING_FLAGS.has(flag)),"-h","-V"].join("|");function joinCompletionValues(values){return[...new Set(values.map(value=>value.trim()).filter(value=>value.length>0))].sort((left,right)=>left.localeCompare(right)).join(" ")}function joinCompletionValuesInOrder(values){return[...new Set(values.map(value=>value.trim()).filter(value=>value.length>0))].join(" ")}function shellDoubleQuote(value){return value.replaceAll("\\","\\\\").replaceAll('"','\\"').replaceAll("$","\\$").replaceAll("`","\\`")}function completionTypeValues(itemTypes,runtime){return joinCompletionValuesInOrder(itemTypes.length>0?itemTypes:runtime.item_types??DEFAULT_ITEM_TYPES)}function completionStatusValues(runtime){return joinCompletionValues(runtime.statuses??DEFAULT_STATUS_VALUES)}function mergeFlagStrings(baseFlags,runtimeFlags){const merged=[...baseFlags.split(/\s+/u).filter(value=>value.length>0),...runtimeFlags??[]];return joinCompletionValues(merged)}function normalizeRuntimeCompletionFlags(runtimeFlags){const normalized=(runtimeFlags??[]).map(value=>value.trim()).filter(value=>value.startsWith("--")&&value.length>2).map(value=>`--${value.slice(2).replaceAll("_","-")}`);return[...new Set(normalized)].sort((left,right)=>left.localeCompare(right))}function renderZshRuntimeFieldFlagSpecs(runtimeFlags){const normalized=normalizeRuntimeCompletionFlags(runtimeFlags);if(normalized.length===0){return""}return`${normalized.map(flag=>` '${flag}[Runtime schema field flag]:value' \\`).join("\n")}
2
+ `}function renderZshArgumentSpecs(specs,options={}){const trailingContinuation=options.trailingContinuation??true;const lastSpecIndex=specs.length-1;return specs.map((spec,index)=>` ${spec}${trailingContinuation||index!==lastSpecIndex?" \\":""}`).join("\n")}function renderZshCommandDescriptions(){return COMMAND_COMPLETION_DESCRIPTIONS.filter(([command])=>!HIDDEN_COMMAND_ALIASES.has(command)).map(([command,description])=>` '${command}:${description}'`).join("\n")}function renderFishCommandDescriptions(){return COMMAND_COMPLETION_DESCRIPTIONS.filter(([command])=>command!=="help"&&!HIDDEN_COMMAND_ALIASES.has(command)).map(([command,description])=>{const fishDescription=FISH_COMMAND_DESCRIPTION_OVERRIDES.get(command)??description;return`complete -c pm -n __pm_no_subcommand -a ${command.padEnd(16)} -d '${fishDescription}'`}).join("\n")}function renderZshPresenceFilterSpecs(options){const missingSpecs=["reviewer-missing[Select only items missing reviewer]","risk-missing[Select only items missing risk]","confidence-missing[Select only items missing confidence]","sprint-missing[Select only items missing sprint]","release-missing[Select only items missing release]"];const contentMissingAliasSpecs=options.includeContentMissingAliases===true?["files-missing[Alias for --no-files]","docs-missing[Alias for --no-docs]"]:[];const pairedSpecs=[["has-notes[Select only items that have notes]","no-notes[Select only items with no notes]"],["has-learnings[Select only items that have learnings]","no-learnings[Select only items with no learnings]"],["has-files[Select only items that have linked files]","no-files[Select only items with no linked files]"],["has-docs[Select only items that have linked docs]","no-docs[Select only items with no linked docs]"],["has-tests[Select only items that have linked tests]","no-tests[Select only items with no linked tests]"],["has-comments[Select only items that have comments]","no-comments[Select only items with no comments]"],["has-deps[Select only items that have dependencies]","no-deps[Select only items with no dependencies]"],["has-body[Select only items with non-empty body]","empty-body[Select only items with empty body]"],["has-linked-command[Select only items that have a linked command]","no-linked-command[Select only items with no linked command]"]];return renderZshArgumentSpecs([...[...missingSpecs,...contentMissingAliasSpecs].map(spec=>`'--${options.missingPrefix}${spec}'`),...pairedSpecs.flatMap(([positive,negative])=>[`'--${options.pairedPrefix}${positive}'`,`'--${options.pairedPrefix}${negative}'`])])}const ZSH_MUTATION_COLLECTION_ARGUMENT_SPECS=["'--comment[Comment seed author=<value>,created_at=<iso|now>,text=<value>]:comment'","'--note[Note seed author=<value>,created_at=<iso|now>,text=<value>]:note'","'--learning[Learning seed author=<value>,created_at=<iso|now>,text=<value>]:learning'","'--file[Linked file path=<value>,scope=<project|global>,note=<text>]:file'","'--test[Linked test command=<value>,path=<value>,scope=<project|global>]:test'","'--doc[Linked doc path=<value>,scope=<project|global>,note=<text>]:doc'","'--reminder[Reminder entry at=<iso|relative>|date=<iso|relative>,text=<text>|title=<text>]:reminder'","'--event[Event entry start=<iso|relative>,end=<iso|relative>,recur_*]:event'","'--type-option[Type option key=value or key=<name>,value=<value>]:type_option'","'--unset[Clear scalar metadata field by name]:field'","'--replace-files[Atomically replace linked files with provided --file values]'","'--replace-docs[Atomically replace linked docs with provided --doc values]'","'--clear-deps[Clear dependency entries]'","'--clear-comments[Clear comments]'","'--clear-notes[Clear notes]'","'--clear-learnings[Clear learnings]'","'--clear-files[Clear linked files]'","'--clear-tests[Clear linked tests]'","'--clear-docs[Clear linked docs]'","'--clear-reminders[Clear reminders]'","'--clear-events[Clear events]'","'--clear-type-options[Clear type options]'"];function renderZshScheduleItemSpecs(kind){const leadingSpecs=kind==="reminder"?["'--at[Reminder time (default +1d)]:at'","'--text[Reminder text (defaults to title)]:text'"]:["'--start[Start time (ISO, now, or relative)]:start'","'--duration[Duration from start (default 1h)]:duration'","'--end[End time (overrides --duration)]:end'","'--location[Location]:location'","'--timezone[IANA timezone]:timezone'","'--all-day[Mark as an all-day event]'"];return renderZshArgumentSpecs([...leadingSpecs,"'--parent[Parent item id]:parent'","'--allow-missing-parent[Permit a parent id that does not exist yet]'","'--tags[Comma-separated tags]:tags'","'(-p --priority)'{-p,--priority}'[Priority (0-4)]:(0 1 2 3 4)'","'(-b --body)'{-b,--body}'[Item body]:body'","'(-d --description)'{-d,--description}'[Short description]:description'","'--author[Mutation author]:author'","'--message[History message]:message'","'--json[Output JSON]'","'--quiet[Suppress stdout]'"],{trailingContinuation:false})}function renderZshBulkSelectionFilterSpecs(action,statusChoices,typeChoices,tagChoices){return renderZshArgumentSpecs([`'--filter-status[Filter by status before ${action}]:(${statusChoices})'`,`'--filter-type[Filter by type before ${action}]:(${typeChoices})'`,`'--filter-tag[Filter by tag before ${action}]:(${tagChoices})'`,`'--filter-priority[Filter by priority before ${action}]:(0 1 2 3 4)'`,"'--filter-deadline-before[Filter by deadline upper bound]:deadline'","'--filter-deadline-after[Filter by deadline lower bound]:deadline'","'--filter-updated-after[Filter by updated_at lower bound (ISO/relative)]:timestamp'","'--filter-updated-before[Filter by updated_at upper bound (ISO/relative)]:timestamp'","'--filter-created-after[Filter by created_at lower bound (ISO/relative)]:timestamp'","'--filter-created-before[Filter by created_at upper bound (ISO/relative)]:timestamp'",`'--filter-assignee[Filter by assignee before ${action}]:assignee'`,"'--filter-assignee-filter[Filter assignee presence]:(assigned unassigned)'","'--filter-parent[Filter by parent item ID]:parent'","'--filter-sprint[Filter by sprint]:sprint'","'--filter-release[Filter by release]:release'"])}function renderFishRuntimeFieldFlagSpecs(commands,runtimeFlags){const normalizedFlags=normalizeRuntimeCompletionFlags(runtimeFlags).map(flag=>flag.slice(2));if(commands.length===0||normalizedFlags.length===0){return""}const lines=[];for(const command of commands){for(const flag of normalizedFlags){lines.push(`complete -c pm -n '__fish_seen_subcommand_from ${command}' -l ${flag} -d 'Runtime schema field flag' -r`)}}return`${lines.join("\n")}
3
+ `}function renderBashDynamicChoiceResolver(kind,command,fallback){const envKind=kind.toUpperCase();const cacheVar=`PM_COMPLETION_${envKind}_CACHE`;const cacheTsVar=`PM_COMPLETION_${envKind}_CACHE_TS`;const ttlVar=`PM_COMPLETION_${envKind}_TTL`;const escapedFallback=shellDoubleQuote(fallback);return[`_pm_completion_${kind}_choices() {`," local now ttl cache_ts resolved",' now="$(date +%s 2>/dev/null || echo 0)"',` ttl="\${${ttlVar}:-120}"`,` cache_ts="\${${cacheTsVar}:-0}"`,` if [[ -n "\${${cacheVar}:-}" && "$now" -ne 0 && $((now - cache_ts)) -lt "$ttl" ]]; then`,` printf '%s\\n' "$${cacheVar}"`," return 0"," fi",` resolved="$(pm ${command} 2>/dev/null)"`,' if [[ -z "$resolved" ]]; then',` resolved="${escapedFallback}"`," fi",` ${cacheVar}="$resolved"`,` ${cacheTsVar}="$now"`,` printf '%s\\n' "$${cacheVar}"`,"}"]}function renderZshDynamicChoiceResolver(kind,command,fallback){const envKind=kind.toUpperCase();const cacheVar=`PM_COMPLETION_${envKind}_CACHE`;const cacheTsVar=`PM_COMPLETION_${envKind}_CACHE_TS`;const ttlVar=`PM_COMPLETION_${envKind}_TTL`;const escapedFallback=shellDoubleQuote(fallback);return`
413
4
  _pm_${kind}_choices() {
414
5
  local now ttl cache_ts resolved
415
6
  now=\${EPOCHSECONDS:-0}
@@ -427,12 +18,7 @@ _pm_${kind}_choices() {
427
18
  ${cacheTsVar}="$now"
428
19
  print -r -- "$${cacheVar}"
429
20
  }
430
- `;
431
- }
432
- function renderFishDynamicChoiceResolver(kind, command, fallback) {
433
- const envKind = kind.toUpperCase();
434
- const escapedFallback = fallback.replaceAll("'", "\\'");
435
- return `
21
+ `}function renderFishDynamicChoiceResolver(kind,command,fallback){const envKind=kind.toUpperCase();const escapedFallback=fallback.replaceAll("'","\\'");return`
436
22
  function __pm_${kind}_choices
437
23
  set -l now (date +%s ^/dev/null)
438
24
  if test -z "$now"
@@ -457,303 +43,7 @@ function __pm_${kind}_choices
457
43
  set -gx PM_COMPLETION_${envKind}_CACHE_TS $now
458
44
  printf '%s\\n' $resolved
459
45
  end
460
- `;
461
- }
462
- /** Implements generate bash script for the public runtime surface of this module. */
463
- export function generateBashScript(itemTypes = [], tags = [], eagerTagExpansion = false, runtime = {}) {
464
- const cmds = ALL_COMMANDS.join(" ");
465
- const useDynamicTypeExpansion = itemTypes.length === 0;
466
- const typeValues = completionTypeValues(itemTypes, runtime);
467
- const statusValues = completionStatusValues(runtime);
468
- const tagValues = joinCompletionValues(tags);
469
- const listFlags = mergeFlagStrings(LIST_FLAGS, runtime.command_flags?.list);
470
- const createFlags = mergeFlagStrings(CREATE_FLAGS, runtime.command_flags?.create);
471
- const updateFlags = mergeFlagStrings(UPDATE_FLAGS, runtime.command_flags?.update);
472
- const updateManyFlags = mergeFlagStrings(UPDATE_MANY_FLAGS, runtime.command_flags?.["update-many"]);
473
- const searchFlags = mergeFlagStrings(SEARCH_FLAGS, runtime.command_flags?.search);
474
- const calendarFlags = mergeFlagStrings(CALENDAR_FLAGS, runtime.command_flags?.calendar);
475
- const contextFlags = mergeFlagStrings(CONTEXT_FLAGS, runtime.command_flags?.context);
476
- const useEagerTagExpansion = eagerTagExpansion || tags.length > 0;
477
- // Note: "${...}" inside regular (non-template) strings are literal characters,
478
- // not JS interpolation. Only backtick template literals interpolate ${...}.
479
- const compgen = (flags) => `$(compgen -W "${flags}" -- "$cur")`;
480
- return [
481
- "# bash completion for pm",
482
- "# Source this file or add 'eval \"$(pm completion bash)\"' to ~/.bashrc",
483
- "",
484
- ...(useDynamicTypeExpansion
485
- ? [
486
- ...renderBashDynamicChoiceResolver("type", "completion-types", typeValues),
487
- "",
488
- ]
489
- : []),
490
- ...renderBashDynamicChoiceResolver("status", "completion-statuses", statusValues),
491
- "",
492
- "_pm_completion() {",
493
- " local cur prev words cword",
494
- " _init_completion 2>/dev/null || {",
495
- ' cur="${COMP_WORDS[COMP_CWORD]}"',
496
- ' prev="${COMP_WORDS[COMP_CWORD-1]}"',
497
- " cword=$COMP_CWORD",
498
- " }",
499
- "",
500
- " if [[ $cword -eq 1 ]]; then",
501
- ` COMPREPLY=(${compgen(cmds)})`,
502
- " return 0",
503
- " fi",
504
- "",
505
- ' if [[ "$prev" == "--type" ]]; then',
506
- useDynamicTypeExpansion
507
- ? ' COMPREPLY=($(compgen -W "$(_pm_completion_type_choices)" -- "$cur"))'
508
- : ` COMPREPLY=(${compgen(typeValues)})`,
509
- " return 0",
510
- " fi",
511
- "",
512
- ' if [[ "$prev" == "--status" ]]; then',
513
- ' COMPREPLY=($(compgen -W "$(_pm_completion_status_choices)" -- "$cur"))',
514
- " return 0",
515
- " fi",
516
- "",
517
- ...(useEagerTagExpansion
518
- ? [
519
- ' if [[ ( "$prev" == "--tag" || "$prev" == "--tags" ) && ! ( ( "${COMP_WORDS[1]}" == "package" || "${COMP_WORDS[1]}" == "packages" ) && "${COMP_WORDS[2]}" == "upgrade" ) ]]; then',
520
- ` COMPREPLY=(${compgen(tagValues)})`,
521
- " return 0",
522
- " fi",
523
- ]
524
- : [
525
- ' if [[ ( "$prev" == "--tag" || "$prev" == "--tags" ) && ! ( ( "${COMP_WORDS[1]}" == "package" || "${COMP_WORDS[1]}" == "packages" ) && "${COMP_WORDS[2]}" == "upgrade" ) ]]; then',
526
- " local now ttl cache_ts tag_values",
527
- ' now="$(date +%s 2>/dev/null || echo 0)"',
528
- ' ttl="${PM_COMPLETION_TAG_TTL:-120}"',
529
- ' cache_ts="${PM_COMPLETION_TAG_CACHE_TS:-0}"',
530
- ' tag_values="${PM_COMPLETION_TAG_CACHE:-}"',
531
- ' if [[ -z "$tag_values" || "$now" -eq 0 || $((now - cache_ts)) -ge "$ttl" ]]; then',
532
- ' tag_values="$(pm completion-tags 2>/dev/null)"',
533
- ' PM_COMPLETION_TAG_CACHE="$tag_values"',
534
- ' PM_COMPLETION_TAG_CACHE_TS="$now"',
535
- " fi",
536
- ' COMPREPLY=($(compgen -W "$tag_values" -- "$cur"))',
537
- " return 0",
538
- " fi",
539
- ]),
540
- "",
541
- ' if [[ "$prev" == "--tag" && ( ( "${COMP_WORDS[1]}" == "package" || "${COMP_WORDS[1]}" == "packages" ) && "${COMP_WORDS[2]}" == "upgrade" ) ]]; then',
542
- " COMPREPLY=()",
543
- " return 0",
544
- " fi",
545
- "",
546
- ' local cmd="${COMP_WORDS[1]}"',
547
- "",
548
- ' case "$cmd" in',
549
- " list)",
550
- ` COMPREPLY=(${compgen(listFlags)})`,
551
- " ;;",
552
- " aggregate)",
553
- ` COMPREPLY=(${compgen(AGGREGATE_FLAGS)})`,
554
- " ;;",
555
- " duplicates)",
556
- ` COMPREPLY=(${compgen(DUPLICATES_FLAGS)})`,
557
- " ;;",
558
- " create)",
559
- ` COMPREPLY=(${compgen(createFlags)})`,
560
- " ;;",
561
- " copy)",
562
- ` COMPREPLY=(${compgen(COPY_FLAGS)})`,
563
- " ;;",
564
- " focus)",
565
- ` COMPREPLY=(${compgen(FOCUS_FLAGS)})`,
566
- " ;;",
567
- " update)",
568
- ` COMPREPLY=(${compgen(updateFlags)})`,
569
- " ;;",
570
- " update-many)",
571
- ` COMPREPLY=(${compgen(updateManyFlags)})`,
572
- " ;;",
573
- " calendar|cal)",
574
- ` COMPREPLY=(${compgen(calendarFlags)})`,
575
- " ;;",
576
- " context|ctx)",
577
- ` COMPREPLY=(${compgen(contextFlags)})`,
578
- " ;;",
579
- " next)",
580
- ` COMPREPLY=(${compgen(NEXT_FLAGS)})`,
581
- " ;;",
582
- " guide)",
583
- ` COMPREPLY=(${compgen(`${GUIDE_FLAGS} ${GUIDE_TOPIC_CHOICES}`)})`,
584
- " ;;",
585
- " search)",
586
- ` COMPREPLY=(${compgen(searchFlags)})`,
587
- " ;;",
588
- " reindex)",
589
- ` COMPREPLY=(${compgen("--mode --progress --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`,
590
- " ;;",
591
- " init)",
592
- ` COMPREPLY=(${compgen(`${INIT_FLAGS} --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help`)})`,
593
- " ;;",
594
- " config)",
595
- ` COMPREPLY=(${compgen("--criterion --clear-criteria --format --policy --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`,
596
- " ;;",
597
- " extension)",
598
- ` COMPREPLY=(${compgen(`${EXTENSION_LIFECYCLE_ACTIONS} ${EXTENSION_LIFECYCLE_FLAGS}`)})`,
599
- " ;;",
600
- " package|packages)",
601
- ` COMPREPLY=(${compgen(`${PACKAGE_LIFECYCLE_ACTIONS} ${PACKAGE_LIFECYCLE_FLAGS} ${UPGRADE_FLAGS}`)})`,
602
- " ;;",
603
- " comments)",
604
- ` COMPREPLY=(${compgen("--add --body --stdin --file --edit --delete --limit --full-history --if-absent --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`,
605
- " ;;",
606
- " notes)",
607
- ` COMPREPLY=(${compgen("--add --add-json --stdin --file --edit --delete --limit --since --event-type --include-meta --full-history --if-absent --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`,
608
- " ;;",
609
- " learnings)",
610
- ` COMPREPLY=(${compgen("--add --stdin --file --edit --delete --limit --full-history --if-absent --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`,
611
- " ;;",
612
- " files)",
613
- ` COMPREPLY=(${compgen("discover lookup --add --add-glob --remove --migrate --list --apply --note --append-stable --validate-paths --scope --limit --offset --no-truncate --strict-read --explain --lines --decision-depth --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`,
614
- " ;;",
615
- " docs)",
616
- ` COMPREPLY=(${compgen("--add --add-glob --remove --migrate --note --validate-paths --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`,
617
- " ;;",
618
- " append)",
619
- ` COMPREPLY=(${compgen(APPEND_FLAGS)})`,
620
- " ;;",
621
- " deps)",
622
- ` COMPREPLY=(${compgen(DEPS_FLAGS)})`,
623
- " ;;",
624
- " graph)",
625
- ` COMPREPLY=(${compgen(`ancestors descendants predecessors successors paths impact analyze audit communities redundancy dominators slack centrality articulation plan index ${GRAPH_FLAGS}`)})`,
626
- " ;;",
627
- " test)",
628
- ` COMPREPLY=(${compgen("--add --add-json --remove --remove-index --list --run --match --only-index --only-last --background --timeout --progress --env-set --env-clear --shared-host-safe --pm-context --override-linked-pm-context --fail-on-context-mismatch --fail-on-skipped --fail-on-empty-test-run --require-assertions-for-pm --check-context --auto-pm-context --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`,
629
- " ;;",
630
- " test-all)",
631
- ` COMPREPLY=(${compgen("--status --limit --offset --background --timeout --progress --env-set --env-clear --shared-host-safe --pm-context --override-linked-pm-context --fail-on-context-mismatch --fail-on-skipped --fail-on-empty-test-run --require-assertions-for-pm --check-context --auto-pm-context --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`,
632
- " ;;",
633
- " test-runs)",
634
- ` COMPREPLY=(${compgen("list status logs stop resume --status --limit --stream --tail --force --author --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`,
635
- " ;;",
636
- " validate)",
637
- ` COMPREPLY=(${compgen("--check-metadata --metadata-profile --check-resolution --check-lifecycle --check-stale-blockers --dependency-cycle-severity --parent-cycle-severity --check-files --scan-mode --include-pm-internals --verbose-file-lists --verbose-diagnostics --all-affected-ids --strict-exit --fail-on-warn --fix-hints --auto-fix --dry-run --fix-scope --prune-missing --check-history-drift --check-command-references --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`,
638
- " ;;",
639
- " health)",
640
- ` COMPREPLY=(${compgen(HEALTH_FLAGS)})`,
641
- " ;;",
642
- " history)",
643
- ` COMPREPLY=(${compgen(HISTORY_FLAGS)})`,
644
- " ;;",
645
- " events)",
646
- ` COMPREPLY=(${compgen(EVENTS_FLAGS)})`,
647
- " ;;",
648
- " history-compact)",
649
- ` COMPREPLY=(${compgen("--before --ids --all-over --closed --all-streams --min-entries --dry-run --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`,
650
- " ;;",
651
- " history-author-acknowledge)",
652
- ` COMPREPLY=(${compgen(`${HISTORY_AUTHOR_ACKNOWLEDGE_FLAGS} --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help`)})`,
653
- " ;;",
654
- " get)",
655
- ` COMPREPLY=(${compgen(GET_FLAGS)})`,
656
- " ;;",
657
- " history-redact)",
658
- ` COMPREPLY=(${compgen("--literal --regex --replacement --dry-run --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`,
659
- " ;;",
660
- " history-repair)",
661
- ` COMPREPLY=(${compgen("--all --dry-run --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`,
662
- " ;;",
663
- " schema)",
664
- ` COMPREPLY=(${compgen("list show show-status add-type remove-type add-status remove-status add-field remove-field list-fields show-field apply-preset rename-type rename-field remap-status --description --default-status --folder --alias --role --order --type --commands --cli-flag --required --required-on-create --no-allow-unset --required-types --infer --min-count --apply --to --migration-id --dry-run --author --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`,
665
- " ;;",
666
- " profile)",
667
- ` COMPREPLY=(${compgen("list show apply lint agile ops research --dry-run --author --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`,
668
- " ;;",
669
- " plan)",
670
- ` COMPREPLY=(${compgen(`${PLAN_SUBCOMMANDS_LIST} ${PLAN_FLAGS}`)})`,
671
- " ;;",
672
- " activity)",
673
- ` COMPREPLY=(${compgen(ACTIVITY_FLAGS)})`,
674
- " ;;",
675
- " contracts)",
676
- ` COMPREPLY=(${compgen(CONTRACTS_FLAGS)})`,
677
- " ;;",
678
- " gc)",
679
- ` COMPREPLY=(${compgen("--dry-run --scope --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`,
680
- " ;;",
681
- " stats)",
682
- ` COMPREPLY=(${compgen(STATS_FLAGS)})`,
683
- " ;;",
684
- " close|close-task)",
685
- ` COMPREPLY=(${compgen(CLOSE_MUTATION_FLAGS)})`,
686
- " ;;",
687
- " close-many)",
688
- ` COMPREPLY=(${compgen(CLOSE_MANY_FLAGS)})`,
689
- " ;;",
690
- " release)",
691
- ` COMPREPLY=(${compgen(RELEASE_MUTATION_FLAGS)})`,
692
- " ;;",
693
- " delete)",
694
- ` COMPREPLY=(${compgen(DELETE_MUTATION_FLAGS)})`,
695
- " ;;",
696
- " claim|restore|start-task|pause-task)",
697
- ` COMPREPLY=(${compgen(MUTATION_FLAGS)})`,
698
- " ;;",
699
- " meet|event)",
700
- ` COMPREPLY=(${compgen(MEET_FLAGS)})`,
701
- " ;;",
702
- " remind)",
703
- ` COMPREPLY=(${compgen(REMIND_FLAGS)})`,
704
- " ;;",
705
- " completion)",
706
- ` COMPREPLY=(${compgen(COMPLETION_SHELL_CHOICES)})`,
707
- " ;;",
708
- " templates)",
709
- ` COMPREPLY=(${compgen("save list show")})`,
710
- " ;;",
711
- " *)",
712
- ` COMPREPLY=(${compgen(GLOBAL_FLAGS)})`,
713
- " ;;",
714
- " esac",
715
- ' if [[ "$cmd" == "comments" || "$cmd" == "notes" || "$cmd" == "learnings" ]]; then',
716
- ` COMPREPLY+=(${compgen("--text")})`,
717
- " fi",
718
- " return 0",
719
- "}",
720
- "",
721
- "complete -F _pm_completion pm",
722
- ].join("\n");
723
- }
724
- /** Implements generate zsh script for the public runtime surface of this module. */
725
- export function generateZshScript(itemTypes = [], tags = [], eagerTagExpansion = false, runtime = {}) {
726
- const useDynamicTypeExpansion = itemTypes.length === 0;
727
- const typeFallbackChoices = completionTypeValues(itemTypes, runtime);
728
- const statusFallbackChoices = completionStatusValues(runtime);
729
- const typeChoices = useDynamicTypeExpansion
730
- ? '${(f)"$(_pm_type_choices)"}'
731
- : typeFallbackChoices;
732
- const statusChoices = '${(f)"$(_pm_status_choices)"}';
733
- const guideTopicChoices = GUIDE_TOPIC_CHOICES;
734
- const tagChoices = joinCompletionValues(tags);
735
- const useEagerTagExpansion = eagerTagExpansion || tags.length > 0;
736
- const zshTagChoices = useEagerTagExpansion
737
- ? tagChoices
738
- : '${(f)"$(_pm_tag_choices)"}';
739
- const zshListRuntimeFieldFlags = renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.list);
740
- const zshCreateRuntimeFieldFlags = renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.create);
741
- const zshSearchRuntimeFieldFlags = renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.search);
742
- const zshCalendarRuntimeFieldFlags = renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.calendar);
743
- const zshContextRuntimeFieldFlags = renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.context);
744
- const zshPresenceFilterFlags = renderZshPresenceFilterSpecs({
745
- missingPrefix: "filter-",
746
- pairedPrefix: "",
747
- includeContentMissingAliases: true,
748
- });
749
- const zshBulkPresenceFilterFlags = renderZshPresenceFilterSpecs({
750
- missingPrefix: "filter-",
751
- pairedPrefix: "filter-",
752
- });
753
- const zshMutationCollectionFlags = renderZshArgumentSpecs(ZSH_MUTATION_COLLECTION_ARGUMENT_SPECS);
754
- const dynamicTagResolver = useEagerTagExpansion
755
- ? ""
756
- : `
46
+ `}function generateBashScript(itemTypes=[],tags=[],eagerTagExpansion=false,runtime={}){const cmds=ALL_COMMANDS.join(" ");const useDynamicTypeExpansion=itemTypes.length===0;const typeValues=completionTypeValues(itemTypes,runtime);const statusValues=completionStatusValues(runtime);const tagValues=joinCompletionValues(tags);const listFlags=mergeFlagStrings(LIST_FLAGS,runtime.command_flags?.list);const createFlags=mergeFlagStrings(CREATE_FLAGS,runtime.command_flags?.create);const updateFlags=mergeFlagStrings(UPDATE_FLAGS,runtime.command_flags?.update);const updateManyFlags=mergeFlagStrings(UPDATE_MANY_FLAGS,runtime.command_flags?.["update-many"]);const searchFlags=mergeFlagStrings(SEARCH_FLAGS,runtime.command_flags?.search);const calendarFlags=mergeFlagStrings(CALENDAR_FLAGS,runtime.command_flags?.calendar);const contextFlags=mergeFlagStrings(CONTEXT_FLAGS,runtime.command_flags?.context);const useEagerTagExpansion=eagerTagExpansion||tags.length>0;const compgen=flags=>`$(compgen -W "${flags}" -- "$cur")`;return["# bash completion for pm",`# Source this file or add 'eval "$(pm completion bash)"' to ~/.bashrc`,"",...useDynamicTypeExpansion?[...renderBashDynamicChoiceResolver("type","completion-types",typeValues),""]:[],...renderBashDynamicChoiceResolver("status","completion-statuses",statusValues),"","_pm_completion() {"," local cur prev words cword"," _init_completion 2>/dev/null || {",' cur="${COMP_WORDS[COMP_CWORD]}"',' prev="${COMP_WORDS[COMP_CWORD-1]}"'," cword=$COMP_CWORD"," }",""," if [[ $cword -eq 1 ]]; then",` COMPREPLY=(${compgen(cmds)})`," return 0"," fi","",' if [[ "$prev" == "--type" ]]; then',useDynamicTypeExpansion?' COMPREPLY=($(compgen -W "$(_pm_completion_type_choices)" -- "$cur"))':` COMPREPLY=(${compgen(typeValues)})`," return 0"," fi","",' if [[ "$prev" == "--status" ]]; then',' COMPREPLY=($(compgen -W "$(_pm_completion_status_choices)" -- "$cur"))'," return 0"," fi","",...useEagerTagExpansion?[' if [[ ( "$prev" == "--tag" || "$prev" == "--tags" ) && ! ( ( "${COMP_WORDS[1]}" == "package" || "${COMP_WORDS[1]}" == "packages" ) && "${COMP_WORDS[2]}" == "upgrade" ) ]]; then',` COMPREPLY=(${compgen(tagValues)})`," return 0"," fi"]:[' if [[ ( "$prev" == "--tag" || "$prev" == "--tags" ) && ! ( ( "${COMP_WORDS[1]}" == "package" || "${COMP_WORDS[1]}" == "packages" ) && "${COMP_WORDS[2]}" == "upgrade" ) ]]; then'," local now ttl cache_ts tag_values",' now="$(date +%s 2>/dev/null || echo 0)"',' ttl="${PM_COMPLETION_TAG_TTL:-120}"',' cache_ts="${PM_COMPLETION_TAG_CACHE_TS:-0}"',' tag_values="${PM_COMPLETION_TAG_CACHE:-}"',' if [[ -z "$tag_values" || "$now" -eq 0 || $((now - cache_ts)) -ge "$ttl" ]]; then',' tag_values="$(pm completion-tags 2>/dev/null)"',' PM_COMPLETION_TAG_CACHE="$tag_values"',' PM_COMPLETION_TAG_CACHE_TS="$now"'," fi",' COMPREPLY=($(compgen -W "$tag_values" -- "$cur"))'," return 0"," fi"],"",' if [[ "$prev" == "--tag" && ( ( "${COMP_WORDS[1]}" == "package" || "${COMP_WORDS[1]}" == "packages" ) && "${COMP_WORDS[2]}" == "upgrade" ) ]]; then'," COMPREPLY=()"," return 0"," fi","",' local cmd="" word_index=1 word'," while (( word_index < cword )); do",' word="${COMP_WORDS[word_index]}"',' case "${word//_/-}" in',` ${GLOBAL_COMPLETION_VALUE_PATTERNS}) (( word_index += 2 )); continue ;;`,` ${GLOBAL_COMPLETION_INLINE_PATTERNS}|${GLOBAL_COMPLETION_SWITCH_PATTERNS}) (( word_index++ )); continue ;;`," --) break ;;"," esac",' if [[ -z "$cmd" ]]; then',' cmd="$word"',' [[ "$cmd" == "history" ]] || break'," else",' case "$word" in',...PM_HISTORY_COMMAND_ALIASES.map(entry=>` ${entry.canonical_argv[1]}) cmd="${entry.alias}" ;;`)," esac"," break"," fi"," (( word_index++ ))"," done",' case "$cmd" in',...HISTORY_OPERATION_FLAGS.flatMap(entry=>[` ${entry.alias})`,` COMPREPLY=(${compgen(entry.flags)})`," return 0"," ;;"])," list)",` COMPREPLY=(${compgen(listFlags)})`," ;;"," aggregate)",` COMPREPLY=(${compgen(AGGREGATE_FLAGS)})`," ;;"," duplicates)",` COMPREPLY=(${compgen(DUPLICATES_FLAGS)})`," ;;"," create)",` COMPREPLY=(${compgen(createFlags)})`," ;;"," copy)",` COMPREPLY=(${compgen(COPY_FLAGS)})`," ;;"," focus)",` COMPREPLY=(${compgen(FOCUS_FLAGS)})`," ;;"," update)",` COMPREPLY=(${compgen(updateFlags)})`," ;;"," update-many)",` COMPREPLY=(${compgen(updateManyFlags)})`," ;;"," calendar|cal)",` COMPREPLY=(${compgen(calendarFlags)})`," ;;"," context|ctx)",` COMPREPLY=(${compgen(contextFlags)})`," ;;"," next)",` COMPREPLY=(${compgen(NEXT_FLAGS)})`," ;;"," guide)",` COMPREPLY=(${compgen(`${GUIDE_FLAGS} ${GUIDE_TOPIC_CHOICES}`)})`," ;;"," search)",` COMPREPLY=(${compgen(searchFlags)})`," ;;"," reindex)",` COMPREPLY=(${compgen("--mode --progress --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," init)",` COMPREPLY=(${compgen(`${INIT_FLAGS} --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help`)})`," ;;"," config)",` COMPREPLY=(${compgen("--criterion --clear-criteria --format --policy --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," extension)",` COMPREPLY=(${compgen(`${EXTENSION_LIFECYCLE_ACTIONS} ${EXTENSION_LIFECYCLE_FLAGS}`)})`," ;;"," package|packages)",` COMPREPLY=(${compgen(`${PACKAGE_LIFECYCLE_ACTIONS} ${PACKAGE_LIFECYCLE_FLAGS} ${UPGRADE_FLAGS}`)})`," ;;"," comments)",` COMPREPLY=(${compgen("--add --body --stdin --file --edit --delete --limit --full-history --if-absent --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," notes)",` COMPREPLY=(${compgen("--add --add-json --stdin --file --edit --delete --limit --since --event-type --include-meta --full-history --if-absent --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," learnings)",` COMPREPLY=(${compgen("--add --stdin --file --edit --delete --limit --full-history --if-absent --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," files)",` COMPREPLY=(${compgen("discover lookup --add --add-glob --remove --migrate --list --apply --note --append-stable --validate-paths --scope --limit --offset --no-truncate --strict-read --explain --lines --decision-depth --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," docs)",` COMPREPLY=(${compgen("--add --add-glob --remove --migrate --note --validate-paths --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," append)",` COMPREPLY=(${compgen(APPEND_FLAGS)})`," ;;"," deps)",` COMPREPLY=(${compgen(DEPS_FLAGS)})`," ;;"," graph)",` COMPREPLY=(${compgen(`ancestors descendants predecessors successors paths impact analyze audit communities redundancy dominators slack centrality articulation plan index ${GRAPH_FLAGS}`)})`," ;;"," test)",` COMPREPLY=(${compgen("--add --add-json --remove --remove-index --list --run --match --only-index --only-last --background --timeout --progress --env-set --env-clear --shared-host-safe --pm-context --override-linked-pm-context --fail-on-context-mismatch --fail-on-skipped --fail-on-empty-test-run --require-assertions-for-pm --check-context --auto-pm-context --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," test-all)",` COMPREPLY=(${compgen("--status --limit --offset --background --timeout --progress --env-set --env-clear --shared-host-safe --pm-context --override-linked-pm-context --fail-on-context-mismatch --fail-on-skipped --fail-on-empty-test-run --require-assertions-for-pm --check-context --auto-pm-context --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," test-runs)",` COMPREPLY=(${compgen("list status logs stop resume --status --limit --stream --tail --force --author --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," validate)",` COMPREPLY=(${compgen("--check-metadata --metadata-profile --check-resolution --check-lifecycle --check-stale-blockers --dependency-cycle-severity --parent-cycle-severity --check-files --scan-mode --include-pm-internals --verbose-file-lists --verbose-diagnostics --all-affected-ids --strict-exit --fail-on-warn --fix-hints --auto-fix --dry-run --fix-scope --prune-missing --check-history-drift --check-command-references --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," health)",` COMPREPLY=(${compgen(HEALTH_FLAGS)})`," ;;"," history)"," if [[ $word_index -eq $cword ]]; then",` COMPREPLY=(${compgen(`${HISTORY_FLAGS} ${HISTORY_LEAVES}`)})`," else",` COMPREPLY=(${compgen(HISTORY_FLAGS)})`," fi"," ;;"," events)",` COMPREPLY=(${compgen(EVENTS_FLAGS)})`," ;;"," history-author-acknowledge)",` COMPREPLY=(${compgen(`${HISTORY_AUTHOR_ACKNOWLEDGE_FLAGS} --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help`)})`," ;;"," get)",` COMPREPLY=(${compgen(GET_FLAGS)})`," ;;"," schema)",` COMPREPLY=(${compgen("list show show-status add-type remove-type add-status remove-status add-field remove-field list-fields show-field apply-preset rename-type rename-field remap-status --description --default-status --folder --alias --role --order --type --commands --cli-flag --required --required-on-create --no-allow-unset --required-types --infer --min-count --apply --to --migration-id --dry-run --author --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," profile)",` COMPREPLY=(${compgen("list show apply lint agile ops research --dry-run --author --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," plan)",` COMPREPLY=(${compgen(`${PLAN_SUBCOMMANDS_LIST} ${PLAN_FLAGS}`)})`," ;;"," contracts)",` COMPREPLY=(${compgen(CONTRACTS_FLAGS)})`," ;;"," gc)",` COMPREPLY=(${compgen("--dry-run --scope --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`," ;;"," stats)",` COMPREPLY=(${compgen(STATS_FLAGS)})`," ;;"," close|close-task)",` COMPREPLY=(${compgen(CLOSE_MUTATION_FLAGS)})`," ;;"," close-many)",` COMPREPLY=(${compgen(CLOSE_MANY_FLAGS)})`," ;;"," release)",` COMPREPLY=(${compgen(RELEASE_MUTATION_FLAGS)})`," ;;"," delete)",` COMPREPLY=(${compgen(DELETE_MUTATION_FLAGS)})`," ;;"," claim|start-task|pause-task)",` COMPREPLY=(${compgen(MUTATION_FLAGS)})`," ;;"," meet|event)",` COMPREPLY=(${compgen(MEET_FLAGS)})`," ;;"," remind)",` COMPREPLY=(${compgen(REMIND_FLAGS)})`," ;;"," completion)",` COMPREPLY=(${compgen(COMPLETION_SHELL_CHOICES)})`," ;;"," templates)",` COMPREPLY=(${compgen("save list show")})`," ;;"," *)",` COMPREPLY=(${compgen(GLOBAL_FLAGS)})`," ;;"," esac",' if [[ "$cmd" == "comments" || "$cmd" == "notes" || "$cmd" == "learnings" ]]; then',` COMPREPLY+=(${compgen("--text")})`," fi"," return 0","}","","complete -F _pm_completion pm"].join("\n")}function generateZshScript(itemTypes=[],tags=[],eagerTagExpansion=false,runtime={}){const useDynamicTypeExpansion=itemTypes.length===0;const typeFallbackChoices=completionTypeValues(itemTypes,runtime);const statusFallbackChoices=completionStatusValues(runtime);const typeChoices=useDynamicTypeExpansion?'${(f)"$(_pm_type_choices)"}':typeFallbackChoices;const statusChoices='${(f)"$(_pm_status_choices)"}';const guideTopicChoices=GUIDE_TOPIC_CHOICES;const tagChoices=joinCompletionValues(tags);const useEagerTagExpansion=eagerTagExpansion||tags.length>0;const zshTagChoices=useEagerTagExpansion?tagChoices:'${(f)"$(_pm_tag_choices)"}';const zshListRuntimeFieldFlags=renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.list);const zshCreateRuntimeFieldFlags=renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.create);const zshSearchRuntimeFieldFlags=renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.search);const zshCalendarRuntimeFieldFlags=renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.calendar);const zshContextRuntimeFieldFlags=renderZshRuntimeFieldFlagSpecs(runtime.command_flags?.context);const zshPresenceFilterFlags=renderZshPresenceFilterSpecs({missingPrefix:"filter-",pairedPrefix:"",includeContentMissingAliases:true});const zshBulkPresenceFilterFlags=renderZshPresenceFilterSpecs({missingPrefix:"filter-",pairedPrefix:"filter-"});const zshMutationCollectionFlags=renderZshArgumentSpecs(ZSH_MUTATION_COLLECTION_ARGUMENT_SPECS);const dynamicTagResolver=useEagerTagExpansion?"":`
757
47
  _pm_tag_choices() {
758
48
  local now ttl cache_ts
759
49
  now=\${EPOCHSECONDS:-0}
@@ -767,8 +57,7 @@ _pm_tag_choices() {
767
57
  PM_COMPLETION_TAG_CACHE_TS="$now"
768
58
  print -r -- "$PM_COMPLETION_TAG_CACHE"
769
59
  }
770
- `;
771
- return `#compdef pm
60
+ `;return`#compdef pm
772
61
  # zsh completion for pm
773
62
  # Source this file or add 'eval "$(pm completion zsh)"' to ~/.zshrc
774
63
 
@@ -780,11 +69,41 @@ ${renderZshCommandDescriptions()}
780
69
  _describe 'command' commands
781
70
  }
782
71
  ${dynamicTagResolver}
783
- ${useDynamicTypeExpansion ? renderZshDynamicChoiceResolver("type", "completion-types", typeFallbackChoices) : ""}
784
- ${renderZshDynamicChoiceResolver("status", "completion-statuses", statusFallbackChoices)}
72
+ ${useDynamicTypeExpansion?renderZshDynamicChoiceResolver("type","completion-types",typeFallbackChoices):""}
73
+ ${renderZshDynamicChoiceResolver("status","completion-statuses",statusFallbackChoices)}
785
74
 
786
75
  _pm() {
787
76
  local context state line
77
+ local -a words=("$words[@]")
78
+ local CURRENT=$CURRENT
79
+ local word_index=2 history_seen=0 operation_index=0 word
80
+ while (( word_index < CURRENT )); do
81
+ word="$words[word_index]"
82
+ case "\${word//_/-}" in
83
+ ${GLOBAL_COMPLETION_VALUE_PATTERNS}) (( word_index += 2 )); continue ;;
84
+ ${GLOBAL_COMPLETION_INLINE_PATTERNS}|${GLOBAL_COMPLETION_SWITCH_PATTERNS}) (( word_index++ )); continue ;;
85
+ --) break ;;
86
+ esac
87
+ if (( history_seen == 0 )); then
88
+ [[ "$word" == "history" ]] || break
89
+ history_seen=1
90
+ else
91
+ operation_index=$word_index
92
+ break
93
+ fi
94
+ (( word_index++ ))
95
+ done
96
+ if (( history_seen && word_index == CURRENT )) && [[ "$words[CURRENT]" != -* ]]; then
97
+ local -a history_commands
98
+ history_commands=(${HISTORY_LEAVES})
99
+ _describe 'history operation' history_commands
100
+ return
101
+ fi
102
+ if (( operation_index > 0 )); then
103
+ case "$words[operation_index]" in
104
+ ${PM_HISTORY_COMMAND_ALIASES.map(entry=>` ${entry.canonical_argv[1]}) words=("$words[1]" "${entry.alias}" "\${words[@]:$operation_index}"); (( CURRENT -= operation_index - 2 )) ;;`).join("\n")}
105
+ esac
106
+ fi
788
107
  _arguments -C \\
789
108
  '--json[Output JSON instead of TOON]' \\
790
109
  '--all[Reveal every public command and compatibility alias]' \\
@@ -962,7 +281,7 @@ ${zshMutationCollectionFlags}
962
281
  ;;
963
282
  update-many)
964
283
  _arguments \\
965
- ${renderZshBulkSelectionFilterSpecs("applying updates", statusChoices, typeChoices, zshTagChoices)}
284
+ ${renderZshBulkSelectionFilterSpecs("applying updates",statusChoices,typeChoices,zshTagChoices)}
966
285
  '--filter-ac-missing[Select only items missing acceptance_criteria]' \\
967
286
  '--filter-estimates-missing[Select only items missing estimated_minutes]' \\
968
287
  '--filter-resolution-missing[Select only terminal items missing resolution]' \\
@@ -1027,7 +346,7 @@ ${zshMutationCollectionFlags}
1027
346
  ;;
1028
347
  close-many)
1029
348
  _arguments \\
1030
- ${renderZshBulkSelectionFilterSpecs("closing", statusChoices, typeChoices, zshTagChoices)}
349
+ ${renderZshBulkSelectionFilterSpecs("closing",statusChoices,typeChoices,zshTagChoices)}
1031
350
  ${zshBulkPresenceFilterFlags}
1032
351
  '--ids[Explicit comma-separated ID allowlist]:ids' \\
1033
352
  '--limit[Limit matched item count]:number' \\
@@ -1188,6 +507,7 @@ ${zshSearchRuntimeFieldFlags} '--json[Output JSON]' \\
1188
507
  ;;
1189
508
  history-compact)
1190
509
  _arguments \\
510
+ '--id[Item ID (alternative to positional ID)]:id' \\
1191
511
  '--before[Compact entries strictly before this version number or ISO timestamp]:before' \\
1192
512
  '--ids[Bulk: compact an explicit comma-separated list of item ids]:ids' \\
1193
513
  '--all-over[Bulk: compact every stream with more than N entries]:all-over' \\
@@ -1226,6 +546,7 @@ ${zshSearchRuntimeFieldFlags} '--json[Output JSON]' \\
1226
546
  ;;
1227
547
  history-redact)
1228
548
  _arguments \\
549
+ '--id[Item ID (alternative to positional ID)]:id' \\
1229
550
  '--literal[Literal string matcher to redact from history/item payloads]:literal' \\
1230
551
  '--regex[Regex matcher to redact (/pattern/flags or raw pattern)]:regex' \\
1231
552
  '--replacement[Replacement text (defaults to [redacted])]:replacement' \\
@@ -1238,6 +559,9 @@ ${zshSearchRuntimeFieldFlags} '--json[Output JSON]' \\
1238
559
  ;;
1239
560
  history-repair)
1240
561
  _arguments \\
562
+ '--id[Item ID (alternative to positional ID)]:id' \\
563
+ '--salvage-tail[Recover an invalid suffix after a verified prefix]' \\
564
+ '--normalize-provenance[Remove invalid provenance with aggregate evidence]' \\
1241
565
  '--all[Repair every drifted stream in one audited pass]' \\
1242
566
  '--dry-run[Preview the re-anchor impact without writing the history file]' \\
1243
567
  '--author[Mutation author]:author' \\
@@ -1314,6 +638,7 @@ ${zshSearchRuntimeFieldFlags} '--json[Output JSON]' \\
1314
638
  '--from[Lower timestamp bound (ISO/date string or relative)]:date' \\
1315
639
  '--to[Upper timestamp bound (ISO/date string or relative)]:date' \\
1316
640
  '--limit[Max entries]:number' \\
641
+ '--unbounded[Return every matching activity entry]' \\
1317
642
  '--compact[Condensed activity projection]' \\
1318
643
  '--raw[Emit raw compact per-event activity output]' \\
1319
644
  '--full[Show full activity entries]' \\
@@ -1322,7 +647,7 @@ ${zshSearchRuntimeFieldFlags} '--json[Output JSON]' \\
1322
647
  '*--harness[Filter by recorded or vocabulary-resolved harness]:harness' \\
1323
648
  '*--agent-instance[Filter by privacy-safe agent instance]:instance' \\
1324
649
  '*--provenance-filter[Filter by exact declared provenance value]:dimension=value' \\
1325
- '--stream[Emit line-delimited JSON rows (requires --json)]:mode' \\
650
+ '--stream[Emit line-delimited JSON rows (requires --json)]::mode:(rows ndjson jsonl)' \\
1326
651
  '--json[Output JSON]' \\
1327
652
  '--quiet[Suppress stdout]'
1328
653
  ;;
@@ -1620,6 +945,10 @@ ${zshSearchRuntimeFieldFlags} '--json[Output JSON]' \\
1620
945
  '--json[Output JSON]' \\
1621
946
  '--quiet[Suppress stdout]'
1622
947
  ;;
948
+ restore)
949
+ _arguments \\
950
+ ${renderZshArgumentSpecs(RESTORE_INVOCATIONS.map(flag=>`'${flag.flag}[${flag.description}]${flag.takes_value?":value":""}'`),{trailingContinuation:false})}
951
+ ;;
1623
952
  start-task|pause-task)
1624
953
  _arguments \\
1625
954
  '--author[Mutation author]:author' \\
@@ -1779,36 +1108,7 @@ ${zshSearchRuntimeFieldFlags} '--json[Output JSON]' \\
1779
1108
  esac
1780
1109
  }
1781
1110
 
1782
- compdef _pm pm`;
1783
- }
1784
- /** Implements generate fish script for the public runtime surface of this module. */
1785
- export function generateFishScript(itemTypes = [], tags = [], eagerTagExpansion = false, runtime = {}) {
1786
- const listCommandNames = ALL_COMMANDS.filter((command) => command === "list" || command.startsWith("list-"));
1787
- const listCmds = listCommandNames.join(" ");
1788
- const noSubcommandList = ALL_COMMANDS.join(" ");
1789
- const useDynamicTypeExpansion = itemTypes.length === 0;
1790
- const typeFallbackChoices = completionTypeValues(itemTypes, runtime);
1791
- const statusFallbackChoices = completionStatusValues(runtime);
1792
- const typeChoices = useDynamicTypeExpansion
1793
- ? "(__pm_type_choices)"
1794
- : typeFallbackChoices;
1795
- const statusChoices = "(__pm_status_choices)";
1796
- const guideTopicChoices = GUIDE_TOPIC_CHOICES;
1797
- const tagChoices = joinCompletionValues(tags);
1798
- const useEagerTagExpansion = eagerTagExpansion || tags.length > 0;
1799
- const fishTagChoices = useEagerTagExpansion
1800
- ? `'${tagChoices}'`
1801
- : "'(__pm_tag_choices)'";
1802
- const fishListRuntimeFieldFlags = renderFishRuntimeFieldFlagSpecs(listCommandNames, runtime.command_flags?.list);
1803
- const fishCreateRuntimeFieldFlags = renderFishRuntimeFieldFlagSpecs(["create"], runtime.command_flags?.create);
1804
- const fishUpdateRuntimeFieldFlags = renderFishRuntimeFieldFlagSpecs(["update"], runtime.command_flags?.update);
1805
- const fishUpdateManyRuntimeFieldFlags = renderFishRuntimeFieldFlagSpecs(["update-many"], runtime.command_flags?.["update-many"]);
1806
- const fishSearchRuntimeFieldFlags = renderFishRuntimeFieldFlagSpecs(["search"], runtime.command_flags?.search);
1807
- const fishCalendarRuntimeFieldFlags = renderFishRuntimeFieldFlagSpecs(["calendar", "cal"], runtime.command_flags?.calendar);
1808
- const fishContextRuntimeFieldFlags = renderFishRuntimeFieldFlagSpecs(["context", "ctx"], runtime.command_flags?.context);
1809
- const dynamicTagResolver = useEagerTagExpansion
1810
- ? ""
1811
- : `
1111
+ compdef _pm pm`}function generateFishScript(itemTypes=[],tags=[],eagerTagExpansion=false,runtime={}){const listCommandNames=ALL_COMMANDS.filter(command=>command==="list"||command.startsWith("list-"));const listCmds=listCommandNames.join(" ");const noSubcommandList=ALL_COMMANDS.join(" ");const useDynamicTypeExpansion=itemTypes.length===0;const typeFallbackChoices=completionTypeValues(itemTypes,runtime);const statusFallbackChoices=completionStatusValues(runtime);const typeChoices=useDynamicTypeExpansion?"(__pm_type_choices)":typeFallbackChoices;const statusChoices="(__pm_status_choices)";const guideTopicChoices=GUIDE_TOPIC_CHOICES;const tagChoices=joinCompletionValues(tags);const useEagerTagExpansion=eagerTagExpansion||tags.length>0;const fishTagChoices=useEagerTagExpansion?`'${tagChoices}'`:"'(__pm_tag_choices)'";const fishListRuntimeFieldFlags=renderFishRuntimeFieldFlagSpecs(listCommandNames,runtime.command_flags?.list);const fishCreateRuntimeFieldFlags=renderFishRuntimeFieldFlagSpecs(["create"],runtime.command_flags?.create);const fishUpdateRuntimeFieldFlags=renderFishRuntimeFieldFlagSpecs(["update"],runtime.command_flags?.update);const fishUpdateManyRuntimeFieldFlags=renderFishRuntimeFieldFlagSpecs(["update-many"],runtime.command_flags?.["update-many"]);const fishSearchRuntimeFieldFlags=renderFishRuntimeFieldFlagSpecs(["search"],runtime.command_flags?.search);const fishCalendarRuntimeFieldFlags=renderFishRuntimeFieldFlagSpecs(["calendar","cal"],runtime.command_flags?.calendar);const fishContextRuntimeFieldFlags=renderFishRuntimeFieldFlagSpecs(["context","ctx"],runtime.command_flags?.context);const dynamicTagResolver=useEagerTagExpansion?"":`
1812
1112
  function __pm_tag_choices
1813
1113
  set -l now (date +%s ^/dev/null)
1814
1114
  if test -z "$now"
@@ -1821,17 +1121,18 @@ function __pm_tag_choices
1821
1121
  if set -q PM_COMPLETION_TAG_CACHE; and set -q PM_COMPLETION_TAG_CACHE_TS
1822
1122
  set -l age (math "$now - $PM_COMPLETION_TAG_CACHE_TS")
1823
1123
  if test $age -lt $ttl
1824
- printf '%s\n' $PM_COMPLETION_TAG_CACHE
1124
+ printf '%s
1125
+ ' $PM_COMPLETION_TAG_CACHE
1825
1126
  return
1826
1127
  end
1827
1128
  end
1828
1129
  set -l resolved (pm completion-tags ^/dev/null)
1829
1130
  set -gx PM_COMPLETION_TAG_CACHE $resolved
1830
1131
  set -gx PM_COMPLETION_TAG_CACHE_TS $now
1831
- printf '%s\n' $resolved
1132
+ printf '%s
1133
+ ' $resolved
1832
1134
  end
1833
- `;
1834
- return `# Fish shell completion for pm
1135
+ `;return`# Fish shell completion for pm
1835
1136
  # Save to ~/.config/fish/completions/pm.fish
1836
1137
  # or run: pm completion fish > ~/.config/fish/completions/pm.fish
1837
1138
 
@@ -1862,8 +1163,8 @@ function __pm_no_subcommand
1862
1163
  not __fish_seen_subcommand_from ${noSubcommandList}
1863
1164
  end
1864
1165
  ${dynamicTagResolver}
1865
- ${useDynamicTypeExpansion ? renderFishDynamicChoiceResolver("type", "completion-types", typeFallbackChoices) : ""}
1866
- ${renderFishDynamicChoiceResolver("status", "completion-statuses", statusFallbackChoices)}
1166
+ ${useDynamicTypeExpansion?renderFishDynamicChoiceResolver("type","completion-types",typeFallbackChoices):""}
1167
+ ${renderFishDynamicChoiceResolver("status","completion-statuses",statusFallbackChoices)}
1867
1168
 
1868
1169
  # Subcommands
1869
1170
  ${renderFishCommandDescriptions()}
@@ -2295,18 +1596,61 @@ complete -c pm -n '__fish_seen_subcommand_from get' -l fields -d 'Render custom
2295
1596
  complete -c pm -n '__fish_seen_subcommand_from get' -l tree -d 'Include descendant subtree in result payload'
2296
1597
  complete -c pm -n '__fish_seen_subcommand_from get' -l tree-depth -d 'Cap subtree depth for --tree (0 = root only)' -r
2297
1598
 
1599
+ # Read the first command positions after consuming recognized global options.
1600
+ function __pm_history_tokens
1601
+ set -l tokens (commandline -opc)
1602
+ set -l skip_value 0
1603
+ set -l positions 0
1604
+ for token in $tokens[2..-1]
1605
+ if test $skip_value -eq 1
1606
+ set skip_value 0
1607
+ continue
1608
+ end
1609
+ switch (string replace -a _ - -- "$token")
1610
+ case ${GLOBAL_COMPLETION_VALUE_PATTERNS.replaceAll("|"," ")}
1611
+ set skip_value 1
1612
+ continue
1613
+ case ${GLOBAL_COMPLETION_INLINE_PATTERNS.split("|").map(pattern=>`'${pattern}'`).join(" ")} ${GLOBAL_COMPLETION_SWITCH_PATTERNS.replaceAll("|"," ")}
1614
+ continue
1615
+ case --
1616
+ printf '%s\\n' --
1617
+ return
1618
+ end
1619
+ printf '%s\\n' "$token"
1620
+ set positions (math $positions + 1)
1621
+ if test $positions -eq 2; or test "$token" != history
1622
+ return
1623
+ end
1624
+ end
1625
+ if test $skip_value -eq 1
1626
+ printf '%s\\n' --value
1627
+ end
1628
+ end
1629
+
1630
+ # Match only the command positions, keeping item history separate from maintenance.
1631
+ function __pm_history_operation
1632
+ set -l tokens (__pm_history_tokens)
1633
+ if test "$tokens[1]" = history; and contains -- "$tokens[2]" ${HISTORY_LEAVES}
1634
+ test "$tokens[2]" = "$argv[2]"
1635
+ else
1636
+ test "$tokens[1]" = "$argv[1]"
1637
+ end
1638
+ end
1639
+ complete -c pm -n 'test (count (__pm_history_tokens)) -eq 1; and __pm_history_operation history' -a '${HISTORY_LEAVES}' -d 'History operation'
1640
+ ${RESTORE_INVOCATIONS.map(flag=>`complete -c pm -n '__pm_history_operation restore restore' -l ${flag.flag.slice(2)}${flag.takes_value?" -r":""}`).join("\n")}
1641
+
2298
1642
  # history / activity flags
2299
- complete -c pm -n '__fish_seen_subcommand_from history' -l limit -d 'Max history entries' -r
2300
- complete -c pm -n '__fish_seen_subcommand_from history' -l compact -d 'Condensed history projection'
2301
- complete -c pm -n '__fish_seen_subcommand_from history' -l full -d 'Show full history entries'
2302
- complete -c pm -n '__fish_seen_subcommand_from history' -l provenance -d 'Patch-free identity and agent provenance projection'
2303
- complete -c pm -n '__fish_seen_subcommand_from history' -l provenance-summary -d 'Include bounded provenance completeness counts'
2304
- complete -c pm -n '__fish_seen_subcommand_from history' -l harness -d 'Filter by recorded or vocabulary-resolved harness' -r
2305
- complete -c pm -n '__fish_seen_subcommand_from history' -l agent-instance -d 'Filter by privacy-safe agent instance' -r
2306
- complete -c pm -n '__fish_seen_subcommand_from history' -l provenance-filter -d 'Filter by exact declared provenance value' -r
2307
- complete -c pm -n '__fish_seen_subcommand_from history' -l diff -d 'Include per-entry field-level before/after value diffs'
2308
- complete -c pm -n '__fish_seen_subcommand_from history' -l field -d 'With --diff, show only entries that changed this field' -r
2309
- complete -c pm -n '__fish_seen_subcommand_from history' -l verify -d 'Verify history hash chain and replay integrity'
1643
+ complete -c pm -n '__pm_history_operation history' -l limit -d 'Max history entries' -r
1644
+ complete -c pm -n '__pm_history_operation history' -l compact -d 'Condensed history projection'
1645
+ complete -c pm -n '__pm_history_operation history' -l full -d 'Show full history entries'
1646
+ complete -c pm -n '__pm_history_operation history' -l provenance -d 'Patch-free identity and agent provenance projection'
1647
+ complete -c pm -n '__pm_history_operation history' -l provenance-summary -d 'Include bounded provenance completeness counts'
1648
+ complete -c pm -n '__pm_history_operation history' -l harness -d 'Filter by recorded or vocabulary-resolved harness' -r
1649
+ complete -c pm -n '__pm_history_operation history' -l agent-instance -d 'Filter by privacy-safe agent instance' -r
1650
+ complete -c pm -n '__pm_history_operation history' -l provenance-filter -d 'Filter by exact declared provenance value' -r
1651
+ complete -c pm -n '__pm_history_operation history' -l diff -d 'Include per-entry field-level before/after value diffs'
1652
+ complete -c pm -n '__pm_history_operation history' -l field -d 'With --diff, show only entries that changed this field' -r
1653
+ complete -c pm -n '__pm_history_operation history' -l verify -d 'Verify history hash chain and replay integrity'
2310
1654
  complete -c pm -n '__fish_seen_subcommand_from events' -l since -d 'Resume after a cursor or from an ISO timestamp' -r
2311
1655
  complete -c pm -n '__fish_seen_subcommand_from events' -l type -d 'Filter by mutation operation' -r
2312
1656
  complete -c pm -n '__fish_seen_subcommand_from events' -l author -d 'Filter by mutation author' -r
@@ -2320,16 +1664,17 @@ complete -c pm -n '__fish_seen_subcommand_from events' -l agent-instance -d 'Fil
2320
1664
  complete -c pm -n '__fish_seen_subcommand_from events' -l provenance-filter -d 'Filter by exact declared provenance value' -r
2321
1665
  complete -c pm -n '__fish_seen_subcommand_from events' -l follow -d 'Continue emitting committed events'
2322
1666
  complete -c pm -n '__fish_seen_subcommand_from events' -l interval-ms -d 'Empty-read delay while following' -r
2323
- complete -c pm -n '__fish_seen_subcommand_from history-compact' -l before -d 'Compact entries strictly before this version number or ISO timestamp' -r
2324
- complete -c pm -n '__fish_seen_subcommand_from history-compact' -l ids -d 'Bulk: compact an explicit comma-separated list of item ids' -r
2325
- complete -c pm -n '__fish_seen_subcommand_from history-compact' -l all-over -d 'Bulk: compact every stream with more than N entries' -r
2326
- complete -c pm -n '__fish_seen_subcommand_from history-compact' -l closed -d 'Bulk: compact only closed (terminal) items streams'
2327
- complete -c pm -n '__fish_seen_subcommand_from history-compact' -l all-streams -d 'Bulk: compact every history stream regardless of lifecycle state'
2328
- complete -c pm -n '__fish_seen_subcommand_from history-compact' -l min-entries -d 'Bulk: skip streams with at most N entries' -r
2329
- complete -c pm -n '__fish_seen_subcommand_from history-compact' -l dry-run -d 'Preview compaction impact without writing the history file'
2330
- complete -c pm -n '__fish_seen_subcommand_from history-compact' -l author -d 'Mutation author' -r
2331
- complete -c pm -n '__fish_seen_subcommand_from history-compact' -l message -d 'Audit history message' -r
2332
- complete -c pm -n '__fish_seen_subcommand_from history-compact' -l force -d 'Force ownership/lock override'
1667
+ complete -c pm -n '__pm_history_operation history-compact compact' -l before -d 'Compact entries strictly before this version number or ISO timestamp' -r
1668
+ complete -c pm -n '__pm_history_operation history-compact compact' -l id -d 'Item ID (alternative to positional ID)' -r
1669
+ complete -c pm -n '__pm_history_operation history-compact compact' -l ids -d 'Bulk: compact an explicit comma-separated list of item ids' -r
1670
+ complete -c pm -n '__pm_history_operation history-compact compact' -l all-over -d 'Bulk: compact every stream with more than N entries' -r
1671
+ complete -c pm -n '__pm_history_operation history-compact compact' -l closed -d 'Bulk: compact only closed (terminal) items streams'
1672
+ complete -c pm -n '__pm_history_operation history-compact compact' -l all-streams -d 'Bulk: compact every history stream regardless of lifecycle state'
1673
+ complete -c pm -n '__pm_history_operation history-compact compact' -l min-entries -d 'Bulk: skip streams with at most N entries' -r
1674
+ complete -c pm -n '__pm_history_operation history-compact compact' -l dry-run -d 'Preview compaction impact without writing the history file'
1675
+ complete -c pm -n '__pm_history_operation history-compact compact' -l author -d 'Mutation author' -r
1676
+ complete -c pm -n '__pm_history_operation history-compact compact' -l message -d 'Audit history message' -r
1677
+ complete -c pm -n '__pm_history_operation history-compact compact' -l force -d 'Force ownership/lock override'
2333
1678
  complete -c pm -n '__fish_seen_subcommand_from history-author-acknowledge' -l event -d 'Actionable unknown-author event' -r
2334
1679
  complete -c pm -n '__fish_seen_subcommand_from history-author-acknowledge' -l all-actionable -d 'Select every currently actionable event'
2335
1680
  complete -c pm -n '__fish_seen_subcommand_from history-author-acknowledge' -l dry-run -d 'Preview a deterministic source-bound plan'
@@ -2338,18 +1683,22 @@ complete -c pm -n '__fish_seen_subcommand_from history-author-acknowledge' -l li
2338
1683
  complete -c pm -n '__fish_seen_subcommand_from history-author-acknowledge' -l attributed-author -d 'Principal attributed by maintainer review' -r
2339
1684
  complete -c pm -n '__fish_seen_subcommand_from history-author-acknowledge' -l reviewer -d 'Reviewer recording the disposition' -r
2340
1685
  complete -c pm -n '__fish_seen_subcommand_from history-author-acknowledge' -l reason -d 'Evidence-backed review rationale' -r
2341
- complete -c pm -n '__fish_seen_subcommand_from history-redact' -l literal -d 'Literal string matcher to redact from history/item payloads' -r
2342
- complete -c pm -n '__fish_seen_subcommand_from history-redact' -l regex -d 'Regex matcher to redact (/pattern/flags or raw pattern)' -r
2343
- complete -c pm -n '__fish_seen_subcommand_from history-redact' -l replacement -d 'Replacement text (defaults to [redacted])' -r
2344
- complete -c pm -n '__fish_seen_subcommand_from history-redact' -l dry-run -d 'Preview redaction impact without writing files'
2345
- complete -c pm -n '__fish_seen_subcommand_from history-redact' -l author -d 'Mutation author' -r
2346
- complete -c pm -n '__fish_seen_subcommand_from history-redact' -l message -d 'Audit history message' -r
2347
- complete -c pm -n '__fish_seen_subcommand_from history-redact' -l force -d 'Force ownership/lock override'
2348
- complete -c pm -n '__fish_seen_subcommand_from history-repair' -l all -d 'Repair every drifted stream in one audited pass'
2349
- complete -c pm -n '__fish_seen_subcommand_from history-repair' -l dry-run -d 'Preview the re-anchor impact without writing the history file'
2350
- complete -c pm -n '__fish_seen_subcommand_from history-repair' -l author -d 'Mutation author' -r
2351
- complete -c pm -n '__fish_seen_subcommand_from history-repair' -l message -d 'Audit history message' -r
2352
- complete -c pm -n '__fish_seen_subcommand_from history-repair' -l force -d 'Force ownership/lock override'
1686
+ complete -c pm -n '__pm_history_operation history-redact redact' -l literal -d 'Literal string matcher to redact from history/item payloads' -r
1687
+ complete -c pm -n '__pm_history_operation history-redact redact' -l id -d 'Item ID (alternative to positional ID)' -r
1688
+ complete -c pm -n '__pm_history_operation history-redact redact' -l regex -d 'Regex matcher to redact (/pattern/flags or raw pattern)' -r
1689
+ complete -c pm -n '__pm_history_operation history-redact redact' -l replacement -d 'Replacement text (defaults to [redacted])' -r
1690
+ complete -c pm -n '__pm_history_operation history-redact redact' -l dry-run -d 'Preview redaction impact without writing files'
1691
+ complete -c pm -n '__pm_history_operation history-redact redact' -l author -d 'Mutation author' -r
1692
+ complete -c pm -n '__pm_history_operation history-redact redact' -l message -d 'Audit history message' -r
1693
+ complete -c pm -n '__pm_history_operation history-redact redact' -l force -d 'Force ownership/lock override'
1694
+ complete -c pm -n '__pm_history_operation history-repair repair' -l salvage-tail -d 'Recover an invalid suffix after a verified prefix'
1695
+ complete -c pm -n '__pm_history_operation history-repair repair' -l id -d 'Item ID (alternative to positional ID)' -r
1696
+ complete -c pm -n '__pm_history_operation history-repair repair' -l normalize-provenance -d 'Remove invalid provenance with aggregate evidence'
1697
+ complete -c pm -n '__pm_history_operation history-repair repair' -l all -d 'Repair every drifted stream in one audited pass'
1698
+ complete -c pm -n '__pm_history_operation history-repair repair' -l dry-run -d 'Preview the re-anchor impact without writing the history file'
1699
+ complete -c pm -n '__pm_history_operation history-repair repair' -l author -d 'Mutation author' -r
1700
+ complete -c pm -n '__pm_history_operation history-repair repair' -l message -d 'Audit history message' -r
1701
+ complete -c pm -n '__pm_history_operation history-repair repair' -l force -d 'Force ownership/lock override'
2353
1702
  complete -c pm -n '__fish_seen_subcommand_from schema' -a 'list show show-status add-type remove-type add-status remove-status add-field remove-field list-fields show-field apply-preset rename-type rename-field remap-status' -d 'Schema subcommand'
2354
1703
  complete -c pm -n '__fish_seen_subcommand_from schema' -l description -d 'Human description for the custom item type, status, or field' -r
2355
1704
  complete -c pm -n '__fish_seen_subcommand_from schema' -l default-status -d 'Default status hint for the custom item type' -r
@@ -2395,21 +1744,22 @@ complete -c pm -n '__fish_seen_subcommand_from plan' -l promote-to-item-dep -d '
2395
1744
  complete -c pm -n '__fish_seen_subcommand_from plan' -l author -d 'Mutation author' -r
2396
1745
  complete -c pm -n '__fish_seen_subcommand_from plan' -l message -d 'Mutation message' -r
2397
1746
  complete -c pm -n '__fish_seen_subcommand_from plan' -l force -d 'Force ownership override'
2398
- complete -c pm -n '__fish_seen_subcommand_from activity' -l id -d 'Filter by item ID' -r
2399
- complete -c pm -n '__fish_seen_subcommand_from activity' -l op -d 'Filter by history operation' -r
2400
- complete -c pm -n '__fish_seen_subcommand_from activity' -l author -d 'Filter by history author' -r
2401
- complete -c pm -n '__fish_seen_subcommand_from activity' -l from -d 'Lower timestamp bound (ISO/date string or relative)' -r
2402
- complete -c pm -n '__fish_seen_subcommand_from activity' -l to -d 'Upper timestamp bound (ISO/date string or relative)' -r
2403
- complete -c pm -n '__fish_seen_subcommand_from activity' -l limit -d 'Max activity entries' -r
2404
- complete -c pm -n '__fish_seen_subcommand_from activity' -l compact -d 'Condensed activity projection'
2405
- complete -c pm -n '__fish_seen_subcommand_from activity' -l raw -d 'Emit raw compact per-event activity output'
2406
- complete -c pm -n '__fish_seen_subcommand_from activity' -l full -d 'Show full activity entries'
2407
- complete -c pm -n '__fish_seen_subcommand_from activity' -l provenance -d 'Patch-free identity and agent provenance projection'
2408
- complete -c pm -n '__fish_seen_subcommand_from activity' -l provenance-summary -d 'Include bounded provenance completeness counts'
2409
- complete -c pm -n '__fish_seen_subcommand_from activity' -l harness -d 'Filter by recorded or vocabulary-resolved harness' -r
2410
- complete -c pm -n '__fish_seen_subcommand_from activity' -l agent-instance -d 'Filter by privacy-safe agent instance' -r
2411
- complete -c pm -n '__fish_seen_subcommand_from activity' -l provenance-filter -d 'Filter by exact declared provenance value' -r
2412
- complete -c pm -n '__fish_seen_subcommand_from activity' -l stream -d 'Emit line-delimited JSON rows (requires --json)'
1747
+ complete -c pm -n '__pm_history_operation activity activity' -l id -d 'Filter by item ID' -r
1748
+ complete -c pm -n '__pm_history_operation activity activity' -l op -d 'Filter by history operation' -r
1749
+ complete -c pm -n '__pm_history_operation activity activity' -l author -d 'Filter by history author' -r
1750
+ complete -c pm -n '__pm_history_operation activity activity' -l from -d 'Lower timestamp bound (ISO/date string or relative)' -r
1751
+ complete -c pm -n '__pm_history_operation activity activity' -l to -d 'Upper timestamp bound (ISO/date string or relative)' -r
1752
+ complete -c pm -n '__pm_history_operation activity activity' -l limit -d 'Max activity entries' -r
1753
+ complete -c pm -n '__pm_history_operation activity activity' -l unbounded -d 'Return every matching activity entry'
1754
+ complete -c pm -n '__pm_history_operation activity activity' -l compact -d 'Condensed activity projection'
1755
+ complete -c pm -n '__pm_history_operation activity activity' -l raw -d 'Emit raw compact per-event activity output'
1756
+ complete -c pm -n '__pm_history_operation activity activity' -l full -d 'Show full activity entries'
1757
+ complete -c pm -n '__pm_history_operation activity activity' -l provenance -d 'Patch-free identity and agent provenance projection'
1758
+ complete -c pm -n '__pm_history_operation activity activity' -l provenance-summary -d 'Include bounded provenance completeness counts'
1759
+ complete -c pm -n '__pm_history_operation activity activity' -l harness -d 'Filter by recorded or vocabulary-resolved harness' -r
1760
+ complete -c pm -n '__pm_history_operation activity activity' -l agent-instance -d 'Filter by privacy-safe agent instance' -r
1761
+ complete -c pm -n '__pm_history_operation activity activity' -l provenance-filter -d 'Filter by exact declared provenance value' -r
1762
+ complete -c pm -n '__pm_history_operation activity activity' -l stream -d 'Emit line-delimited JSON rows (requires --json)'
2413
1763
  complete -c pm -n '__fish_seen_subcommand_from contracts' -l action -d 'Filter schema by tool action' -r
2414
1764
  complete -c pm -n '__fish_seen_subcommand_from contracts' -l command -d 'Scope output to one command (narrow-by-default)' -r
2415
1765
  complete -c pm -n '__fish_seen_subcommand_from contracts' -l summary -d 'Return compact command intent summary'
@@ -2767,35 +2117,5 @@ for package_cmd in package packages
2767
2117
  complete -c pm -n "__fish_seen_subcommand_from $package_cmd" -l repair -d 'Force npm global reinstall for the CLI/SDK'
2768
2118
  complete -c pm -n "__fish_seen_subcommand_from $package_cmd" -l tag -d 'npm version or dist-tag for upgrades' -r
2769
2119
  complete -c pm -n "__fish_seen_subcommand_from $package_cmd" -l package-name -d 'Override the CLI package name' -r
2770
- end`;
2771
- }
2772
- const SETUP_HINTS = {
2773
- bash: 'Add to ~/.bashrc or ~/.bash_profile: eval "$(pm completion bash)"',
2774
- zsh: 'Add to ~/.zshrc: eval "$(pm completion zsh)"',
2775
- fish: "Run: pm completion fish > ~/.config/fish/completions/pm.fish",
2776
- };
2777
- /** Implements run completion for the public runtime surface of this module. */
2778
- export function runCompletion(shell, itemTypes = [], tags = [], eagerTagExpansion = false, runtime = {}) {
2779
- const normalized = shell.trim().toLowerCase();
2780
- if (!VALID_SHELLS.includes(normalized)) {
2781
- throw new PmCliError(`Unknown shell: "${shell}". Supported shells: ${VALID_SHELLS.join(", ")}.`, EXIT_CODE.USAGE);
2782
- }
2783
- const validShell = normalized;
2784
- let script;
2785
- if (validShell === "bash") {
2786
- script = generateBashScript(itemTypes, tags, eagerTagExpansion, runtime);
2787
- }
2788
- else if (validShell === "zsh") {
2789
- script = generateZshScript(itemTypes, tags, eagerTagExpansion, runtime);
2790
- }
2791
- else {
2792
- script = generateFishScript(itemTypes, tags, eagerTagExpansion, runtime);
2793
- }
2794
- return {
2795
- shell: validShell,
2796
- script,
2797
- setup_hint: SETUP_HINTS[validShell],
2798
- };
2799
- }
2120
+ end`}const SETUP_HINTS={bash:'Add to ~/.bashrc or ~/.bash_profile: eval "$(pm completion bash)"',zsh:'Add to ~/.zshrc: eval "$(pm completion zsh)"',fish:"Run: pm completion fish > ~/.config/fish/completions/pm.fish"};function runCompletion(shell,itemTypes=[],tags=[],eagerTagExpansion=false,runtime={}){const normalized=shell.trim().toLowerCase();if(!VALID_SHELLS.includes(normalized)){throw new PmCliError(`Unknown shell: "${shell}". Supported shells: ${VALID_SHELLS.join(", ")}.`,EXIT_CODE.USAGE)}const validShell=normalized;let script;if(validShell==="bash"){script=generateBashScript(itemTypes,tags,eagerTagExpansion,runtime)}else if(validShell==="zsh"){script=generateZshScript(itemTypes,tags,eagerTagExpansion,runtime)}else{script=generateFishScript(itemTypes,tags,eagerTagExpansion,runtime)}return{shell:validShell,script,setup_hint:SETUP_HINTS[validShell]}}export{generateBashScript,generateFishScript,generateZshScript,runCompletion};
2800
2121
  //# sourceMappingURL=completion.js.map
2801
- //# debugId=4bf2b42b-91f3-5850-b1f1-d8a01525860c