@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,106 @@
1
+ ---
2
+ name: pm-extensions
3
+ description: Manages pm-cli package and extension lifecycle — explore, install, activate, author, diagnose, and release-safe validation. Use when building, integrating, or troubleshooting pm packages, extensions, and extension-provided commands.
4
+ license: MIT
5
+ compatibility: Requires pm package/extension commands and local project/global extension directories.
6
+ metadata:
7
+ owner: unbrained
8
+ domain: pm-cli
9
+ scope: extension-workflow
10
+ ---
11
+
12
+ # pm Packages and Extensions Skill
13
+
14
+ Extensions are how pm becomes specific to a project without forking it. They
15
+ register commands, item types, importers, exporters, search providers, and
16
+ profiles over the same substrate.
17
+
18
+ ## Load Order
19
+
20
+ | Tier | Load | Cost | When |
21
+ | ---- | ------------------------------------------------- | --------- | ----------------------------- |
22
+ | 0 | This file | ~650 tok | Always. |
23
+ | 1 | `pm package explore --project` | ~0.5-2k | See what is installed. |
24
+ | 1 | `pm package doctor --detail deep` | ~1-3k | Diagnose activation failures. |
25
+ | 2 | `pm contracts --runtime-only --availability-only` | ~1-2k | What this install exposes. |
26
+ | 3 | `references/*.md` below | ~0.3-1k | Procedure detail. |
27
+ | 4 | `docs/EXTENSIONS.md`, `docs/EXTENSION_LIFECYCLE.md` | varies | Only when routed there. |
28
+
29
+ Optional deep routing that never goes stale:
30
+
31
+ ```bash
32
+ pm install guide-shell --project
33
+ pm guide extensions
34
+ ```
35
+
36
+ ## Non-Negotiables
37
+
38
+ - Author identity is detected automatically. **Never pass `--author`, never set
39
+ `PM_AUTHOR`.**
40
+ - Declare the minimum capability set; anything undeclared is not granted.
41
+ - Never mirror a public SDK type inside a package — import it or derive it.
42
+ - Inspect before mutating; verify exposure after.
43
+
44
+ ## Before Creating A Package
45
+
46
+ Check whether an existing package already owns the capability. Extending a
47
+ published package is almost always correct; a near-duplicate package is the
48
+ most expensive mistake in an ecosystem.
49
+
50
+ ```bash
51
+ pm package explore --project
52
+ pm package explore --global
53
+ pm contracts --runtime-only --availability-only
54
+ ```
55
+
56
+ ## Lifecycle Loop
57
+
58
+ ```bash
59
+ pm package explore --project # inspect state first
60
+ pm package manage --detail summary
61
+ pm package doctor --detail deep
62
+ pm install <package> --project # then mutate
63
+ pm contracts --command <extension-command> --flags-only
64
+ pm package doctor --detail deep # verify after
65
+ ```
66
+
67
+ Order matters: inspect, mutate, verify exposure, record evidence on the linked
68
+ pm item. Deactivation and uninstall are reversible only if you recorded what
69
+ they removed.
70
+
71
+ ## Authoring
72
+
73
+ Author with `defineExtension` and declared capabilities. A capability the
74
+ manifest does not declare is not granted at activation, which is what keeps a
75
+ third-party extension from silently widening its own reach.
76
+
77
+ ```bash
78
+ pm contracts --command package --flags-only
79
+ pm contracts --schema-only
80
+ ```
81
+
82
+ Packages ship TypeScript entries and are loaded through native type stripping,
83
+ so there is no separate build step for a package's own sources. Installed npm
84
+ extensions are not tracked in the host repository; only the managed-extension
85
+ manifest is.
86
+
87
+ ## Verification
88
+
89
+ ```bash
90
+ pm package doctor --detail deep
91
+ pm contracts --runtime-only --availability-only
92
+ pm health --check-only
93
+ pm validate --check-resolution
94
+ ```
95
+
96
+ An extension is correctly integrated when `pm contracts` reports its commands
97
+ and actions as available and `pm <command> --help --json` returns a complete
98
+ flag contract for each one.
99
+
100
+ ## References
101
+
102
+ | Need | Load | Cost |
103
+ | --------------------------------- | ---------------------------------------------------- | -------- |
104
+ | Lifecycle recipes | [Extension lifecycle](references/LIFECYCLE.md) | ~450 tok |
105
+ | Failure diagnosis playbook | [Troubleshooting](references/TROUBLESHOOTING.md) | ~300 tok |
106
+ | Authoring an extension end to end | [Authoring](references/AUTHORING.md) | ~900 tok |
@@ -0,0 +1,95 @@
1
+ # Authoring An Extension
2
+
3
+ The procedure, with routes into the detail rather than a copy of it.
4
+
5
+ ## Route To A Section
6
+
7
+ ```bash
8
+ grep -n "^## " docs/EXTENSIONS.md
9
+ sed -n '<start>,<end>p' docs/EXTENSIONS.md
10
+ ```
11
+
12
+ | Topic | Heading in docs/EXTENSIONS.md |
13
+ | ------------------------------ | ----------------------------- |
14
+ | Where packages come from | `## Package Sources` |
15
+ | Package manifest fields | `## Package Manifest` |
16
+ | Directory layout | `## Extension Layout` |
17
+ | Extension manifest fields | `## Extension Manifest` |
18
+ | Capability and governance policy| `## Governance Policy` |
19
+ | Name collisions | `## Registration Collisions` |
20
+ | Runtime APIs available | `## Runtime APIs` |
21
+ | Lifecycle commands | `## Lifecycle Commands` |
22
+ | Upgrades | `## Upgrade Workflow` |
23
+ | Runnable examples | `## Runnable Examples` |
24
+
25
+ Author-time contracts live in
26
+ [docs/EXTENSION_AUTHOR_CONTRACTS.md](../../../../docs/EXTENSION_AUTHOR_CONTRACTS.md)
27
+ and lifecycle detail in
28
+ [docs/EXTENSION_LIFECYCLE.md](../../../../docs/EXTENSION_LIFECYCLE.md).
29
+
30
+ ## Shape
31
+
32
+ An extension exports `activate(api)` and registers through the `register*`
33
+ family, or declares itself with `defineExtension` and a blueprint. Both forms
34
+ end in the same registration, so choose declarative authoring when the surface
35
+ is static and imperative activation when registration depends on runtime state.
36
+
37
+ Registrable surfaces:
38
+
39
+ - Commands and command actions
40
+ - Custom item types and their fields
41
+ - Statuses with declared lifecycle roles
42
+ - Importers and exporters
43
+ - Search providers
44
+ - Project profiles
45
+ - Templates
46
+
47
+ ## Capabilities Are Declared, Not Assumed
48
+
49
+ The manifest declares what the extension may do. Anything undeclared is not
50
+ granted at activation. Declare the minimum, then verify:
51
+
52
+ ```bash
53
+ pm package doctor --detail deep
54
+ pm contracts --runtime-only --availability-only
55
+ ```
56
+
57
+ A declared version bound must be one the loader actually enforces — a bound
58
+ written in a field nothing reads is worse than no bound, because it reads as a
59
+ guarantee.
60
+
61
+ ## Sources
62
+
63
+ Extensions come from npm, GitHub, a bundled package, or a local directory, and
64
+ the same source works from all four. Package runtime modules use ordinary
65
+ static ESM imports from the published SDK entrypoints; they do not locate copied
66
+ source files through environment variables or generate loader shims.
67
+
68
+ Never mirror a public SDK type inside a package. Import it, or derive its shape
69
+ with `typeof`. A hand-copied signature becomes immutable consumer code the
70
+ moment the package publishes.
71
+
72
+ ## Author Loop
73
+
74
+ ```bash
75
+ pm package init <name> # scaffold
76
+ # ...implement extensions/*.ts...
77
+ pm install <path-or-name> --project # install locally
78
+ pm package doctor --detail deep # activation diagnostics
79
+ pm contracts --command <your-command> --flags-only
80
+ pm <your-command> --help --json # the contract a consumer will read
81
+ ```
82
+
83
+ Record the work on a pm item as you go: link the package sources with
84
+ `pm files`, the docs with `pm docs`, and a runnable check with `pm test`.
85
+
86
+ ## Release Safety
87
+
88
+ ```bash
89
+ pm package doctor --detail deep
90
+ pm contracts --runtime-only --availability-only
91
+ pm health --check-only
92
+ ```
93
+
94
+ An extension that changes what a shared command emits is changing a contract,
95
+ not adding a feature. Treat the contract snapshot as the review artifact.
@@ -0,0 +1,40 @@
1
+ # Extension Lifecycle Recipes
2
+
3
+ ## Inspect Current State
4
+
5
+ ```bash
6
+ pm package explore --project
7
+ pm package manage --detail summary
8
+ pm package doctor --detail deep
9
+ ```
10
+
11
+ ## Install and Activate
12
+
13
+ ```bash
14
+ pm install <target> --project
15
+ pm package activate <target> --project
16
+ pm package doctor --detail summary
17
+ ```
18
+
19
+ ## Adopt Existing Extensions
20
+
21
+ ```bash
22
+ pm package adopt <name> --project
23
+ pm package adopt-all --project
24
+ pm package manage --detail summary
25
+ ```
26
+
27
+ ## Deactivate / Uninstall
28
+
29
+ ```bash
30
+ pm package deactivate <target> --project
31
+ pm package uninstall <target> --project
32
+ pm package doctor --detail deep
33
+ ```
34
+
35
+ ## Contract Checks
36
+
37
+ ```bash
38
+ pm contracts --runtime-only --availability-only
39
+ pm contracts --command package --flags-only
40
+ ```
@@ -0,0 +1,25 @@
1
+ # Extension Troubleshooting
2
+
3
+ ## Common Diagnostic Sequence
4
+
5
+ 1. `pm extension explore --project`
6
+ 2. `pm extension manage --detail summary`
7
+ 3. `pm extension doctor --detail deep --trace`
8
+ 4. `pm contracts --runtime-only --availability-only`
9
+
10
+ ## Symptoms and Checks
11
+
12
+ - **Command not visible**
13
+ - Confirm extension is managed and active.
14
+ - Confirm capability includes `commands`.
15
+ - Check `pm contracts` action availability.
16
+
17
+ - **Schema mismatch**
18
+ - Confirm capability includes `schema`.
19
+ - Re-run doctor with `--detail deep --trace`.
20
+ - Validate runtime-only contracts output.
21
+
22
+ - **Unexpected behavior after updates**
23
+ - Check registration precedence with manage/doctor.
24
+ - Run with `--no-extensions` to isolate core behavior.
25
+ - Re-activate extension after fixing manifest or entry path.
@@ -0,0 +1,107 @@
1
+ ---
2
+ name: pm-sdk
3
+ description: Implements pm-cli integrations on the published @unbrained/pm-cli SDK entrypoints and runtime contracts. Use when authoring extensions, embedding pm in another tool, building a domain on pm primitives, or keeping a wrapper aligned with command/action schema changes.
4
+ license: MIT
5
+ compatibility: Requires Node.js and access to pm contracts output for runtime parity checks.
6
+ metadata:
7
+ owner: unbrained
8
+ domain: pm-cli
9
+ scope: sdk-integration
10
+ ---
11
+
12
+ # pm SDK Skill
13
+
14
+ The SDK is the implementation; the CLI and the MCP server are thin consumers of
15
+ it. Anything the CLI can do is reachable from the published surface, and an
16
+ integration should never import repository internals to get it.
17
+
18
+ ## Load Order
19
+
20
+ | Tier | Load | Cost | When |
21
+ | ---- | ----------------------------------------------- | --------- | ------------------------------------- |
22
+ | 0 | This file | ~700 tok | Always. |
23
+ | 1 | `pm contracts --summary` | ~2.6k | The command/action surface. |
24
+ | 1 | `sdk/public-surface.json` | query it | Exact exported symbols and signatures.|
25
+ | 2 | `pm contracts --command <cmd> --full --json` | ~1-4k | One command's complete contract. |
26
+ | 3 | `references/*.md` below | ~0.3-1k | Procedure detail. |
27
+ | 4 | `docs/SDK.md` **by section only** | 45k whole | Never read whole; grep to a heading. |
28
+
29
+ Optional deep routing that never goes stale:
30
+
31
+ ```bash
32
+ pm install guide-shell --project
33
+ pm guide sdk
34
+ pm guide tokens --depth brief
35
+ ```
36
+
37
+ ## Entrypoints
38
+
39
+ Import the narrowest entrypoint that owns the capability. Startup cost is
40
+ proportional to what you import.
41
+
42
+ | Export | Capability family |
43
+ | ----------------------------------------- | -------------------------------------------------------- |
44
+ | `@unbrained/pm-cli/sdk/core` | Items, schema, profile, transactions, runtime primitives |
45
+ | `@unbrained/pm-cli/sdk/query` | List and search engines, filtering, pagination, rendering |
46
+ | `@unbrained/pm-cli/sdk/graph` | Relationship stores, traversal, analytics, remediation |
47
+ | `@unbrained/pm-cli/sdk/governance` | Validation, health, gc, transaction cleanup |
48
+ | `@unbrained/pm-cli/sdk/merge` | VCS-neutral tracker merge contracts |
49
+ | `@unbrained/pm-cli/sdk/authoring` | Extension blueprints, builders, manifests |
50
+ | `@unbrained/pm-cli/sdk/contracts` | Static command/action contracts, expected-error protocol |
51
+ | `@unbrained/pm-cli/sdk/runtime` | Embedded command execution, package runtime helpers |
52
+ | `@unbrained/pm-cli/sdk/testing` | Package and extension assertion/invocation helpers |
53
+ | `@unbrained/pm-cli/sdk` | Compatibility aggregate over every supported export |
54
+ | `@unbrained/pm-cli/sdk/public-surface.json` | Machine-readable surface snapshot shipped with the package |
55
+ | `@unbrained/pm-cli/cli` | Executable entry (`runPmCli`), not a typed library API |
56
+
57
+ Query the shipped surface instead of guessing a symbol name:
58
+
59
+ ```bash
60
+ jq -r '.entrypoints["./sdk/graph"].symbols[].name' \
61
+ node_modules/@unbrained/pm-cli/sdk/public-surface.json | head -40
62
+ ```
63
+
64
+ ## Non-Negotiables
65
+
66
+ - Never import from `src/core/...` or any unpublished module path. The boundary
67
+ is gated and a private import fails the build.
68
+ - Never mirror an SDK type in your own package. Import it or derive it with
69
+ `typeof`; a hand-copied signature becomes immutable consumer code.
70
+ - Treat `pm contracts` output as the source of truth for flags, actions, and
71
+ availability. Snapshot it in a test so drift fails rather than surprises.
72
+ - Author identity is detected automatically. Pass an author only for a
73
+ deliberate identity override.
74
+
75
+ ## Integration Loop
76
+
77
+ 1. Capture the runtime surface: `pm contracts --schema-only`,
78
+ `pm contracts --runtime-only --availability-only`.
79
+ 2. Map payload fields to contract keys — do not assume the CLI flag spelling
80
+ equals the SDK option key.
81
+ 3. Implement against the narrowest entrypoint.
82
+ 4. Add a regression test that fails when a required contract field drifts.
83
+ 5. Verify the packed artifact, not just the working tree.
84
+
85
+ ## Surface Compatibility
86
+
87
+ The published surface is a reviewed artifact. Additive changes are recorded;
88
+ removals and signature changes require an explicit acknowledgement with a
89
+ reason that stays in the snapshot.
90
+
91
+ ```bash
92
+ pnpm sdk:surface:check
93
+ pnpm sdk:surface:update
94
+ pnpm sdk:surface:update -- --acknowledge-breaking "<release rationale>"
95
+ ```
96
+
97
+ Every package export that declares a `types` path must carry a classification,
98
+ so a new public entrypoint cannot ship ungoverned.
99
+
100
+ ## References
101
+
102
+ | Need | Load | Cost |
103
+ | ------------------------------------------- | -------------------------------------------------------- | -------- |
104
+ | Step-by-step integration checklist | [Integration checklist](references/INTEGRATION_CHECKLIST.md) | ~400 tok |
105
+ | Prompt templates | [Prompts](references/PROMPTS.md) | ~200 tok |
106
+ | Which entrypoint owns which capability | [Surface map](references/SURFACE_MAP.md) | ~900 tok |
107
+ | Building a non-PM domain on pm primitives | [Domain modeling](references/DOMAIN_MODELING.md) | ~900 tok |
@@ -0,0 +1,78 @@
1
+ # Modeling A Domain On pm Primitives
2
+
3
+ pm's primitives are not specific to software project management. A record with
4
+ a type, a status lifecycle, typed relationships, an append-only history, and
5
+ bounded reads describes many domains. This reference is the procedure for
6
+ building one.
7
+
8
+ ## The Primitive Set
9
+
10
+ | Primitive | What it gives the domain |
11
+ | -------------------- | ---------------------------------------------------------- |
12
+ | Item type | The nouns of the domain |
13
+ | Status + lifecycle role | The state machine each noun moves through |
14
+ | Typed relationship | The verbs between nouns, with direction and inverse |
15
+ | Custom fields | Domain attributes with declared types |
16
+ | Append-only history | Immutable proof of every transition, restorable to any version |
17
+ | Assurance gate | The domain's invariants, declared as data |
18
+ | Projection + budget | Bounded reads that stay usable as the corpus grows |
19
+ | Extension | Domain-specific commands over the same substrate |
20
+
21
+ ## Procedure
22
+
23
+ 1. **Name the nouns as item types.**
24
+
25
+ ```bash
26
+ pm schema add-type --name Experiment --description "One training run"
27
+ pm contracts --schema-only
28
+ ```
29
+
30
+ 2. **Give each type its lifecycle.** A status without a declared lifecycle role
31
+ is orphaned from every work-selection surface, so declare the role.
32
+
33
+ 3. **Name the verbs as relationship kinds.** Prefer the built-in typed kinds
34
+ where the meaning matches — `implements`, `verifies`, `discovered_from`,
35
+ `supersedes`, `incident_from`, `blocked_by`, `parent`. Reach for `related`
36
+ only when the relationship genuinely has no direction.
37
+
38
+ 4. **Declare invariants rather than writing checker scripts.** A floor, a
39
+ ceiling, or a monotone property over the record is expressible as an
40
+ assurance measurement plus an assertion, evaluated by the SDK and bound to a
41
+ trigger. See `pm guide assurance`.
42
+
43
+ 5. **Ship domain verbs as an extension**, not as a fork. Extensions register
44
+ commands, item types, importers, exporters, search providers, and profiles
45
+ through `defineExtension` and declared capabilities.
46
+
47
+ 6. **Prove it from the published surface only.** If the domain needs something
48
+ the published SDK cannot express, that is a gap in the SDK, not a reason to
49
+ import internals.
50
+
51
+ ## Workflow Shapes This Already Serves
52
+
53
+ - **Tracker** — the default shape: work items, lifecycle, evidence.
54
+ - **Evaluation and benchmark** — cases as items, runs as history entries,
55
+ scores as recorded verdicts, invariants as gates.
56
+ - **RL and sim-to-RL environment** — an episode is a bounded observation, an
57
+ action is a recorded mutation, the trajectory is the history stream read in
58
+ order, and the reward is a declared predicate over recorded state.
59
+ - **Incident and change management** — `incident_from` and `supersedes` carry
60
+ causality; history carries the audit trail.
61
+ - **Content-addressed or temporal domains** — items as versions, `supersedes`
62
+ as lineage, point-in-time reads as the query.
63
+
64
+ The property that makes all of these work is the same one: every mutation is
65
+ recorded immutably and every read can be bounded, so the record is both proof
66
+ and context.
67
+
68
+ ## Checks Before Calling A Domain Pack Done
69
+
70
+ ```bash
71
+ pm contracts --schema-only --json | jq '.schema.types'
72
+ pm validate --check-lifecycle --check-resolution
73
+ pm graph audit --json | jq '.profile.edges_by_kind'
74
+ pm assurance run <your-gate> --trigger ci --dry-run --json
75
+ ```
76
+
77
+ A domain pack is complete when a new agent can be handed the workspace and the
78
+ contracts, with no prose, and still act correctly.
@@ -0,0 +1,31 @@
1
+ # SDK Integration Checklist
2
+
3
+ ## Contract Capture
4
+
5
+ ```bash
6
+ pm contracts --schema-only --json
7
+ pm contracts --runtime-only --availability-only --json
8
+ pm contracts --command <command> --flags-only --json
9
+ ```
10
+
11
+ ## Implementation Rules
12
+
13
+ - Use `@unbrained/pm-cli/sdk` exports only.
14
+ - Do not import internal runtime modules from `src/core/...`.
15
+ - Keep action/flag mappings derived from `pm contracts` outputs.
16
+ - Handle extension-unavailable states through availability metadata.
17
+
18
+ ## Validation
19
+
20
+ ```bash
21
+ pnpm build
22
+ node scripts/run-tests.mjs test -- <targeted sdk/integration tests>
23
+ node scripts/run-tests.mjs coverage
24
+ ```
25
+
26
+ ## Release Readiness
27
+
28
+ ```bash
29
+ node scripts/release/docs-skills-gate.mjs
30
+ node scripts/release/run-gates.mjs --telemetry-mode best-effort
31
+ ```
@@ -0,0 +1,13 @@
1
+ # SDK Prompt Templates
2
+
3
+ ## Runtime Contract Mapping
4
+
5
+ `Map this integration request to pm contracts output first, then generate implementation steps keyed to command flags and action schema fields.`
6
+
7
+ ## Extension Capability Design
8
+
9
+ `Design extension capabilities for <feature> using defineExtension. Include only needed capabilities and provide a verification command list for activation and contracts checks.`
10
+
11
+ ## Wrapper Parity Check
12
+
13
+ `Audit wrapper action/command mapping parity against current pm contracts output and report any missing or stale fields with patch recommendations.`
@@ -0,0 +1,82 @@
1
+ # SDK Surface Map
2
+
3
+ Where each capability lives, and how to reach the detail without loading
4
+ [docs/SDK.md](../../../../docs/SDK.md) whole (~45k tokens).
5
+
6
+ ## Route To A Section, Not To The File
7
+
8
+ ```bash
9
+ grep -n "^## \|^### " docs/SDK.md # heading index, ~40 lines
10
+ sed -n '<start>,<end>p' docs/SDK.md # read one section
11
+ ```
12
+
13
+ | Topic | Heading in docs/SDK.md |
14
+ | ---------------------------------------- | --------------------------------- |
15
+ | Install and package resolution | `## Install` |
16
+ | Entrypoints and import cost | `## Import Surfaces` |
17
+ | Surface snapshot and breaking-change gate | `### Public-surface compatibility`|
18
+ | The full export inventory | `## Public Exports` |
19
+ | Building a custom project tool | `### Build an entire custom project tool` |
20
+ | Building a non-PM domain | `### Build a non-PM temporal domain` |
21
+ | Plan workflows | `### Plan workflows` |
22
+ | History, restore, rich item reads | `### Immutable history and rich item reads` |
23
+ | Linked resources and dependency governance| `### Linked resources and dependency governance` |
24
+ | Output budgets and discovery | `### Agent output budgets and discovery` |
25
+ | Static and runtime contracts | `## Static And Runtime Contracts` |
26
+ | Atomic workspace transactions | `### Atomic workspace transactions` |
27
+ | Schema evolution | `### Schema evolution and workspace history` |
28
+ | Query execution | `### Query execution` |
29
+ | Context relevance and evaluation | `### Context relevance and evaluation` |
30
+ | Extension capability requirements | `## Capability Requirements` |
31
+ | Declarative authoring and blueprints | `## Declarative Authoring` |
32
+ | Testing helpers | `## Testing Helpers` |
33
+ | Custom item types | `## Custom Item Type` |
34
+ | Importers and exporters | `## Importer / Exporter` |
35
+ | Search providers | `## Search Provider` |
36
+
37
+ ## Query The Shipped Surface
38
+
39
+ `sdk/public-surface.json` ships inside the package, so an integration can read
40
+ the exact surface it compiled against without locating repository files.
41
+
42
+ ```bash
43
+ SURFACE=node_modules/@unbrained/pm-cli/sdk/public-surface.json
44
+
45
+ # Which entrypoints exist and how they are classified
46
+ jq -r '.entrypoints | to_entries[] | "\(.key)\t\(.value.classification)"' "$SURFACE"
47
+
48
+ # Does a symbol exist, and where
49
+ jq -r --arg n createItem '.entrypoints | to_entries[]
50
+ | select(.value.symbols[]?.name == $n) | .key' "$SURFACE"
51
+
52
+ # The exact signature the package compiled against
53
+ jq -r --arg n createItem '.entrypoints["./sdk"].symbols[]
54
+ | select(.name == $n) | .signature' "$SURFACE"
55
+
56
+ # Stable error-code vocabulary
57
+ jq -r '.error_codes[]' "$SURFACE" | head -30
58
+ ```
59
+
60
+ Classifications carry intent:
61
+
62
+ - `supported` — stable authoring surface.
63
+ - `contract_data` — generated contract tables.
64
+ - `advanced_export` — reachable but not the recommended path.
65
+ - `aggregate_alias` — republishes another entrypoint's declarations verbatim.
66
+ - `executable_entry` — the CLI runtime entry, not a typed library API.
67
+
68
+ ## Other Contract Artifacts
69
+
70
+ | Artifact | Answers |
71
+ | ------------------------------------------ | ---------------------------------------------- |
72
+ | `pm contracts --summary --json` | Commands, intents, per-command token ceilings |
73
+ | `pm contracts --command <c> --full --json` | Flags, exit vocabulary, output contract |
74
+ | `pm contracts --schema-only` | Item schema, types, statuses, fields |
75
+ | `pm contracts --runtime-only --availability-only` | What this installation actually exposes |
76
+ | `pm contracts --json --full \| jq '.mcp_tools'` | The MCP tool surface |
77
+ | `pm contracts --json --full \| jq '.relationship_kind_contracts'` | Edge kinds and inverses |
78
+ | `docs/generated/AGENT_COMMAND_SURFACE.md` | Command visibility tiers |
79
+
80
+ `contracts --json --full` is large enough that the default budget omits it.
81
+ Pass `--output-budget unbounded` when scripting it, and never into an agent's
82
+ own context unfiltered — pipe it through `jq` first.