@unbrained/pm-cli 2026.6.8 → 2026.6.10

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 (527) hide show
  1. package/CHANGELOG.md +74 -11
  2. package/dist/cli/bootstrap-args.js +4 -2
  3. package/dist/cli/bootstrap-args.js.map +1 -1
  4. package/dist/cli/commands/aggregate.d.ts +7 -0
  5. package/dist/cli/commands/aggregate.js +53 -12
  6. package/dist/cli/commands/aggregate.js.map +1 -1
  7. package/dist/cli/commands/close.d.ts +1 -0
  8. package/dist/cli/commands/close.js +106 -3
  9. package/dist/cli/commands/close.js.map +1 -1
  10. package/dist/cli/commands/completion.js +20 -7
  11. package/dist/cli/commands/completion.js.map +1 -1
  12. package/dist/cli/commands/context.d.ts +9 -0
  13. package/dist/cli/commands/context.js +149 -20
  14. package/dist/cli/commands/context.js.map +1 -1
  15. package/dist/cli/commands/create.d.ts +1 -0
  16. package/dist/cli/commands/create.js +5 -3
  17. package/dist/cli/commands/create.js.map +1 -1
  18. package/dist/cli/commands/extension.js +4 -2
  19. package/dist/cli/commands/extension.js.map +1 -1
  20. package/dist/cli/commands/health.js +44 -6
  21. package/dist/cli/commands/health.js.map +1 -1
  22. package/dist/cli/commands/history.js +6 -5
  23. package/dist/cli/commands/history.js.map +1 -1
  24. package/dist/cli/commands/linked-test-parsers.d.ts +1 -0
  25. package/dist/cli/commands/linked-test-parsers.js +289 -2
  26. package/dist/cli/commands/linked-test-parsers.js.map +1 -1
  27. package/dist/cli/commands/reindex.d.ts +1 -0
  28. package/dist/cli/commands/reindex.js +33 -4
  29. package/dist/cli/commands/reindex.js.map +1 -1
  30. package/dist/cli/commands/test.d.ts +6 -0
  31. package/dist/cli/commands/test.js +46 -5
  32. package/dist/cli/commands/test.js.map +1 -1
  33. package/dist/cli/extension-command-help.d.ts +1 -0
  34. package/dist/cli/extension-command-help.js +42 -2
  35. package/dist/cli/extension-command-help.js.map +1 -1
  36. package/dist/cli/extension-command-options.d.ts +2 -0
  37. package/dist/cli/extension-command-options.js +89 -17
  38. package/dist/cli/extension-command-options.js.map +1 -1
  39. package/dist/cli/main.js +26 -26
  40. package/dist/cli/main.js.map +1 -1
  41. package/dist/cli/register-list-query.js +3 -2
  42. package/dist/cli/register-list-query.js.map +1 -1
  43. package/dist/cli/register-mutation.js +4 -2
  44. package/dist/cli/register-mutation.js.map +1 -1
  45. package/dist/cli/register-operations.js +15 -6
  46. package/dist/cli/register-operations.js.map +1 -1
  47. package/dist/cli/registration-helpers.js +9 -2
  48. package/dist/cli/registration-helpers.js.map +1 -1
  49. package/dist/cli-bundle/chunks/activity-5QLX6DHN.js +16 -0
  50. package/dist/cli-bundle/chunks/{activity-Q7XMIZIH.js → activity-W6TS5F2L.js} +11 -11
  51. package/dist/cli-bundle/chunks/{aggregate-GBSHSXOB.js → aggregate-NNJLKGEK.js} +64 -24
  52. package/dist/cli-bundle/chunks/aggregate-NNJLKGEK.js.map +7 -0
  53. package/dist/cli-bundle/chunks/{aggregate-HKQJZUBG.js → aggregate-UK2WJ4Z3.js} +65 -25
  54. package/dist/cli-bundle/chunks/aggregate-UK2WJ4Z3.js.map +1 -0
  55. package/dist/cli-bundle/chunks/{append-3RFOU7P5.js → append-7BS36Z2L.js} +8 -8
  56. package/dist/cli-bundle/chunks/{append-OM74OJVT.js → append-DHGTLUZW.js} +8 -8
  57. package/dist/cli-bundle/chunks/{chunk-SDLEYY6A.js → chunk-2MKBPWMK.js} +6 -8
  58. package/dist/cli-bundle/chunks/{chunk-SDLEYY6A.js.map → chunk-2MKBPWMK.js.map} +1 -1
  59. package/dist/cli-bundle/chunks/{chunk-Z2HXAFFH.js → chunk-344GDQTH.js} +2 -2
  60. package/dist/cli-bundle/chunks/{chunk-AEMKH5WQ.js → chunk-3VTWCBXL.js} +3 -3
  61. package/dist/cli-bundle/chunks/{chunk-XLSQ3QLT.js → chunk-4CYHWHZU.js} +2 -2
  62. package/dist/cli-bundle/chunks/{chunk-JS47EKLP.js → chunk-4H2NDEGJ.js} +7 -7
  63. package/dist/cli-bundle/chunks/{chunk-QF4OPBAG.js → chunk-5HH6QRH5.js} +9 -9
  64. package/dist/cli-bundle/chunks/{chunk-5NVJA7IW.js → chunk-5OMABP7I.js} +7 -7
  65. package/dist/cli-bundle/chunks/{chunk-YEFOCDIK.js → chunk-6ADVKPVV.js} +7 -7
  66. package/dist/cli-bundle/chunks/{chunk-SM3RMWGO.js → chunk-6KQS23TX.js} +8 -8
  67. package/dist/cli-bundle/chunks/{chunk-ETZZU5QF.js → chunk-6N46IM44.js} +2 -2
  68. package/dist/cli-bundle/chunks/{chunk-EPWT7BEA.js → chunk-6OSG3EMX.js} +157 -12
  69. package/dist/cli-bundle/chunks/chunk-6OSG3EMX.js.map +1 -0
  70. package/dist/cli-bundle/chunks/{chunk-5WO2VKFA.js → chunk-73PSHEMT.js} +8 -8
  71. package/dist/cli-bundle/chunks/{chunk-J4DKAGTM.js → chunk-7DUVDW7C.js} +3 -3
  72. package/dist/cli-bundle/chunks/{chunk-2BYKYPWY.js → chunk-7GYMMDDW.js} +2 -2
  73. package/dist/cli-bundle/chunks/{chunk-QFVASU44.js → chunk-7TW64BS5.js} +2 -2
  74. package/dist/cli-bundle/chunks/{chunk-VXBUXLVD.js → chunk-A6XVYNQJ.js} +13 -6
  75. package/dist/cli-bundle/chunks/chunk-A6XVYNQJ.js.map +7 -0
  76. package/dist/cli-bundle/chunks/{chunk-KP4KIUQT.js → chunk-ANVZCNL5.js} +3 -3
  77. package/dist/cli-bundle/chunks/{chunk-HOA3GMB6.js → chunk-BE5G7HEL.js} +14 -8
  78. package/dist/cli-bundle/chunks/chunk-BE5G7HEL.js.map +1 -0
  79. package/dist/cli-bundle/chunks/{chunk-QWNUDGFQ.js → chunk-CMEHZD6G.js} +163 -11
  80. package/dist/cli-bundle/chunks/chunk-CMEHZD6G.js.map +7 -0
  81. package/dist/cli-bundle/chunks/{chunk-7NQIY7Z6.js → chunk-CTW7QAHM.js} +6 -5
  82. package/dist/cli-bundle/chunks/chunk-CTW7QAHM.js.map +1 -0
  83. package/dist/cli-bundle/chunks/{chunk-UEXNNF3K.js → chunk-D6JZBUZ6.js} +7 -7
  84. package/dist/cli-bundle/chunks/{chunk-F33AQIB4.js → chunk-DEYNERFX.js} +19 -7
  85. package/dist/cli-bundle/chunks/chunk-DEYNERFX.js.map +1 -0
  86. package/dist/cli-bundle/chunks/{chunk-R4XIE7NQ.js → chunk-DMDEC4QP.js} +6 -6
  87. package/dist/cli-bundle/chunks/{chunk-KN4WSESY.js → chunk-DTRIVUTN.js} +5 -5
  88. package/dist/cli-bundle/chunks/{chunk-KS2U7BZ3.js → chunk-EAQLLID6.js} +16 -6
  89. package/dist/cli-bundle/chunks/chunk-EAQLLID6.js.map +1 -0
  90. package/dist/cli-bundle/chunks/{chunk-HP35AVFS.js → chunk-EIS32UA4.js} +2 -2
  91. package/dist/cli-bundle/chunks/chunk-F2PVV7IX.js +528 -0
  92. package/dist/cli-bundle/chunks/chunk-F2PVV7IX.js.map +7 -0
  93. package/dist/cli-bundle/chunks/{chunk-DV27WDA7.js → chunk-GF5XIBUH.js} +70 -9
  94. package/dist/cli-bundle/chunks/chunk-GF5XIBUH.js.map +7 -0
  95. package/dist/cli-bundle/chunks/{chunk-BFJPMUF5.js → chunk-GP6SHEAI.js} +5 -5
  96. package/dist/cli-bundle/chunks/{chunk-URJEZOLB.js → chunk-GRHPU6EM.js} +2 -2
  97. package/dist/cli-bundle/chunks/{chunk-K62SNVVE.js → chunk-I2FM2SMO.js} +2 -2
  98. package/dist/cli-bundle/chunks/{chunk-F33VC5EX.js → chunk-IEQ3N7WP.js} +12 -5
  99. package/dist/cli-bundle/chunks/chunk-IEQ3N7WP.js.map +1 -0
  100. package/dist/cli-bundle/chunks/{chunk-AXBUHLW7.js → chunk-K45NAJV2.js} +9 -9
  101. package/dist/cli-bundle/chunks/{chunk-NLVCMVC7.js → chunk-K7SXBA75.js} +2 -2
  102. package/dist/cli-bundle/chunks/{chunk-OVSSE2JP.js → chunk-KHBRV5JU.js} +14 -12
  103. package/dist/cli-bundle/chunks/chunk-KHBRV5JU.js.map +1 -0
  104. package/dist/cli-bundle/chunks/{chunk-D7WK2PKB.js → chunk-KMMUDSSB.js} +112 -7
  105. package/dist/cli-bundle/chunks/chunk-KMMUDSSB.js.map +1 -0
  106. package/dist/cli-bundle/chunks/{chunk-ALSRBNYB.js → chunk-KRZQGRVL.js} +14 -7
  107. package/dist/cli-bundle/chunks/chunk-KRZQGRVL.js.map +1 -0
  108. package/dist/cli-bundle/chunks/{chunk-PQDH3S54.js → chunk-LUJQJR7G.js} +71 -69
  109. package/dist/cli-bundle/chunks/{chunk-PQDH3S54.js.map → chunk-LUJQJR7G.js.map} +1 -1
  110. package/dist/cli-bundle/chunks/{chunk-NDSMKB2I.js → chunk-LYL32FT6.js} +3 -3
  111. package/dist/cli-bundle/chunks/{chunk-ODN53S6H.js → chunk-MF6KSSMF.js} +11 -14
  112. package/dist/cli-bundle/chunks/chunk-MF6KSSMF.js.map +1 -0
  113. package/dist/cli-bundle/chunks/{chunk-Z55JACL2.js → chunk-O64EYNHF.js} +6 -6
  114. package/dist/cli-bundle/chunks/{chunk-3TXWDGPU.js → chunk-OQGJSCZZ.js} +522 -37
  115. package/dist/cli-bundle/chunks/chunk-OQGJSCZZ.js.map +7 -0
  116. package/dist/cli-bundle/chunks/{chunk-FO2TYSQZ.js → chunk-OROMGSBP.js} +2 -2
  117. package/dist/cli-bundle/chunks/{chunk-3E3MDBTB.js → chunk-OSGWBWLK.js} +76 -74
  118. package/dist/cli-bundle/chunks/{chunk-3E3MDBTB.js.map → chunk-OSGWBWLK.js.map} +3 -3
  119. package/dist/cli-bundle/chunks/{chunk-7WXGR44E.js → chunk-OVNSQHDG.js} +19 -7
  120. package/dist/cli-bundle/chunks/chunk-OVNSQHDG.js.map +7 -0
  121. package/dist/cli-bundle/chunks/{chunk-XZS4MV37.js → chunk-PYULT32I.js} +2 -2
  122. package/dist/cli-bundle/chunks/{chunk-M7UBTVFT.js → chunk-Q6PSD5DZ.js} +3 -3
  123. package/dist/cli-bundle/chunks/{chunk-QQPZYP73.js → chunk-QGIWURY3.js} +12 -12
  124. package/dist/cli-bundle/chunks/{chunk-KCGMABHM.js → chunk-QJ2OIEOC.js} +68 -7
  125. package/dist/cli-bundle/chunks/chunk-QJ2OIEOC.js.map +1 -0
  126. package/dist/cli-bundle/chunks/{chunk-XEKZCBCS.js → chunk-SNASEDXB.js} +3 -3
  127. package/dist/cli-bundle/chunks/{chunk-4WYBLB6J.js → chunk-T6QLB34N.js} +3 -3
  128. package/dist/cli-bundle/chunks/{chunk-NGEEXR2R.js → chunk-TALBUVWF.js} +2 -2
  129. package/dist/cli-bundle/chunks/{chunk-FGRJZVXD.js → chunk-TV6FZGVK.js} +3 -3
  130. package/dist/cli-bundle/chunks/{chunk-MSH23UWO.js → chunk-TXWMLDMG.js} +13 -7
  131. package/dist/cli-bundle/chunks/chunk-TXWMLDMG.js.map +7 -0
  132. package/dist/cli-bundle/chunks/{chunk-TXKENAQP.js → chunk-TZLGCTA5.js} +5 -4
  133. package/dist/cli-bundle/chunks/chunk-TZLGCTA5.js.map +7 -0
  134. package/dist/cli-bundle/chunks/{chunk-4TI3532H.js → chunk-UDWUDUJI.js} +2 -2
  135. package/dist/cli-bundle/chunks/{chunk-N4SQZ7L3.js → chunk-UMWF6ZAS.js} +12 -5
  136. package/dist/cli-bundle/chunks/chunk-UMWF6ZAS.js.map +7 -0
  137. package/dist/cli-bundle/chunks/{chunk-BKQMJXWY.js → chunk-UNH3KSHG.js} +4 -6
  138. package/dist/cli-bundle/chunks/{chunk-BKQMJXWY.js.map → chunk-UNH3KSHG.js.map} +1 -1
  139. package/dist/cli-bundle/chunks/{chunk-CBJXWXI5.js → chunk-UY26RIBR.js} +2 -2
  140. package/dist/cli-bundle/chunks/{chunk-TBLBEOEX.js → chunk-VSS3CSTF.js} +9 -9
  141. package/dist/cli-bundle/chunks/{chunk-2YPVCD7T.js → chunk-WBU257Z4.js} +13 -11
  142. package/dist/cli-bundle/chunks/chunk-WBU257Z4.js.map +7 -0
  143. package/dist/cli-bundle/chunks/{chunk-YJAKN2N2.js → chunk-WNMRICXH.js} +489 -32
  144. package/dist/cli-bundle/chunks/chunk-WNMRICXH.js.map +1 -0
  145. package/dist/cli-bundle/chunks/chunk-WSWOQP3Z.js +518 -0
  146. package/dist/cli-bundle/chunks/chunk-WSWOQP3Z.js.map +1 -0
  147. package/dist/cli-bundle/chunks/{chunk-OTY2YEH5.js → chunk-WWEFBBVF.js} +12 -12
  148. package/dist/cli-bundle/chunks/{chunk-UMMJAJB2.js → chunk-X3IPJU2O.js} +9 -9
  149. package/dist/cli-bundle/chunks/{chunk-KBKJVXUS.js → chunk-X5YC5DZM.js} +111 -6
  150. package/dist/cli-bundle/chunks/chunk-X5YC5DZM.js.map +7 -0
  151. package/dist/cli-bundle/chunks/{chunk-KVXIQDJG.js → chunk-XH6RA5A5.js} +15 -15
  152. package/dist/cli-bundle/chunks/chunk-XH6RA5A5.js.map +1 -0
  153. package/dist/cli-bundle/chunks/{chunk-2HMD3JM2.js → chunk-XRE4CTNP.js} +11 -14
  154. package/dist/cli-bundle/chunks/chunk-XRE4CTNP.js.map +7 -0
  155. package/dist/cli-bundle/chunks/{chunk-RISLL7XH.js → chunk-XSCGU4WT.js} +15 -5
  156. package/dist/cli-bundle/chunks/{chunk-RISLL7XH.js.map → chunk-XSCGU4WT.js.map} +2 -2
  157. package/dist/cli-bundle/chunks/{chunk-L3LYL3ID.js → chunk-ZH7C7ZVX.js} +14 -14
  158. package/dist/cli-bundle/chunks/chunk-ZH7C7ZVX.js.map +7 -0
  159. package/dist/cli-bundle/chunks/{claim-NHBIIBOW.js → claim-3TY5LE54.js} +10 -10
  160. package/dist/cli-bundle/chunks/{claim-RNEBQCOO.js → claim-LM4YY6QQ.js} +10 -10
  161. package/dist/cli-bundle/chunks/{close-ZMXL2WDS.js → close-CSD4LEMT.js} +8 -8
  162. package/dist/cli-bundle/chunks/close-SIQCDOBR.js +13 -0
  163. package/dist/cli-bundle/chunks/{close-many-CDPQGQUB.js → close-many-B5SHDX6W.js} +17 -18
  164. package/dist/cli-bundle/chunks/{close-many-CDPQGQUB.js.map → close-many-B5SHDX6W.js.map} +1 -1
  165. package/dist/cli-bundle/chunks/{close-many-IQV5C2SI.js → close-many-WRXB5KVY.js} +15 -16
  166. package/dist/cli-bundle/chunks/{close-many-IQV5C2SI.js.map → close-many-WRXB5KVY.js.map} +1 -1
  167. package/dist/cli-bundle/chunks/{comments-J5Q4IJPH.js → comments-A5ALOYTG.js} +10 -10
  168. package/dist/cli-bundle/chunks/{comments-EFVBHWPT.js → comments-BDDEK3VW.js} +10 -10
  169. package/dist/cli-bundle/chunks/{config-72253M2O.js → config-W2NHDNQT.js} +8 -8
  170. package/dist/cli-bundle/chunks/{config-VFYA6BMI.js → config-YUYBMJOW.js} +8 -8
  171. package/dist/cli-bundle/chunks/{context-AVLO4IFH.js → context-LRJ74NSU.js} +147 -36
  172. package/dist/cli-bundle/chunks/context-LRJ74NSU.js.map +7 -0
  173. package/dist/cli-bundle/chunks/{context-WMSI2D65.js → context-R2QLOJCK.js} +148 -37
  174. package/dist/cli-bundle/chunks/context-R2QLOJCK.js.map +1 -0
  175. package/dist/cli-bundle/chunks/{contracts-D4BN3VSQ.js → contracts-47X7RYUF.js} +4 -4
  176. package/dist/cli-bundle/chunks/{contracts-RGPOBLPL.js → contracts-HJHR4NCD.js} +4 -4
  177. package/dist/cli-bundle/chunks/{copy-H6TXHK7S.js → copy-B7HFOWFB.js} +7 -7
  178. package/dist/cli-bundle/chunks/{copy-WXE3OOLZ.js → copy-P4UVYZ7M.js} +7 -7
  179. package/dist/cli-bundle/chunks/{create-PUAIJEZ7.js → create-5ERJF64D.js} +13 -13
  180. package/dist/cli-bundle/chunks/create-TXNRPS4K.js +27 -0
  181. package/dist/cli-bundle/chunks/{delete-WBME6WG5.js → delete-LX3LGBCH.js} +7 -7
  182. package/dist/cli-bundle/chunks/{delete-PKR2JHLH.js → delete-S3WVK6LP.js} +7 -7
  183. package/dist/cli-bundle/chunks/{deps-4BQEDV4L.js → deps-GWSNH7OZ.js} +7 -7
  184. package/dist/cli-bundle/chunks/{deps-KWHQRO75.js → deps-YSM4LZQD.js} +7 -7
  185. package/dist/cli-bundle/chunks/{docs-SCNBUGSV.js → docs-7RYFBHQD.js} +9 -9
  186. package/dist/cli-bundle/chunks/{docs-364GT3ZR.js → docs-TG6JMVMY.js} +9 -9
  187. package/dist/cli-bundle/chunks/{extension-KK2UPXJD.js → extension-R3LUKMX7.js} +5 -5
  188. package/dist/cli-bundle/chunks/{extension-CRE7JM47.js → extension-VNMRKIHI.js} +5 -5
  189. package/dist/cli-bundle/chunks/{files-66EHM5ZR.js → files-KAKU57OT.js} +9 -9
  190. package/dist/cli-bundle/chunks/{files-3GESQAWL.js → files-QB3EYPMO.js} +9 -9
  191. package/dist/cli-bundle/chunks/{gc-MOQDND5J.js → gc-B747VM4M.js} +3 -3
  192. package/dist/cli-bundle/chunks/{gc-D5IWOKQH.js → gc-KNUPLPSW.js} +3 -3
  193. package/dist/cli-bundle/chunks/{get-7J2ZCBV5.js → get-GMGLIQ5I.js} +11 -11
  194. package/dist/cli-bundle/chunks/{get-WXSLXV3K.js → get-SBL6NHYQ.js} +11 -11
  195. package/dist/cli-bundle/chunks/{health-B6AEM7BV.js → health-IG43Z4KL.js} +47 -19
  196. package/dist/cli-bundle/chunks/health-IG43Z4KL.js.map +1 -0
  197. package/dist/cli-bundle/chunks/{health-YMZGOMVX.js → health-WWZJ5KJS.js} +46 -18
  198. package/dist/cli-bundle/chunks/health-WWZJ5KJS.js.map +7 -0
  199. package/dist/cli-bundle/chunks/history-6UKSZTRT.js +20 -0
  200. package/dist/cli-bundle/chunks/{history-TJTO5GCR.js → history-XCWRXBXC.js} +10 -10
  201. package/dist/cli-bundle/chunks/{history-compact-CKNN6UKW.js → history-compact-IDH7E7VN.js} +11 -11
  202. package/dist/cli-bundle/chunks/{history-compact-N2Q7IR3T.js → history-compact-KICKUCR7.js} +11 -11
  203. package/dist/cli-bundle/chunks/history-redact-HKYBTK6X.js +19 -0
  204. package/dist/cli-bundle/chunks/{history-redact-JUXUOH54.js → history-redact-JJWH3QWK.js} +11 -11
  205. package/dist/cli-bundle/chunks/{history-repair-TDBBSRVK.js → history-repair-7HWBZKXN.js} +11 -11
  206. package/dist/cli-bundle/chunks/{history-repair-CCCPBNTF.js → history-repair-N5HXKJOI.js} +11 -11
  207. package/dist/cli-bundle/chunks/init-27JLDUO2.js +17 -0
  208. package/dist/cli-bundle/chunks/{init-6ZPKD3YN.js → init-OQA3TWIS.js} +9 -9
  209. package/dist/cli-bundle/chunks/{learnings-WYNTYQ5T.js → learnings-L7VQUSVI.js} +10 -10
  210. package/dist/cli-bundle/chunks/{learnings-U7U2FNIO.js → learnings-Z4GAIZQ5.js} +10 -10
  211. package/dist/cli-bundle/chunks/list-6U3CJVXS.js +19 -0
  212. package/dist/cli-bundle/chunks/{list-JGP7ODML.js → list-W5ROBC5U.js} +10 -11
  213. package/dist/cli-bundle/chunks/{notes-P25YVTEG.js → notes-JJDOEDFK.js} +10 -10
  214. package/dist/cli-bundle/chunks/{notes-QIF6A7XS.js → notes-SDCK7BEN.js} +10 -10
  215. package/dist/cli-bundle/chunks/{plan-RACB5PI6.js → plan-H5HYHMBB.js} +13 -13
  216. package/dist/cli-bundle/chunks/{plan-SSBJFWXA.js → plan-W2B5RYR3.js} +13 -13
  217. package/dist/cli-bundle/chunks/{register-list-query-GQAEIG4K.js → register-list-query-QGRFMDWA.js} +20 -20
  218. package/dist/cli-bundle/chunks/register-list-query-QGRFMDWA.js.map +7 -0
  219. package/dist/cli-bundle/chunks/{register-list-query-5IXDPUZ6.js → register-list-query-V4S23735.js} +21 -21
  220. package/dist/cli-bundle/chunks/register-list-query-V4S23735.js.map +1 -0
  221. package/dist/cli-bundle/chunks/{register-mutation-FAS4YG63.js → register-mutation-I57PLUHA.js} +36 -35
  222. package/dist/cli-bundle/chunks/register-mutation-I57PLUHA.js.map +1 -0
  223. package/dist/cli-bundle/chunks/{register-mutation-YZCUILGO.js → register-mutation-ZPZNJXSA.js} +35 -34
  224. package/dist/cli-bundle/chunks/register-mutation-ZPZNJXSA.js.map +7 -0
  225. package/dist/cli-bundle/chunks/{register-operations-S2BOLUPF.js → register-operations-KAMLXAF5.js} +42 -37
  226. package/dist/cli-bundle/chunks/register-operations-KAMLXAF5.js.map +1 -0
  227. package/dist/cli-bundle/chunks/{register-operations-IBYWNJN5.js → register-operations-YEN4YEZ2.js} +41 -36
  228. package/dist/cli-bundle/chunks/register-operations-YEN4YEZ2.js.map +7 -0
  229. package/dist/cli-bundle/chunks/{register-setup-JRZ4UMWZ.js → register-setup-BZ3TNE3G.js} +15 -15
  230. package/dist/cli-bundle/chunks/{register-setup-ABA2JPWO.js → register-setup-WLFL3OUF.js} +15 -15
  231. package/dist/cli-bundle/chunks/restore-GNI2W5CN.js +17 -0
  232. package/dist/cli-bundle/chunks/{restore-K72ZNPEP.js → restore-RGFSPG4K.js} +11 -11
  233. package/dist/cli-bundle/chunks/{schema-UL4B2JX5.js → schema-CCDU3RLC.js} +8 -8
  234. package/dist/cli-bundle/chunks/{schema-3VKRDBLC.js → schema-KZASL323.js} +8 -8
  235. package/dist/cli-bundle/chunks/{search-632WJ7GO.js → search-7KSOLI2E.js} +10 -11
  236. package/dist/cli-bundle/chunks/{search-632WJ7GO.js.map → search-7KSOLI2E.js.map} +1 -1
  237. package/dist/cli-bundle/chunks/{search-EQDHSE4G.js → search-DTL7CO22.js} +12 -13
  238. package/dist/cli-bundle/chunks/{search-EQDHSE4G.js.map → search-DTL7CO22.js.map} +1 -1
  239. package/dist/cli-bundle/chunks/{stats-WLJ3XBF5.js → stats-IOXQMGI6.js} +7 -7
  240. package/dist/cli-bundle/chunks/{stats-O4UTMJMC.js → stats-QNV7B2CE.js} +7 -7
  241. package/dist/cli-bundle/chunks/{telemetry-EUVHFSQU.js → telemetry-IV5C6JOM.js} +4 -4
  242. package/dist/cli-bundle/chunks/{telemetry-NRVWX25E.js → telemetry-NHR5RFXT.js} +4 -4
  243. package/dist/cli-bundle/chunks/test-4Z37CXW4.js +32 -0
  244. package/dist/cli-bundle/chunks/{test-GXUBQNUC.js → test-PIL2CEEB.js} +14 -14
  245. package/dist/cli-bundle/chunks/{test-all-UTFXC7S2.js → test-all-GRLYHBNP.js} +14 -14
  246. package/dist/cli-bundle/chunks/{test-all-XM6OKI3L.js → test-all-MFN4MYCV.js} +14 -14
  247. package/dist/cli-bundle/chunks/{test-runs-IK6E2HNX.js → test-runs-7LRFWWCA.js} +5 -5
  248. package/dist/cli-bundle/chunks/{test-runs-7FHCPEA3.js → test-runs-7WCSC3TY.js} +5 -5
  249. package/dist/cli-bundle/chunks/update-I4G34LKJ.js +21 -0
  250. package/dist/cli-bundle/chunks/{update-U4B4OMHZ.js → update-VI5DBZ3G.js} +15 -15
  251. package/dist/cli-bundle/chunks/{update-many-5KD33MKY.js → update-many-LOTAYUTN.js} +22 -23
  252. package/dist/cli-bundle/chunks/{update-many-5KD33MKY.js.map → update-many-LOTAYUTN.js.map} +1 -1
  253. package/dist/cli-bundle/chunks/{update-many-N3YTM7K4.js → update-many-UYMTVF42.js} +24 -25
  254. package/dist/cli-bundle/chunks/{update-many-N3YTM7K4.js.map → update-many-UYMTVF42.js.map} +1 -1
  255. package/dist/cli-bundle/chunks/{upgrade-FFXGO43H.js → upgrade-LT2MLLPS.js} +5 -5
  256. package/dist/cli-bundle/chunks/{upgrade-5SRFLUNW.js → upgrade-ZZSC7CLV.js} +5 -5
  257. package/dist/cli-bundle/chunks/{validate-T3LPWSZG.js → validate-3XRORNMP.js} +16 -16
  258. package/dist/cli-bundle/chunks/{validate-CRWXZILW.js → validate-IQIQSKUX.js} +16 -16
  259. package/dist/cli-bundle/main.js +157 -62
  260. package/dist/cli-bundle/main.js.map +2 -2
  261. package/dist/core/diagnostics/remediation.js +12 -2
  262. package/dist/core/diagnostics/remediation.js.map +1 -1
  263. package/dist/core/extensions/extension-policy.d.ts +14 -1
  264. package/dist/core/extensions/extension-policy.js +38 -3
  265. package/dist/core/extensions/extension-policy.js.map +1 -1
  266. package/dist/core/extensions/extension-types.d.ts +99 -2
  267. package/dist/core/extensions/extension-types.js +28 -2
  268. package/dist/core/extensions/extension-types.js.map +1 -1
  269. package/dist/core/extensions/flag-value-types.d.ts +29 -0
  270. package/dist/core/extensions/flag-value-types.js +78 -0
  271. package/dist/core/extensions/flag-value-types.js.map +1 -0
  272. package/dist/core/extensions/item-field-types.d.ts +22 -0
  273. package/dist/core/extensions/item-field-types.js +43 -0
  274. package/dist/core/extensions/item-field-types.js.map +1 -0
  275. package/dist/core/extensions/item-fields.js +4 -11
  276. package/dist/core/extensions/item-fields.js.map +1 -1
  277. package/dist/core/extensions/loader.d.ts +16 -1
  278. package/dist/core/extensions/loader.js +202 -18
  279. package/dist/core/extensions/loader.js.map +1 -1
  280. package/dist/core/history/replay.d.ts +1 -1
  281. package/dist/core/history/replay.js +13 -4
  282. package/dist/core/history/replay.js.map +1 -1
  283. package/dist/core/output/mutation-projection.d.ts +2 -0
  284. package/dist/core/output/mutation-projection.js +9 -2
  285. package/dist/core/output/mutation-projection.js.map +1 -1
  286. package/dist/core/output/output.d.ts +2 -0
  287. package/dist/core/output/output.js +7 -3
  288. package/dist/core/output/output.js.map +1 -1
  289. package/dist/core/packages/manifest.d.ts +1 -1
  290. package/dist/core/packages/manifest.js +12 -2
  291. package/dist/core/packages/manifest.js.map +1 -1
  292. package/dist/core/shared/command-types.d.ts +1 -0
  293. package/dist/core/shared/command-types.js +2 -2
  294. package/dist/core/shared/command-types.js.map +1 -1
  295. package/dist/core/shared/constants.js +7 -4
  296. package/dist/core/shared/constants.js.map +1 -1
  297. package/dist/core/store/item-store.d.ts +1 -1
  298. package/dist/core/store/item-store.js +3 -3
  299. package/dist/core/store/item-store.js.map +1 -1
  300. package/dist/core/store/settings-read-cache.d.ts +15 -0
  301. package/dist/core/store/settings-read-cache.js +72 -0
  302. package/dist/core/store/settings-read-cache.js.map +1 -0
  303. package/dist/core/store/settings-validator.d.ts +4 -1
  304. package/dist/core/store/settings-validator.js +14 -2
  305. package/dist/core/store/settings-validator.js.map +1 -1
  306. package/dist/core/store/settings.js +166 -16
  307. package/dist/core/store/settings.js.map +1 -1
  308. package/dist/core/telemetry/runtime.d.ts +1 -0
  309. package/dist/core/telemetry/runtime.js +3 -3
  310. package/dist/core/telemetry/runtime.js.map +1 -1
  311. package/dist/core/test/run-selectors.d.ts +27 -0
  312. package/dist/core/test/run-selectors.js +110 -0
  313. package/dist/core/test/run-selectors.js.map +1 -0
  314. package/dist/mcp/server.js +105 -40
  315. package/dist/mcp/server.js.map +1 -1
  316. package/dist/sdk/cli-contracts/commander-mutation-options.js +3 -2
  317. package/dist/sdk/cli-contracts/commander-mutation-options.js.map +1 -1
  318. package/dist/sdk/cli-contracts/tool-option-contracts.js +3 -2
  319. package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
  320. package/dist/sdk/cli-contracts/tool-parameter-tables.js +29 -2
  321. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  322. package/dist/sdk/cli-contracts.js +37 -5
  323. package/dist/sdk/cli-contracts.js.map +1 -1
  324. package/dist/sdk/index.d.ts +7 -2
  325. package/dist/sdk/index.js +3 -3
  326. package/dist/sdk/index.js.map +1 -1
  327. package/dist/sdk/runtime.d.ts +6 -0
  328. package/dist/sdk/runtime.js +51 -3
  329. package/dist/sdk/runtime.js.map +1 -1
  330. package/dist/sdk/testing.d.ts +55 -1
  331. package/dist/sdk/testing.js +92 -2
  332. package/dist/sdk/testing.js.map +1 -1
  333. package/dist/types.d.ts +4 -1
  334. package/dist/types.js +4 -2
  335. package/dist/types.js.map +1 -1
  336. package/docs/AGENT_GUIDE.md +7 -1
  337. package/docs/ARCHITECTURE.md +7 -0
  338. package/docs/COMMANDS.md +37 -3
  339. package/docs/CONFIGURATION.md +1 -1
  340. package/docs/EXTENSIONS.md +59 -53
  341. package/docs/SDK.md +104 -0
  342. package/docs/TESTING.md +60 -0
  343. package/docs/schemas/extension-manifest.schema.json +120 -0
  344. package/package.json +2 -2
  345. package/packages/pm-beads/extensions/beads/manifest.json +10 -0
  346. package/packages/pm-calendar/extensions/calendar/manifest.json +10 -0
  347. package/packages/pm-command-kit/README.md +72 -0
  348. package/packages/pm-command-kit/extensions/command-kit/index.js +181 -0
  349. package/packages/pm-command-kit/extensions/command-kit/index.ts +176 -0
  350. package/packages/pm-command-kit/extensions/command-kit/manifest.json +22 -0
  351. package/packages/pm-command-kit/package.json +53 -0
  352. package/packages/pm-governance-audit/extensions/governance-audit/manifest.json +10 -0
  353. package/packages/pm-guide-shell/extensions/guide-shell/manifest.json +10 -0
  354. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/manifest.json +10 -0
  355. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/manifest.json +10 -0
  356. package/packages/pm-search-advanced/extensions/search-advanced/index.js +6 -0
  357. package/packages/pm-search-advanced/extensions/search-advanced/index.ts +6 -0
  358. package/packages/pm-search-advanced/extensions/search-advanced/manifest.json +10 -0
  359. package/packages/pm-search-advanced/extensions/search-advanced/runtime.js +1 -0
  360. package/packages/pm-search-advanced/extensions/search-advanced/runtime.ts +1 -0
  361. package/packages/pm-templates/extensions/templates/manifest.json +10 -0
  362. package/packages/pm-todos/extensions/todos/manifest.json +10 -0
  363. package/dist/cli-bundle/chunks/activity-A3QKFSSF.js +0 -16
  364. package/dist/cli-bundle/chunks/aggregate-GBSHSXOB.js.map +0 -7
  365. package/dist/cli-bundle/chunks/aggregate-HKQJZUBG.js.map +0 -1
  366. package/dist/cli-bundle/chunks/chunk-2HMD3JM2.js.map +0 -7
  367. package/dist/cli-bundle/chunks/chunk-2YPVCD7T.js.map +0 -7
  368. package/dist/cli-bundle/chunks/chunk-3TXWDGPU.js.map +0 -7
  369. package/dist/cli-bundle/chunks/chunk-7NQIY7Z6.js.map +0 -1
  370. package/dist/cli-bundle/chunks/chunk-7WXGR44E.js.map +0 -7
  371. package/dist/cli-bundle/chunks/chunk-ALSRBNYB.js.map +0 -1
  372. package/dist/cli-bundle/chunks/chunk-D7WK2PKB.js.map +0 -1
  373. package/dist/cli-bundle/chunks/chunk-DV27WDA7.js.map +0 -7
  374. package/dist/cli-bundle/chunks/chunk-EAOG77HM.js +0 -56
  375. package/dist/cli-bundle/chunks/chunk-EAOG77HM.js.map +0 -7
  376. package/dist/cli-bundle/chunks/chunk-EPWT7BEA.js.map +0 -1
  377. package/dist/cli-bundle/chunks/chunk-F33AQIB4.js.map +0 -1
  378. package/dist/cli-bundle/chunks/chunk-F33VC5EX.js.map +0 -1
  379. package/dist/cli-bundle/chunks/chunk-HOA3GMB6.js.map +0 -1
  380. package/dist/cli-bundle/chunks/chunk-KBKJVXUS.js.map +0 -7
  381. package/dist/cli-bundle/chunks/chunk-KCGMABHM.js.map +0 -1
  382. package/dist/cli-bundle/chunks/chunk-KS2U7BZ3.js.map +0 -1
  383. package/dist/cli-bundle/chunks/chunk-KVXIQDJG.js.map +0 -1
  384. package/dist/cli-bundle/chunks/chunk-L3LYL3ID.js.map +0 -7
  385. package/dist/cli-bundle/chunks/chunk-MSH23UWO.js.map +0 -7
  386. package/dist/cli-bundle/chunks/chunk-N4SQZ7L3.js.map +0 -7
  387. package/dist/cli-bundle/chunks/chunk-NUKHZZNM.js +0 -252
  388. package/dist/cli-bundle/chunks/chunk-NUKHZZNM.js.map +0 -7
  389. package/dist/cli-bundle/chunks/chunk-ODN53S6H.js.map +0 -1
  390. package/dist/cli-bundle/chunks/chunk-OVSSE2JP.js.map +0 -1
  391. package/dist/cli-bundle/chunks/chunk-QWNUDGFQ.js.map +0 -7
  392. package/dist/cli-bundle/chunks/chunk-TXKENAQP.js.map +0 -7
  393. package/dist/cli-bundle/chunks/chunk-VXBUXLVD.js.map +0 -7
  394. package/dist/cli-bundle/chunks/chunk-XNGMIVQY.js +0 -242
  395. package/dist/cli-bundle/chunks/chunk-XNGMIVQY.js.map +0 -1
  396. package/dist/cli-bundle/chunks/chunk-XSLQSXAH.js +0 -53
  397. package/dist/cli-bundle/chunks/chunk-XSLQSXAH.js.map +0 -1
  398. package/dist/cli-bundle/chunks/chunk-YJAKN2N2.js.map +0 -1
  399. package/dist/cli-bundle/chunks/close-UNTFXVM3.js +0 -13
  400. package/dist/cli-bundle/chunks/context-AVLO4IFH.js.map +0 -7
  401. package/dist/cli-bundle/chunks/context-WMSI2D65.js.map +0 -1
  402. package/dist/cli-bundle/chunks/create-EZWAMUKR.js +0 -27
  403. package/dist/cli-bundle/chunks/health-B6AEM7BV.js.map +0 -1
  404. package/dist/cli-bundle/chunks/health-YMZGOMVX.js.map +0 -7
  405. package/dist/cli-bundle/chunks/history-ZERISU2L.js +0 -20
  406. package/dist/cli-bundle/chunks/history-redact-GODBYT5A.js +0 -19
  407. package/dist/cli-bundle/chunks/init-CBZHXBR3.js +0 -17
  408. package/dist/cli-bundle/chunks/list-7MTPPZHC.js +0 -20
  409. package/dist/cli-bundle/chunks/register-list-query-5IXDPUZ6.js.map +0 -1
  410. package/dist/cli-bundle/chunks/register-list-query-GQAEIG4K.js.map +0 -7
  411. package/dist/cli-bundle/chunks/register-mutation-FAS4YG63.js.map +0 -1
  412. package/dist/cli-bundle/chunks/register-mutation-YZCUILGO.js.map +0 -7
  413. package/dist/cli-bundle/chunks/register-operations-IBYWNJN5.js.map +0 -7
  414. package/dist/cli-bundle/chunks/register-operations-S2BOLUPF.js.map +0 -1
  415. package/dist/cli-bundle/chunks/restore-3JRX27QW.js +0 -17
  416. package/dist/cli-bundle/chunks/test-XN7RJL5Z.js +0 -32
  417. package/dist/cli-bundle/chunks/update-LFBSEW3N.js +0 -21
  418. /package/dist/cli-bundle/chunks/{activity-A3QKFSSF.js.map → activity-5QLX6DHN.js.map} +0 -0
  419. /package/dist/cli-bundle/chunks/{activity-Q7XMIZIH.js.map → activity-W6TS5F2L.js.map} +0 -0
  420. /package/dist/cli-bundle/chunks/{append-3RFOU7P5.js.map → append-7BS36Z2L.js.map} +0 -0
  421. /package/dist/cli-bundle/chunks/{append-OM74OJVT.js.map → append-DHGTLUZW.js.map} +0 -0
  422. /package/dist/cli-bundle/chunks/{chunk-Z2HXAFFH.js.map → chunk-344GDQTH.js.map} +0 -0
  423. /package/dist/cli-bundle/chunks/{chunk-AEMKH5WQ.js.map → chunk-3VTWCBXL.js.map} +0 -0
  424. /package/dist/cli-bundle/chunks/{chunk-XLSQ3QLT.js.map → chunk-4CYHWHZU.js.map} +0 -0
  425. /package/dist/cli-bundle/chunks/{chunk-JS47EKLP.js.map → chunk-4H2NDEGJ.js.map} +0 -0
  426. /package/dist/cli-bundle/chunks/{chunk-QF4OPBAG.js.map → chunk-5HH6QRH5.js.map} +0 -0
  427. /package/dist/cli-bundle/chunks/{chunk-5NVJA7IW.js.map → chunk-5OMABP7I.js.map} +0 -0
  428. /package/dist/cli-bundle/chunks/{chunk-YEFOCDIK.js.map → chunk-6ADVKPVV.js.map} +0 -0
  429. /package/dist/cli-bundle/chunks/{chunk-SM3RMWGO.js.map → chunk-6KQS23TX.js.map} +0 -0
  430. /package/dist/cli-bundle/chunks/{chunk-ETZZU5QF.js.map → chunk-6N46IM44.js.map} +0 -0
  431. /package/dist/cli-bundle/chunks/{chunk-5WO2VKFA.js.map → chunk-73PSHEMT.js.map} +0 -0
  432. /package/dist/cli-bundle/chunks/{chunk-J4DKAGTM.js.map → chunk-7DUVDW7C.js.map} +0 -0
  433. /package/dist/cli-bundle/chunks/{chunk-2BYKYPWY.js.map → chunk-7GYMMDDW.js.map} +0 -0
  434. /package/dist/cli-bundle/chunks/{chunk-QFVASU44.js.map → chunk-7TW64BS5.js.map} +0 -0
  435. /package/dist/cli-bundle/chunks/{chunk-KP4KIUQT.js.map → chunk-ANVZCNL5.js.map} +0 -0
  436. /package/dist/cli-bundle/chunks/{chunk-UEXNNF3K.js.map → chunk-D6JZBUZ6.js.map} +0 -0
  437. /package/dist/cli-bundle/chunks/{chunk-R4XIE7NQ.js.map → chunk-DMDEC4QP.js.map} +0 -0
  438. /package/dist/cli-bundle/chunks/{chunk-KN4WSESY.js.map → chunk-DTRIVUTN.js.map} +0 -0
  439. /package/dist/cli-bundle/chunks/{chunk-HP35AVFS.js.map → chunk-EIS32UA4.js.map} +0 -0
  440. /package/dist/cli-bundle/chunks/{chunk-BFJPMUF5.js.map → chunk-GP6SHEAI.js.map} +0 -0
  441. /package/dist/cli-bundle/chunks/{chunk-URJEZOLB.js.map → chunk-GRHPU6EM.js.map} +0 -0
  442. /package/dist/cli-bundle/chunks/{chunk-K62SNVVE.js.map → chunk-I2FM2SMO.js.map} +0 -0
  443. /package/dist/cli-bundle/chunks/{chunk-AXBUHLW7.js.map → chunk-K45NAJV2.js.map} +0 -0
  444. /package/dist/cli-bundle/chunks/{chunk-NLVCMVC7.js.map → chunk-K7SXBA75.js.map} +0 -0
  445. /package/dist/cli-bundle/chunks/{chunk-NDSMKB2I.js.map → chunk-LYL32FT6.js.map} +0 -0
  446. /package/dist/cli-bundle/chunks/{chunk-Z55JACL2.js.map → chunk-O64EYNHF.js.map} +0 -0
  447. /package/dist/cli-bundle/chunks/{chunk-FO2TYSQZ.js.map → chunk-OROMGSBP.js.map} +0 -0
  448. /package/dist/cli-bundle/chunks/{chunk-XZS4MV37.js.map → chunk-PYULT32I.js.map} +0 -0
  449. /package/dist/cli-bundle/chunks/{chunk-M7UBTVFT.js.map → chunk-Q6PSD5DZ.js.map} +0 -0
  450. /package/dist/cli-bundle/chunks/{chunk-QQPZYP73.js.map → chunk-QGIWURY3.js.map} +0 -0
  451. /package/dist/cli-bundle/chunks/{chunk-XEKZCBCS.js.map → chunk-SNASEDXB.js.map} +0 -0
  452. /package/dist/cli-bundle/chunks/{chunk-4WYBLB6J.js.map → chunk-T6QLB34N.js.map} +0 -0
  453. /package/dist/cli-bundle/chunks/{chunk-NGEEXR2R.js.map → chunk-TALBUVWF.js.map} +0 -0
  454. /package/dist/cli-bundle/chunks/{chunk-FGRJZVXD.js.map → chunk-TV6FZGVK.js.map} +0 -0
  455. /package/dist/cli-bundle/chunks/{chunk-4TI3532H.js.map → chunk-UDWUDUJI.js.map} +0 -0
  456. /package/dist/cli-bundle/chunks/{chunk-CBJXWXI5.js.map → chunk-UY26RIBR.js.map} +0 -0
  457. /package/dist/cli-bundle/chunks/{chunk-TBLBEOEX.js.map → chunk-VSS3CSTF.js.map} +0 -0
  458. /package/dist/cli-bundle/chunks/{chunk-OTY2YEH5.js.map → chunk-WWEFBBVF.js.map} +0 -0
  459. /package/dist/cli-bundle/chunks/{chunk-UMMJAJB2.js.map → chunk-X3IPJU2O.js.map} +0 -0
  460. /package/dist/cli-bundle/chunks/{claim-NHBIIBOW.js.map → claim-3TY5LE54.js.map} +0 -0
  461. /package/dist/cli-bundle/chunks/{claim-RNEBQCOO.js.map → claim-LM4YY6QQ.js.map} +0 -0
  462. /package/dist/cli-bundle/chunks/{close-ZMXL2WDS.js.map → close-CSD4LEMT.js.map} +0 -0
  463. /package/dist/cli-bundle/chunks/{close-UNTFXVM3.js.map → close-SIQCDOBR.js.map} +0 -0
  464. /package/dist/cli-bundle/chunks/{comments-J5Q4IJPH.js.map → comments-A5ALOYTG.js.map} +0 -0
  465. /package/dist/cli-bundle/chunks/{comments-EFVBHWPT.js.map → comments-BDDEK3VW.js.map} +0 -0
  466. /package/dist/cli-bundle/chunks/{config-72253M2O.js.map → config-W2NHDNQT.js.map} +0 -0
  467. /package/dist/cli-bundle/chunks/{config-VFYA6BMI.js.map → config-YUYBMJOW.js.map} +0 -0
  468. /package/dist/cli-bundle/chunks/{contracts-D4BN3VSQ.js.map → contracts-47X7RYUF.js.map} +0 -0
  469. /package/dist/cli-bundle/chunks/{contracts-RGPOBLPL.js.map → contracts-HJHR4NCD.js.map} +0 -0
  470. /package/dist/cli-bundle/chunks/{copy-H6TXHK7S.js.map → copy-B7HFOWFB.js.map} +0 -0
  471. /package/dist/cli-bundle/chunks/{copy-WXE3OOLZ.js.map → copy-P4UVYZ7M.js.map} +0 -0
  472. /package/dist/cli-bundle/chunks/{create-PUAIJEZ7.js.map → create-5ERJF64D.js.map} +0 -0
  473. /package/dist/cli-bundle/chunks/{create-EZWAMUKR.js.map → create-TXNRPS4K.js.map} +0 -0
  474. /package/dist/cli-bundle/chunks/{delete-WBME6WG5.js.map → delete-LX3LGBCH.js.map} +0 -0
  475. /package/dist/cli-bundle/chunks/{delete-PKR2JHLH.js.map → delete-S3WVK6LP.js.map} +0 -0
  476. /package/dist/cli-bundle/chunks/{deps-4BQEDV4L.js.map → deps-GWSNH7OZ.js.map} +0 -0
  477. /package/dist/cli-bundle/chunks/{deps-KWHQRO75.js.map → deps-YSM4LZQD.js.map} +0 -0
  478. /package/dist/cli-bundle/chunks/{docs-SCNBUGSV.js.map → docs-7RYFBHQD.js.map} +0 -0
  479. /package/dist/cli-bundle/chunks/{docs-364GT3ZR.js.map → docs-TG6JMVMY.js.map} +0 -0
  480. /package/dist/cli-bundle/chunks/{extension-KK2UPXJD.js.map → extension-R3LUKMX7.js.map} +0 -0
  481. /package/dist/cli-bundle/chunks/{extension-CRE7JM47.js.map → extension-VNMRKIHI.js.map} +0 -0
  482. /package/dist/cli-bundle/chunks/{files-66EHM5ZR.js.map → files-KAKU57OT.js.map} +0 -0
  483. /package/dist/cli-bundle/chunks/{files-3GESQAWL.js.map → files-QB3EYPMO.js.map} +0 -0
  484. /package/dist/cli-bundle/chunks/{gc-MOQDND5J.js.map → gc-B747VM4M.js.map} +0 -0
  485. /package/dist/cli-bundle/chunks/{gc-D5IWOKQH.js.map → gc-KNUPLPSW.js.map} +0 -0
  486. /package/dist/cli-bundle/chunks/{get-7J2ZCBV5.js.map → get-GMGLIQ5I.js.map} +0 -0
  487. /package/dist/cli-bundle/chunks/{get-WXSLXV3K.js.map → get-SBL6NHYQ.js.map} +0 -0
  488. /package/dist/cli-bundle/chunks/{history-ZERISU2L.js.map → history-6UKSZTRT.js.map} +0 -0
  489. /package/dist/cli-bundle/chunks/{history-TJTO5GCR.js.map → history-XCWRXBXC.js.map} +0 -0
  490. /package/dist/cli-bundle/chunks/{history-compact-CKNN6UKW.js.map → history-compact-IDH7E7VN.js.map} +0 -0
  491. /package/dist/cli-bundle/chunks/{history-compact-N2Q7IR3T.js.map → history-compact-KICKUCR7.js.map} +0 -0
  492. /package/dist/cli-bundle/chunks/{history-redact-GODBYT5A.js.map → history-redact-HKYBTK6X.js.map} +0 -0
  493. /package/dist/cli-bundle/chunks/{history-redact-JUXUOH54.js.map → history-redact-JJWH3QWK.js.map} +0 -0
  494. /package/dist/cli-bundle/chunks/{history-repair-TDBBSRVK.js.map → history-repair-7HWBZKXN.js.map} +0 -0
  495. /package/dist/cli-bundle/chunks/{history-repair-CCCPBNTF.js.map → history-repair-N5HXKJOI.js.map} +0 -0
  496. /package/dist/cli-bundle/chunks/{init-CBZHXBR3.js.map → init-27JLDUO2.js.map} +0 -0
  497. /package/dist/cli-bundle/chunks/{init-6ZPKD3YN.js.map → init-OQA3TWIS.js.map} +0 -0
  498. /package/dist/cli-bundle/chunks/{learnings-WYNTYQ5T.js.map → learnings-L7VQUSVI.js.map} +0 -0
  499. /package/dist/cli-bundle/chunks/{learnings-U7U2FNIO.js.map → learnings-Z4GAIZQ5.js.map} +0 -0
  500. /package/dist/cli-bundle/chunks/{list-7MTPPZHC.js.map → list-6U3CJVXS.js.map} +0 -0
  501. /package/dist/cli-bundle/chunks/{list-JGP7ODML.js.map → list-W5ROBC5U.js.map} +0 -0
  502. /package/dist/cli-bundle/chunks/{notes-P25YVTEG.js.map → notes-JJDOEDFK.js.map} +0 -0
  503. /package/dist/cli-bundle/chunks/{notes-QIF6A7XS.js.map → notes-SDCK7BEN.js.map} +0 -0
  504. /package/dist/cli-bundle/chunks/{plan-RACB5PI6.js.map → plan-H5HYHMBB.js.map} +0 -0
  505. /package/dist/cli-bundle/chunks/{plan-SSBJFWXA.js.map → plan-W2B5RYR3.js.map} +0 -0
  506. /package/dist/cli-bundle/chunks/{register-setup-JRZ4UMWZ.js.map → register-setup-BZ3TNE3G.js.map} +0 -0
  507. /package/dist/cli-bundle/chunks/{register-setup-ABA2JPWO.js.map → register-setup-WLFL3OUF.js.map} +0 -0
  508. /package/dist/cli-bundle/chunks/{restore-3JRX27QW.js.map → restore-GNI2W5CN.js.map} +0 -0
  509. /package/dist/cli-bundle/chunks/{restore-K72ZNPEP.js.map → restore-RGFSPG4K.js.map} +0 -0
  510. /package/dist/cli-bundle/chunks/{schema-UL4B2JX5.js.map → schema-CCDU3RLC.js.map} +0 -0
  511. /package/dist/cli-bundle/chunks/{schema-3VKRDBLC.js.map → schema-KZASL323.js.map} +0 -0
  512. /package/dist/cli-bundle/chunks/{stats-WLJ3XBF5.js.map → stats-IOXQMGI6.js.map} +0 -0
  513. /package/dist/cli-bundle/chunks/{stats-O4UTMJMC.js.map → stats-QNV7B2CE.js.map} +0 -0
  514. /package/dist/cli-bundle/chunks/{telemetry-EUVHFSQU.js.map → telemetry-IV5C6JOM.js.map} +0 -0
  515. /package/dist/cli-bundle/chunks/{telemetry-NRVWX25E.js.map → telemetry-NHR5RFXT.js.map} +0 -0
  516. /package/dist/cli-bundle/chunks/{test-XN7RJL5Z.js.map → test-4Z37CXW4.js.map} +0 -0
  517. /package/dist/cli-bundle/chunks/{test-GXUBQNUC.js.map → test-PIL2CEEB.js.map} +0 -0
  518. /package/dist/cli-bundle/chunks/{test-all-UTFXC7S2.js.map → test-all-GRLYHBNP.js.map} +0 -0
  519. /package/dist/cli-bundle/chunks/{test-all-XM6OKI3L.js.map → test-all-MFN4MYCV.js.map} +0 -0
  520. /package/dist/cli-bundle/chunks/{test-runs-IK6E2HNX.js.map → test-runs-7LRFWWCA.js.map} +0 -0
  521. /package/dist/cli-bundle/chunks/{test-runs-7FHCPEA3.js.map → test-runs-7WCSC3TY.js.map} +0 -0
  522. /package/dist/cli-bundle/chunks/{update-LFBSEW3N.js.map → update-I4G34LKJ.js.map} +0 -0
  523. /package/dist/cli-bundle/chunks/{update-U4B4OMHZ.js.map → update-VI5DBZ3G.js.map} +0 -0
  524. /package/dist/cli-bundle/chunks/{upgrade-FFXGO43H.js.map → upgrade-LT2MLLPS.js.map} +0 -0
  525. /package/dist/cli-bundle/chunks/{upgrade-5SRFLUNW.js.map → upgrade-ZZSC7CLV.js.map} +0 -0
  526. /package/dist/cli-bundle/chunks/{validate-T3LPWSZG.js.map → validate-3XRORNMP.js.map} +0 -0
  527. /package/dist/cli-bundle/chunks/{validate-CRWXZILW.js.map → validate-IQIQSKUX.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"item-fields.js","sources":["core/extensions/item-fields.ts"],"sourceRoot":"/","sourcesContent":["import type { ExtensionRegistrationRegistry } from \"./loader.js\";\nimport { EXIT_CODE, FRONT_MATTER_KEY_ORDER } from \"../shared/constants.js\";\nimport { PmCliError } from \"../shared/errors.js\";\n\nconst RESERVED_ITEM_FIELD_NAMES = new Set(FRONT_MATTER_KEY_ORDER);\n\nfunction normalizeFieldName(value: unknown): string | null {\n if (typeof value !== \"string\") {\n return null;\n }\n const normalized = value.trim();\n return normalized.length > 0 ? normalized : null;\n}\n\nfunction normalizeFieldType(value: unknown): \"string\" | \"number\" | \"boolean\" | \"array\" | \"object\" | null {\n if (typeof value !== \"string\") {\n return null;\n }\n const normalized = value.trim().toLowerCase();\n if (\n normalized === \"string\" ||\n normalized === \"number\" ||\n normalized === \"boolean\" ||\n normalized === \"array\" ||\n normalized === \"object\"\n ) {\n return normalized;\n }\n return null;\n}\n\nfunction cloneFieldValue<T>(value: T): T {\n try {\n return structuredClone(value);\n } catch {\n return value;\n }\n}\n\nfunction parseFieldAssignment(raw: string): { key: string; value: string } {\n const trimmed = raw.trim();\n const separatorIndex = trimmed.indexOf(\"=\");\n if (separatorIndex <= 0) {\n throw new PmCliError(`--field entries must use name=value syntax, received: ${raw}`, EXIT_CODE.USAGE);\n }\n const key = trimmed.slice(0, separatorIndex).trim();\n const value = trimmed.slice(separatorIndex + 1);\n if (key.length === 0) {\n throw new PmCliError(\"--field entries require a non-empty field name\", EXIT_CODE.USAGE);\n }\n return { key, value };\n}\n\nfunction parseJsonFieldValue(raw: string, fieldName: string, expectedType: \"array\" | \"object\"): unknown {\n try {\n const parsed = JSON.parse(raw);\n if (expectedType === \"array\" && Array.isArray(parsed)) {\n return parsed;\n }\n if (expectedType === \"object\" && typeof parsed === \"object\" && parsed !== null && !Array.isArray(parsed)) {\n return parsed;\n }\n } catch {\n // Fall through to the typed usage error below.\n }\n throw new PmCliError(`--field ${fieldName}=... must be valid JSON ${expectedType}`, EXIT_CODE.USAGE);\n}\n\nfunction coerceRegisteredFieldValue(fieldName: string, fieldType: \"string\" | \"number\" | \"boolean\" | \"array\" | \"object\", raw: string): unknown {\n if (fieldType === \"string\") {\n return raw;\n }\n if (fieldType === \"number\") {\n const trimmed = raw.trim();\n if (trimmed.length === 0) {\n throw new PmCliError(`--field ${fieldName}=... must be a number`, EXIT_CODE.USAGE);\n }\n const parsed = Number(trimmed);\n if (!Number.isFinite(parsed)) {\n throw new PmCliError(`--field ${fieldName}=... must be a number`, EXIT_CODE.USAGE);\n }\n return parsed;\n }\n if (fieldType === \"boolean\") {\n const normalized = raw.trim().toLowerCase();\n if (normalized === \"true\" || normalized === \"1\" || normalized === \"yes\") {\n return true;\n }\n if (normalized === \"false\" || normalized === \"0\" || normalized === \"no\") {\n return false;\n }\n throw new PmCliError(`--field ${fieldName}=... must be one of true|false|1|0|yes|no`, EXIT_CODE.USAGE);\n }\n return parseJsonFieldValue(raw, fieldName, fieldType);\n}\n\nfunction collectRegisteredFieldDefinitions(\n registrations: ExtensionRegistrationRegistry | null,\n): Map<string, { name: string; type: \"string\" | \"number\" | \"boolean\" | \"array\" | \"object\" }> {\n const definitions = new Map<string, { name: string; type: \"string\" | \"number\" | \"boolean\" | \"array\" | \"object\" }>();\n if (!registrations) {\n return definitions;\n }\n for (const registration of registrations.item_fields) {\n for (const definition of registration.fields) {\n const fieldName = normalizeFieldName(definition.name);\n const fieldType = normalizeFieldType(definition.type);\n if (!fieldName || !fieldType) {\n continue;\n }\n const existing = definitions.get(fieldName);\n if (existing && existing.type !== fieldType) {\n throw new PmCliError(\n `Extension item field \"${fieldName}\" is declared with conflicting types: ${existing.type}, ${fieldType}`,\n EXIT_CODE.USAGE,\n {\n code: \"extension_item_field_type_conflict\",\n nextSteps: [\"Make every active extension declaration for this field use the same type.\"],\n },\n );\n }\n definitions.set(fieldName, { name: fieldName, type: fieldType });\n }\n }\n return definitions;\n}\n\nfunction assertNotReservedItemFieldName(fieldName: string): void {\n if (!RESERVED_ITEM_FIELD_NAMES.has(fieldName)) {\n return;\n }\n throw new PmCliError(`Extension item field \"${fieldName}\" collides with reserved item metadata`, EXIT_CODE.USAGE, {\n code: \"extension_item_field_reserved\",\n nextSteps: [\"Rename the extension item field, preferably with an extension-specific prefix.\"],\n });\n}\n\nexport function collectRegisteredItemFieldNames(registrations: ExtensionRegistrationRegistry | null): string[] {\n return [...collectRegisteredFieldDefinitions(registrations).keys()].sort((left, right) => left.localeCompare(right));\n}\n\nexport function parseRegisteredItemFieldAssignments(\n rawFields: string[] | undefined,\n registrations: ExtensionRegistrationRegistry | null,\n): Record<string, unknown> {\n if (!rawFields || rawFields.length === 0) {\n return {};\n }\n const definitions = collectRegisteredFieldDefinitions(registrations);\n const values: Record<string, unknown> = {};\n for (const raw of rawFields) {\n const { key, value } = parseFieldAssignment(raw);\n const definition = definitions.get(key);\n if (!definition) {\n const known = [...definitions.keys()].sort((left, right) => left.localeCompare(right));\n throw new PmCliError(`--field ${key} is not declared by an active extension item-field registration`, EXIT_CODE.USAGE, {\n code: \"extension_item_field_unknown\",\n recovery: { provided_fields: known },\n nextSteps: known.length > 0\n ? [`Use one of the declared fields: ${known.join(\", \")}`]\n : [\"Activate an extension that calls registerItemFields before setting extension fields.\"],\n });\n }\n assertNotReservedItemFieldName(definition.name);\n values[definition.name] = coerceRegisteredFieldValue(definition.name, definition.type, value);\n }\n return values;\n}\n\nfunction isValidFieldType(value: unknown, expectedType: \"string\" | \"number\" | \"boolean\" | \"array\" | \"object\"): boolean {\n if (expectedType === \"string\") {\n return typeof value === \"string\";\n }\n if (expectedType === \"number\") {\n return typeof value === \"number\" && Number.isFinite(value);\n }\n if (expectedType === \"boolean\") {\n return typeof value === \"boolean\";\n }\n if (expectedType === \"array\") {\n return Array.isArray(value);\n }\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isAllowedFieldValue(value: unknown, allowed: unknown[] | undefined): boolean {\n if (!allowed || allowed.length === 0) {\n return true;\n }\n return allowed.some((candidate) => Object.is(candidate, value));\n}\n\nexport function applyRegisteredItemFieldDefaultsAndValidation(\n frontMatter: Record<string, unknown>,\n registrations: ExtensionRegistrationRegistry | null,\n options: { skipDefaultFields?: ReadonlySet<string> } = {},\n): void {\n if (!registrations) {\n return;\n }\n collectRegisteredFieldDefinitions(registrations);\n for (const registration of registrations.item_fields) {\n for (const definition of registration.fields) {\n const fieldName = normalizeFieldName(definition.name);\n if (!fieldName) {\n continue;\n }\n assertNotReservedItemFieldName(fieldName);\n if (\n !(fieldName in frontMatter) &&\n !options.skipDefaultFields?.has(fieldName) &&\n Object.prototype.hasOwnProperty.call(definition, \"default\")\n ) {\n frontMatter[fieldName] = cloneFieldValue(definition.default);\n }\n\n const currentValue = frontMatter[fieldName];\n if (currentValue === undefined) {\n continue;\n }\n const expectedType = normalizeFieldType(definition.type);\n if (expectedType && !isValidFieldType(currentValue, expectedType)) {\n throw new TypeError(`Item field \"${fieldName}\" must be of type ${expectedType}`);\n }\n\n const allowedValues = Array.isArray(definition.values) ? definition.values : undefined;\n if (!isAllowedFieldValue(currentValue, allowedValues)) {\n throw new TypeError(`Item field \"${fieldName}\" must match one of the configured allowed values`);\n }\n }\n }\n}\n"],"names":[],"mappings":";;AACA,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,UAAU,EAA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","sourcesContent":["import type { ExtensionRegistrationRegistry } from \"./loader.js\";\nimport { normalizeItemFieldType, type KnownItemFieldType } from \"./item-field-types.js\";\nimport { EXIT_CODE, FRONT_MATTER_KEY_ORDER } from \"../shared/constants.js\";\nimport { PmCliError } from \"../shared/errors.js\";\n\nconst RESERVED_ITEM_FIELD_NAMES = new Set(FRONT_MATTER_KEY_ORDER);\n\nfunction normalizeFieldName(value: unknown): string | null {\n if (typeof value !== \"string\") {\n return null;\n }\n const normalized = value.trim();\n return normalized.length > 0 ? normalized : null;\n}\n\nfunction normalizeFieldType(value: unknown): KnownItemFieldType | null {\n if (typeof value !== \"string\") {\n return null;\n }\n return normalizeItemFieldType(value);\n}\n\nfunction cloneFieldValue<T>(value: T): T {\n try {\n return structuredClone(value);\n } catch {\n return value;\n }\n}\n\nfunction parseFieldAssignment(raw: string): { key: string; value: string } {\n const trimmed = raw.trim();\n const separatorIndex = trimmed.indexOf(\"=\");\n if (separatorIndex <= 0) {\n throw new PmCliError(`--field entries must use name=value syntax, received: ${raw}`, EXIT_CODE.USAGE);\n }\n const key = trimmed.slice(0, separatorIndex).trim();\n const value = trimmed.slice(separatorIndex + 1);\n if (key.length === 0) {\n throw new PmCliError(\"--field entries require a non-empty field name\", EXIT_CODE.USAGE);\n }\n return { key, value };\n}\n\nfunction parseJsonFieldValue(raw: string, fieldName: string, expectedType: \"array\" | \"object\"): unknown {\n try {\n const parsed = JSON.parse(raw);\n if (expectedType === \"array\" && Array.isArray(parsed)) {\n return parsed;\n }\n if (expectedType === \"object\" && typeof parsed === \"object\" && parsed !== null && !Array.isArray(parsed)) {\n return parsed;\n }\n } catch {\n // Fall through to the typed usage error below.\n }\n throw new PmCliError(`--field ${fieldName}=... must be valid JSON ${expectedType}`, EXIT_CODE.USAGE);\n}\n\nfunction coerceRegisteredFieldValue(fieldName: string, fieldType: \"string\" | \"number\" | \"boolean\" | \"array\" | \"object\", raw: string): unknown {\n if (fieldType === \"string\") {\n return raw;\n }\n if (fieldType === \"number\") {\n const trimmed = raw.trim();\n if (trimmed.length === 0) {\n throw new PmCliError(`--field ${fieldName}=... must be a number`, EXIT_CODE.USAGE);\n }\n const parsed = Number(trimmed);\n if (!Number.isFinite(parsed)) {\n throw new PmCliError(`--field ${fieldName}=... must be a number`, EXIT_CODE.USAGE);\n }\n return parsed;\n }\n if (fieldType === \"boolean\") {\n const normalized = raw.trim().toLowerCase();\n if (normalized === \"true\" || normalized === \"1\" || normalized === \"yes\") {\n return true;\n }\n if (normalized === \"false\" || normalized === \"0\" || normalized === \"no\") {\n return false;\n }\n throw new PmCliError(`--field ${fieldName}=... must be one of true|false|1|0|yes|no`, EXIT_CODE.USAGE);\n }\n return parseJsonFieldValue(raw, fieldName, fieldType);\n}\n\nfunction collectRegisteredFieldDefinitions(\n registrations: ExtensionRegistrationRegistry | null,\n): Map<string, { name: string; type: \"string\" | \"number\" | \"boolean\" | \"array\" | \"object\" }> {\n const definitions = new Map<string, { name: string; type: \"string\" | \"number\" | \"boolean\" | \"array\" | \"object\" }>();\n if (!registrations) {\n return definitions;\n }\n for (const registration of registrations.item_fields) {\n for (const definition of registration.fields) {\n const fieldName = normalizeFieldName(definition.name);\n const fieldType = normalizeFieldType(definition.type);\n if (!fieldName || !fieldType) {\n continue;\n }\n const existing = definitions.get(fieldName);\n if (existing && existing.type !== fieldType) {\n throw new PmCliError(\n `Extension item field \"${fieldName}\" is declared with conflicting types: ${existing.type}, ${fieldType}`,\n EXIT_CODE.USAGE,\n {\n code: \"extension_item_field_type_conflict\",\n nextSteps: [\"Make every active extension declaration for this field use the same type.\"],\n },\n );\n }\n definitions.set(fieldName, { name: fieldName, type: fieldType });\n }\n }\n return definitions;\n}\n\nfunction assertNotReservedItemFieldName(fieldName: string): void {\n if (!RESERVED_ITEM_FIELD_NAMES.has(fieldName)) {\n return;\n }\n throw new PmCliError(`Extension item field \"${fieldName}\" collides with reserved item metadata`, EXIT_CODE.USAGE, {\n code: \"extension_item_field_reserved\",\n nextSteps: [\"Rename the extension item field, preferably with an extension-specific prefix.\"],\n });\n}\n\nexport function collectRegisteredItemFieldNames(registrations: ExtensionRegistrationRegistry | null): string[] {\n return [...collectRegisteredFieldDefinitions(registrations).keys()].sort((left, right) => left.localeCompare(right));\n}\n\nexport function parseRegisteredItemFieldAssignments(\n rawFields: string[] | undefined,\n registrations: ExtensionRegistrationRegistry | null,\n): Record<string, unknown> {\n if (!rawFields || rawFields.length === 0) {\n return {};\n }\n const definitions = collectRegisteredFieldDefinitions(registrations);\n const values: Record<string, unknown> = {};\n for (const raw of rawFields) {\n const { key, value } = parseFieldAssignment(raw);\n const definition = definitions.get(key);\n if (!definition) {\n const known = [...definitions.keys()].sort((left, right) => left.localeCompare(right));\n throw new PmCliError(`--field ${key} is not declared by an active extension item-field registration`, EXIT_CODE.USAGE, {\n code: \"extension_item_field_unknown\",\n recovery: { provided_fields: known },\n nextSteps: known.length > 0\n ? [`Use one of the declared fields: ${known.join(\", \")}`]\n : [\"Activate an extension that calls registerItemFields before setting extension fields.\"],\n });\n }\n assertNotReservedItemFieldName(definition.name);\n values[definition.name] = coerceRegisteredFieldValue(definition.name, definition.type, value);\n }\n return values;\n}\n\nfunction isValidFieldType(value: unknown, expectedType: \"string\" | \"number\" | \"boolean\" | \"array\" | \"object\"): boolean {\n if (expectedType === \"string\") {\n return typeof value === \"string\";\n }\n if (expectedType === \"number\") {\n return typeof value === \"number\" && Number.isFinite(value);\n }\n if (expectedType === \"boolean\") {\n return typeof value === \"boolean\";\n }\n if (expectedType === \"array\") {\n return Array.isArray(value);\n }\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isAllowedFieldValue(value: unknown, allowed: unknown[] | undefined): boolean {\n if (!allowed || allowed.length === 0) {\n return true;\n }\n return allowed.some((candidate) => Object.is(candidate, value));\n}\n\nexport function applyRegisteredItemFieldDefaultsAndValidation(\n frontMatter: Record<string, unknown>,\n registrations: ExtensionRegistrationRegistry | null,\n options: { skipDefaultFields?: ReadonlySet<string> } = {},\n): void {\n if (!registrations) {\n return;\n }\n collectRegisteredFieldDefinitions(registrations);\n for (const registration of registrations.item_fields) {\n for (const definition of registration.fields) {\n const fieldName = normalizeFieldName(definition.name);\n if (!fieldName) {\n continue;\n }\n assertNotReservedItemFieldName(fieldName);\n if (\n !(fieldName in frontMatter) &&\n !options.skipDefaultFields?.has(fieldName) &&\n Object.prototype.hasOwnProperty.call(definition, \"default\")\n ) {\n frontMatter[fieldName] = cloneFieldValue(definition.default);\n }\n\n const currentValue = frontMatter[fieldName];\n if (currentValue === undefined) {\n continue;\n }\n const expectedType = normalizeFieldType(definition.type);\n if (expectedType && !isValidFieldType(currentValue, expectedType)) {\n throw new TypeError(`Item field \"${fieldName}\" must be of type ${expectedType}`);\n }\n\n const allowedValues = Array.isArray(definition.values) ? definition.values : undefined;\n if (!isAllowedFieldValue(currentValue, allowedValues)) {\n throw new TypeError(`Item field \"${fieldName}\" must match one of the configured allowed values`);\n }\n }\n }\n}\n"],"names":[],"mappings":";;AACA,OAAO,EAAE,sBAAsB,EAA2B,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC,sBAAsB,CAAC,CAAC;AAElE,SAAS,kBAAkB,CAAC,KAAc;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAChC,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;AACnD,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAc;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,IAA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AC,YAAY,EAAE,YAAY,CAAC,EAAE,CAAC;gBAClE,MAAM,IAAI,SAAS,CAAC,eAAe,SAAS,qBAAqB,YAAY,EAAE,CAAC,CAAC;YACnF,CAAC;YAED,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;YACvF,IAAI,CAAC,mBAAmB,CAAC,YAAY,EAAE,aAAa,CAAC,EAAE,CAAC;gBACtD,MAAM,IAAI,SAAS,CAAC,eAAe,SAAS,mDAAmD,CAAC,CAAC;YACnG,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC","debugId":"1d92831e-54a7-5c1f-af04-7441908e8e5a"}
@@ -1,7 +1,7 @@
1
1
  export { parseUnknownExtensionCapabilityWarning, parseLegacyExtensionCapabilityAliasWarning, } from "./extension-capability-aliases.js";
2
2
  export { createEmptyExtensionHookRegistry, createEmptyExtensionCommandRegistry, createEmptyExtensionParserRegistry, createEmptyExtensionPreflightRegistry, createEmptyExtensionServiceRegistry, createEmptyExtensionRendererRegistry, createEmptyExtensionRegistrationRegistry, } from "./extension-registries.js";
3
3
  export { runBeforeCommandHooks, runAfterCommandHooks, runOnWriteHooks, runOnReadHooks, runOnIndexHooks, runCommandHandler, runParserOverride, runPreflightOverride, runServiceOverrideSync, runServiceOverride, runCommandOverride, runRendererOverride, } from "./extension-hook-runtime.js";
4
- import { type ExtensionDiscoveryResult, type ExtensionLoadResult, type ExtensionActivationResult, type DiscoverExtensionsOptions } from "./extension-types.js";
4
+ import { type ExtensionDeactivationOptions, type ExtensionDeactivationResult, type ExtensionDiscoveryResult, type ExtensionLoadResult, type ExtensionActivationResult, type DiscoverExtensionsOptions } from "./extension-types.js";
5
5
  export * from "./extension-types.js";
6
6
  export declare function nextExtensionReloadToken(seed?: number): string;
7
7
  export declare function resolveExtensionRoots(pmRoot: string, cwd?: string): {
@@ -10,4 +10,19 @@ export declare function resolveExtensionRoots(pmRoot: string, cwd?: string): {
10
10
  };
11
11
  export declare function discoverExtensions(options: DiscoverExtensionsOptions): Promise<ExtensionDiscoveryResult>;
12
12
  export declare function loadExtensions(options: DiscoverExtensionsOptions): Promise<ExtensionLoadResult>;
13
+ /**
14
+ * Run the optional `deactivate` teardown hook for every loaded extension that
15
+ * exports one. Best-effort: a throwing teardown is captured as a warning and a
16
+ * failure entry rather than propagated, so one extension cannot block another's
17
+ * cleanup. Hosts call this on shutdown/reload (e.g. the MCP server between
18
+ * native-action requests) to release resources opened during `activate`.
19
+ *
20
+ * Pass the `activationResult` to skip extensions whose `activate` failed — they
21
+ * never fully initialized, so (VS Code-style) their `deactivate` must not run.
22
+ * Teardowns run concurrently and each hook has a bounded timeout by default, so
23
+ * one slow or hanging hook cannot serialize the rest or block the host
24
+ * indefinitely unless the host explicitly disables the timeout; the returned
25
+ * warnings/failures preserve loaded order.
26
+ */
27
+ export declare function deactivateExtensions(loadResult: ExtensionLoadResult, activationResult?: Pick<ExtensionActivationResult, "failed">, options?: ExtensionDeactivationOptions): Promise<ExtensionDeactivationResult>;
13
28
  export declare function activateExtensions(loadResult: ExtensionLoadResult): Promise<ExtensionActivationResult>;
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="54365547-c7be-5bd4-be2e-ca02f27aa365")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="19026387-34f8-5e8e-b936-4fc13489f244")}catch(e){}}();
3
3
  import fs from "node:fs/promises";
4
4
  import path from "node:path";
5
5
  import { pathToFileURL } from "node:url";
@@ -8,6 +8,8 @@ import { isPathWithinDirectory } from "../fs/path-utils.js";
8
8
  import { resolvePmPackageRootFromModule } from "../packages/root.js";
9
9
  import { resolveGlobalPmRoot } from "../store/paths.js";
10
10
  import { asRecordLoose } from "../shared/primitives.js";
11
+ import { flattenFlagListValue, isFlagDefaultValueCoercible, resolveFlagValueKind } from "./flag-value-types.js";
12
+ import { KNOWN_ITEM_FIELD_TYPES, normalizeItemFieldType, suggestKnownItemFieldType } from "./item-field-types.js";
11
13
  // Cohesive helper groups now live in sibling modules. They are imported for the
12
14
  // discovery/activation code that stays here and re-exported below so existing
13
15
  // import sites (sdk/index.ts, commands/extension.ts, health.ts, tests, …) keep
@@ -19,7 +21,7 @@ import { normalizeCommandName, cloneContextSnapshot, } from "./extension-runtime
19
21
  export { parseUnknownExtensionCapabilityWarning, parseLegacyExtensionCapabilityAliasWarning, } from "./extension-capability-aliases.js";
20
22
  export { createEmptyExtensionHookRegistry, createEmptyExtensionCommandRegistry, createEmptyExtensionParserRegistry, createEmptyExtensionPreflightRegistry, createEmptyExtensionServiceRegistry, createEmptyExtensionRendererRegistry, createEmptyExtensionRegistrationRegistry, } from "./extension-registries.js";
21
23
  export { runBeforeCommandHooks, runAfterCommandHooks, runOnWriteHooks, runOnReadHooks, runOnIndexHooks, runCommandHandler, runParserOverride, runPreflightOverride, runServiceOverrideSync, runServiceOverride, runCommandOverride, runRendererOverride, } from "./extension-hook-runtime.js";
22
- import { KNOWN_EXTENSION_SERVICE_NAMES, createDefaultExtensionGovernancePolicy, } from "./extension-types.js";
24
+ import { KNOWN_EXTENSION_CAPABILITIES, KNOWN_EXTENSION_SERVICE_NAMES, createDefaultExtensionGovernancePolicy, } from "./extension-types.js";
23
25
  export * from "./extension-types.js";
24
26
  const DEFAULT_EXTENSION_PRIORITY = 100;
25
27
  let currentPmCliVersionPromise = null;
@@ -350,14 +352,14 @@ function buildEffectiveExtensions(globalCandidates, projectCandidates) {
350
352
  }
351
353
  return effective;
352
354
  }
353
- async function scanExtensionLayer(layer, extensionsRoot, enabled, disabled) {
355
+ async function scanExtensionLayer(layer, extensionsRoot, enabled, disabled, pmMaxVersionExceededMode) {
354
356
  const diagnostics = [];
355
357
  const warnings = [];
356
358
  const candidates = [];
357
359
  const directories = await listExtensionDirectories(extensionsRoot);
358
360
  const managedSourcePackages = await readManagedExtensionSourcePackages(extensionsRoot);
359
361
  for (const directory of directories) {
360
- const scanned = await scanExtensionDirectory(layer, extensionsRoot, directory, enabled, disabled, managedSourcePackages);
362
+ const scanned = await scanExtensionDirectory(layer, extensionsRoot, directory, enabled, disabled, managedSourcePackages, pmMaxVersionExceededMode);
361
363
  diagnostics.push(scanned.diagnostic);
362
364
  warnings.push(...scanned.warnings);
363
365
  if (scanned.candidate) {
@@ -366,7 +368,7 @@ async function scanExtensionLayer(layer, extensionsRoot, enabled, disabled) {
366
368
  }
367
369
  return { diagnostics, warnings, candidates };
368
370
  }
369
- async function scanExtensionDirectory(layer, extensionsRoot, directory, enabled, disabled, managedSourcePackages) {
371
+ async function scanExtensionDirectory(layer, extensionsRoot, directory, enabled, disabled, managedSourcePackages, pmMaxVersionExceededMode) {
370
372
  const extensionDir = path.join(extensionsRoot, directory);
371
373
  const manifestPath = path.join(extensionDir, "manifest.json");
372
374
  if (!(await pathExists(manifestPath))) {
@@ -437,7 +439,7 @@ async function scanExtensionDirectory(layer, extensionsRoot, directory, enabled,
437
439
  if (pmVersionCompatibility.warning) {
438
440
  extensionWarnings.push(pmVersionCompatibility.warning);
439
441
  }
440
- const pmMaxVersionCompatibility = await evaluatePmMaxVersionCompatibility(layer, manifest);
442
+ const pmMaxVersionCompatibility = await evaluatePmMaxVersionCompatibility(layer, manifest, pmMaxVersionExceededMode);
441
443
  if (pmMaxVersionCompatibility.warning) {
442
444
  extensionWarnings.push(pmMaxVersionCompatibility.warning);
443
445
  }
@@ -492,8 +494,8 @@ export async function discoverExtensions(options) {
492
494
  }
493
495
  const enabled = new Set(configured_enabled);
494
496
  const disabled = new Set(configured_disabled);
495
- const globalScan = await scanExtensionLayer("global", roots.global, enabled, disabled);
496
- const projectScan = await scanExtensionLayer("project", roots.project, enabled, disabled);
497
+ const globalScan = await scanExtensionLayer("global", roots.global, enabled, disabled, policy.pmMaxVersionExceededMode.global);
498
+ const projectScan = await scanExtensionLayer("project", roots.project, enabled, disabled, policy.pmMaxVersionExceededMode.project);
497
499
  const policyWarnings = [...policy.warnings];
498
500
  const effectiveCandidates = buildEffectiveExtensions(globalScan.candidates, projectScan.candidates);
499
501
  const effective = [];
@@ -621,7 +623,7 @@ async function evaluatePmMinVersionCompatibility(layer, manifest) {
621
623
  }
622
624
  return { allowed: true };
623
625
  }
624
- async function evaluatePmMaxVersionCompatibility(layer, manifest) {
626
+ async function evaluatePmMaxVersionCompatibility(layer, manifest, exceededMode) {
625
627
  if (typeof manifest.pm_max_version !== "string" || manifest.pm_max_version.trim().length === 0) {
626
628
  return { allowed: true };
627
629
  }
@@ -654,8 +656,16 @@ async function evaluatePmMaxVersionCompatibility(layer, manifest) {
654
656
  warning: `extension_pm_max_version_unchecked:${layer}:${manifest.name}:allowed=${manifest.pm_max_version}:current=${currentVersion}`,
655
657
  };
656
658
  }
657
- // follow-up: pm-4gw6 recommends a future settings toggle to relax this default-BLOCK to warn-only per layer.
658
659
  if (comparison > 0) {
660
+ // pm-k5e8: `extensions.policy.pm_max_version_exceeded_mode` (default "block",
661
+ // per-layer overridable) relaxes this to warn-only so operators can keep
662
+ // pinned extensions loading during a CLI upgrade window.
663
+ if (exceededMode === "warn") {
664
+ return {
665
+ allowed: true,
666
+ warning: `extension_pm_max_version_exceeded_warn:${layer}:${manifest.name}:allowed=${manifest.pm_max_version}:current=${currentVersion}`,
667
+ };
668
+ }
659
669
  return {
660
670
  allowed: false,
661
671
  warning: `extension_pm_max_version_exceeded:${layer}:${manifest.name}:allowed=${manifest.pm_max_version}:current=${currentVersion}`,
@@ -727,24 +737,127 @@ export async function loadExtensions(options) {
727
737
  failed,
728
738
  };
729
739
  }
740
+ const DEFAULT_EXTENSION_DEACTIVATE_TIMEOUT_MS = 5_000;
741
+ const MAX_EXTENSION_DEACTIVATE_TIMEOUT_MS = 2_147_483_647;
742
+ function toActivatableExtension(source) {
743
+ // Bind to `source` so a module/default-export authored with methods (or a class
744
+ // instance) keeps its `this` across both lifecycle calls — `activate` is a
745
+ // method call on a fresh object and `deactivate` is invoked bare, so without
746
+ // binding the two would see different (or undefined) `this`.
747
+ const activate = source.activate;
748
+ const activatable = {
749
+ activate: activate.bind(source),
750
+ };
751
+ if (typeof source.deactivate === "function") {
752
+ const deactivate = source.deactivate;
753
+ activatable.deactivate = deactivate.bind(source);
754
+ }
755
+ return activatable;
756
+ }
730
757
  function resolveActivatableExtension(module) {
731
758
  const moduleRecord = asRecordLoose(module);
732
759
  if (!moduleRecord) {
733
760
  return null;
734
761
  }
735
762
  if (typeof moduleRecord.activate === "function") {
736
- return {
737
- activate: moduleRecord.activate,
738
- };
763
+ return toActivatableExtension(moduleRecord);
739
764
  }
740
765
  const defaultExport = asRecordLoose(moduleRecord.default);
741
766
  if (defaultExport && typeof defaultExport.activate === "function") {
742
- return {
743
- activate: defaultExport.activate,
744
- };
767
+ return toActivatableExtension(defaultExport);
745
768
  }
746
769
  return null;
747
770
  }
771
+ /**
772
+ * Run the optional `deactivate` teardown hook for every loaded extension that
773
+ * exports one. Best-effort: a throwing teardown is captured as a warning and a
774
+ * failure entry rather than propagated, so one extension cannot block another's
775
+ * cleanup. Hosts call this on shutdown/reload (e.g. the MCP server between
776
+ * native-action requests) to release resources opened during `activate`.
777
+ *
778
+ * Pass the `activationResult` to skip extensions whose `activate` failed — they
779
+ * never fully initialized, so (VS Code-style) their `deactivate` must not run.
780
+ * Teardowns run concurrently and each hook has a bounded timeout by default, so
781
+ * one slow or hanging hook cannot serialize the rest or block the host
782
+ * indefinitely unless the host explicitly disables the timeout; the returned
783
+ * warnings/failures preserve loaded order.
784
+ */
785
+ export async function deactivateExtensions(loadResult, activationResult, options = {}) {
786
+ const timeoutMs = normalizeExtensionDeactivateTimeout(options?.deactivate_timeout_ms);
787
+ const failedActivationKeys = new Set((activationResult?.failed ?? []).map((entry) => `${entry.layer}:${entry.name}`));
788
+ const targets = [];
789
+ for (const extension of loadResult.loaded) {
790
+ if (failedActivationKeys.has(`${extension.layer}:${extension.name}`)) {
791
+ continue;
792
+ }
793
+ const activatable = resolveActivatableExtension(extension.module);
794
+ if (!activatable || typeof activatable.deactivate !== "function") {
795
+ continue;
796
+ }
797
+ targets.push({ extension, deactivate: activatable.deactivate });
798
+ }
799
+ const outcomes = await Promise.all(targets.map(async ({ extension, deactivate }) => {
800
+ try {
801
+ await runExtensionDeactivateWithTimeout(deactivate, timeoutMs);
802
+ return { ok: true };
803
+ }
804
+ catch (error) {
805
+ return { ok: false, layer: extension.layer, name: extension.name, error: formatUnknownError(error) };
806
+ }
807
+ }));
808
+ const warnings = [];
809
+ const failed = [];
810
+ let deactivated = 0;
811
+ for (const outcome of outcomes) {
812
+ if (outcome.ok) {
813
+ deactivated += 1;
814
+ continue;
815
+ }
816
+ warnings.push(`extension_deactivate_failed:${outcome.layer}:${outcome.name}`);
817
+ failed.push({ layer: outcome.layer, name: outcome.name, error: outcome.error });
818
+ }
819
+ return { deactivated, warnings, failed };
820
+ }
821
+ function normalizeExtensionDeactivateTimeout(rawTimeout) {
822
+ if (typeof rawTimeout !== "number" || rawTimeout < 0) {
823
+ return DEFAULT_EXTENSION_DEACTIVATE_TIMEOUT_MS;
824
+ }
825
+ if (rawTimeout === 0 || rawTimeout === Infinity) {
826
+ return 0;
827
+ }
828
+ if (!Number.isFinite(rawTimeout)) {
829
+ return DEFAULT_EXTENSION_DEACTIVATE_TIMEOUT_MS;
830
+ }
831
+ return Math.min(MAX_EXTENSION_DEACTIVATE_TIMEOUT_MS, Math.max(1, Math.floor(rawTimeout)));
832
+ }
833
+ async function runExtensionDeactivateWithTimeout(deactivate, timeoutMs) {
834
+ if (timeoutMs === 0) {
835
+ await deactivate();
836
+ return;
837
+ }
838
+ let timeoutHandle;
839
+ try {
840
+ // A timed-out deactivate promise may still finish later; JavaScript promises
841
+ // are not cancellable, so the host only stops waiting and consumes any late
842
+ // rejection from the hook.
843
+ const deactivatePromise = Promise.resolve().then(() => deactivate());
844
+ deactivatePromise.catch(() => { });
845
+ await Promise.race([
846
+ deactivatePromise,
847
+ new Promise((_, reject) => {
848
+ timeoutHandle = setTimeout(() => {
849
+ reject(new Error(`extension deactivate timed out after ${timeoutMs}ms`));
850
+ }, timeoutMs);
851
+ timeoutHandle.unref?.();
852
+ }),
853
+ ]);
854
+ }
855
+ finally {
856
+ if (timeoutHandle) {
857
+ clearTimeout(timeoutHandle);
858
+ }
859
+ }
860
+ }
748
861
  function isOutputRendererFormat(value) {
749
862
  return value === "toon" || value === "json";
750
863
  }
@@ -873,6 +986,25 @@ function assertOptionalStringField(name, value) {
873
986
  throw new TypeError(`${name} must be a non-empty string when provided`);
874
987
  }
875
988
  }
989
+ function isFlagDefaultScalar(value) {
990
+ return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
991
+ }
992
+ function assertOptionalFlagDefaultField(name, value) {
993
+ if (value === undefined) {
994
+ return;
995
+ }
996
+ if (Array.isArray(value)) {
997
+ for (const [index, item] of value.entries()) {
998
+ if (!isFlagDefaultScalar(item)) {
999
+ throw new TypeError(`${name}[${index}] must be a string, number, or boolean`);
1000
+ }
1001
+ }
1002
+ return;
1003
+ }
1004
+ if (!isFlagDefaultScalar(value)) {
1005
+ throw new TypeError(`${name} must be a string, number, or boolean, or an array of these when provided`);
1006
+ }
1007
+ }
876
1008
  function assertOptionalStringArrayField(name, value) {
877
1009
  if (value === undefined) {
878
1010
  return;
@@ -992,6 +1124,42 @@ function validateFlagDefinitions(flags) {
992
1124
  assertOptionalBooleanField(`registerFlags flags[${index}].required`, record.required);
993
1125
  assertOptionalBooleanField(`registerFlags flags[${index}].enabled`, record.enabled);
994
1126
  assertOptionalBooleanField(`registerFlags flags[${index}].visible`, record.visible);
1127
+ assertOptionalBooleanField(`registerFlags flags[${index}].list`, record.list);
1128
+ assertOptionalFlagDefaultField(`registerFlags flags[${index}].default`, record.default);
1129
+ if (Array.isArray(record.default) && record.list !== true) {
1130
+ throw new TypeError(`registerFlags flags[${index}].default cannot be an array unless list is true.`);
1131
+ }
1132
+ assertFlagValueTypeAndDefault(`registerFlags flags[${index}]`, record);
1133
+ }
1134
+ }
1135
+ /**
1136
+ * Reject a declared `value_type`/`type` that is not a known flag value kind, and
1137
+ * a `default` whose value(s) would not cleanly coerce under that kind — so the
1138
+ * typed-flag contract is enforced at registration instead of silently leaving
1139
+ * an untyped value to surface at use time.
1140
+ */
1141
+ function assertFlagValueTypeAndDefault(label, record) {
1142
+ const declaredType = (typeof record.value_type === "string" ? record.value_type : undefined) ??
1143
+ (typeof record.type === "string" ? record.type : undefined);
1144
+ if (declaredType === undefined) {
1145
+ return;
1146
+ }
1147
+ const kind = resolveFlagValueKind(declaredType);
1148
+ if (kind === null) {
1149
+ throw new TypeError(`${label} value_type "${declaredType}" is not a known flag value type (expected one of: string, number, boolean).`);
1150
+ }
1151
+ if (record.default === undefined) {
1152
+ return;
1153
+ }
1154
+ // For list flags, validate the default exactly as the runtime will see it —
1155
+ // comma-joined strings and nested arrays are flattened first — so a valid
1156
+ // default like `value_type: "number", default: "10,20"` is not wrongly rejected.
1157
+ const defaults = record.list === true ? flattenFlagListValue(record.default) : [record.default];
1158
+ for (const [defaultIndex, defaultValue] of defaults.entries()) {
1159
+ if (!isFlagDefaultValueCoercible(defaultValue, kind)) {
1160
+ const suffix = defaults.length > 1 ? `default[${defaultIndex}]` : "default";
1161
+ throw new TypeError(`${label}.${suffix} (${JSON.stringify(defaultValue)}) is not coercible to ${kind}.`);
1162
+ }
995
1163
  }
996
1164
  }
997
1165
  function validateItemFieldDefinitions(fields) {
@@ -1001,7 +1169,13 @@ function validateItemFieldDefinitions(fields) {
1001
1169
  for (const [index, raw] of fields.entries()) {
1002
1170
  const record = asRegistrationRecord(`registerItemFields fields[${index}]`, raw);
1003
1171
  assertNonEmptyString(`registerItemFields fields[${index}].name`, record.name);
1004
- assertNonEmptyString(`registerItemFields fields[${index}].type`, record.type);
1172
+ const fieldType = assertNonEmptyString(`registerItemFields fields[${index}].type`, record.type);
1173
+ if (normalizeItemFieldType(fieldType) === null) {
1174
+ const suggestion = suggestKnownItemFieldType(fieldType);
1175
+ const hint = suggestion ? ` Did you mean "${suggestion}"?` : "";
1176
+ throw new TypeError(`registerItemFields fields[${index}].type "${fieldType}" is not a known field type ` +
1177
+ `(expected one of: ${KNOWN_ITEM_FIELD_TYPES.join(", ")}).${hint}`);
1178
+ }
1005
1179
  assertOptionalBooleanField(`registerItemFields fields[${index}].optional`, record.optional);
1006
1180
  }
1007
1181
  }
@@ -1102,6 +1276,15 @@ function assertExtensionCapability(extension, capability, method) {
1102
1276
  }
1103
1277
  }
1104
1278
  function createExtensionApi(extension, hooks, commands, parsers, preflight, services, renderers, registrations, activationWarnings, policy) {
1279
+ const selfIdentity = Object.freeze({
1280
+ name: extension.name,
1281
+ layer: extension.layer,
1282
+ version: extension.version,
1283
+ capabilities: Object.freeze((extension.capabilities ?? []).filter((capability) => KNOWN_EXTENSION_CAPABILITIES.includes(capability))),
1284
+ pm_min_version: extension.pm_min_version,
1285
+ pm_max_version: extension.pm_max_version,
1286
+ source_package: extension.source_package,
1287
+ });
1105
1288
  const extensionRef = {
1106
1289
  layer: extension.layer,
1107
1290
  name: extension.name,
@@ -1552,6 +1735,7 @@ function createExtensionApi(extension, hooks, commands, parsers, preflight, serv
1552
1735
  });
1553
1736
  };
1554
1737
  return {
1738
+ extension: selfIdentity,
1555
1739
  registerCommand,
1556
1740
  registerParser,
1557
1741
  registerPreflight,
@@ -1769,4 +1953,4 @@ export async function activateExtensions(loadResult) {
1769
1953
  };
1770
1954
  }
1771
1955
  //# sourceMappingURL=loader.js.map
1772
- //# debugId=54365547-c7be-5bd4-be2e-ca02f27aa365
1956
+ //# debugId=19026387-34f8-5e8e-b936-4fc13489f244