@unbrained/pm-cli 2026.5.31 → 2026.6.5

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 (586) hide show
  1. package/CHANGELOG.md +127 -0
  2. package/dist/cli/argv-utils.js +7 -3
  3. package/dist/cli/argv-utils.js.map +1 -1
  4. package/dist/cli/bootstrap-args.d.ts +1 -0
  5. package/dist/cli/bootstrap-args.js +23 -3
  6. package/dist/cli/bootstrap-args.js.map +1 -1
  7. package/dist/cli/commands/calendar.js +17 -3
  8. package/dist/cli/commands/calendar.js.map +1 -1
  9. package/dist/cli/commands/close-many.d.ts +63 -0
  10. package/dist/cli/commands/close-many.js +302 -0
  11. package/dist/cli/commands/close-many.js.map +1 -0
  12. package/dist/cli/commands/completion.d.ts +1 -0
  13. package/dist/cli/commands/completion.js +241 -27
  14. package/dist/cli/commands/completion.js.map +1 -1
  15. package/dist/cli/commands/config.d.ts +4 -4
  16. package/dist/cli/commands/config.js +115 -3
  17. package/dist/cli/commands/config.js.map +1 -1
  18. package/dist/cli/commands/contracts.js +191 -162
  19. package/dist/cli/commands/contracts.js.map +1 -1
  20. package/dist/cli/commands/create.d.ts +1 -0
  21. package/dist/cli/commands/create.js +77 -114
  22. package/dist/cli/commands/create.js.map +1 -1
  23. package/dist/cli/commands/extension/doctor.d.ts +12 -0
  24. package/dist/cli/commands/extension/doctor.js +97 -2
  25. package/dist/cli/commands/extension/doctor.js.map +1 -1
  26. package/dist/cli/commands/extension/scaffold.js +49 -48
  27. package/dist/cli/commands/extension/scaffold.js.map +1 -1
  28. package/dist/cli/commands/extension.js +51 -23
  29. package/dist/cli/commands/extension.js.map +1 -1
  30. package/dist/cli/commands/get.js +7 -7
  31. package/dist/cli/commands/get.js.map +1 -1
  32. package/dist/cli/commands/health.js +38 -3
  33. package/dist/cli/commands/health.js.map +1 -1
  34. package/dist/cli/commands/index.d.ts +2 -1
  35. package/dist/cli/commands/index.js +4 -3
  36. package/dist/cli/commands/index.js.map +1 -1
  37. package/dist/cli/commands/init.d.ts +10 -0
  38. package/dist/cli/commands/init.js +107 -4
  39. package/dist/cli/commands/init.js.map +1 -1
  40. package/dist/cli/commands/list.d.ts +5 -0
  41. package/dist/cli/commands/list.js +58 -26
  42. package/dist/cli/commands/list.js.map +1 -1
  43. package/dist/cli/commands/reindex.js +163 -47
  44. package/dist/cli/commands/reindex.js.map +1 -1
  45. package/dist/cli/commands/repeatable-metadata-parsers.d.ts +15 -0
  46. package/dist/cli/commands/repeatable-metadata-parsers.js +120 -0
  47. package/dist/cli/commands/repeatable-metadata-parsers.js.map +1 -0
  48. package/dist/cli/commands/restore.js +25 -4
  49. package/dist/cli/commands/restore.js.map +1 -1
  50. package/dist/cli/commands/schema.d.ts +122 -1
  51. package/dist/cli/commands/schema.js +536 -6
  52. package/dist/cli/commands/schema.js.map +1 -1
  53. package/dist/cli/commands/search.d.ts +1 -0
  54. package/dist/cli/commands/search.js +18 -4
  55. package/dist/cli/commands/search.js.map +1 -1
  56. package/dist/cli/commands/test.js +4 -3
  57. package/dist/cli/commands/test.js.map +1 -1
  58. package/dist/cli/commands/update-many.js +69 -140
  59. package/dist/cli/commands/update-many.js.map +1 -1
  60. package/dist/cli/commands/update.d.ts +2 -0
  61. package/dist/cli/commands/update.js +138 -119
  62. package/dist/cli/commands/update.js.map +1 -1
  63. package/dist/cli/commands/validate.d.ts +1 -0
  64. package/dist/cli/commands/validate.js +63 -33
  65. package/dist/cli/commands/validate.js.map +1 -1
  66. package/dist/cli/error-guidance.js +26 -3
  67. package/dist/cli/error-guidance.js.map +1 -1
  68. package/dist/cli/help-content.js +82 -3
  69. package/dist/cli/help-content.js.map +1 -1
  70. package/dist/cli/main.js +377 -23
  71. package/dist/cli/main.js.map +1 -1
  72. package/dist/cli/register-list-query.js +9 -3
  73. package/dist/cli/register-list-query.js.map +1 -1
  74. package/dist/cli/register-mutation.js +200 -28
  75. package/dist/cli/register-mutation.js.map +1 -1
  76. package/dist/cli/register-operations.js +4 -2
  77. package/dist/cli/register-operations.js.map +1 -1
  78. package/dist/cli/register-setup.js +4 -2
  79. package/dist/cli/register-setup.js.map +1 -1
  80. package/dist/cli/registration-helpers.js +31 -4
  81. package/dist/cli/registration-helpers.js.map +1 -1
  82. package/dist/cli-bundle/chunks/activity-3RWRRNOW.js +20 -0
  83. package/dist/cli-bundle/chunks/activity-3RWRRNOW.js.map +1 -0
  84. package/dist/cli-bundle/chunks/activity-P5BUMWP3.js +16 -0
  85. package/dist/cli-bundle/chunks/aggregate-J35K7WZB.js +206 -0
  86. package/dist/cli-bundle/chunks/aggregate-J35K7WZB.js.map +1 -0
  87. package/dist/cli-bundle/chunks/{aggregate-ADUOSFRO.js → aggregate-OOAGKWRG.js} +11 -11
  88. package/dist/cli-bundle/chunks/{append-JD2DETU7.js → append-5JE3YGXU.js} +8 -9
  89. package/dist/cli-bundle/chunks/{append-JD2DETU7.js.map → append-5JE3YGXU.js.map} +1 -1
  90. package/dist/cli-bundle/chunks/append-PNN6UIBZ.js +69 -0
  91. package/dist/cli-bundle/chunks/append-PNN6UIBZ.js.map +1 -0
  92. package/dist/cli-bundle/chunks/chunk-26KTVXJW.js +218 -0
  93. package/dist/cli-bundle/chunks/chunk-26KTVXJW.js.map +1 -0
  94. package/dist/cli-bundle/chunks/{chunk-JULRTHJQ.js → chunk-3OH4DAEB.js} +119 -6
  95. package/dist/cli-bundle/chunks/chunk-3OH4DAEB.js.map +7 -0
  96. package/dist/cli-bundle/chunks/chunk-4LTBNUYT.js +5553 -0
  97. package/dist/cli-bundle/chunks/chunk-4LTBNUYT.js.map +1 -0
  98. package/dist/cli-bundle/chunks/{chunk-WDPXDQFG.js → chunk-4PJQSECJ.js} +6 -4
  99. package/dist/cli-bundle/chunks/chunk-4PJQSECJ.js.map +7 -0
  100. package/dist/cli-bundle/chunks/chunk-4QCR4QW3.js +1832 -0
  101. package/dist/cli-bundle/chunks/chunk-4QCR4QW3.js.map +1 -0
  102. package/dist/cli-bundle/chunks/{chunk-6HT2F4TK.js → chunk-5IRA6IYD.js} +175 -54
  103. package/dist/cli-bundle/chunks/chunk-5IRA6IYD.js.map +7 -0
  104. package/dist/cli-bundle/chunks/chunk-5KB4X7YY.js +412 -0
  105. package/dist/cli-bundle/chunks/chunk-5KB4X7YY.js.map +1 -0
  106. package/dist/cli-bundle/chunks/chunk-5PAOPUZX.js +182 -0
  107. package/dist/cli-bundle/chunks/chunk-5PAOPUZX.js.map +1 -0
  108. package/dist/cli-bundle/chunks/chunk-7K24QB23.js +698 -0
  109. package/dist/cli-bundle/chunks/chunk-7K24QB23.js.map +1 -0
  110. package/dist/cli-bundle/chunks/chunk-A6PEXMYN.js +380 -0
  111. package/dist/cli-bundle/chunks/chunk-A6PEXMYN.js.map +1 -0
  112. package/dist/cli-bundle/chunks/chunk-ASQM3IF5.js +230 -0
  113. package/dist/cli-bundle/chunks/chunk-ASQM3IF5.js.map +1 -0
  114. package/dist/cli-bundle/chunks/{chunk-G57E5D7T.js → chunk-ATBVS6WW.js} +5 -5
  115. package/dist/cli-bundle/chunks/chunk-AXXKLVTW.js +332 -0
  116. package/dist/cli-bundle/chunks/chunk-AXXKLVTW.js.map +1 -0
  117. package/dist/cli-bundle/chunks/{chunk-PXUAZUUY.js → chunk-B3N4TKNL.js} +12 -11
  118. package/dist/cli-bundle/chunks/chunk-B3N4TKNL.js.map +7 -0
  119. package/dist/cli-bundle/chunks/{chunk-KBQY3YG5.js → chunk-BNL6S7QH.js} +3 -3
  120. package/dist/cli-bundle/chunks/chunk-CCUFLH4J.js +154 -0
  121. package/dist/cli-bundle/chunks/chunk-CCUFLH4J.js.map +1 -0
  122. package/dist/cli-bundle/chunks/{chunk-NGN7UV5K.js → chunk-CJDQB2ED.js} +2 -2
  123. package/dist/cli-bundle/chunks/chunk-CWT53EYT.js +1340 -0
  124. package/dist/cli-bundle/chunks/chunk-CWT53EYT.js.map +1 -0
  125. package/dist/cli-bundle/chunks/{chunk-D7AOMPRH.js → chunk-D3WUNETC.js} +5 -5
  126. package/dist/cli-bundle/chunks/{chunk-3M73P3G6.js → chunk-D5X7N6FI.js} +210 -132
  127. package/dist/cli-bundle/chunks/chunk-D5X7N6FI.js.map +7 -0
  128. package/dist/cli-bundle/chunks/{chunk-6YCV7WSL.js → chunk-DFIZGAI5.js} +10 -12
  129. package/dist/cli-bundle/chunks/{chunk-6YCV7WSL.js.map → chunk-DFIZGAI5.js.map} +1 -1
  130. package/dist/cli-bundle/chunks/chunk-DFUSXJDE.js +1704 -0
  131. package/dist/cli-bundle/chunks/chunk-DFUSXJDE.js.map +1 -0
  132. package/dist/cli-bundle/chunks/chunk-EHXPIKKP.js +2988 -0
  133. package/dist/cli-bundle/chunks/chunk-EHXPIKKP.js.map +1 -0
  134. package/dist/cli-bundle/chunks/chunk-FVXM3GKS.js +128 -0
  135. package/dist/cli-bundle/chunks/chunk-FVXM3GKS.js.map +1 -0
  136. package/dist/cli-bundle/chunks/chunk-G5BACLYH.js +454 -0
  137. package/dist/cli-bundle/chunks/chunk-G5BACLYH.js.map +1 -0
  138. package/dist/cli-bundle/chunks/{chunk-U7FMKRXH.js → chunk-GCAVRLGE.js} +37 -16
  139. package/dist/cli-bundle/chunks/chunk-GCAVRLGE.js.map +7 -0
  140. package/dist/cli-bundle/chunks/chunk-GFWHHMVV.js +57 -0
  141. package/dist/cli-bundle/chunks/chunk-GFWHHMVV.js.map +1 -0
  142. package/dist/cli-bundle/chunks/chunk-GNHVV4SY.js +3860 -0
  143. package/dist/cli-bundle/chunks/chunk-GNHVV4SY.js.map +1 -0
  144. package/dist/cli-bundle/chunks/chunk-GPGAYASV.js +346 -0
  145. package/dist/cli-bundle/chunks/chunk-GPGAYASV.js.map +1 -0
  146. package/dist/cli-bundle/chunks/{chunk-MD7K4JYF.js → chunk-HPH6X4ZZ.js} +26 -15
  147. package/dist/cli-bundle/chunks/chunk-HPH6X4ZZ.js.map +7 -0
  148. package/dist/cli-bundle/chunks/{chunk-5HSEP75M.js → chunk-HZOS2UG5.js} +18 -6
  149. package/dist/cli-bundle/chunks/chunk-HZOS2UG5.js.map +7 -0
  150. package/dist/cli-bundle/chunks/chunk-IUV734HF.js +17 -0
  151. package/dist/cli-bundle/chunks/chunk-IUV734HF.js.map +1 -0
  152. package/dist/cli-bundle/chunks/chunk-J27KIHTG.js +15 -0
  153. package/dist/cli-bundle/chunks/chunk-J27KIHTG.js.map +1 -0
  154. package/dist/cli-bundle/chunks/{chunk-L2FXEKDB.js → chunk-JB4RGL4V.js} +7 -7
  155. package/dist/cli-bundle/chunks/chunk-JQI2HE55.js +130 -0
  156. package/dist/cli-bundle/chunks/chunk-JQI2HE55.js.map +1 -0
  157. package/dist/cli-bundle/chunks/{chunk-SEXQN4KL.js → chunk-K47WAYQV.js} +3 -3
  158. package/dist/cli-bundle/chunks/{chunk-CEFIVZPG.js → chunk-KA24HME7.js} +2 -2
  159. package/dist/cli-bundle/chunks/chunk-KBG47ZOY.js +1325 -0
  160. package/dist/cli-bundle/chunks/chunk-KBG47ZOY.js.map +1 -0
  161. package/dist/cli-bundle/chunks/chunk-KCMIYKTA.js +242 -0
  162. package/dist/cli-bundle/chunks/chunk-KCMIYKTA.js.map +1 -0
  163. package/dist/cli-bundle/chunks/{chunk-7Y53ZJIQ.js → chunk-KK6YPGH3.js} +22 -3
  164. package/dist/cli-bundle/chunks/chunk-KK6YPGH3.js.map +7 -0
  165. package/dist/cli-bundle/chunks/{chunk-A7E7PUVX.js → chunk-LDJK7SHN.js} +7 -7
  166. package/dist/cli-bundle/chunks/chunk-LXYVKYMQ.js +24 -0
  167. package/dist/cli-bundle/chunks/chunk-LXYVKYMQ.js.map +1 -0
  168. package/dist/cli-bundle/chunks/chunk-MISYRLEP.js +80 -0
  169. package/dist/cli-bundle/chunks/chunk-MISYRLEP.js.map +1 -0
  170. package/dist/cli-bundle/chunks/{chunk-FQE6XZDB.js → chunk-N5YF3VFN.js} +54 -32
  171. package/dist/cli-bundle/chunks/chunk-N5YF3VFN.js.map +7 -0
  172. package/dist/cli-bundle/chunks/chunk-NQP3ECKF.js +173 -0
  173. package/dist/cli-bundle/chunks/chunk-NQP3ECKF.js.map +1 -0
  174. package/dist/cli-bundle/chunks/chunk-O5IBJE6S.js +338 -0
  175. package/dist/cli-bundle/chunks/chunk-O5IBJE6S.js.map +1 -0
  176. package/dist/cli-bundle/chunks/{chunk-OGZEG5TT.js → chunk-OIQIXTNB.js} +164 -53
  177. package/dist/cli-bundle/chunks/chunk-OIQIXTNB.js.map +7 -0
  178. package/dist/cli-bundle/chunks/chunk-ORTLYVA4.js +751 -0
  179. package/dist/cli-bundle/chunks/chunk-ORTLYVA4.js.map +1 -0
  180. package/dist/cli-bundle/chunks/{chunk-JTWRXG4B.js → chunk-OUF3ARDX.js} +251 -251
  181. package/dist/cli-bundle/chunks/chunk-OUF3ARDX.js.map +7 -0
  182. package/dist/cli-bundle/chunks/{chunk-PVNQLCIS.js → chunk-RANZIID5.js} +2 -2
  183. package/dist/cli-bundle/chunks/chunk-RQAWLSUU.js +140 -0
  184. package/dist/cli-bundle/chunks/chunk-RQAWLSUU.js.map +7 -0
  185. package/dist/cli-bundle/chunks/{chunk-JFWUHHS2.js → chunk-S3CV7JGJ.js} +4 -4
  186. package/dist/cli-bundle/chunks/{chunk-LSXGH6NE.js → chunk-SRVKTWPR.js} +748 -196
  187. package/dist/cli-bundle/chunks/chunk-SRVKTWPR.js.map +7 -0
  188. package/dist/cli-bundle/chunks/chunk-SSFMJCPF.js +76 -0
  189. package/dist/cli-bundle/chunks/chunk-SSFMJCPF.js.map +1 -0
  190. package/dist/cli-bundle/chunks/chunk-SZQCER6S.js +631 -0
  191. package/dist/cli-bundle/chunks/chunk-SZQCER6S.js.map +1 -0
  192. package/dist/cli-bundle/chunks/chunk-T2ORWB6D.js +540 -0
  193. package/dist/cli-bundle/chunks/chunk-T2ORWB6D.js.map +1 -0
  194. package/dist/cli-bundle/chunks/chunk-TBQVUNVH.js +422 -0
  195. package/dist/cli-bundle/chunks/chunk-TBQVUNVH.js.map +7 -0
  196. package/dist/cli-bundle/chunks/{chunk-P53TN6IA.js → chunk-TK633IVD.js} +35 -8
  197. package/dist/cli-bundle/chunks/chunk-TK633IVD.js.map +7 -0
  198. package/dist/cli-bundle/chunks/chunk-TQ3ZK6VD.js +131 -0
  199. package/dist/cli-bundle/chunks/chunk-TQ3ZK6VD.js.map +7 -0
  200. package/dist/cli-bundle/chunks/chunk-UFCG3SWR.js +119 -0
  201. package/dist/cli-bundle/chunks/chunk-UFCG3SWR.js.map +1 -0
  202. package/dist/cli-bundle/chunks/chunk-UOVLWB47.js +1664 -0
  203. package/dist/cli-bundle/chunks/chunk-UOVLWB47.js.map +1 -0
  204. package/dist/cli-bundle/chunks/chunk-V3JQ4IPL.js +186 -0
  205. package/dist/cli-bundle/chunks/chunk-V3JQ4IPL.js.map +1 -0
  206. package/dist/cli-bundle/chunks/chunk-VGO2T3TY.js +182 -0
  207. package/dist/cli-bundle/chunks/chunk-VGO2T3TY.js.map +1 -0
  208. package/dist/cli-bundle/chunks/{chunk-LRBOHPUE.js → chunk-WIKR7KFL.js} +8 -8
  209. package/dist/cli-bundle/chunks/{chunk-BUPWJ3IJ.js → chunk-XG7RJYHV.js} +484 -49
  210. package/dist/cli-bundle/chunks/chunk-XG7RJYHV.js.map +7 -0
  211. package/dist/cli-bundle/chunks/chunk-XSLQSXAH.js +53 -0
  212. package/dist/cli-bundle/chunks/chunk-XSLQSXAH.js.map +1 -0
  213. package/dist/cli-bundle/chunks/{chunk-AKOOMO3T.js → chunk-XX5LRINW.js} +2 -2
  214. package/dist/cli-bundle/chunks/{chunk-WJ2NAC37.js → chunk-Y2AKE2HS.js} +3 -3
  215. package/dist/cli-bundle/chunks/{chunk-GN7IJPCD.js → chunk-ZQ4F6EC4.js} +301 -24
  216. package/dist/cli-bundle/chunks/chunk-ZQ4F6EC4.js.map +7 -0
  217. package/dist/cli-bundle/chunks/chunk-ZRVSMOMR.js +1809 -0
  218. package/dist/cli-bundle/chunks/chunk-ZRVSMOMR.js.map +1 -0
  219. package/dist/cli-bundle/chunks/{claim-EE4TKKCV.js → claim-AZLP7YFO.js} +10 -11
  220. package/dist/cli-bundle/chunks/{claim-EE4TKKCV.js.map → claim-AZLP7YFO.js.map} +1 -1
  221. package/dist/cli-bundle/chunks/claim-ZFA7HKU4.js +129 -0
  222. package/dist/cli-bundle/chunks/claim-ZFA7HKU4.js.map +1 -0
  223. package/dist/cli-bundle/chunks/close-65DFYAVS.js +17 -0
  224. package/dist/cli-bundle/chunks/close-65DFYAVS.js.map +1 -0
  225. package/dist/cli-bundle/chunks/close-RMHQ3KWH.js +13 -0
  226. package/dist/cli-bundle/chunks/close-many-AKPZNSGI.js +311 -0
  227. package/dist/cli-bundle/chunks/close-many-AKPZNSGI.js.map +1 -0
  228. package/dist/cli-bundle/chunks/close-many-UKZSQGM7.js +314 -0
  229. package/dist/cli-bundle/chunks/close-many-UKZSQGM7.js.map +7 -0
  230. package/dist/cli-bundle/chunks/{comments-AAKJQ6LW.js → comments-AGBNSJJH.js} +10 -11
  231. package/dist/cli-bundle/chunks/{comments-AAKJQ6LW.js.map → comments-AGBNSJJH.js.map} +1 -1
  232. package/dist/cli-bundle/chunks/comments-CJWXQI7X.js +100 -0
  233. package/dist/cli-bundle/chunks/comments-CJWXQI7X.js.map +1 -0
  234. package/dist/cli-bundle/chunks/{config-V3FZOKLI.js → config-5ON3ADRH.js} +121 -10
  235. package/dist/cli-bundle/chunks/config-5ON3ADRH.js.map +7 -0
  236. package/dist/cli-bundle/chunks/config-DDPYIA6J.js +1671 -0
  237. package/dist/cli-bundle/chunks/config-DDPYIA6J.js.map +1 -0
  238. package/dist/cli-bundle/chunks/{context-RZ5QPNJB.js → context-E6U3DWVM.js} +32 -19
  239. package/dist/cli-bundle/chunks/{context-RZ5QPNJB.js.map → context-E6U3DWVM.js.map} +2 -2
  240. package/dist/cli-bundle/chunks/context-ZOJEN5VT.js +1461 -0
  241. package/dist/cli-bundle/chunks/context-ZOJEN5VT.js.map +1 -0
  242. package/dist/cli-bundle/chunks/{contracts-YLMH33VU.js → contracts-CXSFM45B.js} +194 -162
  243. package/dist/cli-bundle/chunks/contracts-CXSFM45B.js.map +7 -0
  244. package/dist/cli-bundle/chunks/contracts-LCSX5R53.js +1274 -0
  245. package/dist/cli-bundle/chunks/contracts-LCSX5R53.js.map +1 -0
  246. package/dist/cli-bundle/chunks/create-ATONSAZW.js +27 -0
  247. package/dist/cli-bundle/chunks/create-WYFKN2U4.js +31 -0
  248. package/dist/cli-bundle/chunks/create-WYFKN2U4.js.map +1 -0
  249. package/dist/cli-bundle/chunks/{delete-RHCTEORS.js → delete-RONNH4F4.js} +7 -8
  250. package/dist/cli-bundle/chunks/{delete-RHCTEORS.js.map → delete-RONNH4F4.js.map} +1 -1
  251. package/dist/cli-bundle/chunks/delete-ZXWC56WO.js +55 -0
  252. package/dist/cli-bundle/chunks/delete-ZXWC56WO.js.map +1 -0
  253. package/dist/cli-bundle/chunks/deps-EHXIFOZR.js +225 -0
  254. package/dist/cli-bundle/chunks/deps-EHXIFOZR.js.map +1 -0
  255. package/dist/cli-bundle/chunks/{deps-MZYCMLAO.js → deps-WII3O4HB.js} +7 -8
  256. package/dist/cli-bundle/chunks/{deps-MZYCMLAO.js.map → deps-WII3O4HB.js.map} +1 -1
  257. package/dist/cli-bundle/chunks/{docs-FXXUCZYU.js → docs-JMVCFNHH.js} +9 -10
  258. package/dist/cli-bundle/chunks/{docs-FXXUCZYU.js.map → docs-JMVCFNHH.js.map} +1 -1
  259. package/dist/cli-bundle/chunks/docs-PDREIMLS.js +31 -0
  260. package/dist/cli-bundle/chunks/docs-PDREIMLS.js.map +1 -0
  261. package/dist/cli-bundle/chunks/extension-B4ROVWJD.js +28 -0
  262. package/dist/cli-bundle/chunks/extension-B4ROVWJD.js.map +1 -0
  263. package/dist/cli-bundle/chunks/{extension-B4WL7BQU.js → extension-G6UXSM5S.js} +4 -5
  264. package/dist/cli-bundle/chunks/files-2PN7UM2D.js +282 -0
  265. package/dist/cli-bundle/chunks/files-2PN7UM2D.js.map +1 -0
  266. package/dist/cli-bundle/chunks/{files-WVOX67PE.js → files-MXYS5W4M.js} +9 -10
  267. package/dist/cli-bundle/chunks/{files-WVOX67PE.js.map → files-MXYS5W4M.js.map} +1 -1
  268. package/dist/cli-bundle/chunks/gc-GT552UJH.js +178 -0
  269. package/dist/cli-bundle/chunks/gc-GT552UJH.js.map +1 -0
  270. package/dist/cli-bundle/chunks/{gc-JWNF66EC.js → gc-QNBRJG6H.js} +3 -3
  271. package/dist/cli-bundle/chunks/{get-LTK3HOCQ.js → get-CINFEUIY.js} +16 -17
  272. package/dist/cli-bundle/chunks/get-CINFEUIY.js.map +7 -0
  273. package/dist/cli-bundle/chunks/get-WXMLRG7M.js +194 -0
  274. package/dist/cli-bundle/chunks/get-WXMLRG7M.js.map +1 -0
  275. package/dist/cli-bundle/chunks/health-5VPOJQ53.js +1258 -0
  276. package/dist/cli-bundle/chunks/health-5VPOJQ53.js.map +1 -0
  277. package/dist/cli-bundle/chunks/{health-TCWL55KM.js → health-IT5DBPRJ.js} +43 -15
  278. package/dist/cli-bundle/chunks/health-IT5DBPRJ.js.map +7 -0
  279. package/dist/cli-bundle/chunks/history-6FC4H6HI.js +20 -0
  280. package/dist/cli-bundle/chunks/history-FLZIP7PM.js +24 -0
  281. package/dist/cli-bundle/chunks/history-FLZIP7PM.js.map +1 -0
  282. package/dist/cli-bundle/chunks/history-redact-SSZBAD76.js +23 -0
  283. package/dist/cli-bundle/chunks/history-redact-SSZBAD76.js.map +1 -0
  284. package/dist/cli-bundle/chunks/history-redact-XKYEZDBL.js +19 -0
  285. package/dist/cli-bundle/chunks/{history-repair-ZWSTDRH2.js → history-repair-KC5ZOJRZ.js} +12 -14
  286. package/dist/cli-bundle/chunks/{history-repair-ZWSTDRH2.js.map → history-repair-KC5ZOJRZ.js.map} +1 -1
  287. package/dist/cli-bundle/chunks/history-repair-X7CO5JJZ.js +193 -0
  288. package/dist/cli-bundle/chunks/history-repair-X7CO5JJZ.js.map +1 -0
  289. package/dist/cli-bundle/chunks/init-6MRFVOLH.js +20 -0
  290. package/dist/cli-bundle/chunks/init-6MRFVOLH.js.map +1 -0
  291. package/dist/cli-bundle/chunks/init-KHX3FEEM.js +16 -0
  292. package/dist/cli-bundle/chunks/{learnings-NXTWE3FR.js → learnings-A3CLB5CO.js} +10 -11
  293. package/dist/cli-bundle/chunks/{learnings-NXTWE3FR.js.map → learnings-A3CLB5CO.js.map} +1 -1
  294. package/dist/cli-bundle/chunks/learnings-DCX55BNX.js +44 -0
  295. package/dist/cli-bundle/chunks/learnings-DCX55BNX.js.map +1 -0
  296. package/dist/cli-bundle/chunks/list-53LZ2AEO.js +20 -0
  297. package/dist/cli-bundle/chunks/list-DBRECOG4.js +24 -0
  298. package/dist/cli-bundle/chunks/list-DBRECOG4.js.map +1 -0
  299. package/dist/cli-bundle/chunks/{notes-DFS5ZGOO.js → notes-42LIC3UE.js} +10 -11
  300. package/dist/cli-bundle/chunks/{notes-DFS5ZGOO.js.map → notes-42LIC3UE.js.map} +1 -1
  301. package/dist/cli-bundle/chunks/notes-P5O3VMQ3.js +44 -0
  302. package/dist/cli-bundle/chunks/notes-P5O3VMQ3.js.map +1 -0
  303. package/dist/cli-bundle/chunks/{plan-67AB2PLM.js → plan-HDQXEUKD.js} +13 -14
  304. package/dist/cli-bundle/chunks/{plan-67AB2PLM.js.map → plan-HDQXEUKD.js.map} +1 -1
  305. package/dist/cli-bundle/chunks/plan-IGTE3WOJ.js +1171 -0
  306. package/dist/cli-bundle/chunks/plan-IGTE3WOJ.js.map +1 -0
  307. package/dist/cli-bundle/chunks/{register-list-query-UP3VRUFS.js → register-list-query-AG3XKXWL.js} +22 -24
  308. package/dist/cli-bundle/chunks/register-list-query-AG3XKXWL.js.map +7 -0
  309. package/dist/cli-bundle/chunks/register-list-query-EMNSIUO4.js +227 -0
  310. package/dist/cli-bundle/chunks/register-list-query-EMNSIUO4.js.map +1 -0
  311. package/dist/cli-bundle/chunks/register-mutation-M3YS6XDO.js +813 -0
  312. package/dist/cli-bundle/chunks/register-mutation-M3YS6XDO.js.map +1 -0
  313. package/dist/cli-bundle/chunks/{register-mutation-YWSBF545.js → register-mutation-RSMT6DPK.js} +154 -43
  314. package/dist/cli-bundle/chunks/register-mutation-RSMT6DPK.js.map +7 -0
  315. package/dist/cli-bundle/chunks/register-operations-KYUOOOOD.js +370 -0
  316. package/dist/cli-bundle/chunks/register-operations-KYUOOOOD.js.map +1 -0
  317. package/dist/cli-bundle/chunks/{register-operations-3BDTGSDH.js → register-operations-Q54JQZUN.js} +33 -34
  318. package/dist/cli-bundle/chunks/register-operations-Q54JQZUN.js.map +7 -0
  319. package/dist/cli-bundle/chunks/register-setup-DI6P7X75.js +242 -0
  320. package/dist/cli-bundle/chunks/register-setup-DI6P7X75.js.map +1 -0
  321. package/dist/cli-bundle/chunks/{register-setup-V56GDRUS.js → register-setup-YJKIQRKA.js} +18 -19
  322. package/dist/cli-bundle/chunks/{register-setup-V56GDRUS.js.map → register-setup-YJKIQRKA.js.map} +2 -2
  323. package/dist/cli-bundle/chunks/restore-2XVTBLKQ.js +21 -0
  324. package/dist/cli-bundle/chunks/restore-2XVTBLKQ.js.map +1 -0
  325. package/dist/cli-bundle/chunks/restore-JL5QIH7H.js +17 -0
  326. package/dist/cli-bundle/chunks/schema-LVXZWFGY.js +770 -0
  327. package/dist/cli-bundle/chunks/schema-LVXZWFGY.js.map +1 -0
  328. package/dist/cli-bundle/chunks/schema-V6BX65Q2.js +780 -0
  329. package/dist/cli-bundle/chunks/schema-V6BX65Q2.js.map +7 -0
  330. package/dist/cli-bundle/chunks/{search-HENBL456.js → search-5A3BMFA7.js} +25 -16
  331. package/dist/cli-bundle/chunks/search-5A3BMFA7.js.map +7 -0
  332. package/dist/cli-bundle/chunks/search-C7NPB7G7.js +1127 -0
  333. package/dist/cli-bundle/chunks/search-C7NPB7G7.js.map +1 -0
  334. package/dist/cli-bundle/chunks/stats-FNLYVXTB.js +120 -0
  335. package/dist/cli-bundle/chunks/stats-FNLYVXTB.js.map +1 -0
  336. package/dist/cli-bundle/chunks/{stats-N6H3YP2F.js → stats-Y2CBTZSL.js} +7 -8
  337. package/dist/cli-bundle/chunks/{stats-N6H3YP2F.js.map → stats-Y2CBTZSL.js.map} +1 -1
  338. package/dist/cli-bundle/chunks/test-OFYONO3C.js +35 -0
  339. package/dist/cli-bundle/chunks/test-OFYONO3C.js.map +1 -0
  340. package/dist/cli-bundle/chunks/test-RJ4ZF35X.js +31 -0
  341. package/dist/cli-bundle/chunks/{test-all-G2AZOHXI.js → test-all-EEMKNTGU.js} +13 -14
  342. package/dist/cli-bundle/chunks/{test-all-G2AZOHXI.js.map → test-all-EEMKNTGU.js.map} +1 -1
  343. package/dist/cli-bundle/chunks/test-all-OJE6CIO7.js +328 -0
  344. package/dist/cli-bundle/chunks/test-all-OJE6CIO7.js.map +1 -0
  345. package/dist/cli-bundle/chunks/test-runs-IPOPFOAF.js +929 -0
  346. package/dist/cli-bundle/chunks/test-runs-IPOPFOAF.js.map +1 -0
  347. package/dist/cli-bundle/chunks/{test-runs-GX5HTPSF.js → test-runs-L2M7WKH7.js} +5 -5
  348. package/dist/cli-bundle/chunks/update-6YEHPVXH.js +25 -0
  349. package/dist/cli-bundle/chunks/update-6YEHPVXH.js.map +1 -0
  350. package/dist/cli-bundle/chunks/update-PYLVHMRD.js +21 -0
  351. package/dist/cli-bundle/chunks/{update-many-46HRSP2Q.js → update-many-322CCH2L.js} +78 -146
  352. package/dist/cli-bundle/chunks/update-many-322CCH2L.js.map +7 -0
  353. package/dist/cli-bundle/chunks/update-many-DYWGW57M.js +605 -0
  354. package/dist/cli-bundle/chunks/update-many-DYWGW57M.js.map +1 -0
  355. package/dist/cli-bundle/chunks/{upgrade-H5HHM5UV.js → upgrade-2U727SAM.js} +5 -7
  356. package/dist/cli-bundle/chunks/{upgrade-H5HHM5UV.js.map → upgrade-2U727SAM.js.map} +1 -1
  357. package/dist/cli-bundle/chunks/upgrade-3W3RVSNM.js +266 -0
  358. package/dist/cli-bundle/chunks/upgrade-3W3RVSNM.js.map +1 -0
  359. package/dist/cli-bundle/chunks/validate-GZ24NYHO.js +1120 -0
  360. package/dist/cli-bundle/chunks/validate-GZ24NYHO.js.map +1 -0
  361. package/dist/cli-bundle/chunks/{validate-TMCVKIGZ.js → validate-ZFVWPEEN.js} +61 -48
  362. package/dist/cli-bundle/chunks/validate-ZFVWPEEN.js.map +7 -0
  363. package/dist/cli-bundle/main.js +490 -52
  364. package/dist/cli-bundle/main.js.map +2 -2
  365. package/dist/core/checkpoint/mutation-checkpoint.d.ts +44 -0
  366. package/dist/core/checkpoint/mutation-checkpoint.js +119 -0
  367. package/dist/core/checkpoint/mutation-checkpoint.js.map +1 -0
  368. package/dist/core/config/positional-value.js +4 -2
  369. package/dist/core/config/positional-value.js.map +1 -1
  370. package/dist/core/diagnostics/remediation.d.ts +73 -0
  371. package/dist/core/diagnostics/remediation.js +328 -0
  372. package/dist/core/diagnostics/remediation.js.map +1 -0
  373. package/dist/core/extensions/extension-hook-runtime.js +9 -2
  374. package/dist/core/extensions/extension-hook-runtime.js.map +1 -1
  375. package/dist/core/extensions/extension-types.d.ts +60 -4
  376. package/dist/core/extensions/extension-types.js +2 -2
  377. package/dist/core/extensions/extension-types.js.map +1 -1
  378. package/dist/core/extensions/index.d.ts +5 -1
  379. package/dist/core/extensions/index.js +61 -2
  380. package/dist/core/extensions/index.js.map +1 -1
  381. package/dist/core/extensions/item-fields.d.ts +5 -1
  382. package/dist/core/extensions/item-fields.js +126 -4
  383. package/dist/core/extensions/item-fields.js.map +1 -1
  384. package/dist/core/extensions/loader.js +283 -8
  385. package/dist/core/extensions/loader.js.map +1 -1
  386. package/dist/core/item/item-format.d.ts +3 -2
  387. package/dist/core/item/item-format.js +15 -10
  388. package/dist/core/item/item-format.js.map +1 -1
  389. package/dist/core/item/status-filter.d.ts +29 -0
  390. package/dist/core/item/status-filter.js +97 -0
  391. package/dist/core/item/status-filter.js.map +1 -0
  392. package/dist/core/item/type-registry.js +4 -2
  393. package/dist/core/item/type-registry.js.map +1 -1
  394. package/dist/core/output/output.js +17 -5
  395. package/dist/core/output/output.js.map +1 -1
  396. package/dist/core/schema/item-types-file.d.ts +15 -0
  397. package/dist/core/schema/item-types-file.js +27 -2
  398. package/dist/core/schema/item-types-file.js.map +1 -1
  399. package/dist/core/schema/runtime-field-filters.js +4 -3
  400. package/dist/core/schema/runtime-field-filters.js.map +1 -1
  401. package/dist/core/schema/runtime-field-values.d.ts +1 -1
  402. package/dist/core/schema/runtime-field-values.js +10 -4
  403. package/dist/core/schema/runtime-field-values.js.map +1 -1
  404. package/dist/core/schema/runtime-schema.js +75 -2
  405. package/dist/core/schema/runtime-schema.js.map +1 -1
  406. package/dist/core/schema/status-defs-file.d.ts +113 -0
  407. package/dist/core/schema/status-defs-file.js +260 -0
  408. package/dist/core/schema/status-defs-file.js.map +1 -0
  409. package/dist/core/schema/type-workflows.d.ts +64 -0
  410. package/dist/core/schema/type-workflows.js +98 -0
  411. package/dist/core/schema/type-workflows.js.map +1 -0
  412. package/dist/core/search/cache.d.ts +3 -1
  413. package/dist/core/search/cache.js +104 -28
  414. package/dist/core/search/cache.js.map +1 -1
  415. package/dist/core/search/http-client.d.ts +2 -2
  416. package/dist/core/search/http-client.js +2 -2
  417. package/dist/core/search/http-client.js.map +1 -1
  418. package/dist/core/search/vector-stores.d.ts +1 -0
  419. package/dist/core/search/vector-stores.js +64 -14
  420. package/dist/core/search/vector-stores.js.map +1 -1
  421. package/dist/core/search/vectorization-metadata.d.ts +13 -0
  422. package/dist/core/search/vectorization-metadata.js +65 -0
  423. package/dist/core/search/vectorization-metadata.js.map +1 -0
  424. package/dist/core/shared/serialization.d.ts +1 -0
  425. package/dist/core/shared/serialization.js +86 -2
  426. package/dist/core/shared/serialization.js.map +1 -1
  427. package/dist/core/store/front-matter-cache.js +14 -5
  428. package/dist/core/store/front-matter-cache.js.map +1 -1
  429. package/dist/core/store/item-store.d.ts +2 -0
  430. package/dist/core/store/item-store.js +61 -6
  431. package/dist/core/store/item-store.js.map +1 -1
  432. package/dist/core/store/settings-validator.js +18 -2
  433. package/dist/core/store/settings-validator.js.map +1 -1
  434. package/dist/core/store/settings.js +40 -5
  435. package/dist/core/store/settings.js.map +1 -1
  436. package/dist/core/telemetry/consent.js +3 -3
  437. package/dist/core/telemetry/consent.js.map +1 -1
  438. package/dist/core/telemetry/observability.js +4 -3
  439. package/dist/core/telemetry/observability.js.map +1 -1
  440. package/dist/mcp/server.js +221 -12
  441. package/dist/mcp/server.js.map +1 -1
  442. package/dist/sdk/cli-contracts/commander-mutation-options.js +16 -2
  443. package/dist/sdk/cli-contracts/commander-mutation-options.js.map +1 -1
  444. package/dist/sdk/cli-contracts/commander-types.js +7 -2
  445. package/dist/sdk/cli-contracts/commander-types.js.map +1 -1
  446. package/dist/sdk/cli-contracts/enum-contracts.d.ts +2 -2
  447. package/dist/sdk/cli-contracts/enum-contracts.js +4 -2
  448. package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -1
  449. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +1 -0
  450. package/dist/sdk/cli-contracts/tool-option-contracts.js +53 -3
  451. package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
  452. package/dist/sdk/cli-contracts/tool-parameter-tables.js +35 -6
  453. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  454. package/dist/sdk/cli-contracts.d.ts +19 -1
  455. package/dist/sdk/cli-contracts.js +187 -15
  456. package/dist/sdk/cli-contracts.js.map +1 -1
  457. package/dist/sdk/errors.d.ts +22 -0
  458. package/dist/sdk/errors.js +46 -0
  459. package/dist/sdk/errors.js.map +1 -0
  460. package/dist/sdk/index.d.ts +2 -1
  461. package/dist/sdk/index.js +3 -2
  462. package/dist/sdk/index.js.map +1 -1
  463. package/dist/sdk/package-import-adapters.js +14 -3
  464. package/dist/sdk/package-import-adapters.js.map +1 -1
  465. package/dist/sdk/runtime.d.ts +1 -0
  466. package/dist/sdk/runtime.js +3 -2
  467. package/dist/sdk/runtime.js.map +1 -1
  468. package/dist/sdk/testing.d.ts +77 -0
  469. package/dist/sdk/testing.js +239 -0
  470. package/dist/sdk/testing.js.map +1 -0
  471. package/dist/types.d.ts +19 -0
  472. package/dist/types.js +3 -2
  473. package/dist/types.js.map +1 -1
  474. package/docs/AGENT_GUIDE.md +21 -2
  475. package/docs/COMMANDS.md +85 -5
  476. package/docs/CONFIGURATION.md +49 -2
  477. package/docs/EXTENSIONS.md +118 -6
  478. package/docs/QUICKSTART.md +2 -0
  479. package/docs/RELEASING.md +2 -2
  480. package/docs/SDK.md +273 -1
  481. package/docs/TESTING.md +17 -0
  482. package/docs/examples/policy-restricted-extension/manifest.json +1 -0
  483. package/docs/examples/starter-extension/index.js +9 -1
  484. package/docs/examples/starter-extension/manifest.json +1 -0
  485. package/package.json +12 -6
  486. package/packages/pm-beads/extensions/beads/index.js +2 -4
  487. package/packages/pm-beads/extensions/beads/index.ts +43 -33
  488. package/packages/pm-beads/extensions/beads/manifest.json +12 -1
  489. package/packages/pm-calendar/README.md +6 -0
  490. package/packages/pm-calendar/extensions/calendar/index.js +6 -1
  491. package/packages/pm-calendar/extensions/calendar/index.ts +6 -1
  492. package/packages/pm-calendar/extensions/calendar/manifest.json +6 -1
  493. package/packages/pm-governance-audit/extensions/governance-audit/manifest.json +6 -1
  494. package/packages/pm-guide-shell/README.md +4 -0
  495. package/packages/pm-guide-shell/extensions/guide-shell/index.js +22 -0
  496. package/packages/pm-guide-shell/extensions/guide-shell/index.ts +22 -0
  497. package/packages/pm-guide-shell/extensions/guide-shell/manifest.json +6 -1
  498. package/packages/pm-guide-shell/extensions/guide-shell/runtime.js +74 -3
  499. package/packages/pm-guide-shell/extensions/guide-shell/runtime.ts +84 -4
  500. package/packages/pm-lifecycle-hooks/README.md +29 -0
  501. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/index.js +18 -0
  502. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/index.ts +20 -0
  503. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/manifest.json +9 -0
  504. package/packages/pm-lifecycle-hooks/package.json +52 -0
  505. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/manifest.json +13 -1
  506. package/packages/pm-search-advanced/extensions/search-advanced/index.js +69 -1
  507. package/packages/pm-search-advanced/extensions/search-advanced/index.ts +91 -2
  508. package/packages/pm-search-advanced/extensions/search-advanced/manifest.json +13 -1
  509. package/packages/pm-templates/extensions/templates/manifest.json +6 -1
  510. package/packages/pm-todos/extensions/todos/index.js +3 -7
  511. package/packages/pm-todos/extensions/todos/index.ts +55 -42
  512. package/packages/pm-todos/extensions/todos/manifest.json +13 -1
  513. package/scripts/bundle-cli.mjs +121 -17
  514. package/dist/cli-bundle/chunks/activity-OWYSUZOY.js +0 -17
  515. package/dist/cli-bundle/chunks/chunk-3M73P3G6.js.map +0 -7
  516. package/dist/cli-bundle/chunks/chunk-4AEZR5EJ.js +0 -189
  517. package/dist/cli-bundle/chunks/chunk-4AEZR5EJ.js.map +0 -7
  518. package/dist/cli-bundle/chunks/chunk-5HSEP75M.js.map +0 -7
  519. package/dist/cli-bundle/chunks/chunk-6HT2F4TK.js.map +0 -7
  520. package/dist/cli-bundle/chunks/chunk-7Y53ZJIQ.js.map +0 -7
  521. package/dist/cli-bundle/chunks/chunk-BUPWJ3IJ.js.map +0 -7
  522. package/dist/cli-bundle/chunks/chunk-EGUGFSNX.js +0 -47
  523. package/dist/cli-bundle/chunks/chunk-EGUGFSNX.js.map +0 -7
  524. package/dist/cli-bundle/chunks/chunk-FM26RGSU.js +0 -56
  525. package/dist/cli-bundle/chunks/chunk-FM26RGSU.js.map +0 -7
  526. package/dist/cli-bundle/chunks/chunk-FQE6XZDB.js.map +0 -7
  527. package/dist/cli-bundle/chunks/chunk-GN7IJPCD.js.map +0 -7
  528. package/dist/cli-bundle/chunks/chunk-JTWRXG4B.js.map +0 -7
  529. package/dist/cli-bundle/chunks/chunk-JULRTHJQ.js.map +0 -7
  530. package/dist/cli-bundle/chunks/chunk-LSXGH6NE.js.map +0 -7
  531. package/dist/cli-bundle/chunks/chunk-MD7K4JYF.js.map +0 -7
  532. package/dist/cli-bundle/chunks/chunk-OGZEG5TT.js.map +0 -7
  533. package/dist/cli-bundle/chunks/chunk-P53TN6IA.js.map +0 -7
  534. package/dist/cli-bundle/chunks/chunk-PXUAZUUY.js.map +0 -7
  535. package/dist/cli-bundle/chunks/chunk-U7FMKRXH.js.map +0 -7
  536. package/dist/cli-bundle/chunks/chunk-VGICHR7D.js +0 -141
  537. package/dist/cli-bundle/chunks/chunk-VGICHR7D.js.map +0 -7
  538. package/dist/cli-bundle/chunks/chunk-WDPXDQFG.js.map +0 -7
  539. package/dist/cli-bundle/chunks/close-XY4CSAYF.js +0 -14
  540. package/dist/cli-bundle/chunks/config-V3FZOKLI.js.map +0 -7
  541. package/dist/cli-bundle/chunks/contracts-YLMH33VU.js.map +0 -7
  542. package/dist/cli-bundle/chunks/create-PZVHRIZQ.js +0 -28
  543. package/dist/cli-bundle/chunks/get-LTK3HOCQ.js.map +0 -7
  544. package/dist/cli-bundle/chunks/health-TCWL55KM.js.map +0 -7
  545. package/dist/cli-bundle/chunks/history-A2JUDXUE.js +0 -21
  546. package/dist/cli-bundle/chunks/history-redact-ED6RFCPL.js +0 -20
  547. package/dist/cli-bundle/chunks/init-M2WUB4YH.js +0 -16
  548. package/dist/cli-bundle/chunks/list-OGWQPC26.js +0 -20
  549. package/dist/cli-bundle/chunks/register-list-query-UP3VRUFS.js.map +0 -7
  550. package/dist/cli-bundle/chunks/register-mutation-YWSBF545.js.map +0 -7
  551. package/dist/cli-bundle/chunks/register-operations-3BDTGSDH.js.map +0 -7
  552. package/dist/cli-bundle/chunks/restore-MB2ISME7.js +0 -18
  553. package/dist/cli-bundle/chunks/schema-Q622KC46.js +0 -119
  554. package/dist/cli-bundle/chunks/schema-Q622KC46.js.map +0 -7
  555. package/dist/cli-bundle/chunks/search-HENBL456.js.map +0 -7
  556. package/dist/cli-bundle/chunks/test-VNBDRJ4Z.js +0 -32
  557. package/dist/cli-bundle/chunks/update-H6SCWNMA.js +0 -22
  558. package/dist/cli-bundle/chunks/update-many-46HRSP2Q.js.map +0 -7
  559. package/dist/cli-bundle/chunks/validate-TMCVKIGZ.js.map +0 -7
  560. /package/dist/cli-bundle/chunks/{activity-OWYSUZOY.js.map → activity-P5BUMWP3.js.map} +0 -0
  561. /package/dist/cli-bundle/chunks/{aggregate-ADUOSFRO.js.map → aggregate-OOAGKWRG.js.map} +0 -0
  562. /package/dist/cli-bundle/chunks/{chunk-G57E5D7T.js.map → chunk-ATBVS6WW.js.map} +0 -0
  563. /package/dist/cli-bundle/chunks/{chunk-KBQY3YG5.js.map → chunk-BNL6S7QH.js.map} +0 -0
  564. /package/dist/cli-bundle/chunks/{chunk-NGN7UV5K.js.map → chunk-CJDQB2ED.js.map} +0 -0
  565. /package/dist/cli-bundle/chunks/{chunk-D7AOMPRH.js.map → chunk-D3WUNETC.js.map} +0 -0
  566. /package/dist/cli-bundle/chunks/{chunk-L2FXEKDB.js.map → chunk-JB4RGL4V.js.map} +0 -0
  567. /package/dist/cli-bundle/chunks/{chunk-SEXQN4KL.js.map → chunk-K47WAYQV.js.map} +0 -0
  568. /package/dist/cli-bundle/chunks/{chunk-CEFIVZPG.js.map → chunk-KA24HME7.js.map} +0 -0
  569. /package/dist/cli-bundle/chunks/{chunk-A7E7PUVX.js.map → chunk-LDJK7SHN.js.map} +0 -0
  570. /package/dist/cli-bundle/chunks/{chunk-PVNQLCIS.js.map → chunk-RANZIID5.js.map} +0 -0
  571. /package/dist/cli-bundle/chunks/{chunk-JFWUHHS2.js.map → chunk-S3CV7JGJ.js.map} +0 -0
  572. /package/dist/cli-bundle/chunks/{chunk-LRBOHPUE.js.map → chunk-WIKR7KFL.js.map} +0 -0
  573. /package/dist/cli-bundle/chunks/{chunk-AKOOMO3T.js.map → chunk-XX5LRINW.js.map} +0 -0
  574. /package/dist/cli-bundle/chunks/{chunk-WJ2NAC37.js.map → chunk-Y2AKE2HS.js.map} +0 -0
  575. /package/dist/cli-bundle/chunks/{close-XY4CSAYF.js.map → close-RMHQ3KWH.js.map} +0 -0
  576. /package/dist/cli-bundle/chunks/{create-PZVHRIZQ.js.map → create-ATONSAZW.js.map} +0 -0
  577. /package/dist/cli-bundle/chunks/{extension-B4WL7BQU.js.map → extension-G6UXSM5S.js.map} +0 -0
  578. /package/dist/cli-bundle/chunks/{gc-JWNF66EC.js.map → gc-QNBRJG6H.js.map} +0 -0
  579. /package/dist/cli-bundle/chunks/{history-A2JUDXUE.js.map → history-6FC4H6HI.js.map} +0 -0
  580. /package/dist/cli-bundle/chunks/{history-redact-ED6RFCPL.js.map → history-redact-XKYEZDBL.js.map} +0 -0
  581. /package/dist/cli-bundle/chunks/{init-M2WUB4YH.js.map → init-KHX3FEEM.js.map} +0 -0
  582. /package/dist/cli-bundle/chunks/{list-OGWQPC26.js.map → list-53LZ2AEO.js.map} +0 -0
  583. /package/dist/cli-bundle/chunks/{restore-MB2ISME7.js.map → restore-JL5QIH7H.js.map} +0 -0
  584. /package/dist/cli-bundle/chunks/{test-VNBDRJ4Z.js.map → test-RJ4ZF35X.js.map} +0 -0
  585. /package/dist/cli-bundle/chunks/{test-runs-GX5HTPSF.js.map → test-runs-L2M7WKH7.js.map} +0 -0
  586. /package/dist/cli-bundle/chunks/{update-H6SCWNMA.js.map → update-PYLVHMRD.js.map} +0 -0
@@ -0,0 +1,412 @@
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]="7064c464-ee52-5164-a51a-6a337b42c837")}catch(e){}}();
3
+ import {
4
+ verifyHistoryChain
5
+ } from "./chunk-ASQM3IF5.js";
6
+ import {
7
+ hashDocument
8
+ } from "./chunk-CWT53EYT.js";
9
+ import {
10
+ getHistoryPath,
11
+ writeFileAtomic
12
+ } from "./chunk-4LTBNUYT.js";
13
+
14
+ // dist/core/history/drift-scan.js
15
+ import fs from "fs/promises";
16
+ import path from "node:path";
17
+ var DRIFT_CACHE_VERSION = 1;
18
+ var DRIFT_CACHE_FILENAME = "history-drift-cache.json";
19
+ function getDriftCachePath(pmRoot) {
20
+ return path.join(pmRoot, "runtime", DRIFT_CACHE_FILENAME);
21
+ }
22
+ async function loadDriftCache(pmRoot) {
23
+ try {
24
+ const raw = await fs.readFile(getDriftCachePath(pmRoot), "utf8");
25
+ const parsed = JSON.parse(raw);
26
+ if (parsed.version !== DRIFT_CACHE_VERSION || typeof parsed.entries !== "object" || parsed.entries === null) {
27
+ return null;
28
+ }
29
+ return parsed;
30
+ } catch {
31
+ return null;
32
+ }
33
+ }
34
+ function isErrno(error, code) {
35
+ return typeof error === "object" && error !== null && "code" in error && error.code === code;
36
+ }
37
+ async function verifyHistoryStream(historyPath) {
38
+ const raw = await fs.readFile(historyPath, "utf8");
39
+ if (raw.trim().length === 0) {
40
+ return null;
41
+ }
42
+ const entries = [];
43
+ let latestAfterHash = null;
44
+ for (const line of raw.split(/\r?\n/)) {
45
+ const trimmed = line.trim();
46
+ if (trimmed.length === 0) {
47
+ continue;
48
+ }
49
+ const parsed = JSON.parse(trimmed);
50
+ if (typeof parsed.after_hash !== "string" || parsed.after_hash.trim().length === 0) {
51
+ throw new Error("missing after_hash");
52
+ }
53
+ entries.push(parsed);
54
+ latestAfterHash = parsed.after_hash;
55
+ }
56
+ if (!latestAfterHash) {
57
+ return null;
58
+ }
59
+ return { latestAfterHash, chainOk: verifyHistoryChain(entries).ok };
60
+ }
61
+ async function scanHistoryDrift(pmRoot, items) {
62
+ const missingStreams = [];
63
+ const unreadableStreams = [];
64
+ const hashMismatches = [];
65
+ const chainMismatches = [];
66
+ const cache = await loadDriftCache(pmRoot);
67
+ const previousEntries = cache?.entries ?? {};
68
+ const nextEntries = {};
69
+ let cacheDirty = false;
70
+ for (const item of items) {
71
+ const historyPath = getHistoryPath(pmRoot, item.id);
72
+ let stat;
73
+ try {
74
+ stat = await fs.stat(historyPath);
75
+ } catch (error) {
76
+ if (isErrno(error, "ENOENT")) {
77
+ missingStreams.push(item.id);
78
+ } else {
79
+ unreadableStreams.push(item.id);
80
+ }
81
+ continue;
82
+ }
83
+ const cached = previousEntries[item.id];
84
+ let verification;
85
+ if (cached && cached.mtime_ms === stat.mtimeMs && cached.ctime_ms === stat.ctimeMs && cached.size === stat.size) {
86
+ verification = { latestAfterHash: cached.latest_after_hash, chainOk: cached.chain_ok };
87
+ } else {
88
+ cacheDirty = true;
89
+ let result;
90
+ try {
91
+ result = await verifyHistoryStream(historyPath);
92
+ } catch {
93
+ unreadableStreams.push(item.id);
94
+ continue;
95
+ }
96
+ if (!result) {
97
+ missingStreams.push(item.id);
98
+ continue;
99
+ }
100
+ verification = result;
101
+ }
102
+ if (!verification.chainOk) {
103
+ chainMismatches.push(item.id);
104
+ }
105
+ nextEntries[item.id] = {
106
+ mtime_ms: stat.mtimeMs,
107
+ ctime_ms: stat.ctimeMs,
108
+ size: stat.size,
109
+ latest_after_hash: verification.latestAfterHash,
110
+ chain_ok: verification.chainOk
111
+ };
112
+ const { body, ...frontMatter } = item;
113
+ const currentHash = hashDocument({
114
+ metadata: frontMatter,
115
+ body
116
+ });
117
+ if (currentHash !== verification.latestAfterHash) {
118
+ hashMismatches.push(item.id);
119
+ }
120
+ }
121
+ if (cacheDirty || Object.keys(previousEntries).length !== Object.keys(nextEntries).length) {
122
+ const cachePath = getDriftCachePath(pmRoot);
123
+ try {
124
+ await fs.mkdir(path.dirname(cachePath), { recursive: true });
125
+ await writeFileAtomic(cachePath, JSON.stringify({ version: DRIFT_CACHE_VERSION, entries: nextEntries }));
126
+ } catch {
127
+ }
128
+ }
129
+ const driftedItems = [.../* @__PURE__ */ new Set([...missingStreams, ...unreadableStreams, ...hashMismatches, ...chainMismatches])].sort((a, b) => a.localeCompare(b));
130
+ return { missingStreams, unreadableStreams, hashMismatches, chainMismatches, driftedItems };
131
+ }
132
+
133
+ // dist/core/diagnostics/remediation.js
134
+ var REMEDIATION_REGISTRY = Object.freeze([
135
+ // --- pm health: directories ---
136
+ {
137
+ code: "missing_directory",
138
+ command: "pm init",
139
+ summary: "Recreate missing tracker directories (pm init is idempotent and restores the scaffold)."
140
+ },
141
+ // --- pm health: settings (read/parse) ---
142
+ {
143
+ code: "settings_read_invalid_json",
144
+ command: "pm config list --json",
145
+ summary: "settings.json is not valid JSON and pm fell back to defaults; fix the syntax error in the reported path, then re-run."
146
+ },
147
+ {
148
+ code: "settings_read_invalid_schema",
149
+ command: "pm config list --json",
150
+ summary: "settings.json failed schema validation and pm fell back to defaults; correct the reported key in the file, then re-run."
151
+ },
152
+ {
153
+ code: "settings_read_merge_failed",
154
+ command: "pm config list --json",
155
+ summary: "Global/project settings could not be merged; reconcile the conflicting keys in the reported settings files."
156
+ },
157
+ // --- pm health: settings_values ---
158
+ {
159
+ code: "settings:id_prefix_empty",
160
+ command: "pm config list --json",
161
+ summary: 'id_prefix is empty; set a non-empty "id_prefix" in settings.json so generated item ids are well-formed.'
162
+ },
163
+ {
164
+ code: "settings:locks_ttl_non_positive",
165
+ command: "pm config list --json",
166
+ summary: 'locks.ttl_seconds must be positive; set a positive "locks.ttl_seconds" in settings.json.'
167
+ },
168
+ // --- pm health: telemetry (advisory) ---
169
+ {
170
+ code: "telemetry_state_invalid_json",
171
+ command: "pm health --check-telemetry",
172
+ summary: "Local telemetry state file is corrupt; pm recreates it on the next flush. Advisory only."
173
+ },
174
+ {
175
+ code: "telemetry_queue_invalid_rows",
176
+ command: "pm health --check-telemetry",
177
+ summary: "The telemetry queue has unparseable rows; they are skipped on the next flush. Advisory only."
178
+ },
179
+ {
180
+ code: "telemetry_queue_pending",
181
+ command: "pm health --check-telemetry",
182
+ summary: "Telemetry events are queued; they flush automatically on the next reachable command. Advisory only."
183
+ },
184
+ {
185
+ code: "telemetry_endpoint_probe_failed",
186
+ command: "pm health --check-telemetry",
187
+ summary: "The telemetry endpoint is unreachable; events stay queued until it recovers. Advisory only."
188
+ },
189
+ {
190
+ code: "telemetry_endpoint_probe_http_status",
191
+ command: "pm health --check-telemetry",
192
+ summary: "The telemetry endpoint returned a non-success status; events stay queued until it recovers. Advisory only."
193
+ },
194
+ // --- pm health: integrity ---
195
+ {
196
+ code: "integrity_item_unreadable",
197
+ command: "pm validate --check-files --verbose-diagnostics",
198
+ summary: "An item file could not be read; restore or repair the file at the reported path."
199
+ },
200
+ {
201
+ code: "integrity_item_parse_failed",
202
+ command: "pm validate --check-files --verbose-diagnostics",
203
+ summary: "An item file failed to parse; fix the malformed front matter at the reported path."
204
+ },
205
+ {
206
+ code: "integrity_item_conflict_marker",
207
+ command: "pm validate --check-files --verbose-diagnostics",
208
+ summary: "An item file contains Git conflict markers; resolve the <<<<<<< / >>>>>>> markers at the reported line."
209
+ },
210
+ {
211
+ code: "integrity_history_unreadable",
212
+ command: "pm history-repair <id>",
213
+ summary: "A history stream could not be read; re-anchor the affected item's history chain."
214
+ },
215
+ {
216
+ code: "integrity_history_invalid_json",
217
+ command: "pm history-repair <id>",
218
+ summary: "A history stream contains invalid JSON; re-anchor the affected item's history chain."
219
+ },
220
+ {
221
+ code: "integrity_history_conflict_marker",
222
+ command: "pm history-repair <id>",
223
+ summary: "A history stream contains Git conflict markers; resolve the markers, then re-anchor the chain."
224
+ },
225
+ // --- pm health: history_drift ---
226
+ {
227
+ code: "history_drift_missing_stream",
228
+ command: "pm history-repair <id>",
229
+ summary: "The item has no history stream; re-anchor the chain to rebuild it."
230
+ },
231
+ {
232
+ code: "history_drift_unreadable_stream",
233
+ command: "pm history-repair <id>",
234
+ summary: "The item's history stream is unreadable; re-anchor the chain."
235
+ },
236
+ {
237
+ code: "history_drift_hash_mismatch",
238
+ command: "pm history-repair <id>",
239
+ summary: "The item's content hash no longer matches its history; re-anchor the chain."
240
+ },
241
+ {
242
+ code: "history_drift_chain_mismatch",
243
+ command: "pm history-repair <id>",
244
+ summary: "The item's history chain is broken; re-anchor the chain."
245
+ },
246
+ // --- pm health: vectorization ---
247
+ {
248
+ code: "vectorization_stale_items_remaining",
249
+ command: "pm health --refresh-vectors",
250
+ summary: "Some items have stale embeddings; refresh vectors so semantic search results stay current."
251
+ },
252
+ // --- pm validate: metadata ---
253
+ // Note: validate_metadata_missing_author has no entry on purpose. `pm update
254
+ // --author` sets the mutation/audit author (history), not the item's
255
+ // `metadata.author` front-matter field, and there is no CLI flag that writes
256
+ // that field — so emitting a command here would record an audit entry without
257
+ // clearing the finding. A missing item author must be restored at the source.
258
+ {
259
+ code: "validate_metadata_missing_acceptance_criteria",
260
+ command: 'pm update <id> --acceptance-criteria "<criteria>"',
261
+ summary: "Backfill the missing acceptance criteria on the reported item(s)."
262
+ },
263
+ {
264
+ code: "validate_metadata_missing_estimate",
265
+ command: 'pm update <id> --estimate "<estimate>"',
266
+ summary: "Backfill the missing estimate on the reported item(s)."
267
+ },
268
+ {
269
+ code: "validate_metadata_missing_close_reason",
270
+ command: 'pm update <id> --close-reason "<reason>"',
271
+ summary: "Backfill the missing close reason on the reported closed item(s)."
272
+ },
273
+ {
274
+ code: "validate_metadata_missing_reviewer",
275
+ command: 'pm update <id> --reviewer "<name>"',
276
+ summary: "Backfill the missing reviewer on the reported item(s)."
277
+ },
278
+ {
279
+ code: "validate_metadata_missing_risk",
280
+ command: 'pm update <id> --risk "<level>"',
281
+ summary: "Backfill the missing risk on the reported item(s)."
282
+ },
283
+ {
284
+ code: "validate_metadata_missing_confidence",
285
+ command: 'pm update <id> --confidence "<level>"',
286
+ summary: "Backfill the missing confidence on the reported item(s)."
287
+ },
288
+ {
289
+ code: "validate_metadata_missing_sprint",
290
+ command: 'pm update <id> --sprint "<sprint>"',
291
+ summary: "Backfill the missing sprint on the reported item(s)."
292
+ },
293
+ {
294
+ code: "validate_metadata_missing_release",
295
+ command: 'pm update <id> --release "<release>"',
296
+ summary: "Backfill the missing release on the reported item(s)."
297
+ },
298
+ {
299
+ code: "validate_metadata_custom_profile_missing_required_fields",
300
+ command: 'pm config set metadata-required-fields --criterion "<field>"',
301
+ summary: "Config-driven finding: the custom metadata profile has no required fields configured and falls back to core, so configure the fields rather than mutating items."
302
+ },
303
+ // --- pm validate: resolution ---
304
+ {
305
+ code: "validate_resolution_missing_fields",
306
+ command: 'pm update <id> --resolution "<how resolved>"',
307
+ summary: "Backfill resolution / expected_result / actual_result on the reported closed item(s)."
308
+ },
309
+ // --- pm validate: lifecycle ---
310
+ {
311
+ code: "validate_lifecycle_active_closure_like_metadata",
312
+ command: "pm update <id> --unset <closure-like-field>",
313
+ summary: "Clear the closure-like field the validator flags on this active item \u2014 the detail row names it (resolution / actual-result / blocked-reason) \u2014 or close the item if it is actually done."
314
+ },
315
+ {
316
+ code: "validate_lifecycle_active_terminal_parent",
317
+ command: "pm update <id> --parent <active-parent-id>",
318
+ summary: "Reopen the terminal parent or move the active child under a non-terminal parent."
319
+ },
320
+ {
321
+ code: "validate_lifecycle_stale_blockers",
322
+ command: "pm update <id> --unset blocked-by --unset blocked-reason",
323
+ summary: "Resolve the stale blocker the validator flags: clear blocked-by/blocked-reason when they linger on a non-blocked item or report a resolved blocker; if instead a blocked item is missing blocker context, add the context or move it out of a blocked status."
324
+ },
325
+ {
326
+ code: "validate_lifecycle_dependency_cycles_error",
327
+ command: "pm update <id> --dep-remove <dep-id>",
328
+ summary: "Break the dependency cycle by removing one edge from the reported cycle."
329
+ },
330
+ {
331
+ code: "validate_lifecycle_dependency_cycles",
332
+ command: "pm update <id> --dep-remove <dep-id>",
333
+ summary: "Break the dependency cycle by removing one edge from the reported cycle."
334
+ },
335
+ // --- pm validate: files ---
336
+ {
337
+ code: "validate_files_missing_linked_paths",
338
+ command: "pm <files|docs> <id> --remove <path>",
339
+ summary: "The check spans both item.files and item.docs under one code: restore the missing linked artifact, or unlink it with pm files (linked file) or pm docs (linked doc)."
340
+ },
341
+ {
342
+ code: "validate_files_orphaned_paths",
343
+ command: "pm <files|docs> <id> --add <path>",
344
+ summary: "Link the orphaned artifact with pm files (file) or pm docs (doc), or remove it from the workspace."
345
+ },
346
+ {
347
+ code: "validate_files_tracked_all_strict_forces_pm_internals",
348
+ command: "pm validate --check-files --include-pm-internals",
349
+ summary: "tracked-all-strict scan flagged pm internals; re-run with --include-pm-internals or a softer --scan-mode."
350
+ },
351
+ // --- pm validate: history_drift ---
352
+ {
353
+ code: "validate_history_drift_missing_streams",
354
+ command: "pm history-repair <id>",
355
+ summary: "Re-anchor the history chains of the items missing a history stream."
356
+ },
357
+ {
358
+ code: "validate_history_drift_unreadable_streams",
359
+ command: "pm history-repair <id>",
360
+ summary: "Re-anchor the history chains of the items with an unreadable history stream."
361
+ },
362
+ {
363
+ code: "validate_history_drift_hash_mismatches",
364
+ command: "pm history-repair <id>",
365
+ summary: "Re-anchor the history chains of the items whose content hash drifted."
366
+ },
367
+ {
368
+ code: "validate_history_drift_chain_mismatches",
369
+ command: "pm history-repair <id>",
370
+ summary: "Re-anchor the history chains of the items with a broken history chain."
371
+ },
372
+ // --- pm validate: command_references ---
373
+ {
374
+ code: "validate_command_references_stale_pm_ids",
375
+ command: 'pm update <id> --replace-tests --test "command=<corrected-command>" [--test ...]',
376
+ summary: "Correct the stale pm-ID inside the item's linked test command (the check scans tests[].command, not the body). --replace-tests overwrites the entire tests list, so re-include the item's other linked tests in the same call."
377
+ }
378
+ ]);
379
+ function resolveRemediation(warning) {
380
+ if (typeof warning !== "string") {
381
+ return void 0;
382
+ }
383
+ const normalized = warning.trim();
384
+ for (const entry of REMEDIATION_REGISTRY) {
385
+ if (normalized === entry.code || normalized.startsWith(`${entry.code}:`)) {
386
+ return entry;
387
+ }
388
+ }
389
+ return void 0;
390
+ }
391
+ function buildRemediationMap(warnings) {
392
+ const map = {};
393
+ for (const warning of warnings) {
394
+ const entry = resolveRemediation(warning);
395
+ if (entry !== void 0 && !Object.prototype.hasOwnProperty.call(map, entry.code)) {
396
+ map[entry.code] = entry.command;
397
+ }
398
+ }
399
+ return map;
400
+ }
401
+ function buildRemediationCommands(warnings) {
402
+ return Object.values(buildRemediationMap(warnings));
403
+ }
404
+
405
+ export {
406
+ scanHistoryDrift,
407
+ buildRemediationMap,
408
+ buildRemediationCommands
409
+ };
410
+ //# sourceMappingURL=chunk-5KB4X7YY.js.map
411
+
412
+ //# debugId=7064c464-ee52-5164-a51a-6a337b42c837
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../core/history/drift-scan.ts","../../../../../../../../core/diagnostics/remediation.ts"],"sourcesContent":["import fs from \"fs/promises\";\nimport path from \"node:path\";\nimport { getHistoryPath } from \"../store/paths.js\";\nimport { writeFileAtomic } from \"../fs/fs-utils.js\";\nimport { hashDocument } from \"./history.js\";\nimport { verifyHistoryChain } from \"./replay.js\";\nimport type { HistoryEntry, ItemMetadata } from \"../../types/index.js\";\n\nexport interface DriftScanResult {\n missingStreams: string[];\n unreadableStreams: string[];\n hashMismatches: string[];\n chainMismatches: string[];\n driftedItems: string[];\n}\n\nconst DRIFT_CACHE_VERSION = 1;\nconst DRIFT_CACHE_FILENAME = \"history-drift-cache.json\";\n\ninterface DriftCacheEntry {\n mtime_ms: number;\n ctime_ms: number;\n size: number;\n latest_after_hash: string;\n chain_ok: boolean;\n}\n\ninterface DriftCacheEnvelope {\n version: number;\n entries: Record<string, DriftCacheEntry>;\n}\n\nfunction getDriftCachePath(pmRoot: string): string {\n return path.join(pmRoot, \"runtime\", DRIFT_CACHE_FILENAME);\n}\n\nasync function loadDriftCache(pmRoot: string): Promise<DriftCacheEnvelope | null> {\n try {\n const raw = await fs.readFile(getDriftCachePath(pmRoot), \"utf8\");\n const parsed = JSON.parse(raw) as DriftCacheEnvelope;\n if (parsed.version !== DRIFT_CACHE_VERSION || typeof parsed.entries !== \"object\" || parsed.entries === null) {\n return null;\n }\n return parsed;\n } catch {\n return null;\n }\n}\n\nfunction isErrno(error: unknown, code: string): boolean {\n return typeof error === \"object\" && error !== null && \"code\" in error && (error as { code?: string }).code === code;\n}\n\ninterface StreamVerification {\n latestAfterHash: string;\n chainOk: boolean;\n}\n\n/**\n * Read and fully verify one history stream's hash chain. Returns null for an\n * empty/missing stream (caller records it as a missing stream).\n */\nasync function verifyHistoryStream(historyPath: string): Promise<StreamVerification | null> {\n const raw = await fs.readFile(historyPath, \"utf8\");\n if (raw.trim().length === 0) {\n return null;\n }\n const entries: HistoryEntry[] = [];\n let latestAfterHash: string | null = null;\n for (const line of raw.split(/\\r?\\n/)) {\n const trimmed = line.trim();\n if (trimmed.length === 0) {\n continue;\n }\n const parsed = JSON.parse(trimmed) as HistoryEntry;\n if (typeof parsed.after_hash !== \"string\" || parsed.after_hash.trim().length === 0) {\n throw new Error(\"missing after_hash\");\n }\n entries.push(parsed);\n latestAfterHash = parsed.after_hash;\n }\n /* c8 ignore start -- defensive guard for future history schema changes. */\n if (!latestAfterHash) {\n return null;\n }\n /* c8 ignore stop */\n return { latestAfterHash, chainOk: verifyHistoryChain(entries).ok };\n}\n\n/**\n * Scan every item's history stream for drift (missing/unreadable streams, broken\n * hash chains, and item/history hash mismatches).\n *\n * Full chain re-verification of a 17MB+ history tree is the dominant cost of\n * `pm health`. We cache the per-stream verification keyed by the history file's\n * mtime/size: an unchanged file has an identical chain and latest stored hash, so\n * we skip re-reading and re-hashing it. Item-side changes are still caught every\n * run because the current document hash is recomputed and compared to the cached\n * `latest_after_hash`.\n */\nexport async function scanHistoryDrift(\n pmRoot: string,\n items: Array<ItemMetadata & { body: string }>,\n): Promise<DriftScanResult> {\n const missingStreams: string[] = [];\n const unreadableStreams: string[] = [];\n const hashMismatches: string[] = [];\n const chainMismatches: string[] = [];\n\n const cache = await loadDriftCache(pmRoot);\n const previousEntries: Record<string, DriftCacheEntry> = cache?.entries ?? {};\n const nextEntries: Record<string, DriftCacheEntry> = {};\n let cacheDirty = false;\n\n for (const item of items) {\n const historyPath = getHistoryPath(pmRoot, item.id);\n\n let stat: Awaited<ReturnType<typeof fs.stat>>;\n try {\n stat = await fs.stat(historyPath);\n } catch (error: unknown) {\n if (isErrno(error, \"ENOENT\")) {\n missingStreams.push(item.id);\n } else {\n unreadableStreams.push(item.id);\n }\n continue;\n }\n\n const cached = previousEntries[item.id];\n let verification: StreamVerification;\n if (cached && cached.mtime_ms === stat.mtimeMs && cached.ctime_ms === stat.ctimeMs && cached.size === stat.size) {\n verification = { latestAfterHash: cached.latest_after_hash, chainOk: cached.chain_ok };\n } else {\n cacheDirty = true;\n let result: StreamVerification | null;\n try {\n result = await verifyHistoryStream(historyPath);\n } catch {\n unreadableStreams.push(item.id);\n continue;\n }\n if (!result) {\n missingStreams.push(item.id);\n continue;\n }\n verification = result;\n }\n\n if (!verification.chainOk) {\n chainMismatches.push(item.id);\n }\n nextEntries[item.id] = {\n mtime_ms: stat.mtimeMs,\n ctime_ms: stat.ctimeMs,\n size: stat.size,\n latest_after_hash: verification.latestAfterHash,\n chain_ok: verification.chainOk,\n };\n\n const { body, ...frontMatter } = item;\n const currentHash = hashDocument({\n metadata: frontMatter as ItemMetadata,\n body,\n });\n if (currentHash !== verification.latestAfterHash) {\n hashMismatches.push(item.id);\n }\n }\n\n if (cacheDirty || Object.keys(previousEntries).length !== Object.keys(nextEntries).length) {\n const cachePath = getDriftCachePath(pmRoot);\n try {\n await fs.mkdir(path.dirname(cachePath), { recursive: true });\n await writeFileAtomic(cachePath, JSON.stringify({ version: DRIFT_CACHE_VERSION, entries: nextEntries }));\n } catch {\n // Best-effort cache write: a failed persist must never fail a health scan.\n }\n }\n\n const driftedItems = [...new Set([...missingStreams, ...unreadableStreams, ...hashMismatches, ...chainMismatches])].sort((a, b) =>\n a.localeCompare(b),\n );\n return { missingStreams, unreadableStreams, hashMismatches, chainMismatches, driftedItems };\n}\n","/**\n * Shared machine-executable remediation registry.\n *\n * `pm health` and `pm validate` both emit stable, colon-delimited warning tokens\n * (for example `history_drift_missing_stream:pm-abcd` or\n * `validate_resolution_missing_fields:3`). Agents that gate on these commands\n * previously had to hardcode the mapping from a warning code to the `pm` command\n * that fixes it. This module is the single source of truth for that mapping so\n * `pm health --json` (per-check `remediation_map`) and `pm validate --fix-hints`\n * (per-check `fix_hints`) can both surface executable remediation without any\n * duplicated, drift-prone lookup tables.\n *\n * Semantics of {@link RemediationEntry.command}: the suggested next `pm` command\n * an operator/agent should run to resolve findings with that code. Per-item\n * findings use an `<id>` placeholder (callers that have the concrete id may\n * substitute it); findings whose only fix is a manual file edit point at the\n * most useful diagnostic/repair command and describe the manual step in\n * {@link RemediationEntry.summary}.\n */\n\nexport interface RemediationEntry {\n /**\n * Stable warning-code prefix this entry resolves. A warning matches when it\n * equals this code or begins with `<code>:`. Registry codes are mutually\n * exclusive under that colon-boundary rule (no code is a `:`-delimited prefix\n * of another — e.g. `settings:id_prefix_empty` is distinct from a bare\n * `settings`, which is intentionally not registered), so `resolveRemediation`\n * uses first-match with no ordering dependency.\n */\n readonly code: string;\n /** Executable `pm` command (or imperative) that resolves the finding. May contain an `<id>` placeholder. */\n readonly command: string;\n /** One-line description of what the command does / which manual step it covers. */\n readonly summary: string;\n}\n\n/**\n * Registry of every non-extension `pm health` / `pm validate` warning code and\n * its remediation. Extension findings keep their richer, contextual\n * `details.triage.remediation` produced by the extension health triage and are\n * intentionally excluded here (see pm-0hnu: \"all non-extension checks\").\n */\nexport const REMEDIATION_REGISTRY: readonly RemediationEntry[] = Object.freeze([\n // --- pm health: directories ---\n {\n code: \"missing_directory\",\n command: \"pm init\",\n summary: \"Recreate missing tracker directories (pm init is idempotent and restores the scaffold).\",\n },\n // --- pm health: settings (read/parse) ---\n {\n code: \"settings_read_invalid_json\",\n command: \"pm config list --json\",\n summary:\n \"settings.json is not valid JSON and pm fell back to defaults; fix the syntax error in the reported path, then re-run.\",\n },\n {\n code: \"settings_read_invalid_schema\",\n command: \"pm config list --json\",\n summary:\n \"settings.json failed schema validation and pm fell back to defaults; correct the reported key in the file, then re-run.\",\n },\n {\n code: \"settings_read_merge_failed\",\n command: \"pm config list --json\",\n summary: \"Global/project settings could not be merged; reconcile the conflicting keys in the reported settings files.\",\n },\n // --- pm health: settings_values ---\n {\n code: \"settings:id_prefix_empty\",\n command: \"pm config list --json\",\n summary: 'id_prefix is empty; set a non-empty \"id_prefix\" in settings.json so generated item ids are well-formed.',\n },\n {\n code: \"settings:locks_ttl_non_positive\",\n command: \"pm config list --json\",\n summary: 'locks.ttl_seconds must be positive; set a positive \"locks.ttl_seconds\" in settings.json.',\n },\n // --- pm health: telemetry (advisory) ---\n {\n code: \"telemetry_state_invalid_json\",\n command: \"pm health --check-telemetry\",\n summary: \"Local telemetry state file is corrupt; pm recreates it on the next flush. Advisory only.\",\n },\n {\n code: \"telemetry_queue_invalid_rows\",\n command: \"pm health --check-telemetry\",\n summary: \"The telemetry queue has unparseable rows; they are skipped on the next flush. Advisory only.\",\n },\n {\n code: \"telemetry_queue_pending\",\n command: \"pm health --check-telemetry\",\n summary: \"Telemetry events are queued; they flush automatically on the next reachable command. Advisory only.\",\n },\n {\n code: \"telemetry_endpoint_probe_failed\",\n command: \"pm health --check-telemetry\",\n summary: \"The telemetry endpoint is unreachable; events stay queued until it recovers. Advisory only.\",\n },\n {\n code: \"telemetry_endpoint_probe_http_status\",\n command: \"pm health --check-telemetry\",\n summary: \"The telemetry endpoint returned a non-success status; events stay queued until it recovers. Advisory only.\",\n },\n // --- pm health: integrity ---\n {\n code: \"integrity_item_unreadable\",\n command: \"pm validate --check-files --verbose-diagnostics\",\n summary: \"An item file could not be read; restore or repair the file at the reported path.\",\n },\n {\n code: \"integrity_item_parse_failed\",\n command: \"pm validate --check-files --verbose-diagnostics\",\n summary: \"An item file failed to parse; fix the malformed front matter at the reported path.\",\n },\n {\n code: \"integrity_item_conflict_marker\",\n command: \"pm validate --check-files --verbose-diagnostics\",\n summary: \"An item file contains Git conflict markers; resolve the <<<<<<< / >>>>>>> markers at the reported line.\",\n },\n {\n code: \"integrity_history_unreadable\",\n command: \"pm history-repair <id>\",\n summary: \"A history stream could not be read; re-anchor the affected item's history chain.\",\n },\n {\n code: \"integrity_history_invalid_json\",\n command: \"pm history-repair <id>\",\n summary: \"A history stream contains invalid JSON; re-anchor the affected item's history chain.\",\n },\n {\n code: \"integrity_history_conflict_marker\",\n command: \"pm history-repair <id>\",\n summary: \"A history stream contains Git conflict markers; resolve the markers, then re-anchor the chain.\",\n },\n // --- pm health: history_drift ---\n {\n code: \"history_drift_missing_stream\",\n command: \"pm history-repair <id>\",\n summary: \"The item has no history stream; re-anchor the chain to rebuild it.\",\n },\n {\n code: \"history_drift_unreadable_stream\",\n command: \"pm history-repair <id>\",\n summary: \"The item's history stream is unreadable; re-anchor the chain.\",\n },\n {\n code: \"history_drift_hash_mismatch\",\n command: \"pm history-repair <id>\",\n summary: \"The item's content hash no longer matches its history; re-anchor the chain.\",\n },\n {\n code: \"history_drift_chain_mismatch\",\n command: \"pm history-repair <id>\",\n summary: \"The item's history chain is broken; re-anchor the chain.\",\n },\n // --- pm health: vectorization ---\n {\n code: \"vectorization_stale_items_remaining\",\n command: \"pm health --refresh-vectors\",\n summary: \"Some items have stale embeddings; refresh vectors so semantic search results stay current.\",\n },\n // --- pm validate: metadata ---\n // Note: validate_metadata_missing_author has no entry on purpose. `pm update\n // --author` sets the mutation/audit author (history), not the item's\n // `metadata.author` front-matter field, and there is no CLI flag that writes\n // that field — so emitting a command here would record an audit entry without\n // clearing the finding. A missing item author must be restored at the source.\n {\n code: \"validate_metadata_missing_acceptance_criteria\",\n command: 'pm update <id> --acceptance-criteria \"<criteria>\"',\n summary: \"Backfill the missing acceptance criteria on the reported item(s).\",\n },\n {\n code: \"validate_metadata_missing_estimate\",\n command: 'pm update <id> --estimate \"<estimate>\"',\n summary: \"Backfill the missing estimate on the reported item(s).\",\n },\n {\n code: \"validate_metadata_missing_close_reason\",\n command: 'pm update <id> --close-reason \"<reason>\"',\n summary: \"Backfill the missing close reason on the reported closed item(s).\",\n },\n {\n code: \"validate_metadata_missing_reviewer\",\n command: 'pm update <id> --reviewer \"<name>\"',\n summary: \"Backfill the missing reviewer on the reported item(s).\",\n },\n {\n code: \"validate_metadata_missing_risk\",\n command: 'pm update <id> --risk \"<level>\"',\n summary: \"Backfill the missing risk on the reported item(s).\",\n },\n {\n code: \"validate_metadata_missing_confidence\",\n command: 'pm update <id> --confidence \"<level>\"',\n summary: \"Backfill the missing confidence on the reported item(s).\",\n },\n {\n code: \"validate_metadata_missing_sprint\",\n command: 'pm update <id> --sprint \"<sprint>\"',\n summary: \"Backfill the missing sprint on the reported item(s).\",\n },\n {\n code: \"validate_metadata_missing_release\",\n command: 'pm update <id> --release \"<release>\"',\n summary: \"Backfill the missing release on the reported item(s).\",\n },\n {\n code: \"validate_metadata_custom_profile_missing_required_fields\",\n command: 'pm config set metadata-required-fields --criterion \"<field>\"',\n summary:\n \"Config-driven finding: the custom metadata profile has no required fields configured and falls back to core, so configure the fields rather than mutating items.\",\n },\n // --- pm validate: resolution ---\n {\n code: \"validate_resolution_missing_fields\",\n command: 'pm update <id> --resolution \"<how resolved>\"',\n summary: \"Backfill resolution / expected_result / actual_result on the reported closed item(s).\",\n },\n // --- pm validate: lifecycle ---\n {\n code: \"validate_lifecycle_active_closure_like_metadata\",\n command: \"pm update <id> --unset <closure-like-field>\",\n summary:\n \"Clear the closure-like field the validator flags on this active item — the detail row names it (resolution / actual-result / blocked-reason) — or close the item if it is actually done.\",\n },\n {\n code: \"validate_lifecycle_active_terminal_parent\",\n command: \"pm update <id> --parent <active-parent-id>\",\n summary: \"Reopen the terminal parent or move the active child under a non-terminal parent.\",\n },\n {\n code: \"validate_lifecycle_stale_blockers\",\n command: \"pm update <id> --unset blocked-by --unset blocked-reason\",\n summary:\n \"Resolve the stale blocker the validator flags: clear blocked-by/blocked-reason when they linger on a non-blocked item or report a resolved blocker; if instead a blocked item is missing blocker context, add the context or move it out of a blocked status.\",\n },\n {\n code: \"validate_lifecycle_dependency_cycles_error\",\n command: \"pm update <id> --dep-remove <dep-id>\",\n summary: \"Break the dependency cycle by removing one edge from the reported cycle.\",\n },\n {\n code: \"validate_lifecycle_dependency_cycles\",\n command: \"pm update <id> --dep-remove <dep-id>\",\n summary: \"Break the dependency cycle by removing one edge from the reported cycle.\",\n },\n // --- pm validate: files ---\n {\n code: \"validate_files_missing_linked_paths\",\n command: \"pm <files|docs> <id> --remove <path>\",\n summary:\n \"The check spans both item.files and item.docs under one code: restore the missing linked artifact, or unlink it with pm files (linked file) or pm docs (linked doc).\",\n },\n {\n code: \"validate_files_orphaned_paths\",\n command: \"pm <files|docs> <id> --add <path>\",\n summary:\n \"Link the orphaned artifact with pm files (file) or pm docs (doc), or remove it from the workspace.\",\n },\n {\n code: \"validate_files_tracked_all_strict_forces_pm_internals\",\n command: \"pm validate --check-files --include-pm-internals\",\n summary: \"tracked-all-strict scan flagged pm internals; re-run with --include-pm-internals or a softer --scan-mode.\",\n },\n // --- pm validate: history_drift ---\n {\n code: \"validate_history_drift_missing_streams\",\n command: \"pm history-repair <id>\",\n summary: \"Re-anchor the history chains of the items missing a history stream.\",\n },\n {\n code: \"validate_history_drift_unreadable_streams\",\n command: \"pm history-repair <id>\",\n summary: \"Re-anchor the history chains of the items with an unreadable history stream.\",\n },\n {\n code: \"validate_history_drift_hash_mismatches\",\n command: \"pm history-repair <id>\",\n summary: \"Re-anchor the history chains of the items whose content hash drifted.\",\n },\n {\n code: \"validate_history_drift_chain_mismatches\",\n command: \"pm history-repair <id>\",\n summary: \"Re-anchor the history chains of the items with a broken history chain.\",\n },\n // --- pm validate: command_references ---\n {\n code: \"validate_command_references_stale_pm_ids\",\n command: 'pm update <id> --replace-tests --test \"command=<corrected-command>\" [--test ...]',\n summary:\n \"Correct the stale pm-ID inside the item's linked test command (the check scans tests[].command, not the body). --replace-tests overwrites the entire tests list, so re-include the item's other linked tests in the same call.\",\n },\n]);\n\n/**\n * Resolve the remediation entry for a warning token, or `undefined` when no\n * entry is registered. A warning matches an entry when it equals the entry code\n * or begins with `<code>:` (the colon boundary keeps sibling codes such as\n * `validate_lifecycle_dependency_cycles` and\n * `validate_lifecycle_dependency_cycles_error` disjoint).\n *\n * First match is intentional and correct: registry codes are mutually exclusive\n * under the colon-boundary rule, so at most one entry can ever match a warning\n * and order is irrelevant. That invariant is enforced by a test (see\n * remediation-registry.spec.ts \"keeps every registry code mutually exclusive\"),\n * which is why this stays a simple linear scan rather than a longest-prefix\n * search — a longest-prefix tie-break is unreachable with disjoint codes.\n *\n * Accepts unknown input defensively (this is an exported helper SDK consumers\n * may call from untyped JS): a non-string `warning` resolves to `undefined`.\n */\nexport function resolveRemediation(warning: string): RemediationEntry | undefined {\n if (typeof warning !== \"string\") {\n return undefined;\n }\n const normalized = warning.trim();\n for (const entry of REMEDIATION_REGISTRY) {\n if (normalized === entry.code || normalized.startsWith(`${entry.code}:`)) {\n return entry;\n }\n }\n return undefined;\n}\n\n/**\n * Build a compact `remediation_map` (code -> command) for a set of warning\n * tokens. First match wins per code; unknown codes are skipped. Used by\n * `pm health --json` per-check details and as the source of deduped executable\n * commands for `pm validate --fix-hints`.\n */\nexport function buildRemediationMap(warnings: Iterable<string>): Record<string, string> {\n const map: Record<string, string> = {};\n for (const warning of warnings) {\n const entry = resolveRemediation(warning);\n if (entry !== undefined && !Object.prototype.hasOwnProperty.call(map, entry.code)) {\n map[entry.code] = entry.command;\n }\n }\n return map;\n}\n\n/**\n * Build a deduped, ordered list of executable remediation commands for a set of\n * warning tokens (one command per distinct matched code). Used by\n * `pm validate --fix-hints` for checks that do not already emit per-row\n * remediation commands.\n */\nexport function buildRemediationCommands(warnings: Iterable<string>): string[] {\n return Object.values(buildRemediationMap(warnings));\n}\n"],"names":[],"mappings":"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","debugId":"7064c464-ee52-5164-a51a-6a337b42c837"}
@@ -0,0 +1,182 @@
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]="5824ce26-e61b-5294-a4fa-9a239e190399")}catch(e){}}();
3
+ import {
4
+ listAllFrontMatterLight,
5
+ mutateItem,
6
+ toItemRecord
7
+ } from "./chunk-CWT53EYT.js";
8
+ import {
9
+ isTerminalStatus
10
+ } from "./chunk-KBG47ZOY.js";
11
+ import {
12
+ resolveItemTypeRegistry
13
+ } from "./chunk-SZQCER6S.js";
14
+ import {
15
+ EXIT_CODE,
16
+ PmCliError,
17
+ getSettingsPath,
18
+ pathExists,
19
+ readSettings,
20
+ resolvePmRoot,
21
+ resolveRuntimeStatusRegistry
22
+ } from "./chunk-4LTBNUYT.js";
23
+
24
+ // dist/cli/commands/close.js
25
+ function toAuthor(candidate, defaultAuthor) {
26
+ const resolved = candidate ?? process.env.PM_AUTHOR ?? defaultAuthor;
27
+ const trimmed = resolved.trim();
28
+ return trimmed || "unknown";
29
+ }
30
+ function ensureCloseReason(reasonText) {
31
+ const reason = reasonText.trim();
32
+ if (reason.length === 0) {
33
+ throw new PmCliError("Close reason text must not be empty", EXIT_CODE.USAGE);
34
+ }
35
+ return reason;
36
+ }
37
+ var CLOSE_VALIDATION_FIELDS = [
38
+ { key: "resolution", label: "resolution" },
39
+ { key: "expected_result", label: "expected_result" },
40
+ { key: "actual_result", label: "actual_result" }
41
+ ];
42
+ function parseValidateCloseMode(raw) {
43
+ if (raw === void 0) {
44
+ return void 0;
45
+ }
46
+ const normalized = raw.trim().toLowerCase();
47
+ if (normalized.length === 0 || normalized === "warn") {
48
+ return "warn";
49
+ }
50
+ if (normalized === "off" || normalized === "none" || normalized === "disabled") {
51
+ return "off";
52
+ }
53
+ if (normalized === "strict") {
54
+ return "strict";
55
+ }
56
+ throw new PmCliError(`Invalid --validate-close mode "${raw}" (expected "off", "warn", or "strict")`, EXIT_CODE.USAGE);
57
+ }
58
+ function findMissingCloseValidationFields(frontMatter) {
59
+ const missing = [];
60
+ for (const field of CLOSE_VALIDATION_FIELDS) {
61
+ const rawValue = frontMatter[field.key];
62
+ if (typeof rawValue !== "string" || rawValue.trim().length === 0) {
63
+ missing.push(field.label);
64
+ }
65
+ }
66
+ return missing;
67
+ }
68
+ async function findActiveChildIds(pmRoot, settings, parentId, statusRegistry) {
69
+ const typeRegistry = resolveItemTypeRegistry(settings);
70
+ const items = await listAllFrontMatterLight(pmRoot, settings.item_format, typeRegistry.type_to_folder, void 0, settings.schema);
71
+ return items.filter((item) => item.parent === parentId && !isTerminalStatus(item.status, statusRegistry)).map((item) => item.id).sort((left, right) => left.localeCompare(right));
72
+ }
73
+ async function runClose(id, closeReasonText, options, global) {
74
+ const pmRoot = resolvePmRoot(process.cwd(), global.path);
75
+ if (!await pathExists(getSettingsPath(pmRoot))) {
76
+ throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
77
+ }
78
+ const settings = await readSettings(pmRoot);
79
+ const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
80
+ const author = toAuthor(options.author, settings.author_default);
81
+ const closeReason = ensureCloseReason(closeReasonText);
82
+ const validateCloseMode = parseValidateCloseMode(options.validateClose) ?? settings.governance.close_validation_default;
83
+ const activeChildIds = await findActiveChildIds(pmRoot, settings, id, statusRegistry);
84
+ const result = await mutateItem({
85
+ pmRoot,
86
+ settings,
87
+ id,
88
+ op: "close",
89
+ author,
90
+ message: options.message,
91
+ force: options.force,
92
+ mutate(document) {
93
+ if (isTerminalStatus(document.metadata.status, statusRegistry) && !options.force) {
94
+ throw new PmCliError(`Item ${document.metadata.id} is already terminal; use --force to close again.`, EXIT_CODE.CONFLICT);
95
+ }
96
+ const mutationWarnings = [];
97
+ const inlineCloseFields = [
98
+ { option: options.resolution, key: "resolution" },
99
+ { option: options.expectedResult, key: "expected_result" },
100
+ { option: options.actualResult, key: "actual_result" }
101
+ ];
102
+ for (const { option, key } of inlineCloseFields) {
103
+ if (typeof option !== "string")
104
+ continue;
105
+ const trimmed = option.trim();
106
+ if (trimmed.length === 0)
107
+ continue;
108
+ document.metadata[key] = trimmed;
109
+ }
110
+ if (validateCloseMode !== "off") {
111
+ const missingFields = findMissingCloseValidationFields(document.metadata);
112
+ if (missingFields.length > 0) {
113
+ if (validateCloseMode === "strict") {
114
+ throw new PmCliError(`Cannot close item ${document.metadata.id}: missing ${missingFields.join(", ")}. Populate fields or use --validate-close warn.`, EXIT_CODE.USAGE);
115
+ }
116
+ mutationWarnings.push(`close_validation_missing_fields:${document.metadata.id}:${missingFields.join(",")}`);
117
+ }
118
+ if (activeChildIds.length > 0) {
119
+ if (validateCloseMode === "strict") {
120
+ throw new PmCliError(`Cannot close item ${document.metadata.id}: active child items remain open (${activeChildIds.join(", ")}). Close, cancel, or re-parent them first, or use --validate-close warn.`, EXIT_CODE.USAGE);
121
+ }
122
+ mutationWarnings.push(`close_validation_active_children:${document.metadata.id}:${activeChildIds.join(",")}`);
123
+ }
124
+ } else if (activeChildIds.length > 0) {
125
+ mutationWarnings.push(`closed_with_active_children:${document.metadata.id}:${activeChildIds.join(",")}`);
126
+ }
127
+ document.metadata.status = statusRegistry.close_status;
128
+ document.metadata.close_reason = closeReason;
129
+ const changedFields = ["status", "close_reason"];
130
+ for (const { option, key } of inlineCloseFields) {
131
+ if (typeof option === "string" && option.trim().length > 0) {
132
+ changedFields.push(key);
133
+ }
134
+ }
135
+ if (document.metadata.assignee !== void 0) {
136
+ delete document.metadata.assignee;
137
+ changedFields.push("assignee");
138
+ }
139
+ const previousBlockedBy = typeof document.metadata.blocked_by === "string" ? document.metadata.blocked_by.trim() : "";
140
+ const existingDeps = document.metadata.dependencies ?? [];
141
+ const blockedByEdge = existingDeps.find((dep) => dep.kind === "blocked_by");
142
+ const hadBlockedReason = document.metadata.blocked_reason !== void 0;
143
+ if (previousBlockedBy.length > 0 || blockedByEdge !== void 0 || hadBlockedReason) {
144
+ if (previousBlockedBy.length > 0) {
145
+ delete document.metadata.blocked_by;
146
+ changedFields.push("blocked_by");
147
+ }
148
+ if (hadBlockedReason) {
149
+ delete document.metadata.blocked_reason;
150
+ changedFields.push("blocked_reason");
151
+ }
152
+ if (blockedByEdge !== void 0) {
153
+ const remainingDeps = existingDeps.filter((dep) => dep.kind !== "blocked_by");
154
+ if (remainingDeps.length > 0) {
155
+ document.metadata.dependencies = remainingDeps;
156
+ } else {
157
+ delete document.metadata.dependencies;
158
+ }
159
+ changedFields.push("dependencies");
160
+ }
161
+ const reportedBlocker = previousBlockedBy || blockedByEdge?.id || "unknown";
162
+ mutationWarnings.push(`closed_cleared_blocked_by:${document.metadata.id}:${reportedBlocker}`);
163
+ }
164
+ return {
165
+ changedFields,
166
+ ...mutationWarnings.length > 0 ? { warnings: mutationWarnings } : {}
167
+ };
168
+ }
169
+ });
170
+ return {
171
+ item: toItemRecord(result.item),
172
+ changed_fields: result.changedFields,
173
+ warnings: result.warnings
174
+ };
175
+ }
176
+
177
+ export {
178
+ runClose
179
+ };
180
+ //# sourceMappingURL=chunk-5PAOPUZX.js.map
181
+
182
+ //# debugId=5824ce26-e61b-5294-a4fa-9a239e190399