@unbrained/pm-cli 2026.6.23 → 2026.6.30

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 (716) hide show
  1. package/CHANGELOG.md +120 -0
  2. package/CONTRIBUTING.md +30 -0
  3. package/README.md +16 -3
  4. package/dist/cli/commander-usage.js +3 -3
  5. package/dist/cli/commander-usage.js.map +1 -1
  6. package/dist/cli/commands/aggregate.js +8 -7
  7. package/dist/cli/commands/aggregate.js.map +1 -1
  8. package/dist/cli/commands/close.d.ts +2 -4
  9. package/dist/cli/commands/close.js +5 -17
  10. package/dist/cli/commands/close.js.map +1 -1
  11. package/dist/cli/commands/completion.js +158 -9
  12. package/dist/cli/commands/completion.js.map +1 -1
  13. package/dist/cli/commands/config.d.ts +1 -1
  14. package/dist/cli/commands/config.js +2 -2
  15. package/dist/cli/commands/config.js.map +1 -1
  16. package/dist/cli/commands/context.d.ts +31 -4
  17. package/dist/cli/commands/context.js +33 -10
  18. package/dist/cli/commands/context.js.map +1 -1
  19. package/dist/cli/commands/contracts.js +48 -8
  20. package/dist/cli/commands/contracts.js.map +1 -1
  21. package/dist/cli/commands/create.d.ts +1 -6
  22. package/dist/cli/commands/create.js +10 -155
  23. package/dist/cli/commands/create.js.map +1 -1
  24. package/dist/cli/commands/extension/describe.d.ts +15 -0
  25. package/dist/cli/commands/extension/describe.js +48 -2
  26. package/dist/cli/commands/extension/describe.js.map +1 -1
  27. package/dist/cli/commands/extension/doctor.js +5 -2
  28. package/dist/cli/commands/extension/doctor.js.map +1 -1
  29. package/dist/cli/commands/extension/install-sources.js +37 -7
  30. package/dist/cli/commands/extension/install-sources.js.map +1 -1
  31. package/dist/cli/commands/extension/scaffold.d.ts +31 -8
  32. package/dist/cli/commands/extension/scaffold.js +1956 -182
  33. package/dist/cli/commands/extension/scaffold.js.map +1 -1
  34. package/dist/cli/commands/extension.d.ts +22 -2
  35. package/dist/cli/commands/extension.js +189 -13
  36. package/dist/cli/commands/extension.js.map +1 -1
  37. package/dist/cli/commands/index.d.ts +3 -1
  38. package/dist/cli/commands/index.js +5 -3
  39. package/dist/cli/commands/index.js.map +1 -1
  40. package/dist/cli/commands/item-filter-options.d.ts +63 -0
  41. package/dist/cli/commands/item-filter-options.js +10 -0
  42. package/dist/cli/commands/item-filter-options.js.map +1 -0
  43. package/dist/cli/commands/legacy-none-tokens.d.ts +14 -0
  44. package/dist/cli/commands/legacy-none-tokens.js +31 -2
  45. package/dist/cli/commands/legacy-none-tokens.js.map +1 -1
  46. package/dist/cli/commands/linked-artifacts.d.ts +7 -0
  47. package/dist/cli/commands/linked-artifacts.js +12 -2
  48. package/dist/cli/commands/linked-artifacts.js.map +1 -1
  49. package/dist/cli/commands/list.d.ts +16 -39
  50. package/dist/cli/commands/list.js +127 -118
  51. package/dist/cli/commands/list.js.map +1 -1
  52. package/dist/cli/commands/next.d.ts +98 -0
  53. package/dist/cli/commands/next.js +304 -0
  54. package/dist/cli/commands/next.js.map +1 -0
  55. package/dist/cli/commands/profile.d.ts +208 -0
  56. package/dist/cli/commands/profile.js +418 -0
  57. package/dist/cli/commands/profile.js.map +1 -0
  58. package/dist/cli/commands/repeatable-metadata-parsers.js +12 -13
  59. package/dist/cli/commands/repeatable-metadata-parsers.js.map +1 -1
  60. package/dist/cli/commands/schema.d.ts +7 -0
  61. package/dist/cli/commands/schema.js +9 -3
  62. package/dist/cli/commands/schema.js.map +1 -1
  63. package/dist/cli/commands/search.d.ts +2 -39
  64. package/dist/cli/commands/search.js +104 -106
  65. package/dist/cli/commands/search.js.map +1 -1
  66. package/dist/cli/commands/shared-unset-fields.d.ts +30 -0
  67. package/dist/cli/commands/shared-unset-fields.js +161 -0
  68. package/dist/cli/commands/shared-unset-fields.js.map +1 -0
  69. package/dist/cli/commands/stats.js +15 -3
  70. package/dist/cli/commands/stats.js.map +1 -1
  71. package/dist/cli/commands/test.js +9 -5
  72. package/dist/cli/commands/test.js.map +1 -1
  73. package/dist/cli/commands/update.d.ts +1 -6
  74. package/dist/cli/commands/update.js +12 -157
  75. package/dist/cli/commands/update.js.map +1 -1
  76. package/dist/cli/commands/validate.js +20 -5
  77. package/dist/cli/commands/validate.js.map +1 -1
  78. package/dist/cli/help-content.js +26 -2
  79. package/dist/cli/help-content.js.map +1 -1
  80. package/dist/cli/help-json-payload.js +3 -3
  81. package/dist/cli/help-json-payload.js.map +1 -1
  82. package/dist/cli/main.js +27 -12
  83. package/dist/cli/main.js.map +1 -1
  84. package/dist/cli/register-list-query.js +42 -3
  85. package/dist/cli/register-list-query.js.map +1 -1
  86. package/dist/cli/register-mutation.js +86 -2
  87. package/dist/cli/register-mutation.js.map +1 -1
  88. package/dist/cli/register-setup.js +67 -6
  89. package/dist/cli/register-setup.js.map +1 -1
  90. package/dist/cli/registration-helpers.d.ts +9 -1
  91. package/dist/cli/registration-helpers.js +34 -3
  92. package/dist/cli/registration-helpers.js.map +1 -1
  93. package/dist/cli-bundle/chunks/activity-EJBMXUBH.js +16 -0
  94. package/dist/cli-bundle/chunks/{activity-H2LMOSSW.js → activity-MVSEND6D.js} +9 -11
  95. package/dist/cli-bundle/chunks/{aggregate-R725FC3S.js → aggregate-MOC4TR2G.js} +16 -17
  96. package/dist/cli-bundle/chunks/aggregate-MOC4TR2G.js.map +1 -0
  97. package/dist/cli-bundle/chunks/{aggregate-EGJLZQBI.js → aggregate-XJHLZQ5X.js} +15 -16
  98. package/dist/cli-bundle/chunks/aggregate-XJHLZQ5X.js.map +7 -0
  99. package/dist/cli-bundle/chunks/{append-5J345QGU.js → append-KDHT4GHI.js} +10 -12
  100. package/dist/cli-bundle/chunks/{append-5J345QGU.js.map → append-KDHT4GHI.js.map} +1 -1
  101. package/dist/cli-bundle/chunks/{append-O5HPBMRN.js → append-LEDBAM3K.js} +8 -10
  102. package/dist/cli-bundle/chunks/{append-O5HPBMRN.js.map → append-LEDBAM3K.js.map} +1 -1
  103. package/dist/cli-bundle/chunks/{chunk-IB3GYLQE.js → chunk-3JWQCLR5.js} +3 -3
  104. package/dist/cli-bundle/chunks/{chunk-2A34E3BA.js → chunk-4TXTVZL3.js} +2 -2
  105. package/dist/cli-bundle/chunks/{chunk-G6N5VEOK.js → chunk-4YIMPANT.js} +3 -3
  106. package/dist/cli-bundle/chunks/{chunk-7AUB5HNA.js → chunk-53ARXF2O.js} +9 -11
  107. package/dist/cli-bundle/chunks/{chunk-7AUB5HNA.js.map → chunk-53ARXF2O.js.map} +1 -1
  108. package/dist/cli-bundle/chunks/chunk-5ABGFWR4.js +116 -0
  109. package/dist/cli-bundle/chunks/chunk-5ABGFWR4.js.map +1 -0
  110. package/dist/cli-bundle/chunks/{chunk-2BFPAUAF.js → chunk-5IRVSKPS.js} +2990 -2890
  111. package/dist/cli-bundle/chunks/chunk-5IRVSKPS.js.map +1 -0
  112. package/dist/cli-bundle/chunks/{chunk-JR2LV3M4.js → chunk-5T6WPLRO.js} +233 -190
  113. package/dist/cli-bundle/chunks/chunk-5T6WPLRO.js.map +7 -0
  114. package/dist/cli-bundle/chunks/{chunk-CKGNPJAG.js → chunk-6T5ZIWBS.js} +3011 -2888
  115. package/dist/cli-bundle/chunks/chunk-6T5ZIWBS.js.map +7 -0
  116. package/dist/cli-bundle/chunks/{chunk-QH3PJYON.js → chunk-6YRAMXRS.js} +111 -114
  117. package/dist/cli-bundle/chunks/chunk-6YRAMXRS.js.map +1 -0
  118. package/dist/cli-bundle/chunks/{chunk-7XGQXHFB.js → chunk-73PTKMAE.js} +3 -3
  119. package/dist/cli-bundle/chunks/{chunk-Y4SUQQYH.js → chunk-74PUWBGN.js} +53 -54
  120. package/dist/cli-bundle/chunks/chunk-74PUWBGN.js.map +1 -0
  121. package/dist/cli-bundle/chunks/{chunk-T5472OMV.js → chunk-7L6TXOOC.js} +4 -6
  122. package/dist/cli-bundle/chunks/{chunk-T5472OMV.js.map → chunk-7L6TXOOC.js.map} +1 -1
  123. package/dist/cli-bundle/chunks/chunk-7M2HAZEB.js +17 -0
  124. package/dist/cli-bundle/chunks/chunk-7M2HAZEB.js.map +7 -0
  125. package/dist/cli-bundle/chunks/{chunk-3VY3YQO6.js → chunk-7RIJGN4R.js} +2 -2
  126. package/dist/cli-bundle/chunks/{chunk-G6PYHBBR.js → chunk-7WDETKGP.js} +192 -113
  127. package/dist/cli-bundle/chunks/chunk-7WDETKGP.js.map +7 -0
  128. package/dist/cli-bundle/chunks/{chunk-AONIHR2C.js → chunk-A3UNLXNJ.js} +40 -260
  129. package/dist/cli-bundle/chunks/chunk-A3UNLXNJ.js.map +7 -0
  130. package/dist/cli-bundle/chunks/{chunk-4KD54S3Z.js → chunk-AWN4PPH5.js} +10 -14
  131. package/dist/cli-bundle/chunks/{chunk-4KD54S3Z.js.map → chunk-AWN4PPH5.js.map} +1 -1
  132. package/dist/cli-bundle/chunks/{chunk-FXR67XVQ.js → chunk-BN3CWK6G.js} +2 -2
  133. package/dist/cli-bundle/chunks/{chunk-KFWBJPSG.js → chunk-BOWQWXLI.js} +12 -24
  134. package/dist/cli-bundle/chunks/chunk-BOWQWXLI.js.map +1 -0
  135. package/dist/cli-bundle/chunks/{chunk-4BHT5VDC.js → chunk-C2KCIZKZ.js} +2 -2
  136. package/dist/cli-bundle/chunks/{chunk-O6LLO73I.js → chunk-CHRNYKNI.js} +2 -2
  137. package/dist/cli-bundle/chunks/{chunk-UELRKQQU.js → chunk-CY5IJMUM.js} +1239 -495
  138. package/dist/cli-bundle/chunks/chunk-CY5IJMUM.js.map +1 -0
  139. package/dist/cli-bundle/chunks/chunk-CZVISY5A.js +87 -0
  140. package/dist/cli-bundle/chunks/chunk-CZVISY5A.js.map +7 -0
  141. package/dist/cli-bundle/chunks/{chunk-7K2XXO4I.js → chunk-D5LYZVGB.js} +7 -9
  142. package/dist/cli-bundle/chunks/{chunk-7K2XXO4I.js.map → chunk-D5LYZVGB.js.map} +1 -1
  143. package/dist/cli-bundle/chunks/{chunk-ZQ3ZVXX2.js → chunk-D6USKAMA.js} +2 -2
  144. package/dist/cli-bundle/chunks/{context-BLBD3PUB.js → chunk-DJDXAU74.js} +19 -21
  145. package/dist/cli-bundle/chunks/chunk-DJDXAU74.js.map +7 -0
  146. package/dist/cli-bundle/chunks/{chunk-WZQWHN4R.js → chunk-DLDCPF5X.js} +3 -3
  147. package/dist/cli-bundle/chunks/{chunk-HFFUQR73.js → chunk-DORJSBGJ.js} +35 -9
  148. package/dist/cli-bundle/chunks/chunk-DORJSBGJ.js.map +7 -0
  149. package/dist/cli-bundle/chunks/{chunk-XVF4YARA.js → chunk-DRPF274X.js} +5 -7
  150. package/dist/cli-bundle/chunks/{chunk-XVF4YARA.js.map → chunk-DRPF274X.js.map} +2 -2
  151. package/dist/cli-bundle/chunks/{chunk-QL5RVYOA.js → chunk-DU66JUGT.js} +16 -14
  152. package/dist/cli-bundle/chunks/chunk-DU66JUGT.js.map +7 -0
  153. package/dist/cli-bundle/chunks/{chunk-UVC5LOR7.js → chunk-E2Q2ULMR.js} +4 -4
  154. package/dist/cli-bundle/chunks/{chunk-U2Z5YUSO.js → chunk-EVWYAG46.js} +9 -11
  155. package/dist/cli-bundle/chunks/{chunk-U2Z5YUSO.js.map → chunk-EVWYAG46.js.map} +1 -1
  156. package/dist/cli-bundle/chunks/{chunk-5VOINNKT.js → chunk-F6VH3LFC.js} +2 -2
  157. package/dist/cli-bundle/chunks/{chunk-VFAQ4LMN.js → chunk-F7G53BOA.js} +18 -11
  158. package/dist/cli-bundle/chunks/chunk-F7G53BOA.js.map +7 -0
  159. package/dist/cli-bundle/chunks/{chunk-Q2KNGP7C.js → chunk-FBZ5XAAF.js} +9 -11
  160. package/dist/cli-bundle/chunks/{chunk-Q2KNGP7C.js.map → chunk-FBZ5XAAF.js.map} +1 -1
  161. package/dist/cli-bundle/chunks/{chunk-H4IIJDE4.js → chunk-FDEVKXC4.js} +2 -2
  162. package/dist/cli-bundle/chunks/{chunk-7UGEAPRY.js → chunk-GF7EAR22.js} +10 -14
  163. package/dist/cli-bundle/chunks/{chunk-7UGEAPRY.js.map → chunk-GF7EAR22.js.map} +1 -1
  164. package/dist/cli-bundle/chunks/{context-DHLVPXN3.js → chunk-HIBK6H4S.js} +20 -22
  165. package/dist/cli-bundle/chunks/chunk-HIBK6H4S.js.map +1 -0
  166. package/dist/cli-bundle/chunks/{chunk-34EONI5F.js → chunk-HUYYMTGW.js} +2 -2
  167. package/dist/cli-bundle/chunks/chunk-IBMFIKVS.js +14 -0
  168. package/dist/cli-bundle/chunks/chunk-IBMFIKVS.js.map +1 -0
  169. package/dist/cli-bundle/chunks/{chunk-BB6MDVNQ.js → chunk-IBU2LLWM.js} +8 -12
  170. package/dist/cli-bundle/chunks/{chunk-BB6MDVNQ.js.map → chunk-IBU2LLWM.js.map} +1 -1
  171. package/dist/cli-bundle/chunks/{chunk-55ISXAQH.js → chunk-IDYCAK35.js} +53 -54
  172. package/dist/cli-bundle/chunks/chunk-IDYCAK35.js.map +7 -0
  173. package/dist/cli-bundle/chunks/{chunk-M4T5DXD5.js → chunk-IF4ERU6A.js} +7 -9
  174. package/dist/cli-bundle/chunks/{chunk-M4T5DXD5.js.map → chunk-IF4ERU6A.js.map} +1 -1
  175. package/dist/cli-bundle/chunks/{chunk-CIIK67GW.js → chunk-IHXXUIXS.js} +4 -4
  176. package/dist/cli-bundle/chunks/chunk-IZQOJR2B.js +2459 -0
  177. package/dist/cli-bundle/chunks/chunk-IZQOJR2B.js.map +7 -0
  178. package/dist/cli-bundle/chunks/{chunk-SBQTAVJZ.js → chunk-JIP67N2K.js} +3 -3
  179. package/dist/cli-bundle/chunks/chunk-JJ4SG243.js +119 -0
  180. package/dist/cli-bundle/chunks/chunk-JJ4SG243.js.map +7 -0
  181. package/dist/cli-bundle/chunks/{chunk-TQZH6OD6.js → chunk-JTRKME24.js} +11 -13
  182. package/dist/cli-bundle/chunks/{chunk-TQZH6OD6.js.map → chunk-JTRKME24.js.map} +1 -1
  183. package/dist/cli-bundle/chunks/{chunk-WBRKK5QR.js → chunk-JVQ7UOYC.js} +6 -8
  184. package/dist/cli-bundle/chunks/{chunk-WBRKK5QR.js.map → chunk-JVQ7UOYC.js.map} +1 -1
  185. package/dist/cli-bundle/chunks/{chunk-KQMUV6LX.js → chunk-JZG5ADVE.js} +191 -98
  186. package/dist/cli-bundle/chunks/chunk-JZG5ADVE.js.map +1 -0
  187. package/dist/cli-bundle/chunks/{chunk-46G6RSB6.js → chunk-K46GQ265.js} +17 -15
  188. package/dist/cli-bundle/chunks/chunk-K46GQ265.js.map +1 -0
  189. package/dist/cli-bundle/chunks/{chunk-5UVVASSA.js → chunk-KGQ3W65B.js} +100 -35
  190. package/dist/cli-bundle/chunks/chunk-KGQ3W65B.js.map +1 -0
  191. package/dist/cli-bundle/chunks/{chunk-2T3JG6V4.js → chunk-KRASIL6M.js} +2 -2
  192. package/dist/cli-bundle/chunks/{chunk-SR3EKWZG.js → chunk-KTMMTOIP.js} +127 -127
  193. package/dist/cli-bundle/chunks/chunk-KTMMTOIP.js.map +7 -0
  194. package/dist/cli-bundle/chunks/{chunk-DT5LPYOD.js → chunk-KYDYQMNW.js} +5 -7
  195. package/dist/cli-bundle/chunks/{chunk-DT5LPYOD.js.map → chunk-KYDYQMNW.js.map} +1 -1
  196. package/dist/cli-bundle/chunks/{chunk-IPKJ6B36.js → chunk-LBH7UYKY.js} +106 -34
  197. package/dist/cli-bundle/chunks/chunk-LBH7UYKY.js.map +7 -0
  198. package/dist/cli-bundle/chunks/{chunk-P77P2ILI.js → chunk-MLHX6DN5.js} +2 -2
  199. package/dist/cli-bundle/chunks/{chunk-YUDJD3XO.js → chunk-NIBP3I7A.js} +36 -10
  200. package/dist/cli-bundle/chunks/chunk-NIBP3I7A.js.map +1 -0
  201. package/dist/cli-bundle/chunks/{schema-RBTJ2YXW.js → chunk-NO6Y6FB2.js} +144 -67
  202. package/dist/cli-bundle/chunks/chunk-NO6Y6FB2.js.map +7 -0
  203. package/dist/cli-bundle/chunks/{chunk-2CKH2LMV.js → chunk-OB3RJV5F.js} +2 -2
  204. package/dist/cli-bundle/chunks/chunk-OKQ22KTH.js +379 -0
  205. package/dist/cli-bundle/chunks/chunk-OKQ22KTH.js.map +1 -0
  206. package/dist/cli-bundle/chunks/{chunk-FIGAZ4Y7.js → chunk-OUQ5JEFM.js} +3 -3
  207. package/dist/cli-bundle/chunks/{chunk-NK3UPBVG.js → chunk-QE5UFCCO.js} +2 -2
  208. package/dist/cli-bundle/chunks/{chunk-MJTINN54.js → chunk-RM6MHL6A.js} +110 -113
  209. package/dist/cli-bundle/chunks/chunk-RM6MHL6A.js.map +7 -0
  210. package/dist/cli-bundle/chunks/{chunk-LRKKONT2.js → chunk-RPRW26NG.js} +12 -16
  211. package/dist/cli-bundle/chunks/{chunk-LRKKONT2.js.map → chunk-RPRW26NG.js.map} +1 -1
  212. package/dist/cli-bundle/chunks/{chunk-WM5ZVBPE.js → chunk-SJZTPVFT.js} +4 -4
  213. package/dist/cli-bundle/chunks/{chunk-MJTSZKK5.js → chunk-SNUK7H5J.js} +1363 -605
  214. package/dist/cli-bundle/chunks/chunk-SNUK7H5J.js.map +7 -0
  215. package/dist/cli-bundle/chunks/chunk-T7ZMQI4J.js +2435 -0
  216. package/dist/cli-bundle/chunks/chunk-T7ZMQI4J.js.map +1 -0
  217. package/dist/cli-bundle/chunks/{chunk-W72GHSJE.js → chunk-TQ6E76BE.js} +11 -13
  218. package/dist/cli-bundle/chunks/{chunk-W72GHSJE.js.map → chunk-TQ6E76BE.js.map} +1 -1
  219. package/dist/cli-bundle/chunks/{chunk-ZRK4O56R.js → chunk-UB3V5WUI.js} +225 -189
  220. package/dist/cli-bundle/chunks/chunk-UB3V5WUI.js.map +1 -0
  221. package/dist/cli-bundle/chunks/{chunk-SKN7LC5W.js → chunk-UFKNF23C.js} +11 -23
  222. package/dist/cli-bundle/chunks/chunk-UFKNF23C.js.map +7 -0
  223. package/dist/cli-bundle/chunks/{chunk-VAYA4XFX.js → chunk-V3KLX7U7.js} +3 -3
  224. package/dist/cli-bundle/chunks/{chunk-GAJVRGGA.js → chunk-VD3LKZFX.js} +41 -254
  225. package/dist/cli-bundle/chunks/chunk-VD3LKZFX.js.map +1 -0
  226. package/dist/cli-bundle/chunks/{chunk-AD3A7ZD6.js → chunk-VMY7MZEM.js} +10 -14
  227. package/dist/cli-bundle/chunks/{chunk-AD3A7ZD6.js.map → chunk-VMY7MZEM.js.map} +1 -1
  228. package/dist/cli-bundle/chunks/chunk-VZDBVEZR.js +382 -0
  229. package/dist/cli-bundle/chunks/chunk-VZDBVEZR.js.map +7 -0
  230. package/dist/cli-bundle/chunks/{chunk-CE5P2NQR.js → chunk-WFJZDUM7.js} +19 -12
  231. package/dist/cli-bundle/chunks/chunk-WFJZDUM7.js.map +1 -0
  232. package/dist/cli-bundle/chunks/{schema-MNTAVQCY.js → chunk-WTRUDJ3R.js} +136 -66
  233. package/dist/cli-bundle/chunks/chunk-WTRUDJ3R.js.map +1 -0
  234. package/dist/cli-bundle/chunks/{chunk-T72AZDBA.js → chunk-YEDFE4DC.js} +6 -8
  235. package/dist/cli-bundle/chunks/{chunk-T72AZDBA.js.map → chunk-YEDFE4DC.js.map} +1 -1
  236. package/dist/cli-bundle/chunks/chunk-YJIEJRZB.js +84 -0
  237. package/dist/cli-bundle/chunks/chunk-YJIEJRZB.js.map +1 -0
  238. package/dist/cli-bundle/chunks/{chunk-H2IP4QLJ.js → chunk-Z55WX4IQ.js} +12 -16
  239. package/dist/cli-bundle/chunks/{chunk-H2IP4QLJ.js.map → chunk-Z55WX4IQ.js.map} +1 -1
  240. package/dist/cli-bundle/chunks/{chunk-2RDVQEWV.js → chunk-Z5BM2FKQ.js} +4 -4
  241. package/dist/cli-bundle/chunks/{chunk-66MEDTUD.js → chunk-ZEATCVAC.js} +2 -2
  242. package/dist/cli-bundle/chunks/{chunk-NCVCO3NZ.js → chunk-ZFIEEDTJ.js} +3 -3
  243. package/dist/cli-bundle/chunks/{chunk-7SV63ZHD.js → chunk-ZIE6WXJ2.js} +128 -128
  244. package/dist/cli-bundle/chunks/chunk-ZIE6WXJ2.js.map +1 -0
  245. package/dist/cli-bundle/chunks/{claim-4KHAA2RN.js → claim-6NINZYB3.js} +10 -12
  246. package/dist/cli-bundle/chunks/{claim-4KHAA2RN.js.map → claim-6NINZYB3.js.map} +1 -1
  247. package/dist/cli-bundle/chunks/{claim-CSPJFLNH.js → claim-HMCLSLUE.js} +8 -10
  248. package/dist/cli-bundle/chunks/{claim-CSPJFLNH.js.map → claim-HMCLSLUE.js.map} +1 -1
  249. package/dist/cli-bundle/chunks/close-37KEHLYM.js +14 -0
  250. package/dist/cli-bundle/chunks/{close-W56IOGYG.js → close-OP3LK7Z2.js} +7 -8
  251. package/dist/cli-bundle/chunks/{close-many-BX5DCSVV.js → close-many-BFMP6HHK.js} +15 -17
  252. package/dist/cli-bundle/chunks/{close-many-BX5DCSVV.js.map → close-many-BFMP6HHK.js.map} +1 -1
  253. package/dist/cli-bundle/chunks/{close-many-TQU5F4E4.js → close-many-CXJBOWWY.js} +17 -19
  254. package/dist/cli-bundle/chunks/{close-many-TQU5F4E4.js.map → close-many-CXJBOWWY.js.map} +1 -1
  255. package/dist/cli-bundle/chunks/{comments-VRECH75R.js → comments-ETHABIY6.js} +9 -11
  256. package/dist/cli-bundle/chunks/{comments-VRECH75R.js.map → comments-ETHABIY6.js.map} +1 -1
  257. package/dist/cli-bundle/chunks/{comments-U5KUC4EU.js → comments-MU2WMBUY.js} +11 -13
  258. package/dist/cli-bundle/chunks/{comments-U5KUC4EU.js.map → comments-MU2WMBUY.js.map} +1 -1
  259. package/dist/cli-bundle/chunks/{config-D3OKQO52.js → config-FIXJZEQK.js} +18 -387
  260. package/dist/cli-bundle/chunks/config-FIXJZEQK.js.map +7 -0
  261. package/dist/cli-bundle/chunks/{config-MMJA4LLK.js → config-X3ZVCUUG.js} +18 -380
  262. package/dist/cli-bundle/chunks/config-X3ZVCUUG.js.map +1 -0
  263. package/dist/cli-bundle/chunks/context-7ZEZV3BV.js +42 -0
  264. package/dist/cli-bundle/chunks/context-XDI4DKKT.js +46 -0
  265. package/dist/cli-bundle/chunks/{contracts-XGVMMPC5.js → contracts-KP4QAGVW.js} +72 -15
  266. package/dist/cli-bundle/chunks/contracts-KP4QAGVW.js.map +1 -0
  267. package/dist/cli-bundle/chunks/{contracts-C3SZCXXG.js → contracts-SMOAN5NF.js} +72 -15
  268. package/dist/cli-bundle/chunks/contracts-SMOAN5NF.js.map +7 -0
  269. package/dist/cli-bundle/chunks/{copy-HHL3K4QP.js → copy-CWM6SBY6.js} +7 -11
  270. package/dist/cli-bundle/chunks/{copy-HHL3K4QP.js.map → copy-CWM6SBY6.js.map} +1 -1
  271. package/dist/cli-bundle/chunks/{copy-5D5DX3VK.js → copy-JJ3KOQW2.js} +9 -13
  272. package/dist/cli-bundle/chunks/{copy-5D5DX3VK.js.map → copy-JJ3KOQW2.js.map} +1 -1
  273. package/dist/cli-bundle/chunks/create-DFMNBKBS.js +28 -0
  274. package/dist/cli-bundle/chunks/{create-IXY43O4H.js → create-J5Q2ELZT.js} +12 -14
  275. package/dist/cli-bundle/chunks/{delete-IBUR3M42.js → delete-2GZLQEUQ.js} +7 -9
  276. package/dist/cli-bundle/chunks/{delete-IBUR3M42.js.map → delete-2GZLQEUQ.js.map} +1 -1
  277. package/dist/cli-bundle/chunks/{delete-QQC2FGUH.js → delete-OOQS4KVD.js} +5 -7
  278. package/dist/cli-bundle/chunks/{delete-QQC2FGUH.js.map → delete-OOQS4KVD.js.map} +1 -1
  279. package/dist/cli-bundle/chunks/{deps-KWKRHXIN.js → deps-IF4IGL4R.js} +6 -9
  280. package/dist/cli-bundle/chunks/{deps-KWKRHXIN.js.map → deps-IF4IGL4R.js.map} +1 -1
  281. package/dist/cli-bundle/chunks/{deps-VTPO4BSE.js → deps-ZVGGCRR6.js} +8 -11
  282. package/dist/cli-bundle/chunks/{deps-VTPO4BSE.js.map → deps-ZVGGCRR6.js.map} +1 -1
  283. package/dist/cli-bundle/chunks/{docs-IIO3FEUO.js → docs-2TIFR62T.js} +8 -9
  284. package/dist/cli-bundle/chunks/{docs-IIO3FEUO.js.map → docs-2TIFR62T.js.map} +1 -1
  285. package/dist/cli-bundle/chunks/{docs-7CHFHXLN.js → docs-NFTBCQQC.js} +10 -11
  286. package/dist/cli-bundle/chunks/{docs-7CHFHXLN.js.map → docs-NFTBCQQC.js.map} +1 -1
  287. package/dist/cli-bundle/chunks/{eval-IO7LREOL.js → eval-2F6EH4XN.js} +12 -14
  288. package/dist/cli-bundle/chunks/{eval-IO7LREOL.js.map → eval-2F6EH4XN.js.map} +1 -1
  289. package/dist/cli-bundle/chunks/{eval-CEYYEPSX.js → eval-PFKXQR3B.js} +10 -12
  290. package/dist/cli-bundle/chunks/{eval-CEYYEPSX.js.map → eval-PFKXQR3B.js.map} +1 -1
  291. package/dist/cli-bundle/chunks/{extension-KCPUWSY2.js → extension-3LRYX7SW.js} +11 -7
  292. package/dist/cli-bundle/chunks/{extension-UTTQDUYI.js → extension-GMVOIP4O.js} +11 -7
  293. package/dist/cli-bundle/chunks/{files-Z2HHEFGP.js → files-DF3HO6XK.js} +11 -13
  294. package/dist/cli-bundle/chunks/{files-Z2HHEFGP.js.map → files-DF3HO6XK.js.map} +1 -1
  295. package/dist/cli-bundle/chunks/{files-TPUL6KWB.js → files-T5ODMETM.js} +9 -11
  296. package/dist/cli-bundle/chunks/{files-TPUL6KWB.js.map → files-T5ODMETM.js.map} +1 -1
  297. package/dist/cli-bundle/chunks/{focus-YRNNH7IP.js → focus-DLXKK4AH.js} +10 -14
  298. package/dist/cli-bundle/chunks/{focus-YRNNH7IP.js.map → focus-DLXKK4AH.js.map} +1 -1
  299. package/dist/cli-bundle/chunks/{focus-JVJCGC2D.js → focus-MY5ARIEK.js} +8 -12
  300. package/dist/cli-bundle/chunks/{focus-JVJCGC2D.js.map → focus-MY5ARIEK.js.map} +1 -1
  301. package/dist/cli-bundle/chunks/{gc-O5GUO3SU.js → gc-FULIVYR4.js} +3 -3
  302. package/dist/cli-bundle/chunks/{gc-PYVVEELM.js → gc-MDGRR2SU.js} +3 -3
  303. package/dist/cli-bundle/chunks/{get-X4O3HBEY.js → get-AWK324RS.js} +10 -13
  304. package/dist/cli-bundle/chunks/{get-X4O3HBEY.js.map → get-AWK324RS.js.map} +1 -1
  305. package/dist/cli-bundle/chunks/{get-ENLTEGTX.js → get-VYPIICPC.js} +12 -15
  306. package/dist/cli-bundle/chunks/{get-ENLTEGTX.js.map → get-VYPIICPC.js.map} +1 -1
  307. package/dist/cli-bundle/chunks/{health-5EXTY44Q.js → health-FBCVZGSX.js} +16 -17
  308. package/dist/cli-bundle/chunks/{health-5EXTY44Q.js.map → health-FBCVZGSX.js.map} +1 -1
  309. package/dist/cli-bundle/chunks/{health-BOTB7YSU.js → health-Q66C43GN.js} +18 -19
  310. package/dist/cli-bundle/chunks/{health-BOTB7YSU.js.map → health-Q66C43GN.js.map} +1 -1
  311. package/dist/cli-bundle/chunks/history-5XUSLAJA.js +18 -0
  312. package/dist/cli-bundle/chunks/{history-AJTXLT6S.js → history-X4OSES6K.js} +8 -10
  313. package/dist/cli-bundle/chunks/{history-compact-46MRHW3I.js → history-compact-2GHT32UX.js} +13 -16
  314. package/dist/cli-bundle/chunks/{history-compact-46MRHW3I.js.map → history-compact-2GHT32UX.js.map} +1 -1
  315. package/dist/cli-bundle/chunks/{history-compact-43OOUAWD.js → history-compact-WLCQEKXS.js} +11 -14
  316. package/dist/cli-bundle/chunks/{history-compact-43OOUAWD.js.map → history-compact-WLCQEKXS.js.map} +1 -1
  317. package/dist/cli-bundle/chunks/{history-redact-KUUUVUFM.js → history-redact-45YW65BK.js} +9 -11
  318. package/dist/cli-bundle/chunks/history-redact-BVHWDXPR.js +19 -0
  319. package/dist/cli-bundle/chunks/{history-repair-B5PZBOPU.js → history-repair-FY75IC26.js} +13 -16
  320. package/dist/cli-bundle/chunks/{history-repair-B5PZBOPU.js.map → history-repair-FY75IC26.js.map} +1 -1
  321. package/dist/cli-bundle/chunks/{history-repair-VQTYOSRS.js → history-repair-GABSDSVD.js} +11 -14
  322. package/dist/cli-bundle/chunks/{history-repair-VQTYOSRS.js.map → history-repair-GABSDSVD.js.map} +1 -1
  323. package/dist/cli-bundle/chunks/{init-BNLVFPRG.js → init-KO7CGIRQ.js} +11 -11
  324. package/dist/cli-bundle/chunks/init-TRYJELH4.js +21 -0
  325. package/dist/cli-bundle/chunks/{learnings-MUUU5KMC.js → learnings-3F7YLI45.js} +9 -11
  326. package/dist/cli-bundle/chunks/{learnings-MUUU5KMC.js.map → learnings-3F7YLI45.js.map} +1 -1
  327. package/dist/cli-bundle/chunks/{learnings-XSGX52S7.js → learnings-LHZT5BHW.js} +11 -13
  328. package/dist/cli-bundle/chunks/{learnings-XSGX52S7.js.map → learnings-LHZT5BHW.js.map} +1 -1
  329. package/dist/cli-bundle/chunks/{list-32U7BSKE.js → list-ROT7JF62.js} +10 -10
  330. package/dist/cli-bundle/chunks/{list-ZEEOHLTQ.js → list-Y6AU5BJS.js} +10 -10
  331. package/dist/cli-bundle/chunks/next-66BJB4N2.js +277 -0
  332. package/dist/cli-bundle/chunks/next-66BJB4N2.js.map +7 -0
  333. package/dist/cli-bundle/chunks/next-N5MWJTBY.js +274 -0
  334. package/dist/cli-bundle/chunks/next-N5MWJTBY.js.map +1 -0
  335. package/dist/cli-bundle/chunks/{notes-OHU25L3M.js → notes-EVJZ3VAB.js} +11 -13
  336. package/dist/cli-bundle/chunks/{notes-OHU25L3M.js.map → notes-EVJZ3VAB.js.map} +1 -1
  337. package/dist/cli-bundle/chunks/{notes-NJ45OZGF.js → notes-FW6YFLND.js} +9 -11
  338. package/dist/cli-bundle/chunks/{notes-NJ45OZGF.js.map → notes-FW6YFLND.js.map} +1 -1
  339. package/dist/cli-bundle/chunks/{plan-LWWAEV5Y.js → plan-DQ7G4EDC.js} +15 -18
  340. package/dist/cli-bundle/chunks/{plan-LWWAEV5Y.js.map → plan-DQ7G4EDC.js.map} +1 -1
  341. package/dist/cli-bundle/chunks/{plan-KQA7CAKI.js → plan-ZHKZ7JVF.js} +17 -20
  342. package/dist/cli-bundle/chunks/{plan-KQA7CAKI.js.map → plan-ZHKZ7JVF.js.map} +1 -1
  343. package/dist/cli-bundle/chunks/profile-CHAW6SEA.js +1197 -0
  344. package/dist/cli-bundle/chunks/profile-CHAW6SEA.js.map +1 -0
  345. package/dist/cli-bundle/chunks/profile-UPZGCDOG.js +1235 -0
  346. package/dist/cli-bundle/chunks/profile-UPZGCDOG.js.map +7 -0
  347. package/dist/cli-bundle/chunks/{register-list-query-DDCHPONM.js → register-list-query-KY6Z6WV7.js} +44 -20
  348. package/dist/cli-bundle/chunks/register-list-query-KY6Z6WV7.js.map +7 -0
  349. package/dist/cli-bundle/chunks/{register-list-query-YNPBVIKM.js → register-list-query-Y2VRHPCL.js} +45 -21
  350. package/dist/cli-bundle/chunks/register-list-query-Y2VRHPCL.js.map +1 -0
  351. package/dist/cli-bundle/chunks/{register-mutation-LAVKYY63.js → register-mutation-N6AYSKPM.js} +103 -37
  352. package/dist/cli-bundle/chunks/register-mutation-N6AYSKPM.js.map +7 -0
  353. package/dist/cli-bundle/chunks/{register-mutation-7ALWDDAX.js → register-mutation-PCARIGZS.js} +104 -38
  354. package/dist/cli-bundle/chunks/register-mutation-PCARIGZS.js.map +1 -0
  355. package/dist/cli-bundle/chunks/{register-operations-U5JAW3WE.js → register-operations-L6CYTOIH.js} +30 -32
  356. package/dist/cli-bundle/chunks/{register-operations-U5JAW3WE.js.map → register-operations-L6CYTOIH.js.map} +1 -1
  357. package/dist/cli-bundle/chunks/{register-operations-R4VOQ6EF.js → register-operations-YAT6FUUB.js} +32 -34
  358. package/dist/cli-bundle/chunks/{register-operations-R4VOQ6EF.js.map → register-operations-YAT6FUUB.js.map} +1 -1
  359. package/dist/cli-bundle/chunks/{register-setup-KBXQDCXE.js → register-setup-MPANILQF.js} +67 -24
  360. package/dist/cli-bundle/chunks/register-setup-MPANILQF.js.map +7 -0
  361. package/dist/cli-bundle/chunks/{register-setup-RCRUHMSZ.js → register-setup-N7UGXYJC.js} +68 -25
  362. package/dist/cli-bundle/chunks/register-setup-N7UGXYJC.js.map +1 -0
  363. package/dist/cli-bundle/chunks/{restore-6K53WOWO.js → restore-DKMCLPI5.js} +9 -11
  364. package/dist/cli-bundle/chunks/restore-IRAKSWIW.js +17 -0
  365. package/dist/cli-bundle/chunks/{scheduling-shortcuts-NJ5UVJFB.js → scheduling-shortcuts-3F4QUEDH.js} +14 -16
  366. package/dist/cli-bundle/chunks/{scheduling-shortcuts-NJ5UVJFB.js.map → scheduling-shortcuts-3F4QUEDH.js.map} +1 -1
  367. package/dist/cli-bundle/chunks/{scheduling-shortcuts-OQVJXG3M.js → scheduling-shortcuts-BNZLQK36.js} +12 -14
  368. package/dist/cli-bundle/chunks/{scheduling-shortcuts-OQVJXG3M.js.map → scheduling-shortcuts-BNZLQK36.js.map} +1 -1
  369. package/dist/cli-bundle/chunks/schema-OLT6LVKH.js +75 -0
  370. package/dist/cli-bundle/chunks/schema-XJXKJQF5.js +71 -0
  371. package/dist/cli-bundle/chunks/{search-6HOIVZDU.js → search-CX5UMV4H.js} +10 -12
  372. package/dist/cli-bundle/chunks/{search-ZWYEMASC.js → search-KP6H7COV.js} +10 -12
  373. package/dist/cli-bundle/chunks/{stats-R5OAJVZK.js → stats-7XW4OEMK.js} +20 -12
  374. package/dist/cli-bundle/chunks/stats-7XW4OEMK.js.map +7 -0
  375. package/dist/cli-bundle/chunks/{stats-FS742AMA.js → stats-QZUG6MX5.js} +21 -13
  376. package/dist/cli-bundle/chunks/stats-QZUG6MX5.js.map +1 -0
  377. package/dist/cli-bundle/chunks/{telemetry-7DIGDQUO.js → telemetry-DIFPXCAT.js} +4 -4
  378. package/dist/cli-bundle/chunks/{telemetry-FWEXSJLQ.js → telemetry-WTYFUPRL.js} +4 -4
  379. package/dist/cli-bundle/chunks/{test-NZF7OT2F.js → test-HU2BS7EY.js} +14 -16
  380. package/dist/cli-bundle/chunks/test-HU2BS7EY.js.map +1 -0
  381. package/dist/cli-bundle/chunks/test-QNDXZQCW.js +34 -0
  382. package/dist/cli-bundle/chunks/test-QNDXZQCW.js.map +7 -0
  383. package/dist/cli-bundle/chunks/{test-all-DPN62TX7.js → test-all-PZTBLLQ6.js} +17 -20
  384. package/dist/cli-bundle/chunks/{test-all-DPN62TX7.js.map → test-all-PZTBLLQ6.js.map} +1 -1
  385. package/dist/cli-bundle/chunks/{test-all-KL7TLMJF.js → test-all-XLPI4USF.js} +19 -22
  386. package/dist/cli-bundle/chunks/{test-all-KL7TLMJF.js.map → test-all-XLPI4USF.js.map} +1 -1
  387. package/dist/cli-bundle/chunks/{test-runs-C6CFIVOS.js → test-runs-CA6K32RD.js} +6 -7
  388. package/dist/cli-bundle/chunks/test-runs-CA6K32RD.js.map +1 -0
  389. package/dist/cli-bundle/chunks/{test-runs-IAJDL6CA.js → test-runs-LANLLPVO.js} +5 -6
  390. package/dist/cli-bundle/chunks/test-runs-LANLLPVO.js.map +7 -0
  391. package/dist/cli-bundle/chunks/update-DJKWLBWJ.js +28 -0
  392. package/dist/cli-bundle/chunks/update-DJKWLBWJ.js.map +1 -0
  393. package/dist/cli-bundle/chunks/update-UXDLTEOZ.js +24 -0
  394. package/dist/cli-bundle/chunks/update-UXDLTEOZ.js.map +7 -0
  395. package/dist/cli-bundle/chunks/{update-many-YEH2DQL6.js → update-many-LU3SCNK5.js} +32 -33
  396. package/dist/cli-bundle/chunks/{update-many-YEH2DQL6.js.map → update-many-LU3SCNK5.js.map} +1 -1
  397. package/dist/cli-bundle/chunks/{update-many-MUTIOAP3.js → update-many-VW5DGF3S.js} +34 -35
  398. package/dist/cli-bundle/chunks/{update-many-MUTIOAP3.js.map → update-many-VW5DGF3S.js.map} +1 -1
  399. package/dist/cli-bundle/chunks/{upgrade-HYJ3SWWU.js → upgrade-77FRUAXN.js} +12 -8
  400. package/dist/cli-bundle/chunks/{upgrade-HYJ3SWWU.js.map → upgrade-77FRUAXN.js.map} +1 -1
  401. package/dist/cli-bundle/chunks/{upgrade-UBNLBZNR.js → upgrade-ICXY244R.js} +10 -6
  402. package/dist/cli-bundle/chunks/{upgrade-UBNLBZNR.js.map → upgrade-ICXY244R.js.map} +1 -1
  403. package/dist/cli-bundle/chunks/{validate-6QWQVCX2.js → validate-2G566PKQ.js} +37 -28
  404. package/dist/cli-bundle/chunks/validate-2G566PKQ.js.map +7 -0
  405. package/dist/cli-bundle/chunks/{validate-W5V5ZGQX.js → validate-BDPVXHHH.js} +38 -29
  406. package/dist/cli-bundle/chunks/validate-BDPVXHHH.js.map +1 -0
  407. package/dist/cli-bundle/main.js +56 -38
  408. package/dist/cli-bundle/main.js.map +2 -2
  409. package/dist/core/config/positional-value.d.ts +2 -0
  410. package/dist/core/config/positional-value.js +2 -2
  411. package/dist/core/config/positional-value.js.map +1 -1
  412. package/dist/core/extensions/activation-summary-markdown.d.ts +71 -0
  413. package/dist/core/extensions/activation-summary-markdown.js +140 -0
  414. package/dist/core/extensions/activation-summary-markdown.js.map +1 -0
  415. package/dist/core/extensions/activation-summary.d.ts +2 -0
  416. package/dist/core/extensions/activation-summary.js +3 -2
  417. package/dist/core/extensions/activation-summary.js.map +1 -1
  418. package/dist/core/extensions/capability-usage.d.ts +1 -1
  419. package/dist/core/extensions/capability-usage.js +4 -3
  420. package/dist/core/extensions/capability-usage.js.map +1 -1
  421. package/dist/core/extensions/extension-registries.js +3 -2
  422. package/dist/core/extensions/extension-registries.js.map +1 -1
  423. package/dist/core/extensions/extension-types.d.ts +21 -1
  424. package/dist/core/extensions/extension-types.js +3 -2
  425. package/dist/core/extensions/extension-types.js.map +1 -1
  426. package/dist/core/extensions/loader.d.ts +1 -2
  427. package/dist/core/extensions/loader.js +169 -103
  428. package/dist/core/extensions/loader.js.map +1 -1
  429. package/dist/core/extensions/version-compat.d.ts +107 -0
  430. package/dist/core/extensions/version-compat.js +130 -0
  431. package/dist/core/extensions/version-compat.js.map +1 -0
  432. package/dist/core/fs/fs-utils.js +27 -2
  433. package/dist/core/fs/fs-utils.js.map +1 -1
  434. package/dist/core/item/actionability.d.ts +57 -0
  435. package/dist/core/item/actionability.js +178 -0
  436. package/dist/core/item/actionability.js.map +1 -0
  437. package/dist/core/item/type-registry.js +18 -45
  438. package/dist/core/item/type-registry.js.map +1 -1
  439. package/dist/core/profile/profile-describe.d.ts +64 -0
  440. package/dist/core/profile/profile-describe.js +83 -0
  441. package/dist/core/profile/profile-describe.js.map +1 -0
  442. package/dist/core/profile/profile-lint.d.ts +53 -0
  443. package/dist/core/profile/profile-lint.js +422 -0
  444. package/dist/core/profile/profile-lint.js.map +1 -0
  445. package/dist/core/profile/profile-plan.d.ts +145 -0
  446. package/dist/core/profile/profile-plan.js +0 -0
  447. package/dist/core/profile/profile-plan.js.map +1 -0
  448. package/dist/core/profile/profile-presets.d.ts +218 -0
  449. package/dist/core/profile/profile-presets.js +325 -0
  450. package/dist/core/profile/profile-presets.js.map +1 -0
  451. package/dist/core/schema/fields-file.js +25 -25
  452. package/dist/core/schema/fields-file.js.map +1 -1
  453. package/dist/core/schema/item-types-file.js +3 -3
  454. package/dist/core/schema/item-types-file.js.map +1 -1
  455. package/dist/core/schema/runtime-schema.js +4 -4
  456. package/dist/core/schema/runtime-schema.js.map +1 -1
  457. package/dist/core/schema/status-defs-file.js +3 -3
  458. package/dist/core/schema/status-defs-file.js.map +1 -1
  459. package/dist/core/shared/serialization.js +83 -62
  460. package/dist/core/shared/serialization.js.map +1 -1
  461. package/dist/core/store/item-store.d.ts +1 -0
  462. package/dist/core/store/item-store.js +16 -8
  463. package/dist/core/store/item-store.js.map +1 -1
  464. package/dist/core/store/paths.js +4 -32
  465. package/dist/core/store/paths.js.map +1 -1
  466. package/dist/core/store/settings.js +14 -14
  467. package/dist/core/store/settings.js.map +1 -1
  468. package/dist/core/telemetry/observability.js +50 -54
  469. package/dist/core/telemetry/observability.js.map +1 -1
  470. package/dist/core/telemetry/runtime.js +11 -2
  471. package/dist/core/telemetry/runtime.js.map +1 -1
  472. package/dist/core/test/background-runs.js +3 -2
  473. package/dist/core/test/background-runs.js.map +1 -1
  474. package/dist/core/validate/linked-artifact-reference.d.ts +24 -0
  475. package/dist/core/validate/linked-artifact-reference.js +41 -0
  476. package/dist/core/validate/linked-artifact-reference.js.map +1 -0
  477. package/dist/mcp/server.js +183 -83
  478. package/dist/mcp/server.js.map +1 -1
  479. package/dist/mcp/tool-definitions.js +33 -2
  480. package/dist/mcp/tool-definitions.js.map +1 -1
  481. package/dist/sdk/cli-contracts/commander-types.d.ts +1 -0
  482. package/dist/sdk/cli-contracts/commander-types.js +15 -2
  483. package/dist/sdk/cli-contracts/commander-types.js.map +1 -1
  484. package/dist/sdk/cli-contracts/enum-contracts.d.ts +3 -3
  485. package/dist/sdk/cli-contracts/enum-contracts.js +6 -2
  486. package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -1
  487. package/dist/sdk/cli-contracts/flag-contracts.d.ts +149 -0
  488. package/dist/sdk/cli-contracts/flag-contracts.js +1583 -0
  489. package/dist/sdk/cli-contracts/flag-contracts.js.map +1 -0
  490. package/dist/sdk/cli-contracts/string-lists.d.ts +14 -0
  491. package/dist/sdk/cli-contracts/string-lists.js +20 -0
  492. package/dist/sdk/cli-contracts/string-lists.js.map +1 -0
  493. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +1 -1
  494. package/dist/sdk/cli-contracts/tool-option-contracts.js +51 -109
  495. package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
  496. package/dist/sdk/cli-contracts/tool-parameter-tables.d.ts +17 -0
  497. package/dist/sdk/cli-contracts/tool-parameter-tables.js +54 -5
  498. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  499. package/dist/sdk/cli-contracts/tool-schema.d.ts +74 -0
  500. package/dist/sdk/cli-contracts/tool-schema.js +840 -0
  501. package/dist/sdk/cli-contracts/tool-schema.js.map +1 -0
  502. package/dist/sdk/cli-contracts.d.ts +13 -193
  503. package/dist/sdk/cli-contracts.js +5 -2277
  504. package/dist/sdk/cli-contracts.js.map +1 -1
  505. package/dist/sdk/compose.d.ts +346 -4
  506. package/dist/sdk/compose.js +486 -15
  507. package/dist/sdk/compose.js.map +1 -1
  508. package/dist/sdk/define.d.ts +29 -14
  509. package/dist/sdk/define.js +21 -7
  510. package/dist/sdk/define.js.map +1 -1
  511. package/dist/sdk/index.d.ts +14 -3
  512. package/dist/sdk/index.js +14 -3
  513. package/dist/sdk/index.js.map +1 -1
  514. package/dist/sdk/testing.d.ts +156 -3
  515. package/dist/sdk/testing.js +172 -4
  516. package/dist/sdk/testing.js.map +1 -1
  517. package/docs/AGENT_GUIDE.md +2 -0
  518. package/docs/CLAUDE_CODE_PLUGIN.md +2 -2
  519. package/docs/COMMANDS.md +37 -0
  520. package/docs/EXTENSIONS.md +20 -20
  521. package/docs/RELEASING.md +6 -1
  522. package/docs/SDK.md +387 -20
  523. package/docs/TESTING.md +12 -0
  524. package/docs/examples/policy-restricted-extension/README.md +6 -0
  525. package/docs/examples/policy-restricted-extension/index.ts +40 -0
  526. package/docs/examples/policy-restricted-extension/manifest.json +2 -2
  527. package/docs/examples/starter-extension/README.md +14 -2
  528. package/docs/examples/starter-extension/{index.js → index.ts} +51 -6
  529. package/docs/examples/starter-extension/manifest.json +2 -2
  530. package/package.json +20 -7
  531. package/packages/pm-beads/extensions/beads/index.ts +3 -3
  532. package/packages/pm-beads/extensions/beads/manifest.json +2 -2
  533. package/packages/pm-beads/extensions/beads/runtime-loader.ts +19 -7
  534. package/packages/pm-beads/extensions/beads/runtime.ts +155 -37
  535. package/packages/pm-calendar/extensions/calendar/index.ts +3 -3
  536. package/packages/pm-calendar/extensions/calendar/manifest.json +2 -2
  537. package/packages/pm-calendar/extensions/calendar/runtime.ts +2 -2
  538. package/packages/pm-command-kit/extensions/command-kit/index.ts +1 -1
  539. package/packages/pm-command-kit/extensions/command-kit/manifest.json +2 -2
  540. package/packages/pm-governance-audit/extensions/governance-audit/index.ts +2 -2
  541. package/packages/pm-governance-audit/extensions/governance-audit/manifest.json +2 -2
  542. package/packages/pm-governance-audit/extensions/governance-audit/runtime.ts +1 -1
  543. package/packages/pm-guide-shell/extensions/guide-shell/index.ts +2 -2
  544. package/packages/pm-guide-shell/extensions/guide-shell/manifest.json +2 -2
  545. package/packages/pm-guide-shell/extensions/guide-shell/runtime.ts +1 -1
  546. package/packages/pm-kanban/README.md +97 -0
  547. package/packages/pm-kanban/extensions/kanban/index.ts +191 -0
  548. package/packages/pm-kanban/extensions/kanban/manifest.json +19 -0
  549. package/packages/pm-kanban/package.json +57 -0
  550. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/index.ts +1 -1
  551. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/manifest.json +2 -2
  552. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/index.ts +2 -2
  553. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/manifest.json +2 -2
  554. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/runtime.ts +1 -1
  555. package/packages/pm-search-advanced/extensions/search-advanced/index.ts +2 -2
  556. package/packages/pm-search-advanced/extensions/search-advanced/manifest.json +2 -2
  557. package/packages/pm-search-advanced/extensions/search-advanced/runtime.ts +1 -1
  558. package/packages/pm-templates/extensions/templates/index.ts +2 -2
  559. package/packages/pm-templates/extensions/templates/manifest.json +2 -2
  560. package/packages/pm-templates/extensions/templates/runtime.ts +1 -1
  561. package/packages/pm-todos/extensions/todos/index.ts +3 -3
  562. package/packages/pm-todos/extensions/todos/manifest.json +2 -2
  563. package/packages/pm-todos/extensions/todos/runtime-loader.ts +19 -7
  564. package/packages/pm-todos/extensions/todos/runtime.ts +177 -43
  565. package/plugins/pm-claude/scripts/pm-mcp-server.mjs +2 -2
  566. package/plugins/pm-codex/scripts/pm-mcp-server.mjs +2 -2
  567. package/scripts/bundle-cli.mjs +1 -1
  568. package/dist/cli-bundle/chunks/activity-XUZ2AHCW.js +0 -18
  569. package/dist/cli-bundle/chunks/aggregate-EGJLZQBI.js.map +0 -7
  570. package/dist/cli-bundle/chunks/aggregate-R725FC3S.js.map +0 -1
  571. package/dist/cli-bundle/chunks/chunk-2BFPAUAF.js.map +0 -1
  572. package/dist/cli-bundle/chunks/chunk-46G6RSB6.js.map +0 -1
  573. package/dist/cli-bundle/chunks/chunk-55ISXAQH.js.map +0 -7
  574. package/dist/cli-bundle/chunks/chunk-5UVVASSA.js.map +0 -1
  575. package/dist/cli-bundle/chunks/chunk-7MRQ4HMK.js +0 -78
  576. package/dist/cli-bundle/chunks/chunk-7MRQ4HMK.js.map +0 -7
  577. package/dist/cli-bundle/chunks/chunk-7SV63ZHD.js.map +0 -1
  578. package/dist/cli-bundle/chunks/chunk-AONIHR2C.js.map +0 -7
  579. package/dist/cli-bundle/chunks/chunk-C5AOG6D2.js +0 -691
  580. package/dist/cli-bundle/chunks/chunk-C5AOG6D2.js.map +0 -1
  581. package/dist/cli-bundle/chunks/chunk-CE5P2NQR.js.map +0 -1
  582. package/dist/cli-bundle/chunks/chunk-CKGNPJAG.js.map +0 -7
  583. package/dist/cli-bundle/chunks/chunk-G6PYHBBR.js.map +0 -7
  584. package/dist/cli-bundle/chunks/chunk-GAJVRGGA.js.map +0 -1
  585. package/dist/cli-bundle/chunks/chunk-HFFUQR73.js.map +0 -7
  586. package/dist/cli-bundle/chunks/chunk-IPKJ6B36.js.map +0 -7
  587. package/dist/cli-bundle/chunks/chunk-JR2LV3M4.js.map +0 -7
  588. package/dist/cli-bundle/chunks/chunk-KFWBJPSG.js.map +0 -1
  589. package/dist/cli-bundle/chunks/chunk-KQMUV6LX.js.map +0 -1
  590. package/dist/cli-bundle/chunks/chunk-MJTINN54.js.map +0 -7
  591. package/dist/cli-bundle/chunks/chunk-MJTSZKK5.js.map +0 -7
  592. package/dist/cli-bundle/chunks/chunk-MVKFOLLM.js +0 -694
  593. package/dist/cli-bundle/chunks/chunk-MVKFOLLM.js.map +0 -7
  594. package/dist/cli-bundle/chunks/chunk-QH3PJYON.js.map +0 -1
  595. package/dist/cli-bundle/chunks/chunk-QL5RVYOA.js.map +0 -7
  596. package/dist/cli-bundle/chunks/chunk-S26C36QC.js +0 -83
  597. package/dist/cli-bundle/chunks/chunk-S26C36QC.js.map +0 -1
  598. package/dist/cli-bundle/chunks/chunk-S2RUQSX2.js +0 -75
  599. package/dist/cli-bundle/chunks/chunk-S2RUQSX2.js.map +0 -1
  600. package/dist/cli-bundle/chunks/chunk-SKH7OGE5.js +0 -86
  601. package/dist/cli-bundle/chunks/chunk-SKH7OGE5.js.map +0 -7
  602. package/dist/cli-bundle/chunks/chunk-SKN7LC5W.js.map +0 -7
  603. package/dist/cli-bundle/chunks/chunk-SR3EKWZG.js.map +0 -7
  604. package/dist/cli-bundle/chunks/chunk-UELRKQQU.js.map +0 -1
  605. package/dist/cli-bundle/chunks/chunk-VFAQ4LMN.js.map +0 -7
  606. package/dist/cli-bundle/chunks/chunk-Y4SUQQYH.js.map +0 -1
  607. package/dist/cli-bundle/chunks/chunk-YDEXO24S.js +0 -654
  608. package/dist/cli-bundle/chunks/chunk-YDEXO24S.js.map +0 -1
  609. package/dist/cli-bundle/chunks/chunk-YJ3SUEPD.js +0 -657
  610. package/dist/cli-bundle/chunks/chunk-YJ3SUEPD.js.map +0 -7
  611. package/dist/cli-bundle/chunks/chunk-YUDJD3XO.js.map +0 -1
  612. package/dist/cli-bundle/chunks/chunk-ZRK4O56R.js.map +0 -1
  613. package/dist/cli-bundle/chunks/close-A3EMKBBY.js +0 -15
  614. package/dist/cli-bundle/chunks/config-D3OKQO52.js.map +0 -7
  615. package/dist/cli-bundle/chunks/config-MMJA4LLK.js.map +0 -1
  616. package/dist/cli-bundle/chunks/context-BLBD3PUB.js.map +0 -7
  617. package/dist/cli-bundle/chunks/context-DHLVPXN3.js.map +0 -1
  618. package/dist/cli-bundle/chunks/contracts-C3SZCXXG.js.map +0 -7
  619. package/dist/cli-bundle/chunks/contracts-XGVMMPC5.js.map +0 -1
  620. package/dist/cli-bundle/chunks/create-QVGFYA2X.js +0 -30
  621. package/dist/cli-bundle/chunks/history-AK3E5Z3C.js +0 -20
  622. package/dist/cli-bundle/chunks/history-redact-TWIYQV5J.js +0 -21
  623. package/dist/cli-bundle/chunks/init-RCRKW5PL.js +0 -21
  624. package/dist/cli-bundle/chunks/register-list-query-DDCHPONM.js.map +0 -7
  625. package/dist/cli-bundle/chunks/register-list-query-YNPBVIKM.js.map +0 -1
  626. package/dist/cli-bundle/chunks/register-mutation-7ALWDDAX.js.map +0 -1
  627. package/dist/cli-bundle/chunks/register-mutation-LAVKYY63.js.map +0 -7
  628. package/dist/cli-bundle/chunks/register-setup-KBXQDCXE.js.map +0 -7
  629. package/dist/cli-bundle/chunks/register-setup-RCRUHMSZ.js.map +0 -1
  630. package/dist/cli-bundle/chunks/restore-2ZKT6UDC.js +0 -19
  631. package/dist/cli-bundle/chunks/schema-MNTAVQCY.js.map +0 -1
  632. package/dist/cli-bundle/chunks/schema-RBTJ2YXW.js.map +0 -7
  633. package/dist/cli-bundle/chunks/stats-FS742AMA.js.map +0 -1
  634. package/dist/cli-bundle/chunks/stats-R5OAJVZK.js.map +0 -7
  635. package/dist/cli-bundle/chunks/test-QJXLKV26.js +0 -36
  636. package/dist/cli-bundle/chunks/test-runs-C6CFIVOS.js.map +0 -1
  637. package/dist/cli-bundle/chunks/test-runs-IAJDL6CA.js.map +0 -7
  638. package/dist/cli-bundle/chunks/update-2XCQNOD6.js +0 -28
  639. package/dist/cli-bundle/chunks/update-IWUCXVH2.js +0 -24
  640. package/dist/cli-bundle/chunks/validate-6QWQVCX2.js.map +0 -7
  641. package/dist/cli-bundle/chunks/validate-W5V5ZGQX.js.map +0 -1
  642. package/docs/examples/policy-restricted-extension/index.js +0 -21
  643. package/packages/pm-beads/extensions/beads/index.js +0 -64
  644. package/packages/pm-beads/extensions/beads/runtime-loader.js +0 -86
  645. package/packages/pm-beads/extensions/beads/runtime.js +0 -482
  646. package/packages/pm-calendar/extensions/calendar/index.js +0 -150
  647. package/packages/pm-calendar/extensions/calendar/runtime.js +0 -126
  648. package/packages/pm-command-kit/extensions/command-kit/index.js +0 -181
  649. package/packages/pm-governance-audit/extensions/governance-audit/index.js +0 -177
  650. package/packages/pm-governance-audit/extensions/governance-audit/runtime.js +0 -153
  651. package/packages/pm-guide-shell/extensions/guide-shell/index.js +0 -98
  652. package/packages/pm-guide-shell/extensions/guide-shell/runtime.js +0 -294
  653. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/index.js +0 -18
  654. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/index.js +0 -124
  655. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/runtime.js +0 -110
  656. package/packages/pm-search-advanced/extensions/search-advanced/index.js +0 -258
  657. package/packages/pm-search-advanced/extensions/search-advanced/runtime.js +0 -361
  658. package/packages/pm-templates/extensions/templates/index.js +0 -132
  659. package/packages/pm-templates/extensions/templates/runtime.js +0 -35
  660. package/packages/pm-todos/extensions/todos/index.js +0 -81
  661. package/packages/pm-todos/extensions/todos/runtime-loader.js +0 -86
  662. package/packages/pm-todos/extensions/todos/runtime.js +0 -545
  663. /package/dist/cli-bundle/chunks/{activity-XUZ2AHCW.js.map → activity-EJBMXUBH.js.map} +0 -0
  664. /package/dist/cli-bundle/chunks/{activity-H2LMOSSW.js.map → activity-MVSEND6D.js.map} +0 -0
  665. /package/dist/cli-bundle/chunks/{chunk-IB3GYLQE.js.map → chunk-3JWQCLR5.js.map} +0 -0
  666. /package/dist/cli-bundle/chunks/{chunk-2A34E3BA.js.map → chunk-4TXTVZL3.js.map} +0 -0
  667. /package/dist/cli-bundle/chunks/{chunk-G6N5VEOK.js.map → chunk-4YIMPANT.js.map} +0 -0
  668. /package/dist/cli-bundle/chunks/{chunk-7XGQXHFB.js.map → chunk-73PTKMAE.js.map} +0 -0
  669. /package/dist/cli-bundle/chunks/{chunk-3VY3YQO6.js.map → chunk-7RIJGN4R.js.map} +0 -0
  670. /package/dist/cli-bundle/chunks/{chunk-FXR67XVQ.js.map → chunk-BN3CWK6G.js.map} +0 -0
  671. /package/dist/cli-bundle/chunks/{chunk-4BHT5VDC.js.map → chunk-C2KCIZKZ.js.map} +0 -0
  672. /package/dist/cli-bundle/chunks/{chunk-O6LLO73I.js.map → chunk-CHRNYKNI.js.map} +0 -0
  673. /package/dist/cli-bundle/chunks/{chunk-ZQ3ZVXX2.js.map → chunk-D6USKAMA.js.map} +0 -0
  674. /package/dist/cli-bundle/chunks/{chunk-WZQWHN4R.js.map → chunk-DLDCPF5X.js.map} +0 -0
  675. /package/dist/cli-bundle/chunks/{chunk-UVC5LOR7.js.map → chunk-E2Q2ULMR.js.map} +0 -0
  676. /package/dist/cli-bundle/chunks/{chunk-5VOINNKT.js.map → chunk-F6VH3LFC.js.map} +0 -0
  677. /package/dist/cli-bundle/chunks/{chunk-H4IIJDE4.js.map → chunk-FDEVKXC4.js.map} +0 -0
  678. /package/dist/cli-bundle/chunks/{chunk-34EONI5F.js.map → chunk-HUYYMTGW.js.map} +0 -0
  679. /package/dist/cli-bundle/chunks/{chunk-CIIK67GW.js.map → chunk-IHXXUIXS.js.map} +0 -0
  680. /package/dist/cli-bundle/chunks/{chunk-SBQTAVJZ.js.map → chunk-JIP67N2K.js.map} +0 -0
  681. /package/dist/cli-bundle/chunks/{chunk-2T3JG6V4.js.map → chunk-KRASIL6M.js.map} +0 -0
  682. /package/dist/cli-bundle/chunks/{chunk-P77P2ILI.js.map → chunk-MLHX6DN5.js.map} +0 -0
  683. /package/dist/cli-bundle/chunks/{chunk-2CKH2LMV.js.map → chunk-OB3RJV5F.js.map} +0 -0
  684. /package/dist/cli-bundle/chunks/{chunk-FIGAZ4Y7.js.map → chunk-OUQ5JEFM.js.map} +0 -0
  685. /package/dist/cli-bundle/chunks/{chunk-NK3UPBVG.js.map → chunk-QE5UFCCO.js.map} +0 -0
  686. /package/dist/cli-bundle/chunks/{chunk-WM5ZVBPE.js.map → chunk-SJZTPVFT.js.map} +0 -0
  687. /package/dist/cli-bundle/chunks/{chunk-VAYA4XFX.js.map → chunk-V3KLX7U7.js.map} +0 -0
  688. /package/dist/cli-bundle/chunks/{chunk-2RDVQEWV.js.map → chunk-Z5BM2FKQ.js.map} +0 -0
  689. /package/dist/cli-bundle/chunks/{chunk-66MEDTUD.js.map → chunk-ZEATCVAC.js.map} +0 -0
  690. /package/dist/cli-bundle/chunks/{chunk-NCVCO3NZ.js.map → chunk-ZFIEEDTJ.js.map} +0 -0
  691. /package/dist/cli-bundle/chunks/{close-A3EMKBBY.js.map → close-37KEHLYM.js.map} +0 -0
  692. /package/dist/cli-bundle/chunks/{close-W56IOGYG.js.map → close-OP3LK7Z2.js.map} +0 -0
  693. /package/dist/cli-bundle/chunks/{create-QVGFYA2X.js.map → context-7ZEZV3BV.js.map} +0 -0
  694. /package/dist/cli-bundle/chunks/{create-IXY43O4H.js.map → context-XDI4DKKT.js.map} +0 -0
  695. /package/dist/cli-bundle/chunks/{extension-UTTQDUYI.js.map → create-DFMNBKBS.js.map} +0 -0
  696. /package/dist/cli-bundle/chunks/{extension-KCPUWSY2.js.map → create-J5Q2ELZT.js.map} +0 -0
  697. /package/dist/cli-bundle/chunks/{history-AJTXLT6S.js.map → extension-3LRYX7SW.js.map} +0 -0
  698. /package/dist/cli-bundle/chunks/{history-AK3E5Z3C.js.map → extension-GMVOIP4O.js.map} +0 -0
  699. /package/dist/cli-bundle/chunks/{gc-O5GUO3SU.js.map → gc-FULIVYR4.js.map} +0 -0
  700. /package/dist/cli-bundle/chunks/{gc-PYVVEELM.js.map → gc-MDGRR2SU.js.map} +0 -0
  701. /package/dist/cli-bundle/chunks/{history-redact-TWIYQV5J.js.map → history-5XUSLAJA.js.map} +0 -0
  702. /package/dist/cli-bundle/chunks/{history-redact-KUUUVUFM.js.map → history-X4OSES6K.js.map} +0 -0
  703. /package/dist/cli-bundle/chunks/{init-BNLVFPRG.js.map → history-redact-45YW65BK.js.map} +0 -0
  704. /package/dist/cli-bundle/chunks/{init-RCRKW5PL.js.map → history-redact-BVHWDXPR.js.map} +0 -0
  705. /package/dist/cli-bundle/chunks/{list-32U7BSKE.js.map → init-KO7CGIRQ.js.map} +0 -0
  706. /package/dist/cli-bundle/chunks/{list-ZEEOHLTQ.js.map → init-TRYJELH4.js.map} +0 -0
  707. /package/dist/cli-bundle/chunks/{restore-6K53WOWO.js.map → list-ROT7JF62.js.map} +0 -0
  708. /package/dist/cli-bundle/chunks/{restore-2ZKT6UDC.js.map → list-Y6AU5BJS.js.map} +0 -0
  709. /package/dist/cli-bundle/chunks/{search-6HOIVZDU.js.map → restore-DKMCLPI5.js.map} +0 -0
  710. /package/dist/cli-bundle/chunks/{search-ZWYEMASC.js.map → restore-IRAKSWIW.js.map} +0 -0
  711. /package/dist/cli-bundle/chunks/{test-NZF7OT2F.js.map → schema-OLT6LVKH.js.map} +0 -0
  712. /package/dist/cli-bundle/chunks/{test-QJXLKV26.js.map → schema-XJXKJQF5.js.map} +0 -0
  713. /package/dist/cli-bundle/chunks/{update-2XCQNOD6.js.map → search-CX5UMV4H.js.map} +0 -0
  714. /package/dist/cli-bundle/chunks/{update-IWUCXVH2.js.map → search-KP6H7COV.js.map} +0 -0
  715. /package/dist/cli-bundle/chunks/{telemetry-7DIGDQUO.js.map → telemetry-DIFPXCAT.js.map} +0 -0
  716. /package/dist/cli-bundle/chunks/{telemetry-FWEXSJLQ.js.map → telemetry-WTYFUPRL.js.map} +0 -0
@@ -4,19 +4,20 @@
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]="4513e1ea-24a5-55b1-9465-78d5d9febba7")}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]="8a2ebc7a-02de-579c-8cf2-dbbbd401e622")}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";
11
11
  import { EXIT_CODE } from "../../../core/shared/constants.js";
12
12
  import { PmCliError } from "../../../core/shared/errors.js";
13
13
  import { normalizeManagedDirectoryName } from "./shared.js";
14
- // Safe compatibility floor emitted into scaffolded manifests. Mirrors the
15
- // first-party package manifests (pm-nf2q): every current 2026.5.x CLI
16
- // satisfies it, and it models the field for external authors. manifest_version
17
- // tracks the manifest schema generation (currently 1).
14
+ // Safe compatibility floor emitted into scaffolded manifests. The current
15
+ // starters are loaded as TypeScript and use the SDK define*/testing helpers; the
16
+ // first released host that supports that full generated contract is v2026.6.24.
17
+ // manifest_version tracks the manifest schema generation (currently 1).
18
18
  const SCAFFOLD_MANIFEST_VERSION = 1;
19
- const SCAFFOLD_PM_MIN_VERSION = "2026.5.0";
19
+ export const SCAFFOLD_PM_MIN_VERSION = "2026.6.24";
20
+ const SCAFFOLD_NODE_ENGINE = ">=22.18.0";
20
21
  const SCAFFOLD_DECLARED_PERMISSIONS = {
21
22
  fs_read: false,
22
23
  fs_write: false,
@@ -25,45 +26,131 @@ const SCAFFOLD_DECLARED_PERMISSIONS = {
25
26
  env_write: false,
26
27
  process_spawn: false,
27
28
  };
29
+ // TypeScript dev-dependency floor for scaffolded packages, matching the CLI's own
30
+ // toolchain so generated packages compile against the same compiler generation.
31
+ const SCAFFOLD_TYPESCRIPT_VERSION = "^6.0.0";
32
+ // `@types/node` floor for scaffolded packages: the colocated `index.test.ts`
33
+ // imports `node:test`/`node:assert`, which need Node's ambient type definitions
34
+ // to type-check. Pinned to the engines floor (Node >=22.18), matching the CLI
35
+ // itself — the version where Node strips TypeScript types on load by default.
36
+ const SCAFFOLD_TYPES_NODE_VERSION = "^22.0.0";
37
+ // Strict NodeNext tsconfig emitted into every scaffold (ADR pm-2c28 / pm-m1uz:
38
+ // extensions are authored AND loaded as TypeScript). It is a type-check-only
39
+ // config (`noEmit`): there is no compile step — pm loads the `./index.ts`
40
+ // manifest entry directly via Node's native type stripping (Node >=22.18), so
41
+ // no `.js` is emitted or committed. `allowImportingTsExtensions` lets the
42
+ // colocated `index.test.ts` import the sibling `./index.ts` entry with its real
43
+ // extension, exactly as Node resolves it at load time. NodeNext resolution keeps
44
+ // the module graph identical to the runtime loader.
45
+ const SCAFFOLD_TSCONFIG = {
46
+ compilerOptions: {
47
+ target: "ES2022",
48
+ module: "NodeNext",
49
+ moduleResolution: "NodeNext",
50
+ strict: true,
51
+ esModuleInterop: true,
52
+ skipLibCheck: true,
53
+ noEmit: true,
54
+ allowImportingTsExtensions: true,
55
+ // `node:test`/`node:assert` in the colocated test (and Node globals) resolve
56
+ // from `@types/node`; name it explicitly so it is loaded regardless of how the
57
+ // package manager lays out `node_modules/@types`.
58
+ types: ["node"],
59
+ },
60
+ // Recursive so a package that grows into subdirectory `*.ts` modules still
61
+ // type-checks; tsc excludes `node_modules` by default.
62
+ include: ["**/*.ts"],
63
+ };
28
64
  /**
29
65
  * Capability shapes the package/extension scaffolder can target via the
30
- * `--capability` selector. `commands` emits the default command-only starter;
31
- * `hooks` additionally wires an `after_command` lifecycle reactor, `search`
32
- * wires an in-memory provider/adapter pair, and `importers` wires importer and
33
- * exporter command primitives so authors can customize project context movement
34
- * without starting from a blank extension.
66
+ * `--capability` selector one per SDK extension capability, so every
67
+ * registration surface has a runnable starter. `commands` emits the default
68
+ * command-only starter; `hooks` additionally wires an `after_command` lifecycle
69
+ * reactor; `search` wires an in-memory provider/adapter pair; `importers` wires
70
+ * importer and exporter command primitives so authors can customize project
71
+ * context movement; `schema` registers a custom item type, item field, and
72
+ * migration so authors can model their own project domain; `profile` registers a
73
+ * complete project-profile archetype (item types, statuses, fields, a workflow,
74
+ * config, a template, and package recommendations) via `api.registerProfile` so
75
+ * `pm profile apply` can tailor a tracker in one shot; `renderers` overrides how
76
+ * a command's output is serialized for a format; `parser` rewrites a command's
77
+ * parsed options before its handler runs; `preflight` adjusts pm's pre-run
78
+ * migration/format gate decision; and `services` overrides a built-in pm service
79
+ * (e.g. output formatting) — without starting from a blank extension.
35
80
  */
36
- export const SCAFFOLD_CAPABILITIES = ["commands", "hooks", "search", "importers"];
81
+ export const SCAFFOLD_CAPABILITIES = [
82
+ "commands",
83
+ "hooks",
84
+ "search",
85
+ "importers",
86
+ "schema",
87
+ "profile",
88
+ "renderers",
89
+ "parser",
90
+ "preflight",
91
+ "services",
92
+ ];
37
93
  const SCAFFOLD_MANIFEST_CAPABILITIES = {
38
94
  commands: ["commands"],
39
95
  hooks: ["commands", "hooks"],
40
96
  search: ["commands", "search"],
41
97
  importers: ["commands", "schema", "importers"],
98
+ schema: ["commands", "schema"],
99
+ // A profile registration IS a schema+config bundle, so the loader gate requires
100
+ // the `schema` capability (no separate `profile` capability) — same grant as the
101
+ // schema starter, mirroring the bundled pm-kanban exemplar.
102
+ profile: ["commands", "schema"],
103
+ renderers: ["commands", "renderers"],
104
+ // The parser starter declares `--shout`/`--upper` command flags so the
105
+ // override is runnable through `pm <command> --shout`; flag metadata is
106
+ // schema-governed, so the manifest also declares `schema`.
107
+ parser: ["commands", "parser", "schema"],
108
+ preflight: ["commands", "preflight"],
109
+ services: ["commands", "services"],
42
110
  };
43
111
  const SAMPLE_TEST_CAPABILITIES_LITERAL = {
44
112
  commands: '["commands"]',
45
113
  hooks: '["commands", "hooks"]',
46
114
  search: '["commands", "search"]',
47
115
  importers: '["commands", "schema", "importers"]',
116
+ schema: '["commands", "schema"]',
117
+ profile: '["commands", "schema"]',
118
+ renderers: '["commands", "renderers"]',
119
+ parser: '["commands", "parser", "schema"]',
120
+ preflight: '["commands", "preflight"]',
121
+ services: '["commands", "services"]',
48
122
  };
49
123
  const ENTRYPOINT_BULLETS = {
50
- commands: "- `index.js`: starter command registration plus a `deactivate` teardown stub.",
51
- hooks: "- `index.js`: starter command registration, an `after_command` lifecycle hook, and a `deactivate` teardown stub.",
52
- search: "- `index.js`: starter command registration, a search provider, a vector-store adapter, and a `deactivate` teardown stub.",
53
- importers: "- `index.js`: starter command registration, importer/exporter command registrations, and a `deactivate` teardown stub.",
124
+ commands: "- `index.ts`: the TypeScript manifest entry — starter command registration plus a `deactivate` teardown stub.",
125
+ hooks: "- `index.ts`: the TypeScript manifest entry — starter command registration, an `after_command` lifecycle hook, and a `deactivate` teardown stub.",
126
+ search: "- `index.ts`: the TypeScript manifest entry — starter command registration, a search provider, a vector-store adapter, and a `deactivate` teardown stub.",
127
+ importers: "- `index.ts`: the TypeScript manifest entry — starter command registration, importer/exporter command registrations, and a `deactivate` teardown stub.",
128
+ schema: "- `index.ts`: the TypeScript manifest entry — starter command registration, a custom item type, a custom item field, a schema migration, and a `deactivate` teardown stub.",
129
+ profile: "- `index.ts`: the TypeScript manifest entry — starter command registration, a project profile (item types, statuses, fields, a workflow, config, a template, and package recommendations) registered via `api.registerProfile`, and a `deactivate` teardown stub.",
130
+ renderers: "- `index.ts`: the TypeScript manifest entry — starter command registration, a `toon` output renderer override, and a `deactivate` teardown stub.",
131
+ parser: "- `index.ts`: the TypeScript manifest entry — starter command registration, a parser override that rewrites the command's parsed options, and a `deactivate` teardown stub.",
132
+ preflight: "- `index.ts`: the TypeScript manifest entry — starter command registration, a preflight override over pm's pre-run gate decision, and a `deactivate` teardown stub.",
133
+ services: "- `index.ts`: the TypeScript manifest entry — starter command registration, an `output_format` service override, and a `deactivate` teardown stub.",
54
134
  };
55
135
  const SAMPLE_TEST_BULLETS = {
56
- commands: "- `index.test.js`: sample `node:test` suite covering activation, command invocation, and teardown via the SDK testing helpers.",
57
- hooks: "- `index.test.js`: sample `node:test` suite covering activation, command invocation, the after_command hook, and teardown via the SDK testing helpers.",
58
- search: "- `index.test.js`: sample `node:test` suite covering activation, command invocation, search provider/vector adapter invocation, and teardown via the SDK testing helpers.",
59
- importers: "- `index.test.js`: sample `node:test` suite covering activation, command invocation, importer/exporter invocation, and teardown via the SDK testing helpers.",
136
+ commands: "- `index.test.ts`: sample `node:test` suite covering activation, command invocation, and teardown via the SDK testing helpers.",
137
+ hooks: "- `index.test.ts`: sample `node:test` suite covering activation, command invocation, the after_command hook, and teardown via the SDK testing helpers.",
138
+ search: "- `index.test.ts`: sample `node:test` suite covering activation, command invocation, search provider/vector adapter invocation, and teardown via the SDK testing helpers.",
139
+ importers: "- `index.test.ts`: sample `node:test` suite covering activation, command invocation, importer/exporter invocation, and teardown via the SDK testing helpers.",
140
+ schema: "- `index.test.ts`: sample `node:test` suite covering activation, command invocation, item type/field/migration registration, migration invocation, and teardown via the SDK testing helpers.",
141
+ profile: "- `index.test.ts`: sample `node:test` suite covering activation, command invocation, project-profile registration (asserting the bundled archetype dimensions), and teardown via the SDK testing helpers.",
142
+ renderers: "- `index.test.ts`: sample `node:test` suite covering activation, command invocation, renderer override registration and invocation (including format pass-through), and teardown via the SDK testing helpers.",
143
+ parser: "- `index.test.ts`: sample `node:test` suite covering activation, command invocation, parser override registration and the option rewrite it produces, and teardown via the SDK testing helpers.",
144
+ preflight: "- `index.test.ts`: sample `node:test` suite covering activation, command invocation, preflight override registration and the gate decision it returns, and teardown via the SDK testing helpers.",
145
+ services: "- `index.test.ts`: sample `node:test` suite covering activation, command invocation, service override registration and invocation (including command pass-through), and teardown via the SDK testing helpers.",
60
146
  };
147
+ const TSCONFIG_BULLET = "- `tsconfig.json`: strict type-check-only TypeScript config (`noEmit`) for the `.ts` source the loader runs directly.";
61
148
  const PACKAGE_CAPABILITY_README_SECTIONS = {
62
149
  commands: [],
63
150
  hooks: [
64
151
  "",
65
152
  "## Lifecycle Hook",
66
- "`index.js` registers an `after_command` hook via `api.hooks.afterCommand`.",
153
+ "`index.ts` registers an `after_command` hook via `api.hooks.afterCommand`.",
67
154
  "pm fires it once a command finishes, passing the command outcome and the",
68
155
  "items it mutated (`context.affected`). React there to keep external context",
69
156
  "in sync - sync records, emit telemetry, or refresh derived state. The",
@@ -73,7 +160,7 @@ const PACKAGE_CAPABILITY_README_SECTIONS = {
73
160
  search: [
74
161
  "",
75
162
  "## Search Provider",
76
- "`index.js` registers a deterministic in-memory search provider and",
163
+ "`index.ts` registers a deterministic in-memory search provider and",
77
164
  "vector-store adapter through `api.registerSearchProvider` and",
78
165
  "`api.registerVectorStoreAdapter`. Replace the sample scoring,",
79
166
  "embedding, and storage behavior with your project-specific retrieval",
@@ -83,20 +170,87 @@ const PACKAGE_CAPABILITY_README_SECTIONS = {
83
170
  importers: [
84
171
  "",
85
172
  "## Importer and Exporter",
86
- "`index.js` registers paired project-context import/export commands through",
173
+ "`index.ts` registers paired project-context import/export commands through",
87
174
  "`api.registerImporter` and `api.registerExporter`. Replace the starter",
88
175
  "payloads with your domain adapter: GitHub issues, CSV rows, documents,",
89
176
  "tickets, or another project-management source of truth. The `importers`",
90
177
  "capability grants both registrations, and `schema` grants the example",
91
178
  "command flag metadata.",
92
179
  ],
180
+ schema: [
181
+ "",
182
+ "## Custom Schema",
183
+ "`index.ts` models a project domain by registering a custom item type, a",
184
+ "custom item field, and a schema migration through `api.registerItemTypes`,",
185
+ "`api.registerItemFields`, and `api.registerMigration`. This is how a package",
186
+ "turns pm into a domain-specific tracker — `project management = context",
187
+ "management`. Replace the sample type/field/migration with your own domain",
188
+ "model; the `schema` capability in `manifest.json` grants all three",
189
+ "registrations. Once installed, the custom type is usable everywhere, e.g.",
190
+ "`pm create <type> \"<title>\"` and `pm list --type <type>`.",
191
+ ],
192
+ profile: [
193
+ "",
194
+ "## Project Profile",
195
+ "`index.ts` registers a complete project-profile archetype through",
196
+ "`api.registerProfile`. A profile is the broadest customization primitive pm",
197
+ "has — one declarative bundle of item types, custom statuses, fields, a per-type",
198
+ "workflow, config knobs, create templates, and package recommendations. Once the",
199
+ "package is installed the profile resolves by name through `pm profile list`,",
200
+ "`pm profile show <name>`, and `pm profile apply <name>`, which stages every",
201
+ "dimension idempotently — exactly like a core archetype (agile/ops/research),",
202
+ "with no consumer code required. Replace the sample archetype with your own",
203
+ "domain; the `schema` capability in `manifest.json` grants the registration (a",
204
+ "profile is a schema+config bundle, so it needs no separate capability).",
205
+ ],
206
+ renderers: [
207
+ "",
208
+ "## Output Renderer",
209
+ "`index.ts` registers a `toon` output renderer override through",
210
+ "`api.registerRenderer`. Renderer overrides run for every command's output in",
211
+ "that format, so this starter scopes itself to THIS package's own command and",
212
+ "returns `null` (pass-through to pm's default renderer) for everything else.",
213
+ "Return a string to take over rendering. Replace the sample serialization with",
214
+ "your own; the `renderers` capability in `manifest.json` grants the",
215
+ "registration.",
216
+ ],
217
+ parser: [
218
+ "",
219
+ "## Parser Override",
220
+ "`index.ts` registers a parser override for the starter command through",
221
+ "`api.registerParser`. pm runs it on the command's parsed options BEFORE the",
222
+ "handler, merging the delta you return. This starter rewrites a deprecated",
223
+ "`--shout` alias to the canonical `--upper` flag; replace it with your",
224
+ "command's real normalization. The `parser` capability in `manifest.json`",
225
+ "grants the registration.",
226
+ ],
227
+ preflight: [
228
+ "",
229
+ "## Preflight Override",
230
+ "`index.ts` registers a preflight override through `api.registerPreflight`. pm",
231
+ "calls it before every command to compute the migration/format gate decision —",
232
+ "the last registered override wins. Return only the decision keys you want to",
233
+ "change; this starter echoes the current decision unchanged (a safe no-op) so",
234
+ "installing the package does not alter gate behavior. The `preflight`",
235
+ "capability in `manifest.json` grants the registration.",
236
+ ],
237
+ services: [
238
+ "",
239
+ "## Service Override",
240
+ "`index.ts` overrides the built-in `output_format` service through",
241
+ "`api.registerService`. The service renders a command's structured result;",
242
+ "returning the payload unchanged passes through to pm's default formatting.",
243
+ "This starter scopes itself to THIS package's own command and passes every",
244
+ "other command through, so it never disrupts unrelated output. The `services`",
245
+ "capability in `manifest.json` grants the registration.",
246
+ ],
93
247
  };
94
248
  const EXTENSION_CAPABILITY_README_SECTIONS = {
95
249
  commands: [],
96
250
  hooks: [
97
251
  "",
98
252
  "## Lifecycle Hook",
99
- "`index.js` registers an `after_command` hook via `api.hooks.afterCommand`.",
253
+ "`index.ts` registers an `after_command` hook via `api.hooks.afterCommand`.",
100
254
  "pm fires it once a command finishes, passing the command outcome and the",
101
255
  "items it mutated (`context.affected`). React there to keep external context",
102
256
  "in sync. The `hooks` capability in `manifest.json` grants the registration;",
@@ -105,7 +259,7 @@ const EXTENSION_CAPABILITY_README_SECTIONS = {
105
259
  search: [
106
260
  "",
107
261
  "## Search Provider",
108
- "`index.js` registers a deterministic in-memory search provider and",
262
+ "`index.ts` registers a deterministic in-memory search provider and",
109
263
  "vector-store adapter through `api.registerSearchProvider` and",
110
264
  "`api.registerVectorStoreAdapter`. Replace the sample scoring, embedding,",
111
265
  "and storage behavior with your project-specific retrieval logic. The",
@@ -114,12 +268,276 @@ const EXTENSION_CAPABILITY_README_SECTIONS = {
114
268
  importers: [
115
269
  "",
116
270
  "## Importer and Exporter",
117
- "`index.js` registers paired project-context import/export commands through",
271
+ "`index.ts` registers paired project-context import/export commands through",
118
272
  "`api.registerImporter` and `api.registerExporter`. Replace the starter",
119
273
  "payloads with your domain adapter. The `importers` capability grants both",
120
274
  "registrations, and `schema` grants the example command flag metadata.",
121
275
  ],
276
+ schema: [
277
+ "",
278
+ "## Custom Schema",
279
+ "`index.ts` models a project domain by registering a custom item type, a",
280
+ "custom item field, and a schema migration through `api.registerItemTypes`,",
281
+ "`api.registerItemFields`, and `api.registerMigration`. Replace the sample",
282
+ "type/field/migration with your own domain model; the `schema` capability in",
283
+ "`manifest.json` grants all three registrations. Once installed, the custom",
284
+ 'type is usable everywhere, e.g. `pm create <type> "<title>"`.',
285
+ ],
286
+ profile: [
287
+ "",
288
+ "## Project Profile",
289
+ "`index.ts` registers a complete project-profile archetype through",
290
+ "`api.registerProfile` — one declarative bundle of item types, custom statuses,",
291
+ "fields, a per-type workflow, config knobs, create templates, and package",
292
+ "recommendations. Once installed the profile resolves by name through",
293
+ "`pm profile list`, `pm profile show <name>`, and `pm profile apply <name>`,",
294
+ "which stages every dimension idempotently like a core archetype. Replace the",
295
+ "sample archetype with your own domain; the `schema` capability in",
296
+ "`manifest.json` grants the registration.",
297
+ ],
298
+ renderers: [
299
+ "",
300
+ "## Output Renderer",
301
+ "`index.ts` registers a `toon` output renderer override through",
302
+ "`api.registerRenderer`. Renderer overrides run for every command's output in",
303
+ "that format, so this starter scopes itself to its own command and returns",
304
+ "`null` (pass-through to pm's default renderer) for everything else. Replace",
305
+ "the sample serialization with your own; the `renderers` capability in",
306
+ "`manifest.json` grants the registration.",
307
+ ],
308
+ parser: [
309
+ "",
310
+ "## Parser Override",
311
+ "`index.ts` registers a parser override for the starter command through",
312
+ "`api.registerParser`. pm runs it on the command's parsed options BEFORE the",
313
+ "handler, merging the delta you return. This starter rewrites a deprecated",
314
+ "`--shout` alias to the canonical `--upper` flag; replace it with your own",
315
+ "normalization. The `parser` capability in `manifest.json` grants the",
316
+ "registration.",
317
+ ],
318
+ preflight: [
319
+ "",
320
+ "## Preflight Override",
321
+ "`index.ts` registers a preflight override through `api.registerPreflight`. pm",
322
+ "calls it before every command to compute the migration/format gate decision —",
323
+ "the last registered override wins. This starter echoes the current decision",
324
+ "unchanged (a safe no-op); return only the decision keys you want to change.",
325
+ "The `preflight` capability in `manifest.json` grants the registration.",
326
+ ],
327
+ services: [
328
+ "",
329
+ "## Service Override",
330
+ "`index.ts` overrides the built-in `output_format` service through",
331
+ "`api.registerService`. Returning the payload unchanged passes through to pm's",
332
+ "default formatting, so this starter scopes itself to its own command and",
333
+ "passes every other command through. The `services` capability in",
334
+ "`manifest.json` grants the registration.",
335
+ ],
336
+ };
337
+ // README activation explainer for command-bearing starters (commands/hooks/
338
+ // search/importers): they declare `activation.commands` so pm loads them lazily.
339
+ const LAZY_ACTIVATION_README_SECTION = {
340
+ package: [
341
+ "",
342
+ "## Lazy Activation",
343
+ "`manifest.json` declares `activation.commands`: the exact command paths this",
344
+ "package's `activate` registers. pm imports and activates the package lazily —",
345
+ "only when an invoked command path matches one of these entries — so unrelated",
346
+ "commands (`pm list`, `pm search`, ...) never pay to load it. Keep this list in",
347
+ "sync with the registrations in `index.ts`: add an entry when you register a new",
348
+ "command, importer, or exporter, and remove one you drop. An omitted or stale",
349
+ "entry means the matching command will not dispatch from the CLI. Globally-scoped",
350
+ "surfaces (hooks, parser/preflight/renderer overrides, and search providers for",
351
+ "built-in search commands) still activate regardless of this list.",
352
+ ],
353
+ extension: [
354
+ "",
355
+ "## Lazy Activation",
356
+ "`manifest.json` declares `activation.commands`: the exact command paths this",
357
+ "extension's `activate` registers. pm imports and activates the extension lazily —",
358
+ "only when an invoked command path matches one of these entries — so unrelated",
359
+ "commands never pay to load it. Keep this list in sync with the registrations in",
360
+ "`index.ts`: an omitted or stale entry means the matching command will not dispatch",
361
+ "from the CLI. Globally-scoped surfaces (hooks, parser/preflight/renderer overrides,",
362
+ "and search providers for built-in search commands) still activate regardless.",
363
+ ],
122
364
  };
365
+ // README activation explainer for the `schema` starter: it contributes a GLOBAL
366
+ // custom item type/field, so it intentionally omits `activation.commands` and
367
+ // relies on pm's conservative activation tier (see buildScaffoldActivationCommands).
368
+ const SCHEMA_ACTIVATION_README_SECTION = {
369
+ package: [
370
+ "",
371
+ "## Activation",
372
+ "This package contributes a GLOBAL custom item type and field, so `manifest.json`",
373
+ "intentionally declares no `activation.commands`. pm activates the package",
374
+ "conservatively — for every command — so the custom type is present wherever it is",
375
+ "used: `pm create <type>`, `pm list --type <type>`, `pm validate`, and so on.",
376
+ "Declaring narrow `activation.commands` here would gate activation to only those",
377
+ "commands and silently leave the custom type unregistered for `pm create`. If you",
378
+ "drop the schema registrations and keep only command/hook/search/importer surfaces,",
379
+ "add `activation.commands` back so pm can load the package lazily.",
380
+ ],
381
+ extension: [
382
+ "",
383
+ "## Activation",
384
+ "This extension contributes a GLOBAL custom item type and field, so `manifest.json`",
385
+ "intentionally declares no `activation.commands`. pm activates the extension",
386
+ "conservatively — for every command — so the custom type is present wherever it is",
387
+ "used: `pm create <type>`, `pm list --type <type>`, `pm validate`, and so on.",
388
+ "Declaring narrow `activation.commands` here would gate activation to only those",
389
+ "commands and silently leave the custom type unregistered for `pm create`.",
390
+ ],
391
+ };
392
+ // README activation explainer for the `profile` starter: the contributed profile
393
+ // is resolved by the built-in `pm profile list/show/apply` commands (which the
394
+ // package does not own), so it intentionally omits `activation.commands` and relies
395
+ // on pm's conservative activation tier (granted by the `schema` capability).
396
+ const PROFILE_ACTIVATION_README_SECTION = {
397
+ package: [
398
+ "",
399
+ "## Activation",
400
+ "This package contributes a project profile resolved by the built-in",
401
+ "`pm profile list`, `pm profile show <name>`, and `pm profile apply <name>`",
402
+ "commands — commands the package does not own — so `manifest.json` intentionally",
403
+ "declares no `activation.commands`. pm activates the package conservatively (for",
404
+ "every command, granted by the `schema` capability) so the profile is present",
405
+ "whenever `pm profile` runs. Declaring narrow `activation.commands` here would",
406
+ "gate activation to only the listed commands and silently leave the profile",
407
+ "unregistered for `pm profile`.",
408
+ ],
409
+ extension: [
410
+ "",
411
+ "## Activation",
412
+ "This extension contributes a project profile resolved by the built-in",
413
+ "`pm profile list`, `pm profile show <name>`, and `pm profile apply <name>`",
414
+ "commands, so `manifest.json` intentionally declares no `activation.commands`. pm",
415
+ "activates the extension conservatively (for every command, granted by the",
416
+ "`schema` capability) so the profile is present whenever `pm profile` runs.",
417
+ "Declaring narrow `activation.commands` here would silently leave the profile",
418
+ "unregistered for `pm profile`.",
419
+ ],
420
+ };
421
+ /**
422
+ * Build the README "Included Files" bullet describing `manifest.json` for the
423
+ * chosen capability and vocabulary. The `schema` and `profile` starters omit
424
+ * `activation.commands` (see {@link buildScaffoldActivationCommands}), so their
425
+ * bullet explains the global-contribution tradeoff instead of referencing a field
426
+ * they deliberately lack.
427
+ */
428
+ function buildScaffoldManifestBullet(capability, vocabulary) {
429
+ if (capability === "schema") {
430
+ return `- \`manifest.json\`: ${vocabulary} metadata and capabilities (no \`activation.commands\` — the custom item type activates for every command).`;
431
+ }
432
+ if (capability === "profile") {
433
+ return `- \`manifest.json\`: ${vocabulary} metadata and capabilities (no \`activation.commands\` — the contributed profile resolves through \`pm profile\` for every command).`;
434
+ }
435
+ return `- \`manifest.json\`: ${vocabulary} metadata, capabilities, and \`activation.commands\` (the command paths that lazily activate this ${vocabulary}).`;
436
+ }
437
+ /**
438
+ * Select the README activation section for the chosen capability and vocabulary:
439
+ * the `schema` and `profile` starters explain conservative activation (they omit
440
+ * `activation.commands`); every other capability documents lazy activation.
441
+ */
442
+ function buildScaffoldActivationReadmeSection(capability, vocabulary) {
443
+ if (capability === "schema") {
444
+ return SCHEMA_ACTIVATION_README_SECTION[vocabulary];
445
+ }
446
+ if (capability === "profile") {
447
+ return PROFILE_ACTIVATION_README_SECTION[vocabulary];
448
+ }
449
+ return LAZY_ACTIVATION_README_SECTION[vocabulary];
450
+ }
451
+ /**
452
+ * Build the project-profile archetype object literal the `profile` starter
453
+ * registers — a complete {@link ProjectProfileDefinition} derived from the package
454
+ * name: one custom item type, a custom status, a custom field, a per-type workflow,
455
+ * offline search config, a create template, and an advisory package recommendation.
456
+ *
457
+ * Returned as the lines BETWEEN the object braces at a two-space base indent. Both
458
+ * authoring styles read from this single source so they never drift: the imperative
459
+ * {@link buildActivateBodyLines} wraps them in `api.registerProfile({ ... })`
460
+ * (re-indenting by the `activate` body offset) and the declarative
461
+ * {@link buildDeclarativeBlueprintSurface} wraps them in
462
+ * `defineProjectProfile({ ... })`.
463
+ */
464
+ function buildProfileArchetypeFieldLines(extensionName) {
465
+ const typeName = extensionName;
466
+ const typeFolder = `${extensionName}s`;
467
+ // De-hyphenate for a short alias; omit a redundant self-alias for single-word names.
468
+ const typeAlias = extensionName.replace(/-/g, "");
469
+ const typeAliases = typeAlias === typeName ? [] : [typeAlias];
470
+ const fieldKey = `${extensionName.replace(/-/g, "_")}_owner`;
471
+ const statusId = "reviewing";
472
+ return [
473
+ ` name: ${JSON.stringify(extensionName)},`,
474
+ ` title: ${JSON.stringify(`${extensionName} archetype`)},`,
475
+ ' summary: "Starter project profile. Replace these dimensions with your own archetype.",',
476
+ " // Item types the profile upserts into the project schema when applied.",
477
+ " types: [",
478
+ " {",
479
+ ` name: ${JSON.stringify(typeName)},`,
480
+ ` folder: ${JSON.stringify(typeFolder)},`,
481
+ ` aliases: ${JSON.stringify(typeAliases)},`,
482
+ ` description: ${JSON.stringify(`A ${extensionName} work item that flows to done.`)},`,
483
+ " },",
484
+ " ],",
485
+ " // Custom statuses upserted into the project status set.",
486
+ " statuses: [",
487
+ " {",
488
+ ` id: ${JSON.stringify(statusId)},`,
489
+ ' roles: ["active"],',
490
+ ' aliases: ["in-review"],',
491
+ ' description: "Work is implementation-complete and awaiting review.",',
492
+ " },",
493
+ " ],",
494
+ " // Custom front-matter fields the archetype tracks.",
495
+ " fields: [",
496
+ " {",
497
+ ` key: ${JSON.stringify(fieldKey)},`,
498
+ ' type: "string",',
499
+ ' commands: ["create", "update", "list"],',
500
+ ' description: "Stakeholder accountable for the item.",',
501
+ " },",
502
+ " ],",
503
+ " // Per-type workflow transition allow-list staged into settings.",
504
+ " workflows: [",
505
+ " {",
506
+ ` type: ${JSON.stringify(typeName)},`,
507
+ " allowed_transitions: [",
508
+ ' ["open", "in_progress"],',
509
+ ` ["in_progress", ${JSON.stringify(statusId)}],`,
510
+ ` [${JSON.stringify(statusId)}, "in_progress"],`,
511
+ ` [${JSON.stringify(statusId)}, "closed"],`,
512
+ ' ["in_progress", "blocked"],',
513
+ ' ["blocked", "in_progress"],',
514
+ " ],",
515
+ " },",
516
+ " ],",
517
+ " // Nested-settings knobs staged when the profile is applied.",
518
+ " config: [",
519
+ ' { key: "search_provider", value: "bm25", summary: "Offline BM25 lexical search needs no embedding service." },',
520
+ ' { key: "search_max_results", value: "20", summary: "Result cap tuned for quick triage." },',
521
+ " ],",
522
+ " // Create templates staged into <pmRoot>/templates.",
523
+ " templates: [",
524
+ " {",
525
+ ` name: ${JSON.stringify(extensionName)},`,
526
+ " options: {",
527
+ ` type: ${JSON.stringify(typeName)},`,
528
+ ' priority: "2",',
529
+ ` tags: ${JSON.stringify(extensionName)},`,
530
+ ' acceptanceCriteria: "Item delivers the stated outcome with tests and docs updated.",',
531
+ ' body: "## Context\\n\\n## Acceptance\\n- [ ] \\n",',
532
+ " },",
533
+ " },",
534
+ " ],",
535
+ " // Advisory package recommendations (never auto-installed).",
536
+ " packages: [",
537
+ ' { spec: "templates", reason: "Reusable create templates for recurring item shapes." },',
538
+ " ],",
539
+ ];
540
+ }
123
541
  /**
124
542
  * Build the `activate` body lines for the starter entrypoint. The base body
125
543
  * always registers the starter command; capability-specific variants append
@@ -183,6 +601,77 @@ function buildActivateBodyLines(extensionName, commandName, capability) {
183
601
  " });",
184
602
  ];
185
603
  }
604
+ if (capability === "schema") {
605
+ const itemTypeName = extensionName;
606
+ const itemTypeFolder = `${extensionName}s`;
607
+ // De-hyphenate for a short alias (e.g. "my-tracker" -> "mytracker"). For a
608
+ // single-word name the de-hyphenated form equals the type name, so omit the
609
+ // alias rather than register a redundant self-alias in the starter.
610
+ const itemTypeAlias = extensionName.replace(/-/g, "");
611
+ const itemTypeAliases = itemTypeAlias === itemTypeName ? [] : [itemTypeAlias];
612
+ const fieldName = `${extensionName.replace(/-/g, "_")}_note`;
613
+ const migrationId = `${extensionName}-0001-init`;
614
+ return [
615
+ ...commandLines,
616
+ "",
617
+ " // Schema registrations let a package model its own project domain — the",
618
+ " // heart of \"project management = context management\". Item types and fields",
619
+ " // are GLOBAL contributions: built-in commands like `pm create <type>` and",
620
+ " // `pm list --type <type>` must see them, so this package declares no",
621
+ " // `activation.commands` and pm activates it conservatively for every command.",
622
+ " // The `schema` capability in manifest.json grants all three registrations.",
623
+ " api.registerItemFields([",
624
+ " {",
625
+ ` name: ${JSON.stringify(fieldName)},`,
626
+ ' type: "string",',
627
+ " optional: true,",
628
+ " },",
629
+ " ]);",
630
+ "",
631
+ " api.registerItemTypes([",
632
+ " {",
633
+ ` name: ${JSON.stringify(itemTypeName)},`,
634
+ " // Replace with your domain's canonical plural folder name.",
635
+ ` folder: ${JSON.stringify(itemTypeFolder)},`,
636
+ ` aliases: ${JSON.stringify(itemTypeAliases)},`,
637
+ " // Add field names here to force them at `pm create` time.",
638
+ " required_create_fields: [],",
639
+ " },",
640
+ " ]);",
641
+ "",
642
+ " // Migrations let a package evolve stored items as its schema changes. pm",
643
+ " // runs each migration ONCE through the preflight gate (not once per item),",
644
+ " // passing a context that identifies the migration itself: `context.id` is",
645
+ " // the migration id (not an item id), alongside `context.pm_root` — iterate",
646
+ " // the corpus yourself from there. This starter is a deterministic no-op so",
647
+ " // package tests can invoke it without touching the corpus; replace the body",
648
+ " // with your real rewrite.",
649
+ " api.registerMigration({",
650
+ ` id: ${JSON.stringify(migrationId)},`,
651
+ ` description: ${JSON.stringify(`Initialize ${extensionName} schema state.`)},`,
652
+ " mandatory: false,",
653
+ " run: async (context) => ({ migrated: true, id: context.id }),",
654
+ " });",
655
+ ];
656
+ }
657
+ if (capability === "profile") {
658
+ return [
659
+ ...commandLines,
660
+ "",
661
+ " // A project profile is the broadest customization primitive pm has: one",
662
+ " // declarative bundle of item types, custom statuses, fields, a per-type",
663
+ " // workflow, config knobs, create templates, and package recommendations. Once",
664
+ " // this package is installed the profile resolves by name through `pm profile",
665
+ " // list`, `pm profile show`, and `pm profile apply`, which stages every dimension",
666
+ " // idempotently like a core archetype. A profile registration is a schema+config",
667
+ " // bundle, so the `schema` capability in manifest.json grants it.",
668
+ " api.registerProfile({",
669
+ // The archetype field lines are all non-empty, so re-indent each by the
670
+ // `activate` body offset (object braces sit at two spaces, fields at four).
671
+ ...buildProfileArchetypeFieldLines(extensionName).map((line) => ` ${line}`),
672
+ " });",
673
+ ];
674
+ }
186
675
  if (capability === "importers") {
187
676
  return [
188
677
  ...commandLines,
@@ -234,6 +723,106 @@ function buildActivateBodyLines(extensionName, commandName, capability) {
234
723
  " );",
235
724
  ];
236
725
  }
726
+ if (capability === "renderers") {
727
+ return [
728
+ ...commandLines,
729
+ "",
730
+ " // Renderer overrides customize how pm serializes a command's structured",
731
+ " // result for an output format (\"toon\" or \"json\"). pm runs this override for",
732
+ " // EVERY command's output in that format, so it scopes itself to THIS",
733
+ " // package's own command and returns null — pass-through to pm's default",
734
+ " // renderer — for everything else. Return a string to take over rendering.",
735
+ " // The `renderers` capability in manifest.json grants the registration.",
736
+ ' api.registerRenderer("toon", (context) => {',
737
+ ` if (context.command !== ${JSON.stringify(commandName)}) {`,
738
+ " return null;",
739
+ " }",
740
+ ` return ${JSON.stringify(`${extensionName}: `)} + JSON.stringify(context.result);`,
741
+ " });",
742
+ ];
743
+ }
744
+ if (capability === "parser") {
745
+ return [
746
+ // The parser starter declares its own flags so the override is runnable end
747
+ // to end through `pm <command> --shout`: the command defines the deprecated
748
+ // `--shout` alias and canonical `--upper` flag, the parser rewrites one to
749
+ // the other, and the handler surfaces the normalized value. Flag metadata
750
+ // needs the `schema` capability (declared in manifest.json).
751
+ " api.registerCommand({",
752
+ ` name: ${JSON.stringify(commandName)},`,
753
+ ' description: "Starter scaffold command. Replace with your own behavior.",',
754
+ " flags: [",
755
+ " {",
756
+ ' long: "--shout",',
757
+ ' value_type: "boolean",',
758
+ ' description: "Deprecated alias for --upper; the parser override rewrites it.",',
759
+ " },",
760
+ " {",
761
+ ' long: "--upper",',
762
+ ' value_type: "boolean",',
763
+ ' description: "Echo the canonical flag the parser override produces.",',
764
+ " },",
765
+ " ],",
766
+ " run: async (context) => ({",
767
+ " ok: true,",
768
+ ` source: ${JSON.stringify(extensionName)},`,
769
+ " command: context.command,",
770
+ " // Surfaces the normalized option so `--shout`/`--upper` is observable.",
771
+ " upper: context.options.upper === true,",
772
+ ' message: "Starter extension scaffold is active.",',
773
+ " }),",
774
+ " });",
775
+ "",
776
+ " // Parser overrides preprocess a command's parsed options BEFORE its handler",
777
+ " // runs, returning a delta — only the keys you set are merged over the parsed",
778
+ " // input. This override is scoped to THIS package's own command. Here it",
779
+ " // rewrites the deprecated `--shout` boolean alias to the canonical `--upper`",
780
+ " // flag; replace it with your command's real normalization. The `parser`",
781
+ " // capability in manifest.json grants the registration.",
782
+ ` api.registerParser(${JSON.stringify(commandName)}, (context) => {`,
783
+ " const options = { ...context.options };",
784
+ " if (options.shout === true) {",
785
+ " options.upper = true;",
786
+ " }",
787
+ " delete options.shout;",
788
+ " return { options };",
789
+ " });",
790
+ ];
791
+ }
792
+ if (capability === "preflight") {
793
+ return [
794
+ ...commandLines,
795
+ "",
796
+ " // Preflight overrides adjust pm's pre-run gate decision (extension",
797
+ " // migrations + item-format checks) before EVERY command — the last",
798
+ " // registered override wins. Return a delta of the keys you want to change",
799
+ " // (enforce_item_format_gate, run_preflight_item_format_sync,",
800
+ " // run_extension_migrations, enforce_mandatory_migration_gate); returning",
801
+ " // context.decision unchanged is a safe no-op so installing the package does",
802
+ " // not alter gate behavior — replace it with your policy, e.g.",
803
+ " // `{ run_extension_migrations: false }`. The `preflight` capability in",
804
+ " // manifest.json grants the registration.",
805
+ " api.registerPreflight((context) => context.decision);",
806
+ ];
807
+ }
808
+ if (capability === "services") {
809
+ return [
810
+ ...commandLines,
811
+ "",
812
+ " // Service overrides replace a built-in pm service. The `output_format`",
813
+ " // service renders a command's structured result; returning the payload",
814
+ " // unchanged passes through to pm's default formatting. This override scopes",
815
+ " // itself to THIS package's own command and passes every other command",
816
+ " // through, so it never disrupts unrelated output. The `services` capability",
817
+ " // in manifest.json grants the registration.",
818
+ ' api.registerService("output_format", (context) => {',
819
+ ` if (context.command !== ${JSON.stringify(commandName)}) {`,
820
+ " return context.payload;",
821
+ " }",
822
+ ` return { rendered_by: ${JSON.stringify(extensionName)}, payload: context.payload };`,
823
+ " });",
824
+ ];
825
+ }
237
826
  return [
238
827
  ...commandLines,
239
828
  "",
@@ -253,60 +842,76 @@ function buildActivateBodyLines(extensionName, commandName, capability) {
253
842
  ];
254
843
  }
255
844
  /**
256
- * Build the colocated `node:test` sample suite for the chosen capability. Every
257
- * variant covers activation, command invocation, and teardown via the SDK
258
- * testing helpers; the `hooks` variant adds a test that asserts the
259
- * `after_command` hook is registered and fires cleanly through the public SDK
260
- * testing helper `runRegisteredHookForTest`.
845
+ * Build the colocated `node:test` sample suite (`index.test.ts`) for the chosen
846
+ * capability. Authored in TypeScript and run through the generated package's
847
+ * `npm test` script (typecheck first, then `node --test`, which strips types on
848
+ * Node >=22.18), it imports the `./index.ts` manifest entry directly under
849
+ * NodeNext resolution.
850
+ * Every variant covers activation, command invocation, and teardown via
851
+ * `createExtensionTestHarness`; capability variants add tests that use the
852
+ * harness-bound `assert*`/`run*` helpers and deactivate in `finally`.
261
853
  */
262
854
  function buildSampleTestSource(extensionName, commandName, capability) {
263
855
  const hooksEnabled = capability === "hooks";
264
856
  const searchEnabled = capability === "search";
265
857
  const importersEnabled = capability === "importers";
858
+ const schemaEnabled = capability === "schema";
859
+ const profileEnabled = capability === "profile";
860
+ const renderersEnabled = capability === "renderers";
861
+ const parserEnabled = capability === "parser";
862
+ const preflightEnabled = capability === "preflight";
863
+ const servicesEnabled = capability === "services";
266
864
  const capabilitiesLiteral = SAMPLE_TEST_CAPABILITIES_LITERAL[capability];
267
865
  const searchProviderName = `${extensionName}-search`;
268
866
  const vectorAdapterName = `${extensionName}-vector`;
269
867
  const adapterName = `${extensionName.replace(/-/g, " ")} items`;
868
+ const itemTypeName = extensionName;
869
+ const itemTypeFolder = `${extensionName}s`;
870
+ const fieldName = `${extensionName.replace(/-/g, "_")}_note`;
871
+ const migrationId = `${extensionName}-0001-init`;
270
872
  const importNames = [
271
- " activateExtensionForTest,",
272
873
  " assertExtensionDeactivated,",
273
- " assertRegisteredCommandContract,",
274
- ...(hooksEnabled ? [" assertRegisteredHook,"] : []),
275
- ...(searchEnabled ? [" assertRegisteredSearchProvider,", " assertRegisteredVectorStoreAdapter,"] : []),
276
- ...(importersEnabled ? [" assertRegisteredImporter,", " assertRegisteredExporter,"] : []),
277
- " deactivateExtensionForTest,",
278
- " runRegisteredCommandForTest,",
279
- ...(hooksEnabled ? [" runRegisteredHookForTest,"] : []),
280
- ...(searchEnabled ? [" runRegisteredSearchProviderForTest,", " runRegisteredVectorStoreAdapterForTest,"] : []),
281
- ...(importersEnabled ? [" runRegisteredImporterForTest,", " runRegisteredExporterForTest,"] : []),
874
+ " createExtensionTestHarness,",
282
875
  ];
283
876
  const hookTestLines = hooksEnabled
284
877
  ? [
285
878
  `test(${JSON.stringify(`${extensionName} reacts to commands via its after_command hook`)}, async () => {`,
286
- " const activation = await activateExtensionForTest(extension, {",
879
+ " const ext = await createExtensionTestHarness(extension, {",
287
880
  ` name: ${JSON.stringify(extensionName)},`,
288
881
  ` capabilities: ${capabilitiesLiteral},`,
289
882
  " });",
290
- " // assertRegisteredHook throws unless an after_command hook is registered,",
291
- " // so reaching the next line already proves the hook is wired.",
292
- " assertRegisteredHook(activation.hooks, {",
293
- ' kind: "after_command",',
294
- ` extensionName: ${JSON.stringify(extensionName)},`,
295
- " });",
296
- " // runRegisteredHookForTest fires the hook through pm's real runner with a",
297
- " // synthetic context and returns the warnings it produced; a clean hook",
298
- " // returns none. Replace the context/assertions as your hook grows.",
299
- " const warnings = await runRegisteredHookForTest(activation.hooks, {",
300
- ' kind: "after_command",',
301
- " context: {",
302
- ` command: ${JSON.stringify(commandName)},`,
303
- " args: [],",
304
- ' pm_root: "",',
305
- " ok: true,",
306
- " affected: [],",
307
- " },",
308
- " });",
309
- " assert.deepEqual(warnings, []);",
883
+ " let deactivated = false;",
884
+ " try {",
885
+ " // assertHook throws unless an after_command hook is registered, so",
886
+ " // reaching the next line already proves the hook is wired.",
887
+ " ext.assertHook({",
888
+ ' kind: "after_command",',
889
+ ` extensionName: ${JSON.stringify(extensionName)},`,
890
+ " });",
891
+ " // runHook fires the hook through pm's real runner with a synthetic",
892
+ " // context and returns the warnings it produced; a clean hook returns none.",
893
+ " // Replace the context/assertions as your hook grows.",
894
+ " const warnings = await ext.runHook({",
895
+ ' kind: "after_command",',
896
+ " context: {",
897
+ ` command: ${JSON.stringify(commandName)},`,
898
+ " args: [],",
899
+ ' pm_root: "",',
900
+ " ok: true,",
901
+ " affected: [],",
902
+ " },",
903
+ " });",
904
+ " assert.deepEqual(warnings, []);",
905
+ " const teardown = await ext.deactivate();",
906
+ " assertExtensionDeactivated(teardown);",
907
+ " deactivated = true;",
908
+ " } finally {",
909
+ " if (!deactivated) {",
910
+ " try {",
911
+ " await ext.deactivate();",
912
+ " } catch {}",
913
+ " }",
914
+ " }",
310
915
  "});",
311
916
  "",
312
917
  ]
@@ -314,49 +919,57 @@ function buildSampleTestSource(extensionName, commandName, capability) {
314
919
  const searchTestLines = searchEnabled
315
920
  ? [
316
921
  `test(${JSON.stringify(`${extensionName} registers and invokes search primitives`)}, async () => {`,
317
- " const activation = await activateExtensionForTest(extension, {",
922
+ " const ext = await createExtensionTestHarness(extension, {",
318
923
  ` name: ${JSON.stringify(extensionName)},`,
319
924
  ` capabilities: ${capabilitiesLiteral},`,
320
925
  " });",
321
- " assertRegisteredSearchProvider(activation.registrations, {",
322
- ` provider: ${JSON.stringify(searchProviderName)},`,
323
- ` extensionName: ${JSON.stringify(extensionName)},`,
324
- " });",
325
- " assertRegisteredVectorStoreAdapter(activation.registrations, {",
326
- ` adapter: ${JSON.stringify(vectorAdapterName)},`,
327
- ` extensionName: ${JSON.stringify(extensionName)},`,
328
- " });",
926
+ " let deactivated = false;",
927
+ " try {",
928
+ ` ext.assertSearchProvider({ provider: ${JSON.stringify(searchProviderName)}, extensionName: ${JSON.stringify(extensionName)} });`,
929
+ ` ext.assertVectorStoreAdapter({ adapter: ${JSON.stringify(vectorAdapterName)}, extensionName: ${JSON.stringify(extensionName)} });`,
329
930
  "",
330
- " const query = await runRegisteredSearchProviderForTest(activation.registrations, {",
331
- ` provider: ${JSON.stringify(searchProviderName)},`,
332
- ' operation: "query",',
333
- " context: {",
334
- ' query: "sync",',
335
- ' mode: "semantic",',
336
- ' tokens: ["sync"],',
337
- " options: {},",
338
- " settings: {},",
339
- " documents: [",
340
- ' { metadata: { id: "pm-1", title: "Sync external context" }, body: "" },',
341
- ' { metadata: { id: "pm-2", title: "Unrelated task" }, body: "" },',
342
- " ],",
343
- " },",
344
- " });",
345
- ' assert.deepEqual(query, { hits: [{ id: "pm-1", score: 1, matched_fields: ["title"] }] });',
931
+ " // The starter provider reads only document title/id, so `settings` is a",
932
+ " // minimal typed stub and `documents` carry just the fields it inspects.",
933
+ " const query = await ext.runSearchProvider({",
934
+ ` provider: ${JSON.stringify(searchProviderName)},`,
935
+ ' operation: "query",',
936
+ " context: {",
937
+ ' query: "sync",',
938
+ ' mode: "semantic",',
939
+ ' tokens: ["sync"],',
940
+ " options: {},",
941
+ " settings: {} as PmSettings,",
942
+ " documents: [",
943
+ ' { metadata: { id: "pm-1", title: "Sync external context" }, body: "" },',
944
+ ' { metadata: { id: "pm-2", title: "Unrelated task" }, body: "" },',
945
+ " ] as ItemDocument[],",
946
+ " },",
947
+ " });",
948
+ ' assert.deepEqual(query, { hits: [{ id: "pm-1", score: 1, matched_fields: ["title"] }] });',
346
949
  "",
347
- " const embedding = await runRegisteredSearchProviderForTest(activation.registrations, {",
348
- ` provider: ${JSON.stringify(searchProviderName)},`,
349
- ' operation: "embed",',
350
- ' context: { input: "abc", settings: {}, model: "starter-model" },',
351
- " });",
352
- " assert.deepEqual(embedding, [3]);",
950
+ " const embedding = await ext.runSearchProvider({",
951
+ ` provider: ${JSON.stringify(searchProviderName)},`,
952
+ ' operation: "embed",',
953
+ ' context: { input: "abc", settings: {} as PmSettings, model: "starter-model" },',
954
+ " });",
955
+ " assert.deepEqual(embedding, [3]);",
353
956
  "",
354
- " const vectorHits = await runRegisteredVectorStoreAdapterForTest(activation.registrations, {",
355
- ` adapter: ${JSON.stringify(vectorAdapterName)},`,
356
- ' operation: "query",',
357
- " context: { vector: [0.1, 0.2], limit: 2, settings: {} },",
358
- " });",
359
- ' assert.deepEqual(vectorHits, [{ id: "starter-vector-hit", score: 2 }]);',
957
+ " const vectorHits = await ext.runVectorStoreAdapter({",
958
+ ` adapter: ${JSON.stringify(vectorAdapterName)},`,
959
+ ' operation: "query",',
960
+ " context: { vector: [0.1, 0.2], limit: 2, settings: {} as PmSettings },",
961
+ " });",
962
+ ' assert.deepEqual(vectorHits, [{ id: "starter-vector-hit", score: 2 }]);',
963
+ " const teardown = await ext.deactivate();",
964
+ " assertExtensionDeactivated(teardown);",
965
+ " deactivated = true;",
966
+ " } finally {",
967
+ " if (!deactivated) {",
968
+ " try {",
969
+ " await ext.deactivate();",
970
+ " } catch {}",
971
+ " }",
972
+ " }",
360
973
  "});",
361
974
  "",
362
975
  ]
@@ -364,34 +977,296 @@ function buildSampleTestSource(extensionName, commandName, capability) {
364
977
  const importerTestLines = importersEnabled
365
978
  ? [
366
979
  `test(${JSON.stringify(`${extensionName} registers and invokes import/export primitives`)}, async () => {`,
367
- " const activation = await activateExtensionForTest(extension, {",
980
+ " const ext = await createExtensionTestHarness(extension, {",
981
+ ` name: ${JSON.stringify(extensionName)},`,
982
+ ` capabilities: ${capabilitiesLiteral},`,
983
+ " });",
984
+ " let deactivated = false;",
985
+ " try {",
986
+ ` ext.assertImporter({ importer: ${JSON.stringify(adapterName)}, extensionName: ${JSON.stringify(extensionName)} });`,
987
+ ` ext.assertExporter({ exporter: ${JSON.stringify(adapterName)}, extensionName: ${JSON.stringify(extensionName)} });`,
988
+ "",
989
+ " const imported = await ext.runImporter({",
990
+ ` importer: ${JSON.stringify(adapterName)},`,
991
+ ' options: { source: "tickets" },',
992
+ ' args: ["batch-1"],',
993
+ " });",
994
+ " assert.equal(imported.handled, true);",
995
+ ' assert.deepEqual(imported.result, { imported: 1, source: "tickets", args: ["batch-1"] });',
996
+ "",
997
+ " const exported = await ext.runExporter({",
998
+ ` exporter: ${JSON.stringify(adapterName)},`,
999
+ ' options: { destination: "archive" },',
1000
+ ' args: ["done"],',
1001
+ " });",
1002
+ " assert.equal(exported.handled, true);",
1003
+ ' assert.deepEqual(exported.result, { exported: true, destination: "archive", args: ["done"] });',
1004
+ " const teardown = await ext.deactivate();",
1005
+ " assertExtensionDeactivated(teardown);",
1006
+ " deactivated = true;",
1007
+ " } finally {",
1008
+ " if (!deactivated) {",
1009
+ " try {",
1010
+ " await ext.deactivate();",
1011
+ " } catch {}",
1012
+ " }",
1013
+ " }",
1014
+ "});",
1015
+ "",
1016
+ ]
1017
+ : [];
1018
+ const schemaTestLines = schemaEnabled
1019
+ ? [
1020
+ `test(${JSON.stringify(`${extensionName} registers and runs its custom schema`)}, async () => {`,
1021
+ " const ext = await createExtensionTestHarness(extension, {",
368
1022
  ` name: ${JSON.stringify(extensionName)},`,
369
1023
  ` capabilities: ${capabilitiesLiteral},`,
370
1024
  " });",
371
- " assertRegisteredImporter(activation.registrations, {",
372
- ` importer: ${JSON.stringify(adapterName)},`,
373
- ` extensionName: ${JSON.stringify(extensionName)},`,
1025
+ " let deactivated = false;",
1026
+ " try {",
1027
+ " // assertItemType/Field/Migration throw unless the registration is",
1028
+ " // present, so reaching each next line already proves the wiring; assert on",
1029
+ " // the returned definitions to demonstrate inspecting registered metadata.",
1030
+ ` const itemType = ext.assertItemType({ itemType: ${JSON.stringify(itemTypeName)}, extensionName: ${JSON.stringify(extensionName)} });`,
1031
+ ` assert.equal(itemType.itemType.folder, ${JSON.stringify(itemTypeFolder)});`,
1032
+ ` const itemField = ext.assertItemField({ field: ${JSON.stringify(fieldName)}, extensionName: ${JSON.stringify(extensionName)} });`,
1033
+ ' assert.equal(itemField.field.type, "string");',
1034
+ ` ext.assertMigration({ migration: ${JSON.stringify(migrationId)}, extensionName: ${JSON.stringify(extensionName)}, mandatory: false });`,
1035
+ "",
1036
+ " // runMigration invokes the migration through pm's real runner with a",
1037
+ " // synthetic context and returns its result. Replace the context/assertions",
1038
+ " // as your migration grows.",
1039
+ ` const migrated = await ext.runMigration({ migration: ${JSON.stringify(migrationId)} });`,
1040
+ ` assert.deepEqual(migrated, { migrated: true, id: ${JSON.stringify(migrationId)} });`,
1041
+ " const teardown = await ext.deactivate();",
1042
+ " assertExtensionDeactivated(teardown);",
1043
+ " deactivated = true;",
1044
+ " } finally {",
1045
+ " if (!deactivated) {",
1046
+ " try {",
1047
+ " await ext.deactivate();",
1048
+ " } catch {}",
1049
+ " }",
1050
+ " }",
1051
+ "});",
1052
+ "",
1053
+ ]
1054
+ : [];
1055
+ const profileTestLines = profileEnabled
1056
+ ? [
1057
+ `test(${JSON.stringify(`${extensionName} registers its project profile`)}, async () => {`,
1058
+ " const ext = await createExtensionTestHarness(extension, {",
1059
+ ` name: ${JSON.stringify(extensionName)},`,
1060
+ ` capabilities: ${capabilitiesLiteral},`,
1061
+ " });",
1062
+ " let deactivated = false;",
1063
+ " try {",
1064
+ " // assertProfile throws unless the profile is registered, so reaching the next",
1065
+ " // line already proves the wiring; assert on the returned definition to inspect",
1066
+ " // the bundled archetype dimensions.",
1067
+ ` const { profile } = ext.assertProfile({ profile: ${JSON.stringify(extensionName)}, extensionName: ${JSON.stringify(extensionName)} });`,
1068
+ ` assert.equal(profile.title, ${JSON.stringify(`${extensionName} archetype`)});`,
1069
+ " assert.equal(profile.types.length, 1);",
1070
+ " assert.equal(profile.workflows.length, 1);",
1071
+ " const teardown = await ext.deactivate();",
1072
+ " assertExtensionDeactivated(teardown);",
1073
+ " deactivated = true;",
1074
+ " } finally {",
1075
+ " if (!deactivated) {",
1076
+ " try {",
1077
+ " await ext.deactivate();",
1078
+ " } catch {}",
1079
+ " }",
1080
+ " }",
1081
+ "});",
1082
+ "",
1083
+ ]
1084
+ : [];
1085
+ const rendererTestLines = renderersEnabled
1086
+ ? [
1087
+ `test(${JSON.stringify(`${extensionName} registers and invokes its renderer override`)}, async () => {`,
1088
+ " const ext = await createExtensionTestHarness(extension, {",
1089
+ ` name: ${JSON.stringify(extensionName)},`,
1090
+ ` capabilities: ${capabilitiesLiteral},`,
374
1091
  " });",
375
- " assertRegisteredExporter(activation.registrations, {",
376
- ` exporter: ${JSON.stringify(adapterName)},`,
377
- ` extensionName: ${JSON.stringify(extensionName)},`,
1092
+ " let deactivated = false;",
1093
+ " try {",
1094
+ " // assertRendererOverride throws unless a renderer is registered for the",
1095
+ " // format, so reaching the next line already proves the wiring.",
1096
+ ` const override = ext.assertRendererOverride({ format: "toon", extensionName: ${JSON.stringify(extensionName)} });`,
1097
+ ' assert.equal(override.format, "toon");',
1098
+ "",
1099
+ " // runRendererOverride renders through pm's real runner. The override",
1100
+ " // customizes only THIS package's command output and returns a string the",
1101
+ " // host uses verbatim. Replace the assertions as it grows.",
1102
+ " const rendered = await ext.runRendererOverride({",
1103
+ ' format: "toon",',
1104
+ ` command: ${JSON.stringify(commandName)},`,
1105
+ " result: { ok: true },",
1106
+ " });",
1107
+ " assert.equal(rendered.overridden, true);",
1108
+ ` assert.equal(rendered.rendered, ${JSON.stringify(`${extensionName}: `)} + JSON.stringify({ ok: true }));`,
1109
+ "",
1110
+ " // Output for any other command passes through to pm's default renderer.",
1111
+ " const passthrough = await ext.runRendererOverride({",
1112
+ ' format: "toon",',
1113
+ ' command: "list",',
1114
+ " result: { ok: true },",
1115
+ " });",
1116
+ " assert.equal(passthrough.overridden, false);",
1117
+ " const teardown = await ext.deactivate();",
1118
+ " assertExtensionDeactivated(teardown);",
1119
+ " deactivated = true;",
1120
+ " } finally {",
1121
+ " if (!deactivated) {",
1122
+ " try {",
1123
+ " await ext.deactivate();",
1124
+ " } catch {}",
1125
+ " }",
1126
+ " }",
1127
+ "});",
1128
+ "",
1129
+ ]
1130
+ : [];
1131
+ const parserTestLines = parserEnabled
1132
+ ? [
1133
+ `test(${JSON.stringify(`${extensionName} rewrites command options via its parser override`)}, async () => {`,
1134
+ " const ext = await createExtensionTestHarness(extension, {",
1135
+ ` name: ${JSON.stringify(extensionName)},`,
1136
+ ` capabilities: ${capabilitiesLiteral},`,
378
1137
  " });",
1138
+ " let deactivated = false;",
1139
+ " try {",
1140
+ " // assertParserOverride throws unless a parser is registered for the",
1141
+ " // command, so reaching the next line already proves the wiring.",
1142
+ ` ext.assertParserOverride({ command: ${JSON.stringify(commandName)}, extensionName: ${JSON.stringify(extensionName)} });`,
1143
+ "",
1144
+ " // runParserOverride runs the override through pm's real parser runner and",
1145
+ " // returns the rewritten context. The starter rewrites the deprecated",
1146
+ " // `shout` alias to the canonical `upper` flag.",
1147
+ " const result = await ext.runParserOverride({",
1148
+ ` command: ${JSON.stringify(commandName)},`,
1149
+ " args: [],",
1150
+ " options: { shout: true },",
1151
+ " global: {},",
1152
+ ' pm_root: "",',
1153
+ " });",
1154
+ " assert.equal(result.overridden, true);",
1155
+ " assert.deepEqual(result.context.options, { upper: true });",
1156
+ "",
1157
+ " // End to end: feed the rewritten options into the command handler to",
1158
+ " // prove `pm <command> --shout` surfaces the normalized `upper` flag in",
1159
+ " // the result.",
1160
+ ` const invocation = await ext.runCommand({ command: ${JSON.stringify(commandName)}, options: result.context.options });`,
1161
+ " assert.equal(invocation.handled, true);",
1162
+ " assert.deepEqual(invocation.result, {",
1163
+ " ok: true,",
1164
+ ` source: ${JSON.stringify(extensionName)},`,
1165
+ ` command: ${JSON.stringify(commandName)},`,
1166
+ " upper: true,",
1167
+ ' message: "Starter extension scaffold is active.",',
1168
+ " });",
1169
+ " const teardown = await ext.deactivate();",
1170
+ " assertExtensionDeactivated(teardown);",
1171
+ " deactivated = true;",
1172
+ " } finally {",
1173
+ " if (!deactivated) {",
1174
+ " try {",
1175
+ " await ext.deactivate();",
1176
+ " } catch {}",
1177
+ " }",
1178
+ " }",
1179
+ "});",
379
1180
  "",
380
- " const imported = await runRegisteredImporterForTest(activation, {",
381
- ` importer: ${JSON.stringify(adapterName)},`,
382
- ' options: { source: "tickets" },',
383
- ' args: ["batch-1"],',
1181
+ ]
1182
+ : [];
1183
+ const preflightTestLines = preflightEnabled
1184
+ ? [
1185
+ `test(${JSON.stringify(`${extensionName} returns a preflight gate decision via its override`)}, async () => {`,
1186
+ " const ext = await createExtensionTestHarness(extension, {",
1187
+ ` name: ${JSON.stringify(extensionName)},`,
1188
+ ` capabilities: ${capabilitiesLiteral},`,
384
1189
  " });",
385
- " assert.equal(imported.handled, true);",
386
- ' assert.deepEqual(imported.result, { imported: 1, source: "tickets", args: ["batch-1"] });',
1190
+ " let deactivated = false;",
1191
+ " try {",
1192
+ " // assertPreflightOverride throws unless a preflight override is",
1193
+ " // registered, so reaching the next line already proves the wiring.",
1194
+ ` ext.assertPreflightOverride({ extensionName: ${JSON.stringify(extensionName)} });`,
387
1195
  "",
388
- " const exported = await runRegisteredExporterForTest(activation, {",
389
- ` exporter: ${JSON.stringify(adapterName)},`,
390
- ' options: { destination: "archive" },',
391
- ' args: ["done"],',
1196
+ " // runPreflightOverride runs the override through pm's real runner with a",
1197
+ " // synthetic gate decision. The starter echoes the decision unchanged;",
1198
+ " // replace the values/assertions with your real policy.",
1199
+ " const decision = {",
1200
+ " enforce_item_format_gate: true,",
1201
+ " run_preflight_item_format_sync: false,",
1202
+ " run_extension_migrations: true,",
1203
+ " enforce_mandatory_migration_gate: false,",
1204
+ " };",
1205
+ " const result = await ext.runPreflightOverride({",
1206
+ ` command: ${JSON.stringify(commandName)},`,
1207
+ " args: [],",
1208
+ " options: {},",
1209
+ " global: {},",
1210
+ ' pm_root: "",',
1211
+ " decision,",
1212
+ " });",
1213
+ " assert.equal(result.overridden, true);",
1214
+ " assert.deepEqual(result.decision, decision);",
1215
+ " const teardown = await ext.deactivate();",
1216
+ " assertExtensionDeactivated(teardown);",
1217
+ " deactivated = true;",
1218
+ " } finally {",
1219
+ " if (!deactivated) {",
1220
+ " try {",
1221
+ " await ext.deactivate();",
1222
+ " } catch {}",
1223
+ " }",
1224
+ " }",
1225
+ "});",
1226
+ "",
1227
+ ]
1228
+ : [];
1229
+ const serviceTestLines = servicesEnabled
1230
+ ? [
1231
+ `test(${JSON.stringify(`${extensionName} customizes command output via its service override`)}, async () => {`,
1232
+ " const ext = await createExtensionTestHarness(extension, {",
1233
+ ` name: ${JSON.stringify(extensionName)},`,
1234
+ ` capabilities: ${capabilitiesLiteral},`,
392
1235
  " });",
393
- " assert.equal(exported.handled, true);",
394
- ' assert.deepEqual(exported.result, { exported: true, destination: "archive", args: ["done"] });',
1236
+ " let deactivated = false;",
1237
+ " try {",
1238
+ " // assertServiceOverride throws unless a service override is registered",
1239
+ " // for the service, so reaching the next line proves the wiring.",
1240
+ ` ext.assertServiceOverride({ service: "output_format", extensionName: ${JSON.stringify(extensionName)} });`,
1241
+ "",
1242
+ " // runServiceOverride runs the override through pm's real service runner.",
1243
+ " // The override customizes only THIS package's command output (handled),",
1244
+ " // passing every other command through (not handled).",
1245
+ " const handled = await ext.runServiceOverride({",
1246
+ ' service: "output_format",',
1247
+ ` command: ${JSON.stringify(commandName)},`,
1248
+ " payload: { ok: true },",
1249
+ " });",
1250
+ " assert.equal(handled.handled, true);",
1251
+ ` assert.deepEqual(handled.result, { rendered_by: ${JSON.stringify(extensionName)}, payload: { ok: true } });`,
1252
+ "",
1253
+ " // Output for any other command passes through to pm's default formatter.",
1254
+ " const passthrough = await ext.runServiceOverride({",
1255
+ ' service: "output_format",',
1256
+ ' command: "list",',
1257
+ " payload: { ok: true },",
1258
+ " });",
1259
+ " assert.equal(passthrough.handled, false);",
1260
+ " const teardown = await ext.deactivate();",
1261
+ " assertExtensionDeactivated(teardown);",
1262
+ " deactivated = true;",
1263
+ " } finally {",
1264
+ " if (!deactivated) {",
1265
+ " try {",
1266
+ " await ext.deactivate();",
1267
+ " } catch {}",
1268
+ " }",
1269
+ " }",
395
1270
  "});",
396
1271
  "",
397
1272
  ]
@@ -402,44 +1277,76 @@ function buildSampleTestSource(extensionName, commandName, capability) {
402
1277
  "import {",
403
1278
  ...importNames,
404
1279
  '} from "@unbrained/pm-cli/sdk/testing";',
405
- 'import extension from "./index.js";',
1280
+ // The search sample's synthetic query/vector contexts reference these SDK types
1281
+ // for their typed-stub fixtures; other capabilities need no extra type imports.
1282
+ ...(searchEnabled ? ['import type { ItemDocument, PmSettings } from "@unbrained/pm-cli/sdk";'] : []),
1283
+ 'import extension from "./index.ts";',
406
1284
  "",
407
1285
  `test(${JSON.stringify(`${extensionName} registers its starter command`)}, async () => {`,
408
1286
  " // `capabilities` mirrors manifest.json so the in-memory activation grants",
409
1287
  " // the capabilities the entrypoint relies on.",
410
- " const activation = await activateExtensionForTest(extension, {",
1288
+ " const ext = await createExtensionTestHarness(extension, {",
411
1289
  ` name: ${JSON.stringify(extensionName)},`,
412
1290
  ` capabilities: ${capabilitiesLiteral},`,
413
1291
  " });",
414
- " // assertRegisteredCommandContract throws if the command is not",
415
- " // registered, so reaching here already proves the wiring; assert on the",
416
- " // returned definition to demonstrate inspecting registered metadata.",
417
- " const registered = assertRegisteredCommandContract(activation.registrations, {",
418
- ` command: ${JSON.stringify(commandName)},`,
419
- ` extensionName: ${JSON.stringify(extensionName)},`,
420
- " });",
421
- ' assert.equal(typeof registered.command.description, "string");',
1292
+ " let deactivated = false;",
1293
+ " try {",
1294
+ " // assertCommandContract is bound to the right activation registry and throws",
1295
+ " // if the command is not registered, so reaching here already proves the",
1296
+ " // wiring; assert on the returned definition to inspect metadata.",
1297
+ " const registered = ext.assertCommandContract({",
1298
+ ` command: ${JSON.stringify(commandName)},`,
1299
+ ` extensionName: ${JSON.stringify(extensionName)},`,
1300
+ " });",
1301
+ ' assert.equal(typeof registered.command.description, "string");',
422
1302
  "",
423
- " // runRegisteredCommandForTest invokes the handler through pm's real",
424
- " // dispatch engine, so this asserts behavior - not just that the command",
425
- " // is wired. Replace these assertions as you flesh out your command.",
426
- " const invocation = await runRegisteredCommandForTest(activation.commands, {",
427
- ` command: ${JSON.stringify(commandName)},`,
428
- " });",
429
- " assert.equal(invocation.handled, true);",
430
- " assert.equal(invocation.result.ok, true);",
431
- ` assert.equal(invocation.result.command, ${JSON.stringify(commandName)});`,
1303
+ " // runCommand invokes the handler through pm's real dispatch engine, so this",
1304
+ " // asserts behavior - not just that the command is wired. Replace these",
1305
+ " // assertions as you flesh out your command.",
1306
+ " const invocation = await ext.runCommand({",
1307
+ ` command: ${JSON.stringify(commandName)},`,
1308
+ " });",
1309
+ " assert.equal(invocation.handled, true);",
1310
+ " // The handler result is typed `unknown`, so deep-equality on the whole",
1311
+ " // structured payload keeps the assertion type-safe without a cast.",
1312
+ " assert.deepEqual(invocation.result, {",
1313
+ " ok: true,",
1314
+ ` source: ${JSON.stringify(extensionName)},`,
1315
+ ` command: ${JSON.stringify(commandName)},`,
1316
+ // The parser starter's command surfaces the normalized `upper` flag, which
1317
+ // defaults to false when the command is invoked without `--shout`/`--upper`.
1318
+ ...(parserEnabled ? [" upper: false,"] : []),
1319
+ ' message: "Starter extension scaffold is active.",',
1320
+ " });",
1321
+ " const teardown = await ext.deactivate();",
1322
+ " assertExtensionDeactivated(teardown);",
1323
+ " deactivated = true;",
1324
+ " } finally {",
1325
+ " if (!deactivated) {",
1326
+ " try {",
1327
+ " await ext.deactivate();",
1328
+ " } catch {}",
1329
+ " }",
1330
+ " }",
432
1331
  "});",
433
1332
  "",
434
1333
  ...hookTestLines,
435
1334
  ...searchTestLines,
436
1335
  ...importerTestLines,
1336
+ ...schemaTestLines,
1337
+ ...profileTestLines,
1338
+ ...rendererTestLines,
1339
+ ...parserTestLines,
1340
+ ...preflightTestLines,
1341
+ ...serviceTestLines,
437
1342
  `test(${JSON.stringify(`${extensionName} tears down cleanly via deactivate`)}, async () => {`,
438
- " // deactivateExtensionForTest runs pm's real teardown engine over the",
439
- " // module, so this proves your `deactivate` hook runs without throwing.",
440
- " const teardown = await deactivateExtensionForTest(extension, {",
1343
+ " // createExtensionTestHarness binds teardown to the same name/layer used for",
1344
+ " // activation, so this proves your `deactivate` hook runs without throwing.",
1345
+ " const ext = await createExtensionTestHarness(extension, {",
441
1346
  ` name: ${JSON.stringify(extensionName)},`,
1347
+ ` capabilities: ${capabilitiesLiteral},`,
442
1348
  " });",
1349
+ " const teardown = await ext.deactivate();",
443
1350
  " // assertExtensionDeactivated throws unless exactly one extension tore down",
444
1351
  " // with no failures, so reaching the next line already proves teardown ran.",
445
1352
  " assertExtensionDeactivated(teardown);",
@@ -448,30 +1355,774 @@ function buildSampleTestSource(extensionName, commandName, capability) {
448
1355
  "",
449
1356
  ].join("\n");
450
1357
  }
1358
+ /**
1359
+ * Build the manifest `activation.commands` list for the chosen capability: the
1360
+ * exact command paths the starter `activate` registers.
1361
+ *
1362
+ * pm uses this list for lazy activation — it imports and activates the package
1363
+ * only when an invoked command path matches one of these entries — so it must
1364
+ * stay in sync with the registrations in {@link buildActivateBodyLines}. Every
1365
+ * first-party bundled package declares the same field; emitting it keeps
1366
+ * generated packages on that convention so they get precise, lazy, correct
1367
+ * activation instead of falling back to capability heuristics (which cannot
1368
+ * enumerate the contributed commands). The `importers` variant additionally
1369
+ * registers paired import/export command handlers under the adapter name.
1370
+ *
1371
+ * The `schema` and `profile` variants are the deliberate exceptions: each returns
1372
+ * an empty list so the manifest omits `activation.commands`. Custom item types and
1373
+ * fields are GLOBAL schema contributions that built-in commands (`pm create
1374
+ * <type>`, `pm list --type <type>`, `pm validate`) must see, and a contributed
1375
+ * project profile is resolved by the built-in `pm profile list/show/apply` commands
1376
+ * — commands the package does not own and cannot enumerate. Declaring narrow
1377
+ * `activation.commands` there would gate activation to only the listed commands and
1378
+ * silently leave the custom type or profile unregistered for those built-ins;
1379
+ * omitting it lets pm's conservative activation tier (which covers `schema`) load
1380
+ * the package for every command.
1381
+ */
1382
+ function buildScaffoldActivationCommands(extensionName, commandName, capability) {
1383
+ if (capability === "schema" || capability === "profile") {
1384
+ return [];
1385
+ }
1386
+ if (capability === "importers") {
1387
+ const adapterName = `${extensionName.replace(/-/g, " ")} items`;
1388
+ return [commandName, `${adapterName} import`, `${adapterName} export`];
1389
+ }
1390
+ return [commandName];
1391
+ }
1392
+ // One-line surface phrase per capability, listing the registration surfaces the
1393
+ // declarative blueprint populates beyond the always-present starter command. Used
1394
+ // to keep the generated README's entrypoint bullet accurate per capability.
1395
+ const DECLARATIVE_ENTRYPOINT_SURFACE_PHRASE = {
1396
+ commands: "starter command",
1397
+ hooks: "starter command and after_command hook",
1398
+ search: "starter command, search provider, and vector-store adapter",
1399
+ importers: "starter command, importer, and exporter",
1400
+ schema: "starter command, custom item type, item field, and migration",
1401
+ profile: "starter command and project profile",
1402
+ renderers: "starter command and toon renderer override",
1403
+ parser: "starter command and parser override",
1404
+ preflight: "starter command and preflight override",
1405
+ services: "starter command and output_format service override",
1406
+ };
1407
+ // The `ExtensionBlueprint` fields each capability populates, rendered as inline
1408
+ // code in the README's Declarative Authoring section so authors can see which
1409
+ // blueprint surface maps to the capability they scaffolded.
1410
+ const DECLARATIVE_CAPABILITY_BLUEPRINT_FIELDS = {
1411
+ commands: "`commands`",
1412
+ hooks: "`commands` and `hooks.afterCommand`",
1413
+ search: "`commands`, `searchProviders`, and `vectorStoreAdapters`",
1414
+ importers: "`commands`, `importers`, and `exporters`",
1415
+ schema: "`commands`, `itemTypes`, `itemFields`, and `migrations`",
1416
+ profile: "`commands` and `profiles`",
1417
+ renderers: "`commands` and `renderers`",
1418
+ parser: "`commands` and `parsers`",
1419
+ preflight: "`commands` and `preflights`",
1420
+ services: "`commands` and `services`",
1421
+ };
1422
+ /**
1423
+ * Build the `defineCommand` starter-command definition for the declarative
1424
+ * entrypoint. Mirrors the imperative {@link buildActivateBodyLines} command body
1425
+ * (same name/description/run result), and for the `parser` capability declares the
1426
+ * `--shout`/`--upper` flags and surfaces the normalized `upper` option so the
1427
+ * override is runnable end to end through `pm <command> --shout`.
1428
+ */
1429
+ function buildDeclarativePingCommandLines(extensionName, commandName, capability) {
1430
+ const parserEnabled = capability === "parser";
1431
+ return [
1432
+ "// The starter command, authored with the `defineCommand` builder so its literal",
1433
+ "// name is preserved and the handler `context` is inferred. Exporting it lets you",
1434
+ "// unit-test the definition in isolation, apart from the blueprint.",
1435
+ "export const pingCommand = defineCommand({",
1436
+ ` name: ${JSON.stringify(commandName)},`,
1437
+ ' description: "Starter scaffold command. Replace with your own behavior.",',
1438
+ ...(parserEnabled
1439
+ ? [
1440
+ " flags: [",
1441
+ " {",
1442
+ ' long: "--shout",',
1443
+ ' value_type: "boolean",',
1444
+ ' description: "Deprecated alias for --upper; the parser override rewrites it.",',
1445
+ " },",
1446
+ " {",
1447
+ ' long: "--upper",',
1448
+ ' value_type: "boolean",',
1449
+ ' description: "Echo the canonical flag the parser override produces.",',
1450
+ " },",
1451
+ " ],",
1452
+ ]
1453
+ : []),
1454
+ " run: async (context) => ({",
1455
+ " ok: true,",
1456
+ ` source: ${JSON.stringify(extensionName)},`,
1457
+ " command: context.command,",
1458
+ ...(parserEnabled ? [" upper: context.options.upper === true,"] : []),
1459
+ ' message: "Starter extension scaffold is active.",',
1460
+ " }),",
1461
+ "});",
1462
+ ];
1463
+ }
1464
+ /**
1465
+ * Build the {@link DeclarativeBlueprintSurface} for a capability: the starter
1466
+ * command plus the capability's `define*`-authored registration definitions and
1467
+ * the `ExtensionBlueprint` fields that collect them.
1468
+ *
1469
+ * Blueprint fields are emitted in {@link composeExtension}'s registration order so
1470
+ * the generated `activate` wires them deterministically. Each surface mirrors the
1471
+ * imperative {@link buildActivateBodyLines} registration (same names, same handler
1472
+ * behavior) so a package scaffolded in either style installs and dispatches
1473
+ * identically — the manifest, derived capabilities, and registered surfaces match.
1474
+ */
1475
+ function buildDeclarativeBlueprintSurface(extensionName, commandName, capability) {
1476
+ const builderImports = [];
1477
+ const definitions = [...buildDeclarativePingCommandLines(extensionName, commandName, capability)];
1478
+ const blueprintFields = [" commands: [pingCommand],"];
1479
+ const searchProviderName = `${extensionName}-search`;
1480
+ const vectorAdapterName = `${extensionName}-vector`;
1481
+ const adapterName = `${extensionName.replace(/-/g, " ")} items`;
1482
+ const itemTypeName = extensionName;
1483
+ const itemTypeFolder = `${extensionName}s`;
1484
+ // De-hyphenate for a short alias; omit a redundant self-alias for single-word names.
1485
+ const itemTypeAlias = extensionName.replace(/-/g, "");
1486
+ const itemTypeAliases = itemTypeAlias === itemTypeName ? [] : [itemTypeAlias];
1487
+ const fieldName = `${extensionName.replace(/-/g, "_")}_note`;
1488
+ const migrationId = `${extensionName}-0001-init`;
1489
+ switch (capability) {
1490
+ case "commands":
1491
+ break;
1492
+ case "hooks":
1493
+ builderImports.push("defineAfterCommandHook");
1494
+ definitions.push("", "// after_command hooks fire once pm finishes a command, receiving the items it", "// mutated. React here - sync to an external system, emit telemetry, or refresh", '// derived context ("project management = context management"). This starter is a', "// documented no-op on the success path; replace the body with your own reaction.", "export const afterCommandHook = defineAfterCommandHook((context) => {", " if (!context.ok) {", " return;", " }", " // `context.affected` lists the items pm mutated (id, status, changed_fields):", " // for (const item of context.affected ?? []) { /* ...item.id... */ }", "});");
1495
+ blueprintFields.push(" hooks: { afterCommand: [afterCommandHook] },");
1496
+ break;
1497
+ case "search":
1498
+ builderImports.push("defineSearchProvider", "defineVectorStoreAdapter");
1499
+ definitions.push("", "// Search providers let packages customize how pm ranks and retrieves project", "// context. This starter is deterministic and dependency-free: replace the scoring", "// with your domain retrieval, embedding, or rerank logic as the package grows.", "export const searchProvider = defineSearchProvider({", ` name: ${JSON.stringify(searchProviderName)},`, " query: async (context) => {", " const needle = context.query.toLowerCase();", " const hits = context.documents", " .filter((document) => {", ' const title = String(document.metadata.title ?? "").toLowerCase();', " return title.includes(needle);", " })", " .map((document) => ({", " id: document.metadata.id,", " score: 1,", ' matched_fields: ["title"],', " }));", " return { hits };", " },", " embed: async (context) => [context.input.length],", "});", "", "// Vector-store adapters let packages own semantic index storage. This starter", "// returns a stable in-memory hit so generated tests can exercise the adapter", "// without external services.", "export const vectorStoreAdapter = defineVectorStoreAdapter({", ` name: ${JSON.stringify(vectorAdapterName)},`, ' query: async (context) => [{ id: "starter-vector-hit", score: context.limit }],', " upsert: async (context) => ({ upserted: context.points.length }),", " delete: async (context) => ({ deleted: context.ids.length }),", "});");
1500
+ blueprintFields.push(" searchProviders: [searchProvider],", " vectorStoreAdapters: [vectorStoreAdapter],");
1501
+ break;
1502
+ case "importers":
1503
+ builderImports.push("defineExporter", "defineImporter");
1504
+ definitions.push("", "// Importers/exporters are the bridge between pm's context graph and another", "// project-management system. Keep the starter deterministic so package tests can", "// run without touching the network or filesystem; replace these payloads with", "// your adapter's real mapping as the package grows.", "export const importer = defineImporter(async (context) => ({", " imported: 1,", ' source: context.options.source ?? "starter",', " args: context.args,", "}));", "", "export const exporter = defineExporter(async (context) => ({", " exported: true,", ' destination: context.options.destination ?? "stdout",', " args: context.args,", "}));");
1505
+ blueprintFields.push(" importers: [", " {", ` name: ${JSON.stringify(adapterName)},`, " importer,", " options: {", ` action: ${JSON.stringify(`${adapterName} import`)},`, ' description: "Import starter records into pm context.",', " flags: [", " {", ' long: "--source",', ' value_name: "name",', ' value_type: "string",', ' description: "Source name or path to import from.",', " },", " ],", " },", " },", " ],", " exporters: [", " {", ` name: ${JSON.stringify(adapterName)},`, " exporter,", " options: {", ` action: ${JSON.stringify(`${adapterName} export`)},`, ' description: "Export pm context into starter records.",', " flags: [", " {", ' long: "--destination",', ' value_name: "name",', ' value_type: "string",', ' description: "Destination name or path to export to.",', " },", " ],", " },", " },", " ],");
1506
+ break;
1507
+ case "schema":
1508
+ builderImports.push("defineItemField", "defineItemType", "defineMigration");
1509
+ definitions.push("", "// Schema registrations let a package model its own project domain - the heart of", '// "project management = context management". Item types and fields are GLOBAL', "// contributions, so this package declares no `activation.commands` and pm", "// activates it conservatively for every command.", "export const noteField = defineItemField({", ` name: ${JSON.stringify(fieldName)},`, ' type: "string",', " optional: true,", "});", "", "export const itemType = defineItemType({", ` name: ${JSON.stringify(itemTypeName)},`, " // Replace with your domain's canonical plural folder name.", ` folder: ${JSON.stringify(itemTypeFolder)},`, ` aliases: ${JSON.stringify(itemTypeAliases)},`, " // Add field names here to force them at `pm create` time.", " required_create_fields: [],", "});", "", "// Migrations let a package evolve stored items as its schema changes. pm runs each", "// migration ONCE through the preflight gate (not once per item), passing a context", "// that identifies the migration itself: `context.id` is the migration id (not an", "// item id), alongside `context.pm_root`. This starter is a deterministic no-op so", "// package tests can invoke it without touching the corpus; replace the body with", "// your real rewrite.", "export const initMigration = defineMigration({", ` id: ${JSON.stringify(migrationId)},`, ` description: ${JSON.stringify(`Initialize ${extensionName} schema state.`)},`, " mandatory: false,", " run: async (context) => ({ migrated: true, id: context.id }),", "});");
1510
+ blueprintFields.push(" itemTypes: [itemType],", " itemFields: [noteField],", " migrations: [initMigration],");
1511
+ break;
1512
+ case "profile":
1513
+ builderImports.push("defineProjectProfile");
1514
+ definitions.push("", "// A project profile is the broadest customization primitive pm has: one", "// declarative bundle of item types, custom statuses, fields, a per-type workflow,", "// config knobs, create templates, and package recommendations. Once installed it", "// resolves by name through `pm profile list/show/apply`, which stages every", "// dimension idempotently like a core archetype. A profile registration is a", "// schema+config bundle, so the `schema` capability grants it.", "export const starterProfile = defineProjectProfile({", ...buildProfileArchetypeFieldLines(extensionName), "});");
1515
+ blueprintFields.push(" profiles: [starterProfile],");
1516
+ break;
1517
+ case "renderers":
1518
+ builderImports.push("defineRendererOverride");
1519
+ definitions.push("", "// Renderer overrides customize how pm serializes a command's structured result", '// for an output format ("toon" or "json"). pm runs this override for EVERY', "// command's output in that format, so it scopes itself to THIS package's own", "// command and returns null - pass-through to pm's default renderer - for", "// everything else. Return a string to take over rendering.", "export const toonRenderer = defineRendererOverride((context) => {", ` if (context.command !== ${JSON.stringify(commandName)}) {`, " return null;", " }", ` return ${JSON.stringify(`${extensionName}: `)} + JSON.stringify(context.result);`, "});");
1520
+ blueprintFields.push(" renderers: { toon: toonRenderer },");
1521
+ break;
1522
+ case "parser":
1523
+ builderImports.push("defineParserOverride");
1524
+ definitions.push("", "// Parser overrides preprocess a command's parsed options BEFORE its handler runs,", "// returning a delta - only the keys you set are merged over the parsed input. This", "// override is scoped to THIS package's own command; here it rewrites the deprecated", "// `--shout` boolean alias to the canonical `--upper` flag.", "export const pingParser = defineParserOverride((context) => {", " const options = { ...context.options };", " if (options.shout === true) {", " options.upper = true;", " }", " delete options.shout;", " return { options };", "});");
1525
+ blueprintFields.push(` parsers: { ${JSON.stringify(commandName)}: pingParser },`);
1526
+ break;
1527
+ case "preflight":
1528
+ builderImports.push("definePreflightOverride");
1529
+ 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);");
1530
+ blueprintFields.push(" preflights: [preflightOverride],");
1531
+ break;
1532
+ case "services":
1533
+ builderImports.push("defineServiceOverride");
1534
+ definitions.push("", "// Service overrides replace a built-in pm service. The `output_format` service", "// renders a command's structured result; returning the payload unchanged passes", "// through to pm's default formatting. This override scopes itself to THIS", "// package's own command and passes every other command through.", "export const outputService = defineServiceOverride((context) => {", ` if (context.command !== ${JSON.stringify(commandName)}) {`, " return context.payload;", " }", ` return { rendered_by: ${JSON.stringify(extensionName)}, payload: context.payload };`, "});");
1535
+ blueprintFields.push(" services: { output_format: outputService },");
1536
+ break;
1537
+ }
1538
+ return { builderImports, definitions, blueprintFields };
1539
+ }
1540
+ /**
1541
+ * Build the declarative (`composeExtension`) variant of the starter `index.ts` for
1542
+ * the chosen capability.
1543
+ *
1544
+ * Where {@link buildActivateBodyLines} emits an imperative `activate` that calls
1545
+ * `api.register*` directly, this emits the SDK's flagship declarative loop: the
1546
+ * capability's surfaces are authored with the `define*` builders (via the shared
1547
+ * {@link buildDeclarativeBlueprintSurface}), collected into an `ExtensionBlueprint`
1548
+ * by `defineExtensionBlueprint`, and turned into the runtime module by
1549
+ * `composeExtension` (which generates the `activate` that registers every blueprint
1550
+ * surface in order). Every definition, the blueprint, and the module are exported
1551
+ * so the colocated test can preflight the blueprint and exercise the module — see
1552
+ * {@link buildDeclarativeSampleTestSource}.
1553
+ *
1554
+ * It is package-mode by construction: `composeExtension` is a runtime SDK *value*
1555
+ * import, so it belongs in package-mode authoring where the SDK is a linked
1556
+ * dependency, not in the import-free extension-only starters.
1557
+ * {@link scaffoldExtensionProject} enforces that constraint before this is reached.
1558
+ */
1559
+ function buildDeclarativeEntrypoint(extensionName, commandName, capability) {
1560
+ const surface = buildDeclarativeBlueprintSurface(extensionName, commandName, capability);
1561
+ // `composeExtension`/`defineCommand`/`defineExtensionBlueprint` are always needed;
1562
+ // sort the full set so the import line is stable and idiomatic per capability.
1563
+ const builderImports = [
1564
+ "composeExtension",
1565
+ "defineCommand",
1566
+ "defineExtensionBlueprint",
1567
+ ...surface.builderImports,
1568
+ ].sort((left, right) => left.localeCompare(right));
1569
+ return [
1570
+ `import { ${builderImports.join(", ")} } from "@unbrained/pm-cli/sdk";`,
1571
+ "",
1572
+ ...surface.definitions,
1573
+ "",
1574
+ "// Declarative authoring: describe WHAT the package registers as a blueprint and",
1575
+ "// let `composeExtension` generate the `activate` that wires every surface in order,",
1576
+ "// instead of hand-writing each `api.register*` call. `defineExtensionBlueprint`",
1577
+ "// contract-checks the blueprint where it is authored. Keep `manifest.json`'s",
1578
+ "// `capabilities` equal to the set this blueprint derives.",
1579
+ "export const blueprint = defineExtensionBlueprint({",
1580
+ ...surface.blueprintFields,
1581
+ " // `deactivate` is the teardown counterpart to the generated `activate`: pm runs",
1582
+ " // it on host shutdown/reload to release anything the package opened (timers,",
1583
+ " // connections, caches). This starter holds none, so it stays a no-op.",
1584
+ " deactivate: () => {},",
1585
+ "});",
1586
+ "",
1587
+ "// `composeExtension(blueprint)` is the package's default export — the runtime",
1588
+ "// `ExtensionModule` pm loads. Guard the blueprint with `assertExtensionPreflight`",
1589
+ "// in index.test.ts before publishing.",
1590
+ "export default composeExtension(blueprint);",
1591
+ "",
1592
+ ].join("\n");
1593
+ }
1594
+ /**
1595
+ * Build the capability-specific `node:test` block for the declarative starter:
1596
+ * a dedicated test that activates the composed module through
1597
+ * {@link ExtensionTestHarness} and asserts + invokes the capability's surface
1598
+ * (hook, search provider/adapter, importer/exporter, schema, renderer, parser,
1599
+ * preflight, or service override). Returns `[]` for the `commands` capability,
1600
+ * whose only surface — the starter command — is already covered by the base test.
1601
+ *
1602
+ * Each block mirrors the imperative {@link buildSampleTestSource} capability test
1603
+ * but reaches it through the harness's bound `assert*`/`run*` helpers instead of
1604
+ * the standalone helpers, so the declarative starter never threads
1605
+ * `activation.registrations` / `activation.parsers` / ... by hand.
1606
+ */
1607
+ function buildDeclarativeCapabilityTestBlock(extensionName, commandName, capability, capabilitiesLiteral) {
1608
+ if (capability === "commands") {
1609
+ return [];
1610
+ }
1611
+ const searchProviderName = `${extensionName}-search`;
1612
+ const vectorAdapterName = `${extensionName}-vector`;
1613
+ const adapterName = `${extensionName.replace(/-/g, " ")} items`;
1614
+ const itemTypeName = extensionName;
1615
+ const itemTypeFolder = `${extensionName}s`;
1616
+ const fieldName = `${extensionName.replace(/-/g, "_")}_note`;
1617
+ const migrationId = `${extensionName}-0001-init`;
1618
+ const harness = [
1619
+ " const ext = await createExtensionTestHarness(extension, {",
1620
+ ` name: ${JSON.stringify(extensionName)},`,
1621
+ ` capabilities: ${capabilitiesLiteral},`,
1622
+ " });",
1623
+ ];
1624
+ const withHarnessCleanup = (body) => [
1625
+ ...harness,
1626
+ " let deactivated = false;",
1627
+ " try {",
1628
+ ...body.map((line) => (line === "" ? line : ` ${line}`)),
1629
+ " const teardown = await ext.deactivate();",
1630
+ " assertExtensionDeactivated(teardown);",
1631
+ " deactivated = true;",
1632
+ " } finally {",
1633
+ " if (!deactivated) {",
1634
+ " try {",
1635
+ " await ext.deactivate();",
1636
+ " } catch {}",
1637
+ " }",
1638
+ " }",
1639
+ ];
1640
+ switch (capability) {
1641
+ case "hooks":
1642
+ return [
1643
+ `test(${JSON.stringify(`${extensionName} reacts to commands via its after_command hook`)}, async () => {`,
1644
+ ...withHarnessCleanup([
1645
+ " // assertHook throws unless an after_command hook is registered, so reaching the",
1646
+ " // next line already proves the hook is wired.",
1647
+ ` ext.assertHook({ kind: "after_command", extensionName: ${JSON.stringify(extensionName)} });`,
1648
+ " // runHook fires the hook through pm's real runner with a synthetic context and",
1649
+ " // returns the warnings it produced; a clean hook returns none.",
1650
+ " const warnings = await ext.runHook({",
1651
+ ' kind: "after_command",',
1652
+ " context: {",
1653
+ ` command: ${JSON.stringify(commandName)},`,
1654
+ " args: [],",
1655
+ ' pm_root: "",',
1656
+ " ok: true,",
1657
+ " affected: [],",
1658
+ " },",
1659
+ " });",
1660
+ " assert.deepEqual(warnings, []);",
1661
+ ]),
1662
+ "});",
1663
+ "",
1664
+ ];
1665
+ case "search":
1666
+ return [
1667
+ `test(${JSON.stringify(`${extensionName} registers and invokes search primitives`)}, async () => {`,
1668
+ ...withHarnessCleanup([
1669
+ ` ext.assertSearchProvider({ provider: ${JSON.stringify(searchProviderName)}, extensionName: ${JSON.stringify(extensionName)} });`,
1670
+ ` ext.assertVectorStoreAdapter({ adapter: ${JSON.stringify(vectorAdapterName)}, extensionName: ${JSON.stringify(extensionName)} });`,
1671
+ "",
1672
+ " // The starter provider reads only document title/id, so `settings` is a minimal",
1673
+ " // typed stub and `documents` carry just the fields it inspects.",
1674
+ " const query = await ext.runSearchProvider({",
1675
+ ` provider: ${JSON.stringify(searchProviderName)},`,
1676
+ ' operation: "query",',
1677
+ " context: {",
1678
+ ' query: "sync",',
1679
+ ' mode: "semantic",',
1680
+ ' tokens: ["sync"],',
1681
+ " options: {},",
1682
+ " settings: {} as PmSettings,",
1683
+ " documents: [",
1684
+ ' { metadata: { id: "pm-1", title: "Sync external context" }, body: "" },',
1685
+ ' { metadata: { id: "pm-2", title: "Unrelated task" }, body: "" },',
1686
+ " ] as ItemDocument[],",
1687
+ " },",
1688
+ " });",
1689
+ ' assert.deepEqual(query, { hits: [{ id: "pm-1", score: 1, matched_fields: ["title"] }] });',
1690
+ "",
1691
+ " const embedding = await ext.runSearchProvider({",
1692
+ ` provider: ${JSON.stringify(searchProviderName)},`,
1693
+ ' operation: "embed",',
1694
+ ' context: { input: "abc", settings: {} as PmSettings, model: "starter-model" },',
1695
+ " });",
1696
+ " assert.deepEqual(embedding, [3]);",
1697
+ "",
1698
+ " const vectorHits = await ext.runVectorStoreAdapter({",
1699
+ ` adapter: ${JSON.stringify(vectorAdapterName)},`,
1700
+ ' operation: "query",',
1701
+ " context: { vector: [0.1, 0.2], limit: 2, settings: {} as PmSettings },",
1702
+ " });",
1703
+ ' assert.deepEqual(vectorHits, [{ id: "starter-vector-hit", score: 2 }]);',
1704
+ ]),
1705
+ "});",
1706
+ "",
1707
+ ];
1708
+ case "importers":
1709
+ return [
1710
+ `test(${JSON.stringify(`${extensionName} registers and invokes import/export primitives`)}, async () => {`,
1711
+ ...withHarnessCleanup([
1712
+ ` ext.assertImporter({ importer: ${JSON.stringify(adapterName)}, extensionName: ${JSON.stringify(extensionName)} });`,
1713
+ ` ext.assertExporter({ exporter: ${JSON.stringify(adapterName)}, extensionName: ${JSON.stringify(extensionName)} });`,
1714
+ "",
1715
+ " const imported = await ext.runImporter({",
1716
+ ` importer: ${JSON.stringify(adapterName)},`,
1717
+ ' options: { source: "tickets" },',
1718
+ ' args: ["batch-1"],',
1719
+ " });",
1720
+ " assert.equal(imported.handled, true);",
1721
+ ' assert.deepEqual(imported.result, { imported: 1, source: "tickets", args: ["batch-1"] });',
1722
+ "",
1723
+ " const exported = await ext.runExporter({",
1724
+ ` exporter: ${JSON.stringify(adapterName)},`,
1725
+ ' options: { destination: "archive" },',
1726
+ ' args: ["done"],',
1727
+ " });",
1728
+ " assert.equal(exported.handled, true);",
1729
+ ' assert.deepEqual(exported.result, { exported: true, destination: "archive", args: ["done"] });',
1730
+ ]),
1731
+ "});",
1732
+ "",
1733
+ ];
1734
+ case "schema":
1735
+ return [
1736
+ `test(${JSON.stringify(`${extensionName} registers and runs its custom schema`)}, async () => {`,
1737
+ ...withHarnessCleanup([
1738
+ " // assertItemType/Field/Migration throw unless the registration is present, so",
1739
+ " // reaching each next line already proves the wiring; assert on the returned",
1740
+ " // definitions to demonstrate inspecting registered metadata.",
1741
+ ` const itemType = ext.assertItemType({ itemType: ${JSON.stringify(itemTypeName)}, extensionName: ${JSON.stringify(extensionName)} });`,
1742
+ ` assert.equal(itemType.itemType.folder, ${JSON.stringify(itemTypeFolder)});`,
1743
+ ` const itemField = ext.assertItemField({ field: ${JSON.stringify(fieldName)}, extensionName: ${JSON.stringify(extensionName)} });`,
1744
+ ' assert.equal(itemField.field.type, "string");',
1745
+ ` ext.assertMigration({ migration: ${JSON.stringify(migrationId)}, extensionName: ${JSON.stringify(extensionName)}, mandatory: false });`,
1746
+ "",
1747
+ " // runMigration invokes the migration through pm's real runner with a synthetic",
1748
+ " // context and returns its result.",
1749
+ ` const migrated = await ext.runMigration({ migration: ${JSON.stringify(migrationId)} });`,
1750
+ ` assert.deepEqual(migrated, { migrated: true, id: ${JSON.stringify(migrationId)} });`,
1751
+ ]),
1752
+ "});",
1753
+ "",
1754
+ ];
1755
+ case "profile":
1756
+ return [
1757
+ `test(${JSON.stringify(`${extensionName} registers its project profile`)}, async () => {`,
1758
+ ...withHarnessCleanup([
1759
+ " // assertProfile throws unless the profile is registered, so reaching the next",
1760
+ " // line already proves the wiring; assert on the returned definition to inspect",
1761
+ " // the bundled archetype dimensions.",
1762
+ ` const { profile } = ext.assertProfile({ profile: ${JSON.stringify(extensionName)}, extensionName: ${JSON.stringify(extensionName)} });`,
1763
+ ` assert.equal(profile.title, ${JSON.stringify(`${extensionName} archetype`)});`,
1764
+ " assert.equal(profile.types.length, 1);",
1765
+ " assert.equal(profile.workflows.length, 1);",
1766
+ ]),
1767
+ "});",
1768
+ "",
1769
+ ];
1770
+ case "renderers":
1771
+ return [
1772
+ `test(${JSON.stringify(`${extensionName} registers and invokes its renderer override`)}, async () => {`,
1773
+ ...withHarnessCleanup([
1774
+ " // assertRendererOverride throws unless a renderer is registered for the format,",
1775
+ " // so reaching the next line already proves the wiring.",
1776
+ ` const override = ext.assertRendererOverride({ format: "toon", extensionName: ${JSON.stringify(extensionName)} });`,
1777
+ ' assert.equal(override.format, "toon");',
1778
+ "",
1779
+ " // runRendererOverride renders through pm's real runner. The override customizes",
1780
+ " // only THIS package's command output and returns a string the host uses verbatim.",
1781
+ " const rendered = await ext.runRendererOverride({",
1782
+ ' format: "toon",',
1783
+ ` command: ${JSON.stringify(commandName)},`,
1784
+ " result: { ok: true },",
1785
+ " });",
1786
+ " assert.equal(rendered.overridden, true);",
1787
+ ` assert.equal(rendered.rendered, ${JSON.stringify(`${extensionName}: `)} + JSON.stringify({ ok: true }));`,
1788
+ "",
1789
+ " // Output for any other command passes through to pm's default renderer.",
1790
+ " const passthrough = await ext.runRendererOverride({",
1791
+ ' format: "toon",',
1792
+ ' command: "list",',
1793
+ " result: { ok: true },",
1794
+ " });",
1795
+ " assert.equal(passthrough.overridden, false);",
1796
+ ]),
1797
+ "});",
1798
+ "",
1799
+ ];
1800
+ case "parser":
1801
+ return [
1802
+ `test(${JSON.stringify(`${extensionName} rewrites command options via its parser override`)}, async () => {`,
1803
+ ...withHarnessCleanup([
1804
+ " // assertParserOverride throws unless a parser is registered for the command, so",
1805
+ " // reaching the next line already proves the wiring.",
1806
+ ` ext.assertParserOverride({ command: ${JSON.stringify(commandName)}, extensionName: ${JSON.stringify(extensionName)} });`,
1807
+ "",
1808
+ " // runParserOverride runs the override through pm's real parser runner and returns",
1809
+ " // the rewritten context. The starter rewrites the deprecated `shout` alias to the",
1810
+ " // canonical `upper` flag.",
1811
+ " const result = await ext.runParserOverride({",
1812
+ ` command: ${JSON.stringify(commandName)},`,
1813
+ " args: [],",
1814
+ " options: { shout: true },",
1815
+ " global: {},",
1816
+ ' pm_root: "",',
1817
+ " });",
1818
+ " assert.equal(result.overridden, true);",
1819
+ " assert.deepEqual(result.context.options, { upper: true });",
1820
+ "",
1821
+ " // End to end: feed the rewritten options into the command handler to prove",
1822
+ " // `pm <command> --shout` surfaces the normalized `upper` flag in the result.",
1823
+ ` const invocation = await ext.runCommand({ command: ${JSON.stringify(commandName)}, options: result.context.options });`,
1824
+ " assert.equal(invocation.handled, true);",
1825
+ " assert.deepEqual(invocation.result, {",
1826
+ " ok: true,",
1827
+ ` source: ${JSON.stringify(extensionName)},`,
1828
+ ` command: ${JSON.stringify(commandName)},`,
1829
+ " upper: true,",
1830
+ ' message: "Starter extension scaffold is active.",',
1831
+ " });",
1832
+ ]),
1833
+ "});",
1834
+ "",
1835
+ ];
1836
+ case "preflight":
1837
+ return [
1838
+ `test(${JSON.stringify(`${extensionName} returns a preflight gate decision via its override`)}, async () => {`,
1839
+ ...withHarnessCleanup([
1840
+ " // assertPreflightOverride throws unless a preflight override is registered, so",
1841
+ " // reaching the next line already proves the wiring.",
1842
+ ` ext.assertPreflightOverride({ extensionName: ${JSON.stringify(extensionName)} });`,
1843
+ "",
1844
+ " // runPreflightOverride runs the override through pm's real runner with a synthetic",
1845
+ " // gate decision. The starter echoes the decision unchanged; replace the",
1846
+ " // values/assertions with your real policy.",
1847
+ " const decision = {",
1848
+ " enforce_item_format_gate: true,",
1849
+ " run_preflight_item_format_sync: false,",
1850
+ " run_extension_migrations: true,",
1851
+ " enforce_mandatory_migration_gate: false,",
1852
+ " };",
1853
+ " const result = await ext.runPreflightOverride({",
1854
+ ` command: ${JSON.stringify(commandName)},`,
1855
+ " args: [],",
1856
+ " options: {},",
1857
+ " global: {},",
1858
+ ' pm_root: "",',
1859
+ " decision,",
1860
+ " });",
1861
+ " assert.equal(result.overridden, true);",
1862
+ " assert.deepEqual(result.decision, decision);",
1863
+ ]),
1864
+ "});",
1865
+ "",
1866
+ ];
1867
+ case "services":
1868
+ return [
1869
+ `test(${JSON.stringify(`${extensionName} customizes command output via its service override`)}, async () => {`,
1870
+ ...withHarnessCleanup([
1871
+ " // assertServiceOverride throws unless a service override is registered for the",
1872
+ " // service, so reaching the next line proves the wiring.",
1873
+ ` ext.assertServiceOverride({ service: "output_format", extensionName: ${JSON.stringify(extensionName)} });`,
1874
+ "",
1875
+ " // runServiceOverride runs the override through pm's real service runner. The",
1876
+ " // override customizes only THIS package's command output (handled), passing every",
1877
+ " // other command through (not handled).",
1878
+ " const handled = await ext.runServiceOverride({",
1879
+ ' service: "output_format",',
1880
+ ` command: ${JSON.stringify(commandName)},`,
1881
+ " payload: { ok: true },",
1882
+ " });",
1883
+ " assert.equal(handled.handled, true);",
1884
+ ` assert.deepEqual(handled.result, { rendered_by: ${JSON.stringify(extensionName)}, payload: { ok: true } });`,
1885
+ "",
1886
+ " // Output for any other command passes through to pm's default formatter.",
1887
+ " const passthrough = await ext.runServiceOverride({",
1888
+ ' service: "output_format",',
1889
+ ' command: "list",',
1890
+ " payload: { ok: true },",
1891
+ " });",
1892
+ " assert.equal(passthrough.handled, false);",
1893
+ ]),
1894
+ "});",
1895
+ "",
1896
+ ];
1897
+ }
1898
+ }
1899
+ /**
1900
+ * Build the declarative variant of the colocated `node:test` suite
1901
+ * (`index.test.ts`) for the chosen capability's `composeExtension` starter.
1902
+ *
1903
+ * Like {@link buildSampleTestSource}, this uses the harness-bound runtime
1904
+ * helpers; it also exercises the author-time capstone the declarative loop
1905
+ * unlocks:
1906
+ * `assertExtensionPreflight(blueprint, { identity, target })` (lint + manifest
1907
+ * synthesis + version-compat in one call) over the exported `blueprint`, and the
1908
+ * ergonomic runtime `createExtensionTestHarness(module)` whose `assert*`/`run*`/
1909
+ * `deactivate` methods are pre-bound to the right activation sub-registry. The base
1910
+ * suite covers preflight, the starter command, and teardown; for non-`commands`
1911
+ * capabilities {@link buildDeclarativeCapabilityTestBlock} adds a dedicated test for
1912
+ * the capability's surface. The `identity`/`target` versions are pinned to the
1913
+ * scaffolded `pm_min_version` so the synthesized manifest is trivially compatible
1914
+ * and the suite stays deterministic; an author edits them as the package matures.
1915
+ */
1916
+ function buildDeclarativeSampleTestSource(extensionName, commandName, capability) {
1917
+ const parserEnabled = capability === "parser";
1918
+ // The preflight report's capability set is DERIVED from the blueprint and SORTED,
1919
+ // so assert against the sorted manifest capabilities (a set match in canonical
1920
+ // order); the harness `capabilities` grant uses the same literal.
1921
+ const capabilitiesLiteral = JSON.stringify([...SCAFFOLD_MANIFEST_CAPABILITIES[capability]].sort());
1922
+ return [
1923
+ 'import assert from "node:assert/strict";',
1924
+ 'import { test } from "node:test";',
1925
+ 'import { assertExtensionDeactivated, assertExtensionPreflight, createExtensionTestHarness } from "@unbrained/pm-cli/sdk/testing";',
1926
+ // The search sample's synthetic query/vector contexts reference these SDK types
1927
+ // for their typed-stub fixtures; other capabilities need no extra type imports.
1928
+ ...(capability === "search" ? ['import type { ItemDocument, PmSettings } from "@unbrained/pm-cli/sdk";'] : []),
1929
+ 'import extension, { blueprint } from "./index.ts";',
1930
+ "",
1931
+ `test(${JSON.stringify(`${extensionName} passes author-time preflight`)}, () => {`,
1932
+ " // assertExtensionPreflight is the author-time capstone: it lints the blueprint,",
1933
+ " // synthesizes the least-privilege manifest from `identity`, and checks the version",
1934
+ " // bounds against `target` in one call, throwing on any blocking finding. It returns",
1935
+ " // the full report so you can inspect the derived data.",
1936
+ " const report = assertExtensionPreflight(blueprint, {",
1937
+ " identity: {",
1938
+ ` name: ${JSON.stringify(extensionName)},`,
1939
+ ' version: "0.1.0",',
1940
+ ' entry: "./index.ts",',
1941
+ " priority: 0,",
1942
+ ` pm_min_version: ${JSON.stringify(SCAFFOLD_PM_MIN_VERSION)},`,
1943
+ " },",
1944
+ ` target: { pmVersion: ${JSON.stringify(SCAFFOLD_PM_MIN_VERSION)} },`,
1945
+ " });",
1946
+ " // The capability set is DERIVED from the blueprint, never hand-synced. Keep",
1947
+ " // manifest.json's `capabilities` equal to this list (set match, sorted).",
1948
+ ` assert.deepEqual(report.capabilities, ${capabilitiesLiteral});`,
1949
+ ` assert.deepEqual(report.manifest?.capabilities, ${capabilitiesLiteral});`,
1950
+ "});",
1951
+ "",
1952
+ `test(${JSON.stringify(`${extensionName} registers and runs its starter command`)}, async () => {`,
1953
+ " // createExtensionTestHarness activates the composed module once and binds the",
1954
+ " // assert*/run*/deactivate helpers to the right activation sub-registry, so you",
1955
+ " // never thread activation.registrations vs activation.commands by hand.",
1956
+ " // `capabilities` mirrors manifest.json so the in-memory activation grants what the",
1957
+ " // blueprint needs.",
1958
+ " const ext = await createExtensionTestHarness(extension, {",
1959
+ ` name: ${JSON.stringify(extensionName)},`,
1960
+ ` capabilities: ${capabilitiesLiteral},`,
1961
+ " });",
1962
+ " let deactivated = false;",
1963
+ " try {",
1964
+ " // assertCommandContract throws unless the command is registered, so reaching",
1965
+ " // the next line already proves the wiring; assert on the returned definition",
1966
+ " // to demonstrate inspecting registered metadata.",
1967
+ ` const registered = ext.assertCommandContract({ command: ${JSON.stringify(commandName)} });`,
1968
+ ' assert.equal(typeof registered.command.description, "string");',
1969
+ "",
1970
+ " // runCommand invokes the handler through pm's real dispatch engine, so this",
1971
+ " // asserts behavior - not just that the command is wired. Replace these",
1972
+ " // assertions as you flesh out your command.",
1973
+ ` const invocation = await ext.runCommand({ command: ${JSON.stringify(commandName)} });`,
1974
+ " assert.equal(invocation.handled, true);",
1975
+ " assert.deepEqual(invocation.result, {",
1976
+ " ok: true,",
1977
+ ` source: ${JSON.stringify(extensionName)},`,
1978
+ ` command: ${JSON.stringify(commandName)},`,
1979
+ // The parser starter's command surfaces the normalized `upper` flag, false when
1980
+ // the command is invoked without `--shout`/`--upper`.
1981
+ ...(parserEnabled ? [" upper: false,"] : []),
1982
+ ' message: "Starter extension scaffold is active.",',
1983
+ " });",
1984
+ " // deactivate runs pm's real teardown engine over the module; exactly one",
1985
+ " // extension tears down with no failures.",
1986
+ " const teardown = await ext.deactivate();",
1987
+ " assertExtensionDeactivated(teardown);",
1988
+ " deactivated = true;",
1989
+ " } finally {",
1990
+ " if (!deactivated) {",
1991
+ " try {",
1992
+ " await ext.deactivate();",
1993
+ " } catch {}",
1994
+ " }",
1995
+ " }",
1996
+ "});",
1997
+ "",
1998
+ ...buildDeclarativeCapabilityTestBlock(extensionName, commandName, capability, capabilitiesLiteral),
1999
+ ].join("\n");
2000
+ }
2001
+ /**
2002
+ * Build the README for the declarative (`composeExtension`) package starter for
2003
+ * the chosen capability.
2004
+ *
2005
+ * It documents the same metadata/validation sections as the imperative package
2006
+ * README but frames the entrypoint around the declarative loop and the author-time
2007
+ * preflight test, so the generated docs match the generated `index.ts`/
2008
+ * `index.test.ts`. The included-files bullets, the Declarative Authoring blueprint
2009
+ * fields, and the activation section are capability-aware: the `schema` starter
2010
+ * contributes a global item type (so it omits `activation.commands`), while every
2011
+ * other capability declares the command paths that lazily activate the package.
2012
+ */
2013
+ function buildDeclarativePackageReadme(packageName, commandName, capability) {
2014
+ // The schema/profile starters omit `activation.commands` (their surface is a
2015
+ // global contribution), so describe the manifest accurately and use the
2016
+ // conservative-activation section.
2017
+ const manifestBullet = buildScaffoldManifestBullet(capability, "package");
2018
+ const activationSection = buildScaffoldActivationReadmeSection(capability, "package");
2019
+ return [
2020
+ `# ${packageName}`,
2021
+ "",
2022
+ "Generated by `pm package init --declarative`.",
2023
+ "",
2024
+ "## Included Files",
2025
+ "- `package.json`: package metadata, `typecheck`/`test` scripts, and `pm` resource manifest.",
2026
+ manifestBullet,
2027
+ `- \`index.ts\`: the TypeScript manifest entry — a \`defineExtensionBlueprint\` blueprint (${DECLARATIVE_ENTRYPOINT_SURFACE_PHRASE[capability]}) composed into the runtime module by \`composeExtension\`, plus a \`deactivate\` teardown stub.`,
2028
+ "- `index.test.ts`: sample `node:test` suite covering author-time preflight (`assertExtensionPreflight`) and runtime surface invocation/teardown via `createExtensionTestHarness`.",
2029
+ TSCONFIG_BULLET,
2030
+ "- `.gitignore`: ignores `node_modules/`, logs, and the TypeScript build cache.",
2031
+ "",
2032
+ "## Quick Start",
2033
+ "This package is authored AND loaded as TypeScript: the manifest `entry` is",
2034
+ "`./index.ts` and pm imports it directly via Node's native type stripping",
2035
+ "(Node >=22.18), so there is no build step — install and run:",
2036
+ "```bash",
2037
+ "npm install",
2038
+ "pm install --project <package-path>",
2039
+ `pm ${commandName}`,
2040
+ "pm package doctor --project --detail summary",
2041
+ "```",
2042
+ "",
2043
+ "## Declarative Authoring",
2044
+ "`index.ts` uses the SDK's declarative authoring loop instead of an imperative",
2045
+ "`activate` body. You describe WHAT the package registers as an",
2046
+ "`ExtensionBlueprint` and `composeExtension` generates the `activate` that wires",
2047
+ "every surface in order:",
2048
+ "- The `define*` builders author each surface with literal-type preservation and",
2049
+ " contextual handler inference (`defineCommand`, `defineSearchProvider`,",
2050
+ " `defineItemType`, `defineParserOverride`, ...).",
2051
+ `- \`defineExtensionBlueprint({ ... })\` collects the definitions into the blueprint;`,
2052
+ ` this starter populates ${DECLARATIVE_CAPABILITY_BLUEPRINT_FIELDS[capability]}. Add more`,
2053
+ " fields as the package grows.",
2054
+ "- `composeExtension(blueprint)` is the default export — the runtime module pm",
2055
+ " loads. Its generated `activate` requires exactly the capabilities the blueprint",
2056
+ " derives, so `manifest.json`'s `capabilities` never drift.",
2057
+ "",
2058
+ "## Validate the Package",
2059
+ "`npm install` pulls the peer SDK and TypeScript. `npm test` is the default",
2060
+ "validation gate: it type-checks the package, then runs the colocated sample:",
2061
+ "```bash",
2062
+ "npm install",
2063
+ "npm test",
2064
+ "```",
2065
+ "`index.test.ts` exercises both authoring capstones: `assertExtensionPreflight`",
2066
+ "(the author-time lint + manifest synthesis + version-compatibility check over the",
2067
+ "exported `blueprint`) and `createExtensionTestHarness` (the runtime fixture whose",
2068
+ "`assert*`/`run*`/`deactivate` methods bind to the right activation sub-registry).",
2069
+ "`npm run typecheck` is available when you only want the SDK contract check.",
2070
+ "`npm run test:runtime` runs just `node --test`, which strips types on load and",
2071
+ "executes `index.test.ts` directly against the `@unbrained/pm-cli/sdk/testing`",
2072
+ "helpers - no compile step and no extra test runner required.",
2073
+ ...activationSection,
2074
+ "",
2075
+ "## Compatibility Bounds",
2076
+ "`manifest.json` cannot hold comments, so the version-compatibility fields are documented here:",
2077
+ `- \`manifest_version\` (integer): manifest schema generation. Leave at \`${SCAFFOLD_MANIFEST_VERSION}\` unless you adopt a newer manifest schema.`,
2078
+ `- \`pm_min_version\` (string): lowest pm CLI version that may load this package. Scaffolded as \`${SCAFFOLD_PM_MIN_VERSION}\`. The loader blocks the package on older CLIs.`,
2079
+ "- `pm_max_version` (string, optional): highest pm CLI version that may load this package. Add it to block CLIs that are newer than the version you have validated against. The loader blocks the package when the CLI exceeds this bound.",
2080
+ "",
2081
+ "## Policy Metadata",
2082
+ "The starter command is pure compute, so `manifest.json` declares `trusted: true`, `sandbox_profile: \"strict\"`, and all six permission keys as `false`. Keep that least-privilege shape for pure packages; relax only the specific permission your package actually needs and verify with `pm package doctor --project --detail deep --trace`.",
2083
+ "",
2084
+ "## Notes",
2085
+ "- Author in `index.ts`; pm loads it directly (no build), so edits take effect on the next install/reload — there is no `.js` to regenerate.",
2086
+ "- Move larger runtimes into sibling or subdirectory `*.ts` modules and import them with their real `.ts` extension; `tsconfig.json` type-checks every `*.ts` in the package (recursively).",
2087
+ "- Use `@unbrained/pm-cli/sdk` as the public SDK import for richer package runtimes.",
2088
+ "",
2089
+ ].join("\n");
2090
+ }
451
2091
  /**
452
2092
  * Implements build starter extension scaffold files for the public runtime surface of this module.
453
2093
  */
454
- export function buildStarterExtensionScaffoldFiles(extensionName, commandName, vocabulary, capability = "commands") {
2094
+ export function buildStarterExtensionScaffoldFiles(extensionName, commandName, vocabulary, capability = "commands", declarative = false) {
455
2095
  const packageName = `pm-${extensionName}`;
456
2096
  const capabilities = SCAFFOLD_MANIFEST_CAPABILITIES[capability];
2097
+ const activationCommands = buildScaffoldActivationCommands(extensionName, commandName, capability);
457
2098
  const manifest = `${JSON.stringify({
458
2099
  name: extensionName,
459
2100
  version: "0.1.0",
460
- entry: "./index.js",
2101
+ entry: "./index.ts",
461
2102
  manifest_version: SCAFFOLD_MANIFEST_VERSION,
462
2103
  pm_min_version: SCAFFOLD_PM_MIN_VERSION,
463
2104
  trusted: true,
464
2105
  sandbox_profile: "strict",
465
2106
  permissions: { ...SCAFFOLD_DECLARED_PERMISSIONS },
466
2107
  capabilities,
2108
+ // Declares the exact command paths `activate` registers so pm activates
2109
+ // this package lazily — only when an invoked command matches — mirroring
2110
+ // every first-party bundled package. Keep it in sync with the entrypoint.
2111
+ // The schema and profile starters omit this field (empty list) so their
2112
+ // global contribution — a custom item type/field, or a project profile
2113
+ // resolved by `pm profile` — stays available to built-in commands (see
2114
+ // buildScaffoldActivationCommands).
2115
+ ...(activationCommands.length > 0 ? { activation: { commands: activationCommands } } : {}),
467
2116
  }, null, 2)}\n`;
468
- // Keep scaffolds dependency-light by default: even package mode can be
469
- // installed before peer dependencies are materialized in the generated root.
470
- // The JSDoc import preserves editor narrowing without forcing the runtime
471
- // loader to resolve @unbrained/pm-cli/sdk from a freshly generated scaffold.
2117
+ // The entrypoint is authored AND loaded as TypeScript (ADR pm-2c28 / pm-m1uz):
2118
+ // the manifest `entry` points at `./index.ts` and pm imports it directly via
2119
+ // Node's native type stripping (Node >=22.18) there is no compile step and no
2120
+ // `.js` artifact. The typed `ExtensionApi` parameter is checked against the SDK
2121
+ // contract at author time (`npm run typecheck`).
472
2122
  const entrypoint = [
473
- '/** @param {import("@unbrained/pm-cli/sdk").ExtensionApi} api */',
474
- "export function activate(api) {",
2123
+ 'import type { ExtensionApi } from "@unbrained/pm-cli/sdk";',
2124
+ "",
2125
+ "export function activate(api: ExtensionApi): void {",
475
2126
  ...buildActivateBodyLines(extensionName, commandName, capability),
476
2127
  "}",
477
2128
  "",
@@ -479,7 +2130,7 @@ export function buildStarterExtensionScaffoldFiles(extensionName, commandName, v
479
2130
  "// shutdown/reload (e.g. the MCP server between requests) to release anything",
480
2131
  "// `activate` opened - timers, connections, caches. This starter holds no such",
481
2132
  "// resources, so it stays a documented no-op; add cleanup here as you grow.",
482
- "export function deactivate() {}",
2133
+ "export function deactivate(): void {}",
483
2134
  "",
484
2135
  "export default {",
485
2136
  " activate,",
@@ -487,9 +2138,14 @@ export function buildStarterExtensionScaffoldFiles(extensionName, commandName, v
487
2138
  "};",
488
2139
  "",
489
2140
  ].join("\n");
490
- // README bullet describing what index.js wires, kept in sync with the chosen
2141
+ const tsconfig = `${JSON.stringify(SCAFFOLD_TSCONFIG, null, 2)}\n`;
2142
+ // README bullet describing what index.ts wires, kept in sync with the chosen
491
2143
  // capability so the generated docs match the generated code.
492
2144
  const entrypointBullet = ENTRYPOINT_BULLETS[capability];
2145
+ // The schema/profile starters omit `activation.commands` (their surface is a
2146
+ // global contribution), so describe the manifest accurately instead of
2147
+ // referencing a field they deliberately lack.
2148
+ const manifestBullet = buildScaffoldManifestBullet(capability, vocabulary);
493
2149
  if (vocabulary === "package") {
494
2150
  const packageJson = `${JSON.stringify({
495
2151
  name: packageName,
@@ -497,13 +2153,28 @@ export function buildStarterExtensionScaffoldFiles(extensionName, commandName, v
497
2153
  private: true,
498
2154
  type: "module",
499
2155
  keywords: ["pm-package"],
500
- // `node --test` runs the colocated *.test.js sample against the peer SDK
501
- // testing helpers; no extra dev-dependency or test runner is required.
2156
+ engines: {
2157
+ node: SCAFFOLD_NODE_ENGINE,
2158
+ },
2159
+ // There is no build step: pm loads the `./index.ts` manifest entry
2160
+ // directly via Node's native type stripping (Node >=22.18). `typecheck`
2161
+ // validates the source against the SDK contracts (`tsc --noEmit`), and
2162
+ // `test` is the self-validating author gate: typecheck first, then run
2163
+ // the colocated sample with Node's built-in runner (which strips types
2164
+ // on load) against the peer SDK testing helpers — no third-party test
2165
+ // runner or compile output required. `test:runtime` remains available
2166
+ // for tight loops after a separate `npm run typecheck`.
502
2167
  scripts: {
503
- test: "node --test",
2168
+ typecheck: "tsc --noEmit",
2169
+ "test:runtime": "node --test",
2170
+ test: "npm run typecheck && npm run test:runtime",
504
2171
  },
505
2172
  peerDependencies: {
506
- "@unbrained/pm-cli": "*",
2173
+ "@unbrained/pm-cli": `>=${SCAFFOLD_PM_MIN_VERSION}`,
2174
+ },
2175
+ devDependencies: {
2176
+ "@types/node": SCAFFOLD_TYPES_NODE_VERSION,
2177
+ typescript: SCAFFOLD_TYPESCRIPT_VERSION,
507
2178
  },
508
2179
  pm: {
509
2180
  aliases: [extensionName],
@@ -524,24 +2195,57 @@ export function buildStarterExtensionScaffoldFiles(extensionName, commandName, v
524
2195
  // capability, the after_command lifecycle hook).
525
2196
  const sampleTest = buildSampleTestSource(extensionName, commandName, capability);
526
2197
  const sampleTestBullet = SAMPLE_TEST_BULLETS[capability];
527
- const gitignore = ["node_modules/", "*.log", ""].join("\n");
2198
+ // The package commits only TypeScript source — pm loads the `.ts` entry
2199
+ // directly, so there is no compiled output to ignore. Keep dependencies and
2200
+ // the tsc incremental cache out of version control.
2201
+ const gitignore = [
2202
+ "node_modules/",
2203
+ "*.log",
2204
+ "*.tsbuildinfo",
2205
+ "",
2206
+ ].join("\n");
528
2207
  const searchProviderName = `${extensionName}-search`;
529
2208
  const vectorAdapterName = `${extensionName}-vector`;
530
2209
  const adapterName = `${extensionName.replace(/-/g, " ")} items`;
2210
+ const itemTypeName = extensionName;
2211
+ const itemTypeFolder = `${extensionName}s`;
2212
+ const itemTypeAlias = extensionName.replace(/-/g, "");
2213
+ // Omit a redundant self-alias when the de-hyphenated form equals the type name.
2214
+ const itemTypeAliases = itemTypeAlias === itemTypeName ? [] : [itemTypeAlias];
2215
+ const fieldName = `${extensionName.replace(/-/g, "_")}_note`;
2216
+ const migrationId = `${extensionName}-0001-init`;
531
2217
  const defineBuilderImports = [
532
2218
  "defineCommand",
533
2219
  ...(capability === "hooks" ? ["defineAfterCommandHook"] : []),
534
2220
  ...(capability === "search" ? ["defineSearchProvider", "defineVectorStoreAdapter"] : []),
535
2221
  ...(capability === "importers" ? ["defineImporter", "defineExporter"] : []),
2222
+ ...(capability === "schema" ? ["defineItemType", "defineItemField", "defineMigration"] : []),
2223
+ ...(capability === "profile" ? ["defineProjectProfile"] : []),
2224
+ ...(capability === "renderers" ? ["defineRendererOverride"] : []),
2225
+ ...(capability === "parser" ? ["defineParserOverride"] : []),
2226
+ ...(capability === "preflight" ? ["definePreflightOverride"] : []),
2227
+ ...(capability === "services" ? ["defineServiceOverride"] : []),
536
2228
  ].join(", ");
537
2229
  const defineBuilderSnippet = [
538
- "```js",
2230
+ "```ts",
539
2231
  `import { ${defineBuilderImports} } from "@unbrained/pm-cli/sdk";`,
2232
+ 'import type { ExtensionApi } from "@unbrained/pm-cli/sdk";',
540
2233
  "",
541
2234
  "export const pingCommand = defineCommand({",
542
2235
  ` name: ${JSON.stringify(commandName)},`,
543
2236
  ' description: "Starter scaffold command. Replace with your own behavior.",',
544
- " run: (context) => ({ ok: true, command: context.command }),",
2237
+ // The parser starter's command declares the flags its override normalizes so
2238
+ // the demo is runnable through `pm <command> --shout`, and surfaces the
2239
+ // canonical `upper` flag in the result.
2240
+ ...(capability === "parser"
2241
+ ? [
2242
+ " flags: [",
2243
+ ' { long: "--shout", value_type: "boolean", description: "Deprecated alias for --upper." },',
2244
+ ' { long: "--upper", value_type: "boolean", description: "Canonical flag the parser produces." },',
2245
+ " ],",
2246
+ " run: (context) => ({ ok: true, command: context.command, upper: context.options.upper === true }),",
2247
+ ]
2248
+ : [" run: (context) => ({ ok: true, command: context.command }),"]),
545
2249
  "});",
546
2250
  ];
547
2251
  if (capability === "hooks") {
@@ -553,54 +2257,101 @@ export function buildStarterExtensionScaffoldFiles(extensionName, commandName, v
553
2257
  if (capability === "importers") {
554
2258
  defineBuilderSnippet.push("", "export const importer = defineImporter(async (context) => ({", " imported: 1,", " source: context.options.source ?? \"starter\",", " args: context.args,", "}));", "", "export const exporter = defineExporter(async (context) => ({", " exported: true,", " destination: context.options.destination ?? \"stdout\",", " args: context.args,", "}));");
555
2259
  }
556
- defineBuilderSnippet.push("", "export function activate(api) {", " api.registerCommand(pingCommand);");
2260
+ if (capability === "schema") {
2261
+ defineBuilderSnippet.push("", `export const noteField = defineItemField({ name: ${JSON.stringify(fieldName)}, type: "string", optional: true });`, "", "export const itemType = defineItemType({", ` name: ${JSON.stringify(itemTypeName)},`, ` folder: ${JSON.stringify(itemTypeFolder)},`, ` aliases: ${JSON.stringify(itemTypeAliases)},`, " required_create_fields: [],", "});", "", "export const initMigration = defineMigration({", ` id: ${JSON.stringify(migrationId)},`, ` description: ${JSON.stringify(`Initialize ${extensionName} schema state.`)},`, " mandatory: false,", " run: async (context) => ({ migrated: true, id: context.id }),", "});");
2262
+ }
2263
+ if (capability === "profile") {
2264
+ // Abbreviated illustration; the generated index.ts populates every archetype
2265
+ // dimension (types, statuses, fields, workflow, config, template, packages).
2266
+ defineBuilderSnippet.push("", "export const starterProfile = defineProjectProfile({", ` name: ${JSON.stringify(extensionName)},`, ` title: ${JSON.stringify(`${extensionName} archetype`)},`, ' summary: "Starter project profile. Replace these dimensions with your own archetype.",', " types: [", ` { name: ${JSON.stringify(itemTypeName)}, folder: ${JSON.stringify(itemTypeFolder)} },`, " ],", " // ...plus statuses, fields, workflows, config, templates, and packages.", "});");
2267
+ }
2268
+ if (capability === "renderers") {
2269
+ defineBuilderSnippet.push("", "export const toonRenderer = defineRendererOverride((context) => {", ` if (context.command !== ${JSON.stringify(commandName)}) return null;`, ` return ${JSON.stringify(`${extensionName}: `)} + JSON.stringify(context.result);`, "});");
2270
+ }
2271
+ if (capability === "parser") {
2272
+ defineBuilderSnippet.push("", "export const pingParser = defineParserOverride((context) => {", " const options = { ...context.options };", " if (options.shout === true) options.upper = true;", " delete options.shout;", " return { options };", "});");
2273
+ }
2274
+ if (capability === "preflight") {
2275
+ defineBuilderSnippet.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);");
2276
+ }
2277
+ if (capability === "services") {
2278
+ defineBuilderSnippet.push("", "export const outputService = defineServiceOverride((context) => {", ` if (context.command !== ${JSON.stringify(commandName)}) return context.payload;`, ` return { rendered_by: ${JSON.stringify(extensionName)}, payload: context.payload };`, "});");
2279
+ }
2280
+ defineBuilderSnippet.push("", "export function activate(api: ExtensionApi): void {", " api.registerCommand(pingCommand);");
2281
+ if (capability === "renderers") {
2282
+ defineBuilderSnippet.push(' api.registerRenderer("toon", toonRenderer);');
2283
+ }
2284
+ if (capability === "parser") {
2285
+ defineBuilderSnippet.push(` api.registerParser(${JSON.stringify(commandName)}, pingParser);`);
2286
+ }
2287
+ if (capability === "preflight") {
2288
+ defineBuilderSnippet.push(" api.registerPreflight(preflightOverride);");
2289
+ }
2290
+ if (capability === "services") {
2291
+ defineBuilderSnippet.push(' api.registerService("output_format", outputService);');
2292
+ }
557
2293
  if (capability === "hooks") {
558
2294
  defineBuilderSnippet.push(" api.hooks.afterCommand(afterCommandHook);");
559
2295
  }
560
2296
  if (capability === "search") {
561
2297
  defineBuilderSnippet.push(" api.registerSearchProvider(searchProvider);", " api.registerVectorStoreAdapter(vectorStoreAdapter);");
562
2298
  }
2299
+ if (capability === "schema") {
2300
+ defineBuilderSnippet.push(" api.registerItemFields([noteField]);", " api.registerItemTypes([itemType]);", " api.registerMigration(initMigration);");
2301
+ }
2302
+ if (capability === "profile") {
2303
+ defineBuilderSnippet.push(" api.registerProfile(starterProfile);");
2304
+ }
563
2305
  if (capability === "importers") {
564
2306
  defineBuilderSnippet.push(` api.registerImporter(${JSON.stringify(adapterName)}, importer, {`, ` action: ${JSON.stringify(`${adapterName} import`)},`, ' description: "Import starter records into pm context.",', " flags: [", " {", ' long: "--source",', ' value_name: "name",', ' value_type: "string",', ' description: "Source name or path to import from.",', " },", " ],", " });", ` api.registerExporter(${JSON.stringify(adapterName)}, exporter, {`, ` action: ${JSON.stringify(`${adapterName} export`)},`, ' description: "Export pm context into starter records.",', " flags: [", " {", ' long: "--destination",', ' value_name: "name",', ' value_type: "string",', ' description: "Destination name or path to export to.",', " },", " ],", " });");
565
2307
  }
566
- defineBuilderSnippet.push("}", "", "export function deactivate() {}", "", "export default { activate, deactivate };", "```");
2308
+ defineBuilderSnippet.push("}", "", "export function deactivate(): void {}", "", "export default { activate, deactivate };", "```");
567
2309
  const packageReadme = [
568
2310
  `# ${packageName}`,
569
2311
  "",
570
2312
  "Generated by `pm package init`.",
571
2313
  "",
572
2314
  "## Included Files",
573
- "- `package.json`: package metadata, `test` script, and `pm` resource manifest.",
574
- "- `manifest.json`: extension metadata and capabilities.",
2315
+ "- `package.json`: package metadata, `typecheck`/`test` scripts, and `pm` resource manifest.",
2316
+ manifestBullet,
575
2317
  entrypointBullet,
576
2318
  sampleTestBullet,
577
- "- `.gitignore`: ignores `node_modules/` and log files.",
2319
+ TSCONFIG_BULLET,
2320
+ "- `.gitignore`: ignores `node_modules/`, logs, and the TypeScript build cache.",
578
2321
  "",
579
2322
  "## Quick Start",
2323
+ "This package is authored AND loaded as TypeScript: the manifest `entry` is",
2324
+ "`./index.ts` and pm imports it directly via Node's native type stripping",
2325
+ "(Node >=22.18), so there is no build step — install and run:",
580
2326
  "```bash",
2327
+ "npm install",
581
2328
  "pm install --project <package-path>",
582
2329
  `pm ${commandName}`,
583
2330
  "pm package doctor --project --detail summary",
584
2331
  "```",
585
2332
  "",
586
2333
  "## Validate the Package",
587
- "Install the peer SDK once, then run the colocated sample test:",
2334
+ "`npm install` pulls the peer SDK and TypeScript. `npm test` is the default",
2335
+ "validation gate: it type-checks the package, then runs the colocated sample:",
588
2336
  "```bash",
589
2337
  "npm install",
590
2338
  "npm test",
591
2339
  "```",
592
- "`npm test` runs `node --test`, which executes `index.test.js` against the",
593
- "`@unbrained/pm-cli/sdk/testing` helpers - no extra test runner required.",
2340
+ "`npm run typecheck` is available when you only want the SDK contract check.",
2341
+ "`npm run test:runtime` runs just `node --test`, which strips types on load and",
2342
+ "executes `index.test.ts` directly against the `@unbrained/pm-cli/sdk/testing`",
2343
+ "helpers - no compile step and no extra test runner required.",
594
2344
  "",
595
2345
  "## Authoring With define* Builders",
596
- "`index.js` stays import-free so the package can be installed locally before",
597
- "`npm install` materializes peer dependencies. After installing dependencies,",
598
- "use the public SDK authoring builders for exported definitions you want",
599
- "editor type-checking, contextual handler inference, and direct unit tests for:",
2346
+ "`index.ts` is authored fully in TypeScript so every registration is checked",
2347
+ "against the SDK contracts at author time. Use the public SDK authoring",
2348
+ "builders for exported definitions you want literal-type preservation,",
2349
+ "contextual handler inference, and direct unit tests for:",
600
2350
  ...defineBuilderSnippet,
601
2351
  "The builders return their argument unchanged; runtime validation still lives",
602
2352
  "in `api.register*`, and behavior validation lives in `sdk/testing`.",
603
2353
  ...PACKAGE_CAPABILITY_README_SECTIONS[capability],
2354
+ ...buildScaffoldActivationReadmeSection(capability, "package"),
604
2355
  "",
605
2356
  "## Compatibility Bounds",
606
2357
  "`manifest.json` cannot hold comments, so the version-compatibility fields are documented here:",
@@ -612,19 +2363,24 @@ export function buildStarterExtensionScaffoldFiles(extensionName, commandName, v
612
2363
  "The starter command is pure compute, so `manifest.json` declares `trusted: true`, `sandbox_profile: \"strict\"`, and all six permission keys as `false`. Keep that least-privilege shape for pure packages; relax only the specific permission your package actually needs and verify with `pm package doctor --project --detail deep --trace`.",
613
2364
  "",
614
2365
  "## Notes",
615
- "- Keep simple starter runtime behavior at the package root so local installs work without dependency bootstrapping.",
616
- "- Move larger runtimes into subdirectories only after adding package dependencies and validating `pm package doctor`.",
2366
+ "- Author in `index.ts`; pm loads it directly (no build), so edits take effect on the next install/reload — there is no `.js` to regenerate.",
2367
+ "- Move larger runtimes into sibling or subdirectory `*.ts` modules and import them with their real `.ts` extension; `tsconfig.json` type-checks every `*.ts` in the package (recursively).",
617
2368
  "- Add capabilities to the extension manifest only when the entrypoint uses the matching SDK API.",
618
2369
  "- Use `@unbrained/pm-cli/sdk` as the public SDK import for richer package runtimes.",
619
2370
  "",
620
2371
  ].join("\n");
2372
+ // The declarative starter swaps the imperative entrypoint/test/README for the
2373
+ // `composeExtension` blueprint form (package-mode, any capability, enforced by
2374
+ // scaffoldExtensionProject). package.json, manifest.json, tsconfig.json, and
2375
+ // .gitignore are identical to the imperative starter for the same capability.
621
2376
  return {
622
2377
  "package.json": packageJson,
623
2378
  "manifest.json": manifest,
624
- "index.js": entrypoint,
625
- "index.test.js": sampleTest,
2379
+ "index.ts": declarative ? buildDeclarativeEntrypoint(extensionName, commandName, capability) : entrypoint,
2380
+ "index.test.ts": declarative ? buildDeclarativeSampleTestSource(extensionName, commandName, capability) : sampleTest,
2381
+ "tsconfig.json": tsconfig,
626
2382
  ".gitignore": gitignore,
627
- "README.md": packageReadme,
2383
+ "README.md": declarative ? buildDeclarativePackageReadme(packageName, commandName, capability) : packageReadme,
628
2384
  };
629
2385
  }
630
2386
  const readme = [
@@ -633,16 +2389,24 @@ export function buildStarterExtensionScaffoldFiles(extensionName, commandName, v
633
2389
  "Generated by `pm extension init`.",
634
2390
  "",
635
2391
  "## Included Files",
636
- "- `manifest.json`: extension metadata and capabilities.",
2392
+ manifestBullet,
637
2393
  entrypointBullet,
2394
+ TSCONFIG_BULLET,
638
2395
  "",
639
2396
  "## Quick Start",
2397
+ "This extension is authored AND loaded as TypeScript: the manifest `entry` is",
2398
+ "`./index.ts` and pm imports it directly via Node's native type stripping",
2399
+ "(Node >=22.18), so there is no compile step. Install the dev dependencies for",
2400
+ "type-checking, then install and run the extension:",
640
2401
  "```bash",
2402
+ "npm install -D typescript @types/node @unbrained/pm-cli",
2403
+ "npx tsc --noEmit",
641
2404
  "pm extension --install --project <scaffold-path>",
642
2405
  `pm ${commandName}`,
643
2406
  "pm extension --doctor --project --detail summary",
644
2407
  "```",
645
2408
  ...EXTENSION_CAPABILITY_README_SECTIONS[capability],
2409
+ ...buildScaffoldActivationReadmeSection(capability, "extension"),
646
2410
  "",
647
2411
  "## Compatibility Bounds",
648
2412
  "`manifest.json` cannot hold comments, so the version-compatibility fields are documented here:",
@@ -653,27 +2417,36 @@ export function buildStarterExtensionScaffoldFiles(extensionName, commandName, v
653
2417
  "## Policy Metadata",
654
2418
  "The starter command is pure compute, so `manifest.json` declares `trusted: true`, `sandbox_profile: \"strict\"`, and all six permission keys as `false`. Keep that least-privilege shape for pure extensions; relax only the specific permission your extension actually needs and verify with `pm extension --doctor --project --detail deep --trace`.",
655
2419
  "",
656
- "## Notes",
657
- "- This scaffold uses ESM exports so it works in package scopes with `type: module`.",
658
- "- Update `manifest.json` capabilities and `index.js` command behavior as your extension evolves.",
2420
+ "- This scaffold is TypeScript ESM source loaded directly by pm (no compile), so it works in package scopes with `type: module`.",
2421
+ "- Author in `index.ts` (the manifest entry); edits take effect on the next install/reload — there is no `.js` to regenerate.",
659
2422
  "- Release any resources `activate` opens (timers, connections, caches) in the `deactivate` teardown hook.",
660
2423
  "",
661
2424
  ].join("\n");
662
2425
  return {
663
2426
  "manifest.json": manifest,
664
- "index.js": entrypoint,
2427
+ "index.ts": entrypoint,
2428
+ "tsconfig.json": tsconfig,
665
2429
  "README.md": readme,
666
2430
  };
667
2431
  }
668
2432
  /**
669
2433
  * Implements scaffold extension project for the public runtime surface of this module.
670
2434
  */
671
- export async function scaffoldExtensionProject(target, vocabulary = "extension", capability = "commands") {
2435
+ export async function scaffoldExtensionProject(target, vocabulary = "extension", capability = "commands", declarative = false) {
672
2436
  const normalizedCapability = capability.trim().toLowerCase();
673
2437
  if (!SCAFFOLD_CAPABILITIES.includes(normalizedCapability)) {
674
2438
  throw new PmCliError(`Unknown scaffold capability "${capability}". Supported capabilities: ${SCAFFOLD_CAPABILITIES.join(", ")}.`, EXIT_CODE.USAGE);
675
2439
  }
676
2440
  const resolvedCapability = normalizedCapability;
2441
+ // The declarative (`composeExtension` blueprint) starter is package-mode only.
2442
+ // `composeExtension` is a runtime SDK *value* import, so it belongs in
2443
+ // package-mode authoring where the SDK is a linked dependency — not in the
2444
+ // import-free extension-only starters that must load without it. Every capability
2445
+ // emits its blueprint form (see buildDeclarativeBlueprintSurface).
2446
+ if (declarative && vocabulary !== "package") {
2447
+ throw new PmCliError("--declarative scaffolds a package-mode blueprint starter (composeExtension is a runtime SDK import). Use `pm package init`, not `pm extension init`.", EXIT_CODE.USAGE);
2448
+ }
2449
+ const style = declarative ? "declarative" : "imperative";
677
2450
  const normalizedTarget = target.trim();
678
2451
  const targetPath = path.resolve(process.cwd(), normalizedTarget);
679
2452
  const extensionName = normalizeManagedDirectoryName(path.basename(targetPath));
@@ -681,7 +2454,7 @@ export async function scaffoldExtensionProject(target, vocabulary = "extension",
681
2454
  // Commander, so generated starters use space-separated command words while the
682
2455
  // manifest and package identity keep their normalized directory names.
683
2456
  const commandName = `${extensionName.replace(/-/g, " ")} ping`;
684
- const scaffoldFiles = buildStarterExtensionScaffoldFiles(extensionName, commandName, vocabulary, resolvedCapability);
2457
+ const scaffoldFiles = buildStarterExtensionScaffoldFiles(extensionName, commandName, vocabulary, resolvedCapability, declarative);
685
2458
  let createdDirectory = false;
686
2459
  if (await pathExists(targetPath)) {
687
2460
  const existingTargetStats = await fs.stat(targetPath);
@@ -724,10 +2497,11 @@ export async function scaffoldExtensionProject(target, vocabulary = "extension",
724
2497
  extension_name: extensionName,
725
2498
  command_name: commandName,
726
2499
  capability: resolvedCapability,
2500
+ style,
727
2501
  target_path: targetPath,
728
2502
  created_directory: createdDirectory,
729
2503
  files,
730
2504
  };
731
2505
  }
732
2506
  //# sourceMappingURL=scaffold.js.map
733
- //# debugId=4513e1ea-24a5-55b1-9465-78d5d9febba7
2507
+ //# debugId=8a2ebc7a-02de-579c-8cf2-dbbbd401e622