@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
@@ -30,7 +30,7 @@ export interface StatsResult {
30
30
  };
31
31
  /** Schema type that determines the shape and validation rules for this value. */
32
32
  by_type: Record<ItemType, number>;
33
- /** Lifecycle state reported for bythe record. */
33
+ /** Item counts grouped by lifecycle status. */
34
34
  by_status: Record<ItemStatus, number>;
35
35
  /** Present only with --metadata-coverage: per-field coverage overall and by type. */
36
36
  metadata_coverage?: MetadataCoverageReport;
package/dist/sdk/stats.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * Implements the pm stats 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]="3abba5c6-fe9b-55de-bafb-3f3c604df10c")}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]="afed0a81-eee3-5a32-9ebb-79f6f64301c5")}catch(e){}}();
8
8
  import fs from "node:fs/promises";
9
9
  import path from "node:path";
10
10
  import { getActiveExtensionRegistrations, runActiveOnReadHooks, } from "../core/extensions/index.js";
@@ -148,4 +148,4 @@ export async function runStats(global, options = {}) {
148
148
  };
149
149
  }
150
150
  //# sourceMappingURL=stats.js.map
151
- //# debugId=3abba5c6-fe9b-55de-bafb-3f3c604df10c
151
+ //# debugId=afed0a81-eee3-5a32-9ebb-79f6f64301c5
@@ -1 +1 @@
1
- {"version":3,"file":"stats.js","sources":["sdk/stats.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module sdk/stats\n *\n * Implements the pm stats command surface and its agent-facing runtime behavior.\n */\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport {\n getActiveExtensionRegistrations,\n runActiveOnReadHooks,\n} from \"../core/extensions/index.js\";\nimport {\n computeContentFieldUtilization,\n type ContentFieldUtilizationReport,\n} from \"../core/governance/content-fields.js\";\nimport {\n computeMetadataCoverage,\n groupItemsByDimension,\n lifecycleClassifierFromStatusRegistry,\n type GroupedBreakdown,\n type MetadataCoverageReport,\n} from \"../core/governance/metadata-coverage.js\";\nimport { pathExists, readFileIfExists } from \"../core/fs/fs-utils.js\";\nimport { enforceHistoryStreamPolicyForItems } from \"../core/history/history-stream-policy.js\";\nimport {\n computeHistoryStorageStats,\n type HistoryStorageStats,\n} from \"../core/history/history-storage-stats.js\";\nimport { resolveItemTypeRegistry } from \"../core/item/type-registry.js\";\nimport { resolveRuntimeStatusRegistry } from \"../core/schema/runtime-schema.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 {\n listAllItemMetadataLight,\n listAllItemMetadataWithBody,\n} from \"../core/store/item-store.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../core/store/paths.js\";\nimport { readSettings } from \"../core/store/settings.js\";\nimport type { ItemStatus, ItemType } from \"../types/index.js\";\n\n/** Documents the stats command options payload exchanged by command, SDK, and package integrations. */\nexport interface StatsCommandOptions {\n /** Include aggregate per-stream history storage metrics (sizes, depth, oldest/newest). */\n storage?: boolean;\n /** Include metadata coverage percentages (AC, estimates, resolution, tags, parent) overall and by type. */\n metadataCoverage?: boolean;\n /** Include a lifecycle-bucketed breakdown grouped by assignee. */\n byAssignee?: boolean;\n /** Include a lifecycle-bucketed breakdown grouped by tag (optionally filtered by --tag-prefix). */\n byTag?: boolean;\n /** Include a lifecycle-bucketed breakdown grouped by priority. */\n byPriority?: boolean;\n /** With --by-tag: only consider tags starting with this prefix (e.g. \"domain:\"). */\n tagPrefix?: string;\n /** Include a content-field utilization breakdown (notes/learnings/files/docs/tests/comments/deps/body usage rates). */\n fieldUtilization?: boolean;\n}\n\n/** Documents the stats result payload exchanged by command, SDK, and package integrations. */\nexport interface StatsResult {\n /** Value that configures or reports totals for this contract. */\n totals: {\n items: number;\n history_streams: number;\n history_entries: number;\n };\n /** Schema type that determines the shape and validation rules for this value. */\n by_type: Record<ItemType, number>;\n /** Lifecycle state reported for bythe record. */\n by_status: Record<ItemStatus, number>;\n /** Present only with --metadata-coverage: per-field coverage overall and by type. */\n metadata_coverage?: MetadataCoverageReport;\n /** Present only with --by-assignee/--by-tag/--by-priority: lifecycle-bucketed group breakdowns. */\n breakdowns?: {\n assignee?: GroupedBreakdown;\n tag?: GroupedBreakdown;\n priority?: GroupedBreakdown;\n };\n /** Present only with --storage: aggregate history-stream metrics for compaction/planning. */\n storage?: HistoryStorageStats;\n /** Present only with --field-utilization: content-field utilization rates across all items. */\n field_utilization?: ContentFieldUtilizationReport;\n /** ISO 8601 timestamp recording when generated occurred. */\n generated_at: string;\n}\n\nfunction zeroByType(itemTypes: string[]): Record<ItemType, number> {\n return itemTypes.reduce(\n (acc, value) => {\n acc[value] = 0;\n return acc;\n },\n {} as Record<ItemType, number>,\n );\n}\n\nfunction zeroByStatus(statuses: string[]): Record<ItemStatus, number> {\n return statuses.reduce(\n (acc, value) => {\n acc[value] = 0;\n return acc;\n },\n {} as Record<ItemStatus, number>,\n );\n}\n\nfunction countNonEmptyLines(raw: string): number {\n if (raw.trim().length === 0) {\n return 0;\n }\n return raw.split(/\\r?\\n/u).filter((line) => line.trim().length > 0).length;\n}\n\nasync function readHistoryStreamContents(\n pmRoot: string,\n): Promise<Array<{ id: string; raw: string }>> {\n const historyDir = path.join(pmRoot, \"history\");\n if (!(await pathExists(historyDir))) {\n return [];\n }\n\n await runActiveOnReadHooks({\n path: historyDir,\n scope: \"project\",\n });\n const historyFiles = (await fs.readdir(historyDir))\n .filter((entry) => entry.endsWith(\".jsonl\"))\n .sort((a, b) => a.localeCompare(b));\n\n const streams: Array<{ id: string; raw: string }> = [];\n for (const file of historyFiles) {\n const historyPath = path.join(historyDir, file);\n const raw = await readFileIfExists(historyPath);\n if (raw === null) {\n continue;\n }\n await runActiveOnReadHooks({\n path: historyPath,\n scope: \"project\",\n });\n streams.push({ id: file.slice(0, -\".jsonl\".length), raw });\n }\n\n return streams;\n}\n\n/** Public contract for test only, shared by SDK and presentation-layer consumers. */\nexport const _testOnly = {\n zeroByType,\n zeroByStatus,\n countNonEmptyLines,\n readHistoryStreamContents,\n};\n\n/** Implements run stats for the public runtime surface of this module. */\nexport async function runStats(\n global: GlobalOptions,\n options: StatsCommandOptions = {},\n): Promise<StatsResult> {\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 typeRegistry = resolveItemTypeRegistry(\n settings,\n getActiveExtensionRegistrations(),\n );\n const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);\n // Field utilization needs the heavy collections (notes/learnings/files/docs/\n // tests/comments/deps) AND the body, which the light reader drops — so when it\n // is requested we read the WithBody rows and use them for every section.\n const items = options.fieldUtilization\n ? await listAllItemMetadataWithBody(\n pmRoot,\n settings.item_format,\n typeRegistry.type_to_folder,\n undefined,\n settings.schema,\n )\n : await listAllItemMetadataLight(\n pmRoot,\n settings.item_format,\n typeRegistry.type_to_folder,\n undefined,\n settings.schema,\n );\n await enforceHistoryStreamPolicyForItems({\n pmRoot,\n settings,\n itemIds: items.map((item) => item.id),\n commandLabel: \"stats\",\n });\n\n const byType = zeroByType(typeRegistry.types);\n const byStatus = zeroByStatus(\n statusRegistry.definitions.map((definition) => definition.id),\n );\n // zeroByType/zeroByStatus pre-seed a bucket for every registry type/status, and\n // the light item-metadata reader drops any item whose type/status falls outside\n // the active registry (parse rejects them) — so every item's bucket is already\n // present here and no on-the-fly initialization is reachable.\n for (const item of items) {\n byType[item.type] += 1;\n byStatus[item.status] += 1;\n }\n\n const streams = await readHistoryStreamContents(pmRoot);\n let historyEntries = 0;\n for (const stream of streams) {\n historyEntries += countNonEmptyLines(stream.raw);\n }\n const storage = options.storage\n ? computeHistoryStorageStats(streams)\n : undefined;\n\n const classifier = lifecycleClassifierFromStatusRegistry(statusRegistry);\n const metadataCoverage = options.metadataCoverage\n ? computeMetadataCoverage(items, classifier)\n : undefined;\n const breakdowns: NonNullable<StatsResult[\"breakdowns\"]> = {};\n if (options.byAssignee) {\n breakdowns.assignee = groupItemsByDimension(items, \"assignee\", classifier);\n }\n if (options.byTag) {\n breakdowns.tag = groupItemsByDimension(items, \"tag\", classifier, {\n tagPrefix: options.tagPrefix,\n });\n }\n if (options.byPriority) {\n breakdowns.priority = groupItemsByDimension(items, \"priority\", classifier);\n }\n const hasBreakdowns = Object.keys(breakdowns).length > 0;\n const fieldUtilization = options.fieldUtilization\n ? computeContentFieldUtilization(items)\n : undefined;\n\n return {\n totals: {\n items: items.length,\n history_streams: streams.length,\n history_entries: historyEntries,\n },\n by_type: byType,\n by_status: byStatus,\n ...(metadataCoverage ? { metadata_coverage: metadataCoverage } : {}),\n ...(hasBreakdowns ? { breakdowns } : {}),\n ...(storage ? { storage } : {}),\n ...(fieldUtilization ? { field_utilization: fieldUtilization } : {}),\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,EACL,+BAA+B,EAC/B,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,8BAA8B,GAE/B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,qCAAqC,GAGtC,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,kCAAkC,EAAE,MAAM,0CAA0C,CAAC;AAC9F,OAAO,EACL,0BAA0B,GAE3B,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EACL,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACxE,OA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AS,CAAC;IAEd,OAAO;QACL,MAAM,EAAE;YACN,KAAK,EAAE,KAAK,CAAC,MAAM;YACnB,eAAe,EAAE,OAAO,CAAC,MAAM;YAC/B,eAAe,EAAE,cAAc;SAChC;QACD,OAAO,EAAE,MAAM;QACf,SAAS,EAAE,QAAQ;QACnB,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACpE,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/B,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACpE,YAAY,EAAE,MAAM,EAAE;KACvB,CAAC;AACJ,CAAC","debugId":"3abba5c6-fe9b-55de-bafb-3f3c604df10c"}
1
+ {"version":3,"file":"stats.js","sources":["sdk/stats.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module sdk/stats\n *\n * Implements the pm stats command surface and its agent-facing runtime behavior.\n */\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport {\n getActiveExtensionRegistrations,\n runActiveOnReadHooks,\n} from \"../core/extensions/index.js\";\nimport {\n computeContentFieldUtilization,\n type ContentFieldUtilizationReport,\n} from \"../core/governance/content-fields.js\";\nimport {\n computeMetadataCoverage,\n groupItemsByDimension,\n lifecycleClassifierFromStatusRegistry,\n type GroupedBreakdown,\n type MetadataCoverageReport,\n} from \"../core/governance/metadata-coverage.js\";\nimport { pathExists, readFileIfExists } from \"../core/fs/fs-utils.js\";\nimport { enforceHistoryStreamPolicyForItems } from \"../core/history/history-stream-policy.js\";\nimport {\n computeHistoryStorageStats,\n type HistoryStorageStats,\n} from \"../core/history/history-storage-stats.js\";\nimport { resolveItemTypeRegistry } from \"../core/item/type-registry.js\";\nimport { resolveRuntimeStatusRegistry } from \"../core/schema/runtime-schema.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 {\n listAllItemMetadataLight,\n listAllItemMetadataWithBody,\n} from \"../core/store/item-store.js\";\nimport { getSettingsPath, resolvePmRoot } from \"../core/store/paths.js\";\nimport { readSettings } from \"../core/store/settings.js\";\nimport type { ItemStatus, ItemType } from \"../types/index.js\";\n\n/** Documents the stats command options payload exchanged by command, SDK, and package integrations. */\nexport interface StatsCommandOptions {\n /** Include aggregate per-stream history storage metrics (sizes, depth, oldest/newest). */\n storage?: boolean;\n /** Include metadata coverage percentages (AC, estimates, resolution, tags, parent) overall and by type. */\n metadataCoverage?: boolean;\n /** Include a lifecycle-bucketed breakdown grouped by assignee. */\n byAssignee?: boolean;\n /** Include a lifecycle-bucketed breakdown grouped by tag (optionally filtered by --tag-prefix). */\n byTag?: boolean;\n /** Include a lifecycle-bucketed breakdown grouped by priority. */\n byPriority?: boolean;\n /** With --by-tag: only consider tags starting with this prefix (e.g. \"domain:\"). */\n tagPrefix?: string;\n /** Include a content-field utilization breakdown (notes/learnings/files/docs/tests/comments/deps/body usage rates). */\n fieldUtilization?: boolean;\n}\n\n/** Documents the stats result payload exchanged by command, SDK, and package integrations. */\nexport interface StatsResult {\n /** Value that configures or reports totals for this contract. */\n totals: {\n items: number;\n history_streams: number;\n history_entries: number;\n };\n /** Schema type that determines the shape and validation rules for this value. */\n by_type: Record<ItemType, number>;\n /** Item counts grouped by lifecycle status. */\n by_status: Record<ItemStatus, number>;\n /** Present only with --metadata-coverage: per-field coverage overall and by type. */\n metadata_coverage?: MetadataCoverageReport;\n /** Present only with --by-assignee/--by-tag/--by-priority: lifecycle-bucketed group breakdowns. */\n breakdowns?: {\n assignee?: GroupedBreakdown;\n tag?: GroupedBreakdown;\n priority?: GroupedBreakdown;\n };\n /** Present only with --storage: aggregate history-stream metrics for compaction/planning. */\n storage?: HistoryStorageStats;\n /** Present only with --field-utilization: content-field utilization rates across all items. */\n field_utilization?: ContentFieldUtilizationReport;\n /** ISO 8601 timestamp recording when generated occurred. */\n generated_at: string;\n}\n\nfunction zeroByType(itemTypes: string[]): Record<ItemType, number> {\n return itemTypes.reduce(\n (acc, value) => {\n acc[value] = 0;\n return acc;\n },\n {} as Record<ItemType, number>,\n );\n}\n\nfunction zeroByStatus(statuses: string[]): Record<ItemStatus, number> {\n return statuses.reduce(\n (acc, value) => {\n acc[value] = 0;\n return acc;\n },\n {} as Record<ItemStatus, number>,\n );\n}\n\nfunction countNonEmptyLines(raw: string): number {\n if (raw.trim().length === 0) {\n return 0;\n }\n return raw.split(/\\r?\\n/u).filter((line) => line.trim().length > 0).length;\n}\n\nasync function readHistoryStreamContents(\n pmRoot: string,\n): Promise<Array<{ id: string; raw: string }>> {\n const historyDir = path.join(pmRoot, \"history\");\n if (!(await pathExists(historyDir))) {\n return [];\n }\n\n await runActiveOnReadHooks({\n path: historyDir,\n scope: \"project\",\n });\n const historyFiles = (await fs.readdir(historyDir))\n .filter((entry) => entry.endsWith(\".jsonl\"))\n .sort((a, b) => a.localeCompare(b));\n\n const streams: Array<{ id: string; raw: string }> = [];\n for (const file of historyFiles) {\n const historyPath = path.join(historyDir, file);\n const raw = await readFileIfExists(historyPath);\n if (raw === null) {\n continue;\n }\n await runActiveOnReadHooks({\n path: historyPath,\n scope: \"project\",\n });\n streams.push({ id: file.slice(0, -\".jsonl\".length), raw });\n }\n\n return streams;\n}\n\n/** Public contract for test only, shared by SDK and presentation-layer consumers. */\nexport const _testOnly = {\n zeroByType,\n zeroByStatus,\n countNonEmptyLines,\n readHistoryStreamContents,\n};\n\n/** Implements run stats for the public runtime surface of this module. */\nexport async function runStats(\n global: GlobalOptions,\n options: StatsCommandOptions = {},\n): Promise<StatsResult> {\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 typeRegistry = resolveItemTypeRegistry(\n settings,\n getActiveExtensionRegistrations(),\n );\n const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);\n // Field utilization needs the heavy collections (notes/learnings/files/docs/\n // tests/comments/deps) AND the body, which the light reader drops — so when it\n // is requested we read the WithBody rows and use them for every section.\n const items = options.fieldUtilization\n ? await listAllItemMetadataWithBody(\n pmRoot,\n settings.item_format,\n typeRegistry.type_to_folder,\n undefined,\n settings.schema,\n )\n : await listAllItemMetadataLight(\n pmRoot,\n settings.item_format,\n typeRegistry.type_to_folder,\n undefined,\n settings.schema,\n );\n await enforceHistoryStreamPolicyForItems({\n pmRoot,\n settings,\n itemIds: items.map((item) => item.id),\n commandLabel: \"stats\",\n });\n\n const byType = zeroByType(typeRegistry.types);\n const byStatus = zeroByStatus(\n statusRegistry.definitions.map((definition) => definition.id),\n );\n // zeroByType/zeroByStatus pre-seed a bucket for every registry type/status, and\n // the light item-metadata reader drops any item whose type/status falls outside\n // the active registry (parse rejects them) — so every item's bucket is already\n // present here and no on-the-fly initialization is reachable.\n for (const item of items) {\n byType[item.type] += 1;\n byStatus[item.status] += 1;\n }\n\n const streams = await readHistoryStreamContents(pmRoot);\n let historyEntries = 0;\n for (const stream of streams) {\n historyEntries += countNonEmptyLines(stream.raw);\n }\n const storage = options.storage\n ? computeHistoryStorageStats(streams)\n : undefined;\n\n const classifier = lifecycleClassifierFromStatusRegistry(statusRegistry);\n const metadataCoverage = options.metadataCoverage\n ? computeMetadataCoverage(items, classifier)\n : undefined;\n const breakdowns: NonNullable<StatsResult[\"breakdowns\"]> = {};\n if (options.byAssignee) {\n breakdowns.assignee = groupItemsByDimension(items, \"assignee\", classifier);\n }\n if (options.byTag) {\n breakdowns.tag = groupItemsByDimension(items, \"tag\", classifier, {\n tagPrefix: options.tagPrefix,\n });\n }\n if (options.byPriority) {\n breakdowns.priority = groupItemsByDimension(items, \"priority\", classifier);\n }\n const hasBreakdowns = Object.keys(breakdowns).length > 0;\n const fieldUtilization = options.fieldUtilization\n ? computeContentFieldUtilization(items)\n : undefined;\n\n return {\n totals: {\n items: items.length,\n history_streams: streams.length,\n history_entries: historyEntries,\n },\n by_type: byType,\n by_status: byStatus,\n ...(metadataCoverage ? { metadata_coverage: metadataCoverage } : {}),\n ...(hasBreakdowns ? { breakdowns } : {}),\n ...(storage ? { storage } : {}),\n ...(fieldUtilization ? { field_utilization: fieldUtilization } : {}),\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,EACL,+BAA+B,EAC/B,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,8BAA8B,GAE/B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,qCAAqC,GAGtC,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,kCAAkC,EAAE,MAAM,0CAA0C,CAAC;AAC9F,OAAO,EACL,0BAA0B,GAE3B,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,O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GAAG,CAAC,CAAC;IACzD,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB;QAC/C,CAAC,CAAC,8BAA8B,CAAC,KAAK,CAAC;QACvC,CAAC,CAAC,SAAS,CAAC;IAEd,OAAO;QACL,MAAM,EAAE;YACN,KAAK,EAAE,KAAK,CAAC,MAAM;YACnB,eAAe,EAAE,OAAO,CAAC,MAAM;YAC/B,eAAe,EAAE,cAAc;SAChC;QACD,OAAO,EAAE,MAAM;QACf,SAAS,EAAE,QAAQ;QACnB,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACpE,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/B,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACpE,YAAY,EAAE,MAAM,EAAE;KACvB,CAAC;AACJ,CAAC","debugId":"afed0a81-eee3-5a32-9ebb-79f6f64301c5"}
@@ -0,0 +1,46 @@
1
+ /** Documents one journal-sweep decision row surfaced by the transaction GC. */
2
+ export interface WorkspaceTransactionGcEntry {
3
+ /** Relative path like "transactions/sdk/<transactionId>.json". */
4
+ file: string;
5
+ /** Journal status read from the receipt, or null when unreadable. */
6
+ status: string | null;
7
+ /** Age in seconds derived from the journal's updatedAt, or null when unparseable. */
8
+ age_seconds: number | null;
9
+ /** Whether the journal was (or would be) pruned. */
10
+ stale: boolean;
11
+ /** Why the journal was retained, when it was. */
12
+ reason?: "active" | "fresh" | "unparseable";
13
+ }
14
+ /** Extension hooks mirroring the checkpoint GC so reads/writes stay observable. */
15
+ export interface WorkspaceTransactionGcHooks {
16
+ /** Invoked before reading each journal file. */
17
+ onRead?: (absolutePath: string) => Promise<string[]>;
18
+ /** Invoked after removing each journal file. */
19
+ onWrite?: (absolutePath: string) => Promise<string[]>;
20
+ }
21
+ /** Documents the transaction GC options payload exchanged by command, SDK, and package integrations. */
22
+ export interface WorkspaceTransactionGcOptions {
23
+ /** Preview prune decisions without deleting any journal. */
24
+ dryRun: boolean;
25
+ /** Prune terminal journals older than this many days. Negative values are clamped to zero; a non-finite value disables pruning entirely so bad input never deletes recovery receipts. */
26
+ retentionDays: number;
27
+ /** Clock override for deterministic tests (milliseconds since epoch). */
28
+ now?: number;
29
+ /** Extension observability hooks. */
30
+ hooks?: WorkspaceTransactionGcHooks;
31
+ }
32
+ /** Documents the transaction GC result payload exchanged by command, SDK, and package integrations. */
33
+ export interface WorkspaceTransactionGcResult {
34
+ /** Number of journal files scanned. */
35
+ scanned: number;
36
+ /** Relative paths of pruned journals. */
37
+ removed: string[];
38
+ /** Relative paths of retained journals. */
39
+ retained: string[];
40
+ /** Non-fatal sweep warnings. */
41
+ warnings: string[];
42
+ /** One decision row per scanned journal. */
43
+ entries: WorkspaceTransactionGcEntry[];
44
+ }
45
+ /** Sweep `transactions/sdk/` and prune terminal workspace-transaction journals older than the retention window. One decision row is reported per journal so `pm gc` output stays auditable. */
46
+ export declare function runWorkspaceTransactionGc(pmRoot: string, options: WorkspaceTransactionGcOptions): Promise<WorkspaceTransactionGcResult>;
@@ -0,0 +1,155 @@
1
+ /**
2
+ * @module sdk/workspace-transaction-gc
3
+ *
4
+ * Age-based garbage collector for the durable SDK workspace-transaction
5
+ * journals written by `commitWorkspaceTransaction` under
6
+ * `transactions/sdk/<transactionId>.json`. Only terminal journals (status
7
+ * `committed` or `compensated`) older than the configured retention are
8
+ * pruned; in-flight journals (`applying`/`compensating`) are crash-recovery
9
+ * state and are always retained, as are journals whose status or timestamp
10
+ * cannot be read (safety-first, mirroring the checkpoint and stale-lock
11
+ * sweeps). Transaction steps are contract-idempotent, so pruning a terminal
12
+ * receipt only costs the ability to short-circuit an identical replay — it
13
+ * never breaks correctness.
14
+ */
15
+
16
+ !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]="b27c5042-bbfb-5427-a76b-084acd5e06de")}catch(e){}}();
17
+ import fs from "node:fs/promises";
18
+ import path from "node:path";
19
+ const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
20
+ const TERMINAL_JOURNAL_STATUSES = new Set(["committed", "compensated"]);
21
+ function isErrno(error, code) {
22
+ return (typeof error === "object" &&
23
+ error !== null &&
24
+ "code" in error &&
25
+ error.code === code);
26
+ }
27
+ function readJournalStatusAndTimestamp(raw) {
28
+ let parsed;
29
+ try {
30
+ parsed = JSON.parse(raw);
31
+ }
32
+ catch {
33
+ return { status: null, updatedAt: null };
34
+ }
35
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
36
+ return { status: null, updatedAt: null };
37
+ }
38
+ const record = parsed;
39
+ return {
40
+ status: typeof record.status === "string" ? record.status : null,
41
+ updatedAt: typeof record.updatedAt === "string" ? record.updatedAt : null,
42
+ };
43
+ }
44
+ function classifyWorkspaceTransactionJournal(file, status, updatedAt, nowMs, retentionMs) {
45
+ const updatedAtMs = updatedAt === null ? Number.NaN : Date.parse(updatedAt);
46
+ if (status === null || !Number.isFinite(updatedAtMs)) {
47
+ return {
48
+ entry: {
49
+ file,
50
+ status,
51
+ age_seconds: null,
52
+ stale: false,
53
+ reason: "unparseable",
54
+ },
55
+ remove: false,
56
+ };
57
+ }
58
+ const ageMs = nowMs - updatedAtMs;
59
+ if (!TERMINAL_JOURNAL_STATUSES.has(status)) {
60
+ return {
61
+ entry: {
62
+ file,
63
+ status,
64
+ age_seconds: Math.floor(ageMs / 1000),
65
+ stale: false,
66
+ reason: "active",
67
+ },
68
+ remove: false,
69
+ };
70
+ }
71
+ // A non-finite retentionMs makes this comparison false, disabling pruning
72
+ // rather than risking deletion under bad input.
73
+ if (!(ageMs > retentionMs)) {
74
+ return {
75
+ entry: {
76
+ file,
77
+ status,
78
+ age_seconds: Math.floor(ageMs / 1000),
79
+ stale: false,
80
+ reason: "fresh",
81
+ },
82
+ remove: false,
83
+ };
84
+ }
85
+ return {
86
+ entry: {
87
+ file,
88
+ status,
89
+ age_seconds: Math.floor(ageMs / 1000),
90
+ stale: true,
91
+ },
92
+ remove: true,
93
+ };
94
+ }
95
+ async function processWorkspaceTransactionJournal(absolutePath, relativePath, fileName, options) {
96
+ const warnings = options.hooks?.onRead
97
+ ? await options.hooks.onRead(absolutePath)
98
+ : [];
99
+ const journal = readJournalStatusAndTimestamp(await fs.readFile(absolutePath, "utf8"));
100
+ const decision = classifyWorkspaceTransactionJournal(relativePath, journal.status, journal.updatedAt, options.nowMs, options.retentionMs);
101
+ if (decision.entry.reason === "unparseable") {
102
+ warnings.push(`transaction_journal_unparseable:${fileName}`);
103
+ }
104
+ if (decision.remove && !options.dryRun) {
105
+ await fs.rm(absolutePath, { force: true });
106
+ if (options.hooks?.onWrite) {
107
+ warnings.push(...(await options.hooks.onWrite(absolutePath)));
108
+ }
109
+ }
110
+ return { decision, warnings };
111
+ }
112
+ /** Sweep `transactions/sdk/` and prune terminal workspace-transaction journals older than the retention window. One decision row is reported per journal so `pm gc` output stays auditable. */
113
+ export async function runWorkspaceTransactionGc(pmRoot, options) {
114
+ const { dryRun, hooks } = options;
115
+ const nowMs = options.now ?? Date.now();
116
+ const retentionMs = Math.max(0, options.retentionDays) * MILLISECONDS_PER_DAY;
117
+ const journalsDir = path.join(pmRoot, "transactions", "sdk");
118
+ const result = {
119
+ scanned: 0,
120
+ removed: [],
121
+ retained: [],
122
+ warnings: [],
123
+ entries: [],
124
+ };
125
+ let files;
126
+ try {
127
+ files = (await fs.readdir(journalsDir))
128
+ .filter((file) => file.endsWith(".json"))
129
+ .sort((left, right) => left.localeCompare(right));
130
+ }
131
+ catch (error) {
132
+ if (isErrno(error, "ENOENT")) {
133
+ return result;
134
+ }
135
+ throw error;
136
+ }
137
+ for (const file of files) {
138
+ const absPath = path.join(journalsDir, file);
139
+ const relPath = `transactions/sdk/${file}`;
140
+ const fileResult = await processWorkspaceTransactionJournal(absPath, relPath, file, { dryRun, hooks, nowMs, retentionMs });
141
+ result.warnings.push(...fileResult.warnings);
142
+ result.scanned += 1;
143
+ const { decision } = fileResult;
144
+ if (!decision.remove) {
145
+ result.retained.push(relPath);
146
+ result.entries.push(decision.entry);
147
+ continue;
148
+ }
149
+ result.removed.push(relPath);
150
+ result.entries.push(decision.entry);
151
+ }
152
+ return result;
153
+ }
154
+ //# sourceMappingURL=workspace-transaction-gc.js.map
155
+ //# debugId=b27c5042-bbfb-5427-a76b-084acd5e06de
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-transaction-gc.js","sources":["sdk/workspace-transaction-gc.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module sdk/workspace-transaction-gc\n *\n * Age-based garbage collector for the durable SDK workspace-transaction\n * journals written by `commitWorkspaceTransaction` under\n * `transactions/sdk/<transactionId>.json`. Only terminal journals (status\n * `committed` or `compensated`) older than the configured retention are\n * pruned; in-flight journals (`applying`/`compensating`) are crash-recovery\n * state and are always retained, as are journals whose status or timestamp\n * cannot be read (safety-first, mirroring the checkpoint and stale-lock\n * sweeps). Transaction steps are contract-idempotent, so pruning a terminal\n * receipt only costs the ability to short-circuit an identical replay — it\n * never breaks correctness.\n */\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\n\nconst MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;\nconst TERMINAL_JOURNAL_STATUSES = new Set([\"committed\", \"compensated\"]);\n\n/** Documents one journal-sweep decision row surfaced by the transaction GC. */\nexport interface WorkspaceTransactionGcEntry {\n /** Relative path like \"transactions/sdk/<transactionId>.json\". */\n file: string;\n /** Journal status read from the receipt, or null when unreadable. */\n status: string | null;\n /** Age in seconds derived from the journal's updatedAt, or null when unparseable. */\n age_seconds: number | null;\n /** Whether the journal was (or would be) pruned. */\n stale: boolean;\n /** Why the journal was retained, when it was. */\n reason?: \"active\" | \"fresh\" | \"unparseable\";\n}\n\n/** Extension hooks mirroring the checkpoint GC so reads/writes stay observable. */\nexport interface WorkspaceTransactionGcHooks {\n /** Invoked before reading each journal file. */\n onRead?: (absolutePath: string) => Promise<string[]>;\n /** Invoked after removing each journal file. */\n onWrite?: (absolutePath: string) => Promise<string[]>;\n}\n\n/** Documents the transaction GC options payload exchanged by command, SDK, and package integrations. */\nexport interface WorkspaceTransactionGcOptions {\n /** Preview prune decisions without deleting any journal. */\n dryRun: boolean;\n /** Prune terminal journals older than this many days. Negative values are clamped to zero; a non-finite value disables pruning entirely so bad input never deletes recovery receipts. */\n retentionDays: number;\n /** Clock override for deterministic tests (milliseconds since epoch). */\n now?: number;\n /** Extension observability hooks. */\n hooks?: WorkspaceTransactionGcHooks;\n}\n\n/** Documents the transaction GC result payload exchanged by command, SDK, and package integrations. */\nexport interface WorkspaceTransactionGcResult {\n /** Number of journal files scanned. */\n scanned: number;\n /** Relative paths of pruned journals. */\n removed: string[];\n /** Relative paths of retained journals. */\n retained: string[];\n /** Non-fatal sweep warnings. */\n warnings: string[];\n /** One decision row per scanned journal. */\n entries: WorkspaceTransactionGcEntry[];\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\nfunction readJournalStatusAndTimestamp(raw: string): {\n status: string | null;\n updatedAt: string | null;\n} {\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw) as unknown;\n } catch {\n return { status: null, updatedAt: null };\n }\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n return { status: null, updatedAt: null };\n }\n const record = parsed as Record<string, unknown>;\n return {\n status: typeof record.status === \"string\" ? record.status : null,\n updatedAt: typeof record.updatedAt === \"string\" ? record.updatedAt : null,\n };\n}\n\ninterface WorkspaceTransactionGcDecision {\n /** Auditable decision row emitted for the journal. */\n entry: WorkspaceTransactionGcEntry;\n /** Whether the journal is old and terminal enough to remove. */\n remove: boolean;\n}\n\ninterface WorkspaceTransactionGcFileResult {\n /** Decision for the scanned journal. */\n decision: WorkspaceTransactionGcDecision;\n /** Extension and parse warnings accumulated while processing the file. */\n warnings: string[];\n}\n\nfunction classifyWorkspaceTransactionJournal(\n file: string,\n status: string | null,\n updatedAt: string | null,\n nowMs: number,\n retentionMs: number,\n): WorkspaceTransactionGcDecision {\n const updatedAtMs = updatedAt === null ? Number.NaN : Date.parse(updatedAt);\n if (status === null || !Number.isFinite(updatedAtMs)) {\n return {\n entry: {\n file,\n status,\n age_seconds: null,\n stale: false,\n reason: \"unparseable\",\n },\n remove: false,\n };\n }\n const ageMs = nowMs - updatedAtMs;\n if (!TERMINAL_JOURNAL_STATUSES.has(status)) {\n return {\n entry: {\n file,\n status,\n age_seconds: Math.floor(ageMs / 1000),\n stale: false,\n reason: \"active\",\n },\n remove: false,\n };\n }\n // A non-finite retentionMs makes this comparison false, disabling pruning\n // rather than risking deletion under bad input.\n if (!(ageMs > retentionMs)) {\n return {\n entry: {\n file,\n status,\n age_seconds: Math.floor(ageMs / 1000),\n stale: false,\n reason: \"fresh\",\n },\n remove: false,\n };\n }\n return {\n entry: {\n file,\n status,\n age_seconds: Math.floor(ageMs / 1000),\n stale: true,\n },\n remove: true,\n };\n}\n\nasync function processWorkspaceTransactionJournal(\n absolutePath: string,\n relativePath: string,\n fileName: string,\n options: {\n dryRun: boolean;\n hooks: WorkspaceTransactionGcHooks | undefined;\n nowMs: number;\n retentionMs: number;\n },\n): Promise<WorkspaceTransactionGcFileResult> {\n const warnings = options.hooks?.onRead\n ? await options.hooks.onRead(absolutePath)\n : [];\n const journal = readJournalStatusAndTimestamp(\n await fs.readFile(absolutePath, \"utf8\"),\n );\n const decision = classifyWorkspaceTransactionJournal(\n relativePath,\n journal.status,\n journal.updatedAt,\n options.nowMs,\n options.retentionMs,\n );\n if (decision.entry.reason === \"unparseable\") {\n warnings.push(`transaction_journal_unparseable:${fileName}`);\n }\n if (decision.remove && !options.dryRun) {\n await fs.rm(absolutePath, { force: true });\n if (options.hooks?.onWrite) {\n warnings.push(...(await options.hooks.onWrite(absolutePath)));\n }\n }\n return { decision, warnings };\n}\n\n/** Sweep `transactions/sdk/` and prune terminal workspace-transaction journals older than the retention window. One decision row is reported per journal so `pm gc` output stays auditable. */\nexport async function runWorkspaceTransactionGc(\n pmRoot: string,\n options: WorkspaceTransactionGcOptions,\n): Promise<WorkspaceTransactionGcResult> {\n const { dryRun, hooks } = options;\n const nowMs = options.now ?? Date.now();\n const retentionMs = Math.max(0, options.retentionDays) * MILLISECONDS_PER_DAY;\n const journalsDir = path.join(pmRoot, \"transactions\", \"sdk\");\n const result: WorkspaceTransactionGcResult = {\n scanned: 0,\n removed: [],\n retained: [],\n warnings: [],\n entries: [],\n };\n\n let files: string[];\n try {\n files = (await fs.readdir(journalsDir))\n .filter((file) => file.endsWith(\".json\"))\n .sort((left, right) => left.localeCompare(right));\n } catch (error: unknown) {\n if (isErrno(error, \"ENOENT\")) {\n return result;\n }\n throw error;\n }\n\n for (const file of files) {\n const absPath = path.join(journalsDir, file);\n const relPath = `transactions/sdk/${file}`;\n const fileResult = await processWorkspaceTransactionJournal(\n absPath,\n relPath,\n file,\n { dryRun, hooks, nowMs, retentionMs },\n );\n result.warnings.push(...fileResult.warnings);\n result.scanned += 1;\n const { decision } = fileResult;\n if (!decision.remove) {\n result.retained.push(relPath);\n result.entries.push(decision.entry);\n continue;\n }\n result.removed.push(relPath);\n result.entries.push(decision.entry);\n }\n return result;\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;;;AACH,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,oBAAoB,GAAG,EAAE,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AAC,CAAC;QAC7C,MAAM,CAAC,OAAO,IAAI,CAAC,CAAC;QACpB,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC;QAChC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YACrB,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC9B,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACpC,SAAS;QACX,CAAC;QACD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7B,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","debugId":"b27c5042-bbfb-5427-a76b-084acd5e06de"}
@@ -2,6 +2,18 @@
2
2
  export declare const PM_GITIGNORE_START = "# pm-cli:runtime-cache:start";
3
3
  /** Closing marker for the init-owned ignore block. */
4
4
  export declare const PM_GITIGNORE_END = "# pm-cli:runtime-cache:end";
5
+ /** Default workspace-relative tracker root used when no custom root is resolved. */
6
+ export declare const PM_GITIGNORE_DEFAULT_TRACKER_ROOT = ".agents/pm";
7
+ /**
8
+ * Tracker-relative directories that hold per-clone runtime state (caches,
9
+ * search indexes, locks, crash-recovery receipts). They must never be
10
+ * committed: they churn on every command and conflict on every concurrent
11
+ * branch merge. `transactions/` (SDK workspace-transaction journals) and
12
+ * `checkpoints/` (bulk-mutation rollback receipts) are per-branch recovery
13
+ * state with their own GC (`pm gc --scope transactions|checkpoints`), so
14
+ * keeping them untracked is the recorded merge-safety disposition.
15
+ */
16
+ export declare const PM_GITIGNORE_RUNTIME_DIRECTORIES: readonly ["runtime/", "search/", "locks/", "transactions/", "checkpoints/"];
5
17
  /** Result of reconciling the init-owned repository ignore block. */
6
18
  export interface EnsurePmGitignoreResult {
7
19
  /** Absolute path to the reconciled file. */
@@ -9,7 +21,19 @@ export interface EnsurePmGitignoreResult {
9
21
  /** Whether the file content changed. */
10
22
  changed: boolean;
11
23
  }
12
- /** Return the canonical pm ignore block, primarily for documentation and tests. */
13
- export declare function getPmGitignoreBlock(): string;
14
- /** Idempotently create or replace the fenced pm cache block in a workspace `.gitignore`. */
15
- export declare function ensurePmGitignore(workspaceRoot: string): Promise<EnsurePmGitignoreResult>;
24
+ /** Return whether a relative path escapes its owning root, without rejecting valid names such as `..pm`. */
25
+ export declare function isPathOutsideRoot(relativePath: string): boolean;
26
+ /** Return the canonical pm ignore block rendered for the given workspace-relative tracker root (defaults to `.agents/pm`), primarily for documentation and tests. */
27
+ export declare function getPmGitignoreBlock(trackerRelativeRoot?: string): string;
28
+ /**
29
+ * Idempotently create or replace the fenced pm cache block in a workspace
30
+ * `.gitignore`. When `pmRoot` is provided the ignored runtime directories are
31
+ * rendered under the resolved workspace-relative tracker root, so custom-root
32
+ * workspaces (`--pm-path`/`PM_PATH`) stop committing runtime caches (GH-598).
33
+ * A tracker root outside the workspace needs no ignore rules here, so the
34
+ * file is left untouched.
35
+ */
36
+ export declare function ensurePmGitignore(workspaceRoot: string, options?: {
37
+ /** Absolute tracker root; rendered relative to the workspace root. */
38
+ pmRoot?: string;
39
+ }): Promise<EnsurePmGitignoreResult>;
@@ -4,27 +4,73 @@
4
4
  * Maintains repository-scaffold contracts shared by the public SDK and CLI.
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]="5b3e660c-f869-5a00-8082-1f0d240c74bf")}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]="2ebcdfcf-c29b-50d6-940d-299d7699059a")}catch(e){}}();
8
8
  import { readFile, writeFile } from "node:fs/promises";
9
9
  import path from "node:path";
10
10
  /** Opening marker for the init-owned ignore block. */
11
11
  export const PM_GITIGNORE_START = "# pm-cli:runtime-cache:start";
12
12
  /** Closing marker for the init-owned ignore block. */
13
13
  export const PM_GITIGNORE_END = "# pm-cli:runtime-cache:end";
14
- const PM_GITIGNORE_BLOCK = [
15
- PM_GITIGNORE_START,
16
- ".agents/pm/runtime/",
17
- ".agents/pm/search/",
18
- ".agents/pm/locks/",
19
- PM_GITIGNORE_END,
20
- ].join("\n");
21
- /** Return the canonical pm ignore block, primarily for documentation and tests. */
22
- export function getPmGitignoreBlock() {
23
- return PM_GITIGNORE_BLOCK;
14
+ /** Default workspace-relative tracker root used when no custom root is resolved. */
15
+ export const PM_GITIGNORE_DEFAULT_TRACKER_ROOT = ".agents/pm";
16
+ /**
17
+ * Tracker-relative directories that hold per-clone runtime state (caches,
18
+ * search indexes, locks, crash-recovery receipts). They must never be
19
+ * committed: they churn on every command and conflict on every concurrent
20
+ * branch merge. `transactions/` (SDK workspace-transaction journals) and
21
+ * `checkpoints/` (bulk-mutation rollback receipts) are per-branch recovery
22
+ * state with their own GC (`pm gc --scope transactions|checkpoints`), so
23
+ * keeping them untracked is the recorded merge-safety disposition.
24
+ */
25
+ export const PM_GITIGNORE_RUNTIME_DIRECTORIES = [
26
+ "runtime/",
27
+ "search/",
28
+ "locks/",
29
+ "transactions/",
30
+ "checkpoints/",
31
+ ];
32
+ function normalizeTrackerRelativeRoot(trackerRelativeRoot) {
33
+ return trackerRelativeRoot
34
+ .replaceAll("\\", "/")
35
+ .replace(/^\.\/+/, "")
36
+ .replace(/\/+$/, "");
37
+ }
38
+ /** Return whether a relative path escapes its owning root, without rejecting valid names such as `..pm`. */
39
+ export function isPathOutsideRoot(relativePath) {
40
+ const normalized = relativePath.replaceAll("\\", "/");
41
+ return (path.isAbsolute(relativePath) ||
42
+ normalized === ".." ||
43
+ normalized.startsWith("../"));
24
44
  }
25
- /** Idempotently create or replace the fenced pm cache block in a workspace `.gitignore`. */
26
- export async function ensurePmGitignore(workspaceRoot) {
45
+ /** Return the canonical pm ignore block rendered for the given workspace-relative tracker root (defaults to `.agents/pm`), primarily for documentation and tests. */
46
+ export function getPmGitignoreBlock(trackerRelativeRoot = PM_GITIGNORE_DEFAULT_TRACKER_ROOT) {
47
+ const root = normalizeTrackerRelativeRoot(trackerRelativeRoot);
48
+ return [
49
+ PM_GITIGNORE_START,
50
+ ...PM_GITIGNORE_RUNTIME_DIRECTORIES.map((directory) => `${root}/${directory}`),
51
+ PM_GITIGNORE_END,
52
+ ].join("\n");
53
+ }
54
+ /**
55
+ * Idempotently create or replace the fenced pm cache block in a workspace
56
+ * `.gitignore`. When `pmRoot` is provided the ignored runtime directories are
57
+ * rendered under the resolved workspace-relative tracker root, so custom-root
58
+ * workspaces (`--pm-path`/`PM_PATH`) stop committing runtime caches (GH-598).
59
+ * A tracker root outside the workspace needs no ignore rules here, so the
60
+ * file is left untouched.
61
+ */
62
+ export async function ensurePmGitignore(workspaceRoot, options = {}) {
27
63
  const gitignorePath = path.join(workspaceRoot, ".gitignore");
64
+ let trackerRelativeRoot = PM_GITIGNORE_DEFAULT_TRACKER_ROOT;
65
+ if (options.pmRoot !== undefined) {
66
+ const relative = normalizeTrackerRelativeRoot(path.relative(path.resolve(workspaceRoot), path.resolve(options.pmRoot)));
67
+ if (isPathOutsideRoot(relative)) {
68
+ return { path: gitignorePath, changed: false };
69
+ }
70
+ if (relative.length > 0) {
71
+ trackerRelativeRoot = relative;
72
+ }
73
+ }
28
74
  let current = "";
29
75
  try {
30
76
  current = await readFile(gitignorePath, "utf8");
@@ -40,7 +86,7 @@ export async function ensurePmGitignore(workspaceRoot) {
40
86
  ? `${current.slice(0, start)}${current.slice(end + PM_GITIGNORE_END.length)}`
41
87
  : current;
42
88
  const prefix = withoutManagedBlock.trimEnd();
43
- const next = `${prefix.length > 0 ? `${prefix}\n\n` : ""}${PM_GITIGNORE_BLOCK}\n`;
89
+ const next = `${prefix.length > 0 ? `${prefix}\n\n` : ""}${getPmGitignoreBlock(trackerRelativeRoot)}\n`;
44
90
  if (next === current) {
45
91
  return { path: gitignorePath, changed: false };
46
92
  }
@@ -48,4 +94,4 @@ export async function ensurePmGitignore(workspaceRoot) {
48
94
  return { path: gitignorePath, changed: true };
49
95
  }
50
96
  //# sourceMappingURL=workspace.js.map
51
- //# debugId=5b3e660c-f869-5a00-8082-1f0d240c74bf
97
+ //# debugId=2ebcdfcf-c29b-50d6-940d-299d7699059a
@@ -1 +1 @@
1
- {"version":3,"file":"workspace.js","sources":["sdk/workspace.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module sdk/workspace\n *\n * Maintains repository-scaffold contracts shared by the public SDK and CLI.\n */\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\n\n/** Opening marker for the init-owned ignore block. */\nexport const PM_GITIGNORE_START = \"# pm-cli:runtime-cache:start\";\n/** Closing marker for the init-owned ignore block. */\nexport const PM_GITIGNORE_END = \"# pm-cli:runtime-cache:end\";\n\nconst PM_GITIGNORE_BLOCK = [\n PM_GITIGNORE_START,\n \".agents/pm/runtime/\",\n \".agents/pm/search/\",\n \".agents/pm/locks/\",\n PM_GITIGNORE_END,\n].join(\"\\n\");\n\n/** Result of reconciling the init-owned repository ignore block. */\nexport interface EnsurePmGitignoreResult {\n /** Absolute path to the reconciled file. */\n path: string;\n /** Whether the file content changed. */\n changed: boolean;\n}\n\n/** Return the canonical pm ignore block, primarily for documentation and tests. */\nexport function getPmGitignoreBlock(): string {\n return PM_GITIGNORE_BLOCK;\n}\n\n/** Idempotently create or replace the fenced pm cache block in a workspace `.gitignore`. */\nexport async function ensurePmGitignore(\n workspaceRoot: string,\n): Promise<EnsurePmGitignoreResult> {\n const gitignorePath = path.join(workspaceRoot, \".gitignore\");\n let current = \"\";\n try {\n current = await readFile(gitignorePath, \"utf8\");\n } catch (error: unknown) {\n if (!(error instanceof Error && \"code\" in error && error.code === \"ENOENT\")) {\n throw error;\n }\n }\n const start = current.indexOf(PM_GITIGNORE_START);\n const end = current.indexOf(PM_GITIGNORE_END);\n const withoutManagedBlock =\n start >= 0 && end >= start\n ? `${current.slice(0, start)}${current.slice(end + PM_GITIGNORE_END.length)}`\n : current;\n const prefix = withoutManagedBlock.trimEnd();\n const next = `${prefix.length > 0 ? `${prefix}\\n\\n` : \"\"}${PM_GITIGNORE_BLOCK}\\n`;\n if (next === current) {\n return { path: gitignorePath, changed: false };\n }\n await writeFile(gitignorePath, next, \"utf8\");\n return { path: gitignorePath, changed: true };\n}\n"],"names":[],"mappings":"AAAA;;;;GAIG;;;AACH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,sDAAsD;AACtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,8BAA8B,CAAC;AACjE,sDAAsD;AACtD,MAAM,CAAC,MAAM,gBAAgB,GAAG,4BAA4B,CAAC;AAE7D,MAAM,kBAAkB,GAAG;IACzB,kBAAkB;IAClB,qBAAqB;IACrB,oBAAoB;IACpB,mBAAmB;IACnB,gBAAgB;CACjB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAUb,mFAAmF;AACnF,MAAM,UAAU,mBAAmB;IACjC,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED,4FAA4F;AAC5F,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,aAAqB;IAErB,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;IAC7D,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,CAAC;QACH,OAAO,GAAG,MAAM,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,EAAE,CAAC;YAC5E,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IACD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAClD,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC9C,MAAM,mBAAmB,GACvB,KAAK,IAAI,CAAC,IAAI,GAAG,IAAI,KAAK;QACxB,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG,gBAAgB,CAAC,MAAM,CAAC,EAAE;QAC7E,CAAC,CAAC,OAAO,CAAC;IACd,MAAM,MAAM,GAAG,mBAAmB,CAAC,OAAO,EAAE,CAAC;IAC7C,MAAM,IAAI,GAAG,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,kBAAkB,IAAI,CAAC;IAClF,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IACjD,CAAC;IACD,MAAM,SAAS,CAAC,aAAa,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7C,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAChD,CAAC","debugId":"5b3e660c-f869-5a00-8082-1f0d240c74bf"}
1
+ {"version":3,"file":"workspace.js","sources":["sdk/workspace.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module sdk/workspace\n *\n * Maintains repository-scaffold contracts shared by the public SDK and CLI.\n */\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\n\n/** Opening marker for the init-owned ignore block. */\nexport const PM_GITIGNORE_START = \"# pm-cli:runtime-cache:start\";\n/** Closing marker for the init-owned ignore block. */\nexport const PM_GITIGNORE_END = \"# pm-cli:runtime-cache:end\";\n\n/** Default workspace-relative tracker root used when no custom root is resolved. */\nexport const PM_GITIGNORE_DEFAULT_TRACKER_ROOT = \".agents/pm\";\n\n/**\n * Tracker-relative directories that hold per-clone runtime state (caches,\n * search indexes, locks, crash-recovery receipts). They must never be\n * committed: they churn on every command and conflict on every concurrent\n * branch merge. `transactions/` (SDK workspace-transaction journals) and\n * `checkpoints/` (bulk-mutation rollback receipts) are per-branch recovery\n * state with their own GC (`pm gc --scope transactions|checkpoints`), so\n * keeping them untracked is the recorded merge-safety disposition.\n */\nexport const PM_GITIGNORE_RUNTIME_DIRECTORIES = [\n \"runtime/\",\n \"search/\",\n \"locks/\",\n \"transactions/\",\n \"checkpoints/\",\n] as const;\n\n/** Result of reconciling the init-owned repository ignore block. */\nexport interface EnsurePmGitignoreResult {\n /** Absolute path to the reconciled file. */\n path: string;\n /** Whether the file content changed. */\n changed: boolean;\n}\n\nfunction normalizeTrackerRelativeRoot(trackerRelativeRoot: string): string {\n return trackerRelativeRoot\n .replaceAll(\"\\\\\", \"/\")\n .replace(/^\\.\\/+/, \"\")\n .replace(/\\/+$/, \"\");\n}\n\n/** Return whether a relative path escapes its owning root, without rejecting valid names such as `..pm`. */\nexport function isPathOutsideRoot(relativePath: string): boolean {\n const normalized = relativePath.replaceAll(\"\\\\\", \"/\");\n return (\n path.isAbsolute(relativePath) ||\n normalized === \"..\" ||\n normalized.startsWith(\"../\")\n );\n}\n\n/** Return the canonical pm ignore block rendered for the given workspace-relative tracker root (defaults to `.agents/pm`), primarily for documentation and tests. */\nexport function getPmGitignoreBlock(\n trackerRelativeRoot: string = PM_GITIGNORE_DEFAULT_TRACKER_ROOT,\n): string {\n const root = normalizeTrackerRelativeRoot(trackerRelativeRoot);\n return [\n PM_GITIGNORE_START,\n ...PM_GITIGNORE_RUNTIME_DIRECTORIES.map(\n (directory) => `${root}/${directory}`,\n ),\n PM_GITIGNORE_END,\n ].join(\"\\n\");\n}\n\n/**\n * Idempotently create or replace the fenced pm cache block in a workspace\n * `.gitignore`. When `pmRoot` is provided the ignored runtime directories are\n * rendered under the resolved workspace-relative tracker root, so custom-root\n * workspaces (`--pm-path`/`PM_PATH`) stop committing runtime caches (GH-598).\n * A tracker root outside the workspace needs no ignore rules here, so the\n * file is left untouched.\n */\nexport async function ensurePmGitignore(\n workspaceRoot: string,\n options: {\n /** Absolute tracker root; rendered relative to the workspace root. */\n pmRoot?: string;\n } = {},\n): Promise<EnsurePmGitignoreResult> {\n const gitignorePath = path.join(workspaceRoot, \".gitignore\");\n let trackerRelativeRoot = PM_GITIGNORE_DEFAULT_TRACKER_ROOT;\n if (options.pmRoot !== undefined) {\n const relative = normalizeTrackerRelativeRoot(\n path.relative(path.resolve(workspaceRoot), path.resolve(options.pmRoot)),\n );\n if (isPathOutsideRoot(relative)) {\n return { path: gitignorePath, changed: false };\n }\n if (relative.length > 0) {\n trackerRelativeRoot = relative;\n }\n }\n let current = \"\";\n try {\n current = await readFile(gitignorePath, \"utf8\");\n } catch (error: unknown) {\n if (\n !(error instanceof Error && \"code\" in error && error.code === \"ENOENT\")\n ) {\n throw error;\n }\n }\n const start = current.indexOf(PM_GITIGNORE_START);\n const end = current.indexOf(PM_GITIGNORE_END);\n const withoutManagedBlock =\n start >= 0 && end >= start\n ? `${current.slice(0, start)}${current.slice(end + PM_GITIGNORE_END.length)}`\n : current;\n const prefix = withoutManagedBlock.trimEnd();\n const next = `${prefix.length > 0 ? `${prefix}\\n\\n` : \"\"}${getPmGitignoreBlock(trackerRelativeRoot)}\\n`;\n if (next === current) {\n return { path: gitignorePath, changed: false };\n }\n await writeFile(gitignorePath, next, \"utf8\");\n return { path: gitignorePath, changed: true };\n}\n"],"names":[],"mappings":"AAAA;;;;GAIG;;;AACH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBA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AAG,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG,gBAAgB,CAAC,MAAM,CAAC,EAAE;QAC7E,CAAC,CAAC,OAAO,CAAC;IACd,MAAM,MAAM,GAAG,mBAAmB,CAAC,OAAO,EAAE,CAAC;IAC7C,MAAM,IAAI,GAAG,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,mBAAmB,CAAC,mBAAmB,CAAC,IAAI,CAAC;IACxG,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IACjD,CAAC;IACD,MAAM,SAAS,CAAC,aAAa,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7C,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAChD,CAAC","debugId":"2ebcdfcf-c29b-50d6-940d-299d7699059a"}
package/dist/types.d.ts CHANGED
@@ -447,17 +447,17 @@ export interface RuntimeFieldDefinition {
447
447
  }
448
448
  /** Documents the runtime workflow definition payload exchanged by command, SDK, and package integrations. */
449
449
  export interface RuntimeWorkflowDefinition {
450
- /** Lifecycle state reported for draftthe record. */
450
+ /** Configured status id representing the draft lifecycle state. */
451
451
  draft_status?: string;
452
- /** Lifecycle state reported for openthe record. */
452
+ /** Configured status id representing the open lifecycle state. */
453
453
  open_status?: string;
454
- /** Lifecycle state reported for in progressthe record. */
454
+ /** Configured status id representing the in-progress lifecycle state. */
455
455
  in_progress_status?: string;
456
- /** Lifecycle state reported for blockedthe record. */
456
+ /** Configured status id representing the blocked lifecycle state. */
457
457
  blocked_status?: string;
458
- /** Lifecycle state reported for closethe record. */
458
+ /** Configured status id representing the closed lifecycle state. */
459
459
  close_status?: string;
460
- /** Lifecycle state reported for canceledthe record. */
460
+ /** Configured status id representing the canceled lifecycle state. */
461
461
  canceled_status?: string;
462
462
  }
463
463
  /** Documents the runtime schema file config payload exchanged by command, SDK, and package integrations. */
@@ -903,6 +903,10 @@ export interface PmSettings {
903
903
  version: number;
904
904
  /** Value that configures or reports id prefix for this contract. */
905
905
  id_prefix: string;
906
+ /** Item id allocation policy: `token_length` is the number of random base36 characters appended to `id_prefix` when minting ids (4–12). Longer tokens shrink cross-branch collision odds for concurrent multi-agent workflows: 4 chars ≈ 1.68M ids (~1% birthday-collision at ~184 items), 6 chars ≈ 2.18B (~1% at ~6.6k items), 8 chars ≈ 2.8T (~1% at ~238k items). */
907
+ ids: {
908
+ token_length: number;
909
+ };
906
910
  /** Value that configures or reports author default for this contract. */
907
911
  author_default: string;
908
912
  /** Value that configures or reports item format for this contract. */
@@ -913,7 +917,7 @@ export interface PmSettings {
913
917
  /** Bounded wait budget (milliseconds) for acquiring a contended item lock before surfacing lock_conflict. 0 disables waiting (fail-fast). Overridable per invocation via PM_LOCK_WAIT_MS. */
914
918
  wait_ms: number;
915
919
  };
916
- /** Retention policy for bulk-mutation rollback checkpoints written by `update-many`/`close-many`. `pm gc --scope checkpoints` prunes checkpoint files older than `retention_days`; checkpoints with an unparseable `created_at` are retained (safety-first, mirroring the stale-lock sweep). */
920
+ /** Retention policy for local crash-recovery receipts: bulk-mutation rollback checkpoints written by `update-many`/`close-many` AND terminal SDK workspace-transaction journals under `transactions/sdk/`. `pm gc --scope checkpoints` prunes checkpoint files older than `retention_days`; `pm gc --scope transactions` prunes committed/compensated journals older than the same window. Unparseable receipts and in-flight journals are always retained (safety-first, mirroring the stale-lock sweep). */
917
921
  checkpoints: {
918
922
  retention_days: number;
919
923
  };
package/dist/types.js CHANGED
@@ -5,7 +5,7 @@
5
5
  */
6
6
  /** Supported values accepted by the builtin item type contract. */
7
7
 
8
- !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]="24e69ccc-1d29-57b3-95a8-73e2501548f0")}catch(e){}}();
8
+ !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]="0ac15454-83a5-5908-b602-2f84dcec66c0")}catch(e){}}();
9
9
  export const BUILTIN_ITEM_TYPE_VALUES = [
10
10
  "Epic",
11
11
  "Feature",
@@ -231,4 +231,4 @@ export const CONTEXT_SECTION_VALUES = [
231
231
  "tests",
232
232
  ];
233
233
  //# sourceMappingURL=types.js.map
234
- //# debugId=24e69ccc-1d29-57b3-95a8-73e2501548f0
234
+ //# debugId=0ac15454-83a5-5908-b602-2f84dcec66c0