@unbrained/pm-cli 2026.8.13 → 2026.8.15

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 (194) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +165 -113
  3. package/dist/cli/commander-usage.js +17 -4
  4. package/dist/cli/error-guidance.d.ts +2 -0
  5. package/dist/cli/error-guidance.js +52 -25
  6. package/dist/cli/main.js +40 -3
  7. package/dist/cli/register-mutation.js +4 -2
  8. package/dist/cli/register-operations.js +5 -5
  9. package/dist/cli-bundle/bundle-manifest.json +146 -178
  10. package/dist/cli-bundle/chunks/{chunk-F7FJYGK3.js → chunk-24GAV7XL.js} +2 -2
  11. package/dist/cli-bundle/chunks/chunk-AIM6VT2N.js +13 -0
  12. package/dist/cli-bundle/chunks/chunk-DSWDLTDR.js +197 -0
  13. package/dist/cli-bundle/chunks/{chunk-Q47C67TQ.js → chunk-J42EGKDK.js} +2 -2
  14. package/dist/cli-bundle/chunks/chunk-KIEGUBYQ.js +2 -0
  15. package/dist/cli-bundle/chunks/{chunk-3ZMOWAFM.js → chunk-KLKYLSDX.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-QGTUPEU5.js → chunk-LJHOAVGI.js} +59 -59
  17. package/dist/cli-bundle/chunks/chunk-MEM2ZS3O.js +5 -0
  18. package/dist/cli-bundle/chunks/chunk-QHPCJWEJ.js +35 -0
  19. package/dist/cli-bundle/chunks/{chunk-YLBAPY22.js → chunk-WLPDLNEZ.js} +2 -2
  20. package/dist/cli-bundle/chunks/{register-list-query-4HIZ7EA3.js → register-list-query-CT3LFDDN.js} +2 -2
  21. package/dist/cli-bundle/chunks/{register-mutation-W64FZ5HN.js → register-mutation-NWEVA5YS.js} +3 -3
  22. package/dist/cli-bundle/chunks/register-operations-AHIAG5KM.js +2 -0
  23. package/dist/cli-bundle/chunks/{register-setup-634MFRXU.js → register-setup-ZJZFVAKE.js} +2 -2
  24. package/dist/cli-bundle/focused-chunks/chunk-4X57RE4U.js +2 -0
  25. package/dist/cli-bundle/focused-chunks/chunk-6XKF3PGV.js +18 -0
  26. package/dist/cli-bundle/focused-chunks/chunk-7NJ4QYQ2.js +2 -0
  27. package/dist/cli-bundle/focused-chunks/{chunk-I75MANL7.js → chunk-EXZA4257.js} +2 -2
  28. package/dist/cli-bundle/focused-chunks/chunk-ITAUHSO6.js +50 -0
  29. package/dist/cli-bundle/focused-chunks/{chunk-OOYYKQWX.js → chunk-KLVUMNXJ.js} +2 -2
  30. package/dist/cli-bundle/focused-chunks/{chunk-2RI2FESN.js → chunk-KT5XMYSX.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/{chunk-E3AVJ655.js → chunk-KTKH4IMG.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/chunk-M67F5AIN.js +8 -0
  33. package/dist/cli-bundle/focused-chunks/{chunk-3DJSGWVB.js → chunk-NSPYTG6G.js} +2 -2
  34. package/dist/cli-bundle/focused-chunks/chunk-OKA6ELTL.js +2 -0
  35. package/dist/cli-bundle/focused-chunks/chunk-PUISBOPP.js +2 -0
  36. package/dist/cli-bundle/focused-chunks/chunk-QLNMCESQ.js +155 -0
  37. package/dist/cli-bundle/focused-chunks/{chunk-IIS2FRKL.js → chunk-SLKC6QLJ.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/chunk-U65UC4G3.js +2 -0
  39. package/dist/cli-bundle/focused-chunks/chunk-WTSER4WJ.js +16 -0
  40. package/dist/cli-bundle/focused-chunks/{chunk-2JP7W7GO.js → chunk-ZMFXQ7VF.js} +2 -2
  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 +1 -1
  44. package/dist/cli-bundle/sdk-core.js +41 -41
  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 +110 -1
  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 +2 -2
  52. package/dist/core/diagnostics/remediation.js +7 -2
  53. package/dist/core/extensions/reserved-host-flags.js +3 -2
  54. package/dist/core/history/drift-scan.d.ts +6 -0
  55. package/dist/core/history/drift-scan.js +74 -50
  56. package/dist/core/history/replay.d.ts +14 -1
  57. package/dist/core/history/replay.js +45 -8
  58. package/dist/core/history/workspace-history.d.ts +59 -0
  59. package/dist/core/history/workspace-history.js +197 -10
  60. package/dist/core/output/output.d.ts +2 -0
  61. package/dist/core/output/output.js +13 -4
  62. package/dist/core/shared/command-types.d.ts +2 -0
  63. package/dist/core/shared/command-types.js +2 -2
  64. package/dist/core/shared/errors.d.ts +12 -0
  65. package/dist/core/shared/errors.js +2 -2
  66. package/dist/mcp/tool-definitions.js +9 -5
  67. package/dist/sdk/agent/refusal-reachability.d.ts +61 -0
  68. package/dist/sdk/agent/refusal-reachability.js +91 -3
  69. package/dist/sdk/cli-bootstrap.d.ts +2 -0
  70. package/dist/sdk/cli-bootstrap.js +7 -2
  71. package/dist/sdk/cli-contracts/completeness.js +3 -2
  72. package/dist/sdk/cli-contracts/flag-contracts.js +3 -2
  73. package/dist/sdk/cli-contracts/registration-helpers.js +3 -2
  74. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +11 -1
  75. package/dist/sdk/cli-contracts/runtime-contracts.js +176 -65
  76. package/dist/sdk/cli-contracts/tool-parameter-tables.js +15 -5
  77. package/dist/sdk/cli-contracts/tool-schema.js +10 -3
  78. package/dist/sdk/cli-program.js +4 -3
  79. package/dist/sdk/context-relevance.js +12 -4
  80. package/dist/sdk/core.d.ts +2 -2
  81. package/dist/sdk/core.js +3 -3
  82. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +26 -2
  83. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +50 -26
  84. package/dist/sdk/governance/assurance-action.d.ts +7 -1
  85. package/dist/sdk/governance/assurance-action.js +7 -6
  86. package/dist/sdk/governance/assurance-mutation-error.d.ts +42 -1
  87. package/dist/sdk/governance/assurance-mutation-error.js +27 -3
  88. package/dist/sdk/governance/assurance-runtime.js +12 -11
  89. package/dist/sdk/governance/assurance.d.ts +9 -0
  90. package/dist/sdk/governance/assurance.js +82 -16
  91. package/dist/sdk/governance/extension-host-version.d.ts +25 -0
  92. package/dist/sdk/governance/extension-host-version.js +105 -0
  93. package/dist/sdk/governance/health.d.ts +32 -1
  94. package/dist/sdk/governance/health.js +132 -28
  95. package/dist/sdk/governance/provenance-health.d.ts +27 -0
  96. package/dist/sdk/governance/provenance-health.js +95 -3
  97. package/dist/sdk/governance/validate-history-drift.d.ts +7 -0
  98. package/dist/sdk/governance/validate-history-drift.js +68 -0
  99. package/dist/sdk/governance/validate.js +9 -52
  100. package/dist/sdk/governance.d.ts +6 -0
  101. package/dist/sdk/governance.js +8 -2
  102. package/dist/sdk/graph/assembly.d.ts +23 -0
  103. package/dist/sdk/graph/assembly.js +54 -2
  104. package/dist/sdk/graph/durable-cache.js +50 -20
  105. package/dist/sdk/graph/governance-contracts.d.ts +1 -1
  106. package/dist/sdk/graph/governance-contracts.js +4 -2
  107. package/dist/sdk/graph/governance.d.ts +21 -1
  108. package/dist/sdk/graph/governance.js +94 -32
  109. package/dist/sdk/graph/index.d.ts +2 -2
  110. package/dist/sdk/graph/index.js +4 -4
  111. package/dist/sdk/graph/mutation-advisory.js +15 -7
  112. package/dist/sdk/graph/remediation.js +12 -2
  113. package/dist/sdk/history-read.d.ts +8 -0
  114. package/dist/sdk/history-read.js +2 -2
  115. package/dist/sdk/history-repair.d.ts +13 -1
  116. package/dist/sdk/history-repair.js +62 -18
  117. package/dist/sdk/index.d.ts +1 -1
  118. package/dist/sdk/index.js +3 -3
  119. package/dist/sdk/linked-artifacts.js +16 -5
  120. package/dist/sdk/pagination.d.ts +15 -0
  121. package/dist/sdk/pagination.js +9 -5
  122. package/dist/sdk/query/context.d.ts +5 -1
  123. package/dist/sdk/query/context.js +14 -5
  124. package/dist/sdk/query/history.js +20 -3
  125. package/dist/sdk/read-output/continuation.d.ts +11 -0
  126. package/dist/sdk/read-output/continuation.js +132 -0
  127. package/dist/sdk/read-output-budget.d.ts +3 -1
  128. package/dist/sdk/read-output-budget.js +24 -13
  129. package/dist/sdk/read-output-contracts.d.ts +127 -7
  130. package/dist/sdk/read-output-contracts.js +381 -35
  131. package/dist/sdk/read-output-rows.d.ts +13 -0
  132. package/dist/sdk/read-output-rows.js +60 -2
  133. package/dist/sdk/runtime-input.js +4 -2
  134. package/dist/sdk/runtime-primitives.d.ts +1 -1
  135. package/dist/sdk/runtime-primitives.js +3 -3
  136. package/dist/sdk/runtime.js +5 -3
  137. package/docs/ASSURANCE.md +68 -2
  138. package/docs/COMMANDS.md +39 -4
  139. package/docs/READ_OUTPUT_CONTRACTS.md +85 -8
  140. package/docs/RELATIONSHIP_GRAPH.md +20 -5
  141. package/docs/RELEASING.md +42 -5
  142. package/docs/SDK.md +12 -5
  143. package/docs/SDK_CONTEXT_INTEGRITY.md +94 -1
  144. package/docs/TESTING.md +23 -1
  145. package/docs/performance/sdk-entrypoint-import-costs.md +20 -13
  146. package/marketplace.json +2 -2
  147. package/package.json +7 -7
  148. package/packages/pm-beads/extensions/beads/index.ts +1 -0
  149. package/packages/pm-beads/package.json +1 -1
  150. package/packages/pm-calendar/extensions/calendar/index.ts +1 -0
  151. package/packages/pm-calendar/package.json +1 -1
  152. package/packages/pm-command-kit/package.json +1 -1
  153. package/packages/pm-digital-twin/extensions/digital-twin/index.ts +7 -0
  154. package/packages/pm-digital-twin/package.json +1 -1
  155. package/packages/pm-governance-audit/extensions/governance-audit/index.ts +4 -0
  156. package/packages/pm-governance-audit/package.json +1 -1
  157. package/packages/pm-guide-shell/extensions/guide-shell/index.ts +5 -0
  158. package/packages/pm-guide-shell/package.json +1 -1
  159. package/packages/pm-kanban/package.json +1 -1
  160. package/packages/pm-lifecycle-hooks/package.json +1 -1
  161. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/index.ts +6 -0
  162. package/packages/pm-linked-test-adapters/package.json +1 -1
  163. package/packages/pm-search-advanced/extensions/search-advanced/index.ts +2 -0
  164. package/packages/pm-search-advanced/package.json +1 -1
  165. package/packages/pm-templates/extensions/templates/index.ts +4 -0
  166. package/packages/pm-templates/package.json +1 -1
  167. package/packages/pm-todos/extensions/todos/index.ts +2 -0
  168. package/packages/pm-todos/package.json +1 -1
  169. package/packages/pm-vcs/extensions/vcs/index.ts +7 -0
  170. package/packages/pm-vcs/package.json +1 -1
  171. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  172. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  173. package/scripts/bundle-cli.mjs +17 -4
  174. package/sdk/public-surface.json +1283 -157
  175. package/dist/cli-bundle/chunks/chunk-DEDU3DG7.js +0 -196
  176. package/dist/cli-bundle/chunks/chunk-DL5M5J3V.js +0 -13
  177. package/dist/cli-bundle/chunks/chunk-HIUZVCMN.js +0 -5
  178. package/dist/cli-bundle/chunks/chunk-IMGIN7R6.js +0 -2
  179. package/dist/cli-bundle/chunks/chunk-TF3TPKPR.js +0 -34
  180. package/dist/cli-bundle/chunks/register-operations-C44ET7R5.js +0 -2
  181. package/dist/cli-bundle/focused-chunks/chunk-27N23W6M.js +0 -31
  182. package/dist/cli-bundle/focused-chunks/chunk-3BNVU6LC.js +0 -8
  183. package/dist/cli-bundle/focused-chunks/chunk-6MLIRBLV.js +0 -5
  184. package/dist/cli-bundle/focused-chunks/chunk-6XYLENDV.js +0 -155
  185. package/dist/cli-bundle/focused-chunks/chunk-CP4K4WFS.js +0 -2
  186. package/dist/cli-bundle/focused-chunks/chunk-EBTNSFYE.js +0 -2
  187. package/dist/cli-bundle/focused-chunks/chunk-HC2OL2H2.js +0 -2
  188. package/dist/cli-bundle/focused-chunks/chunk-NFHFZH2Z.js +0 -2
  189. package/dist/cli-bundle/focused-chunks/chunk-OGC4XSBC.js +0 -17
  190. package/dist/cli-bundle/focused-chunks/chunk-PKPOZXLL.js +0 -2
  191. package/dist/cli-bundle/focused-chunks/chunk-QDZUABWL.js +0 -2
  192. package/dist/cli-bundle/focused-chunks/chunk-QQX5TDFT.js +0 -16
  193. package/dist/cli-bundle/focused-chunks/chunk-TEZIXMTH.js +0 -2
  194. package/dist/cli-bundle/focused-chunks/chunk-WEH6NSL6.js +0 -18
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="05cf369c-7529-57ab-984a-f5505cc9c0c9")}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]="48877bbb-17bf-5a78-91fa-19a2f2f4c2be")}catch(e){}}();
3
3
  import { pathExists, resolveItemTypeRegistry, EXIT_CODE, getSettingsPath, resolvePmRoot, readSettings, getActiveExtensionRegistrations, locateItem, runActiveServiceOverride, levenshteinDistanceWithinLimit, } from "../sdk/runtime-primitives.js";
4
4
  import { BUILTIN_ITEM_TYPE_VALUES } from "../types/index.js";
5
5
  import { PM_CORE_COMMAND_NAMES, resolveSubcommandFlagContractsForCommand, } from "../sdk/cli-contracts.js";
@@ -587,10 +587,20 @@ function resolveUnknownOptionSuggestions(message, commandName) {
587
587
  ...suggestNearestLongFlags(match[1], collectKnownLongFlags(commandName)),
588
588
  ])
589
589
  : undefined;
590
+ const otherCommands = match
591
+ ? findOtherCommandsForFlag(match[1], commandName)
592
+ : [];
593
+ const declaredOnPath = match !== null &&
594
+ collectKnownLongFlags(commandName).includes(normalizeLongFlag(match[1]));
590
595
  return {
591
596
  match,
592
597
  suggestions,
593
- otherCommands: match ? findOtherCommandsForFlag(match[1], commandName) : [],
598
+ otherCommands,
599
+ scope: declaredOnPath
600
+ ? "declared_on_path"
601
+ : otherCommands.length > 0
602
+ ? "declared_elsewhere"
603
+ : "declared_nowhere",
594
604
  };
595
605
  }
596
606
  function resolveSuggestedRetryForUnknownOption(invocationArgv, unknownOptionMatch, unknownOptionSuggestions) {
@@ -681,6 +691,7 @@ export async function resolveCommanderUsageContext(error, rootProgram, extension
681
691
  ? unknownOption.otherCommands.length
682
692
  : undefined,
683
693
  unknownOptionOtherCommandsTruncated: unknownOption.otherCommands.length > 12 || undefined,
694
+ unknownOptionScope: unknownOption.scope,
684
695
  suggestedRetryCommand,
685
696
  verifiedCollectionItemId: workspaceUsage.verifiedCollectionItemId,
686
697
  ...splitSchemaSubcommand,
@@ -691,7 +702,7 @@ export async function resolveCommanderUsageContext(error, rootProgram, extension
691
702
  /** Implements format commander usage message for the public runtime surface of this module. */
692
703
  export async function formatCommanderUsageMessage(error, rootProgram, extensionDescriptors, guidanceOverrides = {}) {
693
704
  const usageContext = await resolveCommanderUsageContext(error, rootProgram, extensionDescriptors, guidanceOverrides);
694
- const { message, commandName, allowedTypes, unknownCommandExamples, unknownCommandNextSteps, attemptedCommand, normalizedInvocationArgs, providedOptionFlags, unknownOptionSuggestions, unknownOptionOtherCommands, unknownOptionOtherCommandsTotal, unknownOptionOtherCommandsTruncated, unknownSubcommandPath, unknownSubcommandToken, unknownSubcommandAllowedValues, suggestedRetryCommand, verifiedCollectionItemId, failedExtensions, } = usageContext;
705
+ const { message, commandName, allowedTypes, unknownCommandExamples, unknownCommandNextSteps, attemptedCommand, normalizedInvocationArgs, providedOptionFlags, unknownOptionSuggestions, unknownOptionOtherCommands, unknownOptionOtherCommandsTotal, unknownOptionOtherCommandsTruncated, unknownOptionScope, unknownSubcommandPath, unknownSubcommandToken, unknownSubcommandAllowedValues, suggestedRetryCommand, verifiedCollectionItemId, failedExtensions, } = usageContext;
695
706
  const formatted = formatCommanderErrorForDisplay(message, commandName, allowedTypes, {
696
707
  unknownCommandExamples,
697
708
  unknownCommandNextSteps,
@@ -702,6 +713,7 @@ export async function formatCommanderUsageMessage(error, rootProgram, extensionD
702
713
  unknownOptionOtherCommands,
703
714
  unknownOptionOtherCommandsTotal,
704
715
  unknownOptionOtherCommandsTruncated,
716
+ unknownOptionScope,
705
717
  unknownSubcommandPath,
706
718
  unknownSubcommandToken,
707
719
  unknownSubcommandAllowedValues,
@@ -732,6 +744,7 @@ export async function formatCommanderUsageJson(error, rootProgram, extensionDesc
732
744
  unknownOptionOtherCommands: usageContext.unknownOptionOtherCommands,
733
745
  unknownOptionOtherCommandsTotal: usageContext.unknownOptionOtherCommandsTotal,
734
746
  unknownOptionOtherCommandsTruncated: usageContext.unknownOptionOtherCommandsTruncated,
747
+ unknownOptionScope: usageContext.unknownOptionScope,
735
748
  unknownSubcommandPath: usageContext.unknownSubcommandPath,
736
749
  unknownSubcommandToken: usageContext.unknownSubcommandToken,
737
750
  unknownSubcommandAllowedValues: usageContext.unknownSubcommandAllowedValues,
@@ -750,4 +763,4 @@ export const _testOnly = {
750
763
  suggestNearestLongFlags,
751
764
  };
752
765
  //# sourceMappingURL=commander-usage.js.map
753
- //# debugId=05cf369c-7529-57ab-984a-f5505cc9c0c9
766
+ //# debugId=48877bbb-17bf-5a78-91fa-19a2f2f4c2be
@@ -81,6 +81,8 @@ export interface CommanderGuidanceContext {
81
81
  unknownOptionOtherCommandsTotal?: number;
82
82
  /** Whether the structured command candidates reached their own ceiling. */
83
83
  unknownOptionOtherCommandsTruncated?: boolean;
84
+ /** Declared lexicon membership of the rejected option spelling. */
85
+ unknownOptionScope?: PmCliErrorRecoveryPayload["option_scope"];
84
86
  /** Command family whose positional subcommand was split into invalid tokens. */
85
87
  unknownSubcommandPath?: string;
86
88
  /** Rejected positional subcommand token or token sequence. */
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9ec35c35-f2dc-5f86-a166-cf0c80eab1bd")}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]="6f4c3f5d-9acc-5e2c-9351-12fdcfcdb56a")}catch(e){}}();
3
3
  import { resolveRecoveryCommandName } from "../sdk/agent/command-recovery.js";
4
4
  import { renderPmCommand } from "./argv-utils.js";
5
5
  import { discoverNearbyPmRoot } from "../sdk/tracker-root-discovery.js";
@@ -171,6 +171,11 @@ function normalizeRecoveryPayload(payload) {
171
171
  if (payload.candidate_commands_truncated === true) {
172
172
  normalized.candidate_commands_truncated = true;
173
173
  }
174
+ if (payload.option_scope === "declared_on_path" ||
175
+ payload.option_scope === "declared_elsewhere" ||
176
+ payload.option_scope === "declared_nowhere") {
177
+ normalized.option_scope = payload.option_scope;
178
+ }
174
179
  assignRecoveryString(normalized, "suggested_retry", payload.suggested_retry);
175
180
  if (typeof payload.retry_after_ms === "number" &&
176
181
  Number.isSafeInteger(payload.retry_after_ms) &&
@@ -221,6 +226,9 @@ function renderRecoveryBundle(recovery) {
221
226
  if (normalized.candidate_commands_truncated === true) {
222
227
  lines.push(" candidate_commands_truncated: true");
223
228
  }
229
+ if (normalized.option_scope !== undefined) {
230
+ lines.push(` option_scope: ${normalized.option_scope}`);
231
+ }
224
232
  appendRecoveryTextLine(lines, "suggested_retry", normalized.suggested_retry);
225
233
  if (typeof normalized.retry_after_ms === "number") {
226
234
  lines.push(` retry_after_ms: ${normalized.retry_after_ms}`);
@@ -826,6 +834,42 @@ function buildUnsupportedUpdateOptionGuidance(optionName, context, suggestions)
826
834
  }),
827
835
  });
828
836
  }
837
+ const UNKNOWN_OPTION_REQUIRED_BY_SCOPE = {
838
+ declared_elsewhere: "Use an option declared on this path, or move the declared option to one of its accepting command paths.",
839
+ declared_on_path: "Use the option with the value and syntax declared by this command path.",
840
+ declared_nowhere: "Use a declared option on this command path; this spelling exists nowhere in the command lexicon.",
841
+ };
842
+ function resolveUnknownOptionCandidateContext(context) {
843
+ const otherCommands = normalizeContextList(context.unknownOptionOtherCommands) ?? [];
844
+ return {
845
+ otherCommands,
846
+ optionScope: context.unknownOptionScope ??
847
+ (otherCommands.length > 0 ? "declared_elsewhere" : "declared_nowhere"),
848
+ candidateTotal: context.unknownOptionOtherCommandsTotal ?? otherCommands.length,
849
+ };
850
+ }
851
+ function buildUnknownOptionNextSteps(optionName, commandName, suggestions, candidateContext, retryCommand) {
852
+ const proseCommands = candidateContext.otherCommands.slice(0, 3);
853
+ const proseRemainder = candidateContext.candidateTotal - proseCommands.length;
854
+ const proseRemainderText = proseRemainder > 0
855
+ ? ` and ${String(proseRemainder)} more command path(s)`
856
+ : "";
857
+ return [
858
+ "Run command help to confirm the exact option contracts for this command path.",
859
+ suggestions.length
860
+ ? `Nearest supported options: ${suggestions.join(", ")}`
861
+ : undefined,
862
+ proseCommands.length
863
+ ? `${optionName} is accepted by ${proseCommands.join(", ")}${proseRemainderText}. Inspect those command contracts only if you intended a different operation.`
864
+ : undefined,
865
+ candidateContext.optionScope === "declared_nowhere"
866
+ ? `${optionName} is not declared on any command path. Use a nearest supported option on ${commandName ?? "the attempted command"}, or inspect that command's help.`
867
+ : undefined,
868
+ retryCommand
869
+ ? `Replay with suggested correction: ${retryCommand}`
870
+ : undefined,
871
+ ].filter((entry) => typeof entry === "string");
872
+ }
829
873
  function buildUnknownOptionGuidance(message, commandName, context) {
830
874
  const unknownOption = message.match(/unknown option '([^']+)'/);
831
875
  if (!unknownOption) {
@@ -839,26 +883,8 @@ function buildUnknownOptionGuidance(message, commandName, context) {
839
883
  (optionName === "--file" || optionName === "--doc")) {
840
884
  return buildUnsupportedUpdateOptionGuidance(optionName, context, suggestions);
841
885
  }
842
- const otherCommands = normalizeContextList(guidanceContext.unknownOptionOtherCommands) ?? [];
843
- const candidateTotal = guidanceContext.unknownOptionOtherCommandsTotal ?? otherCommands.length;
844
- const proseCommands = otherCommands.slice(0, 3);
845
- const proseRemainder = candidateTotal - proseCommands.length;
846
- let proseRemainderText = "";
847
- if (proseRemainder > 0) {
848
- proseRemainderText = ` and ${String(proseRemainder)} more command path(s)`;
849
- }
850
- const nextSteps = [
851
- "Run command help to confirm the exact option contracts for this command path.",
852
- suggestions.length
853
- ? `Nearest supported options: ${suggestions.join(", ")}`
854
- : undefined,
855
- proseCommands.length
856
- ? `${optionName} is accepted by ${proseCommands.join(", ")}${proseRemainderText}. Inspect those command contracts only if you intended a different operation.`
857
- : undefined,
858
- retryCommand
859
- ? `Replay with suggested correction: ${retryCommand}`
860
- : undefined,
861
- ].filter((entry) => typeof entry === "string");
886
+ const candidateContext = resolveUnknownOptionCandidateContext(guidanceContext);
887
+ const nextSteps = buildUnknownOptionNextSteps(optionName, commandName, suggestions, candidateContext, retryCommand);
862
888
  const examples = [
863
889
  retryCommand,
864
890
  `pm ${commandName ?? "<command>"} --help`,
@@ -867,15 +893,16 @@ function buildUnknownOptionGuidance(message, commandName, context) {
867
893
  code: "unknown_option",
868
894
  title: `Unknown option ${optionName}`,
869
895
  happened: `Commander does not recognize option ${optionName} for this command path.`,
870
- required: "Use supported options only, or move option to the correct subcommand.",
896
+ required: UNKNOWN_OPTION_REQUIRED_BY_SCOPE[candidateContext.optionScope],
871
897
  why: "Option contracts are command-specific and intentionally validated.",
872
898
  examples,
873
899
  nextSteps,
874
900
  recovery: buildCommanderRecoveryPayload(context, {
875
901
  suggested_flags: suggestions.length > 0 ? suggestions : undefined,
876
- candidate_commands: otherCommands,
877
- candidate_commands_total: candidateTotal || undefined,
902
+ candidate_commands: candidateContext.otherCommands,
903
+ candidate_commands_total: candidateContext.candidateTotal || undefined,
878
904
  candidate_commands_truncated: guidanceContext.unknownOptionOtherCommandsTruncated,
905
+ option_scope: candidateContext.optionScope,
879
906
  }),
880
907
  });
881
908
  }
@@ -1197,4 +1224,4 @@ export const _testOnly = {
1197
1224
  resolveKnownPackageCommandHint,
1198
1225
  };
1199
1226
  //# sourceMappingURL=error-guidance.js.map
1200
- //# debugId=9ec35c35-f2dc-5f86-a166-cf0c80eab1bd
1227
+ //# debugId=6f4c3f5d-9acc-5e2c-9351-12fdcfcdb56a
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]="8aed7a8b-4c51-5aba-b27e-80f87f8f3d35")}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]="cf9d1c78-06f0-5330-8562-ac863c95ee86")}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,7 +27,7 @@ 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 { validateReadOutputOptions } from "../sdk/read-output-contracts.js";
30
+ import { applyReadOutputIncludeModes, 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";
@@ -499,6 +499,40 @@ async function handleGenericRunPmCliError(params) {
499
499
  }
500
500
  }
501
501
  }
502
+ /**
503
+ * Hand canonical `--output-include` projection modes to the command that owns
504
+ * them, leaving only field selectors for post-execution projection.
505
+ *
506
+ * `--output-include brief` must be the exact behaviour of `--brief`, which the
507
+ * emitted migration hint promises; a mode can only be honoured before the
508
+ * command computes its rows, so it cannot be resolved by the output layer.
509
+ */
510
+ function forwardReadOutputIncludeModes(actionCommand, commandPath, globalOptions, commandOptions) {
511
+ const requested = globalOptions.outputInclude;
512
+ if (requested === undefined)
513
+ return;
514
+ const modeOptions = {};
515
+ const { selectors, modes } = applyReadOutputIncludeModes(commandPath, requested, modeOptions);
516
+ if (modes.length === 0)
517
+ return;
518
+ for (const [key, value] of Object.entries(modeOptions)) {
519
+ commandOptions[key] = value;
520
+ actionCommand.setOptionValueWithSource(key, value, "cli");
521
+ }
522
+ const residual = selectors.length > 0 ? selectors.join(",") : undefined;
523
+ if (residual === undefined) {
524
+ delete globalOptions.outputInclude;
525
+ }
526
+ else {
527
+ globalOptions.outputInclude = residual;
528
+ }
529
+ // The resolved-global cache is cleared and re-read from Commander before the
530
+ // handler runs, so the consumed modes have to leave the parsed option too.
531
+ for (let scope = actionCommand; scope; scope = scope.parent) {
532
+ scope.setOptionValueWithSource("outputInclude", residual, "cli");
533
+ }
534
+ setResolvedGlobalOptions(actionCommand, globalOptions);
535
+ }
502
536
  function extractCommandScopedOptions(command, commandArgs, extensionFlagDefinitions = []) {
503
537
  const allOptions = command.optsWithGlobals();
504
538
  const scoped = { ...allOptions };
@@ -1564,7 +1598,9 @@ function attachProgramLifecycleHooks(rootProgram) {
1564
1598
  outputBudget: rawGlobalOptions.outputBudget,
1565
1599
  outputFormat: rawGlobalOptions.outputFormat,
1566
1600
  outputSession: rawGlobalOptions.outputSession,
1601
+ outputCursor: rawGlobalOptions.outputCursor,
1567
1602
  });
1603
+ forwardReadOutputIncludeModes(actionCommand, commandPath, globalOptions, commandOptions);
1568
1604
  await maybeRunFirstUseTelemetryPrompt(commandPath, globalOptions);
1569
1605
  const fallbackPmRoot = resolvePmRoot(process.cwd(), bootstrapGlobalOptions.path);
1570
1606
  const runtimeExtensions = await maybeLoadRuntimeExtensions(actionCommand);
@@ -1602,6 +1638,7 @@ function attachProgramLifecycleHooks(rootProgram) {
1602
1638
  setActiveExtensionRegistrations(runtimeExtensions.registrations);
1603
1639
  const extensionFlagDefinitions = collectExtensionFlagDefinitionsForInvocation(runtimeExtensions.registrations, commandPath, commandArgs);
1604
1640
  commandOptions = extractCommandScopedOptions(actionCommand, commandArgs, extensionFlagDefinitions);
1641
+ forwardReadOutputIncludeModes(actionCommand, commandPath, globalOptions, commandOptions);
1605
1642
  const parserOverride = await runActiveParserOverride({
1606
1643
  command: commandPath,
1607
1644
  args: commandArgs,
@@ -2475,4 +2512,4 @@ export const _testOnly = {
2475
2512
  wrapThrownErrorForSentry,
2476
2513
  };
2477
2514
  //# sourceMappingURL=main.js.map
2478
- //# debugId=8aed7a8b-4c51-5aba-b27e-80f87f8f3d35
2515
+ //# debugId=cf9d1c78-06f0-5330-8562-ac863c95ee86
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6c7d647c-e489-51e3-b84b-5b62b4114033")}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]="60ee1ab9-00a0-50a7-839e-4938ecc6a48f")}catch(e){}}();
3
3
  import { resolveBodyFileContent, EXIT_CODE, splitCommaList, PmCliError, createUnknownSubcommandError, } from "../sdk/runtime-primitives.js";
4
4
  import { CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS, PLAN_CREATE_METADATA_PARAMETER_KEYS, UPDATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS, } from "../sdk/cli-contracts.js";
5
5
  import { BUILTIN_ITEM_TYPE_VALUES } from "../types/index.js";
@@ -1670,6 +1670,7 @@ export function registerMutationCommands(program, registrationOptions = {}) {
1670
1670
  .argument("[id]", "Item id (omit with --all)")
1671
1671
  .option("--all", "Scan every stream for drift and repair each drifted stream in one audited pass")
1672
1672
  .option("--dry-run", "Preview the re-anchor impact without writing the history file")
1673
+ .option("--normalize-provenance", "Remove invalid provenance; return aggregate-only evidence")
1673
1674
  .option("--author <value>", "Mutation author")
1674
1675
  .option("--message <value>", "Audit history message for the repair marker entry")
1675
1676
  .option("--force", "Force ownership/lock override")
@@ -1684,6 +1685,7 @@ export function registerMutationCommands(program, registrationOptions = {}) {
1684
1685
  author: typeof options.author === "string" ? options.author : undefined,
1685
1686
  message: typeof options.message === "string" ? options.message : undefined,
1686
1687
  force: Boolean(options.force),
1688
+ normalizeProvenance: options.normalizeProvenance === true,
1687
1689
  };
1688
1690
  // history-repair only re-anchors the audit stream; item content is untouched,
1689
1691
  // so search caches do not need invalidation.
@@ -1838,4 +1840,4 @@ export function registerMutationCommands(program, registrationOptions = {}) {
1838
1840
  .action(runDepsAction);
1839
1841
  }
1840
1842
  //# sourceMappingURL=register-mutation.js.map
1841
- //# debugId=6c7d647c-e489-51e3-b84b-5b62b4114033
1843
+ //# debugId=60ee1ab9-00a0-50a7-839e-4938ecc6a48f
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7796ea07-0de7-5db8-a3b5-a8021ceebc69")}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]="dec5fb7d-416f-5da6-bd97-c05c25dbf769")}catch(e){}}();
3
3
  import { resolveRuntimeStatusRegistry, setActiveCommandResult, EXIT_CODE, PmCliError, createUnknownSubcommandError, resolveAuthor, resolvePmRoot, readSettings, } from "../sdk/runtime-primitives.js";
4
4
  import { resolveStartTaskInProgressStatus } from "../sdk/start-task-status.js";
5
5
  import { parseStatsAnalyticsJson } from "./stats-analytics-json.js";
@@ -284,6 +284,7 @@ async function runDuplicatesAction(options, command) {
284
284
  async function runHealthAction(options, command) {
285
285
  const globalOptions = getGlobalOptions(command);
286
286
  const startedAt = Date.now();
287
+ const strictExit = Boolean(options.strictExit) || Boolean(options.failOnWarn);
287
288
  const result = await runHealth(globalOptions, {
288
289
  strictDirectories: Boolean(options.strictDirectories),
289
290
  requireMergeDrivers: Boolean(options.requireMergeDrivers),
@@ -294,14 +295,13 @@ async function runHealthAction(options, command) {
294
295
  verboseStaleItems: Boolean(options.verboseStaleItems),
295
296
  verboseAuthorEvents: Boolean(options.verboseAuthorEvents),
296
297
  brief: Boolean(options.brief),
297
- summary: Boolean(options.summary),
298
+ summary: Boolean(options.summary) || strictExit,
298
299
  skipVectors: Boolean(options.skipVectors),
299
300
  skipIntegrity: Boolean(options.skipIntegrity),
300
301
  skipDrift: Boolean(options.skipDrift),
301
302
  full: Boolean(options.full),
302
303
  });
303
304
  printResult(result, globalOptions);
304
- const strictExit = Boolean(options.strictExit) || Boolean(options.failOnWarn);
305
305
  if (strictExit && !result.ok) {
306
306
  setActiveCommandResult({
307
307
  ...result,
@@ -649,7 +649,7 @@ export function registerOperationCommands(program) {
649
649
  .option("--skip-integrity", "Skip item/history file integrity check for a faster run")
650
650
  .option("--skip-drift", "Skip history drift hash check for a faster run")
651
651
  .option("--full", "Run all checks including slow integrity, drift, and vectorization checks")
652
- .option("--strict-exit", "Return non-zero exit when health is not ok (advisory telemetry warnings are excluded; see warnings[])")
652
+ .option("--strict-exit", "Return non-zero exit when health is not ok and default to actionable summary output; use --full for complete details")
653
653
  .option("--fail-on-warn", "Alias for --strict-exit")
654
654
  .action(runHealthAction);
655
655
  program
@@ -873,4 +873,4 @@ function registerSchedulingShortcutCommands(program) {
873
873
  });
874
874
  }
875
875
  //# sourceMappingURL=register-operations.js.map
876
- //# debugId=7796ea07-0de7-5db8-a3b5-a8021ceebc69
876
+ //# debugId=dec5fb7d-416f-5da6-bd97-c05c25dbf769