@unbrained/pm-cli 2026.8.21 → 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 (158) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +16 -0
  3. package/dist/cli/error-guidance.d.ts +9 -4
  4. package/dist/cli/error-guidance.js +16 -15
  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 +153 -153
  8. package/dist/cli-bundle/chunks/{chunk-BKYB45NQ.js → chunk-BWX4SK46.js} +48 -48
  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-LARJJ3RK.js → chunk-MYYI3ZOA.js} +2 -2
  12. package/dist/cli-bundle/chunks/{chunk-BUNIEJNE.js → chunk-MZTZQTMS.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-LOVTQ52Z.js → chunk-QI2CT3IX.js} +2 -2
  14. package/dist/cli-bundle/chunks/chunk-SMWXHMVB.js +35 -0
  15. package/dist/cli-bundle/chunks/{chunk-N3DSV4CH.js → chunk-U6GQ4VMV.js} +6 -6
  16. package/dist/cli-bundle/chunks/{chunk-3AFAUHUE.js → chunk-VMMIL3SI.js} +2 -2
  17. package/dist/cli-bundle/chunks/chunk-WG4STC36.js +5 -0
  18. package/dist/cli-bundle/chunks/{chunk-JSLOFXGA.js → chunk-YBPJAOQQ.js} +2 -2
  19. package/dist/cli-bundle/chunks/{register-list-query-F57EWDEF.js → register-list-query-HZKBQNWW.js} +2 -2
  20. package/dist/cli-bundle/chunks/{register-mutation-7IY2D5KO.js → register-mutation-HTKEEGRD.js} +2 -2
  21. package/dist/cli-bundle/chunks/{register-operations-FALL3YTU.js → register-operations-6EMRWJJY.js} +2 -2
  22. package/dist/cli-bundle/chunks/{register-setup-HXU7IZZD.js → register-setup-QK4OTOXN.js} +2 -2
  23. package/dist/cli-bundle/focused-chunks/{chunk-FJ22HNRP.js → chunk-2ARQGDDW.js} +2 -2
  24. package/dist/cli-bundle/focused-chunks/{chunk-CKKQSJNN.js → chunk-2AZT5WXZ.js} +2 -2
  25. package/dist/cli-bundle/focused-chunks/{chunk-F4YEW5I2.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-FH6DYED3.js → chunk-6S2MO3Q3.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/{chunk-UZE7XUZK.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-KDNG7TKQ.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-4ERLO7QD.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-ZOSEELYJ.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-2NIY5NKG.js → chunk-PH2OXXVZ.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/{chunk-YKBKIEAJ.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 +4 -0
  61. package/dist/core/shared/errors.js +2 -2
  62. package/dist/sdk/agent/refusal-reachability.d.ts +1 -1
  63. package/dist/sdk/authoring.d.ts +1 -1
  64. package/dist/sdk/authoring.js +2 -2
  65. package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +77 -0
  66. package/dist/sdk/cli-contracts/agent-output-contracts.js +324 -2
  67. package/dist/sdk/cli-contracts/commander-mutation-options.js +3 -3
  68. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +3 -1
  69. package/dist/sdk/cli-contracts/runtime-contracts.js +4 -3
  70. package/dist/sdk/cli-contracts.d.ts +1 -1
  71. package/dist/sdk/cli-contracts.js +3 -3
  72. package/dist/sdk/extension/install-sources.d.ts +1 -1
  73. package/dist/sdk/extension/install-sources.js +6 -3
  74. package/dist/sdk/extension/output-ownership.d.ts +1 -0
  75. package/dist/sdk/extension/output-ownership.js +3 -2
  76. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +38 -14
  77. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +14 -2
  78. package/dist/sdk/governance/health.d.ts +3 -0
  79. package/dist/sdk/governance/health.js +39 -7
  80. package/dist/sdk/governance/hierarchy-validation.d.ts +29 -0
  81. package/dist/sdk/governance/hierarchy-validation.js +109 -0
  82. package/dist/sdk/governance/validate.d.ts +1 -7
  83. package/dist/sdk/governance/validate.js +47 -99
  84. package/dist/sdk/graph/assembly.d.ts +6 -1
  85. package/dist/sdk/graph/assembly.js +16 -22
  86. package/dist/sdk/graph/governance-contracts.d.ts +1 -1
  87. package/dist/sdk/graph/governance-contracts.js +8 -2
  88. package/dist/sdk/graph/governance.js +46 -2
  89. package/dist/sdk/graph/hierarchy-integrity.d.ts +94 -0
  90. package/dist/sdk/graph/hierarchy-integrity.js +311 -0
  91. package/dist/sdk/graph/index.d.ts +2 -1
  92. package/dist/sdk/graph/index.js +3 -2
  93. package/dist/sdk/graph/remediation.js +32 -2
  94. package/dist/sdk/graph/run.d.ts +31 -2
  95. package/dist/sdk/graph/run.js +80 -31
  96. package/dist/sdk/graph/workspace-relationship-kind-registry.d.ts +8 -0
  97. package/dist/sdk/graph/workspace-relationship-kind-registry.js +28 -0
  98. package/dist/sdk/index.d.ts +2 -2
  99. package/dist/sdk/index.js +3 -3
  100. package/dist/sdk/item-children.js +21 -8
  101. package/dist/sdk/lifecycle/create.js +125 -96
  102. package/dist/sdk/lifecycle/hierarchy-mutation-lock.d.ts +15 -0
  103. package/dist/sdk/lifecycle/hierarchy-mutation-lock.js +25 -0
  104. package/dist/sdk/lifecycle/update.d.ts +2 -0
  105. package/dist/sdk/lifecycle/update.js +171 -83
  106. package/dist/sdk/query/complete-list.d.ts +3 -3
  107. package/dist/sdk/query/complete-list.js +46 -3
  108. package/dist/sdk/query/list.d.ts +4 -3
  109. package/dist/sdk/query/list.js +89 -49
  110. package/dist/sdk/read-output-contracts.d.ts +5 -1
  111. package/dist/sdk/read-output-contracts.js +87 -22
  112. package/dist/sdk/relationship-context.js +3 -4
  113. package/dist/sdk/relationships.js +17 -10
  114. package/dist/sdk/runtime.d.ts +3 -2
  115. package/dist/sdk/runtime.js +3 -2
  116. package/dist/sdk/test/batch.js +13 -5
  117. package/dist/sdk/test/execution.js +10 -2
  118. package/dist/types.d.ts +11 -0
  119. package/dist/types.js +2 -2
  120. package/docs/AGENT_UX_CONTRACTS.md +20 -4
  121. package/docs/COMMANDS.md +29 -14
  122. package/docs/DEPENDENCY_KIND_CONTRACT.md +31 -3
  123. package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +98 -0
  124. package/docs/EXTENSIONS.md +2 -1
  125. package/docs/README.md +1 -0
  126. package/docs/READ_OUTPUT_CONTRACTS.md +9 -2
  127. package/docs/RELATIONSHIP_GRAPH.md +6 -3
  128. package/docs/TESTING.md +15 -0
  129. package/marketplace.json +2 -2
  130. package/package.json +1 -1
  131. package/packages/pm-beads/package.json +1 -1
  132. package/packages/pm-calendar/package.json +1 -1
  133. package/packages/pm-command-kit/package.json +1 -1
  134. package/packages/pm-digital-twin/package.json +1 -1
  135. package/packages/pm-governance-audit/package.json +1 -1
  136. package/packages/pm-guide-shell/package.json +1 -1
  137. package/packages/pm-kanban/package.json +1 -1
  138. package/packages/pm-lifecycle-hooks/package.json +1 -1
  139. package/packages/pm-linked-test-adapters/package.json +1 -1
  140. package/packages/pm-search-advanced/package.json +1 -1
  141. package/packages/pm-templates/package.json +1 -1
  142. package/packages/pm-todos/package.json +1 -1
  143. package/packages/pm-vcs/package.json +1 -1
  144. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  145. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  146. package/sdk/public-surface.json +593 -35
  147. package/dist/cli-bundle/chunks/chunk-2MA6ZQVZ.js +0 -197
  148. package/dist/cli-bundle/chunks/chunk-7VHZS727.js +0 -5
  149. package/dist/cli-bundle/chunks/chunk-OCLPLFAY.js +0 -35
  150. package/dist/cli-bundle/chunks/chunk-S4IRYKBU.js +0 -13
  151. package/dist/cli-bundle/focused-chunks/chunk-7WZRLCYF.js +0 -50
  152. package/dist/cli-bundle/focused-chunks/chunk-EEFKYMDR.js +0 -16
  153. package/dist/cli-bundle/focused-chunks/chunk-F2A56DHV.js +0 -8
  154. package/dist/cli-bundle/focused-chunks/chunk-FV5ACOK7.js +0 -2
  155. package/dist/cli-bundle/focused-chunks/chunk-JEAVFOWM.js +0 -2
  156. package/dist/cli-bundle/focused-chunks/chunk-NJ63LOP6.js +0 -155
  157. package/dist/cli-bundle/focused-chunks/chunk-NXRTQ7HI.js +0 -2
  158. package/dist/cli-bundle/focused-chunks/chunk-TJ7EMJ46.js +0 -4
@@ -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.21"
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.21",
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,21 @@
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
+
3
19
  ## 2026.8.21 - 2026-08-21
4
20
 
5
21
  ### 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;
@@ -52,9 +53,13 @@ export interface JsonErrorEnvelope {
52
53
  available_dependencies?: NonNullable<PmCliErrorContext["available_dependencies"]>;
53
54
  /** Value that configures or reports recovery for this contract. */
54
55
  recovery?: PmCliErrorRecoveryPayload;
56
+ /** Binding output-budget receipt for this diagnostic. */
57
+ diagnostic_output?: PmDiagnosticOutputReceipt;
55
58
  }
59
+ /** Error envelope after deterministic budget projection. */
60
+ export type ProjectedJsonErrorEnvelope = PmProjectedDiagnostic<JsonErrorEnvelope>;
56
61
  /** Compact an error envelope to fields that change the caller's next action. */
57
- export declare function projectLeanErrorEnvelope(envelope: JsonErrorEnvelope): Omit<JsonErrorEnvelope, "required" | "why" | "title">;
62
+ export declare function projectLeanErrorEnvelope(envelope: ProjectedJsonErrorEnvelope): ProjectedJsonErrorEnvelope;
58
63
  /** Documents the error classification payload exchanged by command, SDK, and package integrations. */
59
64
  export interface ErrorClassification {
60
65
  /** Schema type that determines the shape and validation rules for this value. */
@@ -149,15 +154,15 @@ export declare function formatPmCliErrorForDisplay(rawMessage: string, context?:
149
154
  /** Implements classify pm cli error for the public runtime surface of this module. */
150
155
  export declare function classifyPmCliError(rawMessage: string, context?: PmCliErrorContext): ErrorClassification;
151
156
  /** Implements format pm cli error for json for the public runtime surface of this module. */
152
- export declare function formatPmCliErrorForJson(rawMessage: string, exitCode: number, context?: PmCliErrorContext): JsonErrorEnvelope;
157
+ export declare function formatPmCliErrorForJson(rawMessage: string, exitCode: number, context?: PmCliErrorContext): ProjectedJsonErrorEnvelope;
153
158
  /** Implements format commander error for display for the public runtime surface of this module. */
154
159
  export declare function formatCommanderErrorForDisplay(rawMessage: string, commandName: string | undefined, allowedTypes: string, context?: CommanderGuidanceContext): string;
155
160
  /** Implements classify commander error for the public runtime surface of this module. */
156
161
  export declare function classifyCommanderError(rawMessage: string, commandName: string | undefined, allowedTypes: string, context?: CommanderGuidanceContext): ErrorClassification;
157
162
  /** Implements format commander error for json for the public runtime surface of this module. */
158
- 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;
159
164
  /** Implements format unknown error for json for the public runtime surface of this module. */
160
- export declare function formatUnknownErrorForJson(rawMessage: string, exitCode: number): JsonErrorEnvelope;
165
+ export declare function formatUnknownErrorForJson(rawMessage: string, exitCode: number): ProjectedJsonErrorEnvelope;
161
166
  /** Implements classify unknown error for the public runtime surface of this module. */
162
167
  export declare function classifyUnknownError(rawMessage: string): ErrorClassification;
163
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]="d90c153b-bb1d-57b1-81fd-e0ea7347c520")}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));
@@ -1164,7 +1163,8 @@ function buildCommanderErrorGuidance(rawMessage, commandName, allowedTypes, cont
1164
1163
  }
1165
1164
  /** Implements format pm cli error for display for the public runtime surface of this module. */
1166
1165
  export function formatPmCliErrorForDisplay(rawMessage, context) {
1167
- return renderGuidanceMessage(buildPmCliErrorGuidance(rawMessage, context));
1166
+ const guidance = buildPmCliErrorGuidance(rawMessage, context);
1167
+ return projectPmDiagnosticText(renderGuidanceMessage(guidance), guidance.required).output;
1168
1168
  }
1169
1169
  /** Implements classify pm cli error for the public runtime surface of this module. */
1170
1170
  export function classifyPmCliError(rawMessage, context) {
@@ -1172,11 +1172,12 @@ export function classifyPmCliError(rawMessage, context) {
1172
1172
  }
1173
1173
  /** Implements format pm cli error for json for the public runtime surface of this module. */
1174
1174
  export function formatPmCliErrorForJson(rawMessage, exitCode, context) {
1175
- return guidanceToJsonEnvelope(buildPmCliErrorGuidance(rawMessage, context), exitCode);
1175
+ return projectPmDiagnosticOutput(guidanceToJsonEnvelope(buildPmCliErrorGuidance(rawMessage, context), exitCode));
1176
1176
  }
1177
1177
  /** Implements format commander error for display for the public runtime surface of this module. */
1178
1178
  export function formatCommanderErrorForDisplay(rawMessage, commandName, allowedTypes, context) {
1179
- return renderGuidanceMessage(buildCommanderErrorGuidance(rawMessage, commandName, allowedTypes, context));
1179
+ const guidance = buildCommanderErrorGuidance(rawMessage, commandName, allowedTypes, context);
1180
+ return projectPmDiagnosticText(renderGuidanceMessage(guidance), guidance.required).output;
1180
1181
  }
1181
1182
  /** Implements classify commander error for the public runtime surface of this module. */
1182
1183
  export function classifyCommanderError(rawMessage, commandName, allowedTypes, context) {
@@ -1184,12 +1185,12 @@ export function classifyCommanderError(rawMessage, commandName, allowedTypes, co
1184
1185
  }
1185
1186
  /** Implements format commander error for json for the public runtime surface of this module. */
1186
1187
  export function formatCommanderErrorForJson(rawMessage, commandName, allowedTypes, exitCode, context) {
1187
- return guidanceToJsonEnvelope(buildCommanderErrorGuidance(rawMessage, commandName, allowedTypes, context), exitCode);
1188
+ return projectPmDiagnosticOutput(guidanceToJsonEnvelope(buildCommanderErrorGuidance(rawMessage, commandName, allowedTypes, context), exitCode));
1188
1189
  }
1189
1190
  /** Implements format unknown error for json for the public runtime surface of this module. */
1190
1191
  export function formatUnknownErrorForJson(rawMessage, exitCode) {
1191
1192
  const guidance = buildUnknownErrorGuidance(rawMessage);
1192
- return guidanceToJsonEnvelope(guidance, exitCode);
1193
+ return projectPmDiagnosticOutput(guidanceToJsonEnvelope(guidance, exitCode));
1193
1194
  }
1194
1195
  function buildUnknownErrorGuidance(rawMessage) {
1195
1196
  const message = normalizeMessage(rawMessage);
@@ -1240,4 +1241,4 @@ export const _testOnly = {
1240
1241
  resolveKnownPackageCommandHint,
1241
1242
  };
1242
1243
  //# sourceMappingURL=error-guidance.js.map
1243
- //# debugId=d90c153b-bb1d-57b1-81fd-e0ea7347c520
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