@unbrained/pm-cli 2026.8.10 → 2026.8.11

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 (175) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +102 -80
  3. package/dist/cli/commander-usage.js +79 -7
  4. package/dist/cli/error-guidance.d.ts +10 -0
  5. package/dist/cli/error-guidance.js +76 -25
  6. package/dist/cli/main.js +6 -2
  7. package/dist/cli/register-assurance.d.ts +8 -0
  8. package/dist/cli/register-assurance.js +52 -0
  9. package/dist/cli/register-files-lookup.js +14 -3
  10. package/dist/cli/register-mutation.js +30 -9
  11. package/dist/cli/register-operations.js +16 -11
  12. package/dist/cli-bundle/bundle-manifest.json +159 -159
  13. package/dist/cli-bundle/chunks/{chunk-TRWXF476.js → chunk-2OOU2AFH.js} +2 -2
  14. package/dist/cli-bundle/chunks/chunk-2RA2YTHJ.js +33 -0
  15. package/dist/cli-bundle/chunks/chunk-A2SJGHSI.js +3 -0
  16. package/dist/cli-bundle/chunks/chunk-DSKYD4LG.js +13 -0
  17. package/dist/cli-bundle/chunks/chunk-HC3GM6YY.js +194 -0
  18. package/dist/cli-bundle/chunks/chunk-IUNRVDAI.js +2 -0
  19. package/dist/cli-bundle/chunks/chunk-W7CPZGSB.js +2 -0
  20. package/dist/cli-bundle/chunks/{chunk-EBO7OUUE.js → chunk-WMEZHCFI.js} +59 -53
  21. package/dist/cli-bundle/chunks/{chunk-ETML5C6H.js → chunk-ZU34C3LH.js} +47 -47
  22. package/dist/cli-bundle/chunks/chunk-ZXOC6HG5.js +5 -0
  23. package/dist/cli-bundle/chunks/{register-list-query-OJ6ZXKV4.js → register-list-query-HAUXVUPY.js} +8 -8
  24. package/dist/cli-bundle/chunks/register-mutation-7Y5U7ABT.js +20 -0
  25. package/dist/cli-bundle/chunks/register-operations-EQX3DLAZ.js +2 -0
  26. package/dist/cli-bundle/chunks/{register-setup-S3KT2LTH.js → register-setup-NOCOOWQY.js} +2 -2
  27. package/dist/cli-bundle/focused-chunks/{chunk-34SX654S.js → chunk-23FTGO3W.js} +2 -2
  28. package/dist/cli-bundle/focused-chunks/{chunk-2COZ67XT.js → chunk-2DL3MRTD.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/chunk-3AYKXMYX.js +2 -0
  30. package/dist/cli-bundle/focused-chunks/chunk-4AHEC74N.js +2 -0
  31. package/dist/cli-bundle/focused-chunks/{chunk-7UN6BHHO.js → chunk-4H5IA6AV.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/chunk-4SV3ZKG3.js +16 -0
  33. package/dist/cli-bundle/focused-chunks/chunk-55BIB6DV.js +2 -0
  34. package/dist/cli-bundle/focused-chunks/chunk-6JW6Z2P5.js +8 -0
  35. package/dist/cli-bundle/focused-chunks/{chunk-IW43E4XL.js → chunk-BKPIY34S.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/chunk-D4PIWE6D.js +2 -0
  37. package/dist/cli-bundle/focused-chunks/{chunk-KR5RVXLQ.js → chunk-DPO7TEFX.js} +29 -29
  38. package/dist/cli-bundle/focused-chunks/{chunk-JMVA4HKR.js → chunk-E3KCL7AY.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/chunk-ERAAFLPS.js +153 -0
  40. package/dist/cli-bundle/focused-chunks/{chunk-RIIN5V4N.js → chunk-F6E4JZKG.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/chunk-FPSYO5ZG.js +18 -0
  42. package/dist/cli-bundle/focused-chunks/{chunk-M6RPIXKC.js → chunk-J5EKAIVD.js} +2 -2
  43. package/dist/cli-bundle/focused-chunks/{chunk-2EXI2DKR.js → chunk-KDH5OX3D.js} +2 -2
  44. package/dist/cli-bundle/focused-chunks/chunk-OJ3LVVIS.js +2 -0
  45. package/dist/cli-bundle/focused-chunks/{chunk-DZGAHZZV.js → chunk-TL5M2PAY.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/{chunk-75774JWP.js → chunk-UDAZWT25.js} +2 -2
  47. package/dist/cli-bundle/focused-chunks/chunk-VABB4L5Y.js +17 -0
  48. package/dist/cli-bundle/main.js +13 -13
  49. package/dist/cli-bundle/sdk-authoring.js +1 -1
  50. package/dist/cli-bundle/sdk-contracts.js +1 -1
  51. package/dist/cli-bundle/sdk-core.js +41 -39
  52. package/dist/cli-bundle/sdk-governance.js +1 -1
  53. package/dist/cli-bundle/sdk-graph.js +1 -1
  54. package/dist/cli-bundle/sdk-merge.js +1 -1
  55. package/dist/cli-bundle/sdk-query.js +1 -1
  56. package/dist/cli-bundle/sdk-runtime.js +1 -1
  57. package/dist/cli-bundle/sdk-testing.js +1 -1
  58. package/dist/cli-bundle/sdk.js +2 -2
  59. package/dist/core/session/session-state.d.ts +47 -0
  60. package/dist/core/session/session-state.js +207 -6
  61. package/dist/core/shared/author.d.ts +7 -1
  62. package/dist/core/shared/author.js +66 -46
  63. package/dist/core/shared/errors.d.ts +8 -0
  64. package/dist/core/shared/errors.js +2 -2
  65. package/dist/sdk/agent/refusal-reachability.d.ts +40 -0
  66. package/dist/sdk/agent/refusal-reachability.js +72 -0
  67. package/dist/sdk/agent/subcommand-recovery.d.ts +40 -0
  68. package/dist/sdk/agent/subcommand-recovery.js +84 -0
  69. package/dist/sdk/cli-bootstrap.d.ts +8 -0
  70. package/dist/sdk/cli-bootstrap.js +7 -7
  71. package/dist/sdk/cli-contracts/completeness.js +13 -3
  72. package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
  73. package/dist/sdk/cli-contracts/enum-contracts.js +3 -2
  74. package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
  75. package/dist/sdk/cli-contracts/flag-contracts.js +17 -2
  76. package/dist/sdk/cli-contracts/runtime-contracts.js +4 -3
  77. package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +513 -0
  78. package/dist/sdk/cli-contracts/schemas/assurance-definition.js +251 -0
  79. package/dist/sdk/cli-contracts/tool-parameter-tables.js +79 -2
  80. package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
  81. package/dist/sdk/cli-contracts/tool-schema.js +34 -4
  82. package/dist/sdk/cli-contracts.d.ts +1 -1
  83. package/dist/sdk/cli-contracts.js +3 -3
  84. package/dist/sdk/completion.js +9 -3
  85. package/dist/sdk/config.js +9 -3
  86. package/dist/sdk/context/semantic-session-attribution.d.ts +32 -0
  87. package/dist/sdk/context/semantic-session-attribution.js +83 -0
  88. package/dist/sdk/core-governance.d.ts +3 -1
  89. package/dist/sdk/core-governance.js +5 -3
  90. package/dist/sdk/core.d.ts +1 -1
  91. package/dist/sdk/core.js +2 -2
  92. package/dist/sdk/error-code-catalog.d.ts +13 -0
  93. package/dist/sdk/error-code-catalog.js +35 -2
  94. package/dist/sdk/extension.js +18 -17
  95. package/dist/sdk/files.d.ts +11 -0
  96. package/dist/sdk/files.js +82 -24
  97. package/dist/sdk/generated-error-code-catalog.js +32 -13
  98. package/dist/sdk/governance/assurance-action-contracts.d.ts +7 -0
  99. package/dist/sdk/governance/assurance-action-contracts.js +5 -0
  100. package/dist/sdk/governance/assurance-action.d.ts +70 -0
  101. package/dist/sdk/governance/assurance-action.js +198 -0
  102. package/dist/sdk/governance/assurance-limits.d.ts +7 -0
  103. package/dist/sdk/governance/assurance-limits.js +11 -0
  104. package/dist/sdk/governance/assurance-runtime.d.ts +20 -0
  105. package/dist/sdk/governance/assurance-runtime.js +131 -0
  106. package/dist/sdk/governance/assurance.d.ts +432 -0
  107. package/dist/sdk/governance/assurance.js +689 -0
  108. package/dist/sdk/graph/run.js +8 -3
  109. package/dist/sdk/index.d.ts +6 -1
  110. package/dist/sdk/index.js +8 -3
  111. package/dist/sdk/lifecycle/claim.js +18 -3
  112. package/dist/sdk/lifecycle/focus.js +13 -3
  113. package/dist/sdk/lifecycle/plan.js +8 -3
  114. package/dist/sdk/provenance.d.ts +38 -0
  115. package/dist/sdk/provenance.js +64 -2
  116. package/dist/sdk/query/context.js +19 -8
  117. package/dist/sdk/runtime-extended-actions.js +22 -5
  118. package/dist/sdk/runtime-primitives.d.ts +2 -0
  119. package/dist/sdk/runtime-primitives.js +4 -2
  120. package/dist/sdk/runtime.d.ts +4 -0
  121. package/dist/sdk/runtime.js +31 -27
  122. package/dist/sdk/telemetry.js +7 -4
  123. package/dist/sdk/traceability/runtime-files-lookup.d.ts +8 -0
  124. package/dist/sdk/traceability/runtime-files-lookup.js +33 -0
  125. package/dist/sdk/traceability/source-traceability.d.ts +102 -0
  126. package/dist/sdk/traceability/source-traceability.js +293 -0
  127. package/dist/types.d.ts +8 -2
  128. package/dist/types.js +2 -2
  129. package/docs/ASSURANCE.md +132 -0
  130. package/docs/README.md +1 -0
  131. package/docs/RELEASING.md +9 -5
  132. package/docs/SDK.md +12 -1
  133. package/docs/SDK_AGENT_SESSION_CONTEXT.md +40 -4
  134. package/docs/SDK_EVIDENCE_TRACEABILITY.md +39 -1
  135. package/docs/SDK_RUNTIME_BOUNDARIES.md +36 -1
  136. package/docs/TESTING.md +12 -9
  137. package/docs/generated/AGENT_COMMAND_SURFACE.md +1 -0
  138. package/marketplace.json +2 -2
  139. package/package.json +3 -3
  140. package/packages/pm-beads/package.json +1 -1
  141. package/packages/pm-calendar/package.json +1 -1
  142. package/packages/pm-command-kit/package.json +1 -1
  143. package/packages/pm-digital-twin/package.json +1 -1
  144. package/packages/pm-governance-audit/package.json +1 -1
  145. package/packages/pm-guide-shell/package.json +1 -1
  146. package/packages/pm-kanban/package.json +1 -1
  147. package/packages/pm-lifecycle-hooks/package.json +1 -1
  148. package/packages/pm-linked-test-adapters/package.json +1 -1
  149. package/packages/pm-search-advanced/package.json +1 -1
  150. package/packages/pm-templates/extensions/templates/index.ts +9 -3
  151. package/packages/pm-templates/package.json +1 -1
  152. package/packages/pm-todos/package.json +1 -1
  153. package/packages/pm-vcs/package.json +1 -1
  154. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  155. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  156. package/sdk/public-surface.json +840 -28
  157. package/dist/cli-bundle/chunks/chunk-2QYH4QMI.js +0 -30
  158. package/dist/cli-bundle/chunks/chunk-JUDU4RO4.js +0 -194
  159. package/dist/cli-bundle/chunks/chunk-JZSNADRR.js +0 -5
  160. package/dist/cli-bundle/chunks/chunk-MENWVGJW.js +0 -2
  161. package/dist/cli-bundle/chunks/chunk-S4EITGLA.js +0 -3
  162. package/dist/cli-bundle/chunks/chunk-TIGKWVLA.js +0 -13
  163. package/dist/cli-bundle/chunks/chunk-TSLDTJLQ.js +0 -2
  164. package/dist/cli-bundle/chunks/register-mutation-DKI7QC7O.js +0 -20
  165. package/dist/cli-bundle/chunks/register-operations-P5OGMT6I.js +0 -2
  166. package/dist/cli-bundle/focused-chunks/chunk-36FTZ2NT.js +0 -2
  167. package/dist/cli-bundle/focused-chunks/chunk-3CQECMKR.js +0 -16
  168. package/dist/cli-bundle/focused-chunks/chunk-CHIBMEZR.js +0 -8
  169. package/dist/cli-bundle/focused-chunks/chunk-FF4MNAYB.js +0 -153
  170. package/dist/cli-bundle/focused-chunks/chunk-GHTN2ILR.js +0 -2
  171. package/dist/cli-bundle/focused-chunks/chunk-I4YM2I7S.js +0 -2
  172. package/dist/cli-bundle/focused-chunks/chunk-IMDTEN7K.js +0 -2
  173. package/dist/cli-bundle/focused-chunks/chunk-KSNJG4KI.js +0 -16
  174. package/dist/cli-bundle/focused-chunks/chunk-MXYSIQ56.js +0 -18
  175. package/dist/cli-bundle/focused-chunks/chunk-RKWSCYYN.js +0 -2
@@ -1,12 +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]="a327ea76-ca7d-5f8f-aa2d-2f6f43052913")}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]="78ae2dad-a000-57be-9492-caea26a412ef")}catch(e){}}();
3
3
  import { pathExists, resolveItemTypeRegistry, EXIT_CODE, getSettingsPath, resolvePmRoot, readSettings, getActiveExtensionRegistrations, 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";
6
6
  import { formatCommanderErrorForDisplay, formatCommanderErrorForJson, projectLeanErrorEnvelope, } from "./error-guidance.js";
7
7
  import { normalizeHelpCommandPath } from "./help-content.js";
8
8
  import { getCommandPath } from "./registration-helpers.js";
9
- import { EXECUTABLE_COMMAND_ALIASES, normalizeBootstrapInvocation, parseBootstrapHelpRequest, parseBootstrapGlobalOptions, parseBootstrapCommandName, } from "./bootstrap-args.js";
9
+ import { EXECUTABLE_COMMAND_ALIASES, findBootstrapCommandTokenIndex, normalizeBootstrapInvocation, parseBootstrapHelpRequest, parseBootstrapGlobalOptions, parseBootstrapCommandName, } from "./bootstrap-args.js";
10
10
  import { extractProvidedOptionFlags, normalizeLongFlag, renderPmCommand, } from "./argv-utils.js";
11
11
  import { normalizeExtensionNameForMatch } from "./commands/extension/shared.js";
12
12
  import { rankCommandPaths } from "../sdk/agent/command-suggestions.js";
@@ -54,6 +54,23 @@ const SEMANTIC_UNKNOWN_OPTION_SUGGESTIONS = {
54
54
  "--tag": ["--tags"],
55
55
  },
56
56
  };
57
+ const SCHEMA_SUBCOMMAND_VALUES = [
58
+ "add-field",
59
+ "add-status",
60
+ "add-type",
61
+ "apply-preset",
62
+ "list",
63
+ "list-fields",
64
+ "remap-status",
65
+ "remove-field",
66
+ "remove-status",
67
+ "remove-type",
68
+ "rename-field",
69
+ "rename-type",
70
+ "show",
71
+ "show-field",
72
+ "show-status",
73
+ ];
57
74
  function getSemanticUnknownOptionSuggestions(commandName, unknownOption) {
58
75
  const commandSuggestions = SEMANTIC_UNKNOWN_OPTION_SUGGESTIONS[commandName];
59
76
  if (!commandSuggestions) {
@@ -335,9 +352,17 @@ function findOtherCommandsForFlag(unknownOption, currentCommand) {
335
352
  return [];
336
353
  }
337
354
  const normalizedCurrent = currentCommand?.trim().toLowerCase();
355
+ const currentFlags = new Set(collectKnownLongFlags(normalizedCurrent));
338
356
  return commands
339
357
  .filter((command) => command !== normalizedCurrent)
340
- .slice(0, 3);
358
+ .map((command) => ({
359
+ command,
360
+ sharedFlagCount: collectKnownLongFlags(command).filter((flag) => currentFlags.has(flag)).length,
361
+ }))
362
+ .sort((left, right) => left.sharedFlagCount !== right.sharedFlagCount
363
+ ? right.sharedFlagCount - left.sharedFlagCount
364
+ : left.command.localeCompare(right.command))
365
+ .map(({ command }) => command);
341
366
  }
342
367
  function rewriteUnknownOptionArgv(argv, unknownOption, replacementFlag) {
343
368
  for (let index = 0; index < argv.length; index += 1) {
@@ -571,6 +596,35 @@ function resolveSuggestedRetryForMissingOption(message, invocationArgv) {
571
596
  requiredOptionToken,
572
597
  ]);
573
598
  }
599
+ function resolveSplitSchemaSubcommand(message, invocationArgv) {
600
+ if (!/too many arguments/i.test(message)) {
601
+ return undefined;
602
+ }
603
+ if (parseBootstrapCommandName(invocationArgv) !== "schema") {
604
+ return undefined;
605
+ }
606
+ const schemaIndex = findBootstrapCommandTokenIndex(invocationArgv);
607
+ const verb = invocationArgv[schemaIndex + 1]?.trim().toLowerCase();
608
+ const noun = invocationArgv[schemaIndex + 2]?.trim().toLowerCase();
609
+ if (!verb || !noun) {
610
+ return undefined;
611
+ }
612
+ const joined = `${verb}-${noun}`;
613
+ if (!SCHEMA_SUBCOMMAND_VALUES.includes(joined)) {
614
+ return undefined;
615
+ }
616
+ const rewritten = [
617
+ ...invocationArgv.slice(0, schemaIndex + 1),
618
+ joined,
619
+ ...invocationArgv.slice(schemaIndex + 3),
620
+ ];
621
+ return {
622
+ unknownSubcommandPath: "schema",
623
+ unknownSubcommandToken: `${verb} ${noun}`,
624
+ unknownSubcommandAllowedValues: [...SCHEMA_SUBCOMMAND_VALUES],
625
+ suggestedRetryCommand: renderAttemptedCommand(rewritten),
626
+ };
627
+ }
574
628
  /** Implements resolve commander usage context for the public runtime surface of this module. */
575
629
  export async function resolveCommanderUsageContext(error, rootProgram, extensionDescriptors, guidanceOverrides = {}) {
576
630
  const rawMessage = typeof error === "object" && error !== null
@@ -585,7 +639,10 @@ export async function resolveCommanderUsageContext(error, rootProgram, extension
585
639
  const allowedTypes = await resolveAllowedTypesForUsage(bootstrapGlobal);
586
640
  const unknownCommandGuidance = buildUnknownCommandGuidanceFromRuntime(message, rootProgram, extensionDescriptors);
587
641
  const unknownOption = resolveUnknownOptionSuggestions(message, commandName);
588
- const suggestedRetryCommand = resolveSuggestedRetryForUnknownOption(invocationArgv, unknownOption.match, unknownOption.suggestions) ?? resolveSuggestedRetryForMissingOption(message, invocationArgv);
642
+ const splitSchemaSubcommand = resolveSplitSchemaSubcommand(message, invocationArgv);
643
+ const suggestedRetryCommand = splitSchemaSubcommand?.suggestedRetryCommand ??
644
+ resolveSuggestedRetryForUnknownOption(invocationArgv, unknownOption.match, unknownOption.suggestions) ??
645
+ resolveSuggestedRetryForMissingOption(message, invocationArgv);
589
646
  return {
590
647
  message,
591
648
  commandName,
@@ -595,9 +652,14 @@ export async function resolveCommanderUsageContext(error, rootProgram, extension
595
652
  providedOptionFlags,
596
653
  unknownOptionSuggestions: unknownOption.suggestions,
597
654
  unknownOptionOtherCommands: unknownOption.otherCommands.length > 0
598
- ? unknownOption.otherCommands
655
+ ? unknownOption.otherCommands.slice(0, 12)
656
+ : undefined,
657
+ unknownOptionOtherCommandsTotal: unknownOption.otherCommands.length > 0
658
+ ? unknownOption.otherCommands.length
599
659
  : undefined,
660
+ unknownOptionOtherCommandsTruncated: unknownOption.otherCommands.length > 12 || undefined,
600
661
  suggestedRetryCommand,
662
+ ...splitSchemaSubcommand,
601
663
  ...unknownCommandGuidance,
602
664
  ...guidanceOverrides,
603
665
  };
@@ -605,7 +667,7 @@ export async function resolveCommanderUsageContext(error, rootProgram, extension
605
667
  /** Implements format commander usage message for the public runtime surface of this module. */
606
668
  export async function formatCommanderUsageMessage(error, rootProgram, extensionDescriptors, guidanceOverrides = {}) {
607
669
  const usageContext = await resolveCommanderUsageContext(error, rootProgram, extensionDescriptors, guidanceOverrides);
608
- const { message, commandName, allowedTypes, unknownCommandExamples, unknownCommandNextSteps, attemptedCommand, normalizedInvocationArgs, providedOptionFlags, unknownOptionSuggestions, unknownOptionOtherCommands, suggestedRetryCommand, failedExtensions, } = usageContext;
670
+ const { message, commandName, allowedTypes, unknownCommandExamples, unknownCommandNextSteps, attemptedCommand, normalizedInvocationArgs, providedOptionFlags, unknownOptionSuggestions, unknownOptionOtherCommands, unknownOptionOtherCommandsTotal, unknownOptionOtherCommandsTruncated, unknownSubcommandPath, unknownSubcommandToken, unknownSubcommandAllowedValues, suggestedRetryCommand, failedExtensions, } = usageContext;
609
671
  const formatted = formatCommanderErrorForDisplay(message, commandName, allowedTypes, {
610
672
  unknownCommandExamples,
611
673
  unknownCommandNextSteps,
@@ -614,6 +676,11 @@ export async function formatCommanderUsageMessage(error, rootProgram, extensionD
614
676
  providedOptionFlags,
615
677
  unknownOptionSuggestions,
616
678
  unknownOptionOtherCommands,
679
+ unknownOptionOtherCommandsTotal,
680
+ unknownOptionOtherCommandsTruncated,
681
+ unknownSubcommandPath,
682
+ unknownSubcommandToken,
683
+ unknownSubcommandAllowedValues,
617
684
  suggestedRetryCommand,
618
685
  failedExtensions,
619
686
  });
@@ -638,6 +705,11 @@ export async function formatCommanderUsageJson(error, rootProgram, extensionDesc
638
705
  providedOptionFlags: usageContext.providedOptionFlags,
639
706
  unknownOptionSuggestions: usageContext.unknownOptionSuggestions,
640
707
  unknownOptionOtherCommands: usageContext.unknownOptionOtherCommands,
708
+ unknownOptionOtherCommandsTotal: usageContext.unknownOptionOtherCommandsTotal,
709
+ unknownOptionOtherCommandsTruncated: usageContext.unknownOptionOtherCommandsTruncated,
710
+ unknownSubcommandPath: usageContext.unknownSubcommandPath,
711
+ unknownSubcommandToken: usageContext.unknownSubcommandToken,
712
+ unknownSubcommandAllowedValues: usageContext.unknownSubcommandAllowedValues,
641
713
  suggestedRetryCommand: usageContext.suggestedRetryCommand,
642
714
  failedExtensions: usageContext.failedExtensions,
643
715
  });
@@ -652,4 +724,4 @@ export const _testOnly = {
652
724
  suggestNearestLongFlags,
653
725
  };
654
726
  //# sourceMappingURL=commander-usage.js.map
655
- //# debugId=a327ea76-ca7d-5f8f-aa2d-2f6f43052913
727
+ //# debugId=78ae2dad-a000-57be-9492-caea26a412ef
@@ -77,6 +77,16 @@ export interface CommanderGuidanceContext {
77
77
  unknownOptionSuggestions?: string[];
78
78
  /** Value that configures or reports unknown option other commands for this contract. */
79
79
  unknownOptionOtherCommands?: string[];
80
+ /** Complete number of commands accepting the unknown option. */
81
+ unknownOptionOtherCommandsTotal?: number;
82
+ /** Whether the structured command candidates reached their own ceiling. */
83
+ unknownOptionOtherCommandsTruncated?: boolean;
84
+ /** Command family whose positional subcommand was split into invalid tokens. */
85
+ unknownSubcommandPath?: string;
86
+ /** Rejected positional subcommand token or token sequence. */
87
+ unknownSubcommandToken?: string;
88
+ /** Complete declared subcommand vocabulary for the command family. */
89
+ unknownSubcommandAllowedValues?: string[];
80
90
  /** Value that configures or reports suggested retry command for this contract. */
81
91
  suggestedRetryCommand?: string;
82
92
  /** Installed extensions whose activation failed for this invocation. */
@@ -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]="d9d3d041-587b-5660-a909-d0759998248d")}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]="4d6caae5-76d6-5563-acb9-b435f8cdfe9c")}catch(e){}}();
3
3
  import { renderPmCommand } from "./argv-utils.js";
4
4
  import { discoverNearbyPmRoot } from "../sdk/tracker-root-discovery.js";
5
5
  /** Compact an error envelope to fields that change the caller's next action. */
@@ -145,6 +145,16 @@ function normalizeRecoveryPayload(payload) {
145
145
  assignRecoveryStringArray(normalized, "missing", payload.missing);
146
146
  assignRecoveryStringArray(normalized, "missing_required_fields", payload.missing_required_fields);
147
147
  assignRecoveryStringArray(normalized, "suggested_flags", payload.suggested_flags);
148
+ assignRecoveryStringArray(normalized, "allowed_values", payload.allowed_values);
149
+ assignRecoveryStringArray(normalized, "candidate_commands", payload.candidate_commands);
150
+ if (typeof payload.candidate_commands_total === "number" &&
151
+ Number.isSafeInteger(payload.candidate_commands_total) &&
152
+ payload.candidate_commands_total >= 0) {
153
+ normalized.candidate_commands_total = payload.candidate_commands_total;
154
+ }
155
+ if (payload.candidate_commands_truncated === true) {
156
+ normalized.candidate_commands_truncated = true;
157
+ }
148
158
  assignRecoveryString(normalized, "suggested_retry", payload.suggested_retry);
149
159
  if (typeof payload.retry_after_ms === "number" &&
150
160
  Number.isSafeInteger(payload.retry_after_ms) &&
@@ -180,6 +190,14 @@ function renderRecoveryBundle(recovery) {
180
190
  appendRecoveryListLine(lines, "missing", normalized.missing, ", ");
181
191
  appendRecoveryListLine(lines, "missing_required_fields", normalized.missing_required_fields, ", ");
182
192
  appendRecoveryListLine(lines, "suggested_flags", normalized.suggested_flags, ", ");
193
+ appendRecoveryListLine(lines, "allowed_values", normalized.allowed_values, ", ");
194
+ appendRecoveryListLine(lines, "candidate_commands", normalized.candidate_commands, ", ");
195
+ if (typeof normalized.candidate_commands_total === "number") {
196
+ lines.push(` candidate_commands_total: ${String(normalized.candidate_commands_total)}`);
197
+ }
198
+ if (normalized.candidate_commands_truncated === true) {
199
+ lines.push(" candidate_commands_truncated: true");
200
+ }
183
201
  appendRecoveryTextLine(lines, "suggested_retry", normalized.suggested_retry);
184
202
  if (typeof normalized.retry_after_ms === "number") {
185
203
  lines.push(` retry_after_ms: ${normalized.retry_after_ms}`);
@@ -471,9 +489,7 @@ function buildLockConflictGuidance(rawMessage, message, context) {
471
489
  happened: message,
472
490
  required: "Wait for lock release, or use --force where supported if lock is stale and safe to override.",
473
491
  why: "Locking protects item files from concurrent write races.",
474
- examples: [
475
- "pm update pm-a1b2 --status in_progress --force",
476
- ],
492
+ examples: ["pm update pm-a1b2 --status in_progress --force"],
477
493
  }), rawMessage, context);
478
494
  }
479
495
  function buildPmMissingRequiredOptionGuidance(rawMessage, message, context) {
@@ -797,32 +813,36 @@ function buildUnknownOptionGuidance(message, commandName, context) {
797
813
  if (!unknownOption) {
798
814
  return null;
799
815
  }
816
+ const guidanceContext = context ?? {};
800
817
  const optionName = unknownOption[1];
801
- const suggestions = normalizeOptionFlags(context?.unknownOptionSuggestions);
802
- const retryCommand = context?.suggestedRetryCommand;
818
+ const suggestions = normalizeOptionFlags(guidanceContext.unknownOptionSuggestions) ?? [];
819
+ const retryCommand = guidanceContext.suggestedRetryCommand;
803
820
  if (commandName === "update" &&
804
821
  (optionName === "--file" || optionName === "--doc")) {
805
822
  return buildUnsupportedUpdateOptionGuidance(optionName, context, suggestions);
806
823
  }
807
- const otherCommands = normalizeContextList(context?.unknownOptionOtherCommands);
824
+ const otherCommands = normalizeContextList(guidanceContext.unknownOptionOtherCommands) ?? [];
825
+ const candidateTotal = guidanceContext.unknownOptionOtherCommandsTotal ??
826
+ otherCommands.length;
827
+ const proseCommands = otherCommands.slice(0, 3);
828
+ const proseRemainder = candidateTotal - proseCommands.length;
829
+ let proseRemainderText = "";
830
+ if (proseRemainder > 0) {
831
+ proseRemainderText = ` and ${String(proseRemainder)} more command path(s)`;
832
+ }
808
833
  const nextSteps = [
809
834
  "Run command help to confirm the exact option contracts for this command path.",
810
- ...(suggestions && suggestions.length > 0
811
- ? [`Nearest supported options: ${suggestions.join(", ")}`]
812
- : []),
813
- ...(otherCommands && otherCommands.length > 0
814
- ? [
815
- `${optionName} is a valid option on: ${otherCommands.join(", ")}. If you meant one of those, run that command instead.`,
816
- ]
817
- : []),
818
- ...(retryCommand
819
- ? [`Replay with suggested correction: ${retryCommand}`]
820
- : []),
821
- ];
822
- const examples = [
823
- ...(retryCommand ? [retryCommand] : []),
824
- `pm ${commandName ?? "<command>"} --help`,
825
- ];
835
+ suggestions.length
836
+ ? `Nearest supported options: ${suggestions.join(", ")}`
837
+ : undefined,
838
+ proseCommands.length
839
+ ? `${optionName} is accepted by ${proseCommands.join(", ")}${proseRemainderText}. Inspect those command contracts only if you intended a different operation.`
840
+ : undefined,
841
+ retryCommand
842
+ ? `Replay with suggested correction: ${retryCommand}`
843
+ : undefined,
844
+ ].filter((entry) => typeof entry === "string");
845
+ const examples = [retryCommand, `pm ${commandName ?? "<command>"} --help`].filter((entry) => typeof entry === "string");
826
846
  return makeGuidanceMessage({
827
847
  code: "unknown_option",
828
848
  title: `Unknown option ${optionName}`,
@@ -832,7 +852,10 @@ function buildUnknownOptionGuidance(message, commandName, context) {
832
852
  examples,
833
853
  nextSteps,
834
854
  recovery: buildCommanderRecoveryPayload(context, {
835
- suggested_flags: suggestions,
855
+ suggested_flags: suggestions.length > 0 ? suggestions : undefined,
856
+ candidate_commands: otherCommands,
857
+ candidate_commands_total: candidateTotal || undefined,
858
+ candidate_commands_truncated: guidanceContext.unknownOptionOtherCommandsTruncated,
836
859
  }),
837
860
  });
838
861
  }
@@ -884,6 +907,33 @@ function buildUnknownCommandGuidance(message, context) {
884
907
  recovery: buildCommanderRecoveryPayload(context),
885
908
  });
886
909
  }
910
+ function buildUnknownSubcommandGuidance(context) {
911
+ const commandPath = context?.unknownSubcommandPath?.trim();
912
+ const token = context?.unknownSubcommandToken?.trim();
913
+ const allowed = normalizeContextList(context?.unknownSubcommandAllowedValues);
914
+ if (!commandPath || !token || !allowed) {
915
+ return null;
916
+ }
917
+ const retryCommand = context?.suggestedRetryCommand;
918
+ return makeGuidanceMessage({
919
+ code: "unknown_subcommand",
920
+ title: `Unknown ${commandPath} subcommand ${token}`,
921
+ happened: `The positional token sequence "${token}" is not a declared ${commandPath} subcommand.`,
922
+ required: `Use one of: ${allowed.join(", ")}.`,
923
+ why: "Subcommands are single positional tokens; multi-word action names use hyphens.",
924
+ examples: [
925
+ ...(retryCommand ? [retryCommand] : []),
926
+ `pm ${commandPath} --help`,
927
+ ],
928
+ nextSteps: retryCommand
929
+ ? [`Retry with the declared hyphenated action: ${retryCommand}`]
930
+ : ["Choose one value from recovery.allowed_values."],
931
+ recovery: buildCommanderRecoveryPayload(context, {
932
+ allowed_values: allowed,
933
+ suggested_retry: retryCommand,
934
+ }),
935
+ });
936
+ }
887
937
  function buildLinkedTestValueNotQuotedGuidance(message, commandName, context) {
888
938
  if (!/too many arguments/i.test(message) || commandName !== "test") {
889
939
  return null;
@@ -990,6 +1040,7 @@ function buildCommanderErrorGuidance(rawMessage, commandName, allowedTypes, cont
990
1040
  buildMissingRequiredArgumentGuidance(message, commandName, context) ??
991
1041
  buildUnknownOptionGuidance(message, commandName, context) ??
992
1042
  buildUnknownCommandGuidance(message, context) ??
1043
+ buildUnknownSubcommandGuidance(context) ??
993
1044
  buildLinkedTestValueNotQuotedGuidance(message, commandName, context) ??
994
1045
  buildContextItemArgumentGuidance(message, commandName, context);
995
1046
  if (guidance) {
@@ -1083,4 +1134,4 @@ export const _testOnly = {
1083
1134
  resolveKnownPackageCommandHint,
1084
1135
  };
1085
1136
  //# sourceMappingURL=error-guidance.js.map
1086
- //# debugId=d9d3d041-587b-5660-a909-d0759998248d
1137
+ //# debugId=4d6caae5-76d6-5563-acb9-b435f8cdfe9c
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]="555e37d0-385a-5748-b0a5-760f48c94e90")}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]="80e9dea8-2bb3-50e7-b21e-50ec328c3d3d")}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";
@@ -138,6 +138,10 @@ function projectExistingRecoveryOptionalFields(existingRecovery) {
138
138
  "recovery_mode",
139
139
  "missing_required_fields",
140
140
  "suggested_flags",
141
+ "allowed_values",
142
+ "candidate_commands",
143
+ "candidate_commands_total",
144
+ "candidate_commands_truncated",
141
145
  "fallback_candidates",
142
146
  "next_best_command",
143
147
  ];
@@ -2455,4 +2459,4 @@ export const _testOnly = {
2455
2459
  wrapThrownErrorForSentry,
2456
2460
  };
2457
2461
  //# sourceMappingURL=main.js.map
2458
- //# debugId=555e37d0-385a-5748-b0a5-760f48c94e90
2462
+ //# debugId=80e9dea8-2bb3-50e7-b21e-50ec328c3d3d
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @module cli/register-assurance
3
+ *
4
+ * Thin Commander adapter over the transport-neutral public assurance action.
5
+ */
6
+ import type { Command } from "commander";
7
+ /** Register the declarative assurance command family. */
8
+ export declare function registerAssuranceCommand(program: Command): void;
@@ -0,0 +1,52 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1adbac08-0950-55be-82bf-cc4dc7b6ad18")}catch(e){}}();
3
+ import { ASSURANCE_ACTIONS, ASSURANCE_DECLARATION_KINDS, runAssuranceAction, } from "../sdk/governance/assurance-action.js";
4
+ import { printResult } from "../sdk/runtime-primitives.js";
5
+ import { getGlobalOptions, readOptionString } from "./registration-helpers.js";
6
+ async function runAssuranceCliAction(action, kindOrGate, id, options, command) {
7
+ const global = getGlobalOptions(command);
8
+ const isRun = action === "run";
9
+ const isVerdicts = action === "verdicts";
10
+ const result = await runAssuranceAction({
11
+ action,
12
+ ...(isRun || isVerdicts ? {} : { kind: kindOrGate }),
13
+ id: isRun || isVerdicts ? (id ?? kindOrGate) : id,
14
+ definition: readOptionString(options, "definition"),
15
+ trigger: readOptionString(options, "trigger"),
16
+ tree: readOptionString(options, "tree"),
17
+ gate: readOptionString(options, "gate"),
18
+ limit: readOptionString(options, "limit"),
19
+ dry_run: options.dryRun === true,
20
+ fullChangedFields: global.fullChangedFields,
21
+ idOnly: global.idOnly,
22
+ author: readOptionString(options, "author"),
23
+ message: readOptionString(options, "message"),
24
+ }, global);
25
+ printResult(result, global);
26
+ if (typeof result === "object" &&
27
+ result !== null &&
28
+ "exit_code" in result &&
29
+ result.exit_code === 1) {
30
+ process.exitCode = 1;
31
+ }
32
+ }
33
+ /** Register the declarative assurance command family. */
34
+ export function registerAssuranceCommand(program) {
35
+ program
36
+ .command("assurance")
37
+ .argument("<action>", `Action: ${ASSURANCE_ACTIONS.join(", ")}`)
38
+ .argument("[kind]", `Declaration kind: ${ASSURANCE_DECLARATION_KINDS.join(", ")}; for run this may be the gate id`)
39
+ .argument("[id]", "Declaration or gate id")
40
+ .description("Declare and evaluate SDK-owned project assurance contracts.")
41
+ .option("--definition <json>", "JSON declaration for put")
42
+ .option("--trigger <value>", "Gate lifecycle trigger")
43
+ .option("--tree <value>", "Commit, tree, or snapshot identity being judged")
44
+ .option("--gate <id>", "Filter verdict history by gate id")
45
+ .option("--limit <number>", "Maximum newest verdicts returned")
46
+ .option("--dry-run", "Evaluate a gate without appending a verdict")
47
+ .option("--author <value>", "Mutation author override")
48
+ .option("--message <value>", "Audited mutation rationale")
49
+ .action(runAssuranceCliAction);
50
+ }
51
+ //# sourceMappingURL=register-assurance.js.map
52
+ //# debugId=1adbac08-0950-55be-82bf-cc4dc7b6ad18
@@ -1,6 +1,7 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="dabf24f7-406d-57e0-af3c-25391325a1b4")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="452f6689-f5bd-5398-915b-52ce7e2fd55e")}catch(e){}}();
3
3
  import { runFilesLookup } from "../sdk/files.js";
4
+ import { parseSourceLineRange } from "../sdk/traceability/source-traceability.js";
4
5
  import { EXIT_CODE, PmCliError } from "../sdk/runtime-primitives.js";
5
6
  import { getGlobalOptions, printResult } from "./registration-helpers.js";
6
7
  function parseIntegerBound(flag, minimum) {
@@ -26,6 +27,13 @@ async function runFilesLookupAction(paths, options, command) {
26
27
  offset: typeof options.offset === "number" ? options.offset : undefined,
27
28
  noTruncate: options.noTruncate === true,
28
29
  strictRead: options.strictRead === true,
30
+ explain: options.explain === true,
31
+ lineRange: typeof options.lines === "string"
32
+ ? parseSourceLineRange(options.lines)
33
+ : undefined,
34
+ decisionDepth: typeof options.decisionDepth === "number"
35
+ ? options.decisionDepth
36
+ : undefined,
29
37
  }, globalOptions);
30
38
  printResult(result, globalOptions);
31
39
  }
@@ -39,8 +47,11 @@ export function registerFilesLookupCommand(filesCommand) {
39
47
  .option("--offset <n>", "Number of referencing items to skip", parseIntegerBound("--offset", 0))
40
48
  .option("--no-truncate", "Return every referencing item")
41
49
  .option("--strict-read", "Fail when any authoritative item cannot be read")
42
- .description("Find pm items that link the requested source paths.")
50
+ .option("--explain", "Include ranked source-to-work rationale")
51
+ .option("--lines <start:end>", "Attribute an inclusive source line range")
52
+ .option("--decision-depth <n>", "Maximum governing-decision relationship depth", parseIntegerBound("--decision-depth", 1))
53
+ .description("Find and explain pm items that govern requested source paths.")
43
54
  .action(runFilesLookupAction);
44
55
  }
45
56
  //# sourceMappingURL=register-files-lookup.js.map
46
- //# debugId=dabf24f7-406d-57e0-af3c-25391325a1b4
57
+ //# debugId=452f6689-f5bd-5398-915b-52ce7e2fd55e
@@ -1,6 +1,6 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e5b9b4c9-c2eb-5282-99da-702a8887c4e4")}catch(e){}}();
3
- import { resolveBodyFileContent, EXIT_CODE, splitCommaList, PmCliError, } from "../sdk/runtime-primitives.js";
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6c7d647c-e489-51e3-b84b-5b62b4114033")}catch(e){}}();
3
+ import { resolveBodyFileContent, EXIT_CODE, splitCommaList, PmCliError, createUnknownSubcommandError, } from "../sdk/runtime-primitives.js";
4
4
  import { CREATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS, PLAN_CREATE_METADATA_PARAMETER_KEYS, UPDATE_COMMANDER_OPTION_REGISTRATION_CONTRACTS, } from "../sdk/cli-contracts.js";
5
5
  import { BUILTIN_ITEM_TYPE_VALUES } from "../types/index.js";
6
6
  import { MERGE_DRIVER_ARTIFACT_VALUES, runMergeDriver, runMergeInstall, runMergeReconcile, runMergeReceiptReport, } from "./commands/merge.js";
@@ -675,7 +675,7 @@ function normalizePlanAliases(options) {
675
675
  normalized.blockedBy = planOptions.blockedBy;
676
676
  return normalized;
677
677
  }
678
- function assertKnownPlanSubcommand(subcommand, normalized, allowed) {
678
+ function assertKnownPlanSubcommand(normalized, allowed) {
679
679
  if (!normalized) {
680
680
  throw new PmCliError(`pm plan requires a subcommand. Allowed: ${allowed.join(", ")}`, EXIT_CODE.USAGE, {
681
681
  code: "missing_required_argument",
@@ -692,7 +692,15 @@ function assertKnownPlanSubcommand(subcommand, normalized, allowed) {
692
692
  const examples = normalized === "list" || normalized === "ls"
693
693
  ? ["pm list --type Plan", "pm list-all --type Plan"]
694
694
  : undefined;
695
- throw new PmCliError(`Unknown pm plan subcommand "${subcommand}". Allowed: ${allowed.join(", ")}`, EXIT_CODE.USAGE, examples ? { code: "unknown_subcommand", examples } : undefined);
695
+ throw createUnknownSubcommandError({
696
+ command_path: "plan",
697
+ token: normalized,
698
+ allowed,
699
+ examples,
700
+ retry_command: normalized === "list" || normalized === "ls"
701
+ ? "pm list --type Plan"
702
+ : undefined,
703
+ });
696
704
  }
697
705
  function parsePlanReorderTo(normalizedSubcommand, reorderToken) {
698
706
  if (normalizedSubcommand !== "reorder-step" ||
@@ -709,7 +717,7 @@ async function runPlanAction(subcommand, id, stepRef, reorderToken, options, com
709
717
  const globalOptions = getGlobalOptions(command);
710
718
  const startedAt = Date.now();
711
719
  const normalizedSubcommand = (subcommand ?? "").trim().toLowerCase();
712
- assertKnownPlanSubcommand(subcommand, normalizedSubcommand, PLAN_SUBCOMMANDS);
720
+ assertKnownPlanSubcommand(normalizedSubcommand, PLAN_SUBCOMMANDS);
713
721
  const planOptions = normalizePlanAliases(options);
714
722
  const reorderTo = parsePlanReorderTo(normalizedSubcommand, reorderToken);
715
723
  const planId = normalizedSubcommand === "create" &&
@@ -812,7 +820,12 @@ async function runMergeAction(subcommand, artifact, base, ours, theirs, options,
812
820
  await runMergeDriverSubcommand(artifact, base, ours, theirs, options, globalOptions);
813
821
  break;
814
822
  default:
815
- throw new PmCliError(`Unknown merge subcommand "${subcommand}". Supported subcommands: install, reconcile, report, driver.`, EXIT_CODE.USAGE);
823
+ throw createUnknownSubcommandError({
824
+ command_path: "merge",
825
+ token: subcommand,
826
+ allowed: ["install", "reconcile", "report", "driver"],
827
+ display_name: "merge",
828
+ });
816
829
  }
817
830
  if (globalOptions.profile) {
818
831
  printError(`profile:command=merge took_ms=${Date.now() - startedAt}`);
@@ -890,7 +903,11 @@ async function runSchemaAction(subcommand, name, options, command) {
890
903
  normalizedSubcommand = "add-type";
891
904
  }
892
905
  if (!SCHEMA_SUBCOMMANDS.includes(normalizedSubcommand)) {
893
- throw new PmCliError(`Unknown pm schema subcommand "${subcommand}". Allowed: ${SCHEMA_SUBCOMMANDS.join(", ")}`, EXIT_CODE.USAGE, { code: "unknown_subcommand" });
906
+ throw createUnknownSubcommandError({
907
+ command_path: "schema",
908
+ token: normalizedSubcommand,
909
+ allowed: SCHEMA_SUBCOMMANDS,
910
+ });
894
911
  }
895
912
  const result = await dispatchSchemaSubcommand(schemaModule, {
896
913
  normalizedSubcommand,
@@ -1070,7 +1087,11 @@ async function runProfileAction(subcommand, name, options, command) {
1070
1087
  });
1071
1088
  }
1072
1089
  if (!PROFILE_SUBCOMMANDS.includes(normalizedSubcommand)) {
1073
- throw new PmCliError(`Unknown pm profile subcommand "${subcommand}". Allowed: ${PROFILE_SUBCOMMANDS.join(", ")}`, EXIT_CODE.USAGE, { code: "unknown_subcommand" });
1090
+ throw createUnknownSubcommandError({
1091
+ command_path: "profile",
1092
+ token: normalizedSubcommand,
1093
+ allowed: PROFILE_SUBCOMMANDS,
1094
+ });
1074
1095
  }
1075
1096
  const result = await dispatchProfileSubcommand(profileModule, normalizedSubcommand, name, options, globalOptions);
1076
1097
  // Profile inspection and schema staging do not mutate item content, so search caches stay valid (mirrors pm schema).
@@ -1817,4 +1838,4 @@ export function registerMutationCommands(program, registrationOptions = {}) {
1817
1838
  .action(runDepsAction);
1818
1839
  }
1819
1840
  //# sourceMappingURL=register-mutation.js.map
1820
- //# debugId=e5b9b4c9-c2eb-5282-99da-702a8887c4e4
1841
+ //# debugId=6c7d647c-e489-51e3-b84b-5b62b4114033
@@ -1,6 +1,6 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4856ec1e-7841-5ad0-95e3-6e3057ed999c")}catch(e){}}();
3
- import { resolveRuntimeStatusRegistry, setActiveCommandResult, EXIT_CODE, PmCliError, resolveAuthor, resolvePmRoot, readSettings, } from "../sdk/runtime-primitives.js";
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8bd1cf90-5ac8-5470-903d-b9b61d62bb85")}catch(e){}}();
3
+ import { resolveRuntimeStatusRegistry, setActiveCommandResult, EXIT_CODE, PmCliError, createUnknownSubcommandError, resolveAuthor, resolvePmRoot, readSettings, } from "../sdk/runtime-primitives.js";
4
4
  import { resolveStartTaskInProgressStatus } from "../sdk/start-task-status.js";
5
5
  import { parseStatsAnalyticsJson } from "./stats-analytics-json.js";
6
6
  import { createWorkspaceSnapshot, deleteWorkspaceSnapshot, inspectWorkspaceSnapshot, listWorkspaceSnapshots, planWorkspaceSnapshotRestore, restoreWorkspaceSnapshotWithRecovery, } from "../sdk/workspace-snapshot.js";
@@ -19,6 +19,7 @@ import { runStartBackgroundRun, runTestRunsWorker, } from "./commands/test-runs.
19
19
  import { runUpdate } from "./commands/update.js";
20
20
  import { runValidate } from "./commands/validate.js";
21
21
  import { buildBackgroundTestAllCommandArgs, applyActiveCommandResultService, buildBackgroundTestCommandArgs, addHiddenOption, collect, getGlobalOptions, invalidateSearchCachesForMutation, printError, printResult, readOptionString, } from "./registration-helpers.js";
22
+ import { registerAssuranceCommand } from "./register-assurance.js";
22
23
  function resolveTelemetrySubcommand(namespaceOrSubcommand, subcommand) {
23
24
  const normalizedNamespace = namespaceOrSubcommand?.trim().toLowerCase();
24
25
  const normalizedSubcommand = subcommand?.trim().toLowerCase();
@@ -31,13 +32,13 @@ function resolveTelemetrySubcommand(namespaceOrSubcommand, subcommand) {
31
32
  : "status";
32
33
  }
33
34
  if (normalizedSubcommand !== undefined && normalizedSubcommand.length > 0) {
34
- throw new PmCliError(`Unknown pm telemetry path "${namespaceOrSubcommand} ${subcommand}". Use "pm telemetry ${namespaceOrSubcommand}" or legacy alias "pm telemetry local-analytics ${normalizedSubcommand}".`, EXIT_CODE.USAGE, {
35
- code: "unknown_subcommand",
35
+ throw createUnknownSubcommandError({
36
+ command_path: "telemetry",
37
+ token: `${namespaceOrSubcommand} ${subcommand}`,
38
+ allowed: ["status", "flush", "stats", "clear", "local-analytics"],
39
+ token_kind: "path",
36
40
  examples: [
37
- "pm telemetry status",
38
- "pm telemetry flush",
39
41
  "pm telemetry stats --limit 10",
40
- "pm telemetry clear",
41
42
  "pm telemetry local-analytics status --json",
42
43
  ],
43
44
  });
@@ -372,11 +373,14 @@ async function runWorkspaceSnapshotAction(action, target, options, command) {
372
373
  const pmRoot = resolvePmRoot(process.cwd(), globalOptions.path);
373
374
  const normalizedAction = action.trim().toLowerCase();
374
375
  if (!["create", "list", "inspect", "restore", "delete"].includes(normalizedAction)) {
375
- throw new PmCliError(`Unknown workspace snapshot action "${action}". Use create, list, inspect, restore, or delete.`, EXIT_CODE.USAGE, {
376
- code: "unknown_subcommand",
376
+ throw createUnknownSubcommandError({
377
+ command_path: "workspace snapshot",
378
+ token: action,
379
+ allowed: ["create", "list", "inspect", "restore", "delete"],
380
+ display_name: "workspace snapshot",
381
+ token_kind: "action",
377
382
  examples: [
378
383
  "pm workspace snapshot create before-migration",
379
- "pm workspace snapshot list",
380
384
  "pm workspace snapshot restore before-migration",
381
385
  ],
382
386
  });
@@ -555,6 +559,7 @@ function addLinkedTestExecutionOptions(command) {
555
559
  }
556
560
  /** Implements register operation commands for the public runtime surface of this module. */
557
561
  export function registerOperationCommands(program) {
562
+ registerAssuranceCommand(program);
558
563
  const testCommand = program
559
564
  .command("test")
560
565
  .argument("<id>", "Item id")
@@ -858,4 +863,4 @@ function registerSchedulingShortcutCommands(program) {
858
863
  });
859
864
  }
860
865
  //# sourceMappingURL=register-operations.js.map
861
- //# debugId=4856ec1e-7841-5ad0-95e3-6e3057ed999c
866
+ //# debugId=8bd1cf90-5ac8-5470-903d-b9b61d62bb85