@unbrained/pm-cli 2026.9.4 → 2026.9.6

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 (277) hide show
  1. package/.agents/skills/HARNESS_COMPATIBILITY.md +1 -1
  2. package/.agents/skills/README.md +2 -2
  3. package/.agents/skills/pm-developer/SKILL.md +4 -1
  4. package/.agents/skills/pm-developer/references/COMMAND_PLAYBOOK.md +10 -0
  5. package/.agents/skills/pm-developer/references/GRAPH_AND_RELATIONSHIPS.md +3 -1
  6. package/.agents/skills/pm-extensions/SKILL.md +2 -2
  7. package/.agents/skills/pm-extensions/references/LIFECYCLE.md +3 -3
  8. package/.agents/skills/pm-extensions/references/TROUBLESHOOTING.md +3 -3
  9. package/.agents/skills/pm-user/SKILL.md +2 -0
  10. package/.agents/skills/pm-user/references/BACKLOG_SHAPING.md +5 -0
  11. package/.agents/skills/pm-user/references/WORKFLOWS.md +20 -5
  12. package/.claude-plugin/marketplace.json +2 -2
  13. package/CHANGELOG.md +58 -3
  14. package/dist/cli/commander-usage.d.ts +2 -0
  15. package/dist/cli/commander-usage.js +15 -12
  16. package/dist/cli/help-json-payload.js +12 -7
  17. package/dist/cli/main.js +22 -11
  18. package/dist/cli/register-list-query.js +4 -2
  19. package/dist/cli/register-mutation.js +4 -2
  20. package/dist/cli/register-operations.js +17 -8
  21. package/dist/cli-bundle/bundle-manifest.json +153 -161
  22. package/dist/cli-bundle/chunks/chunk-AZDFJGH6.js +9 -0
  23. package/dist/cli-bundle/chunks/{chunk-V72UV7QS.js → chunk-BAX2BYUW.js} +73 -73
  24. package/dist/cli-bundle/chunks/{chunk-HI6BHPCU.js → chunk-CKOL5U7J.js} +51 -51
  25. package/dist/cli-bundle/chunks/{chunk-A24WAVE6.js → chunk-JT6XF6GE.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-I2AS367G.js → chunk-JX4DH4WC.js} +2 -2
  27. package/dist/cli-bundle/chunks/{chunk-YW4QK2G7.js → chunk-NPN5I67J.js} +2 -2
  28. package/dist/cli-bundle/chunks/chunk-OF76PSDQ.js +5 -0
  29. package/dist/cli-bundle/chunks/chunk-QUWFABDM.js +232 -0
  30. package/dist/cli-bundle/chunks/{chunk-RI4XNOYS.js → chunk-RWWBOWJ5.js} +2 -2
  31. package/dist/cli-bundle/chunks/chunk-WGAOYSYH.js +40 -0
  32. package/dist/cli-bundle/chunks/{chunk-X6CMGV6L.js → chunk-WI2AYPA7.js} +2 -2
  33. package/dist/cli-bundle/chunks/{register-list-query-Z5YYSJJG.js → register-list-query-5JL52D33.js} +3 -3
  34. package/dist/cli-bundle/chunks/{register-mutation-ELSP6I4I.js → register-mutation-ZPG7KMVP.js} +4 -4
  35. package/dist/cli-bundle/chunks/register-operations-I5W3KMGB.js +2 -0
  36. package/dist/cli-bundle/chunks/{register-setup-E2AE72QG.js → register-setup-H4SVAVX7.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-3646BZ4W.js → chunk-3BZEOXLT.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/chunk-AL5ON6K6.js +2 -0
  39. package/dist/cli-bundle/focused-chunks/chunk-CHC2IDXA.js +6 -0
  40. package/dist/cli-bundle/focused-chunks/chunk-CK6QFAPZ.js +20 -0
  41. package/dist/cli-bundle/focused-chunks/{chunk-NBMJD6MK.js → chunk-EZR3GHFE.js} +2 -2
  42. package/dist/cli-bundle/focused-chunks/chunk-H2WJWK7L.js +56 -0
  43. package/dist/cli-bundle/focused-chunks/{chunk-53IHPICX.js → chunk-LIJIA4TY.js} +2 -2
  44. package/dist/cli-bundle/focused-chunks/{chunk-25UJBH4M.js → chunk-M6PBRFSH.js} +2 -2
  45. package/dist/cli-bundle/focused-chunks/{chunk-AJR3OP2E.js → chunk-NTPY5GSO.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/chunk-P5O7MP5Y.js +2 -0
  47. package/dist/cli-bundle/focused-chunks/chunk-PDMW2E36.js +177 -0
  48. package/dist/cli-bundle/focused-chunks/{chunk-MHKUIPJW.js → chunk-PEFABF7E.js} +2 -2
  49. package/dist/cli-bundle/focused-chunks/{chunk-6PWPQKDN.js → chunk-QTVCLMSZ.js} +2 -2
  50. package/dist/cli-bundle/focused-chunks/{chunk-7N2TV7WZ.js → chunk-QTZRBUYA.js} +2 -2
  51. package/dist/cli-bundle/focused-chunks/chunk-SGQST3PQ.js +12 -0
  52. package/dist/cli-bundle/focused-chunks/chunk-UKHASMMP.js +10 -0
  53. package/dist/cli-bundle/focused-chunks/chunk-ZPEKQHOC.js +2 -0
  54. package/dist/cli-bundle/main.js +22 -15
  55. package/dist/cli-bundle/sdk-authoring.js +1 -1
  56. package/dist/cli-bundle/sdk-contracts.js +2 -2
  57. package/dist/cli-bundle/sdk-core.js +37 -37
  58. package/dist/cli-bundle/sdk-governance.js +1 -1
  59. package/dist/cli-bundle/sdk-graph.js +1 -1
  60. package/dist/cli-bundle/sdk-merge.js +42 -39
  61. package/dist/cli-bundle/sdk-query.js +1 -1
  62. package/dist/cli-bundle/sdk-runtime.js +1 -1
  63. package/dist/cli-bundle/sdk-testing.js +1 -1
  64. package/dist/cli-bundle/sdk.js +9 -9
  65. package/dist/core/extensions/extension-types.d.ts +2 -0
  66. package/dist/core/extensions/extension-types.js +2 -2
  67. package/dist/core/extensions/module-graph-snapshot.js +5 -4
  68. package/dist/core/fs/host-environment-errors.d.ts +27 -0
  69. package/dist/core/fs/host-environment-errors.js +142 -0
  70. package/dist/core/history/drift-scan.d.ts +5 -0
  71. package/dist/core/history/drift-scan.js +16 -6
  72. package/dist/core/history/event-classification.d.ts +1 -1
  73. package/dist/core/history/event-classification.js +3 -2
  74. package/dist/core/history/history.js +37 -5
  75. package/dist/core/history/identity.d.ts +15 -0
  76. package/dist/core/history/identity.js +31 -0
  77. package/dist/core/history/projection.js +50 -17
  78. package/dist/core/history/read.js +6 -3
  79. package/dist/core/history/replay.d.ts +1 -2
  80. package/dist/core/history/replay.js +4 -4
  81. package/dist/core/history/version-address.d.ts +13 -0
  82. package/dist/core/history/version-address.js +33 -0
  83. package/dist/core/item/actionability.d.ts +21 -1
  84. package/dist/core/item/actionability.js +45 -10
  85. package/dist/core/item/id.js +8 -4
  86. package/dist/core/item/item-type-definition.d.ts +2 -0
  87. package/dist/core/item/item-type-definition.js +9 -2
  88. package/dist/core/item/type-registry.d.ts +5 -1
  89. package/dist/core/item/type-registry.js +9 -4
  90. package/dist/core/output/mutation-projection.js +12 -5
  91. package/dist/core/shared/errors.d.ts +8 -0
  92. package/dist/core/shared/errors.js +2 -2
  93. package/dist/core/store/item-metadata-query-index.js +13 -10
  94. package/dist/core/store/item-metadata-read-work.d.ts +19 -0
  95. package/dist/core/store/item-metadata-read-work.js +44 -0
  96. package/dist/core/store/item-store.d.ts +14 -0
  97. package/dist/core/store/item-store.js +52 -10
  98. package/dist/core/store/settings-validator.js +3 -2
  99. package/dist/core/validate/fix-planning.d.ts +1 -1
  100. package/dist/core/validate/fix-planning.js +2 -2
  101. package/dist/core/validate/missing-link-owners.d.ts +1 -1
  102. package/dist/core/validate/missing-link-owners.js +5 -3
  103. package/dist/core/validate/stale-file-classification.d.ts +6 -4
  104. package/dist/core/validate/stale-file-classification.js +20 -5
  105. package/dist/mcp/server.js +12 -5
  106. package/dist/sdk/actionability.d.ts +1 -1
  107. package/dist/sdk/actionability.js +3 -3
  108. package/dist/sdk/cli-contracts/command-aliases.js +11 -2
  109. package/dist/sdk/cli-contracts/completeness.js +4 -3
  110. package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
  111. package/dist/sdk/cli-contracts/flag-contracts.js +31 -5
  112. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +21 -13
  113. package/dist/sdk/cli-contracts/grammar-contracts.js +11 -2
  114. package/dist/sdk/cli-contracts/runtime-contracts.js +5 -2
  115. package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +254 -5
  116. package/dist/sdk/cli-contracts/schemas/assurance-definition.js +52 -2
  117. package/dist/sdk/cli-contracts/tool-parameter-tables.js +30 -6
  118. package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
  119. package/dist/sdk/cli-contracts/tool-schema.js +32 -7
  120. package/dist/sdk/context/usage-ledger.d.ts +41 -0
  121. package/dist/sdk/context/usage-ledger.js +186 -0
  122. package/dist/sdk/context-intent-contracts.js +3 -3
  123. package/dist/sdk/context-usage.d.ts +18 -9
  124. package/dist/sdk/context-usage.js +44 -121
  125. package/dist/sdk/define.d.ts +1 -1
  126. package/dist/sdk/define.js +2 -2
  127. package/dist/sdk/dependency-provenance.d.ts +7 -0
  128. package/dist/sdk/dependency-provenance.js +14 -4
  129. package/dist/sdk/duplicates.d.ts +2 -0
  130. package/dist/sdk/duplicates.js +3 -2
  131. package/dist/sdk/environment/host-environment-errors.d.ts +5 -27
  132. package/dist/sdk/environment/host-environment-errors.js +4 -137
  133. package/dist/sdk/extension/install-runtime.js +9 -6
  134. package/dist/sdk/extension/install-snapshot.js +7 -6
  135. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +104 -56
  136. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +50 -2
  137. package/dist/sdk/governance/assurance-action.d.ts +3 -2
  138. package/dist/sdk/governance/assurance-action.js +23 -11
  139. package/dist/sdk/governance/assurance-runtime.d.ts +2 -0
  140. package/dist/sdk/governance/assurance-runtime.js +6 -3
  141. package/dist/sdk/governance/defect-recurrence-coverage.d.ts +93 -0
  142. package/dist/sdk/governance/defect-recurrence-coverage.js +189 -0
  143. package/dist/sdk/governance/defect-recurrence-graph.d.ts +33 -0
  144. package/dist/sdk/governance/defect-recurrence-graph.js +121 -0
  145. package/dist/sdk/governance/defect-recurrence.d.ts +8 -0
  146. package/dist/sdk/governance/defect-recurrence.js +118 -17
  147. package/dist/sdk/governance/health.d.ts +17 -2
  148. package/dist/sdk/governance/health.js +31 -10
  149. package/dist/sdk/governance/linked-file-report.d.ts +41 -0
  150. package/dist/sdk/governance/linked-file-report.js +72 -0
  151. package/dist/sdk/governance/validate-history-drift.js +16 -5
  152. package/dist/sdk/governance/validate.d.ts +5 -2
  153. package/dist/sdk/governance/validate.js +21 -37
  154. package/dist/sdk/governance.d.ts +2 -0
  155. package/dist/sdk/governance.js +4 -2
  156. package/dist/sdk/guide-topics.js +116 -2
  157. package/dist/sdk/history/salvage.d.ts +35 -0
  158. package/dist/sdk/history/salvage.js +248 -0
  159. package/dist/sdk/history-compact.js +32 -37
  160. package/dist/sdk/history-read.d.ts +3 -2
  161. package/dist/sdk/history-read.js +6 -3
  162. package/dist/sdk/history-repair.d.ts +12 -0
  163. package/dist/sdk/history-repair.js +60 -13
  164. package/dist/sdk/lifecycle/claim.d.ts +4 -0
  165. package/dist/sdk/lifecycle/claim.js +9 -3
  166. package/dist/sdk/lifecycle/close.d.ts +8 -0
  167. package/dist/sdk/lifecycle/close.js +16 -8
  168. package/dist/sdk/lifecycle/create.js +9 -12
  169. package/dist/sdk/lifecycle/restore.d.ts +1 -0
  170. package/dist/sdk/lifecycle/restore.js +19 -7
  171. package/dist/sdk/lifecycle/update.js +12 -12
  172. package/dist/sdk/lifecycle-policy.d.ts +3 -0
  173. package/dist/sdk/lifecycle-policy.js +2 -2
  174. package/dist/sdk/merge/abandoned-receipts.d.ts +15 -0
  175. package/dist/sdk/merge/abandoned-receipts.js +47 -0
  176. package/dist/sdk/merge/driver.js +4 -2
  177. package/dist/sdk/merge/index.d.ts +1 -0
  178. package/dist/sdk/merge/index.js +2 -2
  179. package/dist/sdk/merge/receipt-operation.d.ts +15 -0
  180. package/dist/sdk/merge/receipt-operation.js +97 -0
  181. package/dist/sdk/merge/receipt-schema.d.ts +20 -0
  182. package/dist/sdk/merge/receipt-schema.js +398 -0
  183. package/dist/sdk/merge/receipts.d.ts +16 -7
  184. package/dist/sdk/merge/receipts.js +54 -340
  185. package/dist/sdk/merge/reconcile.d.ts +2 -0
  186. package/dist/sdk/merge/reconcile.js +11 -4
  187. package/dist/sdk/output-projection.d.ts +3 -1
  188. package/dist/sdk/output-projection.js +11 -3
  189. package/dist/sdk/public-surface.json +1 -0
  190. package/dist/sdk/query/context.d.ts +9 -0
  191. package/dist/sdk/query/context.js +33 -21
  192. package/dist/sdk/query/duplicate-candidates.d.ts +7 -0
  193. package/dist/sdk/query/duplicate-candidates.js +71 -0
  194. package/dist/sdk/query/get.d.ts +2 -2
  195. package/dist/sdk/query/get.js +9 -8
  196. package/dist/sdk/query/history.d.ts +11 -0
  197. package/dist/sdk/query/history.js +34 -10
  198. package/dist/sdk/query/next.d.ts +15 -1
  199. package/dist/sdk/query/next.js +43 -20
  200. package/dist/sdk/query.d.ts +3 -0
  201. package/dist/sdk/query.js +5 -2
  202. package/dist/sdk/read-output-session.js +5 -3
  203. package/dist/sdk/runtime-primitives.d.ts +1 -1
  204. package/dist/sdk/runtime-primitives.js +3 -3
  205. package/dist/sdk/runtime.js +4 -2
  206. package/dist/sdk/similarity.d.ts +24 -3
  207. package/dist/sdk/similarity.js +50 -55
  208. package/dist/types.d.ts +2 -0
  209. package/dist/types.js +2 -2
  210. package/docs/AGENT_GUIDE.md +58 -1
  211. package/docs/BOUNDED_CONTEXT_READS.md +185 -0
  212. package/docs/CLOSE_EVIDENCE_RECOVERY.md +35 -0
  213. package/docs/COMMANDS.md +30 -8
  214. package/docs/CONTEXT_RELEVANCE.md +16 -4
  215. package/docs/DEFECT_RECURRENCE.md +80 -6
  216. package/docs/EXTENSIONS.md +18 -19
  217. package/docs/HISTORY_RECOVERY.md +146 -0
  218. package/docs/MERGE_SAFETY.md +50 -0
  219. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +66 -0
  220. package/docs/PR_REVIEW_LOOP.md +18 -3
  221. package/docs/README.md +19 -1
  222. package/docs/RELEASING.md +31 -13
  223. package/docs/SDK_CONTEXT_TRUTH_CONTRACTS.md +24 -1
  224. package/docs/SDK_EXECUTION_CONTRACTS.md +105 -0
  225. package/docs/SDK_LIFECYCLE.md +27 -0
  226. package/docs/SDK_RUNTIME_BOUNDARIES.md +11 -0
  227. package/docs/TESTING.md +5 -0
  228. package/docs/agent-task-token-baseline.json +17 -17
  229. package/docs/agent-task-transcripts.json +2 -1
  230. package/docs/generated/FLAG_LEXICON_BUDGETS.md +11 -11
  231. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +11 -3
  232. package/marketplace.json +2 -2
  233. package/package.json +8 -6
  234. package/packages/pm-beads/package.json +1 -1
  235. package/packages/pm-calendar/package.json +1 -1
  236. package/packages/pm-command-kit/package.json +1 -1
  237. package/packages/pm-digital-twin/package.json +1 -1
  238. package/packages/pm-governance-audit/README.md +10 -1
  239. package/packages/pm-governance-audit/extensions/governance-audit/dedupe-audit.ts +50 -65
  240. package/packages/pm-governance-audit/extensions/governance-audit/index.ts +2 -2
  241. package/packages/pm-governance-audit/extensions/governance-audit/sdk.ts +1 -0
  242. package/packages/pm-governance-audit/package.json +1 -1
  243. package/packages/pm-guide-shell/package.json +1 -1
  244. package/packages/pm-kanban/package.json +1 -1
  245. package/packages/pm-lifecycle-hooks/package.json +1 -1
  246. package/packages/pm-linked-test-adapters/package.json +1 -1
  247. package/packages/pm-search-advanced/package.json +1 -1
  248. package/packages/pm-templates/package.json +1 -1
  249. package/packages/pm-todos/package.json +1 -1
  250. package/packages/pm-vcs/package.json +1 -1
  251. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  252. package/plugins/pm-claude/skills/pm-audit/SKILL.md +2 -2
  253. package/plugins/pm-claude/skills/pm-developer/SKILL.md +2 -2
  254. package/plugins/pm-claude/skills/pm-planner/SKILL.md +2 -2
  255. package/plugins/pm-claude/skills/pm-release/SKILL.md +2 -2
  256. package/plugins/pm-claude/skills/pm-workflow/SKILL.md +3 -3
  257. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  258. package/plugins/pm-codex/skills/pm-auditor/SKILL.md +2 -2
  259. package/plugins/pm-codex/skills/pm-native/SKILL.md +3 -4
  260. package/plugins/pm-codex/skills/pm-release/SKILL.md +2 -2
  261. package/scripts/finalize-build.mjs +13 -1
  262. package/dist/cli-bundle/chunks/chunk-6XSKPNCF.js +0 -230
  263. package/dist/cli-bundle/chunks/chunk-OGBVU67G.js +0 -5
  264. package/dist/cli-bundle/chunks/chunk-TXW6VL33.js +0 -38
  265. package/dist/cli-bundle/chunks/chunk-VGLHECAP.js +0 -9
  266. package/dist/cli-bundle/chunks/register-operations-OH7R3ZT4.js +0 -2
  267. package/dist/cli-bundle/focused-chunks/chunk-4YRAVI43.js +0 -12
  268. package/dist/cli-bundle/focused-chunks/chunk-5P4HVOWG.js +0 -176
  269. package/dist/cli-bundle/focused-chunks/chunk-636VVQ7F.js +0 -54
  270. package/dist/cli-bundle/focused-chunks/chunk-B3A6MJYE.js +0 -2
  271. package/dist/cli-bundle/focused-chunks/chunk-BFDDJ2T2.js +0 -2
  272. package/dist/cli-bundle/focused-chunks/chunk-BHUIRZWQ.js +0 -9
  273. package/dist/cli-bundle/focused-chunks/chunk-JADHHPY6.js +0 -6
  274. package/dist/cli-bundle/focused-chunks/chunk-NSKBLHVI.js +0 -20
  275. package/dist/cli-bundle/focused-chunks/chunk-P2GOAOQN.js +0 -2
  276. package/dist/cli-bundle/focused-chunks/chunk-YARWJM2B.js +0 -2
  277. package/sdk/public-surface.json +0 -33034
@@ -4,8 +4,9 @@
4
4
  * Reads and writes tracker storage with format-aware helpers for Item Store.
5
5
  */
6
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]="bffd3114-3e85-58ae-90c7-eea5069cdb89")}catch(e){}}();
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]="7cbc256e-cdd8-51de-9c22-08cf2f3cd010")}catch(e){}}();
8
8
  import fs from "node:fs/promises";
9
+ import { recordItemMetadataEnumeration } from "./item-metadata-read-work.js";
9
10
  import path from "node:path";
10
11
  import { getActiveExtensionRegistrations, projectAfterCommandItemSnapshot, recordAfterCommandAffectedItem, runActiveOnReadHooks, runActiveBeforeMutationHooks, runActiveOnWriteHooks, runActiveServiceOverride, } from "../extensions/index.js";
11
12
  import { collectRegisteredItemFieldNames } from "../extensions/item-fields.js";
@@ -18,6 +19,7 @@ import { canonicalDocument, parseItemDocument, serializeItemDocument, } from "..
18
19
  import { resolveItemTypeRegistry } from "../item/type-registry.js";
19
20
  import { acquireLock } from "../lock/lock.js";
20
21
  import { writeFileAtomic } from "../fs/fs-utils.js";
22
+ import { isUtf8 } from "node:buffer";
21
23
  import { normalizeItemId, normalizeRawItemId } from "../item/id.js";
22
24
  import { acquireItemMetadataDerivedIndexLock, listAllDocumentCandidatesCached, listAllDocumentsCached, listAllDocumentsCachedLight, refreshItemMetadataDerivedIndex, } from "./item-metadata-cache.js";
23
25
  import { getHistoryPath, getItemPath, ITEM_FILE_EXTENSIONS } from "./paths.js";
@@ -96,23 +98,61 @@ export async function locateItem(pmRoot, rawId, idPrefix = "pm-", preferredForma
96
98
  }
97
99
  /** Implements read located item for the public runtime surface of this module. */
98
100
  export async function readLocatedItem(item, options = {}) {
99
- const raw = await fs.readFile(item.itemPath, "utf8");
101
+ const snapshot = await readLocatedItemSnapshot(item, options);
102
+ if (snapshot.error !== null)
103
+ throw snapshot.error;
104
+ return { raw: snapshot.raw, document: snapshot.document };
105
+ }
106
+ /**
107
+ * Read once and retain a recoverable parse failure beside its exact text snapshot.
108
+ * Filesystem and merge-conflict errors still throw; callers must explicitly
109
+ * reconstruct an invalid document before performing any mutation.
110
+ */
111
+ export async function readLocatedItemSnapshot(item, options = {}) {
112
+ const bytes = await fs.readFile(item.itemPath);
113
+ if (!isUtf8(bytes)) {
114
+ throw new PmCliError("Item contains invalid UTF-8; preserve a binary backup before recovering it.", EXIT_CODE.CONFLICT, { code: "item_document_encoding_invalid", item_id: item.id, item_path: item.itemPath, byte_length: bytes.length, empty: false });
115
+ }
116
+ const raw = bytes.toString("utf8");
100
117
  await runActiveOnReadHooks({
101
118
  path: item.itemPath,
102
119
  scope: "project",
103
120
  });
104
- const document = parseItemDocument(raw, {
105
- format: item.item_format,
106
- schema: options.schema,
107
- extensionFieldNames: resolveActiveExtensionFieldNames(options.extensionFieldNames),
108
- onWarning: (warning) => appendWarning(options.warnings, warning),
109
- });
110
- return { raw, document };
121
+ let document;
122
+ try {
123
+ document = parseItemDocument(raw, {
124
+ format: item.item_format,
125
+ schema: options.schema,
126
+ extensionFieldNames: resolveActiveExtensionFieldNames(options.extensionFieldNames),
127
+ onWarning: (warning) => appendWarning(options.warnings, warning),
128
+ });
129
+ }
130
+ catch (error) {
131
+ if (error instanceof PmCliError && error.code === "item_document_invalid") {
132
+ return {
133
+ raw,
134
+ document: null,
135
+ error: new PmCliError(`Cannot read ${item.id} at ${item.itemPath}${bytes.length === 0 ? " (zero-length file)" : ""}: ${error.message}`, error.exitCode, {
136
+ ...error.context,
137
+ item_id: item.id,
138
+ item_path: item.itemPath,
139
+ byte_length: bytes.length,
140
+ empty: bytes.length === 0,
141
+ nextSteps: [
142
+ `Run pm history ${item.id} --full, then pm restore ${item.id} <version> to recover a recorded state.`,
143
+ ],
144
+ }),
145
+ };
146
+ }
147
+ throw error;
148
+ }
149
+ return { raw, document, error: null };
111
150
  }
112
151
  /** Implements list all item metadata for the public runtime surface of this module. */
113
152
  export async function listAllItemMetadata(pmRoot, preferredFormat, typeToFolder = TYPE_TO_FOLDER, warnings, schema) {
114
153
  await assertReadableTrackerRoot(pmRoot);
115
154
  const documents = await listAllDocumentsCached(pmRoot, preferredFormat, typeToFolder, warnings, schema);
155
+ recordItemMetadataEnumeration(documents.length);
116
156
  return documents.map((document) => document.metadata);
117
157
  }
118
158
  /**
@@ -124,6 +164,7 @@ export async function listAllItemMetadata(pmRoot, preferredFormat, typeToFolder
124
164
  export async function listAllItemMetadataLight(pmRoot, preferredFormat, typeToFolder = TYPE_TO_FOLDER, warnings, schema) {
125
165
  await assertReadableTrackerRoot(pmRoot);
126
166
  const documents = await listAllDocumentsCachedLight(pmRoot, preferredFormat, typeToFolder, warnings, schema);
167
+ recordItemMetadataEnumeration(documents.length);
127
168
  return documents.map((document) => document.metadata);
128
169
  }
129
170
  /** List item metadata with bodies, optionally bypassing the derived-index fast path when an integrity workflow must re-read authoritative files. */
@@ -133,6 +174,7 @@ export async function listAllItemMetadataWithBody(pmRoot, preferredFormat, typeT
133
174
  includeBody: true,
134
175
  forceSourceScan: options.forceSourceScan,
135
176
  });
177
+ recordItemMetadataEnumeration(candidates.length);
136
178
  return candidates.map((candidate) => ({
137
179
  ...candidate.metadata,
138
180
  // includeBody:true guarantees candidate bodies are materialized.
@@ -649,4 +691,4 @@ export async function deleteItem(params) {
649
691
  }
650
692
  }
651
693
  //# sourceMappingURL=item-store.js.map
652
- //# debugId=bffd3114-3e85-58ae-90c7-eea5069cdb89
694
+ //# debugId=7cbc256e-cdd8-51de-9c22-08cf2f3cd010
@@ -12,7 +12,7 @@
12
12
  * byte-identical to the previous implementation.
13
13
  */
14
14
 
15
- !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]="0e135793-d2ed-505b-b73e-6db55218d8af")}catch(e){}}();
15
+ !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]="c9cac741-16ba-5466-806f-bf8881a2ffa2")}catch(e){}}();
16
16
  import { GOVERNANCE_PRESET_VALUES, RUNTIME_FIELD_COMMAND_VALUES, RUNTIME_FIELD_TYPE_VALUES, RUNTIME_STATUS_ROLE_VALUES, RUNTIME_UNKNOWN_FIELD_POLICY_VALUES, } from "../../types.js";
17
17
  // Generic over `never` so it is assignable to every `Outcome<T>`.
18
18
  const FAIL = { ok: false };
@@ -137,6 +137,7 @@ const itemTypeDefinition = vObject({
137
137
  // Per-type create-time default status (config-driven); preserved so inline
138
138
  // settings.item_types.definitions behave identically to schema/types.json.
139
139
  default_status: vOptional(vString),
140
+ execution_role: vOptional(vLiteral("agent", "human", "gate")),
140
141
  folder: vOptional(vString),
141
142
  aliases: vOptional(vArray(vString)),
142
143
  required_create_fields: vOptional(vArray(vString)),
@@ -418,4 +419,4 @@ export function validateSettings(raw) {
418
419
  return { success: true, data: result.value };
419
420
  }
420
421
  //# sourceMappingURL=settings-validator.js.map
421
- //# debugId=0e135793-d2ed-505b-b73e-6db55218d8af
422
+ //# debugId=c9cac741-16ba-5466-806f-bf8881a2ffa2
@@ -97,7 +97,7 @@ export interface StaleLinkPruneRow {
97
97
  /** Value that configures or reports link kind for this contract. */
98
98
  link_kind: "files" | "docs";
99
99
  /** Value that configures or reports classification for this contract. */
100
- classification: "moved" | "deleted";
100
+ classification: "moved" | "deleted" | "malformed";
101
101
  }
102
102
  /** Plan link prunes for `--prune-missing` (pm-0v2m / GH-184). Only links whose stale path classified as `deleted` are pruned; `moved` links keep their relink candidates in the files-check details instead of being dropped, so recoverable link information is never destroyed. Link removal only — real files are never touched. */
103
103
  export declare function planStaleLinkPruneFixes(rows: readonly StaleLinkPruneRow[]): ValidateFixRecord[];
@@ -16,7 +16,7 @@
16
16
  * explicitly granted.
17
17
  */
18
18
 
19
- !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]="ab236f47-a866-5236-b8da-f7f23140b978")}catch(e){}}();
19
+ !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]="98a73818-c4ef-5bce-8b23-6c40f7312cc3")}catch(e){}}();
20
20
  import { EXIT_CODE } from "../shared/constants.js";
21
21
  import { PmCliError } from "../shared/errors.js";
22
22
  import { resolveEstimateDefaultMinutes } from "./estimate-defaults.js";
@@ -187,4 +187,4 @@ export function toFixOutputRow(fix) {
187
187
  };
188
188
  }
189
189
  //# sourceMappingURL=fix-planning.js.map
190
- //# debugId=ab236f47-a866-5236-b8da-f7f23140b978
190
+ //# debugId=98a73818-c4ef-5bce-8b23-6c40f7312cc3
@@ -13,7 +13,7 @@
13
13
  * the already-collected stale-link rows plus a metadata `lookup` closure.
14
14
  */
15
15
  /** Classification assigned to a stale linked path during files validation. */
16
- export type StaleLinkClassification = "moved" | "deleted";
16
+ export type StaleLinkClassification = "moved" | "deleted" | "malformed";
17
17
  /** Documents the stale link owner input payload exchanged by command, SDK, and package integrations. */
18
18
  export interface StaleLinkOwnerInput {
19
19
  /** Value that configures or reports item id for this contract. */
@@ -12,10 +12,12 @@
12
12
  * Pure module (GH-210): no filesystem access and no heavy imports — callers pass
13
13
  * the already-collected stale-link rows plus a metadata `lookup` closure.
14
14
  */
15
- /** `moved` wins over `deleted` when a single path's rows disagree on classification: `moved` means a relink candidate exists, which is the safer, more-actionable signal (relink instead of risk pruning a still-reachable link). In practice all rows for one path share a classification; this is a deterministic tie-break for the degenerate case. */
15
+ /** `malformed` wins over other classifications to prevent unsafe automatic repair. Otherwise `moved` wins over `deleted` when a single path's rows disagree on classification: `moved` means a relink candidate exists, which is the safer, more-actionable signal (relink instead of risk pruning a still-reachable link). In practice all rows for one path share a classification; this is a deterministic tie-break for the degenerate case. */
16
16
 
17
- !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]="e063d634-4306-5725-927a-5f2af1722458")}catch(e){}}();
17
+ !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]="1a4f19cf-56ba-571a-908c-97278a8284f7")}catch(e){}}();
18
18
  function preferClassification(current, next) {
19
+ if (current === "malformed" || next === "malformed")
20
+ return "malformed";
19
21
  return current === "moved" || next === "moved" ? "moved" : "deleted";
20
22
  }
21
23
  function ownerKey(input) {
@@ -91,4 +93,4 @@ export function summarizeMissingLinkedPathRows(rows) {
91
93
  return lines;
92
94
  }
93
95
  //# sourceMappingURL=missing-link-owners.js.map
94
- //# debugId=e063d634-4306-5725-927a-5f2af1722458
96
+ //# debugId=1a4f19cf-56ba-571a-908c-97278a8284f7
@@ -6,27 +6,29 @@
6
6
  * scanned candidate set — the candidates are reported so an agent can relink
7
7
  * the item to the new location instead of dropping the link, or
8
8
  * - `deleted`: no candidate with that basename exists anywhere in the scan,
9
- * so the link points at content that is gone and pruning it is safe.
9
+ * making it eligible for an explicitly requested prune, or
10
+ * - `malformed`: an ambiguous missing CSV or path:note literal which must be
11
+ * reviewed before any relocation or removal is inferred.
10
12
  *
11
13
  * Pure module (pm-0v2m / GH-184): no filesystem access — callers pass the
12
14
  * already-collected candidate file list from the files check scan.
13
15
  */
14
16
  /** Classification labels for linked paths that no longer exist on disk. */
15
- export type StaleLinkedPathClassification = "moved" | "deleted";
17
+ export type StaleLinkedPathClassification = "moved" | "deleted" | "malformed";
16
18
  /** Documents the classified stale linked path payload exchanged by command, SDK, and package integrations. */
17
19
  export interface ClassifiedStaleLinkedPath {
18
20
  /** Normalized workspace-relative stale linked path. */
19
21
  path: string;
20
22
  /** Value that configures or reports classification for this contract. */
21
23
  classification: StaleLinkedPathClassification;
22
- /** Candidate new locations (same basename, different path), sorted and capped at `candidateLimit`. Empty for `deleted`. */
24
+ /** Candidate new locations (same basename, different path), sorted and capped at `candidateLimit`. Empty for `deleted` and `malformed`. */
23
25
  candidates: string[];
24
26
  /** True when more candidates existed than `candidateLimit` allowed. */
25
27
  candidates_truncated: boolean;
26
28
  }
27
29
  /** Fallback stale path candidate limit used when callers do not provide an override. */
28
30
  export declare const DEFAULT_STALE_PATH_CANDIDATE_LIMIT = 3;
29
- /** Classify each stale (missing) linked path as `moved` or `deleted` by matching its basename against the candidate file list. Output preserves the input order of `stalePaths` (callers pass an already-sorted unique list). A candidate equal to the stale path itself never matches (the path is known missing; an identical candidate would be self-referential noise). */
31
+ /** Classify each stale (missing) linked path as `moved`, `deleted`, or `malformed` by matching its basename against the candidate file list. Output preserves the input order of `stalePaths` (callers pass an already-sorted unique list). A candidate equal to the stale path itself never matches (the path is known missing; an identical candidate would be self-referential noise). */
30
32
  export declare function classifyStaleLinkedPaths(stalePaths: readonly string[], candidateFiles: readonly string[], candidateLimit?: number): ClassifiedStaleLinkedPath[];
31
33
  /** Render compact `<path>:moved:<top-candidate>` / `<path>:deleted` rows for the files check details (token-efficient counterpart to the full classification objects). */
32
34
  export declare function summarizeStaleLinkedPathClassifications(classified: readonly ClassifiedStaleLinkedPath[]): string[];
@@ -6,20 +6,23 @@
6
6
  * scanned candidate set — the candidates are reported so an agent can relink
7
7
  * the item to the new location instead of dropping the link, or
8
8
  * - `deleted`: no candidate with that basename exists anywhere in the scan,
9
- * so the link points at content that is gone and pruning it is safe.
9
+ * making it eligible for an explicitly requested prune, or
10
+ * - `malformed`: an ambiguous missing CSV or path:note literal which must be
11
+ * reviewed before any relocation or removal is inferred.
10
12
  *
11
13
  * Pure module (pm-0v2m / GH-184): no filesystem access — callers pass the
12
14
  * already-collected candidate file list from the files check scan.
13
15
  */
14
16
  /** Fallback stale path candidate limit used when callers do not provide an override. */
15
17
 
16
- !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]="5a5b0bd8-d99b-52fb-82ae-52ba48c54c30")}catch(e){}}();
18
+ !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]="eb4fe9bd-31b5-5ed3-b401-3e3776ec12e9")}catch(e){}}();
17
19
  export const DEFAULT_STALE_PATH_CANDIDATE_LIMIT = 3;
20
+ /** Extract a basename from either portable separator convention. */
18
21
  function basenameOf(relativePath) {
19
22
  const lastSlash = Math.max(relativePath.lastIndexOf("/"), relativePath.lastIndexOf("\\"));
20
23
  return lastSlash === -1 ? relativePath : relativePath.slice(lastSlash + 1);
21
24
  }
22
- /** Classify each stale (missing) linked path as `moved` or `deleted` by matching its basename against the candidate file list. Output preserves the input order of `stalePaths` (callers pass an already-sorted unique list). A candidate equal to the stale path itself never matches (the path is known missing; an identical candidate would be self-referential noise). */
25
+ /** Classify each stale (missing) linked path as `moved`, `deleted`, or `malformed` by matching its basename against the candidate file list. Output preserves the input order of `stalePaths` (callers pass an already-sorted unique list). A candidate equal to the stale path itself never matches (the path is known missing; an identical candidate would be self-referential noise). */
23
26
  export function classifyStaleLinkedPaths(stalePaths, candidateFiles, candidateLimit = DEFAULT_STALE_PATH_CANDIDATE_LIMIT) {
24
27
  const limit = Number.isFinite(candidateLimit) && candidateLimit >= 1
25
28
  ? Math.floor(candidateLimit)
@@ -39,6 +42,18 @@ export function classifyStaleLinkedPaths(stalePaths, candidateFiles, candidateLi
39
42
  }
40
43
  }
41
44
  return stalePaths.map((stalePath) => {
45
+ // Historical CSV and path:note input must not become a confident basename
46
+ // relocation. Existing files are checked before classification; this only
47
+ // rejects ambiguous missing references, never an existing literal filename.
48
+ if (stalePath.includes(",") ||
49
+ stalePath.replace(/^[a-z]:[\\/]/i, "").includes(":")) {
50
+ return {
51
+ path: stalePath,
52
+ classification: "malformed",
53
+ candidates: [],
54
+ candidates_truncated: false,
55
+ };
56
+ }
42
57
  const matches = (candidatesByBasename.get(basenameOf(stalePath)) ?? [])
43
58
  .filter((candidate) => candidate !== stalePath)
44
59
  .sort((left, right) => left.localeCompare(right));
@@ -62,7 +77,7 @@ export function classifyStaleLinkedPaths(stalePaths, candidateFiles, candidateLi
62
77
  export function summarizeStaleLinkedPathClassifications(classified) {
63
78
  return classified.map((entry) => entry.classification === "moved"
64
79
  ? `${entry.path}:moved:${entry.candidates[0]}`
65
- : `${entry.path}:deleted`);
80
+ : `${entry.path}:${entry.classification}`);
66
81
  }
67
82
  //# sourceMappingURL=stale-file-classification.js.map
68
- //# debugId=5a5b0bd8-d99b-52fb-82ae-52ba48c54c30
83
+ //# debugId=eb4fe9bd-31b5-5ed3-b401-3e3776ec12e9
@@ -5,7 +5,7 @@
5
5
  * Runs the MCP server adapter that exposes pm actions and contracts to external agents.
6
6
  */
7
7
 
8
- !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]="71cfdc6b-c990-51b6-a9ae-ed9bf98136f7")}catch(e){}}();
8
+ !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]="1950da06-8c27-5506-bc64-4bf51c1a3f1c")}catch(e){}}();
9
9
  import { realpathSync } from "node:fs";
10
10
  import { readFile } from "node:fs/promises";
11
11
  import path from "node:path";
@@ -410,11 +410,13 @@ async function emitMcpChangeNotifications(action) {
410
410
  }
411
411
  pruneClosedMcpSubscriptionRegistries();
412
412
  }
413
+ /** Resolve one tool's workspace and scope SDK attribution to that request without changing process environment. */
413
414
  async function handleToolCall(paramsInput, clientInfo, progressiveDiscoveryNegotiated = false) {
415
+ const clientSignals = clientInfo ? { client_info: clientInfo } : {};
414
416
  return runWithHarnessDetectionSignals({
415
417
  env: process.env,
416
418
  argv: process.argv,
417
- ...(clientInfo ? { client_info: clientInfo } : {}),
419
+ ...clientSignals,
418
420
  }, async () => {
419
421
  const params = asRecordClone(paramsInput);
420
422
  const name = readRequiredString(params, "name");
@@ -454,7 +456,12 @@ async function handleToolCall(paramsInput, clientInfo, progressiveDiscoveryNegot
454
456
  const workspaceIdentity = (await pathExists(getSettingsPath(pmRoot)))
455
457
  ? (await readSettings(pmRoot)).agent_identity
456
458
  : undefined;
457
- return runWithWorkspaceHarnessSignalDescriptors(workspaceIdentity?.harness_signals ?? [], async () => {
459
+ return runWithHarnessDetectionSignals({
460
+ env: { ...process.env, PM_PATH: pmRoot },
461
+ argv: process.argv,
462
+ cwd,
463
+ ...clientSignals,
464
+ }, () => runWithWorkspaceHarnessSignalDescriptors(workspaceIdentity?.harness_signals ?? [], async () => {
458
465
  // pm-qxwu: non-breaking detection of typo'd / unexpected top-level keys.
459
466
  // additionalProperties stays true so passthrough still works; we only warn.
460
467
  // pm-upi0 extends the same mechanism into the nested options object.
@@ -472,7 +479,7 @@ async function handleToolCall(paramsInput, clientInfo, progressiveDiscoveryNegot
472
479
  const result = await handler(args);
473
480
  void emitMcpChangeNotifications(action);
474
481
  return resultContent(result, warnings, args.tokenAccounting === true, progressiveDiscoveryNegotiated);
475
- }, { probesEnabled: workspaceIdentity?.probes_enabled });
482
+ }, { probesEnabled: workspaceIdentity?.probes_enabled }));
476
483
  });
477
484
  }
478
485
  /** Open one modern subscription through a concrete transport-owned sink. */
@@ -1225,4 +1232,4 @@ if (isInvokedAsMcpMainModule(process.argv[1], import.meta.url)) {
1225
1232
  }
1226
1233
  /* c8 ignore stop */
1227
1234
  //# sourceMappingURL=server.js.map
1228
- //# debugId=71cfdc6b-c990-51b6-a9ae-ed9bf98136f7
1235
+ //# debugId=1950da06-8c27-5506-bc64-4bf51c1a3f1c
@@ -7,4 +7,4 @@
7
7
  * blocker or ready-work classifications without storage or rendering side
8
8
  * effects.
9
9
  */
10
- export { ACTIONABILITY_ORDERING_KINDS, collectBlockedByIds, collectBlockedByIdsFromCorpus, collectDependencyBlockedIds, computeActionabilityReport, indexBlockedByIds, resolveItemBlockers, type ActionabilityReport, type ActionableEntry, type ResolvedBlocker, } from "../core/item/actionability.js";
10
+ export { ACTIONABILITY_ORDERING_KINDS, collectBlockedByIds, collectBlockedByIdsFromCorpus, collectDependencyBlockedIds, computeActionabilityReport, indexBlockedByIds, resolveItemBlockers, resolveItemExecutionRole, selectActionableEntries, type ActionabilitySelectionOptions, type ActionabilityReport, type ActionableEntry, type ResolvedBlocker, } from "../core/item/actionability.js";
@@ -8,7 +8,7 @@
8
8
  * effects.
9
9
  */
10
10
 
11
- !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]="cc271a73-9767-54bb-a142-d4d4569e3c6a")}catch(e){}}();
12
- export { ACTIONABILITY_ORDERING_KINDS, collectBlockedByIds, collectBlockedByIdsFromCorpus, collectDependencyBlockedIds, computeActionabilityReport, indexBlockedByIds, resolveItemBlockers, } from "../core/item/actionability.js";
11
+ !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]="7d393eb0-d24d-55d2-8e4e-e94805d91784")}catch(e){}}();
12
+ export { ACTIONABILITY_ORDERING_KINDS, collectBlockedByIds, collectBlockedByIdsFromCorpus, collectDependencyBlockedIds, computeActionabilityReport, indexBlockedByIds, resolveItemBlockers, resolveItemExecutionRole, selectActionableEntries, } from "../core/item/actionability.js";
13
13
  //# sourceMappingURL=actionability.js.map
14
- //# debugId=cc271a73-9767-54bb-a142-d4d4569e3c6a
14
+ //# debugId=7d393eb0-d24d-55d2-8e4e-e94805d91784
@@ -10,8 +10,17 @@
10
10
  * are intentionally absent from default help and completion discovery.
11
11
  */
12
12
 
13
- !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]="3c9694bd-3635-5298-abeb-6899c94317ab")}catch(e){}}();
13
+ !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]="a7934e70-b1ea-5eac-b500-e4b18a6385a6")}catch(e){}}();
14
14
  export const PM_COMMAND_ALIAS_CONTRACTS = [
15
+ {
16
+ alias: "tests",
17
+ canonical: "test",
18
+ canonical_argv: ["test"],
19
+ lifecycle: "permanent",
20
+ hidden: false,
21
+ registration: "bootstrap",
22
+ owner: "pm-u4t9gp",
23
+ },
15
24
  ...[
16
25
  ["fetch", "get"],
17
26
  ["read", "get"],
@@ -96,4 +105,4 @@ export function renderPmCommandAliasMigrationHint(contract) {
96
105
  return `Deprecated command \`${contract.alias}\`; use \`pm ${contract.canonical_argv.join(" ")}\`.`;
97
106
  }
98
107
  //# sourceMappingURL=command-aliases.js.map
99
- //# debugId=3c9694bd-3635-5298-abeb-6899c94317ab
108
+ //# debugId=a7934e70-b1ea-5eac-b500-e4b18a6385a6
@@ -7,7 +7,7 @@
7
7
  * a hand-picked test list.
8
8
  */
9
9
 
10
- !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]="f4e5eed5-94c2-536a-8685-e20b735de480")}catch(e){}}();
10
+ !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]="199e3ef5-93a0-5d93-8f77-d9d12bbc69d4")}catch(e){}}();
11
11
  import { PM_TOOL_ACTIONS } from "./enum-contracts.js";
12
12
  import { resolveSubcommandFlagContractsForCommand, } from "./flag-contracts.js";
13
13
  import { pmToolActionParameterKeys } from "./tool-schema.js";
@@ -100,6 +100,7 @@ const ACTION_POSITIONAL_PARAMETERS = {
100
100
  },
101
101
  };
102
102
  const ACTION_FLAG_PARAMETER_OVERRIDES = {
103
+ append: { "--text": "body" },
103
104
  assurance: {
104
105
  "--tree": "treeId",
105
106
  "--owner": "owner",
@@ -139,7 +140,7 @@ const ACTION_FLAG_PARAMETER_OVERRIDES = {
139
140
  docs: { "--note": "addNote" },
140
141
  comments: { "--full-history": "full" },
141
142
  notes: { "--file": "text", "--full-history": "full" },
142
- learnings: { "--full-history": "full" },
143
+ learnings: { "--file": "text", "--full-history": "full" },
143
144
  gc: { "--scope": "gcScope" },
144
145
  contracts: { "--action": "contractAction" },
145
146
  schema: {
@@ -390,4 +391,4 @@ export function analyzeSdkCliParameterCompleteness(source = {}) {
390
391
  });
391
392
  }
392
393
  //# sourceMappingURL=completeness.js.map
393
- //# debugId=f4e5eed5-94c2-536a-8685-e20b735de480
394
+ //# debugId=199e3ef5-93a0-5d93-8f77-d9d12bbc69d4
@@ -21,6 +21,8 @@ export interface CliFlagContract {
21
21
  value_type?: "string" | "number" | "boolean";
22
22
  /** Marks a presentation-only flag that may change paging or rendering without invalidating continuation. Omission means the flag is query-semantic. */
23
23
  cursor_semantics?: "presentation";
24
+ /** Host reservation boundary: inherited flags are forbidden on extensions; root-only flags may have command-local meanings. */
25
+ reservation_scope?: "inherited" | "root_only";
24
26
  }
25
27
  /** Maps an MCP tool option `param` to the CLI `flag` it forwards to, plus the value semantics (`allowEmpty`, `repeatable`, `booleanish`) the bridge needs to translate a structured tool call into argv. */
26
28
  export interface ToolOptionFlagContract {
@@ -7,7 +7,7 @@
7
7
  * flag surface stays single-sourced across the CLI, SDK, and MCP boundaries.
8
8
  */
9
9
 
10
- !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]="789faf62-dfbf-56ff-9412-55adc5c12d3d")}catch(e){}}();
10
+ !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]="573d318a-5ebe-5547-8be7-16026a077c84")}catch(e){}}();
11
11
  import { normalizeUniqueStringList } from "./string-lists.js";
12
12
  import { RESERVED_EXTENSION_HOST_FLAGS } from "../../core/extensions/reserved-host-flags.js";
13
13
  import { PM_POSITIONAL_ACTION_CONTRACTS, } from "./grammar-contracts.js";
@@ -67,13 +67,16 @@ export function compactFlagAliasContracts(flagContracts) {
67
67
  /** Public contract for subcommand global flag contracts, shared by SDK and presentation-layer consumers. */
68
68
  export const SUBCOMMAND_GLOBAL_FLAG_CONTRACTS = RESERVED_EXTENSION_HOST_FLAGS.map((definition) => ({
69
69
  flag: definition.flag,
70
+ reservation_scope: "inherited",
70
71
  ...(definition.aliases ? { aliases: [...definition.aliases] } : {}),
71
72
  ...(definition.value_name ? { value_name: definition.value_name } : {}),
72
73
  }));
73
74
  /** Public contract for global flag contracts, shared by SDK and presentation-layer consumers. */
74
75
  export const GLOBAL_FLAG_CONTRACTS = [
75
76
  ...SUBCOMMAND_GLOBAL_FLAG_CONTRACTS,
76
- { flag: "--version" },
77
+ { flag: "--version", value_type: "boolean", reservation_scope: "root_only" },
78
+ { flag: "--all", value_type: "boolean", reservation_scope: "root_only", description: "Expand root help to every command." },
79
+ { flag: "--explain", value_type: "boolean", reservation_scope: "root_only", description: "Expand root help with command guidance." },
77
80
  ];
78
81
  /** Governance-missing (GH-236) + content-field presence/absence (GH-242) selection-filter flags shared verbatim by the `list` and `search` flag tables. Module-private on purpose — spread into both tables at the same position so the published contract order is unchanged. */
79
82
  const GOVERNANCE_AND_CONTENT_FILTER_FLAG_CONTRACTS = [
@@ -259,6 +262,10 @@ export const NOTES_FLAG_CONTRACTS = [
259
262
  export const LEARNINGS_FLAG_CONTRACTS = [
260
263
  { flag: "--id", value_name: "item-id" },
261
264
  { flag: "--add", aliases: ["--learning", "--text"] },
265
+ { flag: "--stdin" },
266
+ { flag: "--file" },
267
+ { flag: "--edit" },
268
+ { flag: "--delete" },
262
269
  { flag: "--limit" },
263
270
  { flag: "--full-history" },
264
271
  { flag: "--if-absent", value_type: "boolean" },
@@ -327,6 +334,9 @@ export const HISTORY_FLAG_CONTRACTS = [
327
334
  /** Public contract for merge flag contracts, shared by SDK and presentation-layer consumers. */
328
335
  export const MERGE_FLAG_CONTRACTS = [
329
336
  { flag: "--dry-run" },
337
+ { flag: "--message" },
338
+ { flag: "--force" },
339
+ { flag: "--include-reconciled" },
330
340
  { flag: "--output" },
331
341
  { flag: "--item-path" },
332
342
  { flag: "--prefer" },
@@ -348,6 +358,7 @@ export const HISTORY_REPAIR_FLAG_CONTRACTS = [
348
358
  { flag: "--all" },
349
359
  { flag: "--dry-run" },
350
360
  { flag: "--normalize-provenance" },
361
+ { flag: "--salvage-tail", value_type: "boolean" },
351
362
  { flag: "--author" },
352
363
  { flag: "--message" },
353
364
  { flag: "--force" },
@@ -545,6 +556,7 @@ export const INIT_FLAG_CONTRACTS = [
545
556
  ];
546
557
  /** Public contract for config flag contracts, shared by SDK and presentation-layer consumers. */
547
558
  export const CONFIG_FLAG_CONTRACTS = [
559
+ { flag: "--value", value_name: "value" },
548
560
  { flag: "--criterion" },
549
561
  { flag: "--clear-criteria" },
550
562
  { flag: "--format" },
@@ -781,6 +793,7 @@ export const CLOSE_MANY_FLAG_CONTRACTS = [
781
793
  export const APPEND_FLAG_CONTRACTS = [
782
794
  { flag: "--id", value_name: "item-id" },
783
795
  { flag: "--body", short: "-b" },
796
+ { flag: "--text" },
784
797
  { flag: "--author" },
785
798
  { flag: "--message" },
786
799
  { flag: "--force" },
@@ -802,6 +815,8 @@ export const CLAIM_FLAG_CONTRACTS = [
802
815
  { flag: "--release" },
803
816
  { flag: "--max-attempts" },
804
817
  { flag: "--include-decisions" },
818
+ { flag: "--include-gates" },
819
+ { flag: "--include-containers" },
805
820
  { flag: "--token-budget", aliases: ["--token_budget"] },
806
821
  { flag: "--explain-ranking", aliases: ["--explain_ranking"] },
807
822
  ];
@@ -880,6 +895,7 @@ export const REMIND_FLAG_CONTRACTS = [
880
895
  ];
881
896
  /** Public contract for test flag contracts, shared by SDK and presentation-layer consumers. */
882
897
  export const TEST_FLAG_CONTRACTS = [
898
+ { flag: "--list" },
883
899
  { flag: "--id", value_name: "item-id" },
884
900
  { flag: "--add" },
885
901
  { flag: "--add-json" },
@@ -969,6 +985,7 @@ export const STATS_FLAG_CONTRACTS = [
969
985
  ];
970
986
  /** Public contract for duplicate-cluster discovery flags. */
971
987
  export const DUPLICATES_FLAG_CONTRACTS = [
988
+ { flag: "--exhaustive", value_type: "boolean" },
972
989
  { flag: "--status", repeatable: true, list: true },
973
990
  { flag: "--since" },
974
991
  { flag: "--threshold" },
@@ -1282,6 +1299,12 @@ export const UPDATE_FLAG_CONTRACTS = [
1282
1299
  ];
1283
1300
  /** Public contract for update many flag contracts, shared by SDK and presentation-layer consumers. */
1284
1301
  export const UPDATE_MANY_FLAG_CONTRACTS = [
1302
+ { flag: "--status", short: "-s" },
1303
+ { flag: "--assignee" },
1304
+ { flag: "--parent" },
1305
+ { flag: "--blocked-by", aliases: ["--blocked_by"] },
1306
+ { flag: "--blocked-reason", aliases: ["--blocked_reason"] },
1307
+ { flag: "--unblock-note", aliases: ["--unblock_note"] },
1285
1308
  { flag: "--filter-status", list: true },
1286
1309
  { flag: "--filter-type", list: true },
1287
1310
  { flag: "--filter-tag", list: true },
@@ -1559,6 +1582,9 @@ export const WORKSPACE_FLAG_CONTRACTS = [
1559
1582
  export const WORKSPACE_POSITION_FLAG_CONTRACTS = [];
1560
1583
  /** Public contract for next flag contracts, shared by SDK and presentation-layer consumers. */
1561
1584
  export const NEXT_FLAG_CONTRACTS = [
1585
+ { flag: "--include-decisions" },
1586
+ { flag: "--include-gates" },
1587
+ { flag: "--include-containers" },
1562
1588
  { flag: "--for", value_name: "intent" },
1563
1589
  { flag: "--type" },
1564
1590
  { flag: "--tag" },
@@ -1694,7 +1720,6 @@ const FIXED_STATUS_LIST_COMMAND_ALIASES = [
1694
1720
  "list-canceled",
1695
1721
  ];
1696
1722
  const FIXED_STATUS_LIST_FLAG_CONTRACTS = LIST_FILTER_FLAG_CONTRACTS.filter((contract) => contract.flag !== "--status" && contract.flag !== "--all");
1697
- const ALL_STATUS_LIST_FLAG_CONTRACTS = LIST_FILTER_FLAG_CONTRACTS.filter((contract) => contract.flag !== "--status");
1698
1723
  function indexCliFlagContracts(contracts) {
1699
1724
  const index = new Map();
1700
1725
  for (const contract of contracts) {
@@ -1741,7 +1766,7 @@ export const PM_POSITIONAL_ACTION_FLAG_CONTRACTS = resolvePmPositionalActionFlag
1741
1766
  // member such as `constructor` or `toString`.
1742
1767
  const SUBCOMMAND_FLAG_CONTRACTS_BY_COMMAND = new Map([
1743
1768
  ["list", LIST_FILTER_FLAG_CONTRACTS],
1744
- ["list-all", ALL_STATUS_LIST_FLAG_CONTRACTS],
1769
+ ["list-all", LIST_FILTER_FLAG_CONTRACTS],
1745
1770
  ...FIXED_STATUS_LIST_COMMAND_ALIASES.map((command) => [
1746
1771
  command,
1747
1772
  FIXED_STATUS_LIST_FLAG_CONTRACTS,
@@ -1759,6 +1784,7 @@ const SUBCOMMAND_FLAG_CONTRACTS_BY_COMMAND = new Map([
1759
1784
  ["install", INSTALL_FLAG_CONTRACTS],
1760
1785
  ["upgrade", UPGRADE_FLAG_CONTRACTS],
1761
1786
  ["create", CREATE_FLAG_CONTRACTS],
1787
+ ["item", []],
1762
1788
  ["item mutate", ITEM_MUTATE_FLAG_CONTRACTS],
1763
1789
  ["item complete", ITEM_COMPLETE_FLAG_CONTRACTS],
1764
1790
  ["item reopen", ITEM_REOPEN_FLAG_CONTRACTS],
@@ -1919,4 +1945,4 @@ export function toCompletionFlagString(flagContracts, includeGlobal = true) {
1919
1945
  return normalizeUniqueStringList(all).join(" ");
1920
1946
  }
1921
1947
  //# sourceMappingURL=flag-contracts.js.map
1922
- //# debugId=789faf62-dfbf-56ff-9412-55adc5c12d3d
1948
+ //# debugId=573d318a-5ebe-5547-8be7-16026a077c84