@unbrained/pm-cli 2026.5.1 → 2026.5.3-5

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 (265) hide show
  1. package/AGENTS.md +8 -1
  2. package/CHANGELOG.md +73 -4
  3. package/CONTRIBUTING.md +11 -5
  4. package/PRD.md +17 -1
  5. package/README.md +55 -1099
  6. package/SECURITY.md +6 -11
  7. package/dist/cli/bootstrap-args.d.ts +18 -0
  8. package/dist/cli/bootstrap-args.js +242 -0
  9. package/dist/cli/bootstrap-args.js.map +1 -0
  10. package/dist/cli/commander-usage.d.ts +17 -0
  11. package/dist/cli/commander-usage.js +178 -0
  12. package/dist/cli/commander-usage.js.map +1 -0
  13. package/dist/cli/commands/activity.d.ts +10 -0
  14. package/dist/cli/commands/activity.js +14 -10
  15. package/dist/cli/commands/activity.js.map +1 -1
  16. package/dist/cli/commands/aggregate.js.map +1 -1
  17. package/dist/cli/commands/append.js.map +1 -1
  18. package/dist/cli/commands/calendar.js +19 -34
  19. package/dist/cli/commands/calendar.js.map +1 -1
  20. package/dist/cli/commands/claim.js.map +1 -1
  21. package/dist/cli/commands/close.js.map +1 -1
  22. package/dist/cli/commands/comments-audit.js.map +1 -1
  23. package/dist/cli/commands/comments.js +1 -9
  24. package/dist/cli/commands/comments.js.map +1 -1
  25. package/dist/cli/commands/completion.js.map +1 -1
  26. package/dist/cli/commands/config.d.ts +21 -3
  27. package/dist/cli/commands/config.js +118 -2
  28. package/dist/cli/commands/config.js.map +1 -1
  29. package/dist/cli/commands/context.d.ts +90 -1
  30. package/dist/cli/commands/context.js +496 -12
  31. package/dist/cli/commands/context.js.map +1 -1
  32. package/dist/cli/commands/contracts.js.map +1 -1
  33. package/dist/cli/commands/create.js +2 -2
  34. package/dist/cli/commands/create.js.map +1 -1
  35. package/dist/cli/commands/dedupe-audit.js +2 -11
  36. package/dist/cli/commands/dedupe-audit.js.map +1 -1
  37. package/dist/cli/commands/delete.js.map +1 -1
  38. package/dist/cli/commands/deps.js.map +1 -1
  39. package/dist/cli/commands/docs.js.map +1 -1
  40. package/dist/cli/commands/extension.js.map +1 -1
  41. package/dist/cli/commands/files.js +14 -2
  42. package/dist/cli/commands/files.js.map +1 -1
  43. package/dist/cli/commands/gc.js.map +1 -1
  44. package/dist/cli/commands/get.js.map +1 -1
  45. package/dist/cli/commands/health.js +16 -12
  46. package/dist/cli/commands/health.js.map +1 -1
  47. package/dist/cli/commands/history.js +1 -9
  48. package/dist/cli/commands/history.js.map +1 -1
  49. package/dist/cli/commands/index.js.map +1 -1
  50. package/dist/cli/commands/init.js.map +1 -1
  51. package/dist/cli/commands/learnings.js +1 -9
  52. package/dist/cli/commands/learnings.js.map +1 -1
  53. package/dist/cli/commands/list.d.ts +1 -0
  54. package/dist/cli/commands/list.js +13 -31
  55. package/dist/cli/commands/list.js.map +1 -1
  56. package/dist/cli/commands/normalize.js +14 -23
  57. package/dist/cli/commands/normalize.js.map +1 -1
  58. package/dist/cli/commands/notes.js +1 -9
  59. package/dist/cli/commands/notes.js.map +1 -1
  60. package/dist/cli/commands/reindex.js +2 -7
  61. package/dist/cli/commands/reindex.js.map +1 -1
  62. package/dist/cli/commands/restore.js.map +1 -1
  63. package/dist/cli/commands/search.js +4 -35
  64. package/dist/cli/commands/search.js.map +1 -1
  65. package/dist/cli/commands/stats.js.map +1 -1
  66. package/dist/cli/commands/templates.js.map +1 -1
  67. package/dist/cli/commands/test-all.js.map +1 -1
  68. package/dist/cli/commands/test-runs.js +1 -11
  69. package/dist/cli/commands/test-runs.js.map +1 -1
  70. package/dist/cli/commands/test.js.map +1 -1
  71. package/dist/cli/commands/update-many.js +1 -6
  72. package/dist/cli/commands/update-many.js.map +1 -1
  73. package/dist/cli/commands/update.js +2 -2
  74. package/dist/cli/commands/update.js.map +1 -1
  75. package/dist/cli/commands/validate.js +23 -18
  76. package/dist/cli/commands/validate.js.map +1 -1
  77. package/dist/cli/error-guidance.d.ts +13 -0
  78. package/dist/cli/error-guidance.js +56 -6
  79. package/dist/cli/error-guidance.js.map +1 -1
  80. package/dist/cli/extension-command-help.d.ts +48 -0
  81. package/dist/cli/extension-command-help.js +389 -0
  82. package/dist/cli/extension-command-help.js.map +1 -0
  83. package/dist/cli/extension-command-options.js.map +1 -1
  84. package/dist/cli/help-content.js +9 -3
  85. package/dist/cli/help-content.js.map +1 -1
  86. package/dist/cli/help-json-payload.d.ts +25 -0
  87. package/dist/cli/help-json-payload.js +265 -0
  88. package/dist/cli/help-json-payload.js.map +1 -0
  89. package/dist/cli/main.js +1000 -4456
  90. package/dist/cli/main.js.map +1 -1
  91. package/dist/cli/migration-gates.d.ts +22 -0
  92. package/dist/cli/migration-gates.js +146 -0
  93. package/dist/cli/migration-gates.js.map +1 -0
  94. package/dist/cli/register-list-query.d.ts +2 -0
  95. package/dist/cli/register-list-query.js +317 -0
  96. package/dist/cli/register-list-query.js.map +1 -0
  97. package/dist/cli/register-mutation.d.ts +2 -0
  98. package/dist/cli/register-mutation.js +795 -0
  99. package/dist/cli/register-mutation.js.map +1 -0
  100. package/dist/cli/register-operations.d.ts +2 -0
  101. package/dist/cli/register-operations.js +610 -0
  102. package/dist/cli/register-operations.js.map +1 -0
  103. package/dist/cli/register-setup.d.ts +2 -0
  104. package/dist/cli/register-setup.js +334 -0
  105. package/dist/cli/register-setup.js.map +1 -0
  106. package/dist/cli/registration-helpers.d.ts +53 -0
  107. package/dist/cli/registration-helpers.js +669 -0
  108. package/dist/cli/registration-helpers.js.map +1 -0
  109. package/dist/cli/shared-parsers.d.ts +6 -0
  110. package/dist/cli/shared-parsers.js +40 -0
  111. package/dist/cli/shared-parsers.js.map +1 -0
  112. package/dist/cli.d.ts +1 -1
  113. package/dist/cli.js +3 -1
  114. package/dist/cli.js.map +1 -1
  115. package/dist/core/extensions/extension-types.d.ts +605 -0
  116. package/dist/core/extensions/extension-types.js +22 -0
  117. package/dist/core/extensions/extension-types.js.map +1 -0
  118. package/dist/core/extensions/index.js.map +1 -1
  119. package/dist/core/extensions/item-fields.js.map +1 -1
  120. package/dist/core/extensions/loader.d.ts +2 -586
  121. package/dist/core/extensions/loader.js +3 -21
  122. package/dist/core/extensions/loader.js.map +1 -1
  123. package/dist/core/extensions/runtime-registrations.js.map +1 -1
  124. package/dist/core/fs/fs-utils.js.map +1 -1
  125. package/dist/core/fs/index.js.map +1 -1
  126. package/dist/core/history/history-stream-policy.js.map +1 -1
  127. package/dist/core/history/history.js.map +1 -1
  128. package/dist/core/history/index.js.map +1 -1
  129. package/dist/core/item/id.js.map +1 -1
  130. package/dist/core/item/index.js.map +1 -1
  131. package/dist/core/item/item-format.js.map +1 -1
  132. package/dist/core/item/parent-reference-policy.js.map +1 -1
  133. package/dist/core/item/parse.js +6 -0
  134. package/dist/core/item/parse.js.map +1 -1
  135. package/dist/core/item/sprint-release-format.js.map +1 -1
  136. package/dist/core/item/status.js.map +1 -1
  137. package/dist/core/item/type-registry.js.map +1 -1
  138. package/dist/core/lock/index.js.map +1 -1
  139. package/dist/core/lock/lock.js +1 -6
  140. package/dist/core/lock/lock.js.map +1 -1
  141. package/dist/core/output/command-aware.js.map +1 -1
  142. package/dist/core/output/output.js.map +1 -1
  143. package/dist/core/schema/runtime-field-filters.js.map +1 -1
  144. package/dist/core/schema/runtime-field-values.js.map +1 -1
  145. package/dist/core/schema/runtime-schema.js.map +1 -1
  146. package/dist/core/search/cache.js +1 -7
  147. package/dist/core/search/cache.js.map +1 -1
  148. package/dist/core/search/embedding-batches.js +4 -0
  149. package/dist/core/search/embedding-batches.js.map +1 -1
  150. package/dist/core/search/http-client.d.ts +29 -0
  151. package/dist/core/search/http-client.js +64 -0
  152. package/dist/core/search/http-client.js.map +1 -0
  153. package/dist/core/search/providers.d.ts +3 -13
  154. package/dist/core/search/providers.js +19 -88
  155. package/dist/core/search/providers.js.map +1 -1
  156. package/dist/core/search/semantic-defaults.js +2 -7
  157. package/dist/core/search/semantic-defaults.js.map +1 -1
  158. package/dist/core/search/vector-stores.d.ts +4 -13
  159. package/dist/core/search/vector-stores.js +40 -93
  160. package/dist/core/search/vector-stores.js.map +1 -1
  161. package/dist/core/sentry/helpers.d.ts +27 -0
  162. package/dist/core/sentry/helpers.js +171 -0
  163. package/dist/core/sentry/helpers.js.map +1 -0
  164. package/dist/core/sentry/instrument.d.ts +25 -0
  165. package/dist/core/sentry/instrument.js +204 -0
  166. package/dist/core/sentry/instrument.js.map +1 -0
  167. package/dist/core/shared/command-types.js.map +1 -1
  168. package/dist/core/shared/conflict-markers.js.map +1 -1
  169. package/dist/core/shared/constants.d.ts +3 -0
  170. package/dist/core/shared/constants.js +58 -1
  171. package/dist/core/shared/constants.js.map +1 -1
  172. package/dist/core/shared/errors.js.map +1 -1
  173. package/dist/core/shared/index.d.ts +1 -0
  174. package/dist/core/shared/index.js +1 -0
  175. package/dist/core/shared/index.js.map +1 -1
  176. package/dist/core/shared/primitives.d.ts +13 -0
  177. package/dist/core/shared/primitives.js +33 -0
  178. package/dist/core/shared/primitives.js.map +1 -0
  179. package/dist/core/shared/serialization.js.map +1 -1
  180. package/dist/core/shared/text-normalization.js.map +1 -1
  181. package/dist/core/shared/time.js.map +1 -1
  182. package/dist/core/store/front-matter-cache.d.ts +6 -0
  183. package/dist/core/store/front-matter-cache.js +150 -0
  184. package/dist/core/store/front-matter-cache.js.map +1 -0
  185. package/dist/core/store/index.js.map +1 -1
  186. package/dist/core/store/item-format-migration.js.map +1 -1
  187. package/dist/core/store/item-store.js +46 -36
  188. package/dist/core/store/item-store.js.map +1 -1
  189. package/dist/core/store/paths.js.map +1 -1
  190. package/dist/core/store/settings.js +36 -0
  191. package/dist/core/store/settings.js.map +1 -1
  192. package/dist/core/telemetry/consent.js.map +1 -1
  193. package/dist/core/telemetry/observability.d.ts +24 -0
  194. package/dist/core/telemetry/observability.js +185 -0
  195. package/dist/core/telemetry/observability.js.map +1 -0
  196. package/dist/core/telemetry/runtime.d.ts +29 -3
  197. package/dist/core/telemetry/runtime.js +337 -25
  198. package/dist/core/telemetry/runtime.js.map +1 -1
  199. package/dist/core/test/background-runs.js.map +1 -1
  200. package/dist/core/test/item-test-run-tracking.js.map +1 -1
  201. package/dist/sdk/cli-contracts.js +28 -0
  202. package/dist/sdk/cli-contracts.js.map +1 -1
  203. package/dist/sdk/index.d.ts +1 -1
  204. package/dist/sdk/index.js.map +1 -1
  205. package/dist/types/index.js.map +1 -1
  206. package/dist/types.d.ts +21 -0
  207. package/dist/types.js +11 -0
  208. package/dist/types.js.map +1 -1
  209. package/docs/AGENT_GUIDE.md +125 -0
  210. package/docs/ARCHITECTURE.md +201 -478
  211. package/docs/COMMANDS.md +209 -0
  212. package/docs/CONFIGURATION.md +146 -0
  213. package/docs/EXTENSIONS.md +146 -645
  214. package/docs/QUICKSTART.md +108 -0
  215. package/docs/README.md +70 -0
  216. package/docs/RELEASING.md +92 -50
  217. package/docs/SDK.md +127 -68
  218. package/docs/TESTING.md +125 -0
  219. package/docs/examples/starter-extension/README.md +39 -25
  220. package/package.json +24 -11
  221. package/dist/command-types.d.ts +0 -1
  222. package/dist/command-types.js +0 -2
  223. package/dist/command-types.js.map +0 -1
  224. package/dist/constants.d.ts +0 -1
  225. package/dist/constants.js +0 -2
  226. package/dist/constants.js.map +0 -1
  227. package/dist/errors.d.ts +0 -1
  228. package/dist/errors.js +0 -2
  229. package/dist/errors.js.map +0 -1
  230. package/dist/fs-utils.d.ts +0 -1
  231. package/dist/fs-utils.js +0 -2
  232. package/dist/fs-utils.js.map +0 -1
  233. package/dist/history.d.ts +0 -1
  234. package/dist/history.js +0 -2
  235. package/dist/history.js.map +0 -1
  236. package/dist/id.d.ts +0 -1
  237. package/dist/id.js +0 -2
  238. package/dist/id.js.map +0 -1
  239. package/dist/item-format.d.ts +0 -1
  240. package/dist/item-format.js +0 -2
  241. package/dist/item-format.js.map +0 -1
  242. package/dist/item-store.d.ts +0 -1
  243. package/dist/item-store.js +0 -2
  244. package/dist/item-store.js.map +0 -1
  245. package/dist/lock.d.ts +0 -1
  246. package/dist/lock.js +0 -2
  247. package/dist/lock.js.map +0 -1
  248. package/dist/output.d.ts +0 -1
  249. package/dist/output.js +0 -2
  250. package/dist/output.js.map +0 -1
  251. package/dist/parse.d.ts +0 -1
  252. package/dist/parse.js +0 -2
  253. package/dist/parse.js.map +0 -1
  254. package/dist/paths.d.ts +0 -1
  255. package/dist/paths.js +0 -2
  256. package/dist/paths.js.map +0 -1
  257. package/dist/serialization.d.ts +0 -1
  258. package/dist/serialization.js +0 -2
  259. package/dist/serialization.js.map +0 -1
  260. package/dist/settings.d.ts +0 -1
  261. package/dist/settings.js +0 -2
  262. package/dist/settings.js.map +0 -1
  263. package/dist/time.d.ts +0 -1
  264. package/dist/time.js +0 -2
  265. package/dist/time.js.map +0 -1
@@ -0,0 +1,108 @@
1
+ # Quickstart
2
+
3
+ Use this page to get from a clean repository to a tracked, verified item.
4
+
5
+ ## Agent Quick Context
6
+
7
+ - Start with `pm init`.
8
+ - Create items with enough metadata to route work, then enrich later.
9
+ - Claim before implementation.
10
+ - Link changed files, docs, and tests to the item.
11
+ - Close only after evidence is recorded.
12
+
13
+ Tracked documentation work: [pm-1sb2](../.agents/pm/tasks/pm-1sb2.toon).
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ npm install -g @unbrained/pm-cli
19
+ pm --version
20
+ ```
21
+
22
+ For one-off use:
23
+
24
+ ```bash
25
+ npx @unbrained/pm-cli --help
26
+ ```
27
+
28
+ ## Initialize a Repository
29
+
30
+ ```bash
31
+ pm init
32
+ pm health --check-only
33
+ ```
34
+
35
+ `pm init` creates `.agents/pm/` with settings, item folders, history, locks, search cache directories, and project extension storage.
36
+
37
+ ## Create Your First Item
38
+
39
+ Use strict create mode when all required fields are ready. Use progressive mode for staged triage.
40
+
41
+ ```bash
42
+ pm create \
43
+ --title "Add restore retry logging" \
44
+ --description "Restore should explain stale lock retry behavior." \
45
+ --type Task \
46
+ --status open \
47
+ --priority 1 \
48
+ --tags "restore,locks" \
49
+ --ac "Retry logs are visible and regression coverage passes." \
50
+ --create-mode progressive
51
+ ```
52
+
53
+ Useful item types:
54
+
55
+ | Type | Use |
56
+ |------|-----|
57
+ | `Epic` | broad outcome or initiative |
58
+ | `Feature` | user-facing capability or major slice |
59
+ | `Task` | implementation work |
60
+ | `Issue` | bug or defect |
61
+ | `Decision` | recorded choice and rationale |
62
+ | `Event`, `Reminder`, `Milestone`, `Meeting` | calendar-aware planning |
63
+
64
+ ## Find and Claim Work
65
+
66
+ ```bash
67
+ pm context --limit 10
68
+ pm search "restore lock retry" --limit 10
69
+ pm list-open --limit 20
70
+ pm claim <item-id>
71
+ pm update <item-id> --status in_progress --message "Start implementation"
72
+ ```
73
+
74
+ Do not create a duplicate item until `context`, `search`, and list commands show no relevant active item.
75
+
76
+ ## Link Work Artifacts
77
+
78
+ ```bash
79
+ pm files <item-id> --add path=src/core/lock/lock.ts,scope=project,note="implementation"
80
+ pm docs <item-id> --add path=docs/ARCHITECTURE.md,scope=project,note="design context"
81
+ pm test <item-id> --add command="node scripts/run-tests.mjs test -- tests/unit/lock.spec.ts",scope=project,timeout_seconds=240
82
+ ```
83
+
84
+ Use `node scripts/run-tests.mjs ...` for linked tests so tracker data is sandboxed.
85
+
86
+ ## Record Evidence and Close
87
+
88
+ ```bash
89
+ pm test <item-id> --run --progress
90
+ pm comments <item-id> "Evidence: linked lock regression passed."
91
+ pm close <item-id> "Acceptance criteria met; linked regression passed." --validate-close warn
92
+ pm release <item-id>
93
+ ```
94
+
95
+ For broad readiness checks:
96
+
97
+ ```bash
98
+ pnpm build
99
+ node scripts/run-tests.mjs coverage
100
+ pm validate --check-resolution --check-history-drift
101
+ ```
102
+
103
+ ## Next Pages
104
+
105
+ - [Agent Guide](AGENT_GUIDE.md) for the full canonical workflow.
106
+ - [Command Reference](COMMANDS.md) for command families and examples.
107
+ - [Configuration](CONFIGURATION.md) for output, storage, search, and validation settings.
108
+ - [Testing](TESTING.md) for sandbox and linked-test details.
package/docs/README.md ADDED
@@ -0,0 +1,70 @@
1
+ # pm-cli Documentation
2
+
3
+ This directory is the public documentation home for `pm-cli`. It is organized for progressive disclosure: read the smallest page that answers the current question, then follow links only when more detail is needed.
4
+
5
+ ## Read Path
6
+
7
+ | Reader | First page | Then read |
8
+ |--------|------------|-----------|
9
+ | New user | [Quickstart](QUICKSTART.md) | [Command Reference](COMMANDS.md) |
10
+ | Coding agent | [Agent Guide](AGENT_GUIDE.md) | [Configuration](CONFIGURATION.md), then command help |
11
+ | Maintainer | [Contributing](../CONTRIBUTING.md) | [Testing](TESTING.md), [Releasing](RELEASING.md), [Architecture](ARCHITECTURE.md) |
12
+ | Extension author | [Extensions](EXTENSIONS.md) | [SDK](SDK.md), [starter extension](examples/starter-extension/README.md) |
13
+ | Machine client | [Command Reference](COMMANDS.md#machine-contracts) | `pm contracts --json` |
14
+
15
+ ## Documentation Map
16
+
17
+ - [Quickstart](QUICKSTART.md) - install, initialize, create, claim, link, test, close.
18
+ - [Agent Guide](AGENT_GUIDE.md) - canonical agent loop, tracker linking, and token-minimal command choices.
19
+ - [Command Reference](COMMANDS.md) - command families with examples and when to use each family.
20
+ - [Configuration](CONFIGURATION.md) - settings, storage formats, output, search, validation, and environment variables.
21
+ - [Testing](TESTING.md) - sandbox-safe local tests and linked-test orchestration.
22
+ - [Architecture](ARCHITECTURE.md) - contributor internals: storage, mutation flow, search, extensions, and command contracts.
23
+ - [Extensions](EXTENSIONS.md) - runtime extension lifecycle and API reference.
24
+ - [SDK](SDK.md) - public import surfaces and typed authoring examples.
25
+ - [Releasing](RELEASING.md) - maintainer release checklist and failure handling.
26
+ - [starter extension](examples/starter-extension/README.md) - compact extension scaffold reference.
27
+
28
+ Community files:
29
+
30
+ - [Contributing](../CONTRIBUTING.md)
31
+ - [Security](../SECURITY.md)
32
+ - [Code of Conduct](../CODE_OF_CONDUCT.md)
33
+ - [Changelog](../CHANGELOG.md)
34
+ - [License](../LICENSE)
35
+
36
+ ## Agent Routing Rules
37
+
38
+ 1. Start with [Agent Guide](AGENT_GUIDE.md) for workflow rules.
39
+ 2. Use [Command Reference](COMMANDS.md) for command families, not exhaustive flag memory.
40
+ 3. Use `pm <command> --help --json` or `pm contracts --command <name> --flags-only --json` for exact flags.
41
+ 4. Use [Architecture](ARCHITECTURE.md) only when changing internals or debugging behavior.
42
+ 5. Use [SDK](SDK.md) and [Extensions](EXTENSIONS.md) only when authoring or troubleshooting extensions.
43
+
44
+ ## Tracker References
45
+
46
+ This documentation structure is tracked through:
47
+
48
+ - [pm-3042](../.agents/pm/epics/pm-3042.toon)
49
+ - [pm-r9gu](../.agents/pm/features/pm-r9gu.toon)
50
+ - [pm-1sb2](../.agents/pm/tasks/pm-1sb2.toon)
51
+
52
+ When changing docs, link files back to the active item:
53
+
54
+ ```bash
55
+ pm docs <item-id> --add path=docs/README.md,scope=project,note="documentation index"
56
+ pm comments <item-id> "Docs updated; links and build verified."
57
+ ```
58
+
59
+ ## Public Boundary
60
+
61
+ Public docs must not link to ignored local operations artifacts, unpublished evidence logs, credentials, host-specific runbooks, or private service details. Keep those materials local and out of packaged releases.
62
+
63
+ ## Maintenance Checklist
64
+
65
+ - Keep links relative and GitHub-compatible.
66
+ - Keep README short; move detail into focused pages.
67
+ - Put a short "Agent Quick Context" near the top of deep docs.
68
+ - Prefer commands that agents can copy exactly.
69
+ - Use `pm` item IDs as durable references when docs explain tracked work.
70
+ - Run link/search checks before closing documentation tasks.
package/docs/RELEASING.md CHANGED
@@ -1,69 +1,107 @@
1
1
  # Releasing `@unbrained/pm-cli`
2
2
 
3
- This repository uses a tag-driven GitHub Actions pipeline that publishes to npm and creates a GitHub Release. The pipeline uses standard GitHub Actions, repository or environment secrets, artifacts, and npm provenance; it does not require paid GitHub features or paid-only environment protection rules.
3
+ This page is for maintainers cutting npm and GitHub releases. It assumes release work is tracked with `pm`.
4
4
 
5
- ## Version Policy
5
+ ## Agent Quick Context
6
+
7
+ - Release versioning is calendar SemVer-compatible: `YYYY.M.D` or `YYYY.M.D-N`.
8
+ - Daily release preparation is owned by the GitHub Actions auto-release workflow.
9
+ - Publishing is owned by the tag-driven GitHub Actions release workflow.
10
+ - Do not run manual `npm publish`.
11
+ - Run local parity gates before pushing release tags.
6
12
 
7
- `pm-cli` uses a calendar SemVer-compatible scheme:
13
+ Tracked documentation work: [pm-1sb2](../.agents/pm/tasks/pm-1sb2.toon).
8
14
 
9
- - `YYYY.M.D` for the first release on a date
10
- - `YYYY.M.D-N` for additional releases on the same date (`N >= 2`)
15
+ ## Version Policy
11
16
 
12
17
  Examples:
13
18
 
14
- - First release on 2026-03-09: `2026.3.9`
15
- - Second release on 2026-03-09: `2026.3.9-2`
19
+ - first release on 2026-05-01: `2026.5.1`
20
+ - second release on 2026-05-01: `2026.5.1-2`
16
21
 
17
- Use this to compute the next expected release version from the npm registry:
22
+ Check the next version:
18
23
 
19
24
  ```bash
20
25
  pnpm version:next
21
26
  ```
22
27
 
23
- The release workflow enforces the package version, tag name, calendar date, and npm registry sequencing before publishing.
28
+ Validate the current package version:
29
+
30
+ ```bash
31
+ pnpm version:check
32
+ ```
24
33
 
25
34
  ## One-Time Setup
26
35
 
27
- - Add `NPM_TOKEN` as a GitHub Environment or repository secret named `NPM_TOKEN`.
28
- - If using an Environment named `release`, keep it free-feature compatible: no paid-only reviewer or deployment-protection requirements.
29
- - Ensure `GITHUB_TOKEN` has the default workflow permission needed by `permissions: contents: write` for GitHub Release creation.
30
- - Keep npm two-factor settings compatible with automation tokens and provenance publishing.
31
- - Keep `package.json` repository, homepage, and bugs URLs aligned with the canonical GitHub source repository (`https://github.com/unbraind/pm-cli`); npm provenance validation rejects mismatched repository metadata.
36
+ - Add `NPM_TOKEN` as a GitHub Environment or repository secret.
37
+ - Add `SENTRY_AUTH_TOKEN` as an optional GitHub Environment or repository secret when Sentry release creation and sourcemap upload should run. The release workflow skips this step cleanly when the secret is absent.
38
+ - Keep any `release` environment compatible with free GitHub features. This repository is public, so environment secrets and tag/branch deployment rules are compatible with the free GitHub path; do not add paid-only release gates.
39
+ - Ensure `GITHUB_TOKEN` has `contents: write` for GitHub Release creation.
40
+ - Keep `package.json` repository, homepage, and bugs URLs aligned with `https://github.com/unbraind/pm-cli`.
41
+ - Keep npm automation token settings compatible with provenance publishing. The release workflow must keep `id-token: write`, a GitHub-hosted runner, and `npm publish --access public --provenance`.
32
42
 
33
- ## Local Release Checklist
43
+ ## Automated Daily Driver
34
44
 
35
- 1. Confirm the next version:
45
+ `.github/workflows/auto-release.yml` runs once per day and can also be dispatched manually.
46
+
47
+ Policy:
48
+
49
+ - release only when commits exist after the latest release tag
50
+ - release at most once per UTC day by default
51
+ - same-day follow-up release (`YYYY.M.D-N`) is manual-only via `allow_same_day_release=true`
52
+ - release preparation must pass all quality and compatibility gates before commit+tag push
53
+
54
+ Pipeline entrypoint:
36
55
 
37
56
  ```bash
38
- pnpm version:next
57
+ node scripts/release/run-release-pipeline.mjs
39
58
  ```
40
59
 
41
- 2. Update `package.json`, `pnpm-lock.yaml`, and `CHANGELOG.md`.
60
+ The pipeline performs:
61
+
62
+ 1. change detection + one-release-per-day guard
63
+ 2. version bump + changelog promotion from `[Unreleased]`
64
+ 3. strict gates (build, typecheck, coverage, static quality, compatibility, security, smoke checks, reliability gate)
65
+ 4. release note generation from changelog + pm evidence
66
+ 5. commit and tag creation (plus optional push)
67
+
68
+ ## Local Release Parity Checklist
42
69
 
43
- 3. Generate release notes locally from changelog + pm tracker data:
70
+ 1. Confirm or compute the version.
44
71
 
45
72
  ```bash
46
- pnpm build
47
- pnpm release:notes -- --version "$(node -p 'require("./package.json").version')" --output /tmp/pm-cli-release-notes.md
73
+ pnpm version:next
48
74
  ```
49
75
 
50
- 4. Run local release gates:
76
+ 2. Verify previous-version tracker compatibility in a temporary project before release asset edits.
77
+
78
+ Create representative data with the latest published package and then read, mutate, run linked tests, validate, and health-check the same temp `PM_PATH` with the current build. The temp run must use isolated `PM_PATH` and `PM_GLOBAL_PATH`; never point compatibility tests at the repository's real tracker data.
79
+
80
+ Minimum coverage:
81
+
82
+ - parent and dependency links
83
+ - comments, notes, learnings, body, reminders, events
84
+ - linked files, docs, and tests
85
+ - closed issue metadata and history drift checks
86
+ - current-build write mutation and item-count preservation
87
+
88
+ 3. Review private reliability signals.
89
+
90
+ Use maintainer-only local workflows for reliability checks and incident triage. Keep operational details, infrastructure topology, and raw diagnostics out of tracked release documentation and release notes.
91
+
92
+ If private reliability checks identify repeated user friction, either confirm the current release already contains the remediation with regression coverage or fix it before continuing.
93
+
94
+ 4. Run the same release pipeline locally.
51
95
 
52
96
  ```bash
53
- pnpm install
54
- pnpm build
55
- pnpm typecheck
56
- pnpm test
57
- pnpm test:coverage
58
- node scripts/run-tests.mjs coverage
59
- pnpm version:check
60
- pnpm security:scan
61
- pnpm smoke:npx
62
- ```
97
+ # Read-only parity check
98
+ pnpm release:pipeline:dry-run
63
99
 
64
- 5. Verify previous-version tracker compatibility before tagging. Use a temporary project with the previously published package, create representative items, then run the current build against the same sandboxed `PM_PATH` and `PM_GLOBAL_PATH`. Confirm item count, fields, linked files/docs/tests, comments, close metadata, health, and history drift checks remain intact.
100
+ # Full local preparation (version/changelog mutation + local commit/tag)
101
+ pnpm release:pipeline -- --telemetry-mode required
102
+ ```
65
103
 
66
- 6. Commit, push, tag, and push the tag:
104
+ 5. Push branch and tag after local green.
67
105
 
68
106
  ```bash
69
107
  git push origin main
@@ -71,22 +109,28 @@ git tag v<version>
71
109
  git push origin v<version>
72
110
  ```
73
111
 
74
- ## Release Workflow
112
+ ## GitHub Workflow
75
113
 
76
- `.github/workflows/release.yml` runs on `v*.*.*` tags and performs:
114
+ `.github/workflows/release.yml` runs on `v*.*.*` tags and handles:
77
115
 
78
- - full-history checkout for previous-tag and release-note generation
116
+ - full-history checkout
79
117
  - pnpm install with frozen lockfile
80
118
  - version policy and tag guard
81
- - secret leak scan
82
- - build, typecheck, test coverage, and sandboxed pm coverage
119
+ - secret scan
120
+ - build, typecheck, test, and coverage
121
+ - static quality gate (complexity, duplication, dead/orphan module, file/folder hygiene)
122
+ - temporary-project compatibility gate against latest published tracker data
123
+ - reliability threshold gate (Sentry severity threshold, telemetry policy mode)
124
+ - sandboxed `pm` coverage
125
+ - optional Sentry release metadata and sourcemap upload when `SENTRY_AUTH_TOKEN` is configured
83
126
  - npm pack dry run and npx tarball smoke test
84
- - generated release notes from `CHANGELOG.md` plus sanitized `pm` tracker metadata
85
- - coverage and release-note artifact uploads
127
+ - generated release notes from changelog plus sanitized tracker metadata
128
+ - artifact uploads
86
129
  - `npm publish --access public --provenance`
87
- - GitHub Release creation using the generated release-note body
130
+ - post-publish npm/npx/bunx verification
131
+ - GitHub Release creation
88
132
 
89
- Monitor with:
133
+ Monitor:
90
134
 
91
135
  ```bash
92
136
  gh run list --workflow Release --limit 5
@@ -95,8 +139,6 @@ gh run watch <run-id> --exit-status
95
139
 
96
140
  ## Post-Release Verification
97
141
 
98
- After the workflow succeeds, verify all distribution paths:
99
-
100
142
  ```bash
101
143
  npm view @unbrained/pm-cli@<version> version dist.integrity dist.unpackedSize --json
102
144
  npx --yes @unbrained/pm-cli@<version> --version
@@ -104,11 +146,11 @@ bunx @unbrained/pm-cli@<version> --version
104
146
  gh release view v<version> --json tagName,name,isDraft,isPrerelease,url
105
147
  ```
106
148
 
107
- The `pm` executable name remains unchanged even though the npm package is scoped.
149
+ The executable remains `pm` even though the npm package is scoped.
108
150
 
109
151
  ## Failure Handling
110
152
 
111
- - Do not run manual `npm publish`; publishing is owned by `.github/workflows/release.yml`.
112
- - If local gates fail, fix the code/docs/tests and rerun the checklist before tagging.
113
- - If the tag workflow fails before npm publish, fix the issue, move the tag only after confirming no package was published, and rerun the workflow.
114
- - If npm publish succeeds but GitHub Release creation fails, rerun only the release creation after confirming the tag and package are correct.
153
+ - If local gates fail, fix and rerun before tagging.
154
+ - If the tag workflow fails before npm publish, confirm no package was published before moving or replacing a tag.
155
+ - If npm publish succeeds but GitHub Release creation fails, recreate only the GitHub Release after verifying the tag and package.
156
+ - Record failure evidence and remediation in the release `pm` item.
package/docs/SDK.md CHANGED
@@ -1,123 +1,182 @@
1
- # pm SDK Guide
1
+ # SDK
2
2
 
3
- This guide documents the public SDK surface for extension authors.
3
+ The public SDK is exported from `@unbrained/pm-cli/sdk`. Use it for extension authoring and command-contract introspection. Do not import internal `src/core/...` modules from extensions.
4
4
 
5
- Primary import:
5
+ ## Agent Quick Context
6
+
7
+ - Primary import: `@unbrained/pm-cli/sdk`.
8
+ - Runtime extension lifecycle is documented in [Extensions](EXTENSIONS.md).
9
+ - Exact command/action contracts are available through `pm contracts`.
10
+
11
+ Tracked documentation work: [pm-1sb2](../.agents/pm/tasks/pm-1sb2.toon).
12
+
13
+ ## Import Surfaces
6
14
 
7
15
  ```ts
8
16
  import { defineExtension } from "@unbrained/pm-cli/sdk";
9
17
  ```
10
18
 
11
- Use this document for SDK/API contracts. Use `docs/EXTENSIONS.md` for full runtime lifecycle behavior and `pm extension --init ./my-extension` for starter scaffold generation.
12
-
13
- ## Import Surfaces
19
+ Supported package exports:
14
20
 
15
- - `@unbrained/pm-cli/sdk`: stable extension authoring API and CLI contract exports.
16
- - `@unbrained/pm-cli/cli`: runtime CLI module entrypoint. This path is for runtime module resolution, not a typed library API; its declaration file intentionally exports no symbols.
21
+ - `@unbrained/pm-cli/sdk` - stable extension authoring API and CLI contract exports.
22
+ - `@unbrained/pm-cli/cli` - runtime CLI module entrypoint for package resolution, not a typed library API.
17
23
 
18
- ## Public SDK Exports
24
+ ## Public Exports
19
25
 
20
26
  Source of truth:
21
27
 
22
- - `src/sdk/index.ts`
23
- - `src/sdk/cli-contracts.ts`
28
+ - [`src/sdk/index.ts`](../src/sdk/index.ts)
29
+ - [`src/sdk/cli-contracts.ts`](../src/sdk/cli-contracts.ts)
24
30
 
25
- ### Extension authoring values
31
+ Common authoring exports:
26
32
 
27
- - `defineExtension(...)`
33
+ - `defineExtension`
28
34
  - `EXTENSION_CAPABILITIES`
29
35
  - `EXTENSION_CAPABILITY_CONTRACT`
30
36
  - `EXTENSION_CAPABILITY_CONTRACT_VERSION`
31
37
  - `EXTENSION_CAPABILITY_LEGACY_ALIASES`
32
-
33
- ### CLI/action contract values
34
-
35
38
  - `PM_CORE_COMMAND_NAMES`
36
39
  - `PM_TOOL_ACTIONS`
37
40
  - `PM_TOOL_PARAMETERS_SCHEMA`
38
41
  - `PM_EXTENSION_CAPABILITY_CONTRACTS`
39
42
  - `PM_EXTENSION_SERVICE_NAME_CONTRACTS`
40
- - all exported `...FLAG_CONTRACTS`, `...OPTION_CONTRACTS`, and `...COMMANDER_*_CONTRACTS` arrays from `src/sdk/cli-contracts.ts`
41
-
42
- ### CLI/action contract helpers
43
-
44
- - `withFlagAliasMetadata(...)`
45
- - `toCompletionFlagString(...)`
46
- - `readFirstStringFromCommanderOptions(...)`
47
- - `readStringArrayFromCommanderOptions(...)`
48
43
 
49
- ### Key type exports
44
+ Common types:
50
45
 
51
- - extension capability/types: `ExtensionCapability`, `PmToolAction`, `PmExtensionCapabilityContract`, `PmExtensionServiceNameContract`
52
- - command/flag/type helpers: `CommandDefinition`, `ExtensionCommandArgumentDefinition`, `FlagDefinition`, `SchemaFieldDefinition`, `SchemaItemTypeDefinition`
53
- - runtime extension API types: `ExtensionApi`, `ExtensionManifest`, lifecycle hook context types, importer/exporter contexts, search provider types, vector adapter types
54
- - shared command/settings types: `GlobalOptions`, `PmSettings`
55
-
56
- ## Capability Requirements (Quick Reference)
57
-
58
- Declare capabilities in `manifest.json`; runtime gating is strict.
46
+ - `ExtensionApi`
47
+ - `ExtensionManifest`
48
+ - `CommandDefinition`
49
+ - `FlagDefinition`
50
+ - `SchemaFieldDefinition`
51
+ - `SchemaItemTypeDefinition`
52
+ - `SearchProviderDefinition`
53
+ - `VectorStoreAdapterDefinition`
54
+ - `GlobalOptions`
55
+ - `PmSettings`
56
+
57
+ ## Capability Requirements
58
+
59
+ | Registration | Manifest capability |
60
+ |--------------|---------------------|
61
+ | `registerCommand` | `commands` |
62
+ | inline command flags | `schema` |
63
+ | `registerFlags` | `schema` |
64
+ | `registerItemFields` | `schema` |
65
+ | `registerItemTypes` | `schema` |
66
+ | `registerMigration` | `schema` |
67
+ | `registerImporter` | `importers` |
68
+ | `registerExporter` | `importers` |
69
+ | `registerParser` | `parser` |
70
+ | `registerPreflight` | `preflight` |
71
+ | `registerService` | `services` |
72
+ | `registerRenderer` | `renderers` |
73
+ | lifecycle hooks | `hooks` |
74
+ | `registerSearchProvider` | `search` |
75
+ | `registerVectorStoreAdapter` | `search` |
76
+
77
+ ## Minimal Command Extension
59
78
 
60
- - `registerCommand(...)`: requires `commands`
61
- - `registerCommand({ flags: [...] })` and `registerFlags(...)`: require `schema`
62
- - `registerItemFields(...)`, `registerItemTypes(...)`, `registerMigration(...)`: require `schema`
63
- - `registerImporter(...)` and `registerExporter(...)`: require `importers`
64
- - `registerParser(...)`: requires `parser`
65
- - `registerPreflight(...)`: requires `preflight`
66
- - `registerService(...)`: requires `services`
67
- - `registerRenderer(...)`: requires `renderers`
68
- - lifecycle hooks (`beforeCommand`, `afterCommand`, `onWrite`, `onRead`, `onIndex`): require `hooks`
69
- - `registerSearchProvider(...)` and `registerVectorStoreAdapter(...)`: require `search`
79
+ ```ts
80
+ import { defineExtension } from "@unbrained/pm-cli/sdk";
70
81
 
71
- ## Minimal Extension
82
+ export default defineExtension({
83
+ activate(api) {
84
+ api.registerCommand({
85
+ name: "hello",
86
+ description: "Return a deterministic hello payload.",
87
+ intent: "verify SDK extension activation",
88
+ examples: ["pm hello"],
89
+ run: async () => ({ ok: true, message: "hello" }),
90
+ });
91
+ },
92
+ });
93
+ ```
72
94
 
73
- `manifest.json`:
95
+ Manifest:
74
96
 
75
97
  ```json
76
98
  {
77
- "name": "hello-extension",
99
+ "name": "hello",
78
100
  "version": "0.1.0",
79
101
  "entry": "./index.js",
80
102
  "capabilities": ["commands"]
81
103
  }
82
104
  ```
83
105
 
84
- `index.js`:
106
+ ## Custom Item Type
85
107
 
86
- ```js
108
+ ```ts
87
109
  import { defineExtension } from "@unbrained/pm-cli/sdk";
88
110
 
89
111
  export default defineExtension({
90
112
  activate(api) {
91
- api.registerCommand({
92
- name: "hello",
93
- run: async () => ({ ok: true, message: "hello from sdk extension" }),
113
+ api.registerItemTypes([
114
+ {
115
+ name: "Incident",
116
+ folder: "incidents",
117
+ aliases: ["incident"],
118
+ required_create_fields: ["title", "description", "severity"],
119
+ options: [
120
+ { key: "severity", values: ["critical", "major", "minor"], required: true },
121
+ { key: "service", values: ["api", "web", "worker"] },
122
+ ],
123
+ },
124
+ ]);
125
+
126
+ api.registerItemFields([
127
+ { name: "severity", type: "string" },
128
+ { name: "service", type: "string", optional: true },
129
+ ]);
130
+ },
131
+ });
132
+ ```
133
+
134
+ Manifest capability: `schema`.
135
+
136
+ ## Search Provider
137
+
138
+ ```ts
139
+ import { defineExtension } from "@unbrained/pm-cli/sdk";
140
+
141
+ export default defineExtension({
142
+ activate(api) {
143
+ api.registerSearchProvider({
144
+ name: "example-search",
145
+ async query(context) {
146
+ return context.documents
147
+ .filter((doc) => doc.front_matter.title?.toLowerCase().includes(context.query.toLowerCase()))
148
+ .map((doc) => ({ id: doc.front_matter.id, score: 0.5, matched_fields: ["title"] }));
149
+ },
94
150
  });
95
151
  },
96
152
  });
97
153
  ```
98
154
 
99
- ## Typed Authoring Highlights
155
+ Manifest capability: `search`.
100
156
 
101
- The SDK provides explicit interfaces for key surfaces including:
157
+ ## Command Contracts
102
158
 
103
- - `CommandDefinition` and `ExtensionCommandArgumentDefinition`
104
- - `FlagDefinition`
105
- - `SchemaFieldDefinition`, `SchemaItemTypeDefinition`, `SchemaMigrationDefinition`
106
- - `ImportExportContext`
107
- - `SearchProviderDefinition`, `SearchProviderQueryContext`, `SearchProviderHit`
108
- - `VectorStoreAdapterDefinition`, `VectorStoreQueryContext`, `VectorStoreUpsertContext`
159
+ For machine clients:
160
+
161
+ ```bash
162
+ pm contracts --json
163
+ pm contracts --command create --flags-only --json
164
+ pm contracts --action create --schema-only --json
165
+ ```
109
166
 
110
- These interfaces intentionally allow additive metadata (`[key: string]: unknown`) where extension-defined metadata is expected.
167
+ Use the runtime command because active extensions can add command/action metadata.
111
168
 
112
- ## Recommended Authoring Pattern
169
+ ## Authoring Pattern
113
170
 
114
- - keep command handlers deterministic and JSON-like
115
- - keep renderer/service overrides narrow to specific command paths
116
- - prefer additive hooks and schema fields over global behavior changes
117
- - ship one extension folder with `manifest.json`, an entry module, and package metadata/dependencies
171
+ - Keep handlers deterministic and JSON-like.
172
+ - Return data, not pre-rendered terminal text, unless implementing a renderer.
173
+ - Keep service and preflight overrides narrow.
174
+ - Declare only capabilities in use.
175
+ - Include examples and failure hints in dynamic commands.
176
+ - Add `pm extension doctor` diagnostics to testing instructions.
118
177
 
119
178
  ## Related Docs
120
179
 
121
- - full extension lifecycle/runtime reference: `docs/EXTENSIONS.md`
122
- - architecture internals: `docs/ARCHITECTURE.md`
123
- - complete starter scaffold: `docs/examples/starter-extension/`
180
+ - [Extensions](EXTENSIONS.md)
181
+ - [Architecture](ARCHITECTURE.md)
182
+ - [starter extension](examples/starter-extension/README.md)