@unbrained/pm-cli 2026.8.9 → 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 (249) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +142 -80
  3. package/dist/cli/commander-usage.js +94 -17
  4. package/dist/cli/error-guidance.d.ts +10 -0
  5. package/dist/cli/error-guidance.js +76 -25
  6. package/dist/cli/help-json-payload.js +51 -16
  7. package/dist/cli/main.js +11 -6
  8. package/dist/cli/register-assurance.d.ts +8 -0
  9. package/dist/cli/register-assurance.js +52 -0
  10. package/dist/cli/register-files-lookup.js +14 -3
  11. package/dist/cli/register-mutation.js +30 -9
  12. package/dist/cli/register-operations.js +16 -11
  13. package/dist/cli-bundle/bundle-manifest.json +163 -163
  14. package/dist/cli-bundle/chunks/{chunk-RJC7TPF4.js → chunk-2OOU2AFH.js} +2 -2
  15. package/dist/cli-bundle/chunks/chunk-2RA2YTHJ.js +33 -0
  16. package/dist/cli-bundle/chunks/chunk-A2SJGHSI.js +3 -0
  17. package/dist/cli-bundle/chunks/chunk-DSKYD4LG.js +13 -0
  18. package/dist/cli-bundle/chunks/chunk-HC3GM6YY.js +194 -0
  19. package/dist/cli-bundle/chunks/chunk-IUNRVDAI.js +2 -0
  20. package/dist/cli-bundle/chunks/chunk-W7CPZGSB.js +2 -0
  21. package/dist/cli-bundle/chunks/{chunk-YC3UF2IO.js → chunk-WMEZHCFI.js} +66 -60
  22. package/dist/cli-bundle/chunks/{chunk-GMX5YOI3.js → chunk-ZU34C3LH.js} +48 -48
  23. package/dist/cli-bundle/chunks/chunk-ZXOC6HG5.js +5 -0
  24. package/dist/cli-bundle/chunks/{register-list-query-BUE7PTCU.js → register-list-query-HAUXVUPY.js} +8 -8
  25. package/dist/cli-bundle/chunks/register-mutation-7Y5U7ABT.js +20 -0
  26. package/dist/cli-bundle/chunks/register-operations-EQX3DLAZ.js +2 -0
  27. package/dist/cli-bundle/chunks/{register-setup-UQDTNTLJ.js → register-setup-NOCOOWQY.js} +2 -2
  28. package/dist/cli-bundle/focused-chunks/{chunk-KNEHLPBF.js → chunk-23FTGO3W.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/{chunk-6DO4YQWZ.js → chunk-2DL3MRTD.js} +2 -2
  30. package/dist/cli-bundle/focused-chunks/chunk-3AYKXMYX.js +2 -0
  31. package/dist/cli-bundle/focused-chunks/chunk-4AHEC74N.js +2 -0
  32. package/dist/cli-bundle/focused-chunks/{chunk-MRWVJ3ZG.js → chunk-4H5IA6AV.js} +2 -2
  33. package/dist/cli-bundle/focused-chunks/chunk-4SV3ZKG3.js +16 -0
  34. package/dist/cli-bundle/focused-chunks/chunk-55BIB6DV.js +2 -0
  35. package/dist/cli-bundle/focused-chunks/chunk-6JW6Z2P5.js +8 -0
  36. package/dist/cli-bundle/focused-chunks/chunk-BKPIY34S.js +2 -0
  37. package/dist/cli-bundle/focused-chunks/chunk-D4PIWE6D.js +2 -0
  38. package/dist/cli-bundle/focused-chunks/chunk-DPO7TEFX.js +31 -0
  39. package/dist/cli-bundle/focused-chunks/{chunk-3WVHTUAW.js → chunk-E3KCL7AY.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/chunk-ERAAFLPS.js +153 -0
  41. package/dist/cli-bundle/focused-chunks/chunk-F6E4JZKG.js +2 -0
  42. package/dist/cli-bundle/focused-chunks/chunk-FPSYO5ZG.js +18 -0
  43. package/dist/cli-bundle/focused-chunks/{chunk-73FIJONU.js → chunk-J5EKAIVD.js} +2 -2
  44. package/dist/cli-bundle/focused-chunks/chunk-KDH5OX3D.js +4 -0
  45. package/dist/cli-bundle/focused-chunks/chunk-OJ3LVVIS.js +2 -0
  46. package/dist/cli-bundle/focused-chunks/chunk-TL5M2PAY.js +3 -0
  47. package/dist/cli-bundle/focused-chunks/chunk-UDAZWT25.js +6 -0
  48. package/dist/cli-bundle/focused-chunks/chunk-VABB4L5Y.js +17 -0
  49. package/dist/cli-bundle/main.js +13 -13
  50. package/dist/cli-bundle/sdk-authoring.js +1 -1
  51. package/dist/cli-bundle/sdk-contracts.js +1 -1
  52. package/dist/cli-bundle/sdk-core.js +41 -39
  53. package/dist/cli-bundle/sdk-governance.js +1 -1
  54. package/dist/cli-bundle/sdk-graph.js +1 -1
  55. package/dist/cli-bundle/sdk-merge.js +1 -1
  56. package/dist/cli-bundle/sdk-query.js +1 -1
  57. package/dist/cli-bundle/sdk-runtime.js +1 -1
  58. package/dist/cli-bundle/sdk-testing.js +1 -1
  59. package/dist/cli-bundle/sdk.js +2 -2
  60. package/dist/core/diagnostics/remediation.js +9 -9
  61. package/dist/core/fs/fs-utils.d.ts +10 -0
  62. package/dist/core/fs/fs-utils.js +16 -4
  63. package/dist/core/item/item-format.js +3 -32
  64. package/dist/core/schema/fields-file.d.ts +1 -2
  65. package/dist/core/schema/fields-file.js +4 -11
  66. package/dist/core/schema/runtime-schema.js +3 -10
  67. package/dist/core/schema/status-defs-file.d.ts +1 -2
  68. package/dist/core/schema/status-defs-file.js +4 -32
  69. package/dist/core/schema/status-token.d.ts +2 -0
  70. package/dist/core/schema/status-token.js +32 -0
  71. package/dist/core/schema/type-workflows.d.ts +1 -2
  72. package/dist/core/schema/type-workflows.js +4 -11
  73. package/dist/core/session/session-state.d.ts +47 -0
  74. package/dist/core/session/session-state.js +207 -6
  75. package/dist/core/shared/author.d.ts +8 -2
  76. package/dist/core/shared/author.js +85 -52
  77. package/dist/core/shared/errors.d.ts +12 -0
  78. package/dist/core/shared/errors.js +2 -2
  79. package/dist/core/shared/text-normalization.d.ts +1 -1
  80. package/dist/core/shared/text-normalization.js +2 -2
  81. package/dist/sdk/agent/command-recovery.d.ts +4 -0
  82. package/dist/sdk/agent/command-recovery.js +52 -0
  83. package/dist/sdk/agent/command-suggestions.d.ts +4 -0
  84. package/dist/sdk/agent/command-suggestions.js +67 -0
  85. package/dist/sdk/agent/create-option-policy.d.ts +12 -0
  86. package/dist/sdk/agent/create-option-policy.js +32 -0
  87. package/dist/sdk/agent/item-addressing.d.ts +19 -0
  88. package/dist/sdk/agent/item-addressing.js +208 -0
  89. package/dist/sdk/agent/refusal-reachability.d.ts +40 -0
  90. package/dist/sdk/agent/refusal-reachability.js +72 -0
  91. package/dist/sdk/agent/subcommand-recovery.d.ts +40 -0
  92. package/dist/sdk/agent/subcommand-recovery.js +84 -0
  93. package/dist/sdk/cli-bootstrap.d.ts +9 -1
  94. package/dist/sdk/cli-bootstrap.js +25 -10
  95. package/dist/sdk/cli-contracts/commander-mutation-options.js +16 -4
  96. package/dist/sdk/cli-contracts/completeness.js +13 -3
  97. package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
  98. package/dist/sdk/cli-contracts/enum-contracts.js +3 -2
  99. package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
  100. package/dist/sdk/cli-contracts/flag-contracts.js +77 -21
  101. package/dist/sdk/cli-contracts/registration-helpers.js +10 -2
  102. package/dist/sdk/cli-contracts/runtime-contracts.js +6 -3
  103. package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +513 -0
  104. package/dist/sdk/cli-contracts/schemas/assurance-definition.js +251 -0
  105. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +6 -0
  106. package/dist/sdk/cli-contracts/tool-option-contracts.js +4 -2
  107. package/dist/sdk/cli-contracts/tool-parameter-tables.js +96 -4
  108. package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
  109. package/dist/sdk/cli-contracts/tool-schema.js +49 -6
  110. package/dist/sdk/cli-contracts.d.ts +1 -1
  111. package/dist/sdk/cli-contracts.js +3 -3
  112. package/dist/sdk/completion.js +9 -3
  113. package/dist/sdk/config.js +9 -3
  114. package/dist/sdk/context/semantic-session-attribution.d.ts +32 -0
  115. package/dist/sdk/context/semantic-session-attribution.js +83 -0
  116. package/dist/sdk/context-intent-runtime.js +8 -5
  117. package/dist/sdk/context-signal-store.d.ts +34 -0
  118. package/dist/sdk/context-signal-store.js +24 -2
  119. package/dist/sdk/core-governance.d.ts +3 -1
  120. package/dist/sdk/core-governance.js +5 -3
  121. package/dist/sdk/core.d.ts +1 -1
  122. package/dist/sdk/core.js +2 -2
  123. package/dist/sdk/dependency-flag-validation.d.ts +15 -1
  124. package/dist/sdk/dependency-flag-validation.js +54 -2
  125. package/dist/sdk/error-code-catalog.d.ts +13 -0
  126. package/dist/sdk/error-code-catalog.js +35 -2
  127. package/dist/sdk/extension.js +18 -17
  128. package/dist/sdk/files.d.ts +11 -0
  129. package/dist/sdk/files.js +82 -24
  130. package/dist/sdk/generated-error-code-catalog.js +104 -13
  131. package/dist/sdk/governance/assurance-action-contracts.d.ts +7 -0
  132. package/dist/sdk/governance/assurance-action-contracts.js +5 -0
  133. package/dist/sdk/governance/assurance-action.d.ts +70 -0
  134. package/dist/sdk/governance/assurance-action.js +198 -0
  135. package/dist/sdk/governance/assurance-limits.d.ts +7 -0
  136. package/dist/sdk/governance/assurance-limits.js +11 -0
  137. package/dist/sdk/governance/assurance-runtime.d.ts +20 -0
  138. package/dist/sdk/governance/assurance-runtime.js +131 -0
  139. package/dist/sdk/governance/assurance.d.ts +432 -0
  140. package/dist/sdk/governance/assurance.js +689 -0
  141. package/dist/sdk/governance/health.js +14 -7
  142. package/dist/sdk/governance/provenance-health.d.ts +13 -0
  143. package/dist/sdk/governance/provenance-health.js +63 -17
  144. package/dist/sdk/governance/validate-item-reader.d.ts +13 -0
  145. package/dist/sdk/governance/validate-item-reader.js +18 -0
  146. package/dist/sdk/governance/validate.d.ts +2 -2
  147. package/dist/sdk/governance/validate.js +15 -6
  148. package/dist/sdk/graph/run.js +8 -3
  149. package/dist/sdk/index.d.ts +10 -1
  150. package/dist/sdk/index.js +12 -3
  151. package/dist/sdk/lifecycle/claim.js +18 -3
  152. package/dist/sdk/lifecycle/close.js +17 -14
  153. package/dist/sdk/lifecycle/create.d.ts +2 -0
  154. package/dist/sdk/lifecycle/create.js +62 -9
  155. package/dist/sdk/lifecycle/focus.js +13 -3
  156. package/dist/sdk/lifecycle/plan.js +8 -3
  157. package/dist/sdk/lifecycle/update-many.js +39 -27
  158. package/dist/sdk/lifecycle/update.d.ts +6 -1
  159. package/dist/sdk/lifecycle/update.js +47 -10
  160. package/dist/sdk/merge/index.d.ts +1 -1
  161. package/dist/sdk/merge/index.js +3 -3
  162. package/dist/sdk/merge/install.d.ts +4 -0
  163. package/dist/sdk/merge/install.js +28 -16
  164. package/dist/sdk/merge/receipts.d.ts +3 -0
  165. package/dist/sdk/merge/receipts.js +81 -17
  166. package/dist/sdk/output-projection.js +24 -4
  167. package/dist/sdk/provenance.d.ts +38 -0
  168. package/dist/sdk/provenance.js +64 -2
  169. package/dist/sdk/query/context.d.ts +2 -0
  170. package/dist/sdk/query/context.js +24 -10
  171. package/dist/sdk/query/light-metadata.d.ts +3 -0
  172. package/dist/sdk/query/light-metadata.js +19 -0
  173. package/dist/sdk/runtime-extended-actions.js +22 -5
  174. package/dist/sdk/runtime-primitives.d.ts +2 -0
  175. package/dist/sdk/runtime-primitives.js +4 -2
  176. package/dist/sdk/runtime.d.ts +8 -1
  177. package/dist/sdk/runtime.js +37 -28
  178. package/dist/sdk/schema-migration.js +7 -9
  179. package/dist/sdk/similarity-scoring.d.ts +1 -2
  180. package/dist/sdk/similarity-scoring.js +4 -16
  181. package/dist/sdk/telemetry.js +7 -4
  182. package/dist/sdk/traceability/runtime-files-lookup.d.ts +8 -0
  183. package/dist/sdk/traceability/runtime-files-lookup.js +33 -0
  184. package/dist/sdk/traceability/source-traceability.d.ts +102 -0
  185. package/dist/sdk/traceability/source-traceability.js +293 -0
  186. package/dist/sdk/workspace-snapshot.d.ts +4 -0
  187. package/dist/sdk/workspace-snapshot.js +24 -11
  188. package/dist/types.d.ts +8 -2
  189. package/dist/types.js +2 -2
  190. package/docs/AGENT_GUIDE.md +3 -1
  191. package/docs/ASSURANCE.md +132 -0
  192. package/docs/COMMANDS.md +8 -5
  193. package/docs/MERGE_SAFETY.md +7 -5
  194. package/docs/README.md +3 -5
  195. package/docs/READ_OUTPUT_CONTRACTS.md +2 -2
  196. package/docs/RELEASING.md +9 -5
  197. package/docs/SDK.md +44 -8
  198. package/docs/SDK_AGENT_SESSION_CONTEXT.md +43 -6
  199. package/docs/SDK_CONTEXT.md +97 -0
  200. package/docs/SDK_CONTEXT_INTEGRITY.md +18 -3
  201. package/docs/SDK_EVIDENCE_TRACEABILITY.md +39 -1
  202. package/docs/SDK_RUNTIME_BOUNDARIES.md +36 -1
  203. package/docs/TESTING.md +12 -9
  204. package/docs/agent-task-token-baseline.json +2 -2
  205. package/docs/generated/AGENT_COMMAND_SURFACE.md +1 -0
  206. package/marketplace.json +2 -2
  207. package/package.json +7 -6
  208. package/packages/pm-beads/package.json +1 -1
  209. package/packages/pm-calendar/package.json +1 -1
  210. package/packages/pm-command-kit/package.json +1 -1
  211. package/packages/pm-digital-twin/package.json +1 -1
  212. package/packages/pm-governance-audit/package.json +1 -1
  213. package/packages/pm-guide-shell/package.json +1 -1
  214. package/packages/pm-kanban/package.json +1 -1
  215. package/packages/pm-lifecycle-hooks/package.json +1 -1
  216. package/packages/pm-linked-test-adapters/package.json +1 -1
  217. package/packages/pm-search-advanced/package.json +1 -1
  218. package/packages/pm-templates/extensions/templates/index.ts +9 -3
  219. package/packages/pm-templates/package.json +1 -1
  220. package/packages/pm-todos/package.json +1 -1
  221. package/packages/pm-vcs/package.json +1 -1
  222. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  223. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  224. package/sdk/public-surface.json +1028 -48
  225. package/dist/cli-bundle/chunks/chunk-2DTCZXSD.js +0 -13
  226. package/dist/cli-bundle/chunks/chunk-5JO6R4BS.js +0 -3
  227. package/dist/cli-bundle/chunks/chunk-5KN4DZYV.js +0 -194
  228. package/dist/cli-bundle/chunks/chunk-EF43KODO.js +0 -2
  229. package/dist/cli-bundle/chunks/chunk-HUV2Z7IS.js +0 -28
  230. package/dist/cli-bundle/chunks/chunk-MHBVCUF2.js +0 -2
  231. package/dist/cli-bundle/chunks/chunk-PYO5GZU6.js +0 -5
  232. package/dist/cli-bundle/chunks/register-mutation-FC3XLVIK.js +0 -20
  233. package/dist/cli-bundle/chunks/register-operations-YH2WAOXU.js +0 -2
  234. package/dist/cli-bundle/focused-chunks/chunk-2VVP5RAA.js +0 -153
  235. package/dist/cli-bundle/focused-chunks/chunk-3GSFUDAI.js +0 -2
  236. package/dist/cli-bundle/focused-chunks/chunk-4H6MVCK3.js +0 -16
  237. package/dist/cli-bundle/focused-chunks/chunk-54TZJ4BM.js +0 -2
  238. package/dist/cli-bundle/focused-chunks/chunk-5NK5TJ5D.js +0 -2
  239. package/dist/cli-bundle/focused-chunks/chunk-C3GCHDSQ.js +0 -31
  240. package/dist/cli-bundle/focused-chunks/chunk-JGRSQZJT.js +0 -18
  241. package/dist/cli-bundle/focused-chunks/chunk-NL57J7BZ.js +0 -4
  242. package/dist/cli-bundle/focused-chunks/chunk-P6BBIQRG.js +0 -6
  243. package/dist/cli-bundle/focused-chunks/chunk-PZAGVQNN.js +0 -3
  244. package/dist/cli-bundle/focused-chunks/chunk-QDAO3XEK.js +0 -14
  245. package/dist/cli-bundle/focused-chunks/chunk-T4IGQCSY.js +0 -2
  246. package/dist/cli-bundle/focused-chunks/chunk-U46GQJNY.js +0 -2
  247. package/dist/cli-bundle/focused-chunks/chunk-VRXJSGIT.js +0 -8
  248. package/dist/cli-bundle/focused-chunks/chunk-XC2ZW3CJ.js +0 -2
  249. package/dist/cli-bundle/focused-chunks/chunk-ZG54B4XG.js +0 -2
@@ -1,14 +1,16 @@
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]="042ecf17-9265-5496-bbee-4e7a07371618")}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
+ import { rankCommandPaths } from "../sdk/agent/command-suggestions.js";
13
+ import { renderMissingOptionRetry } from "../sdk/agent/command-recovery.js";
12
14
  /** Supported values accepted by the builtin type help contract. */
13
15
  export const BUILTIN_TYPE_HELP_VALUES = BUILTIN_ITEM_TYPE_VALUES.join("|");
14
16
  const OPTIONAL_PACKAGE_INSTALL_HINTS = {
@@ -52,6 +54,23 @@ const SEMANTIC_UNKNOWN_OPTION_SUGGESTIONS = {
52
54
  "--tag": ["--tags"],
53
55
  },
54
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
+ ];
55
74
  function getSemanticUnknownOptionSuggestions(commandName, unknownOption) {
56
75
  const commandSuggestions = SEMANTIC_UNKNOWN_OPTION_SUGGESTIONS[commandName];
57
76
  if (!commandSuggestions) {
@@ -333,9 +352,17 @@ function findOtherCommandsForFlag(unknownOption, currentCommand) {
333
352
  return [];
334
353
  }
335
354
  const normalizedCurrent = currentCommand?.trim().toLowerCase();
355
+ const currentFlags = new Set(collectKnownLongFlags(normalizedCurrent));
336
356
  return commands
337
357
  .filter((command) => command !== normalizedCurrent)
338
- .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);
339
366
  }
340
367
  function rewriteUnknownOptionArgv(argv, unknownOption, replacementFlag) {
341
368
  for (let index = 0; index < argv.length; index += 1) {
@@ -388,9 +415,14 @@ function scoreRuntimeCommandCandidates(params) {
388
415
  .map(([commandPath]) => commandPath);
389
416
  }
390
417
  function resolveUnknownCommandCandidates(params) {
418
+ const semanticCandidates = rankCommandPaths(params.commandPaths, params.primaryToken);
391
419
  const rankedCandidates = scoreRuntimeCommandCandidates(params);
392
420
  const installedPackageCandidates = collectInstalledPackageCommandPathHints(params.primaryToken, params.extensionDescriptors).filter((commandPath) => params.commandPaths.includes(commandPath));
393
- return dedupeStrings([...rankedCandidates, ...installedPackageCandidates]);
421
+ return dedupeStrings([
422
+ ...semanticCandidates,
423
+ ...rankedCandidates,
424
+ ...installedPackageCandidates,
425
+ ]);
394
426
  }
395
427
  function resolveUnknownCommandFallbacks(commandPaths) {
396
428
  const topLevel = [
@@ -556,15 +588,42 @@ function resolveSuggestedRetryForMissingOption(message, invocationArgv) {
556
588
  if (!requiredOptionToken?.startsWith("--")) {
557
589
  return undefined;
558
590
  }
559
- const hasFlag = invocationArgv.some((token) => token === requiredOptionToken ||
560
- token.startsWith(`${requiredOptionToken}=`));
561
- return hasFlag
562
- ? undefined
563
- : renderAttemptedCommand([
564
- ...invocationArgv,
565
- requiredOptionToken,
566
- "<value>",
567
- ]);
591
+ const commandName = parseBootstrapCommandName(invocationArgv);
592
+ if (!commandName) {
593
+ return undefined;
594
+ }
595
+ return renderMissingOptionRetry(invocationArgv, commandName, [
596
+ requiredOptionToken,
597
+ ]);
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
+ };
568
627
  }
569
628
  /** Implements resolve commander usage context for the public runtime surface of this module. */
570
629
  export async function resolveCommanderUsageContext(error, rootProgram, extensionDescriptors, guidanceOverrides = {}) {
@@ -580,7 +639,10 @@ export async function resolveCommanderUsageContext(error, rootProgram, extension
580
639
  const allowedTypes = await resolveAllowedTypesForUsage(bootstrapGlobal);
581
640
  const unknownCommandGuidance = buildUnknownCommandGuidanceFromRuntime(message, rootProgram, extensionDescriptors);
582
641
  const unknownOption = resolveUnknownOptionSuggestions(message, commandName);
583
- 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);
584
646
  return {
585
647
  message,
586
648
  commandName,
@@ -590,9 +652,14 @@ export async function resolveCommanderUsageContext(error, rootProgram, extension
590
652
  providedOptionFlags,
591
653
  unknownOptionSuggestions: unknownOption.suggestions,
592
654
  unknownOptionOtherCommands: unknownOption.otherCommands.length > 0
593
- ? unknownOption.otherCommands
655
+ ? unknownOption.otherCommands.slice(0, 12)
656
+ : undefined,
657
+ unknownOptionOtherCommandsTotal: unknownOption.otherCommands.length > 0
658
+ ? unknownOption.otherCommands.length
594
659
  : undefined,
660
+ unknownOptionOtherCommandsTruncated: unknownOption.otherCommands.length > 12 || undefined,
595
661
  suggestedRetryCommand,
662
+ ...splitSchemaSubcommand,
596
663
  ...unknownCommandGuidance,
597
664
  ...guidanceOverrides,
598
665
  };
@@ -600,7 +667,7 @@ export async function resolveCommanderUsageContext(error, rootProgram, extension
600
667
  /** Implements format commander usage message for the public runtime surface of this module. */
601
668
  export async function formatCommanderUsageMessage(error, rootProgram, extensionDescriptors, guidanceOverrides = {}) {
602
669
  const usageContext = await resolveCommanderUsageContext(error, rootProgram, extensionDescriptors, guidanceOverrides);
603
- 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;
604
671
  const formatted = formatCommanderErrorForDisplay(message, commandName, allowedTypes, {
605
672
  unknownCommandExamples,
606
673
  unknownCommandNextSteps,
@@ -609,6 +676,11 @@ export async function formatCommanderUsageMessage(error, rootProgram, extensionD
609
676
  providedOptionFlags,
610
677
  unknownOptionSuggestions,
611
678
  unknownOptionOtherCommands,
679
+ unknownOptionOtherCommandsTotal,
680
+ unknownOptionOtherCommandsTruncated,
681
+ unknownSubcommandPath,
682
+ unknownSubcommandToken,
683
+ unknownSubcommandAllowedValues,
612
684
  suggestedRetryCommand,
613
685
  failedExtensions,
614
686
  });
@@ -633,6 +705,11 @@ export async function formatCommanderUsageJson(error, rootProgram, extensionDesc
633
705
  providedOptionFlags: usageContext.providedOptionFlags,
634
706
  unknownOptionSuggestions: usageContext.unknownOptionSuggestions,
635
707
  unknownOptionOtherCommands: usageContext.unknownOptionOtherCommands,
708
+ unknownOptionOtherCommandsTotal: usageContext.unknownOptionOtherCommandsTotal,
709
+ unknownOptionOtherCommandsTruncated: usageContext.unknownOptionOtherCommandsTruncated,
710
+ unknownSubcommandPath: usageContext.unknownSubcommandPath,
711
+ unknownSubcommandToken: usageContext.unknownSubcommandToken,
712
+ unknownSubcommandAllowedValues: usageContext.unknownSubcommandAllowedValues,
636
713
  suggestedRetryCommand: usageContext.suggestedRetryCommand,
637
714
  failedExtensions: usageContext.failedExtensions,
638
715
  });
@@ -647,4 +724,4 @@ export const _testOnly = {
647
724
  suggestNearestLongFlags,
648
725
  };
649
726
  //# sourceMappingURL=commander-usage.js.map
650
- //# debugId=042ecf17-9265-5496-bbee-4e7a07371618
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
@@ -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]="a33bada3-c1a1-5343-8a77-51dc76dd5a11")}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]="42b9782e-2151-54b0-98ce-8c5ae810c424")}catch(e){}}();
3
3
  import { hasSubcommandFlagContractsForCommand, PM_CORE_COMMAND_NAMES, } from "../sdk/cli-contracts.js";
4
4
  import { commandOptionFlagLabel, resolveCommandOptionPolicyState, resolveTypeDefinition, EXIT_CODE, printError, writeStdout, } from "../sdk/runtime-primitives.js";
5
5
  import { buildDynamicExtensionHelpOptionSummaries, mergeHelpOptionSummaries, findCommandByPath, findDirectChildCommand, commandAliases, } from "./extension-command-help.js";
@@ -9,6 +9,7 @@ import { parseBootstrapGlobalOptions, parseBootstrapHelpRequest, parseBootstrapC
9
9
  import { extractProvidedOptionFlags, renderPmCommand } from "./argv-utils.js";
10
10
  import { formatCommanderErrorForJson } from "./error-guidance.js";
11
11
  import { BUILTIN_TYPE_HELP_VALUES, buildUnknownCommandGuidanceFromRuntime, } from "./commander-usage.js";
12
+ import { resolveCreateExplicitEmptyFlag } from "../sdk/agent/create-option-policy.js";
12
13
  function resolveCommandFromPathTokens(root, pathTokens) {
13
14
  if (pathTokens.length === 0) {
14
15
  return root;
@@ -303,6 +304,39 @@ function appendTypeOptionHelpLines(lines, typeDefinition) {
303
304
  }
304
305
  }
305
306
  }
307
+ function buildCreatePolicyRequiredSets(commandName, typeDefinition) {
308
+ const progressive = commandName === "create"
309
+ ? new Set(["title", "type"])
310
+ : new Set();
311
+ const strict = new Set(progressive);
312
+ if (commandName === "create") {
313
+ for (const option of [
314
+ ...typeDefinition.required_create_fields,
315
+ ...typeDefinition.required_create_repeatables,
316
+ ]) {
317
+ strict.add(option);
318
+ }
319
+ }
320
+ return { progressive, strict };
321
+ }
322
+ function appendStrictCreatePolicyHelpLines(lines, typeDefinition, progressiveRequired, strictRequired) {
323
+ const progressive = new Set(progressiveRequired);
324
+ const strictOnly = strictRequired.filter((option) => !progressive.has(option));
325
+ const toFlags = (options) => options.length > 0
326
+ ? options
327
+ .map((option) => commandOptionFlagLabel("create", option))
328
+ .join(", ")
329
+ : "none";
330
+ lines.push(` required in strict mode: ${toFlags(strictOnly)}`);
331
+ const explicitEmptyFlags = strictOnly
332
+ .map(resolveCreateExplicitEmptyFlag)
333
+ .filter((flag) => flag !== undefined);
334
+ lines.push(` explicit empty assertion: ${explicitEmptyFlags.length > 0 ? explicitEmptyFlags.join(", ") : "none"}`);
335
+ if (["Reminder", "Meeting", "Event"].includes(typeDefinition.name)) {
336
+ lines.push(" schedule preset: --schedule-preset lightweight switches schedule artifacts to progressive required-option policy.");
337
+ lines.push(" strict parity remains available via --create-mode strict.");
338
+ }
339
+ }
306
340
  function buildCreateUpdatePolicyHelpText(commandName, typeRegistry, argv) {
307
341
  const selectedTypeRaw = parseBootstrapTypeValue(argv);
308
342
  if (!selectedTypeRaw) {
@@ -317,16 +351,18 @@ function buildCreateUpdatePolicyHelpText(commandName, typeRegistry, argv) {
317
351
  ` active type values: ${allowed}`,
318
352
  ].join("\n");
319
353
  }
320
- const baseRequired = commandName === "create"
321
- ? new Set([
322
- "title",
323
- "description",
324
- "type",
325
- ...typeDefinition.required_create_fields,
326
- ...typeDefinition.required_create_repeatables,
327
- ])
328
- : new Set();
329
- const policyState = resolveCommandOptionPolicyState(typeDefinition, commandName, baseRequired);
354
+ const argumentTerminatorIndex = argv.indexOf("--");
355
+ const optionArgv = argumentTerminatorIndex < 0 ? argv : argv.slice(0, argumentTerminatorIndex);
356
+ const createModeTokenIndex = optionArgv.findIndex((token) => token === "--create-mode" || token.startsWith("--create-mode="));
357
+ const createModeToken = createModeTokenIndex < 0
358
+ ? undefined
359
+ : optionArgv[createModeTokenIndex]?.startsWith("--create-mode=")
360
+ ? optionArgv[createModeTokenIndex]?.slice("--create-mode=".length)
361
+ : optionArgv[createModeTokenIndex + 1];
362
+ const strictCreateMode = commandName === "create" && createModeToken?.toLowerCase() === "strict";
363
+ const requiredSets = buildCreatePolicyRequiredSets(commandName, typeDefinition);
364
+ const progressivePolicyState = resolveCommandOptionPolicyState(typeDefinition, commandName, requiredSets.progressive);
365
+ const policyState = resolveCommandOptionPolicyState(typeDefinition, commandName, strictCreateMode ? requiredSets.strict : requiredSets.progressive);
330
366
  const toFlags = (options) => options.length > 0
331
367
  ? options
332
368
  .map((option) => commandOptionFlagLabel(commandName, option))
@@ -339,10 +375,9 @@ function buildCreateUpdatePolicyHelpText(commandName, typeRegistry, argv) {
339
375
  ` disabled: ${toFlags(policyState.disabled)}`,
340
376
  ` hidden: ${toFlags(policyState.hidden)}`,
341
377
  ];
342
- if (commandName === "create" &&
343
- ["Reminder", "Meeting", "Event"].includes(typeDefinition.name)) {
344
- lines.push(" schedule preset: --schedule-preset lightweight switches schedule artifacts to progressive required-option policy.");
345
- lines.push(" strict parity remains available via --create-mode strict.");
378
+ if (commandName === "create") {
379
+ const strictPolicyState = resolveCommandOptionPolicyState(typeDefinition, commandName, requiredSets.strict);
380
+ appendStrictCreatePolicyHelpLines(lines, typeDefinition, progressivePolicyState.required, strictPolicyState.required);
346
381
  }
347
382
  appendTypeOptionHelpLines(lines, typeDefinition);
348
383
  if (policyState.errors.length > 0) {
@@ -376,4 +411,4 @@ export const _testOnly = {
376
411
  resolveCommandFromPathTokens,
377
412
  };
378
413
  //# sourceMappingURL=help-json-payload.js.map
379
- //# debugId=a33bada3-c1a1-5343-8a77-51dc76dd5a11
414
+ //# debugId=42b9782e-2151-54b0-98ce-8c5ae810c424
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]="52c705ab-a5c4-5b94-b806-4eaac31b6e9c")}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
  ];
@@ -2307,13 +2311,14 @@ export async function runPmCli(rawArgv = process.argv.slice(2)) {
2307
2311
  runtimeExtensionDiscoverySnapshotCache = null;
2308
2312
  activeRuntimeExtensionCommandDescriptors = new Map();
2309
2313
  resetActiveExtensionRuntimeState();
2310
- const bootstrapInvocation = normalizeBootstrapInvocation(rawArgv);
2311
- const invocationArgv = bootstrapInvocation.argv;
2312
- const invocationProcessArgv = [process.argv[0], process.argv[1], ...invocationArgv];
2313
- const isBareInvocation = invocationArgv.length === 0;
2314
+ let invocationArgv = [...rawArgv];
2314
2315
  let restorePmAuthor;
2315
2316
  let restorePagerPolicy;
2316
2317
  try {
2318
+ const bootstrapInvocation = normalizeBootstrapInvocation(rawArgv);
2319
+ invocationArgv = bootstrapInvocation.argv;
2320
+ const invocationProcessArgv = [process.argv[0], process.argv[1], ...invocationArgv];
2321
+ const isBareInvocation = invocationArgv.length === 0;
2317
2322
  const bootstrapGlobal = parseBootstrapGlobalOptions(invocationArgv);
2318
2323
  if (bootstrapGlobal.authorMissingValue) {
2319
2324
  throw new PmCliError("--author requires a non-empty value.", EXIT_CODE.USAGE, {
@@ -2454,4 +2459,4 @@ export const _testOnly = {
2454
2459
  wrapThrownErrorForSentry,
2455
2460
  };
2456
2461
  //# sourceMappingURL=main.js.map
2457
- //# debugId=52c705ab-a5c4-5b94-b806-4eaac31b6e9c
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