@unbrained/pm-cli 2026.8.10 → 2026.8.12

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 (243) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +153 -100
  3. package/dist/cli/commander-usage.js +113 -15
  4. package/dist/cli/error-guidance.d.ts +12 -0
  5. package/dist/cli/error-guidance.js +147 -29
  6. package/dist/cli/main.js +38 -19
  7. package/dist/cli/register-annotations.js +56 -3
  8. package/dist/cli/register-assurance.d.ts +8 -0
  9. package/dist/cli/register-assurance.js +52 -0
  10. package/dist/cli/register-files-lookup.js +14 -3
  11. package/dist/cli/register-list-query.js +10 -7
  12. package/dist/cli/register-mutation.js +30 -9
  13. package/dist/cli/register-operations.js +30 -15
  14. package/dist/cli-bundle/bundle-manifest.json +155 -155
  15. package/dist/cli-bundle/chunks/{chunk-TRWXF476.js → chunk-3PS7X6GS.js} +2 -2
  16. package/dist/cli-bundle/chunks/chunk-7KL6KMWF.js +13 -0
  17. package/dist/cli-bundle/chunks/{chunk-EBO7OUUE.js → chunk-BM5YJ2UW.js} +69 -55
  18. package/dist/cli-bundle/chunks/chunk-D55A5AEN.js +33 -0
  19. package/dist/cli-bundle/chunks/chunk-KIKDWECH.js +196 -0
  20. package/dist/cli-bundle/chunks/{chunk-ETML5C6H.js → chunk-KOQMGCTA.js} +47 -47
  21. package/dist/cli-bundle/chunks/chunk-R76342NV.js +2 -0
  22. package/dist/cli-bundle/chunks/chunk-RBTK5EZV.js +5 -0
  23. package/dist/cli-bundle/chunks/chunk-VLUQOIDT.js +2 -0
  24. package/dist/cli-bundle/chunks/chunk-WLAHPSOX.js +3 -0
  25. package/dist/cli-bundle/chunks/register-list-query-XPCJRUUD.js +10 -0
  26. package/dist/cli-bundle/chunks/register-mutation-4RJCBKRS.js +20 -0
  27. package/dist/cli-bundle/chunks/register-operations-2OGISOVR.js +2 -0
  28. package/dist/cli-bundle/chunks/{register-setup-S3KT2LTH.js → register-setup-LLHAKP2V.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/chunk-2DALMVF7.js +5 -0
  30. package/dist/cli-bundle/focused-chunks/chunk-5OQIMELN.js +155 -0
  31. package/dist/cli-bundle/focused-chunks/chunk-5TAGTDRE.js +2 -0
  32. package/dist/cli-bundle/focused-chunks/chunk-ECADZMVC.js +18 -0
  33. package/dist/cli-bundle/focused-chunks/chunk-EJGXRA6B.js +2 -0
  34. package/dist/cli-bundle/focused-chunks/chunk-FFGSZCPK.js +16 -0
  35. package/dist/cli-bundle/focused-chunks/{chunk-IW43E4XL.js → chunk-GQW4BPUT.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/chunk-ISKOBJCM.js +2 -0
  37. package/dist/cli-bundle/focused-chunks/{chunk-75774JWP.js → chunk-JAFRIWVF.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/{chunk-2COZ67XT.js → chunk-KHM2CS2C.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/{chunk-M6RPIXKC.js → chunk-KPSXVBDV.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/{chunk-34SX654S.js → chunk-KTLOKKCQ.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/chunk-LGYK3NUF.js +8 -0
  42. package/dist/cli-bundle/focused-chunks/{chunk-2EXI2DKR.js → chunk-NBLUKITQ.js} +2 -2
  43. package/dist/cli-bundle/focused-chunks/chunk-NYLOUPOB.js +2 -0
  44. package/dist/cli-bundle/focused-chunks/chunk-Q4T463SD.js +31 -0
  45. package/dist/cli-bundle/focused-chunks/chunk-QVZVY53N.js +2 -0
  46. package/dist/cli-bundle/focused-chunks/{chunk-DZGAHZZV.js → chunk-RWPAWUOT.js} +2 -2
  47. package/dist/cli-bundle/focused-chunks/chunk-UTEWXDEQ.js +17 -0
  48. package/dist/cli-bundle/focused-chunks/{chunk-7UN6BHHO.js → chunk-YIAXMC3T.js} +2 -2
  49. package/dist/cli-bundle/focused-chunks/chunk-ZMGWAYH7.js +2 -0
  50. package/dist/cli-bundle/main.js +13 -13
  51. package/dist/cli-bundle/sdk-authoring.js +1 -1
  52. package/dist/cli-bundle/sdk-contracts.js +1 -1
  53. package/dist/cli-bundle/sdk-core.js +41 -39
  54. package/dist/cli-bundle/sdk-governance.js +1 -1
  55. package/dist/cli-bundle/sdk-graph.js +1 -1
  56. package/dist/cli-bundle/sdk-merge.js +1 -1
  57. package/dist/cli-bundle/sdk-query.js +1 -1
  58. package/dist/cli-bundle/sdk-runtime.js +1 -1
  59. package/dist/cli-bundle/sdk-testing.js +1 -1
  60. package/dist/cli-bundle/sdk.js +2 -2
  61. package/dist/core/extensions/reserved-host-flags.js +3 -2
  62. package/dist/core/history/drift-scan.js +13 -8
  63. package/dist/core/history/history.d.ts +8 -0
  64. package/dist/core/history/history.js +57 -7
  65. package/dist/core/history/replay.d.ts +9 -1
  66. package/dist/core/history/replay.js +48 -13
  67. package/dist/core/output/output.d.ts +2 -0
  68. package/dist/core/output/output.js +46 -14
  69. package/dist/core/session/session-state.d.ts +47 -0
  70. package/dist/core/session/session-state.js +207 -6
  71. package/dist/core/shared/author.d.ts +7 -1
  72. package/dist/core/shared/author.js +66 -46
  73. package/dist/core/shared/command-types.d.ts +2 -0
  74. package/dist/core/shared/command-types.js +2 -2
  75. package/dist/core/shared/errors.d.ts +13 -0
  76. package/dist/core/shared/errors.js +2 -2
  77. package/dist/core/store/item-metadata-cache.d.ts +1 -1
  78. package/dist/core/store/item-metadata-cache.js +14 -7
  79. package/dist/sdk/agent/refusal-reachability.d.ts +40 -0
  80. package/dist/sdk/agent/refusal-reachability.js +72 -0
  81. package/dist/sdk/agent/subcommand-recovery.d.ts +40 -0
  82. package/dist/sdk/agent/subcommand-recovery.js +84 -0
  83. package/dist/sdk/cli-bootstrap.d.ts +10 -0
  84. package/dist/sdk/cli-bootstrap.js +11 -7
  85. package/dist/sdk/cli-contracts/completeness.js +14 -3
  86. package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
  87. package/dist/sdk/cli-contracts/enum-contracts.js +3 -2
  88. package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
  89. package/dist/sdk/cli-contracts/flag-contracts.js +20 -2
  90. package/dist/sdk/cli-contracts/registration-helpers.d.ts +20 -3
  91. package/dist/sdk/cli-contracts/registration-helpers.js +18 -12
  92. package/dist/sdk/cli-contracts/runtime-contracts.js +4 -3
  93. package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +515 -0
  94. package/dist/sdk/cli-contracts/schemas/assurance-definition.js +252 -0
  95. package/dist/sdk/cli-contracts/tool-option-contracts.js +3 -2
  96. package/dist/sdk/cli-contracts/tool-parameter-tables.js +99 -2
  97. package/dist/sdk/cli-contracts/tool-schema.d.ts +3 -3
  98. package/dist/sdk/cli-contracts/tool-schema.js +38 -5
  99. package/dist/sdk/cli-contracts.d.ts +1 -1
  100. package/dist/sdk/cli-contracts.js +3 -3
  101. package/dist/sdk/cli-program.js +3 -2
  102. package/dist/sdk/completion.js +23 -8
  103. package/dist/sdk/config.js +9 -3
  104. package/dist/sdk/context/semantic-session-attribution.d.ts +32 -0
  105. package/dist/sdk/context/semantic-session-attribution.js +83 -0
  106. package/dist/sdk/context-intent-contracts.js +45 -4
  107. package/dist/sdk/core-governance.d.ts +3 -1
  108. package/dist/sdk/core-governance.js +5 -3
  109. package/dist/sdk/core.d.ts +2 -1
  110. package/dist/sdk/core.js +3 -2
  111. package/dist/sdk/error-code-catalog.d.ts +13 -0
  112. package/dist/sdk/error-code-catalog.js +35 -2
  113. package/dist/sdk/extension.js +18 -17
  114. package/dist/sdk/files.d.ts +11 -0
  115. package/dist/sdk/files.js +82 -24
  116. package/dist/sdk/generated/generated-error-code-catalog-part-1.d.ts +8 -0
  117. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1585 -0
  118. package/dist/sdk/generated/generated-error-code-catalog-part-2.d.ts +8 -0
  119. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1608 -0
  120. package/dist/sdk/generated-error-code-catalog.js +6 -3121
  121. package/dist/sdk/governance/assurance-action-contracts.d.ts +7 -0
  122. package/dist/sdk/governance/assurance-action-contracts.js +5 -0
  123. package/dist/sdk/governance/assurance-action.d.ts +70 -0
  124. package/dist/sdk/governance/assurance-action.js +200 -0
  125. package/dist/sdk/governance/assurance-limits.d.ts +7 -0
  126. package/dist/sdk/governance/assurance-limits.js +11 -0
  127. package/dist/sdk/governance/assurance-mutation-error.d.ts +7 -0
  128. package/dist/sdk/governance/assurance-mutation-error.js +35 -0
  129. package/dist/sdk/governance/assurance-runtime.d.ts +20 -0
  130. package/dist/sdk/governance/assurance-runtime.js +134 -0
  131. package/dist/sdk/governance/assurance.d.ts +438 -0
  132. package/dist/sdk/governance/assurance.js +804 -0
  133. package/dist/sdk/governance/health.d.ts +3 -1
  134. package/dist/sdk/governance/health.js +21 -4
  135. package/dist/sdk/governance/validate-item-reader.js +3 -3
  136. package/dist/sdk/governance/validate.d.ts +2 -0
  137. package/dist/sdk/governance/validate.js +13 -3
  138. package/dist/sdk/graph/durable-cache.d.ts +1 -1
  139. package/dist/sdk/graph/durable-cache.js +98 -29
  140. package/dist/sdk/graph/governance.d.ts +14 -0
  141. package/dist/sdk/graph/governance.js +34 -9
  142. package/dist/sdk/graph/run.js +8 -3
  143. package/dist/sdk/index.d.ts +7 -2
  144. package/dist/sdk/index.js +9 -4
  145. package/dist/sdk/lifecycle/claim.js +26 -4
  146. package/dist/sdk/lifecycle/focus.js +13 -3
  147. package/dist/sdk/lifecycle/plan.js +8 -3
  148. package/dist/sdk/merge/driver.d.ts +2 -2
  149. package/dist/sdk/merge/driver.js +3 -3
  150. package/dist/sdk/merge/receipts.d.ts +6 -4
  151. package/dist/sdk/merge/receipts.js +7 -5
  152. package/dist/sdk/merge/three-way.d.ts +2 -2
  153. package/dist/sdk/merge/three-way.js +3 -3
  154. package/dist/sdk/output-projection.d.ts +9 -1
  155. package/dist/sdk/output-projection.js +45 -9
  156. package/dist/sdk/provenance.d.ts +38 -0
  157. package/dist/sdk/provenance.js +64 -2
  158. package/dist/sdk/query/activity.d.ts +49 -2
  159. package/dist/sdk/query/activity.js +183 -37
  160. package/dist/sdk/query/context.js +19 -8
  161. package/dist/sdk/query/get.js +19 -2
  162. package/dist/sdk/read-output-contracts.d.ts +5 -1
  163. package/dist/sdk/read-output-contracts.js +17 -2
  164. package/dist/sdk/read-output-session.d.ts +2 -0
  165. package/dist/sdk/read-output-session.js +12 -5
  166. package/dist/sdk/runtime-extended-actions.js +22 -5
  167. package/dist/sdk/runtime-primitives.d.ts +5 -3
  168. package/dist/sdk/runtime-primitives.js +7 -5
  169. package/dist/sdk/runtime-stats-options.js +3 -2
  170. package/dist/sdk/runtime.d.ts +4 -0
  171. package/dist/sdk/runtime.js +34 -34
  172. package/dist/sdk/stats.d.ts +36 -3
  173. package/dist/sdk/stats.js +55 -15
  174. package/dist/sdk/telemetry.js +7 -4
  175. package/dist/sdk/test/execution.d.ts +4 -0
  176. package/dist/sdk/test/execution.js +86 -21
  177. package/dist/sdk/traceability/runtime-files-lookup.d.ts +8 -0
  178. package/dist/sdk/traceability/runtime-files-lookup.js +33 -0
  179. package/dist/sdk/traceability/source-traceability.d.ts +102 -0
  180. package/dist/sdk/traceability/source-traceability.js +293 -0
  181. package/dist/types.d.ts +10 -2
  182. package/dist/types.js +2 -2
  183. package/docs/ASSURANCE.md +137 -0
  184. package/docs/COMMANDS.md +29 -8
  185. package/docs/CONFIGURATION.md +7 -0
  186. package/docs/DEPENDENCY_KIND_CONTRACT.md +10 -8
  187. package/docs/MERGE_SAFETY.md +3 -1
  188. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +26 -13
  189. package/docs/README.md +3 -0
  190. package/docs/READ_OUTPUT_CONTRACTS.md +17 -2
  191. package/docs/RELEASING.md +9 -5
  192. package/docs/SDK.md +12 -1
  193. package/docs/SDK_AGENT_SESSION_CONTEXT.md +52 -5
  194. package/docs/SDK_CONTEXT_EVIDENCE_CONTRACTS.md +53 -0
  195. package/docs/SDK_CONTEXT_INTEGRITY.md +28 -1
  196. package/docs/SDK_EVIDENCE_TRACEABILITY.md +39 -1
  197. package/docs/SDK_RUNTIME_BOUNDARIES.md +36 -1
  198. package/docs/TESTING.md +12 -9
  199. package/docs/TRUSTWORTHY_CONTEXT_EVIDENCE.md +106 -0
  200. package/docs/generated/AGENT_COMMAND_SURFACE.md +1 -0
  201. package/docs/performance/sdk-entrypoint-import-costs.md +6 -2
  202. package/marketplace.json +2 -2
  203. package/package.json +7 -7
  204. package/packages/pm-beads/package.json +1 -1
  205. package/packages/pm-calendar/package.json +1 -1
  206. package/packages/pm-command-kit/package.json +1 -1
  207. package/packages/pm-digital-twin/package.json +1 -1
  208. package/packages/pm-governance-audit/package.json +1 -1
  209. package/packages/pm-guide-shell/package.json +1 -1
  210. package/packages/pm-kanban/package.json +1 -1
  211. package/packages/pm-lifecycle-hooks/package.json +1 -1
  212. package/packages/pm-linked-test-adapters/package.json +1 -1
  213. package/packages/pm-search-advanced/package.json +1 -1
  214. package/packages/pm-templates/extensions/templates/index.ts +9 -3
  215. package/packages/pm-templates/package.json +1 -1
  216. package/packages/pm-todos/package.json +1 -1
  217. package/packages/pm-vcs/package.json +1 -1
  218. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  219. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  220. package/sdk/public-surface.json +1030 -67
  221. package/dist/cli-bundle/chunks/chunk-2QYH4QMI.js +0 -30
  222. package/dist/cli-bundle/chunks/chunk-JUDU4RO4.js +0 -194
  223. package/dist/cli-bundle/chunks/chunk-JZSNADRR.js +0 -5
  224. package/dist/cli-bundle/chunks/chunk-MENWVGJW.js +0 -2
  225. package/dist/cli-bundle/chunks/chunk-S4EITGLA.js +0 -3
  226. package/dist/cli-bundle/chunks/chunk-TIGKWVLA.js +0 -13
  227. package/dist/cli-bundle/chunks/chunk-TSLDTJLQ.js +0 -2
  228. package/dist/cli-bundle/chunks/register-list-query-OJ6ZXKV4.js +0 -10
  229. package/dist/cli-bundle/chunks/register-mutation-DKI7QC7O.js +0 -20
  230. package/dist/cli-bundle/chunks/register-operations-P5OGMT6I.js +0 -2
  231. package/dist/cli-bundle/focused-chunks/chunk-36FTZ2NT.js +0 -2
  232. package/dist/cli-bundle/focused-chunks/chunk-3CQECMKR.js +0 -16
  233. package/dist/cli-bundle/focused-chunks/chunk-CHIBMEZR.js +0 -8
  234. package/dist/cli-bundle/focused-chunks/chunk-FF4MNAYB.js +0 -153
  235. package/dist/cli-bundle/focused-chunks/chunk-GHTN2ILR.js +0 -2
  236. package/dist/cli-bundle/focused-chunks/chunk-I4YM2I7S.js +0 -2
  237. package/dist/cli-bundle/focused-chunks/chunk-IMDTEN7K.js +0 -2
  238. package/dist/cli-bundle/focused-chunks/chunk-JMVA4HKR.js +0 -5
  239. package/dist/cli-bundle/focused-chunks/chunk-KR5RVXLQ.js +0 -31
  240. package/dist/cli-bundle/focused-chunks/chunk-KSNJG4KI.js +0 -16
  241. package/dist/cli-bundle/focused-chunks/chunk-MXYSIQ56.js +0 -18
  242. package/dist/cli-bundle/focused-chunks/chunk-RIIN5V4N.js +0 -2
  243. package/dist/cli-bundle/focused-chunks/chunk-RKWSCYYN.js +0 -2
@@ -1,10 +1,52 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0977d72e-6e4d-5ece-bfaf-eb24a4e9982c")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="616fff4b-f86e-54e5-b569-0b9894da5221")}catch(e){}}();
3
3
  import { EXIT_CODE, PmCliError, } from "../sdk/runtime-primitives.js";
4
+ import { renderPmCommand } from "../sdk/command-line.js";
4
5
  import { runComments } from "./commands/comments.js";
5
6
  import { runLearnings } from "./commands/learnings.js";
6
7
  import { runNotes } from "./commands/notes.js";
7
8
  import { addHiddenOption, getGlobalOptions, invalidateSearchCachesForMutation, printError, printResult, readOptionString, } from "./registration-helpers.js";
9
+ function assertNoTransposedAnnotationAction(collection, id, text, options) {
10
+ if (id.trim().toLowerCase() !== "add" || !text?.trim()) {
11
+ return;
12
+ }
13
+ const suppliedText = readOptionString(options, "add") ??
14
+ readOptionString(options, "note") ??
15
+ readOptionString(options, "body") ??
16
+ readOptionString(options, "comment");
17
+ const file = readOptionString(options, "file");
18
+ const retryArgs = [collection, text.trim()];
19
+ if (suppliedText !== undefined)
20
+ retryArgs.push("--add", suppliedText);
21
+ else if (options.stdin === true)
22
+ retryArgs.push("--stdin");
23
+ else if (file !== undefined)
24
+ retryArgs.push("--file", file);
25
+ else
26
+ retryArgs.push("--add", "-");
27
+ const suggestedRetry = renderPmCommand(retryArgs);
28
+ const stdinRetry = renderPmCommand([
29
+ collection,
30
+ text.trim(),
31
+ "--add",
32
+ "-",
33
+ ]);
34
+ throw new PmCliError(`The positional token "add" was parsed as the item id, while "${text.trim()}" was parsed as annotation text. ${collection} does not use an add subcommand.`, EXIT_CODE.USAGE, {
35
+ code: "annotation_transposed_subcommand",
36
+ reason: "noun_verb_object_transposition",
37
+ required: `Place the item id immediately after ${collection}, then use --add for annotation text.`,
38
+ examples: [...new Set([suggestedRetry, stdinRetry])],
39
+ recovery: {
40
+ attempted_command: `pm ${collection} add ${text.trim()}`,
41
+ normalized_args: [collection, "add", text.trim()],
42
+ parsed_positionals: [
43
+ { role: "transposed_subcommand", value: "add" },
44
+ { role: "item_id", value: text.trim() },
45
+ ],
46
+ suggested_retry: suggestedRetry,
47
+ },
48
+ });
49
+ }
8
50
  function resolveCommentSources(text, options) {
9
51
  const editIndex = typeof options.edit === "number" ? options.edit : undefined;
10
52
  const deleteIndex = typeof options.delete === "number" ? options.delete : undefined;
@@ -42,7 +84,14 @@ function resolveCommentSources(text, options) {
42
84
  };
43
85
  }
44
86
  function resolveSingleTextSource(label, positional, options) {
45
- const addFromOption = readOptionString(options, "add");
87
+ const canonicalAdd = readOptionString(options, "add");
88
+ const aliasAdd = label === "note" ? readOptionString(options, "note") : undefined;
89
+ if (canonicalAdd !== undefined &&
90
+ aliasAdd !== undefined &&
91
+ canonicalAdd !== aliasAdd) {
92
+ throw new PmCliError("Specify note text with either --add or --note, not conflicting values for both aliases", EXIT_CODE.USAGE, { code: "annotation_alias_conflict" });
93
+ }
94
+ const addFromOption = canonicalAdd ?? aliasAdd;
46
95
  const addFromPositional = typeof positional === "string" ? positional : undefined;
47
96
  if (addFromOption !== undefined && addFromPositional !== undefined) {
48
97
  throw new PmCliError(`Specify ${label} text either as positional [text] or with --add, not both`, EXIT_CODE.USAGE);
@@ -52,6 +101,7 @@ function resolveSingleTextSource(label, positional, options) {
52
101
  async function runCommentsAction(id, text, options, command) {
53
102
  const globalOptions = getGlobalOptions(command);
54
103
  const startedAt = Date.now();
104
+ assertNoTransposedAnnotationAction("comments", id, text, options);
55
105
  const sources = resolveCommentSources(text, options);
56
106
  const result = await runComments(id, {
57
107
  add: sources.add,
@@ -74,6 +124,7 @@ async function runCommentsAction(id, text, options, command) {
74
124
  async function runNotesAction(id, text, options, command) {
75
125
  const globalOptions = getGlobalOptions(command);
76
126
  const startedAt = Date.now();
127
+ assertNoTransposedAnnotationAction("notes", id, text, options);
77
128
  const add = resolveSingleTextSource("note", text, options);
78
129
  const result = await runNotes(id, {
79
130
  add,
@@ -105,6 +156,7 @@ async function runNotesAction(id, text, options, command) {
105
156
  async function runLearningsAction(id, text, options, command) {
106
157
  const globalOptions = getGlobalOptions(command);
107
158
  const startedAt = Date.now();
159
+ assertNoTransposedAnnotationAction("learnings", id, text, options);
108
160
  const add = resolveSingleTextSource("learning", text, options);
109
161
  const result = await runLearnings(id, {
110
162
  add,
@@ -159,6 +211,7 @@ export function registerAnnotationCommands(program, parsePositiveInteger) {
159
211
  .argument("<id>", "Item id")
160
212
  .argument("[text]", "Optional note text shorthand (equivalent to --add; use - for stdin)")
161
213
  .option("--add <text>", "Add a text note (- reads stdin)")
214
+ .option("--note <text>", "Alias for --add")
162
215
  .option("--add-json <json>", "Append a merge-safe JSON event")
163
216
  .option("--stdin", "Read note text from stdin")
164
217
  .option("--file <path>", "Read note text from a UTF-8 file")
@@ -192,4 +245,4 @@ export function registerAnnotationCommands(program, parsePositiveInteger) {
192
245
  .action(runLearningsAction);
193
246
  }
194
247
  //# sourceMappingURL=register-annotations.js.map
195
- //# debugId=0977d72e-6e4d-5ece-bfaf-eb24a4e9982c
248
+ //# debugId=616fff4b-f86e-54e5-b569-0b9894da5221
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @module cli/register-assurance
3
+ *
4
+ * Thin Commander adapter over the transport-neutral public assurance action.
5
+ */
6
+ import type { Command } from "commander";
7
+ /** Register the declarative assurance command family. */
8
+ export declare function registerAssuranceCommand(program: Command): void;
@@ -0,0 +1,52 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1adbac08-0950-55be-82bf-cc4dc7b6ad18")}catch(e){}}();
3
+ import { ASSURANCE_ACTIONS, ASSURANCE_DECLARATION_KINDS, runAssuranceAction, } from "../sdk/governance/assurance-action.js";
4
+ import { printResult } from "../sdk/runtime-primitives.js";
5
+ import { getGlobalOptions, readOptionString } from "./registration-helpers.js";
6
+ async function runAssuranceCliAction(action, kindOrGate, id, options, command) {
7
+ const global = getGlobalOptions(command);
8
+ const isRun = action === "run";
9
+ const isVerdicts = action === "verdicts";
10
+ const result = await runAssuranceAction({
11
+ action,
12
+ ...(isRun || isVerdicts ? {} : { kind: kindOrGate }),
13
+ id: isRun || isVerdicts ? (id ?? kindOrGate) : id,
14
+ definition: readOptionString(options, "definition"),
15
+ trigger: readOptionString(options, "trigger"),
16
+ tree: readOptionString(options, "tree"),
17
+ gate: readOptionString(options, "gate"),
18
+ limit: readOptionString(options, "limit"),
19
+ dry_run: options.dryRun === true,
20
+ fullChangedFields: global.fullChangedFields,
21
+ idOnly: global.idOnly,
22
+ author: readOptionString(options, "author"),
23
+ message: readOptionString(options, "message"),
24
+ }, global);
25
+ printResult(result, global);
26
+ if (typeof result === "object" &&
27
+ result !== null &&
28
+ "exit_code" in result &&
29
+ result.exit_code === 1) {
30
+ process.exitCode = 1;
31
+ }
32
+ }
33
+ /** Register the declarative assurance command family. */
34
+ export function registerAssuranceCommand(program) {
35
+ program
36
+ .command("assurance")
37
+ .argument("<action>", `Action: ${ASSURANCE_ACTIONS.join(", ")}`)
38
+ .argument("[kind]", `Declaration kind: ${ASSURANCE_DECLARATION_KINDS.join(", ")}; for run this may be the gate id`)
39
+ .argument("[id]", "Declaration or gate id")
40
+ .description("Declare and evaluate SDK-owned project assurance contracts.")
41
+ .option("--definition <json>", "JSON declaration for put")
42
+ .option("--trigger <value>", "Gate lifecycle trigger")
43
+ .option("--tree <value>", "Commit, tree, or snapshot identity being judged")
44
+ .option("--gate <id>", "Filter verdict history by gate id")
45
+ .option("--limit <number>", "Maximum newest verdicts returned")
46
+ .option("--dry-run", "Evaluate a gate without appending a verdict")
47
+ .option("--author <value>", "Mutation author override")
48
+ .option("--message <value>", "Audited mutation rationale")
49
+ .action(runAssuranceCliAction);
50
+ }
51
+ //# sourceMappingURL=register-assurance.js.map
52
+ //# debugId=1adbac08-0950-55be-82bf-cc4dc7b6ad18
@@ -1,6 +1,7 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="dabf24f7-406d-57e0-af3c-25391325a1b4")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="452f6689-f5bd-5398-915b-52ce7e2fd55e")}catch(e){}}();
3
3
  import { runFilesLookup } from "../sdk/files.js";
4
+ import { parseSourceLineRange } from "../sdk/traceability/source-traceability.js";
4
5
  import { EXIT_CODE, PmCliError } from "../sdk/runtime-primitives.js";
5
6
  import { getGlobalOptions, printResult } from "./registration-helpers.js";
6
7
  function parseIntegerBound(flag, minimum) {
@@ -26,6 +27,13 @@ async function runFilesLookupAction(paths, options, command) {
26
27
  offset: typeof options.offset === "number" ? options.offset : undefined,
27
28
  noTruncate: options.noTruncate === true,
28
29
  strictRead: options.strictRead === true,
30
+ explain: options.explain === true,
31
+ lineRange: typeof options.lines === "string"
32
+ ? parseSourceLineRange(options.lines)
33
+ : undefined,
34
+ decisionDepth: typeof options.decisionDepth === "number"
35
+ ? options.decisionDepth
36
+ : undefined,
29
37
  }, globalOptions);
30
38
  printResult(result, globalOptions);
31
39
  }
@@ -39,8 +47,11 @@ export function registerFilesLookupCommand(filesCommand) {
39
47
  .option("--offset <n>", "Number of referencing items to skip", parseIntegerBound("--offset", 0))
40
48
  .option("--no-truncate", "Return every referencing item")
41
49
  .option("--strict-read", "Fail when any authoritative item cannot be read")
42
- .description("Find pm items that link the requested source paths.")
50
+ .option("--explain", "Include ranked source-to-work rationale")
51
+ .option("--lines <start:end>", "Attribute an inclusive source line range")
52
+ .option("--decision-depth <n>", "Maximum governing-decision relationship depth", parseIntegerBound("--decision-depth", 1))
53
+ .description("Find and explain pm items that govern requested source paths.")
43
54
  .action(runFilesLookupAction);
44
55
  }
45
56
  //# sourceMappingURL=register-files-lookup.js.map
46
- //# debugId=dabf24f7-406d-57e0-af3c-25391325a1b4
57
+ //# debugId=452f6689-f5bd-5398-915b-52ce7e2fd55e
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6a380419-3ed6-5e3d-a66f-40a6d5408b6b")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0bcbdc33-3145-54cc-b4b6-10df50aef57a")}catch(e){}}();
3
3
  import { EXIT_CODE, PmCliError, renderRowsAsCsv, renderRowsAsTable, } from "../sdk/runtime-primitives.js";
4
4
  import { EVAL_QUERY_SET_SCHEMA_ID } from "../sdk/eval.js";
5
5
  import { applyContextIntentProjection } from "../sdk/context-intent-contracts.js";
@@ -372,7 +372,7 @@ async function runGetAction(id, options, command) {
372
372
  async function runHistoryAction(id, options, command) {
373
373
  const globalOptions = getGlobalOptions(command);
374
374
  const startedAt = Date.now();
375
- if ([options.compact, options.full, options.provenance].filter((value) => value === true).length > 1) {
375
+ if ([options.compact, options.raw, options.full, options.provenance].filter((value) => value === true).length > 1) {
376
376
  throw new PmCliError("History projection options are mutually exclusive. Use --compact, --provenance, or --full.", EXIT_CODE.USAGE);
377
377
  }
378
378
  const field = typeof options.field === "string" ? options.field : undefined;
@@ -472,15 +472,17 @@ async function runEventsAction(options, command) {
472
472
  async function runActivityAction(options, command) {
473
473
  const globalOptions = getGlobalOptions(command);
474
474
  const startedAt = Date.now();
475
- if ([options.compact, options.full, options.provenance].filter((value) => value === true).length > 1) {
476
- throw new PmCliError("Activity projection options are mutually exclusive. Use --compact, --provenance, or --full.", EXIT_CODE.USAGE);
475
+ if ([options.raw, options.compact, options.full, options.provenance].filter((value) => value === true).length > 1) {
476
+ throw new PmCliError("Activity projection options are mutually exclusive. Use --raw, --compact, --provenance, or --full.", EXIT_CODE.USAGE);
477
477
  }
478
- const normalized = normalizeActivityOptions(options);
479
- const result = await runActivity(normalized, globalOptions);
480
478
  const streamMode = resolveActivityStreamMode(options.stream);
481
479
  if (streamMode && !globalOptions.json) {
482
480
  throw new PmCliError("--stream requires --json output mode.", EXIT_CODE.USAGE);
483
481
  }
482
+ const normalized = normalizeActivityOptions(options);
483
+ const result = await runActivity(streamMode && options.full !== true && options.provenance !== true
484
+ ? { ...normalized, raw: true, compact: true }
485
+ : normalized, globalOptions);
484
486
  if (streamMode) {
485
487
  printActivityJsonStream(result, normalized, globalOptions);
486
488
  }
@@ -795,6 +797,7 @@ export function registerListQueryCommands(program, options) {
795
797
  .option("--limit <n>", "Return only the latest n activity entries")
796
798
  .option("--unbounded", "Explicitly return every matching activity entry (disables the default bound)")
797
799
  .option("--compact", "Condensed output: show only id, op, ts, author, msg per entry")
800
+ .option("--raw", "Show the legacy compact per-event stream instead of the item digest")
798
801
  .option("--full", "Show full activity entries with JSON Patch payloads")
799
802
  .option("--provenance", "Show patch-free author, harness, instance, and extensible provenance")
800
803
  .option("--provenance-summary", "Include bounded provenance completeness counts")
@@ -835,4 +838,4 @@ export const _testOnlyRegisterListQuery = {
835
838
  parseListFormat,
836
839
  };
837
840
  //# sourceMappingURL=register-list-query.js.map
838
- //# debugId=6a380419-3ed6-5e3d-a66f-40a6d5408b6b
841
+ //# debugId=0bcbdc33-3145-54cc-b4b6-10df50aef57a
@@ -1,6 +1,6 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e5b9b4c9-c2eb-5282-99da-702a8887c4e4")}catch(e){}}();
3
- import { resolveBodyFileContent, EXIT_CODE, splitCommaList, PmCliError, } from "../sdk/runtime-primitives.js";
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6c7d647c-e489-51e3-b84b-5b62b4114033")}catch(e){}}();
3
+ import { resolveBodyFileContent, EXIT_CODE, splitCommaList, PmCliError, createUnknownSubcommandError, } from "../sdk/runtime-primitives.js";
4
4
  import { CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS, PLAN_CREATE_METADATA_PARAMETER_KEYS, UPDATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS, } from "../sdk/cli-contracts.js";
5
5
  import { BUILTIN_ITEM_TYPE_VALUES } from "../types/index.js";
6
6
  import { MERGE_DRIVER_ARTIFACT_VALUES, runMergeDriver, runMergeInstall, runMergeReconcile, runMergeReceiptReport, } from "./commands/merge.js";
@@ -675,7 +675,7 @@ function normalizePlanAliases(options) {
675
675
  normalized.blockedBy = planOptions.blockedBy;
676
676
  return normalized;
677
677
  }
678
- function assertKnownPlanSubcommand(subcommand, normalized, allowed) {
678
+ function assertKnownPlanSubcommand(normalized, allowed) {
679
679
  if (!normalized) {
680
680
  throw new PmCliError(`pm plan requires a subcommand. Allowed: ${allowed.join(", ")}`, EXIT_CODE.USAGE, {
681
681
  code: "missing_required_argument",
@@ -692,7 +692,15 @@ function assertKnownPlanSubcommand(subcommand, normalized, allowed) {
692
692
  const examples = normalized === "list" || normalized === "ls"
693
693
  ? ["pm list --type Plan", "pm list-all --type Plan"]
694
694
  : undefined;
695
- throw new PmCliError(`Unknown pm plan subcommand "${subcommand}". Allowed: ${allowed.join(", ")}`, EXIT_CODE.USAGE, examples ? { code: "unknown_subcommand", examples } : undefined);
695
+ throw createUnknownSubcommandError({
696
+ command_path: "plan",
697
+ token: normalized,
698
+ allowed,
699
+ examples,
700
+ retry_command: normalized === "list" || normalized === "ls"
701
+ ? "pm list --type Plan"
702
+ : undefined,
703
+ });
696
704
  }
697
705
  function parsePlanReorderTo(normalizedSubcommand, reorderToken) {
698
706
  if (normalizedSubcommand !== "reorder-step" ||
@@ -709,7 +717,7 @@ async function runPlanAction(subcommand, id, stepRef, reorderToken, options, com
709
717
  const globalOptions = getGlobalOptions(command);
710
718
  const startedAt = Date.now();
711
719
  const normalizedSubcommand = (subcommand ?? "").trim().toLowerCase();
712
- assertKnownPlanSubcommand(subcommand, normalizedSubcommand, PLAN_SUBCOMMANDS);
720
+ assertKnownPlanSubcommand(normalizedSubcommand, PLAN_SUBCOMMANDS);
713
721
  const planOptions = normalizePlanAliases(options);
714
722
  const reorderTo = parsePlanReorderTo(normalizedSubcommand, reorderToken);
715
723
  const planId = normalizedSubcommand === "create" &&
@@ -812,7 +820,12 @@ async function runMergeAction(subcommand, artifact, base, ours, theirs, options,
812
820
  await runMergeDriverSubcommand(artifact, base, ours, theirs, options, globalOptions);
813
821
  break;
814
822
  default:
815
- throw new PmCliError(`Unknown merge subcommand "${subcommand}". Supported subcommands: install, reconcile, report, driver.`, EXIT_CODE.USAGE);
823
+ throw createUnknownSubcommandError({
824
+ command_path: "merge",
825
+ token: subcommand,
826
+ allowed: ["install", "reconcile", "report", "driver"],
827
+ display_name: "merge",
828
+ });
816
829
  }
817
830
  if (globalOptions.profile) {
818
831
  printError(`profile:command=merge took_ms=${Date.now() - startedAt}`);
@@ -890,7 +903,11 @@ async function runSchemaAction(subcommand, name, options, command) {
890
903
  normalizedSubcommand = "add-type";
891
904
  }
892
905
  if (!SCHEMA_SUBCOMMANDS.includes(normalizedSubcommand)) {
893
- throw new PmCliError(`Unknown pm schema subcommand "${subcommand}". Allowed: ${SCHEMA_SUBCOMMANDS.join(", ")}`, EXIT_CODE.USAGE, { code: "unknown_subcommand" });
906
+ throw createUnknownSubcommandError({
907
+ command_path: "schema",
908
+ token: normalizedSubcommand,
909
+ allowed: SCHEMA_SUBCOMMANDS,
910
+ });
894
911
  }
895
912
  const result = await dispatchSchemaSubcommand(schemaModule, {
896
913
  normalizedSubcommand,
@@ -1070,7 +1087,11 @@ async function runProfileAction(subcommand, name, options, command) {
1070
1087
  });
1071
1088
  }
1072
1089
  if (!PROFILE_SUBCOMMANDS.includes(normalizedSubcommand)) {
1073
- throw new PmCliError(`Unknown pm profile subcommand "${subcommand}". Allowed: ${PROFILE_SUBCOMMANDS.join(", ")}`, EXIT_CODE.USAGE, { code: "unknown_subcommand" });
1090
+ throw createUnknownSubcommandError({
1091
+ command_path: "profile",
1092
+ token: normalizedSubcommand,
1093
+ allowed: PROFILE_SUBCOMMANDS,
1094
+ });
1074
1095
  }
1075
1096
  const result = await dispatchProfileSubcommand(profileModule, normalizedSubcommand, name, options, globalOptions);
1076
1097
  // Profile inspection and schema staging do not mutate item content, so search caches stay valid (mirrors pm schema).
@@ -1817,4 +1838,4 @@ export function registerMutationCommands(program, registrationOptions = {}) {
1817
1838
  .action(runDepsAction);
1818
1839
  }
1819
1840
  //# sourceMappingURL=register-mutation.js.map
1820
- //# debugId=e5b9b4c9-c2eb-5282-99da-702a8887c4e4
1841
+ //# debugId=6c7d647c-e489-51e3-b84b-5b62b4114033
@@ -1,6 +1,6 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4856ec1e-7841-5ad0-95e3-6e3057ed999c")}catch(e){}}();
3
- import { resolveRuntimeStatusRegistry, setActiveCommandResult, EXIT_CODE, PmCliError, resolveAuthor, resolvePmRoot, readSettings, } from "../sdk/runtime-primitives.js";
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7796ea07-0de7-5db8-a3b5-a8021ceebc69")}catch(e){}}();
3
+ import { resolveRuntimeStatusRegistry, setActiveCommandResult, EXIT_CODE, PmCliError, createUnknownSubcommandError, resolveAuthor, resolvePmRoot, readSettings, } from "../sdk/runtime-primitives.js";
4
4
  import { resolveStartTaskInProgressStatus } from "../sdk/start-task-status.js";
5
5
  import { parseStatsAnalyticsJson } from "./stats-analytics-json.js";
6
6
  import { createWorkspaceSnapshot, deleteWorkspaceSnapshot, inspectWorkspaceSnapshot, listWorkspaceSnapshots, planWorkspaceSnapshotRestore, restoreWorkspaceSnapshotWithRecovery, } from "../sdk/workspace-snapshot.js";
@@ -19,6 +19,7 @@ import { runStartBackgroundRun, runTestRunsWorker, } from "./commands/test-runs.
19
19
  import { runUpdate } from "./commands/update.js";
20
20
  import { runValidate } from "./commands/validate.js";
21
21
  import { buildBackgroundTestAllCommandArgs, applyActiveCommandResultService, buildBackgroundTestCommandArgs, addHiddenOption, collect, getGlobalOptions, invalidateSearchCachesForMutation, printError, printResult, readOptionString, } from "./registration-helpers.js";
22
+ import { registerAssuranceCommand } from "./register-assurance.js";
22
23
  function resolveTelemetrySubcommand(namespaceOrSubcommand, subcommand) {
23
24
  const normalizedNamespace = namespaceOrSubcommand?.trim().toLowerCase();
24
25
  const normalizedSubcommand = subcommand?.trim().toLowerCase();
@@ -31,13 +32,13 @@ function resolveTelemetrySubcommand(namespaceOrSubcommand, subcommand) {
31
32
  : "status";
32
33
  }
33
34
  if (normalizedSubcommand !== undefined && normalizedSubcommand.length > 0) {
34
- throw new PmCliError(`Unknown pm telemetry path "${namespaceOrSubcommand} ${subcommand}". Use "pm telemetry ${namespaceOrSubcommand}" or legacy alias "pm telemetry local-analytics ${normalizedSubcommand}".`, EXIT_CODE.USAGE, {
35
- code: "unknown_subcommand",
35
+ throw createUnknownSubcommandError({
36
+ command_path: "telemetry",
37
+ token: `${namespaceOrSubcommand} ${subcommand}`,
38
+ allowed: ["status", "flush", "stats", "clear", "local-analytics"],
39
+ token_kind: "path",
36
40
  examples: [
37
- "pm telemetry status",
38
- "pm telemetry flush",
39
41
  "pm telemetry stats --limit 10",
40
- "pm telemetry clear",
41
42
  "pm telemetry local-analytics status --json",
42
43
  ],
43
44
  });
@@ -53,6 +54,9 @@ function collectTestMutationValues(options) {
53
54
  removeValues: Array.isArray(options.remove)
54
55
  ? options.remove
55
56
  : [],
57
+ removeIndexValues: Array.isArray(options.removeIndex)
58
+ ? options.removeIndex
59
+ : [],
56
60
  };
57
61
  }
58
62
  function validateBackgroundTestOptions(options, values) {
@@ -64,8 +68,9 @@ function validateBackgroundTestOptions(options, values) {
64
68
  }
65
69
  if (values.addValues.length > 0 ||
66
70
  values.addJsonValues.length > 0 ||
67
- values.removeValues.length > 0) {
68
- throw new PmCliError("--background does not support --add/--add-json/--remove; update linked tests first, then run in background", EXIT_CODE.USAGE);
71
+ values.removeValues.length > 0 ||
72
+ values.removeIndexValues.length > 0) {
73
+ throw new PmCliError("--background does not support --add/--add-json/--remove/--remove-index; update linked tests first, then run in background", EXIT_CODE.USAGE);
69
74
  }
70
75
  }
71
76
  async function runBackgroundLinkedTests(id, options, globalOptions, values) {
@@ -76,6 +81,7 @@ async function runBackgroundLinkedTests(id, options, globalOptions, values) {
76
81
  add: values.addValues,
77
82
  addJson: values.addJsonValues,
78
83
  remove: values.removeValues,
84
+ removeIndex: values.removeIndexValues,
79
85
  }),
80
86
  targetId: id,
81
87
  author: typeof options.author === "string" ? options.author : undefined,
@@ -88,6 +94,7 @@ function buildRunTestOptions(options, values) {
88
94
  add: values.addValues,
89
95
  addJson: values.addJsonValues,
90
96
  remove: values.removeValues,
97
+ removeIndex: values.removeIndexValues,
91
98
  list: Boolean(options.list),
92
99
  run: Boolean(options.run),
93
100
  match: typeof options.match === "string" ? options.match : undefined,
@@ -126,7 +133,8 @@ async function runForegroundLinkedTests(id, options, globalOptions, values) {
126
133
  if (values.addValues.length > 0 ||
127
134
  values.addJsonValues.length > 0 ||
128
135
  values.removeValues.length > 0 ||
129
- options.run === true) {
136
+ options.run === true ||
137
+ values.removeIndexValues.length > 0) {
130
138
  await invalidateSearchCachesForMutation(globalOptions, result);
131
139
  }
132
140
  printResult(result, globalOptions);
@@ -235,6 +243,7 @@ async function runStatsAction(options, command) {
235
243
  const startedAt = Date.now();
236
244
  const analytics = parseStatsAnalyticsJson(readOptionString(options, "analytics"));
237
245
  const result = await runStats(globalOptions, {
246
+ includeEmpty: options.includeEmpty === true,
238
247
  storage: options.storage === true,
239
248
  metadataCoverage: options.metadataCoverage === true,
240
249
  byAssignee: options.byAssignee === true,
@@ -372,11 +381,14 @@ async function runWorkspaceSnapshotAction(action, target, options, command) {
372
381
  const pmRoot = resolvePmRoot(process.cwd(), globalOptions.path);
373
382
  const normalizedAction = action.trim().toLowerCase();
374
383
  if (!["create", "list", "inspect", "restore", "delete"].includes(normalizedAction)) {
375
- throw new PmCliError(`Unknown workspace snapshot action "${action}". Use create, list, inspect, restore, or delete.`, EXIT_CODE.USAGE, {
376
- code: "unknown_subcommand",
384
+ throw createUnknownSubcommandError({
385
+ command_path: "workspace snapshot",
386
+ token: action,
387
+ allowed: ["create", "list", "inspect", "restore", "delete"],
388
+ display_name: "workspace snapshot",
389
+ token_kind: "action",
377
390
  examples: [
378
391
  "pm workspace snapshot create before-migration",
379
- "pm workspace snapshot list",
380
392
  "pm workspace snapshot restore before-migration",
381
393
  ],
382
394
  });
@@ -555,12 +567,14 @@ function addLinkedTestExecutionOptions(command) {
555
567
  }
556
568
  /** Implements register operation commands for the public runtime surface of this module. */
557
569
  export function registerOperationCommands(program) {
570
+ registerAssuranceCommand(program);
558
571
  const testCommand = program
559
572
  .command("test")
560
573
  .argument("<id>", "Item id")
561
574
  .option("--add <value>", "Add linked test entry (CSV/markdown pairs or - for stdin)", collect)
562
575
  .option("--add-json <value>", "Add linked test entry from JSON object/array (or - for stdin)", collect)
563
- .option("--remove <value>", "Remove linked test entry by command/path (command=<value>, path=<value>, markdown pairs, plain value, or - for stdin)", collect)
576
+ .option("--remove <value>", "Remove linked test entry by exact command/path (command=<value> and path=<value> preserve commas and equals signs; or - for stdin)", collect)
577
+ .option("--remove-index <n>", "Remove the 1-based linked-test index from --list order (repeatable)", collect)
564
578
  .option("--list", "List linked tests without mutating")
565
579
  .option("--run", "Run linked test commands")
566
580
  .option("--match <value>", "Run only linked tests whose command/path contains this substring")
@@ -608,6 +622,7 @@ export function registerOperationCommands(program) {
608
622
  program
609
623
  .command("stats")
610
624
  .description("Show project tracker statistics.")
625
+ .option("--include-empty", "Restore zero-count registered item-type and lifecycle-status buckets")
611
626
  .option("--storage", "Include aggregate history-stream storage metrics (total streams/lines/bytes, largest + deepest streams, oldest/newest entries)")
612
627
  .option("--metadata-coverage", "Include metadata coverage % (acceptance_criteria, estimated_minutes, resolution, tags, parent) overall and by type")
613
628
  .option("--by-assignee", "Include a lifecycle-bucketed item breakdown grouped by assignee")
@@ -858,4 +873,4 @@ function registerSchedulingShortcutCommands(program) {
858
873
  });
859
874
  }
860
875
  //# sourceMappingURL=register-operations.js.map
861
- //# debugId=4856ec1e-7841-5ad0-95e3-6e3057ed999c
876
+ //# debugId=7796ea07-0de7-5db8-a3b5-a8021ceebc69