@unbrained/pm-cli 2026.8.5 → 2026.8.7

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 (251) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +44 -0
  3. package/dist/cli/main.js +14 -37
  4. package/dist/cli/register-operations.js +11 -2
  5. package/dist/cli/register-setup.d.ts +1 -1
  6. package/dist/cli/register-setup.js +46 -20
  7. package/dist/cli/stats-analytics-json.d.ts +9 -0
  8. package/dist/cli/stats-analytics-json.js +69 -0
  9. package/dist/cli-bundle/bundle-manifest.json +403 -403
  10. package/dist/cli-bundle/chunks/append-7BXBFDGD.js +2 -0
  11. package/dist/cli-bundle/chunks/{chunk-PMXJEU3F.js → chunk-2AXF3VSK.js} +2 -2
  12. package/dist/cli-bundle/chunks/{chunk-MHK6LIWE.js → chunk-2XS43CCV.js} +2 -2
  13. package/dist/cli-bundle/chunks/chunk-3A6KWB72.js +8 -0
  14. package/dist/cli-bundle/chunks/chunk-3ISTDB42.js +8 -0
  15. package/dist/cli-bundle/chunks/{chunk-45G53IU4.js → chunk-4MTI7XOV.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-7C4PTJG6.js → chunk-6BX5UDCN.js} +2 -2
  17. package/dist/cli-bundle/chunks/{chunk-4YUBDMQM.js → chunk-6QPO7KLR.js} +2 -2
  18. package/dist/cli-bundle/chunks/{chunk-HWRRMBJO.js → chunk-7MXHZHSQ.js} +2 -2
  19. package/dist/cli-bundle/chunks/{chunk-3FTILRJ2.js → chunk-7ZPMJW4U.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-2WFXWAYX.js → chunk-AGYNSNCI.js} +2 -2
  21. package/dist/cli-bundle/chunks/chunk-B4H7FEFH.js +5 -0
  22. package/dist/cli-bundle/chunks/{chunk-43HQQI6S.js → chunk-B4KLBBMN.js} +2 -2
  23. package/dist/cli-bundle/chunks/{chunk-VCKLFEUN.js → chunk-CALJHNBL.js} +12 -12
  24. package/dist/cli-bundle/chunks/{chunk-CSI3WS5I.js → chunk-CFIGP5LY.js} +2 -2
  25. package/dist/cli-bundle/chunks/{chunk-V3EUXXOF.js → chunk-CS6MRHG7.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-YSO3YFZ4.js → chunk-CUGNQQKH.js} +2 -2
  27. package/dist/cli-bundle/chunks/chunk-D4FPS43D.js +164 -0
  28. package/dist/cli-bundle/chunks/{chunk-BXQLRKWF.js → chunk-H5Y5YE6A.js} +2 -2
  29. package/dist/cli-bundle/chunks/{chunk-54FNT7U2.js → chunk-H5Y6UV6E.js} +2 -2
  30. package/dist/cli-bundle/chunks/{chunk-UP7DTVMD.js → chunk-H7KGWPDF.js} +2 -2
  31. package/dist/cli-bundle/chunks/{chunk-E2RKBKWB.js → chunk-HFSD77TQ.js} +2 -2
  32. package/dist/cli-bundle/chunks/{chunk-V3774P7D.js → chunk-HX2GTA6L.js} +2 -2
  33. package/dist/cli-bundle/chunks/{chunk-UZBWIUYD.js → chunk-J2IEKAVR.js} +2 -2
  34. package/dist/cli-bundle/chunks/{chunk-HNFD72UK.js → chunk-K44PYFXH.js} +2 -2
  35. package/dist/cli-bundle/chunks/{chunk-5ZBOIPGP.js → chunk-K4KGEEBT.js} +2 -2
  36. package/dist/cli-bundle/chunks/chunk-KFLK5TRH.js +21 -0
  37. package/dist/cli-bundle/chunks/{chunk-OMXVBQ2N.js → chunk-KL6IEBV2.js} +2 -2
  38. package/dist/cli-bundle/chunks/{chunk-7A5OT5J2.js → chunk-KWQZDZSS.js} +2 -2
  39. package/dist/cli-bundle/chunks/{chunk-M72BKL5Q.js → chunk-KZ4X3DGU.js} +2 -2
  40. package/dist/cli-bundle/chunks/chunk-LD77HJMQ.js +13 -0
  41. package/dist/cli-bundle/chunks/{chunk-VN5VITU3.js → chunk-ME2JJ4LA.js} +2 -2
  42. package/dist/cli-bundle/chunks/chunk-NFLJ3FHD.js +2 -0
  43. package/dist/cli-bundle/chunks/{chunk-A62CYISG.js → chunk-NG6OXIBR.js} +8 -8
  44. package/dist/cli-bundle/chunks/{chunk-42E7YPLG.js → chunk-NYIGHWQY.js} +2 -2
  45. package/dist/cli-bundle/chunks/{chunk-RKAVWO3O.js → chunk-NZ75GNSA.js} +2 -2
  46. package/dist/cli-bundle/chunks/{chunk-DXDREUXT.js → chunk-PCJWJNC2.js} +2 -2
  47. package/dist/cli-bundle/chunks/{chunk-ZYHOB3SN.js → chunk-PD3225AM.js} +2 -2
  48. package/dist/cli-bundle/chunks/{chunk-OTHLDSFP.js → chunk-PDEGKG7P.js} +2 -2
  49. package/dist/cli-bundle/chunks/chunk-PIE5HBNA.js +2 -0
  50. package/dist/cli-bundle/chunks/chunk-PW2H7YJR.js +56 -0
  51. package/dist/cli-bundle/chunks/{chunk-L3AZOELJ.js → chunk-TPKN3S7S.js} +2 -2
  52. package/dist/cli-bundle/chunks/{chunk-LKDGK44W.js → chunk-TPXAXTCO.js} +2 -2
  53. package/dist/cli-bundle/chunks/chunk-UFWUJO4V.js +2 -0
  54. package/dist/cli-bundle/chunks/{chunk-R546TPDE.js → chunk-UQLZQVFW.js} +2 -2
  55. package/dist/cli-bundle/chunks/{chunk-BPELKUQD.js → chunk-VT3Z5G7D.js} +2 -2
  56. package/dist/cli-bundle/chunks/chunk-WOD3WWUN.js +2 -0
  57. package/dist/cli-bundle/chunks/{chunk-4VN6GS4U.js → chunk-WSJEIGJF.js} +2 -2
  58. package/dist/cli-bundle/chunks/{chunk-UN66FZRO.js → chunk-WYNUU7ZW.js} +49 -46
  59. package/dist/cli-bundle/chunks/{chunk-NY4T3JWN.js → chunk-YGPNCCXZ.js} +2 -2
  60. package/dist/cli-bundle/chunks/close-CMY3BAUG.js +2 -0
  61. package/dist/cli-bundle/chunks/close-many-SA4XZCTK.js +2 -0
  62. package/dist/cli-bundle/chunks/comments-EZ556ZD3.js +2 -0
  63. package/dist/cli-bundle/chunks/copy-ZSGPA52X.js +2 -0
  64. package/dist/cli-bundle/chunks/{create-XLKTXTUF.js → create-I5DVV4YG.js} +2 -2
  65. package/dist/cli-bundle/chunks/delete-RL3JACSW.js +2 -0
  66. package/dist/cli-bundle/chunks/{deps-ITTY3GIC.js → deps-S7UBCECS.js} +2 -2
  67. package/dist/cli-bundle/chunks/{docs-W4OSRTYR.js → docs-ZZNVBBYO.js} +2 -2
  68. package/dist/cli-bundle/chunks/{files-EOK4AZI4.js → files-27C337VT.js} +2 -2
  69. package/dist/cli-bundle/chunks/focus-5Z2SG7LU.js +2 -0
  70. package/dist/cli-bundle/chunks/{history-compact-7UGTMLL3.js → history-compact-HJQK67CZ.js} +2 -2
  71. package/dist/cli-bundle/chunks/{history-redact-4DZRMD6Z.js → history-redact-PWC6PDWA.js} +2 -2
  72. package/dist/cli-bundle/chunks/{history-repair-UPOSZW5R.js → history-repair-N3CY4WBF.js} +2 -2
  73. package/dist/cli-bundle/chunks/{learnings-GMRNCBS3.js → learnings-4FH23XDT.js} +2 -2
  74. package/dist/cli-bundle/chunks/{profile-2MUUMHRE.js → profile-5Y5XXH5N.js} +2 -2
  75. package/dist/cli-bundle/chunks/{register-list-query-LR3SQ5ZF.js → register-list-query-FJZCJ67O.js} +2 -2
  76. package/dist/cli-bundle/chunks/{register-mutation-SUOHFVWM.js → register-mutation-YGYPW3BL.js} +3 -3
  77. package/dist/cli-bundle/chunks/register-operations-WMDSUMQF.js +2 -0
  78. package/dist/cli-bundle/chunks/register-setup-DL7FFABC.js +2 -0
  79. package/dist/cli-bundle/chunks/restore-6KYBV5BY.js +2 -0
  80. package/dist/cli-bundle/chunks/{schema-FJ4EA3XF.js → schema-EQGKBYXJ.js} +2 -2
  81. package/dist/cli-bundle/chunks/update-QVTYOD6I.js +2 -0
  82. package/dist/cli-bundle/chunks/update-many-DJSBU525.js +2 -0
  83. package/dist/cli-bundle/focused-chunks/{chunk-MJ7HWSFK.js → chunk-2ECLECMK.js} +3 -3
  84. package/dist/cli-bundle/focused-chunks/{chunk-A7BJ5SS6.js → chunk-3K4XV2BF.js} +2 -2
  85. package/dist/cli-bundle/focused-chunks/{chunk-PIMMYG7Q.js → chunk-4EX25PXM.js} +2 -2
  86. package/dist/cli-bundle/focused-chunks/chunk-4VJQTS3P.js +2 -0
  87. package/dist/cli-bundle/focused-chunks/chunk-73JUDYXT.js +2 -0
  88. package/dist/cli-bundle/focused-chunks/{chunk-WVIVUWVL.js → chunk-CIXVQPB7.js} +2 -2
  89. package/dist/cli-bundle/focused-chunks/chunk-DLTS3IHM.js +2 -0
  90. package/dist/cli-bundle/focused-chunks/{chunk-FGKY4MBE.js → chunk-DQ6FKGL3.js} +10 -10
  91. package/dist/cli-bundle/focused-chunks/{chunk-QVHKCI4T.js → chunk-HNL6IFGS.js} +2 -2
  92. package/dist/cli-bundle/focused-chunks/chunk-JLG2C4EQ.js +2 -0
  93. package/dist/cli-bundle/focused-chunks/{chunk-G6ETT4QK.js → chunk-MHMTKV5V.js} +2 -2
  94. package/dist/cli-bundle/focused-chunks/{chunk-7J5TUBUJ.js → chunk-MOTJFQ3F.js} +22 -22
  95. package/dist/cli-bundle/focused-chunks/{chunk-UIL2M2NA.js → chunk-NBJKQP4S.js} +2 -2
  96. package/dist/cli-bundle/focused-chunks/{chunk-RUR5I3TK.js → chunk-QHRTT7WT.js} +2 -2
  97. package/dist/cli-bundle/focused-chunks/{chunk-B7LJWAZE.js → chunk-R2LEMEV5.js} +2 -2
  98. package/dist/cli-bundle/focused-chunks/{chunk-SV3O7TSH.js → chunk-RPNYG5MO.js} +2 -2
  99. package/dist/cli-bundle/focused-chunks/chunk-RW5IYD4J.js +4 -0
  100. package/dist/cli-bundle/focused-chunks/chunk-TIKDBG4D.js +29 -0
  101. package/dist/cli-bundle/focused-chunks/{chunk-IPWSFADF.js → chunk-VZFU2R4M.js} +2 -2
  102. package/dist/cli-bundle/focused-chunks/{chunk-WEM2E2PE.js → chunk-YZEZAPJK.js} +2 -2
  103. package/dist/cli-bundle/focused-chunks/chunk-ZJIMJHDB.js +2 -0
  104. package/dist/cli-bundle/main.js +13 -13
  105. package/dist/cli-bundle/sdk-authoring.js +1 -1
  106. package/dist/cli-bundle/sdk-contracts.js +1 -1
  107. package/dist/cli-bundle/sdk-core.js +29 -28
  108. package/dist/cli-bundle/sdk-governance.js +1 -1
  109. package/dist/cli-bundle/sdk-graph.js +1 -1
  110. package/dist/cli-bundle/sdk-merge.js +1 -1
  111. package/dist/cli-bundle/sdk-query.js +1 -1
  112. package/dist/cli-bundle/sdk-runtime.js +1 -1
  113. package/dist/cli-bundle/sdk-testing.js +1 -1
  114. package/dist/cli-bundle/sdk.js +1 -1
  115. package/dist/core/extensions/activation-summary.d.ts +4 -0
  116. package/dist/core/extensions/activation-summary.js +5 -2
  117. package/dist/core/extensions/contribution-inventory.d.ts +1 -0
  118. package/dist/core/extensions/contribution-inventory.js +35 -2
  119. package/dist/core/extensions/extension-hook-runtime.js +5 -3
  120. package/dist/core/extensions/extension-types.d.ts +18 -1
  121. package/dist/core/extensions/extension-types.js +2 -2
  122. package/dist/core/extensions/loader.js +5 -13
  123. package/dist/core/extensions/preflight-ownership.d.ts +5 -0
  124. package/dist/core/extensions/preflight-ownership.js +42 -0
  125. package/dist/core/extensions/reserved-host-flags.js +3 -2
  126. package/dist/core/history/workspace-history.d.ts +22 -2
  127. package/dist/core/history/workspace-history.js +60 -36
  128. package/dist/core/output/output.d.ts +2 -0
  129. package/dist/core/output/output.js +3 -2
  130. package/dist/core/shared/command-types.d.ts +2 -0
  131. package/dist/core/shared/command-types.js +2 -2
  132. package/dist/mcp/tool-definitions.js +6 -2
  133. package/dist/sdk/author-attribution.js +23 -7
  134. package/dist/sdk/cli-bootstrap.d.ts +2 -0
  135. package/dist/sdk/cli-bootstrap.js +7 -2
  136. package/dist/sdk/cli-contracts/completeness.js +51 -4
  137. package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
  138. package/dist/sdk/cli-contracts/flag-contracts.js +9 -2
  139. package/dist/sdk/cli-contracts/registration-helpers.js +3 -2
  140. package/dist/sdk/cli-contracts/runtime-contracts.js +16 -9
  141. package/dist/sdk/cli-contracts/tool-parameter-tables.js +116 -10
  142. package/dist/sdk/cli-contracts/tool-schema.js +18 -2
  143. package/dist/sdk/cli-contracts.d.ts +1 -1
  144. package/dist/sdk/cli-contracts.js +3 -3
  145. package/dist/sdk/cli-program.js +3 -2
  146. package/dist/sdk/completion.js +5 -2
  147. package/dist/sdk/compose.d.ts +2 -2
  148. package/dist/sdk/compose.js +7 -2
  149. package/dist/sdk/contracts.d.ts +1 -0
  150. package/dist/sdk/contracts.js +2 -2
  151. package/dist/sdk/core.d.ts +3 -1
  152. package/dist/sdk/core.js +4 -3
  153. package/dist/sdk/define.d.ts +3 -1
  154. package/dist/sdk/define.js +3 -8
  155. package/dist/sdk/extension/install-sources.d.ts +43 -5
  156. package/dist/sdk/extension/install-sources.js +36 -2
  157. package/dist/sdk/extension/migrations.d.ts +114 -0
  158. package/dist/sdk/extension/migrations.js +175 -0
  159. package/dist/sdk/extension/scaffold.js +14 -9
  160. package/dist/sdk/extension/source-resolution.d.ts +50 -0
  161. package/dist/sdk/extension/source-resolution.js +66 -0
  162. package/dist/sdk/extension.d.ts +5 -1
  163. package/dist/sdk/extension.js +31 -35
  164. package/dist/sdk/generated-error-code-catalog.js +112 -2
  165. package/dist/sdk/governance/health.js +11 -2
  166. package/dist/sdk/history-analytics.d.ts +141 -0
  167. package/dist/sdk/history-analytics.js +283 -0
  168. package/dist/sdk/improvement-ledger-validation.d.ts +3 -0
  169. package/dist/sdk/improvement-ledger-validation.js +63 -0
  170. package/dist/sdk/improvement-ledger.d.ts +139 -0
  171. package/dist/sdk/improvement-ledger.js +261 -0
  172. package/dist/sdk/index.d.ts +11 -3
  173. package/dist/sdk/index.js +12 -4
  174. package/dist/sdk/lifecycle/plan.js +6 -3
  175. package/dist/sdk/merge/install.js +10 -2
  176. package/dist/sdk/package-migrations.d.ts +10 -0
  177. package/dist/sdk/package-migrations.js +21 -0
  178. package/dist/sdk/read-output-budget.js +24 -22
  179. package/dist/sdk/read-output-contracts.d.ts +10 -2
  180. package/dist/sdk/read-output-contracts.js +124 -65
  181. package/dist/sdk/read-output-rows.d.ts +29 -0
  182. package/dist/sdk/read-output-rows.js +100 -0
  183. package/dist/sdk/read-output-session.d.ts +69 -0
  184. package/dist/sdk/read-output-session.js +200 -0
  185. package/dist/sdk/runtime-input.d.ts +2 -0
  186. package/dist/sdk/runtime-input.js +14 -2
  187. package/dist/sdk/runtime-primitives.d.ts +1 -1
  188. package/dist/sdk/runtime-primitives.js +3 -3
  189. package/dist/sdk/runtime-stats-options.d.ts +9 -0
  190. package/dist/sdk/runtime-stats-options.js +38 -0
  191. package/dist/sdk/runtime.d.ts +3 -0
  192. package/dist/sdk/runtime.js +10 -27
  193. package/dist/sdk/stats.d.ts +40 -0
  194. package/dist/sdk/stats.js +112 -29
  195. package/docs/COMMANDS.md +9 -0
  196. package/docs/EXTENSIONS.md +2 -2
  197. package/docs/EXTENSION_LIFECYCLE.md +46 -0
  198. package/docs/IMPROVEMENT_ANALYTICS.md +103 -0
  199. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +5 -5
  200. package/docs/README.md +2 -0
  201. package/docs/READ_OUTPUT_CONTRACTS.md +60 -1
  202. package/docs/RELEASING.md +33 -20
  203. package/docs/SDK.md +31 -3
  204. package/marketplace.json +2 -2
  205. package/package.json +5 -5
  206. package/packages/pm-beads/package.json +1 -1
  207. package/packages/pm-calendar/package.json +1 -1
  208. package/packages/pm-command-kit/package.json +1 -1
  209. package/packages/pm-digital-twin/package.json +1 -1
  210. package/packages/pm-governance-audit/package.json +1 -1
  211. package/packages/pm-guide-shell/package.json +1 -1
  212. package/packages/pm-kanban/package.json +1 -1
  213. package/packages/pm-lifecycle-hooks/package.json +1 -1
  214. package/packages/pm-linked-test-adapters/package.json +1 -1
  215. package/packages/pm-search-advanced/package.json +1 -1
  216. package/packages/pm-templates/package.json +1 -1
  217. package/packages/pm-todos/package.json +1 -1
  218. package/packages/pm-vcs/package.json +1 -1
  219. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  220. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  221. package/sdk/public-surface.json +566 -815
  222. package/dist/cli-bundle/chunks/append-VXXGOXSG.js +0 -2
  223. package/dist/cli-bundle/chunks/chunk-6MSQJOTG.js +0 -13
  224. package/dist/cli-bundle/chunks/chunk-EGJ4JTUG.js +0 -55
  225. package/dist/cli-bundle/chunks/chunk-FPBQHMFT.js +0 -8
  226. package/dist/cli-bundle/chunks/chunk-GE4KCSZP.js +0 -164
  227. package/dist/cli-bundle/chunks/chunk-LN2WFEU4.js +0 -2
  228. package/dist/cli-bundle/chunks/chunk-OPVH7SKD.js +0 -8
  229. package/dist/cli-bundle/chunks/chunk-Q35VBGOQ.js +0 -5
  230. package/dist/cli-bundle/chunks/chunk-SSF4PIUR.js +0 -2
  231. package/dist/cli-bundle/chunks/chunk-WRL4KNDL.js +0 -20
  232. package/dist/cli-bundle/chunks/chunk-XCEZYMNI.js +0 -2
  233. package/dist/cli-bundle/chunks/chunk-YEWNL576.js +0 -2
  234. package/dist/cli-bundle/chunks/close-VZ3OQPN5.js +0 -2
  235. package/dist/cli-bundle/chunks/close-many-SB4TI27P.js +0 -2
  236. package/dist/cli-bundle/chunks/comments-BIF3Q4KY.js +0 -2
  237. package/dist/cli-bundle/chunks/copy-6AI5Z57X.js +0 -2
  238. package/dist/cli-bundle/chunks/delete-ZY2VHQTP.js +0 -2
  239. package/dist/cli-bundle/chunks/focus-DLBNWL7L.js +0 -2
  240. package/dist/cli-bundle/chunks/register-operations-ARRRKOVN.js +0 -2
  241. package/dist/cli-bundle/chunks/register-setup-O6AYP6NP.js +0 -2
  242. package/dist/cli-bundle/chunks/restore-ZVCVHTB5.js +0 -2
  243. package/dist/cli-bundle/chunks/update-YHV52CSS.js +0 -2
  244. package/dist/cli-bundle/chunks/update-many-M6YHVNXM.js +0 -2
  245. package/dist/cli-bundle/focused-chunks/chunk-BIMTMOS7.js +0 -4
  246. package/dist/cli-bundle/focused-chunks/chunk-GJ2TG2CW.js +0 -28
  247. package/dist/cli-bundle/focused-chunks/chunk-N5XU5UVK.js +0 -2
  248. package/dist/cli-bundle/focused-chunks/chunk-PG2RIZBX.js +0 -2
  249. package/dist/cli-bundle/focused-chunks/chunk-VLYOEYML.js +0 -2
  250. package/dist/cli-bundle/focused-chunks/chunk-W7BJEWHX.js +0 -2
  251. package/dist/cli-bundle/focused-chunks/chunk-Y4LDYLLT.js +0 -2
@@ -4,7 +4,7 @@
4
4
  * Implements extension package-management support for Scaffold.
5
5
  */
6
6
 
7
- !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]="50f2e5c4-c7fe-5e29-ae2a-60b1b1957756")}catch(e){}}();
7
+ !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]="30dfc6e4-27c5-56c0-981b-94e85b780f1f")}catch(e){}}();
8
8
  import fs from "node:fs/promises";
9
9
  import path from "node:path";
10
10
  import { pathExists } from "../../core/fs/fs-utils.js";
@@ -276,8 +276,9 @@ const PACKAGE_CAPABILITY_README_SECTIONS = {
276
276
  "",
277
277
  "## Preflight Override",
278
278
  "`index.ts` registers a preflight override through `api.registerPreflight`. pm",
279
- "calls it before every command to compute the migration/format gate decision —",
280
- "the last registered override wins. Return only the decision keys you want to",
279
+ "calls it only for its declared command ownership to compute the migration/format",
280
+ "gate decision. Overlapping or legacy global ownership is diagnosed. Return only",
281
+ "the decision keys you want to",
281
282
  "change; this starter echoes the current decision unchanged (a safe no-op) so",
282
283
  "installing the package does not alter gate behavior. The `preflight`",
283
284
  "capability in `manifest.json` grants the registration.",
@@ -765,15 +766,19 @@ function buildActivateBodyLines(extensionName, commandName, capability) {
765
766
  ...commandLines,
766
767
  "",
767
768
  " // Preflight overrides adjust pm's pre-run gate decision (extension",
768
- " // migrations + item-format checks) before EVERY command the last",
769
- " // registered override wins. Return a delta of the keys you want to change",
769
+ " // migrations + item-format checks) for the commands it owns. Disjoint",
770
+ " // packages compose; overlapping or legacy global ownership is diagnosed.",
771
+ " // Return a delta of the keys you want to change",
770
772
  " // (enforce_item_format_gate, run_preflight_item_format_sync,",
771
773
  " // run_extension_migrations, enforce_mandatory_migration_gate); returning",
772
774
  " // context.decision unchanged is a safe no-op so installing the package does",
773
775
  " // not alter gate behavior — replace it with your policy, e.g.",
774
776
  " // `{ run_extension_migrations: false }`. The `preflight` capability in",
775
777
  " // manifest.json grants the registration.",
776
- " api.registerPreflight((context) => context.decision);",
778
+ " api.registerPreflight({",
779
+ ` commands: [${JSON.stringify(commandName)}],`,
780
+ " run: (context) => context.decision,",
781
+ " });",
777
782
  ];
778
783
  }
779
784
  if (capability === "services") {
@@ -1339,7 +1344,7 @@ function buildDeclarativeBlueprintSurface(extensionName, commandName, capability
1339
1344
  break;
1340
1345
  case "preflight":
1341
1346
  builderImports.push("definePreflightOverride");
1342
- definitions.push("", "// Preflight overrides adjust pm's pre-run gate decision (extension migrations +", "// item-format checks) before EVERY command - the last registered override wins.", "// Return a delta of the keys you want to change (enforce_item_format_gate,", "// run_preflight_item_format_sync, run_extension_migrations,", "// enforce_mandatory_migration_gate); returning context.decision unchanged is a", "// safe no-op - replace it with your policy, e.g. { run_extension_migrations: false }.", "export const preflightOverride = definePreflightOverride((context) => context.decision);");
1347
+ definitions.push("", "// Preflight overrides adjust pm's pre-run gate decision (extension migrations +", "// item-format checks) for the commands it owns. Scoped ownership composes with", "// other packages; overlapping or legacy global ownership is diagnosed.", "// Return a delta of the keys you want to change (enforce_item_format_gate,", "// run_preflight_item_format_sync, run_extension_migrations,", "// enforce_mandatory_migration_gate); returning context.decision unchanged is a", "// safe no-op - replace it with your policy, e.g. { run_extension_migrations: false }.", "export const preflightOverride = definePreflightOverride({", ` commands: [${JSON.stringify(commandName)}],`, " run: (context) => context.decision,", "});");
1343
1348
  blueprintFields.push(" preflights: [preflightOverride],");
1344
1349
  break;
1345
1350
  case "services":
@@ -1963,7 +1968,7 @@ function buildDefineBuilderExports(extensionName, commandName, capability, names
1963
1968
  lines.push("", "export const pingParser = defineParserOverride((context) => {", " const options = { ...context.options };", " if (options.shout === true) options.upper = true;", " delete options.shout;", " return { options };", "});");
1964
1969
  }
1965
1970
  if (capability === "preflight") {
1966
- lines.push("", "// Return a delta of the gate-decision keys you want to change; returning", "// context.decision unchanged is a safe no-op (e.g. { run_extension_migrations: false }).", "export const preflightOverride = definePreflightOverride((context) => context.decision);");
1971
+ lines.push("", "// Return a delta of the gate-decision keys you want to change; returning", "// context.decision unchanged is a safe no-op (e.g. { run_extension_migrations: false }).", "export const preflightOverride = definePreflightOverride({", ` commands: [${JSON.stringify(commandName)}],`, " run: (context) => context.decision,", "});");
1967
1972
  }
1968
1973
  if (capability === "services") {
1969
1974
  lines.push("", "export const outputService = defineServiceOverride((context) => {", ` if (context.command !== ${JSON.stringify(commandName)}) return { handled: false };`, ` return { rendered_by: ${JSON.stringify(extensionName)}, payload: context.payload };`, "});");
@@ -2295,4 +2300,4 @@ export async function scaffoldExtensionProject(target, vocabulary = "extension",
2295
2300
  };
2296
2301
  }
2297
2302
  //# sourceMappingURL=scaffold.js.map
2298
- //# debugId=50f2e5c4-c7fe-5e29-ae2a-60b1b1957756
2303
+ //# debugId=30dfc6e4-27c5-56c0-981b-94e85b780f1f
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @module sdk/extension/source-resolution
3
+ *
4
+ * Resolves install-source identity without executing package code.
5
+ */
6
+ import { type InstallSource } from "./install-sources.js";
7
+ /** Selected install-source identity. */
8
+ export interface ExtensionInstallSourceSelection {
9
+ /** Selected source family. */
10
+ kind: "builtin" | "local" | "github" | "npm";
11
+ /** Canonical source input used for resolution. */
12
+ input: string;
13
+ /** Canonical package name when known. */
14
+ package?: string;
15
+ }
16
+ /** One source candidate and the explicit command that selects it. */
17
+ export interface ExtensionInstallSourceCandidate extends ExtensionInstallSourceSelection {
18
+ /** Installed candidate version when known. */
19
+ version?: string;
20
+ /** Installed candidate directory when relevant. */
21
+ directory?: string;
22
+ /** Unambiguous CLI command that selects this candidate. */
23
+ command: string;
24
+ }
25
+ /** Machine-readable explanation of how one install target resolved. */
26
+ export interface ExtensionInstallSourceResolution {
27
+ /** Exact target supplied by the caller. */
28
+ requested: string;
29
+ /** Source selected by the deterministic resolver. */
30
+ selected: ExtensionInstallSourceSelection;
31
+ /** Whether another locally available source could satisfy the same bare name. */
32
+ ambiguous: boolean;
33
+ /** Stable precedence rule used for the selection. */
34
+ precedence: "bundled_alias_before_installed_npm";
35
+ /** Every matching candidate and its explicit install command. */
36
+ candidates: ExtensionInstallSourceCandidate[];
37
+ }
38
+ /** Complete result of resolving one extension install target. */
39
+ export interface ResolvedExtensionInstallSource {
40
+ /** Normalized bundled alias, or null for non-bundled sources. */
41
+ bundledAliasName: string | null;
42
+ /** Bundled package name, or null when unavailable. */
43
+ bundledPackageName: string | null;
44
+ /** Parsed source passed to the install resolver. */
45
+ installSource: InstallSource;
46
+ /** Observable source-selection decision. */
47
+ sourceResolution: ExtensionInstallSourceResolution;
48
+ }
49
+ /** Resolve bundled-alias provenance and competing installed npm identity. */
50
+ export declare function resolveExtensionInstallSourceIdentity(explicitSourceInput: string, githubOption: string | undefined, ref: string | undefined): Promise<ResolvedExtensionInstallSource>;
@@ -0,0 +1,66 @@
1
+ /**
2
+ * @module sdk/extension/source-resolution
3
+ *
4
+ * Resolves install-source identity without executing package code.
5
+ */
6
+
7
+ !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]="39bc7f14-2d32-5b58-97ab-647f9f238273")}catch(e){}}();
8
+ import { findInstalledNpmPackageCandidate, parseExtensionInstallSource, } from "./install-sources.js";
9
+ import { resolveBundledExtensionAliasSource, resolveBundledPackageNpmName, } from "./bundled-catalog.js";
10
+ /** Resolve bundled-alias provenance and competing installed npm identity. */
11
+ export async function resolveExtensionInstallSourceIdentity(explicitSourceInput, githubOption, ref) {
12
+ const bundledAliasSource = typeof githubOption === "string"
13
+ ? null
14
+ : await resolveBundledExtensionAliasSource(explicitSourceInput);
15
+ const bundledAliasName = bundledAliasSource === null
16
+ ? null
17
+ : explicitSourceInput.trim().toLowerCase();
18
+ const bundledPackageName = bundledAliasName === null
19
+ ? null
20
+ : await resolveBundledPackageNpmName(bundledAliasName);
21
+ const installSource = parseExtensionInstallSource(bundledAliasSource ?? explicitSourceInput, { forceGithub: typeof githubOption === "string", ref });
22
+ const installedNpmCandidate = bundledAliasName === null
23
+ ? null
24
+ : await findInstalledNpmPackageCandidate(explicitSourceInput);
25
+ return {
26
+ bundledAliasName,
27
+ bundledPackageName,
28
+ installSource,
29
+ sourceResolution: {
30
+ requested: explicitSourceInput,
31
+ selected: {
32
+ kind: bundledAliasName === null ? installSource.kind : "builtin",
33
+ input: bundledAliasName ?? installSource.input,
34
+ ...(bundledPackageName === null ? {} : { package: bundledPackageName }),
35
+ },
36
+ ambiguous: installedNpmCandidate !== null,
37
+ precedence: "bundled_alias_before_installed_npm",
38
+ candidates: [
39
+ ...(bundledAliasName === null
40
+ ? []
41
+ : [{
42
+ kind: "builtin",
43
+ input: bundledAliasName,
44
+ ...(bundledPackageName === null
45
+ ? {}
46
+ : { package: bundledPackageName }),
47
+ command: `pm install ${bundledAliasName}`,
48
+ }]),
49
+ ...(installedNpmCandidate === null
50
+ ? []
51
+ : [{
52
+ kind: "npm",
53
+ input: `npm:${installedNpmCandidate.package}`,
54
+ package: installedNpmCandidate.package,
55
+ ...(installedNpmCandidate.version === undefined
56
+ ? {}
57
+ : { version: installedNpmCandidate.version }),
58
+ directory: installedNpmCandidate.directory,
59
+ command: `pm install npm:${installedNpmCandidate.package}`,
60
+ }]),
61
+ ],
62
+ },
63
+ };
64
+ }
65
+ //# sourceMappingURL=source-resolution.js.map
66
+ //# debugId=39bc7f14-2d32-5b58-97ab-647f9f238273
@@ -16,7 +16,7 @@ export { parseExtensionManifest, validateExtensionDirectory, readManagedExtensio
16
16
  export type { ManagedExtensionSource, ManagedExtensionRecord, ManagedExtensionState, };
17
17
  export type { ManagedExtensionStateReadResult } from "./extension/managed-state.js";
18
18
  /** Restricts extension command action values accepted by command, SDK, and storage contracts. */
19
- export type ExtensionCommandAction = "install" | "uninstall" | "explore" | "manage" | "describe" | "reload" | "doctor" | "catalog" | "adopt" | "adopt-all" | "activate" | "deactivate" | "init";
19
+ export type ExtensionCommandAction = "install" | "uninstall" | "explore" | "manage" | "describe" | "reload" | "doctor" | "catalog" | "adopt" | "adopt-all" | "activate" | "deactivate" | "migrate" | "init";
20
20
  /** Restricts extension scope values accepted by command, SDK, and storage contracts. */
21
21
  export type ExtensionScope = "project" | "global";
22
22
  /** Restricts extension activation status values accepted by command, SDK, and storage contracts. */
@@ -59,6 +59,8 @@ export interface ExtensionCommandOptions {
59
59
  activate?: boolean;
60
60
  /** Value that configures or reports deactivate for this contract. */
61
61
  deactivate?: boolean;
62
+ /** Plan or apply active extension migrations. */
63
+ migrate?: boolean;
62
64
  /** Value that configures or reports project for this contract. */
63
65
  project?: boolean;
64
66
  /** Value that configures or reports local for this contract. */
@@ -93,6 +95,8 @@ export interface ExtensionCommandOptions {
93
95
  declarative?: boolean;
94
96
  /** Value that configures or reports vocabulary for this contract. */
95
97
  vocabulary?: "extension" | "package";
98
+ /** Plan migration work without invoking extension code. */
99
+ dryRun?: boolean;
96
100
  }
97
101
  /** Documents the managed extension summary payload exchanged by command, SDK, and package integrations. */
98
102
  export interface ManagedExtensionSummary {
@@ -4,9 +4,8 @@
4
4
  * Implements the pm extension command surface and its agent-facing runtime behavior.
5
5
  */
6
6
 
7
- !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]="4fb93ad8-845c-5b71-93eb-c95481f101b7")}catch(e){}}();
7
+ !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]="f4b47053-cc05-51f2-b5cb-cc6dba3365c2")}catch(e){}}();
8
8
  import fs from "node:fs/promises";
9
- import os from "node:os";
10
9
  import path from "node:path";
11
10
  import { activateExtensions, createSerialQueue, loadExtensions, nextExtensionReloadToken, } from "../core/extensions/index.js";
12
11
  import { describeExtensionActivation } from "../core/extensions/activation-summary.js";
@@ -30,7 +29,7 @@ import { ensureTypeFolderScaffold } from "./schema.js";
30
29
  import { normalizeStringList, normalizeExtensionNameForMatch, normalizeManagedDirectoryName, parseExtensionManifest, validateExtensionDirectory, } from "./extension/shared.js";
31
30
  import { sortManagedEntries, managedExtensionSourcesEquivalent, readManagedExtensionState, writeManagedExtensionState, upsertManagedEntry, persistManagedContributionInventory, resolveManagedExtensionStatePath, } from "./extension/managed-state.js";
32
31
  import { parseExtensionInstallSource, resolveInstallSource, areDirectoriesEquivalent, } from "./extension/install-sources.js";
33
- import { resolveBundledExtensionAliasSource, resolveBundledPackageNpmName, isBundledPackageInstallAllTarget, listBundledPackageAliases, resolveBundledAliasManifestName, buildBundledPackageCatalog, } from "./extension/bundled-catalog.js";
32
+ import { resolveBundledExtensionAliasSource, isBundledPackageInstallAllTarget, listBundledPackageAliases, resolveBundledAliasManifestName, buildBundledPackageCatalog, } from "./extension/bundled-catalog.js";
34
33
  import { scaffoldExtensionProject } from "./extension/scaffold.js";
35
34
  import { buildExtensionDescribeResult } from "./extension/describe.js";
36
35
  import { applyDoctorRuntimeActivationState, classifyDoctorLoadFailureWarnings, classifyDoctorActivationFailureWarnings, classifyUnusedCapabilityWarnings, buildExtensionTriageSummary, parseDoctorDetailMode, collectUnknownCapabilityGuidance, buildCapabilityContractMetadata, buildDoctorConsistencySummary, summarizeExtensionFailures, } from "./extension/doctor.js";
@@ -40,6 +39,8 @@ import { summarizeRuntimeCommandPathsForExtension } from "./extension/runtime-su
40
39
  import { collectGlobalOutputOverrideDoctorWarnings } from "./extension/output-ownership.js";
41
40
  import { collectMcpCustomFieldCollisionDoctorWarnings } from "./extension/custom-field-collisions.js";
42
41
  import { checkGithubUpdate } from "./extension/update-check.js";
42
+ import { runExtensionMigrateAction } from "./extension/migrations.js";
43
+ import { resolveExtensionInstallSourceIdentity, } from "./extension/source-resolution.js";
43
44
  import { captureExtensionInstallSnapshot, readOptionalMetadataFile, restoreExtensionInstallSnapshot, } from "./extension/install-snapshot.js";
44
45
  // Re-export the public surface that lives in sibling modules but was previously
45
46
  // exported from this file (used by sdk barrels, upgrade.ts, and tests).
@@ -61,6 +62,7 @@ const LIFECYCLE_ACTION_TARGETS = [
61
62
  ["adopt-all", "adopt-all", "--adopt-all"],
62
63
  ["activate", "activate", "--activate"],
63
64
  ["deactivate", "deactivate", "--deactivate"],
65
+ ["migrate", "migrate", "--migrate"],
64
66
  ];
65
67
  const LIFECYCLE_ACTION_FLAG_HINT = LIFECYCLE_ACTION_TARGETS.map(([, , flag]) => flag)
66
68
  .filter((flag, index, flags) => flags.indexOf(flag) === index)
@@ -78,6 +80,7 @@ const LIFECYCLE_ACTION_FLAGS = {
78
80
  "adopt-all": "--adopt-all",
79
81
  activate: "--activate",
80
82
  deactivate: "--deactivate",
83
+ migrate: "--migrate",
81
84
  init: "--init",
82
85
  };
83
86
  const NATIVE_OUTPUT_MARKER = "__pm_native_output";
@@ -353,6 +356,7 @@ const EXTENSION_ACTION_FLAG_SELECTORS = [
353
356
  ["adoptAll", "adopt-all"],
354
357
  ["activate", "activate"],
355
358
  ["deactivate", "deactivate"],
359
+ ["migrate", "migrate"],
356
360
  ];
357
361
  /** Positional lifecycle shorthand mapped to the canonical extension action. */
358
362
  const IMPLICIT_EXTENSION_ACTIONS = {
@@ -363,6 +367,7 @@ const IMPLICIT_EXTENSION_ACTIONS = {
363
367
  scaffold: "init",
364
368
  explore: "explore",
365
369
  manage: "manage",
370
+ migrate: "migrate",
366
371
  list: "explore",
367
372
  "": "explore",
368
373
  };
@@ -637,10 +642,10 @@ const resolveInstallRuntimeActivationStatus = (extensionName, scope, runtimeInst
637
642
  (installActivationFailure ? "failed" : "unknown"));
638
643
  };
639
644
  /** Probe a temporary installed extension for runtime command registrations. */
640
- const probeRuntimeCommandPathsForInstall = (pmRoot, settings, refreshedInstalled, global) => {
645
+ const probeRuntimeCommandPathsForInstall = (pmRoot, parent, settings, refreshedInstalled, global) => {
641
646
  return extensionRuntimeProbeQueue.enqueue(async () => {
642
647
  const originalPackageRoot = process.env.PM_CLI_PACKAGE_ROOT;
643
- const moduleGraphSnapshotRoot = await fs.mkdtemp(path.join(os.tmpdir(), "pm-extension-module-graph-"));
648
+ const snapshotRoot = await fs.mkdtemp(path.join(parent, ".pm-module-graph-"));
644
649
  process.env.PM_CLI_PACKAGE_ROOT = resolvePmPackageRootFromModule(import.meta.url, ["../.."]);
645
650
  try {
646
651
  const loadResult = await loadExtensions({
@@ -650,11 +655,10 @@ const probeRuntimeCommandPathsForInstall = (pmRoot, settings, refreshedInstalled
650
655
  noExtensions: global.noExtensions === true,
651
656
  reload_token: nextExtensionReloadToken(),
652
657
  cache_bust: true,
653
- module_graph_snapshot_root: moduleGraphSnapshotRoot,
658
+ module_graph_snapshot_root: snapshotRoot,
654
659
  });
655
660
  const activationResult = await activateExtensions({
656
661
  ...loadResult,
657
- loaded: loadResult.loaded,
658
662
  });
659
663
  const runtimeFailures = [
660
664
  ...loadResult.failed.map((failure) => ({
@@ -681,7 +685,7 @@ const probeRuntimeCommandPathsForInstall = (pmRoot, settings, refreshedInstalled
681
685
  };
682
686
  }
683
687
  finally {
684
- await fs.rm(moduleGraphSnapshotRoot, { recursive: true, force: true });
688
+ await fs.rm(snapshotRoot, { recursive: true, force: true });
685
689
  if (originalPackageRoot === undefined) {
686
690
  delete process.env.PM_CLI_PACKAGE_ROOT;
687
691
  }
@@ -889,6 +893,11 @@ const assertExtensionActionOptionScope = (action, options) => {
889
893
  allowed: action === "init",
890
894
  message: "--declarative is only valid with --init/--scaffold.",
891
895
  },
896
+ {
897
+ triggered: options.dryRun === true,
898
+ allowed: action === "migrate",
899
+ message: "--dry-run is only valid with --migrate.",
900
+ },
892
901
  ];
893
902
  const invalidGuard = guards.find((guard) => guard.triggered && !guard.allowed);
894
903
  if (invalidGuard) {
@@ -1264,7 +1273,7 @@ const buildInstalledExtensionActivation = (ctx, extensionName, runtimeProbe, com
1264
1273
  registered_commands: commandSummary.command_paths,
1265
1274
  registered_actions: commandSummary.action_paths,
1266
1275
  registered_item_types: installedItemTypes,
1267
- module_graph_verification: "fresh_snapshot",
1276
+ module_graph_verification: "fresh_in_topology_snapshot",
1268
1277
  health: healthByActivation[String(activated)],
1269
1278
  },
1270
1279
  };
@@ -1276,7 +1285,7 @@ const performExtensionInstallUnderLock = async (ctx, input) => {
1276
1285
  const persisted = await persistExtensionInstall(ctx, input);
1277
1286
  const refreshedInstalled = await listInstalledExtensions(resolvedRoots.selected_root, scope, persisted.settings, persisted.managedState);
1278
1287
  warnings.push(...refreshedInstalled.warnings);
1279
- const runtimeProbe = await probeRuntimeCommandPathsForInstall(resolvedRoots.pm_root, persisted.settings, refreshedInstalled.extensions, global);
1288
+ const runtimeProbe = await probeRuntimeCommandPathsForInstall(resolvedRoots.pm_root, path.dirname(resolvedRoots.selected_root), persisted.settings, refreshedInstalled.extensions, global);
1280
1289
  warnings.push(...runtimeProbe.warnings);
1281
1290
  // Scaffold the folders for any item types the installed package contributes
1282
1291
  // so the tracker is immediately healthy — matching `pm schema add-type` and
@@ -1302,6 +1311,7 @@ const performExtensionInstallUnderLock = async (ctx, input) => {
1302
1311
  directory: destinationDirectoryName,
1303
1312
  },
1304
1313
  source: persisted.sourceRecord,
1314
+ source_resolution: input.sourceResolution,
1305
1315
  destination_path: persisted.destinationDirectory,
1306
1316
  overwritten: [
1307
1317
  persisted.destinationExists,
@@ -1357,6 +1367,7 @@ const runBundledExtensionInstallAll = async (ctx) => {
1357
1367
  ok: entry.result.ok,
1358
1368
  extension: details.extension,
1359
1369
  source: details.source,
1370
+ source_resolution: details.source_resolution,
1360
1371
  destination_path: details.destination_path,
1361
1372
  activated: details.activated,
1362
1373
  settings_changed: details.settings_changed,
@@ -1371,32 +1382,14 @@ const runBundledExtensionInstallAll = async (ctx) => {
1371
1382
  }),
1372
1383
  }, installedAll);
1373
1384
  };
1374
- /** Resolve bundled-alias provenance before installing one extension source. */
1375
- const resolveSingleExtensionInstallSource = async (explicitSourceInput, githubOption, ref) => {
1376
- /* c8 ignore start -- github/local alias-source split is exercised in install-action integration tests */
1377
- const bundledAliasSource = typeof githubOption === "string"
1378
- ? null
1379
- : await resolveBundledExtensionAliasSource(explicitSourceInput);
1380
- /* c8 ignore stop */
1381
- const bundledAliasName = bundledAliasSource === null
1382
- ? null
1383
- : explicitSourceInput.trim().toLowerCase();
1384
- const bundledPackageName = bundledAliasName === null
1385
- ? null
1386
- : await resolveBundledPackageNpmName(bundledAliasName);
1387
- const sourceInput = bundledAliasSource ?? explicitSourceInput;
1388
- /* c8 ignore start -- install-source branch combinations are covered in install-sources focused tests */
1389
- const installSource = parseExtensionInstallSource(sourceInput, {
1390
- forceGithub: typeof githubOption === "string",
1391
- ref,
1392
- });
1393
- /* c8 ignore stop */
1394
- return { bundledAliasName, bundledPackageName, installSource };
1395
- };
1396
1385
  /** Install one resolved source and clean transient source material afterward. */
1397
1386
  const runSingleExtensionInstall = async (ctx, explicitSourceInput, githubOption) => {
1398
1387
  const { resolvedRoots } = ctx;
1399
- const { bundledAliasName, bundledPackageName, installSource } = await resolveSingleExtensionInstallSource(explicitSourceInput, githubOption, ctx.options.ref);
1388
+ const { bundledAliasName, bundledPackageName, installSource, sourceResolution, } = await resolveExtensionInstallSourceIdentity(explicitSourceInput, githubOption, ctx.options.ref);
1389
+ if (sourceResolution.ambiguous) {
1390
+ const npmCandidate = sourceResolution.candidates.find((candidate) => candidate.kind === "npm");
1391
+ ctx.warnings.push(`extension_install_source_ambiguous:${explicitSourceInput}:builtin:${bundledAliasName}:npm:${npmCandidate.package}`);
1392
+ }
1400
1393
  const resolvedSource = await resolveInstallSource(installSource);
1401
1394
  try {
1402
1395
  const validated = await validateExtensionDirectory(resolvedSource.directory, {
@@ -1410,6 +1403,7 @@ const runSingleExtensionInstall = async (ctx, explicitSourceInput, githubOption)
1410
1403
  destinationDirectoryName,
1411
1404
  bundledAliasName,
1412
1405
  bundledPackageName,
1406
+ sourceResolution,
1413
1407
  installSource,
1414
1408
  resolvedSource,
1415
1409
  }));
@@ -1640,7 +1634,7 @@ const runExtensionActivateDeactivateAction = async (ctx) => {
1640
1634
  await writeSettings(resolvedRoots.settings_root, settings, "settings:write");
1641
1635
  }
1642
1636
  const activationFailure = action === "activate"
1643
- ? await probeRuntimeCommandPathsForInstall(resolvedRoots.pm_root, settings, [candidate], global).then((probe) => {
1637
+ ? await probeRuntimeCommandPathsForInstall(resolvedRoots.pm_root, path.dirname(resolvedRoots.selected_root), settings, [candidate], global).then((probe) => {
1644
1638
  warnings.push(...probe.warnings);
1645
1639
  return findActivationFailureByName(candidate.name, probe.activation_failures, ctx.scope);
1646
1640
  })
@@ -2147,6 +2141,7 @@ const EXTENSION_ACTION_HANDLERS = {
2147
2141
  "adopt-all": runExtensionAdoptAllAction,
2148
2142
  activate: runExtensionActivateDeactivateAction,
2149
2143
  deactivate: runExtensionActivateDeactivateAction,
2144
+ migrate: runExtensionMigrateAction,
2150
2145
  };
2151
2146
  /** Identify lifecycle actions that mutate shared settings or managed-extension state. */
2152
2147
  const requiresExtensionStateLock = (ctx) => [
@@ -2156,6 +2151,7 @@ const requiresExtensionStateLock = (ctx) => [
2156
2151
  ctx.action === "adopt-all",
2157
2152
  ctx.action === "activate",
2158
2153
  ctx.action === "deactivate",
2154
+ ctx.action === "migrate",
2159
2155
  [ctx.action === "doctor", ctx.options.fixManagedState === true].every(Boolean),
2160
2156
  ].some(Boolean);
2161
2157
  /** Dispatch one normalized lifecycle action through the complete handler table. */
@@ -2194,4 +2190,4 @@ export const _testOnly = {
2194
2190
  withExtensionInstallLock,
2195
2191
  };
2196
2192
  //# sourceMappingURL=extension.js.map
2197
- //# debugId=4fb93ad8-845c-5b71-93eb-c95481f101b7
2193
+ //# debugId=f4b47053-cc05-51f2-b5cb-cc6dba3365c2
@@ -4,7 +4,7 @@
4
4
  * Generated by scripts/generate-error-code-catalog.mjs. Do not edit manually.
5
5
  */
6
6
 
7
- !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]="7a568064-a103-5b19-969d-6e58fc0cc5b7")}catch(e){}}();
7
+ !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]="93c784d2-8f0f-5bf4-875e-3d83a675c9eb")}catch(e){}}();
8
8
  import { definePmErrorCodeCatalog } from "./error-code-catalog.js";
9
9
  /** Exhaustive catalog generated from literal error guidance declarations. */
10
10
  export const PM_ERROR_CODE_CATALOG = definePmErrorCodeCatalog([
@@ -668,6 +668,26 @@ export const PM_ERROR_CODE_CATALOG = definePmErrorCodeCatalog([
668
668
  sources: ["core/diagnostics/remediation.ts"],
669
669
  emitting_commands: ["*"],
670
670
  },
671
+ {
672
+ code: "improvement_metric_contract_conflict",
673
+ meaning: "Improvement metric contract conflict condition.",
674
+ stability: "provisional",
675
+ exit_code: 4,
676
+ class: "conflict",
677
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
678
+ sources: ["sdk/improvement-ledger.ts"],
679
+ emitting_commands: ["*"],
680
+ },
681
+ {
682
+ code: "improvement_observation_conflict",
683
+ meaning: "Improvement observation conflict condition.",
684
+ stability: "provisional",
685
+ exit_code: 4,
686
+ class: "conflict",
687
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
688
+ sources: ["sdk/improvement-ledger.ts"],
689
+ emitting_commands: ["*"],
690
+ },
671
691
  {
672
692
  code: "init_existing_settings_requires_force",
673
693
  meaning: "Init existing settings requires force condition.",
@@ -853,6 +873,86 @@ export const PM_ERROR_CODE_CATALOG = definePmErrorCodeCatalog([
853
873
  sources: ["sdk/mutation-events.ts"],
854
874
  emitting_commands: ["*"],
855
875
  },
876
+ {
877
+ code: "invalid_history_analytics_limit",
878
+ meaning: "Invalid history analytics limit condition.",
879
+ stability: "provisional",
880
+ exit_code: 2,
881
+ class: "usage",
882
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
883
+ sources: ["sdk/history-analytics.ts"],
884
+ emitting_commands: ["*"],
885
+ },
886
+ {
887
+ code: "invalid_history_analytics_minimum_sample",
888
+ meaning: "Invalid history analytics minimum sample condition.",
889
+ stability: "provisional",
890
+ exit_code: 2,
891
+ class: "usage",
892
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
893
+ sources: ["sdk/history-analytics.ts"],
894
+ emitting_commands: ["*"],
895
+ },
896
+ {
897
+ code: "invalid_history_analytics_since",
898
+ meaning: "Invalid history analytics since condition.",
899
+ stability: "provisional",
900
+ exit_code: 2,
901
+ class: "usage",
902
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
903
+ sources: ["sdk/history-analytics.ts"],
904
+ emitting_commands: ["*"],
905
+ },
906
+ {
907
+ code: "invalid_improvement_ledger",
908
+ meaning: "Invalid improvement ledger condition.",
909
+ stability: "provisional",
910
+ exit_code: 1,
911
+ class: "generic_failure",
912
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
913
+ sources: ["sdk/improvement-ledger-validation.ts"],
914
+ emitting_commands: ["*"],
915
+ },
916
+ {
917
+ code: "invalid_improvement_metric",
918
+ meaning: "Invalid improvement metric condition.",
919
+ stability: "provisional",
920
+ exit_code: 2,
921
+ class: "usage",
922
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
923
+ sources: ["sdk/improvement-ledger.ts"],
924
+ emitting_commands: ["*"],
925
+ },
926
+ {
927
+ code: "invalid_improvement_observation",
928
+ meaning: "Invalid improvement observation condition.",
929
+ stability: "provisional",
930
+ exit_code: 2,
931
+ class: "usage",
932
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
933
+ sources: ["sdk/improvement-ledger.ts"],
934
+ emitting_commands: ["*"],
935
+ },
936
+ {
937
+ code: "invalid_improvement_observation_limit",
938
+ meaning: "Invalid improvement observation limit condition.",
939
+ stability: "provisional",
940
+ exit_code: 2,
941
+ class: "usage",
942
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
943
+ sources: ["sdk/improvement-ledger.ts"],
944
+ emitting_commands: ["*"],
945
+ },
946
+ {
947
+ code: "invalid_improvement_observation_timestamp",
948
+ meaning: "Invalid improvement observation timestamp condition.",
949
+ stability: "provisional",
950
+ exit_code: 2,
951
+ class: "usage",
952
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
953
+ sources: ["sdk/improvement-ledger.ts"],
954
+ emitting_commands: ["*"],
955
+ },
856
956
  {
857
957
  code: "invalid_provenance_predicate",
858
958
  meaning: "Invalid provenance predicate condition.",
@@ -873,6 +973,16 @@ export const PM_ERROR_CODE_CATALOG = definePmErrorCodeCatalog([
873
973
  sources: ["sdk/pagination.ts"],
874
974
  emitting_commands: ["*"],
875
975
  },
976
+ {
977
+ code: "invalid_read_output_session",
978
+ meaning: "Invalid read output session condition.",
979
+ stability: "provisional",
980
+ exit_code: 2,
981
+ class: "usage",
982
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
983
+ sources: ["sdk/read-output-session.ts"],
984
+ emitting_commands: ["*"],
985
+ },
876
986
  {
877
987
  code: "invalid_workspace_snapshot_target",
878
988
  meaning: "Invalid workspace snapshot target condition.",
@@ -2285,4 +2395,4 @@ export const PM_ERROR_CODE_CATALOG = definePmErrorCodeCatalog([
2285
2395
  },
2286
2396
  ]);
2287
2397
  //# sourceMappingURL=generated-error-code-catalog.js.map
2288
- //# debugId=7a568064-a103-5b19-969d-6e58fc0cc5b7
2398
+ //# debugId=93c784d2-8f0f-5bf4-875e-3d83a675c9eb
@@ -4,7 +4,7 @@
4
4
  * Implements the pm health command surface and its agent-facing runtime behavior.
5
5
  */
6
6
 
7
- !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]="6d814d40-522c-5bcc-b404-7e6511cf999a")}catch(e){}}();
7
+ !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]="34fc99f6-45e5-53f2-96eb-767d50ed449c")}catch(e){}}();
8
8
  import fs from "node:fs/promises";
9
9
  import path from "node:path";
10
10
  import { resolveItemTypeRegistry } from "../../core/item/type-registry.js";
@@ -35,6 +35,7 @@ import { readSettingsWithMetadata } from "../../core/store/settings.js";
35
35
  import { buildRemediationMap } from "../../core/diagnostics/remediation.js";
36
36
  import { scanHistoryAuthorAttribution, } from "../author-attribution.js";
37
37
  import { readManagedExtensionState } from "../extension.js";
38
+ import { applyStoredExtensionMigrationState } from "../extension/migrations.js";
38
39
  import { buildCapabilityContractMetadata, buildRegistrationCollisionRemediation, collectUnknownCapabilityGuidance, } from "../extension/doctor.js";
39
40
  import { scanStaleInProgressItems, } from "./stale-work.js";
40
41
  import { scanTrackedRuntimeCache } from "./tracked-runtime-cache.js";
@@ -605,6 +606,7 @@ async function buildExtensionCheck(pmRoot, settings, noExtensionsFlag) {
605
606
  readManagedExtensionState(loadResult.roots.project),
606
607
  readManagedExtensionState(loadResult.roots.global),
607
608
  ]);
609
+ await applyStoredExtensionMigrationState(pmRoot, activationResult.registrations.migrations);
608
610
  const migrationStatus = summarizeMigrationStatuses(activationResult.registrations.migrations);
609
611
  const activationDetails = {
610
612
  failed: activationResult.failed,
@@ -695,6 +697,13 @@ async function buildExtensionCheck(pmRoot, settings, noExtensionsFlag) {
695
697
  warnings: extensionWarnings,
696
698
  activation: activationDetails,
697
699
  triage: extensionTriage,
700
+ ...(migrationStatus.summary.pending_count > 0
701
+ ? {
702
+ remediation_map: {
703
+ extension_migration_pending: "pm extension migrate --project",
704
+ },
705
+ }
706
+ : {}),
698
707
  capability_contract: capabilityContract,
699
708
  capability_guidance: capabilityGuidance,
700
709
  },
@@ -1955,4 +1964,4 @@ export const _testOnlyHealthCommand = {
1955
1964
  warningCode,
1956
1965
  };
1957
1966
  //# sourceMappingURL=health.js.map
1958
- //# debugId=6d814d40-522c-5bcc-b404-7e6511cf999a
1967
+ //# debugId=34fc99f6-45e5-53f2-96eb-767d50ed449c