@unbrained/pm-cli 2026.7.19 → 2026.7.20

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 (600) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/AGENTS.md +2 -0
  3. package/CHANGELOG.md +36 -0
  4. package/dist/cli/commands/append.js +13 -6
  5. package/dist/cli/commands/append.js.map +1 -1
  6. package/dist/cli/commands/calendar.d.ts +1 -1
  7. package/dist/cli/commands/calendar.js +2 -2
  8. package/dist/cli/commands/calendar.js.map +1 -1
  9. package/dist/cli/commands/comments.js +2 -5
  10. package/dist/cli/commands/comments.js.map +1 -1
  11. package/dist/cli/commands/completion.js +11 -3
  12. package/dist/cli/commands/completion.js.map +1 -1
  13. package/dist/cli/commands/context.d.ts +1 -1
  14. package/dist/cli/commands/context.js +2 -2
  15. package/dist/cli/commands/context.js.map +1 -1
  16. package/dist/cli/commands/contracts.js +4 -3
  17. package/dist/cli/commands/contracts.js.map +1 -1
  18. package/dist/cli/commands/copy.js +5 -3
  19. package/dist/cli/commands/copy.js.map +1 -1
  20. package/dist/cli/commands/create.d.ts +3 -1
  21. package/dist/cli/commands/create.js +5 -3
  22. package/dist/cli/commands/create.js.map +1 -1
  23. package/dist/cli/commands/merge.d.ts +8 -0
  24. package/dist/cli/commands/merge.js +12 -0
  25. package/dist/cli/commands/merge.js.map +1 -0
  26. package/dist/cli/commands/plan.d.ts +1 -1
  27. package/dist/cli/commands/plan.js +2 -2
  28. package/dist/cli/commands/plan.js.map +1 -1
  29. package/dist/cli/commands/update-many.d.ts +5 -0
  30. package/dist/cli/commands/update-many.js +81 -6
  31. package/dist/cli/commands/update-many.js.map +1 -1
  32. package/dist/cli/commands/update.d.ts +5 -1
  33. package/dist/cli/commands/update.js +50 -4
  34. package/dist/cli/commands/update.js.map +1 -1
  35. package/dist/cli/register-list-query.js +14 -2
  36. package/dist/cli/register-list-query.js.map +1 -1
  37. package/dist/cli/register-mutation.js +61 -2
  38. package/dist/cli/register-mutation.js.map +1 -1
  39. package/dist/cli/register-operations.js +5 -3
  40. package/dist/cli/register-operations.js.map +1 -1
  41. package/dist/cli/registration-helpers.js +4 -2
  42. package/dist/cli/registration-helpers.js.map +1 -1
  43. package/dist/cli-bundle/bundle-manifest.json +365 -333
  44. package/dist/cli-bundle/chunks/{append-MBXHNWSX.js → append-E6V54WOQ.js} +5 -5
  45. package/dist/cli-bundle/chunks/append-NNJ3EFIT.js +11 -0
  46. package/dist/cli-bundle/chunks/{chunk-M4B4RK4J.js → chunk-2BO4CA46.js} +14 -238
  47. package/dist/cli-bundle/chunks/{chunk-M4B4RK4J.js.map → chunk-2BO4CA46.js.map} +1 -1
  48. package/dist/cli-bundle/chunks/{chunk-MQOSMBWV.js → chunk-3AO5VSDR.js} +25 -6
  49. package/dist/cli-bundle/chunks/chunk-3AO5VSDR.js.map +7 -0
  50. package/dist/cli-bundle/chunks/{chunk-ODEIDKGW.js → chunk-3LPFHE3P.js} +596 -154
  51. package/dist/cli-bundle/chunks/chunk-3LPFHE3P.js.map +1 -0
  52. package/dist/cli-bundle/chunks/{chunk-YGEA4CLH.js → chunk-3MCTMJXI.js} +4 -4
  53. package/dist/cli-bundle/chunks/{chunk-N7FCFJ76.js → chunk-3P7UJQOX.js} +2 -2
  54. package/dist/cli-bundle/chunks/{chunk-7B7IHMLH.js → chunk-3VY6MIEO.js} +3 -3
  55. package/dist/cli-bundle/chunks/{chunk-3EZZTFL2.js → chunk-4F6BWJ4J.js} +51 -43
  56. package/dist/cli-bundle/chunks/chunk-4F6BWJ4J.js.map +7 -0
  57. package/dist/cli-bundle/chunks/{chunk-VA3H7VVC.js → chunk-4L23AGQ7.js} +9 -7
  58. package/dist/cli-bundle/chunks/chunk-4L23AGQ7.js.map +1 -0
  59. package/dist/cli-bundle/chunks/{chunk-5S6IZXK7.js → chunk-4U4Z6AHI.js} +7 -7
  60. package/dist/cli-bundle/chunks/{chunk-UOIFZ66L.js → chunk-4XGJLADW.js} +3 -3
  61. package/dist/cli-bundle/chunks/{chunk-SUNZKVAH.js → chunk-5IZJWSDB.js} +5 -5
  62. package/dist/cli-bundle/chunks/{chunk-QQ77W23U.js → chunk-5NTE36LD.js} +4 -4
  63. package/dist/cli-bundle/chunks/{chunk-EVAN5VJA.js → chunk-5OK4UGFV.js} +5 -8
  64. package/dist/cli-bundle/chunks/{chunk-EVAN5VJA.js.map → chunk-5OK4UGFV.js.map} +2 -2
  65. package/dist/cli-bundle/chunks/{chunk-H3YKUVDR.js → chunk-5UX66S6U.js} +26 -7
  66. package/dist/cli-bundle/chunks/chunk-5UX66S6U.js.map +1 -0
  67. package/dist/cli-bundle/chunks/{chunk-KGPLSHJD.js → chunk-6C2ZZX5Z.js} +2 -2
  68. package/dist/cli-bundle/chunks/{chunk-Q5NHJ6RO.js → chunk-6JUTHVQS.js} +2 -2
  69. package/dist/cli-bundle/chunks/{chunk-NTS2RKHN.js → chunk-6VIJ7UA5.js} +15 -15
  70. package/dist/cli-bundle/chunks/{chunk-BBGR4FKQ.js → chunk-6XMUURSS.js} +6 -6
  71. package/dist/cli-bundle/chunks/chunk-6XMUURSS.js.map +1 -0
  72. package/dist/cli-bundle/chunks/{chunk-XVB6BATY.js → chunk-72LQ4TKV.js} +3 -3
  73. package/dist/cli-bundle/chunks/{chunk-WCBB6VI3.js → chunk-7AVEY74G.js} +8 -5
  74. package/dist/cli-bundle/chunks/chunk-7AVEY74G.js.map +7 -0
  75. package/dist/cli-bundle/chunks/{chunk-YG56M3NE.js → chunk-7DOJC3HS.js} +8 -8
  76. package/dist/cli-bundle/chunks/chunk-7DOJC3HS.js.map +1 -0
  77. package/dist/cli-bundle/chunks/{chunk-KZ5AC6B5.js → chunk-7WCE6Y64.js} +2 -2
  78. package/dist/cli-bundle/chunks/{chunk-VQOG2ETB.js → chunk-AF2CCM5U.js} +4 -4
  79. package/dist/cli-bundle/chunks/{chunk-P24ZU5QV.js → chunk-AOEOYL3S.js} +49 -12
  80. package/dist/cli-bundle/chunks/chunk-AOEOYL3S.js.map +7 -0
  81. package/dist/cli-bundle/chunks/{chunk-BZKE2O5V.js → chunk-BKIAH72N.js} +8 -6
  82. package/dist/cli-bundle/chunks/chunk-BKIAH72N.js.map +1 -0
  83. package/dist/cli-bundle/chunks/{chunk-RWAIRGBC.js → chunk-C3KD7U3T.js} +12 -243
  84. package/dist/cli-bundle/chunks/chunk-C3KD7U3T.js.map +7 -0
  85. package/dist/cli-bundle/chunks/chunk-CFHAODHQ.js +334 -0
  86. package/dist/cli-bundle/chunks/chunk-CFHAODHQ.js.map +1 -0
  87. package/dist/cli-bundle/chunks/{chunk-TELI67UP.js → chunk-CQTQKUUV.js} +6 -9
  88. package/dist/cli-bundle/chunks/{chunk-TELI67UP.js.map → chunk-CQTQKUUV.js.map} +1 -1
  89. package/dist/cli-bundle/chunks/{chunk-ZUCBPXNA.js → chunk-D6NXDNP3.js} +5 -5
  90. package/dist/cli-bundle/chunks/chunk-D6NXDNP3.js.map +7 -0
  91. package/dist/cli-bundle/chunks/{chunk-EAV3P54W.js → chunk-DAQ45GCS.js} +5 -5
  92. package/dist/cli-bundle/chunks/{chunk-6V4T4RD3.js → chunk-DVDBQA3B.js} +79 -22
  93. package/dist/cli-bundle/chunks/chunk-DVDBQA3B.js.map +1 -0
  94. package/dist/cli-bundle/chunks/chunk-E6LEMURX.js +249 -0
  95. package/dist/cli-bundle/chunks/chunk-E6LEMURX.js.map +7 -0
  96. package/dist/cli-bundle/chunks/{chunk-ZF52NVRT.js → chunk-E7ICD63T.js} +131 -179
  97. package/dist/cli-bundle/chunks/chunk-E7ICD63T.js.map +7 -0
  98. package/dist/cli-bundle/chunks/{chunk-RX53WHFI.js → chunk-EJDGV4GR.js} +3 -3
  99. package/dist/cli-bundle/chunks/{chunk-IXG5CMBR.js → chunk-FDHPAVVB.js} +4 -4
  100. package/dist/cli-bundle/chunks/{chunk-KAE727L2.js → chunk-FSRHYUDA.js} +2 -2
  101. package/dist/cli-bundle/chunks/chunk-FSRHYUDA.js.map +7 -0
  102. package/dist/cli-bundle/chunks/{chunk-46Z6FAVP.js → chunk-G3COA6GS.js} +51 -43
  103. package/dist/cli-bundle/chunks/chunk-G3COA6GS.js.map +1 -0
  104. package/dist/cli-bundle/chunks/{chunk-A4FVWFZY.js → chunk-GFQP7HAZ.js} +8 -6
  105. package/dist/cli-bundle/chunks/chunk-GFQP7HAZ.js.map +7 -0
  106. package/dist/cli-bundle/chunks/{chunk-2XPDCXK5.js → chunk-GIQSU6S2.js} +6 -6
  107. package/dist/cli-bundle/chunks/chunk-GIQSU6S2.js.map +1 -0
  108. package/dist/cli-bundle/chunks/{chunk-V4QHAMI5.js → chunk-GROYI4RB.js} +3 -3
  109. package/dist/cli-bundle/chunks/{chunk-77XFQRTD.js → chunk-GSJSM5BJ.js} +3 -3
  110. package/dist/cli-bundle/chunks/{chunk-QYGK2XQ3.js → chunk-GTLCVJOE.js} +3 -3
  111. package/dist/cli-bundle/chunks/{chunk-VSQE43NO.js → chunk-GV2262OF.js} +4 -4
  112. package/dist/cli-bundle/chunks/{chunk-N2TEEOXJ.js → chunk-GVI6FAFG.js} +8 -6
  113. package/dist/cli-bundle/chunks/chunk-GVI6FAFG.js.map +7 -0
  114. package/dist/cli-bundle/chunks/{chunk-A5EQPNV7.js → chunk-GVT754PX.js} +44 -3
  115. package/dist/cli-bundle/chunks/chunk-GVT754PX.js.map +7 -0
  116. package/dist/cli-bundle/chunks/{chunk-Y2VSGFT4.js → chunk-HB3P4M52.js} +22 -7
  117. package/dist/cli-bundle/chunks/chunk-HB3P4M52.js.map +1 -0
  118. package/dist/cli-bundle/chunks/{chunk-STBCBDKF.js → chunk-HCEBZNC3.js} +6 -6
  119. package/dist/cli-bundle/chunks/{chunk-EEECAV5M.js → chunk-HEWM6CEN.js} +80 -25
  120. package/dist/cli-bundle/chunks/chunk-HEWM6CEN.js.map +7 -0
  121. package/dist/cli-bundle/chunks/{chunk-GKCEEXMA.js → chunk-HQ3SB4CN.js} +21 -6
  122. package/dist/cli-bundle/chunks/{chunk-GKCEEXMA.js.map → chunk-HQ3SB4CN.js.map} +2 -2
  123. package/dist/cli-bundle/chunks/{chunk-U6RYD446.js → chunk-HRW7GF6T.js} +7 -7
  124. package/dist/cli-bundle/chunks/{chunk-D35WYXWC.js → chunk-HYW67VJ5.js} +6 -3
  125. package/dist/cli-bundle/chunks/chunk-HYW67VJ5.js.map +1 -0
  126. package/dist/cli-bundle/chunks/{chunk-OKWJUL6F.js → chunk-I577UHC7.js} +16 -9
  127. package/dist/cli-bundle/chunks/{chunk-OKWJUL6F.js.map → chunk-I577UHC7.js.map} +2 -2
  128. package/dist/cli-bundle/chunks/{chunk-XDWXPG2E.js → chunk-IAQE32BI.js} +4 -4
  129. package/dist/cli-bundle/chunks/{chunk-66SRNEBK.js → chunk-IJNK6WW2.js} +3 -3
  130. package/dist/cli-bundle/chunks/chunk-INSTSQNZ.js +623 -0
  131. package/dist/cli-bundle/chunks/chunk-INSTSQNZ.js.map +7 -0
  132. package/dist/cli-bundle/chunks/{chunk-A3GAQLBH.js → chunk-IX677TRO.js} +75 -12
  133. package/dist/cli-bundle/chunks/chunk-IX677TRO.js.map +7 -0
  134. package/dist/cli-bundle/chunks/{chunk-RLLOZAM2.js → chunk-IY6VZ3IW.js} +29 -8
  135. package/dist/cli-bundle/chunks/chunk-IY6VZ3IW.js.map +7 -0
  136. package/dist/cli-bundle/chunks/{chunk-SVAWG7EE.js → chunk-J4FBIFU6.js} +45 -4
  137. package/dist/cli-bundle/chunks/chunk-J4FBIFU6.js.map +1 -0
  138. package/dist/cli-bundle/chunks/{chunk-AGEBQRBG.js → chunk-JAPE62Y5.js} +9 -9
  139. package/dist/cli-bundle/chunks/{chunk-UWAQI3B7.js → chunk-JGUKMMRS.js} +3 -3
  140. package/dist/cli-bundle/chunks/{chunk-UU6EP25G.js → chunk-JH2ZSLO3.js} +2 -2
  141. package/dist/cli-bundle/chunks/{chunk-GRDK25BN.js → chunk-JHJSFOAM.js} +6 -6
  142. package/dist/cli-bundle/chunks/{chunk-FQO5THHM.js → chunk-JM6YAXTR.js} +2 -2
  143. package/dist/cli-bundle/chunks/{chunk-E7KBMWEF.js → chunk-JSLT7WVE.js} +2 -2
  144. package/dist/cli-bundle/chunks/{chunk-FIUTBFC6.js → chunk-K4CI6Y45.js} +2 -2
  145. package/dist/cli-bundle/chunks/{chunk-IEMXESIS.js → chunk-KSPWRNVP.js} +7 -7
  146. package/dist/cli-bundle/chunks/{chunk-3QNUDDY2.js → chunk-KZEANWJS.js} +14 -12
  147. package/dist/cli-bundle/chunks/{chunk-3QNUDDY2.js.map → chunk-KZEANWJS.js.map} +2 -2
  148. package/dist/cli-bundle/chunks/{chunk-BFJP4VYC.js → chunk-L7BH7IWU.js} +4 -4
  149. package/dist/cli-bundle/chunks/{chunk-2UCG5H6B.js → chunk-LPEYZRUR.js} +3 -3
  150. package/dist/cli-bundle/chunks/{chunk-FQF6VVPH.js → chunk-MYSS5H2A.js} +9 -7
  151. package/dist/cli-bundle/chunks/{chunk-FQF6VVPH.js.map → chunk-MYSS5H2A.js.map} +1 -1
  152. package/dist/cli-bundle/chunks/{chunk-IR3GOO6E.js → chunk-NHT3F4WZ.js} +15 -15
  153. package/dist/cli-bundle/chunks/{chunk-6BNV3G6C.js → chunk-NLR32VFS.js} +2 -2
  154. package/dist/cli-bundle/chunks/{chunk-BDC4TW4B.js → chunk-OV7MSW3I.js} +15 -13
  155. package/dist/cli-bundle/chunks/chunk-OV7MSW3I.js.map +1 -0
  156. package/dist/cli-bundle/chunks/{chunk-EI3UIMZM.js → chunk-OWXOPDHD.js} +4 -4
  157. package/dist/cli-bundle/chunks/chunk-P7JTWYLH.js +246 -0
  158. package/dist/cli-bundle/chunks/chunk-P7JTWYLH.js.map +1 -0
  159. package/dist/cli-bundle/chunks/{chunk-AQUNTB7G.js → chunk-PEQGTJ5Q.js} +3 -3
  160. package/dist/cli-bundle/chunks/{chunk-QFG4MB7P.js → chunk-POG76WWZ.js} +28 -7
  161. package/dist/cli-bundle/chunks/chunk-POG76WWZ.js.map +1 -0
  162. package/dist/cli-bundle/chunks/{chunk-MI3346YW.js → chunk-QANSTTC7.js} +129 -170
  163. package/dist/cli-bundle/chunks/chunk-QANSTTC7.js.map +1 -0
  164. package/dist/cli-bundle/chunks/{chunk-T6MOTLOJ.js → chunk-QJKL5PHS.js} +2 -2
  165. package/dist/cli-bundle/chunks/{chunk-SBW7EQC4.js → chunk-QLZ643FM.js} +76 -13
  166. package/dist/cli-bundle/chunks/chunk-QLZ643FM.js.map +1 -0
  167. package/dist/cli-bundle/chunks/{chunk-XKVHL3MB.js → chunk-QWRVBJ4D.js} +2 -2
  168. package/dist/cli-bundle/chunks/chunk-R3EWPG4A.js +106 -0
  169. package/dist/cli-bundle/chunks/chunk-R3EWPG4A.js.map +1 -0
  170. package/dist/cli-bundle/chunks/chunk-R5U2VZ3K.js +344 -0
  171. package/dist/cli-bundle/chunks/chunk-R5U2VZ3K.js.map +7 -0
  172. package/dist/cli-bundle/chunks/{chunk-VFA5EIEN.js → chunk-R7QV7ICM.js} +4 -4
  173. package/dist/cli-bundle/chunks/{chunk-NPEYH6CE.js → chunk-RDV4ZFYS.js} +12 -10
  174. package/dist/cli-bundle/chunks/{chunk-NPEYH6CE.js.map → chunk-RDV4ZFYS.js.map} +1 -1
  175. package/dist/cli-bundle/chunks/{chunk-K2L6FZBX.js → chunk-RJO3YAFM.js} +4 -4
  176. package/dist/cli-bundle/chunks/{chunk-YIC5NGXF.js → chunk-RMF7LMBS.js} +7 -7
  177. package/dist/cli-bundle/chunks/{chunk-YIC5NGXF.js.map → chunk-RMF7LMBS.js.map} +2 -2
  178. package/dist/cli-bundle/chunks/{chunk-MRXAHR4B.js → chunk-RZJLNXFG.js} +50 -13
  179. package/dist/cli-bundle/chunks/chunk-RZJLNXFG.js.map +1 -0
  180. package/dist/cli-bundle/chunks/{chunk-DJAGYYCQ.js → chunk-SC2HMDGB.js} +19 -3
  181. package/dist/cli-bundle/chunks/chunk-SC2HMDGB.js.map +1 -0
  182. package/dist/cli-bundle/chunks/{chunk-SGJB6PXA.js → chunk-SF3DT5HJ.js} +3 -3
  183. package/dist/cli-bundle/chunks/chunk-SG74J6MV.js +604 -0
  184. package/dist/cli-bundle/chunks/chunk-SG74J6MV.js.map +1 -0
  185. package/dist/cli-bundle/chunks/{chunk-Q3K5XPAQ.js → chunk-SR3JOATZ.js} +18 -2
  186. package/dist/cli-bundle/chunks/chunk-SR3JOATZ.js.map +7 -0
  187. package/dist/cli-bundle/chunks/{chunk-DUDLSQFG.js → chunk-SSKOQNMS.js} +14 -12
  188. package/dist/cli-bundle/chunks/{chunk-DUDLSQFG.js.map → chunk-SSKOQNMS.js.map} +1 -1
  189. package/dist/cli-bundle/chunks/{chunk-UNNCT5QY.js → chunk-SZVB53Y3.js} +3 -3
  190. package/dist/cli-bundle/chunks/{chunk-JBW2S2C6.js → chunk-T44FMVRL.js} +613 -157
  191. package/dist/cli-bundle/chunks/chunk-T44FMVRL.js.map +7 -0
  192. package/dist/cli-bundle/chunks/{chunk-GFZB5CLP.js → chunk-T6PPNM7V.js} +4 -4
  193. package/dist/cli-bundle/chunks/{chunk-UE7LK3RE.js → chunk-THAOZG4U.js} +9 -7
  194. package/dist/cli-bundle/chunks/chunk-THAOZG4U.js.map +1 -0
  195. package/dist/cli-bundle/chunks/{chunk-IGBBTPM5.js → chunk-TOBGV45Y.js} +4 -4
  196. package/dist/cli-bundle/chunks/chunk-TOBGV45Y.js.map +1 -0
  197. package/dist/cli-bundle/chunks/{chunk-W6IEJXNC.js → chunk-TVYYO5A7.js} +2 -2
  198. package/dist/cli-bundle/chunks/chunk-TYHJDFYW.js +109 -0
  199. package/dist/cli-bundle/chunks/chunk-TYHJDFYW.js.map +7 -0
  200. package/dist/cli-bundle/chunks/{chunk-DOASIOQR.js → chunk-UQLXSG72.js} +2 -2
  201. package/dist/cli-bundle/chunks/{chunk-IDUTGRDM.js → chunk-URXVHN3L.js} +3 -3
  202. package/dist/cli-bundle/chunks/chunk-URXVHN3L.js.map +1 -0
  203. package/dist/cli-bundle/chunks/{chunk-7CHWLT2J.js → chunk-UVN66B3M.js} +2 -2
  204. package/dist/cli-bundle/chunks/{chunk-Q6JPYR7I.js → chunk-UX6SSO2I.js} +2 -2
  205. package/dist/cli-bundle/chunks/{chunk-JPWUZOMR.js → chunk-UZDQXNUB.js} +75 -20
  206. package/dist/cli-bundle/chunks/chunk-UZDQXNUB.js.map +1 -0
  207. package/dist/cli-bundle/chunks/{chunk-OK7VSX3N.js → chunk-UZLJOEAC.js} +3 -3
  208. package/dist/cli-bundle/chunks/{chunk-4PSJVGRE.js → chunk-VDO2JMD4.js} +7 -7
  209. package/dist/cli-bundle/chunks/{chunk-IRJ6F23W.js → chunk-VQIHNHMJ.js} +2 -2
  210. package/dist/cli-bundle/chunks/{chunk-FQODDTE7.js → chunk-WUVEBQW6.js} +7 -5
  211. package/dist/cli-bundle/chunks/{chunk-FQODDTE7.js.map → chunk-WUVEBQW6.js.map} +1 -1
  212. package/dist/cli-bundle/chunks/{chunk-Q4PSG2GV.js → chunk-WVA4DVNV.js} +5 -5
  213. package/dist/cli-bundle/chunks/{chunk-Q4PSG2GV.js.map → chunk-WVA4DVNV.js.map} +1 -1
  214. package/dist/cli-bundle/chunks/{chunk-4M6RZJXF.js → chunk-WWNL6WMH.js} +3 -3
  215. package/dist/cli-bundle/chunks/chunk-WWNL6WMH.js.map +7 -0
  216. package/dist/cli-bundle/chunks/{chunk-3KPNOZOH.js → chunk-X6K5XTTN.js} +78 -21
  217. package/dist/cli-bundle/chunks/chunk-X6K5XTTN.js.map +7 -0
  218. package/dist/cli-bundle/chunks/{chunk-G33XIMRT.js → chunk-XJF7CDNH.js} +17 -10
  219. package/dist/cli-bundle/chunks/{chunk-G33XIMRT.js.map → chunk-XJF7CDNH.js.map} +1 -1
  220. package/dist/cli-bundle/chunks/{chunk-AR24KW26.js → chunk-YBT7O4KT.js} +17 -112
  221. package/dist/cli-bundle/chunks/chunk-YBT7O4KT.js.map +7 -0
  222. package/dist/cli-bundle/chunks/{chunk-CZA2DXCV.js → chunk-YQQNAKW3.js} +17 -105
  223. package/dist/cli-bundle/chunks/chunk-YQQNAKW3.js.map +1 -0
  224. package/dist/cli-bundle/chunks/{chunk-OKPZDH43.js → chunk-YQWCZ5AC.js} +7 -5
  225. package/dist/cli-bundle/chunks/{chunk-OKPZDH43.js.map → chunk-YQWCZ5AC.js.map} +2 -2
  226. package/dist/cli-bundle/chunks/{chunk-LT5UWU7H.js → chunk-ZOJ3LR7O.js} +2 -2
  227. package/dist/cli-bundle/chunks/{chunk-3HSRP6T2.js → chunk-ZOY5K4D3.js} +2 -2
  228. package/dist/cli-bundle/chunks/{chunk-XXWDEQ6O.js → chunk-ZV2NTVMJ.js} +4 -4
  229. package/dist/cli-bundle/chunks/{chunk-UW6HCMP2.js → chunk-ZYPFOO3L.js} +9 -9
  230. package/dist/cli-bundle/chunks/close-O5QVZ6ET.js +12 -0
  231. package/dist/cli-bundle/chunks/{close-7NWA3GLA.js → close-QEMOYZN3.js} +5 -5
  232. package/dist/cli-bundle/chunks/close-many-SDA426VT.js +24 -0
  233. package/dist/cli-bundle/chunks/{close-many-YALQ7AXS.js → close-many-UTZANOCQ.js} +15 -14
  234. package/dist/cli-bundle/chunks/{comments-SQIQ5WYR.js → comments-LZN6FXXC.js} +7 -7
  235. package/dist/cli-bundle/chunks/comments-VBQ345ND.js +13 -0
  236. package/dist/cli-bundle/chunks/{copy-YDAMENCP.js → copy-DKTSSCK7.js} +4 -4
  237. package/dist/cli-bundle/chunks/copy-M7DDI6LS.js +9 -0
  238. package/dist/cli-bundle/chunks/{create-JSL6CXU3.js → create-GG4RBCGC.js} +11 -11
  239. package/dist/cli-bundle/chunks/create-JBC5KUW6.js +29 -0
  240. package/dist/cli-bundle/chunks/{delete-IGVOZEU2.js → delete-LCS3VPDH.js} +4 -4
  241. package/dist/cli-bundle/chunks/delete-MD7YXQLH.js +10 -0
  242. package/dist/cli-bundle/chunks/{deps-BQAXUQAK.js → deps-DELOO4TL.js} +6 -6
  243. package/dist/cli-bundle/chunks/{deps-CBPPSS6J.js → deps-FI4O6NQS.js} +6 -6
  244. package/dist/cli-bundle/chunks/docs-2UYBP5D6.js +14 -0
  245. package/dist/cli-bundle/chunks/{docs-NS2AZWCN.js → docs-6Z2MP526.js} +6 -6
  246. package/dist/cli-bundle/chunks/{files-XUUBQ76I.js → files-HEUGSJZL.js} +6 -6
  247. package/dist/cli-bundle/chunks/{files-PVWEPT5J.js → files-HKEAN5MA.js} +6 -6
  248. package/dist/cli-bundle/chunks/{focus-DHBHKK3E.js → focus-7SOUT5PZ.js} +5 -5
  249. package/dist/cli-bundle/chunks/focus-DRQ6FQH6.js +10 -0
  250. package/dist/cli-bundle/chunks/history-compact-65YVN5DB.js +17 -0
  251. package/dist/cli-bundle/chunks/{history-compact-3TNPYVFG.js → history-compact-7NDVP3PT.js} +7 -6
  252. package/dist/cli-bundle/chunks/{history-redact-KKFDICCF.js → history-redact-7YBL4XSG.js} +5 -4
  253. package/dist/cli-bundle/chunks/{history-redact-ELRL73XN.js → history-redact-IZGNJBU4.js} +5 -4
  254. package/dist/cli-bundle/chunks/{history-repair-J7WKZFAG.js → history-repair-7M4PYQUH.js} +8 -6
  255. package/dist/cli-bundle/chunks/history-repair-GNGETJLI.js +18 -0
  256. package/dist/cli-bundle/chunks/learnings-3YXDRWFT.js +13 -0
  257. package/dist/cli-bundle/chunks/{learnings-X4D6JCCG.js → learnings-ALC6IMNL.js} +7 -7
  258. package/dist/cli-bundle/chunks/notes-7JMLQ447.js +13 -0
  259. package/dist/cli-bundle/chunks/{notes-UQC6VS6N.js → notes-JFCLTC5C.js} +7 -7
  260. package/dist/cli-bundle/chunks/plan-KOIPWVOZ.js +26 -0
  261. package/dist/cli-bundle/chunks/{plan-5GKRBJJO.js → plan-T3XB3WTK.js} +12 -12
  262. package/dist/cli-bundle/chunks/{profile-5PQAPCLF.js → profile-OILJHKUW.js} +12 -11
  263. package/dist/cli-bundle/chunks/{profile-CW4BD3FO.js → profile-RJXA7PGS.js} +12 -11
  264. package/dist/cli-bundle/chunks/{register-list-query-PHIPDFP2.js → register-list-query-CFVG75P3.js} +30 -21
  265. package/dist/cli-bundle/chunks/{register-list-query-PHIPDFP2.js.map → register-list-query-CFVG75P3.js.map} +1 -1
  266. package/dist/cli-bundle/chunks/{register-list-query-HTDQE6VI.js → register-list-query-E7UVY4TN.js} +29 -20
  267. package/dist/cli-bundle/chunks/{register-list-query-HTDQE6VI.js.map → register-list-query-E7UVY4TN.js.map} +2 -2
  268. package/dist/cli-bundle/chunks/{register-mutation-BLEWM5I6.js → register-mutation-4VJTXBZW.js} +86 -32
  269. package/dist/cli-bundle/chunks/register-mutation-4VJTXBZW.js.map +7 -0
  270. package/dist/cli-bundle/chunks/{register-mutation-OTYHR7J6.js → register-mutation-IQ55E25C.js} +78 -33
  271. package/dist/cli-bundle/chunks/register-mutation-IQ55E25C.js.map +1 -0
  272. package/dist/cli-bundle/chunks/{register-operations-AMCUFYEW.js → register-operations-AR7RMX4W.js} +42 -38
  273. package/dist/cli-bundle/chunks/register-operations-AR7RMX4W.js.map +1 -0
  274. package/dist/cli-bundle/chunks/{register-operations-MRLHOZYR.js → register-operations-NOLZGORC.js} +41 -37
  275. package/dist/cli-bundle/chunks/register-operations-NOLZGORC.js.map +7 -0
  276. package/dist/cli-bundle/chunks/{register-setup-ZVKTDL4G.js → register-setup-BB77VUEE.js} +17 -16
  277. package/dist/cli-bundle/chunks/{register-setup-ZVKTDL4G.js.map → register-setup-BB77VUEE.js.map} +1 -1
  278. package/dist/cli-bundle/chunks/{register-setup-N2FOSWAG.js → register-setup-EYZ7VTPZ.js} +15 -14
  279. package/dist/cli-bundle/chunks/{register-setup-N2FOSWAG.js.map → register-setup-EYZ7VTPZ.js.map} +1 -1
  280. package/dist/cli-bundle/chunks/restore-L6IAGOD7.js +15 -0
  281. package/dist/cli-bundle/chunks/{restore-HEQAG6EK.js → restore-ZH65GZFB.js} +7 -6
  282. package/dist/cli-bundle/chunks/{schema-Q5DAWJ2S.js → schema-4ERWM5QJ.js} +7 -6
  283. package/dist/cli-bundle/chunks/{schema-MAXAIHEC.js → schema-55DL3Q52.js} +7 -6
  284. package/dist/cli-bundle/chunks/{update-DWFXXJKP.js → update-FW6FKDOP.js} +15 -15
  285. package/dist/cli-bundle/chunks/update-TJHSPRPT.js +23 -0
  286. package/dist/cli-bundle/chunks/update-many-NNALYQCN.js +35 -0
  287. package/dist/cli-bundle/chunks/update-many-PWXX5WHO.js +39 -0
  288. package/dist/cli-bundle/main.js +62 -59
  289. package/dist/cli-bundle/main.js.map +1 -1
  290. package/dist/cli-bundle/sdk-runtime.js +62 -59
  291. package/dist/cli-bundle/sdk-testing.js +8 -8
  292. package/dist/cli-bundle/sdk.js +327 -57
  293. package/dist/cli-bundle/sdk.js.map +4 -4
  294. package/dist/core/config/nested-settings.d.ts +2 -0
  295. package/dist/core/config/nested-settings.js +18 -2
  296. package/dist/core/config/nested-settings.js.map +1 -1
  297. package/dist/core/diagnostics/remediation.js +38 -2
  298. package/dist/core/diagnostics/remediation.js.map +1 -1
  299. package/dist/core/extensions/extension-types.d.ts +1 -1
  300. package/dist/core/extensions/extension-types.js +2 -2
  301. package/dist/core/extensions/extension-types.js.map +1 -1
  302. package/dist/core/item/id.d.ts +19 -2
  303. package/dist/core/item/id.js +27 -6
  304. package/dist/core/item/id.js.map +1 -1
  305. package/dist/core/item/parse.d.ts +7 -0
  306. package/dist/core/item/parse.js +48 -2
  307. package/dist/core/item/parse.js.map +1 -1
  308. package/dist/core/schema/item-types-file.d.ts +2 -2
  309. package/dist/core/schema/item-types-file.js +2 -2
  310. package/dist/core/schema/item-types-file.js.map +1 -1
  311. package/dist/core/schema/runtime-schema.d.ts +3 -3
  312. package/dist/core/schema/runtime-schema.js +2 -2
  313. package/dist/core/schema/runtime-schema.js.map +1 -1
  314. package/dist/core/schema/type-workflows.d.ts +2 -2
  315. package/dist/core/schema/type-workflows.js +2 -2
  316. package/dist/core/schema/type-workflows.js.map +1 -1
  317. package/dist/core/shared/constants.js +5 -2
  318. package/dist/core/shared/constants.js.map +1 -1
  319. package/dist/core/store/settings-validator.d.ts +4 -0
  320. package/dist/core/store/settings-validator.js +8 -2
  321. package/dist/core/store/settings-validator.js.map +1 -1
  322. package/dist/core/store/settings.js +8 -2
  323. package/dist/core/store/settings.js.map +1 -1
  324. package/dist/sdk/annotations.js +24 -2
  325. package/dist/sdk/annotations.js.map +1 -1
  326. package/dist/sdk/cli-bootstrap.d.ts +1 -1
  327. package/dist/sdk/cli-bootstrap.js +3 -3
  328. package/dist/sdk/cli-bootstrap.js.map +1 -1
  329. package/dist/sdk/cli-contracts/commander-mutation-options.js +22 -2
  330. package/dist/sdk/cli-contracts/commander-mutation-options.js.map +1 -1
  331. package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
  332. package/dist/sdk/cli-contracts/enum-contracts.js +3 -2
  333. package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -1
  334. package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
  335. package/dist/sdk/cli-contracts/flag-contracts.js +17 -2
  336. package/dist/sdk/cli-contracts/flag-contracts.js.map +1 -1
  337. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +512 -0
  338. package/dist/sdk/cli-contracts/tool-option-contracts.js +21 -11
  339. package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
  340. package/dist/sdk/cli-contracts/tool-parameter-tables.js +13 -3
  341. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  342. package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -0
  343. package/dist/sdk/cli-contracts/tool-schema.js +14 -10
  344. package/dist/sdk/cli-contracts/tool-schema.js.map +1 -1
  345. package/dist/sdk/cli-contracts/typed-action-inputs.d.ts +69 -0
  346. package/dist/sdk/cli-contracts/typed-action-inputs.js +5 -0
  347. package/dist/sdk/cli-contracts/typed-action-inputs.js.map +1 -0
  348. package/dist/sdk/cli-contracts.d.ts +4 -3
  349. package/dist/sdk/cli-contracts.js +5 -5
  350. package/dist/sdk/cli-contracts.js.map +1 -1
  351. package/dist/sdk/extension/describe.d.ts +1 -1
  352. package/dist/sdk/extension/describe.js +2 -2
  353. package/dist/sdk/extension/describe.js.map +1 -1
  354. package/dist/sdk/extension/install-runtime.js +5 -3
  355. package/dist/sdk/extension/install-runtime.js.map +1 -1
  356. package/dist/sdk/extension.d.ts +2 -2
  357. package/dist/sdk/extension.js +2 -2
  358. package/dist/sdk/extension.js.map +1 -1
  359. package/dist/sdk/governance/gc.d.ts +14 -1
  360. package/dist/sdk/governance/gc.js +38 -2
  361. package/dist/sdk/governance/gc.js.map +1 -1
  362. package/dist/sdk/governance/storage-integrity.d.ts +84 -0
  363. package/dist/sdk/governance/storage-integrity.js +240 -0
  364. package/dist/sdk/governance/storage-integrity.js.map +1 -0
  365. package/dist/sdk/governance/validate.d.ts +3 -1
  366. package/dist/sdk/governance/validate.js +56 -2
  367. package/dist/sdk/governance/validate.js.map +1 -1
  368. package/dist/sdk/history-read.d.ts +1 -1
  369. package/dist/sdk/history-read.js +2 -2
  370. package/dist/sdk/history-read.js.map +1 -1
  371. package/dist/sdk/history-repair.d.ts +36 -0
  372. package/dist/sdk/history-repair.js +69 -4
  373. package/dist/sdk/history-repair.js.map +1 -1
  374. package/dist/sdk/index.d.ts +5 -2
  375. package/dist/sdk/index.js +5 -2
  376. package/dist/sdk/index.js.map +1 -1
  377. package/dist/sdk/init.js +3 -3
  378. package/dist/sdk/init.js.map +1 -1
  379. package/dist/sdk/item-transaction.d.ts +131 -0
  380. package/dist/sdk/item-transaction.js +280 -0
  381. package/dist/sdk/item-transaction.js.map +1 -0
  382. package/dist/sdk/merge/driver.d.ts +75 -0
  383. package/dist/sdk/merge/driver.js +166 -0
  384. package/dist/sdk/merge/driver.js.map +1 -0
  385. package/dist/sdk/merge/index.d.ts +11 -0
  386. package/dist/sdk/merge/index.js +15 -0
  387. package/dist/sdk/merge/index.js.map +1 -0
  388. package/dist/sdk/merge/install.d.ts +90 -0
  389. package/dist/sdk/merge/install.js +318 -0
  390. package/dist/sdk/merge/install.js.map +1 -0
  391. package/dist/sdk/merge/three-way.d.ts +126 -0
  392. package/dist/sdk/merge/three-way.js +545 -0
  393. package/dist/sdk/merge/three-way.js.map +1 -0
  394. package/dist/sdk/query/list.d.ts +19 -2
  395. package/dist/sdk/query/list.js +5 -2
  396. package/dist/sdk/query/list.js.map +1 -1
  397. package/dist/sdk/runtime.d.ts +17 -14
  398. package/dist/sdk/runtime.js +5 -5
  399. package/dist/sdk/runtime.js.map +1 -1
  400. package/dist/sdk/schema.d.ts +2 -2
  401. package/dist/sdk/schema.js +29 -2
  402. package/dist/sdk/schema.js.map +1 -1
  403. package/dist/sdk/stats.d.ts +1 -1
  404. package/dist/sdk/stats.js +2 -2
  405. package/dist/sdk/stats.js.map +1 -1
  406. package/dist/sdk/workspace-transaction-gc.d.ts +46 -0
  407. package/dist/sdk/workspace-transaction-gc.js +155 -0
  408. package/dist/sdk/workspace-transaction-gc.js.map +1 -0
  409. package/dist/sdk/workspace.d.ts +28 -4
  410. package/dist/sdk/workspace.js +61 -15
  411. package/dist/sdk/workspace.js.map +1 -1
  412. package/dist/types.d.ts +11 -7
  413. package/dist/types.js +2 -2
  414. package/dist/types.js.map +1 -1
  415. package/docs/AGENT_GUIDE.md +58 -47
  416. package/docs/COMMANDS.md +7 -0
  417. package/docs/CONFIGURATION.md +2 -0
  418. package/docs/MERGE_SAFETY.md +99 -0
  419. package/docs/README.md +1 -0
  420. package/docs/SDK.md +56 -0
  421. package/marketplace.json +2 -2
  422. package/package.json +3 -2
  423. package/packages/pm-beads/package.json +1 -1
  424. package/packages/pm-calendar/package.json +1 -1
  425. package/packages/pm-command-kit/package.json +1 -1
  426. package/packages/pm-governance-audit/package.json +1 -1
  427. package/packages/pm-guide-shell/package.json +1 -1
  428. package/packages/pm-kanban/package.json +1 -1
  429. package/packages/pm-lifecycle-hooks/package.json +1 -1
  430. package/packages/pm-linked-test-adapters/package.json +1 -1
  431. package/packages/pm-search-advanced/package.json +1 -1
  432. package/packages/pm-templates/package.json +1 -1
  433. package/packages/pm-todos/package.json +1 -1
  434. package/packages/pm-vcs/package.json +1 -1
  435. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  436. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  437. package/dist/cli-bundle/chunks/append-XUYF7NON.js +0 -11
  438. package/dist/cli-bundle/chunks/chunk-2XPDCXK5.js.map +0 -1
  439. package/dist/cli-bundle/chunks/chunk-3EZZTFL2.js.map +0 -7
  440. package/dist/cli-bundle/chunks/chunk-3KPNOZOH.js.map +0 -7
  441. package/dist/cli-bundle/chunks/chunk-46Z6FAVP.js.map +0 -1
  442. package/dist/cli-bundle/chunks/chunk-4M6RZJXF.js.map +0 -7
  443. package/dist/cli-bundle/chunks/chunk-6V4T4RD3.js.map +0 -1
  444. package/dist/cli-bundle/chunks/chunk-A3GAQLBH.js.map +0 -7
  445. package/dist/cli-bundle/chunks/chunk-A4FVWFZY.js.map +0 -7
  446. package/dist/cli-bundle/chunks/chunk-A5EQPNV7.js.map +0 -7
  447. package/dist/cli-bundle/chunks/chunk-AR24KW26.js.map +0 -7
  448. package/dist/cli-bundle/chunks/chunk-BBGR4FKQ.js.map +0 -1
  449. package/dist/cli-bundle/chunks/chunk-BDC4TW4B.js.map +0 -1
  450. package/dist/cli-bundle/chunks/chunk-BZKE2O5V.js.map +0 -1
  451. package/dist/cli-bundle/chunks/chunk-CZA2DXCV.js.map +0 -1
  452. package/dist/cli-bundle/chunks/chunk-D35WYXWC.js.map +0 -1
  453. package/dist/cli-bundle/chunks/chunk-DJAGYYCQ.js.map +0 -1
  454. package/dist/cli-bundle/chunks/chunk-EEECAV5M.js.map +0 -7
  455. package/dist/cli-bundle/chunks/chunk-H3YKUVDR.js.map +0 -1
  456. package/dist/cli-bundle/chunks/chunk-IDUTGRDM.js.map +0 -1
  457. package/dist/cli-bundle/chunks/chunk-IGBBTPM5.js.map +0 -1
  458. package/dist/cli-bundle/chunks/chunk-JBW2S2C6.js.map +0 -7
  459. package/dist/cli-bundle/chunks/chunk-JPWUZOMR.js.map +0 -1
  460. package/dist/cli-bundle/chunks/chunk-KAE727L2.js.map +0 -7
  461. package/dist/cli-bundle/chunks/chunk-MI3346YW.js.map +0 -1
  462. package/dist/cli-bundle/chunks/chunk-MQOSMBWV.js.map +0 -7
  463. package/dist/cli-bundle/chunks/chunk-MRXAHR4B.js.map +0 -1
  464. package/dist/cli-bundle/chunks/chunk-N2TEEOXJ.js.map +0 -7
  465. package/dist/cli-bundle/chunks/chunk-ODEIDKGW.js.map +0 -1
  466. package/dist/cli-bundle/chunks/chunk-P24ZU5QV.js.map +0 -7
  467. package/dist/cli-bundle/chunks/chunk-Q3K5XPAQ.js.map +0 -7
  468. package/dist/cli-bundle/chunks/chunk-QFG4MB7P.js.map +0 -1
  469. package/dist/cli-bundle/chunks/chunk-RLLOZAM2.js.map +0 -7
  470. package/dist/cli-bundle/chunks/chunk-RWAIRGBC.js.map +0 -7
  471. package/dist/cli-bundle/chunks/chunk-SBW7EQC4.js.map +0 -1
  472. package/dist/cli-bundle/chunks/chunk-SVAWG7EE.js.map +0 -1
  473. package/dist/cli-bundle/chunks/chunk-UE7LK3RE.js.map +0 -1
  474. package/dist/cli-bundle/chunks/chunk-VA3H7VVC.js.map +0 -1
  475. package/dist/cli-bundle/chunks/chunk-WCBB6VI3.js.map +0 -7
  476. package/dist/cli-bundle/chunks/chunk-Y2VSGFT4.js.map +0 -1
  477. package/dist/cli-bundle/chunks/chunk-YG56M3NE.js.map +0 -1
  478. package/dist/cli-bundle/chunks/chunk-ZF52NVRT.js.map +0 -7
  479. package/dist/cli-bundle/chunks/chunk-ZUCBPXNA.js.map +0 -7
  480. package/dist/cli-bundle/chunks/close-ZZCDDWJT.js +0 -12
  481. package/dist/cli-bundle/chunks/close-many-QCZHFCON.js +0 -23
  482. package/dist/cli-bundle/chunks/comments-FMQNYPSZ.js +0 -13
  483. package/dist/cli-bundle/chunks/copy-GI3RCVZP.js +0 -9
  484. package/dist/cli-bundle/chunks/create-LXMLYJNM.js +0 -29
  485. package/dist/cli-bundle/chunks/delete-5DFAXJNI.js +0 -10
  486. package/dist/cli-bundle/chunks/docs-KCWPLQOV.js +0 -14
  487. package/dist/cli-bundle/chunks/focus-3EJVFI3D.js +0 -10
  488. package/dist/cli-bundle/chunks/history-compact-JHYVDYLW.js +0 -16
  489. package/dist/cli-bundle/chunks/history-repair-REMI7DDI.js +0 -16
  490. package/dist/cli-bundle/chunks/learnings-O6V5WDCV.js +0 -13
  491. package/dist/cli-bundle/chunks/notes-ZSZREWZA.js +0 -13
  492. package/dist/cli-bundle/chunks/plan-EZW2YDDY.js +0 -26
  493. package/dist/cli-bundle/chunks/register-mutation-BLEWM5I6.js.map +0 -7
  494. package/dist/cli-bundle/chunks/register-mutation-OTYHR7J6.js.map +0 -1
  495. package/dist/cli-bundle/chunks/register-operations-AMCUFYEW.js.map +0 -1
  496. package/dist/cli-bundle/chunks/register-operations-MRLHOZYR.js.map +0 -7
  497. package/dist/cli-bundle/chunks/restore-A55MLFAI.js +0 -14
  498. package/dist/cli-bundle/chunks/update-5DTSCWVF.js +0 -23
  499. package/dist/cli-bundle/chunks/update-many-6T4ZLZS7.js +0 -34
  500. package/dist/cli-bundle/chunks/update-many-MYRK6VBJ.js +0 -38
  501. /package/dist/cli-bundle/chunks/{append-MBXHNWSX.js.map → append-E6V54WOQ.js.map} +0 -0
  502. /package/dist/cli-bundle/chunks/{append-XUYF7NON.js.map → append-NNJ3EFIT.js.map} +0 -0
  503. /package/dist/cli-bundle/chunks/{chunk-YGEA4CLH.js.map → chunk-3MCTMJXI.js.map} +0 -0
  504. /package/dist/cli-bundle/chunks/{chunk-N7FCFJ76.js.map → chunk-3P7UJQOX.js.map} +0 -0
  505. /package/dist/cli-bundle/chunks/{chunk-7B7IHMLH.js.map → chunk-3VY6MIEO.js.map} +0 -0
  506. /package/dist/cli-bundle/chunks/{chunk-5S6IZXK7.js.map → chunk-4U4Z6AHI.js.map} +0 -0
  507. /package/dist/cli-bundle/chunks/{chunk-UOIFZ66L.js.map → chunk-4XGJLADW.js.map} +0 -0
  508. /package/dist/cli-bundle/chunks/{chunk-SUNZKVAH.js.map → chunk-5IZJWSDB.js.map} +0 -0
  509. /package/dist/cli-bundle/chunks/{chunk-QQ77W23U.js.map → chunk-5NTE36LD.js.map} +0 -0
  510. /package/dist/cli-bundle/chunks/{chunk-KGPLSHJD.js.map → chunk-6C2ZZX5Z.js.map} +0 -0
  511. /package/dist/cli-bundle/chunks/{chunk-Q5NHJ6RO.js.map → chunk-6JUTHVQS.js.map} +0 -0
  512. /package/dist/cli-bundle/chunks/{chunk-NTS2RKHN.js.map → chunk-6VIJ7UA5.js.map} +0 -0
  513. /package/dist/cli-bundle/chunks/{chunk-XVB6BATY.js.map → chunk-72LQ4TKV.js.map} +0 -0
  514. /package/dist/cli-bundle/chunks/{chunk-KZ5AC6B5.js.map → chunk-7WCE6Y64.js.map} +0 -0
  515. /package/dist/cli-bundle/chunks/{chunk-VQOG2ETB.js.map → chunk-AF2CCM5U.js.map} +0 -0
  516. /package/dist/cli-bundle/chunks/{chunk-EAV3P54W.js.map → chunk-DAQ45GCS.js.map} +0 -0
  517. /package/dist/cli-bundle/chunks/{chunk-RX53WHFI.js.map → chunk-EJDGV4GR.js.map} +0 -0
  518. /package/dist/cli-bundle/chunks/{chunk-IXG5CMBR.js.map → chunk-FDHPAVVB.js.map} +0 -0
  519. /package/dist/cli-bundle/chunks/{chunk-V4QHAMI5.js.map → chunk-GROYI4RB.js.map} +0 -0
  520. /package/dist/cli-bundle/chunks/{chunk-77XFQRTD.js.map → chunk-GSJSM5BJ.js.map} +0 -0
  521. /package/dist/cli-bundle/chunks/{chunk-QYGK2XQ3.js.map → chunk-GTLCVJOE.js.map} +0 -0
  522. /package/dist/cli-bundle/chunks/{chunk-VSQE43NO.js.map → chunk-GV2262OF.js.map} +0 -0
  523. /package/dist/cli-bundle/chunks/{chunk-STBCBDKF.js.map → chunk-HCEBZNC3.js.map} +0 -0
  524. /package/dist/cli-bundle/chunks/{chunk-U6RYD446.js.map → chunk-HRW7GF6T.js.map} +0 -0
  525. /package/dist/cli-bundle/chunks/{chunk-XDWXPG2E.js.map → chunk-IAQE32BI.js.map} +0 -0
  526. /package/dist/cli-bundle/chunks/{chunk-66SRNEBK.js.map → chunk-IJNK6WW2.js.map} +0 -0
  527. /package/dist/cli-bundle/chunks/{chunk-AGEBQRBG.js.map → chunk-JAPE62Y5.js.map} +0 -0
  528. /package/dist/cli-bundle/chunks/{chunk-UWAQI3B7.js.map → chunk-JGUKMMRS.js.map} +0 -0
  529. /package/dist/cli-bundle/chunks/{chunk-UU6EP25G.js.map → chunk-JH2ZSLO3.js.map} +0 -0
  530. /package/dist/cli-bundle/chunks/{chunk-GRDK25BN.js.map → chunk-JHJSFOAM.js.map} +0 -0
  531. /package/dist/cli-bundle/chunks/{chunk-FQO5THHM.js.map → chunk-JM6YAXTR.js.map} +0 -0
  532. /package/dist/cli-bundle/chunks/{chunk-E7KBMWEF.js.map → chunk-JSLT7WVE.js.map} +0 -0
  533. /package/dist/cli-bundle/chunks/{chunk-FIUTBFC6.js.map → chunk-K4CI6Y45.js.map} +0 -0
  534. /package/dist/cli-bundle/chunks/{chunk-IEMXESIS.js.map → chunk-KSPWRNVP.js.map} +0 -0
  535. /package/dist/cli-bundle/chunks/{chunk-BFJP4VYC.js.map → chunk-L7BH7IWU.js.map} +0 -0
  536. /package/dist/cli-bundle/chunks/{chunk-2UCG5H6B.js.map → chunk-LPEYZRUR.js.map} +0 -0
  537. /package/dist/cli-bundle/chunks/{chunk-IR3GOO6E.js.map → chunk-NHT3F4WZ.js.map} +0 -0
  538. /package/dist/cli-bundle/chunks/{chunk-6BNV3G6C.js.map → chunk-NLR32VFS.js.map} +0 -0
  539. /package/dist/cli-bundle/chunks/{chunk-EI3UIMZM.js.map → chunk-OWXOPDHD.js.map} +0 -0
  540. /package/dist/cli-bundle/chunks/{chunk-AQUNTB7G.js.map → chunk-PEQGTJ5Q.js.map} +0 -0
  541. /package/dist/cli-bundle/chunks/{chunk-T6MOTLOJ.js.map → chunk-QJKL5PHS.js.map} +0 -0
  542. /package/dist/cli-bundle/chunks/{chunk-XKVHL3MB.js.map → chunk-QWRVBJ4D.js.map} +0 -0
  543. /package/dist/cli-bundle/chunks/{chunk-VFA5EIEN.js.map → chunk-R7QV7ICM.js.map} +0 -0
  544. /package/dist/cli-bundle/chunks/{chunk-K2L6FZBX.js.map → chunk-RJO3YAFM.js.map} +0 -0
  545. /package/dist/cli-bundle/chunks/{chunk-SGJB6PXA.js.map → chunk-SF3DT5HJ.js.map} +0 -0
  546. /package/dist/cli-bundle/chunks/{chunk-UNNCT5QY.js.map → chunk-SZVB53Y3.js.map} +0 -0
  547. /package/dist/cli-bundle/chunks/{chunk-GFZB5CLP.js.map → chunk-T6PPNM7V.js.map} +0 -0
  548. /package/dist/cli-bundle/chunks/{chunk-W6IEJXNC.js.map → chunk-TVYYO5A7.js.map} +0 -0
  549. /package/dist/cli-bundle/chunks/{chunk-DOASIOQR.js.map → chunk-UQLXSG72.js.map} +0 -0
  550. /package/dist/cli-bundle/chunks/{chunk-7CHWLT2J.js.map → chunk-UVN66B3M.js.map} +0 -0
  551. /package/dist/cli-bundle/chunks/{chunk-Q6JPYR7I.js.map → chunk-UX6SSO2I.js.map} +0 -0
  552. /package/dist/cli-bundle/chunks/{chunk-OK7VSX3N.js.map → chunk-UZLJOEAC.js.map} +0 -0
  553. /package/dist/cli-bundle/chunks/{chunk-4PSJVGRE.js.map → chunk-VDO2JMD4.js.map} +0 -0
  554. /package/dist/cli-bundle/chunks/{chunk-IRJ6F23W.js.map → chunk-VQIHNHMJ.js.map} +0 -0
  555. /package/dist/cli-bundle/chunks/{chunk-LT5UWU7H.js.map → chunk-ZOJ3LR7O.js.map} +0 -0
  556. /package/dist/cli-bundle/chunks/{chunk-3HSRP6T2.js.map → chunk-ZOY5K4D3.js.map} +0 -0
  557. /package/dist/cli-bundle/chunks/{chunk-XXWDEQ6O.js.map → chunk-ZV2NTVMJ.js.map} +0 -0
  558. /package/dist/cli-bundle/chunks/{chunk-UW6HCMP2.js.map → chunk-ZYPFOO3L.js.map} +0 -0
  559. /package/dist/cli-bundle/chunks/{close-ZZCDDWJT.js.map → close-O5QVZ6ET.js.map} +0 -0
  560. /package/dist/cli-bundle/chunks/{close-7NWA3GLA.js.map → close-QEMOYZN3.js.map} +0 -0
  561. /package/dist/cli-bundle/chunks/{close-many-QCZHFCON.js.map → close-many-SDA426VT.js.map} +0 -0
  562. /package/dist/cli-bundle/chunks/{close-many-YALQ7AXS.js.map → close-many-UTZANOCQ.js.map} +0 -0
  563. /package/dist/cli-bundle/chunks/{comments-SQIQ5WYR.js.map → comments-LZN6FXXC.js.map} +0 -0
  564. /package/dist/cli-bundle/chunks/{comments-FMQNYPSZ.js.map → comments-VBQ345ND.js.map} +0 -0
  565. /package/dist/cli-bundle/chunks/{copy-YDAMENCP.js.map → copy-DKTSSCK7.js.map} +0 -0
  566. /package/dist/cli-bundle/chunks/{copy-GI3RCVZP.js.map → copy-M7DDI6LS.js.map} +0 -0
  567. /package/dist/cli-bundle/chunks/{create-JSL6CXU3.js.map → create-GG4RBCGC.js.map} +0 -0
  568. /package/dist/cli-bundle/chunks/{create-LXMLYJNM.js.map → create-JBC5KUW6.js.map} +0 -0
  569. /package/dist/cli-bundle/chunks/{delete-IGVOZEU2.js.map → delete-LCS3VPDH.js.map} +0 -0
  570. /package/dist/cli-bundle/chunks/{delete-5DFAXJNI.js.map → delete-MD7YXQLH.js.map} +0 -0
  571. /package/dist/cli-bundle/chunks/{deps-BQAXUQAK.js.map → deps-DELOO4TL.js.map} +0 -0
  572. /package/dist/cli-bundle/chunks/{deps-CBPPSS6J.js.map → deps-FI4O6NQS.js.map} +0 -0
  573. /package/dist/cli-bundle/chunks/{docs-KCWPLQOV.js.map → docs-2UYBP5D6.js.map} +0 -0
  574. /package/dist/cli-bundle/chunks/{docs-NS2AZWCN.js.map → docs-6Z2MP526.js.map} +0 -0
  575. /package/dist/cli-bundle/chunks/{files-XUUBQ76I.js.map → files-HEUGSJZL.js.map} +0 -0
  576. /package/dist/cli-bundle/chunks/{files-PVWEPT5J.js.map → files-HKEAN5MA.js.map} +0 -0
  577. /package/dist/cli-bundle/chunks/{focus-DHBHKK3E.js.map → focus-7SOUT5PZ.js.map} +0 -0
  578. /package/dist/cli-bundle/chunks/{focus-3EJVFI3D.js.map → focus-DRQ6FQH6.js.map} +0 -0
  579. /package/dist/cli-bundle/chunks/{history-compact-JHYVDYLW.js.map → history-compact-65YVN5DB.js.map} +0 -0
  580. /package/dist/cli-bundle/chunks/{history-compact-3TNPYVFG.js.map → history-compact-7NDVP3PT.js.map} +0 -0
  581. /package/dist/cli-bundle/chunks/{history-redact-KKFDICCF.js.map → history-redact-7YBL4XSG.js.map} +0 -0
  582. /package/dist/cli-bundle/chunks/{history-redact-ELRL73XN.js.map → history-redact-IZGNJBU4.js.map} +0 -0
  583. /package/dist/cli-bundle/chunks/{history-repair-J7WKZFAG.js.map → history-repair-7M4PYQUH.js.map} +0 -0
  584. /package/dist/cli-bundle/chunks/{history-repair-REMI7DDI.js.map → history-repair-GNGETJLI.js.map} +0 -0
  585. /package/dist/cli-bundle/chunks/{learnings-O6V5WDCV.js.map → learnings-3YXDRWFT.js.map} +0 -0
  586. /package/dist/cli-bundle/chunks/{learnings-X4D6JCCG.js.map → learnings-ALC6IMNL.js.map} +0 -0
  587. /package/dist/cli-bundle/chunks/{notes-ZSZREWZA.js.map → notes-7JMLQ447.js.map} +0 -0
  588. /package/dist/cli-bundle/chunks/{notes-UQC6VS6N.js.map → notes-JFCLTC5C.js.map} +0 -0
  589. /package/dist/cli-bundle/chunks/{plan-EZW2YDDY.js.map → plan-KOIPWVOZ.js.map} +0 -0
  590. /package/dist/cli-bundle/chunks/{plan-5GKRBJJO.js.map → plan-T3XB3WTK.js.map} +0 -0
  591. /package/dist/cli-bundle/chunks/{profile-5PQAPCLF.js.map → profile-OILJHKUW.js.map} +0 -0
  592. /package/dist/cli-bundle/chunks/{profile-CW4BD3FO.js.map → profile-RJXA7PGS.js.map} +0 -0
  593. /package/dist/cli-bundle/chunks/{restore-A55MLFAI.js.map → restore-L6IAGOD7.js.map} +0 -0
  594. /package/dist/cli-bundle/chunks/{restore-HEQAG6EK.js.map → restore-ZH65GZFB.js.map} +0 -0
  595. /package/dist/cli-bundle/chunks/{schema-Q5DAWJ2S.js.map → schema-4ERWM5QJ.js.map} +0 -0
  596. /package/dist/cli-bundle/chunks/{schema-MAXAIHEC.js.map → schema-55DL3Q52.js.map} +0 -0
  597. /package/dist/cli-bundle/chunks/{update-DWFXXJKP.js.map → update-FW6FKDOP.js.map} +0 -0
  598. /package/dist/cli-bundle/chunks/{update-5DTSCWVF.js.map → update-TJHSPRPT.js.map} +0 -0
  599. /package/dist/cli-bundle/chunks/{update-many-6T4ZLZS7.js.map → update-many-NNALYQCN.js.map} +0 -0
  600. /package/dist/cli-bundle/chunks/{update-many-MYRK6VBJ.js.map → update-many-PWXX5WHO.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  import type { GlobalOptions } from "../../core/shared/command-types.js";
2
- declare const GC_SCOPE_VALUES: readonly ["index", "embeddings", "runtime", "locks", "checkpoints"];
2
+ declare const GC_SCOPE_VALUES: readonly ["index", "embeddings", "runtime", "locks", "checkpoints", "transactions"];
3
3
  type GcScope = (typeof GC_SCOPE_VALUES)[number];
4
4
  /** Documents the gc command options payload exchanged by command, SDK, and package integrations. */
5
5
  export interface GcCommandOptions {
@@ -28,6 +28,17 @@ export interface GcCheckpointsSummary {
28
28
  /** Value that configures or reports retention days for this contract. */
29
29
  retention_days: number;
30
30
  }
31
+ /** Documents the gc transactions summary payload exchanged by command, SDK, and package integrations. */
32
+ export interface GcTransactionsSummary {
33
+ /** Value that configures or reports scanned for this contract. */
34
+ scanned: number;
35
+ /** Value that configures or reports removed for this contract. */
36
+ removed: number;
37
+ /** Value that configures or reports retained for this contract. */
38
+ retained: number;
39
+ /** Value that configures or reports retention days for this contract. */
40
+ retention_days: number;
41
+ }
31
42
  /** Documents the gc result payload exchanged by command, SDK, and package integrations. */
32
43
  export interface GcResult {
33
44
  /** Whether the operation completed without a blocking failure. */
@@ -48,6 +59,8 @@ export interface GcResult {
48
59
  locks?: GcLocksSummary;
49
60
  /** Present only when the checkpoints scope was selected. Summarizes the rollback-checkpoint sweep. */
50
61
  checkpoints?: GcCheckpointsSummary;
62
+ /** Present only when the transactions scope was selected. Summarizes the workspace-transaction journal sweep. */
63
+ transactions?: GcTransactionsSummary;
51
64
  /** ISO 8601 timestamp recording when generated occurred. */
52
65
  generated_at: string;
53
66
  }
@@ -4,10 +4,11 @@
4
4
  * Implements the pm gc command surface and its agent-facing runtime behavior.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="68767a06-5737-53dc-91a4-aa9ef5c8c6a7")}catch(e){}}();
7
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="de71886f-021a-569d-b39a-a2f2818ee3e9")}catch(e){}}();
8
8
  import fs from "node:fs/promises";
9
9
  import path from "node:path";
10
10
  import { runCheckpointGc } from "../../core/checkpoint/checkpoint-gc.js";
11
+ import { runWorkspaceTransactionGc } from "../workspace-transaction-gc.js";
11
12
  import { runActiveOnIndexHooks, runActiveOnReadHooks, runActiveOnWriteHooks, } from "../../core/extensions/index.js";
12
13
  import { pathExists } from "../../core/fs/fs-utils.js";
13
14
  import { runLockGc } from "../../core/lock/lock-gc.js";
@@ -22,6 +23,7 @@ const GC_SCOPE_VALUES = [
22
23
  "runtime",
23
24
  "locks",
24
25
  "checkpoints",
26
+ "transactions",
25
27
  ];
26
28
  const GC_TARGETS = [
27
29
  {
@@ -171,6 +173,10 @@ function buildGcGuidance(params) {
171
173
  params.removed.some((entry) => entry.startsWith("checkpoints/"))) {
172
174
  guidance.push('Aged rollback checkpoints were removed; their "pm update-many"/"pm close-many --rollback" windows are no longer recoverable.');
173
175
  }
176
+ if (!params.dryRun &&
177
+ params.removed.some((entry) => entry.startsWith("transactions/"))) {
178
+ guidance.push("Aged terminal workspace-transaction journals were removed; replaying those transactionIds re-executes their idempotent steps instead of short-circuiting.");
179
+ }
174
180
  return guidance;
175
181
  }
176
182
  /** Implements run gc for the public runtime surface of this module. */
@@ -225,6 +231,35 @@ export async function runGc(global, options = {}) {
225
231
  // checkpoints/ and removes only rollback checkpoints older than the configured
226
232
  // checkpoints.retention_days, retaining active and unparseable files. See
227
233
  // core/checkpoint/checkpoint-gc.ts.
234
+ // The transactions scope sweeps transactions/sdk/ and removes only terminal
235
+ // (committed/compensated) workspace-transaction journals older than the
236
+ // shared recovery-receipt retention, retaining in-flight and unparseable
237
+ // journals. See sdk/workspace-transaction-gc.ts.
238
+ let transactionsSummary;
239
+ if (scopes.includes("transactions")) {
240
+ const retentionDays = settings.checkpoints.retention_days;
241
+ const transactionResult = await runWorkspaceTransactionGc(pmRoot, {
242
+ dryRun,
243
+ retentionDays,
244
+ hooks: {
245
+ onRead: (journalPath) => runActiveOnReadHooks({ path: journalPath, scope: "project" }),
246
+ onWrite: (journalPath) => runActiveOnWriteHooks({
247
+ path: journalPath,
248
+ scope: "project",
249
+ op: "gc:transaction_journal_remove",
250
+ }),
251
+ },
252
+ });
253
+ removed.push(...transactionResult.removed);
254
+ retained.push(...transactionResult.retained);
255
+ warnings.push(...transactionResult.warnings);
256
+ transactionsSummary = {
257
+ scanned: transactionResult.scanned,
258
+ removed: transactionResult.removed.length,
259
+ retained: transactionResult.retained.length,
260
+ retention_days: retentionDays,
261
+ };
262
+ }
228
263
  let checkpointsSummary;
229
264
  if (scopes.includes("checkpoints")) {
230
265
  const retentionDays = settings.checkpoints.retention_days;
@@ -268,9 +303,10 @@ export async function runGc(global, options = {}) {
268
303
  warnings,
269
304
  ...(locksSummary ? { locks: locksSummary } : {}),
270
305
  ...(checkpointsSummary ? { checkpoints: checkpointsSummary } : {}),
306
+ ...(transactionsSummary ? { transactions: transactionsSummary } : {}),
271
307
  guidance,
272
308
  generated_at: nowIso(),
273
309
  };
274
310
  }
275
311
  //# sourceMappingURL=gc.js.map
276
- //# debugId=68767a06-5737-53dc-91a4-aa9ef5c8c6a7
312
+ //# debugId=de71886f-021a-569d-b39a-a2f2818ee3e9
@@ -1 +1 @@
1
- {"version":3,"file":"gc.js","sources":["sdk/governance/gc.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module sdk/governance/gc\n *\n * Implements the pm gc command surface and its agent-facing runtime behavior.\n */\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { runCheckpointGc } from \"../../core/checkpoint/checkpoint-gc.js\";\nimport {\n runActiveOnIndexHooks,\n runActiveOnReadHooks,\n runActiveOnWriteHooks,\n} from \"../../core/extensions/index.js\";\nimport { pathExists } from \"../../core/fs/fs-utils.js\";\nimport { runLockGc } from \"../../core/lock/lock-gc.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\n\nconst GC_SCOPE_VALUES = [\n \"index\",\n \"embeddings\",\n \"runtime\",\n \"locks\",\n \"checkpoints\",\n] as const;\ntype GcScope = (typeof GC_SCOPE_VALUES)[number];\n\ninterface GcTarget {\n scope: GcScope;\n relativePath: string;\n kind: \"file\" | \"directory\";\n}\n\nconst GC_TARGETS: readonly GcTarget[] = [\n {\n scope: \"index\",\n relativePath: \"index/manifest.json\",\n kind: \"file\",\n },\n {\n scope: \"embeddings\",\n relativePath: \"search/embeddings.jsonl\",\n kind: \"file\",\n },\n {\n scope: \"embeddings\",\n relativePath: \"search/vectorization-status.json\",\n kind: \"file\",\n },\n {\n scope: \"embeddings\",\n relativePath: \"search/lancedb\",\n kind: \"directory\",\n },\n {\n // Removing embeddings invalidates the whole semantic index, so the queued\n // background-refresh work is also meaningless: a worker draining a stale\n // queue against an empty ledger would rebuild a partial, inconsistent index\n // (only the queued items vectorized). Clear the queue and its gate so the\n // next mutation re-seeds from a clean slate. See core/search/background-refresh.ts.\n scope: \"embeddings\",\n relativePath: \"search/pending-refresh.json\",\n kind: \"file\",\n },\n {\n scope: \"embeddings\",\n relativePath: \"search/pending-refresh.gate.lock\",\n kind: \"directory\",\n },\n {\n scope: \"runtime\",\n relativePath: \"runtime/test-runs\",\n kind: \"directory\",\n },\n {\n scope: \"runtime\",\n relativePath: \"runtime/history-drift-cache.json\",\n kind: \"file\",\n },\n] as const;\n\n/** Documents the gc command options payload exchanged by command, SDK, and package integrations. */\nexport interface GcCommandOptions {\n /** Value that configures or reports dry run for this contract. */\n dryRun?: boolean;\n /** Value that configures or reports scope for this contract. */\n scope?: string[];\n}\n\n/** Documents the gc locks summary payload exchanged by command, SDK, and package integrations. */\nexport interface GcLocksSummary {\n /** Value that configures or reports scanned for this contract. */\n scanned: number;\n /** Value that configures or reports removed for this contract. */\n removed: number;\n /** Value that configures or reports retained for this contract. */\n retained: number;\n}\n\n/** Documents the gc checkpoints summary payload exchanged by command, SDK, and package integrations. */\nexport interface GcCheckpointsSummary {\n /** Value that configures or reports scanned for this contract. */\n scanned: number;\n /** Value that configures or reports removed for this contract. */\n removed: number;\n /** Value that configures or reports retained for this contract. */\n retained: number;\n /** Value that configures or reports retention days for this contract. */\n retention_days: number;\n}\n\n/** Documents the gc result payload exchanged by command, SDK, and package integrations. */\nexport interface GcResult {\n /** Whether the operation completed without a blocking failure. */\n ok: boolean;\n /** Value that configures or reports dry run for this contract. */\n dry_run: boolean;\n /** Value that configures or reports scope for this contract. */\n scope: GcScope[];\n /** Value that configures or reports removed for this contract. */\n removed: string[];\n /** Value that configures or reports retained for this contract. */\n retained: string[];\n /** Value that configures or reports warnings for this contract. */\n warnings: string[];\n /** Value that configures or reports guidance for this contract. */\n guidance: string[];\n /** Present only when the locks scope was selected. Summarizes the stale-lock sweep. */\n locks?: GcLocksSummary;\n /** Present only when the checkpoints scope was selected. Summarizes the rollback-checkpoint sweep. */\n checkpoints?: GcCheckpointsSummary;\n /** ISO 8601 timestamp recording when generated occurred. */\n generated_at: string;\n}\n\nfunction isErrno(error: unknown, code: string): boolean {\n return (\n typeof error === \"object\" &&\n error !== null &&\n \"code\" in error &&\n (error as { code?: string }).code === code\n );\n}\n\nasync function removeCacheFile(\n pmRoot: string,\n target: GcTarget,\n dryRun: boolean,\n): Promise<{ removed: boolean; warnings: string[] }> {\n const relativePath = target.relativePath;\n const absolutePath = path.join(pmRoot, relativePath);\n const warnings = await runActiveOnReadHooks({\n path: absolutePath,\n scope: \"project\",\n });\n try {\n const stats = await fs.stat(absolutePath);\n if (target.kind === \"file\" && !stats.isFile()) {\n return {\n removed: false,\n warnings: [...warnings, `not_a_file:${relativePath}`],\n };\n }\n if (target.kind === \"directory\" && !stats.isDirectory()) {\n return {\n removed: false,\n warnings: [...warnings, `not_a_directory:${relativePath}`],\n };\n }\n if (dryRun) {\n return {\n removed: true,\n warnings,\n };\n }\n if (target.kind === \"file\") {\n await fs.unlink(absolutePath);\n } else {\n await fs.rm(absolutePath, { recursive: true, force: true });\n }\n const writeWarnings = await runActiveOnWriteHooks({\n path: absolutePath,\n scope: \"project\",\n op: \"gc:remove\",\n });\n return {\n removed: true,\n warnings: [...warnings, ...writeWarnings],\n };\n } catch (error: unknown) {\n if (isErrno(error, \"ENOENT\")) {\n return {\n removed: false,\n warnings,\n };\n }\n throw error;\n }\n}\n\nfunction parseScopes(raw: string[] | undefined): GcScope[] {\n if (!raw || raw.length === 0) {\n return [...GC_SCOPE_VALUES];\n }\n const tokens = raw\n .flatMap((entry) => entry.split(\",\"))\n .map((entry) => entry.trim().toLowerCase())\n .filter((entry) => entry.length > 0);\n if (tokens.length === 0) {\n throw new PmCliError(\n `--scope requires at least one value (${GC_SCOPE_VALUES.join(\",\")})`,\n EXIT_CODE.USAGE,\n );\n }\n const resolved = new Set<GcScope>();\n for (const token of tokens) {\n if (!(GC_SCOPE_VALUES as readonly string[]).includes(token)) {\n throw new PmCliError(\n `Invalid --scope value \"${token}\". Expected one or more of: ${GC_SCOPE_VALUES.join(\", \")}`,\n EXIT_CODE.USAGE,\n );\n }\n resolved.add(token as GcScope);\n }\n return GC_SCOPE_VALUES.filter((scope) => resolved.has(scope));\n}\n\nfunction buildGcGuidance(params: {\n dryRun: boolean;\n scopes: GcScope[];\n removed: string[];\n}): string[] {\n const guidance: string[] = [];\n if (params.dryRun) {\n guidance.push(\"Dry-run preview only: no cache artifacts were deleted.\");\n }\n const searchScopeSelected =\n params.scopes.includes(\"index\") || params.scopes.includes(\"embeddings\");\n const searchArtifactsAffected = params.removed.some(\n (entry) =>\n entry === \"index/manifest.json\" ||\n entry === \"search/embeddings.jsonl\" ||\n entry === \"search/vectorization-status.json\" ||\n entry === \"search/lancedb\" ||\n entry === \"search/pending-refresh.json\" ||\n entry === \"search/pending-refresh.gate.lock\",\n );\n if (searchScopeSelected && searchArtifactsAffected) {\n guidance.push(\n 'Search artifacts were removed; the semantic index (including any queued background refresh) is invalidated. Run \"pm install search-advanced --project\" if reindex is unavailable, then \"pm reindex --mode keyword\" (and \"--mode semantic\" when semantic search is enabled) before search-heavy workflows.',\n );\n }\n if (params.removed.includes(\"runtime/history-drift-cache.json\")) {\n guidance.push(\n 'History drift cache was removed; the next \"pm health\" run performs a full history-drift re-scan.',\n );\n }\n if (\n !params.dryRun &&\n params.removed.some((entry) => entry.startsWith(\"checkpoints/\"))\n ) {\n guidance.push(\n 'Aged rollback checkpoints were removed; their \"pm update-many\"/\"pm close-many --rollback\" windows are no longer recoverable.',\n );\n }\n return guidance;\n}\n\n/** Implements run gc for the public runtime surface of this module. */\nexport async function runGc(\n global: GlobalOptions,\n options: GcCommandOptions = {},\n): Promise<GcResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(\n `Tracker is not initialized at ${pmRoot}. Run pm init first.`,\n EXIT_CODE.NOT_FOUND,\n );\n }\n\n const settings = await readSettings(pmRoot);\n const dryRun = options.dryRun === true;\n const scopes = parseScopes(options.scope);\n const selectedTargets = GC_TARGETS.filter((target) =>\n scopes.includes(target.scope),\n );\n\n const removed: string[] = [];\n const retained: string[] = [];\n const warnings: string[] = [];\n\n for (const target of selectedTargets) {\n const result = await removeCacheFile(pmRoot, target, dryRun);\n if (result.removed) {\n removed.push(target.relativePath);\n } else {\n retained.push(target.relativePath);\n }\n warnings.push(...result.warnings);\n }\n\n // The locks scope is not a path-based GC_TARGET: it sweeps the locks/ directory\n // and removes only locks whose own embedded ttl has expired (crashed-process\n // debris), retaining active and unparseable locks. See core/lock/lock-gc.ts.\n let locksSummary: GcLocksSummary | undefined;\n if (scopes.includes(\"locks\")) {\n const lockResult = await runLockGc(pmRoot, {\n dryRun,\n hooks: {\n onRead: (lockPath) =>\n runActiveOnReadHooks({ path: lockPath, scope: \"project\" }),\n onWrite: (lockPath) =>\n runActiveOnWriteHooks({\n path: lockPath,\n scope: \"project\",\n op: \"gc:lock_remove\",\n }),\n },\n });\n removed.push(...lockResult.removed);\n retained.push(...lockResult.retained);\n warnings.push(...lockResult.warnings);\n locksSummary = {\n scanned: lockResult.scanned,\n removed: lockResult.removed.length,\n retained: lockResult.retained.length,\n };\n }\n\n // The checkpoints scope is also not a path-based GC_TARGET: it sweeps\n // checkpoints/ and removes only rollback checkpoints older than the configured\n // checkpoints.retention_days, retaining active and unparseable files. See\n // core/checkpoint/checkpoint-gc.ts.\n let checkpointsSummary: GcCheckpointsSummary | undefined;\n if (scopes.includes(\"checkpoints\")) {\n const retentionDays = settings.checkpoints.retention_days;\n const checkpointResult = await runCheckpointGc(pmRoot, {\n dryRun,\n retentionDays,\n hooks: {\n onRead: (checkpointPath) =>\n runActiveOnReadHooks({ path: checkpointPath, scope: \"project\" }),\n onWrite: (checkpointPath) =>\n runActiveOnWriteHooks({\n path: checkpointPath,\n scope: \"project\",\n op: \"gc:checkpoint_remove\",\n }),\n },\n });\n removed.push(...checkpointResult.removed);\n retained.push(...checkpointResult.retained);\n warnings.push(...checkpointResult.warnings);\n checkpointsSummary = {\n scanned: checkpointResult.scanned,\n removed: checkpointResult.removed.length,\n retained: checkpointResult.retained.length,\n retention_days: retentionDays,\n };\n }\n\n warnings.push(\n ...(await runActiveOnIndexHooks({\n mode: dryRun ? \"gc:dry-run\" : \"gc\",\n total_items: selectedTargets.length,\n })),\n );\n const guidance = buildGcGuidance({\n dryRun,\n scopes,\n removed,\n });\n\n return {\n ok: warnings.length === 0,\n dry_run: dryRun,\n scope: scopes,\n removed,\n retained,\n warnings,\n ...(locksSummary ? { locks: locksSummary } : {}),\n ...(checkpointsSummary ? { checkpoints: checkpointsSummary } : {}),\n guidance,\n generated_at: nowIso(),\n };\n}\n"],"names":[],"mappings":"AAAA;;;;GAIG;;;AACH,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CA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O;QACL,EAAE,EAAE,QAAQ,CAAC,MAAM,KAAK,CAAC;QACzB,OAAO,EAAE,MAAM;QACf,KAAK,EAAE,MAAM;QACb,OAAO;QACP,QAAQ;QACR,QAAQ;QACR,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChD,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAClE,QAAQ;QACR,YAAY,EAAE,MAAM,EAAE;KACvB,CAAC;AACJ,CAAC","debugId":"68767a06-5737-53dc-91a4-aa9ef5c8c6a7"}
1
+ {"version":3,"file":"gc.js","sources":["sdk/governance/gc.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module sdk/governance/gc\n *\n * Implements the pm gc command surface and its agent-facing runtime behavior.\n */\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { runCheckpointGc } from \"../../core/checkpoint/checkpoint-gc.js\";\nimport { runWorkspaceTransactionGc } from \"../workspace-transaction-gc.js\";\nimport {\n runActiveOnIndexHooks,\n runActiveOnReadHooks,\n runActiveOnWriteHooks,\n} from \"../../core/extensions/index.js\";\nimport { pathExists } from \"../../core/fs/fs-utils.js\";\nimport { runLockGc } from \"../../core/lock/lock-gc.js\";\nimport { EXIT_CODE } from \"../../core/shared/constants.js\";\nimport type { GlobalOptions } from \"../../core/shared/command-types.js\";\nimport { PmCliError } from \"../../core/shared/errors.js\";\nimport { nowIso } from \"../../core/shared/time.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\n\nconst GC_SCOPE_VALUES = [\n \"index\",\n \"embeddings\",\n \"runtime\",\n \"locks\",\n \"checkpoints\",\n \"transactions\",\n] as const;\ntype GcScope = (typeof GC_SCOPE_VALUES)[number];\n\ninterface GcTarget {\n scope: GcScope;\n relativePath: string;\n kind: \"file\" | \"directory\";\n}\n\nconst GC_TARGETS: readonly GcTarget[] = [\n {\n scope: \"index\",\n relativePath: \"index/manifest.json\",\n kind: \"file\",\n },\n {\n scope: \"embeddings\",\n relativePath: \"search/embeddings.jsonl\",\n kind: \"file\",\n },\n {\n scope: \"embeddings\",\n relativePath: \"search/vectorization-status.json\",\n kind: \"file\",\n },\n {\n scope: \"embeddings\",\n relativePath: \"search/lancedb\",\n kind: \"directory\",\n },\n {\n // Removing embeddings invalidates the whole semantic index, so the queued\n // background-refresh work is also meaningless: a worker draining a stale\n // queue against an empty ledger would rebuild a partial, inconsistent index\n // (only the queued items vectorized). Clear the queue and its gate so the\n // next mutation re-seeds from a clean slate. See core/search/background-refresh.ts.\n scope: \"embeddings\",\n relativePath: \"search/pending-refresh.json\",\n kind: \"file\",\n },\n {\n scope: \"embeddings\",\n relativePath: \"search/pending-refresh.gate.lock\",\n kind: \"directory\",\n },\n {\n scope: \"runtime\",\n relativePath: \"runtime/test-runs\",\n kind: \"directory\",\n },\n {\n scope: \"runtime\",\n relativePath: \"runtime/history-drift-cache.json\",\n kind: \"file\",\n },\n] as const;\n\n/** Documents the gc command options payload exchanged by command, SDK, and package integrations. */\nexport interface GcCommandOptions {\n /** Value that configures or reports dry run for this contract. */\n dryRun?: boolean;\n /** Value that configures or reports scope for this contract. */\n scope?: string[];\n}\n\n/** Documents the gc locks summary payload exchanged by command, SDK, and package integrations. */\nexport interface GcLocksSummary {\n /** Value that configures or reports scanned for this contract. */\n scanned: number;\n /** Value that configures or reports removed for this contract. */\n removed: number;\n /** Value that configures or reports retained for this contract. */\n retained: number;\n}\n\n/** Documents the gc checkpoints summary payload exchanged by command, SDK, and package integrations. */\nexport interface GcCheckpointsSummary {\n /** Value that configures or reports scanned for this contract. */\n scanned: number;\n /** Value that configures or reports removed for this contract. */\n removed: number;\n /** Value that configures or reports retained for this contract. */\n retained: number;\n /** Value that configures or reports retention days for this contract. */\n retention_days: number;\n}\n\n/** Documents the gc transactions summary payload exchanged by command, SDK, and package integrations. */\nexport interface GcTransactionsSummary {\n /** Value that configures or reports scanned for this contract. */\n scanned: number;\n /** Value that configures or reports removed for this contract. */\n removed: number;\n /** Value that configures or reports retained for this contract. */\n retained: number;\n /** Value that configures or reports retention days for this contract. */\n retention_days: number;\n}\n\n/** Documents the gc result payload exchanged by command, SDK, and package integrations. */\nexport interface GcResult {\n /** Whether the operation completed without a blocking failure. */\n ok: boolean;\n /** Value that configures or reports dry run for this contract. */\n dry_run: boolean;\n /** Value that configures or reports scope for this contract. */\n scope: GcScope[];\n /** Value that configures or reports removed for this contract. */\n removed: string[];\n /** Value that configures or reports retained for this contract. */\n retained: string[];\n /** Value that configures or reports warnings for this contract. */\n warnings: string[];\n /** Value that configures or reports guidance for this contract. */\n guidance: string[];\n /** Present only when the locks scope was selected. Summarizes the stale-lock sweep. */\n locks?: GcLocksSummary;\n /** Present only when the checkpoints scope was selected. Summarizes the rollback-checkpoint sweep. */\n checkpoints?: GcCheckpointsSummary;\n /** Present only when the transactions scope was selected. Summarizes the workspace-transaction journal sweep. */\n transactions?: GcTransactionsSummary;\n /** ISO 8601 timestamp recording when generated occurred. */\n generated_at: string;\n}\n\nfunction isErrno(error: unknown, code: string): boolean {\n return (\n typeof error === \"object\" &&\n error !== null &&\n \"code\" in error &&\n (error as { code?: string }).code === code\n );\n}\n\nasync function removeCacheFile(\n pmRoot: string,\n target: GcTarget,\n dryRun: boolean,\n): Promise<{ removed: boolean; warnings: string[] }> {\n const relativePath = target.relativePath;\n const absolutePath = path.join(pmRoot, relativePath);\n const warnings = await runActiveOnReadHooks({\n path: absolutePath,\n scope: \"project\",\n });\n try {\n const stats = await fs.stat(absolutePath);\n if (target.kind === \"file\" && !stats.isFile()) {\n return {\n removed: false,\n warnings: [...warnings, `not_a_file:${relativePath}`],\n };\n }\n if (target.kind === \"directory\" && !stats.isDirectory()) {\n return {\n removed: false,\n warnings: [...warnings, `not_a_directory:${relativePath}`],\n };\n }\n if (dryRun) {\n return {\n removed: true,\n warnings,\n };\n }\n if (target.kind === \"file\") {\n await fs.unlink(absolutePath);\n } else {\n await fs.rm(absolutePath, { recursive: true, force: true });\n }\n const writeWarnings = await runActiveOnWriteHooks({\n path: absolutePath,\n scope: \"project\",\n op: \"gc:remove\",\n });\n return {\n removed: true,\n warnings: [...warnings, ...writeWarnings],\n };\n } catch (error: unknown) {\n if (isErrno(error, \"ENOENT\")) {\n return {\n removed: false,\n warnings,\n };\n }\n throw error;\n }\n}\n\nfunction parseScopes(raw: string[] | undefined): GcScope[] {\n if (!raw || raw.length === 0) {\n return [...GC_SCOPE_VALUES];\n }\n const tokens = raw\n .flatMap((entry) => entry.split(\",\"))\n .map((entry) => entry.trim().toLowerCase())\n .filter((entry) => entry.length > 0);\n if (tokens.length === 0) {\n throw new PmCliError(\n `--scope requires at least one value (${GC_SCOPE_VALUES.join(\",\")})`,\n EXIT_CODE.USAGE,\n );\n }\n const resolved = new Set<GcScope>();\n for (const token of tokens) {\n if (!(GC_SCOPE_VALUES as readonly string[]).includes(token)) {\n throw new PmCliError(\n `Invalid --scope value \"${token}\". Expected one or more of: ${GC_SCOPE_VALUES.join(\", \")}`,\n EXIT_CODE.USAGE,\n );\n }\n resolved.add(token as GcScope);\n }\n return GC_SCOPE_VALUES.filter((scope) => resolved.has(scope));\n}\n\nfunction buildGcGuidance(params: {\n dryRun: boolean;\n scopes: GcScope[];\n removed: string[];\n}): string[] {\n const guidance: string[] = [];\n if (params.dryRun) {\n guidance.push(\"Dry-run preview only: no cache artifacts were deleted.\");\n }\n const searchScopeSelected =\n params.scopes.includes(\"index\") || params.scopes.includes(\"embeddings\");\n const searchArtifactsAffected = params.removed.some(\n (entry) =>\n entry === \"index/manifest.json\" ||\n entry === \"search/embeddings.jsonl\" ||\n entry === \"search/vectorization-status.json\" ||\n entry === \"search/lancedb\" ||\n entry === \"search/pending-refresh.json\" ||\n entry === \"search/pending-refresh.gate.lock\",\n );\n if (searchScopeSelected && searchArtifactsAffected) {\n guidance.push(\n 'Search artifacts were removed; the semantic index (including any queued background refresh) is invalidated. Run \"pm install search-advanced --project\" if reindex is unavailable, then \"pm reindex --mode keyword\" (and \"--mode semantic\" when semantic search is enabled) before search-heavy workflows.',\n );\n }\n if (params.removed.includes(\"runtime/history-drift-cache.json\")) {\n guidance.push(\n 'History drift cache was removed; the next \"pm health\" run performs a full history-drift re-scan.',\n );\n }\n if (\n !params.dryRun &&\n params.removed.some((entry) => entry.startsWith(\"checkpoints/\"))\n ) {\n guidance.push(\n 'Aged rollback checkpoints were removed; their \"pm update-many\"/\"pm close-many --rollback\" windows are no longer recoverable.',\n );\n }\n if (\n !params.dryRun &&\n params.removed.some((entry) => entry.startsWith(\"transactions/\"))\n ) {\n guidance.push(\n \"Aged terminal workspace-transaction journals were removed; replaying those transactionIds re-executes their idempotent steps instead of short-circuiting.\",\n );\n }\n return guidance;\n}\n\n/** Implements run gc for the public runtime surface of this module. */\nexport async function runGc(\n global: GlobalOptions,\n options: GcCommandOptions = {},\n): Promise<GcResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(\n `Tracker is not initialized at ${pmRoot}. Run pm init first.`,\n EXIT_CODE.NOT_FOUND,\n );\n }\n\n const settings = await readSettings(pmRoot);\n const dryRun = options.dryRun === true;\n const scopes = parseScopes(options.scope);\n const selectedTargets = GC_TARGETS.filter((target) =>\n scopes.includes(target.scope),\n );\n\n const removed: string[] = [];\n const retained: string[] = [];\n const warnings: string[] = [];\n\n for (const target of selectedTargets) {\n const result = await removeCacheFile(pmRoot, target, dryRun);\n if (result.removed) {\n removed.push(target.relativePath);\n } else {\n retained.push(target.relativePath);\n }\n warnings.push(...result.warnings);\n }\n\n // The locks scope is not a path-based GC_TARGET: it sweeps the locks/ directory\n // and removes only locks whose own embedded ttl has expired (crashed-process\n // debris), retaining active and unparseable locks. See core/lock/lock-gc.ts.\n let locksSummary: GcLocksSummary | undefined;\n if (scopes.includes(\"locks\")) {\n const lockResult = await runLockGc(pmRoot, {\n dryRun,\n hooks: {\n onRead: (lockPath) =>\n runActiveOnReadHooks({ path: lockPath, scope: \"project\" }),\n onWrite: (lockPath) =>\n runActiveOnWriteHooks({\n path: lockPath,\n scope: \"project\",\n op: \"gc:lock_remove\",\n }),\n },\n });\n removed.push(...lockResult.removed);\n retained.push(...lockResult.retained);\n warnings.push(...lockResult.warnings);\n locksSummary = {\n scanned: lockResult.scanned,\n removed: lockResult.removed.length,\n retained: lockResult.retained.length,\n };\n }\n\n // The checkpoints scope is also not a path-based GC_TARGET: it sweeps\n // checkpoints/ and removes only rollback checkpoints older than the configured\n // checkpoints.retention_days, retaining active and unparseable files. See\n // core/checkpoint/checkpoint-gc.ts.\n // The transactions scope sweeps transactions/sdk/ and removes only terminal\n // (committed/compensated) workspace-transaction journals older than the\n // shared recovery-receipt retention, retaining in-flight and unparseable\n // journals. See sdk/workspace-transaction-gc.ts.\n let transactionsSummary: GcTransactionsSummary | undefined;\n if (scopes.includes(\"transactions\")) {\n const retentionDays = settings.checkpoints.retention_days;\n const transactionResult = await runWorkspaceTransactionGc(pmRoot, {\n dryRun,\n retentionDays,\n hooks: {\n onRead: (journalPath) =>\n runActiveOnReadHooks({ path: journalPath, scope: \"project\" }),\n onWrite: (journalPath) =>\n runActiveOnWriteHooks({\n path: journalPath,\n scope: \"project\",\n op: \"gc:transaction_journal_remove\",\n }),\n },\n });\n removed.push(...transactionResult.removed);\n retained.push(...transactionResult.retained);\n warnings.push(...transactionResult.warnings);\n transactionsSummary = {\n scanned: transactionResult.scanned,\n removed: transactionResult.removed.length,\n retained: transactionResult.retained.length,\n retention_days: retentionDays,\n };\n }\n\n let checkpointsSummary: GcCheckpointsSummary | undefined;\n if (scopes.includes(\"checkpoints\")) {\n const retentionDays = settings.checkpoints.retention_days;\n const checkpointResult = await runCheckpointGc(pmRoot, {\n dryRun,\n retentionDays,\n hooks: {\n onRead: (checkpointPath) =>\n runActiveOnReadHooks({ path: checkpointPath, scope: \"project\" }),\n onWrite: (checkpointPath) =>\n runActiveOnWriteHooks({\n path: checkpointPath,\n scope: \"project\",\n op: \"gc:checkpoint_remove\",\n }),\n },\n });\n removed.push(...checkpointResult.removed);\n retained.push(...checkpointResult.retained);\n warnings.push(...checkpointResult.warnings);\n checkpointsSummary = {\n scanned: checkpointResult.scanned,\n removed: checkpointResult.removed.length,\n retained: checkpointResult.retained.length,\n retention_days: retentionDays,\n };\n }\n\n warnings.push(\n ...(await runActiveOnIndexHooks({\n mode: dryRun ? \"gc:dry-run\" : \"gc\",\n total_items: selectedTargets.length,\n })),\n );\n const guidance = buildGcGuidance({\n dryRun,\n scopes,\n removed,\n });\n\n return {\n ok: warnings.length === 0,\n dry_run: dryRun,\n scope: scopes,\n removed,\n retained,\n warnings,\n ...(locksSummary ? { locks: locksSummary } : {}),\n ...(checkpointsSummary ? { checkpoints: checkpointsSummary } : {}),\n ...(transactionsSummary ? { transactions: transactionsSummary } : {}),\n guidance,\n generated_at: nowIso(),\n };\n}\n"],"names":[],"mappings":"AAAA;;;;GAIG;;;AACH,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,a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OAAO;QACP,QAAQ;QACR,QAAQ;QACR,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChD,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAClE,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrE,QAAQ;QACR,YAAY,EAAE,MAAM,EAAE;KACvB,CAAC;AACJ,CAAC","debugId":"de71886f-021a-569d-b39a-a2f2818ee3e9"}
@@ -0,0 +1,84 @@
1
+ import { type ItemDocumentFormatOptions } from "../../core/item/item-format.js";
2
+ /** Documents one unreadable item-file finding surfaced by the storage-integrity check. */
3
+ export interface UnreadableItemFileRow {
4
+ /** Tracker-relative path of the item file that failed to parse. */
5
+ path: string;
6
+ /** Item id derived from the file name. */
7
+ id: string;
8
+ }
9
+ /** Documents one history-stream finding surfaced by the storage-integrity check. */
10
+ export interface HistoryStreamIntegrityRow {
11
+ /** Item id whose history stream is affected. */
12
+ id: string;
13
+ /** Tracker-relative path of the history stream. */
14
+ path: string;
15
+ /** Line number of the first offending content, when line-addressable. */
16
+ line?: number;
17
+ /** Failure detail (conflict marker text or parse failure reason). */
18
+ detail: string;
19
+ }
20
+ /** Documents one resurrection-candidate finding: a live item whose history says it was deleted. */
21
+ export interface ResurrectedItemRow {
22
+ /** Live item id whose newest history operation is a delete. */
23
+ id: string;
24
+ /** Timestamp of the recorded delete operation. */
25
+ deleted_at: string;
26
+ /** Author of the recorded delete operation. */
27
+ deleted_by: string;
28
+ }
29
+ /** Documents one duplicate-item-id finding: one id claimed by multiple item documents (cross-branch add/add collision or duplicated format variant). */
30
+ export interface DuplicateItemIdRow {
31
+ /** Item id claimed by more than one on-disk document. */
32
+ id: string;
33
+ /** Tracker-relative paths of every document claiming the id, sorted for determinism. */
34
+ paths: string[];
35
+ }
36
+ /** Documents one unparseable configuration/schema file finding. */
37
+ export interface UnparseableConfigRow {
38
+ /** Tracker-relative path of the configuration file. */
39
+ path: string;
40
+ /** Failure detail (conflict marker location or JSON parse failure). */
41
+ detail: string;
42
+ }
43
+ /** Documents the storage-integrity scan result consumed by the validate check builder. */
44
+ export interface StorageIntegrityScanResult {
45
+ /** Number of item files present on disk across all type folders. */
46
+ item_files_on_disk: number;
47
+ /** Number of distinct item ids present on disk. */
48
+ item_ids_on_disk: number;
49
+ /** Number of items the standard read path successfully parsed. */
50
+ parsed_items: number;
51
+ /** Item files whose ids the standard read path could not parse (silently skipped elsewhere). */
52
+ unreadable_item_files: UnreadableItemFileRow[];
53
+ /** Ids claimed by more than one item document (post-merge add/add id collisions across type folders or format variants; GH-600). */
54
+ duplicate_item_ids: DuplicateItemIdRow[];
55
+ /** Number of history streams scanned. */
56
+ history_streams_scanned: number;
57
+ /** History streams containing unresolved merge-conflict markers. */
58
+ history_conflict_marker_streams: HistoryStreamIntegrityRow[];
59
+ /** History streams containing an entry that is not a JSON object. */
60
+ history_unparseable_streams: HistoryStreamIntegrityRow[];
61
+ /** Live items whose newest history operation is a delete (delete/modify merge resurrection candidates). */
62
+ resurrected_items: ResurrectedItemRow[];
63
+ /** Streams whose final entry is a non-empty history_repair reconciliation patch — the post-repair divergence signal (informational, not a failure). */
64
+ history_repair_reconciliations: number;
65
+ /** Number of configuration/schema files scanned. */
66
+ config_files_scanned: number;
67
+ /** Configuration/schema files that cannot be parsed (silent-defaults fallback risk). */
68
+ unparseable_config_files: UnparseableConfigRow[];
69
+ }
70
+ /** Runtime schema context used to parse every physical item file exactly as the ordinary read path does. */
71
+ export interface StorageIntegrityItemParseOptions {
72
+ /** Active runtime schema, including unknown-field policy and custom field definitions. */
73
+ schema?: ItemDocumentFormatOptions["schema"];
74
+ /** Item fields contributed by active extensions and therefore valid under a rejecting schema. */
75
+ extensionFieldNames?: readonly string[];
76
+ }
77
+ /**
78
+ * Scan tracker storage for integrity failures the ordinary read path masks.
79
+ * `parsedItemIds` are the ids the standard cached list scan successfully
80
+ * parsed; any on-disk item file whose id is missing from that set is an
81
+ * unreadable document that `pm get` would hard-error on while list-based
82
+ * commands silently skip it.
83
+ */
84
+ export declare function scanStorageIntegrity(pmRoot: string, parsedItemIds: ReadonlySet<string>, typeToFolder: Record<string, string>, itemParseOptions?: StorageIntegrityItemParseOptions): Promise<StorageIntegrityScanResult>;
@@ -0,0 +1,240 @@
1
+ /**
2
+ * @module sdk/governance/storage-integrity
3
+ *
4
+ * Post-merge storage-integrity check for `pm validate`: fails the workspace
5
+ * when tracker storage is provably corrupted in ways the ordinary read path
6
+ * silently tolerates — unparseable item documents (skipped by the list scan),
7
+ * history streams containing unresolved merge-conflict markers, deleted items
8
+ * silently resurrected by a delete/modify merge, and configuration or schema
9
+ * files whose parse failure would otherwise fall back to defaults behind a
10
+ * green gate. This is the detection half of the tracker merge-semantics
11
+ * contract; the merge drivers in `sdk/merge` are the prevention half.
12
+ */
13
+
14
+ !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]="99fdc5e7-d08b-54a7-8169-1385c91f8ed6")}catch(e){}}();
15
+ import fs from "node:fs/promises";
16
+ import path from "node:path";
17
+ import { readFileIfExists } from "../../core/fs/fs-utils.js";
18
+ import { parseItemDocument, } from "../../core/item/item-format.js";
19
+ import { findFirstMergeConflictMarker } from "../../core/shared/conflict-markers.js";
20
+ import { getSettingsPath, ITEM_FILE_EXTENSIONS, } from "../../core/store/paths.js";
21
+ async function listItemFilesOnDisk(pmRoot, typeToFolder) {
22
+ const folders = [...new Set(Object.values(typeToFolder))];
23
+ const found = [];
24
+ await Promise.all(folders.map(async (folder) => {
25
+ let entries;
26
+ try {
27
+ entries = await fs.readdir(path.join(pmRoot, folder));
28
+ }
29
+ catch {
30
+ return;
31
+ }
32
+ for (const entry of entries) {
33
+ for (const extension of ITEM_FILE_EXTENSIONS) {
34
+ if (entry.toLowerCase().endsWith(extension)) {
35
+ found.push({
36
+ relativePath: `${folder}/${entry}`,
37
+ id: entry.slice(0, -extension.length),
38
+ });
39
+ break;
40
+ }
41
+ }
42
+ }
43
+ }));
44
+ return found.sort((left, right) => left.relativePath.localeCompare(right.relativePath));
45
+ }
46
+ function scanHistoryStreamContent(accumulator, raw) {
47
+ const { id, relativePath, liveItemIds, out } = accumulator;
48
+ out.scanned += 1;
49
+ const conflictMarker = findFirstMergeConflictMarker(raw);
50
+ if (conflictMarker) {
51
+ out.conflictMarkers.push({
52
+ id,
53
+ path: relativePath,
54
+ line: conflictMarker.line,
55
+ detail: `unresolved merge conflict marker ${conflictMarker.marker}`,
56
+ });
57
+ return;
58
+ }
59
+ let latestEntry = null;
60
+ const lines = raw
61
+ .split(/\r?\n/)
62
+ .map((line, index) => ({ content: line.trim(), number: index + 1 }))
63
+ .filter((line) => line.content.length > 0);
64
+ for (const line of lines) {
65
+ try {
66
+ const parsed = JSON.parse(line.content);
67
+ if (typeof parsed !== "object" ||
68
+ parsed === null ||
69
+ Array.isArray(parsed)) {
70
+ throw new TypeError("history entry must be an object");
71
+ }
72
+ latestEntry = parsed;
73
+ }
74
+ catch {
75
+ out.unparseable.push({
76
+ id,
77
+ path: relativePath,
78
+ line: line.number,
79
+ detail: "history line is not a valid JSON object",
80
+ });
81
+ return;
82
+ }
83
+ }
84
+ if (latestEntry === null) {
85
+ return;
86
+ }
87
+ if (latestEntry.op === "delete" && liveItemIds.has(id)) {
88
+ out.resurrected.push({
89
+ id,
90
+ deleted_at: typeof latestEntry.ts === "string" ? latestEntry.ts : "",
91
+ deleted_by: typeof latestEntry.author === "string" ? latestEntry.author : "",
92
+ });
93
+ }
94
+ if (latestEntry.op === "history_repair" &&
95
+ Array.isArray(latestEntry.patch) &&
96
+ latestEntry.patch.length > 0) {
97
+ out.repairReconciliations += 1;
98
+ }
99
+ }
100
+ async function scanHistoryStreams(pmRoot, liveItemIds) {
101
+ const out = {
102
+ conflictMarkers: [],
103
+ unparseable: [],
104
+ resurrected: [],
105
+ repairReconciliations: 0,
106
+ scanned: 0,
107
+ };
108
+ let entries;
109
+ try {
110
+ entries = await fs.readdir(path.join(pmRoot, "history"));
111
+ }
112
+ catch {
113
+ return out;
114
+ }
115
+ for (const entry of entries.sort((left, right) => left.localeCompare(right))) {
116
+ if (!entry.endsWith(".jsonl")) {
117
+ continue;
118
+ }
119
+ const raw = await fs.readFile(path.join(pmRoot, "history", entry), "utf8");
120
+ scanHistoryStreamContent({
121
+ id: entry.slice(0, -".jsonl".length),
122
+ relativePath: `history/${entry}`,
123
+ liveItemIds,
124
+ out,
125
+ }, raw);
126
+ }
127
+ return out;
128
+ }
129
+ function describeUnparseableJson(raw) {
130
+ const conflictMarker = findFirstMergeConflictMarker(raw);
131
+ if (conflictMarker) {
132
+ return `unresolved merge conflict marker ${conflictMarker.marker} at line ${conflictMarker.line}`;
133
+ }
134
+ try {
135
+ JSON.parse(raw);
136
+ return null;
137
+ }
138
+ catch (error) {
139
+ return `invalid JSON (${String(error)})`;
140
+ }
141
+ }
142
+ async function scanConfigFiles(pmRoot) {
143
+ const unparseable = [];
144
+ let scanned = 0;
145
+ const settingsRaw = await readFileIfExists(getSettingsPath(pmRoot));
146
+ if (settingsRaw !== null) {
147
+ scanned += 1;
148
+ const detail = describeUnparseableJson(settingsRaw);
149
+ if (detail !== null) {
150
+ unparseable.push({ path: "settings.json", detail });
151
+ }
152
+ }
153
+ let schemaEntries;
154
+ try {
155
+ schemaEntries = await fs.readdir(path.join(pmRoot, "schema"));
156
+ }
157
+ catch {
158
+ return { scanned, unparseable };
159
+ }
160
+ for (const entry of schemaEntries.sort((left, right) => left.localeCompare(right))) {
161
+ if (!entry.endsWith(".json")) {
162
+ continue;
163
+ }
164
+ const raw = await fs.readFile(path.join(pmRoot, "schema", entry), "utf8");
165
+ scanned += 1;
166
+ const detail = describeUnparseableJson(raw);
167
+ if (detail !== null) {
168
+ unparseable.push({ path: `schema/${entry}`, detail });
169
+ }
170
+ }
171
+ return { scanned, unparseable };
172
+ }
173
+ /**
174
+ * Scan tracker storage for integrity failures the ordinary read path masks.
175
+ * `parsedItemIds` are the ids the standard cached list scan successfully
176
+ * parsed; any on-disk item file whose id is missing from that set is an
177
+ * unreadable document that `pm get` would hard-error on while list-based
178
+ * commands silently skip it.
179
+ */
180
+ export async function scanStorageIntegrity(pmRoot, parsedItemIds, typeToFolder, itemParseOptions = {}) {
181
+ const itemFiles = await listItemFilesOnDisk(pmRoot, typeToFolder);
182
+ const idsOnDisk = new Set(itemFiles.map((file) => file.id));
183
+ const pathsById = new Map();
184
+ for (const file of itemFiles) {
185
+ const paths = pathsById.get(file.id);
186
+ if (paths === undefined) {
187
+ pathsById.set(file.id, [file.relativePath]);
188
+ }
189
+ else {
190
+ paths.push(file.relativePath);
191
+ }
192
+ }
193
+ const duplicateItemIds = [...pathsById.entries()]
194
+ .filter(([, paths]) => paths.length > 1)
195
+ .map(([id, paths]) => ({
196
+ id,
197
+ paths: [...paths].sort((left, right) => left.localeCompare(right)),
198
+ }))
199
+ .sort((left, right) => left.id.localeCompare(right.id));
200
+ const unreadableItemFiles = (await Promise.all(itemFiles.map(async (file) => {
201
+ if (!parsedItemIds.has(file.id)) {
202
+ return { path: file.relativePath, id: file.id };
203
+ }
204
+ try {
205
+ const absolutePath = path.join(pmRoot, file.relativePath);
206
+ parseItemDocument(await fs.readFile(absolutePath, "utf8"), {
207
+ format: absolutePath.toLowerCase().endsWith(".md")
208
+ ? "json_markdown"
209
+ : "toon",
210
+ schema: itemParseOptions.schema,
211
+ extensionFieldNames: itemParseOptions.extensionFieldNames,
212
+ });
213
+ return null;
214
+ }
215
+ catch {
216
+ return { path: file.relativePath, id: file.id };
217
+ }
218
+ }))).filter((row) => row !== null);
219
+ // "Live" for resurrection detection means an item file exists on disk —
220
+ // deleted items keep their history stream but lose the document, so a
221
+ // delete-terminated stream is only suspicious when the document is back.
222
+ const historyScan = await scanHistoryStreams(pmRoot, idsOnDisk);
223
+ const configScan = await scanConfigFiles(pmRoot);
224
+ return {
225
+ item_files_on_disk: itemFiles.length,
226
+ item_ids_on_disk: idsOnDisk.size,
227
+ parsed_items: parsedItemIds.size,
228
+ unreadable_item_files: unreadableItemFiles,
229
+ duplicate_item_ids: duplicateItemIds,
230
+ history_streams_scanned: historyScan.scanned,
231
+ history_conflict_marker_streams: historyScan.conflictMarkers,
232
+ history_unparseable_streams: historyScan.unparseable,
233
+ resurrected_items: historyScan.resurrected,
234
+ history_repair_reconciliations: historyScan.repairReconciliations,
235
+ config_files_scanned: configScan.scanned,
236
+ unparseable_config_files: configScan.unparseable,
237
+ };
238
+ }
239
+ //# sourceMappingURL=storage-integrity.js.map
240
+ //# debugId=99fdc5e7-d08b-54a7-8169-1385c91f8ed6
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-integrity.js","sources":["sdk/governance/storage-integrity.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module sdk/governance/storage-integrity\n *\n * Post-merge storage-integrity check for `pm validate`: fails the workspace\n * when tracker storage is provably corrupted in ways the ordinary read path\n * silently tolerates — unparseable item documents (skipped by the list scan),\n * history streams containing unresolved merge-conflict markers, deleted items\n * silently resurrected by a delete/modify merge, and configuration or schema\n * files whose parse failure would otherwise fall back to defaults behind a\n * green gate. This is the detection half of the tracker merge-semantics\n * contract; the merge drivers in `sdk/merge` are the prevention half.\n */\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { readFileIfExists } from \"../../core/fs/fs-utils.js\";\nimport {\n parseItemDocument,\n type ItemDocumentFormatOptions,\n} from \"../../core/item/item-format.js\";\nimport { findFirstMergeConflictMarker } from \"../../core/shared/conflict-markers.js\";\nimport {\n getSettingsPath,\n ITEM_FILE_EXTENSIONS,\n} from \"../../core/store/paths.js\";\nimport type { HistoryEntry } from \"../../types/index.js\";\n\n/** Documents one unreadable item-file finding surfaced by the storage-integrity check. */\nexport interface UnreadableItemFileRow {\n /** Tracker-relative path of the item file that failed to parse. */\n path: string;\n /** Item id derived from the file name. */\n id: string;\n}\n\n/** Documents one history-stream finding surfaced by the storage-integrity check. */\nexport interface HistoryStreamIntegrityRow {\n /** Item id whose history stream is affected. */\n id: string;\n /** Tracker-relative path of the history stream. */\n path: string;\n /** Line number of the first offending content, when line-addressable. */\n line?: number;\n /** Failure detail (conflict marker text or parse failure reason). */\n detail: string;\n}\n\n/** Documents one resurrection-candidate finding: a live item whose history says it was deleted. */\nexport interface ResurrectedItemRow {\n /** Live item id whose newest history operation is a delete. */\n id: string;\n /** Timestamp of the recorded delete operation. */\n deleted_at: string;\n /** Author of the recorded delete operation. */\n deleted_by: string;\n}\n\n/** Documents one duplicate-item-id finding: one id claimed by multiple item documents (cross-branch add/add collision or duplicated format variant). */\nexport interface DuplicateItemIdRow {\n /** Item id claimed by more than one on-disk document. */\n id: string;\n /** Tracker-relative paths of every document claiming the id, sorted for determinism. */\n paths: string[];\n}\n\n/** Documents one unparseable configuration/schema file finding. */\nexport interface UnparseableConfigRow {\n /** Tracker-relative path of the configuration file. */\n path: string;\n /** Failure detail (conflict marker location or JSON parse failure). */\n detail: string;\n}\n\n/** Documents the storage-integrity scan result consumed by the validate check builder. */\nexport interface StorageIntegrityScanResult {\n /** Number of item files present on disk across all type folders. */\n item_files_on_disk: number;\n /** Number of distinct item ids present on disk. */\n item_ids_on_disk: number;\n /** Number of items the standard read path successfully parsed. */\n parsed_items: number;\n /** Item files whose ids the standard read path could not parse (silently skipped elsewhere). */\n unreadable_item_files: UnreadableItemFileRow[];\n /** Ids claimed by more than one item document (post-merge add/add id collisions across type folders or format variants; GH-600). */\n duplicate_item_ids: DuplicateItemIdRow[];\n /** Number of history streams scanned. */\n history_streams_scanned: number;\n /** History streams containing unresolved merge-conflict markers. */\n history_conflict_marker_streams: HistoryStreamIntegrityRow[];\n /** History streams containing an entry that is not a JSON object. */\n history_unparseable_streams: HistoryStreamIntegrityRow[];\n /** Live items whose newest history operation is a delete (delete/modify merge resurrection candidates). */\n resurrected_items: ResurrectedItemRow[];\n /** Streams whose final entry is a non-empty history_repair reconciliation patch — the post-repair divergence signal (informational, not a failure). */\n history_repair_reconciliations: number;\n /** Number of configuration/schema files scanned. */\n config_files_scanned: number;\n /** Configuration/schema files that cannot be parsed (silent-defaults fallback risk). */\n unparseable_config_files: UnparseableConfigRow[];\n}\n\n/** Runtime schema context used to parse every physical item file exactly as the ordinary read path does. */\nexport interface StorageIntegrityItemParseOptions {\n /** Active runtime schema, including unknown-field policy and custom field definitions. */\n schema?: ItemDocumentFormatOptions[\"schema\"];\n /** Item fields contributed by active extensions and therefore valid under a rejecting schema. */\n extensionFieldNames?: readonly string[];\n}\n\nasync function listItemFilesOnDisk(\n pmRoot: string,\n typeToFolder: Record<string, string>,\n): Promise<Array<{ relativePath: string; id: string }>> {\n const folders = [...new Set(Object.values(typeToFolder))];\n const found: Array<{ relativePath: string; id: string }> = [];\n await Promise.all(\n folders.map(async (folder) => {\n let entries: string[];\n try {\n entries = await fs.readdir(path.join(pmRoot, folder));\n } catch {\n return;\n }\n for (const entry of entries) {\n for (const extension of ITEM_FILE_EXTENSIONS) {\n if (entry.toLowerCase().endsWith(extension)) {\n found.push({\n relativePath: `${folder}/${entry}`,\n id: entry.slice(0, -extension.length),\n });\n break;\n }\n }\n }\n }),\n );\n return found.sort((left, right) =>\n left.relativePath.localeCompare(right.relativePath),\n );\n}\n\ninterface HistoryStreamScanAccumulator {\n conflictMarkers: HistoryStreamIntegrityRow[];\n unparseable: HistoryStreamIntegrityRow[];\n resurrected: ResurrectedItemRow[];\n repairReconciliations: number;\n scanned: number;\n}\n\nfunction scanHistoryStreamContent(\n accumulator: HistoryStreamAccumulatorInput,\n raw: string,\n): void {\n const { id, relativePath, liveItemIds, out } = accumulator;\n out.scanned += 1;\n const conflictMarker = findFirstMergeConflictMarker(raw);\n if (conflictMarker) {\n out.conflictMarkers.push({\n id,\n path: relativePath,\n line: conflictMarker.line,\n detail: `unresolved merge conflict marker ${conflictMarker.marker}`,\n });\n return;\n }\n let latestEntry: HistoryEntry | null = null;\n const lines = raw\n .split(/\\r?\\n/)\n .map((line, index) => ({ content: line.trim(), number: index + 1 }))\n .filter((line) => line.content.length > 0);\n for (const line of lines) {\n try {\n const parsed = JSON.parse(line.content) as unknown;\n if (\n typeof parsed !== \"object\" ||\n parsed === null ||\n Array.isArray(parsed)\n ) {\n throw new TypeError(\"history entry must be an object\");\n }\n latestEntry = parsed as HistoryEntry;\n } catch {\n out.unparseable.push({\n id,\n path: relativePath,\n line: line.number,\n detail: \"history line is not a valid JSON object\",\n });\n return;\n }\n }\n if (latestEntry === null) {\n return;\n }\n if (latestEntry.op === \"delete\" && liveItemIds.has(id)) {\n out.resurrected.push({\n id,\n deleted_at: typeof latestEntry.ts === \"string\" ? latestEntry.ts : \"\",\n deleted_by:\n typeof latestEntry.author === \"string\" ? latestEntry.author : \"\",\n });\n }\n if (\n latestEntry.op === \"history_repair\" &&\n Array.isArray(latestEntry.patch) &&\n latestEntry.patch.length > 0\n ) {\n out.repairReconciliations += 1;\n }\n}\n\ninterface HistoryStreamAccumulatorInput {\n id: string;\n relativePath: string;\n liveItemIds: Set<string>;\n out: HistoryStreamScanAccumulator;\n}\n\nasync function scanHistoryStreams(\n pmRoot: string,\n liveItemIds: Set<string>,\n): Promise<HistoryStreamScanAccumulator> {\n const out: HistoryStreamScanAccumulator = {\n conflictMarkers: [],\n unparseable: [],\n resurrected: [],\n repairReconciliations: 0,\n scanned: 0,\n };\n let entries: string[];\n try {\n entries = await fs.readdir(path.join(pmRoot, \"history\"));\n } catch {\n return out;\n }\n for (const entry of entries.sort((left, right) =>\n left.localeCompare(right),\n )) {\n if (!entry.endsWith(\".jsonl\")) {\n continue;\n }\n const raw = await fs.readFile(path.join(pmRoot, \"history\", entry), \"utf8\");\n scanHistoryStreamContent(\n {\n id: entry.slice(0, -\".jsonl\".length),\n relativePath: `history/${entry}`,\n liveItemIds,\n out,\n },\n raw,\n );\n }\n return out;\n}\n\nfunction describeUnparseableJson(raw: string): string | null {\n const conflictMarker = findFirstMergeConflictMarker(raw);\n if (conflictMarker) {\n return `unresolved merge conflict marker ${conflictMarker.marker} at line ${conflictMarker.line}`;\n }\n try {\n JSON.parse(raw);\n return null;\n } catch (error) {\n return `invalid JSON (${String(error)})`;\n }\n}\n\nasync function scanConfigFiles(pmRoot: string): Promise<{\n scanned: number;\n unparseable: UnparseableConfigRow[];\n}> {\n const unparseable: UnparseableConfigRow[] = [];\n let scanned = 0;\n const settingsRaw = await readFileIfExists(getSettingsPath(pmRoot));\n if (settingsRaw !== null) {\n scanned += 1;\n const detail = describeUnparseableJson(settingsRaw);\n if (detail !== null) {\n unparseable.push({ path: \"settings.json\", detail });\n }\n }\n let schemaEntries: string[];\n try {\n schemaEntries = await fs.readdir(path.join(pmRoot, \"schema\"));\n } catch {\n return { scanned, unparseable };\n }\n for (const entry of schemaEntries.sort((left, right) =>\n left.localeCompare(right),\n )) {\n if (!entry.endsWith(\".json\")) {\n continue;\n }\n const raw = await fs.readFile(path.join(pmRoot, \"schema\", entry), \"utf8\");\n scanned += 1;\n const detail = describeUnparseableJson(raw);\n if (detail !== null) {\n unparseable.push({ path: `schema/${entry}`, detail });\n }\n }\n return { scanned, unparseable };\n}\n\n/**\n * Scan tracker storage for integrity failures the ordinary read path masks.\n * `parsedItemIds` are the ids the standard cached list scan successfully\n * parsed; any on-disk item file whose id is missing from that set is an\n * unreadable document that `pm get` would hard-error on while list-based\n * commands silently skip it.\n */\nexport async function scanStorageIntegrity(\n pmRoot: string,\n parsedItemIds: ReadonlySet<string>,\n typeToFolder: Record<string, string>,\n itemParseOptions: StorageIntegrityItemParseOptions = {},\n): Promise<StorageIntegrityScanResult> {\n const itemFiles = await listItemFilesOnDisk(pmRoot, typeToFolder);\n const idsOnDisk = new Set(itemFiles.map((file) => file.id));\n const pathsById = new Map<string, string[]>();\n for (const file of itemFiles) {\n const paths = pathsById.get(file.id);\n if (paths === undefined) {\n pathsById.set(file.id, [file.relativePath]);\n } else {\n paths.push(file.relativePath);\n }\n }\n const duplicateItemIds: DuplicateItemIdRow[] = [...pathsById.entries()]\n .filter(([, paths]) => paths.length > 1)\n .map(([id, paths]) => ({\n id,\n paths: [...paths].sort((left, right) => left.localeCompare(right)),\n }))\n .sort((left, right) => left.id.localeCompare(right.id));\n const unreadableItemFiles = (\n await Promise.all(\n itemFiles.map(async (file): Promise<UnreadableItemFileRow | null> => {\n if (!parsedItemIds.has(file.id)) {\n return { path: file.relativePath, id: file.id };\n }\n try {\n const absolutePath = path.join(pmRoot, file.relativePath);\n parseItemDocument(await fs.readFile(absolutePath, \"utf8\"), {\n format: absolutePath.toLowerCase().endsWith(\".md\")\n ? \"json_markdown\"\n : \"toon\",\n schema: itemParseOptions.schema,\n extensionFieldNames: itemParseOptions.extensionFieldNames,\n });\n return null;\n } catch {\n return { path: file.relativePath, id: file.id };\n }\n }),\n )\n ).filter((row): row is UnreadableItemFileRow => row !== null);\n // \"Live\" for resurrection detection means an item file exists on disk —\n // deleted items keep their history stream but lose the document, so a\n // delete-terminated stream is only suspicious when the document is back.\n const historyScan = await scanHistoryStreams(pmRoot, idsOnDisk);\n const configScan = await scanConfigFiles(pmRoot);\n return {\n item_files_on_disk: itemFiles.length,\n item_ids_on_disk: idsOnDisk.size,\n parsed_items: parsedItemIds.size,\n unreadable_item_files: unreadableItemFiles,\n duplicate_item_ids: duplicateItemIds,\n history_streams_scanned: historyScan.scanned,\n history_conflict_marker_streams: historyScan.conflictMarkers,\n history_unparseable_streams: historyScan.unparseable,\n resurrected_items: historyScan.resurrected,\n history_repair_reconciliations: historyScan.repairReconciliations,\n config_files_scanned: configScan.scanned,\n unparseable_config_files: configScan.unparseable,\n };\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;;;AACH,OAAO,EAAE,MAAM,kBAAkB,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E;IACtE,yEAAyE;IACzE,MAAM,WAAW,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAChE,MAAM,UAAU,GAAG,MAAM,eAAe,CAAC,MAAM,CAAC,CAAC;IACjD,OAAO;QACL,kBAAkB,EAAE,SAAS,CAAC,MAAM;QACpC,gBAAgB,EAAE,SAAS,CAAC,IAAI;QAChC,YAAY,EAAE,aAAa,CAAC,IAAI;QAChC,qBAAqB,EAAE,mBAAmB;QAC1C,kBAAkB,EAAE,gBAAgB;QACpC,uBAAuB,EAAE,WAAW,CAAC,OAAO;QAC5C,+BAA+B,EAAE,WAAW,CAAC,eAAe;QAC5D,2BAA2B,EAAE,WAAW,CAAC,WAAW;QACpD,iBAAiB,EAAE,WAAW,CAAC,WAAW;QAC1C,8BAA8B,EAAE,WAAW,CAAC,qBAAqB;QACjE,oBAAoB,EAAE,UAAU,CAAC,OAAO;QACxC,wBAAwB,EAAE,UAAU,CAAC,WAAW;KACjD,CAAC;AACJ,CAAC","debugId":"99fdc5e7-d08b-54a7-8169-1385c91f8ed6"}
@@ -6,7 +6,7 @@ import { type DuplicateIssueCode } from "../../core/governance/issue-codes.js";
6
6
  import { type MissingFieldOccurrence } from "../../core/validate/missing-by-type.js";
7
7
  import type { ValidateMetadataProfile, ValidateMetadataRequiredField } from "../../types/index.js";
8
8
  import { type RelationshipKindRegistry } from "../relationships.js";
9
- type ValidateCheckName = "metadata" | "resolution" | "lifecycle" | "dependency_references" | "files" | "command_references" | "history_drift" | "format_version";
9
+ type ValidateCheckName = "metadata" | "resolution" | "lifecycle" | "dependency_references" | "files" | "command_references" | "history_drift" | "format_version" | "storage_integrity";
10
10
  type ValidateStatus = "ok" | "warn" | "error";
11
11
  type ValidateDependencyCycleSeverity = "off" | "warn" | "error";
12
12
  type ValidateFileScanMode = "default" | "tracked-all" | "tracked-all-strict";
@@ -40,6 +40,8 @@ export interface ValidateCommandOptions {
40
40
  allAffectedIds?: boolean;
41
41
  /** Value that configures or reports check history drift for this contract. */
42
42
  checkHistoryDrift?: boolean;
43
+ /** Run the post-merge storage-integrity check (unreadable items, history conflict markers, resurrected items, unparseable config). */
44
+ checkStorageIntegrity?: boolean;
43
45
  /** Value that configures or reports check command references for this contract. */
44
46
  checkCommandReferences?: boolean;
45
47
  /** Strategy used to control scan behavior. */