@unbrained/pm-cli 2026.8.20 → 2026.8.22

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 (228) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +38 -0
  3. package/dist/cli/error-guidance.d.ts +29 -4
  4. package/dist/cli/error-guidance.js +43 -43
  5. package/dist/cli/main.d.ts +3 -0
  6. package/dist/cli/main.js +40 -7
  7. package/dist/cli-bundle/bundle-manifest.json +150 -150
  8. package/dist/cli-bundle/chunks/{chunk-L4LGPBJU.js → chunk-BWX4SK46.js} +58 -58
  9. package/dist/cli-bundle/chunks/chunk-EMWDM5FI.js +13 -0
  10. package/dist/cli-bundle/chunks/chunk-HYG6LRL4.js +200 -0
  11. package/dist/cli-bundle/chunks/{chunk-TSMWLCHS.js → chunk-MYYI3ZOA.js} +2 -2
  12. package/dist/cli-bundle/chunks/{chunk-4GB2LTOQ.js → chunk-MZTZQTMS.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-7BRF2BX2.js → chunk-QI2CT3IX.js} +2 -2
  14. package/dist/cli-bundle/chunks/chunk-SMWXHMVB.js +35 -0
  15. package/dist/cli-bundle/chunks/{chunk-US2ZQW2M.js → chunk-U6GQ4VMV.js} +47 -47
  16. package/dist/cli-bundle/chunks/{chunk-K3EN3LK2.js → chunk-VMMIL3SI.js} +2 -2
  17. package/dist/cli-bundle/chunks/chunk-WG4STC36.js +5 -0
  18. package/dist/cli-bundle/chunks/{chunk-XYDDWBZN.js → chunk-YBPJAOQQ.js} +3 -3
  19. package/dist/cli-bundle/chunks/{register-list-query-JSAQCVOC.js → register-list-query-HZKBQNWW.js} +2 -2
  20. package/dist/cli-bundle/chunks/{register-mutation-XJPAW63D.js → register-mutation-HTKEEGRD.js} +2 -2
  21. package/dist/cli-bundle/chunks/{register-operations-DSOSB2XQ.js → register-operations-6EMRWJJY.js} +2 -2
  22. package/dist/cli-bundle/chunks/{register-setup-QUR6QL2C.js → register-setup-QK4OTOXN.js} +2 -2
  23. package/dist/cli-bundle/focused-chunks/{chunk-TDR5OGG3.js → chunk-2ARQGDDW.js} +2 -2
  24. package/dist/cli-bundle/focused-chunks/{chunk-AZBACT5T.js → chunk-2AZT5WXZ.js} +2 -2
  25. package/dist/cli-bundle/focused-chunks/{chunk-M32HFIQB.js → chunk-2POVTNLY.js} +2 -2
  26. package/dist/cli-bundle/focused-chunks/chunk-3LKU6PTJ.js +4 -0
  27. package/dist/cli-bundle/focused-chunks/chunk-5SHSBMX2.js +2 -0
  28. package/dist/cli-bundle/focused-chunks/{chunk-UGSS4F5X.js → chunk-6S2MO3Q3.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/{chunk-5L7M4AI7.js → chunk-A2BC5PQL.js} +2 -2
  30. package/dist/cli-bundle/focused-chunks/chunk-C4S4A4JJ.js +5 -0
  31. package/dist/cli-bundle/focused-chunks/{chunk-OM65KHGF.js → chunk-D6RBZEJJ.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/chunk-E2EWYPY6.js +16 -0
  33. package/dist/cli-bundle/focused-chunks/{chunk-G3C5ERXG.js → chunk-GMYPD4FX.js} +2 -2
  34. package/dist/cli-bundle/focused-chunks/chunk-L5LDSRO2.js +155 -0
  35. package/dist/cli-bundle/focused-chunks/{chunk-BLJCGGID.js → chunk-MB37AYN6.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/chunk-MCOR37QK.js +2 -0
  37. package/dist/cli-bundle/focused-chunks/{chunk-FUREQLQN.js → chunk-PH2OXXVZ.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/{chunk-325UXIO7.js → chunk-PMGJUFNQ.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/chunk-R6SR45XU.js +50 -0
  40. package/dist/cli-bundle/focused-chunks/chunk-WZE4LIPW.js +8 -0
  41. package/dist/cli-bundle/main.js +13 -13
  42. package/dist/cli-bundle/sdk-authoring.js +1 -1
  43. package/dist/cli-bundle/sdk-contracts.js +2 -2
  44. package/dist/cli-bundle/sdk-core.js +40 -40
  45. package/dist/cli-bundle/sdk-governance.js +1 -1
  46. package/dist/cli-bundle/sdk-graph.js +1 -1
  47. package/dist/cli-bundle/sdk-merge.js +32 -32
  48. package/dist/cli-bundle/sdk-query.js +1 -1
  49. package/dist/cli-bundle/sdk-runtime.js +1 -1
  50. package/dist/cli-bundle/sdk-testing.js +1 -1
  51. package/dist/cli-bundle/sdk.js +5 -5
  52. package/dist/core/extensions/extension-hook-runtime.js +22 -20
  53. package/dist/core/extensions/extension-types.d.ts +8 -1
  54. package/dist/core/extensions/extension-types.js +2 -2
  55. package/dist/core/extensions/loader.js +7 -3
  56. package/dist/core/extensions/service-ownership.d.ts +8 -0
  57. package/dist/core/extensions/service-ownership.js +20 -0
  58. package/dist/core/item/id.js +20 -5
  59. package/dist/core/item/item-format.js +27 -2
  60. package/dist/core/shared/errors.d.ts +20 -0
  61. package/dist/core/shared/errors.js +2 -2
  62. package/dist/core/store/item-store.js +6 -91
  63. package/dist/core/store/tracker-preflight.d.ts +7 -0
  64. package/dist/core/store/tracker-preflight.js +142 -0
  65. package/dist/sdk/agent/refusal-reachability.d.ts +1 -1
  66. package/dist/sdk/agent/tracker-preflight-contracts.d.ts +63 -0
  67. package/dist/sdk/agent/tracker-preflight-contracts.js +127 -0
  68. package/dist/sdk/annotations.js +6 -7
  69. package/dist/sdk/authoring.d.ts +1 -1
  70. package/dist/sdk/authoring.js +2 -2
  71. package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +77 -0
  72. package/dist/sdk/cli-contracts/agent-output-contracts.js +324 -2
  73. package/dist/sdk/cli-contracts/commander-mutation-options.js +3 -3
  74. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +3 -1
  75. package/dist/sdk/cli-contracts/runtime-contracts.js +4 -3
  76. package/dist/sdk/cli-contracts.d.ts +1 -1
  77. package/dist/sdk/cli-contracts.js +3 -3
  78. package/dist/sdk/config.d.ts +5 -0
  79. package/dist/sdk/config.js +5 -5
  80. package/dist/sdk/context-intent-runtime.js +7 -4
  81. package/dist/sdk/contracts.d.ts +1 -0
  82. package/dist/sdk/contracts.js +3 -2
  83. package/dist/sdk/dependencies.js +5 -7
  84. package/dist/sdk/dependency-flag-validation.d.ts +1 -1
  85. package/dist/sdk/dependency-flag-validation.js +10 -4
  86. package/dist/sdk/environment/tracker-preflight.d.ts +6 -0
  87. package/dist/sdk/environment/tracker-preflight.js +10 -0
  88. package/dist/sdk/eval.js +5 -7
  89. package/dist/sdk/extension/install-sources.d.ts +1 -1
  90. package/dist/sdk/extension/install-sources.js +6 -3
  91. package/dist/sdk/extension/output-ownership.d.ts +1 -0
  92. package/dist/sdk/extension/output-ownership.js +3 -2
  93. package/dist/sdk/files.js +6 -10
  94. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +75 -15
  95. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +81 -8
  96. package/dist/sdk/governance/assurance.d.ts +36 -2
  97. package/dist/sdk/governance/assurance.js +184 -10
  98. package/dist/sdk/governance/gc.js +5 -6
  99. package/dist/sdk/governance/health.d.ts +3 -0
  100. package/dist/sdk/governance/health.js +42 -11
  101. package/dist/sdk/governance/hierarchy-validation.d.ts +29 -0
  102. package/dist/sdk/governance/hierarchy-validation.js +109 -0
  103. package/dist/sdk/governance/reindex.js +5 -6
  104. package/dist/sdk/governance/validate.d.ts +2 -9
  105. package/dist/sdk/governance/validate.js +51 -109
  106. package/dist/sdk/graph/assembly.d.ts +6 -1
  107. package/dist/sdk/graph/assembly.js +16 -22
  108. package/dist/sdk/graph/governance-contracts.d.ts +1 -1
  109. package/dist/sdk/graph/governance-contracts.js +8 -2
  110. package/dist/sdk/graph/governance.d.ts +7 -5
  111. package/dist/sdk/graph/governance.js +76 -16
  112. package/dist/sdk/graph/hierarchy-integrity.d.ts +94 -0
  113. package/dist/sdk/graph/hierarchy-integrity.js +311 -0
  114. package/dist/sdk/graph/index.d.ts +2 -1
  115. package/dist/sdk/graph/index.js +3 -2
  116. package/dist/sdk/graph/remediation.js +32 -2
  117. package/dist/sdk/graph/run.d.ts +31 -2
  118. package/dist/sdk/graph/run.js +83 -36
  119. package/dist/sdk/graph/traversal.js +14 -5
  120. package/dist/sdk/graph/workspace-relationship-kind-registry.d.ts +8 -0
  121. package/dist/sdk/graph/workspace-relationship-kind-registry.js +28 -0
  122. package/dist/sdk/history-compact.js +6 -9
  123. package/dist/sdk/history-read.js +5 -7
  124. package/dist/sdk/history-redact.js +5 -6
  125. package/dist/sdk/history-repair.js +6 -9
  126. package/dist/sdk/improvement-ledger.js +7 -10
  127. package/dist/sdk/index.d.ts +4 -2
  128. package/dist/sdk/index.js +5 -3
  129. package/dist/sdk/item-children.js +21 -8
  130. package/dist/sdk/lifecycle/append.d.ts +0 -5
  131. package/dist/sdk/lifecycle/append.js +5 -6
  132. package/dist/sdk/lifecycle/claim.d.ts +0 -5
  133. package/dist/sdk/lifecycle/claim.js +6 -9
  134. package/dist/sdk/lifecycle/close-many.d.ts +0 -5
  135. package/dist/sdk/lifecycle/close-many.js +5 -6
  136. package/dist/sdk/lifecycle/close.d.ts +0 -5
  137. package/dist/sdk/lifecycle/close.js +5 -6
  138. package/dist/sdk/lifecycle/copy.d.ts +0 -5
  139. package/dist/sdk/lifecycle/copy.js +5 -6
  140. package/dist/sdk/lifecycle/create.d.ts +0 -5
  141. package/dist/sdk/lifecycle/create.js +127 -102
  142. package/dist/sdk/lifecycle/delete.js +5 -6
  143. package/dist/sdk/lifecycle/focus.d.ts +0 -5
  144. package/dist/sdk/lifecycle/focus.js +5 -6
  145. package/dist/sdk/lifecycle/hierarchy-mutation-lock.d.ts +15 -0
  146. package/dist/sdk/lifecycle/hierarchy-mutation-lock.js +25 -0
  147. package/dist/sdk/lifecycle/plan.d.ts +0 -5
  148. package/dist/sdk/lifecycle/plan.js +5 -6
  149. package/dist/sdk/lifecycle/restore.js +5 -6
  150. package/dist/sdk/lifecycle/update-many.d.ts +0 -5
  151. package/dist/sdk/lifecycle/update-many.js +5 -6
  152. package/dist/sdk/lifecycle/update.d.ts +2 -5
  153. package/dist/sdk/lifecycle/update.js +211 -84
  154. package/dist/sdk/linked-artifacts.js +6 -7
  155. package/dist/sdk/merge/install.js +5 -6
  156. package/dist/sdk/mutation-events.js +5 -7
  157. package/dist/sdk/package-import-adapters.js +6 -8
  158. package/dist/sdk/profile.js +6 -7
  159. package/dist/sdk/query/activity.js +5 -6
  160. package/dist/sdk/query/calendar.js +5 -6
  161. package/dist/sdk/query/complete-list.d.ts +3 -3
  162. package/dist/sdk/query/complete-list.js +46 -3
  163. package/dist/sdk/query/get.d.ts +0 -5
  164. package/dist/sdk/query/get.js +5 -6
  165. package/dist/sdk/query/history.d.ts +0 -5
  166. package/dist/sdk/query/history.js +5 -6
  167. package/dist/sdk/query/list.d.ts +4 -3
  168. package/dist/sdk/query/list.js +92 -54
  169. package/dist/sdk/query/search.js +5 -7
  170. package/dist/sdk/read-output-contracts.d.ts +5 -1
  171. package/dist/sdk/read-output-contracts.js +87 -22
  172. package/dist/sdk/relationship-context.js +3 -4
  173. package/dist/sdk/relationship-kinds/contract.d.ts +8 -0
  174. package/dist/sdk/relationship-kinds/contract.js +13 -13
  175. package/dist/sdk/relationships.d.ts +1 -1
  176. package/dist/sdk/relationships.js +27 -2
  177. package/dist/sdk/runtime.d.ts +3 -2
  178. package/dist/sdk/runtime.js +3 -2
  179. package/dist/sdk/schema-migration.js +6 -7
  180. package/dist/sdk/schema.js +5 -6
  181. package/dist/sdk/stats.js +5 -8
  182. package/dist/sdk/templates.js +5 -6
  183. package/dist/sdk/test/batch.js +15 -9
  184. package/dist/sdk/test/execution.js +12 -5
  185. package/dist/sdk/test/runs.js +5 -7
  186. package/dist/types.d.ts +11 -0
  187. package/dist/types.js +2 -2
  188. package/docs/AGENT_UX_CONTRACTS.md +24 -1
  189. package/docs/COMMANDS.md +29 -14
  190. package/docs/DEPENDENCY_KIND_CONTRACT.md +40 -1
  191. package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +98 -0
  192. package/docs/EXTENSIONS.md +2 -1
  193. package/docs/README.md +1 -0
  194. package/docs/READ_OUTPUT_CONTRACTS.md +9 -2
  195. package/docs/RECURRENCE_RECOVERY_CONTRACTS.md +37 -0
  196. package/docs/RELATIONSHIP_GRAPH.md +97 -12
  197. package/docs/SDK_PRIMITIVE_INVENTORY.md +15 -1
  198. package/docs/TESTING.md +15 -0
  199. package/marketplace.json +2 -2
  200. package/package.json +1 -1
  201. package/packages/pm-beads/package.json +1 -1
  202. package/packages/pm-calendar/package.json +1 -1
  203. package/packages/pm-command-kit/package.json +1 -1
  204. package/packages/pm-digital-twin/package.json +1 -1
  205. package/packages/pm-governance-audit/package.json +1 -1
  206. package/packages/pm-guide-shell/package.json +1 -1
  207. package/packages/pm-kanban/package.json +1 -1
  208. package/packages/pm-lifecycle-hooks/package.json +1 -1
  209. package/packages/pm-linked-test-adapters/package.json +1 -1
  210. package/packages/pm-search-advanced/package.json +1 -1
  211. package/packages/pm-templates/package.json +1 -1
  212. package/packages/pm-todos/package.json +1 -1
  213. package/packages/pm-vcs/package.json +1 -1
  214. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  215. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  216. package/sdk/public-surface.json +848 -56
  217. package/dist/cli-bundle/chunks/chunk-2RDVGYWE.js +0 -13
  218. package/dist/cli-bundle/chunks/chunk-BLVQHFSY.js +0 -35
  219. package/dist/cli-bundle/chunks/chunk-CU25EQVV.js +0 -5
  220. package/dist/cli-bundle/chunks/chunk-RS3IV2R6.js +0 -197
  221. package/dist/cli-bundle/focused-chunks/chunk-6AHG2YW7.js +0 -50
  222. package/dist/cli-bundle/focused-chunks/chunk-GXWQBE3T.js +0 -8
  223. package/dist/cli-bundle/focused-chunks/chunk-JWKEDZJI.js +0 -4
  224. package/dist/cli-bundle/focused-chunks/chunk-KYZ6JGPL.js +0 -155
  225. package/dist/cli-bundle/focused-chunks/chunk-Q47EX4DI.js +0 -2
  226. package/dist/cli-bundle/focused-chunks/chunk-RIHDMCUM.js +0 -2
  227. package/dist/cli-bundle/focused-chunks/chunk-T4ZFY7ZJ.js +0 -16
  228. package/dist/cli-bundle/focused-chunks/chunk-Z3PLWSGM.js +0 -2
@@ -6,14 +6,14 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Official marketplace for pm CLI — native git-based project management for Claude Code and AI coding agents.",
9
- "version": "2026.8.20"
9
+ "version": "2026.8.22"
10
10
  },
11
11
  "plugins": [
12
12
  {
13
13
  "name": "pm-claude",
14
14
  "source": "./plugins/pm-claude",
15
15
  "description": "Native pm CLI integration for Claude Code — 28 MCP tools, 5 workflow skills, 14 slash commands, 4 subagents, hybrid TUI task tracking, session context injection, and coordination subagents for git-based project management without leaving Claude Code.",
16
- "version": "2026.8.20",
16
+ "version": "2026.8.22",
17
17
  "author": {
18
18
  "name": "unbrained",
19
19
  "url": "https://github.com/unbraind/pm-cli"
package/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # Changelog
2
2
 
3
+ ## 2026.8.22 - 2026-08-22
4
+
5
+ ### Fixed
6
+
7
+ - GH-1078: Complete-list certification accepts absent or contradictory truth receipts and emits stale recovery ([pm-gh1078](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1078.toon))
8
+ - GH-1076: read-only duplicates rejects universal JSON output controls ([pm-gh1076](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1076.toon))
9
+ - GH-1074: package doctor cannot distinguish a safe declining service override from a global interceptor ([pm-gh1074](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1074.toon))
10
+ - GH-1073: pm init accepts a whitespace id prefix that makes later creates fail ([pm-gh1073](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1073.toon))
11
+ - GH-1075: Windows Node 24 nightly validation failed at main 3e7ac007 ([pm-gh1075](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1075.toon))
12
+ - The child hierarchy kind has an unenforced direction and cardinality: 7 of 15 rows are inverted against the registry's own declaration and no channel, validator, or audit finding notices ([pm-vk7zek](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-vk7zek.toon))
13
+ - Hierarchy-canonicalizing dependency kinds bypass every cycle detector: mutual child_of edges leave the graph provably inconsistent while validate, health, and graph analyze all report acyclic ([pm-rggtvd](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-rggtvd.toon))
14
+
15
+ ### Security
16
+
17
+ - GH-1072: pm install leaks user allow-scripts config into isolated package installs ([pm-gh1072](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1072.toon))
18
+
19
+ ## 2026.8.21 - 2026-08-21
20
+
21
+ ### Added
22
+
23
+ - Prose-asserted relationships are unmeasured: 1,750 identifier pairs named in item text carry no edge in any direction, and nothing counts the gap ([pm-ob9z4y](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-ob9z4y.toon))
24
+
25
+ ### Changed
26
+
27
+ - Provide consistent tracker preflight and executable recovery across SDK, CLI, and MCP ([pm-6qiwan](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-6qiwan.toon))
28
+
29
+ ### Fixed
30
+
31
+ - The blocks ceiling counts fabricated and evidence-cited ordering edges identically, so the historical ordering reconstruction another item mandates cannot land ([pm-c90tfh](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-c90tfh.toon))
32
+ - The dependency remove flag accepts a value its own add flag refuses and reports success on a zero-match, so a mistyped graph repair exits 0 having changed nothing ([pm-gos426](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gos426.toon))
33
+ - All four graph traversal verbs reject the semantic edge kinds the ontology exists to express, so 'what implements this milestone' returns the ordering-kind answer with no sign a semantic one exists ([pm-3dyec2](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-3dyec2.toon))
34
+ - Typed-outcome reachability admits three of ten edge kinds, so the four semantic kinds the ontology exists to express contribute nothing to the invariant they were minted to satisfy ([pm-ayg31c](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-ayg31c.toon))
35
+ - The graph audit raises duplicate dependency rows at warning severity and the only remediation available deletes every copy, so collapsing a duplicate means briefly destroying a real edge ([pm-flnefm](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-flnefm.toon))
36
+
37
+ ### Other
38
+
39
+ - ADR: Ordering assurance partitions evidence-cited blocks from uncited blocks ([pm-jhpby4](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/decisions/pm-jhpby4.toon))
40
+
3
41
  ## 2026.8.20 - 2026-08-20
4
42
 
5
43
  ### Added
@@ -4,6 +4,7 @@
4
4
  * Provides CLI runtime support for Error Guidance.
5
5
  */
6
6
  import { type PmCliErrorContext, type PmCliErrorRecoveryPayload } from "../sdk/runtime-primitives.js";
7
+ import { type PmDiagnosticOutputReceipt, type PmProjectedDiagnostic } from "../sdk/cli-contracts/agent-output-contracts.js";
7
8
  interface GuidanceMessage {
8
9
  code: string;
9
10
  type: string;
@@ -14,6 +15,10 @@ interface GuidanceMessage {
14
15
  examples?: string[];
15
16
  nextSteps?: string[];
16
17
  verificationErrors?: string[];
18
+ flag?: string;
19
+ value?: string;
20
+ unmatchedSelectors?: NonNullable<PmCliErrorContext["unmatched_selectors"]>;
21
+ availableDependencies?: NonNullable<PmCliErrorContext["available_dependencies"]>;
17
22
  recovery?: PmCliErrorRecoveryPayload;
18
23
  }
19
24
  /** Documents the json error envelope payload exchanged by command, SDK, and package integrations. */
@@ -38,11 +43,23 @@ export interface JsonErrorEnvelope {
38
43
  next_steps?: string[];
39
44
  /** Exact integrity verifier findings that caused the operation to refuse. */
40
45
  verification_errors?: string[];
46
+ /** CLI flag whose supplied value violated a shared mutation grammar. */
47
+ flag?: string;
48
+ /** Supplied scalar value that violated a shared mutation grammar. */
49
+ value?: string;
50
+ /** Dependency selectors that matched no stored edge. */
51
+ unmatched_selectors?: NonNullable<PmCliErrorContext["unmatched_selectors"]>;
52
+ /** Compact stored dependency identities available when a removal failed. */
53
+ available_dependencies?: NonNullable<PmCliErrorContext["available_dependencies"]>;
41
54
  /** Value that configures or reports recovery for this contract. */
42
55
  recovery?: PmCliErrorRecoveryPayload;
56
+ /** Binding output-budget receipt for this diagnostic. */
57
+ diagnostic_output?: PmDiagnosticOutputReceipt;
43
58
  }
59
+ /** Error envelope after deterministic budget projection. */
60
+ export type ProjectedJsonErrorEnvelope = PmProjectedDiagnostic<JsonErrorEnvelope>;
44
61
  /** Compact an error envelope to fields that change the caller's next action. */
45
- export declare function projectLeanErrorEnvelope(envelope: JsonErrorEnvelope): Omit<JsonErrorEnvelope, "required" | "why" | "title">;
62
+ export declare function projectLeanErrorEnvelope(envelope: ProjectedJsonErrorEnvelope): ProjectedJsonErrorEnvelope;
46
63
  /** Documents the error classification payload exchanged by command, SDK, and package integrations. */
47
64
  export interface ErrorClassification {
48
65
  /** Schema type that determines the shape and validation rules for this value. */
@@ -63,6 +80,14 @@ export interface ErrorClassification {
63
80
  next_steps?: string[];
64
81
  /** Exact integrity verifier findings that caused the operation to refuse. */
65
82
  verification_errors?: string[];
83
+ /** CLI flag whose supplied value violated a shared mutation grammar. */
84
+ flag?: string;
85
+ /** Supplied scalar value that violated a shared mutation grammar. */
86
+ value?: string;
87
+ /** Dependency selectors that matched no stored edge. */
88
+ unmatched_selectors?: NonNullable<PmCliErrorContext["unmatched_selectors"]>;
89
+ /** Compact stored dependency identities available when a removal failed. */
90
+ available_dependencies?: NonNullable<PmCliErrorContext["available_dependencies"]>;
66
91
  /** Value that configures or reports recovery for this contract. */
67
92
  recovery?: PmCliErrorRecoveryPayload;
68
93
  }
@@ -129,15 +154,15 @@ export declare function formatPmCliErrorForDisplay(rawMessage: string, context?:
129
154
  /** Implements classify pm cli error for the public runtime surface of this module. */
130
155
  export declare function classifyPmCliError(rawMessage: string, context?: PmCliErrorContext): ErrorClassification;
131
156
  /** Implements format pm cli error for json for the public runtime surface of this module. */
132
- export declare function formatPmCliErrorForJson(rawMessage: string, exitCode: number, context?: PmCliErrorContext): JsonErrorEnvelope;
157
+ export declare function formatPmCliErrorForJson(rawMessage: string, exitCode: number, context?: PmCliErrorContext): ProjectedJsonErrorEnvelope;
133
158
  /** Implements format commander error for display for the public runtime surface of this module. */
134
159
  export declare function formatCommanderErrorForDisplay(rawMessage: string, commandName: string | undefined, allowedTypes: string, context?: CommanderGuidanceContext): string;
135
160
  /** Implements classify commander error for the public runtime surface of this module. */
136
161
  export declare function classifyCommanderError(rawMessage: string, commandName: string | undefined, allowedTypes: string, context?: CommanderGuidanceContext): ErrorClassification;
137
162
  /** Implements format commander error for json for the public runtime surface of this module. */
138
- export declare function formatCommanderErrorForJson(rawMessage: string, commandName: string | undefined, allowedTypes: string, exitCode: number, context?: CommanderGuidanceContext): JsonErrorEnvelope;
163
+ export declare function formatCommanderErrorForJson(rawMessage: string, commandName: string | undefined, allowedTypes: string, exitCode: number, context?: CommanderGuidanceContext): ProjectedJsonErrorEnvelope;
139
164
  /** Implements format unknown error for json for the public runtime surface of this module. */
140
- export declare function formatUnknownErrorForJson(rawMessage: string, exitCode: number): JsonErrorEnvelope;
165
+ export declare function formatUnknownErrorForJson(rawMessage: string, exitCode: number): ProjectedJsonErrorEnvelope;
141
166
  /** Implements classify unknown error for the public runtime surface of this module. */
142
167
  export declare function classifyUnknownError(rawMessage: string): ErrorClassification;
143
168
  /** Public contract for test only, shared by SDK and presentation-layer consumers. */
@@ -1,11 +1,12 @@
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]="367d9302-9e1e-5813-a913-e4e87f34d8b9")}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]="72da6986-67d5-5adf-8e63-4f654d9ec7dd")}catch(e){}}();
3
3
  import { resolveRecoveryCommandName } from "../sdk/agent/command-recovery.js";
4
+ import { projectPmDiagnosticOutput, projectPmDiagnosticText, } from "../sdk/cli-contracts/agent-output-contracts.js";
4
5
  import { renderPmCommand } from "./argv-utils.js";
5
6
  import { discoverNearbyPmRoot } from "../sdk/tracker-root-discovery.js";
6
7
  /** Compact an error envelope to fields that change the caller's next action. */
7
8
  export function projectLeanErrorEnvelope(envelope) {
8
- const { required: _required, why: _why, title: _title, ...actionable } = envelope;
9
+ const { why: _why, title: _title, ...actionable } = envelope;
9
10
  return actionable;
10
11
  }
11
12
  // JSON/classification payloads are consumed heavily by agents; suppress common
@@ -249,12 +250,14 @@ export function renderGuidanceMessage(message) {
249
250
  const lines = [
250
251
  `Error: ${message.title}`,
251
252
  "",
252
- "What happened:",
253
- ` ${message.happened}`,
254
- "",
255
253
  "What is required:",
256
254
  ` ${message.required}`,
257
255
  ];
256
+ if (message.nextSteps && message.nextSteps.length > 0) {
257
+ lines.push("");
258
+ lines.push(...renderList("Next steps:", message.nextSteps));
259
+ }
260
+ lines.push("", "What happened:", ` ${message.happened}`);
258
261
  if (message.why) {
259
262
  lines.push("", "Why:");
260
263
  lines.push(` ${message.why}`);
@@ -263,10 +266,6 @@ export function renderGuidanceMessage(message) {
263
266
  lines.push("");
264
267
  lines.push(...renderList("Examples:", message.examples));
265
268
  }
266
- if (message.nextSteps && message.nextSteps.length > 0) {
267
- lines.push("");
268
- lines.push(...renderList("Next steps:", message.nextSteps));
269
- }
270
269
  if (message.verificationErrors && message.verificationErrors.length > 0) {
271
270
  lines.push("");
272
271
  lines.push(...renderList("Verification errors:", message.verificationErrors));
@@ -278,15 +277,8 @@ export function renderGuidanceMessage(message) {
278
277
  }
279
278
  return lines.join("\n");
280
279
  }
281
- function guidanceToJsonEnvelope(message, exitCode) {
282
- const payload = {
283
- type: message.type,
284
- code: message.code,
285
- title: message.title,
286
- detail: message.happened,
287
- required: message.required,
288
- exit_code: exitCode,
289
- };
280
+ /** Attach optional actionable fields shared by JSON and classification envelopes. */
281
+ function attachStructuredGuidanceDetails(payload, message) {
290
282
  if (includeWhyInStructuredGuidance(message)) {
291
283
  payload.why = message.why;
292
284
  }
@@ -299,35 +291,37 @@ function guidanceToJsonEnvelope(message, exitCode) {
299
291
  if (message.verificationErrors && message.verificationErrors.length > 0) {
300
292
  payload.verification_errors = message.verificationErrors;
301
293
  }
294
+ if (message.flag !== undefined)
295
+ payload.flag = message.flag;
296
+ if (message.value !== undefined)
297
+ payload.value = message.value;
298
+ if (message.unmatchedSelectors !== undefined)
299
+ payload.unmatched_selectors = message.unmatchedSelectors;
300
+ if (message.availableDependencies !== undefined)
301
+ payload.available_dependencies = message.availableDependencies;
302
302
  if (message.recovery) {
303
303
  payload.recovery = message.recovery;
304
304
  }
305
305
  return payload;
306
306
  }
307
+ function guidanceToJsonEnvelope(message, exitCode) {
308
+ return attachStructuredGuidanceDetails({
309
+ type: message.type,
310
+ code: message.code,
311
+ title: message.title,
312
+ detail: message.happened,
313
+ required: message.required,
314
+ exit_code: exitCode,
315
+ }, message);
316
+ }
307
317
  function guidanceToClassification(message) {
308
- const payload = {
318
+ return attachStructuredGuidanceDetails({
309
319
  type: message.type,
310
320
  code: message.code,
311
321
  title: message.title,
312
322
  detail: message.happened,
313
323
  required: message.required,
314
- };
315
- if (includeWhyInStructuredGuidance(message)) {
316
- payload.why = message.why;
317
- }
318
- if (message.examples && message.examples.length > 0) {
319
- payload.examples = message.examples;
320
- }
321
- if (message.nextSteps && message.nextSteps.length > 0) {
322
- payload.next_steps = message.nextSteps;
323
- }
324
- if (message.verificationErrors && message.verificationErrors.length > 0) {
325
- payload.verification_errors = message.verificationErrors;
326
- }
327
- if (message.recovery) {
328
- payload.recovery = message.recovery;
329
- }
330
- return payload;
324
+ }, message);
331
325
  }
332
326
  function normalizeMessage(message) {
333
327
  return message.replace(/\(outputHelp\)/g, "").trim();
@@ -435,11 +429,15 @@ function applyPmCliErrorContext(guidance, rawMessage, context) {
435
429
  examples,
436
430
  nextSteps,
437
431
  verificationErrors,
432
+ flag: context.flag,
433
+ value: context.value,
434
+ unmatchedSelectors: context.unmatched_selectors,
435
+ availableDependencies: context.available_dependencies,
438
436
  recovery,
439
437
  };
440
438
  }
441
439
  function buildTrackerNotInitializedGuidance(rawMessage, message, context) {
442
- const trackerNotInitialized = message.match(/^Tracker is not initialized at (.+)\. Run pm init first\.$/);
440
+ const trackerNotInitialized = message.match(/^Tracker is not initialized at (.+)\. (?:Run pm init first|Tracker root does not exist\. Run pm init first)\.$/);
443
441
  if (!trackerNotInitialized) {
444
442
  return null;
445
443
  }
@@ -1165,7 +1163,8 @@ function buildCommanderErrorGuidance(rawMessage, commandName, allowedTypes, cont
1165
1163
  }
1166
1164
  /** Implements format pm cli error for display for the public runtime surface of this module. */
1167
1165
  export function formatPmCliErrorForDisplay(rawMessage, context) {
1168
- return renderGuidanceMessage(buildPmCliErrorGuidance(rawMessage, context));
1166
+ const guidance = buildPmCliErrorGuidance(rawMessage, context);
1167
+ return projectPmDiagnosticText(renderGuidanceMessage(guidance), guidance.required).output;
1169
1168
  }
1170
1169
  /** Implements classify pm cli error for the public runtime surface of this module. */
1171
1170
  export function classifyPmCliError(rawMessage, context) {
@@ -1173,11 +1172,12 @@ export function classifyPmCliError(rawMessage, context) {
1173
1172
  }
1174
1173
  /** Implements format pm cli error for json for the public runtime surface of this module. */
1175
1174
  export function formatPmCliErrorForJson(rawMessage, exitCode, context) {
1176
- return guidanceToJsonEnvelope(buildPmCliErrorGuidance(rawMessage, context), exitCode);
1175
+ return projectPmDiagnosticOutput(guidanceToJsonEnvelope(buildPmCliErrorGuidance(rawMessage, context), exitCode));
1177
1176
  }
1178
1177
  /** Implements format commander error for display for the public runtime surface of this module. */
1179
1178
  export function formatCommanderErrorForDisplay(rawMessage, commandName, allowedTypes, context) {
1180
- return renderGuidanceMessage(buildCommanderErrorGuidance(rawMessage, commandName, allowedTypes, context));
1179
+ const guidance = buildCommanderErrorGuidance(rawMessage, commandName, allowedTypes, context);
1180
+ return projectPmDiagnosticText(renderGuidanceMessage(guidance), guidance.required).output;
1181
1181
  }
1182
1182
  /** Implements classify commander error for the public runtime surface of this module. */
1183
1183
  export function classifyCommanderError(rawMessage, commandName, allowedTypes, context) {
@@ -1185,12 +1185,12 @@ export function classifyCommanderError(rawMessage, commandName, allowedTypes, co
1185
1185
  }
1186
1186
  /** Implements format commander error for json for the public runtime surface of this module. */
1187
1187
  export function formatCommanderErrorForJson(rawMessage, commandName, allowedTypes, exitCode, context) {
1188
- return guidanceToJsonEnvelope(buildCommanderErrorGuidance(rawMessage, commandName, allowedTypes, context), exitCode);
1188
+ return projectPmDiagnosticOutput(guidanceToJsonEnvelope(buildCommanderErrorGuidance(rawMessage, commandName, allowedTypes, context), exitCode));
1189
1189
  }
1190
1190
  /** Implements format unknown error for json for the public runtime surface of this module. */
1191
1191
  export function formatUnknownErrorForJson(rawMessage, exitCode) {
1192
1192
  const guidance = buildUnknownErrorGuidance(rawMessage);
1193
- return guidanceToJsonEnvelope(guidance, exitCode);
1193
+ return projectPmDiagnosticOutput(guidanceToJsonEnvelope(guidance, exitCode));
1194
1194
  }
1195
1195
  function buildUnknownErrorGuidance(rawMessage) {
1196
1196
  const message = normalizeMessage(rawMessage);
@@ -1241,4 +1241,4 @@ export const _testOnly = {
1241
1241
  resolveKnownPackageCommandHint,
1242
1242
  };
1243
1243
  //# sourceMappingURL=error-guidance.js.map
1244
- //# debugId=367d9302-9e1e-5813-a913-e4e87f34d8b9
1244
+ //# debugId=72da6986-67d5-5adf-8e63-4f654d9ec7dd
@@ -11,6 +11,8 @@ import { type ExtensionCommandHelpDescriptor } from "./extension-command-help.js
11
11
  import { normalizeBootstrapInvocation } from "./bootstrap-args.js";
12
12
  import { type MandatoryMigrationBlocker } from "./migration-gates.js";
13
13
  import { resolveUnknownCommanderToken } from "./commander-usage.js";
14
+ /** Record the exact compatibility flags present in the raw CLI invocation. */
15
+ declare function recordCliReadOutputInvocationProvenance(actionCommand: Command, commandPath: string, commandOptions: Record<string, unknown>): void;
14
16
  declare function setActiveExtensionHookContextForTest(context: ActiveExtensionHookContext<MandatoryMigrationBlocker> | null): void;
15
17
  declare function setActiveRuntimeExtensionCommandDescriptorsForTest(descriptors: Map<string, ExtensionCommandHelpDescriptor>): void;
16
18
  interface RuntimeExtensionSnapshot {
@@ -292,6 +294,7 @@ export declare const _testOnly: {
292
294
  readRecordBoolean: typeof readRecordBoolean;
293
295
  readRecordNumber: typeof readRecordNumber;
294
296
  readRecordString: typeof readRecordString;
297
+ recordCliReadOutputInvocationProvenance: typeof recordCliReadOutputInvocationProvenance;
295
298
  registerDynamicExtensionCommandPaths: typeof registerDynamicExtensionCommandPaths;
296
299
  registerRuntimeSchemaFieldFlags: typeof registerRuntimeSchemaFieldFlags;
297
300
  resolveCoreCommandRegistrationSelection: typeof resolveCoreCommandRegistrationSelection;
package/dist/cli/main.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * @module cli/main
4
4
  */
5
5
 
6
- !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]="27eeca2d-756c-539b-a0d4-d64516ee4aa6")}catch(e){}}();
6
+ !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]="5a349bce-a08d-5ff6-870a-3ec38843b512")}catch(e){}}();
7
7
  import { Command } from "commander";
8
8
  import { activateExtensions, clearActiveExtensionHooks, createCoreCommandHookContext, resetActiveExtensionRuntimeState, createEmptyExtensionRegistrationRegistry, discoverExtensions, getActiveCommandResult, getActiveExtensionRegistrations, loadExtensions, consumeAfterCommandAffectedItems, runActiveCommandHandler, runActiveParserOverride, runActivePreflightOverride, runAfterCommandHooks, runBeforeCommandHooks, setActiveCommandResult, setActiveCommandContext, setActiveExtensionCommands, setActiveExtensionHooks, setActiveExtensionParsers, setActiveExtensionPreflight, setActiveExtensionRegistrations, setActiveExtensionRenderers, setActiveExtensionServices, pathExists, resolvePmCliVersion, resolvePmPackageRootFromModule, resolveItemTypeRegistry, resolveRuntimeFieldRegistry, EXIT_CODE, resolveTelemetryErrorCategory, PmCliError, asRecordOrNull, printError, printResult, maybeRunFirstUseTelemetryPrompt, emitTelemetryErrorEvent, startTelemetryCommand, deriveTelemetryCommandResolution, sentryCaptureCliError, sentryFinishCommandSpan, sentryFlush, sentryLogCliUsageError, sentrySetCommandContext, sentryStartCommandSpan, ensureSentryInit, getSettingsPath, resolvePmRoot, readSettings, readSettingsWithMetadata, runWithWorkspaceHarnessSignalDescriptors, createLazyModule, } from "../sdk/runtime-primitives.js";
9
9
  import { resolveSubcommandFlagContractsForCommand } from "../sdk/cli-contracts.js";
@@ -27,10 +27,38 @@ import { loadExtensionRecoveryFailures, loadUnknownCommandRecoveryFailures } fro
27
27
  import { maybeRenderBootstrapJsonHelp, attachCreateUpdatePolicyHelpText } from "./help-json-payload.js";
28
28
  import { attachOutputTokenAccounting } from "../sdk/output-token-accounting.js";
29
29
  import { runWithDiscoveredContextIntentContracts } from "../sdk/context-intent-runtime.js";
30
- import { applyReadOutputIncludeModes, validateReadOutputOptions } from "../sdk/read-output-contracts.js";
30
+ import { PM_READ_OUTPUT_SURFACE_CONTRACTS, applyReadOutputIncludeModes, readOutputIncludeModeOptions, resolveReadOutputSurface, validateReadOutputOptions, } from "../sdk/read-output-contracts.js";
31
31
  import { loadContextIntentSnapshotForInvocation } from "./context-intent-invocation.js";
32
32
  import { isPmSuccessfulExitCode } from "../sdk/cli-contracts/command-exit-contracts.js";
33
33
  const PM_PACKAGE_ROOT_ENV = "PM_CLI_PACKAGE_ROOT";
34
+ const READ_OUTPUT_INVOCATION_PROVENANCE = Symbol.for("pm.readOutputInvocationProvenance");
35
+ /** Carry private read-output provenance across Commander's option rebuilds. */
36
+ function copyReadOutputInvocationProvenance(source, target) {
37
+ const provenance = Reflect.get(source, READ_OUTPUT_INVOCATION_PROVENANCE);
38
+ if (provenance !== undefined) {
39
+ Reflect.set(target, READ_OUTPUT_INVOCATION_PROVENANCE, provenance);
40
+ }
41
+ }
42
+ /** Record the exact compatibility flags present in the raw CLI invocation. */
43
+ function recordCliReadOutputInvocationProvenance(actionCommand, commandPath, commandOptions) {
44
+ const surface = resolveReadOutputSurface(commandPath, commandOptions);
45
+ if (!surface)
46
+ return;
47
+ let rootCommand = actionCommand;
48
+ while (rootCommand.parent)
49
+ rootCommand = rootCommand.parent;
50
+ const rawArgs = rootCommand.rawArgs;
51
+ const providedFlags = new Set(extractProvidedOptionFlags(rawArgs.slice(2)));
52
+ const contract = PM_READ_OUTPUT_SURFACE_CONTRACTS.find((candidate) => candidate.command === surface);
53
+ const explicitLegacyAliases = Object.values(contract.dimensions).flatMap((dimension) => dimension.legacy_aliases.flatMap((alias) => providedFlags.has(alias.flag) ? [alias.flag] : []));
54
+ const previous = Reflect.get(commandOptions, READ_OUTPUT_INVOCATION_PROVENANCE);
55
+ Reflect.set(commandOptions, READ_OUTPUT_INVOCATION_PROVENANCE, {
56
+ canonical_include_modes: previous?.canonical_include_modes ?? [],
57
+ explicit_legacy_aliases: explicitLegacyAliases,
58
+ cli_invocation_observed: true,
59
+ });
60
+ copyReadOutputInvocationProvenance(commandOptions, actionCommand);
61
+ }
34
62
  function resolvePmPackageRoot() {
35
63
  return resolvePmPackageRootFromModule(import.meta.url, ["../.."]);
36
64
  }
@@ -512,15 +540,18 @@ async function handleGenericRunPmCliError(params) {
512
540
  * command computes its rows, so it cannot be resolved by the output layer.
513
541
  */
514
542
  function forwardReadOutputIncludeModes(actionCommand, commandPath, globalOptions, commandOptions) {
543
+ recordCliReadOutputInvocationProvenance(actionCommand, commandPath, commandOptions);
515
544
  const requested = globalOptions.outputInclude;
516
545
  if (requested === undefined)
517
546
  return;
518
- const modeOptions = {};
519
- const { selectors, modes } = applyReadOutputIncludeModes(commandPath, requested, modeOptions);
547
+ const { selectors, modes } = applyReadOutputIncludeModes(commandPath, requested, commandOptions);
520
548
  if (modes.length === 0)
521
549
  return;
522
- for (const [key, value] of Object.entries(modeOptions)) {
523
- commandOptions[key] = value;
550
+ copyReadOutputInvocationProvenance(commandOptions, actionCommand);
551
+ const modeOptions = readOutputIncludeModeOptions(commandPath);
552
+ for (const mode of modes) {
553
+ const key = modeOptions.get(mode);
554
+ const value = commandOptions[key];
524
555
  actionCommand.setOptionValueWithSource(key, value, "cli");
525
556
  }
526
557
  const residual = selectors.length > 0 ? selectors.join(",") : undefined;
@@ -540,6 +571,7 @@ function forwardReadOutputIncludeModes(actionCommand, commandPath, globalOptions
540
571
  function extractCommandScopedOptions(command, commandArgs, extensionFlagDefinitions = []) {
541
572
  const allOptions = command.optsWithGlobals();
542
573
  const scoped = { ...allOptions };
574
+ copyReadOutputInvocationProvenance(command, scoped);
543
575
  delete scoped.json;
544
576
  delete scoped.quiet;
545
577
  delete scoped.path;
@@ -2493,6 +2525,7 @@ export const _testOnly = {
2493
2525
  readRecordBoolean,
2494
2526
  readRecordNumber,
2495
2527
  readRecordString,
2528
+ recordCliReadOutputInvocationProvenance,
2496
2529
  registerDynamicExtensionCommandPaths,
2497
2530
  registerRuntimeSchemaFieldFlags,
2498
2531
  resolveCoreCommandRegistrationSelection,
@@ -2516,4 +2549,4 @@ export const _testOnly = {
2516
2549
  wrapThrownErrorForSentry,
2517
2550
  };
2518
2551
  //# sourceMappingURL=main.js.map
2519
- //# debugId=27eeca2d-756c-539b-a0d4-d64516ee4aa6
2552
+ //# debugId=5a349bce-a08d-5ff6-870a-3ec38843b512