@unbrained/pm-cli 2026.5.14 → 2026.5.18

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 (361) hide show
  1. package/.claude-plugin/marketplace.json +4 -4
  2. package/AGENTS.md +78 -457
  3. package/CHANGELOG.md +11 -0
  4. package/CONTRIBUTING.md +1 -0
  5. package/README.md +6 -5
  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 +5 -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/append.js +4 -1
  17. package/dist/cli/commands/append.js.map +1 -1
  18. package/dist/cli/commands/calendar.js +4 -1
  19. package/dist/cli/commands/calendar.js.map +1 -1
  20. package/dist/cli/commands/claim.d.ts +3 -0
  21. package/dist/cli/commands/claim.js +19 -3
  22. package/dist/cli/commands/claim.js.map +1 -1
  23. package/dist/cli/commands/close.js +4 -1
  24. package/dist/cli/commands/close.js.map +1 -1
  25. package/dist/cli/commands/comments-audit.js +4 -1
  26. package/dist/cli/commands/comments-audit.js.map +1 -1
  27. package/dist/cli/commands/comments.js +4 -1
  28. package/dist/cli/commands/comments.js.map +1 -1
  29. package/dist/cli/commands/completion.js +98 -2
  30. package/dist/cli/commands/completion.js.map +1 -1
  31. package/dist/cli/commands/config.js +4 -1
  32. package/dist/cli/commands/config.js.map +1 -1
  33. package/dist/cli/commands/context.js +19 -5
  34. package/dist/cli/commands/context.js.map +1 -1
  35. package/dist/cli/commands/contracts.d.ts +9 -0
  36. package/dist/cli/commands/contracts.js +152 -34
  37. package/dist/cli/commands/contracts.js.map +1 -1
  38. package/dist/cli/commands/create.js +30 -6
  39. package/dist/cli/commands/create.js.map +1 -1
  40. package/dist/cli/commands/dedupe-audit.js +4 -1
  41. package/dist/cli/commands/dedupe-audit.js.map +1 -1
  42. package/dist/cli/commands/delete.js +4 -1
  43. package/dist/cli/commands/delete.js.map +1 -1
  44. package/dist/cli/commands/deps.js +4 -1
  45. package/dist/cli/commands/deps.js.map +1 -1
  46. package/dist/cli/commands/docs.js +4 -1
  47. package/dist/cli/commands/docs.js.map +1 -1
  48. package/dist/cli/commands/extension.d.ts +2 -1
  49. package/dist/cli/commands/extension.js +123 -33
  50. package/dist/cli/commands/extension.js.map +1 -1
  51. package/dist/cli/commands/files.js +4 -1
  52. package/dist/cli/commands/files.js.map +1 -1
  53. package/dist/cli/commands/gc.js +4 -1
  54. package/dist/cli/commands/gc.js.map +1 -1
  55. package/dist/cli/commands/get.d.ts +7 -3
  56. package/dist/cli/commands/get.js +91 -18
  57. package/dist/cli/commands/get.js.map +1 -1
  58. package/dist/cli/commands/guide.js +6 -8
  59. package/dist/cli/commands/guide.js.map +1 -1
  60. package/dist/cli/commands/health.d.ts +4 -0
  61. package/dist/cli/commands/health.js +31 -8
  62. package/dist/cli/commands/health.js.map +1 -1
  63. package/dist/cli/commands/history-redact.d.ts +42 -0
  64. package/dist/cli/commands/history-redact.js +559 -0
  65. package/dist/cli/commands/history-redact.js.map +1 -0
  66. package/dist/cli/commands/history.d.ts +4 -0
  67. package/dist/cli/commands/history.js +14 -3
  68. package/dist/cli/commands/history.js.map +1 -1
  69. package/dist/cli/commands/index.d.ts +2 -0
  70. package/dist/cli/commands/index.js +6 -1
  71. package/dist/cli/commands/index.js.map +1 -1
  72. package/dist/cli/commands/init-agent-guidance.d.ts +31 -0
  73. package/dist/cli/commands/init-agent-guidance.js +336 -0
  74. package/dist/cli/commands/init-agent-guidance.js.map +1 -0
  75. package/dist/cli/commands/init.d.ts +14 -0
  76. package/dist/cli/commands/init.js +75 -1
  77. package/dist/cli/commands/init.js.map +1 -1
  78. package/dist/cli/commands/learnings.js +4 -1
  79. package/dist/cli/commands/learnings.js.map +1 -1
  80. package/dist/cli/commands/list.d.ts +1 -0
  81. package/dist/cli/commands/list.js +42 -18
  82. package/dist/cli/commands/list.js.map +1 -1
  83. package/dist/cli/commands/metadata-normalizers.js +4 -1
  84. package/dist/cli/commands/metadata-normalizers.js.map +1 -1
  85. package/dist/cli/commands/normalize.js +4 -1
  86. package/dist/cli/commands/normalize.js.map +1 -1
  87. package/dist/cli/commands/notes.js +4 -1
  88. package/dist/cli/commands/notes.js.map +1 -1
  89. package/dist/cli/commands/plan.d.ts +118 -0
  90. package/dist/cli/commands/plan.js +975 -0
  91. package/dist/cli/commands/plan.js.map +1 -0
  92. package/dist/cli/commands/reindex.js +4 -1
  93. package/dist/cli/commands/reindex.js.map +1 -1
  94. package/dist/cli/commands/restore.js +4 -1
  95. package/dist/cli/commands/restore.js.map +1 -1
  96. package/dist/cli/commands/search.js +7 -2
  97. package/dist/cli/commands/search.js.map +1 -1
  98. package/dist/cli/commands/stats.js +4 -1
  99. package/dist/cli/commands/stats.js.map +1 -1
  100. package/dist/cli/commands/templates.js +4 -1
  101. package/dist/cli/commands/templates.js.map +1 -1
  102. package/dist/cli/commands/test-all.js +4 -1
  103. package/dist/cli/commands/test-all.js.map +1 -1
  104. package/dist/cli/commands/test-runs.js +4 -1
  105. package/dist/cli/commands/test-runs.js.map +1 -1
  106. package/dist/cli/commands/test.js +4 -1
  107. package/dist/cli/commands/test.js.map +1 -1
  108. package/dist/cli/commands/update-many.js +4 -1
  109. package/dist/cli/commands/update-many.js.map +1 -1
  110. package/dist/cli/commands/update.js +114 -71
  111. package/dist/cli/commands/update.js.map +1 -1
  112. package/dist/cli/commands/upgrade.js +6 -3
  113. package/dist/cli/commands/upgrade.js.map +1 -1
  114. package/dist/cli/commands/validate.js +32 -4
  115. package/dist/cli/commands/validate.js.map +1 -1
  116. package/dist/cli/error-guidance.js +5 -2
  117. package/dist/cli/error-guidance.js.map +1 -1
  118. package/dist/cli/extension-command-help.js +4 -1
  119. package/dist/cli/extension-command-help.js.map +1 -1
  120. package/dist/cli/extension-command-options.js +4 -1
  121. package/dist/cli/extension-command-options.js.map +1 -1
  122. package/dist/cli/guide-topics.js +4 -1
  123. package/dist/cli/guide-topics.js.map +1 -1
  124. package/dist/cli/help-content.js +35 -15
  125. package/dist/cli/help-content.js.map +1 -1
  126. package/dist/cli/help-json-payload.js +4 -1
  127. package/dist/cli/help-json-payload.js.map +1 -1
  128. package/dist/cli/main.js +203 -25
  129. package/dist/cli/main.js.map +1 -1
  130. package/dist/cli/migration-gates.js +4 -1
  131. package/dist/cli/migration-gates.js.map +1 -1
  132. package/dist/cli/register-list-query.js +37 -14
  133. package/dist/cli/register-list-query.js.map +1 -1
  134. package/dist/cli/register-mutation.js +228 -4
  135. package/dist/cli/register-mutation.js.map +1 -1
  136. package/dist/cli/register-operations.js +33 -1
  137. package/dist/cli/register-operations.js.map +1 -1
  138. package/dist/cli/register-setup.js +23 -13
  139. package/dist/cli/register-setup.js.map +1 -1
  140. package/dist/cli/registration-helpers.js +10 -2
  141. package/dist/cli/registration-helpers.js.map +1 -1
  142. package/dist/cli/shared-parsers.js +4 -1
  143. package/dist/cli/shared-parsers.js.map +1 -1
  144. package/dist/cli/telemetry-flush.js +4 -1
  145. package/dist/cli/telemetry-flush.js.map +1 -1
  146. package/dist/cli.js +45 -3
  147. package/dist/cli.js.map +1 -1
  148. package/dist/core/extensions/extension-types.js +4 -1
  149. package/dist/core/extensions/extension-types.js.map +1 -1
  150. package/dist/core/extensions/index.js +4 -1
  151. package/dist/core/extensions/index.js.map +1 -1
  152. package/dist/core/extensions/item-fields.js +4 -1
  153. package/dist/core/extensions/item-fields.js.map +1 -1
  154. package/dist/core/extensions/loader.js +77 -53
  155. package/dist/core/extensions/loader.js.map +1 -1
  156. package/dist/core/extensions/runtime-registrations.js +4 -1
  157. package/dist/core/extensions/runtime-registrations.js.map +1 -1
  158. package/dist/core/fs/fs-utils.js +4 -1
  159. package/dist/core/fs/fs-utils.js.map +1 -1
  160. package/dist/core/fs/index.js +4 -1
  161. package/dist/core/fs/index.js.map +1 -1
  162. package/dist/core/history/history-stream-policy.js +4 -1
  163. package/dist/core/history/history-stream-policy.js.map +1 -1
  164. package/dist/core/history/history.js +4 -1
  165. package/dist/core/history/history.js.map +1 -1
  166. package/dist/core/history/index.js +4 -1
  167. package/dist/core/history/index.js.map +1 -1
  168. package/dist/core/item/id.js +4 -1
  169. package/dist/core/item/id.js.map +1 -1
  170. package/dist/core/item/index.js +4 -1
  171. package/dist/core/item/index.js.map +1 -1
  172. package/dist/core/item/item-format.js +241 -2
  173. package/dist/core/item/item-format.js.map +1 -1
  174. package/dist/core/item/parent-reference-policy.js +4 -1
  175. package/dist/core/item/parent-reference-policy.js.map +1 -1
  176. package/dist/core/item/parse.js +33 -3
  177. package/dist/core/item/parse.js.map +1 -1
  178. package/dist/core/item/sprint-release-format.js +4 -1
  179. package/dist/core/item/sprint-release-format.js.map +1 -1
  180. package/dist/core/item/status.js +4 -1
  181. package/dist/core/item/status.js.map +1 -1
  182. package/dist/core/item/type-registry.js +4 -1
  183. package/dist/core/item/type-registry.js.map +1 -1
  184. package/dist/core/lock/index.js +4 -1
  185. package/dist/core/lock/index.js.map +1 -1
  186. package/dist/core/lock/lock.js +4 -1
  187. package/dist/core/lock/lock.js.map +1 -1
  188. package/dist/core/output/command-aware.js +4 -1
  189. package/dist/core/output/command-aware.js.map +1 -1
  190. package/dist/core/output/output.d.ts +4 -0
  191. package/dist/core/output/output.js +47 -6
  192. package/dist/core/output/output.js.map +1 -1
  193. package/dist/core/packages/manifest.d.ts +1 -0
  194. package/dist/core/packages/manifest.js +5 -1
  195. package/dist/core/packages/manifest.js.map +1 -1
  196. package/dist/core/packages/root.d.ts +3 -0
  197. package/dist/core/packages/root.js +51 -0
  198. package/dist/core/packages/root.js.map +1 -0
  199. package/dist/core/schema/runtime-field-filters.js +4 -1
  200. package/dist/core/schema/runtime-field-filters.js.map +1 -1
  201. package/dist/core/schema/runtime-field-values.js +4 -1
  202. package/dist/core/schema/runtime-field-values.js.map +1 -1
  203. package/dist/core/schema/runtime-schema.js +4 -1
  204. package/dist/core/schema/runtime-schema.js.map +1 -1
  205. package/dist/core/search/cache.js +7 -2
  206. package/dist/core/search/cache.js.map +1 -1
  207. package/dist/core/search/corpus.d.ts +2 -0
  208. package/dist/core/search/corpus.js +77 -2
  209. package/dist/core/search/corpus.js.map +1 -1
  210. package/dist/core/search/embedding-batches.js +21 -7
  211. package/dist/core/search/embedding-batches.js.map +1 -1
  212. package/dist/core/search/http-client.js +4 -1
  213. package/dist/core/search/http-client.js.map +1 -1
  214. package/dist/core/search/providers.js +4 -1
  215. package/dist/core/search/providers.js.map +1 -1
  216. package/dist/core/search/semantic-defaults.js +11 -2
  217. package/dist/core/search/semantic-defaults.js.map +1 -1
  218. package/dist/core/search/vector-stores.js +4 -1
  219. package/dist/core/search/vector-stores.js.map +1 -1
  220. package/dist/core/sentry/helpers.js +4 -1
  221. package/dist/core/sentry/helpers.js.map +1 -1
  222. package/dist/core/sentry/instrument.js +10 -13
  223. package/dist/core/sentry/instrument.js.map +1 -1
  224. package/dist/core/shared/command-types.js +4 -1
  225. package/dist/core/shared/command-types.js.map +1 -1
  226. package/dist/core/shared/conflict-markers.js +4 -1
  227. package/dist/core/shared/conflict-markers.js.map +1 -1
  228. package/dist/core/shared/constants.d.ts +2 -2
  229. package/dist/core/shared/constants.js +24 -1
  230. package/dist/core/shared/constants.js.map +1 -1
  231. package/dist/core/shared/errors.js +4 -1
  232. package/dist/core/shared/errors.js.map +1 -1
  233. package/dist/core/shared/index.js +4 -1
  234. package/dist/core/shared/index.js.map +1 -1
  235. package/dist/core/shared/levenshtein.js +4 -1
  236. package/dist/core/shared/levenshtein.js.map +1 -1
  237. package/dist/core/shared/primitives.js +4 -1
  238. package/dist/core/shared/primitives.js.map +1 -1
  239. package/dist/core/shared/serialization.js +4 -1
  240. package/dist/core/shared/serialization.js.map +1 -1
  241. package/dist/core/shared/text-normalization.js +4 -1
  242. package/dist/core/shared/text-normalization.js.map +1 -1
  243. package/dist/core/shared/time.js +4 -1
  244. package/dist/core/shared/time.js.map +1 -1
  245. package/dist/core/store/front-matter-cache.js +8 -3
  246. package/dist/core/store/front-matter-cache.js.map +1 -1
  247. package/dist/core/store/index.js +4 -1
  248. package/dist/core/store/index.js.map +1 -1
  249. package/dist/core/store/item-format-migration.js +4 -1
  250. package/dist/core/store/item-format-migration.js.map +1 -1
  251. package/dist/core/store/item-store.d.ts +2 -0
  252. package/dist/core/store/item-store.js +66 -3
  253. package/dist/core/store/item-store.js.map +1 -1
  254. package/dist/core/store/paths.js +4 -1
  255. package/dist/core/store/paths.js.map +1 -1
  256. package/dist/core/store/settings.js +39 -1
  257. package/dist/core/store/settings.js.map +1 -1
  258. package/dist/core/telemetry/consent.js +4 -1
  259. package/dist/core/telemetry/consent.js.map +1 -1
  260. package/dist/core/telemetry/observability.d.ts +1 -1
  261. package/dist/core/telemetry/observability.js +11 -2
  262. package/dist/core/telemetry/observability.js.map +1 -1
  263. package/dist/core/telemetry/runtime.js +31 -5
  264. package/dist/core/telemetry/runtime.js.map +1 -1
  265. package/dist/core/test/background-runs.js +4 -1
  266. package/dist/core/test/background-runs.js.map +1 -1
  267. package/dist/core/test/item-test-run-tracking.js +4 -1
  268. package/dist/core/test/item-test-run-tracking.js.map +1 -1
  269. package/dist/mcp/server.js +123 -14
  270. package/dist/mcp/server.js.map +1 -1
  271. package/dist/sdk/cli-contracts/commander-mutation-options.js +10 -3
  272. package/dist/sdk/cli-contracts/commander-mutation-options.js.map +1 -1
  273. package/dist/sdk/cli-contracts/commander-types.js +4 -1
  274. package/dist/sdk/cli-contracts/commander-types.js.map +1 -1
  275. package/dist/sdk/cli-contracts.d.ts +6 -2
  276. package/dist/sdk/cli-contracts.js +213 -20
  277. package/dist/sdk/cli-contracts.js.map +1 -1
  278. package/dist/sdk/index.js +4 -1
  279. package/dist/sdk/index.js.map +1 -1
  280. package/dist/sdk/runtime.js +4 -1
  281. package/dist/sdk/runtime.js.map +1 -1
  282. package/dist/types/index.js +4 -1
  283. package/dist/types/index.js.map +1 -1
  284. package/dist/types.d.ts +86 -2
  285. package/dist/types.js +34 -1
  286. package/dist/types.js.map +1 -1
  287. package/docs/AGENT_GUIDE.md +16 -6
  288. package/docs/CLAUDE_CODE_PLUGIN.md +10 -10
  289. package/docs/CODEX_PLUGIN.md +2 -2
  290. package/docs/COMMANDS.md +80 -8
  291. package/docs/CONFIGURATION.md +4 -1
  292. package/docs/EXTENSIONS.md +158 -814
  293. package/docs/QUICKSTART.md +11 -5
  294. package/docs/README.md +7 -6
  295. package/docs/RELEASING.md +2 -2
  296. package/docs/TESTING.md +2 -2
  297. package/marketplace.json +3 -3
  298. package/package.json +4 -2
  299. package/packages/pm-beads/package.json +1 -1
  300. package/packages/pm-calendar/README.md +1 -1
  301. package/packages/pm-calendar/extensions/calendar/index.js +1 -1
  302. package/packages/pm-calendar/extensions/calendar/index.ts +1 -1
  303. package/packages/pm-calendar/extensions/calendar/runtime.js +26 -7
  304. package/packages/pm-calendar/extensions/calendar/runtime.ts +26 -7
  305. package/packages/pm-calendar/package.json +1 -1
  306. package/packages/pm-governance-audit/package.json +1 -1
  307. package/packages/pm-guide-shell/extensions/guide-shell/index.js +1 -1
  308. package/packages/pm-guide-shell/extensions/guide-shell/index.ts +1 -1
  309. package/packages/pm-guide-shell/package.json +1 -1
  310. package/packages/pm-linked-test-adapters/package.json +1 -1
  311. package/packages/pm-search-advanced/extensions/search-advanced/index.ts +1 -1
  312. package/packages/pm-search-advanced/package.json +1 -1
  313. package/packages/pm-templates/README.md +1 -1
  314. package/packages/pm-templates/package.json +1 -1
  315. package/packages/pm-todos/package.json +1 -1
  316. package/plugins/{pm-cli-claude → pm-claude}/.claude-plugin/plugin.json +2 -2
  317. package/plugins/{pm-cli-claude → pm-claude}/.mcp.json +1 -1
  318. package/plugins/{pm-cli-claude → pm-claude}/README.md +4 -4
  319. package/plugins/{pm-cli-claude → pm-claude}/agents/pm-coordinator.md +1 -1
  320. package/plugins/{pm-cli-claude → pm-claude}/commands/pm-init.md +10 -1
  321. package/plugins/{pm-cli-claude → pm-claude}/commands/pm-planner.md +18 -0
  322. package/plugins/{pm-cli-claude → pm-claude}/skills/pm-planner/SKILL.md +46 -1
  323. package/plugins/{pm-cli-codex → pm-codex}/.codex-plugin/plugin.json +3 -3
  324. package/plugins/{pm-cli-codex → pm-codex}/.mcp.json +1 -1
  325. package/plugins/{pm-cli-codex → pm-codex}/README.md +7 -4
  326. package/plugins/pm-codex/skills/pm-native/SKILL.md +81 -0
  327. package/scripts/finalize-build.mjs +28 -0
  328. package/scripts/prepare-build-cache.mjs +37 -0
  329. package/plugins/pm-cli-codex/skills/pm-native/SKILL.md +0 -57
  330. /package/plugins/{pm-cli-claude → pm-claude}/agents/pm-delivery-chain.md +0 -0
  331. /package/plugins/{pm-cli-claude → pm-claude}/agents/pm-triage-agent.md +0 -0
  332. /package/plugins/{pm-cli-claude → pm-claude}/agents/pm-verification-agent.md +0 -0
  333. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-audit.md +0 -0
  334. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-calendar.md +0 -0
  335. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-close-task.md +0 -0
  336. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-developer.md +0 -0
  337. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-list.md +0 -0
  338. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-new.md +0 -0
  339. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-release.md +0 -0
  340. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-search.md +0 -0
  341. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-start-task.md +0 -0
  342. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-status.md +0 -0
  343. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-triage.md +0 -0
  344. /package/plugins/{pm-cli-claude → pm-claude}/commands/pm-workflow.md +0 -0
  345. /package/plugins/{pm-cli-claude → pm-claude}/hooks/hooks.json +0 -0
  346. /package/plugins/{pm-cli-claude → pm-claude}/hooks/session-start.mjs +0 -0
  347. /package/plugins/{pm-cli-claude → pm-claude}/scripts/pm-mcp-server.mjs +0 -0
  348. /package/plugins/{pm-cli-claude → pm-claude}/skills/pm-audit/SKILL.md +0 -0
  349. /package/plugins/{pm-cli-claude → pm-claude}/skills/pm-developer/SKILL.md +0 -0
  350. /package/plugins/{pm-cli-claude → pm-claude}/skills/pm-release/SKILL.md +0 -0
  351. /package/plugins/{pm-cli-claude → pm-claude}/skills/pm-workflow/SKILL.md +0 -0
  352. /package/plugins/{pm-cli-codex → pm-codex}/assets/pm-cli-small.svg +0 -0
  353. /package/plugins/{pm-cli-codex → pm-codex}/commands/pm-audit.md +0 -0
  354. /package/plugins/{pm-cli-codex → pm-codex}/commands/pm-close-task.md +0 -0
  355. /package/plugins/{pm-cli-codex → pm-codex}/commands/pm-start-task.md +0 -0
  356. /package/plugins/{pm-cli-codex → pm-codex}/scripts/pm-mcp-server.mjs +0 -0
  357. /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-auditor/SKILL.md +0 -0
  358. /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-auditor/agents/openai.yaml +0 -0
  359. /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-native/agents/openai.yaml +0 -0
  360. /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-release/SKILL.md +0 -0
  361. /package/plugins/{pm-cli-codex → pm-codex}/skills/pm-release/agents/openai.yaml +0 -0
@@ -1,3 +1,5 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="499323d3-24fc-5cd7-b97a-b27a0971ba12")}catch(e){}}();
1
3
  import { execFile } from "node:child_process";
2
4
  import fs from "node:fs/promises";
3
5
  import os from "node:os";
@@ -8,6 +10,7 @@ import { activateExtensions, loadExtensions, nextExtensionReloadToken } from "..
8
10
  import { EXTENSION_CAPABILITY_CONTRACT, KNOWN_EXTENSION_CAPABILITIES, parseLegacyExtensionCapabilityAliasWarning, parseUnknownExtensionCapabilityWarning, resolveExtensionRoots, } from "../../core/extensions/loader.js";
9
11
  import { pathExists } from "../../core/fs/fs-utils.js";
10
12
  import { PM_PACKAGE_RESOURCE_KINDS, collectPackageExtensionDirectories, readPmPackageManifest, } from "../../core/packages/manifest.js";
13
+ import { resolvePmPackageRootFromModule } from "../../core/packages/root.js";
11
14
  import { EXIT_CODE } from "../../core/shared/constants.js";
12
15
  import { PmCliError } from "../../core/shared/errors.js";
13
16
  import { nowIso } from "../../core/shared/time.js";
@@ -35,8 +38,7 @@ function resolvePackageRootCandidates() {
35
38
  if (typeof envRoot === "string" && envRoot.trim().length > 0) {
36
39
  candidates.push(path.resolve(envRoot.trim()));
37
40
  }
38
- const moduleRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../..");
39
- candidates.push(moduleRoot);
41
+ candidates.push(resolvePmPackageRootFromModule(import.meta.url, ["../../.."]));
40
42
  return [...new Set(candidates)];
41
43
  }
42
44
  async function resolveBundledExtensionAliasSource(input) {
@@ -350,7 +352,7 @@ function normalizeManagedState(raw) {
350
352
  continue;
351
353
  }
352
354
  const source = entry.source;
353
- if ((source.kind !== "local" && source.kind !== "github" && source.kind !== "npm") ||
355
+ if ((source.kind !== "local" && source.kind !== "github" && source.kind !== "npm" && source.kind !== "builtin") ||
354
356
  typeof source.input !== "string" ||
355
357
  typeof source.location !== "string") {
356
358
  continue;
@@ -368,6 +370,7 @@ function normalizeManagedState(raw) {
368
370
  kind: source.kind,
369
371
  input: source.input,
370
372
  location: source.location,
373
+ name: typeof source.name === "string" ? source.name : undefined,
371
374
  package: typeof source.package === "string" ? source.package : undefined,
372
375
  version: typeof source.version === "string" ? source.version : undefined,
373
376
  repository: typeof source.repository === "string" ? source.repository : undefined,
@@ -557,7 +560,19 @@ function resolveAction(target, options) {
557
560
  if (typeof target === "string" && (target.trim().toLowerCase() === "init" || target.trim().toLowerCase() === "scaffold")) {
558
561
  return "init";
559
562
  }
560
- throw new PmCliError("One action flag is required. Use one of: --install, --uninstall, --explore, --manage, --reload, --doctor, --catalog, --init/--scaffold, --adopt, --adopt-all, --activate, --deactivate.", EXIT_CODE.USAGE);
563
+ if (typeof target === "string" && target.trim().toLowerCase() === "explore") {
564
+ return "explore";
565
+ }
566
+ if (typeof target === "string" && target.trim().toLowerCase() === "manage") {
567
+ return "manage";
568
+ }
569
+ if (typeof target === "string" && (target.trim().toLowerCase() === "list" || target.trim() === "")) {
570
+ return "explore";
571
+ }
572
+ if (target === undefined) {
573
+ return "explore";
574
+ }
575
+ throw new PmCliError("One action flag is required. Use one of: --install, --uninstall, --explore, --manage, --reload, --doctor, --catalog, --init/--scaffold, --adopt, --adopt-all, --activate, --deactivate. Bare `pm package` and `pm extension` default to --explore.", EXIT_CODE.USAGE);
561
576
  }
562
577
  if (selected.length > 1) {
563
578
  throw new PmCliError("Extension action flags are mutually exclusive.", EXIT_CODE.USAGE);
@@ -578,7 +593,13 @@ async function buildBundledPackageCatalog(scope, global) {
578
593
  const managedStateRead = await readManagedExtensionState(selectedRoot);
579
594
  const installedLocations = new Set(managedStateRead.state.entries
580
595
  .filter((entry) => entry.scope === scope)
596
+ .filter((entry) => entry.source.kind !== "builtin")
581
597
  .map((entry) => path.resolve(entry.source.location)));
598
+ const installedBuiltinAliases = new Set(managedStateRead.state.entries
599
+ .filter((entry) => entry.scope === scope && entry.source.kind === "builtin")
600
+ .flatMap((entry) => [entry.source.name, entry.source.input, entry.source.location])
601
+ .filter((value) => typeof value === "string" && value.trim().length > 0)
602
+ .map((value) => value.trim().toLowerCase()));
582
603
  const packages = [];
583
604
  for (const alias of await listBundledPackageAliases()) {
584
605
  const packageRoot = await resolveBundledPackageRoot(alias);
@@ -599,7 +620,9 @@ async function buildBundledPackageCatalog(scope, global) {
599
620
  const report = manifest.catalog?.links?.report ?? manifest.package_bugs_url;
600
621
  const docs = manifest.catalog?.links?.docs ?? manifest.package_homepage;
601
622
  const npm = manifest.catalog?.links?.npm ??
602
- (manifest.package_name ? `https://www.npmjs.com/package/${encodeURIComponent(manifest.package_name)}` : undefined);
623
+ (manifest.package_name && manifest.package_private !== true
624
+ ? `https://www.npmjs.com/package/${encodeURIComponent(manifest.package_name)}`
625
+ : undefined);
603
626
  const metadataOnlyResources = Object.fromEntries(PM_PACKAGE_RESOURCE_KINDS
604
627
  .filter((resourceKind) => resourceKind !== "extensions")
605
628
  .map((resourceKind) => [resourceKind, manifest.resources[resourceKind] ?? []])
@@ -608,7 +631,7 @@ async function buildBundledPackageCatalog(scope, global) {
608
631
  alias,
609
632
  bundled: true,
610
633
  available: true,
611
- installed: installedLocations.has(path.resolve(packageRoot)),
634
+ installed: installedBuiltinAliases.has(alias) || installedLocations.has(path.resolve(packageRoot)),
612
635
  install_target: alias,
613
636
  install_command: `pm install ${alias} ${installScopeFlag}`,
614
637
  package_root: packageRoot,
@@ -896,11 +919,14 @@ async function resolveGithubSourceDirectory(cloneDirectory, source) {
896
919
  }
897
920
  async function resolveInstallSource(source) {
898
921
  if (source.kind === "local") {
899
- if (!(await pathExists(source.absolute_path))) {
922
+ let localStats;
923
+ try {
924
+ localStats = await fs.stat(source.absolute_path);
925
+ }
926
+ catch {
900
927
  throw new PmCliError(`Local extension source does not exist: "${source.absolute_path}".`, EXIT_CODE.NOT_FOUND);
901
928
  }
902
- const stats = await fs.stat(source.absolute_path);
903
- if (!stats.isDirectory()) {
929
+ if (!localStats.isDirectory()) {
904
930
  throw new PmCliError(`Local extension source must be a directory: "${source.absolute_path}".`, EXIT_CODE.USAGE);
905
931
  }
906
932
  const directory = await resolvePackageExtensionDirectory(source.absolute_path, source.input);
@@ -1319,6 +1345,7 @@ function lifecycleFlagCommand(options, action) {
1319
1345
  return options.vocabulary === "package" ? `pm package ${action}` : `pm extension --${action}`;
1320
1346
  }
1321
1347
  function buildStarterExtensionScaffoldFiles(extensionName, commandName, vocabulary) {
1348
+ const packageName = `pm-${extensionName}`;
1322
1349
  const manifest = `${JSON.stringify({
1323
1350
  name: extensionName,
1324
1351
  version: "0.1.0",
@@ -1344,10 +1371,63 @@ function buildStarterExtensionScaffoldFiles(extensionName, commandName, vocabula
1344
1371
  "};",
1345
1372
  "",
1346
1373
  ].join("\n");
1374
+ if (vocabulary === "package") {
1375
+ const packageJson = `${JSON.stringify({
1376
+ name: packageName,
1377
+ version: "0.1.0",
1378
+ private: true,
1379
+ type: "module",
1380
+ keywords: ["pm-package"],
1381
+ peerDependencies: {
1382
+ "@unbrained/pm-cli": "*",
1383
+ },
1384
+ pm: {
1385
+ aliases: [extensionName],
1386
+ extensions: [`extensions/${extensionName}`],
1387
+ docs: ["README.md"],
1388
+ examples: ["README.md"],
1389
+ catalog: {
1390
+ display_name: extensionName,
1391
+ category: "workflow",
1392
+ summary: "Starter pm package scaffold.",
1393
+ tags: ["starter"],
1394
+ },
1395
+ },
1396
+ }, null, 2)}\n`;
1397
+ const packageReadme = [
1398
+ `# ${packageName}`,
1399
+ "",
1400
+ "Generated by `pm package init`.",
1401
+ "",
1402
+ "## Included Files",
1403
+ "- `package.json`: package metadata and `pm` resource manifest.",
1404
+ `- \`extensions/${extensionName}/manifest.json\`: extension metadata and capabilities.`,
1405
+ `- \`extensions/${extensionName}/index.js\`: starter command registration using the \`commands\` capability.`,
1406
+ "",
1407
+ "## Quick Start",
1408
+ "```bash",
1409
+ "pm install --project <package-path>",
1410
+ `pm ${commandName}`,
1411
+ "pm package doctor --project --detail summary",
1412
+ "```",
1413
+ "",
1414
+ "## Notes",
1415
+ "- Keep package metadata in `package.json` and runtime behavior under `extensions/`.",
1416
+ "- Add capabilities to the extension manifest only when the entrypoint uses the matching SDK API.",
1417
+ "- Use `@unbrained/pm-cli/sdk` as the public SDK import for richer package runtimes.",
1418
+ "",
1419
+ ].join("\n");
1420
+ return {
1421
+ "package.json": packageJson,
1422
+ [`extensions/${extensionName}/manifest.json`]: manifest,
1423
+ [`extensions/${extensionName}/index.js`]: entrypoint,
1424
+ "README.md": packageReadme,
1425
+ };
1426
+ }
1347
1427
  const readme = [
1348
1428
  `# ${extensionName}`,
1349
1429
  "",
1350
- `Generated by \`${vocabulary === "package" ? "pm package init" : "pm extension init"}\`.`,
1430
+ "Generated by `pm extension init`.",
1351
1431
  "",
1352
1432
  "## Included Files",
1353
1433
  "- `manifest.json`: extension metadata and capabilities.",
@@ -1355,9 +1435,9 @@ function buildStarterExtensionScaffoldFiles(extensionName, commandName, vocabula
1355
1435
  "",
1356
1436
  "## Quick Start",
1357
1437
  "```bash",
1358
- `${vocabulary === "package" ? "pm install" : "pm extension --install"} --project <scaffold-path>`,
1438
+ "pm extension --install --project <scaffold-path>",
1359
1439
  `pm ${commandName}`,
1360
- `${vocabulary === "package" ? "pm package doctor" : "pm extension --doctor"} --project --detail summary`,
1440
+ "pm extension --doctor --project --detail summary",
1361
1441
  "```",
1362
1442
  "",
1363
1443
  "## Notes",
@@ -1391,6 +1471,7 @@ async function scaffoldExtensionProject(target, vocabulary = "extension") {
1391
1471
  const files = [];
1392
1472
  for (const [relativePath, content] of Object.entries(scaffoldFiles)) {
1393
1473
  const absolutePath = path.join(targetPath, relativePath);
1474
+ await fs.mkdir(path.dirname(absolutePath), { recursive: true });
1394
1475
  if (await pathExists(absolutePath)) {
1395
1476
  const existingContent = await fs.readFile(absolutePath, "utf8");
1396
1477
  if (existingContent !== content) {
@@ -1810,6 +1891,7 @@ export async function runExtension(target, options, global) {
1810
1891
  });
1811
1892
  }
1812
1893
  const bundledAliasSource = typeof githubOption === "string" ? null : await resolveBundledExtensionAliasSource(explicitSourceInput);
1894
+ const bundledAliasName = bundledAliasSource === null ? null : explicitSourceInput.trim().toLowerCase();
1813
1895
  const sourceInput = bundledAliasSource ?? explicitSourceInput;
1814
1896
  const installSource = parseExtensionInstallSource(sourceInput, {
1815
1897
  forceGithub: typeof githubOption === "string",
@@ -1832,31 +1914,38 @@ export async function runExtension(target, options, global) {
1832
1914
  }
1833
1915
  await fs.cp(validated.directory, destinationDirectory, { recursive: true, force: true });
1834
1916
  }
1835
- const sourceRecord = installSource.kind === "local"
1917
+ const sourceRecord = bundledAliasName
1836
1918
  ? {
1837
- kind: "local",
1838
- input: installSource.input,
1839
- location: installSource.absolute_path,
1919
+ kind: "builtin",
1920
+ input: bundledAliasName,
1921
+ location: bundledAliasName,
1922
+ name: bundledAliasName,
1840
1923
  }
1841
- : installSource.kind === "npm"
1924
+ : installSource.kind === "local"
1842
1925
  ? {
1843
- kind: "npm",
1926
+ kind: "local",
1844
1927
  input: installSource.input,
1845
- location: resolvedSource.resolved_subpath ?? ".",
1846
- package: resolvedSource.npm_package,
1847
- version: resolvedSource.npm_version,
1928
+ location: installSource.absolute_path,
1848
1929
  }
1849
- : {
1850
- kind: "github",
1851
- input: installSource.input,
1852
- location: resolvedSource.resolved_subpath ?? installSource.subpath ?? ".",
1853
- repository: installSource.repository,
1854
- owner: installSource.owner,
1855
- repo: installSource.repo,
1856
- ref: installSource.ref,
1857
- subpath: resolvedSource.resolved_subpath ?? installSource.subpath,
1858
- commit: resolvedSource.commit,
1859
- };
1930
+ : installSource.kind === "npm"
1931
+ ? {
1932
+ kind: "npm",
1933
+ input: installSource.input,
1934
+ location: resolvedSource.resolved_subpath ?? ".",
1935
+ package: resolvedSource.npm_package,
1936
+ version: resolvedSource.npm_version,
1937
+ }
1938
+ : {
1939
+ kind: "github",
1940
+ input: installSource.input,
1941
+ location: resolvedSource.resolved_subpath ?? installSource.subpath ?? ".",
1942
+ repository: installSource.repository,
1943
+ owner: installSource.owner,
1944
+ repo: installSource.repo,
1945
+ ref: installSource.ref,
1946
+ subpath: resolvedSource.resolved_subpath ?? installSource.subpath,
1947
+ commit: resolvedSource.commit,
1948
+ };
1860
1949
  const now = nowIso();
1861
1950
  const existingManagedEntry = managedStateRead.state.entries.find((entry) => normalizeExtensionNameForMatch(entry.name) === normalizeExtensionNameForMatch(validated.manifest.name));
1862
1951
  const managedState = upsertManagedEntry(managedStateRead.state, {
@@ -2405,4 +2494,5 @@ export async function runExtension(target, options, global) {
2405
2494
  }
2406
2495
  throw new PmCliError(`Unsupported extension action "${action}".`, EXIT_CODE.USAGE);
2407
2496
  }
2408
- //# sourceMappingURL=extension.js.map
2497
+ //# sourceMappingURL=extension.js.map
2498
+ //# debugId=499323d3-24fc-5cd7-b97a-b27a0971ba12