@unbrained/pm-cli 2026.8.4 → 2026.8.6

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 (253) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +53 -13
  3. package/dist/cli/error-guidance.js +4 -4
  4. package/dist/cli/main.js +12 -37
  5. package/dist/cli/register-setup.d.ts +1 -1
  6. package/dist/cli/register-setup.js +46 -20
  7. package/dist/cli/register-structured-mutation.d.ts +2 -0
  8. package/dist/cli/register-structured-mutation.js +124 -12
  9. package/dist/cli-bundle/bundle-manifest.json +397 -397
  10. package/dist/cli-bundle/chunks/append-XAJ5Z4XS.js +2 -0
  11. package/dist/cli-bundle/chunks/{chunk-QVO3VTA4.js → chunk-343QETLI.js} +2 -2
  12. package/dist/cli-bundle/chunks/{chunk-Q5F6OI7C.js → chunk-3KFVGGRE.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-6S7I3UKV.js → chunk-3ZJRFYY2.js} +19 -19
  14. package/dist/cli-bundle/chunks/{chunk-NFF3JAQR.js → chunk-4AVFKHHC.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-5H47J5FG.js → chunk-4OVGQW22.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-D2MBVMVE.js → chunk-5PBP2ZP3.js} +2 -2
  17. package/dist/cli-bundle/chunks/chunk-5ZKQPA44.js +2 -0
  18. package/dist/cli-bundle/chunks/chunk-A3XQ7VPU.js +2 -0
  19. package/dist/cli-bundle/chunks/chunk-AJE3AHPD.js +8 -0
  20. package/dist/cli-bundle/chunks/{chunk-2POYGY53.js → chunk-AOBDLU4T.js} +2 -2
  21. package/dist/cli-bundle/chunks/{chunk-PYYPQLHC.js → chunk-AYRUGRNS.js} +2 -2
  22. package/dist/cli-bundle/chunks/{chunk-QMWUL66F.js → chunk-BP6EMEDP.js} +5 -5
  23. package/dist/cli-bundle/chunks/{chunk-UVZREFZU.js → chunk-C3YABSJK.js} +2 -2
  24. package/dist/cli-bundle/chunks/{chunk-RB65T4RX.js → chunk-CA3BURYF.js} +2 -2
  25. package/dist/cli-bundle/chunks/{chunk-KIKLF2W4.js → chunk-D7I3TUGV.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-PQXEB7W4.js → chunk-DQGJ2RWT.js} +2 -2
  27. package/dist/cli-bundle/chunks/{chunk-OB7TRZ2G.js → chunk-DWOAOZHZ.js} +2 -2
  28. package/dist/cli-bundle/chunks/{chunk-SVDH5CHC.js → chunk-E7BFPLUZ.js} +4 -4
  29. package/dist/cli-bundle/chunks/{chunk-CGY5I2GO.js → chunk-F4NREH3G.js} +2 -2
  30. package/dist/cli-bundle/chunks/{chunk-DCJ6CM6F.js → chunk-FDBRXV25.js} +2 -2
  31. package/dist/cli-bundle/chunks/{chunk-NM5G7RLU.js → chunk-GU3TSEHD.js} +2 -2
  32. package/dist/cli-bundle/chunks/chunk-HS7OVAUN.js +164 -0
  33. package/dist/cli-bundle/chunks/{chunk-CU5ENFNP.js → chunk-JFZIS6JF.js} +2 -2
  34. package/dist/cli-bundle/chunks/{chunk-GOICHIX4.js → chunk-JQ4NZ5EB.js} +2 -2
  35. package/dist/cli-bundle/chunks/{chunk-HE3DZFN4.js → chunk-L6LGKJX3.js} +2 -2
  36. package/dist/cli-bundle/chunks/{chunk-BLINBTMX.js → chunk-M357ZCOR.js} +2 -2
  37. package/dist/cli-bundle/chunks/{chunk-NRDKVOUE.js → chunk-M4VEE3FK.js} +2 -2
  38. package/dist/cli-bundle/chunks/{chunk-HTYC76A4.js → chunk-MCS73BKB.js} +2 -2
  39. package/dist/cli-bundle/chunks/{chunk-BKMZTZYL.js → chunk-MDTH7SAE.js} +2 -2
  40. package/dist/cli-bundle/chunks/{chunk-H6FITE7D.js → chunk-NE5VRDAI.js} +2 -2
  41. package/dist/cli-bundle/chunks/{chunk-NPUJ7OLK.js → chunk-OXY3SJ3N.js} +2 -2
  42. package/dist/cli-bundle/chunks/chunk-PECV7L5T.js +2 -0
  43. package/dist/cli-bundle/chunks/{chunk-KH4GVBMC.js → chunk-Q3VOP62W.js} +2 -2
  44. package/dist/cli-bundle/chunks/{chunk-FQ4EFFDU.js → chunk-QJ7C3JIW.js} +2 -2
  45. package/dist/cli-bundle/chunks/{chunk-VH2EAGUG.js → chunk-R6LSRGPS.js} +2 -2
  46. package/dist/cli-bundle/chunks/{chunk-HQ2WU7OY.js → chunk-R6RKEYYW.js} +2 -2
  47. package/dist/cli-bundle/chunks/{chunk-PA5XRN2A.js → chunk-RAFUN7IX.js} +4 -4
  48. package/dist/cli-bundle/chunks/chunk-RUAU5OSH.js +2 -0
  49. package/dist/cli-bundle/chunks/chunk-SD3YXU2U.js +56 -0
  50. package/dist/cli-bundle/chunks/{chunk-JMKVCQSE.js → chunk-SV3YQ4RY.js} +2 -2
  51. package/dist/cli-bundle/chunks/{chunk-B5ZLCD5Z.js → chunk-SVV3DQES.js} +2 -2
  52. package/dist/cli-bundle/chunks/{chunk-J4EPW4GT.js → chunk-SXECIECW.js} +2 -2
  53. package/dist/cli-bundle/chunks/chunk-T45OHXDW.js +8 -0
  54. package/dist/cli-bundle/chunks/{chunk-NH35JNK5.js → chunk-TPKDJ5WL.js} +2 -2
  55. package/dist/cli-bundle/chunks/{chunk-ZSH4GNBH.js → chunk-UVVXHGYS.js} +2 -2
  56. package/dist/cli-bundle/chunks/chunk-V663653R.js +20 -0
  57. package/dist/cli-bundle/chunks/{chunk-5PZGZMPG.js → chunk-WSI5KZQJ.js} +2 -2
  58. package/dist/cli-bundle/chunks/{chunk-3XZYTRPC.js → chunk-XPOQQJTX.js} +2 -2
  59. package/dist/cli-bundle/chunks/{chunk-UJHUR3LZ.js → chunk-YCCDXBNU.js} +2 -2
  60. package/dist/cli-bundle/chunks/chunk-ZFBWCKYF.js +2 -0
  61. package/dist/cli-bundle/chunks/close-DI66JMSB.js +2 -0
  62. package/dist/cli-bundle/chunks/close-many-VFKT6U3O.js +2 -0
  63. package/dist/cli-bundle/chunks/comments-E73HIEZJ.js +2 -0
  64. package/dist/cli-bundle/chunks/copy-WBYVLCPC.js +2 -0
  65. package/dist/cli-bundle/chunks/{create-RLLCBCXM.js → create-TG67IVFI.js} +2 -2
  66. package/dist/cli-bundle/chunks/delete-6XKUVVQN.js +2 -0
  67. package/dist/cli-bundle/chunks/{deps-J4ONTF4X.js → deps-AJUGP2OH.js} +2 -2
  68. package/dist/cli-bundle/chunks/{docs-YL2DJ4WD.js → docs-QOCLDRKJ.js} +2 -2
  69. package/dist/cli-bundle/chunks/{files-NGNAIYKK.js → files-3ST5TY64.js} +2 -2
  70. package/dist/cli-bundle/chunks/focus-R2AWS63Y.js +2 -0
  71. package/dist/cli-bundle/chunks/{history-compact-HW62K5XP.js → history-compact-7BJFML4S.js} +2 -2
  72. package/dist/cli-bundle/chunks/{history-redact-HVBKUJOW.js → history-redact-WJN3HYXR.js} +2 -2
  73. package/dist/cli-bundle/chunks/{history-repair-OPNBH5JJ.js → history-repair-XDNZUB7F.js} +2 -2
  74. package/dist/cli-bundle/chunks/{learnings-F36PZXT6.js → learnings-SZMUPVNA.js} +2 -2
  75. package/dist/cli-bundle/chunks/{profile-N3XMWBM7.js → profile-KL53JIAC.js} +2 -2
  76. package/dist/cli-bundle/chunks/{register-list-query-BKGHBI7Y.js → register-list-query-QH7ONPKU.js} +2 -2
  77. package/dist/cli-bundle/chunks/register-mutation-OCRQNZK4.js +20 -0
  78. package/dist/cli-bundle/chunks/register-operations-HIBJXRGB.js +2 -0
  79. package/dist/cli-bundle/chunks/register-setup-QWBQ6HBS.js +2 -0
  80. package/dist/cli-bundle/chunks/restore-FXA5QPM7.js +2 -0
  81. package/dist/cli-bundle/chunks/{schema-4PJQMGUY.js → schema-QJ27OTRV.js} +2 -2
  82. package/dist/cli-bundle/chunks/update-7GBO4SXG.js +2 -0
  83. package/dist/cli-bundle/chunks/update-many-VF6ZKQUO.js +2 -0
  84. package/dist/cli-bundle/focused-chunks/chunk-27DK4A5O.js +2 -0
  85. package/dist/cli-bundle/focused-chunks/chunk-4JC3AOGS.js +8 -0
  86. package/dist/cli-bundle/focused-chunks/chunk-6KDHXURF.js +2 -0
  87. package/dist/cli-bundle/focused-chunks/chunk-74CWP3A4.js +2 -0
  88. package/dist/cli-bundle/focused-chunks/chunk-7AZDTGPA.js +2 -0
  89. package/dist/cli-bundle/focused-chunks/chunk-7YTZ7A4E.js +2 -0
  90. package/dist/cli-bundle/focused-chunks/{chunk-ONIX2KKW.js → chunk-CL3NB7VW.js} +2 -2
  91. package/dist/cli-bundle/focused-chunks/chunk-EAXXF2HW.js +4 -0
  92. package/dist/cli-bundle/focused-chunks/{chunk-L6A4NVQC.js → chunk-EYO4F74Z.js} +2 -2
  93. package/dist/cli-bundle/focused-chunks/chunk-GEYU23YS.js +153 -0
  94. package/dist/cli-bundle/focused-chunks/{chunk-DQ4PLKEE.js → chunk-GIERI4YU.js} +2 -2
  95. package/dist/cli-bundle/focused-chunks/chunk-GSW2Y7VZ.js +5 -0
  96. package/dist/cli-bundle/focused-chunks/{chunk-WVGJAD7L.js → chunk-LKQXXO62.js} +2 -2
  97. package/dist/cli-bundle/focused-chunks/{chunk-UFCPSWIL.js → chunk-MBBMTDD3.js} +2 -2
  98. package/dist/cli-bundle/focused-chunks/{chunk-OYTK4VNH.js → chunk-ME4XVOBJ.js} +2 -2
  99. package/dist/cli-bundle/focused-chunks/{chunk-RO5BQFG3.js → chunk-N7QN3NE6.js} +2 -2
  100. package/dist/cli-bundle/focused-chunks/chunk-QL5H3AQH.js +2 -0
  101. package/dist/cli-bundle/focused-chunks/chunk-TQMFQYXR.js +29 -0
  102. package/dist/cli-bundle/focused-chunks/{chunk-SQXVGHMH.js → chunk-XNVXIQ4B.js} +2 -2
  103. package/dist/cli-bundle/focused-chunks/{chunk-BOGRY7M6.js → chunk-YHDCGUIW.js} +10 -10
  104. package/dist/cli-bundle/focused-chunks/{chunk-K37BB4JL.js → chunk-YLPZHWX7.js} +2 -2
  105. package/dist/cli-bundle/main.js +13 -13
  106. package/dist/cli-bundle/sdk-authoring.js +1 -1
  107. package/dist/cli-bundle/sdk-contracts.js +1 -1
  108. package/dist/cli-bundle/sdk-core.js +28 -28
  109. package/dist/cli-bundle/sdk-governance.js +1 -1
  110. package/dist/cli-bundle/sdk-graph.js +1 -1
  111. package/dist/cli-bundle/sdk-merge.js +1 -1
  112. package/dist/cli-bundle/sdk-query.js +1 -1
  113. package/dist/cli-bundle/sdk-runtime.js +1 -1
  114. package/dist/cli-bundle/sdk-testing.js +1 -1
  115. package/dist/cli-bundle/sdk.js +1 -1
  116. package/dist/core/extensions/activation-summary.d.ts +4 -0
  117. package/dist/core/extensions/activation-summary.js +5 -2
  118. package/dist/core/extensions/contribution-inventory.d.ts +1 -0
  119. package/dist/core/extensions/contribution-inventory.js +35 -2
  120. package/dist/core/extensions/extension-hook-runtime.js +5 -3
  121. package/dist/core/extensions/extension-types.d.ts +18 -1
  122. package/dist/core/extensions/extension-types.js +2 -2
  123. package/dist/core/extensions/loader.js +8 -13
  124. package/dist/core/extensions/preflight-ownership.d.ts +5 -0
  125. package/dist/core/extensions/preflight-ownership.js +42 -0
  126. package/dist/core/item/item-format.js +14 -20
  127. package/dist/core/shared/constants.js +3 -2
  128. package/dist/core/store/item-store.js +2 -2
  129. package/dist/core/store/settings.js +2 -2
  130. package/dist/mcp/server.js +12 -6
  131. package/dist/mcp/tool-definitions.js +14 -7
  132. package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +18 -18
  133. package/dist/sdk/cli-contracts/agent-output-contracts.js +51 -23
  134. package/dist/sdk/cli-contracts/commander-mutation-options.js +26 -2
  135. package/dist/sdk/cli-contracts/flag-contracts.d.ts +4 -0
  136. package/dist/sdk/cli-contracts/flag-contracts.js +34 -2
  137. package/dist/sdk/cli-contracts/registration-helpers.js +4 -2
  138. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +10 -2
  139. package/dist/sdk/cli-contracts/runtime-contracts.js +21 -5
  140. package/dist/sdk/cli-contracts/tool-schema.js +4 -2
  141. package/dist/sdk/cli-contracts.d.ts +2 -2
  142. package/dist/sdk/cli-contracts.js +4 -4
  143. package/dist/sdk/cli-program.js +3 -3
  144. package/dist/sdk/compose.d.ts +2 -2
  145. package/dist/sdk/compose.js +7 -2
  146. package/dist/sdk/contracts.d.ts +1 -0
  147. package/dist/sdk/contracts.js +3 -2
  148. package/dist/sdk/define.d.ts +3 -1
  149. package/dist/sdk/define.js +3 -8
  150. package/dist/sdk/dependency-provenance.d.ts +2 -0
  151. package/dist/sdk/dependency-provenance.js +7 -3
  152. package/dist/sdk/error-code-catalog.d.ts +23 -0
  153. package/dist/sdk/error-code-catalog.js +25 -5
  154. package/dist/sdk/extension/install-sources.d.ts +43 -5
  155. package/dist/sdk/extension/install-sources.js +36 -2
  156. package/dist/sdk/extension/migrations.d.ts +114 -0
  157. package/dist/sdk/extension/migrations.js +175 -0
  158. package/dist/sdk/extension/scaffold.js +14 -9
  159. package/dist/sdk/extension/source-resolution.d.ts +50 -0
  160. package/dist/sdk/extension/source-resolution.js +66 -0
  161. package/dist/sdk/extension.d.ts +5 -1
  162. package/dist/sdk/extension.js +24 -26
  163. package/dist/sdk/generated-error-code-catalog.js +499 -3
  164. package/dist/sdk/governance/health.js +11 -2
  165. package/dist/sdk/graph/governance.js +3 -3
  166. package/dist/sdk/graph/remediation.js +3 -3
  167. package/dist/sdk/graph/run.js +4 -8
  168. package/dist/sdk/index.d.ts +7 -2
  169. package/dist/sdk/index.js +9 -4
  170. package/dist/sdk/item-transaction.d.ts +51 -6
  171. package/dist/sdk/item-transaction.js +132 -22
  172. package/dist/sdk/lifecycle/create.d.ts +4 -0
  173. package/dist/sdk/lifecycle/create.js +26 -10
  174. package/dist/sdk/lifecycle-policy.d.ts +9 -0
  175. package/dist/sdk/lifecycle-policy.js +22 -9
  176. package/dist/sdk/merge/driver.js +6 -3
  177. package/dist/sdk/output-contracts.d.ts +67 -0
  178. package/dist/sdk/output-contracts.js +173 -0
  179. package/dist/sdk/package-import-adapters.js +2 -2
  180. package/dist/sdk/package-migrations.d.ts +10 -0
  181. package/dist/sdk/package-migrations.js +21 -0
  182. package/dist/sdk/runtime.d.ts +2 -0
  183. package/dist/sdk/runtime.js +6 -2
  184. package/dist/sdk/structured-mutations.d.ts +23 -0
  185. package/dist/sdk/structured-mutations.js +219 -10
  186. package/dist/sdk/workspace-snapshot.js +58 -12
  187. package/dist/sdk/workspace.js +30 -4
  188. package/docs/COMMANDS.md +49 -10
  189. package/docs/EXTENSIONS.md +3 -3
  190. package/docs/EXTENSION_LIFECYCLE.md +46 -0
  191. package/docs/MERGE_SAFETY.md +2 -0
  192. package/docs/PR_REVIEW_LOOP.md +10 -4
  193. package/docs/README.md +23 -22
  194. package/docs/RELEASING.md +36 -23
  195. package/docs/SCRIPTING.md +32 -9
  196. package/docs/SDK.md +122 -14
  197. package/docs/SELF_DESCRIBING_CONTEXT_CONTRACTS.md +13 -0
  198. package/docs/TESTING.md +25 -0
  199. package/docs/examples/sdk-contract-consumer/README.md +11 -1
  200. package/docs/examples/sdk-contract-consumer/package.json +2 -1
  201. package/docs/examples/sdk-contract-consumer/parse-receipt.mjs +22 -0
  202. package/marketplace.json +2 -2
  203. package/package.json +5 -4
  204. package/packages/pm-beads/package.json +1 -1
  205. package/packages/pm-calendar/package.json +1 -1
  206. package/packages/pm-command-kit/package.json +1 -1
  207. package/packages/pm-digital-twin/package.json +1 -1
  208. package/packages/pm-governance-audit/package.json +1 -1
  209. package/packages/pm-guide-shell/package.json +1 -1
  210. package/packages/pm-kanban/package.json +1 -1
  211. package/packages/pm-lifecycle-hooks/package.json +1 -1
  212. package/packages/pm-linked-test-adapters/package.json +1 -1
  213. package/packages/pm-search-advanced/package.json +1 -1
  214. package/packages/pm-templates/package.json +1 -1
  215. package/packages/pm-todos/package.json +1 -1
  216. package/packages/pm-vcs/package.json +1 -1
  217. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  218. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  219. package/sdk/public-surface.json +508 -32
  220. package/dist/cli-bundle/chunks/append-DHBRLHHS.js +0 -2
  221. package/dist/cli-bundle/chunks/chunk-2INN52SU.js +0 -8
  222. package/dist/cli-bundle/chunks/chunk-377OOXUF.js +0 -55
  223. package/dist/cli-bundle/chunks/chunk-6RSK4IFN.js +0 -20
  224. package/dist/cli-bundle/chunks/chunk-ASJJKA57.js +0 -2
  225. package/dist/cli-bundle/chunks/chunk-IYAVULRN.js +0 -2
  226. package/dist/cli-bundle/chunks/chunk-JDPKBV5P.js +0 -2
  227. package/dist/cli-bundle/chunks/chunk-RRQBHQOV.js +0 -2
  228. package/dist/cli-bundle/chunks/chunk-SULWTPQO.js +0 -8
  229. package/dist/cli-bundle/chunks/chunk-V5K52PYW.js +0 -164
  230. package/dist/cli-bundle/chunks/chunk-XBLOD5TZ.js +0 -2
  231. package/dist/cli-bundle/chunks/close-VLHNN6YB.js +0 -2
  232. package/dist/cli-bundle/chunks/close-many-LSJNZKU6.js +0 -2
  233. package/dist/cli-bundle/chunks/comments-AAIA6A6X.js +0 -2
  234. package/dist/cli-bundle/chunks/copy-Z7YMLEHN.js +0 -2
  235. package/dist/cli-bundle/chunks/delete-KNOHHQJM.js +0 -2
  236. package/dist/cli-bundle/chunks/focus-LFRCGALV.js +0 -2
  237. package/dist/cli-bundle/chunks/register-mutation-GU3DCECN.js +0 -20
  238. package/dist/cli-bundle/chunks/register-operations-PTWH727R.js +0 -2
  239. package/dist/cli-bundle/chunks/register-setup-KWV6UD77.js +0 -2
  240. package/dist/cli-bundle/chunks/restore-4HZSLILR.js +0 -2
  241. package/dist/cli-bundle/chunks/update-E6LPS5IV.js +0 -2
  242. package/dist/cli-bundle/chunks/update-many-OSIC6KRO.js +0 -2
  243. package/dist/cli-bundle/focused-chunks/chunk-2VIIXOAD.js +0 -2
  244. package/dist/cli-bundle/focused-chunks/chunk-5MTKO7TV.js +0 -153
  245. package/dist/cli-bundle/focused-chunks/chunk-6GIZK7VQ.js +0 -2
  246. package/dist/cli-bundle/focused-chunks/chunk-AOP2WIZZ.js +0 -2
  247. package/dist/cli-bundle/focused-chunks/chunk-C2QSL62X.js +0 -28
  248. package/dist/cli-bundle/focused-chunks/chunk-CL75YW32.js +0 -2
  249. package/dist/cli-bundle/focused-chunks/chunk-E7OFMWGT.js +0 -8
  250. package/dist/cli-bundle/focused-chunks/chunk-I5F5UK3Q.js +0 -2
  251. package/dist/cli-bundle/focused-chunks/chunk-QM2BIVK7.js +0 -4
  252. package/dist/cli-bundle/focused-chunks/chunk-T5TSY36R.js +0 -5
  253. package/dist/cli-bundle/focused-chunks/chunk-VT6BF2IX.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,7 +4,7 @@
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]="f4f1a871-b632-5263-aec0-cb00bcdbe1b3")}catch(e){}}();
8
8
  import fs from "node:fs/promises";
9
9
  import os from "node:os";
10
10
  import path from "node:path";
@@ -30,7 +30,7 @@ import { ensureTypeFolderScaffold } from "./schema.js";
30
30
  import { normalizeStringList, normalizeExtensionNameForMatch, normalizeManagedDirectoryName, parseExtensionManifest, validateExtensionDirectory, } from "./extension/shared.js";
31
31
  import { sortManagedEntries, managedExtensionSourcesEquivalent, readManagedExtensionState, writeManagedExtensionState, upsertManagedEntry, persistManagedContributionInventory, resolveManagedExtensionStatePath, } from "./extension/managed-state.js";
32
32
  import { parseExtensionInstallSource, resolveInstallSource, areDirectoriesEquivalent, } from "./extension/install-sources.js";
33
- import { resolveBundledExtensionAliasSource, resolveBundledPackageNpmName, isBundledPackageInstallAllTarget, listBundledPackageAliases, resolveBundledAliasManifestName, buildBundledPackageCatalog, } from "./extension/bundled-catalog.js";
33
+ import { resolveBundledExtensionAliasSource, isBundledPackageInstallAllTarget, listBundledPackageAliases, resolveBundledAliasManifestName, buildBundledPackageCatalog, } from "./extension/bundled-catalog.js";
34
34
  import { scaffoldExtensionProject } from "./extension/scaffold.js";
35
35
  import { buildExtensionDescribeResult } from "./extension/describe.js";
36
36
  import { applyDoctorRuntimeActivationState, classifyDoctorLoadFailureWarnings, classifyDoctorActivationFailureWarnings, classifyUnusedCapabilityWarnings, buildExtensionTriageSummary, parseDoctorDetailMode, collectUnknownCapabilityGuidance, buildCapabilityContractMetadata, buildDoctorConsistencySummary, summarizeExtensionFailures, } from "./extension/doctor.js";
@@ -40,6 +40,8 @@ import { summarizeRuntimeCommandPathsForExtension } from "./extension/runtime-su
40
40
  import { collectGlobalOutputOverrideDoctorWarnings } from "./extension/output-ownership.js";
41
41
  import { collectMcpCustomFieldCollisionDoctorWarnings } from "./extension/custom-field-collisions.js";
42
42
  import { checkGithubUpdate } from "./extension/update-check.js";
43
+ import { runExtensionMigrateAction } from "./extension/migrations.js";
44
+ import { resolveExtensionInstallSourceIdentity, } from "./extension/source-resolution.js";
43
45
  import { captureExtensionInstallSnapshot, readOptionalMetadataFile, restoreExtensionInstallSnapshot, } from "./extension/install-snapshot.js";
44
46
  // Re-export the public surface that lives in sibling modules but was previously
45
47
  // exported from this file (used by sdk barrels, upgrade.ts, and tests).
@@ -61,6 +63,7 @@ const LIFECYCLE_ACTION_TARGETS = [
61
63
  ["adopt-all", "adopt-all", "--adopt-all"],
62
64
  ["activate", "activate", "--activate"],
63
65
  ["deactivate", "deactivate", "--deactivate"],
66
+ ["migrate", "migrate", "--migrate"],
64
67
  ];
65
68
  const LIFECYCLE_ACTION_FLAG_HINT = LIFECYCLE_ACTION_TARGETS.map(([, , flag]) => flag)
66
69
  .filter((flag, index, flags) => flags.indexOf(flag) === index)
@@ -78,6 +81,7 @@ const LIFECYCLE_ACTION_FLAGS = {
78
81
  "adopt-all": "--adopt-all",
79
82
  activate: "--activate",
80
83
  deactivate: "--deactivate",
84
+ migrate: "--migrate",
81
85
  init: "--init",
82
86
  };
83
87
  const NATIVE_OUTPUT_MARKER = "__pm_native_output";
@@ -353,6 +357,7 @@ const EXTENSION_ACTION_FLAG_SELECTORS = [
353
357
  ["adoptAll", "adopt-all"],
354
358
  ["activate", "activate"],
355
359
  ["deactivate", "deactivate"],
360
+ ["migrate", "migrate"],
356
361
  ];
357
362
  /** Positional lifecycle shorthand mapped to the canonical extension action. */
358
363
  const IMPLICIT_EXTENSION_ACTIONS = {
@@ -363,6 +368,7 @@ const IMPLICIT_EXTENSION_ACTIONS = {
363
368
  scaffold: "init",
364
369
  explore: "explore",
365
370
  manage: "manage",
371
+ migrate: "migrate",
366
372
  list: "explore",
367
373
  "": "explore",
368
374
  };
@@ -889,6 +895,11 @@ const assertExtensionActionOptionScope = (action, options) => {
889
895
  allowed: action === "init",
890
896
  message: "--declarative is only valid with --init/--scaffold.",
891
897
  },
898
+ {
899
+ triggered: options.dryRun === true,
900
+ allowed: action === "migrate",
901
+ message: "--dry-run is only valid with --migrate.",
902
+ },
892
903
  ];
893
904
  const invalidGuard = guards.find((guard) => guard.triggered && !guard.allowed);
894
905
  if (invalidGuard) {
@@ -1302,6 +1313,7 @@ const performExtensionInstallUnderLock = async (ctx, input) => {
1302
1313
  directory: destinationDirectoryName,
1303
1314
  },
1304
1315
  source: persisted.sourceRecord,
1316
+ source_resolution: input.sourceResolution,
1305
1317
  destination_path: persisted.destinationDirectory,
1306
1318
  overwritten: [
1307
1319
  persisted.destinationExists,
@@ -1357,6 +1369,7 @@ const runBundledExtensionInstallAll = async (ctx) => {
1357
1369
  ok: entry.result.ok,
1358
1370
  extension: details.extension,
1359
1371
  source: details.source,
1372
+ source_resolution: details.source_resolution,
1360
1373
  destination_path: details.destination_path,
1361
1374
  activated: details.activated,
1362
1375
  settings_changed: details.settings_changed,
@@ -1371,32 +1384,14 @@ const runBundledExtensionInstallAll = async (ctx) => {
1371
1384
  }),
1372
1385
  }, installedAll);
1373
1386
  };
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
1387
  /** Install one resolved source and clean transient source material afterward. */
1397
1388
  const runSingleExtensionInstall = async (ctx, explicitSourceInput, githubOption) => {
1398
1389
  const { resolvedRoots } = ctx;
1399
- const { bundledAliasName, bundledPackageName, installSource } = await resolveSingleExtensionInstallSource(explicitSourceInput, githubOption, ctx.options.ref);
1390
+ const { bundledAliasName, bundledPackageName, installSource, sourceResolution, } = await resolveExtensionInstallSourceIdentity(explicitSourceInput, githubOption, ctx.options.ref);
1391
+ if (sourceResolution.ambiguous) {
1392
+ const npmCandidate = sourceResolution.candidates.find((candidate) => candidate.kind === "npm");
1393
+ ctx.warnings.push(`extension_install_source_ambiguous:${explicitSourceInput}:builtin:${bundledAliasName}:npm:${npmCandidate.package}`);
1394
+ }
1400
1395
  const resolvedSource = await resolveInstallSource(installSource);
1401
1396
  try {
1402
1397
  const validated = await validateExtensionDirectory(resolvedSource.directory, {
@@ -1410,6 +1405,7 @@ const runSingleExtensionInstall = async (ctx, explicitSourceInput, githubOption)
1410
1405
  destinationDirectoryName,
1411
1406
  bundledAliasName,
1412
1407
  bundledPackageName,
1408
+ sourceResolution,
1413
1409
  installSource,
1414
1410
  resolvedSource,
1415
1411
  }));
@@ -2147,6 +2143,7 @@ const EXTENSION_ACTION_HANDLERS = {
2147
2143
  "adopt-all": runExtensionAdoptAllAction,
2148
2144
  activate: runExtensionActivateDeactivateAction,
2149
2145
  deactivate: runExtensionActivateDeactivateAction,
2146
+ migrate: runExtensionMigrateAction,
2150
2147
  };
2151
2148
  /** Identify lifecycle actions that mutate shared settings or managed-extension state. */
2152
2149
  const requiresExtensionStateLock = (ctx) => [
@@ -2156,6 +2153,7 @@ const requiresExtensionStateLock = (ctx) => [
2156
2153
  ctx.action === "adopt-all",
2157
2154
  ctx.action === "activate",
2158
2155
  ctx.action === "deactivate",
2156
+ ctx.action === "migrate",
2159
2157
  [ctx.action === "doctor", ctx.options.fixManagedState === true].every(Boolean),
2160
2158
  ].some(Boolean);
2161
2159
  /** Dispatch one normalized lifecycle action through the complete handler table. */
@@ -2194,4 +2192,4 @@ export const _testOnly = {
2194
2192
  withExtensionInstallLock,
2195
2193
  };
2196
2194
  //# sourceMappingURL=extension.js.map
2197
- //# debugId=4fb93ad8-845c-5b71-93eb-c95481f101b7
2195
+ //# debugId=f4f1a871-b632-5263-aec0-cb00bcdbe1b3