@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,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]="69ff4814-0641-5d85-962e-a798cfd1a78e")}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";
@@ -7,7 +9,9 @@ import { promisify } from "node:util";
7
9
  import { activateExtensions, loadExtensions, nextExtensionReloadToken } from "../../core/extensions/index.js";
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";
12
+ import { isPathWithinDirectory } from "../../core/fs/path-utils.js";
10
13
  import { PM_PACKAGE_RESOURCE_KINDS, collectPackageExtensionDirectories, readPmPackageManifest, } from "../../core/packages/manifest.js";
14
+ import { resolvePmPackageRootFromModule } from "../../core/packages/root.js";
11
15
  import { EXIT_CODE } from "../../core/shared/constants.js";
12
16
  import { PmCliError } from "../../core/shared/errors.js";
13
17
  import { nowIso } from "../../core/shared/time.js";
@@ -35,8 +39,7 @@ function resolvePackageRootCandidates() {
35
39
  if (typeof envRoot === "string" && envRoot.trim().length > 0) {
36
40
  candidates.push(path.resolve(envRoot.trim()));
37
41
  }
38
- const moduleRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../..");
39
- candidates.push(moduleRoot);
42
+ candidates.push(resolvePmPackageRootFromModule(import.meta.url, ["../../.."]));
40
43
  return [...new Set(candidates)];
41
44
  }
42
45
  async function resolveBundledExtensionAliasSource(input) {
@@ -253,13 +256,6 @@ function parseExtensionManifest(raw) {
253
256
  capabilities,
254
257
  };
255
258
  }
256
- function isPathWithinDirectory(directory, targetPath) {
257
- const relative = path.relative(directory, targetPath);
258
- if (relative.length === 0) {
259
- return true;
260
- }
261
- return !relative.startsWith("..") && !path.isAbsolute(relative);
262
- }
263
259
  async function isCanonicalPathWithinDirectory(directory, targetPath) {
264
260
  const [resolvedDirectory, resolvedTargetPath] = await Promise.all([fs.realpath(directory), fs.realpath(targetPath)]);
265
261
  return isPathWithinDirectory(resolvedDirectory, resolvedTargetPath);
@@ -320,6 +316,21 @@ function sortManagedEntries(entries) {
320
316
  return left.directory.localeCompare(right.directory);
321
317
  });
322
318
  }
319
+ function managedExtensionSourcesEquivalent(left, right) {
320
+ if (left.kind !== right.kind || left.input !== right.input || left.location !== right.location) {
321
+ return false;
322
+ }
323
+ if (left.kind === "npm" && right.kind === "npm") {
324
+ return left.package === right.package && left.version === right.version;
325
+ }
326
+ if (left.kind === "github" && right.kind === "github") {
327
+ return left.repository === right.repository && left.ref === right.ref && left.subpath === right.subpath && left.commit === right.commit;
328
+ }
329
+ if (left.kind === "builtin" && right.kind === "builtin") {
330
+ return left.name === right.name;
331
+ }
332
+ return true;
333
+ }
323
334
  function normalizeManagedState(raw) {
324
335
  if (typeof raw !== "object" || raw === null) {
325
336
  return null;
@@ -350,7 +361,7 @@ function normalizeManagedState(raw) {
350
361
  continue;
351
362
  }
352
363
  const source = entry.source;
353
- if ((source.kind !== "local" && source.kind !== "github" && source.kind !== "npm") ||
364
+ if ((source.kind !== "local" && source.kind !== "github" && source.kind !== "npm" && source.kind !== "builtin") ||
354
365
  typeof source.input !== "string" ||
355
366
  typeof source.location !== "string") {
356
367
  continue;
@@ -368,6 +379,7 @@ function normalizeManagedState(raw) {
368
379
  kind: source.kind,
369
380
  input: source.input,
370
381
  location: source.location,
382
+ name: typeof source.name === "string" ? source.name : undefined,
371
383
  package: typeof source.package === "string" ? source.package : undefined,
372
384
  version: typeof source.version === "string" ? source.version : undefined,
373
385
  repository: typeof source.repository === "string" ? source.repository : undefined,
@@ -557,7 +569,19 @@ function resolveAction(target, options) {
557
569
  if (typeof target === "string" && (target.trim().toLowerCase() === "init" || target.trim().toLowerCase() === "scaffold")) {
558
570
  return "init";
559
571
  }
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);
572
+ if (typeof target === "string" && target.trim().toLowerCase() === "explore") {
573
+ return "explore";
574
+ }
575
+ if (typeof target === "string" && target.trim().toLowerCase() === "manage") {
576
+ return "manage";
577
+ }
578
+ if (typeof target === "string" && (target.trim().toLowerCase() === "list" || target.trim() === "")) {
579
+ return "explore";
580
+ }
581
+ if (target === undefined) {
582
+ return "explore";
583
+ }
584
+ 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
585
  }
562
586
  if (selected.length > 1) {
563
587
  throw new PmCliError("Extension action flags are mutually exclusive.", EXIT_CODE.USAGE);
@@ -572,13 +596,19 @@ function resolveScope(options) {
572
596
  }
573
597
  return global ? "global" : "project";
574
598
  }
575
- async function buildBundledPackageCatalog(scope, global) {
599
+ async function buildBundledPackageCatalog(scope, global, options = {}) {
576
600
  const roots = resolveExtensionRoots(resolvePmRoot(process.cwd(), global.path), process.cwd());
577
601
  const selectedRoot = scope === "global" ? roots.global : roots.project;
578
602
  const managedStateRead = await readManagedExtensionState(selectedRoot);
579
603
  const installedLocations = new Set(managedStateRead.state.entries
580
604
  .filter((entry) => entry.scope === scope)
605
+ .filter((entry) => entry.source.kind !== "builtin")
581
606
  .map((entry) => path.resolve(entry.source.location)));
607
+ const installedBuiltinAliases = new Set(managedStateRead.state.entries
608
+ .filter((entry) => entry.scope === scope && entry.source.kind === "builtin")
609
+ .flatMap((entry) => [entry.source.name, entry.source.input, entry.source.location])
610
+ .filter((value) => typeof value === "string" && value.trim().length > 0)
611
+ .map((value) => value.trim().toLowerCase()));
582
612
  const packages = [];
583
613
  for (const alias of await listBundledPackageAliases()) {
584
614
  const packageRoot = await resolveBundledPackageRoot(alias);
@@ -599,7 +629,9 @@ async function buildBundledPackageCatalog(scope, global) {
599
629
  const report = manifest.catalog?.links?.report ?? manifest.package_bugs_url;
600
630
  const docs = manifest.catalog?.links?.docs ?? manifest.package_homepage;
601
631
  const npm = manifest.catalog?.links?.npm ??
602
- (manifest.package_name ? `https://www.npmjs.com/package/${encodeURIComponent(manifest.package_name)}` : undefined);
632
+ (manifest.package_name && manifest.package_private !== true
633
+ ? `https://www.npmjs.com/package/${encodeURIComponent(manifest.package_name)}`
634
+ : undefined);
603
635
  const metadataOnlyResources = Object.fromEntries(PM_PACKAGE_RESOURCE_KINDS
604
636
  .filter((resourceKind) => resourceKind !== "extensions")
605
637
  .map((resourceKind) => [resourceKind, manifest.resources[resourceKind] ?? []])
@@ -608,10 +640,9 @@ async function buildBundledPackageCatalog(scope, global) {
608
640
  alias,
609
641
  bundled: true,
610
642
  available: true,
611
- installed: installedLocations.has(path.resolve(packageRoot)),
643
+ installed: installedBuiltinAliases.has(alias) || installedLocations.has(path.resolve(packageRoot)),
612
644
  install_target: alias,
613
645
  install_command: `pm install ${alias} ${installScopeFlag}`,
614
- package_root: packageRoot,
615
646
  package_name: manifest.package_name,
616
647
  package_version: manifest.package_version,
617
648
  description: manifest.catalog?.summary ?? manifest.package_description,
@@ -635,14 +666,68 @@ async function buildBundledPackageCatalog(scope, global) {
635
666
  },
636
667
  });
637
668
  }
669
+ const fields = parsePackageCatalogFields(options.fields);
670
+ const outputPackages = fields ? packages.map((entry) => projectPackageCatalogEntry(entry, fields)) : packages;
638
671
  return {
639
- total: packages.length,
672
+ total: outputPackages.length,
640
673
  scope,
641
674
  installable_resource_kinds: ["extensions"],
642
675
  metadata_only_resource_kinds: PM_PACKAGE_RESOURCE_KINDS.filter((resourceKind) => resourceKind !== "extensions"),
643
- packages,
676
+ packages: outputPackages,
644
677
  };
645
678
  }
679
+ const PACKAGE_CATALOG_FIELD_KEYS = new Set([
680
+ "alias",
681
+ "bundled",
682
+ "available",
683
+ "installed",
684
+ "install_target",
685
+ "install_command",
686
+ "package_name",
687
+ "package_version",
688
+ "description",
689
+ "keywords",
690
+ "resources",
691
+ "installable_resources",
692
+ "metadata_only_resources",
693
+ "catalog",
694
+ "category",
695
+ "display_name",
696
+ ]);
697
+ function parsePackageCatalogFields(raw) {
698
+ if (raw === undefined) {
699
+ return undefined;
700
+ }
701
+ const fields = [...new Set(raw.split(",").map((entry) => entry.trim()).filter((entry) => entry.length > 0))];
702
+ if (fields.length === 0) {
703
+ throw new PmCliError("Package catalog --fields requires a comma-separated list of field names", EXIT_CODE.USAGE);
704
+ }
705
+ const unknown = fields.filter((field) => !PACKAGE_CATALOG_FIELD_KEYS.has(field));
706
+ if (unknown.length > 0) {
707
+ throw new PmCliError(`Unknown package catalog --fields value(s): ${unknown.join(", ")}`, EXIT_CODE.USAGE, {
708
+ examples: [
709
+ "pm package list --project --fields alias,installed,install_command",
710
+ "pm package catalog --project --fields alias,package_name,category",
711
+ ],
712
+ });
713
+ }
714
+ return fields;
715
+ }
716
+ function projectPackageCatalogEntry(entry, fields) {
717
+ const projected = {};
718
+ for (const field of fields) {
719
+ if (field === "category") {
720
+ projected[field] = entry.catalog?.category ?? null;
721
+ }
722
+ else if (field === "display_name") {
723
+ projected[field] = entry.catalog?.display_name ?? null;
724
+ }
725
+ else {
726
+ projected[field] = entry[field] ?? null;
727
+ }
728
+ }
729
+ return projected;
730
+ }
646
731
  function parseGithubPathSpec(pathSpec, input, refOverride) {
647
732
  const segments = pathSpec
648
733
  .split("/")
@@ -843,6 +928,7 @@ async function resolveNpmSourceDirectory(source) {
843
928
  const packed = parsePackedNpmPackage(packStdout, packDirectory);
844
929
  await execFileAsync("tar", ["-xzf", packed.tarball, "-C", extractDirectory], { encoding: "utf8" });
845
930
  const packageRoot = path.join(extractDirectory, "package");
931
+ await installNpmPackageRuntimeDependencies(packageRoot);
846
932
  const directory = await resolvePackageExtensionDirectory(packageRoot, source.input);
847
933
  return {
848
934
  directory,
@@ -858,6 +944,50 @@ async function resolveNpmSourceDirectory(source) {
858
944
  throw error;
859
945
  }
860
946
  }
947
+ async function installNpmPackageRuntimeDependencies(packageRoot) {
948
+ const packageJsonPath = path.join(packageRoot, "package.json");
949
+ if (!(await pathExists(packageJsonPath))) {
950
+ return;
951
+ }
952
+ let parsed;
953
+ try {
954
+ parsed = JSON.parse(await fs.readFile(packageJsonPath, "utf8"));
955
+ }
956
+ catch {
957
+ return;
958
+ }
959
+ if (typeof parsed !== "object" || parsed === null) {
960
+ return;
961
+ }
962
+ const manifest = parsed;
963
+ const dependencySpecs = runtimeDependencyInstallSpecs(manifest);
964
+ if (dependencySpecs.length === 0) {
965
+ return;
966
+ }
967
+ const runtimeOnlyManifest = { ...parsed };
968
+ delete runtimeOnlyManifest.devDependencies;
969
+ await fs.writeFile(packageJsonPath, `${JSON.stringify(runtimeOnlyManifest, null, 2)}\n`, "utf8");
970
+ await Promise.all([
971
+ fs.rm(path.join(packageRoot, "package-lock.json"), { force: true }),
972
+ fs.rm(path.join(packageRoot, "npm-shrinkwrap.json"), { force: true }),
973
+ ]);
974
+ await runNpmCommand(["install", "--ignore-scripts", "--no-audit", "--fund=false", "--package-lock=false", "--no-save", ...dependencySpecs], packageRoot);
975
+ }
976
+ function runtimeDependencyInstallSpecs(manifest) {
977
+ const specs = new Map();
978
+ for (const dependencyMap of [manifest.dependencies, manifest.optionalDependencies, manifest.peerDependencies]) {
979
+ if (typeof dependencyMap !== "object" || dependencyMap === null) {
980
+ continue;
981
+ }
982
+ for (const [name, version] of Object.entries(dependencyMap)) {
983
+ if (typeof version !== "string" || version.trim().length === 0 || specs.has(name)) {
984
+ continue;
985
+ }
986
+ specs.set(name, `${name}@${version.trim()}`);
987
+ }
988
+ }
989
+ return [...specs.values()];
990
+ }
861
991
  async function resolvePackageExtensionDirectory(packageRoot, sourceLabel) {
862
992
  const discovered = await collectPackageExtensionDirectories(packageRoot);
863
993
  if (discovered.length === 1) {
@@ -896,11 +1026,14 @@ async function resolveGithubSourceDirectory(cloneDirectory, source) {
896
1026
  }
897
1027
  async function resolveInstallSource(source) {
898
1028
  if (source.kind === "local") {
899
- if (!(await pathExists(source.absolute_path))) {
1029
+ let localStats;
1030
+ try {
1031
+ localStats = await fs.stat(source.absolute_path);
1032
+ }
1033
+ catch {
900
1034
  throw new PmCliError(`Local extension source does not exist: "${source.absolute_path}".`, EXIT_CODE.NOT_FOUND);
901
1035
  }
902
- const stats = await fs.stat(source.absolute_path);
903
- if (!stats.isDirectory()) {
1036
+ if (!localStats.isDirectory()) {
904
1037
  throw new PmCliError(`Local extension source must be a directory: "${source.absolute_path}".`, EXIT_CODE.USAGE);
905
1038
  }
906
1039
  const directory = await resolvePackageExtensionDirectory(source.absolute_path, source.input);
@@ -1319,6 +1452,7 @@ function lifecycleFlagCommand(options, action) {
1319
1452
  return options.vocabulary === "package" ? `pm package ${action}` : `pm extension --${action}`;
1320
1453
  }
1321
1454
  function buildStarterExtensionScaffoldFiles(extensionName, commandName, vocabulary) {
1455
+ const packageName = `pm-${extensionName}`;
1322
1456
  const manifest = `${JSON.stringify({
1323
1457
  name: extensionName,
1324
1458
  version: "0.1.0",
@@ -1344,10 +1478,63 @@ function buildStarterExtensionScaffoldFiles(extensionName, commandName, vocabula
1344
1478
  "};",
1345
1479
  "",
1346
1480
  ].join("\n");
1481
+ if (vocabulary === "package") {
1482
+ const packageJson = `${JSON.stringify({
1483
+ name: packageName,
1484
+ version: "0.1.0",
1485
+ private: true,
1486
+ type: "module",
1487
+ keywords: ["pm-package"],
1488
+ peerDependencies: {
1489
+ "@unbrained/pm-cli": "*",
1490
+ },
1491
+ pm: {
1492
+ aliases: [extensionName],
1493
+ extensions: [`extensions/${extensionName}`],
1494
+ docs: ["README.md"],
1495
+ examples: ["README.md"],
1496
+ catalog: {
1497
+ display_name: extensionName,
1498
+ category: "workflow",
1499
+ summary: "Starter pm package scaffold.",
1500
+ tags: ["starter"],
1501
+ },
1502
+ },
1503
+ }, null, 2)}\n`;
1504
+ const packageReadme = [
1505
+ `# ${packageName}`,
1506
+ "",
1507
+ "Generated by `pm package init`.",
1508
+ "",
1509
+ "## Included Files",
1510
+ "- `package.json`: package metadata and `pm` resource manifest.",
1511
+ `- \`extensions/${extensionName}/manifest.json\`: extension metadata and capabilities.`,
1512
+ `- \`extensions/${extensionName}/index.js\`: starter command registration using the \`commands\` capability.`,
1513
+ "",
1514
+ "## Quick Start",
1515
+ "```bash",
1516
+ "pm install --project <package-path>",
1517
+ `pm ${commandName}`,
1518
+ "pm package doctor --project --detail summary",
1519
+ "```",
1520
+ "",
1521
+ "## Notes",
1522
+ "- Keep package metadata in `package.json` and runtime behavior under `extensions/`.",
1523
+ "- Add capabilities to the extension manifest only when the entrypoint uses the matching SDK API.",
1524
+ "- Use `@unbrained/pm-cli/sdk` as the public SDK import for richer package runtimes.",
1525
+ "",
1526
+ ].join("\n");
1527
+ return {
1528
+ "package.json": packageJson,
1529
+ [`extensions/${extensionName}/manifest.json`]: manifest,
1530
+ [`extensions/${extensionName}/index.js`]: entrypoint,
1531
+ "README.md": packageReadme,
1532
+ };
1533
+ }
1347
1534
  const readme = [
1348
1535
  `# ${extensionName}`,
1349
1536
  "",
1350
- `Generated by \`${vocabulary === "package" ? "pm package init" : "pm extension init"}\`.`,
1537
+ "Generated by `pm extension init`.",
1351
1538
  "",
1352
1539
  "## Included Files",
1353
1540
  "- `manifest.json`: extension metadata and capabilities.",
@@ -1355,9 +1542,9 @@ function buildStarterExtensionScaffoldFiles(extensionName, commandName, vocabula
1355
1542
  "",
1356
1543
  "## Quick Start",
1357
1544
  "```bash",
1358
- `${vocabulary === "package" ? "pm install" : "pm extension --install"} --project <scaffold-path>`,
1545
+ "pm extension --install --project <scaffold-path>",
1359
1546
  `pm ${commandName}`,
1360
- `${vocabulary === "package" ? "pm package doctor" : "pm extension --doctor"} --project --detail summary`,
1547
+ "pm extension --doctor --project --detail summary",
1361
1548
  "```",
1362
1549
  "",
1363
1550
  "## Notes",
@@ -1391,6 +1578,7 @@ async function scaffoldExtensionProject(target, vocabulary = "extension") {
1391
1578
  const files = [];
1392
1579
  for (const [relativePath, content] of Object.entries(scaffoldFiles)) {
1393
1580
  const absolutePath = path.join(targetPath, relativePath);
1581
+ await fs.mkdir(path.dirname(absolutePath), { recursive: true });
1394
1582
  if (await pathExists(absolutePath)) {
1395
1583
  const existingContent = await fs.readFile(absolutePath, "utf8");
1396
1584
  if (existingContent !== content) {
@@ -1689,12 +1877,19 @@ export async function runExtension(target, options, global) {
1689
1877
  ok: true,
1690
1878
  action,
1691
1879
  scope,
1692
- roots: {
1693
- project: resolvedRoots.roots.project,
1694
- global: resolvedRoots.roots.global,
1695
- selected: resolvedRoots.selected_root,
1696
- settings_root: resolvedRoots.settings_root,
1697
- },
1880
+ roots: action === "catalog" && typeof options.fields === "string" && options.fields.trim().length > 0
1881
+ ? {
1882
+ project: "project",
1883
+ global: "global",
1884
+ selected: scope,
1885
+ settings_root: "project",
1886
+ }
1887
+ : {
1888
+ project: resolvedRoots.roots.project,
1889
+ global: resolvedRoots.roots.global,
1890
+ selected: resolvedRoots.selected_root,
1891
+ settings_root: resolvedRoots.settings_root,
1892
+ },
1698
1893
  warnings: [...new Set(warnings)].sort((left, right) => left.localeCompare(right)),
1699
1894
  details,
1700
1895
  });
@@ -1774,7 +1969,7 @@ export async function runExtension(target, options, global) {
1774
1969
  if (typeof normalizedTarget === "string" && normalizedTarget.length > 0 && normalizedTarget !== "catalog") {
1775
1970
  throw new PmCliError('Action "catalog" does not accept a package target.', EXIT_CODE.USAGE);
1776
1971
  }
1777
- return withResult(await buildBundledPackageCatalog(scope, global));
1972
+ return withResult(await buildBundledPackageCatalog(scope, global, options));
1778
1973
  }
1779
1974
  if (action === "install") {
1780
1975
  const githubOption = resolveGithubOption(options);
@@ -1810,6 +2005,7 @@ export async function runExtension(target, options, global) {
1810
2005
  });
1811
2006
  }
1812
2007
  const bundledAliasSource = typeof githubOption === "string" ? null : await resolveBundledExtensionAliasSource(explicitSourceInput);
2008
+ const bundledAliasName = bundledAliasSource === null ? null : explicitSourceInput.trim().toLowerCase();
1813
2009
  const sourceInput = bundledAliasSource ?? explicitSourceInput;
1814
2010
  const installSource = parseExtensionInstallSource(sourceInput, {
1815
2011
  forceGithub: typeof githubOption === "string",
@@ -1832,33 +2028,43 @@ export async function runExtension(target, options, global) {
1832
2028
  }
1833
2029
  await fs.cp(validated.directory, destinationDirectory, { recursive: true, force: true });
1834
2030
  }
1835
- const sourceRecord = installSource.kind === "local"
2031
+ const sourceRecord = bundledAliasName
1836
2032
  ? {
1837
- kind: "local",
1838
- input: installSource.input,
1839
- location: installSource.absolute_path,
2033
+ kind: "builtin",
2034
+ input: bundledAliasName,
2035
+ location: bundledAliasName,
2036
+ name: bundledAliasName,
1840
2037
  }
1841
- : installSource.kind === "npm"
2038
+ : installSource.kind === "local"
1842
2039
  ? {
1843
- kind: "npm",
2040
+ kind: "local",
1844
2041
  input: installSource.input,
1845
- location: resolvedSource.resolved_subpath ?? ".",
1846
- package: resolvedSource.npm_package,
1847
- version: resolvedSource.npm_version,
2042
+ location: installSource.absolute_path,
1848
2043
  }
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
- };
2044
+ : installSource.kind === "npm"
2045
+ ? {
2046
+ kind: "npm",
2047
+ input: installSource.input,
2048
+ location: resolvedSource.resolved_subpath ?? ".",
2049
+ package: resolvedSource.npm_package,
2050
+ version: resolvedSource.npm_version,
2051
+ }
2052
+ : {
2053
+ kind: "github",
2054
+ input: installSource.input,
2055
+ location: resolvedSource.resolved_subpath ?? installSource.subpath ?? ".",
2056
+ repository: installSource.repository,
2057
+ owner: installSource.owner,
2058
+ repo: installSource.repo,
2059
+ ref: installSource.ref,
2060
+ subpath: resolvedSource.resolved_subpath ?? installSource.subpath,
2061
+ commit: resolvedSource.commit,
2062
+ };
1860
2063
  const now = nowIso();
1861
2064
  const existingManagedEntry = managedStateRead.state.entries.find((entry) => normalizeExtensionNameForMatch(entry.name) === normalizeExtensionNameForMatch(validated.manifest.name));
2065
+ const sourceUnchanged = existingManagedEntry !== undefined &&
2066
+ existingManagedEntry.manifest_version === validated.manifest.version &&
2067
+ managedExtensionSourcesEquivalent(existingManagedEntry.source, sourceRecord);
1862
2068
  const managedState = upsertManagedEntry(managedStateRead.state, {
1863
2069
  name: validated.manifest.name,
1864
2070
  directory: destinationDirectoryName,
@@ -1867,7 +2073,7 @@ export async function runExtension(target, options, global) {
1867
2073
  manifest_entry: validated.manifest.entry,
1868
2074
  capabilities: [...validated.manifest.capabilities],
1869
2075
  installed_at: existingManagedEntry?.installed_at ?? now,
1870
- updated_at: now,
2076
+ updated_at: sourceUnchanged ? existingManagedEntry.updated_at : now,
1871
2077
  source: sourceRecord,
1872
2078
  });
1873
2079
  await writeManagedExtensionState(resolvedRoots.selected_root, managedState);
@@ -2405,4 +2611,5 @@ export async function runExtension(target, options, global) {
2405
2611
  }
2406
2612
  throw new PmCliError(`Unsupported extension action "${action}".`, EXIT_CODE.USAGE);
2407
2613
  }
2408
- //# sourceMappingURL=extension.js.map
2614
+ //# sourceMappingURL=extension.js.map
2615
+ //# debugId=69ff4814-0641-5d85-962e-a798cfd1a78e