@unbrained/pm-cli 2026.8.22 → 2026.8.24

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 (229) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +42 -1
  3. package/dist/cli/description-stdin.js +5 -4
  4. package/dist/cli/error-guidance.d.ts +13 -0
  5. package/dist/cli/error-guidance.js +62 -6
  6. package/dist/cli/extension-command-help.d.ts +5 -0
  7. package/dist/cli/extension-command-help.js +6 -2
  8. package/dist/cli/help-content.d.ts +5 -0
  9. package/dist/cli/help-content.js +56 -3
  10. package/dist/cli/help-json-payload.d.ts +5 -2
  11. package/dist/cli/help-json-payload.js +57 -17
  12. package/dist/cli/main.d.ts +3 -0
  13. package/dist/cli/main.js +39 -5
  14. package/dist/cli/register-annotations.js +5 -5
  15. package/dist/cli/register-mutation.js +77 -31
  16. package/dist/cli/register-operations.d.ts +73 -0
  17. package/dist/cli/register-operations.js +39 -14
  18. package/dist/cli/register-setup.js +3 -3
  19. package/dist/cli/schema-registration-helpers.d.ts +8 -1
  20. package/dist/cli/schema-registration-helpers.js +14 -5
  21. package/dist/cli-bundle/bundle-manifest.json +155 -155
  22. package/dist/cli-bundle/chunks/chunk-AGUL3HUT.js +3 -0
  23. package/dist/cli-bundle/chunks/{chunk-WG4STC36.js → chunk-DJNJBWAQ.js} +2 -2
  24. package/dist/cli-bundle/chunks/{chunk-MYYI3ZOA.js → chunk-I5Q7QSZX.js} +2 -2
  25. package/dist/cli-bundle/chunks/chunk-IW72J5FW.js +2 -0
  26. package/dist/cli-bundle/chunks/{chunk-BWX4SK46.js → chunk-L22NP5MA.js} +66 -66
  27. package/dist/cli-bundle/chunks/chunk-MKE6MD2K.js +36 -0
  28. package/dist/cli-bundle/chunks/{chunk-MZTZQTMS.js → chunk-NXBFO63A.js} +2 -2
  29. package/dist/cli-bundle/chunks/chunk-TEQDR5KI.js +202 -0
  30. package/dist/cli-bundle/chunks/chunk-X7WWQDYQ.js +2 -0
  31. package/dist/cli-bundle/chunks/chunk-YOLLRCLY.js +13 -0
  32. package/dist/cli-bundle/chunks/{chunk-U6GQ4VMV.js → chunk-ZAVCS2GH.js} +4 -4
  33. package/dist/cli-bundle/chunks/{register-list-query-HZKBQNWW.js → register-list-query-37A4P6O4.js} +2 -2
  34. package/dist/cli-bundle/chunks/register-mutation-TBJDHYIT.js +20 -0
  35. package/dist/cli-bundle/chunks/register-operations-WRZNEBUM.js +2 -0
  36. package/dist/cli-bundle/chunks/{register-setup-QK4OTOXN.js → register-setup-H4PDLACD.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-GMYPD4FX.js → chunk-4WP7LNE3.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/chunk-6MUTDXMP.js +2 -0
  39. package/dist/cli-bundle/focused-chunks/chunk-6Z24ZMU3.js +2 -0
  40. package/dist/cli-bundle/focused-chunks/{chunk-2ARQGDDW.js → chunk-BFA6KKCI.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/chunk-CWCN5RLO.js +26 -0
  42. package/dist/cli-bundle/focused-chunks/chunk-FCTT4CZU.js +5 -0
  43. package/dist/cli-bundle/focused-chunks/chunk-GJR6YEMR.js +156 -0
  44. package/dist/cli-bundle/focused-chunks/{chunk-2POVTNLY.js → chunk-IMWTYKII.js} +2 -2
  45. package/dist/cli-bundle/focused-chunks/{chunk-D6RBZEJJ.js → chunk-IZNRRCU3.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/{chunk-PMGJUFNQ.js → chunk-MNPECIRL.js} +2 -2
  47. package/dist/cli-bundle/focused-chunks/{chunk-A2BC5PQL.js → chunk-O4ZXNJMT.js} +2 -2
  48. package/dist/cli-bundle/focused-chunks/chunk-Q63PSLO4.js +2 -0
  49. package/dist/cli-bundle/focused-chunks/chunk-QBP5FSBX.js +4 -0
  50. package/dist/cli-bundle/focused-chunks/{chunk-R6SR45XU.js → chunk-QV5UP27O.js} +48 -47
  51. package/dist/cli-bundle/focused-chunks/chunk-RASVBJX5.js +8 -0
  52. package/dist/cli-bundle/focused-chunks/{chunk-E2EWYPY6.js → chunk-RPRLENVA.js} +2 -2
  53. package/dist/cli-bundle/focused-chunks/chunk-TOFVXBWA.js +19 -0
  54. package/dist/cli-bundle/focused-chunks/{chunk-6S2MO3Q3.js → chunk-WZLSSGEU.js} +2 -2
  55. package/dist/cli-bundle/main.js +18 -17
  56. package/dist/cli-bundle/sdk-authoring.js +1 -1
  57. package/dist/cli-bundle/sdk-contracts.js +2 -2
  58. package/dist/cli-bundle/sdk-core.js +41 -41
  59. package/dist/cli-bundle/sdk-governance.js +1 -1
  60. package/dist/cli-bundle/sdk-graph.js +1 -1
  61. package/dist/cli-bundle/sdk-merge.js +33 -32
  62. package/dist/cli-bundle/sdk-query.js +1 -1
  63. package/dist/cli-bundle/sdk-runtime.js +1 -1
  64. package/dist/cli-bundle/sdk-testing.js +1 -1
  65. package/dist/cli-bundle/sdk.js +6 -5
  66. package/dist/core/config/nested-settings.js +8 -2
  67. package/dist/core/config/positional-value.d.ts +1 -1
  68. package/dist/core/config/positional-value.js +5 -2
  69. package/dist/core/extensions/command-metadata-contract.d.ts +10 -0
  70. package/dist/core/extensions/command-metadata-contract.js +23 -0
  71. package/dist/core/extensions/command-visibility-tier.js +12 -2
  72. package/dist/core/extensions/extension-types.d.ts +6 -0
  73. package/dist/core/extensions/extension-types.js +2 -2
  74. package/dist/core/extensions/loader.js +4 -3
  75. package/dist/core/history/history.js +3 -3
  76. package/dist/core/io/body-file.js +7 -2
  77. package/dist/core/io/bulk-ids-input.d.ts +24 -0
  78. package/dist/core/io/bulk-ids-input.js +113 -0
  79. package/dist/core/item/item-format.js +66 -12
  80. package/dist/core/item/parse.d.ts +22 -2
  81. package/dist/core/item/parse.js +97 -4
  82. package/dist/core/reproducibility/context.d.ts +4 -0
  83. package/dist/core/reproducibility/context.js +14 -8
  84. package/dist/core/shared/author.d.ts +55 -1
  85. package/dist/core/shared/author.js +333 -16
  86. package/dist/core/shared/constants.js +3 -2
  87. package/dist/core/store/settings-validator.d.ts +1 -0
  88. package/dist/core/store/settings-validator.js +6 -3
  89. package/dist/core/store/settings.js +5 -2
  90. package/dist/mcp/server.d.ts +4 -3
  91. package/dist/mcp/server.js +44 -16
  92. package/dist/sdk/agent/identity-config.d.ts +63 -0
  93. package/dist/sdk/agent/identity-config.js +107 -0
  94. package/dist/sdk/agent/refusal-closure-census.d.ts +66 -0
  95. package/dist/sdk/agent/refusal-closure-census.js +144 -0
  96. package/dist/sdk/agent/refusal-corpus-contracts.d.ts +76 -0
  97. package/dist/sdk/agent/refusal-corpus-contracts.js +194 -0
  98. package/dist/sdk/agent-capability-contracts.d.ts +34 -1
  99. package/dist/sdk/agent-capability-contracts.js +104 -6
  100. package/dist/sdk/annotations.d.ts +2 -0
  101. package/dist/sdk/annotations.js +25 -7
  102. package/dist/sdk/cli-contracts/agent-output-contracts.js +6 -4
  103. package/dist/sdk/cli-contracts/enum-contracts.d.ts +4 -0
  104. package/dist/sdk/cli-contracts/enum-contracts.js +9 -2
  105. package/dist/sdk/cli-contracts/flag-contracts.js +9 -2
  106. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +4 -4
  107. package/dist/sdk/cli-contracts/registration-helpers.js +5 -2
  108. package/dist/sdk/cli-contracts/tool-parameter-tables.js +58 -2
  109. package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
  110. package/dist/sdk/cli-contracts/tool-schema.js +14 -3
  111. package/dist/sdk/cli-contracts/typed-action-inputs.d.ts +4 -1
  112. package/dist/sdk/cli-contracts/typed-action-inputs.js +2 -2
  113. package/dist/sdk/cli-contracts.d.ts +3 -3
  114. package/dist/sdk/cli-contracts.js +4 -4
  115. package/dist/sdk/comments.js +15 -7
  116. package/dist/sdk/config.d.ts +6 -1
  117. package/dist/sdk/config.js +119 -14
  118. package/dist/sdk/context-intent-contracts.js +4 -2
  119. package/dist/sdk/core-governance.d.ts +1 -1
  120. package/dist/sdk/core-governance.js +3 -3
  121. package/dist/sdk/extension/scaffold.js +11 -5
  122. package/dist/sdk/flag-invocation-contracts.d.ts +2 -0
  123. package/dist/sdk/flag-invocation-contracts.js +30 -3
  124. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +83 -2
  125. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +87 -2
  126. package/dist/sdk/governance/assurance-action.js +30 -10
  127. package/dist/sdk/governance/validate.d.ts +2 -2
  128. package/dist/sdk/governance/validate.js +39 -14
  129. package/dist/sdk/guide-topics.d.ts +0 -5
  130. package/dist/sdk/guide-topics.js +28 -2
  131. package/dist/sdk/history-compact.d.ts +2 -1
  132. package/dist/sdk/history-compact.js +24 -5
  133. package/dist/sdk/history-mcp.js +11 -10
  134. package/dist/sdk/index.d.ts +8 -2
  135. package/dist/sdk/index.js +9 -3
  136. package/dist/sdk/item-transaction.js +19 -12
  137. package/dist/sdk/lifecycle/append.js +4 -4
  138. package/dist/sdk/lifecycle/close-many.js +16 -7
  139. package/dist/sdk/lifecycle/create.js +33 -22
  140. package/dist/sdk/lifecycle/plan.js +24 -6
  141. package/dist/sdk/lifecycle/update-many.js +15 -8
  142. package/dist/sdk/lifecycle/update.d.ts +2 -0
  143. package/dist/sdk/lifecycle/update.js +37 -25
  144. package/dist/sdk/merge/three-way.js +105 -26
  145. package/dist/sdk/read-output-budget.d.ts +21 -0
  146. package/dist/sdk/read-output-budget.js +39 -2
  147. package/dist/sdk/read-output-contracts.d.ts +5 -3
  148. package/dist/sdk/read-output-contracts.js +20 -12
  149. package/dist/sdk/reproducibility/process.d.ts +19 -0
  150. package/dist/sdk/reproducibility/process.js +88 -0
  151. package/dist/sdk/runtime-extended-actions.js +5 -3
  152. package/dist/sdk/runtime-input.d.ts +4 -0
  153. package/dist/sdk/runtime-input.js +98 -23
  154. package/dist/sdk/runtime-primitives.d.ts +3 -2
  155. package/dist/sdk/runtime-primitives.js +5 -4
  156. package/dist/sdk/runtime.js +11 -23
  157. package/dist/sdk/scheduling-shortcuts.js +5 -3
  158. package/dist/sdk/structured-mutations.js +10 -3
  159. package/dist/sdk/test/batch.d.ts +6 -0
  160. package/dist/sdk/test/batch.js +15 -3
  161. package/dist/sdk/test/entry.d.ts +1 -1
  162. package/dist/sdk/test/entry.js +3 -2
  163. package/dist/sdk/test/execution.d.ts +28 -3
  164. package/dist/sdk/test/execution.js +193 -34
  165. package/dist/sdk/test/parsers.d.ts +6 -0
  166. package/dist/sdk/test/parsers.js +21 -2
  167. package/dist/sdk/test/trust.d.ts +33 -0
  168. package/dist/sdk/test/trust.js +207 -0
  169. package/dist/sdk/workspace-contracts.d.ts +3 -0
  170. package/dist/sdk/workspace-contracts.js +3 -2
  171. package/dist/types.d.ts +23 -0
  172. package/dist/types.js +2 -2
  173. package/docs/AGENT_PROVENANCE_ADR.md +41 -5
  174. package/docs/CONFIGURATION.md +4 -0
  175. package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +19 -2
  176. package/docs/MERGE_SAFETY.md +15 -1
  177. package/docs/README.md +2 -0
  178. package/docs/READ_OUTPUT_CONTRACTS.md +11 -1
  179. package/docs/RELEASING.md +40 -21
  180. package/docs/REPRODUCIBLE_WORKSPACES.md +42 -8
  181. package/docs/SCRIPTING.md +62 -3
  182. package/docs/SDK.md +17 -0
  183. package/docs/SDK_AGENT_SESSION_CONTEXT.md +6 -4
  184. package/docs/SDK_EVIDENCE_TRACEABILITY.md +1 -1
  185. package/docs/TESTING.md +75 -8
  186. package/docs/agent-task-token-baseline.json +2 -2
  187. package/docs/generated/AGENT_CAPABILITY_ROUTING.md +17 -0
  188. package/docs/generated/AGENT_COMMAND_SURFACE.md +1 -1
  189. package/docs/generated/FLAG_LEXICON_BUDGETS.md +2 -2
  190. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +355 -0
  191. package/marketplace.json +2 -2
  192. package/package.json +2 -2
  193. package/packages/pm-beads/package.json +1 -1
  194. package/packages/pm-calendar/package.json +1 -1
  195. package/packages/pm-command-kit/README.md +9 -11
  196. package/packages/pm-command-kit/extensions/command-kit/index.ts +3 -1
  197. package/packages/pm-command-kit/package.json +1 -1
  198. package/packages/pm-digital-twin/package.json +1 -1
  199. package/packages/pm-governance-audit/package.json +1 -1
  200. package/packages/pm-guide-shell/extensions/guide-shell/index.ts +10 -0
  201. package/packages/pm-guide-shell/package.json +1 -1
  202. package/packages/pm-kanban/package.json +1 -1
  203. package/packages/pm-lifecycle-hooks/package.json +1 -1
  204. package/packages/pm-linked-test-adapters/package.json +1 -1
  205. package/packages/pm-search-advanced/package.json +1 -1
  206. package/packages/pm-templates/package.json +1 -1
  207. package/packages/pm-todos/package.json +1 -1
  208. package/packages/pm-vcs/package.json +1 -1
  209. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  210. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  211. package/scripts/generate-agent-capability-surfaces.mjs +27 -1
  212. package/sdk/public-surface.json +642 -28
  213. package/dist/cli-bundle/chunks/chunk-EMWDM5FI.js +0 -13
  214. package/dist/cli-bundle/chunks/chunk-HYG6LRL4.js +0 -200
  215. package/dist/cli-bundle/chunks/chunk-QI2CT3IX.js +0 -2
  216. package/dist/cli-bundle/chunks/chunk-SMWXHMVB.js +0 -35
  217. package/dist/cli-bundle/chunks/chunk-VMMIL3SI.js +0 -2
  218. package/dist/cli-bundle/chunks/chunk-YBPJAOQQ.js +0 -3
  219. package/dist/cli-bundle/chunks/register-mutation-HTKEEGRD.js +0 -20
  220. package/dist/cli-bundle/chunks/register-operations-6EMRWJJY.js +0 -2
  221. package/dist/cli-bundle/focused-chunks/chunk-2AZT5WXZ.js +0 -2
  222. package/dist/cli-bundle/focused-chunks/chunk-3LKU6PTJ.js +0 -4
  223. package/dist/cli-bundle/focused-chunks/chunk-5SHSBMX2.js +0 -2
  224. package/dist/cli-bundle/focused-chunks/chunk-C4S4A4JJ.js +0 -5
  225. package/dist/cli-bundle/focused-chunks/chunk-L5LDSRO2.js +0 -155
  226. package/dist/cli-bundle/focused-chunks/chunk-MB37AYN6.js +0 -26
  227. package/dist/cli-bundle/focused-chunks/chunk-MCOR37QK.js +0 -2
  228. package/dist/cli-bundle/focused-chunks/chunk-PH2OXXVZ.js +0 -18
  229. package/dist/cli-bundle/focused-chunks/chunk-WZE4LIPW.js +0 -8
@@ -6,14 +6,14 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Official marketplace for pm CLI — native git-based project management for Claude Code and AI coding agents.",
9
- "version": "2026.8.22"
9
+ "version": "2026.8.24"
10
10
  },
11
11
  "plugins": [
12
12
  {
13
13
  "name": "pm-claude",
14
14
  "source": "./plugins/pm-claude",
15
15
  "description": "Native pm CLI integration for Claude Code — 28 MCP tools, 5 workflow skills, 14 slash commands, 4 subagents, hybrid TUI task tracking, session context injection, and coordination subagents for git-based project management without leaving Claude Code.",
16
- "version": "2026.8.22",
16
+ "version": "2026.8.24",
17
17
  "author": {
18
18
  "name": "unbrained",
19
19
  "url": "https://github.com/unbraind/pm-cli"
package/CHANGELOG.md CHANGED
@@ -1,5 +1,47 @@
1
1
  # Changelog
2
2
 
3
+ ## 2026.8.24 - 2026-08-24
4
+
5
+ ### Fixed
6
+
7
+ - Structured release-failure causes are preserved in blocked-release alerts ([pm-x63izf](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-x63izf.toon))
8
+ - Bulk writes accept newline/comma IDs from argv, stdin, and @path with effect-aware exits ([pm-3oq022](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-3oq022.toon))
9
+ - update-many --dry-run allows filter-only preview for review and bulk-selection workflows ([pm-kexu](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-kexu.toon))
10
+ - Releases from the default branch are supported with analyzer evidence ([pm-u1baah](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-u1baah.toon))
11
+
12
+ ### Other
13
+
14
+ - Uniform stdin convention: body-file and annotation --file flags accept '-' for stdin ([pm-iktj](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/tasks/pm-iktj.toon))
15
+ - Single source of surface tiering: one contract-declared tier per command drives CLI help, MCP tool profiles, completions, and docs together ([pm-kxci8x](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/tasks/pm-kxci8x.toon))
16
+
17
+ ## 2026.8.23 - 2026-08-23
18
+
19
+ ### Added
20
+
21
+ - Every instruction the product emits about its own next command is an unexecuted claim: the recovery vocabulary is generated, asserted as text, and run by nothing ([pm-h8tpeh](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-h8tpeh.toon))
22
+
23
+ ### Changed
24
+
25
+ - Update ESLint to compatible 10.9.0 release ([pm-940mcx](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-940mcx.toon))
26
+
27
+ ### Fixed
28
+
29
+ - Allow linked tests to opt out of source-workspace injection for self-sandboxing repo-wide gates ([pm-efkvdy](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-efkvdy.toon))
30
+ - Linked-test schema context changes non-PM repository checks, so commands that pass directly fail when recorded and run through pm test ([pm-e97jyf](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-e97jyf.toon))
31
+ - GH-1089: expose reproducible execution through supported CLI and MCP process configuration ([pm-gh1089](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gh1089.toon))
32
+ - Budget recovery can recommend a smaller ceiling than the request that already truncated ([pm-xam9bt](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-xam9bt.toon))
33
+
34
+ ### Security
35
+
36
+ - Linked-test commands are merge-unioned workspace data executed with shell:true — no provenance, allowlist, or confirmation boundary ([pm-ed28wi](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-ed28wi.toon))
37
+ - Cross-harness provenance adapters: automatically resolve native model, version, and effort signals beyond Claude without identity flags ([pm-c0lrdm](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-c0lrdm.toon))
38
+
39
+ ### Other
40
+
41
+ - Cross-process reproducibility gate: prove CLI and MCP deterministic runs are byte-identical and fail on ambient time leaks ([pm-vklr99](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/tasks/pm-vklr99.toon))
42
+ - Expose agent probe controls and versioned legacy-author vocabulary through pm config and SDK mutation APIs ([pm-yds9dt](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-yds9dt.toon))
43
+ - Diagnostic output budget: errors, warnings, and recovery bundles are the output an agent reads most and the only output with no declared ceiling ([pm-cha95z](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/tasks/pm-cha95z.toon))
44
+
3
45
  ## 2026.8.22 - 2026-08-22
4
46
 
5
47
  ### Fixed
@@ -81,7 +123,6 @@
81
123
 
82
124
  ### Fixed
83
125
 
84
- - A commit pushed directly to the default branch can never be released: both analyzer-evidence fallbacks presuppose a pull request, and nothing declares that precondition ([pm-u1baah](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-u1baah.toon))
85
126
  - GH-1052: typed fail-closed whole-list SDK primitive ([pm-y4aaol](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-y4aaol.toon))
86
127
  - Packed Bun SDK import fails on node:module stripTypeScriptTypes ([pm-ikj8ve](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-ikj8ve.toon))
87
128
  - GH-1051: package catalog rejects universal output-budget controls ([pm-2firut](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-2firut.toon))
@@ -4,14 +4,15 @@
4
4
  * Resolves the shared create/update description stdin sentinel.
5
5
  */
6
6
 
7
- !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]="e6b32b75-4618-5270-a79a-8564e97c7f3b")}catch(e){}}();
7
+ !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]="c55461f3-15d7-51f4-9e41-f71ce693b7b8")}catch(e){}}();
8
8
  import { createStdinTokenResolver } from "../sdk/runtime-primitives.js";
9
9
  /** Replace a description stdin sentinel with the complete standard-input payload. */
10
10
  export async function resolveDescriptionStdin(options) {
11
- if (options.description === "-") {
11
+ if (typeof options.description === "string" &&
12
+ options.description.trim() === "-") {
12
13
  options.description =
13
- (await createStdinTokenResolver().resolveValue("-", "--description")) ?? "";
14
+ (await createStdinTokenResolver().resolveValue(options.description, "--description")) ?? "";
14
15
  }
15
16
  }
16
17
  //# sourceMappingURL=description-stdin.js.map
17
- //# debugId=e6b32b75-4618-5270-a79a-8564e97c7f3b
18
+ //# debugId=c55461f3-15d7-51f4-9e41-f71ce693b7b8
@@ -21,6 +21,17 @@ interface GuidanceMessage {
21
21
  availableDependencies?: NonNullable<PmCliErrorContext["available_dependencies"]>;
22
22
  recovery?: PmCliErrorRecoveryPayload;
23
23
  }
24
+ /** Compact refusal identity embedded in every structured error envelope. */
25
+ export interface PmRefusalEnvelope {
26
+ /** Command, flag, or missing operand that rejected the invocation. */
27
+ surface: string;
28
+ /** Supplied scalar rejected by a closed domain, when available. */
29
+ rejected_value?: string;
30
+ /** Complete legal domain advertised by the refusal, when applicable. */
31
+ legal_domain?: string[];
32
+ /** Process exit code paired with the refusal. */
33
+ exit_code: number;
34
+ }
24
35
  /** Documents the json error envelope payload exchanged by command, SDK, and package integrations. */
25
36
  export interface JsonErrorEnvelope {
26
37
  /** Schema type that determines the shape and validation rules for this value. */
@@ -53,6 +64,8 @@ export interface JsonErrorEnvelope {
53
64
  available_dependencies?: NonNullable<PmCliErrorContext["available_dependencies"]>;
54
65
  /** Value that configures or reports recovery for this contract. */
55
66
  recovery?: PmCliErrorRecoveryPayload;
67
+ /** Stable compact identity of the failing surface and legal recovery domain. */
68
+ refusal: PmRefusalEnvelope;
56
69
  /** Binding output-budget receipt for this diagnostic. */
57
70
  diagnostic_output?: PmDiagnosticOutputReceipt;
58
71
  }
@@ -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]="72da6986-67d5-5adf-8e63-4f654d9ec7dd")}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]="4bdb7fcf-dd74-57bc-8a0e-07539095462e")}catch(e){}}();
3
3
  import { resolveRecoveryCommandName } from "../sdk/agent/command-recovery.js";
4
4
  import { projectPmDiagnosticOutput, projectPmDiagnosticText, } from "../sdk/cli-contracts/agent-output-contracts.js";
5
5
  import { renderPmCommand } from "./argv-utils.js";
@@ -304,6 +304,42 @@ function attachStructuredGuidanceDetails(payload, message) {
304
304
  }
305
305
  return payload;
306
306
  }
307
+ function resolveRefusalCandidateFlag(message, normalizedArgs) {
308
+ if (message.flag)
309
+ return message.flag;
310
+ return message.recovery?.provided_fields?.find((field) => field !== "--json" &&
311
+ field !== "--quiet" &&
312
+ normalizedArgs.includes(field));
313
+ }
314
+ function resolveRefusalRejectedValue(message, normalizedArgs, candidateFlag) {
315
+ if (message.value !== undefined)
316
+ return message.value;
317
+ if (candidateFlag) {
318
+ return normalizedArgs[normalizedArgs.indexOf(candidateFlag) + 1];
319
+ }
320
+ const allowedValues = message.recovery?.allowed_values;
321
+ if (!allowedValues?.length)
322
+ return undefined;
323
+ return normalizedArgs.find((argument, index) => index > 0 &&
324
+ !argument.startsWith("-") &&
325
+ !allowedValues.includes(argument));
326
+ }
327
+ function buildRefusalEnvelope(message, exitCode) {
328
+ const normalizedArgs = message.recovery?.normalized_args ?? [];
329
+ const candidateFlag = resolveRefusalCandidateFlag(message, normalizedArgs);
330
+ const rejectedValue = resolveRefusalRejectedValue(message, normalizedArgs, candidateFlag);
331
+ return {
332
+ surface: candidateFlag ??
333
+ message.recovery?.missing?.[0] ??
334
+ inferCommandNameFromRecovery(message.recovery) ??
335
+ "command",
336
+ ...(rejectedValue !== undefined ? { rejected_value: rejectedValue } : {}),
337
+ ...(message.recovery?.allowed_values?.length
338
+ ? { legal_domain: message.recovery.allowed_values }
339
+ : {}),
340
+ exit_code: exitCode,
341
+ };
342
+ }
307
343
  function guidanceToJsonEnvelope(message, exitCode) {
308
344
  return attachStructuredGuidanceDetails({
309
345
  type: message.type,
@@ -312,8 +348,20 @@ function guidanceToJsonEnvelope(message, exitCode) {
312
348
  detail: message.happened,
313
349
  required: message.required,
314
350
  exit_code: exitCode,
351
+ refusal: buildRefusalEnvelope(message, exitCode),
315
352
  }, message);
316
353
  }
354
+ function projectJsonErrorGuidance(guidance, exitCode) {
355
+ const recovery = guidance.recovery;
356
+ const hasActionableRecovery = Boolean(recovery?.suggested_retry) ||
357
+ Boolean(recovery?.suggested_retry_args?.length) ||
358
+ Boolean(recovery?.allowed_values?.length) ||
359
+ Boolean(recovery?.candidate_commands?.length) ||
360
+ Boolean(guidance.nextSteps?.length);
361
+ return projectPmDiagnosticOutput(guidanceToJsonEnvelope(guidance, exitCode), {
362
+ diagnosticClass: hasActionableRecovery ? "recovery_bundle" : "error",
363
+ });
364
+ }
317
365
  function guidanceToClassification(message) {
318
366
  return attachStructuredGuidanceDetails({
319
367
  type: message.type,
@@ -415,7 +463,10 @@ function applyPmCliErrorContext(guidance, rawMessage, context) {
415
463
  const fallbackTitle = guidance.code === "command_failed" && context.code
416
464
  ? buildFallbackTitleFromMessage(normalizedRawMessage)
417
465
  : undefined;
418
- const recovery = normalizeRecoveryPayload(context.recovery) ?? guidance.recovery;
466
+ const contextRecovery = normalizeRecoveryPayload(context.recovery);
467
+ const recovery = contextRecovery && guidance.recovery
468
+ ? normalizeRecoveryPayload({ ...guidance.recovery, ...contextRecovery })
469
+ : (contextRecovery ?? guidance.recovery);
419
470
  return {
420
471
  ...guidance,
421
472
  code,
@@ -600,6 +651,10 @@ function buildInvalidArgumentGuidance(rawMessage, message, context) {
600
651
  ? `pm ${commandName} --help`
601
652
  : "pm <command> --help";
602
653
  const allowedValues = inferAllowedValuesFromMessage(message);
654
+ const enrichedRecovery = normalizeRecoveryPayload({
655
+ ...recovery,
656
+ allowed_values: recovery?.allowed_values ?? allowedValues,
657
+ });
603
658
  const retryExample = buildAllowedValueRetryCommand(recovery, allowedValues);
604
659
  const examples = retryExample
605
660
  ? [retryExample, helpExample]
@@ -620,6 +675,7 @@ function buildInvalidArgumentGuidance(rawMessage, message, context) {
620
675
  why: "Validation protects data consistency and deterministic behavior across commands.",
621
676
  examples,
622
677
  nextSteps,
678
+ recovery: enrichedRecovery,
623
679
  }), rawMessage, context);
624
680
  }
625
681
  function buildPmCliErrorGuidance(rawMessage, context) {
@@ -1172,7 +1228,7 @@ export function classifyPmCliError(rawMessage, context) {
1172
1228
  }
1173
1229
  /** Implements format pm cli error for json for the public runtime surface of this module. */
1174
1230
  export function formatPmCliErrorForJson(rawMessage, exitCode, context) {
1175
- return projectPmDiagnosticOutput(guidanceToJsonEnvelope(buildPmCliErrorGuidance(rawMessage, context), exitCode));
1231
+ return projectJsonErrorGuidance(buildPmCliErrorGuidance(rawMessage, context), exitCode);
1176
1232
  }
1177
1233
  /** Implements format commander error for display for the public runtime surface of this module. */
1178
1234
  export function formatCommanderErrorForDisplay(rawMessage, commandName, allowedTypes, context) {
@@ -1185,12 +1241,12 @@ export function classifyCommanderError(rawMessage, commandName, allowedTypes, co
1185
1241
  }
1186
1242
  /** Implements format commander error for json for the public runtime surface of this module. */
1187
1243
  export function formatCommanderErrorForJson(rawMessage, commandName, allowedTypes, exitCode, context) {
1188
- return projectPmDiagnosticOutput(guidanceToJsonEnvelope(buildCommanderErrorGuidance(rawMessage, commandName, allowedTypes, context), exitCode));
1244
+ return projectJsonErrorGuidance(buildCommanderErrorGuidance(rawMessage, commandName, allowedTypes, context), exitCode);
1189
1245
  }
1190
1246
  /** Implements format unknown error for json for the public runtime surface of this module. */
1191
1247
  export function formatUnknownErrorForJson(rawMessage, exitCode) {
1192
1248
  const guidance = buildUnknownErrorGuidance(rawMessage);
1193
- return projectPmDiagnosticOutput(guidanceToJsonEnvelope(guidance, exitCode));
1249
+ return projectJsonErrorGuidance(guidance, exitCode);
1194
1250
  }
1195
1251
  function buildUnknownErrorGuidance(rawMessage) {
1196
1252
  const message = normalizeMessage(rawMessage);
@@ -1241,4 +1297,4 @@ export const _testOnly = {
1241
1297
  resolveKnownPackageCommandHint,
1242
1298
  };
1243
1299
  //# sourceMappingURL=error-guidance.js.map
1244
- //# debugId=72da6986-67d5-5adf-8e63-4f654d9ec7dd
1300
+ //# debugId=4bdb7fcf-dd74-57bc-8a0e-07539095462e
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import { Command } from "commander";
7
7
  import { type FlagDefinition, type RegisteredExtensionCommandDefinition, type RegisteredExtensionFlagDefinitions } from "../sdk/runtime-primitives.js";
8
+ import type { PmCommandCapabilityFamily, PmCommandVisibilityTier } from "../sdk/agent-capability-contracts.js";
8
9
  /** Documents the extension command argument help descriptor payload exchanged by command, SDK, and package integrations. */
9
10
  export interface ExtensionCommandArgumentHelpDescriptor {
10
11
  /** Value that configures or reports name for this contract. */
@@ -34,6 +35,10 @@ export interface ExtensionCommandHelpDescriptor {
34
35
  arguments: ExtensionCommandArgumentHelpDescriptor[];
35
36
  /** Value that configures or reports flags for this contract. */
36
37
  flags: FlagDefinition[];
38
+ /** Minimum agent surface tier declared by the package. */
39
+ tier: PmCommandVisibilityTier;
40
+ /** Capability family declared by the package. */
41
+ family: PmCommandCapabilityFamily;
37
42
  /** Value that configures or reports source for this contract. */
38
43
  source?: {
39
44
  layer: "global" | "project";
@@ -4,7 +4,7 @@
4
4
  * Provides CLI runtime support for Extension Command Help.
5
5
  */
6
6
 
7
- !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]="45f3bebb-c075-5573-97bc-b573ae4d2d76")}catch(e){}}();
7
+ !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]="99d39b7c-ec26-5c95-85c0-ac28112a6fe6")}catch(e){}}();
8
8
  import { Option } from "commander";
9
9
  /** Implements normalize extension command path for the public runtime surface of this module. */
10
10
  export function normalizeExtensionCommandPath(commandPath) {
@@ -227,6 +227,8 @@ function collectExtensionDefinitionsByCommand(commandDefinitions) {
227
227
  failure_hints: normalizeExtensionCommandStringList(definition.failure_hints),
228
228
  arguments: normalizeExtensionCommandArguments(definition.arguments),
229
229
  flags: [],
230
+ tier: definition.tier ?? "standard",
231
+ family: definition.family ?? "extensions",
230
232
  source: {
231
233
  layer: definition.layer,
232
234
  name: definition.name,
@@ -300,6 +302,8 @@ export function collectExtensionCommandHelpDescriptors(commandHandlers, commandD
300
302
  failure_hints: [],
301
303
  arguments: [],
302
304
  flags,
305
+ tier: "standard",
306
+ family: "extensions",
303
307
  });
304
308
  }
305
309
  return descriptors;
@@ -630,4 +634,4 @@ export function reportExtensionCommandCollision(activationWarnings, report, warn
630
634
  report(`[pm] warning: ${warning}; core command preserved. Rename or namespace the extension command alias.`);
631
635
  }
632
636
  //# sourceMappingURL=extension-command-help.js.map
633
- //# debugId=45f3bebb-c075-5573-97bc-b573ae4d2d76
637
+ //# debugId=99d39b7c-ec26-5c95-85c0-ac28112a6fe6
@@ -4,6 +4,11 @@
4
4
  * Provides CLI runtime support for Help Content.
5
5
  */
6
6
  import { Command } from "commander";
7
+ import { type PmCommandVisibilityTier } from "../sdk/agent-capability-contracts.js";
8
+ /** Attach a package command's declared tier to its Commander presentation node. */
9
+ export declare function setPmCommandHelpVisibilityTier(command: Command, tier: PmCommandVisibilityTier): void;
10
+ /** Read presentation metadata attached to a package-created Commander node. */
11
+ export declare function getPmCommandHelpVisibilityTier(command: Command): PmCommandVisibilityTier | undefined;
7
12
  /** Documents the help bundle payload exchanged by command, SDK, and package integrations. */
8
13
  export interface HelpBundle {
9
14
  /** Value that configures or reports why for this contract. */
@@ -1,7 +1,17 @@
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]="9cf83881-9464-5c18-b196-ee669057a873")}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]="5ea35d21-cfe6-5138-9fdb-413083719924")}catch(e){}}();
3
3
  import { parseBootstrapHelpRequest } from "./bootstrap-args.js";
4
4
  import { formatPmPositionalActionFlagTip, PM_POSITIONAL_ACTION_CONTRACTS, resolvePmPositionalActionContract, } from "../sdk/cli-contracts/grammar-contracts.js";
5
+ import { listPmCommandsForTier, measurePmCoreHelp, PM_CORE_HELP_OPTION_FLAGS, } from "../sdk/agent-capability-contracts.js";
6
+ const COMMAND_HELP_VISIBILITY_TIERS = new WeakMap();
7
+ /** Attach a package command's declared tier to its Commander presentation node. */
8
+ export function setPmCommandHelpVisibilityTier(command, tier) {
9
+ COMMAND_HELP_VISIBILITY_TIERS.set(command, tier);
10
+ }
11
+ /** Read presentation metadata attached to a package-created Commander node. */
12
+ export function getPmCommandHelpVisibilityTier(command) {
13
+ return COMMAND_HELP_VISIBILITY_TIERS.get(command);
14
+ }
5
15
  // Compact help/narrative surfaces show at most the first example. Centralizing this
6
16
  // keeps the empty-examples guard in one place for renderCompactHelpBundle and
7
17
  // resolveHelpNarrative (both must degrade to an empty list rather than [undefined]).
@@ -875,8 +885,51 @@ export function resolveHelpNarrative(commandPath, detailMode) {
875
885
  }
876
886
  /** Implements attach rich help text for the public runtime surface of this module. */
877
887
  export function attachRichHelpText(program, argv = process.argv.slice(2)) {
888
+ const baselineHelp = program.createHelp();
889
+ const coreCommands = new Set(listPmCommandsForTier("core"));
890
+ const coreOptions = new Set(PM_CORE_HELP_OPTION_FLAGS);
891
+ const selectedRootCommands = new Set();
892
+ program.configureHelp({
893
+ visibleCommands(command) {
894
+ const visible = baselineHelp.visibleCommands(command);
895
+ if (command !== program) {
896
+ return visible;
897
+ }
898
+ return visible.filter((candidate) => selectedRootCommands.has(candidate));
899
+ },
900
+ visibleOptions(command) {
901
+ const visible = baselineHelp.visibleOptions(command);
902
+ return command === program
903
+ ? visible.filter((option) => coreOptions.has(option.flags))
904
+ : visible;
905
+ },
906
+ });
878
907
  const detailMode = resolveHelpDetailMode(argv);
879
- program.addHelpText("after", renderHelpBundle(ROOT_HELP_BUNDLE, detailMode));
908
+ const rootHelpText = renderHelpBundle(ROOT_HELP_BUNDLE, detailMode);
909
+ program.addHelpText("after", rootHelpText);
910
+ const budgetHelp = program.createHelp();
911
+ budgetHelp.prepareContext({
912
+ error: false,
913
+ helpWidth: 80,
914
+ outputHasColors: false,
915
+ });
916
+ const renderBudgetHelp = () => `${budgetHelp.formatHelp(program, budgetHelp)}${rootHelpText}\n`;
917
+ const rootCandidates = baselineHelp.visibleCommands(program);
918
+ for (const candidate of rootCandidates) {
919
+ const declaredTier = getPmCommandHelpVisibilityTier(candidate);
920
+ if (declaredTier === undefined &&
921
+ (candidate.name() === "help" || coreCommands.has(candidate.name()))) {
922
+ selectedRootCommands.add(candidate);
923
+ }
924
+ }
925
+ for (const candidate of rootCandidates) {
926
+ if (getPmCommandHelpVisibilityTier(candidate) !== "core")
927
+ continue;
928
+ selectedRootCommands.add(candidate);
929
+ if (!measurePmCoreHelp(renderBudgetHelp()).within_budget) {
930
+ selectedRootCommands.delete(candidate);
931
+ }
932
+ }
880
933
  for (const [commandPath, bundle] of Object.entries(HELP_BY_COMMAND_PATH)) {
881
934
  attachBundleByPath(program, commandPath, bundle, detailMode);
882
935
  }
@@ -910,4 +963,4 @@ export const _testOnly = {
910
963
  renderDetailedHelpBundle,
911
964
  };
912
965
  //# sourceMappingURL=help-content.js.map
913
- //# debugId=9cf83881-9464-5c18-b196-ee669057a873
966
+ //# debugId=5ea35d21-cfe6-5138-9fdb-413083719924
@@ -32,13 +32,15 @@ export interface HelpSubcommandSummary {
32
32
  /** Shared command capability family. */
33
33
  family: PmCommandCapabilityFamily;
34
34
  }
35
+ type ExtensionCommandSurface = Pick<ExtensionCommandHelpDescriptor, "tier" | "family">;
36
+ declare function resolveExtensionCommandSurface(commandPath: string, descriptors: ReadonlyMap<string, ExtensionCommandHelpDescriptor>, allowDescendants?: boolean): ExtensionCommandSurface | undefined;
35
37
  declare function resolveCommandFromPathTokens(root: Command, pathTokens: string[]): Command | null;
36
38
  declare function readOptionAttributeName(option: unknown): string | null;
37
39
  declare function buildOptionAliasMap(options: unknown[]): Map<string, string[]>;
38
40
  declare function buildHelpOptionSummaries(command: Command): HelpOptionSummary[];
39
41
  declare function compactHelpOptionAliases(options: HelpOptionSummary[]): HelpOptionSummary[];
40
42
  declare function buildHelpArgumentSummaries(command: Command): HelpArgumentSummary[];
41
- declare function buildHelpSubcommandSummaries(command: Command): HelpSubcommandSummary[];
43
+ declare function buildHelpSubcommandSummaries(command: Command, extensionDescriptors?: ReadonlyMap<string, ExtensionCommandHelpDescriptor>): HelpSubcommandSummary[];
42
44
  interface PositionalActionHelpProjection {
43
45
  arguments: HelpArgumentSummary[];
44
46
  options: HelpOptionSummary[];
@@ -46,7 +48,7 @@ interface PositionalActionHelpProjection {
46
48
  usage: string;
47
49
  }
48
50
  /** Build the command/action structural view shared by every JSON help field. */
49
- declare function buildPositionalActionHelpProjection(action: PmPositionalActionContract | undefined, targetCommand: Command, resolvedPath: string, allOptions: HelpOptionSummary[]): PositionalActionHelpProjection;
51
+ declare function buildPositionalActionHelpProjection(action: PmPositionalActionContract | undefined, targetCommand: Command, resolvedPath: string, allOptions: HelpOptionSummary[], extensionDescriptors?: ReadonlyMap<string, ExtensionCommandHelpDescriptor>): PositionalActionHelpProjection;
50
52
  declare function buildJsonHelpPayload(rootProgram: Command, targetCommand: Command, argv: string[], requestedPath: string[], extensionDescriptors: ReadonlyMap<string, ExtensionCommandHelpDescriptor>): Record<string, unknown>;
51
53
  /** Implements maybe render bootstrap json help for the public runtime surface of this module. */
52
54
  export declare function maybeRenderBootstrapJsonHelp(rootProgram: Command, argv: string[], extensionDescriptors: ReadonlyMap<string, ExtensionCommandHelpDescriptor>): Promise<boolean>;
@@ -66,5 +68,6 @@ export declare const _testOnly: {
66
68
  compactHelpOptionAliases: typeof compactHelpOptionAliases;
67
69
  readOptionAttributeName: typeof readOptionAttributeName;
68
70
  resolveCommandFromPathTokens: typeof resolveCommandFromPathTokens;
71
+ resolveExtensionCommandSurface: typeof resolveExtensionCommandSurface;
69
72
  };
70
73
  export {};
@@ -1,9 +1,9 @@
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]="abdb8d3e-8c1b-511e-b25b-220d5a40ae3f")}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]="26c3efa6-b820-5370-b0ab-65b08bc007ec")}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";
6
- import { normalizeHelpCommandPath, resolveHelpDetailMode, resolveHelpNarrative, } from "./help-content.js";
6
+ import { getPmCommandHelpVisibilityTier, normalizeHelpCommandPath, resolveHelpDetailMode, resolveHelpNarrative, } from "./help-content.js";
7
7
  import { getCommandPath } from "./registration-helpers.js";
8
8
  import { parseBootstrapGlobalOptions, parseBootstrapHelpRequest, parseBootstrapCommandName, parseBootstrapTypeValue, } from "./bootstrap-args.js";
9
9
  import { extractProvidedOptionFlags, renderPmCommand } from "./argv-utils.js";
@@ -12,6 +12,32 @@ import { BUILTIN_TYPE_HELP_VALUES, buildUnknownCommandGuidanceFromRuntime, } fro
12
12
  import { resolveCreateExplicitEmptyFlag } from "../sdk/agent/create-option-policy.js";
13
13
  import { formatPmPositionalActionFlagTip, PM_POSITIONAL_ACTION_CONTRACTS, resolvePmPositionalActionContract, } from "../sdk/cli-contracts/grammar-contracts.js";
14
14
  import { resolvePmCommandCapabilityFamily, resolvePmCommandVisibilityTier, } from "../sdk/agent-capability-contracts.js";
15
+ const EXTENSION_TIER_ORDER = {
16
+ core: 0,
17
+ standard: 1,
18
+ full: 2,
19
+ internal: 3,
20
+ };
21
+ function resolveExtensionCommandSurface(commandPath, descriptors, allowDescendants = true) {
22
+ const exact = descriptors.get(commandPath);
23
+ if (exact)
24
+ return exact;
25
+ if (!allowDescendants)
26
+ return undefined;
27
+ const descendants = [...descriptors.entries()]
28
+ .filter(([path]) => path.startsWith(`${commandPath} `))
29
+ .map(([, descriptor]) => descriptor);
30
+ if (descendants.length === 0)
31
+ return undefined;
32
+ const tier = descendants.reduce((selected, descriptor) => EXTENSION_TIER_ORDER[descriptor.tier] < EXTENSION_TIER_ORDER[selected]
33
+ ? descriptor.tier
34
+ : selected, "internal");
35
+ const families = new Set(descendants.map(({ family }) => family));
36
+ return {
37
+ tier,
38
+ family: families.size === 1 ? descendants[0].family : "extensions",
39
+ };
40
+ }
15
41
  function resolveCommandFromPathTokens(root, pathTokens) {
16
42
  if (pathTokens.length === 0) {
17
43
  return root;
@@ -180,20 +206,23 @@ function buildHelpArgumentSummaries(command) {
180
206
  };
181
207
  });
182
208
  }
183
- function buildHelpSubcommandSummaries(command) {
209
+ function buildHelpSubcommandSummaries(command, extensionDescriptors = new Map()) {
184
210
  return command
185
211
  .createHelp()
186
212
  .visibleCommands(command)
187
213
  .filter((entry) => entry.name() !== "help" || command.parent === null)
188
214
  .map((entry) => {
189
- const rootCommand = normalizeHelpCommandPath(getCommandPath(entry))
190
- .split(" ")[0];
215
+ const commandPath = normalizeHelpCommandPath(getCommandPath(entry));
216
+ const rootCommand = commandPath.split(" ")[0];
217
+ const extensionDescriptor = resolveExtensionCommandSurface(commandPath, extensionDescriptors, getPmCommandHelpVisibilityTier(entry) !== undefined);
191
218
  return {
192
219
  name: entry.name().trim(),
193
220
  aliases: commandAliases(entry),
194
221
  description: entry.description().trim(),
195
- tier: resolvePmCommandVisibilityTier(rootCommand),
196
- family: resolvePmCommandCapabilityFamily(rootCommand),
222
+ tier: extensionDescriptor?.tier ??
223
+ resolvePmCommandVisibilityTier(rootCommand),
224
+ family: extensionDescriptor?.family ??
225
+ resolvePmCommandCapabilityFamily(rootCommand),
197
226
  };
198
227
  })
199
228
  .sort((left, right) => left.name.localeCompare(right.name));
@@ -223,11 +252,22 @@ function buildJsonHelpNarrative(detailMode, fallbackNarrative, extensionDescript
223
252
  detail_mode: detailMode,
224
253
  };
225
254
  }
255
+ function resolveJsonHelpVisibilityTier(rootCommandPath, extensionDescriptor) {
256
+ if (rootCommandPath === undefined)
257
+ return null;
258
+ return (extensionDescriptor?.tier ?? resolvePmCommandVisibilityTier(rootCommandPath));
259
+ }
260
+ function resolveJsonHelpCapabilityFamily(rootCommandPath, extensionDescriptor) {
261
+ if (rootCommandPath === undefined)
262
+ return null;
263
+ return (extensionDescriptor?.family ??
264
+ resolvePmCommandCapabilityFamily(rootCommandPath));
265
+ }
226
266
  /** Build the command/action structural view shared by every JSON help field. */
227
- function buildPositionalActionHelpProjection(action, targetCommand, resolvedPath, allOptions) {
267
+ function buildPositionalActionHelpProjection(action, targetCommand, resolvedPath, allOptions, extensionDescriptors = new Map()) {
228
268
  if (!action) {
229
269
  const argumentsList = buildHelpArgumentSummaries(targetCommand);
230
- const registeredSubcommands = buildHelpSubcommandSummaries(targetCommand);
270
+ const registeredSubcommands = buildHelpSubcommandSummaries(targetCommand, extensionDescriptors);
231
271
  const registeredSubcommandNames = new Set(registeredSubcommands.map(({ name }) => name));
232
272
  return {
233
273
  arguments: argumentsList,
@@ -289,21 +329,20 @@ function buildJsonHelpPayload(rootProgram, targetCommand, argv, requestedPath, e
289
329
  const extensionDescriptor = commandPath
290
330
  ? extensionDescriptors.get(commandPath)
291
331
  : undefined;
332
+ const extensionSurface = commandPath
333
+ ? resolveExtensionCommandSurface(commandPath, extensionDescriptors, getPmCommandHelpVisibilityTier(targetCommand) !== undefined)
334
+ : undefined;
292
335
  const narrative = buildJsonHelpNarrative(detailMode, fallbackNarrative, extensionDescriptor);
293
336
  const allOptionSummaries = compactHelpOptionAliases(mergeHelpOptionSummaries(buildHelpOptionSummaries(targetCommand), buildDynamicExtensionHelpOptionSummaries(extensionDescriptor)));
294
- const projection = buildPositionalActionHelpProjection(positionalAction, targetCommand, projectedPath, allOptionSummaries);
337
+ const projection = buildPositionalActionHelpProjection(positionalAction, targetCommand, projectedPath, allOptionSummaries, extensionDescriptors);
295
338
  return {
296
339
  format: "pm_help_v1",
297
340
  detail_mode: detailMode,
298
341
  root_command: rootProgram.name(),
299
342
  requested_path: requestedPath,
300
343
  resolved_path: projectedPath.length > 0 ? projectedPath : rootProgram.name(),
301
- visibility_tier: rootCommandPath === undefined
302
- ? null
303
- : resolvePmCommandVisibilityTier(rootCommandPath),
304
- capability_family: rootCommandPath === undefined
305
- ? null
306
- : resolvePmCommandCapabilityFamily(rootCommandPath),
344
+ visibility_tier: resolveJsonHelpVisibilityTier(rootCommandPath, extensionSurface),
345
+ capability_family: resolveJsonHelpCapabilityFamily(rootCommandPath, extensionSurface),
307
346
  description: positionalAction?.description ?? targetCommand.description(),
308
347
  usage: projection.usage,
309
348
  intent: positionalAction?.description ?? narrative.intent,
@@ -487,6 +526,7 @@ export const _testOnly = {
487
526
  compactHelpOptionAliases,
488
527
  readOptionAttributeName,
489
528
  resolveCommandFromPathTokens,
529
+ resolveExtensionCommandSurface,
490
530
  };
491
531
  //# sourceMappingURL=help-json-payload.js.map
492
- //# debugId=abdb8d3e-8c1b-511e-b25b-220d5a40ae3f
532
+ //# debugId=26c3efa6-b820-5370-b0ab-65b08bc007ec
@@ -157,6 +157,8 @@ declare function loadRuntimeExtensionCommandDescriptorsForRecovery(pmRoot: strin
157
157
  declare function executeRegisteredRuntimeMigrations(migrations: RegisteredExtensionSchemaMigrationDefinition[], pmRoot: string): Promise<string[]>;
158
158
  declare function runRequiredExtensionCommand(command: Command, options: Record<string, unknown>, globalOptions: GlobalOptions, extensionFlagDefinitions?: LooseCommandFlagDefinition[]): Promise<unknown>;
159
159
  declare function wrapProgramActionsForExtensionHandlers(rootProgram: Command): void;
160
+ /** Apply descendant-derived visibility to every generated extension namespace. */
161
+ declare function applyDynamicExtensionRootHelpVisibility(rootProgram: Command, preexistingTopLevelCommands: ReadonlySet<string>, descriptors: ReadonlyMap<string, ExtensionCommandHelpDescriptor>): void;
160
162
  declare function registerDynamicExtensionCommandPaths(rootProgram: Command, invocationArgv: string[]): Promise<void>;
161
163
  interface CoreCommandRegistrationSelection {
162
164
  setup: boolean;
@@ -230,6 +232,7 @@ export declare function runPmCli(rawArgv?: string[]): Promise<void>;
230
232
  /** Public contract for test only, shared by SDK and presentation-layer consumers. */
231
233
  export declare const _testOnly: {
232
234
  activationCommandMatchesProbe: typeof activationCommandMatchesProbe;
235
+ applyDynamicExtensionRootHelpVisibility: typeof applyDynamicExtensionRootHelpVisibility;
233
236
  bootstrapProfileEnabled: typeof bootstrapProfileEnabled;
234
237
  buildBootstrapActivationProbe: typeof buildBootstrapActivationProbe;
235
238
  buildPostActionTelemetryOutcome: typeof buildPostActionTelemetryOutcome;