@unbrained/pm-cli 2026.5.31 → 2026.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (638) hide show
  1. package/CHANGELOG.md +167 -0
  2. package/CONTRIBUTING.md +1 -0
  3. package/README.md +12 -4
  4. package/dist/cli/argv-utils.js +7 -3
  5. package/dist/cli/argv-utils.js.map +1 -1
  6. package/dist/cli/bootstrap-args.d.ts +1 -0
  7. package/dist/cli/bootstrap-args.js +23 -3
  8. package/dist/cli/bootstrap-args.js.map +1 -1
  9. package/dist/cli/commands/calendar.js +17 -3
  10. package/dist/cli/commands/calendar.js.map +1 -1
  11. package/dist/cli/commands/close-many.d.ts +63 -0
  12. package/dist/cli/commands/close-many.js +302 -0
  13. package/dist/cli/commands/close-many.js.map +1 -0
  14. package/dist/cli/commands/completion.d.ts +1 -0
  15. package/dist/cli/commands/completion.js +260 -32
  16. package/dist/cli/commands/completion.js.map +1 -1
  17. package/dist/cli/commands/config.d.ts +4 -4
  18. package/dist/cli/commands/config.js +115 -3
  19. package/dist/cli/commands/config.js.map +1 -1
  20. package/dist/cli/commands/contracts.js +193 -162
  21. package/dist/cli/commands/contracts.js.map +1 -1
  22. package/dist/cli/commands/create.d.ts +1 -0
  23. package/dist/cli/commands/create.js +77 -114
  24. package/dist/cli/commands/create.js.map +1 -1
  25. package/dist/cli/commands/extension/doctor.d.ts +12 -0
  26. package/dist/cli/commands/extension/doctor.js +97 -2
  27. package/dist/cli/commands/extension/doctor.js.map +1 -1
  28. package/dist/cli/commands/extension/scaffold.js +49 -48
  29. package/dist/cli/commands/extension/scaffold.js.map +1 -1
  30. package/dist/cli/commands/extension.js +51 -23
  31. package/dist/cli/commands/extension.js.map +1 -1
  32. package/dist/cli/commands/gc.d.ts +8 -1
  33. package/dist/cli/commands/gc.js +26 -3
  34. package/dist/cli/commands/gc.js.map +1 -1
  35. package/dist/cli/commands/get.js +7 -7
  36. package/dist/cli/commands/get.js.map +1 -1
  37. package/dist/cli/commands/health.js +51 -3
  38. package/dist/cli/commands/health.js.map +1 -1
  39. package/dist/cli/commands/history.d.ts +4 -1
  40. package/dist/cli/commands/history.js +12 -24
  41. package/dist/cli/commands/history.js.map +1 -1
  42. package/dist/cli/commands/index.d.ts +3 -1
  43. package/dist/cli/commands/index.js +5 -3
  44. package/dist/cli/commands/index.js.map +1 -1
  45. package/dist/cli/commands/init.d.ts +10 -0
  46. package/dist/cli/commands/init.js +107 -4
  47. package/dist/cli/commands/init.js.map +1 -1
  48. package/dist/cli/commands/list.d.ts +5 -0
  49. package/dist/cli/commands/list.js +58 -26
  50. package/dist/cli/commands/list.js.map +1 -1
  51. package/dist/cli/commands/reindex.js +163 -47
  52. package/dist/cli/commands/reindex.js.map +1 -1
  53. package/dist/cli/commands/repeatable-metadata-parsers.d.ts +15 -0
  54. package/dist/cli/commands/repeatable-metadata-parsers.js +120 -0
  55. package/dist/cli/commands/repeatable-metadata-parsers.js.map +1 -0
  56. package/dist/cli/commands/restore.js +25 -4
  57. package/dist/cli/commands/restore.js.map +1 -1
  58. package/dist/cli/commands/schema.d.ts +122 -1
  59. package/dist/cli/commands/schema.js +536 -6
  60. package/dist/cli/commands/schema.js.map +1 -1
  61. package/dist/cli/commands/search.d.ts +1 -0
  62. package/dist/cli/commands/search.js +18 -4
  63. package/dist/cli/commands/search.js.map +1 -1
  64. package/dist/cli/commands/stats.d.ts +8 -1
  65. package/dist/cli/commands/stats.js +18 -17
  66. package/dist/cli/commands/stats.js.map +1 -1
  67. package/dist/cli/commands/telemetry.d.ts +8 -0
  68. package/dist/cli/commands/telemetry.js +253 -0
  69. package/dist/cli/commands/telemetry.js.map +1 -0
  70. package/dist/cli/commands/test.js +4 -3
  71. package/dist/cli/commands/test.js.map +1 -1
  72. package/dist/cli/commands/update-many.js +69 -140
  73. package/dist/cli/commands/update-many.js.map +1 -1
  74. package/dist/cli/commands/update.d.ts +2 -0
  75. package/dist/cli/commands/update.js +138 -119
  76. package/dist/cli/commands/update.js.map +1 -1
  77. package/dist/cli/commands/validate.d.ts +1 -0
  78. package/dist/cli/commands/validate.js +63 -33
  79. package/dist/cli/commands/validate.js.map +1 -1
  80. package/dist/cli/error-guidance.js +26 -3
  81. package/dist/cli/error-guidance.js.map +1 -1
  82. package/dist/cli/help-content.js +91 -3
  83. package/dist/cli/help-content.js.map +1 -1
  84. package/dist/cli/main.js +377 -23
  85. package/dist/cli/main.js.map +1 -1
  86. package/dist/cli/register-list-query.js +14 -5
  87. package/dist/cli/register-list-query.js.map +1 -1
  88. package/dist/cli/register-mutation.js +200 -28
  89. package/dist/cli/register-mutation.js.map +1 -1
  90. package/dist/cli/register-operations.js +31 -6
  91. package/dist/cli/register-operations.js.map +1 -1
  92. package/dist/cli/register-setup.js +4 -2
  93. package/dist/cli/register-setup.js.map +1 -1
  94. package/dist/cli/registration-helpers.js +31 -4
  95. package/dist/cli/registration-helpers.js.map +1 -1
  96. package/dist/cli-bundle/chunks/activity-CVXTCHYY.js +16 -0
  97. package/dist/cli-bundle/chunks/activity-JM6DTDND.js +20 -0
  98. package/dist/cli-bundle/chunks/activity-JM6DTDND.js.map +1 -0
  99. package/dist/cli-bundle/chunks/aggregate-GI7WSZPH.js +206 -0
  100. package/dist/cli-bundle/chunks/aggregate-GI7WSZPH.js.map +1 -0
  101. package/dist/cli-bundle/chunks/{aggregate-ADUOSFRO.js → aggregate-VNAHUNNF.js} +11 -11
  102. package/dist/cli-bundle/chunks/{append-JD2DETU7.js → append-7H5N64R2.js} +8 -9
  103. package/dist/cli-bundle/chunks/{append-JD2DETU7.js.map → append-7H5N64R2.js.map} +1 -1
  104. package/dist/cli-bundle/chunks/append-WMKRXKCE.js +69 -0
  105. package/dist/cli-bundle/chunks/append-WMKRXKCE.js.map +1 -0
  106. package/dist/cli-bundle/chunks/{chunk-3M73P3G6.js → chunk-23YFZ3IG.js} +210 -132
  107. package/dist/cli-bundle/chunks/chunk-23YFZ3IG.js.map +7 -0
  108. package/dist/cli-bundle/chunks/chunk-2HVRUSQA.js +128 -0
  109. package/dist/cli-bundle/chunks/chunk-2HVRUSQA.js.map +1 -0
  110. package/dist/cli-bundle/chunks/chunk-2RSPZI5H.js +266 -0
  111. package/dist/cli-bundle/chunks/chunk-2RSPZI5H.js.map +1 -0
  112. package/dist/cli-bundle/chunks/chunk-2VBQ6ZXS.js +631 -0
  113. package/dist/cli-bundle/chunks/chunk-2VBQ6ZXS.js.map +1 -0
  114. package/dist/cli-bundle/chunks/chunk-2VVCGBNV.js +380 -0
  115. package/dist/cli-bundle/chunks/chunk-2VVCGBNV.js.map +1 -0
  116. package/dist/cli-bundle/chunks/chunk-3BWOVLTH.js +1664 -0
  117. package/dist/cli-bundle/chunks/chunk-3BWOVLTH.js.map +1 -0
  118. package/dist/cli-bundle/chunks/{chunk-6HT2F4TK.js → chunk-3FI4SEFT.js} +175 -54
  119. package/dist/cli-bundle/chunks/chunk-3FI4SEFT.js.map +7 -0
  120. package/dist/cli-bundle/chunks/{chunk-JULRTHJQ.js → chunk-3LB74A67.js} +119 -6
  121. package/dist/cli-bundle/chunks/chunk-3LB74A67.js.map +7 -0
  122. package/dist/cli-bundle/chunks/chunk-3VAM3NNM.js +57 -0
  123. package/dist/cli-bundle/chunks/chunk-3VAM3NNM.js.map +1 -0
  124. package/dist/cli-bundle/chunks/chunk-4LL6TK5B.js +1832 -0
  125. package/dist/cli-bundle/chunks/chunk-4LL6TK5B.js.map +1 -0
  126. package/dist/cli-bundle/chunks/chunk-52MAOQ6J.js +422 -0
  127. package/dist/cli-bundle/chunks/chunk-52MAOQ6J.js.map +7 -0
  128. package/dist/cli-bundle/chunks/chunk-5FDATVEZ.js +412 -0
  129. package/dist/cli-bundle/chunks/chunk-5FDATVEZ.js.map +1 -0
  130. package/dist/cli-bundle/chunks/chunk-5SFCOO6B.js +5622 -0
  131. package/dist/cli-bundle/chunks/chunk-5SFCOO6B.js.map +1 -0
  132. package/dist/cli-bundle/chunks/{chunk-U7FMKRXH.js → chunk-6ER6DXH5.js} +37 -16
  133. package/dist/cli-bundle/chunks/chunk-6ER6DXH5.js.map +7 -0
  134. package/dist/cli-bundle/chunks/chunk-6P6GGMOG.js +218 -0
  135. package/dist/cli-bundle/chunks/chunk-6P6GGMOG.js.map +1 -0
  136. package/dist/cli-bundle/chunks/chunk-77GFDHGF.js +80 -0
  137. package/dist/cli-bundle/chunks/chunk-77GFDHGF.js.map +1 -0
  138. package/dist/cli-bundle/chunks/{chunk-MD7K4JYF.js → chunk-AO442XLN.js} +26 -15
  139. package/dist/cli-bundle/chunks/chunk-AO442XLN.js.map +7 -0
  140. package/dist/cli-bundle/chunks/chunk-AY43SBIN.js +751 -0
  141. package/dist/cli-bundle/chunks/chunk-AY43SBIN.js.map +1 -0
  142. package/dist/cli-bundle/chunks/{chunk-D7AOMPRH.js → chunk-BQHUILZS.js} +5 -5
  143. package/dist/cli-bundle/chunks/chunk-E5FJNAZA.js +242 -0
  144. package/dist/cli-bundle/chunks/chunk-E5FJNAZA.js.map +1 -0
  145. package/dist/cli-bundle/chunks/{chunk-OGZEG5TT.js → chunk-ECCMVXGM.js} +164 -53
  146. package/dist/cli-bundle/chunks/chunk-ECCMVXGM.js.map +7 -0
  147. package/dist/cli-bundle/chunks/chunk-FRAUKRU2.js +182 -0
  148. package/dist/cli-bundle/chunks/chunk-FRAUKRU2.js.map +1 -0
  149. package/dist/cli-bundle/chunks/chunk-GCOQW437.js +130 -0
  150. package/dist/cli-bundle/chunks/chunk-GCOQW437.js.map +1 -0
  151. package/dist/cli-bundle/chunks/chunk-GGYWB3Y2.js +1340 -0
  152. package/dist/cli-bundle/chunks/chunk-GGYWB3Y2.js.map +1 -0
  153. package/dist/cli-bundle/chunks/{chunk-G57E5D7T.js → chunk-GU2ZJ2VV.js} +5 -5
  154. package/dist/cli-bundle/chunks/chunk-GXSUPCBV.js +231 -0
  155. package/dist/cli-bundle/chunks/chunk-GXSUPCBV.js.map +1 -0
  156. package/dist/cli-bundle/chunks/chunk-HZGUAH22.js +76 -0
  157. package/dist/cli-bundle/chunks/chunk-HZGUAH22.js.map +1 -0
  158. package/dist/cli-bundle/chunks/chunk-I2HSTRJF.js +346 -0
  159. package/dist/cli-bundle/chunks/chunk-I2HSTRJF.js.map +1 -0
  160. package/dist/cli-bundle/chunks/chunk-I6BNFU5X.js +140 -0
  161. package/dist/cli-bundle/chunks/chunk-I6BNFU5X.js.map +7 -0
  162. package/dist/cli-bundle/chunks/{chunk-JTWRXG4B.js → chunk-IJGCZSIQ.js} +251 -251
  163. package/dist/cli-bundle/chunks/chunk-IJGCZSIQ.js.map +7 -0
  164. package/dist/cli-bundle/chunks/chunk-IOR7LGF4.js +1491 -0
  165. package/dist/cli-bundle/chunks/chunk-IOR7LGF4.js.map +1 -0
  166. package/dist/cli-bundle/chunks/chunk-IUV734HF.js +17 -0
  167. package/dist/cli-bundle/chunks/chunk-IUV734HF.js.map +1 -0
  168. package/dist/cli-bundle/chunks/chunk-J27KIHTG.js +15 -0
  169. package/dist/cli-bundle/chunks/chunk-J27KIHTG.js.map +1 -0
  170. package/dist/cli-bundle/chunks/{chunk-AKOOMO3T.js → chunk-KAG77BY3.js} +2 -2
  171. package/dist/cli-bundle/chunks/{chunk-KBQY3YG5.js → chunk-KJ33AOCY.js} +3 -3
  172. package/dist/cli-bundle/chunks/{chunk-WDPXDQFG.js → chunk-KJE2FOS4.js} +6 -4
  173. package/dist/cli-bundle/chunks/chunk-KJE2FOS4.js.map +7 -0
  174. package/dist/cli-bundle/chunks/chunk-KWU6HG75.js +3883 -0
  175. package/dist/cli-bundle/chunks/chunk-KWU6HG75.js.map +1 -0
  176. package/dist/cli-bundle/chunks/chunk-LB3RUL2N.js +1325 -0
  177. package/dist/cli-bundle/chunks/chunk-LB3RUL2N.js.map +1 -0
  178. package/dist/cli-bundle/chunks/{chunk-5HSEP75M.js → chunk-LCM63IXU.js} +18 -6
  179. package/dist/cli-bundle/chunks/chunk-LCM63IXU.js.map +7 -0
  180. package/dist/cli-bundle/chunks/chunk-LXYVKYMQ.js +24 -0
  181. package/dist/cli-bundle/chunks/chunk-LXYVKYMQ.js.map +1 -0
  182. package/dist/cli-bundle/chunks/chunk-ME2YH6FN.js +182 -0
  183. package/dist/cli-bundle/chunks/chunk-ME2YH6FN.js.map +1 -0
  184. package/dist/cli-bundle/chunks/chunk-MITFDD35.js +1809 -0
  185. package/dist/cli-bundle/chunks/chunk-MITFDD35.js.map +1 -0
  186. package/dist/cli-bundle/chunks/{chunk-WJ2NAC37.js → chunk-N7ACFE26.js} +3 -3
  187. package/dist/cli-bundle/chunks/chunk-NUZ5HKR4.js +332 -0
  188. package/dist/cli-bundle/chunks/chunk-NUZ5HKR4.js.map +1 -0
  189. package/dist/cli-bundle/chunks/{chunk-7Y53ZJIQ.js → chunk-OVQCEJPG.js} +22 -3
  190. package/dist/cli-bundle/chunks/chunk-OVQCEJPG.js.map +7 -0
  191. package/dist/cli-bundle/chunks/{chunk-PXUAZUUY.js → chunk-OZ7NSQHL.js} +12 -11
  192. package/dist/cli-bundle/chunks/chunk-OZ7NSQHL.js.map +7 -0
  193. package/dist/cli-bundle/chunks/{chunk-P53TN6IA.js → chunk-PDDFYW4X.js} +35 -8
  194. package/dist/cli-bundle/chunks/chunk-PDDFYW4X.js.map +7 -0
  195. package/dist/cli-bundle/chunks/{chunk-6YCV7WSL.js → chunk-PIU6RSL3.js} +10 -12
  196. package/dist/cli-bundle/chunks/{chunk-6YCV7WSL.js.map → chunk-PIU6RSL3.js.map} +1 -1
  197. package/dist/cli-bundle/chunks/chunk-PO3GSVFV.js +338 -0
  198. package/dist/cli-bundle/chunks/chunk-PO3GSVFV.js.map +1 -0
  199. package/dist/cli-bundle/chunks/{chunk-LRBOHPUE.js → chunk-PRJCELV4.js} +108 -21
  200. package/dist/cli-bundle/chunks/chunk-PRJCELV4.js.map +7 -0
  201. package/dist/cli-bundle/chunks/{chunk-GN7IJPCD.js → chunk-PROOHX4K.js} +332 -32
  202. package/dist/cli-bundle/chunks/chunk-PROOHX4K.js.map +7 -0
  203. package/dist/cli-bundle/chunks/{chunk-FQE6XZDB.js → chunk-Q7SPNHLW.js} +54 -32
  204. package/dist/cli-bundle/chunks/chunk-Q7SPNHLW.js.map +7 -0
  205. package/dist/cli-bundle/chunks/{chunk-PVNQLCIS.js → chunk-QO7EBBOM.js} +2 -2
  206. package/dist/cli-bundle/chunks/{chunk-A7E7PUVX.js → chunk-R6UFP2GE.js} +7 -7
  207. package/dist/cli-bundle/chunks/chunk-RWPSOIEE.js +154 -0
  208. package/dist/cli-bundle/chunks/chunk-RWPSOIEE.js.map +1 -0
  209. package/dist/cli-bundle/chunks/chunk-RZN6VURO.js +119 -0
  210. package/dist/cli-bundle/chunks/chunk-RZN6VURO.js.map +1 -0
  211. package/dist/cli-bundle/chunks/chunk-SKJWX3QB.js +1501 -0
  212. package/dist/cli-bundle/chunks/chunk-SKJWX3QB.js.map +7 -0
  213. package/dist/cli-bundle/chunks/{chunk-CEFIVZPG.js → chunk-T3LC5LKB.js} +2 -2
  214. package/dist/cli-bundle/chunks/chunk-TCD3R2PF.js +173 -0
  215. package/dist/cli-bundle/chunks/chunk-TCD3R2PF.js.map +1 -0
  216. package/dist/cli-bundle/chunks/chunk-TPH5XEVD.js +2988 -0
  217. package/dist/cli-bundle/chunks/chunk-TPH5XEVD.js.map +1 -0
  218. package/dist/cli-bundle/chunks/{chunk-LSXGH6NE.js → chunk-U5SXYXSY.js} +821 -200
  219. package/dist/cli-bundle/chunks/chunk-U5SXYXSY.js.map +7 -0
  220. package/dist/cli-bundle/chunks/chunk-UBOPJT3S.js +540 -0
  221. package/dist/cli-bundle/chunks/chunk-UBOPJT3S.js.map +1 -0
  222. package/dist/cli-bundle/chunks/{chunk-JFWUHHS2.js → chunk-UM2GBHS4.js} +5 -4
  223. package/dist/cli-bundle/chunks/chunk-W7XABV4H.js +454 -0
  224. package/dist/cli-bundle/chunks/chunk-W7XABV4H.js.map +1 -0
  225. package/dist/cli-bundle/chunks/{chunk-SEXQN4KL.js → chunk-WKY2IBOQ.js} +3 -3
  226. package/dist/cli-bundle/chunks/chunk-WOPXVEZP.js +698 -0
  227. package/dist/cli-bundle/chunks/chunk-WOPXVEZP.js.map +1 -0
  228. package/dist/cli-bundle/chunks/chunk-WSMOSYRD.js +1704 -0
  229. package/dist/cli-bundle/chunks/chunk-WSMOSYRD.js.map +1 -0
  230. package/dist/cli-bundle/chunks/{chunk-NGN7UV5K.js → chunk-XLTD2HN3.js} +2 -2
  231. package/dist/cli-bundle/chunks/chunk-XSJCLN2R.js +131 -0
  232. package/dist/cli-bundle/chunks/chunk-XSJCLN2R.js.map +7 -0
  233. package/dist/cli-bundle/chunks/chunk-XSLQSXAH.js +53 -0
  234. package/dist/cli-bundle/chunks/chunk-XSLQSXAH.js.map +1 -0
  235. package/dist/cli-bundle/chunks/{chunk-BUPWJ3IJ.js → chunk-XTGLRY2Y.js} +484 -49
  236. package/dist/cli-bundle/chunks/chunk-XTGLRY2Y.js.map +7 -0
  237. package/dist/cli-bundle/chunks/{chunk-L2FXEKDB.js → chunk-YL2DJGYS.js} +7 -7
  238. package/dist/cli-bundle/chunks/{claim-EE4TKKCV.js → claim-4DBF6RVG.js} +10 -11
  239. package/dist/cli-bundle/chunks/{claim-EE4TKKCV.js.map → claim-4DBF6RVG.js.map} +1 -1
  240. package/dist/cli-bundle/chunks/claim-X2P4IB7J.js +129 -0
  241. package/dist/cli-bundle/chunks/claim-X2P4IB7J.js.map +1 -0
  242. package/dist/cli-bundle/chunks/close-3HDWDA3L.js +13 -0
  243. package/dist/cli-bundle/chunks/close-PTYFA45H.js +17 -0
  244. package/dist/cli-bundle/chunks/close-PTYFA45H.js.map +1 -0
  245. package/dist/cli-bundle/chunks/close-many-7CGIDPTJ.js +314 -0
  246. package/dist/cli-bundle/chunks/close-many-7CGIDPTJ.js.map +7 -0
  247. package/dist/cli-bundle/chunks/close-many-ERFO6LHR.js +311 -0
  248. package/dist/cli-bundle/chunks/close-many-ERFO6LHR.js.map +1 -0
  249. package/dist/cli-bundle/chunks/comments-OONGABK5.js +100 -0
  250. package/dist/cli-bundle/chunks/comments-OONGABK5.js.map +1 -0
  251. package/dist/cli-bundle/chunks/{comments-AAKJQ6LW.js → comments-QKBYCWKD.js} +10 -11
  252. package/dist/cli-bundle/chunks/{comments-AAKJQ6LW.js.map → comments-QKBYCWKD.js.map} +1 -1
  253. package/dist/cli-bundle/chunks/config-6FXCQKIF.js +1671 -0
  254. package/dist/cli-bundle/chunks/config-6FXCQKIF.js.map +1 -0
  255. package/dist/cli-bundle/chunks/{config-V3FZOKLI.js → config-U4RZ4CQB.js} +121 -10
  256. package/dist/cli-bundle/chunks/config-U4RZ4CQB.js.map +7 -0
  257. package/dist/cli-bundle/chunks/{context-RZ5QPNJB.js → context-FYYJGFWS.js} +32 -19
  258. package/dist/cli-bundle/chunks/{context-RZ5QPNJB.js.map → context-FYYJGFWS.js.map} +2 -2
  259. package/dist/cli-bundle/chunks/context-YMJ3Z2HQ.js +1461 -0
  260. package/dist/cli-bundle/chunks/context-YMJ3Z2HQ.js.map +1 -0
  261. package/dist/cli-bundle/chunks/contracts-QDB6OMLQ.js +1278 -0
  262. package/dist/cli-bundle/chunks/contracts-QDB6OMLQ.js.map +1 -0
  263. package/dist/cli-bundle/chunks/{contracts-YLMH33VU.js → contracts-RFSPGVVJ.js} +198 -162
  264. package/dist/cli-bundle/chunks/contracts-RFSPGVVJ.js.map +7 -0
  265. package/dist/cli-bundle/chunks/create-I5L4EYYZ.js +31 -0
  266. package/dist/cli-bundle/chunks/create-I5L4EYYZ.js.map +1 -0
  267. package/dist/cli-bundle/chunks/create-JTZNCTQC.js +27 -0
  268. package/dist/cli-bundle/chunks/delete-7HPGI4GZ.js +55 -0
  269. package/dist/cli-bundle/chunks/delete-7HPGI4GZ.js.map +1 -0
  270. package/dist/cli-bundle/chunks/{delete-RHCTEORS.js → delete-VXUPH5RS.js} +7 -8
  271. package/dist/cli-bundle/chunks/{delete-RHCTEORS.js.map → delete-VXUPH5RS.js.map} +1 -1
  272. package/dist/cli-bundle/chunks/{deps-MZYCMLAO.js → deps-JSRRWC3Z.js} +7 -8
  273. package/dist/cli-bundle/chunks/{deps-MZYCMLAO.js.map → deps-JSRRWC3Z.js.map} +1 -1
  274. package/dist/cli-bundle/chunks/deps-SCZIFK2Z.js +225 -0
  275. package/dist/cli-bundle/chunks/deps-SCZIFK2Z.js.map +1 -0
  276. package/dist/cli-bundle/chunks/docs-GJK6K4VP.js +31 -0
  277. package/dist/cli-bundle/chunks/docs-GJK6K4VP.js.map +1 -0
  278. package/dist/cli-bundle/chunks/{docs-FXXUCZYU.js → docs-WW4N3MBM.js} +9 -10
  279. package/dist/cli-bundle/chunks/{docs-FXXUCZYU.js.map → docs-WW4N3MBM.js.map} +1 -1
  280. package/dist/cli-bundle/chunks/{extension-B4WL7BQU.js → extension-J7IBMFTD.js} +4 -5
  281. package/dist/cli-bundle/chunks/extension-VDY2U33M.js +28 -0
  282. package/dist/cli-bundle/chunks/extension-VDY2U33M.js.map +1 -0
  283. package/dist/cli-bundle/chunks/files-ISZJGILQ.js +282 -0
  284. package/dist/cli-bundle/chunks/files-ISZJGILQ.js.map +1 -0
  285. package/dist/cli-bundle/chunks/{files-WVOX67PE.js → files-WKOD326U.js} +9 -10
  286. package/dist/cli-bundle/chunks/{files-WVOX67PE.js.map → files-WKOD326U.js.map} +1 -1
  287. package/dist/cli-bundle/chunks/gc-JDVJ6OQ2.js +362 -0
  288. package/dist/cli-bundle/chunks/gc-JDVJ6OQ2.js.map +1 -0
  289. package/dist/cli-bundle/chunks/gc-ULPVWMTN.js +372 -0
  290. package/dist/cli-bundle/chunks/gc-ULPVWMTN.js.map +7 -0
  291. package/dist/cli-bundle/chunks/get-RV37HT3G.js +194 -0
  292. package/dist/cli-bundle/chunks/get-RV37HT3G.js.map +1 -0
  293. package/dist/cli-bundle/chunks/{get-LTK3HOCQ.js → get-WXU6WI5P.js} +16 -17
  294. package/dist/cli-bundle/chunks/get-WXU6WI5P.js.map +7 -0
  295. package/dist/cli-bundle/chunks/{health-TCWL55KM.js → health-6L6EH4WR.js} +57 -16
  296. package/dist/cli-bundle/chunks/health-6L6EH4WR.js.map +7 -0
  297. package/dist/cli-bundle/chunks/health-LOI2HHKB.js +1271 -0
  298. package/dist/cli-bundle/chunks/health-LOI2HHKB.js.map +1 -0
  299. package/dist/cli-bundle/chunks/history-2BA3T5AE.js +20 -0
  300. package/dist/cli-bundle/chunks/history-PKN67D5O.js +24 -0
  301. package/dist/cli-bundle/chunks/history-PKN67D5O.js.map +1 -0
  302. package/dist/cli-bundle/chunks/history-redact-JBZNXHGR.js +19 -0
  303. package/dist/cli-bundle/chunks/history-redact-V4FOJGS7.js +23 -0
  304. package/dist/cli-bundle/chunks/history-redact-V4FOJGS7.js.map +1 -0
  305. package/dist/cli-bundle/chunks/{history-repair-ZWSTDRH2.js → history-repair-HIBCBIKK.js} +12 -14
  306. package/dist/cli-bundle/chunks/{history-repair-ZWSTDRH2.js.map → history-repair-HIBCBIKK.js.map} +1 -1
  307. package/dist/cli-bundle/chunks/history-repair-SDMHR7JT.js +193 -0
  308. package/dist/cli-bundle/chunks/history-repair-SDMHR7JT.js.map +1 -0
  309. package/dist/cli-bundle/chunks/init-HIVSNX3O.js +16 -0
  310. package/dist/cli-bundle/chunks/init-P56QYWJF.js +20 -0
  311. package/dist/cli-bundle/chunks/init-P56QYWJF.js.map +1 -0
  312. package/dist/cli-bundle/chunks/learnings-GDFRG5J7.js +44 -0
  313. package/dist/cli-bundle/chunks/learnings-GDFRG5J7.js.map +1 -0
  314. package/dist/cli-bundle/chunks/{learnings-NXTWE3FR.js → learnings-MIXSESLK.js} +10 -11
  315. package/dist/cli-bundle/chunks/{learnings-NXTWE3FR.js.map → learnings-MIXSESLK.js.map} +1 -1
  316. package/dist/cli-bundle/chunks/list-FGOWQMSM.js +24 -0
  317. package/dist/cli-bundle/chunks/list-FGOWQMSM.js.map +1 -0
  318. package/dist/cli-bundle/chunks/list-MUSQNMTD.js +20 -0
  319. package/dist/cli-bundle/chunks/{notes-DFS5ZGOO.js → notes-4XVSH2AZ.js} +10 -11
  320. package/dist/cli-bundle/chunks/{notes-DFS5ZGOO.js.map → notes-4XVSH2AZ.js.map} +1 -1
  321. package/dist/cli-bundle/chunks/notes-5UK3GEH2.js +44 -0
  322. package/dist/cli-bundle/chunks/notes-5UK3GEH2.js.map +1 -0
  323. package/dist/cli-bundle/chunks/plan-DUMBV3QB.js +1171 -0
  324. package/dist/cli-bundle/chunks/plan-DUMBV3QB.js.map +1 -0
  325. package/dist/cli-bundle/chunks/{plan-67AB2PLM.js → plan-SLMODHWX.js} +13 -14
  326. package/dist/cli-bundle/chunks/{plan-67AB2PLM.js.map → plan-SLMODHWX.js.map} +1 -1
  327. package/dist/cli-bundle/chunks/register-list-query-POCFZ5JW.js +229 -0
  328. package/dist/cli-bundle/chunks/register-list-query-POCFZ5JW.js.map +1 -0
  329. package/dist/cli-bundle/chunks/{register-list-query-UP3VRUFS.js → register-list-query-WST76HSQ.js} +26 -26
  330. package/dist/cli-bundle/chunks/register-list-query-WST76HSQ.js.map +7 -0
  331. package/dist/cli-bundle/chunks/register-mutation-N5GSUZJV.js +813 -0
  332. package/dist/cli-bundle/chunks/register-mutation-N5GSUZJV.js.map +1 -0
  333. package/dist/cli-bundle/chunks/{register-mutation-YWSBF545.js → register-mutation-OA675SOU.js} +154 -43
  334. package/dist/cli-bundle/chunks/register-mutation-OA675SOU.js.map +7 -0
  335. package/dist/cli-bundle/chunks/register-operations-GNHBE5I3.js +383 -0
  336. package/dist/cli-bundle/chunks/register-operations-GNHBE5I3.js.map +1 -0
  337. package/dist/cli-bundle/chunks/{register-operations-3BDTGSDH.js → register-operations-N3PMHXH5.js} +49 -37
  338. package/dist/cli-bundle/chunks/register-operations-N3PMHXH5.js.map +7 -0
  339. package/dist/cli-bundle/chunks/register-setup-JIMPKJKV.js +242 -0
  340. package/dist/cli-bundle/chunks/register-setup-JIMPKJKV.js.map +1 -0
  341. package/dist/cli-bundle/chunks/{register-setup-V56GDRUS.js → register-setup-ZHJI2DI3.js} +18 -19
  342. package/dist/cli-bundle/chunks/{register-setup-V56GDRUS.js.map → register-setup-ZHJI2DI3.js.map} +2 -2
  343. package/dist/cli-bundle/chunks/restore-D4RGNX33.js +17 -0
  344. package/dist/cli-bundle/chunks/restore-PBL6T5TW.js +21 -0
  345. package/dist/cli-bundle/chunks/restore-PBL6T5TW.js.map +1 -0
  346. package/dist/cli-bundle/chunks/schema-2NOO6NGB.js +780 -0
  347. package/dist/cli-bundle/chunks/schema-2NOO6NGB.js.map +7 -0
  348. package/dist/cli-bundle/chunks/schema-EBI4NLUO.js +770 -0
  349. package/dist/cli-bundle/chunks/schema-EBI4NLUO.js.map +1 -0
  350. package/dist/cli-bundle/chunks/search-JPUQTVCY.js +1127 -0
  351. package/dist/cli-bundle/chunks/search-JPUQTVCY.js.map +1 -0
  352. package/dist/cli-bundle/chunks/{search-HENBL456.js → search-OA6JX27A.js} +25 -16
  353. package/dist/cli-bundle/chunks/search-OA6JX27A.js.map +7 -0
  354. package/dist/cli-bundle/chunks/stats-CV54BAWY.js +202 -0
  355. package/dist/cli-bundle/chunks/stats-CV54BAWY.js.map +1 -0
  356. package/dist/cli-bundle/chunks/stats-XYB6KTFG.js +212 -0
  357. package/dist/cli-bundle/chunks/stats-XYB6KTFG.js.map +7 -0
  358. package/dist/cli-bundle/chunks/telemetry-LMJ7PFUO.js +251 -0
  359. package/dist/cli-bundle/chunks/telemetry-LMJ7PFUO.js.map +7 -0
  360. package/dist/cli-bundle/chunks/telemetry-NCMEPJNR.js +248 -0
  361. package/dist/cli-bundle/chunks/telemetry-NCMEPJNR.js.map +1 -0
  362. package/dist/cli-bundle/chunks/test-MXX3E5JL.js +31 -0
  363. package/dist/cli-bundle/chunks/test-WBROAJIE.js +35 -0
  364. package/dist/cli-bundle/chunks/test-WBROAJIE.js.map +1 -0
  365. package/dist/cli-bundle/chunks/test-all-N6NSRDTV.js +328 -0
  366. package/dist/cli-bundle/chunks/test-all-N6NSRDTV.js.map +1 -0
  367. package/dist/cli-bundle/chunks/{test-all-G2AZOHXI.js → test-all-NTOZ7C3M.js} +13 -14
  368. package/dist/cli-bundle/chunks/{test-all-G2AZOHXI.js.map → test-all-NTOZ7C3M.js.map} +1 -1
  369. package/dist/cli-bundle/chunks/test-runs-V6A7LPWZ.js +929 -0
  370. package/dist/cli-bundle/chunks/test-runs-V6A7LPWZ.js.map +1 -0
  371. package/dist/cli-bundle/chunks/{test-runs-GX5HTPSF.js → test-runs-WMVTQU3Y.js} +5 -5
  372. package/dist/cli-bundle/chunks/update-OSV3NAQB.js +25 -0
  373. package/dist/cli-bundle/chunks/update-OSV3NAQB.js.map +1 -0
  374. package/dist/cli-bundle/chunks/update-YRXSUGYQ.js +21 -0
  375. package/dist/cli-bundle/chunks/update-many-EM6OXYGO.js +605 -0
  376. package/dist/cli-bundle/chunks/update-many-EM6OXYGO.js.map +1 -0
  377. package/dist/cli-bundle/chunks/{update-many-46HRSP2Q.js → update-many-KGGEYABR.js} +78 -146
  378. package/dist/cli-bundle/chunks/update-many-KGGEYABR.js.map +7 -0
  379. package/dist/cli-bundle/chunks/{upgrade-H5HHM5UV.js → upgrade-BLI7XBAJ.js} +5 -7
  380. package/dist/cli-bundle/chunks/{upgrade-H5HHM5UV.js.map → upgrade-BLI7XBAJ.js.map} +1 -1
  381. package/dist/cli-bundle/chunks/upgrade-LXPOQKFV.js +266 -0
  382. package/dist/cli-bundle/chunks/upgrade-LXPOQKFV.js.map +1 -0
  383. package/dist/cli-bundle/chunks/{validate-TMCVKIGZ.js → validate-AGOAUOVW.js} +61 -48
  384. package/dist/cli-bundle/chunks/validate-AGOAUOVW.js.map +7 -0
  385. package/dist/cli-bundle/chunks/validate-L5J6A7YO.js +1120 -0
  386. package/dist/cli-bundle/chunks/validate-L5J6A7YO.js.map +1 -0
  387. package/dist/cli-bundle/main.js +534 -1505
  388. package/dist/cli-bundle/main.js.map +4 -4
  389. package/dist/core/checkpoint/mutation-checkpoint.d.ts +44 -0
  390. package/dist/core/checkpoint/mutation-checkpoint.js +119 -0
  391. package/dist/core/checkpoint/mutation-checkpoint.js.map +1 -0
  392. package/dist/core/config/positional-value.js +4 -2
  393. package/dist/core/config/positional-value.js.map +1 -1
  394. package/dist/core/diagnostics/remediation.d.ts +73 -0
  395. package/dist/core/diagnostics/remediation.js +328 -0
  396. package/dist/core/diagnostics/remediation.js.map +1 -0
  397. package/dist/core/extensions/extension-hook-runtime.js +9 -2
  398. package/dist/core/extensions/extension-hook-runtime.js.map +1 -1
  399. package/dist/core/extensions/extension-types.d.ts +60 -4
  400. package/dist/core/extensions/extension-types.js +2 -2
  401. package/dist/core/extensions/extension-types.js.map +1 -1
  402. package/dist/core/extensions/index.d.ts +5 -1
  403. package/dist/core/extensions/index.js +61 -2
  404. package/dist/core/extensions/index.js.map +1 -1
  405. package/dist/core/extensions/item-fields.d.ts +5 -1
  406. package/dist/core/extensions/item-fields.js +126 -4
  407. package/dist/core/extensions/item-fields.js.map +1 -1
  408. package/dist/core/extensions/loader.js +283 -8
  409. package/dist/core/extensions/loader.js.map +1 -1
  410. package/dist/core/history/history-diff.d.ts +47 -0
  411. package/dist/core/history/history-diff.js +152 -0
  412. package/dist/core/history/history-diff.js.map +1 -0
  413. package/dist/core/history/history-storage-stats.d.ts +31 -0
  414. package/dist/core/history/history-storage-stats.js +101 -0
  415. package/dist/core/history/history-storage-stats.js.map +1 -0
  416. package/dist/core/item/item-format.d.ts +3 -2
  417. package/dist/core/item/item-format.js +15 -10
  418. package/dist/core/item/item-format.js.map +1 -1
  419. package/dist/core/item/status-filter.d.ts +29 -0
  420. package/dist/core/item/status-filter.js +97 -0
  421. package/dist/core/item/status-filter.js.map +1 -0
  422. package/dist/core/item/type-registry.js +4 -2
  423. package/dist/core/item/type-registry.js.map +1 -1
  424. package/dist/core/lock/lock-gc.d.ts +46 -0
  425. package/dist/core/lock/lock-gc.js +194 -0
  426. package/dist/core/lock/lock-gc.js.map +1 -0
  427. package/dist/core/output/output.js +17 -5
  428. package/dist/core/output/output.js.map +1 -1
  429. package/dist/core/schema/item-types-file.d.ts +15 -0
  430. package/dist/core/schema/item-types-file.js +27 -2
  431. package/dist/core/schema/item-types-file.js.map +1 -1
  432. package/dist/core/schema/runtime-field-filters.js +4 -3
  433. package/dist/core/schema/runtime-field-filters.js.map +1 -1
  434. package/dist/core/schema/runtime-field-values.d.ts +1 -1
  435. package/dist/core/schema/runtime-field-values.js +10 -4
  436. package/dist/core/schema/runtime-field-values.js.map +1 -1
  437. package/dist/core/schema/runtime-schema.js +75 -2
  438. package/dist/core/schema/runtime-schema.js.map +1 -1
  439. package/dist/core/schema/status-defs-file.d.ts +113 -0
  440. package/dist/core/schema/status-defs-file.js +260 -0
  441. package/dist/core/schema/status-defs-file.js.map +1 -0
  442. package/dist/core/schema/type-workflows.d.ts +64 -0
  443. package/dist/core/schema/type-workflows.js +98 -0
  444. package/dist/core/schema/type-workflows.js.map +1 -0
  445. package/dist/core/search/cache.d.ts +3 -1
  446. package/dist/core/search/cache.js +104 -28
  447. package/dist/core/search/cache.js.map +1 -1
  448. package/dist/core/search/http-client.d.ts +2 -2
  449. package/dist/core/search/http-client.js +2 -2
  450. package/dist/core/search/http-client.js.map +1 -1
  451. package/dist/core/search/vector-stores.d.ts +1 -0
  452. package/dist/core/search/vector-stores.js +64 -14
  453. package/dist/core/search/vector-stores.js.map +1 -1
  454. package/dist/core/search/vectorization-metadata.d.ts +13 -0
  455. package/dist/core/search/vectorization-metadata.js +65 -0
  456. package/dist/core/search/vectorization-metadata.js.map +1 -0
  457. package/dist/core/shared/serial-queue.d.ts +12 -0
  458. package/dist/core/shared/serial-queue.js +43 -0
  459. package/dist/core/shared/serial-queue.js.map +1 -0
  460. package/dist/core/shared/serialization.d.ts +1 -0
  461. package/dist/core/shared/serialization.js +86 -2
  462. package/dist/core/shared/serialization.js.map +1 -1
  463. package/dist/core/store/front-matter-cache.js +14 -5
  464. package/dist/core/store/front-matter-cache.js.map +1 -1
  465. package/dist/core/store/item-store.d.ts +2 -0
  466. package/dist/core/store/item-store.js +61 -6
  467. package/dist/core/store/item-store.js.map +1 -1
  468. package/dist/core/store/settings-validator.js +18 -2
  469. package/dist/core/store/settings-validator.js.map +1 -1
  470. package/dist/core/store/settings.d.ts +19 -1
  471. package/dist/core/store/settings.js +130 -10
  472. package/dist/core/store/settings.js.map +1 -1
  473. package/dist/core/telemetry/consent.js +3 -3
  474. package/dist/core/telemetry/consent.js.map +1 -1
  475. package/dist/core/telemetry/observability.js +5 -4
  476. package/dist/core/telemetry/observability.js.map +1 -1
  477. package/dist/core/telemetry/runtime.js +16 -4
  478. package/dist/core/telemetry/runtime.js.map +1 -1
  479. package/dist/mcp/server.d.ts +1 -0
  480. package/dist/mcp/server.js +372 -45
  481. package/dist/mcp/server.js.map +1 -1
  482. package/dist/sdk/cli-contracts/commander-mutation-options.js +16 -2
  483. package/dist/sdk/cli-contracts/commander-mutation-options.js.map +1 -1
  484. package/dist/sdk/cli-contracts/commander-types.js +7 -2
  485. package/dist/sdk/cli-contracts/commander-types.js.map +1 -1
  486. package/dist/sdk/cli-contracts/enum-contracts.d.ts +2 -2
  487. package/dist/sdk/cli-contracts/enum-contracts.js +6 -2
  488. package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -1
  489. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +1 -0
  490. package/dist/sdk/cli-contracts/tool-option-contracts.js +53 -3
  491. package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
  492. package/dist/sdk/cli-contracts/tool-parameter-tables.js +42 -10
  493. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  494. package/dist/sdk/cli-contracts.d.ts +42 -1
  495. package/dist/sdk/cli-contracts.js +225 -19
  496. package/dist/sdk/cli-contracts.js.map +1 -1
  497. package/dist/sdk/errors.d.ts +22 -0
  498. package/dist/sdk/errors.js +46 -0
  499. package/dist/sdk/errors.js.map +1 -0
  500. package/dist/sdk/index.d.ts +2 -1
  501. package/dist/sdk/index.js +3 -2
  502. package/dist/sdk/index.js.map +1 -1
  503. package/dist/sdk/package-import-adapters.js +14 -3
  504. package/dist/sdk/package-import-adapters.js.map +1 -1
  505. package/dist/sdk/runtime.d.ts +1 -0
  506. package/dist/sdk/runtime.js +3 -2
  507. package/dist/sdk/runtime.js.map +1 -1
  508. package/dist/sdk/testing.d.ts +77 -0
  509. package/dist/sdk/testing.js +239 -0
  510. package/dist/sdk/testing.js.map +1 -0
  511. package/dist/types.d.ts +19 -0
  512. package/dist/types.js +3 -2
  513. package/dist/types.js.map +1 -1
  514. package/docs/AGENT_GUIDE.md +22 -3
  515. package/docs/ARCHITECTURE.md +11 -1
  516. package/docs/CLAUDE_CODE_PLUGIN.md +2 -2
  517. package/docs/COMMANDS.md +118 -7
  518. package/docs/CONFIGURATION.md +57 -2
  519. package/docs/EXTENSIONS.md +125 -6
  520. package/docs/EXTENSION_AUTHOR_CONTRACTS.md +73 -0
  521. package/docs/ONBOARDING.md +165 -0
  522. package/docs/QUICKSTART.md +3 -1
  523. package/docs/README.md +12 -4
  524. package/docs/RELEASING.md +38 -3
  525. package/docs/SDK.md +273 -1
  526. package/docs/TESTING.md +36 -1
  527. package/docs/examples/policy-restricted-extension/manifest.json +1 -0
  528. package/docs/examples/starter-extension/index.js +9 -1
  529. package/docs/examples/starter-extension/manifest.json +1 -0
  530. package/package.json +16 -7
  531. package/packages/pm-beads/extensions/beads/index.js +2 -4
  532. package/packages/pm-beads/extensions/beads/index.ts +43 -33
  533. package/packages/pm-beads/extensions/beads/manifest.json +12 -1
  534. package/packages/pm-calendar/README.md +6 -0
  535. package/packages/pm-calendar/extensions/calendar/index.js +6 -1
  536. package/packages/pm-calendar/extensions/calendar/index.ts +6 -1
  537. package/packages/pm-calendar/extensions/calendar/manifest.json +6 -1
  538. package/packages/pm-governance-audit/extensions/governance-audit/manifest.json +6 -1
  539. package/packages/pm-guide-shell/README.md +4 -0
  540. package/packages/pm-guide-shell/extensions/guide-shell/index.js +22 -0
  541. package/packages/pm-guide-shell/extensions/guide-shell/index.ts +22 -0
  542. package/packages/pm-guide-shell/extensions/guide-shell/manifest.json +6 -1
  543. package/packages/pm-guide-shell/extensions/guide-shell/runtime.js +74 -3
  544. package/packages/pm-guide-shell/extensions/guide-shell/runtime.ts +84 -4
  545. package/packages/pm-lifecycle-hooks/README.md +29 -0
  546. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/index.js +18 -0
  547. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/index.ts +20 -0
  548. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/manifest.json +9 -0
  549. package/packages/pm-lifecycle-hooks/package.json +52 -0
  550. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/manifest.json +13 -1
  551. package/packages/pm-search-advanced/extensions/search-advanced/index.js +69 -1
  552. package/packages/pm-search-advanced/extensions/search-advanced/index.ts +91 -2
  553. package/packages/pm-search-advanced/extensions/search-advanced/manifest.json +13 -1
  554. package/packages/pm-templates/extensions/templates/manifest.json +6 -1
  555. package/packages/pm-todos/extensions/todos/index.js +3 -7
  556. package/packages/pm-todos/extensions/todos/index.ts +55 -42
  557. package/packages/pm-todos/extensions/todos/manifest.json +13 -1
  558. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  559. package/plugins/pm-claude/README.md +7 -4
  560. package/plugins/pm-claude/agents/pm-coordinator.md +1 -1
  561. package/plugins/pm-claude/commands/pm-init.md +1 -1
  562. package/scripts/bundle-cli.mjs +121 -17
  563. package/dist/cli-bundle/chunks/activity-OWYSUZOY.js +0 -17
  564. package/dist/cli-bundle/chunks/chunk-3M73P3G6.js.map +0 -7
  565. package/dist/cli-bundle/chunks/chunk-4AEZR5EJ.js +0 -189
  566. package/dist/cli-bundle/chunks/chunk-4AEZR5EJ.js.map +0 -7
  567. package/dist/cli-bundle/chunks/chunk-5HSEP75M.js.map +0 -7
  568. package/dist/cli-bundle/chunks/chunk-6HT2F4TK.js.map +0 -7
  569. package/dist/cli-bundle/chunks/chunk-7Y53ZJIQ.js.map +0 -7
  570. package/dist/cli-bundle/chunks/chunk-BUPWJ3IJ.js.map +0 -7
  571. package/dist/cli-bundle/chunks/chunk-EGUGFSNX.js +0 -47
  572. package/dist/cli-bundle/chunks/chunk-EGUGFSNX.js.map +0 -7
  573. package/dist/cli-bundle/chunks/chunk-FM26RGSU.js +0 -56
  574. package/dist/cli-bundle/chunks/chunk-FM26RGSU.js.map +0 -7
  575. package/dist/cli-bundle/chunks/chunk-FQE6XZDB.js.map +0 -7
  576. package/dist/cli-bundle/chunks/chunk-GN7IJPCD.js.map +0 -7
  577. package/dist/cli-bundle/chunks/chunk-JTWRXG4B.js.map +0 -7
  578. package/dist/cli-bundle/chunks/chunk-JULRTHJQ.js.map +0 -7
  579. package/dist/cli-bundle/chunks/chunk-LRBOHPUE.js.map +0 -7
  580. package/dist/cli-bundle/chunks/chunk-LSXGH6NE.js.map +0 -7
  581. package/dist/cli-bundle/chunks/chunk-MD7K4JYF.js.map +0 -7
  582. package/dist/cli-bundle/chunks/chunk-OGZEG5TT.js.map +0 -7
  583. package/dist/cli-bundle/chunks/chunk-P53TN6IA.js.map +0 -7
  584. package/dist/cli-bundle/chunks/chunk-PXUAZUUY.js.map +0 -7
  585. package/dist/cli-bundle/chunks/chunk-U7FMKRXH.js.map +0 -7
  586. package/dist/cli-bundle/chunks/chunk-VGICHR7D.js +0 -141
  587. package/dist/cli-bundle/chunks/chunk-VGICHR7D.js.map +0 -7
  588. package/dist/cli-bundle/chunks/chunk-WDPXDQFG.js.map +0 -7
  589. package/dist/cli-bundle/chunks/close-XY4CSAYF.js +0 -14
  590. package/dist/cli-bundle/chunks/config-V3FZOKLI.js.map +0 -7
  591. package/dist/cli-bundle/chunks/contracts-YLMH33VU.js.map +0 -7
  592. package/dist/cli-bundle/chunks/create-PZVHRIZQ.js +0 -28
  593. package/dist/cli-bundle/chunks/gc-JWNF66EC.js +0 -181
  594. package/dist/cli-bundle/chunks/gc-JWNF66EC.js.map +0 -7
  595. package/dist/cli-bundle/chunks/get-LTK3HOCQ.js.map +0 -7
  596. package/dist/cli-bundle/chunks/health-TCWL55KM.js.map +0 -7
  597. package/dist/cli-bundle/chunks/history-A2JUDXUE.js +0 -21
  598. package/dist/cli-bundle/chunks/history-redact-ED6RFCPL.js +0 -20
  599. package/dist/cli-bundle/chunks/init-M2WUB4YH.js +0 -16
  600. package/dist/cli-bundle/chunks/list-OGWQPC26.js +0 -20
  601. package/dist/cli-bundle/chunks/register-list-query-UP3VRUFS.js.map +0 -7
  602. package/dist/cli-bundle/chunks/register-mutation-YWSBF545.js.map +0 -7
  603. package/dist/cli-bundle/chunks/register-operations-3BDTGSDH.js.map +0 -7
  604. package/dist/cli-bundle/chunks/restore-MB2ISME7.js +0 -18
  605. package/dist/cli-bundle/chunks/schema-Q622KC46.js +0 -119
  606. package/dist/cli-bundle/chunks/schema-Q622KC46.js.map +0 -7
  607. package/dist/cli-bundle/chunks/search-HENBL456.js.map +0 -7
  608. package/dist/cli-bundle/chunks/stats-N6H3YP2F.js +0 -124
  609. package/dist/cli-bundle/chunks/stats-N6H3YP2F.js.map +0 -7
  610. package/dist/cli-bundle/chunks/test-VNBDRJ4Z.js +0 -32
  611. package/dist/cli-bundle/chunks/update-H6SCWNMA.js +0 -22
  612. package/dist/cli-bundle/chunks/update-many-46HRSP2Q.js.map +0 -7
  613. package/dist/cli-bundle/chunks/validate-TMCVKIGZ.js.map +0 -7
  614. /package/dist/cli-bundle/chunks/{activity-OWYSUZOY.js.map → activity-CVXTCHYY.js.map} +0 -0
  615. /package/dist/cli-bundle/chunks/{aggregate-ADUOSFRO.js.map → aggregate-VNAHUNNF.js.map} +0 -0
  616. /package/dist/cli-bundle/chunks/{chunk-D7AOMPRH.js.map → chunk-BQHUILZS.js.map} +0 -0
  617. /package/dist/cli-bundle/chunks/{chunk-G57E5D7T.js.map → chunk-GU2ZJ2VV.js.map} +0 -0
  618. /package/dist/cli-bundle/chunks/{chunk-AKOOMO3T.js.map → chunk-KAG77BY3.js.map} +0 -0
  619. /package/dist/cli-bundle/chunks/{chunk-KBQY3YG5.js.map → chunk-KJ33AOCY.js.map} +0 -0
  620. /package/dist/cli-bundle/chunks/{chunk-WJ2NAC37.js.map → chunk-N7ACFE26.js.map} +0 -0
  621. /package/dist/cli-bundle/chunks/{chunk-PVNQLCIS.js.map → chunk-QO7EBBOM.js.map} +0 -0
  622. /package/dist/cli-bundle/chunks/{chunk-A7E7PUVX.js.map → chunk-R6UFP2GE.js.map} +0 -0
  623. /package/dist/cli-bundle/chunks/{chunk-CEFIVZPG.js.map → chunk-T3LC5LKB.js.map} +0 -0
  624. /package/dist/cli-bundle/chunks/{chunk-JFWUHHS2.js.map → chunk-UM2GBHS4.js.map} +0 -0
  625. /package/dist/cli-bundle/chunks/{chunk-SEXQN4KL.js.map → chunk-WKY2IBOQ.js.map} +0 -0
  626. /package/dist/cli-bundle/chunks/{chunk-NGN7UV5K.js.map → chunk-XLTD2HN3.js.map} +0 -0
  627. /package/dist/cli-bundle/chunks/{chunk-L2FXEKDB.js.map → chunk-YL2DJGYS.js.map} +0 -0
  628. /package/dist/cli-bundle/chunks/{close-XY4CSAYF.js.map → close-3HDWDA3L.js.map} +0 -0
  629. /package/dist/cli-bundle/chunks/{create-PZVHRIZQ.js.map → create-JTZNCTQC.js.map} +0 -0
  630. /package/dist/cli-bundle/chunks/{extension-B4WL7BQU.js.map → extension-J7IBMFTD.js.map} +0 -0
  631. /package/dist/cli-bundle/chunks/{history-A2JUDXUE.js.map → history-2BA3T5AE.js.map} +0 -0
  632. /package/dist/cli-bundle/chunks/{history-redact-ED6RFCPL.js.map → history-redact-JBZNXHGR.js.map} +0 -0
  633. /package/dist/cli-bundle/chunks/{init-M2WUB4YH.js.map → init-HIVSNX3O.js.map} +0 -0
  634. /package/dist/cli-bundle/chunks/{list-OGWQPC26.js.map → list-MUSQNMTD.js.map} +0 -0
  635. /package/dist/cli-bundle/chunks/{restore-MB2ISME7.js.map → restore-D4RGNX33.js.map} +0 -0
  636. /package/dist/cli-bundle/chunks/{test-VNBDRJ4Z.js.map → test-MXX3E5JL.js.map} +0 -0
  637. /package/dist/cli-bundle/chunks/{test-runs-GX5HTPSF.js.map → test-runs-WMVTQU3Y.js.map} +0 -0
  638. /package/dist/cli-bundle/chunks/{update-H6SCWNMA.js.map → update-YRXSUGYQ.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-schema.js","sources":["core/schema/runtime-schema.ts"],"sourceRoot":"/","sourcesContent":["import path from \"node:path\";\nimport { pathExists, readFileIfExists, writeFileAtomic } from \"../fs/fs-utils.js\";\nimport { DEFAULT_STATUS_DEFINITIONS, DEFAULT_WORKFLOW_DEFINITION } from \"../shared/constants.js\";\nimport {\n RUNTIME_FIELD_COMMAND_VALUES,\n RUNTIME_FIELD_TYPE_VALUES,\n RUNTIME_STATUS_ROLE_VALUES,\n RUNTIME_UNKNOWN_FIELD_POLICY_VALUES,\n STATUS_VALUES,\n} from \"../../types/index.js\";\nimport type {\n ItemTypeDefinition,\n RuntimeFieldCommand,\n RuntimeFieldDefinition,\n RuntimeFieldType,\n RuntimeSchemaSettings,\n RuntimeStatusDefinition,\n RuntimeStatusRole,\n RuntimeWorkflowDefinition,\n} from \"../../types/index.js\";\n\nexport type { RuntimeFieldCommand } from \"../../types/index.js\";\n\nexport const DEFAULT_RUNTIME_SCHEMA_FILE_PATHS = Object.freeze({\n types: \"schema/types.json\",\n statuses: \"schema/statuses.json\",\n fields: \"schema/fields.json\",\n workflows: \"schema/workflows.json\",\n});\n\n// Default lifecycle status model and workflow role mapping live in\n// src/core/shared/constants.ts as the single source of truth (also referenced\n// by SETTINGS_DEFAULTS). Re-exported here under the historical names.\nexport const DEFAULT_RUNTIME_WORKFLOW: RuntimeWorkflowDefinition = DEFAULT_WORKFLOW_DEFINITION;\n\nexport const DEFAULT_RUNTIME_STATUS_DEFINITIONS: ReadonlyArray<RuntimeStatusDefinition> = DEFAULT_STATUS_DEFINITIONS;\n\nconst DEFAULT_RUNTIME_FIELD_COMMANDS: RuntimeFieldCommand[] = [\"create\", \"update\"];\n\nexport interface RuntimeStatusDefinitionResolved {\n id: string;\n aliases: string[];\n roles: RuntimeStatusRole[];\n description?: string;\n order: number;\n}\n\nexport interface RuntimeFieldDefinitionResolved {\n key: string;\n metadata_key: string;\n cli_flag: string;\n cli_aliases: string[];\n description?: string;\n type: RuntimeFieldType;\n commands: RuntimeFieldCommand[];\n repeatable: boolean;\n required: boolean;\n required_on_create: boolean;\n required_types: string[];\n allow_unset: boolean;\n}\n\nexport interface RuntimeStatusRegistry {\n definitions: RuntimeStatusDefinitionResolved[];\n by_id: Map<string, RuntimeStatusDefinitionResolved>;\n alias_to_id: Map<string, string>;\n terminal_statuses: Set<string>;\n terminal_done_statuses: Set<string>;\n terminal_canceled_statuses: Set<string>;\n active_statuses: Set<string>;\n blocked_statuses: Set<string>;\n draft_statuses: Set<string>;\n open_status: string;\n close_status: string;\n canceled_status: string;\n}\n\nexport interface RuntimeFieldRegistry {\n definitions: RuntimeFieldDefinitionResolved[];\n by_key: Map<string, RuntimeFieldDefinitionResolved>;\n by_cli_token: Map<string, RuntimeFieldDefinitionResolved>;\n command_to_fields: Map<RuntimeFieldCommand, RuntimeFieldDefinitionResolved[]>;\n}\n\nexport interface RuntimeSchemaFileBootstrapResult {\n created_paths: string[];\n}\n\nexport interface LoadedRuntimeSchemaSections {\n schema: RuntimeSchemaSettings;\n type_definitions_from_file: ItemTypeDefinition[] | undefined;\n warnings: string[];\n created_paths: string[];\n}\n\nconst RUNTIME_STATUS_ROLE_SET = new Set<string>(RUNTIME_STATUS_ROLE_VALUES);\nconst RUNTIME_FIELD_TYPE_SET = new Set<string>(RUNTIME_FIELD_TYPE_VALUES);\nconst RUNTIME_FIELD_COMMAND_SET = new Set<string>(RUNTIME_FIELD_COMMAND_VALUES);\nconst RUNTIME_UNKNOWN_FIELD_POLICY_SET = new Set<string>(RUNTIME_UNKNOWN_FIELD_POLICY_VALUES);\n\nfunction normalizeStringList(values: string[] | undefined): string[] {\n const candidates = Array.isArray(values) ? values : [];\n return [...new Set(candidates.map((value) => (typeof value === \"string\" ? value.trim() : \"\")).filter((value) => value.length > 0))]\n .sort((left, right) => left.localeCompare(right));\n}\n\nfunction normalizeStatusToken(value: unknown): string {\n return typeof value === \"string\" ? value.trim().toLowerCase().replaceAll(/[\\s-]+/g, \"_\") : \"\";\n}\n\nfunction normalizeStatusId(value: unknown): string | undefined {\n if (typeof value !== \"string\" || value.length === 0) {\n return undefined;\n }\n const normalized = normalizeStatusToken(value);\n return normalized.length > 0 ? normalized : undefined;\n}\n\nfunction stripFlagPrefix(value: string): string {\n return value.startsWith(\"--\") ? value.slice(2) : value;\n}\n\nfunction normalizeCliToken(value: unknown): string {\n return typeof value === \"string\" ? stripFlagPrefix(value.trim().toLowerCase().replaceAll(/[\\s_]+/g, \"-\")) : \"\";\n}\n\nfunction keyToDefaultCliFlag(value: string): string {\n return value.replaceAll(\"_\", \"-\");\n}\n\nfunction toCamelCase(input: string): string {\n const segments = input\n .replaceAll(/[^A-Za-z0-9]+/g, \" \")\n .trim()\n .split(/\\s+/)\n .filter((segment) => segment.length > 0)\n .map((segment) => segment.toLowerCase());\n if (segments.length === 0) {\n return input;\n }\n const [first, ...rest] = segments;\n return `${first}${rest.map((segment) => `${segment.slice(0, 1).toUpperCase()}${segment.slice(1)}`).join(\"\")}`;\n}\n\nfunction normalizeRuntimeStatusDefinition(\n definition: RuntimeStatusDefinition,\n fallbackOrder: number,\n): RuntimeStatusDefinitionResolved | null {\n const id = normalizeStatusId(definition.id);\n if (!id) {\n return null;\n }\n const aliases = normalizeStringList(definition.aliases).map((value) => normalizeStatusToken(value)).filter((value) => value !== id);\n const roles = normalizeStringList(definition.roles).filter((value): value is RuntimeStatusRole => RUNTIME_STATUS_ROLE_SET.has(value));\n const description = definition.description?.trim();\n const order = typeof definition.order === \"number\" && Number.isFinite(definition.order) ? definition.order : fallbackOrder;\n return {\n id,\n aliases,\n roles,\n description: description && description.length > 0 ? description : undefined,\n order,\n };\n}\n\nfunction normalizeRuntimeWorkflow(workflow: RuntimeWorkflowDefinition | undefined): RuntimeWorkflowDefinition {\n return {\n draft_status: normalizeStatusId(workflow?.draft_status),\n open_status: normalizeStatusId(workflow?.open_status),\n in_progress_status: normalizeStatusId(workflow?.in_progress_status),\n blocked_status: normalizeStatusId(workflow?.blocked_status),\n close_status: normalizeStatusId(workflow?.close_status),\n canceled_status: normalizeStatusId(workflow?.canceled_status),\n };\n}\n\nfunction normalizeRuntimeFieldDefinition(definition: RuntimeFieldDefinition): RuntimeFieldDefinitionResolved | null {\n const key = normalizeStatusToken(definition.key ?? \"\");\n if (!key) {\n return null;\n }\n const metadataKey = normalizeStatusToken(definition.metadata_key ?? definition.front_matter_key ?? key);\n const cliFlag = normalizeCliToken(definition.cli_flag ?? keyToDefaultCliFlag(key));\n if (!cliFlag) {\n return null;\n }\n const cliAliases = normalizeStringList(definition.cli_aliases)\n .map((value) => normalizeCliToken(value))\n .filter((value) => value.length > 0 && value !== cliFlag);\n const typeCandidate = typeof definition.type === \"string\" ? definition.type.trim().toLowerCase() : \"string\";\n const type = RUNTIME_FIELD_TYPE_SET.has(typeCandidate) ? (typeCandidate as RuntimeFieldType) : \"string\";\n const commands = (() => {\n const normalized = normalizeStringList(definition.commands).filter((value): value is RuntimeFieldCommand =>\n RUNTIME_FIELD_COMMAND_SET.has(value),\n );\n if (normalized.length > 0) {\n return normalized;\n }\n return [...DEFAULT_RUNTIME_FIELD_COMMANDS];\n })();\n const description = definition.description?.trim();\n const requiredTypes = normalizeStringList(definition.required_types);\n return {\n key,\n metadata_key: metadataKey,\n cli_flag: cliFlag,\n cli_aliases: cliAliases,\n description: description && description.length > 0 ? description : undefined,\n type,\n commands,\n repeatable: definition.repeatable === true || type === \"string_array\",\n required: definition.required === true,\n required_on_create: definition.required_on_create === true,\n required_types: requiredTypes,\n allow_unset: definition.allow_unset !== false,\n };\n}\n\nexport function normalizeRuntimeSchemaSettings(schema: Partial<RuntimeSchemaSettings> | undefined): RuntimeSchemaSettings {\n const files = {\n ...DEFAULT_RUNTIME_SCHEMA_FILE_PATHS,\n ...(schema?.files ?? {}),\n };\n const statusesSource = schema?.statuses && schema.statuses.length > 0 ? schema.statuses : DEFAULT_RUNTIME_STATUS_DEFINITIONS;\n const normalizedStatuses = (() => {\n const dedupedById = new Map<string, RuntimeStatusDefinitionResolved>();\n for (const [index, definition] of statusesSource.entries()) {\n const normalized = normalizeRuntimeStatusDefinition(definition, index);\n if (!normalized) {\n continue;\n }\n dedupedById.set(normalized.id, normalized);\n }\n const values = [...dedupedById.values()].sort((left, right) =>\n left.order === right.order ? left.id.localeCompare(right.id) : left.order - right.order,\n );\n if (values.length > 0) {\n return values;\n }\n return DEFAULT_RUNTIME_STATUS_DEFINITIONS.map((definition, index) =>\n normalizeRuntimeStatusDefinition(definition, index),\n ).filter((definition): definition is RuntimeStatusDefinitionResolved => definition !== null);\n })();\n const normalizedFields = (() => {\n const dedupedByKey = new Map<string, RuntimeFieldDefinitionResolved>();\n for (const definition of schema?.fields ?? []) {\n const normalized = normalizeRuntimeFieldDefinition(definition);\n if (!normalized) {\n continue;\n }\n dedupedByKey.set(normalized.key, normalized);\n }\n return [...dedupedByKey.values()].sort((left, right) => left.key.localeCompare(right.key));\n })();\n const unknownFieldPolicyCandidate =\n typeof schema?.unknown_field_policy === \"string\" ? schema.unknown_field_policy.trim().toLowerCase() : \"allow\";\n const unknownFieldPolicy = RUNTIME_UNKNOWN_FIELD_POLICY_SET.has(unknownFieldPolicyCandidate)\n ? unknownFieldPolicyCandidate\n : \"allow\";\n return {\n version: typeof schema?.version === \"number\" && Number.isFinite(schema.version) ? Math.floor(schema.version) : 1,\n files,\n statuses: normalizedStatuses.map((definition) => ({\n id: definition.id,\n aliases: definition.aliases.length > 0 ? [...definition.aliases] : undefined,\n roles: definition.roles.length > 0 ? [...definition.roles] : undefined,\n description: definition.description,\n order: definition.order,\n })),\n fields: normalizedFields.map((definition) => ({\n key: definition.key,\n metadata_key: definition.metadata_key !== definition.key ? definition.metadata_key : undefined,\n cli_flag: definition.cli_flag !== keyToDefaultCliFlag(definition.key) ? definition.cli_flag : undefined,\n cli_aliases: definition.cli_aliases.length > 0 ? [...definition.cli_aliases] : undefined,\n description: definition.description,\n type: definition.type,\n commands: [...definition.commands],\n repeatable: definition.repeatable === true ? true : undefined,\n required: definition.required === true ? true : undefined,\n required_on_create: definition.required_on_create === true ? true : undefined,\n required_types: definition.required_types.length > 0 ? [...definition.required_types] : undefined,\n allow_unset: definition.allow_unset === false ? false : undefined,\n })),\n workflow: {\n ...DEFAULT_RUNTIME_WORKFLOW,\n ...normalizeRuntimeWorkflow(schema?.workflow),\n },\n unknown_field_policy: unknownFieldPolicy as RuntimeSchemaSettings[\"unknown_field_policy\"],\n };\n}\n\nfunction serializeJson(value: unknown): string {\n return `${JSON.stringify(value, null, 2)}\\n`;\n}\n\nfunction buildTypesFileSeed(): unknown {\n return {\n definitions: [],\n };\n}\n\nfunction buildStatusesFileSeed(): unknown {\n return {\n statuses: DEFAULT_RUNTIME_STATUS_DEFINITIONS,\n };\n}\n\nfunction buildFieldsFileSeed(): unknown {\n return {\n fields: [],\n };\n}\n\nfunction buildWorkflowsFileSeed(): unknown {\n return {\n workflow: DEFAULT_RUNTIME_WORKFLOW,\n };\n}\n\nfunction parseOptionalJson(raw: string, warningKey: string, warnings: string[]): unknown | undefined {\n try {\n return JSON.parse(raw) as unknown;\n } catch {\n warnings.push(warningKey);\n return undefined;\n }\n}\n\nfunction readTypeDefinitionsFromSchemaFile(parsed: unknown): ItemTypeDefinition[] | undefined {\n if (Array.isArray(parsed)) {\n return parsed as ItemTypeDefinition[];\n }\n if (typeof parsed !== \"object\" || parsed === null) {\n return undefined;\n }\n const record = parsed as Record<string, unknown>;\n if (Array.isArray(record.definitions)) {\n return record.definitions as ItemTypeDefinition[];\n }\n if (typeof record.item_types === \"object\" && record.item_types !== null) {\n const itemTypesRecord = record.item_types as Record<string, unknown>;\n if (Array.isArray(itemTypesRecord.definitions)) {\n return itemTypesRecord.definitions as ItemTypeDefinition[];\n }\n }\n return undefined;\n}\n\nfunction readStatusesFromSchemaFile(parsed: unknown): RuntimeStatusDefinition[] | undefined {\n if (Array.isArray(parsed)) {\n return parsed as RuntimeStatusDefinition[];\n }\n if (typeof parsed !== \"object\" || parsed === null) {\n return undefined;\n }\n const record = parsed as Record<string, unknown>;\n if (Array.isArray(record.statuses)) {\n return record.statuses as RuntimeStatusDefinition[];\n }\n if (Array.isArray(record.definitions)) {\n return record.definitions as RuntimeStatusDefinition[];\n }\n return undefined;\n}\n\nfunction readFieldsFromSchemaFile(parsed: unknown): RuntimeFieldDefinition[] | undefined {\n if (Array.isArray(parsed)) {\n return parsed as RuntimeFieldDefinition[];\n }\n if (typeof parsed !== \"object\" || parsed === null) {\n return undefined;\n }\n const record = parsed as Record<string, unknown>;\n if (Array.isArray(record.fields)) {\n return record.fields as RuntimeFieldDefinition[];\n }\n if (Array.isArray(record.definitions)) {\n return record.definitions as RuntimeFieldDefinition[];\n }\n return undefined;\n}\n\nfunction readWorkflowFromSchemaFile(parsed: unknown): RuntimeWorkflowDefinition | undefined {\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n return undefined;\n }\n const record = parsed as Record<string, unknown>;\n if (typeof record.workflow === \"object\" && record.workflow !== null && !Array.isArray(record.workflow)) {\n return record.workflow as RuntimeWorkflowDefinition;\n }\n if (typeof record.workflows === \"object\" && record.workflows !== null && !Array.isArray(record.workflows)) {\n return record.workflows as RuntimeWorkflowDefinition;\n }\n return record as RuntimeWorkflowDefinition;\n}\n\nexport function filePathForSchemaSection(pmRoot: string, configuredPath: string | undefined, fallbackPath: string): string {\n const normalized = configuredPath?.trim() || fallbackPath;\n if (path.isAbsolute(normalized)) {\n return normalized;\n }\n return path.join(pmRoot, normalized);\n}\n\nexport async function ensureRuntimeSchemaFileScaffold(\n pmRoot: string,\n schema: RuntimeSchemaSettings,\n): Promise<RuntimeSchemaFileBootstrapResult> {\n const normalizedSchema = normalizeRuntimeSchemaSettings(schema);\n const specs: Array<{ path: string; seed: unknown }> = [\n {\n path: filePathForSchemaSection(pmRoot, normalizedSchema.files.types, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.types),\n seed: buildTypesFileSeed(),\n },\n {\n path: filePathForSchemaSection(pmRoot, normalizedSchema.files.statuses, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.statuses),\n seed: buildStatusesFileSeed(),\n },\n {\n path: filePathForSchemaSection(pmRoot, normalizedSchema.files.fields, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.fields),\n seed: buildFieldsFileSeed(),\n },\n {\n path: filePathForSchemaSection(pmRoot, normalizedSchema.files.workflows, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.workflows),\n seed: buildWorkflowsFileSeed(),\n },\n ];\n const createdPaths: string[] = [];\n for (const spec of specs) {\n if (await pathExists(spec.path)) {\n continue;\n }\n await writeFileAtomic(spec.path, serializeJson(spec.seed));\n createdPaths.push(spec.path);\n }\n return {\n created_paths: createdPaths,\n };\n}\n\nexport async function loadRuntimeSchemaFromOptionalFiles(\n pmRoot: string,\n schema: RuntimeSchemaSettings,\n): Promise<LoadedRuntimeSchemaSections> {\n const normalizedSchema = normalizeRuntimeSchemaSettings(schema);\n const warnings: string[] = [];\n const typeFilePath = filePathForSchemaSection(pmRoot, normalizedSchema.files.types, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.types);\n const statusFilePath = filePathForSchemaSection(\n pmRoot,\n normalizedSchema.files.statuses,\n DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.statuses,\n );\n const fieldsFilePath = filePathForSchemaSection(pmRoot, normalizedSchema.files.fields, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.fields);\n const workflowsFilePath = filePathForSchemaSection(\n pmRoot,\n normalizedSchema.files.workflows,\n DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.workflows,\n );\n\n const typeDefinitionsFromFile = (() => {\n return undefined as ItemTypeDefinition[] | undefined;\n })();\n let loadedTypeDefinitions = typeDefinitionsFromFile;\n let loadedStatuses: RuntimeStatusDefinition[] | undefined;\n let loadedFields: RuntimeFieldDefinition[] | undefined;\n let loadedWorkflow: RuntimeWorkflowDefinition | undefined;\n\n const readAndParse = async (targetPath: string, warningKey: string): Promise<unknown | undefined> => {\n const raw = await readFileIfExists(targetPath);\n if (raw === null) {\n return undefined;\n }\n return parseOptionalJson(raw, warningKey, warnings);\n };\n\n const parsedTypes = await readAndParse(typeFilePath, \"runtime_schema_types_invalid_json\");\n if (parsedTypes !== undefined) {\n loadedTypeDefinitions = readTypeDefinitionsFromSchemaFile(parsedTypes);\n if (loadedTypeDefinitions === undefined) {\n warnings.push(\"runtime_schema_types_invalid_shape\");\n }\n }\n\n const parsedStatuses = await readAndParse(statusFilePath, \"runtime_schema_statuses_invalid_json\");\n if (parsedStatuses !== undefined) {\n loadedStatuses = readStatusesFromSchemaFile(parsedStatuses);\n if (loadedStatuses === undefined) {\n warnings.push(\"runtime_schema_statuses_invalid_shape\");\n }\n }\n\n const parsedFields = await readAndParse(fieldsFilePath, \"runtime_schema_fields_invalid_json\");\n if (parsedFields !== undefined) {\n loadedFields = readFieldsFromSchemaFile(parsedFields);\n if (loadedFields === undefined) {\n warnings.push(\"runtime_schema_fields_invalid_shape\");\n }\n }\n\n const parsedWorkflow = await readAndParse(workflowsFilePath, \"runtime_schema_workflows_invalid_json\");\n if (parsedWorkflow !== undefined) {\n loadedWorkflow = readWorkflowFromSchemaFile(parsedWorkflow);\n if (loadedWorkflow === undefined) {\n warnings.push(\"runtime_schema_workflows_invalid_shape\");\n }\n }\n\n const mergedSchema = normalizeRuntimeSchemaSettings({\n ...normalizedSchema,\n statuses: [...normalizedSchema.statuses, ...(loadedStatuses ?? [])],\n fields: [...normalizedSchema.fields, ...(loadedFields ?? [])],\n workflow: {\n ...normalizedSchema.workflow,\n ...(loadedWorkflow ?? {}),\n },\n });\n\n return {\n schema: mergedSchema,\n type_definitions_from_file: loadedTypeDefinitions,\n warnings,\n created_paths: [],\n };\n}\n\nfunction preferredStatusForRole(\n definitions: RuntimeStatusDefinitionResolved[],\n role: RuntimeStatusRole,\n fallbackValues: string[],\n): string | undefined {\n const withRole = definitions.filter((definition) => definition.roles.includes(role));\n if (withRole.length > 0) {\n return withRole[0].id;\n }\n for (const value of fallbackValues) {\n const normalized = normalizeStatusId(value);\n if (!normalized) {\n continue;\n }\n if (definitions.some((definition) => definition.id === normalized)) {\n return normalized;\n }\n }\n return definitions[0]?.id;\n}\n\nexport function resolveRuntimeStatusRegistry(schema: RuntimeSchemaSettings): RuntimeStatusRegistry {\n const normalizedSchema = normalizeRuntimeSchemaSettings(schema);\n const definitions = normalizedSchema.statuses.map((definition, index) =>\n normalizeRuntimeStatusDefinition(definition, index),\n ).filter((definition): definition is RuntimeStatusDefinitionResolved => definition !== null);\n const aliasToId = new Map<string, string>();\n const byId = new Map<string, RuntimeStatusDefinitionResolved>();\n for (const definition of definitions) {\n byId.set(definition.id, definition);\n aliasToId.set(definition.id, definition.id);\n aliasToId.set(definition.id.replaceAll(\"_\", \"-\"), definition.id);\n aliasToId.set(definition.id.replaceAll(\"_\", \" \"), definition.id);\n for (const alias of definition.aliases) {\n aliasToId.set(alias, definition.id);\n aliasToId.set(alias.replaceAll(\"_\", \"-\"), definition.id);\n aliasToId.set(alias.replaceAll(\"_\", \" \"), definition.id);\n }\n }\n const terminalStatuses = new Set<string>();\n const terminalDoneStatuses = new Set<string>();\n const terminalCanceledStatuses = new Set<string>();\n const activeStatuses = new Set<string>();\n const blockedStatuses = new Set<string>();\n const draftStatuses = new Set<string>();\n for (const definition of definitions) {\n const roles = new Set(definition.roles);\n if (roles.has(\"terminal\") || roles.has(\"terminal_done\") || roles.has(\"terminal_canceled\")) {\n terminalStatuses.add(definition.id);\n }\n if (roles.has(\"terminal_done\")) {\n terminalDoneStatuses.add(definition.id);\n }\n if (roles.has(\"terminal_canceled\")) {\n terminalCanceledStatuses.add(definition.id);\n }\n if (roles.has(\"active\")) {\n activeStatuses.add(definition.id);\n }\n if (roles.has(\"blocked\")) {\n blockedStatuses.add(definition.id);\n }\n if (roles.has(\"draft\")) {\n draftStatuses.add(definition.id);\n }\n }\n const workflow = normalizedSchema.workflow;\n const openStatus =\n normalizeStatusId(workflow.open_status) ??\n preferredStatusForRole(definitions, \"default_open\", [\"open\", \"in_progress\", STATUS_VALUES[0] ?? \"open\"]);\n const closeStatus =\n normalizeStatusId(workflow.close_status) ??\n preferredStatusForRole(definitions, \"default_close\", [\"closed\", \"done\", \"complete\"]);\n const canceledStatus =\n normalizeStatusId(workflow.canceled_status) ??\n preferredStatusForRole(definitions, \"default_cancel\", [\"canceled\", \"cancelled\"]);\n\n return {\n definitions,\n by_id: byId,\n alias_to_id: aliasToId,\n terminal_statuses: terminalStatuses,\n terminal_done_statuses: terminalDoneStatuses,\n terminal_canceled_statuses: terminalCanceledStatuses,\n active_statuses: activeStatuses,\n blocked_statuses: blockedStatuses,\n draft_statuses: draftStatuses,\n open_status: openStatus ?? definitions[0]?.id ?? \"open\",\n close_status: closeStatus ?? definitions[0]?.id ?? \"closed\",\n canceled_status: canceledStatus ?? definitions[0]?.id ?? \"canceled\",\n };\n}\n\nexport function normalizeStatusInputWithRegistry(value: unknown, registry: RuntimeStatusRegistry): string | undefined {\n const normalized = normalizeStatusToken(value);\n if (!normalized) {\n return undefined;\n }\n return registry.alias_to_id.get(normalized);\n}\n\nexport function resolveRuntimeFieldRegistry(schema: RuntimeSchemaSettings): RuntimeFieldRegistry {\n const normalizedSchema = normalizeRuntimeSchemaSettings(schema);\n const dedupedByKey = new Map<string, RuntimeFieldDefinitionResolved>();\n for (const definition of normalizedSchema.fields) {\n const normalized = normalizeRuntimeFieldDefinition(definition);\n if (!normalized) {\n continue;\n }\n dedupedByKey.set(normalized.key, normalized);\n }\n const definitions = [...dedupedByKey.values()].sort((left, right) => left.key.localeCompare(right.key));\n const byKey = new Map<string, RuntimeFieldDefinitionResolved>();\n const byCliToken = new Map<string, RuntimeFieldDefinitionResolved>();\n const commandToFields = new Map<RuntimeFieldCommand, RuntimeFieldDefinitionResolved[]>();\n for (const definition of definitions) {\n byKey.set(definition.key, definition);\n byCliToken.set(definition.cli_flag, definition);\n for (const alias of definition.cli_aliases) {\n byCliToken.set(alias, definition);\n }\n for (const command of definition.commands) {\n const existing = commandToFields.get(command) ?? [];\n existing.push(definition);\n commandToFields.set(command, existing);\n }\n }\n for (const [command, fieldDefinitions] of commandToFields.entries()) {\n fieldDefinitions.sort((left, right) => left.key.localeCompare(right.key));\n commandToFields.set(command, fieldDefinitions);\n }\n return {\n definitions,\n by_key: byKey,\n by_cli_token: byCliToken,\n command_to_fields: commandToFields,\n };\n}\n\nexport function runtimeFieldOptionTarget(field: RuntimeFieldDefinitionResolved): string {\n return toCamelCase(field.key);\n}\n\nexport function statusIsTerminal(status: string, registry: RuntimeStatusRegistry): boolean {\n const normalized = normalizeStatusInputWithRegistry(status, registry);\n if (!normalized) {\n return false;\n }\n return registry.terminal_statuses.has(normalized);\n}\n"],"names":[],"mappings":";;AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EACL,4BAA4B,EAC5B,yBAAyB,EACzB,0BAA0B,EAC1B,mCAAmC,EACnC,aAAa,GACd,MAAM,sBAAsB,CAAC;AAc9B,MAAM,CAAC,MAAM,iCAAiC,GAAG,MAAM,CAAC,MAAM,CAAC;IAC7D,KAAK,EAAE,mBAAmB;IAC1B,QAAQ,EAAE,sBAAsB;IAChC,MAAM,EAAE,oBAAoB;IAC5B,SAAS,EAAE,uBAAuB;CACnC,CAAC,CAAC;AAEH,mEAAmE;AACnE,8EAA8E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E,MAAM,UAAU,GAAG,gCAAgC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACtE,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,QAAQ,CAAC,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AACpD,CAAC","debugId":"f8b9437a-034b-5c44-917c-72eb805b32ac"}
1
+ {"version":3,"file":"runtime-schema.js","sources":["core/schema/runtime-schema.ts"],"sourceRoot":"/","sourcesContent":["import path from \"node:path\";\nimport { pathExists, readFileIfExists, writeFileAtomic } from \"../fs/fs-utils.js\";\nimport { DEFAULT_STATUS_DEFINITIONS, DEFAULT_WORKFLOW_DEFINITION } from \"../shared/constants.js\";\nimport {\n RUNTIME_FIELD_COMMAND_VALUES,\n RUNTIME_FIELD_TYPE_VALUES,\n RUNTIME_STATUS_ROLE_VALUES,\n RUNTIME_UNKNOWN_FIELD_POLICY_VALUES,\n STATUS_VALUES,\n} from \"../../types/index.js\";\nimport type {\n ItemTypeDefinition,\n RuntimeFieldCommand,\n RuntimeFieldDefinition,\n RuntimeFieldType,\n RuntimeSchemaSettings,\n RuntimeStatusDefinition,\n RuntimeStatusRole,\n RuntimeWorkflowDefinition,\n TypeWorkflowDefinition,\n} from \"../../types/index.js\";\n\nexport type { RuntimeFieldCommand } from \"../../types/index.js\";\n\nexport const DEFAULT_RUNTIME_SCHEMA_FILE_PATHS = Object.freeze({\n types: \"schema/types.json\",\n statuses: \"schema/statuses.json\",\n fields: \"schema/fields.json\",\n workflows: \"schema/workflows.json\",\n});\n\n// Default lifecycle status model and workflow role mapping live in\n// src/core/shared/constants.ts as the single source of truth (also referenced\n// by SETTINGS_DEFAULTS). Re-exported here under the historical names.\nexport const DEFAULT_RUNTIME_WORKFLOW: RuntimeWorkflowDefinition = DEFAULT_WORKFLOW_DEFINITION;\n\nexport const DEFAULT_RUNTIME_STATUS_DEFINITIONS: ReadonlyArray<RuntimeStatusDefinition> = DEFAULT_STATUS_DEFINITIONS;\n\nconst DEFAULT_RUNTIME_FIELD_COMMANDS: RuntimeFieldCommand[] = [\"create\", \"update\"];\n\nexport interface RuntimeStatusDefinitionResolved {\n id: string;\n aliases: string[];\n roles: RuntimeStatusRole[];\n description?: string;\n order: number;\n}\n\nexport interface RuntimeFieldDefinitionResolved {\n key: string;\n metadata_key: string;\n cli_flag: string;\n cli_aliases: string[];\n description?: string;\n type: RuntimeFieldType;\n commands: RuntimeFieldCommand[];\n repeatable: boolean;\n required: boolean;\n required_on_create: boolean;\n required_types: string[];\n allow_unset: boolean;\n}\n\nexport interface RuntimeStatusRegistry {\n definitions: RuntimeStatusDefinitionResolved[];\n by_id: Map<string, RuntimeStatusDefinitionResolved>;\n alias_to_id: Map<string, string>;\n terminal_statuses: Set<string>;\n terminal_done_statuses: Set<string>;\n terminal_canceled_statuses: Set<string>;\n active_statuses: Set<string>;\n blocked_statuses: Set<string>;\n draft_statuses: Set<string>;\n open_status: string;\n close_status: string;\n canceled_status: string;\n}\n\nexport interface RuntimeFieldRegistry {\n definitions: RuntimeFieldDefinitionResolved[];\n by_key: Map<string, RuntimeFieldDefinitionResolved>;\n by_cli_token: Map<string, RuntimeFieldDefinitionResolved>;\n command_to_fields: Map<RuntimeFieldCommand, RuntimeFieldDefinitionResolved[]>;\n}\n\nexport interface RuntimeSchemaFileBootstrapResult {\n created_paths: string[];\n}\n\nexport interface LoadedRuntimeSchemaSections {\n schema: RuntimeSchemaSettings;\n type_definitions_from_file: ItemTypeDefinition[] | undefined;\n warnings: string[];\n created_paths: string[];\n}\n\nconst RUNTIME_STATUS_ROLE_SET = new Set<string>(RUNTIME_STATUS_ROLE_VALUES);\nconst RUNTIME_FIELD_TYPE_SET = new Set<string>(RUNTIME_FIELD_TYPE_VALUES);\nconst RUNTIME_FIELD_COMMAND_SET = new Set<string>(RUNTIME_FIELD_COMMAND_VALUES);\nconst RUNTIME_UNKNOWN_FIELD_POLICY_SET = new Set<string>(RUNTIME_UNKNOWN_FIELD_POLICY_VALUES);\n\nfunction normalizeStringList(values: string[] | undefined): string[] {\n const candidates = Array.isArray(values) ? values : [];\n return [...new Set(candidates.map((value) => (typeof value === \"string\" ? value.trim() : \"\")).filter((value) => value.length > 0))]\n .sort((left, right) => left.localeCompare(right));\n}\n\nfunction normalizeStatusToken(value: unknown): string {\n return typeof value === \"string\" ? value.trim().toLowerCase().replaceAll(/[\\s-]+/g, \"_\") : \"\";\n}\n\nfunction normalizeStatusId(value: unknown): string | undefined {\n if (typeof value !== \"string\" || value.length === 0) {\n return undefined;\n }\n const normalized = normalizeStatusToken(value);\n return normalized.length > 0 ? normalized : undefined;\n}\n\nfunction stripFlagPrefix(value: string): string {\n return value.startsWith(\"--\") ? value.slice(2) : value;\n}\n\nfunction normalizeCliToken(value: unknown): string {\n return typeof value === \"string\" ? stripFlagPrefix(value.trim().toLowerCase().replaceAll(/[\\s_]+/g, \"-\")) : \"\";\n}\n\nfunction keyToDefaultCliFlag(value: string): string {\n return value.replaceAll(\"_\", \"-\");\n}\n\nfunction toCamelCase(input: string): string {\n const segments = input\n .replaceAll(/[^A-Za-z0-9]+/g, \" \")\n .trim()\n .split(/\\s+/)\n .filter((segment) => segment.length > 0)\n .map((segment) => segment.toLowerCase());\n if (segments.length === 0) {\n return input;\n }\n const [first, ...rest] = segments;\n return `${first}${rest.map((segment) => `${segment.slice(0, 1).toUpperCase()}${segment.slice(1)}`).join(\"\")}`;\n}\n\nfunction normalizeRuntimeStatusDefinition(\n definition: RuntimeStatusDefinition,\n fallbackOrder: number,\n): RuntimeStatusDefinitionResolved | null {\n const id = normalizeStatusId(definition.id);\n if (!id) {\n return null;\n }\n const aliases = normalizeStringList(definition.aliases).map((value) => normalizeStatusToken(value)).filter((value) => value !== id);\n const roles = normalizeStringList(definition.roles).filter((value): value is RuntimeStatusRole => RUNTIME_STATUS_ROLE_SET.has(value));\n const description = definition.description?.trim();\n const order = typeof definition.order === \"number\" && Number.isFinite(definition.order) ? definition.order : fallbackOrder;\n return {\n id,\n aliases,\n roles,\n description: description && description.length > 0 ? description : undefined,\n order,\n };\n}\n\nfunction normalizeRuntimeWorkflow(workflow: RuntimeWorkflowDefinition | undefined): RuntimeWorkflowDefinition {\n return {\n draft_status: normalizeStatusId(workflow?.draft_status),\n open_status: normalizeStatusId(workflow?.open_status),\n in_progress_status: normalizeStatusId(workflow?.in_progress_status),\n blocked_status: normalizeStatusId(workflow?.blocked_status),\n close_status: normalizeStatusId(workflow?.close_status),\n canceled_status: normalizeStatusId(workflow?.canceled_status),\n };\n}\n\nfunction normalizeTypeWorkflowDefinitions(\n workflows: TypeWorkflowDefinition[] | undefined,\n): TypeWorkflowDefinition[] | undefined {\n if (!Array.isArray(workflows) || workflows.length === 0) {\n return undefined;\n }\n // Keep the raw (trimmed) type name so it round-trips verbatim; comparison is\n // case-insensitive downstream (resolveTypeWorkflows lower-cases). from/to\n // status tokens use the same normalization rules as runtime statuses.\n //\n // An EXPLICIT empty `allowed_transitions: []` is a deliberate DENY-ALL rule and\n // MUST survive normalization (it must NOT collapse to \"no entry\", which would\n // leave the type unrestricted). But a NON-empty array whose every pair is\n // malformed (e.g. a 3-element tuple typo) must be DROPPED like other malformed\n // schema-file content, NOT silently turned into a deny-all rule — otherwise a\n // typo would start failing every update for that type under strict enforcement.\n const byTypeKey = new Map<string, { type: string; pairs: [string, string][]; denyAll: boolean }>();\n for (const entry of workflows) {\n const rawType = typeof entry?.type === \"string\" ? entry.type.trim() : \"\";\n if (rawType.length === 0) {\n continue;\n }\n if (!Array.isArray(entry?.allowed_transitions)) {\n continue;\n }\n const typeKey = rawType.toLowerCase();\n const pairs = entry.allowed_transitions;\n const record = byTypeKey.get(typeKey) ?? { type: rawType, pairs: [], denyAll: false };\n // Only an explicitly empty array signals an intentional deny-all.\n if (pairs.length === 0) {\n record.denyAll = true;\n }\n for (const pair of pairs) {\n if (!Array.isArray(pair) || pair.length !== 2) {\n continue;\n }\n const from = normalizeStatusToken(pair[0]);\n const to = normalizeStatusToken(pair[1]);\n if (from.length === 0 || to.length === 0) {\n continue;\n }\n if (record.pairs.some((candidate) => candidate[0] === from && candidate[1] === to)) {\n continue;\n }\n record.pairs.push([from, to]);\n }\n byTypeKey.set(typeKey, record);\n }\n const normalized: TypeWorkflowDefinition[] = [];\n for (const record of byTypeKey.values()) {\n // Keep when there is at least one valid transition OR an explicit deny-all was\n // declared; drop nonempty-but-all-malformed entries (treated as typos).\n if (record.pairs.length > 0 || record.denyAll) {\n normalized.push({ type: record.type, allowed_transitions: record.pairs });\n }\n }\n normalized.sort((left, right) => left.type.localeCompare(right.type));\n return normalized.length > 0 ? normalized : undefined;\n}\n\nfunction normalizeRuntimeFieldDefinition(definition: RuntimeFieldDefinition): RuntimeFieldDefinitionResolved | null {\n const key = normalizeStatusToken(definition.key ?? \"\");\n if (!key) {\n return null;\n }\n const metadataKey = normalizeStatusToken(definition.metadata_key ?? definition.front_matter_key ?? key);\n const cliFlag = normalizeCliToken(definition.cli_flag ?? keyToDefaultCliFlag(key));\n if (!cliFlag) {\n return null;\n }\n const cliAliases = normalizeStringList(definition.cli_aliases)\n .map((value) => normalizeCliToken(value))\n .filter((value) => value.length > 0 && value !== cliFlag);\n const typeCandidate = typeof definition.type === \"string\" ? definition.type.trim().toLowerCase() : \"string\";\n const type = RUNTIME_FIELD_TYPE_SET.has(typeCandidate) ? (typeCandidate as RuntimeFieldType) : \"string\";\n const commands = (() => {\n const normalized = normalizeStringList(definition.commands).filter((value): value is RuntimeFieldCommand =>\n RUNTIME_FIELD_COMMAND_SET.has(value),\n );\n if (normalized.length > 0) {\n return normalized;\n }\n return [...DEFAULT_RUNTIME_FIELD_COMMANDS];\n })();\n const description = definition.description?.trim();\n const requiredTypes = normalizeStringList(definition.required_types);\n return {\n key,\n metadata_key: metadataKey,\n cli_flag: cliFlag,\n cli_aliases: cliAliases,\n description: description && description.length > 0 ? description : undefined,\n type,\n commands,\n repeatable: definition.repeatable === true || type === \"string_array\",\n required: definition.required === true,\n required_on_create: definition.required_on_create === true,\n required_types: requiredTypes,\n allow_unset: definition.allow_unset !== false,\n };\n}\n\nexport function normalizeRuntimeSchemaSettings(schema: Partial<RuntimeSchemaSettings> | undefined): RuntimeSchemaSettings {\n const files = {\n ...DEFAULT_RUNTIME_SCHEMA_FILE_PATHS,\n ...(schema?.files ?? {}),\n };\n const statusesSource = schema?.statuses && schema.statuses.length > 0 ? schema.statuses : DEFAULT_RUNTIME_STATUS_DEFINITIONS;\n const normalizedStatuses = (() => {\n const dedupedById = new Map<string, RuntimeStatusDefinitionResolved>();\n for (const [index, definition] of statusesSource.entries()) {\n const normalized = normalizeRuntimeStatusDefinition(definition, index);\n if (!normalized) {\n continue;\n }\n dedupedById.set(normalized.id, normalized);\n }\n const values = [...dedupedById.values()].sort((left, right) =>\n left.order === right.order ? left.id.localeCompare(right.id) : left.order - right.order,\n );\n if (values.length > 0) {\n return values;\n }\n return DEFAULT_RUNTIME_STATUS_DEFINITIONS.map((definition, index) =>\n normalizeRuntimeStatusDefinition(definition, index),\n ).filter((definition): definition is RuntimeStatusDefinitionResolved => definition !== null);\n })();\n const normalizedFields = (() => {\n const dedupedByKey = new Map<string, RuntimeFieldDefinitionResolved>();\n for (const definition of schema?.fields ?? []) {\n const normalized = normalizeRuntimeFieldDefinition(definition);\n if (!normalized) {\n continue;\n }\n dedupedByKey.set(normalized.key, normalized);\n }\n return [...dedupedByKey.values()].sort((left, right) => left.key.localeCompare(right.key));\n })();\n const unknownFieldPolicyCandidate =\n typeof schema?.unknown_field_policy === \"string\" ? schema.unknown_field_policy.trim().toLowerCase() : \"allow\";\n const unknownFieldPolicy = RUNTIME_UNKNOWN_FIELD_POLICY_SET.has(unknownFieldPolicyCandidate)\n ? unknownFieldPolicyCandidate\n : \"allow\";\n return {\n version: typeof schema?.version === \"number\" && Number.isFinite(schema.version) ? Math.floor(schema.version) : 1,\n files,\n statuses: normalizedStatuses.map((definition) => ({\n id: definition.id,\n aliases: definition.aliases.length > 0 ? [...definition.aliases] : undefined,\n roles: definition.roles.length > 0 ? [...definition.roles] : undefined,\n description: definition.description,\n order: definition.order,\n })),\n fields: normalizedFields.map((definition) => ({\n key: definition.key,\n metadata_key: definition.metadata_key !== definition.key ? definition.metadata_key : undefined,\n cli_flag: definition.cli_flag !== keyToDefaultCliFlag(definition.key) ? definition.cli_flag : undefined,\n cli_aliases: definition.cli_aliases.length > 0 ? [...definition.cli_aliases] : undefined,\n description: definition.description,\n type: definition.type,\n commands: [...definition.commands],\n repeatable: definition.repeatable === true ? true : undefined,\n required: definition.required === true ? true : undefined,\n required_on_create: definition.required_on_create === true ? true : undefined,\n required_types: definition.required_types.length > 0 ? [...definition.required_types] : undefined,\n allow_unset: definition.allow_unset === false ? false : undefined,\n })),\n workflow: {\n ...DEFAULT_RUNTIME_WORKFLOW,\n ...normalizeRuntimeWorkflow(schema?.workflow),\n },\n type_workflows: normalizeTypeWorkflowDefinitions(schema?.type_workflows),\n unknown_field_policy: unknownFieldPolicy as RuntimeSchemaSettings[\"unknown_field_policy\"],\n };\n}\n\nfunction serializeJson(value: unknown): string {\n return `${JSON.stringify(value, null, 2)}\\n`;\n}\n\nfunction buildTypesFileSeed(): unknown {\n return {\n definitions: [],\n };\n}\n\nfunction buildStatusesFileSeed(): unknown {\n return {\n statuses: DEFAULT_RUNTIME_STATUS_DEFINITIONS,\n };\n}\n\nfunction buildFieldsFileSeed(): unknown {\n return {\n fields: [],\n };\n}\n\nfunction buildWorkflowsFileSeed(): unknown {\n return {\n workflow: DEFAULT_RUNTIME_WORKFLOW,\n };\n}\n\nfunction parseOptionalJson(raw: string, warningKey: string, warnings: string[]): unknown | undefined {\n try {\n return JSON.parse(raw) as unknown;\n } catch {\n warnings.push(warningKey);\n return undefined;\n }\n}\n\nfunction readTypeDefinitionsFromSchemaFile(parsed: unknown): ItemTypeDefinition[] | undefined {\n if (Array.isArray(parsed)) {\n return parsed as ItemTypeDefinition[];\n }\n if (typeof parsed !== \"object\" || parsed === null) {\n return undefined;\n }\n const record = parsed as Record<string, unknown>;\n if (Array.isArray(record.definitions)) {\n return record.definitions as ItemTypeDefinition[];\n }\n if (typeof record.item_types === \"object\" && record.item_types !== null) {\n const itemTypesRecord = record.item_types as Record<string, unknown>;\n if (Array.isArray(itemTypesRecord.definitions)) {\n return itemTypesRecord.definitions as ItemTypeDefinition[];\n }\n }\n return undefined;\n}\n\nfunction readStatusesFromSchemaFile(parsed: unknown): RuntimeStatusDefinition[] | undefined {\n if (Array.isArray(parsed)) {\n return parsed as RuntimeStatusDefinition[];\n }\n if (typeof parsed !== \"object\" || parsed === null) {\n return undefined;\n }\n const record = parsed as Record<string, unknown>;\n if (Array.isArray(record.statuses)) {\n return record.statuses as RuntimeStatusDefinition[];\n }\n if (Array.isArray(record.definitions)) {\n return record.definitions as RuntimeStatusDefinition[];\n }\n return undefined;\n}\n\nfunction readFieldsFromSchemaFile(parsed: unknown): RuntimeFieldDefinition[] | undefined {\n if (Array.isArray(parsed)) {\n return parsed as RuntimeFieldDefinition[];\n }\n if (typeof parsed !== \"object\" || parsed === null) {\n return undefined;\n }\n const record = parsed as Record<string, unknown>;\n if (Array.isArray(record.fields)) {\n return record.fields as RuntimeFieldDefinition[];\n }\n if (Array.isArray(record.definitions)) {\n return record.definitions as RuntimeFieldDefinition[];\n }\n return undefined;\n}\n\nfunction readWorkflowFromSchemaFile(parsed: unknown): RuntimeWorkflowDefinition | undefined {\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n return undefined;\n }\n const record = parsed as Record<string, unknown>;\n if (typeof record.workflow === \"object\" && record.workflow !== null && !Array.isArray(record.workflow)) {\n return record.workflow as RuntimeWorkflowDefinition;\n }\n if (typeof record.workflows === \"object\" && record.workflows !== null && !Array.isArray(record.workflows)) {\n return record.workflows as RuntimeWorkflowDefinition;\n }\n return record as RuntimeWorkflowDefinition;\n}\n\nfunction readTypeWorkflowsFromSchemaFile(parsed: unknown): TypeWorkflowDefinition[] | undefined {\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n return undefined;\n }\n const record = parsed as Record<string, unknown>;\n if (Array.isArray(record.type_workflows)) {\n return record.type_workflows as TypeWorkflowDefinition[];\n }\n return undefined;\n}\n\nexport function filePathForSchemaSection(pmRoot: string, configuredPath: string | undefined, fallbackPath: string): string {\n const normalized = configuredPath?.trim() || fallbackPath;\n if (path.isAbsolute(normalized)) {\n return normalized;\n }\n return path.join(pmRoot, normalized);\n}\n\nexport async function ensureRuntimeSchemaFileScaffold(\n pmRoot: string,\n schema: RuntimeSchemaSettings,\n): Promise<RuntimeSchemaFileBootstrapResult> {\n const normalizedSchema = normalizeRuntimeSchemaSettings(schema);\n const specs: Array<{ path: string; seed: unknown }> = [\n {\n path: filePathForSchemaSection(pmRoot, normalizedSchema.files.types, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.types),\n seed: buildTypesFileSeed(),\n },\n {\n path: filePathForSchemaSection(pmRoot, normalizedSchema.files.statuses, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.statuses),\n seed: buildStatusesFileSeed(),\n },\n {\n path: filePathForSchemaSection(pmRoot, normalizedSchema.files.fields, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.fields),\n seed: buildFieldsFileSeed(),\n },\n {\n path: filePathForSchemaSection(pmRoot, normalizedSchema.files.workflows, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.workflows),\n seed: buildWorkflowsFileSeed(),\n },\n ];\n const createdPaths: string[] = [];\n for (const spec of specs) {\n if (await pathExists(spec.path)) {\n continue;\n }\n await writeFileAtomic(spec.path, serializeJson(spec.seed));\n createdPaths.push(spec.path);\n }\n return {\n created_paths: createdPaths,\n };\n}\n\nexport async function loadRuntimeSchemaFromOptionalFiles(\n pmRoot: string,\n schema: RuntimeSchemaSettings,\n): Promise<LoadedRuntimeSchemaSections> {\n const normalizedSchema = normalizeRuntimeSchemaSettings(schema);\n const warnings: string[] = [];\n const typeFilePath = filePathForSchemaSection(pmRoot, normalizedSchema.files.types, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.types);\n const statusFilePath = filePathForSchemaSection(\n pmRoot,\n normalizedSchema.files.statuses,\n DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.statuses,\n );\n const fieldsFilePath = filePathForSchemaSection(pmRoot, normalizedSchema.files.fields, DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.fields);\n const workflowsFilePath = filePathForSchemaSection(\n pmRoot,\n normalizedSchema.files.workflows,\n DEFAULT_RUNTIME_SCHEMA_FILE_PATHS.workflows,\n );\n\n const typeDefinitionsFromFile = (() => {\n return undefined as ItemTypeDefinition[] | undefined;\n })();\n let loadedTypeDefinitions = typeDefinitionsFromFile;\n let loadedStatuses: RuntimeStatusDefinition[] | undefined;\n let loadedFields: RuntimeFieldDefinition[] | undefined;\n let loadedWorkflow: RuntimeWorkflowDefinition | undefined;\n let loadedTypeWorkflows: TypeWorkflowDefinition[] | undefined;\n\n const readAndParse = async (targetPath: string, warningKey: string): Promise<unknown | undefined> => {\n const raw = await readFileIfExists(targetPath);\n if (raw === null) {\n return undefined;\n }\n return parseOptionalJson(raw, warningKey, warnings);\n };\n\n const parsedTypes = await readAndParse(typeFilePath, \"runtime_schema_types_invalid_json\");\n if (parsedTypes !== undefined) {\n loadedTypeDefinitions = readTypeDefinitionsFromSchemaFile(parsedTypes);\n if (loadedTypeDefinitions === undefined) {\n warnings.push(\"runtime_schema_types_invalid_shape\");\n }\n }\n\n const parsedStatuses = await readAndParse(statusFilePath, \"runtime_schema_statuses_invalid_json\");\n if (parsedStatuses !== undefined) {\n loadedStatuses = readStatusesFromSchemaFile(parsedStatuses);\n if (loadedStatuses === undefined) {\n warnings.push(\"runtime_schema_statuses_invalid_shape\");\n }\n }\n\n const parsedFields = await readAndParse(fieldsFilePath, \"runtime_schema_fields_invalid_json\");\n if (parsedFields !== undefined) {\n loadedFields = readFieldsFromSchemaFile(parsedFields);\n if (loadedFields === undefined) {\n warnings.push(\"runtime_schema_fields_invalid_shape\");\n }\n }\n\n const parsedWorkflow = await readAndParse(workflowsFilePath, \"runtime_schema_workflows_invalid_json\");\n if (parsedWorkflow !== undefined) {\n loadedWorkflow = readWorkflowFromSchemaFile(parsedWorkflow);\n if (loadedWorkflow === undefined) {\n warnings.push(\"runtime_schema_workflows_invalid_shape\");\n }\n // type_workflows live alongside `workflow` in the same file; their absence\n // is not an error (the file may carry only the lifecycle workflow block).\n loadedTypeWorkflows = readTypeWorkflowsFromSchemaFile(parsedWorkflow);\n }\n\n const mergedSchema = normalizeRuntimeSchemaSettings({\n ...normalizedSchema,\n statuses: [...normalizedSchema.statuses, ...(loadedStatuses ?? [])],\n fields: [...normalizedSchema.fields, ...(loadedFields ?? [])],\n workflow: {\n ...normalizedSchema.workflow,\n ...(loadedWorkflow ?? {}),\n },\n type_workflows: [...(normalizedSchema.type_workflows ?? []), ...(loadedTypeWorkflows ?? [])],\n });\n\n return {\n schema: mergedSchema,\n type_definitions_from_file: loadedTypeDefinitions,\n warnings,\n created_paths: [],\n };\n}\n\nfunction preferredStatusForRole(\n definitions: RuntimeStatusDefinitionResolved[],\n role: RuntimeStatusRole,\n fallbackValues: string[],\n): string | undefined {\n const withRole = definitions.filter((definition) => definition.roles.includes(role));\n if (withRole.length > 0) {\n return withRole[0].id;\n }\n for (const value of fallbackValues) {\n const normalized = normalizeStatusId(value);\n if (!normalized) {\n continue;\n }\n if (definitions.some((definition) => definition.id === normalized)) {\n return normalized;\n }\n }\n return definitions[0]?.id;\n}\n\nexport function resolveRuntimeStatusRegistry(schema: RuntimeSchemaSettings): RuntimeStatusRegistry {\n const normalizedSchema = normalizeRuntimeSchemaSettings(schema);\n const definitions = normalizedSchema.statuses.map((definition, index) =>\n normalizeRuntimeStatusDefinition(definition, index),\n ).filter((definition): definition is RuntimeStatusDefinitionResolved => definition !== null);\n const aliasToId = new Map<string, string>();\n const byId = new Map<string, RuntimeStatusDefinitionResolved>();\n for (const definition of definitions) {\n byId.set(definition.id, definition);\n aliasToId.set(definition.id, definition.id);\n aliasToId.set(definition.id.replaceAll(\"_\", \"-\"), definition.id);\n aliasToId.set(definition.id.replaceAll(\"_\", \" \"), definition.id);\n for (const alias of definition.aliases) {\n aliasToId.set(alias, definition.id);\n aliasToId.set(alias.replaceAll(\"_\", \"-\"), definition.id);\n aliasToId.set(alias.replaceAll(\"_\", \" \"), definition.id);\n }\n }\n const terminalStatuses = new Set<string>();\n const terminalDoneStatuses = new Set<string>();\n const terminalCanceledStatuses = new Set<string>();\n const activeStatuses = new Set<string>();\n const blockedStatuses = new Set<string>();\n const draftStatuses = new Set<string>();\n for (const definition of definitions) {\n const roles = new Set(definition.roles);\n if (roles.has(\"terminal\") || roles.has(\"terminal_done\") || roles.has(\"terminal_canceled\")) {\n terminalStatuses.add(definition.id);\n }\n if (roles.has(\"terminal_done\")) {\n terminalDoneStatuses.add(definition.id);\n }\n if (roles.has(\"terminal_canceled\")) {\n terminalCanceledStatuses.add(definition.id);\n }\n if (roles.has(\"active\")) {\n activeStatuses.add(definition.id);\n }\n if (roles.has(\"blocked\")) {\n blockedStatuses.add(definition.id);\n }\n if (roles.has(\"draft\")) {\n draftStatuses.add(definition.id);\n }\n }\n const workflow = normalizedSchema.workflow;\n const openStatus =\n normalizeStatusId(workflow.open_status) ??\n preferredStatusForRole(definitions, \"default_open\", [\"open\", \"in_progress\", STATUS_VALUES[0] ?? \"open\"]);\n const closeStatus =\n normalizeStatusId(workflow.close_status) ??\n preferredStatusForRole(definitions, \"default_close\", [\"closed\", \"done\", \"complete\"]);\n const canceledStatus =\n normalizeStatusId(workflow.canceled_status) ??\n preferredStatusForRole(definitions, \"default_cancel\", [\"canceled\", \"cancelled\"]);\n\n return {\n definitions,\n by_id: byId,\n alias_to_id: aliasToId,\n terminal_statuses: terminalStatuses,\n terminal_done_statuses: terminalDoneStatuses,\n terminal_canceled_statuses: terminalCanceledStatuses,\n active_statuses: activeStatuses,\n blocked_statuses: blockedStatuses,\n draft_statuses: draftStatuses,\n open_status: openStatus ?? definitions[0]?.id ?? \"open\",\n close_status: closeStatus ?? definitions[0]?.id ?? \"closed\",\n canceled_status: canceledStatus ?? definitions[0]?.id ?? \"canceled\",\n };\n}\n\nexport function normalizeStatusInputWithRegistry(value: unknown, registry: RuntimeStatusRegistry): string | undefined {\n const normalized = normalizeStatusToken(value);\n if (!normalized) {\n return undefined;\n }\n return registry.alias_to_id.get(normalized);\n}\n\nexport function resolveRuntimeFieldRegistry(schema: RuntimeSchemaSettings): RuntimeFieldRegistry {\n const normalizedSchema = normalizeRuntimeSchemaSettings(schema);\n const dedupedByKey = new Map<string, RuntimeFieldDefinitionResolved>();\n for (const definition of normalizedSchema.fields) {\n const normalized = normalizeRuntimeFieldDefinition(definition);\n if (!normalized) {\n continue;\n }\n dedupedByKey.set(normalized.key, normalized);\n }\n const definitions = [...dedupedByKey.values()].sort((left, right) => left.key.localeCompare(right.key));\n const byKey = new Map<string, RuntimeFieldDefinitionResolved>();\n const byCliToken = new Map<string, RuntimeFieldDefinitionResolved>();\n const commandToFields = new Map<RuntimeFieldCommand, RuntimeFieldDefinitionResolved[]>();\n for (const definition of definitions) {\n byKey.set(definition.key, definition);\n byCliToken.set(definition.cli_flag, definition);\n for (const alias of definition.cli_aliases) {\n byCliToken.set(alias, definition);\n }\n for (const command of definition.commands) {\n const existing = commandToFields.get(command) ?? [];\n existing.push(definition);\n commandToFields.set(command, existing);\n }\n }\n for (const [command, fieldDefinitions] of commandToFields.entries()) {\n fieldDefinitions.sort((left, right) => left.key.localeCompare(right.key));\n commandToFields.set(command, fieldDefinitions);\n }\n return {\n definitions,\n by_key: byKey,\n by_cli_token: byCliToken,\n command_to_fields: commandToFields,\n };\n}\n\nexport function runtimeFieldOptionTarget(field: RuntimeFieldDefinitionResolved): string {\n return toCamelCase(field.key);\n}\n\nexport function statusIsTerminal(status: string, registry: RuntimeStatusRegistry): boolean {\n const normalized = normalizeStatusInputWithRegistry(status, registry);\n if (!normalized) {\n return false;\n }\n return registry.terminal_statuses.has(normalized);\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,MAAM,UAAU,gBAAgB,CAAC,MAAc,EAAE,QAA+B;IAC9E,MAAM,UAAU,GAAG,gCAAgC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACtE,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,QAAQ,CAAC,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AACpD,CAAC","debugId":"11167959-e632-5d72-a6d1-103f6a7d50ef"}
@@ -0,0 +1,113 @@
1
+ import type { RuntimeStatusDefinition, RuntimeStatusRole } from "../../types/index.js";
2
+ export type { RuntimeStatusDefinition, RuntimeStatusRole } from "../../types/index.js";
3
+ /**
4
+ * The 5 lifecycle status ids that ship as built-in defaults and may never be
5
+ * removed (their normalized ids match DEFAULT_RUNTIME_STATUS_DEFINITIONS:
6
+ * open/in_progress/blocked/closed/canceled). `draft` is also a default but the
7
+ * acceptance criteria enumerate the 5 terminal/active ids explicitly, so the
8
+ * guard derives the full set from the canonical defaults to stay in sync.
9
+ */
10
+ export declare const BUILTIN_STATUS_IDS: ReadonlySet<string>;
11
+ /**
12
+ * The shape persisted at `.agents/pm/schema/statuses.json`.
13
+ */
14
+ export interface StatusDefsFile {
15
+ statuses: RuntimeStatusDefinition[];
16
+ }
17
+ export interface RawAddStatusInput {
18
+ id: string | undefined;
19
+ roles?: string[];
20
+ aliases?: string[];
21
+ description?: string;
22
+ order?: number;
23
+ }
24
+ export interface NormalizedAddStatusInput {
25
+ id: string;
26
+ /**
27
+ * Normalized roles, or `undefined` when the raw input did not supply a roles
28
+ * field at all. `undefined` means "leave existing roles untouched" on upsert;
29
+ * an explicit empty array means "clear roles". This distinction is what keeps
30
+ * `add-status review --description x` from wiping a previously-set role.
31
+ */
32
+ roles?: RuntimeStatusRole[];
33
+ /** Same omitted-vs-explicit-empty semantics as `roles`. */
34
+ aliases?: string[];
35
+ description?: string;
36
+ order?: number;
37
+ }
38
+ export interface UpsertStatusDefResult {
39
+ file: StatusDefsFile;
40
+ /** The definition as stored after the upsert (existing fields preserved). */
41
+ definition: RuntimeStatusDefinition;
42
+ /** True when an existing definition with the same (normalized) id was replaced. */
43
+ replaced: boolean;
44
+ }
45
+ export interface RemoveStatusDefResult {
46
+ file: StatusDefsFile;
47
+ /** True when a matching definition existed and was dropped from the file. */
48
+ removed: boolean;
49
+ /** The removed definition, when one matched the requested id. */
50
+ definition?: RuntimeStatusDefinition;
51
+ }
52
+ /**
53
+ * Normalizes a status token using the same rules as runtime-schema.ts: lowercase
54
+ * and collapse any run of whitespace/hyphens into a single underscore.
55
+ */
56
+ export declare function normalizeStatusToken(value: unknown): string;
57
+ /**
58
+ * Validates and normalizes raw add-status CLI input. Throws a plain Error with a
59
+ * stable message when the id is missing/empty or a role is not one of
60
+ * RUNTIME_STATUS_ROLE_VALUES; the CLI layer maps these to PmCliError exit codes.
61
+ *
62
+ * Omitted vs explicit-empty is preserved end-to-end: when `raw.roles`/`raw.aliases`
63
+ * is `undefined` (flag not supplied) the normalized field is `undefined` so the
64
+ * upsert leaves the existing value untouched; when supplied (even an empty array)
65
+ * the field is normalized to an array so the upsert can apply an explicit clear.
66
+ */
67
+ export declare function normalizeAddStatusInput(raw: RawAddStatusInput): NormalizedAddStatusInput;
68
+ /**
69
+ * Coerces an arbitrary parsed value from statuses.json into a StatusDefsFile.
70
+ * Accepts the canonical `{ statuses: [...] }` shape, a bare array of
71
+ * definitions, or a `{ definitions: [...] }` form, and tolerates a
72
+ * missing/invalid file by returning an empty statuses list.
73
+ */
74
+ export declare function parseStatusDefsFile(raw: string | null | undefined): StatusDefsFile;
75
+ /**
76
+ * Serializes the status definitions file with a trailing newline (matches the
77
+ * rest of the schema scaffold files written by pm).
78
+ */
79
+ export declare function serializeStatusDefsFile(file: StatusDefsFile): string;
80
+ /**
81
+ * Idempotent UPSERT of a status definition into the parsed file. Matching is by
82
+ * normalized id. When a definition already exists, fields supplied in `input`
83
+ * override the previous values (roles/aliases replace when a non-empty array is
84
+ * given, clear when an explicit empty array is given, and are left UNTOUCHED
85
+ * when the field is `undefined` — i.e. the add-status flag was omitted);
86
+ * description/order override when provided. Fields not addressed by add-status
87
+ * flags are preserved untouched, so `add-status <id> --description x` keeps any
88
+ * previously-set roles/aliases.
89
+ */
90
+ export declare function upsertStatusDef(file: StatusDefsFile, input: NormalizedAddStatusInput, baseDefinition?: RuntimeStatusDefinition): UpsertStatusDefResult;
91
+ /**
92
+ * Removes a status definition from the parsed file by id (normalized). Throws a
93
+ * plain Error when `id` is empty or matches a reserved built-in default status
94
+ * (those are never stored in the file and must never be deletable). Returns
95
+ * `removed: false` when no matching definition exists so the CLI layer can treat
96
+ * the call as an idempotent no-op.
97
+ */
98
+ export declare function removeStatusDef(file: StatusDefsFile, id: string | undefined): RemoveStatusDefResult;
99
+ /**
100
+ * Throws when the new status id or any explicitly-supplied alias collides with a
101
+ * DIFFERENT existing status's id/alias. `resolvedAliasToId` maps a normalized
102
+ * token to its owning status id (the runtime status registry's alias_to_id map,
103
+ * which stores ids and aliases in one namespace). Re-adding the same status
104
+ * (matching id) is allowed — only cross-status collisions throw. This prevents a
105
+ * custom status from shadowing a built-in lifecycle token (for example
106
+ * `add-status review --alias open`, or a custom id `cancelled` that aliases the
107
+ * built-in `canceled`), which would make `pm update --status open` resolve to the
108
+ * wrong status. The CLI layer maps the thrown Error to a USAGE exit code.
109
+ */
110
+ export declare function assertStatusTokensAvailable(input: {
111
+ id: string;
112
+ aliases?: string[];
113
+ }, resolvedAliasToId: ReadonlyMap<string, string>): void;
@@ -0,0 +1,260 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d738db07-1d64-5ab0-9ebd-f9c9f6de5706")}catch(e){}}();
3
+ import { RUNTIME_STATUS_ROLE_VALUES } from "../../types/index.js";
4
+ import { DEFAULT_RUNTIME_STATUS_DEFINITIONS } from "./runtime-schema.js";
5
+ /**
6
+ * Pure logic for the `pm schema add-status` / `pm schema remove-status`
7
+ * commands. The CLI command file (schema.ts) owns IO/governance; everything
8
+ * testable and side-effect-free lives here so it can be coverage-gated to 100%.
9
+ *
10
+ * Statuses persist at `.agents/pm/schema/statuses.json` under the shape
11
+ * `{ statuses: RuntimeStatusDefinition[] }`. When the file is absent the runtime
12
+ * merge layer (src/core/store/settings.ts) still supplies the built-in defaults
13
+ * from DEFAULT_RUNTIME_STATUS_DEFINITIONS, so this module never duplicates them
14
+ * into the persisted file.
15
+ */
16
+ const RUNTIME_STATUS_ROLE_SET = new Set(RUNTIME_STATUS_ROLE_VALUES);
17
+ /**
18
+ * The 5 lifecycle status ids that ship as built-in defaults and may never be
19
+ * removed (their normalized ids match DEFAULT_RUNTIME_STATUS_DEFINITIONS:
20
+ * open/in_progress/blocked/closed/canceled). `draft` is also a default but the
21
+ * acceptance criteria enumerate the 5 terminal/active ids explicitly, so the
22
+ * guard derives the full set from the canonical defaults to stay in sync.
23
+ */
24
+ export const BUILTIN_STATUS_IDS = new Set(DEFAULT_RUNTIME_STATUS_DEFINITIONS.map((definition) => normalizeStatusToken(definition.id)).filter((id) => id.length > 0));
25
+ /**
26
+ * Normalizes a status token using the same rules as runtime-schema.ts: lowercase
27
+ * and collapse any run of whitespace/hyphens into a single underscore.
28
+ */
29
+ export function normalizeStatusToken(value) {
30
+ return typeof value === "string" ? value.trim().toLowerCase().replaceAll(/[\s-]+/g, "_") : "";
31
+ }
32
+ function dedupeTokens(values) {
33
+ const seen = new Set();
34
+ for (const value of values) {
35
+ const token = normalizeStatusToken(value);
36
+ if (token.length > 0) {
37
+ seen.add(token);
38
+ }
39
+ }
40
+ return [...seen].sort((left, right) => left.localeCompare(right));
41
+ }
42
+ /**
43
+ * Validates and normalizes raw add-status CLI input. Throws a plain Error with a
44
+ * stable message when the id is missing/empty or a role is not one of
45
+ * RUNTIME_STATUS_ROLE_VALUES; the CLI layer maps these to PmCliError exit codes.
46
+ *
47
+ * Omitted vs explicit-empty is preserved end-to-end: when `raw.roles`/`raw.aliases`
48
+ * is `undefined` (flag not supplied) the normalized field is `undefined` so the
49
+ * upsert leaves the existing value untouched; when supplied (even an empty array)
50
+ * the field is normalized to an array so the upsert can apply an explicit clear.
51
+ */
52
+ export function normalizeAddStatusInput(raw) {
53
+ const id = normalizeStatusToken(raw.id);
54
+ if (id.length === 0) {
55
+ throw new Error("Status id must not be empty.");
56
+ }
57
+ // Built-in lifecycle statuses are reserved and cannot be overridden: an
58
+ // add-status override would change reserved metadata yet remove-status refuses
59
+ // to delete a built-in id, leaving no CLI path to undo it. Reject up front,
60
+ // symmetric with removeStatusDef.
61
+ if (BUILTIN_STATUS_IDS.has(id)) {
62
+ throw new Error(`Cannot add-status the built-in status "${id}". Built-in statuses are reserved: ${[...BUILTIN_STATUS_IDS].join(", ")}.`);
63
+ }
64
+ let roles;
65
+ if (raw.roles !== undefined) {
66
+ roles = [];
67
+ const seenRoles = new Set();
68
+ for (const rawRole of raw.roles) {
69
+ const role = typeof rawRole === "string" ? rawRole.trim().toLowerCase() : "";
70
+ if (role.length === 0) {
71
+ continue;
72
+ }
73
+ if (!RUNTIME_STATUS_ROLE_SET.has(role)) {
74
+ throw new Error(`Invalid status role "${rawRole}". Allowed roles: ${RUNTIME_STATUS_ROLE_VALUES.join(", ")}.`);
75
+ }
76
+ if (!seenRoles.has(role)) {
77
+ seenRoles.add(role);
78
+ roles.push(role);
79
+ }
80
+ }
81
+ }
82
+ const aliases = raw.aliases === undefined ? undefined : dedupeTokens(raw.aliases).filter((alias) => alias !== id);
83
+ const description = raw.description?.trim();
84
+ const order = typeof raw.order === "number" && Number.isFinite(raw.order) ? Math.trunc(raw.order) : undefined;
85
+ return {
86
+ id,
87
+ roles,
88
+ aliases,
89
+ description: description && description.length > 0 ? description : undefined,
90
+ order,
91
+ };
92
+ }
93
+ function selectStatusesArray(parsed) {
94
+ if (Array.isArray(parsed)) {
95
+ return parsed;
96
+ }
97
+ if (typeof parsed !== "object" || parsed === null) {
98
+ return undefined;
99
+ }
100
+ const record = parsed;
101
+ if (Array.isArray(record.statuses)) {
102
+ return record.statuses;
103
+ }
104
+ if (Array.isArray(record.definitions)) {
105
+ return record.definitions;
106
+ }
107
+ return undefined;
108
+ }
109
+ function extractStatusDefinitions(parsed) {
110
+ const candidate = selectStatusesArray(parsed);
111
+ if (!candidate) {
112
+ return [];
113
+ }
114
+ const definitions = [];
115
+ for (const entry of candidate) {
116
+ if (typeof entry !== "object" || entry === null || Array.isArray(entry)) {
117
+ continue;
118
+ }
119
+ const record = entry;
120
+ if (typeof record.id !== "string" || record.id.trim().length === 0) {
121
+ continue;
122
+ }
123
+ definitions.push(record);
124
+ }
125
+ return definitions;
126
+ }
127
+ /**
128
+ * Coerces an arbitrary parsed value from statuses.json into a StatusDefsFile.
129
+ * Accepts the canonical `{ statuses: [...] }` shape, a bare array of
130
+ * definitions, or a `{ definitions: [...] }` form, and tolerates a
131
+ * missing/invalid file by returning an empty statuses list.
132
+ */
133
+ export function parseStatusDefsFile(raw) {
134
+ if (raw === null || raw === undefined || raw.trim().length === 0) {
135
+ return { statuses: [] };
136
+ }
137
+ let parsed;
138
+ try {
139
+ parsed = JSON.parse(raw);
140
+ }
141
+ catch {
142
+ throw new Error("schema/statuses.json contains invalid JSON.");
143
+ }
144
+ return { statuses: extractStatusDefinitions(parsed) };
145
+ }
146
+ /**
147
+ * Serializes the status definitions file with a trailing newline (matches the
148
+ * rest of the schema scaffold files written by pm).
149
+ */
150
+ export function serializeStatusDefsFile(file) {
151
+ return `${JSON.stringify({ statuses: file.statuses }, null, 2)}\n`;
152
+ }
153
+ /**
154
+ * Idempotent UPSERT of a status definition into the parsed file. Matching is by
155
+ * normalized id. When a definition already exists, fields supplied in `input`
156
+ * override the previous values (roles/aliases replace when a non-empty array is
157
+ * given, clear when an explicit empty array is given, and are left UNTOUCHED
158
+ * when the field is `undefined` — i.e. the add-status flag was omitted);
159
+ * description/order override when provided. Fields not addressed by add-status
160
+ * flags are preserved untouched, so `add-status <id> --description x` keeps any
161
+ * previously-set roles/aliases.
162
+ */
163
+ export function upsertStatusDef(file, input, baseDefinition) {
164
+ const statuses = file.statuses.slice();
165
+ const existingIndex = statuses.findIndex((definition) => normalizeStatusToken(definition.id) === input.id);
166
+ // A file-backed definition is the primary seed; when the status is not yet in
167
+ // statuses.json fall back to `baseDefinition` (the resolved settings-backed
168
+ // definition) so omitting --role/--alias preserves metadata that lives in
169
+ // settings.schema.statuses rather than the file.
170
+ const existing = existingIndex >= 0 ? statuses[existingIndex] : baseDefinition;
171
+ const next = {
172
+ ...(existing ?? {}),
173
+ id: input.id,
174
+ };
175
+ if (input.roles !== undefined) {
176
+ if (input.roles.length > 0) {
177
+ next.roles = [...input.roles];
178
+ }
179
+ else if (next.roles !== undefined) {
180
+ delete next.roles;
181
+ }
182
+ }
183
+ if (input.aliases !== undefined) {
184
+ if (input.aliases.length > 0) {
185
+ next.aliases = [...input.aliases];
186
+ }
187
+ else if (next.aliases !== undefined) {
188
+ delete next.aliases;
189
+ }
190
+ }
191
+ if (input.description !== undefined) {
192
+ next.description = input.description;
193
+ }
194
+ if (input.order !== undefined) {
195
+ next.order = input.order;
196
+ }
197
+ if (existingIndex >= 0) {
198
+ statuses[existingIndex] = next;
199
+ }
200
+ else {
201
+ statuses.push(next);
202
+ }
203
+ return {
204
+ file: { statuses },
205
+ definition: next,
206
+ // "replaced" reflects whether the status already existed effectively (in the
207
+ // file OR in resolved settings), so the CLI reports "Updated" vs "Registered"
208
+ // correctly even when the prior definition lived only in settings.
209
+ replaced: existing !== undefined,
210
+ };
211
+ }
212
+ /**
213
+ * Removes a status definition from the parsed file by id (normalized). Throws a
214
+ * plain Error when `id` is empty or matches a reserved built-in default status
215
+ * (those are never stored in the file and must never be deletable). Returns
216
+ * `removed: false` when no matching definition exists so the CLI layer can treat
217
+ * the call as an idempotent no-op.
218
+ */
219
+ export function removeStatusDef(file, id) {
220
+ const normalizedId = normalizeStatusToken(id);
221
+ if (normalizedId.length === 0) {
222
+ throw new Error("Status id must not be empty.");
223
+ }
224
+ if (BUILTIN_STATUS_IDS.has(normalizedId)) {
225
+ throw new Error(`Cannot remove built-in status "${normalizedId}". Built-in statuses are reserved: ${[...BUILTIN_STATUS_IDS].join(", ")}.`);
226
+ }
227
+ const statuses = file.statuses.slice();
228
+ const existingIndex = statuses.findIndex((definition) => normalizeStatusToken(definition.id) === normalizedId);
229
+ if (existingIndex < 0) {
230
+ return { file: { statuses }, removed: false };
231
+ }
232
+ const [definition] = statuses.splice(existingIndex, 1);
233
+ return { file: { statuses }, removed: true, definition };
234
+ }
235
+ /**
236
+ * Throws when the new status id or any explicitly-supplied alias collides with a
237
+ * DIFFERENT existing status's id/alias. `resolvedAliasToId` maps a normalized
238
+ * token to its owning status id (the runtime status registry's alias_to_id map,
239
+ * which stores ids and aliases in one namespace). Re-adding the same status
240
+ * (matching id) is allowed — only cross-status collisions throw. This prevents a
241
+ * custom status from shadowing a built-in lifecycle token (for example
242
+ * `add-status review --alias open`, or a custom id `cancelled` that aliases the
243
+ * built-in `canceled`), which would make `pm update --status open` resolve to the
244
+ * wrong status. The CLI layer maps the thrown Error to a USAGE exit code.
245
+ */
246
+ export function assertStatusTokensAvailable(input, resolvedAliasToId) {
247
+ const candidates = [input.id, ...(input.aliases ?? [])];
248
+ for (const candidate of candidates) {
249
+ const token = normalizeStatusToken(candidate);
250
+ if (token.length === 0) {
251
+ continue;
252
+ }
253
+ const owner = resolvedAliasToId.get(token);
254
+ if (owner !== undefined && owner !== input.id) {
255
+ throw new Error(`Status token "${token}" already belongs to status "${owner}". Choose a different id/alias to avoid shadowing it.`);
256
+ }
257
+ }
258
+ }
259
+ //# sourceMappingURL=status-defs-file.js.map
260
+ //# debugId=d738db07-1d64-5ab0-9ebd-f9c9f6de5706