@unbrained/pm-cli 2026.6.19 → 2026.6.21

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 (545) hide show
  1. package/CHANGELOG.md +328 -258
  2. package/README.md +1 -1
  3. package/dist/cli/bootstrap-args.d.ts +12 -1
  4. package/dist/cli/bootstrap-args.js +20 -9
  5. package/dist/cli/bootstrap-args.js.map +1 -1
  6. package/dist/cli/commander-usage.js +31 -25
  7. package/dist/cli/commander-usage.js.map +1 -1
  8. package/dist/cli/commands/completion.js +3 -3
  9. package/dist/cli/commands/completion.js.map +1 -1
  10. package/dist/cli/commands/contracts.js +4 -3
  11. package/dist/cli/commands/contracts.js.map +1 -1
  12. package/dist/cli/commands/eval.d.ts +62 -0
  13. package/dist/cli/commands/eval.js +158 -0
  14. package/dist/cli/commands/eval.js.map +1 -0
  15. package/dist/cli/commands/extension/install-sources.d.ts +12 -0
  16. package/dist/cli/commands/extension/install-sources.js +77 -10
  17. package/dist/cli/commands/extension/install-sources.js.map +1 -1
  18. package/dist/cli/commands/extension/scaffold.js +49 -3
  19. package/dist/cli/commands/extension/scaffold.js.map +1 -1
  20. package/dist/cli/commands/extension.js +9 -2
  21. package/dist/cli/commands/extension.js.map +1 -1
  22. package/dist/cli/commands/gc.d.ts +12 -1
  23. package/dist/cli/commands/gc.js +53 -6
  24. package/dist/cli/commands/gc.js.map +1 -1
  25. package/dist/cli/commands/health.js +27 -9
  26. package/dist/cli/commands/health.js.map +1 -1
  27. package/dist/cli/commands/index.d.ts +1 -0
  28. package/dist/cli/commands/index.js +3 -2
  29. package/dist/cli/commands/index.js.map +1 -1
  30. package/dist/cli/commands/linked-artifacts.js +13 -3
  31. package/dist/cli/commands/linked-artifacts.js.map +1 -1
  32. package/dist/cli/commands/list.js +12 -9
  33. package/dist/cli/commands/list.js.map +1 -1
  34. package/dist/cli/commands/plan.js +2 -2
  35. package/dist/cli/commands/plan.js.map +1 -1
  36. package/dist/cli/commands/restore.js +5 -11
  37. package/dist/cli/commands/restore.js.map +1 -1
  38. package/dist/cli/commands/search.d.ts +39 -1
  39. package/dist/cli/commands/search.js +89 -12
  40. package/dist/cli/commands/search.js.map +1 -1
  41. package/dist/cli/commands/update.js +96 -58
  42. package/dist/cli/commands/update.js.map +1 -1
  43. package/dist/cli/commands/validate.d.ts +1 -1
  44. package/dist/cli/commands/validate.js +44 -2
  45. package/dist/cli/commands/validate.js.map +1 -1
  46. package/dist/cli/extension-command-help.d.ts +9 -0
  47. package/dist/cli/extension-command-help.js +13 -2
  48. package/dist/cli/extension-command-help.js.map +1 -1
  49. package/dist/cli/extension-command-options.d.ts +8 -0
  50. package/dist/cli/extension-command-options.js +27 -2
  51. package/dist/cli/extension-command-options.js.map +1 -1
  52. package/dist/cli/help-content.js +15 -2
  53. package/dist/cli/help-content.js.map +1 -1
  54. package/dist/cli/main.d.ts +12 -0
  55. package/dist/cli/main.js +49 -9
  56. package/dist/cli/main.js.map +1 -1
  57. package/dist/cli/register-list-query.js +34 -4
  58. package/dist/cli/register-list-query.js.map +1 -1
  59. package/dist/cli/register-operations.js +3 -3
  60. package/dist/cli/register-operations.js.map +1 -1
  61. package/dist/cli-bundle/chunks/activity-CIHV64UC.js +18 -0
  62. package/dist/cli-bundle/chunks/{activity-XJ7WRNWS.js → activity-KW3IRP44.js} +11 -11
  63. package/dist/cli-bundle/chunks/{aggregate-LBCWF6UJ.js → aggregate-3ZKQG5SW.js} +10 -10
  64. package/dist/cli-bundle/chunks/{aggregate-OFT4YVB6.js → aggregate-FIGQEIL3.js} +10 -10
  65. package/dist/cli-bundle/chunks/{append-BP2ARHOK.js → append-EWJYJ7CH.js} +8 -8
  66. package/dist/cli-bundle/chunks/{append-5U3XR5SD.js → append-QEOLX3XB.js} +8 -8
  67. package/dist/cli-bundle/chunks/{chunk-CSRFOIHG.js → chunk-2EIMPCE4.js} +3 -3
  68. package/dist/cli-bundle/chunks/{chunk-MAKOMXVM.js → chunk-2GCDRRIF.js} +106 -67
  69. package/dist/cli-bundle/chunks/chunk-2GCDRRIF.js.map +1 -0
  70. package/dist/cli-bundle/chunks/{search-AZR2JITW.js → chunk-2PKHRP6G.js} +190 -22
  71. package/dist/cli-bundle/chunks/chunk-2PKHRP6G.js.map +7 -0
  72. package/dist/cli-bundle/chunks/{chunk-YWAYOWDQ.js → chunk-32R4PIC6.js} +118 -15
  73. package/dist/cli-bundle/chunks/chunk-32R4PIC6.js.map +1 -0
  74. package/dist/cli-bundle/chunks/{chunk-II3WDRCM.js → chunk-37QXHBIB.js} +3 -3
  75. package/dist/cli-bundle/chunks/{chunk-UCNEPMPY.js → chunk-3EWSGA7N.js} +105 -66
  76. package/dist/cli-bundle/chunks/chunk-3EWSGA7N.js.map +7 -0
  77. package/dist/cli-bundle/chunks/{chunk-UMTPQMEG.js → chunk-3MDHREEV.js} +3 -3
  78. package/dist/cli-bundle/chunks/{chunk-I2VJM36R.js → chunk-434HM6Z5.js} +21 -21
  79. package/dist/cli-bundle/chunks/chunk-434HM6Z5.js.map +1 -0
  80. package/dist/cli-bundle/chunks/{chunk-Y4IBSEQ2.js → chunk-52OCIDPG.js} +20 -8
  81. package/dist/cli-bundle/chunks/chunk-52OCIDPG.js.map +1 -0
  82. package/dist/cli-bundle/chunks/{chunk-DJ3YYLHG.js → chunk-5FIEHKEX.js} +5 -5
  83. package/dist/cli-bundle/chunks/{chunk-OURX4WVG.js → chunk-5IDI42VV.js} +7 -7
  84. package/dist/cli-bundle/chunks/{chunk-UA4ANRJY.js → chunk-5PCI3UBT.js} +119 -16
  85. package/dist/cli-bundle/chunks/chunk-5PCI3UBT.js.map +7 -0
  86. package/dist/cli-bundle/chunks/{chunk-RVG3WLY3.js → chunk-5QICDWMV.js} +2 -2
  87. package/dist/cli-bundle/chunks/{chunk-LIVRA6VG.js → chunk-6CJWZAN7.js} +7 -7
  88. package/dist/cli-bundle/chunks/{chunk-AVMSP2HH.js → chunk-6H4LF7AO.js} +2 -2
  89. package/dist/cli-bundle/chunks/{chunk-B2NEFANY.js → chunk-6M4RJS4M.js} +3 -3
  90. package/dist/cli-bundle/chunks/{chunk-4BFNWAMQ.js → chunk-6ZXM2XNF.js} +29 -12
  91. package/dist/cli-bundle/chunks/chunk-6ZXM2XNF.js.map +7 -0
  92. package/dist/cli-bundle/chunks/{chunk-A5JPMD4Q.js → chunk-76Z3YSHV.js} +2 -2
  93. package/dist/cli-bundle/chunks/{chunk-5NS6TJ2F.js → chunk-7D3SAQXM.js} +2 -2
  94. package/dist/cli-bundle/chunks/{chunk-DVUU3AHP.js → chunk-A4Z7ZOL5.js} +17 -6
  95. package/dist/cli-bundle/chunks/chunk-A4Z7ZOL5.js.map +1 -0
  96. package/dist/cli-bundle/chunks/{chunk-2E3KSWFG.js → chunk-AIS5PGI3.js} +2 -2
  97. package/dist/cli-bundle/chunks/{chunk-47BYN6CA.js → chunk-AZMOLBN3.js} +7 -7
  98. package/dist/cli-bundle/chunks/{chunk-DYZKSIVX.js → chunk-B473GZWW.js} +3 -3
  99. package/dist/cli-bundle/chunks/{chunk-RNWE2HZR.js → chunk-C3AZ5ZML.js} +15 -15
  100. package/dist/cli-bundle/chunks/{chunk-S673PVHD.js → chunk-C4N5I7ZW.js} +3 -3
  101. package/dist/cli-bundle/chunks/{chunk-TYQBGXH2.js → chunk-CF55WVVS.js} +2 -2
  102. package/dist/cli-bundle/chunks/{chunk-4EOS35RL.js → chunk-CZPXY7UW.js} +3 -3
  103. package/dist/cli-bundle/chunks/{chunk-MPEWACTG.js → chunk-CZUB4XWO.js} +2 -2
  104. package/dist/cli-bundle/chunks/{chunk-22YA6GCA.js → chunk-D7FYS6PG.js} +2 -2
  105. package/dist/cli-bundle/chunks/{chunk-5SRID7DV.js → chunk-EBH56IXK.js} +29 -12
  106. package/dist/cli-bundle/chunks/chunk-EBH56IXK.js.map +1 -0
  107. package/dist/cli-bundle/chunks/{chunk-UIMLAFOE.js → chunk-F5NZWFSW.js} +7 -7
  108. package/dist/cli-bundle/chunks/{chunk-PSWSQHM7.js → chunk-F7K5GWP3.js} +15 -19
  109. package/dist/cli-bundle/chunks/chunk-F7K5GWP3.js.map +1 -0
  110. package/dist/cli-bundle/chunks/{chunk-H3DP6OUM.js → chunk-FKBDKV7Y.js} +3 -3
  111. package/dist/cli-bundle/chunks/{chunk-SO2IOH37.js → chunk-FRUFKWNK.js} +2 -2
  112. package/dist/cli-bundle/chunks/{chunk-7R5YKVKO.js → chunk-FWPDUYEY.js} +7 -7
  113. package/dist/cli-bundle/chunks/{search-2JX776KX.js → chunk-GMHPNNYG.js} +184 -23
  114. package/dist/cli-bundle/chunks/chunk-GMHPNNYG.js.map +1 -0
  115. package/dist/cli-bundle/chunks/{chunk-USVOBLGB.js → chunk-GOZUHWFD.js} +2 -2
  116. package/dist/cli-bundle/chunks/{chunk-ZBVYKWT2.js → chunk-H7NJZWG2.js} +15 -15
  117. package/dist/cli-bundle/chunks/{chunk-FPQA4ZMA.js → chunk-HC4AWIKT.js} +18 -7
  118. package/dist/cli-bundle/chunks/chunk-HC4AWIKT.js.map +7 -0
  119. package/dist/cli-bundle/chunks/{chunk-4L7Q4OVT.js → chunk-HCU6WUSY.js} +9 -9
  120. package/dist/cli-bundle/chunks/{chunk-2RI3BDFK.js → chunk-HIP7WVTL.js} +10 -9
  121. package/dist/cli-bundle/chunks/chunk-HIP7WVTL.js.map +7 -0
  122. package/dist/cli-bundle/chunks/{chunk-5QLHQK7V.js → chunk-HMOADQVT.js} +26 -26
  123. package/dist/cli-bundle/chunks/chunk-HMOADQVT.js.map +7 -0
  124. package/dist/cli-bundle/chunks/{chunk-K5TD74VU.js → chunk-J4MYYSOL.js} +19 -7
  125. package/dist/cli-bundle/chunks/chunk-J4MYYSOL.js.map +7 -0
  126. package/dist/cli-bundle/chunks/{chunk-GDOTTY2S.js → chunk-JINYH2DB.js} +40 -2
  127. package/dist/cli-bundle/chunks/chunk-JINYH2DB.js.map +7 -0
  128. package/dist/cli-bundle/chunks/{chunk-EMFDZ7N3.js → chunk-LEU5GHRC.js} +55 -5
  129. package/dist/cli-bundle/chunks/chunk-LEU5GHRC.js.map +1 -0
  130. package/dist/cli-bundle/chunks/{chunk-PRUB7RI4.js → chunk-LUWW7L4B.js} +3 -3
  131. package/dist/cli-bundle/chunks/{chunk-N7LDJRB4.js → chunk-M5XALUSL.js} +2 -2
  132. package/dist/cli-bundle/chunks/{chunk-NPNNW5TU.js → chunk-N5ZJACJ6.js} +8 -8
  133. package/dist/cli-bundle/chunks/{chunk-NNMBNN6Q.js → chunk-NB3PYLQ6.js} +7 -5
  134. package/dist/cli-bundle/chunks/{chunk-USKTNI7P.js → chunk-NIGXMNNI.js} +2 -2
  135. package/dist/cli-bundle/chunks/{chunk-GL3QKIET.js → chunk-NIUEXCFS.js} +6 -6
  136. package/dist/cli-bundle/chunks/{chunk-OUG4CL4H.js → chunk-NJHMAJ6N.js} +8 -8
  137. package/dist/cli-bundle/chunks/{chunk-2K56AWDP.js → chunk-NJN7LL7U.js} +5 -5
  138. package/dist/cli-bundle/chunks/{chunk-5P2LQV2F.js → chunk-NSBZ2CKF.js} +2 -2
  139. package/dist/cli-bundle/chunks/{chunk-ZZEM2PH7.js → chunk-NXS7ZKAK.js} +19 -14
  140. package/dist/cli-bundle/chunks/chunk-NXS7ZKAK.js.map +1 -0
  141. package/dist/cli-bundle/chunks/{chunk-XV6N3QND.js → chunk-O47BPOPC.js} +2 -2
  142. package/dist/cli-bundle/chunks/{chunk-X26ODPU4.js → chunk-OFYMIDF2.js} +14 -18
  143. package/dist/cli-bundle/chunks/chunk-OFYMIDF2.js.map +7 -0
  144. package/dist/cli-bundle/chunks/{chunk-QCHNPN24.js → chunk-OTHIWLMB.js} +7 -5
  145. package/dist/cli-bundle/chunks/{chunk-YVYJQR6S.js → chunk-PFSRUHDH.js} +9 -9
  146. package/dist/cli-bundle/chunks/{chunk-M35R7LFX.js → chunk-PP2U4NMT.js} +5 -5
  147. package/dist/cli-bundle/chunks/{chunk-ZGEWEO7B.js → chunk-PUH4D67U.js} +2 -2
  148. package/dist/cli-bundle/chunks/{chunk-LEC57E7K.js → chunk-Q2J2HJUN.js} +2 -2
  149. package/dist/cli-bundle/chunks/{chunk-QSH34DSQ.js → chunk-QGG32QHW.js} +61 -4
  150. package/dist/cli-bundle/chunks/chunk-QGG32QHW.js.map +7 -0
  151. package/dist/cli-bundle/chunks/{chunk-QG6M6XQE.js → chunk-QQHISQBJ.js} +3 -3
  152. package/dist/cli-bundle/chunks/{chunk-BQVESTOG.js → chunk-QZTWBFXJ.js} +2 -2
  153. package/dist/cli-bundle/chunks/{chunk-COHNQLB2.js → chunk-R2EMWY7Q.js} +41 -3
  154. package/dist/cli-bundle/chunks/chunk-R2EMWY7Q.js.map +1 -0
  155. package/dist/cli-bundle/chunks/{chunk-5LZPDRFW.js → chunk-RLK7P77C.js} +5 -5
  156. package/dist/cli-bundle/chunks/{chunk-QTWWHFI3.js → chunk-RVHYI7SL.js} +8 -8
  157. package/dist/cli-bundle/chunks/{chunk-FVZSUIN5.js → chunk-SBGXDO7A.js} +3 -3
  158. package/dist/cli-bundle/chunks/{chunk-VP4Z36GO.js → chunk-SRYYRVPB.js} +2 -2
  159. package/dist/cli-bundle/chunks/{chunk-X7RKOJXL.js → chunk-SX75ADBK.js} +6 -6
  160. package/dist/cli-bundle/chunks/{chunk-MTDEEUGV.js → chunk-TKBHZPKD.js} +3 -3
  161. package/dist/cli-bundle/chunks/{chunk-HMQMRHQJ.js → chunk-UEMNL33O.js} +8 -8
  162. package/dist/cli-bundle/chunks/{chunk-SDUZTZ55.js → chunk-UPE3CDD7.js} +7 -7
  163. package/dist/cli-bundle/chunks/{chunk-VG3B2CYD.js → chunk-UV6IYE5U.js} +2 -2
  164. package/dist/cli-bundle/chunks/{chunk-YOGXK3ON.js → chunk-WQ7NIVDK.js} +18 -13
  165. package/dist/cli-bundle/chunks/chunk-WQ7NIVDK.js.map +7 -0
  166. package/dist/cli-bundle/chunks/{chunk-MTGMNUMJ.js → chunk-YCJX76PW.js} +2 -2
  167. package/dist/cli-bundle/chunks/{chunk-FP7YLQ52.js → chunk-Z6T4PQI2.js} +11 -10
  168. package/dist/cli-bundle/chunks/chunk-Z6T4PQI2.js.map +1 -0
  169. package/dist/cli-bundle/chunks/{claim-2BSYPJTJ.js → claim-RC56YUWG.js} +10 -10
  170. package/dist/cli-bundle/chunks/{claim-EZ6JKY5X.js → claim-THOJ6CMV.js} +10 -10
  171. package/dist/cli-bundle/chunks/close-DNMHGOCX.js +15 -0
  172. package/dist/cli-bundle/chunks/{close-3TSX6BYF.js → close-SG5MNCVQ.js} +8 -8
  173. package/dist/cli-bundle/chunks/{close-many-HB4UFCS3.js → close-many-3L3AQZBU.js} +15 -15
  174. package/dist/cli-bundle/chunks/{close-many-B7DBVA46.js → close-many-DKQLBGLV.js} +15 -15
  175. package/dist/cli-bundle/chunks/{comments-M7PAINZT.js → comments-M7ZOZNBX.js} +10 -10
  176. package/dist/cli-bundle/chunks/{comments-X7M7XM6I.js → comments-SKWMDWCW.js} +10 -10
  177. package/dist/cli-bundle/chunks/{config-YICACPHA.js → config-7CK62S7T.js} +30 -10
  178. package/dist/cli-bundle/chunks/config-7CK62S7T.js.map +1 -0
  179. package/dist/cli-bundle/chunks/{config-UWF3KRP5.js → config-OZCUABPB.js} +29 -9
  180. package/dist/cli-bundle/chunks/config-OZCUABPB.js.map +7 -0
  181. package/dist/cli-bundle/chunks/{context-EGUGU4K7.js → context-OEC366TO.js} +13 -13
  182. package/dist/cli-bundle/chunks/{context-V32ZAPL6.js → context-PUG2A7RC.js} +13 -13
  183. package/dist/cli-bundle/chunks/{contracts-B2YWYUV5.js → contracts-3THOLA7L.js} +10 -8
  184. package/dist/cli-bundle/chunks/contracts-3THOLA7L.js.map +7 -0
  185. package/dist/cli-bundle/chunks/{contracts-7G553BHP.js → contracts-N65FXEOL.js} +10 -8
  186. package/dist/cli-bundle/chunks/contracts-N65FXEOL.js.map +1 -0
  187. package/dist/cli-bundle/chunks/{copy-NWFFRYWM.js → copy-6QLHILAC.js} +7 -7
  188. package/dist/cli-bundle/chunks/{copy-RMLXLZOL.js → copy-JPX7VZCH.js} +7 -7
  189. package/dist/cli-bundle/chunks/create-NNP6TSFO.js +30 -0
  190. package/dist/cli-bundle/chunks/{create-GK4MX2LJ.js → create-Y54ZVVZH.js} +14 -14
  191. package/dist/cli-bundle/chunks/{delete-RMGNIL2S.js → delete-63PCMQAJ.js} +7 -7
  192. package/dist/cli-bundle/chunks/{delete-EFQLVEAS.js → delete-GDSMGAGJ.js} +7 -7
  193. package/dist/cli-bundle/chunks/{deps-WKHUPVD3.js → deps-T4ZF5G54.js} +7 -7
  194. package/dist/cli-bundle/chunks/{deps-K2I7QV4Y.js → deps-XYQ73XRH.js} +7 -7
  195. package/dist/cli-bundle/chunks/{docs-3FXRDYA7.js → docs-C75YIXHC.js} +10 -9
  196. package/dist/cli-bundle/chunks/{docs-3FXRDYA7.js.map → docs-C75YIXHC.js.map} +1 -1
  197. package/dist/cli-bundle/chunks/{docs-2H2UGIT6.js → docs-EHNPDWUL.js} +12 -11
  198. package/dist/cli-bundle/chunks/{docs-2H2UGIT6.js.map → docs-EHNPDWUL.js.map} +1 -1
  199. package/dist/cli-bundle/chunks/eval-3WKDTRMH.js +276 -0
  200. package/dist/cli-bundle/chunks/eval-3WKDTRMH.js.map +1 -0
  201. package/dist/cli-bundle/chunks/eval-GTENKE24.js +286 -0
  202. package/dist/cli-bundle/chunks/eval-GTENKE24.js.map +7 -0
  203. package/dist/cli-bundle/chunks/{extension-4LPTFTV4.js → extension-46NWACO3.js} +5 -5
  204. package/dist/cli-bundle/chunks/{extension-ASUPTDCC.js → extension-D5FDZ2CO.js} +5 -5
  205. package/dist/cli-bundle/chunks/{files-TXEQOA7C.js → files-DSZBOSSN.js} +12 -11
  206. package/dist/cli-bundle/chunks/{files-TXEQOA7C.js.map → files-DSZBOSSN.js.map} +1 -1
  207. package/dist/cli-bundle/chunks/{files-UAZFB3EA.js → files-X3H7CCBQ.js} +10 -9
  208. package/dist/cli-bundle/chunks/{files-UAZFB3EA.js.map → files-X3H7CCBQ.js.map} +1 -1
  209. package/dist/cli-bundle/chunks/{focus-UGROAMAX.js → focus-5STQXDPU.js} +8 -8
  210. package/dist/cli-bundle/chunks/{focus-ELOPN2SR.js → focus-MDVPOWB5.js} +8 -8
  211. package/dist/cli-bundle/chunks/gc-ZC7JHBG7.js +395 -0
  212. package/dist/cli-bundle/chunks/gc-ZC7JHBG7.js.map +7 -0
  213. package/dist/cli-bundle/chunks/gc-ZMST3WQP.js +385 -0
  214. package/dist/cli-bundle/chunks/gc-ZMST3WQP.js.map +1 -0
  215. package/dist/cli-bundle/chunks/{get-OTXPLWYW.js → get-J2IPJRZW.js} +11 -11
  216. package/dist/cli-bundle/chunks/{get-IWZ7IMPS.js → get-NT7L2HUZ.js} +11 -11
  217. package/dist/cli-bundle/chunks/{health-PPTJ7XKW.js → health-IVMA3XQC.js} +38 -26
  218. package/dist/cli-bundle/chunks/health-IVMA3XQC.js.map +1 -0
  219. package/dist/cli-bundle/chunks/{health-JEBESKID.js → health-WOYBR3KU.js} +37 -25
  220. package/dist/cli-bundle/chunks/health-WOYBR3KU.js.map +7 -0
  221. package/dist/cli-bundle/chunks/{history-HNWBUDMI.js → history-RLH2QCRO.js} +10 -10
  222. package/dist/cli-bundle/chunks/history-WX3MGFS2.js +20 -0
  223. package/dist/cli-bundle/chunks/{history-compact-MMQC7MCW.js → history-compact-UXDIFC33.js} +12 -12
  224. package/dist/cli-bundle/chunks/{history-compact-EQXVPK3V.js → history-compact-ZBEBGJM7.js} +12 -12
  225. package/dist/cli-bundle/chunks/{history-redact-UBDHBEJE.js → history-redact-P7I7AWMB.js} +11 -11
  226. package/dist/cli-bundle/chunks/history-redact-YQGU3XRA.js +21 -0
  227. package/dist/cli-bundle/chunks/{history-repair-GMMHFAGH.js → history-repair-52KINVIK.js} +12 -12
  228. package/dist/cli-bundle/chunks/{history-repair-7DSDRPMX.js → history-repair-RM5ITLU5.js} +12 -12
  229. package/dist/cli-bundle/chunks/{init-QGK4JFF6.js → init-2BNZOO6F.js} +10 -10
  230. package/dist/cli-bundle/chunks/init-SC2P6CHP.js +20 -0
  231. package/dist/cli-bundle/chunks/{learnings-DR53TWRA.js → learnings-W6F3FIPL.js} +10 -10
  232. package/dist/cli-bundle/chunks/{learnings-A6DGBMG3.js → learnings-YGYVHWJK.js} +10 -10
  233. package/dist/cli-bundle/chunks/{list-LJ5DBXC3.js → list-K6FPV4J4.js} +10 -10
  234. package/dist/cli-bundle/chunks/{list-KOJN23UL.js → list-KPAYU5KZ.js} +10 -10
  235. package/dist/cli-bundle/chunks/{notes-7VLTHKPW.js → notes-PU74EPKV.js} +10 -10
  236. package/dist/cli-bundle/chunks/{notes-K5I3TAYR.js → notes-YTD6ZILW.js} +10 -10
  237. package/dist/cli-bundle/chunks/{plan-X3STKLED.js → plan-FNXHXRCI.js} +15 -15
  238. package/dist/cli-bundle/chunks/plan-FNXHXRCI.js.map +7 -0
  239. package/dist/cli-bundle/chunks/{plan-BK3OMLGP.js → plan-GEQYUCBW.js} +16 -16
  240. package/dist/cli-bundle/chunks/plan-GEQYUCBW.js.map +1 -0
  241. package/dist/cli-bundle/chunks/{register-list-query-XDLFESU7.js → register-list-query-PHWYHENI.js} +43 -22
  242. package/dist/cli-bundle/chunks/register-list-query-PHWYHENI.js.map +1 -0
  243. package/dist/cli-bundle/chunks/{register-list-query-FUMXPWZ4.js → register-list-query-QI45RMKN.js} +42 -21
  244. package/dist/cli-bundle/chunks/register-list-query-QI45RMKN.js.map +7 -0
  245. package/dist/cli-bundle/chunks/{register-mutation-RXRX4P7D.js → register-mutation-X3BUOQEL.js} +33 -33
  246. package/dist/cli-bundle/chunks/{register-mutation-ZAGVKMBQ.js → register-mutation-YINRTS7L.js} +33 -33
  247. package/dist/cli-bundle/chunks/{register-operations-DGSHCS75.js → register-operations-E5JEASRK.js} +35 -35
  248. package/dist/cli-bundle/chunks/register-operations-E5JEASRK.js.map +1 -0
  249. package/dist/cli-bundle/chunks/{register-operations-6UURPZN5.js → register-operations-MIDTRW7S.js} +34 -34
  250. package/dist/cli-bundle/chunks/{register-operations-6UURPZN5.js.map → register-operations-MIDTRW7S.js.map} +2 -2
  251. package/dist/cli-bundle/chunks/{register-setup-LTJG52WP.js → register-setup-DYBFLEZX.js} +15 -15
  252. package/dist/cli-bundle/chunks/{register-setup-2FEGSFLM.js → register-setup-EG2U6CEU.js} +15 -15
  253. package/dist/cli-bundle/chunks/restore-5KHR2YYQ.js +19 -0
  254. package/dist/cli-bundle/chunks/{restore-SJUWYOCK.js → restore-XQYSWBV7.js} +11 -11
  255. package/dist/cli-bundle/chunks/{scheduling-shortcuts-VWAMP2S2.js → scheduling-shortcuts-HJMTEXKE.js} +14 -14
  256. package/dist/cli-bundle/chunks/{scheduling-shortcuts-W4F2LKHW.js → scheduling-shortcuts-NNT5ASZR.js} +14 -14
  257. package/dist/cli-bundle/chunks/{schema-N5ETYD4P.js → schema-263RI4WW.js} +9 -9
  258. package/dist/cli-bundle/chunks/{schema-DXQRIEFM.js → schema-TZXW6XWD.js} +9 -9
  259. package/dist/cli-bundle/chunks/search-LECJYSXE.js +33 -0
  260. package/dist/cli-bundle/chunks/search-SFRJOVDG.js +37 -0
  261. package/dist/cli-bundle/chunks/{stats-ZFESFVQC.js → stats-N7ER2PNK.js} +8 -8
  262. package/dist/cli-bundle/chunks/{stats-J563NJBY.js → stats-VPBGSRQH.js} +8 -8
  263. package/dist/cli-bundle/chunks/{telemetry-BNGLIFEM.js → telemetry-L6K3BUIQ.js} +4 -4
  264. package/dist/cli-bundle/chunks/{telemetry-SC7HPRXX.js → telemetry-PP3FUNBU.js} +4 -4
  265. package/dist/cli-bundle/chunks/{test-47UQGEXE.js → test-3EGNS3T5.js} +15 -15
  266. package/dist/cli-bundle/chunks/{test-55RJCGRU.js → test-RQCTSWUK.js} +15 -15
  267. package/dist/cli-bundle/chunks/{test-all-DN6KG4FX.js → test-all-NJ5V2QFS.js} +15 -15
  268. package/dist/cli-bundle/chunks/{test-all-5SFTTRNL.js → test-all-ZHFAWNC3.js} +15 -15
  269. package/dist/cli-bundle/chunks/{test-runs-NHRBT7SN.js → test-runs-AJHR6IQF.js} +5 -5
  270. package/dist/cli-bundle/chunks/{test-runs-DZEDJ4GH.js → test-runs-GN3C6GOI.js} +5 -5
  271. package/dist/cli-bundle/chunks/update-6YXOGHRT.js +24 -0
  272. package/dist/cli-bundle/chunks/update-6YXOGHRT.js.map +7 -0
  273. package/dist/cli-bundle/chunks/update-V33YUBRP.js +28 -0
  274. package/dist/cli-bundle/chunks/update-V33YUBRP.js.map +1 -0
  275. package/dist/cli-bundle/chunks/{update-many-IRNV3OTG.js → update-many-N2AN6ZDH.js} +23 -23
  276. package/dist/cli-bundle/chunks/{update-many-OKYWFCBO.js → update-many-RYQ64CFW.js} +23 -23
  277. package/dist/cli-bundle/chunks/{upgrade-KP4I45V5.js → upgrade-TJXFLZIX.js} +5 -5
  278. package/dist/cli-bundle/chunks/{upgrade-3RIAFQIK.js → upgrade-VPCIYAVW.js} +5 -5
  279. package/dist/cli-bundle/chunks/{validate-GVY4VE43.js → validate-JMNWEUYF.js} +62 -24
  280. package/dist/cli-bundle/chunks/validate-JMNWEUYF.js.map +1 -0
  281. package/dist/cli-bundle/chunks/{validate-ADKGN37M.js → validate-PHKIYGSY.js} +61 -23
  282. package/dist/cli-bundle/chunks/validate-PHKIYGSY.js.map +7 -0
  283. package/dist/cli-bundle/main.js +133 -55
  284. package/dist/cli-bundle/main.js.map +2 -2
  285. package/dist/core/checkpoint/checkpoint-gc.d.ts +69 -0
  286. package/dist/core/checkpoint/checkpoint-gc.js +175 -0
  287. package/dist/core/checkpoint/checkpoint-gc.js.map +1 -0
  288. package/dist/core/config/nested-settings.js +22 -2
  289. package/dist/core/config/nested-settings.js.map +1 -1
  290. package/dist/core/diagnostics/remediation.js +40 -2
  291. package/dist/core/diagnostics/remediation.js.map +1 -1
  292. package/dist/core/extensions/extension-types.d.ts +0 -9
  293. package/dist/core/extensions/extension-types.js +2 -27
  294. package/dist/core/extensions/extension-types.js.map +1 -1
  295. package/dist/core/fs/fs-utils.d.ts +17 -1
  296. package/dist/core/fs/fs-utils.js +19 -3
  297. package/dist/core/fs/fs-utils.js.map +1 -1
  298. package/dist/core/history/drift-scan.d.ts +17 -5
  299. package/dist/core/history/drift-scan.js +22 -14
  300. package/dist/core/history/drift-scan.js.map +1 -1
  301. package/dist/core/history/replay.d.ts +7 -0
  302. package/dist/core/history/replay.js +11 -6
  303. package/dist/core/history/replay.js.map +1 -1
  304. package/dist/core/item/item-format-version.d.ts +87 -0
  305. package/dist/core/item/item-format-version.js +85 -0
  306. package/dist/core/item/item-format-version.js.map +1 -0
  307. package/dist/core/item/item-format.js +8 -2
  308. package/dist/core/item/item-format.js.map +1 -1
  309. package/dist/core/item/status-filter.d.ts +7 -3
  310. package/dist/core/item/status-filter.js +26 -5
  311. package/dist/core/item/status-filter.js.map +1 -1
  312. package/dist/core/search/bm25.d.ts +113 -0
  313. package/dist/core/search/bm25.js +178 -0
  314. package/dist/core/search/bm25.js.map +1 -0
  315. package/dist/core/search/eval.d.ts +114 -0
  316. package/dist/core/search/eval.js +217 -0
  317. package/dist/core/search/eval.js.map +1 -0
  318. package/dist/core/sentry/instrument.d.ts +14 -0
  319. package/dist/core/sentry/instrument.js +43 -3
  320. package/dist/core/sentry/instrument.js.map +1 -1
  321. package/dist/core/shared/constants.js +6 -2
  322. package/dist/core/shared/constants.js.map +1 -1
  323. package/dist/core/store/paths.js +4 -3
  324. package/dist/core/store/paths.js.map +1 -1
  325. package/dist/core/store/settings-validator.d.ts +7 -0
  326. package/dist/core/store/settings-validator.js +10 -2
  327. package/dist/core/store/settings-validator.js.map +1 -1
  328. package/dist/core/store/settings.js +6 -2
  329. package/dist/core/store/settings.js.map +1 -1
  330. package/dist/mcp/tool-definitions.js +4 -3
  331. package/dist/mcp/tool-definitions.js.map +1 -1
  332. package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
  333. package/dist/sdk/cli-contracts/enum-contracts.js +3 -2
  334. package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -1
  335. package/dist/sdk/cli-contracts/tool-parameter-tables.js +4 -4
  336. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  337. package/dist/sdk/cli-contracts.d.ts +1 -0
  338. package/dist/sdk/cli-contracts.js +11 -2
  339. package/dist/sdk/cli-contracts.js.map +1 -1
  340. package/dist/sdk/index.d.ts +2 -2
  341. package/dist/sdk/index.js +3 -3
  342. package/dist/sdk/index.js.map +1 -1
  343. package/dist/sdk/runtime.d.ts +1 -0
  344. package/dist/sdk/runtime.js +3 -2
  345. package/dist/sdk/runtime.js.map +1 -1
  346. package/dist/sdk/testing.d.ts +48 -1
  347. package/dist/sdk/testing.js +98 -2
  348. package/dist/sdk/testing.js.map +1 -1
  349. package/dist/types.d.ts +26 -0
  350. package/dist/types.js +2 -2
  351. package/dist/types.js.map +1 -1
  352. package/docs/AGENT_GUIDE.md +1 -0
  353. package/docs/ARCHITECTURE.md +126 -11
  354. package/docs/CLAUDE_CODE_PLUGIN.md +5 -13
  355. package/docs/COMMANDS.md +57 -5
  356. package/docs/CONFIGURATION.md +39 -0
  357. package/docs/EXTENSIONS.md +2 -2
  358. package/docs/MIGRATION_CLI_SIMPLIFICATION.md +9 -2
  359. package/docs/QUICKSTART.md +2 -0
  360. package/docs/README.md +2 -0
  361. package/docs/RELEASING.md +2 -1
  362. package/docs/SDK.md +80 -1
  363. package/docs/TESTING.md +18 -0
  364. package/package.json +4 -3
  365. package/packages/pm-command-kit/README.md +4 -0
  366. package/packages/pm-todos/extensions/todos/index.js +2 -0
  367. package/packages/pm-todos/extensions/todos/index.ts +2 -0
  368. package/packages/pm-todos/extensions/todos/runtime.js +192 -9
  369. package/packages/pm-todos/extensions/todos/runtime.ts +211 -8
  370. package/dist/cli-bundle/chunks/activity-62I26XZB.js +0 -18
  371. package/dist/cli-bundle/chunks/chunk-2RI3BDFK.js.map +0 -7
  372. package/dist/cli-bundle/chunks/chunk-4BFNWAMQ.js.map +0 -7
  373. package/dist/cli-bundle/chunks/chunk-5QLHQK7V.js.map +0 -7
  374. package/dist/cli-bundle/chunks/chunk-5SRID7DV.js.map +0 -1
  375. package/dist/cli-bundle/chunks/chunk-COHNQLB2.js.map +0 -1
  376. package/dist/cli-bundle/chunks/chunk-DVUU3AHP.js.map +0 -1
  377. package/dist/cli-bundle/chunks/chunk-EMFDZ7N3.js.map +0 -1
  378. package/dist/cli-bundle/chunks/chunk-FP7YLQ52.js.map +0 -1
  379. package/dist/cli-bundle/chunks/chunk-FPQA4ZMA.js.map +0 -7
  380. package/dist/cli-bundle/chunks/chunk-GDOTTY2S.js.map +0 -7
  381. package/dist/cli-bundle/chunks/chunk-I2VJM36R.js.map +0 -1
  382. package/dist/cli-bundle/chunks/chunk-K5TD74VU.js.map +0 -7
  383. package/dist/cli-bundle/chunks/chunk-MAKOMXVM.js.map +0 -1
  384. package/dist/cli-bundle/chunks/chunk-PSWSQHM7.js.map +0 -1
  385. package/dist/cli-bundle/chunks/chunk-QSH34DSQ.js.map +0 -7
  386. package/dist/cli-bundle/chunks/chunk-UA4ANRJY.js.map +0 -7
  387. package/dist/cli-bundle/chunks/chunk-UCNEPMPY.js.map +0 -7
  388. package/dist/cli-bundle/chunks/chunk-X26ODPU4.js.map +0 -7
  389. package/dist/cli-bundle/chunks/chunk-Y4IBSEQ2.js.map +0 -1
  390. package/dist/cli-bundle/chunks/chunk-YOGXK3ON.js.map +0 -7
  391. package/dist/cli-bundle/chunks/chunk-YWAYOWDQ.js.map +0 -1
  392. package/dist/cli-bundle/chunks/chunk-ZZEM2PH7.js.map +0 -1
  393. package/dist/cli-bundle/chunks/close-TQZK43Z5.js +0 -15
  394. package/dist/cli-bundle/chunks/config-UWF3KRP5.js.map +0 -7
  395. package/dist/cli-bundle/chunks/config-YICACPHA.js.map +0 -1
  396. package/dist/cli-bundle/chunks/contracts-7G553BHP.js.map +0 -1
  397. package/dist/cli-bundle/chunks/contracts-B2YWYUV5.js.map +0 -7
  398. package/dist/cli-bundle/chunks/create-UZLJXHLA.js +0 -30
  399. package/dist/cli-bundle/chunks/gc-5RTYXLQU.js +0 -211
  400. package/dist/cli-bundle/chunks/gc-5RTYXLQU.js.map +0 -7
  401. package/dist/cli-bundle/chunks/gc-FK5732EK.js +0 -208
  402. package/dist/cli-bundle/chunks/gc-FK5732EK.js.map +0 -1
  403. package/dist/cli-bundle/chunks/health-JEBESKID.js.map +0 -7
  404. package/dist/cli-bundle/chunks/health-PPTJ7XKW.js.map +0 -1
  405. package/dist/cli-bundle/chunks/history-TKTULEVE.js +0 -20
  406. package/dist/cli-bundle/chunks/history-redact-SPIFIXVY.js +0 -21
  407. package/dist/cli-bundle/chunks/init-A6FTZ5UC.js +0 -20
  408. package/dist/cli-bundle/chunks/plan-BK3OMLGP.js.map +0 -1
  409. package/dist/cli-bundle/chunks/plan-X3STKLED.js.map +0 -7
  410. package/dist/cli-bundle/chunks/register-list-query-FUMXPWZ4.js.map +0 -7
  411. package/dist/cli-bundle/chunks/register-list-query-XDLFESU7.js.map +0 -1
  412. package/dist/cli-bundle/chunks/register-operations-DGSHCS75.js.map +0 -1
  413. package/dist/cli-bundle/chunks/restore-PI3WM4GK.js +0 -19
  414. package/dist/cli-bundle/chunks/search-2JX776KX.js.map +0 -1
  415. package/dist/cli-bundle/chunks/search-AZR2JITW.js.map +0 -7
  416. package/dist/cli-bundle/chunks/update-2BZEAI7B.js +0 -24
  417. package/dist/cli-bundle/chunks/update-GCNLER2H.js +0 -28
  418. package/dist/cli-bundle/chunks/validate-ADKGN37M.js.map +0 -7
  419. package/dist/cli-bundle/chunks/validate-GVY4VE43.js.map +0 -1
  420. /package/dist/cli-bundle/chunks/{activity-62I26XZB.js.map → activity-CIHV64UC.js.map} +0 -0
  421. /package/dist/cli-bundle/chunks/{activity-XJ7WRNWS.js.map → activity-KW3IRP44.js.map} +0 -0
  422. /package/dist/cli-bundle/chunks/{aggregate-LBCWF6UJ.js.map → aggregate-3ZKQG5SW.js.map} +0 -0
  423. /package/dist/cli-bundle/chunks/{aggregate-OFT4YVB6.js.map → aggregate-FIGQEIL3.js.map} +0 -0
  424. /package/dist/cli-bundle/chunks/{append-BP2ARHOK.js.map → append-EWJYJ7CH.js.map} +0 -0
  425. /package/dist/cli-bundle/chunks/{append-5U3XR5SD.js.map → append-QEOLX3XB.js.map} +0 -0
  426. /package/dist/cli-bundle/chunks/{chunk-CSRFOIHG.js.map → chunk-2EIMPCE4.js.map} +0 -0
  427. /package/dist/cli-bundle/chunks/{chunk-II3WDRCM.js.map → chunk-37QXHBIB.js.map} +0 -0
  428. /package/dist/cli-bundle/chunks/{chunk-UMTPQMEG.js.map → chunk-3MDHREEV.js.map} +0 -0
  429. /package/dist/cli-bundle/chunks/{chunk-DJ3YYLHG.js.map → chunk-5FIEHKEX.js.map} +0 -0
  430. /package/dist/cli-bundle/chunks/{chunk-OURX4WVG.js.map → chunk-5IDI42VV.js.map} +0 -0
  431. /package/dist/cli-bundle/chunks/{chunk-RVG3WLY3.js.map → chunk-5QICDWMV.js.map} +0 -0
  432. /package/dist/cli-bundle/chunks/{chunk-LIVRA6VG.js.map → chunk-6CJWZAN7.js.map} +0 -0
  433. /package/dist/cli-bundle/chunks/{chunk-AVMSP2HH.js.map → chunk-6H4LF7AO.js.map} +0 -0
  434. /package/dist/cli-bundle/chunks/{chunk-B2NEFANY.js.map → chunk-6M4RJS4M.js.map} +0 -0
  435. /package/dist/cli-bundle/chunks/{chunk-A5JPMD4Q.js.map → chunk-76Z3YSHV.js.map} +0 -0
  436. /package/dist/cli-bundle/chunks/{chunk-5NS6TJ2F.js.map → chunk-7D3SAQXM.js.map} +0 -0
  437. /package/dist/cli-bundle/chunks/{chunk-2E3KSWFG.js.map → chunk-AIS5PGI3.js.map} +0 -0
  438. /package/dist/cli-bundle/chunks/{chunk-47BYN6CA.js.map → chunk-AZMOLBN3.js.map} +0 -0
  439. /package/dist/cli-bundle/chunks/{chunk-DYZKSIVX.js.map → chunk-B473GZWW.js.map} +0 -0
  440. /package/dist/cli-bundle/chunks/{chunk-RNWE2HZR.js.map → chunk-C3AZ5ZML.js.map} +0 -0
  441. /package/dist/cli-bundle/chunks/{chunk-S673PVHD.js.map → chunk-C4N5I7ZW.js.map} +0 -0
  442. /package/dist/cli-bundle/chunks/{chunk-TYQBGXH2.js.map → chunk-CF55WVVS.js.map} +0 -0
  443. /package/dist/cli-bundle/chunks/{chunk-4EOS35RL.js.map → chunk-CZPXY7UW.js.map} +0 -0
  444. /package/dist/cli-bundle/chunks/{chunk-MPEWACTG.js.map → chunk-CZUB4XWO.js.map} +0 -0
  445. /package/dist/cli-bundle/chunks/{chunk-22YA6GCA.js.map → chunk-D7FYS6PG.js.map} +0 -0
  446. /package/dist/cli-bundle/chunks/{chunk-UIMLAFOE.js.map → chunk-F5NZWFSW.js.map} +0 -0
  447. /package/dist/cli-bundle/chunks/{chunk-H3DP6OUM.js.map → chunk-FKBDKV7Y.js.map} +0 -0
  448. /package/dist/cli-bundle/chunks/{chunk-SO2IOH37.js.map → chunk-FRUFKWNK.js.map} +0 -0
  449. /package/dist/cli-bundle/chunks/{chunk-7R5YKVKO.js.map → chunk-FWPDUYEY.js.map} +0 -0
  450. /package/dist/cli-bundle/chunks/{chunk-USVOBLGB.js.map → chunk-GOZUHWFD.js.map} +0 -0
  451. /package/dist/cli-bundle/chunks/{chunk-ZBVYKWT2.js.map → chunk-H7NJZWG2.js.map} +0 -0
  452. /package/dist/cli-bundle/chunks/{chunk-4L7Q4OVT.js.map → chunk-HCU6WUSY.js.map} +0 -0
  453. /package/dist/cli-bundle/chunks/{chunk-PRUB7RI4.js.map → chunk-LUWW7L4B.js.map} +0 -0
  454. /package/dist/cli-bundle/chunks/{chunk-N7LDJRB4.js.map → chunk-M5XALUSL.js.map} +0 -0
  455. /package/dist/cli-bundle/chunks/{chunk-NPNNW5TU.js.map → chunk-N5ZJACJ6.js.map} +0 -0
  456. /package/dist/cli-bundle/chunks/{chunk-NNMBNN6Q.js.map → chunk-NB3PYLQ6.js.map} +0 -0
  457. /package/dist/cli-bundle/chunks/{chunk-USKTNI7P.js.map → chunk-NIGXMNNI.js.map} +0 -0
  458. /package/dist/cli-bundle/chunks/{chunk-GL3QKIET.js.map → chunk-NIUEXCFS.js.map} +0 -0
  459. /package/dist/cli-bundle/chunks/{chunk-OUG4CL4H.js.map → chunk-NJHMAJ6N.js.map} +0 -0
  460. /package/dist/cli-bundle/chunks/{chunk-2K56AWDP.js.map → chunk-NJN7LL7U.js.map} +0 -0
  461. /package/dist/cli-bundle/chunks/{chunk-5P2LQV2F.js.map → chunk-NSBZ2CKF.js.map} +0 -0
  462. /package/dist/cli-bundle/chunks/{chunk-XV6N3QND.js.map → chunk-O47BPOPC.js.map} +0 -0
  463. /package/dist/cli-bundle/chunks/{chunk-QCHNPN24.js.map → chunk-OTHIWLMB.js.map} +0 -0
  464. /package/dist/cli-bundle/chunks/{chunk-YVYJQR6S.js.map → chunk-PFSRUHDH.js.map} +0 -0
  465. /package/dist/cli-bundle/chunks/{chunk-M35R7LFX.js.map → chunk-PP2U4NMT.js.map} +0 -0
  466. /package/dist/cli-bundle/chunks/{chunk-ZGEWEO7B.js.map → chunk-PUH4D67U.js.map} +0 -0
  467. /package/dist/cli-bundle/chunks/{chunk-LEC57E7K.js.map → chunk-Q2J2HJUN.js.map} +0 -0
  468. /package/dist/cli-bundle/chunks/{chunk-QG6M6XQE.js.map → chunk-QQHISQBJ.js.map} +0 -0
  469. /package/dist/cli-bundle/chunks/{chunk-BQVESTOG.js.map → chunk-QZTWBFXJ.js.map} +0 -0
  470. /package/dist/cli-bundle/chunks/{chunk-5LZPDRFW.js.map → chunk-RLK7P77C.js.map} +0 -0
  471. /package/dist/cli-bundle/chunks/{chunk-QTWWHFI3.js.map → chunk-RVHYI7SL.js.map} +0 -0
  472. /package/dist/cli-bundle/chunks/{chunk-FVZSUIN5.js.map → chunk-SBGXDO7A.js.map} +0 -0
  473. /package/dist/cli-bundle/chunks/{chunk-VP4Z36GO.js.map → chunk-SRYYRVPB.js.map} +0 -0
  474. /package/dist/cli-bundle/chunks/{chunk-X7RKOJXL.js.map → chunk-SX75ADBK.js.map} +0 -0
  475. /package/dist/cli-bundle/chunks/{chunk-MTDEEUGV.js.map → chunk-TKBHZPKD.js.map} +0 -0
  476. /package/dist/cli-bundle/chunks/{chunk-HMQMRHQJ.js.map → chunk-UEMNL33O.js.map} +0 -0
  477. /package/dist/cli-bundle/chunks/{chunk-SDUZTZ55.js.map → chunk-UPE3CDD7.js.map} +0 -0
  478. /package/dist/cli-bundle/chunks/{chunk-VG3B2CYD.js.map → chunk-UV6IYE5U.js.map} +0 -0
  479. /package/dist/cli-bundle/chunks/{chunk-MTGMNUMJ.js.map → chunk-YCJX76PW.js.map} +0 -0
  480. /package/dist/cli-bundle/chunks/{claim-2BSYPJTJ.js.map → claim-RC56YUWG.js.map} +0 -0
  481. /package/dist/cli-bundle/chunks/{claim-EZ6JKY5X.js.map → claim-THOJ6CMV.js.map} +0 -0
  482. /package/dist/cli-bundle/chunks/{close-TQZK43Z5.js.map → close-DNMHGOCX.js.map} +0 -0
  483. /package/dist/cli-bundle/chunks/{close-3TSX6BYF.js.map → close-SG5MNCVQ.js.map} +0 -0
  484. /package/dist/cli-bundle/chunks/{close-many-HB4UFCS3.js.map → close-many-3L3AQZBU.js.map} +0 -0
  485. /package/dist/cli-bundle/chunks/{close-many-B7DBVA46.js.map → close-many-DKQLBGLV.js.map} +0 -0
  486. /package/dist/cli-bundle/chunks/{comments-M7PAINZT.js.map → comments-M7ZOZNBX.js.map} +0 -0
  487. /package/dist/cli-bundle/chunks/{comments-X7M7XM6I.js.map → comments-SKWMDWCW.js.map} +0 -0
  488. /package/dist/cli-bundle/chunks/{context-EGUGU4K7.js.map → context-OEC366TO.js.map} +0 -0
  489. /package/dist/cli-bundle/chunks/{context-V32ZAPL6.js.map → context-PUG2A7RC.js.map} +0 -0
  490. /package/dist/cli-bundle/chunks/{copy-NWFFRYWM.js.map → copy-6QLHILAC.js.map} +0 -0
  491. /package/dist/cli-bundle/chunks/{copy-RMLXLZOL.js.map → copy-JPX7VZCH.js.map} +0 -0
  492. /package/dist/cli-bundle/chunks/{create-UZLJXHLA.js.map → create-NNP6TSFO.js.map} +0 -0
  493. /package/dist/cli-bundle/chunks/{create-GK4MX2LJ.js.map → create-Y54ZVVZH.js.map} +0 -0
  494. /package/dist/cli-bundle/chunks/{delete-RMGNIL2S.js.map → delete-63PCMQAJ.js.map} +0 -0
  495. /package/dist/cli-bundle/chunks/{delete-EFQLVEAS.js.map → delete-GDSMGAGJ.js.map} +0 -0
  496. /package/dist/cli-bundle/chunks/{deps-WKHUPVD3.js.map → deps-T4ZF5G54.js.map} +0 -0
  497. /package/dist/cli-bundle/chunks/{deps-K2I7QV4Y.js.map → deps-XYQ73XRH.js.map} +0 -0
  498. /package/dist/cli-bundle/chunks/{extension-4LPTFTV4.js.map → extension-46NWACO3.js.map} +0 -0
  499. /package/dist/cli-bundle/chunks/{extension-ASUPTDCC.js.map → extension-D5FDZ2CO.js.map} +0 -0
  500. /package/dist/cli-bundle/chunks/{focus-UGROAMAX.js.map → focus-5STQXDPU.js.map} +0 -0
  501. /package/dist/cli-bundle/chunks/{focus-ELOPN2SR.js.map → focus-MDVPOWB5.js.map} +0 -0
  502. /package/dist/cli-bundle/chunks/{get-OTXPLWYW.js.map → get-J2IPJRZW.js.map} +0 -0
  503. /package/dist/cli-bundle/chunks/{get-IWZ7IMPS.js.map → get-NT7L2HUZ.js.map} +0 -0
  504. /package/dist/cli-bundle/chunks/{history-HNWBUDMI.js.map → history-RLH2QCRO.js.map} +0 -0
  505. /package/dist/cli-bundle/chunks/{history-TKTULEVE.js.map → history-WX3MGFS2.js.map} +0 -0
  506. /package/dist/cli-bundle/chunks/{history-compact-MMQC7MCW.js.map → history-compact-UXDIFC33.js.map} +0 -0
  507. /package/dist/cli-bundle/chunks/{history-compact-EQXVPK3V.js.map → history-compact-ZBEBGJM7.js.map} +0 -0
  508. /package/dist/cli-bundle/chunks/{history-redact-UBDHBEJE.js.map → history-redact-P7I7AWMB.js.map} +0 -0
  509. /package/dist/cli-bundle/chunks/{history-redact-SPIFIXVY.js.map → history-redact-YQGU3XRA.js.map} +0 -0
  510. /package/dist/cli-bundle/chunks/{history-repair-GMMHFAGH.js.map → history-repair-52KINVIK.js.map} +0 -0
  511. /package/dist/cli-bundle/chunks/{history-repair-7DSDRPMX.js.map → history-repair-RM5ITLU5.js.map} +0 -0
  512. /package/dist/cli-bundle/chunks/{init-QGK4JFF6.js.map → init-2BNZOO6F.js.map} +0 -0
  513. /package/dist/cli-bundle/chunks/{init-A6FTZ5UC.js.map → init-SC2P6CHP.js.map} +0 -0
  514. /package/dist/cli-bundle/chunks/{learnings-DR53TWRA.js.map → learnings-W6F3FIPL.js.map} +0 -0
  515. /package/dist/cli-bundle/chunks/{learnings-A6DGBMG3.js.map → learnings-YGYVHWJK.js.map} +0 -0
  516. /package/dist/cli-bundle/chunks/{list-LJ5DBXC3.js.map → list-K6FPV4J4.js.map} +0 -0
  517. /package/dist/cli-bundle/chunks/{list-KOJN23UL.js.map → list-KPAYU5KZ.js.map} +0 -0
  518. /package/dist/cli-bundle/chunks/{notes-7VLTHKPW.js.map → notes-PU74EPKV.js.map} +0 -0
  519. /package/dist/cli-bundle/chunks/{notes-K5I3TAYR.js.map → notes-YTD6ZILW.js.map} +0 -0
  520. /package/dist/cli-bundle/chunks/{register-mutation-RXRX4P7D.js.map → register-mutation-X3BUOQEL.js.map} +0 -0
  521. /package/dist/cli-bundle/chunks/{register-mutation-ZAGVKMBQ.js.map → register-mutation-YINRTS7L.js.map} +0 -0
  522. /package/dist/cli-bundle/chunks/{register-setup-LTJG52WP.js.map → register-setup-DYBFLEZX.js.map} +0 -0
  523. /package/dist/cli-bundle/chunks/{register-setup-2FEGSFLM.js.map → register-setup-EG2U6CEU.js.map} +0 -0
  524. /package/dist/cli-bundle/chunks/{restore-PI3WM4GK.js.map → restore-5KHR2YYQ.js.map} +0 -0
  525. /package/dist/cli-bundle/chunks/{restore-SJUWYOCK.js.map → restore-XQYSWBV7.js.map} +0 -0
  526. /package/dist/cli-bundle/chunks/{scheduling-shortcuts-VWAMP2S2.js.map → scheduling-shortcuts-HJMTEXKE.js.map} +0 -0
  527. /package/dist/cli-bundle/chunks/{scheduling-shortcuts-W4F2LKHW.js.map → scheduling-shortcuts-NNT5ASZR.js.map} +0 -0
  528. /package/dist/cli-bundle/chunks/{schema-N5ETYD4P.js.map → schema-263RI4WW.js.map} +0 -0
  529. /package/dist/cli-bundle/chunks/{schema-DXQRIEFM.js.map → schema-TZXW6XWD.js.map} +0 -0
  530. /package/dist/cli-bundle/chunks/{test-55RJCGRU.js.map → search-LECJYSXE.js.map} +0 -0
  531. /package/dist/cli-bundle/chunks/{test-47UQGEXE.js.map → search-SFRJOVDG.js.map} +0 -0
  532. /package/dist/cli-bundle/chunks/{stats-ZFESFVQC.js.map → stats-N7ER2PNK.js.map} +0 -0
  533. /package/dist/cli-bundle/chunks/{stats-J563NJBY.js.map → stats-VPBGSRQH.js.map} +0 -0
  534. /package/dist/cli-bundle/chunks/{telemetry-BNGLIFEM.js.map → telemetry-L6K3BUIQ.js.map} +0 -0
  535. /package/dist/cli-bundle/chunks/{telemetry-SC7HPRXX.js.map → telemetry-PP3FUNBU.js.map} +0 -0
  536. /package/dist/cli-bundle/chunks/{update-GCNLER2H.js.map → test-3EGNS3T5.js.map} +0 -0
  537. /package/dist/cli-bundle/chunks/{update-2BZEAI7B.js.map → test-RQCTSWUK.js.map} +0 -0
  538. /package/dist/cli-bundle/chunks/{test-all-DN6KG4FX.js.map → test-all-NJ5V2QFS.js.map} +0 -0
  539. /package/dist/cli-bundle/chunks/{test-all-5SFTTRNL.js.map → test-all-ZHFAWNC3.js.map} +0 -0
  540. /package/dist/cli-bundle/chunks/{test-runs-NHRBT7SN.js.map → test-runs-AJHR6IQF.js.map} +0 -0
  541. /package/dist/cli-bundle/chunks/{test-runs-DZEDJ4GH.js.map → test-runs-GN3C6GOI.js.map} +0 -0
  542. /package/dist/cli-bundle/chunks/{update-many-IRNV3OTG.js.map → update-many-N2AN6ZDH.js.map} +0 -0
  543. /package/dist/cli-bundle/chunks/{update-many-OKYWFCBO.js.map → update-many-RYQ64CFW.js.map} +0 -0
  544. /package/dist/cli-bundle/chunks/{upgrade-KP4I45V5.js.map → upgrade-TJXFLZIX.js.map} +0 -0
  545. /package/dist/cli-bundle/chunks/{upgrade-3RIAFQIK.js.map → upgrade-VPCIYAVW.js.map} +0 -0
package/docs/TESTING.md CHANGED
@@ -52,6 +52,24 @@ quality:static`: every `src/**/*.ts` source file needs a module TSDoc block,
52
52
  every exported declaration needs a non-module TSDoc block, and known generated
53
53
  boilerplate summaries are rejected.
54
54
 
55
+ ### Directory-load cap and the `tests/unit` split
56
+
57
+ `pnpm quality:static` also caps each directory under `src/`, `tests/`, and
58
+ `packages/` at **120 `.ts` files** (`--max-files-per-dir`, default `120`). This
59
+ keeps any single directory navigable and forces load to be partitioned by area
60
+ rather than piling into one folder. `tests/unit/` is therefore split into
61
+ per-area subdirectories (`tests/unit/commands/`, `tests/unit/core/`,
62
+ `tests/unit/cli/`, `tests/unit/mcp/`, `tests/unit/extensions/`, …) instead of a
63
+ single flat directory.
64
+
65
+ When adding a unit test, place it in the matching `tests/unit/<area>/`
66
+ subdirectory (or merge into an existing spec there); never add a file directly
67
+ to `tests/unit/`. The
68
+ [`static-quality-gate directory-load contract`](../tests/integration/ci-workflow-contract.spec.ts)
69
+ test asserts the live repository stays at or below the cap and that the magic
70
+ number matches the gate default, so drift is caught before CI's `static` gate
71
+ fails.
72
+
55
73
  ## Search Quality Evaluation
56
74
 
57
75
  `search-advanced` exposes an advisory golden-query harness for relevance drift checks.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unbrained/pm-cli",
3
- "version": "2026.6.19",
3
+ "version": "2026.6.21",
4
4
  "description": "Git-native project management CLI for humans and agents.",
5
5
  "type": "module",
6
6
  "author": "unbrained",
@@ -125,7 +125,7 @@
125
125
  }
126
126
  },
127
127
  "dependencies": {
128
- "@sentry/node": "^10.58.0",
128
+ "@sentry/node": "^10.59.0",
129
129
  "@toon-format/toon": "^2.3.0",
130
130
  "commander": "^14.0.3",
131
131
  "fast-glob": "^3.3.3",
@@ -150,7 +150,8 @@
150
150
  "brace-expansion": ">=5.0.6",
151
151
  "vite": "7.3.5",
152
152
  "esbuild": "0.28.1",
153
- "@opentelemetry/core": ">=2.8.0"
153
+ "@opentelemetry/core": ">=2.8.0",
154
+ "undici": "6.27.0"
154
155
  }
155
156
  }
156
157
  }
@@ -70,3 +70,7 @@ Key conventions for authors:
70
70
  - `activation.commands` in `manifest.json` lists both package-owned commands and
71
71
  existing commands that receive injected flags so the host can lazily activate the
72
72
  extension before option validation.
73
+ - Unit tests can validate this package's three command-facing registrations with
74
+ public SDK helpers: `assertRegisteredCommandContract(...)` for the owned command,
75
+ `assertRegisteredParserOverride(...)` for parser rewrites, and
76
+ `assertRegisteredFlags(...)` for the injected `pm list --kit-note` flag.
@@ -39,6 +39,7 @@ export function activate(api) {
39
39
  api.registerImporter("todos", async (context) => runTodosImportFromRuntime(toImportOptions(context.options), context.global), {
40
40
  action: "todos-import",
41
41
  description: "Import Todo markdown files into pm items.",
42
+ failure_hints: ["This command reads a directory, not a file. Use --folder <path> to point at the Todo markdown directory."],
42
43
  flags: [
43
44
  {
44
45
  long: "--folder",
@@ -63,6 +64,7 @@ export function activate(api) {
63
64
  api.registerExporter("todos", async (context) => runTodosExportFromRuntime(toExportOptions(context.options), context.global), {
64
65
  action: "todos-export",
65
66
  description: "Export pm items into Todo markdown files.",
67
+ failure_hints: ["This command writes a directory of markdown files. Use --folder <path> to choose the destination directory."],
66
68
  flags: [
67
69
  {
68
70
  long: "--folder",
@@ -65,6 +65,7 @@ export function activate(api: ExtensionApi): void {
65
65
  {
66
66
  action: "todos-import",
67
67
  description: "Import Todo markdown files into pm items.",
68
+ failure_hints: ["This command reads a directory, not a file. Use --folder <path> to point at the Todo markdown directory."],
68
69
  flags: [
69
70
  {
70
71
  long: "--folder",
@@ -93,6 +94,7 @@ export function activate(api: ExtensionApi): void {
93
94
  {
94
95
  action: "todos-export",
95
96
  description: "Export pm items into Todo markdown files.",
97
+ failure_hints: ["This command writes a directory of markdown files. Use --folder <path> to choose the destination directory."],
96
98
  flags: [
97
99
  {
98
100
  long: "--folder",
@@ -1,6 +1,6 @@
1
1
  import fs from "node:fs/promises";
2
2
  import path from "node:path";
3
- import { CONFIDENCE_TEXT_VALUES, EXIT_CODE, ISSUE_SEVERITY_VALUES, PmCliError, RISK_VALUES, canonicalDocument, commitImportedItem, generateItemId, getActiveExtensionRegistrations, getItemPath, listAllFrontMatter, locateItem, normalizeFrontMatter, normalizeItemId, nowIso, readLocatedItem, readSettings, resolveItemTypeRegistry, resolvePmRoot, runActiveOnReadHooks, runActiveOnWriteHooks, selectImportAuthor, splitFrontMatter, ensureTrackerInitialized, toEstimatedMinutesValue, toImportPriority, toImportStatus, toImportTags, toNonEmptyImportString, writeFileAtomic, } from "../../../../dist/sdk/index.js";
3
+ import { CONFIDENCE_TEXT_VALUES, DEPENDENCY_KIND_VALUES, EXIT_CODE, ISSUE_SEVERITY_VALUES, PmCliError, RISK_VALUES, canonicalDocument, commitImportedItem, generateItemId, getActiveExtensionRegistrations, getItemPath, listAllFrontMatter, locateItem, normalizeFrontMatter, normalizeItemId, nowIso, readLocatedItem, readSettings, resolveItemTypeRegistry, resolvePmRoot, runActiveOnReadHooks, runActiveOnWriteHooks, selectImportAuthor, splitFrontMatter, ensureTrackerInitialized, toEstimatedMinutesValue, toImportPriority, toImportStatus, toImportTags, toNonEmptyImportString, writeFileAtomic, } from "../../../../dist/sdk/index.js";
4
4
  const DEFAULT_TODOS_FOLDER = ".pm/todos";
5
5
  // Shared, behavior-identical value coercers are sourced from the SDK adapter
6
6
  // surface; package-specific mappings (lenient timestamps, type-name resolution,
@@ -95,6 +95,189 @@ function toBoolean(value) {
95
95
  return undefined;
96
96
  }
97
97
  const toTags = toImportTags;
98
+ function toLinkScope(value) {
99
+ return toNonEmptyString(value)?.toLowerCase() === "global" ? "global" : "project";
100
+ }
101
+ function toStringList(value) {
102
+ if (!Array.isArray(value)) {
103
+ return undefined;
104
+ }
105
+ const entries = value
106
+ .map((entry) => toNonEmptyString(entry))
107
+ .filter((entry) => entry !== undefined);
108
+ return entries.length > 0 ? entries : undefined;
109
+ }
110
+ function toStringMap(value) {
111
+ if (!isRecord(value)) {
112
+ return undefined;
113
+ }
114
+ const entries = Object.entries(value)
115
+ .map(([key, entryValue]) => [key.trim(), toNonEmptyString(entryValue)])
116
+ .filter((entry) => entry[0].length > 0 && entry[1] !== undefined);
117
+ return entries.length > 0 ? Object.fromEntries(entries) : undefined;
118
+ }
119
+ function toNumberMap(value) {
120
+ if (!isRecord(value)) {
121
+ return undefined;
122
+ }
123
+ const entries = Object.entries(value)
124
+ .map(([key, entryValue]) => [key.trim(), toInteger(entryValue)])
125
+ .filter((entry) => entry[0].length > 0 && entry[1] !== undefined);
126
+ return entries.length > 0 ? Object.fromEntries(entries) : undefined;
127
+ }
128
+ function toDependencyEntries(value, fallbackCreatedAt) {
129
+ if (!Array.isArray(value)) {
130
+ return undefined;
131
+ }
132
+ const dependencies = [];
133
+ for (const entry of value) {
134
+ if (!isRecord(entry)) {
135
+ continue;
136
+ }
137
+ const id = toNonEmptyString(entry.id);
138
+ if (!id) {
139
+ continue;
140
+ }
141
+ const normalizedKind = toNonEmptyString(entry.kind)?.toLowerCase();
142
+ const kind = normalizedKind && DEPENDENCY_KIND_VALUES.includes(normalizedKind) ? normalizedKind : "related";
143
+ dependencies.push({
144
+ id,
145
+ kind,
146
+ created_at: toIsoString(entry.created_at) ?? fallbackCreatedAt,
147
+ author: toNonEmptyString(entry.author),
148
+ source_kind: toNonEmptyString(entry.source_kind),
149
+ });
150
+ }
151
+ return dependencies.length > 0 ? dependencies : undefined;
152
+ }
153
+ function toLogEntries(value, fallbackCreatedAt, fallbackAuthor) {
154
+ if (!Array.isArray(value)) {
155
+ return undefined;
156
+ }
157
+ const entries = value
158
+ .map((entry) => {
159
+ if (typeof entry === "string") {
160
+ const text = toNonEmptyString(entry);
161
+ return text
162
+ ? {
163
+ created_at: fallbackCreatedAt,
164
+ author: fallbackAuthor,
165
+ text,
166
+ }
167
+ : undefined;
168
+ }
169
+ if (!isRecord(entry)) {
170
+ return undefined;
171
+ }
172
+ const text = toNonEmptyString(entry.text);
173
+ if (!text) {
174
+ return undefined;
175
+ }
176
+ return {
177
+ created_at: toIsoString(entry.created_at) ?? fallbackCreatedAt,
178
+ author: toNonEmptyString(entry.author) ?? fallbackAuthor,
179
+ text,
180
+ };
181
+ })
182
+ .filter((entry) => entry !== undefined);
183
+ return entries.length > 0 ? entries : undefined;
184
+ }
185
+ function toLinkedFiles(value) {
186
+ if (!Array.isArray(value)) {
187
+ return undefined;
188
+ }
189
+ const entries = value
190
+ .map((entry) => {
191
+ if (typeof entry === "string") {
192
+ const filePath = toNonEmptyString(entry);
193
+ return filePath ? { path: filePath, scope: "project" } : undefined;
194
+ }
195
+ if (!isRecord(entry)) {
196
+ return undefined;
197
+ }
198
+ const filePath = toNonEmptyString(entry.path);
199
+ if (!filePath) {
200
+ return undefined;
201
+ }
202
+ return {
203
+ path: filePath,
204
+ scope: toLinkScope(entry.scope),
205
+ note: toNonEmptyString(entry.note),
206
+ };
207
+ })
208
+ .filter((entry) => entry !== undefined);
209
+ return entries.length > 0 ? entries : undefined;
210
+ }
211
+ function toLinkedDocs(value) {
212
+ if (!Array.isArray(value)) {
213
+ return undefined;
214
+ }
215
+ const entries = value
216
+ .map((entry) => {
217
+ if (typeof entry === "string") {
218
+ const docPath = toNonEmptyString(entry);
219
+ return docPath ? { path: docPath, scope: "project" } : undefined;
220
+ }
221
+ if (!isRecord(entry)) {
222
+ return undefined;
223
+ }
224
+ const docPath = toNonEmptyString(entry.path);
225
+ if (!docPath) {
226
+ return undefined;
227
+ }
228
+ return {
229
+ path: docPath,
230
+ scope: toLinkScope(entry.scope),
231
+ note: toNonEmptyString(entry.note),
232
+ };
233
+ })
234
+ .filter((entry) => entry !== undefined);
235
+ return entries.length > 0 ? entries : undefined;
236
+ }
237
+ function toLinkedTests(value) {
238
+ if (!Array.isArray(value)) {
239
+ return undefined;
240
+ }
241
+ const entries = [];
242
+ for (const entry of value) {
243
+ if (typeof entry === "string") {
244
+ const command = toNonEmptyString(entry);
245
+ if (command) {
246
+ entries.push({ command, scope: "project" });
247
+ }
248
+ continue;
249
+ }
250
+ if (!isRecord(entry)) {
251
+ continue;
252
+ }
253
+ const command = toNonEmptyString(entry.command);
254
+ const testPath = toNonEmptyString(entry.path);
255
+ if (!command && !testPath) {
256
+ continue;
257
+ }
258
+ const timeoutSeconds = toInteger(entry.timeout_seconds);
259
+ const pmContextMode = toNormalizedEnum(entry.pm_context_mode, ["schema", "tracker", "auto"]);
260
+ entries.push({
261
+ command,
262
+ path: testPath,
263
+ scope: toLinkScope(entry.scope),
264
+ timeout_seconds: timeoutSeconds !== undefined && timeoutSeconds > 0 ? timeoutSeconds : undefined,
265
+ pm_context_mode: pmContextMode,
266
+ env_set: toStringMap(entry.env_set),
267
+ env_clear: toStringList(entry.env_clear),
268
+ shared_host_safe: toBoolean(entry.shared_host_safe),
269
+ assert_stdout_contains: toStringList(entry.assert_stdout_contains),
270
+ assert_stdout_regex: toStringList(entry.assert_stdout_regex),
271
+ assert_stderr_contains: toStringList(entry.assert_stderr_contains),
272
+ assert_stderr_regex: toStringList(entry.assert_stderr_regex),
273
+ assert_stdout_min_lines: toInteger(entry.assert_stdout_min_lines),
274
+ assert_json_field_equals: toStringMap(entry.assert_json_field_equals),
275
+ assert_json_field_gte: toNumberMap(entry.assert_json_field_gte),
276
+ note: toNonEmptyString(entry.note),
277
+ });
278
+ }
279
+ return entries.length > 0 ? entries : undefined;
280
+ }
98
281
  function toItemType(value, typeNames) {
99
282
  const normalized = toNonEmptyString(value)?.toLowerCase();
100
283
  const fallbackType = typeNames.find((entry) => entry.toLowerCase() === "task") ?? typeNames[0] ?? "Task";
@@ -224,13 +407,13 @@ async function importTodoCandidate(candidate, runtime) {
224
407
  regression: toBoolean(candidate.frontMatter.regression),
225
408
  customer_impact: toNonEmptyString(candidate.frontMatter.customer_impact),
226
409
  close_reason: toNonEmptyString(candidate.frontMatter.close_reason),
227
- dependencies: Array.isArray(candidate.frontMatter.dependencies) ? candidate.frontMatter.dependencies : undefined,
228
- comments: Array.isArray(candidate.frontMatter.comments) ? candidate.frontMatter.comments : undefined,
229
- notes: Array.isArray(candidate.frontMatter.notes) ? candidate.frontMatter.notes : undefined,
230
- learnings: Array.isArray(candidate.frontMatter.learnings) ? candidate.frontMatter.learnings : undefined,
231
- files: Array.isArray(candidate.frontMatter.files) ? candidate.frontMatter.files : undefined,
232
- docs: Array.isArray(candidate.frontMatter.docs) ? candidate.frontMatter.docs : undefined,
233
- tests: Array.isArray(candidate.frontMatter.tests) ? candidate.frontMatter.tests : undefined,
410
+ dependencies: toDependencyEntries(candidate.frontMatter.dependencies, createdAt),
411
+ comments: toLogEntries(candidate.frontMatter.comments, createdAt, runtime.author),
412
+ notes: toLogEntries(candidate.frontMatter.notes, createdAt, runtime.author),
413
+ learnings: toLogEntries(candidate.frontMatter.learnings, createdAt, runtime.author),
414
+ files: toLinkedFiles(candidate.frontMatter.files),
415
+ docs: toLinkedDocs(candidate.frontMatter.docs),
416
+ tests: toLinkedTests(candidate.frontMatter.tests),
234
417
  }),
235
418
  body: candidate.body,
236
419
  });
@@ -261,7 +444,7 @@ export async function runTodosImport(options, global) {
261
444
  entries = await fs.readdir(sourceFolder, { withFileTypes: true });
262
445
  }
263
446
  catch {
264
- throw new PmCliError(`Todos source folder not found at ${sourceFolder}`, EXIT_CODE.NOT_FOUND);
447
+ throw new PmCliError(`Todos source folder not found at ${sourceFolder}. Use --folder <path> to point at the directory of Todo markdown files.`, EXIT_CODE.NOT_FOUND);
265
448
  }
266
449
  const author = selectAuthor(toNonEmptyString(options.author), settings.author_default);
267
450
  const message = toNonEmptyString(options.message) ?? "Import from todos markdown";
@@ -3,6 +3,7 @@ import type { Dirent } from "node:fs";
3
3
  import path from "node:path";
4
4
  import {
5
5
  CONFIDENCE_TEXT_VALUES,
6
+ DEPENDENCY_KIND_VALUES,
6
7
  EXIT_CODE,
7
8
  ISSUE_SEVERITY_VALUES,
8
9
  PmCliError,
@@ -36,6 +37,10 @@ import {
36
37
  type ItemMetadata,
37
38
  type ItemStatus,
38
39
  type ItemType,
40
+ type LinkedDoc,
41
+ type LinkedFile,
42
+ type LinkedTest,
43
+ type LogNote,
39
44
  type PmSettings,
40
45
  } from "../../../../src/sdk/index.js";
41
46
 
@@ -194,6 +199,201 @@ function toBoolean(value: unknown): boolean | undefined {
194
199
 
195
200
  const toTags = toImportTags;
196
201
 
202
+ function toLinkScope(value: unknown): "project" | "global" {
203
+ return toNonEmptyString(value)?.toLowerCase() === "global" ? "global" : "project";
204
+ }
205
+
206
+ function toStringList(value: unknown): string[] | undefined {
207
+ if (!Array.isArray(value)) {
208
+ return undefined;
209
+ }
210
+ const entries = value
211
+ .map((entry) => toNonEmptyString(entry))
212
+ .filter((entry): entry is string => entry !== undefined);
213
+ return entries.length > 0 ? entries : undefined;
214
+ }
215
+
216
+ function toStringMap(value: unknown): Record<string, string> | undefined {
217
+ if (!isRecord(value)) {
218
+ return undefined;
219
+ }
220
+ const entries = Object.entries(value)
221
+ .map(([key, entryValue]) => [key.trim(), toNonEmptyString(entryValue)] as const)
222
+ .filter((entry): entry is readonly [string, string] => entry[0].length > 0 && entry[1] !== undefined);
223
+ return entries.length > 0 ? Object.fromEntries(entries) : undefined;
224
+ }
225
+
226
+ function toNumberMap(value: unknown): Record<string, number> | undefined {
227
+ if (!isRecord(value)) {
228
+ return undefined;
229
+ }
230
+ const entries = Object.entries(value)
231
+ .map(([key, entryValue]) => [key.trim(), toInteger(entryValue)] as const)
232
+ .filter((entry): entry is readonly [string, number] => entry[0].length > 0 && entry[1] !== undefined);
233
+ return entries.length > 0 ? Object.fromEntries(entries) : undefined;
234
+ }
235
+
236
+ function toDependencyEntries(value: unknown, fallbackCreatedAt: string): ItemMetadata["dependencies"] {
237
+ if (!Array.isArray(value)) {
238
+ return undefined;
239
+ }
240
+ const dependencies: NonNullable<ItemMetadata["dependencies"]> = [];
241
+ for (const entry of value) {
242
+ if (!isRecord(entry)) {
243
+ continue;
244
+ }
245
+ const id = toNonEmptyString(entry.id);
246
+ if (!id) {
247
+ continue;
248
+ }
249
+ const normalizedKind = toNonEmptyString(entry.kind)?.toLowerCase();
250
+ const kind =
251
+ normalizedKind && DEPENDENCY_KIND_VALUES.includes(normalizedKind as (typeof DEPENDENCY_KIND_VALUES)[number])
252
+ ? (normalizedKind as (typeof DEPENDENCY_KIND_VALUES)[number])
253
+ : "related";
254
+ dependencies.push({
255
+ id,
256
+ kind,
257
+ created_at: toIsoString(entry.created_at) ?? fallbackCreatedAt,
258
+ author: toNonEmptyString(entry.author),
259
+ source_kind: toNonEmptyString(entry.source_kind),
260
+ });
261
+ }
262
+ return dependencies.length > 0 ? dependencies : undefined;
263
+ }
264
+
265
+ function toLogEntries(value: unknown, fallbackCreatedAt: string, fallbackAuthor: string): LogNote[] | undefined {
266
+ if (!Array.isArray(value)) {
267
+ return undefined;
268
+ }
269
+ const entries = value
270
+ .map((entry) => {
271
+ if (typeof entry === "string") {
272
+ const text = toNonEmptyString(entry);
273
+ return text
274
+ ? {
275
+ created_at: fallbackCreatedAt,
276
+ author: fallbackAuthor,
277
+ text,
278
+ }
279
+ : undefined;
280
+ }
281
+ if (!isRecord(entry)) {
282
+ return undefined;
283
+ }
284
+ const text = toNonEmptyString(entry.text);
285
+ if (!text) {
286
+ return undefined;
287
+ }
288
+ return {
289
+ created_at: toIsoString(entry.created_at) ?? fallbackCreatedAt,
290
+ author: toNonEmptyString(entry.author) ?? fallbackAuthor,
291
+ text,
292
+ };
293
+ })
294
+ .filter((entry): entry is LogNote => entry !== undefined);
295
+ return entries.length > 0 ? entries : undefined;
296
+ }
297
+
298
+ function toLinkedFiles(value: unknown): LinkedFile[] | undefined {
299
+ if (!Array.isArray(value)) {
300
+ return undefined;
301
+ }
302
+ const entries = value
303
+ .map((entry) => {
304
+ if (typeof entry === "string") {
305
+ const filePath = toNonEmptyString(entry);
306
+ return filePath ? { path: filePath, scope: "project" } : undefined;
307
+ }
308
+ if (!isRecord(entry)) {
309
+ return undefined;
310
+ }
311
+ const filePath = toNonEmptyString(entry.path);
312
+ if (!filePath) {
313
+ return undefined;
314
+ }
315
+ return {
316
+ path: filePath,
317
+ scope: toLinkScope(entry.scope),
318
+ note: toNonEmptyString(entry.note),
319
+ };
320
+ })
321
+ .filter((entry): entry is LinkedFile => entry !== undefined);
322
+ return entries.length > 0 ? entries : undefined;
323
+ }
324
+
325
+ function toLinkedDocs(value: unknown): LinkedDoc[] | undefined {
326
+ if (!Array.isArray(value)) {
327
+ return undefined;
328
+ }
329
+ const entries = value
330
+ .map((entry) => {
331
+ if (typeof entry === "string") {
332
+ const docPath = toNonEmptyString(entry);
333
+ return docPath ? { path: docPath, scope: "project" } : undefined;
334
+ }
335
+ if (!isRecord(entry)) {
336
+ return undefined;
337
+ }
338
+ const docPath = toNonEmptyString(entry.path);
339
+ if (!docPath) {
340
+ return undefined;
341
+ }
342
+ return {
343
+ path: docPath,
344
+ scope: toLinkScope(entry.scope),
345
+ note: toNonEmptyString(entry.note),
346
+ };
347
+ })
348
+ .filter((entry): entry is LinkedDoc => entry !== undefined);
349
+ return entries.length > 0 ? entries : undefined;
350
+ }
351
+
352
+ function toLinkedTests(value: unknown): LinkedTest[] | undefined {
353
+ if (!Array.isArray(value)) {
354
+ return undefined;
355
+ }
356
+ const entries: LinkedTest[] = [];
357
+ for (const entry of value) {
358
+ if (typeof entry === "string") {
359
+ const command = toNonEmptyString(entry);
360
+ if (command) {
361
+ entries.push({ command, scope: "project" });
362
+ }
363
+ continue;
364
+ }
365
+ if (!isRecord(entry)) {
366
+ continue;
367
+ }
368
+ const command = toNonEmptyString(entry.command);
369
+ const testPath = toNonEmptyString(entry.path);
370
+ if (!command && !testPath) {
371
+ continue;
372
+ }
373
+ const timeoutSeconds = toInteger(entry.timeout_seconds);
374
+ const pmContextMode = toNormalizedEnum(entry.pm_context_mode, ["schema", "tracker", "auto"] as const);
375
+ entries.push({
376
+ command,
377
+ path: testPath,
378
+ scope: toLinkScope(entry.scope),
379
+ timeout_seconds: timeoutSeconds !== undefined && timeoutSeconds > 0 ? timeoutSeconds : undefined,
380
+ pm_context_mode: pmContextMode,
381
+ env_set: toStringMap(entry.env_set),
382
+ env_clear: toStringList(entry.env_clear),
383
+ shared_host_safe: toBoolean(entry.shared_host_safe),
384
+ assert_stdout_contains: toStringList(entry.assert_stdout_contains),
385
+ assert_stdout_regex: toStringList(entry.assert_stdout_regex),
386
+ assert_stderr_contains: toStringList(entry.assert_stderr_contains),
387
+ assert_stderr_regex: toStringList(entry.assert_stderr_regex),
388
+ assert_stdout_min_lines: toInteger(entry.assert_stdout_min_lines),
389
+ assert_json_field_equals: toStringMap(entry.assert_json_field_equals),
390
+ assert_json_field_gte: toNumberMap(entry.assert_json_field_gte),
391
+ note: toNonEmptyString(entry.note),
392
+ });
393
+ }
394
+ return entries.length > 0 ? entries : undefined;
395
+ }
396
+
197
397
  function toItemType(value: unknown, typeNames: string[]): ItemType {
198
398
  const normalized = toNonEmptyString(value)?.toLowerCase();
199
399
  const fallbackType = typeNames.find((entry) => entry.toLowerCase() === "task") ?? typeNames[0] ?? "Task";
@@ -342,13 +542,13 @@ async function importTodoCandidate(candidate: ParsedTodoCandidate, runtime: Todo
342
542
  regression: toBoolean(candidate.frontMatter.regression),
343
543
  customer_impact: toNonEmptyString(candidate.frontMatter.customer_impact),
344
544
  close_reason: toNonEmptyString(candidate.frontMatter.close_reason),
345
- dependencies: Array.isArray(candidate.frontMatter.dependencies) ? (candidate.frontMatter.dependencies as any[]) : undefined,
346
- comments: Array.isArray(candidate.frontMatter.comments) ? (candidate.frontMatter.comments as any[]) : undefined,
347
- notes: Array.isArray(candidate.frontMatter.notes) ? (candidate.frontMatter.notes as any[]) : undefined,
348
- learnings: Array.isArray(candidate.frontMatter.learnings) ? (candidate.frontMatter.learnings as any[]) : undefined,
349
- files: Array.isArray(candidate.frontMatter.files) ? (candidate.frontMatter.files as any[]) : undefined,
350
- docs: Array.isArray(candidate.frontMatter.docs) ? (candidate.frontMatter.docs as any[]) : undefined,
351
- tests: Array.isArray(candidate.frontMatter.tests) ? (candidate.frontMatter.tests as any[]) : undefined,
545
+ dependencies: toDependencyEntries(candidate.frontMatter.dependencies, createdAt),
546
+ comments: toLogEntries(candidate.frontMatter.comments, createdAt, runtime.author),
547
+ notes: toLogEntries(candidate.frontMatter.notes, createdAt, runtime.author),
548
+ learnings: toLogEntries(candidate.frontMatter.learnings, createdAt, runtime.author),
549
+ files: toLinkedFiles(candidate.frontMatter.files),
550
+ docs: toLinkedDocs(candidate.frontMatter.docs),
551
+ tests: toLinkedTests(candidate.frontMatter.tests),
352
552
  } as ItemMetadata),
353
553
  body: candidate.body,
354
554
  });
@@ -383,7 +583,10 @@ export async function runTodosImport(options: TodosImportOptions, global: Global
383
583
  try {
384
584
  entries = await fs.readdir(sourceFolder, { withFileTypes: true });
385
585
  } catch {
386
- throw new PmCliError(`Todos source folder not found at ${sourceFolder}`, EXIT_CODE.NOT_FOUND);
586
+ throw new PmCliError(
587
+ `Todos source folder not found at ${sourceFolder}. Use --folder <path> to point at the directory of Todo markdown files.`,
588
+ EXIT_CODE.NOT_FOUND,
589
+ );
387
590
  }
388
591
 
389
592
  const author = selectAuthor(toNonEmptyString(options.author), settings.author_default);
@@ -1,18 +0,0 @@
1
- import {
2
- _testOnly,
3
- runActivity
4
- } from "./chunk-OURX4WVG.js";
5
- import "./chunk-QTWWHFI3.js";
6
- import "./chunk-2RI3BDFK.js";
7
- import "./chunk-DYZKSIVX.js";
8
- import "./chunk-X7RKOJXL.js";
9
- import "./chunk-5NS6TJ2F.js";
10
- import "./chunk-QSH34DSQ.js";
11
- import "./chunk-SO2IOH37.js";
12
- import "./chunk-MTGMNUMJ.js";
13
- import "./chunk-5QLHQK7V.js";
14
- export {
15
- _testOnly,
16
- runActivity
17
- };
18
- //# sourceMappingURL=activity-62I26XZB.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../../../../core/history/replay.ts"],
4
- "sourcesContent": ["/**\n * @module core/history/replay\n *\n * Implements append-only history and replay behavior for Replay.\n */\nimport jsonPatch from \"fast-json-patch\";\nimport { FRONT_MATTER_KEY_ORDER } from \"../shared/constants.js\";\nimport { canonicalDocument } from \"../item/item-format.js\";\nimport { toItemRecord } from \"../item/item-record.js\";\nimport { orderObject, sha256Hex, stableStringify } from \"../shared/serialization.js\";\nimport { hashDocument } from \"./history.js\";\nimport type { HistoryEntry, HistoryPatchOp, ItemDocument, ItemMetadata } from \"../../types/index.js\";\n\n/**\n * Shared history replay/patch mechanics single-sourced for the history, restore,\n * history-redact, and history-repair commands plus the health/validate drift checks.\n *\n * Each command keeps its own thin error-formatting wrapper so the exact CLI error\n * contracts (restore's rich patch-failure context, redact's op tag, history's\n * generic message) are preserved; only the underlying replay/patch logic is shared.\n */\n\nexport interface ReplayDocument {\n metadata: Record<string, unknown>;\n body: string;\n}\n\nexport const EMPTY_REPLAY_DOCUMENT: ReplayDocument = {\n metadata: {},\n body: \"\",\n};\n\n/**\n * Implements clone empty replay document for the public runtime surface of this module.\n */\nexport function cloneEmptyReplayDocument(): ReplayDocument {\n return structuredClone(EMPTY_REPLAY_DOCUMENT);\n}\n\n/**\n * Implements replay hash for the public runtime surface of this module.\n */\nexport function replayHash(document: ReplayDocument): string {\n try {\n return hashDocument({\n metadata: document.metadata as unknown as ItemMetadata,\n body: document.body,\n });\n } catch {\n // Legacy/malformed replay states (for example a stream whose first entry never\n // established a full `create` document, so the canonicalizer cannot normalize it)\n // cannot be canonically hashed. Fall back to a deterministic structural hash so\n // re-anchor and verification stay internally consistent for these streams. Fully\n // formed documents always take the canonical path above, so valid streams are\n // unaffected.\n return sha256Hex(stableStringify({ replay_fallback: true, metadata: document.metadata, body: document.body }));\n }\n}\n\n/**\n * Implements replay to item document for the public runtime surface of this module.\n */\nexport function replayToItemDocument(document: ReplayDocument): ItemDocument {\n return {\n metadata: document.metadata as unknown as ItemMetadata,\n body: document.body,\n };\n}\n\n/**\n * Canonicalize an item document into the ordered replay form used when comparing\n * a replayed chain against the on-disk item (restore + history-repair reconciliation).\n */\nexport function toReplayDocument(document: ItemDocument): ReplayDocument {\n if (!document.metadata || Object.keys(document.metadata).length === 0) {\n return {\n metadata: {},\n body: document.body ?? \"\",\n };\n }\n const canonical = canonicalDocument(document);\n return {\n metadata: orderObject(toItemRecord(canonical.metadata), FRONT_MATTER_KEY_ORDER),\n body: canonical.body,\n };\n}\n\n/**\n * Implements normalize replay patch path for the public runtime surface of this module.\n */\nexport function normalizeReplayPatchPath(path: string): string {\n if (path === \"/front_matter\") {\n return \"/metadata\";\n }\n if (path.startsWith(\"/front_matter/\")) {\n return `/metadata/${path.slice(\"/front_matter/\".length)}`;\n }\n return path;\n}\n\nfunction isHistoryPatchOp(value: unknown): value is HistoryPatchOp {\n return (\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as { op?: unknown }).op === \"string\" &&\n typeof (value as { path?: unknown }).path === \"string\"\n );\n}\n\n/**\n * Implements normalize replay patch ops for the public runtime surface of this module.\n */\nexport function normalizeReplayPatchOps(patch: HistoryPatchOp[] | unknown): HistoryPatchOp[] {\n if (!Array.isArray(patch)) {\n return [];\n }\n return patch.filter(isHistoryPatchOp).map((operation) => ({\n ...operation,\n path: normalizeReplayPatchPath(operation.path),\n from: typeof operation.from === \"string\" ? normalizeReplayPatchPath(operation.from) : undefined,\n }));\n}\n\nfunction isReplayDocumentShape(value: unknown): value is { metadata: Record<string, unknown>; body: string } {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"metadata\" in value &&\n \"body\" in value &&\n typeof (value as { body: unknown }).body === \"string\" &&\n typeof (value as { metadata: unknown }).metadata === \"object\" &&\n (value as { metadata: unknown }).metadata !== null\n );\n}\n\n/**\n * Restricts replay apply result values accepted by command, SDK, and storage contracts.\n */\nexport type ReplayApplyResult =\n | { ok: true; document: ReplayDocument }\n | { ok: false; error: unknown };\n\n/**\n * Strictly apply a history patch (front_matter->metadata normalized) to a replay\n * document. Returns a result envelope rather than throwing so each caller can\n * format its own error contract.\n */\nexport function tryApplyReplayPatch(current: ReplayDocument, patch: HistoryPatchOp[]): ReplayApplyResult {\n try {\n const normalizedPatch = normalizeReplayPatchOps(patch);\n const applied = jsonPatch.applyPatch(\n structuredClone(current),\n normalizedPatch as jsonPatch.Operation[],\n true,\n false,\n ).newDocument as unknown;\n if (!isReplayDocumentShape(applied)) {\n return { ok: false, error: new Error(\"history_replay_invalid_document_shape\") };\n }\n return { ok: true, document: { metadata: applied.metadata, body: applied.body } };\n } catch (error) {\n return { ok: false, error };\n }\n}\n\n/**\n * Deterministically verify a history chain: each entry's before_hash must equal\n * the prior replayed after_hash, the patch must strictly apply, and the recorded\n * after_hash must equal the replayed result.\n */\nexport function verifyHistoryChain(entries: HistoryEntry[]): { ok: boolean; errors: string[] } {\n let replay = cloneEmptyReplayDocument();\n for (let index = 0; index < entries.length; index += 1) {\n const entry = entries[index];\n if (replayHash(replay) !== entry.before_hash) {\n return {\n ok: false,\n errors: [`verify_failed:before_hash_mismatch:entry_${index + 1}`],\n };\n }\n const applied = tryApplyReplayPatch(replay, entry.patch);\n if (!applied.ok) {\n return {\n ok: false,\n errors: [`verify_failed:patch_apply_failed:entry_${index + 1}`],\n };\n }\n replay = applied.document;\n if (replayHash(replay) !== entry.after_hash) {\n return {\n ok: false,\n errors: [`verify_failed:after_hash_mismatch:entry_${index + 1}`],\n };\n }\n }\n return { ok: true, errors: [] };\n}\n\n/**\n * Documents the lenient apply result payload exchanged by command, SDK, and package integrations.\n */\nexport interface LenientApplyResult {\n document: ReplayDocument;\n convertedReplaceToAdd: number;\n skippedOps: number;\n}\n\nfunction tryApplySingleOp(document: unknown, op: HistoryPatchOp): { ok: true; document: unknown } | { ok: false } {\n try {\n const applied = jsonPatch.applyPatch(\n structuredClone(document),\n [op as jsonPatch.Operation],\n true,\n false,\n ).newDocument as unknown;\n return { ok: true, document: applied };\n } catch {\n return { ok: false };\n }\n}\n\n/**\n * Apply a legacy patch op-by-op, recovering from drift that strict replay rejects:\n * a `replace` whose path no longer exists is retried as `add`, and any op that\n * still cannot apply against the current replay state is skipped. The resulting\n * document is what the repaired entry's recomputed patch should target.\n */\nexport function lenientApplyReplayPatch(current: ReplayDocument, patch: HistoryPatchOp[]): LenientApplyResult {\n let working: unknown = structuredClone(current);\n let convertedReplaceToAdd = 0;\n let skippedOps = 0;\n\n for (const op of normalizeReplayPatchOps(patch)) {\n const direct = tryApplySingleOp(working, op);\n if (direct.ok) {\n working = direct.document;\n continue;\n }\n if (op.op === \"replace\") {\n const asAdd = tryApplySingleOp(working, { ...op, op: \"add\" });\n if (asAdd.ok) {\n working = asAdd.document;\n convertedReplaceToAdd += 1;\n continue;\n }\n }\n skippedOps += 1;\n }\n\n const candidate = working as { metadata?: unknown; body?: unknown };\n const document: ReplayDocument = {\n metadata:\n typeof candidate.metadata === \"object\" && candidate.metadata !== null\n ? (candidate.metadata as Record<string, unknown>)\n : {},\n body: typeof candidate.body === \"string\" ? candidate.body : current.body,\n };\n return { document, convertedReplaceToAdd, skippedOps };\n}\n\n/**\n * Documents the reanchor entry detail payload exchanged by command, SDK, and package integrations.\n */\nexport interface ReanchorEntryDetail {\n index: number;\n rehashed: boolean;\n patch_repaired: boolean;\n converted_replace_to_add: number;\n skipped_ops: number;\n}\n\n/**\n * Documents the reanchor result payload exchanged by command, SDK, and package integrations.\n */\nexport interface ReanchorResult {\n entries: HistoryEntry[];\n finalDocument: ReplayDocument;\n entriesRehashed: number;\n entriesPatchRepaired: number;\n convertedReplaceToAdd: number;\n skippedOps: number;\n details: ReanchorEntryDetail[];\n}\n\n/**\n * Re-anchor a drifted history chain: replay every entry from empty, recompute the\n * before/after hashes, and only rewrite a patch when the original op set no longer\n * strictly applies (legacy drift). Clean entries keep their patch verbatim so the\n * on-disk diff stays minimal. The returned chain verifies via verifyHistoryChain.\n */\nexport function reanchorHistoryEntries(entries: HistoryEntry[]): ReanchorResult {\n let replay = cloneEmptyReplayDocument();\n const rewritten: HistoryEntry[] = [];\n const details: ReanchorEntryDetail[] = [];\n let entriesRehashed = 0;\n let entriesPatchRepaired = 0;\n let convertedReplaceToAdd = 0;\n let skippedOps = 0;\n\n for (let index = 0; index < entries.length; index += 1) {\n const entry = entries[index];\n const beforeHash = replayHash(replay);\n const strict = tryApplyReplayPatch(replay, entry.patch);\n\n let next: ReplayDocument;\n let outPatch: HistoryPatchOp[];\n let patchRepaired = false;\n let entryConverted = 0;\n let entrySkipped = 0;\n\n if (strict.ok) {\n next = strict.document;\n outPatch = entry.patch;\n } else {\n const lenient = lenientApplyReplayPatch(replay, entry.patch);\n next = lenient.document;\n outPatch = jsonPatch.compare(replay, next) as HistoryPatchOp[];\n patchRepaired = true;\n entryConverted = lenient.convertedReplaceToAdd;\n entrySkipped = lenient.skippedOps;\n convertedReplaceToAdd += entryConverted;\n skippedOps += entrySkipped;\n entriesPatchRepaired += 1;\n }\n\n const afterHash = replayHash(next);\n const rehashed = beforeHash !== entry.before_hash || afterHash !== entry.after_hash;\n if (rehashed) {\n entriesRehashed += 1;\n }\n\n rewritten.push({\n ...entry,\n patch: outPatch,\n before_hash: beforeHash,\n after_hash: afterHash,\n });\n details.push({\n index: index + 1,\n rehashed,\n patch_repaired: patchRepaired,\n converted_replace_to_add: entryConverted,\n skipped_ops: entrySkipped,\n });\n replay = next;\n }\n\n return {\n entries: rewritten,\n finalDocument: replay,\n entriesRehashed,\n entriesPatchRepaired,\n convertedReplaceToAdd,\n skippedOps,\n details,\n };\n}\n\n/**\n * Implements history entries to raw for the public runtime surface of this module.\n */\nexport function historyEntriesToRaw(entries: HistoryEntry[]): string {\n if (entries.length === 0) {\n return \"\";\n }\n return `${entries.map((entry) => JSON.stringify(entry)).join(\"\\n\")}\\n`;\n}\n"],
5
- "mappings": "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",
6
- "names": []
7
- }