@unbrained/pm-cli 2026.5.14 → 2026.5.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (436) hide show
  1. package/.claude-plugin/marketplace.json +4 -4
  2. package/AGENTS.md +78 -457
  3. package/CHANGELOG.md +71 -0
  4. package/CONTRIBUTING.md +1 -0
  5. package/README.md +8 -6
  6. package/dist/cli/argv-utils.js +4 -1
  7. package/dist/cli/argv-utils.js.map +1 -1
  8. package/dist/cli/bootstrap-args.js +4 -1
  9. package/dist/cli/bootstrap-args.js.map +1 -1
  10. package/dist/cli/commander-usage.js +19 -1
  11. package/dist/cli/commander-usage.js.map +1 -1
  12. package/dist/cli/commands/activity.js +4 -1
  13. package/dist/cli/commands/activity.js.map +1 -1
  14. package/dist/cli/commands/aggregate.js +5 -2
  15. package/dist/cli/commands/aggregate.js.map +1 -1
  16. package/dist/cli/commands/annotation-command.d.ts +49 -0
  17. package/dist/cli/commands/annotation-command.js +135 -0
  18. package/dist/cli/commands/annotation-command.js.map +1 -0
  19. package/dist/cli/commands/append.js +5 -6
  20. package/dist/cli/commands/append.js.map +1 -1
  21. package/dist/cli/commands/calendar.js +5 -5
  22. package/dist/cli/commands/calendar.js.map +1 -1
  23. package/dist/cli/commands/claim.d.ts +3 -0
  24. package/dist/cli/commands/claim.js +29 -23
  25. package/dist/cli/commands/claim.js.map +1 -1
  26. package/dist/cli/commands/close.js +63 -8
  27. package/dist/cli/commands/close.js.map +1 -1
  28. package/dist/cli/commands/comments-audit.js +4 -1
  29. package/dist/cli/commands/comments-audit.js.map +1 -1
  30. package/dist/cli/commands/comments.d.ts +5 -0
  31. package/dist/cli/commands/comments.js +29 -116
  32. package/dist/cli/commands/comments.js.map +1 -1
  33. package/dist/cli/commands/completion.js +198 -15
  34. package/dist/cli/commands/completion.js.map +1 -1
  35. package/dist/cli/commands/config.js +4 -1
  36. package/dist/cli/commands/config.js.map +1 -1
  37. package/dist/cli/commands/context.js +21 -13
  38. package/dist/cli/commands/context.js.map +1 -1
  39. package/dist/cli/commands/contracts.d.ts +9 -0
  40. package/dist/cli/commands/contracts.js +314 -64
  41. package/dist/cli/commands/contracts.js.map +1 -1
  42. package/dist/cli/commands/create.js +77 -48
  43. package/dist/cli/commands/create.js.map +1 -1
  44. package/dist/cli/commands/dedupe-audit.js +9 -3
  45. package/dist/cli/commands/dedupe-audit.js.map +1 -1
  46. package/dist/cli/commands/delete.d.ts +3 -0
  47. package/dist/cli/commands/delete.js +11 -7
  48. package/dist/cli/commands/delete.js.map +1 -1
  49. package/dist/cli/commands/deps.js +4 -1
  50. package/dist/cli/commands/deps.js.map +1 -1
  51. package/dist/cli/commands/docs.d.ts +1 -0
  52. package/dist/cli/commands/docs.js +6 -7
  53. package/dist/cli/commands/docs.js.map +1 -1
  54. package/dist/cli/commands/event-validation-messages.d.ts +3 -0
  55. package/dist/cli/commands/event-validation-messages.js +44 -0
  56. package/dist/cli/commands/event-validation-messages.js.map +1 -0
  57. package/dist/cli/commands/extension.d.ts +3 -1
  58. package/dist/cli/commands/extension.js +259 -52
  59. package/dist/cli/commands/extension.js.map +1 -1
  60. package/dist/cli/commands/files.js +8 -12
  61. package/dist/cli/commands/files.js.map +1 -1
  62. package/dist/cli/commands/gc.js +19 -3
  63. package/dist/cli/commands/gc.js.map +1 -1
  64. package/dist/cli/commands/get.d.ts +10 -5
  65. package/dist/cli/commands/get.js +135 -20
  66. package/dist/cli/commands/get.js.map +1 -1
  67. package/dist/cli/commands/guide.js +6 -8
  68. package/dist/cli/commands/guide.js.map +1 -1
  69. package/dist/cli/commands/health.d.ts +14 -0
  70. package/dist/cli/commands/health.js +269 -67
  71. package/dist/cli/commands/health.js.map +1 -1
  72. package/dist/cli/commands/history-redact.d.ts +50 -0
  73. package/dist/cli/commands/history-redact.js +476 -0
  74. package/dist/cli/commands/history-redact.js.map +1 -0
  75. package/dist/cli/commands/history-repair.d.ts +33 -0
  76. package/dist/cli/commands/history-repair.js +166 -0
  77. package/dist/cli/commands/history-repair.js.map +1 -0
  78. package/dist/cli/commands/history.d.ts +4 -0
  79. package/dist/cli/commands/history.js +12 -79
  80. package/dist/cli/commands/history.js.map +1 -1
  81. package/dist/cli/commands/index.d.ts +5 -1
  82. package/dist/cli/commands/index.js +9 -2
  83. package/dist/cli/commands/index.js.map +1 -1
  84. package/dist/cli/commands/init-agent-guidance.d.ts +31 -0
  85. package/dist/cli/commands/init-agent-guidance.js +336 -0
  86. package/dist/cli/commands/init-agent-guidance.js.map +1 -0
  87. package/dist/cli/commands/init.d.ts +42 -0
  88. package/dist/cli/commands/init.js +96 -1
  89. package/dist/cli/commands/init.js.map +1 -1
  90. package/dist/cli/commands/learnings.js +22 -118
  91. package/dist/cli/commands/learnings.js.map +1 -1
  92. package/dist/cli/commands/linked-test-entry.d.ts +3 -0
  93. package/dist/cli/commands/linked-test-entry.js +62 -0
  94. package/dist/cli/commands/linked-test-entry.js.map +1 -0
  95. package/dist/cli/commands/list.d.ts +1 -0
  96. package/dist/cli/commands/list.js +72 -38
  97. package/dist/cli/commands/list.js.map +1 -1
  98. package/dist/cli/commands/metadata-normalizers.js +4 -1
  99. package/dist/cli/commands/metadata-normalizers.js.map +1 -1
  100. package/dist/cli/commands/normalize.js +4 -1
  101. package/dist/cli/commands/normalize.js.map +1 -1
  102. package/dist/cli/commands/notes.js +22 -118
  103. package/dist/cli/commands/notes.js.map +1 -1
  104. package/dist/cli/commands/plan.d.ts +121 -0
  105. package/dist/cli/commands/plan.js +1137 -0
  106. package/dist/cli/commands/plan.js.map +1 -0
  107. package/dist/cli/commands/reindex.js +4 -1
  108. package/dist/cli/commands/reindex.js.map +1 -1
  109. package/dist/cli/commands/restore.js +9 -49
  110. package/dist/cli/commands/restore.js.map +1 -1
  111. package/dist/cli/commands/schema.d.ts +31 -0
  112. package/dist/cli/commands/schema.js +98 -0
  113. package/dist/cli/commands/schema.js.map +1 -0
  114. package/dist/cli/commands/search.js +156 -40
  115. package/dist/cli/commands/search.js.map +1 -1
  116. package/dist/cli/commands/stats.js +4 -1
  117. package/dist/cli/commands/stats.js.map +1 -1
  118. package/dist/cli/commands/templates.d.ts +4 -0
  119. package/dist/cli/commands/templates.js +91 -16
  120. package/dist/cli/commands/templates.js.map +1 -1
  121. package/dist/cli/commands/test-all.js +6 -7
  122. package/dist/cli/commands/test-all.js.map +1 -1
  123. package/dist/cli/commands/test-runs.js +4 -1
  124. package/dist/cli/commands/test-runs.js.map +1 -1
  125. package/dist/cli/commands/test.d.ts +1 -0
  126. package/dist/cli/commands/test.js +9 -9
  127. package/dist/cli/commands/test.js.map +1 -1
  128. package/dist/cli/commands/update-many.js +6 -7
  129. package/dist/cli/commands/update-many.js.map +1 -1
  130. package/dist/cli/commands/update.js +204 -103
  131. package/dist/cli/commands/update.js.map +1 -1
  132. package/dist/cli/commands/upgrade.js +6 -3
  133. package/dist/cli/commands/upgrade.js.map +1 -1
  134. package/dist/cli/commands/validate.d.ts +3 -1
  135. package/dist/cli/commands/validate.js +44 -64
  136. package/dist/cli/commands/validate.js.map +1 -1
  137. package/dist/cli/error-guidance.js +99 -6
  138. package/dist/cli/error-guidance.js.map +1 -1
  139. package/dist/cli/extension-command-help.d.ts +0 -1
  140. package/dist/cli/extension-command-help.js +4 -12
  141. package/dist/cli/extension-command-help.js.map +1 -1
  142. package/dist/cli/extension-command-options.d.ts +1 -0
  143. package/dist/cli/extension-command-options.js +108 -6
  144. package/dist/cli/extension-command-options.js.map +1 -1
  145. package/dist/cli/guide-topics.js +4 -1
  146. package/dist/cli/guide-topics.js.map +1 -1
  147. package/dist/cli/help-content.d.ts +0 -1
  148. package/dist/cli/help-content.js +46 -22
  149. package/dist/cli/help-content.js.map +1 -1
  150. package/dist/cli/help-json-payload.d.ts +1 -0
  151. package/dist/cli/help-json-payload.js +35 -2
  152. package/dist/cli/help-json-payload.js.map +1 -1
  153. package/dist/cli/main.js +214 -30
  154. package/dist/cli/main.js.map +1 -1
  155. package/dist/cli/migration-gates.js +4 -1
  156. package/dist/cli/migration-gates.js.map +1 -1
  157. package/dist/cli/register-list-query.d.ts +1 -1
  158. package/dist/cli/register-list-query.js +75 -29
  159. package/dist/cli/register-list-query.js.map +1 -1
  160. package/dist/cli/register-mutation.d.ts +1 -1
  161. package/dist/cli/register-mutation.js +430 -38
  162. package/dist/cli/register-mutation.js.map +1 -1
  163. package/dist/cli/register-operations.js +47 -10
  164. package/dist/cli/register-operations.js.map +1 -1
  165. package/dist/cli/register-setup.js +47 -25
  166. package/dist/cli/register-setup.js.map +1 -1
  167. package/dist/cli/registration-helpers.d.ts +0 -2
  168. package/dist/cli/registration-helpers.js +21 -40
  169. package/dist/cli/registration-helpers.js.map +1 -1
  170. package/dist/cli/shared-parsers.js +4 -1
  171. package/dist/cli/shared-parsers.js.map +1 -1
  172. package/dist/cli/telemetry-flush.js +4 -1
  173. package/dist/cli/telemetry-flush.js.map +1 -1
  174. package/dist/cli.js +65 -3
  175. package/dist/cli.js.map +1 -1
  176. package/dist/core/extensions/extension-types.js +4 -1
  177. package/dist/core/extensions/extension-types.js.map +1 -1
  178. package/dist/core/extensions/index.d.ts +0 -1
  179. package/dist/core/extensions/index.js +4 -13
  180. package/dist/core/extensions/index.js.map +1 -1
  181. package/dist/core/extensions/item-fields.js +4 -1
  182. package/dist/core/extensions/item-fields.js.map +1 -1
  183. package/dist/core/extensions/loader.js +78 -60
  184. package/dist/core/extensions/loader.js.map +1 -1
  185. package/dist/core/extensions/runtime-registrations.js +4 -1
  186. package/dist/core/extensions/runtime-registrations.js.map +1 -1
  187. package/dist/core/fs/fs-utils.js +4 -1
  188. package/dist/core/fs/fs-utils.js.map +1 -1
  189. package/dist/core/fs/index.js +4 -1
  190. package/dist/core/fs/index.js.map +1 -1
  191. package/dist/core/fs/path-utils.d.ts +1 -0
  192. package/dist/core/fs/path-utils.js +12 -0
  193. package/dist/core/fs/path-utils.js.map +1 -0
  194. package/dist/core/history/drift-scan.d.ts +11 -0
  195. package/dist/core/history/drift-scan.js +67 -0
  196. package/dist/core/history/drift-scan.js.map +1 -0
  197. package/dist/core/history/history-stream-policy.js +4 -1
  198. package/dist/core/history/history-stream-policy.js.map +1 -1
  199. package/dist/core/history/history.js +4 -1
  200. package/dist/core/history/history.js.map +1 -1
  201. package/dist/core/history/index.js +4 -1
  202. package/dist/core/history/index.js.map +1 -1
  203. package/dist/core/history/replay.d.ts +82 -0
  204. package/dist/core/history/replay.js +249 -0
  205. package/dist/core/history/replay.js.map +1 -0
  206. package/dist/core/item/id.js +4 -1
  207. package/dist/core/item/id.js.map +1 -1
  208. package/dist/core/item/index.js +4 -1
  209. package/dist/core/item/index.js.map +1 -1
  210. package/dist/core/item/item-format.js +250 -8
  211. package/dist/core/item/item-format.js.map +1 -1
  212. package/dist/core/item/item-type-definition.d.ts +52 -0
  213. package/dist/core/item/item-type-definition.js +123 -0
  214. package/dist/core/item/item-type-definition.js.map +1 -0
  215. package/dist/core/item/parent-reference-policy.js +4 -1
  216. package/dist/core/item/parent-reference-policy.js.map +1 -1
  217. package/dist/core/item/parse.js +34 -3
  218. package/dist/core/item/parse.js.map +1 -1
  219. package/dist/core/item/priority.d.ts +23 -0
  220. package/dist/core/item/priority.js +55 -0
  221. package/dist/core/item/priority.js.map +1 -0
  222. package/dist/core/item/sprint-release-format.js +4 -1
  223. package/dist/core/item/sprint-release-format.js.map +1 -1
  224. package/dist/core/item/status.d.ts +14 -1
  225. package/dist/core/item/status.js +24 -1
  226. package/dist/core/item/status.js.map +1 -1
  227. package/dist/core/item/toon-decode.d.ts +19 -0
  228. package/dist/core/item/toon-decode.js +69 -0
  229. package/dist/core/item/toon-decode.js.map +1 -0
  230. package/dist/core/item/type-registry.js +15 -83
  231. package/dist/core/item/type-registry.js.map +1 -1
  232. package/dist/core/lock/index.js +4 -1
  233. package/dist/core/lock/index.js.map +1 -1
  234. package/dist/core/lock/lock.js +4 -1
  235. package/dist/core/lock/lock.js.map +1 -1
  236. package/dist/core/output/output.d.ts +4 -0
  237. package/dist/core/output/output.js +47 -6
  238. package/dist/core/output/output.js.map +1 -1
  239. package/dist/core/packages/manifest.d.ts +1 -0
  240. package/dist/core/packages/manifest.js +6 -8
  241. package/dist/core/packages/manifest.js.map +1 -1
  242. package/dist/core/packages/root.d.ts +3 -0
  243. package/dist/core/packages/root.js +51 -0
  244. package/dist/core/packages/root.js.map +1 -0
  245. package/dist/core/schema/item-types-file.d.ts +85 -0
  246. package/dist/core/schema/item-types-file.js +243 -0
  247. package/dist/core/schema/item-types-file.js.map +1 -0
  248. package/dist/core/schema/runtime-field-filters.js +4 -1
  249. package/dist/core/schema/runtime-field-filters.js.map +1 -1
  250. package/dist/core/schema/runtime-field-values.js +4 -1
  251. package/dist/core/schema/runtime-field-values.js.map +1 -1
  252. package/dist/core/schema/runtime-schema.d.ts +2 -1
  253. package/dist/core/schema/runtime-schema.js +13 -8
  254. package/dist/core/schema/runtime-schema.js.map +1 -1
  255. package/dist/core/search/cache.js +7 -2
  256. package/dist/core/search/cache.js.map +1 -1
  257. package/dist/core/search/corpus.d.ts +2 -0
  258. package/dist/core/search/corpus.js +77 -2
  259. package/dist/core/search/corpus.js.map +1 -1
  260. package/dist/core/search/embedding-batches.js +21 -7
  261. package/dist/core/search/embedding-batches.js.map +1 -1
  262. package/dist/core/search/http-client.js +4 -1
  263. package/dist/core/search/http-client.js.map +1 -1
  264. package/dist/core/search/providers.js +4 -1
  265. package/dist/core/search/providers.js.map +1 -1
  266. package/dist/core/search/semantic-defaults.js +12 -3
  267. package/dist/core/search/semantic-defaults.js.map +1 -1
  268. package/dist/core/search/vector-stores.js +4 -1
  269. package/dist/core/search/vector-stores.js.map +1 -1
  270. package/dist/core/sentry/helpers.js +4 -1
  271. package/dist/core/sentry/helpers.js.map +1 -1
  272. package/dist/core/sentry/instrument.js +10 -13
  273. package/dist/core/sentry/instrument.js.map +1 -1
  274. package/dist/core/shared/author.d.ts +1 -0
  275. package/dist/core/shared/author.js +9 -0
  276. package/dist/core/shared/author.js.map +1 -0
  277. package/dist/core/shared/command-types.js +4 -1
  278. package/dist/core/shared/command-types.js.map +1 -1
  279. package/dist/core/shared/conflict-markers.js +4 -1
  280. package/dist/core/shared/conflict-markers.js.map +1 -1
  281. package/dist/core/shared/constants.d.ts +2 -2
  282. package/dist/core/shared/constants.js +24 -1
  283. package/dist/core/shared/constants.js.map +1 -1
  284. package/dist/core/shared/errors.js +4 -1
  285. package/dist/core/shared/errors.js.map +1 -1
  286. package/dist/core/shared/index.js +4 -1
  287. package/dist/core/shared/index.js.map +1 -1
  288. package/dist/core/shared/lazy-module.d.ts +1 -0
  289. package/dist/core/shared/lazy-module.js +11 -0
  290. package/dist/core/shared/lazy-module.js.map +1 -0
  291. package/dist/core/shared/levenshtein.js +4 -1
  292. package/dist/core/shared/levenshtein.js.map +1 -1
  293. package/dist/core/shared/option-alias-visibility.d.ts +44 -0
  294. package/dist/core/shared/option-alias-visibility.js +76 -0
  295. package/dist/core/shared/option-alias-visibility.js.map +1 -0
  296. package/dist/core/shared/primitives.js +4 -1
  297. package/dist/core/shared/primitives.js.map +1 -1
  298. package/dist/core/shared/serialization.js +4 -1
  299. package/dist/core/shared/serialization.js.map +1 -1
  300. package/dist/core/shared/text-normalization.d.ts +0 -1
  301. package/dist/core/shared/text-normalization.js +4 -4
  302. package/dist/core/shared/text-normalization.js.map +1 -1
  303. package/dist/core/shared/time.js +4 -1
  304. package/dist/core/shared/time.js.map +1 -1
  305. package/dist/core/store/front-matter-cache.js +8 -3
  306. package/dist/core/store/front-matter-cache.js.map +1 -1
  307. package/dist/core/store/index.js +4 -1
  308. package/dist/core/store/index.js.map +1 -1
  309. package/dist/core/store/item-format-migration.js +4 -1
  310. package/dist/core/store/item-format-migration.js.map +1 -1
  311. package/dist/core/store/item-store.d.ts +4 -0
  312. package/dist/core/store/item-store.js +133 -39
  313. package/dist/core/store/item-store.js.map +1 -1
  314. package/dist/core/store/paths.js +4 -1
  315. package/dist/core/store/paths.js.map +1 -1
  316. package/dist/core/store/settings-validator.d.ts +106 -0
  317. package/dist/core/store/settings-validator.js +279 -0
  318. package/dist/core/store/settings-validator.js.map +1 -0
  319. package/dist/core/store/settings.js +32 -331
  320. package/dist/core/store/settings.js.map +1 -1
  321. package/dist/core/telemetry/consent.js +4 -1
  322. package/dist/core/telemetry/consent.js.map +1 -1
  323. package/dist/core/telemetry/observability.d.ts +1 -1
  324. package/dist/core/telemetry/observability.js +11 -2
  325. package/dist/core/telemetry/observability.js.map +1 -1
  326. package/dist/core/telemetry/runtime.js +34 -6
  327. package/dist/core/telemetry/runtime.js.map +1 -1
  328. package/dist/core/test/background-runs.js +4 -1
  329. package/dist/core/test/background-runs.js.map +1 -1
  330. package/dist/core/test/item-test-run-tracking.js +4 -1
  331. package/dist/core/test/item-test-run-tracking.js.map +1 -1
  332. package/dist/mcp/server.js +182 -22
  333. package/dist/mcp/server.js.map +1 -1
  334. package/dist/sdk/cli-contracts/commander-mutation-options.js +10 -3
  335. package/dist/sdk/cli-contracts/commander-mutation-options.js.map +1 -1
  336. package/dist/sdk/cli-contracts/commander-types.js +4 -1
  337. package/dist/sdk/cli-contracts/commander-types.js.map +1 -1
  338. package/dist/sdk/cli-contracts.d.ts +13 -2
  339. package/dist/sdk/cli-contracts.js +410 -26
  340. package/dist/sdk/cli-contracts.js.map +1 -1
  341. package/dist/sdk/index.js +4 -1
  342. package/dist/sdk/index.js.map +1 -1
  343. package/dist/sdk/runtime.d.ts +25 -1
  344. package/dist/sdk/runtime.js +48 -2
  345. package/dist/sdk/runtime.js.map +1 -1
  346. package/dist/types/index.js +4 -1
  347. package/dist/types/index.js.map +1 -1
  348. package/dist/types.d.ts +92 -2
  349. package/dist/types.js +42 -1
  350. package/dist/types.js.map +1 -1
  351. package/docs/AGENT_GUIDE.md +23 -7
  352. package/docs/ARCHITECTURE.md +1 -1
  353. package/docs/CLAUDE_CODE_PLUGIN.md +10 -10
  354. package/docs/CODEX_PLUGIN.md +2 -2
  355. package/docs/COMMANDS.md +117 -12
  356. package/docs/CONFIGURATION.md +5 -2
  357. package/docs/EXTENSIONS.md +158 -814
  358. package/docs/QUICKSTART.md +11 -5
  359. package/docs/README.md +7 -6
  360. package/docs/RELEASING.md +13 -9
  361. package/docs/SDK.md +11 -2
  362. package/docs/TESTING.md +2 -2
  363. package/marketplace.json +3 -3
  364. package/package.json +15 -12
  365. package/packages/pm-beads/package.json +1 -1
  366. package/packages/pm-calendar/README.md +4 -2
  367. package/packages/pm-calendar/extensions/calendar/index.js +22 -3
  368. package/packages/pm-calendar/extensions/calendar/index.ts +22 -3
  369. package/packages/pm-calendar/extensions/calendar/runtime.js +26 -7
  370. package/packages/pm-calendar/extensions/calendar/runtime.ts +26 -7
  371. package/packages/pm-calendar/package.json +1 -1
  372. package/packages/pm-governance-audit/package.json +1 -1
  373. package/packages/pm-guide-shell/extensions/guide-shell/index.js +1 -1
  374. package/packages/pm-guide-shell/extensions/guide-shell/index.ts +1 -1
  375. package/packages/pm-guide-shell/package.json +1 -1
  376. package/packages/pm-linked-test-adapters/package.json +1 -1
  377. package/packages/pm-search-advanced/README.md +8 -0
  378. package/packages/pm-search-advanced/extensions/search-advanced/index.js +74 -0
  379. package/packages/pm-search-advanced/extensions/search-advanced/index.ts +75 -1
  380. package/packages/pm-search-advanced/extensions/search-advanced/runtime.js +67 -9
  381. package/packages/pm-search-advanced/extensions/search-advanced/runtime.ts +67 -9
  382. package/packages/pm-search-advanced/package.json +1 -1
  383. package/packages/pm-templates/README.md +1 -1
  384. package/packages/pm-templates/extensions/templates/runtime.js +11 -202
  385. package/packages/pm-templates/extensions/templates/runtime.ts +38 -230
  386. package/packages/pm-templates/package.json +1 -1
  387. package/packages/pm-todos/package.json +1 -1
  388. package/plugins/{pm-cli-claude → pm-claude}/.claude-plugin/plugin.json +2 -2
  389. package/plugins/{pm-cli-claude → pm-claude}/.mcp.json +1 -1
  390. package/plugins/{pm-cli-claude → pm-claude}/README.md +4 -4
  391. package/plugins/{pm-cli-claude → pm-claude}/agents/pm-coordinator.md +1 -1
  392. package/plugins/{pm-cli-claude → pm-claude}/commands/pm-init.md +10 -1
  393. package/plugins/{pm-cli-claude → pm-claude}/commands/pm-planner.md +18 -0
  394. package/plugins/{pm-cli-claude → pm-claude}/skills/pm-planner/SKILL.md +46 -1
  395. package/plugins/{pm-cli-codex → pm-codex}/.codex-plugin/plugin.json +3 -3
  396. package/plugins/{pm-cli-codex → pm-codex}/.mcp.json +1 -1
  397. package/plugins/{pm-cli-codex → pm-codex}/README.md +7 -4
  398. package/plugins/pm-codex/skills/pm-native/SKILL.md +81 -0
  399. package/scripts/finalize-build.mjs +28 -0
  400. package/scripts/prepare-build-cache.mjs +37 -0
  401. package/dist/core/output/command-aware.d.ts +0 -1
  402. package/dist/core/output/command-aware.js +0 -394
  403. package/dist/core/output/command-aware.js.map +0 -1
  404. package/plugins/pm-cli-codex/skills/pm-native/SKILL.md +0 -57
  405. /package/plugins/{pm-cli-claude → pm-claude}/agents/pm-delivery-chain.md +0 -0
  406. /package/plugins/{pm-cli-claude → pm-claude}/agents/pm-triage-agent.md +0 -0
  407. /package/plugins/{pm-cli-claude → pm-claude}/agents/pm-verification-agent.md +0 -0
  408. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-audit.md +0 -0
  409. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-calendar.md +0 -0
  410. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-close-task.md +0 -0
  411. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-developer.md +0 -0
  412. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-list.md +0 -0
  413. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-new.md +0 -0
  414. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-release.md +0 -0
  415. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-search.md +0 -0
  416. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-start-task.md +0 -0
  417. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-status.md +0 -0
  418. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-triage.md +0 -0
  419. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-workflow.md +0 -0
  420. /package/plugins/{pm-cli-claude → pm-claude}/hooks/hooks.json +0 -0
  421. /package/plugins/{pm-cli-claude → pm-claude}/hooks/session-start.mjs +0 -0
  422. /package/plugins/{pm-cli-claude → pm-claude}/scripts/pm-mcp-server.mjs +0 -0
  423. /package/plugins/{pm-cli-claude → pm-claude}/skills/pm-audit/SKILL.md +0 -0
  424. /package/plugins/{pm-cli-claude → pm-claude}/skills/pm-developer/SKILL.md +0 -0
  425. /package/plugins/{pm-cli-claude → pm-claude}/skills/pm-release/SKILL.md +0 -0
  426. /package/plugins/{pm-cli-claude → pm-claude}/skills/pm-workflow/SKILL.md +0 -0
  427. /package/plugins/{pm-cli-codex → pm-codex}/assets/pm-cli-small.svg +0 -0
  428. /package/plugins/{pm-cli-codex → pm-codex}/commands/pm-audit.md +0 -0
  429. /package/plugins/{pm-cli-codex → pm-codex}/commands/pm-close-task.md +0 -0
  430. /package/plugins/{pm-cli-codex → pm-codex}/commands/pm-start-task.md +0 -0
  431. /package/plugins/{pm-cli-codex → pm-codex}/scripts/pm-mcp-server.mjs +0 -0
  432. /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-auditor/SKILL.md +0 -0
  433. /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-auditor/agents/openai.yaml +0 -0
  434. /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-native/agents/openai.yaml +0 -0
  435. /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-release/SKILL.md +0 -0
  436. /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-release/agents/openai.yaml +0 -0
@@ -1,85 +1,53 @@
1
1
  # Packages and Extensions
2
2
 
3
- Packages let you add or override `pm` runtime behavior without modifying core `pm-cli` sources. A package can currently contain one or more runtime extensions, and the package-first command surface is the preferred user-facing workflow.
4
-
5
- `pm extension ...` remains supported for compatibility. New scripts and docs should prefer `pm install ...` and `pm package ...`.
6
-
7
- This document is the canonical package/extension reference for manifest contracts, governance policy, trust and sandbox controls, reload workflows, and diagnostics.
8
-
9
- ## Quick Start
3
+ Packages add optional `pm` workflows without changing the core CLI. A package can ship one or more runtime extensions plus metadata such as docs and examples. Prefer the package-first commands in new docs and automation:
10
4
 
11
5
  ```bash
12
- # 1) Scaffold a package extension
13
- pm package init ./my-package-extension
14
-
15
- # 2) Install in project scope
6
+ pm package init ./my-package
16
7
  pm install ./my-package --project
17
-
18
- # Or install all bundled first-party packages
19
- pm install '*' --project
20
-
21
- # 3) Run diagnostics
22
8
  pm package doctor --project --detail summary
23
-
24
- # 4) Plan CLI/SDK and package upgrades
25
- pm upgrade --dry-run
26
-
27
- # 5) Reload runtime modules after local edits
28
9
  pm package reload --project
10
+ pm upgrade --dry-run
29
11
  ```
30
12
 
31
- Compatibility equivalents:
13
+ `pm extension ...` remains supported for compatibility and low-level runtime debugging.
32
14
 
33
- ```bash
34
- pm extension init ./my-package # prefer: pm package init ./my-package
35
- pm extension install ./my-package --project
36
- pm extension doctor --project --detail summary
37
- pm extension reload --project
38
- ```
15
+ Related docs:
39
16
 
40
- Use compatibility equivalents only for existing automation or for debugging extension-runtime behavior directly.
17
+ - [SDK](SDK.md)
18
+ - [Configuration](CONFIGURATION.md)
19
+ - [Testing](TESTING.md)
20
+ - [Command Reference](COMMANDS.md)
41
21
 
42
- ## Upgrade Workflow
22
+ ## Package Sources
43
23
 
44
- `pm upgrade` is the package-first update entrypoint:
24
+ `pm install` accepts local, registry, and GitHub sources:
45
25
 
46
26
  ```bash
47
- pm upgrade --dry-run # plan CLI/SDK and project package updates
48
- pm upgrade # update the global pm CLI/SDK, then refresh project packages
49
- pm upgrade --packages-only # refresh managed packages without changing the CLI
50
- pm upgrade todos --dry-run # plan one managed package refresh
51
- pm upgrade --cli-only --repair # force a global CLI/SDK reinstall through npm
27
+ pm install ./local-package --project
28
+ pm install /absolute/path/to/package --project
29
+ pm install npm:@scope/package --project
30
+ pm install npm:package@1.2.3 --project
31
+ pm install https://github.com/org/repo --project
32
+ pm install --github org/repo/path --ref main --project
52
33
  ```
53
34
 
54
- CLI/SDK upgrades use `npm install -g @unbrained/pm-cli@<tag>`.
55
- Managed package upgrades reuse the source recorded at install time, including `npm:`, GitHub, local, and first-party package paths.
56
- Use `--tag <version-or-dist-tag>` to target a registry tag such as `latest` or `next`.
57
-
58
- ## Extension Locations
59
-
60
- - project scope: `.agents/pm/extensions/<name>/`
61
- - global scope: `~/.pm-cli/extensions/<name>/`
62
- - project entries override global entries for matching command paths
63
-
64
- Runtime path overrides:
65
-
66
- - `PM_PATH`: project tracker root override
67
- - `PM_GLOBAL_PATH`: global profile root override
68
-
69
- ## Package Sources
70
-
71
- `pm install` accepts these package sources:
35
+ Bundled first-party packages live under `packages/pm-*`:
72
36
 
73
37
  ```bash
74
- pm install ./local-package
75
- pm install /absolute/path/to/package
76
- pm install npm:@scope/package
77
- pm install npm:package@1.2.3
78
- pm install https://github.com/org/repo
79
- pm install --github org/repo/path --ref main
38
+ pm package catalog --project
39
+ pm install '*' --project
40
+ pm install all --project
41
+ pm install calendar --project
42
+ pm install search-advanced --project
43
+ pm install governance-audit --project
80
44
  ```
81
45
 
82
- Package roots can expose resources with a `pm` manifest in `package.json`:
46
+ `pm install '*'`, `pm install all`, and shell-expanded `pm install *` are normalized to the same bundled install-all request. First-party package aliases come from each package manifest, with a fallback derived from the `packages/pm-*` directory name.
47
+
48
+ ## Package Manifest
49
+
50
+ Package roots declare resources in `package.json` under `pm`:
83
51
 
84
52
  ```json
85
53
  {
@@ -89,7 +57,7 @@ Package roots can expose resources with a `pm` manifest in `package.json`:
89
57
  "aliases": ["my-workflow"],
90
58
  "extensions": ["extensions/my-extension"],
91
59
  "docs": ["README.md"],
92
- "examples": ["README.md"],
60
+ "examples": ["examples/basic.md"],
93
61
  "catalog": {
94
62
  "display_name": "My pm Package",
95
63
  "category": "workflow",
@@ -99,301 +67,70 @@ Package roots can expose resources with a `pm` manifest in `package.json`:
99
67
  "docs": "https://example.com/docs",
100
68
  "repository": "https://github.com/org/my-pm-package",
101
69
  "report": "https://github.com/org/my-pm-package/issues"
102
- },
103
- "media": {
104
- "image": "https://example.com/preview.png"
105
70
  }
106
71
  }
107
72
  }
108
73
  }
109
74
  ```
110
75
 
111
- `pm.aliases` declares short install targets for bundled first-party packages. If aliases are omitted, `pm` derives a default alias from the `packages/pm-*` directory name. The SDK exposes this project-management package model through `PM_PACKAGE_RESOURCE_KINDS`, `PM_PACKAGE_CONVENTIONAL_RESOURCE_ROOTS`, and `readPmPackageManifest`. Package installation currently activates only `pm.extensions`; `pm.docs` and `pm.examples` are metadata-first catalog resources. Agent-specific bundles such as prompts, skills, and MCP servers should live in separate agent adapter packages rather than the core `pm` package contract.
76
+ Current resource kinds are:
77
+
78
+ - `extensions`
79
+ - `docs`
80
+ - `examples`
112
81
 
113
- When no manifest is present, `pm` discovers conventional extension directories:
82
+ Installation activates `pm.extensions`. `pm.docs` and `pm.examples` are catalog metadata. Agent-specific assets such as prompts, skills, or MCP servers should live in agent adapter packages, not in the core `pm` package contract.
83
+
84
+ When no package manifest is present, `pm` discovers conventional extension directories:
114
85
 
115
86
  - `.agents/pm/extensions/`
116
87
  - `extensions/`
117
88
  - `.custom/pm-extensions/`
118
89
  - `.custom/pm-extension/`
119
90
 
120
- If a package contains multiple extension manifests, install the exact extension path so the managed state has one deterministic package target.
121
-
122
- First-party optional packages are shipped as package roots under `packages/`:
123
-
124
- ```bash
125
- pm package catalog --project
126
- pm install '*' --project
127
- pm install all --project
128
- pm install packages/pm-calendar --project
129
- pm install packages/pm-beads --project
130
- pm install packages/pm-todos --project
131
- ```
132
-
133
- `pm install '*'` and `pm install all` install every bundled first-party package in deterministic alias order. If your shell expands `pm install *`, pm recognizes that expansion and treats it as the same bundled-package install-all request.
134
-
135
- Compatibility aliases remain available:
91
+ If a source contains multiple extension manifests, install the exact extension path so managed state has one deterministic target.
136
92
 
137
- ```bash
138
- pm install beads --project
139
- pm install calendar --project
140
- pm install todos --project
141
- ```
93
+ ## Extension Layout
142
94
 
143
- Those aliases install package-shipped extension sources. They are then tracked in managed package state and can be refreshed with `pm upgrade --packages-only`.
95
+ Project extensions are stored under `.agents/pm/extensions/<name>/`. Global extensions are stored under `~/.pm-cli/extensions/<name>/`. Project entries override global entries when they register the same command path or runtime surface.
144
96
 
145
- If a package-owned command is invoked before installation (for example `pm calendar --help`, `pm reindex --help`, or `pm normalize --help` in bare core mode), runtime usage guidance now includes a direct recovery command such as `pm install calendar`, `pm install search-advanced`, or `pm install governance-audit`.
97
+ Runtime path overrides:
146
98
 
147
- ## Manifest Contract
99
+ - `PM_PATH`: project tracker root
100
+ - `PM_GLOBAL_PATH`: global profile root
148
101
 
149
- ### Manifest v1 (supported)
102
+ A minimal extension has a `manifest.json` and an entrypoint:
150
103
 
151
104
  ```json
152
105
  {
153
- "name": "my-ext",
106
+ "name": "hello",
154
107
  "version": "0.1.0",
155
108
  "entry": "./index.js",
156
- "priority": 100,
157
109
  "capabilities": ["commands"]
158
110
  }
159
111
  ```
160
112
 
161
- ### Manifest v2 (recommended)
113
+ ```js
114
+ import { defineExtension } from "@unbrained/pm-cli/sdk";
162
115
 
163
- ```json
164
- {
165
- "name": "my-ext",
166
- "version": "0.2.0",
167
- "entry": "./index.js",
168
- "priority": 100,
169
- "manifest_version": 2,
170
- "trusted": true,
171
- "provenance": {
172
- "source": "github://org/repo/path",
173
- "verified": true
174
- },
175
- "sandbox_profile": "restricted",
176
- "permissions": {
177
- "fs_read": true,
178
- "fs_write": false,
179
- "network": false,
180
- "env_read": true,
181
- "env_write": false,
182
- "process_spawn": false
116
+ export default defineExtension({
117
+ activate(api) {
118
+ api.registerCommand({
119
+ name: "hello",
120
+ description: "Print a deterministic hello payload.",
121
+ intent: "verify extension command activation",
122
+ examples: ["pm hello"],
123
+ run() {
124
+ return { ok: true, message: "hello" };
125
+ },
126
+ });
183
127
  },
184
- "capabilities": ["commands", "hooks"]
185
- }
186
- ```
187
-
188
- ### Capability values
189
-
190
- - `commands`
191
- - `parser`
192
- - `preflight`
193
- - `services`
194
- - `renderers`
195
- - `hooks`
196
- - `schema`
197
- - `importers`
198
- - `search`
199
-
200
- ## Governance Policy (`extensions.policy`)
201
-
202
- Policy is configured in `settings.json` under `extensions.policy`.
203
-
204
- ```json
205
- {
206
- "extensions": {
207
- "policy": {
208
- "mode": "enforce",
209
- "trust_mode": "warn",
210
- "require_provenance": true,
211
- "default_sandbox_profile": "restricted",
212
- "allowed_extensions": [],
213
- "blocked_extensions": [],
214
- "allowed_capabilities": [],
215
- "blocked_capabilities": ["services"],
216
- "allowed_surfaces": [],
217
- "blocked_surfaces": ["commands.override"],
218
- "allowed_commands": [],
219
- "blocked_commands": ["dangerous command"],
220
- "allowed_actions": [],
221
- "blocked_actions": ["dangerous-command"],
222
- "allowed_services": [],
223
- "blocked_services": ["output_format"]
224
- }
225
- }
226
- }
227
- ```
228
-
229
- Mode semantics:
230
-
231
- - `mode`: `off|warn|enforce` for extension/capability/surface/command/action/service checks
232
- - `trust_mode`: `off|warn|enforce` for trust checks
233
- - `default_sandbox_profile`: `none|restricted|strict`
234
-
235
- Sandbox profiles:
236
-
237
- - `none`: no sandbox permission gating
238
- - `restricted`: blocks sensitive writes and spawn (`process_spawn`, `env_write`)
239
- - `strict`: blocks spawn/network/write style permissions (`process_spawn`, `network`, `fs_write`, `env_write`)
240
-
241
- If profile is non-`none` and manifest permissions are missing, policy emits a deterministic warning or block.
242
-
243
- ## Supported Surface Tokens
244
-
245
- Use these values with `allowed_surfaces` and `blocked_surfaces`:
246
-
247
- - `commands.override`
248
- - `commands.handler`
249
- - `hooks.beforecommand`
250
- - `hooks.aftercommand`
251
- - `hooks.onwrite`
252
- - `hooks.onread`
253
- - `hooks.onindex`
254
- - `schema.flags`
255
- - `schema.itemfields`
256
- - `schema.itemtypes`
257
- - `schema.migrations`
258
- - `parser.override`
259
- - `preflight.override`
260
- - `services.override`
261
- - `renderers.override`
262
- - `importers.importer`
263
- - `importers.exporter`
264
- - `search.provider`
265
- - `search.vectorstore`
266
-
267
- ## Reload and Watch Workflows
268
-
269
- Manual reload:
270
-
271
- ```bash
272
- pm extension --reload --project
273
- ```
274
-
275
- Watch-mode semantics:
276
-
277
- ```bash
278
- pm extension --reload --project --watch
279
- ```
280
-
281
- In non-interactive automation, `--watch` performs a deterministic single-pass reload and emits a watch-hint warning.
282
-
283
- ## Diagnostics and Management
284
-
285
- Basic diagnostics:
286
-
287
- ```bash
288
- pm extension --doctor --project --detail summary
289
- ```
290
-
291
- Deep diagnostics:
292
-
293
- ```bash
294
- pm extension --doctor --project --detail deep --trace
295
- ```
296
-
297
- Management commands:
298
-
299
- ```bash
300
- pm package catalog --project
301
- pm package explore
302
- pm package manage --project
303
- pm package manage --project --runtime-probe
304
- pm package manage --project --fix-managed-state
305
- pm package activate my-extension --project
306
- pm package deactivate my-extension --project
307
- pm package uninstall my-extension --project
308
- ```
309
-
310
- Common warning prefixes:
311
-
312
- - `extension_policy_violation_extension`
313
- - `extension_policy_violation_capability`
314
- - `extension_policy_violation_registration`
315
- - `extension_policy_violation_trust`
316
- - `extension_policy_blocked_extension`
317
- - `extension_policy_blocked_capability`
318
- - `extension_policy_blocked_registration`
319
- - `extension_policy_blocked_trust`
320
-
321
- ## Migration Checklist (v1 -> v2)
322
-
323
- 1. Keep existing manifest fields.
324
- 2. Add `manifest_version: 2`.
325
- 3. Add `trusted`, `provenance`, `sandbox_profile`, and `permissions`.
326
- 4. Extend `extensions.policy` with trust/sandbox and command/action/service controls.
327
- 5. Run:
328
-
329
- ```bash
330
- pm contracts --json
331
- pm package doctor --project --detail summary --strict-exit
332
- ```
333
-
334
- 6. Resolve warnings before enforcing `mode=enforce` and `trust_mode=enforce`.
335
-
336
- ## Runnable Examples
337
-
338
- - `docs/examples/starter-extension/`
339
- - `docs/examples/policy-restricted-extension/`
340
- - `docs/examples/sdk-contract-consumer/`
341
- - `docs/examples/sdk-app-embedding/`
342
- - `docs/examples/ci/github-actions-pm-extension-gate.yml`
343
- - `docs/examples/ci/gitlab-ci-pm-extension-gate.yml`
344
- - `docs/examples/ci/jenkins-pm-extension-gate.Jenkinsfile`
345
- # Extension Runtime Details
346
-
347
- Extensions let you add or override `pm` runtime behavior without modifying core `pm-cli`.
348
-
349
- This guide is the authoritative reference for:
350
-
351
- - manifest `v1` and `v2` contracts
352
- - governance policy (`extensions.policy`) controls
353
- - trust/provenance and sandbox restrictions
354
- - manual reload and watch-mode workflows
355
- - migration from policy-only setups to enterprise controls
356
-
357
- ## Quick Start
358
-
359
- ```bash
360
- # 1) Scaffold a package-backed extension
361
- pm package init ./my-package
362
-
363
- # 2) Install in project scope
364
- pm install ./my-package --project
365
-
366
- # 3) Run diagnostics
367
- pm package doctor --project --detail summary
368
-
369
- # 4) Reload runtime modules after local edits
370
- pm package reload --project
128
+ });
371
129
  ```
372
130
 
373
- ## Delta From Previous Scope
374
-
375
- Compared to the previous policy-only extension surface, this release adds:
376
-
377
- - **Manifest v2 metadata** for trust, provenance, sandbox profile, and runtime permission declarations.
378
- - **Policy v2 controls** for trust mode, provenance requirement, sandbox defaults, and command/action/service allow/block maps.
379
- - **Registration enforcement upgrades** so command/action/service restrictions are evaluated at registration boundaries.
380
- - **Hot reload controls** via cache-busted package reload (`pm package reload`) with watch-mode semantics (`--watch`).
381
- - **Contracts metadata upgrades** for trust/sandbox compatibility information in `pm contracts`.
131
+ ## Extension Manifest
382
132
 
383
- ## Extension Locations
384
-
385
- - Project scope: `.agents/pm/extensions/<name>/`
386
- - Global scope: `~/.pm-cli/extensions/<name>/`
387
- - Project entries override global entries when command paths collide.
388
-
389
- Overrides:
390
-
391
- - `PM_PATH`: project tracker root override
392
- - `PM_GLOBAL_PATH`: global profile root override
393
-
394
- ## Manifest Contract
395
-
396
- ### Manifest v1 (still supported)
133
+ Manifest v1 is supported:
397
134
 
398
135
  ```json
399
136
  {
@@ -405,7 +142,7 @@ Overrides:
405
142
  }
406
143
  ```
407
144
 
408
- ### Manifest v2 (recommended)
145
+ Manifest v2 is recommended when governance, trust, or sandbox metadata matters:
409
146
 
410
147
  ```json
411
148
  {
@@ -428,11 +165,18 @@ Overrides:
428
165
  "env_write": false,
429
166
  "process_spawn": false
430
167
  },
431
- "capabilities": ["commands", "hooks"]
168
+ "capabilities": ["commands", "schema"]
432
169
  }
433
170
  ```
434
171
 
435
- ### Capability Values
172
+ Rules:
173
+
174
+ - `entry` must resolve inside the extension directory.
175
+ - Declare only capabilities the extension actually uses.
176
+ - Unknown capabilities emit deterministic warnings.
177
+ - Legacy aliases such as `migration` and `validation` are normalized to `schema` with warnings.
178
+
179
+ Supported capabilities:
436
180
 
437
181
  - `commands`
438
182
  - `parser`
@@ -444,9 +188,9 @@ Overrides:
444
188
  - `importers`
445
189
  - `search`
446
190
 
447
- ## Governance Policy v2
191
+ ## Governance Policy
448
192
 
449
- Policy is configured under `settings.json` -> `extensions.policy`.
193
+ Governance policy is configured in `settings.json` under `extensions.policy`:
450
194
 
451
195
  ```json
452
196
  {
@@ -455,7 +199,6 @@ Policy is configured under `settings.json` -> `extensions.policy`.
455
199
  "mode": "enforce",
456
200
  "trust_mode": "warn",
457
201
  "require_provenance": true,
458
- "trusted_extensions": ["policy-restricted-extension"],
459
202
  "default_sandbox_profile": "restricted",
460
203
  "allowed_extensions": [],
461
204
  "blocked_extensions": [],
@@ -466,240 +209,34 @@ Policy is configured under `settings.json` -> `extensions.policy`.
466
209
  "allowed_commands": [],
467
210
  "blocked_commands": ["dangerous command"],
468
211
  "allowed_actions": [],
469
- "blocked_actions": ["dangerous-command"],
212
+ "blocked_actions": [],
470
213
  "allowed_services": [],
471
- "blocked_services": ["output_format"],
472
- "extension_overrides": [
473
- {
474
- "name": "policy-restricted-extension",
475
- "require_trusted": true,
476
- "require_provenance": true,
477
- "sandbox_profile": "strict",
478
- "allowed_surfaces": ["commands.handler", "hooks.beforecommand"],
479
- "blocked_surfaces": ["services.override"]
480
- }
481
- ]
214
+ "blocked_services": []
482
215
  }
483
216
  }
484
217
  }
485
218
  ```
486
219
 
487
- ### Mode Semantics
488
-
489
- - `mode`: `off|warn|enforce` for extension/capability/surface/command/action/service restrictions
490
- - `trust_mode`: `off|warn|enforce` for trust checks
491
- - `default_sandbox_profile`: `none|restricted|strict`
492
-
493
- ### Sandbox Profiles
494
-
495
- Sandbox profiles are policy-driven gates evaluated against manifest permission declarations:
220
+ Policy modes:
496
221
 
497
- - `none`: no sandbox permission gating
498
- - `restricted`: blocks sensitive writes/spawn (`process_spawn`, `env_write`)
499
- - `strict`: blocks spawn/network/write-style permissions (`process_spawn`, `network`, `fs_write`, `env_write`)
222
+ - `off`: no policy enforcement or warnings
223
+ - `warn`: allow registrations but emit policy warnings
224
+ - `enforce`: block disallowed extensions, capabilities, commands, actions, services, or surfaces
500
225
 
501
- If a non-`none` profile is active and manifest permissions are missing, a deterministic policy warning/block is emitted.
226
+ Sandbox profiles:
502
227
 
503
- ### Surface Tokens
228
+ - `none`: no extra sandbox restriction
229
+ - `restricted`: safe default for normal package workflows
230
+ - `strict`: most restrictive policy profile
504
231
 
505
- Supported `allowed_surfaces` / `blocked_surfaces` values:
232
+ Surface tokens include:
506
233
 
507
- - `commands.override`
508
234
  - `commands.handler`
509
- - `hooks.beforecommand`
510
- - `hooks.aftercommand`
511
- - `hooks.onwrite`
512
- - `hooks.onread`
513
- - `hooks.onindex`
514
- - `schema.flags`
515
- - `schema.itemfields`
516
- - `schema.itemtypes`
517
- - `schema.migrations`
235
+ - `commands.override`
518
236
  - `parser.override`
519
237
  - `preflight.override`
520
238
  - `services.override`
521
239
  - `renderers.override`
522
- - `importers.importer`
523
- - `importers.exporter`
524
- - `search.provider`
525
- - `search.vectorstore`
526
-
527
- ## Hot Reload
528
-
529
- ### Manual reload
530
-
531
- ```bash
532
- pm extension --reload --project
533
- ```
534
-
535
- This runs extension discovery/load with cache-busted import URLs and returns deterministic load/activation diagnostics.
536
-
537
- ### Watch mode
538
-
539
- ```bash
540
- pm extension --reload --project --watch
541
- ```
542
-
543
- `--watch` enables watch-mode semantics for reload workflows. In non-interactive automation, it executes a deterministic single-pass reload and emits a watch hint warning.
544
-
545
- ## Diagnostics and Warning Codes
546
-
547
- Common warning prefixes:
548
-
549
- - `extension_policy_violation_extension`
550
- - `extension_policy_violation_capability`
551
- - `extension_policy_violation_registration`
552
- - `extension_policy_violation_trust`
553
- - `extension_policy_blocked_extension`
554
- - `extension_policy_blocked_capability`
555
- - `extension_policy_blocked_registration`
556
- - `extension_policy_blocked_trust`
557
-
558
- Use:
559
-
560
- ```bash
561
- pm extension --doctor --project --detail deep --trace
562
- ```
563
-
564
- for full activation traces.
565
-
566
- ## Migration (v1 -> v2)
567
-
568
- 1. Keep existing manifest fields unchanged.
569
- 2. Add `manifest_version: 2`.
570
- 3. Add `trusted`, `provenance`, `sandbox_profile`, and `permissions`.
571
- 4. Extend `extensions.policy` with trust/sandbox/command-action-service fields.
572
- 5. Run:
573
-
574
- ```bash
575
- pm contracts --json
576
- pm extension --doctor --project --detail summary --strict-exit
577
- ```
578
-
579
- 6. Fix any policy warnings before enforcing (`mode=enforce`, `trust_mode=enforce`).
580
-
581
- ## Runnable Examples
582
-
583
- - `docs/examples/starter-extension/`
584
- - `docs/examples/policy-restricted-extension/`
585
- - `docs/examples/sdk-contract-consumer/`
586
- - `docs/examples/sdk-app-embedding/`
587
- - `docs/examples/ci/github-actions-pm-extension-gate.yml`
588
- - `docs/examples/ci/gitlab-ci-pm-extension-gate.yml`
589
- - `docs/examples/ci/jenkins-pm-extension-gate.Jenkinsfile`
590
- # Extension Runtime Governance
591
-
592
- Extensions let you add or override `pm` runtime behavior without editing core `pm-cli` sources. They are loaded at runtime, gated by manifest capabilities, and now support granular governance policies for capability/surface allow/block controls.
593
-
594
- ## Quick Start
595
-
596
- ```bash
597
- # 1) Scaffold a new package
598
- pm package init ./my-package
599
-
600
- # 2) Install into project scope
601
- pm install ./my-package --project
602
-
603
- # 3) Run package diagnostics
604
- pm package doctor --project --detail summary
605
-
606
- # 4) Deep diagnostics with traces
607
- pm package doctor --project --detail deep --trace
608
- ```
609
-
610
- Expected summary signals from `pm package doctor`:
611
-
612
- - `details.summary.status`: `ok` or `warn`
613
- - `details.summary.warning_codes`: deterministic warning code list
614
- - `details.summary.policy`: active policy mode and configured counts
615
- - `details.triage.remediation`: actionable follow-up guidance
616
-
617
- ## Extension Locations and Precedence
618
-
619
- - Project extensions: `.agents/pm/extensions/<name>/`
620
- - Global extensions: `~/.pm-cli/extensions/<name>/`
621
- - Project takes precedence when both scopes register the same command/surface.
622
- - Discovery and activation remain deterministic across runs.
623
-
624
- Environment overrides:
625
-
626
- - `PM_PATH`: project tracker root override
627
- - `PM_GLOBAL_PATH`: global profile root override
628
-
629
- ## Manifest and Capabilities
630
-
631
- Minimal `manifest.json`:
632
-
633
- ```json
634
- {
635
- "name": "pm-ext-example",
636
- "version": "0.1.0",
637
- "entry": "./index.js",
638
- "priority": 100,
639
- "capabilities": ["commands"]
640
- }
641
- ```
642
-
643
- Rules:
644
-
645
- - `entry` must resolve inside extension directory (symlink-safe canonical checks apply).
646
- - Declare only capabilities actually used.
647
- - Unknown capabilities produce deterministic warnings with guidance.
648
- - Legacy aliases (`migration`, `validation`) are remapped to `schema` with guidance warnings.
649
-
650
- Supported capabilities:
651
-
652
- - `commands`
653
- - `parser`
654
- - `preflight`
655
- - `services`
656
- - `renderers`
657
- - `hooks`
658
- - `schema`
659
- - `importers`
660
- - `search`
661
-
662
- ## Governance Policy (Granular Controls)
663
-
664
- Extension governance policy is configured in `settings.json` under `extensions.policy`.
665
-
666
- Policy modes:
667
-
668
- - `off`: no policy enforcement/warnings
669
- - `warn`: allow registrations but emit policy violation warnings
670
- - `enforce`: block disallowed extensions/capabilities/surfaces
671
-
672
- Example policy:
673
-
674
- ```json
675
- {
676
- "extensions": {
677
- "policy": {
678
- "mode": "enforce",
679
- "allowed_extensions": ["release-audit-ext"],
680
- "blocked_extensions": [],
681
- "allowed_capabilities": [],
682
- "blocked_capabilities": ["services"],
683
- "allowed_surfaces": [],
684
- "blocked_surfaces": ["commands.override"],
685
- "extension_overrides": [
686
- {
687
- "name": "release-audit-ext",
688
- "allowed_surfaces": ["commands.handler", "hooks.beforecommand"],
689
- "blocked_surfaces": ["services.override"]
690
- }
691
- ]
692
- }
693
- }
694
- }
695
- ```
696
-
697
- ### Surface Tokens
698
-
699
- Use these exact values for `allowed_surfaces` / `blocked_surfaces`:
700
-
701
- - `commands.override`
702
- - `commands.handler`
703
240
  - `hooks.beforecommand`
704
241
  - `hooks.aftercommand`
705
242
  - `hooks.onwrite`
@@ -709,323 +246,130 @@ Use these exact values for `allowed_surfaces` / `blocked_surfaces`:
709
246
  - `schema.itemfields`
710
247
  - `schema.itemtypes`
711
248
  - `schema.migrations`
712
- - `parser.override`
713
- - `preflight.override`
714
- - `services.override`
715
- - `renderers.override`
716
- - `importers.importer`
717
- - `importers.exporter`
249
+ - `importers`
718
250
  - `search.provider`
719
- - `search.vectorstore`
720
-
721
- Policy diagnostics use deterministic warning codes:
722
-
723
- - `extension_policy_violation_extension`
724
- - `extension_policy_violation_capability`
725
- - `extension_policy_violation_registration`
726
- - `extension_policy_blocked_extension`
727
- - `extension_policy_blocked_capability`
728
- - `extension_policy_blocked_registration`
729
-
730
- ## Runtime APIs (Public SDK)
731
-
732
- Use `@unbrained/pm-cli/sdk` only (no internal imports).
733
-
734
- - `api.registerCommand(def)` -> `commands`
735
- - `api.registerParser(command, fn)` -> `parser`
736
- - `api.registerPreflight(fn)` -> `preflight`
737
- - `api.registerService(name, fn)` -> `services`
738
- - `api.registerRenderer(format, fn)` -> `renderers`
739
- - `api.registerFlags(command, flags)` -> `schema`
740
- - `api.registerItemFields(fields)` -> `schema`
741
- - `api.registerItemTypes(types)` -> `schema`
742
- - `api.registerMigration(def)` -> `schema`
743
- - `api.registerImporter(name, fn)` -> `importers`
744
- - `api.registerExporter(name, fn)` -> `importers`
745
- - `api.registerSearchProvider(provider)` -> `search`
746
- - `api.registerVectorStoreAdapter(adapter)` -> `search`
747
- - `api.hooks.beforeCommand/afterCommand/onWrite/onRead/onIndex(fn)` -> `hooks`
748
-
749
- ## Lifecycle Commands
750
-
751
- ```bash
752
- # Explore
753
- pm extension --explore --project
754
-
755
- # Manage (update checks + managed state diagnostics)
756
- pm extension --manage --project
757
251
 
758
- # Optional runtime probe parity in manage mode
759
- pm extension --manage --project --runtime-probe
252
+ Use `pm package doctor --project --detail deep --trace` to inspect active policy state and warning codes.
760
253
 
761
- # Auto-adopt unmanaged extensions into managed state
762
- pm extension --manage --project --fix-managed-state
254
+ ## Runtime APIs
763
255
 
764
- # Activation/deactivation
765
- pm extension --activate my-extension --project
766
- pm extension --deactivate my-extension --project
256
+ Use the public SDK barrel. Do not deep-import from `src/core` or `dist/core`.
767
257
 
768
- # Uninstall
769
- pm extension --uninstall my-extension --project
258
+ ```js
259
+ import { defineExtension } from "@unbrained/pm-cli/sdk";
770
260
  ```
771
261
 
772
- ## Non-Interactive Automation Patterns
773
-
774
- For CI/CD and agents:
775
-
776
- - Prefer `--json` outputs.
777
- - Use `pm contracts --schema-only --json` before invoking action payloads.
778
- - Run `pm extension --doctor --detail summary --strict-exit` as a gate.
779
- - Add `--detail deep --trace` on failure paths for remediation payloads.
780
- - Use `--no-extensions` as a deterministic fallback for core-only triage.
781
-
782
- ## Runnable Examples
783
-
784
- - Full starter extension: `docs/examples/starter-extension/`
785
- - Capability-restricted policy example: `docs/examples/policy-restricted-extension/`
786
- - Programmatic contracts consumer: `docs/examples/sdk-contract-consumer/`
787
- - CI gating workflow: `docs/examples/ci/github-actions-pm-extension-gate.yml`
788
-
789
- ## Troubleshooting
262
+ Common APIs:
790
263
 
791
- - Manifest/entry failures: run `pm package explore --project`
792
- - Activation failures: run `pm package doctor --detail deep --trace`
793
- - Policy blocks: review `settings.extensions.policy` and `details.summary.policy`
794
- - Runtime drift suspicion: compare with `pm --no-extensions <command>`
795
- - Managed-state update-check gaps: run `pm package manage --fix-managed-state`
264
+ - `api.registerCommand(definition)` adds package-owned commands.
265
+ - `api.registerFlags(command, flags)` adds runtime command flags.
266
+ - `api.registerItemFields(fields)` adds custom metadata fields.
267
+ - `api.registerItemTypes(types)` adds custom item types.
268
+ - `api.registerMigration(definition)` adds schema migrations.
269
+ - `api.registerOutputService(definition)` customizes output rendering.
270
+ - `api.registerRenderer(definition)` adds format-specific renderers.
271
+ - `api.registerHook(name, handler)` adds lifecycle hooks.
796
272
 
797
- ## Related Docs
273
+ Inline command flags require both `commands` and `schema` capabilities. Runtime schema changes should be verified with:
798
274
 
799
- - `docs/SDK.md`
800
- - `docs/examples/starter-extension/README.md`
801
- - `docs/CLAUDE_CODE_PLUGIN.md`
802
- # Extension Runtime Reference
803
-
804
- Extensions add commands, schema, renderers, importers/exporters, search adapters, lifecycle hooks, and selected runtime overrides without modifying core `pm-cli`.
805
-
806
- ## Agent Quick Context
807
-
808
- - Use `pm package init ./my-package` for a starter scaffold.
809
- - Use `@unbrained/pm-cli/sdk` for public extension APIs.
810
- - Declare only the capabilities your extension uses.
811
- - Run `pm package doctor --detail deep --trace` for activation failures.
812
- - Use `--no-extensions` to isolate core behavior during incident triage.
813
- - Use `pm guide extensions --depth standard` for local docs routing.
814
-
815
- Tracked documentation work: [pm-1sb2](../.agents/pm/tasks/pm-1sb2.toon).
816
-
817
- ## Extension Locations
818
-
819
- | Scope | Path |
820
- |-------|------|
821
- | Project | `.agents/pm/extensions/<name>/` |
822
- | Global | `~/.pm-cli/extensions/<name>/` |
823
-
824
- Environment overrides:
825
-
826
- - `PM_PATH` changes project tracker root.
827
- - `PM_GLOBAL_PATH` changes global profile root.
828
-
829
- Load order is global, then project. Project extensions take precedence when keys collide.
275
+ ```bash
276
+ pm contracts --runtime-only --schema-only --json
277
+ pm contracts --command <command> --flags-only --json
278
+ ```
830
279
 
831
- ## Lifecycle Manager
280
+ ## Lifecycle Commands
832
281
 
833
- Scaffold:
282
+ Explore installed runtime entries:
834
283
 
835
284
  ```bash
836
- pm package init ./my-package
837
- pm package scaffold ./my-package
285
+ pm package explore --project
286
+ pm package explore --project --json
838
287
  ```
839
288
 
840
- Install:
289
+ Run diagnostics:
841
290
 
842
291
  ```bash
843
- pm package install ./my-package --project
844
- pm package install github.com/unbraind/pm-cli/packages/pm-todos --project
845
- pm install todos --project
292
+ pm package doctor --project --detail summary
293
+ pm package doctor --project --detail deep --trace
294
+ pm package doctor --project --strict-exit
846
295
  ```
847
296
 
848
- Inspect and manage:
297
+ Manage state and update checks:
849
298
 
850
299
  ```bash
851
- pm package explore --project
852
300
  pm package manage --project
853
- pm package doctor --detail summary
854
- pm package doctor --detail deep --trace
301
+ pm package manage --project --fix-managed-state
302
+ pm package adopt my-extension --project
303
+ pm package adopt-all --project
855
304
  ```
856
305
 
857
- Activate and deactivate:
306
+ Activate or deactivate:
858
307
 
859
308
  ```bash
860
309
  pm package activate my-extension --project
861
310
  pm package deactivate my-extension --project
862
311
  ```
863
312
 
864
- Adopt unmanaged extensions:
313
+ Uninstall:
865
314
 
866
315
  ```bash
867
- pm package adopt my-extension --project
868
- pm package adopt-all --project
869
- ```
870
-
871
- ## Install Sources
872
-
873
- `pm install` and `pm package install` accept:
874
-
875
- - local directories
876
- - GitHub HTTPS URLs
877
- - `github.com/<owner>/<repo>[/path]`
878
- - `--gh <owner>/<repo>[/path]`
879
- - optional `--ref <branch|tag|sha>`
880
-
881
- When a GitHub source omits a subpath, the installer accepts a repository root containing one extension manifest or exactly one extension under known extension roots.
882
-
883
- ## Manifest
884
-
885
- Every extension has `manifest.json`:
886
-
887
- ```json
888
- {
889
- "name": "pm-ext-example",
890
- "version": "0.1.0",
891
- "entry": "./index.js",
892
- "priority": 100,
893
- "capabilities": ["commands"]
894
- }
316
+ pm package uninstall my-extension --project
895
317
  ```
896
318
 
897
- Rules:
319
+ Reload local edits:
898
320
 
899
- - `entry` must stay inside the extension directory.
900
- - `capabilities` gates what the extension can register.
901
- - Unknown capabilities emit guidance.
902
- - Legacy capability aliases are normalized for compatibility with warnings.
903
-
904
- Capability names:
905
-
906
- - `commands`
907
- - `parser`
908
- - `preflight`
909
- - `services`
910
- - `renderers`
911
- - `hooks`
912
- - `schema`
913
- - `importers`
914
- - `search`
915
-
916
- ## Minimal Extension
917
-
918
- `manifest.json`:
919
-
920
- ```json
921
- {
922
- "name": "hello",
923
- "version": "0.1.0",
924
- "entry": "./index.js",
925
- "capabilities": ["commands"]
926
- }
321
+ ```bash
322
+ pm package reload --project
323
+ pm package reload --project --watch
927
324
  ```
928
325
 
929
- `index.js`:
930
-
931
- ```js
932
- import { defineExtension } from "@unbrained/pm-cli/sdk";
326
+ Compatibility equivalents remain available through `pm extension ...` for existing automation.
933
327
 
934
- export default defineExtension({
935
- activate(api) {
936
- api.registerCommand({
937
- name: "hello",
938
- description: "Print a deterministic hello payload.",
939
- intent: "verify extension command activation",
940
- examples: ["pm hello"],
941
- run: async () => ({ message: "hello" }),
942
- });
943
- },
944
- });
945
- ```
328
+ ## Upgrade Workflow
946
329
 
947
- Run:
330
+ `pm upgrade` is the package-first update entrypoint:
948
331
 
949
332
  ```bash
950
- pm extension install ./hello --project
951
- pm hello
952
- ```
953
-
954
- ## API Reference
955
-
956
- Use [SDK](SDK.md) for typed examples. Runtime APIs include:
957
-
958
- | API | Capability | Purpose |
959
- |-----|------------|---------|
960
- | `api.registerCommand(def)` | `commands` | add or replace command handlers |
961
- | `api.registerParser(command, fn)` | `parser` | normalize args/options before dispatch |
962
- | `api.registerPreflight(fn)` | `preflight` | influence mutation gate decisions |
963
- | `api.registerService(name, fn)` | `services` | replace selected runtime services |
964
- | `api.registerRenderer(format, fn)` | `renderers` | override TOON or JSON output |
965
- | `api.registerImporter(name, fn)` | `importers` | add `<name> import` |
966
- | `api.registerExporter(name, fn)` | `importers` | add `<name> export` |
967
- | `api.registerFlags(command, flags)` | `schema` | describe dynamic command flags |
968
- | `api.registerItemFields(fields)` | `schema` | add item metadata fields |
969
- | `api.registerItemTypes(types)` | `schema` | add custom item types |
970
- | `api.registerMigration(def)` | `schema` | add schema migrations |
971
- | `api.registerSearchProvider(provider)` | `search` | add search provider |
972
- | `api.registerVectorStoreAdapter(adapter)` | `search` | add vector adapter |
973
- | `api.hooks.beforeCommand(fn)` | `hooks` | run before commands |
974
- | `api.hooks.afterCommand(fn)` | `hooks` | run after commands |
975
- | `api.hooks.onWrite(fn)` | `hooks` | observe writes |
976
- | `api.hooks.onRead(fn)` | `hooks` | observe reads |
977
- | `api.hooks.onIndex(fn)` | `hooks` | observe index operations |
978
-
979
- ## Command Metadata
980
-
981
- Dynamic commands should include human and machine metadata:
982
-
983
- ```js
984
- api.registerCommand({
985
- name: "acme sync",
986
- action: "acme-sync",
987
- description: "Synchronize ACME records into pm items.",
988
- intent: "run deterministic import before release prep",
989
- examples: ["pm acme sync --source ./records.json --dry-run"],
990
- failure_hints: ["Ensure --source points to readable JSON."],
991
- flags: [
992
- { long: "--source", value_name: "path", description: "Input file path", required: true },
993
- { long: "--dry-run", description: "Preview without writing", type: "boolean" }
994
- ],
995
- run: async (context) => ({ ok: true, args: context.args }),
996
- });
333
+ pm upgrade --dry-run
334
+ pm upgrade
335
+ pm upgrade --packages-only
336
+ pm upgrade todos --dry-run
337
+ pm upgrade --cli-only --repair
997
338
  ```
998
339
 
999
- Inline command flags require both `commands` and `schema` capabilities.
340
+ CLI/SDK upgrades use `npm install -g @unbrained/pm-cli@<tag>`. Managed package upgrades reuse the source recorded at install time, including registry, GitHub, local, and first-party package sources.
1000
341
 
1001
- ## Service and Preflight Safety
342
+ ## Automation Patterns
1002
343
 
1003
- `parser`, `preflight`, and `services` are powerful. They can change command input, mutation gates, output formatting, lock behavior, history appends, and item-store writes. Only enable these capabilities for reviewed extensions.
1004
-
1005
- For troubleshooting:
344
+ Use non-interactive commands with explicit project scope:
1006
345
 
1007
346
  ```bash
1008
- pm --no-extensions list-open
1009
- pm extension doctor --detail deep --trace
1010
- pm health --check-only
347
+ pm init --defaults --author codex-agent
348
+ pm install '*' --project
349
+ pm package doctor --project --detail summary --json
350
+ pm contracts --flags-only --json
351
+ pm health --check-only --json
1011
352
  ```
1012
353
 
1013
- ## Bundled Managed Extensions
354
+ For package-owned commands, install the package before assuming the command is available. Runtime contracts expose installed package actions; static SDK contracts intentionally expose only core actions.
1014
355
 
1015
- `pm-cli` ships optional first-party package roots that are not auto-installed:
356
+ If a package-owned command is invoked before installation, usage guidance includes the recovery install command when `pm` can map the command to a bundled package.
1016
357
 
1017
- | Alias | Commands after install | Purpose |
1018
- |-------|------------------------|---------|
1019
- | `beads` | `pm beads import` | import Beads JSONL records |
1020
- | `todos` | `pm todos import`, `pm todos export` | round-trip todos markdown format |
358
+ ## Troubleshooting
1021
359
 
1022
- Install:
360
+ - Manifest or entry failure: run `pm package explore --project`.
361
+ - Activation failure: run `pm package doctor --detail deep --trace`.
362
+ - Policy block: inspect `settings.extensions.policy` and `details.summary.policy`.
363
+ - Runtime drift: compare with `pm --no-extensions <command>`.
364
+ - Managed-state update-check gap: run `pm package manage --fix-managed-state`.
365
+ - Unknown package command: run `pm package catalog --project` and install the owning package.
1023
366
 
1024
- ```bash
1025
- pm install beads --project
1026
- pm install todos --project
1027
- ```
1028
-
1029
- ## Starter Extension
367
+ ## Runnable Examples
1030
368
 
1031
- See [examples/starter-extension](examples/starter-extension/README.md) for a compact extension that demonstrates all capability categories through the public SDK.
369
+ - `docs/examples/starter-extension/`
370
+ - `docs/examples/policy-restricted-extension/`
371
+ - `docs/examples/sdk-contract-consumer/`
372
+ - `docs/examples/sdk-app-embedding/`
373
+ - `docs/examples/ci/github-actions-pm-extension-gate.yml`
374
+ - `docs/examples/ci/gitlab-ci-pm-extension-gate.yml`
375
+ - `docs/examples/ci/jenkins-pm-extension-gate.Jenkinsfile`