@unbrained/pm-cli 2026.8.26 → 2026.8.28

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 (196) hide show
  1. package/.agents/skills/HARNESS_COMPATIBILITY.md +32 -0
  2. package/.agents/skills/README.md +47 -0
  3. package/.agents/skills/pm-developer/SKILL.md +117 -0
  4. package/.agents/skills/pm-developer/references/COMMAND_PLAYBOOK.md +49 -0
  5. package/.agents/skills/pm-developer/references/GRAPH_AND_RELATIONSHIPS.md +91 -0
  6. package/.agents/skills/pm-developer/references/MULTI_AGENT_MERGE.md +72 -0
  7. package/.agents/skills/pm-developer/references/PROMPTS.md +17 -0
  8. package/.agents/skills/pm-developer/references/SCRIPTING_COMPOSITION.md +82 -0
  9. package/.agents/skills/pm-developer/references/TOKEN_BUDGETS.md +85 -0
  10. package/.agents/skills/pm-extensions/SKILL.md +106 -0
  11. package/.agents/skills/pm-extensions/references/AUTHORING.md +95 -0
  12. package/.agents/skills/pm-extensions/references/LIFECYCLE.md +40 -0
  13. package/.agents/skills/pm-extensions/references/TROUBLESHOOTING.md +25 -0
  14. package/.agents/skills/pm-sdk/SKILL.md +107 -0
  15. package/.agents/skills/pm-sdk/references/DOMAIN_MODELING.md +78 -0
  16. package/.agents/skills/pm-sdk/references/INTEGRATION_CHECKLIST.md +31 -0
  17. package/.agents/skills/pm-sdk/references/PROMPTS.md +13 -0
  18. package/.agents/skills/pm-sdk/references/SURFACE_MAP.md +82 -0
  19. package/.agents/skills/pm-user/SKILL.md +111 -0
  20. package/.agents/skills/pm-user/references/BACKLOG_SHAPING.md +105 -0
  21. package/.agents/skills/pm-user/references/PROMPTS.md +17 -0
  22. package/.agents/skills/pm-user/references/WORKFLOWS.md +35 -0
  23. package/.claude-plugin/marketplace.json +2 -2
  24. package/CHANGELOG.md +50 -4
  25. package/README.md +8 -5
  26. package/dist/cli/commander-usage.js +11 -7
  27. package/dist/cli/error-guidance.js +62 -8
  28. package/dist/cli/help-content.d.ts +2 -0
  29. package/dist/cli/help-content.js +53 -17
  30. package/dist/cli/help-json-payload.d.ts +8 -2
  31. package/dist/cli/help-json-payload.js +46 -12
  32. package/dist/cli/main.js +52 -74
  33. package/dist/cli/register-annotations.js +83 -60
  34. package/dist/cli/register-setup.js +98 -57
  35. package/dist/cli-bundle/bundle-manifest.json +151 -151
  36. package/dist/cli-bundle/chunks/{chunk-UKBCRPA2.js → chunk-BY2FQ2NI.js} +2 -2
  37. package/dist/cli-bundle/chunks/chunk-E73FDIWT.js +3 -0
  38. package/dist/cli-bundle/chunks/{chunk-WRHJ3MB6.js → chunk-FEVBFFCQ.js} +2 -2
  39. package/dist/cli-bundle/chunks/{chunk-KBFP3E4E.js → chunk-M7OXRQE3.js} +66 -44
  40. package/dist/cli-bundle/chunks/{chunk-S4U76VZF.js → chunk-NBCBFVZI.js} +2 -2
  41. package/dist/cli-bundle/chunks/{chunk-ZNRLJ54C.js → chunk-NTXZHRKA.js} +45 -45
  42. package/dist/cli-bundle/chunks/chunk-QE6WQXFO.js +3 -0
  43. package/dist/cli-bundle/chunks/chunk-TIQ6AMH2.js +13 -0
  44. package/dist/cli-bundle/chunks/chunk-X2RROGZE.js +2 -0
  45. package/dist/cli-bundle/chunks/{chunk-E2GCFJSU.js → chunk-XRVVYRRO.js} +33 -33
  46. package/dist/cli-bundle/chunks/chunk-XWEQGHHG.js +202 -0
  47. package/dist/cli-bundle/chunks/{register-list-query-EMCPMICY.js → register-list-query-J35ZPQQ5.js} +2 -2
  48. package/dist/cli-bundle/chunks/{register-mutation-OJ67ABCB.js → register-mutation-J6XJJOGU.js} +4 -4
  49. package/dist/cli-bundle/chunks/{register-operations-H2GLP7LT.js → register-operations-AE3JEMFT.js} +2 -2
  50. package/dist/cli-bundle/chunks/register-setup-OQERLLWE.js +2 -0
  51. package/dist/cli-bundle/focused-chunks/{chunk-72T6JGAE.js → chunk-4ZDRZYYJ.js} +43 -43
  52. package/dist/cli-bundle/focused-chunks/{chunk-OHIHZ7HS.js → chunk-6GCRSLPG.js} +2 -2
  53. package/dist/cli-bundle/focused-chunks/{chunk-UYBA57GY.js → chunk-AD6ULRAF.js} +2 -2
  54. package/dist/cli-bundle/focused-chunks/{chunk-FXDLT6FL.js → chunk-AHAM2HAU.js} +2 -2
  55. package/dist/cli-bundle/focused-chunks/{chunk-LV5N3LK5.js → chunk-FC2AXLB5.js} +2 -2
  56. package/dist/cli-bundle/focused-chunks/{chunk-IBHXMFE7.js → chunk-HC7ODMH3.js} +2 -2
  57. package/dist/cli-bundle/focused-chunks/{chunk-4K2II4TV.js → chunk-HVQ22RC4.js} +2 -2
  58. package/dist/cli-bundle/focused-chunks/{chunk-MMXUPDDJ.js → chunk-JZYPPMXF.js} +2 -2
  59. package/dist/cli-bundle/focused-chunks/chunk-LLNTHF5X.js +2 -0
  60. package/dist/cli-bundle/focused-chunks/chunk-LYFWQMVC.js +2 -0
  61. package/dist/cli-bundle/focused-chunks/{chunk-A644DUFQ.js → chunk-MEASX544.js} +2 -2
  62. package/dist/cli-bundle/focused-chunks/{chunk-YO3ZF3FI.js → chunk-THEPQMLX.js} +2 -2
  63. package/dist/cli-bundle/focused-chunks/{chunk-57XY346D.js → chunk-XDPYBQCF.js} +9 -9
  64. package/dist/cli-bundle/focused-chunks/{chunk-TMJDFHVD.js → chunk-Y3JJXRVK.js} +2 -2
  65. package/dist/cli-bundle/focused-chunks/{chunk-66VGB23P.js → chunk-Y5A7SJJ7.js} +2 -2
  66. package/dist/cli-bundle/focused-chunks/chunk-YJLDHJOD.js +2 -0
  67. package/dist/cli-bundle/focused-chunks/{chunk-P2E6LDAE.js → chunk-YVVZ3LQ6.js} +3 -3
  68. package/dist/cli-bundle/focused-chunks/chunk-Z2USIBR2.js +5 -0
  69. package/dist/cli-bundle/main.js +15 -14
  70. package/dist/cli-bundle/sdk-authoring.js +1 -1
  71. package/dist/cli-bundle/sdk-contracts.js +2 -2
  72. package/dist/cli-bundle/sdk-core.js +31 -31
  73. package/dist/cli-bundle/sdk-governance.js +1 -1
  74. package/dist/cli-bundle/sdk-graph.js +1 -1
  75. package/dist/cli-bundle/sdk-merge.js +31 -31
  76. package/dist/cli-bundle/sdk-query.js +1 -1
  77. package/dist/cli-bundle/sdk-runtime.js +1 -1
  78. package/dist/cli-bundle/sdk-testing.js +1 -1
  79. package/dist/cli-bundle/sdk.js +32 -7
  80. package/dist/core/governance/issue-codes.d.ts +11 -2
  81. package/dist/core/governance/issue-codes.js +29 -10
  82. package/dist/core/item/item-format.js +3 -3
  83. package/dist/core/store/item-store.js +12 -5
  84. package/dist/mcp/server.js +123 -9
  85. package/dist/mcp/tool-definitions.d.ts +2 -0
  86. package/dist/mcp/tool-definitions.js +5 -5
  87. package/dist/sdk/agent/closed-domain-contracts.d.ts +1 -1
  88. package/dist/sdk/agent/closed-domain-contracts.js +24 -2
  89. package/dist/sdk/agent/command-recovery.js +3 -3
  90. package/dist/sdk/agent/task-transcript-contracts.d.ts +52 -0
  91. package/dist/sdk/agent/task-transcript-contracts.js +198 -0
  92. package/dist/sdk/agent-capability-contracts.js +6 -2
  93. package/dist/sdk/annotations.d.ts +5 -2
  94. package/dist/sdk/annotations.js +66 -36
  95. package/dist/sdk/cli-bootstrap.d.ts +2 -8
  96. package/dist/sdk/cli-bootstrap.js +7 -66
  97. package/dist/sdk/cli-contracts/bootstrap-command-scanner.d.ts +23 -0
  98. package/dist/sdk/cli-contracts/bootstrap-command-scanner.js +80 -0
  99. package/dist/sdk/cli-contracts/command-aliases.js +15 -2
  100. package/dist/sdk/cli-contracts/enum-contracts.d.ts +4 -1
  101. package/dist/sdk/cli-contracts/enum-contracts.js +7 -2
  102. package/dist/sdk/cli-contracts/flag-contracts.js +12 -5
  103. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +5 -5
  104. package/dist/sdk/cli-contracts/grammar-contracts.d.ts +3 -3
  105. package/dist/sdk/cli-contracts/grammar-contracts.js +24 -17
  106. package/dist/sdk/cli-contracts/runtime-contracts.js +13 -11
  107. package/dist/sdk/cli-contracts/tool-parameter-tables.js +15 -2
  108. package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
  109. package/dist/sdk/cli-contracts/tool-schema.js +32 -16
  110. package/dist/sdk/cli-contracts.d.ts +1 -1
  111. package/dist/sdk/cli-contracts.js +3 -3
  112. package/dist/sdk/cli-program.js +3 -2
  113. package/dist/sdk/comments.d.ts +4 -0
  114. package/dist/sdk/comments.js +2 -2
  115. package/dist/sdk/completion.js +47 -16
  116. package/dist/sdk/contracts.d.ts +1 -0
  117. package/dist/sdk/contracts.js +3 -2
  118. package/dist/sdk/extension/install-sources.d.ts +13 -0
  119. package/dist/sdk/extension/install-sources.js +62 -30
  120. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +26 -2
  121. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +38 -14
  122. package/dist/sdk/governance/upgrade.d.ts +2 -0
  123. package/dist/sdk/governance/upgrade.js +30 -8
  124. package/dist/sdk/governance/validate.js +8 -6
  125. package/dist/sdk/guide-topics.js +6 -6
  126. package/dist/sdk/index.d.ts +5 -2
  127. package/dist/sdk/index.js +6 -3
  128. package/dist/sdk/learnings.d.ts +4 -0
  129. package/dist/sdk/learnings.js +7 -4
  130. package/dist/sdk/lifecycle/close.js +4 -3
  131. package/dist/sdk/mcp/apps.d.ts +70 -0
  132. package/dist/sdk/mcp/apps.js +154 -0
  133. package/dist/sdk/mcp/skills.d.ts +127 -0
  134. package/dist/sdk/mcp/skills.js +390 -0
  135. package/dist/sdk/notes.d.ts +4 -0
  136. package/dist/sdk/notes.js +2 -2
  137. package/dist/sdk/read-output-contracts.js +16 -3
  138. package/dist/sdk/runtime-action-aliases.js +7 -3
  139. package/dist/sdk/runtime-input.js +15 -4
  140. package/dist/sdk/runtime-primitives.d.ts +1 -1
  141. package/dist/sdk/runtime-primitives.js +3 -3
  142. package/dist/sdk/runtime.d.ts +6 -6
  143. package/dist/sdk/runtime.js +8 -8
  144. package/docs/CLI_GRAMMAR.md +7 -1
  145. package/docs/COMMANDS.md +5 -4
  146. package/docs/EXTENSIONS.md +33 -32
  147. package/docs/MCP_2026_07_28.md +24 -2
  148. package/docs/MCP_2026_07_28_CONFORMANCE.md +4 -4
  149. package/docs/MCP_SKILLS_AND_APPS.md +107 -0
  150. package/docs/OUTPUT_TOKEN_ACCOUNTING.md +20 -7
  151. package/docs/QUICKSTART.md +15 -15
  152. package/docs/README.md +1 -0
  153. package/docs/RELEASING.md +20 -4
  154. package/docs/SDK.md +12 -0
  155. package/docs/SDK_CONTEXT_INTEGRITY.md +18 -1
  156. package/docs/SDK_EVIDENCE_TRACEABILITY.md +9 -1
  157. package/docs/SDK_RUNTIME_BOUNDARIES.md +10 -0
  158. package/docs/TESTING.md +6 -2
  159. package/docs/agent-task-token-baseline.json +97 -11
  160. package/docs/agent-task-transcripts.json +211 -0
  161. package/docs/generated/AGENT_CAPABILITY_ROUTING.md +1 -1
  162. package/docs/generated/FLAG_LEXICON_BUDGETS.md +3 -3
  163. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +11 -7
  164. package/docs/performance/cli-transport-overhead.md +10 -2
  165. package/marketplace.json +2 -2
  166. package/package.json +10 -8
  167. package/packages/pm-beads/README.md +12 -6
  168. package/packages/pm-beads/docs/MIGRATION.md +53 -0
  169. package/packages/pm-beads/extensions/beads/index.ts +8 -0
  170. package/packages/pm-beads/extensions/beads/runtime.ts +671 -112
  171. package/packages/pm-beads/package.json +1 -1
  172. package/packages/pm-calendar/package.json +1 -1
  173. package/packages/pm-command-kit/package.json +1 -1
  174. package/packages/pm-digital-twin/package.json +1 -1
  175. package/packages/pm-governance-audit/package.json +1 -1
  176. package/packages/pm-guide-shell/package.json +1 -1
  177. package/packages/pm-kanban/package.json +1 -1
  178. package/packages/pm-lifecycle-hooks/package.json +1 -1
  179. package/packages/pm-linked-test-adapters/package.json +1 -1
  180. package/packages/pm-search-advanced/package.json +1 -1
  181. package/packages/pm-templates/package.json +1 -1
  182. package/packages/pm-todos/package.json +1 -1
  183. package/packages/pm-vcs/package.json +1 -1
  184. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  185. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  186. package/sdk/public-surface.json +430 -36
  187. package/dist/cli-bundle/chunks/chunk-ES25LX3D.js +0 -202
  188. package/dist/cli-bundle/chunks/chunk-FRDWWB6R.js +0 -3
  189. package/dist/cli-bundle/chunks/chunk-ICQ3RVIY.js +0 -2
  190. package/dist/cli-bundle/chunks/chunk-IV64RJVE.js +0 -13
  191. package/dist/cli-bundle/chunks/chunk-MVYLQ67M.js +0 -3
  192. package/dist/cli-bundle/chunks/register-setup-GLZAHLVI.js +0 -2
  193. package/dist/cli-bundle/focused-chunks/chunk-4XNH2HM7.js +0 -2
  194. package/dist/cli-bundle/focused-chunks/chunk-7I23XGWO.js +0 -2
  195. package/dist/cli-bundle/focused-chunks/chunk-7YCDTCBC.js +0 -2
  196. package/dist/cli-bundle/focused-chunks/chunk-LMKG3DFE.js +0 -5
@@ -0,0 +1,111 @@
1
+ ---
2
+ name: pm-user
3
+ description: Guides user- and operator-facing pm-cli workflows for intake, triage, prioritization, planning, and reporting under a bounded token budget. Use when routing requests into pm items, organizing a backlog, or reporting on state without implementing code changes.
4
+ license: MIT
5
+ compatibility: Works in terminal-based agent harnesses that execute pm CLI commands.
6
+ metadata:
7
+ owner: unbrained
8
+ domain: pm-cli
9
+ scope: operator-workflow
10
+ ---
11
+
12
+ # pm User Skill
13
+
14
+ Planning and coordination work where the output is clean tracker state, not
15
+ code. The tracker is the project's context: an item is well-formed when another
16
+ agent can rebuild the full situation from it alone.
17
+
18
+ ## Load Order
19
+
20
+ | Tier | Load | Cost | When |
21
+ | ---- | ------------------------------------- | --------- | ------------------------------ |
22
+ | 0 | This file | ~650 tok | Always. |
23
+ | 1 | `pm context --limit 10` | ~2.1k | Orient in an existing project. |
24
+ | 1 | `pm search "<terms>" --limit 10` | ~0.5-1k | Before creating anything. |
25
+ | 2 | `pm guide <topic> --depth brief` | ~0.6-1k | An unfamiliar family. |
26
+ | 3 | `references/*.md` below | ~0.3-1k | Procedure detail. |
27
+
28
+ Optional deep routing that never goes stale:
29
+
30
+ ```bash
31
+ pm install guide-shell --project
32
+ pm guide quickstart
33
+ pm guide commands --depth brief
34
+ ```
35
+
36
+ ## Non-Negotiables
37
+
38
+ - Author identity is detected automatically. **Never pass `--author`, never set
39
+ `PM_AUTHOR`.**
40
+ - Search before creating; record the duplicate check as a create-time comment.
41
+ - Never delete items by search match — only by exact id.
42
+ - Prefer appending (`pm comments`, `pm notes`) over rewriting item content.
43
+ - Never assert an item's state from memory. Read it live first.
44
+
45
+ ## Intake Loop
46
+
47
+ ```bash
48
+ pm context --limit 10
49
+ pm search "<request keywords>" --limit 10
50
+ pm list-open --limit 20 --output-include id,title,type,priority
51
+ # reuse if it exists; otherwise create with lineage
52
+ pm create --create-mode progressive \
53
+ --title "..." --description "..." --type Task --status open \
54
+ --parent <epic-or-feature-id> \
55
+ --dep "id=<origin-item>,kind=discovered_from" \
56
+ --ac "..." --priority 1 --risk medium --confidence medium
57
+ pm comments <ID> "Duplicate check: searched <terms>; nearest existing is <id> which covers <scope>."
58
+ ```
59
+
60
+ ## What Makes An Item Well-Formed
61
+
62
+ Use the metadata the tracker actually has. An item carrying only a title is a
63
+ placeholder, not a tracked unit of work.
64
+
65
+ | Field | Why it matters |
66
+ | ---------------------------------------- | -------------------------------------------------- |
67
+ | `--type` | Routes into the right lifecycle and changelog bucket|
68
+ | `--parent` | Places the item in the ladder |
69
+ | `--dep "id=..,kind=.."` | Makes lineage machine-readable |
70
+ | `--ac` | Defines done without argument |
71
+ | `--expected-result` / `--actual-result` | Turns a defect into a reproducible claim |
72
+ | `--priority`, `--risk`, `--confidence` | Lets selection rank without a human |
73
+ | `--estimate`, `--deadline` | Feeds scheduling and forecasting |
74
+ | `--resolution`, `--close-reason` | Makes the closed record answerable later |
75
+
76
+ `--risk` is an enum: `low`, `medium`, `high`, `critical`. `--ac` **replaces**
77
+ the criteria; `--dep` **appends**.
78
+
79
+ ## Capability Map
80
+
81
+ | Need | Entry | Guide topic |
82
+ | --------------------------- | ---------------------------------------- | ------------ |
83
+ | What should I do next | `pm next` | `quickstart` |
84
+ | Where does this project stand | `pm context`, `pm stats` | `quickstart` |
85
+ | Find existing work | `pm search`, `pm list`, `pm duplicates` | `commands` |
86
+ | Group and count | `pm aggregate --group-by <field>` | `commands` |
87
+ | Lineage and ordering | `pm deps`, `pm graph <verb>` | `graph` |
88
+ | Recent movement | `pm activity`, `pm events`, `pm history` | `assurance` |
89
+ | Data quality | `pm validate`, `pm health` | `assurance` |
90
+ | Plan a multi-step change | `pm plan` | `workflows` |
91
+ | Custom types and statuses | `pm schema`, `pm config` | `commands` |
92
+ | Keep reads cheap | `--output-*`, `--token-accounting` | `tokens` |
93
+
94
+ ## Reporting Without Loading Rows
95
+
96
+ ```bash
97
+ pm stats
98
+ pm aggregate --group-by status --json | jq '.groups'
99
+ pm list --status open --output-include id,title,priority --output-limit 20
100
+ ```
101
+
102
+ `--group-by tags` groups by the whole tag **tuple**, not by individual tag.
103
+ Aggregate on a scalar field when a per-value count is what you want.
104
+
105
+ ## References
106
+
107
+ | Need | Load | Cost |
108
+ | --------------------------------- | --------------------------------------------- | -------- |
109
+ | Triage and planning procedures | [Workflows](references/WORKFLOWS.md) | ~350 tok |
110
+ | Prompt templates | [Prompts](references/PROMPTS.md) | ~250 tok |
111
+ | Backlog structure and item quality | [Backlog shaping](references/BACKLOG_SHAPING.md) | ~900 tok |
@@ -0,0 +1,105 @@
1
+ # Backlog Shaping
2
+
3
+ How to keep a tracker readable by both people and graph algorithms as it grows
4
+ from a handful of items to hundreds of thousands.
5
+
6
+ ## The Ladder
7
+
8
+ Work resolves upward through typed edges to a declared outcome. A healthy
9
+ workspace has no active item that reaches nothing.
10
+
11
+ ```
12
+ Milestone (declared outcome)
13
+ ^ implements
14
+ Epic / capability area
15
+ ^ parent
16
+ Feature / Story / Decision
17
+ ^ parent
18
+ Task / Issue / Chore
19
+ ```
20
+
21
+ - `Story` states what an agent or an organization needs, in their words.
22
+ - `Decision` records an architecture choice; open means proposed, closed means
23
+ accepted or rejected with rationale.
24
+ - `Milestone` declares an outcome, not a date bucket.
25
+ - `Plan` holds a multi-step change with durable steps and discoveries.
26
+
27
+ Check the ladder:
28
+
29
+ ```bash
30
+ pm graph audit --json | jq '{
31
+ isolated: .profile.isolated_active_nodes,
32
+ unreachable: .profile.outcome_unreachable_nodes,
33
+ outcomes: .profile.outcome_nodes
34
+ }'
35
+ ```
36
+
37
+ ## Never Create A Duplicate
38
+
39
+ ```bash
40
+ pm search "<distinctive phrase from the request>" --limit 10
41
+ pm search "<second phrasing>" --limit 10
42
+ pm list --type <likely-type> --status all --output-include id,title --output-limit 30
43
+ pm duplicates --limit 20 # scored candidate pairs, where the corpus allows it
44
+ ```
45
+
46
+ Record what you searched in a create-time comment. A duplicate check that is
47
+ not written down cannot be audited later, and the next agent repeats it.
48
+
49
+ When the request extends existing scope, extend the existing item — add
50
+ acceptance criteria, add a child, add a typed edge. Filing a near-identical
51
+ sibling is the most expensive mistake in a large tracker.
52
+
53
+ ## Prioritization That Selection Can Use
54
+
55
+ `pm next` ranks from recorded metadata. Metadata you never set cannot rank.
56
+
57
+ ```bash
58
+ pm update <ID> --priority 1 --risk high --confidence medium --estimate 120
59
+ pm update <ID> --deadline 2026-09-30
60
+ pm comments <ID> "Decision log: raised to P1 because <evidence>."
61
+ ```
62
+
63
+ Ordering belongs in edges, not in priority numbers:
64
+
65
+ ```bash
66
+ pm update <ID> --dep "id=<prerequisite>,kind=blocked_by"
67
+ ```
68
+
69
+ Do not record the inverse `blocks` edge as well — the pair is one relationship
70
+ and recording both creates a cycle.
71
+
72
+ ## Closing Well
73
+
74
+ A closed item is the project's memory. Closed badly, it is a dead end.
75
+
76
+ ```bash
77
+ pm close <ID> "<what shipped and what proved it>" \
78
+ --resolution "<how it was resolved>" \
79
+ --validate-close warn
80
+ pm release <ID>
81
+ ```
82
+
83
+ Fill `resolution`, `expected_result`, and `actual_result` for defects.
84
+ `pm validate --check-resolution` reports which terminal items are missing them.
85
+
86
+ Record evolution explicitly rather than letting it be inferred:
87
+
88
+ ```bash
89
+ pm update <NEW> --dep "id=<OLD>,kind=supersedes"
90
+ pm update <FIX> --dep "id=<INCIDENT>,kind=incident_from"
91
+ pm update <TEST> --dep "id=<FEATURE>,kind=verifies"
92
+ ```
93
+
94
+ ## Periodic Hygiene
95
+
96
+ ```bash
97
+ pm validate --check-resolution --check-history-drift
98
+ pm health --summary
99
+ pm graph audit
100
+ pm list --status in_progress # stale claims
101
+ pm aggregate --group-by type --json
102
+ ```
103
+
104
+ Fix what a diagnostic prescribes rather than only recording that it warned.
105
+ A warning that has been carried for months is a decision that was never made.
@@ -0,0 +1,17 @@
1
+ # Operator Prompt Templates
2
+
3
+ ## Triage
4
+
5
+ `Find the canonical pm item for this request. Show duplicate-check commands, then either reuse and update the item or create parent lineage + child item with explicit rationale.`
6
+
7
+ ## Schedule
8
+
9
+ `Apply deterministic scheduling metadata (status, priority, estimate, deadline) to <ID> and leave a comment explaining the prioritization decision.`
10
+
11
+ ## Handoff
12
+
13
+ `Prepare <ID> for handoff: append current state, blockers, and next actions; release the claim when handoff is complete.`
14
+
15
+ ## Closure Readiness
16
+
17
+ `Validate whether <ID> is close-ready by checking acceptance criteria, linked files/tests/docs, and latest verification evidence.`
@@ -0,0 +1,35 @@
1
+ # User and Operator Workflows
2
+
3
+ ## Intake Workflow
4
+
5
+ 1. Query current context:
6
+
7
+ ```bash
8
+ pm context --limit 10
9
+ pm search "<keywords>" --limit 10
10
+ pm list-open --limit 20
11
+ pm list-in-progress --limit 20
12
+ ```
13
+
14
+ 2. If existing item matches, reuse and update it.
15
+ 3. If no match exists, create parent lineage then child item.
16
+ 4. Add duplicate-check evidence in comments at creation time.
17
+
18
+ ## Claim and Ownership Workflow
19
+
20
+ ```bash
21
+ pm claim <ID>
22
+ pm update <ID> --status in_progress --message "Start work"
23
+ pm comments <ID> "Owner update: <state>"
24
+ pm release <ID>
25
+ ```
26
+
27
+ ## Audit-Friendly Collaboration
28
+
29
+ For non-owner append-only collaboration:
30
+
31
+ ```bash
32
+ pm comments <ID> --add "audit comment" --allow-audit-comment
33
+ pm notes <ID> --add "audit note" --allow-audit-comment
34
+ pm update <ID> --dep "id=<id>,kind=related,author=<author>,created_at=now" --allow-audit-dep-update
35
+ ```
@@ -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.26"
9
+ "version": "2026.8.28"
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.26",
16
+ "version": "2026.8.28",
17
17
  "author": {
18
18
  "name": "unbrained",
19
19
  "url": "https://github.com/unbraind/pm-cli"
package/CHANGELOG.md CHANGED
@@ -1,5 +1,52 @@
1
1
  # Changelog
2
2
 
3
+ ## 2026.8.28 - 2026-08-28
4
+
5
+ ### Fixed
6
+
7
+ - Repository test runner inherits production Sentry and turns negative CLI fixtures into release-blocking incidents ([pm-5ug5xq](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-5ug5xq.toon))
8
+ - Broad squash commits overflow hosted-analysis tree lookup and falsely lose reviewed PR provenance ([pm-gactwj](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gactwj.toon))
9
+ - Golden agent-transcript replay: measure tokens-per-completed-task as a CI-visible DX regression gate ([pm-8pnj](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-8pnj.toon))
10
+ - Unknown-option refusal textual flags bypass structured global-option filtering ([pm-x4wbui](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-x4wbui.toon))
11
+ - Agent-task transcript recovery accepts a refusal as a successful retry ([pm-o360q6](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-o360q6.toon))
12
+ - Close lifecycle bypasses reproducible process clock ([pm-hmpu4p](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-hmpu4p.toon))
13
+ - GH-1132: opt-in idempotent annotation append (ifAbsent/--if-absent) prevents retry-driven context duplication; duplicate appends remain available by default ([pm-ea1yh2](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-ea1yh2.toon))
14
+ - Agent-task transcripts accept declared no-effect and partial-effect successful exits ([pm-wanwyc](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-wanwyc.toon))
15
+ - Agent-task baselines accept missing task and composite token ceilings ([pm-aksavu](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-aksavu.toon))
16
+ - Agent-task closeout claims lack linked full-verification commands ([pm-ervmsc](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-ervmsc.toon))
17
+ - CLI transport-floor RSS admission false-fails on single-sample page noise ([pm-pz49xc](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-pz49xc.toon))
18
+ - Unknown-option refusals identify the actual rejected flag and fail closed at delimiters ([pm-fo8g7j](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-fo8g7j.toon))
19
+ - Agent-task gate accepts incidental substrings as required-field completeness ([pm-o7u08u](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-o7u08u.toon))
20
+ - Completed-task transcripts require terminal success, exclusive refusal metadata, and complete recovery ([pm-wa39rl](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-wa39rl.toon))
21
+ - Agent-task token replay trusts missing or incorrect accounting estimates ([pm-ok2kdn](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-ok2kdn.toon))
22
+
23
+ ### Security
24
+
25
+ - GH-1131: macOS Node 24 nightly cannot create the Skills-over-MCP special-file socket fixture ([pm-k23c4c](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-k23c4c.toon))
26
+
27
+ ## 2026.8.27 - 2026-08-27
28
+
29
+ ### Added
30
+
31
+ - Tiered contract-driven help: one-screen core help, full surface via pm help --all, generated from the contract table ([pm-e2bq](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-e2bq.toon))
32
+ - Skills over MCP: discoverable version-coherent pm workflows with progressive disclosure, capability requirements, and token budgets ([pm-8nzivt](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-8nzivt.toon))
33
+ - MCP Apps for pm: interactive graph, context, plan, assurance, and long-operation views with consent-safe action boundaries ([pm-pznhee](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-pznhee.toon))
34
+
35
+ ### Fixed
36
+
37
+ - GH-859: pm-beads source export can omit Beads comment bodies and events ([pm-tpwde6](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-tpwde6.toon))
38
+ - pm get silently discards --output-include field names because entity reads bind the flag to sections while collection reads bind it to fields, and the omission receipt reports no omissions either way ([pm-0k19l7](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-0k19l7.toon))
39
+ - GH-860: pm-beads --preserve-source-ids changes source ID casing ([pm-f7jj9b](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-f7jj9b.toon))
40
+ - GH-862: pm-beads must map Beads close reasons into native resolution metadata ([pm-gus5ft](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gus5ft.toon))
41
+ - GH-1118: natural-language word-number titles trigger duplicate issue-code false positives ([pm-blvfye](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-blvfye.toon))
42
+ - Published-artifact verification rejects the new pm-mcp-http bin before executing its healthy published entrypoint ([pm-fpdne3](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-fpdne3.toon))
43
+
44
+ ### Other
45
+
46
+ - Consolidate package lifecycle: extension/package/install/upgrade under a single pm package namespace ([pm-tnud](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/tasks/pm-tnud.toon))
47
+ - Refresh compatible ESLint 10.9.1 and Node type 26.3 patches ([pm-crkmmr](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-crkmmr.toon))
48
+ - MCP 2026-07-28 conformance and release gate: official schema matrix, protocol-era adapters, real transports, adversarial cases, and published consumers ([pm-55yf1t](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/tasks/pm-55yf1t.toon))
49
+
3
50
  ## 2026.8.26 - 2026-08-26
4
51
 
5
52
  ### Added
@@ -442,7 +489,6 @@
442
489
  - Sentry PM-CLI-2Q: expected snapshot-name validation is captured as a high production error ([pm-qyg51h](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-qyg51h.toon))
443
490
  - The release gate classifies production errors by message prose and reads none of the 236 error codes the product declares, so every waiver is a latent re-block and a broad substring is a silent waiver ([pm-dqtzva](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-dqtzva.toon))
444
491
  - The mandatory command-wiring replication set is enforced only by a prose checklist, and the census shows partial application is the single largest recurring defect class in the record ([pm-7rrqsk](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-7rrqsk.toon))
445
- - pm get silently discards --output-include field names because entity reads bind the flag to sections while collection reads bind it to fields, and the omission receipt reports no omissions either way ([pm-0k19l7](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-0k19l7.toon))
446
492
  - GH-919: \_workspace author-attribution coordinates cannot be acknowledged ([pm-ety1qc](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-ety1qc.toon))
447
493
  - pm comments write response replays the entire accumulated history, so one append can emit hundreds of comments ([pm-9stazf](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-9stazf.toon))
448
494
  - GH-457: pm health hangs during vectorization check with no output (never-block violation) ([pm-tu71](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-tu71.toon))
@@ -865,10 +911,10 @@
865
911
 
866
912
  ### Other
867
913
 
914
+ - CLI transport overhead budget: gate the per-invocation bootstrap floor and the CLI-vs-SDK delta, not just absolute scale numbers ([pm-yse5dt](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/tasks/pm-yse5dt.toon))
868
915
  - CI/CD + test-suite performance: in-process CLI runner and dedupe redundant matrix legs ([pm-7rlp](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-7rlp.toon))
869
916
  - ADR: agent identity model — stable author namespace plus structured harness, model, and session provenance ([pm-qwuber](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/decisions/pm-qwuber.toon))
870
917
  - Public SDK surface shape: 881 exports behind one flat entrypoint with no capability tiering and a 250ms eager import cost ([pm-38bskj](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/tasks/pm-38bskj.toon))
871
- - CLI transport overhead budget: gate the per-invocation bootstrap floor and the CLI-vs-SDK delta, not just absolute scale numbers ([pm-yse5dt](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/tasks/pm-yse5dt.toon))
872
918
 
873
919
  ## 2026.7.25 - 2026-07-25
874
920
 
@@ -991,12 +1037,12 @@
991
1037
 
992
1038
  ### Fixed
993
1039
 
1040
+ - GH-576: unknown-command help probes return structured non-zero errors ([pm-bu1m](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-bu1m.toon))
994
1041
  - Sentry PM-CLI-2G: make merge-driver installation permission failures actionable ([pm-bnmlsc](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-bnmlsc.toon))
995
1042
  - Sentry PM-CLI-2F: classify manifest-proven torn bundle call-time TypeError ([pm-pz7xtx](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-pz7xtx.toon))
996
1043
  - Compatibility gate rejects compact legacy create envelopes after release promotion ([pm-pkdpyz](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-pkdpyz.toon))
997
1044
  - Sentry PM-CLI-2E: directory-shaped settings.json crashes CLI bootstrap ([pm-k0nl2w](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-k0nl2w.toon))
998
1045
  - Sentry PM-CLI-2D: storage-integrity history scan reads .jsonl directories as files ([pm-o1c53b](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-o1c53b.toon))
999
- - GH-576: unknown-command help probes return structured non-zero errors ([pm-bu1m](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-bu1m.toon))
1000
1046
  - GH-551: dependency seeds accept global source_kind and preserve cross-workspace IDs ([pm-topu](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-topu.toon))
1001
1047
  - GH-595: list JSON always emits total/has_more/truncated/next_cursor and omits unset filters ([pm-wrss](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-wrss.toon))
1002
1048
  - GH-623: opt-in post-merge history reconciliation hook and one-command verify repair ([pm-mfkv92](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-mfkv92.toon))
@@ -1462,6 +1508,7 @@
1462
1508
 
1463
1509
  ### Added
1464
1510
 
1511
+ - pm package/extension init --capability profile: scaffold a project-profile starter package ([pm-h2hk](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-h2hk.toon))
1465
1512
  - Describe --markdown writes reference docs to a file ([pm-u2tm](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-u2tm.toon))
1466
1513
  - Complete scaffold capability matrix: --capability renderers/parser/preflight/services starters ([pm-i5p5](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-i5p5.toon))
1467
1514
  - Scaffolded & authored command-bearing extensions reliably activate for their own commands ([pm-yxb5](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-yxb5.toon))
@@ -1469,7 +1516,6 @@
1469
1516
  - pm next: recommend the next actionable (unblocked, ready) work item with rationale + blocked companion ([pm-nj90](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-nj90.toon))
1470
1517
  - Add pm package / pm packages shell completion (bash/zsh/fish), including the package-only --declarative flag ([pm-mthy](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/tasks/pm-mthy.toon))
1471
1518
  - Project profile author-time validation: lintProjectProfile + assertProjectProfile + pm profile lint ([pm-j1fj](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-j1fj.toon))
1472
- - pm package/extension init --capability profile: scaffold a project-profile starter package ([pm-h2hk](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-h2hk.toon))
1473
1519
  - SDK + CLI: render extension/package surfaces to Markdown reference docs (renderExtensionSurfaceMarkdown + describe --markdown) ([pm-dmum](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-dmum.toon))
1474
1520
  - pm package/extension init --capability schema: scaffold custom item type/field/migration starter ([pm-d1ig](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-d1ig.toon))
1475
1521
  - First-party baseline profile package built on public SDK primitives ([pm-a7o4](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-a7o4.toon))
package/README.md CHANGED
@@ -60,14 +60,17 @@ npx --yes @unbrained/pm-cli@latest --help
60
60
  `pm` packages use the same package-first vocabulary:
61
61
 
62
62
  ```bash
63
- pm install '*'
64
- pm install ./my-package
63
+ pm package install '*'
64
+ pm package install ./my-package
65
65
  pm package manage --project
66
66
  pm package doctor --detail summary
67
- pm upgrade --dry-run
67
+ pm package upgrade --dry-run
68
68
  ```
69
69
 
70
- The legacy `pm extension ...` command remains available for existing automation.
70
+ The hidden legacy `pm extension ...`, `pm install ...`, and `pm upgrade ...`
71
+ aliases remain available for existing automation. They preserve canonical output
72
+ and emit one migration hint on stderr unless `ux.deprecation_hints` is disabled;
73
+ for example, `pm install guide-shell --project` maps to the canonical command.
71
74
 
72
75
  ## 60 Second Example
73
76
 
@@ -108,7 +111,7 @@ pm list --status in_progress --limit 20
108
111
 
109
112
  If no relevant item exists, create a parent lineage before child work, claim the child item, link changed files/docs/tests, and leave evidence comments before closing. The full workflow is in the [Agent Guide](docs/AGENT_GUIDE.md).
110
113
 
111
- For token-aware local routing, install `guide-shell` with `pm install guide-shell --project`, then use `pm guide workflows` and drill into related topics (`commands`, `skills`, `release`) only when needed.
114
+ For token-aware local routing, install `guide-shell` with `pm package install guide-shell --project`, then use `pm guide workflows` and drill into related topics (`commands`, `skills`, `release`) only when needed.
112
115
 
113
116
  ## Core Model
114
117
 
@@ -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]="48877bbb-17bf-5a78-91fa-19a2f2f4c2be")}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]="8879d491-9158-548c-bfbd-8ab57d8eb936")}catch(e){}}();
3
3
  import { pathExists, resolveItemTypeRegistry, EXIT_CODE, getSettingsPath, resolvePmRoot, readSettings, getActiveExtensionRegistrations, locateItem, runActiveServiceOverride, levenshteinDistanceWithinLimit, } from "../sdk/runtime-primitives.js";
4
4
  import { BUILTIN_ITEM_TYPE_VALUES } from "../types/index.js";
5
5
  import { PM_CORE_COMMAND_NAMES, resolveSubcommandFlagContractsForCommand, } from "../sdk/cli-contracts.js";
@@ -525,16 +525,20 @@ export function isKnownHelpCommandPath(root, commandPathTokens) {
525
525
  return true;
526
526
  }
527
527
  let current = root;
528
- let matchedAny = false;
529
- for (const token of commandPathTokens) {
528
+ for (const [tokenIndex, token] of commandPathTokens.entries()) {
530
529
  const next = resolveChildCommandByToken(current, token);
531
530
  if (!next) {
532
- return matchedAny;
531
+ if (current.commands.some((candidate) => candidate.name() !== "help")) {
532
+ return false;
533
+ }
534
+ const declaredArguments = current.registeredArguments;
535
+ return (declaredArguments.length > 0 &&
536
+ (declaredArguments.at(-1)?.variadic === true ||
537
+ commandPathTokens.length - tokenIndex <= declaredArguments.length));
533
538
  }
534
- matchedAny = true;
535
539
  current = next;
536
540
  }
537
- return matchedAny;
541
+ return true;
538
542
  }
539
543
  async function resolveWorkspaceUsageContext(bootstrapGlobal, message, invocationArgv, commandName) {
540
544
  try {
@@ -763,4 +767,4 @@ export const _testOnly = {
763
767
  suggestNearestLongFlags,
764
768
  };
765
769
  //# sourceMappingURL=commander-usage.js.map
766
- //# debugId=48877bbb-17bf-5a78-91fa-19a2f2f4c2be
770
+ //# debugId=8879d491-9158-548c-bfbd-8ab57d8eb936
@@ -1,9 +1,10 @@
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]="4bdb7fcf-dd74-57bc-8a0e-07539095462e")}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]="ca79853d-468c-5522-b5f9-6509c66e3d9b")}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";
6
6
  import { discoverNearbyPmRoot } from "../sdk/tracker-root-discovery.js";
7
+ import { stripGlobalBootstrapTokens } from "../sdk/cli-bootstrap.js";
7
8
  /** Compact an error envelope to fields that change the caller's next action. */
8
9
  export function projectLeanErrorEnvelope(envelope) {
9
10
  const { why: _why, title: _title, ...actionable } = envelope;
@@ -207,6 +208,7 @@ function renderRecoveryBundle(recovery) {
207
208
  return [];
208
209
  }
209
210
  const lines = ["Recovery bundle:"];
211
+ appendRecoveryTextLine(lines, "suggested_retry", normalized.suggested_retry);
210
212
  appendRecoveryTextLine(lines, "attempted_command", normalized.attempted_command);
211
213
  appendRecoveryListLine(lines, "normalized_args", normalized.normalized_args, " ");
212
214
  if (normalized.parsed_positionals &&
@@ -231,7 +233,6 @@ function renderRecoveryBundle(recovery) {
231
233
  if (normalized.option_scope !== undefined) {
232
234
  lines.push(` option_scope: ${normalized.option_scope}`);
233
235
  }
234
- appendRecoveryTextLine(lines, "suggested_retry", normalized.suggested_retry);
235
236
  if (typeof normalized.retry_after_ms === "number") {
236
237
  lines.push(` retry_after_ms: ${normalized.retry_after_ms}`);
237
238
  }
@@ -307,15 +308,36 @@ function attachStructuredGuidanceDetails(payload, message) {
307
308
  function resolveRefusalCandidateFlag(message, normalizedArgs) {
308
309
  if (message.flag)
309
310
  return message.flag;
310
- return message.recovery?.provided_fields?.find((field) => field !== "--json" &&
311
- field !== "--quiet" &&
312
- normalizedArgs.includes(field));
311
+ const isAdmissibleCandidate = (flag) => {
312
+ const canonicalFlag = flag.split("=", 1)[0];
313
+ return (stripGlobalBootstrapTokens([canonicalFlag]).length > 0 &&
314
+ !["--help", "--no-changed-fields", "--version"].includes(canonicalFlag) &&
315
+ normalizedArgs.some((argument) => argument === canonicalFlag ||
316
+ argument.startsWith(`${canonicalFlag}=`)));
317
+ };
318
+ const mentionedFlag = [
319
+ ...`${message.title} ${message.happened}`.matchAll(/--[A-Za-z0-9][A-Za-z0-9_-]*/gu),
320
+ ]
321
+ .map((match) => match[0])
322
+ .find((flag) => isAdmissibleCandidate(flag));
323
+ if (mentionedFlag)
324
+ return mentionedFlag;
325
+ return message.recovery?.provided_fields
326
+ ?.map((field) => field.split("=", 1)[0])
327
+ .find((field) => isAdmissibleCandidate(field));
313
328
  }
314
329
  function resolveRefusalRejectedValue(message, normalizedArgs, candidateFlag) {
315
330
  if (message.value !== undefined)
316
331
  return message.value;
317
332
  if (candidateFlag) {
318
- return normalizedArgs[normalizedArgs.indexOf(candidateFlag) + 1];
333
+ const candidateArgument = normalizedArgs.find((argument) => argument === candidateFlag || argument.startsWith(`${candidateFlag}=`));
334
+ if (candidateArgument?.startsWith(`${candidateFlag}=`)) {
335
+ return candidateArgument.slice(candidateFlag.length + 1);
336
+ }
337
+ const candidateIndex = normalizedArgs.indexOf(candidateFlag);
338
+ return candidateIndex >= 0
339
+ ? normalizedArgs[candidateIndex + 1]
340
+ : undefined;
319
341
  }
320
342
  const allowedValues = message.recovery?.allowed_values;
321
343
  if (!allowedValues?.length)
@@ -941,6 +963,34 @@ function buildUnknownOptionNextSteps(optionName, commandName, suggestions, candi
941
963
  : undefined,
942
964
  ].filter((entry) => typeof entry === "string");
943
965
  }
966
+ /**
967
+ * Publish a shell-free correction only when removing the unknown token leaves
968
+ * positional ownership unambiguous; explicit producer guidance stays authoritative.
969
+ */
970
+ function resolveUnknownOptionRetry(context, optionName) {
971
+ if (context.suggestedRetryCommand !== undefined) {
972
+ return { retryCommand: context.suggestedRetryCommand };
973
+ }
974
+ const normalizedArgs = context.normalizedInvocationArgs;
975
+ if (normalizedArgs === undefined)
976
+ return {};
977
+ if (normalizedArgs.filter((argument) => argument === optionName || argument.startsWith(`${optionName}=`)).length !== 1) {
978
+ return {};
979
+ }
980
+ const optionIndex = normalizedArgs.findIndex((argument) => argument === optionName || argument.startsWith(`${optionName}=`));
981
+ if (optionIndex < 0 ||
982
+ normalizedArgs.includes("--") ||
983
+ (!normalizedArgs[optionIndex]?.includes("=") &&
984
+ optionIndex !== normalizedArgs.length - 1 &&
985
+ normalizedArgs[optionIndex + 1]?.startsWith("-") !== true)) {
986
+ return {};
987
+ }
988
+ const suggestedRetryArgs = stripGlobalBootstrapTokens(normalizedArgs.filter((_, index) => index !== optionIndex));
989
+ return {
990
+ retryCommand: renderPmCommand(suggestedRetryArgs),
991
+ suggestedRetryArgs,
992
+ };
993
+ }
944
994
  function buildUnknownOptionGuidance(message, commandName, context) {
945
995
  const unknownOption = message.match(/unknown option '([^']+)'/);
946
996
  if (!unknownOption) {
@@ -949,7 +999,7 @@ function buildUnknownOptionGuidance(message, commandName, context) {
949
999
  const guidanceContext = context ?? {};
950
1000
  const optionName = unknownOption[1];
951
1001
  const suggestions = normalizeOptionFlags(guidanceContext.unknownOptionSuggestions) ?? [];
952
- const retryCommand = guidanceContext.suggestedRetryCommand;
1002
+ const { retryCommand, suggestedRetryArgs } = resolveUnknownOptionRetry(guidanceContext, optionName);
953
1003
  if (commandName === "update" &&
954
1004
  (optionName === "--file" || optionName === "--doc")) {
955
1005
  return buildUnsupportedUpdateOptionGuidance(optionName, context, suggestions);
@@ -966,10 +1016,14 @@ function buildUnknownOptionGuidance(message, commandName, context) {
966
1016
  happened: `Commander does not recognize option ${optionName} for this command path.`,
967
1017
  required: UNKNOWN_OPTION_REQUIRED_BY_SCOPE[candidateContext.optionScope],
968
1018
  why: "Option contracts are command-specific and intentionally validated.",
1019
+ flag: optionName,
1020
+ value: optionName,
969
1021
  examples,
970
1022
  nextSteps,
971
1023
  recovery: buildCommanderRecoveryPayload(context, {
972
1024
  suggested_flags: suggestions.length > 0 ? suggestions : undefined,
1025
+ suggested_retry: retryCommand,
1026
+ suggested_retry_args: suggestedRetryArgs,
973
1027
  candidate_commands: candidateContext.otherCommands,
974
1028
  candidate_commands_total: candidateContext.candidateTotal || undefined,
975
1029
  candidate_commands_truncated: guidanceContext.unknownOptionOtherCommandsTruncated,
@@ -1297,4 +1351,4 @@ export const _testOnly = {
1297
1351
  resolveKnownPackageCommandHint,
1298
1352
  };
1299
1353
  //# sourceMappingURL=error-guidance.js.map
1300
- //# debugId=4bdb7fcf-dd74-57bc-8a0e-07539095462e
1354
+ //# debugId=ca79853d-468c-5522-b5f9-6509c66e3d9b
@@ -39,6 +39,8 @@ declare function renderDetailedHelpBundle(bundle: HelpBundle): string;
39
39
  export declare function normalizeHelpCommandPath(commandPath: string): string;
40
40
  /** Implements resolve help detail mode for the public runtime surface of this module. */
41
41
  export declare function resolveHelpDetailMode(argv: string[]): HelpDetailMode;
42
+ /** Whether an invocation requests the complete public command discovery tier. */
43
+ export declare function isFullHelpDiscovery(argv: readonly string[]): boolean;
42
44
  /** Public contract for root help bundle, shared by SDK and presentation-layer consumers. */
43
45
  export declare const ROOT_HELP_BUNDLE: HelpBundle;
44
46
  /** Implements resolve help bundle for path for the public runtime surface of this module. */