@unbrained/pm-cli 2026.6.19 → 2026.6.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 (517) hide show
  1. package/CHANGELOG.md +311 -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/gc.d.ts +12 -1
  19. package/dist/cli/commands/gc.js +53 -6
  20. package/dist/cli/commands/gc.js.map +1 -1
  21. package/dist/cli/commands/health.js +14 -8
  22. package/dist/cli/commands/health.js.map +1 -1
  23. package/dist/cli/commands/index.d.ts +1 -0
  24. package/dist/cli/commands/index.js +3 -2
  25. package/dist/cli/commands/index.js.map +1 -1
  26. package/dist/cli/commands/linked-artifacts.js +13 -3
  27. package/dist/cli/commands/linked-artifacts.js.map +1 -1
  28. package/dist/cli/commands/list.js +12 -9
  29. package/dist/cli/commands/list.js.map +1 -1
  30. package/dist/cli/commands/plan.js +2 -2
  31. package/dist/cli/commands/plan.js.map +1 -1
  32. package/dist/cli/commands/restore.js +5 -11
  33. package/dist/cli/commands/restore.js.map +1 -1
  34. package/dist/cli/commands/search.d.ts +39 -1
  35. package/dist/cli/commands/search.js +89 -12
  36. package/dist/cli/commands/search.js.map +1 -1
  37. package/dist/cli/commands/update.js +96 -58
  38. package/dist/cli/commands/update.js.map +1 -1
  39. package/dist/cli/extension-command-help.d.ts +9 -0
  40. package/dist/cli/extension-command-help.js +13 -2
  41. package/dist/cli/extension-command-help.js.map +1 -1
  42. package/dist/cli/extension-command-options.d.ts +8 -0
  43. package/dist/cli/extension-command-options.js +27 -2
  44. package/dist/cli/extension-command-options.js.map +1 -1
  45. package/dist/cli/help-content.js +15 -2
  46. package/dist/cli/help-content.js.map +1 -1
  47. package/dist/cli/main.d.ts +12 -0
  48. package/dist/cli/main.js +49 -9
  49. package/dist/cli/main.js.map +1 -1
  50. package/dist/cli/register-list-query.js +34 -4
  51. package/dist/cli/register-list-query.js.map +1 -1
  52. package/dist/cli/register-operations.js +3 -3
  53. package/dist/cli/register-operations.js.map +1 -1
  54. package/dist/cli-bundle/chunks/activity-7G7NNNZQ.js +18 -0
  55. package/dist/cli-bundle/chunks/{activity-XJ7WRNWS.js → activity-KEEITOTB.js} +11 -11
  56. package/dist/cli-bundle/chunks/{aggregate-OFT4YVB6.js → aggregate-5BTHOHW2.js} +10 -10
  57. package/dist/cli-bundle/chunks/{aggregate-LBCWF6UJ.js → aggregate-GB2LJNTZ.js} +10 -10
  58. package/dist/cli-bundle/chunks/{append-BP2ARHOK.js → append-BBM4MNVD.js} +8 -8
  59. package/dist/cli-bundle/chunks/{append-5U3XR5SD.js → append-BFV5UYWS.js} +8 -8
  60. package/dist/cli-bundle/chunks/{chunk-ZZEM2PH7.js → chunk-26OQTCGH.js} +19 -14
  61. package/dist/cli-bundle/chunks/chunk-26OQTCGH.js.map +1 -0
  62. package/dist/cli-bundle/chunks/{chunk-RVG3WLY3.js → chunk-2LUNPA3U.js} +2 -2
  63. package/dist/cli-bundle/chunks/{chunk-OURX4WVG.js → chunk-2QJLN4KM.js} +7 -7
  64. package/dist/cli-bundle/chunks/{search-2JX776KX.js → chunk-2ZY5SLNR.js} +184 -23
  65. package/dist/cli-bundle/chunks/chunk-2ZY5SLNR.js.map +1 -0
  66. package/dist/cli-bundle/chunks/{chunk-AVMSP2HH.js → chunk-3KVCMB2M.js} +2 -2
  67. package/dist/cli-bundle/chunks/{chunk-FVZSUIN5.js → chunk-3WAKNI2W.js} +3 -3
  68. package/dist/cli-bundle/chunks/{chunk-H3DP6OUM.js → chunk-4KFL5OYK.js} +3 -3
  69. package/dist/cli-bundle/chunks/{chunk-VG3B2CYD.js → chunk-4PW4C3ZB.js} +2 -2
  70. package/dist/cli-bundle/chunks/{chunk-SDUZTZ55.js → chunk-4S4INK3B.js} +7 -7
  71. package/dist/cli-bundle/chunks/{chunk-QCHNPN24.js → chunk-4YMX7XFI.js} +7 -5
  72. package/dist/cli-bundle/chunks/{chunk-QSH34DSQ.js → chunk-5MWA46UN.js} +3 -3
  73. package/dist/cli-bundle/chunks/{chunk-UIMLAFOE.js → chunk-5XK2RYJR.js} +7 -7
  74. package/dist/cli-bundle/chunks/{chunk-B2NEFANY.js → chunk-6DZO5NN7.js} +3 -3
  75. package/dist/cli-bundle/chunks/{chunk-VP4Z36GO.js → chunk-6FSPWUBI.js} +2 -2
  76. package/dist/cli-bundle/chunks/{chunk-MPEWACTG.js → chunk-6KARQMC6.js} +2 -2
  77. package/dist/cli-bundle/chunks/{chunk-N7LDJRB4.js → chunk-6KSFULO6.js} +2 -2
  78. package/dist/cli-bundle/chunks/{chunk-XV6N3QND.js → chunk-6LTSLEHD.js} +2 -2
  79. package/dist/cli-bundle/chunks/{chunk-X26ODPU4.js → chunk-6Y7IQ6XN.js} +14 -18
  80. package/dist/cli-bundle/chunks/chunk-6Y7IQ6XN.js.map +7 -0
  81. package/dist/cli-bundle/chunks/{chunk-USKTNI7P.js → chunk-7MMXBIRZ.js} +2 -2
  82. package/dist/cli-bundle/chunks/{chunk-UCNEPMPY.js → chunk-ACULWT7G.js} +105 -66
  83. package/dist/cli-bundle/chunks/chunk-ACULWT7G.js.map +7 -0
  84. package/dist/cli-bundle/chunks/{chunk-2K56AWDP.js → chunk-AOCYDQLT.js} +5 -5
  85. package/dist/cli-bundle/chunks/{chunk-ZBVYKWT2.js → chunk-ATRXPXAL.js} +15 -15
  86. package/dist/cli-bundle/chunks/{chunk-A5JPMD4Q.js → chunk-AW4PYYNF.js} +2 -2
  87. package/dist/cli-bundle/chunks/{chunk-I2VJM36R.js → chunk-AZ75OVK4.js} +20 -21
  88. package/dist/cli-bundle/chunks/chunk-AZ75OVK4.js.map +1 -0
  89. package/dist/cli-bundle/chunks/{chunk-MTGMNUMJ.js → chunk-B3LROPTV.js} +2 -2
  90. package/dist/cli-bundle/chunks/{chunk-NPNNW5TU.js → chunk-BBSUVIIT.js} +8 -8
  91. package/dist/cli-bundle/chunks/{chunk-47BYN6CA.js → chunk-BYNJWB5F.js} +7 -7
  92. package/dist/cli-bundle/chunks/{chunk-PSWSQHM7.js → chunk-BZWIDTDE.js} +15 -19
  93. package/dist/cli-bundle/chunks/chunk-BZWIDTDE.js.map +1 -0
  94. package/dist/cli-bundle/chunks/{chunk-S673PVHD.js → chunk-CNPWCUDR.js} +3 -3
  95. package/dist/cli-bundle/chunks/{chunk-TYQBGXH2.js → chunk-DKWIPIJY.js} +2 -2
  96. package/dist/cli-bundle/chunks/{search-AZR2JITW.js → chunk-DYOJJTCG.js} +190 -22
  97. package/dist/cli-bundle/chunks/chunk-DYOJJTCG.js.map +7 -0
  98. package/dist/cli-bundle/chunks/{chunk-Y4IBSEQ2.js → chunk-E4E7UQBT.js} +20 -8
  99. package/dist/cli-bundle/chunks/chunk-E4E7UQBT.js.map +1 -0
  100. package/dist/cli-bundle/chunks/{chunk-HMQMRHQJ.js → chunk-EKMHDL6Z.js} +8 -8
  101. package/dist/cli-bundle/chunks/{chunk-LIVRA6VG.js → chunk-EOFROIC5.js} +7 -7
  102. package/dist/cli-bundle/chunks/{chunk-NNMBNN6Q.js → chunk-ETJKPURB.js} +7 -5
  103. package/dist/cli-bundle/chunks/{chunk-2E3KSWFG.js → chunk-F4EYOSNC.js} +2 -2
  104. package/dist/cli-bundle/chunks/{chunk-DJ3YYLHG.js → chunk-FA5O2DEG.js} +5 -5
  105. package/dist/cli-bundle/chunks/{chunk-QTWWHFI3.js → chunk-FBBPCSJM.js} +8 -8
  106. package/dist/cli-bundle/chunks/{chunk-EMFDZ7N3.js → chunk-FSOJCFDS.js} +3 -3
  107. package/dist/cli-bundle/chunks/{chunk-M35R7LFX.js → chunk-FXKPUMIR.js} +5 -5
  108. package/dist/cli-bundle/chunks/{chunk-YOGXK3ON.js → chunk-GF44HVZL.js} +18 -13
  109. package/dist/cli-bundle/chunks/chunk-GF44HVZL.js.map +7 -0
  110. package/dist/cli-bundle/chunks/{chunk-UA4ANRJY.js → chunk-H3ZTSYPA.js} +71 -13
  111. package/dist/cli-bundle/chunks/chunk-H3ZTSYPA.js.map +7 -0
  112. package/dist/cli-bundle/chunks/{chunk-II3WDRCM.js → chunk-HWHZ7EY7.js} +3 -3
  113. package/dist/cli-bundle/chunks/{chunk-7R5YKVKO.js → chunk-ICEWMJYH.js} +7 -7
  114. package/dist/cli-bundle/chunks/{chunk-UMTPQMEG.js → chunk-II4BRHKM.js} +3 -3
  115. package/dist/cli-bundle/chunks/{chunk-GDOTTY2S.js → chunk-IWKD7B33.js} +19 -2
  116. package/dist/cli-bundle/chunks/chunk-IWKD7B33.js.map +7 -0
  117. package/dist/cli-bundle/chunks/{chunk-QG6M6XQE.js → chunk-J7VSEFWB.js} +3 -3
  118. package/dist/cli-bundle/chunks/{chunk-22YA6GCA.js → chunk-K2LBDYDC.js} +2 -2
  119. package/dist/cli-bundle/chunks/{chunk-BQVESTOG.js → chunk-KCJZREBI.js} +2 -2
  120. package/dist/cli-bundle/chunks/{chunk-YWAYOWDQ.js → chunk-LTUB7ARL.js} +72 -14
  121. package/dist/cli-bundle/chunks/chunk-LTUB7ARL.js.map +1 -0
  122. package/dist/cli-bundle/chunks/{chunk-DVUU3AHP.js → chunk-MFCFHL27.js} +17 -6
  123. package/dist/cli-bundle/chunks/chunk-MFCFHL27.js.map +1 -0
  124. package/dist/cli-bundle/chunks/{chunk-5P2LQV2F.js → chunk-MTQK5ZSB.js} +2 -2
  125. package/dist/cli-bundle/chunks/{chunk-LEC57E7K.js → chunk-NCGQ27PK.js} +2 -2
  126. package/dist/cli-bundle/chunks/{chunk-2RI3BDFK.js → chunk-NKTUBA2C.js} +10 -9
  127. package/dist/cli-bundle/chunks/chunk-NKTUBA2C.js.map +7 -0
  128. package/dist/cli-bundle/chunks/{chunk-5LZPDRFW.js → chunk-NMQNXH4U.js} +5 -5
  129. package/dist/cli-bundle/chunks/{chunk-COHNQLB2.js → chunk-OLEP5TJH.js} +20 -3
  130. package/dist/cli-bundle/chunks/chunk-OLEP5TJH.js.map +1 -0
  131. package/dist/cli-bundle/chunks/{chunk-PRUB7RI4.js → chunk-OVSFW4KD.js} +3 -3
  132. package/dist/cli-bundle/chunks/{chunk-4L7Q4OVT.js → chunk-PF5GLFPU.js} +9 -9
  133. package/dist/cli-bundle/chunks/{chunk-YVYJQR6S.js → chunk-QUTJOHGK.js} +9 -9
  134. package/dist/cli-bundle/chunks/{chunk-5QLHQK7V.js → chunk-QWAJPGEI.js} +25 -26
  135. package/dist/cli-bundle/chunks/chunk-QWAJPGEI.js.map +7 -0
  136. package/dist/cli-bundle/chunks/{chunk-K5TD74VU.js → chunk-RADIHKJ3.js} +19 -7
  137. package/dist/cli-bundle/chunks/chunk-RADIHKJ3.js.map +7 -0
  138. package/dist/cli-bundle/chunks/{chunk-CSRFOIHG.js → chunk-RICT5QYR.js} +3 -3
  139. package/dist/cli-bundle/chunks/{chunk-OUG4CL4H.js → chunk-RNKUCHUQ.js} +8 -8
  140. package/dist/cli-bundle/chunks/{chunk-X7RKOJXL.js → chunk-SL233DQD.js} +6 -6
  141. package/dist/cli-bundle/chunks/{chunk-USVOBLGB.js → chunk-U3WTMYBX.js} +2 -2
  142. package/dist/cli-bundle/chunks/{chunk-DYZKSIVX.js → chunk-VE3BUO3R.js} +3 -3
  143. package/dist/cli-bundle/chunks/{chunk-FPQA4ZMA.js → chunk-VONJSFUW.js} +18 -7
  144. package/dist/cli-bundle/chunks/chunk-VONJSFUW.js.map +7 -0
  145. package/dist/cli-bundle/chunks/{chunk-RNWE2HZR.js → chunk-W2ZESOQE.js} +15 -15
  146. package/dist/cli-bundle/chunks/{chunk-4BFNWAMQ.js → chunk-WFOITX4A.js} +29 -12
  147. package/dist/cli-bundle/chunks/chunk-WFOITX4A.js.map +7 -0
  148. package/dist/cli-bundle/chunks/{chunk-FP7YLQ52.js → chunk-WMQBNVZL.js} +11 -10
  149. package/dist/cli-bundle/chunks/chunk-WMQBNVZL.js.map +1 -0
  150. package/dist/cli-bundle/chunks/{chunk-5SRID7DV.js → chunk-X3CD2VUI.js} +29 -12
  151. package/dist/cli-bundle/chunks/chunk-X3CD2VUI.js.map +1 -0
  152. package/dist/cli-bundle/chunks/{chunk-GL3QKIET.js → chunk-XKJDCJEH.js} +6 -6
  153. package/dist/cli-bundle/chunks/{chunk-SO2IOH37.js → chunk-XNQ3YH6N.js} +2 -2
  154. package/dist/cli-bundle/chunks/{chunk-ZGEWEO7B.js → chunk-XXGAWTH5.js} +2 -2
  155. package/dist/cli-bundle/chunks/{chunk-4EOS35RL.js → chunk-YBQF4CAW.js} +3 -3
  156. package/dist/cli-bundle/chunks/{chunk-MTDEEUGV.js → chunk-YT4Z2OVB.js} +3 -3
  157. package/dist/cli-bundle/chunks/{chunk-5NS6TJ2F.js → chunk-ZHCSGIUX.js} +2 -2
  158. package/dist/cli-bundle/chunks/{chunk-MAKOMXVM.js → chunk-ZYG4TR32.js} +106 -67
  159. package/dist/cli-bundle/chunks/chunk-ZYG4TR32.js.map +1 -0
  160. package/dist/cli-bundle/chunks/{claim-2BSYPJTJ.js → claim-G57ZJLZ4.js} +10 -10
  161. package/dist/cli-bundle/chunks/{claim-EZ6JKY5X.js → claim-TRSDQO6L.js} +10 -10
  162. package/dist/cli-bundle/chunks/{close-3TSX6BYF.js → close-4QMUQMON.js} +8 -8
  163. package/dist/cli-bundle/chunks/close-NNZZTZ5V.js +15 -0
  164. package/dist/cli-bundle/chunks/{close-many-B7DBVA46.js → close-many-3UWKJRQK.js} +15 -15
  165. package/dist/cli-bundle/chunks/{close-many-HB4UFCS3.js → close-many-A7U62CRI.js} +15 -15
  166. package/dist/cli-bundle/chunks/{comments-M7PAINZT.js → comments-4EM7XR74.js} +10 -10
  167. package/dist/cli-bundle/chunks/{comments-X7M7XM6I.js → comments-URWDZP2I.js} +10 -10
  168. package/dist/cli-bundle/chunks/{config-YICACPHA.js → config-GRJYZ2O3.js} +30 -10
  169. package/dist/cli-bundle/chunks/config-GRJYZ2O3.js.map +1 -0
  170. package/dist/cli-bundle/chunks/{config-UWF3KRP5.js → config-PSZ5GWAK.js} +29 -9
  171. package/dist/cli-bundle/chunks/config-PSZ5GWAK.js.map +7 -0
  172. package/dist/cli-bundle/chunks/{context-EGUGU4K7.js → context-A46YAV2F.js} +13 -13
  173. package/dist/cli-bundle/chunks/{context-V32ZAPL6.js → context-BCR34RKM.js} +13 -13
  174. package/dist/cli-bundle/chunks/{contracts-7G553BHP.js → contracts-HPT25X4D.js} +10 -8
  175. package/dist/cli-bundle/chunks/contracts-HPT25X4D.js.map +1 -0
  176. package/dist/cli-bundle/chunks/{contracts-B2YWYUV5.js → contracts-JOPCQNDP.js} +10 -8
  177. package/dist/cli-bundle/chunks/contracts-JOPCQNDP.js.map +7 -0
  178. package/dist/cli-bundle/chunks/{copy-RMLXLZOL.js → copy-KBTIUW7L.js} +7 -7
  179. package/dist/cli-bundle/chunks/{copy-NWFFRYWM.js → copy-X7V6AEDB.js} +7 -7
  180. package/dist/cli-bundle/chunks/create-4KOAQ6ME.js +30 -0
  181. package/dist/cli-bundle/chunks/{create-GK4MX2LJ.js → create-ZPZKJDFQ.js} +14 -14
  182. package/dist/cli-bundle/chunks/{delete-EFQLVEAS.js → delete-2ZI6CJZM.js} +7 -7
  183. package/dist/cli-bundle/chunks/{delete-RMGNIL2S.js → delete-FGKVPUQZ.js} +7 -7
  184. package/dist/cli-bundle/chunks/{deps-WKHUPVD3.js → deps-IUJOBF2H.js} +7 -7
  185. package/dist/cli-bundle/chunks/{deps-K2I7QV4Y.js → deps-SJCEFU3C.js} +7 -7
  186. package/dist/cli-bundle/chunks/{docs-2H2UGIT6.js → docs-2LXF5SVC.js} +12 -11
  187. package/dist/cli-bundle/chunks/{docs-2H2UGIT6.js.map → docs-2LXF5SVC.js.map} +1 -1
  188. package/dist/cli-bundle/chunks/{docs-3FXRDYA7.js → docs-UWJ75CKR.js} +10 -9
  189. package/dist/cli-bundle/chunks/{docs-3FXRDYA7.js.map → docs-UWJ75CKR.js.map} +1 -1
  190. package/dist/cli-bundle/chunks/eval-FRIDCTM2.js +276 -0
  191. package/dist/cli-bundle/chunks/eval-FRIDCTM2.js.map +1 -0
  192. package/dist/cli-bundle/chunks/eval-ZTT3F3SL.js +286 -0
  193. package/dist/cli-bundle/chunks/eval-ZTT3F3SL.js.map +7 -0
  194. package/dist/cli-bundle/chunks/{extension-4LPTFTV4.js → extension-VRYTNNSV.js} +5 -5
  195. package/dist/cli-bundle/chunks/{extension-ASUPTDCC.js → extension-XFQG3BXL.js} +5 -5
  196. package/dist/cli-bundle/chunks/{files-UAZFB3EA.js → files-AJOGTTAN.js} +10 -9
  197. package/dist/cli-bundle/chunks/{files-UAZFB3EA.js.map → files-AJOGTTAN.js.map} +1 -1
  198. package/dist/cli-bundle/chunks/{files-TXEQOA7C.js → files-B2RUCA32.js} +12 -11
  199. package/dist/cli-bundle/chunks/{files-TXEQOA7C.js.map → files-B2RUCA32.js.map} +1 -1
  200. package/dist/cli-bundle/chunks/{focus-UGROAMAX.js → focus-7N36RIMT.js} +8 -8
  201. package/dist/cli-bundle/chunks/{focus-ELOPN2SR.js → focus-CFE33IYC.js} +8 -8
  202. package/dist/cli-bundle/chunks/gc-OYJK4YBY.js +395 -0
  203. package/dist/cli-bundle/chunks/gc-OYJK4YBY.js.map +7 -0
  204. package/dist/cli-bundle/chunks/gc-SBF2FGHK.js +385 -0
  205. package/dist/cli-bundle/chunks/gc-SBF2FGHK.js.map +1 -0
  206. package/dist/cli-bundle/chunks/{get-OTXPLWYW.js → get-577VLZZ7.js} +11 -11
  207. package/dist/cli-bundle/chunks/{get-IWZ7IMPS.js → get-LLFWSPXW.js} +11 -11
  208. package/dist/cli-bundle/chunks/{health-PPTJ7XKW.js → health-C2PUT6JZ.js} +21 -22
  209. package/dist/cli-bundle/chunks/{health-PPTJ7XKW.js.map → health-C2PUT6JZ.js.map} +1 -1
  210. package/dist/cli-bundle/chunks/{health-JEBESKID.js → health-PBJS7W2T.js} +20 -21
  211. package/dist/cli-bundle/chunks/{health-JEBESKID.js.map → health-PBJS7W2T.js.map} +2 -2
  212. package/dist/cli-bundle/chunks/{history-HNWBUDMI.js → history-4FJK6Y3O.js} +10 -10
  213. package/dist/cli-bundle/chunks/history-ZXNWG6H4.js +20 -0
  214. package/dist/cli-bundle/chunks/{history-compact-EQXVPK3V.js → history-compact-AXR6R6GU.js} +12 -12
  215. package/dist/cli-bundle/chunks/{history-compact-MMQC7MCW.js → history-compact-HXF3OT7G.js} +12 -12
  216. package/dist/cli-bundle/chunks/history-redact-GV633Z4H.js +21 -0
  217. package/dist/cli-bundle/chunks/{history-redact-UBDHBEJE.js → history-redact-UMPD4G3K.js} +11 -11
  218. package/dist/cli-bundle/chunks/{history-repair-GMMHFAGH.js → history-repair-WHOK2ICG.js} +12 -12
  219. package/dist/cli-bundle/chunks/{history-repair-7DSDRPMX.js → history-repair-X57HE5EA.js} +12 -12
  220. package/dist/cli-bundle/chunks/init-KQWZSNBX.js +20 -0
  221. package/dist/cli-bundle/chunks/{init-QGK4JFF6.js → init-N7MIIYCU.js} +10 -10
  222. package/dist/cli-bundle/chunks/{learnings-A6DGBMG3.js → learnings-FPG7WAVW.js} +10 -10
  223. package/dist/cli-bundle/chunks/{learnings-DR53TWRA.js → learnings-GZRBIEAN.js} +10 -10
  224. package/dist/cli-bundle/chunks/{list-LJ5DBXC3.js → list-MZBCSKLU.js} +10 -10
  225. package/dist/cli-bundle/chunks/{list-KOJN23UL.js → list-ZDQ2OBSO.js} +10 -10
  226. package/dist/cli-bundle/chunks/{notes-K5I3TAYR.js → notes-LW53PFLH.js} +10 -10
  227. package/dist/cli-bundle/chunks/{notes-7VLTHKPW.js → notes-WQAP67EC.js} +10 -10
  228. package/dist/cli-bundle/chunks/{plan-X3STKLED.js → plan-AVJ4VJQO.js} +15 -15
  229. package/dist/cli-bundle/chunks/plan-AVJ4VJQO.js.map +7 -0
  230. package/dist/cli-bundle/chunks/{plan-BK3OMLGP.js → plan-VZKICKIJ.js} +16 -16
  231. package/dist/cli-bundle/chunks/plan-VZKICKIJ.js.map +1 -0
  232. package/dist/cli-bundle/chunks/{register-list-query-FUMXPWZ4.js → register-list-query-7BD6ZHU5.js} +42 -21
  233. package/dist/cli-bundle/chunks/register-list-query-7BD6ZHU5.js.map +7 -0
  234. package/dist/cli-bundle/chunks/{register-list-query-XDLFESU7.js → register-list-query-CM4SVAQA.js} +43 -22
  235. package/dist/cli-bundle/chunks/register-list-query-CM4SVAQA.js.map +1 -0
  236. package/dist/cli-bundle/chunks/{register-mutation-ZAGVKMBQ.js → register-mutation-ANZIWHUF.js} +33 -33
  237. package/dist/cli-bundle/chunks/{register-mutation-RXRX4P7D.js → register-mutation-PLFHAS4N.js} +33 -33
  238. package/dist/cli-bundle/chunks/{register-operations-DGSHCS75.js → register-operations-KQPQIFF2.js} +35 -35
  239. package/dist/cli-bundle/chunks/register-operations-KQPQIFF2.js.map +1 -0
  240. package/dist/cli-bundle/chunks/{register-operations-6UURPZN5.js → register-operations-VLGCAWIW.js} +34 -34
  241. package/dist/cli-bundle/chunks/{register-operations-6UURPZN5.js.map → register-operations-VLGCAWIW.js.map} +2 -2
  242. package/dist/cli-bundle/chunks/{register-setup-2FEGSFLM.js → register-setup-KPTZ36D4.js} +15 -15
  243. package/dist/cli-bundle/chunks/{register-setup-LTJG52WP.js → register-setup-TMEF6V7O.js} +15 -15
  244. package/dist/cli-bundle/chunks/{restore-SJUWYOCK.js → restore-64JKQV7G.js} +11 -11
  245. package/dist/cli-bundle/chunks/restore-GKM26SAW.js +19 -0
  246. package/dist/cli-bundle/chunks/{scheduling-shortcuts-W4F2LKHW.js → scheduling-shortcuts-4ION7QAX.js} +14 -14
  247. package/dist/cli-bundle/chunks/{scheduling-shortcuts-VWAMP2S2.js → scheduling-shortcuts-X6D6VSZR.js} +14 -14
  248. package/dist/cli-bundle/chunks/{schema-N5ETYD4P.js → schema-OA4RSVMI.js} +9 -9
  249. package/dist/cli-bundle/chunks/{schema-DXQRIEFM.js → schema-TA3NF3RG.js} +9 -9
  250. package/dist/cli-bundle/chunks/search-INCM5I4J.js +33 -0
  251. package/dist/cli-bundle/chunks/search-UAIHEQZL.js +37 -0
  252. package/dist/cli-bundle/chunks/{stats-J563NJBY.js → stats-RHEMG4CE.js} +8 -8
  253. package/dist/cli-bundle/chunks/{stats-ZFESFVQC.js → stats-WQWTIA5Y.js} +8 -8
  254. package/dist/cli-bundle/chunks/{telemetry-BNGLIFEM.js → telemetry-G6UKGKJU.js} +4 -4
  255. package/dist/cli-bundle/chunks/{telemetry-SC7HPRXX.js → telemetry-XA5D2QEO.js} +4 -4
  256. package/dist/cli-bundle/chunks/{test-55RJCGRU.js → test-XF7BYLMZ.js} +15 -15
  257. package/dist/cli-bundle/chunks/{test-47UQGEXE.js → test-ZMQF23P3.js} +15 -15
  258. package/dist/cli-bundle/chunks/{test-all-DN6KG4FX.js → test-all-WUBBJCPU.js} +15 -15
  259. package/dist/cli-bundle/chunks/{test-all-5SFTTRNL.js → test-all-ZNQBMUOI.js} +15 -15
  260. package/dist/cli-bundle/chunks/{test-runs-DZEDJ4GH.js → test-runs-N7LI7HLH.js} +5 -5
  261. package/dist/cli-bundle/chunks/{test-runs-NHRBT7SN.js → test-runs-RFA42EEX.js} +5 -5
  262. package/dist/cli-bundle/chunks/update-CPNOG73P.js +24 -0
  263. package/dist/cli-bundle/chunks/update-CPNOG73P.js.map +7 -0
  264. package/dist/cli-bundle/chunks/update-T5AYT6ZN.js +28 -0
  265. package/dist/cli-bundle/chunks/update-T5AYT6ZN.js.map +1 -0
  266. package/dist/cli-bundle/chunks/{update-many-OKYWFCBO.js → update-many-6XFR7TFG.js} +23 -23
  267. package/dist/cli-bundle/chunks/{update-many-IRNV3OTG.js → update-many-NMRUQZL2.js} +23 -23
  268. package/dist/cli-bundle/chunks/{upgrade-KP4I45V5.js → upgrade-EJTME2YQ.js} +5 -5
  269. package/dist/cli-bundle/chunks/{upgrade-3RIAFQIK.js → upgrade-QMCSONWR.js} +5 -5
  270. package/dist/cli-bundle/chunks/{validate-GVY4VE43.js → validate-3SUCHXXX.js} +21 -21
  271. package/dist/cli-bundle/chunks/{validate-ADKGN37M.js → validate-KIIJY5RC.js} +21 -21
  272. package/dist/cli-bundle/main.js +133 -55
  273. package/dist/cli-bundle/main.js.map +2 -2
  274. package/dist/core/checkpoint/checkpoint-gc.d.ts +69 -0
  275. package/dist/core/checkpoint/checkpoint-gc.js +175 -0
  276. package/dist/core/checkpoint/checkpoint-gc.js.map +1 -0
  277. package/dist/core/config/nested-settings.js +22 -2
  278. package/dist/core/config/nested-settings.js.map +1 -1
  279. package/dist/core/diagnostics/remediation.js +19 -2
  280. package/dist/core/diagnostics/remediation.js.map +1 -1
  281. package/dist/core/extensions/extension-types.d.ts +0 -9
  282. package/dist/core/extensions/extension-types.js +2 -27
  283. package/dist/core/extensions/extension-types.js.map +1 -1
  284. package/dist/core/fs/fs-utils.d.ts +17 -1
  285. package/dist/core/fs/fs-utils.js +19 -3
  286. package/dist/core/fs/fs-utils.js.map +1 -1
  287. package/dist/core/history/drift-scan.d.ts +17 -5
  288. package/dist/core/history/drift-scan.js +22 -14
  289. package/dist/core/history/drift-scan.js.map +1 -1
  290. package/dist/core/history/replay.d.ts +7 -0
  291. package/dist/core/history/replay.js +11 -6
  292. package/dist/core/history/replay.js.map +1 -1
  293. package/dist/core/item/status-filter.d.ts +7 -3
  294. package/dist/core/item/status-filter.js +26 -5
  295. package/dist/core/item/status-filter.js.map +1 -1
  296. package/dist/core/search/bm25.d.ts +113 -0
  297. package/dist/core/search/bm25.js +178 -0
  298. package/dist/core/search/bm25.js.map +1 -0
  299. package/dist/core/search/eval.d.ts +114 -0
  300. package/dist/core/search/eval.js +217 -0
  301. package/dist/core/search/eval.js.map +1 -0
  302. package/dist/core/sentry/instrument.d.ts +14 -0
  303. package/dist/core/sentry/instrument.js +43 -3
  304. package/dist/core/sentry/instrument.js.map +1 -1
  305. package/dist/core/shared/constants.js +5 -2
  306. package/dist/core/shared/constants.js.map +1 -1
  307. package/dist/core/store/paths.js +4 -3
  308. package/dist/core/store/paths.js.map +1 -1
  309. package/dist/core/store/settings-validator.d.ts +7 -0
  310. package/dist/core/store/settings-validator.js +10 -2
  311. package/dist/core/store/settings-validator.js.map +1 -1
  312. package/dist/core/store/settings.js +6 -2
  313. package/dist/core/store/settings.js.map +1 -1
  314. package/dist/mcp/tool-definitions.js +4 -3
  315. package/dist/mcp/tool-definitions.js.map +1 -1
  316. package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
  317. package/dist/sdk/cli-contracts/enum-contracts.js +3 -2
  318. package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -1
  319. package/dist/sdk/cli-contracts/tool-parameter-tables.js +4 -4
  320. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  321. package/dist/sdk/cli-contracts.d.ts +1 -0
  322. package/dist/sdk/cli-contracts.js +11 -2
  323. package/dist/sdk/cli-contracts.js.map +1 -1
  324. package/dist/types.d.ts +19 -0
  325. package/dist/types.js +2 -2
  326. package/dist/types.js.map +1 -1
  327. package/docs/AGENT_GUIDE.md +1 -0
  328. package/docs/ARCHITECTURE.md +124 -11
  329. package/docs/CLAUDE_CODE_PLUGIN.md +5 -13
  330. package/docs/COMMANDS.md +55 -5
  331. package/docs/CONFIGURATION.md +39 -0
  332. package/docs/EXTENSIONS.md +2 -2
  333. package/docs/MIGRATION_CLI_SIMPLIFICATION.md +9 -2
  334. package/docs/QUICKSTART.md +2 -0
  335. package/docs/README.md +2 -0
  336. package/docs/RELEASING.md +2 -1
  337. package/docs/SDK.md +9 -1
  338. package/docs/TESTING.md +18 -0
  339. package/package.json +4 -3
  340. package/packages/pm-todos/extensions/todos/index.js +2 -0
  341. package/packages/pm-todos/extensions/todos/index.ts +2 -0
  342. package/packages/pm-todos/extensions/todos/runtime.js +1 -1
  343. package/packages/pm-todos/extensions/todos/runtime.ts +4 -1
  344. package/dist/cli-bundle/chunks/activity-62I26XZB.js +0 -18
  345. package/dist/cli-bundle/chunks/chunk-2RI3BDFK.js.map +0 -7
  346. package/dist/cli-bundle/chunks/chunk-4BFNWAMQ.js.map +0 -7
  347. package/dist/cli-bundle/chunks/chunk-5QLHQK7V.js.map +0 -7
  348. package/dist/cli-bundle/chunks/chunk-5SRID7DV.js.map +0 -1
  349. package/dist/cli-bundle/chunks/chunk-COHNQLB2.js.map +0 -1
  350. package/dist/cli-bundle/chunks/chunk-DVUU3AHP.js.map +0 -1
  351. package/dist/cli-bundle/chunks/chunk-FP7YLQ52.js.map +0 -1
  352. package/dist/cli-bundle/chunks/chunk-FPQA4ZMA.js.map +0 -7
  353. package/dist/cli-bundle/chunks/chunk-GDOTTY2S.js.map +0 -7
  354. package/dist/cli-bundle/chunks/chunk-I2VJM36R.js.map +0 -1
  355. package/dist/cli-bundle/chunks/chunk-K5TD74VU.js.map +0 -7
  356. package/dist/cli-bundle/chunks/chunk-MAKOMXVM.js.map +0 -1
  357. package/dist/cli-bundle/chunks/chunk-PSWSQHM7.js.map +0 -1
  358. package/dist/cli-bundle/chunks/chunk-UA4ANRJY.js.map +0 -7
  359. package/dist/cli-bundle/chunks/chunk-UCNEPMPY.js.map +0 -7
  360. package/dist/cli-bundle/chunks/chunk-X26ODPU4.js.map +0 -7
  361. package/dist/cli-bundle/chunks/chunk-Y4IBSEQ2.js.map +0 -1
  362. package/dist/cli-bundle/chunks/chunk-YOGXK3ON.js.map +0 -7
  363. package/dist/cli-bundle/chunks/chunk-YWAYOWDQ.js.map +0 -1
  364. package/dist/cli-bundle/chunks/chunk-ZZEM2PH7.js.map +0 -1
  365. package/dist/cli-bundle/chunks/close-TQZK43Z5.js +0 -15
  366. package/dist/cli-bundle/chunks/config-UWF3KRP5.js.map +0 -7
  367. package/dist/cli-bundle/chunks/config-YICACPHA.js.map +0 -1
  368. package/dist/cli-bundle/chunks/contracts-7G553BHP.js.map +0 -1
  369. package/dist/cli-bundle/chunks/contracts-B2YWYUV5.js.map +0 -7
  370. package/dist/cli-bundle/chunks/create-UZLJXHLA.js +0 -30
  371. package/dist/cli-bundle/chunks/gc-5RTYXLQU.js +0 -211
  372. package/dist/cli-bundle/chunks/gc-5RTYXLQU.js.map +0 -7
  373. package/dist/cli-bundle/chunks/gc-FK5732EK.js +0 -208
  374. package/dist/cli-bundle/chunks/gc-FK5732EK.js.map +0 -1
  375. package/dist/cli-bundle/chunks/history-TKTULEVE.js +0 -20
  376. package/dist/cli-bundle/chunks/history-redact-SPIFIXVY.js +0 -21
  377. package/dist/cli-bundle/chunks/init-A6FTZ5UC.js +0 -20
  378. package/dist/cli-bundle/chunks/plan-BK3OMLGP.js.map +0 -1
  379. package/dist/cli-bundle/chunks/plan-X3STKLED.js.map +0 -7
  380. package/dist/cli-bundle/chunks/register-list-query-FUMXPWZ4.js.map +0 -7
  381. package/dist/cli-bundle/chunks/register-list-query-XDLFESU7.js.map +0 -1
  382. package/dist/cli-bundle/chunks/register-operations-DGSHCS75.js.map +0 -1
  383. package/dist/cli-bundle/chunks/restore-PI3WM4GK.js +0 -19
  384. package/dist/cli-bundle/chunks/search-2JX776KX.js.map +0 -1
  385. package/dist/cli-bundle/chunks/search-AZR2JITW.js.map +0 -7
  386. package/dist/cli-bundle/chunks/update-2BZEAI7B.js +0 -24
  387. package/dist/cli-bundle/chunks/update-GCNLER2H.js +0 -28
  388. /package/dist/cli-bundle/chunks/{activity-62I26XZB.js.map → activity-7G7NNNZQ.js.map} +0 -0
  389. /package/dist/cli-bundle/chunks/{activity-XJ7WRNWS.js.map → activity-KEEITOTB.js.map} +0 -0
  390. /package/dist/cli-bundle/chunks/{aggregate-OFT4YVB6.js.map → aggregate-5BTHOHW2.js.map} +0 -0
  391. /package/dist/cli-bundle/chunks/{aggregate-LBCWF6UJ.js.map → aggregate-GB2LJNTZ.js.map} +0 -0
  392. /package/dist/cli-bundle/chunks/{append-BP2ARHOK.js.map → append-BBM4MNVD.js.map} +0 -0
  393. /package/dist/cli-bundle/chunks/{append-5U3XR5SD.js.map → append-BFV5UYWS.js.map} +0 -0
  394. /package/dist/cli-bundle/chunks/{chunk-RVG3WLY3.js.map → chunk-2LUNPA3U.js.map} +0 -0
  395. /package/dist/cli-bundle/chunks/{chunk-OURX4WVG.js.map → chunk-2QJLN4KM.js.map} +0 -0
  396. /package/dist/cli-bundle/chunks/{chunk-AVMSP2HH.js.map → chunk-3KVCMB2M.js.map} +0 -0
  397. /package/dist/cli-bundle/chunks/{chunk-FVZSUIN5.js.map → chunk-3WAKNI2W.js.map} +0 -0
  398. /package/dist/cli-bundle/chunks/{chunk-H3DP6OUM.js.map → chunk-4KFL5OYK.js.map} +0 -0
  399. /package/dist/cli-bundle/chunks/{chunk-VG3B2CYD.js.map → chunk-4PW4C3ZB.js.map} +0 -0
  400. /package/dist/cli-bundle/chunks/{chunk-SDUZTZ55.js.map → chunk-4S4INK3B.js.map} +0 -0
  401. /package/dist/cli-bundle/chunks/{chunk-QCHNPN24.js.map → chunk-4YMX7XFI.js.map} +0 -0
  402. /package/dist/cli-bundle/chunks/{chunk-QSH34DSQ.js.map → chunk-5MWA46UN.js.map} +0 -0
  403. /package/dist/cli-bundle/chunks/{chunk-UIMLAFOE.js.map → chunk-5XK2RYJR.js.map} +0 -0
  404. /package/dist/cli-bundle/chunks/{chunk-B2NEFANY.js.map → chunk-6DZO5NN7.js.map} +0 -0
  405. /package/dist/cli-bundle/chunks/{chunk-VP4Z36GO.js.map → chunk-6FSPWUBI.js.map} +0 -0
  406. /package/dist/cli-bundle/chunks/{chunk-MPEWACTG.js.map → chunk-6KARQMC6.js.map} +0 -0
  407. /package/dist/cli-bundle/chunks/{chunk-N7LDJRB4.js.map → chunk-6KSFULO6.js.map} +0 -0
  408. /package/dist/cli-bundle/chunks/{chunk-XV6N3QND.js.map → chunk-6LTSLEHD.js.map} +0 -0
  409. /package/dist/cli-bundle/chunks/{chunk-USKTNI7P.js.map → chunk-7MMXBIRZ.js.map} +0 -0
  410. /package/dist/cli-bundle/chunks/{chunk-2K56AWDP.js.map → chunk-AOCYDQLT.js.map} +0 -0
  411. /package/dist/cli-bundle/chunks/{chunk-ZBVYKWT2.js.map → chunk-ATRXPXAL.js.map} +0 -0
  412. /package/dist/cli-bundle/chunks/{chunk-A5JPMD4Q.js.map → chunk-AW4PYYNF.js.map} +0 -0
  413. /package/dist/cli-bundle/chunks/{chunk-MTGMNUMJ.js.map → chunk-B3LROPTV.js.map} +0 -0
  414. /package/dist/cli-bundle/chunks/{chunk-NPNNW5TU.js.map → chunk-BBSUVIIT.js.map} +0 -0
  415. /package/dist/cli-bundle/chunks/{chunk-47BYN6CA.js.map → chunk-BYNJWB5F.js.map} +0 -0
  416. /package/dist/cli-bundle/chunks/{chunk-S673PVHD.js.map → chunk-CNPWCUDR.js.map} +0 -0
  417. /package/dist/cli-bundle/chunks/{chunk-TYQBGXH2.js.map → chunk-DKWIPIJY.js.map} +0 -0
  418. /package/dist/cli-bundle/chunks/{chunk-HMQMRHQJ.js.map → chunk-EKMHDL6Z.js.map} +0 -0
  419. /package/dist/cli-bundle/chunks/{chunk-LIVRA6VG.js.map → chunk-EOFROIC5.js.map} +0 -0
  420. /package/dist/cli-bundle/chunks/{chunk-NNMBNN6Q.js.map → chunk-ETJKPURB.js.map} +0 -0
  421. /package/dist/cli-bundle/chunks/{chunk-2E3KSWFG.js.map → chunk-F4EYOSNC.js.map} +0 -0
  422. /package/dist/cli-bundle/chunks/{chunk-DJ3YYLHG.js.map → chunk-FA5O2DEG.js.map} +0 -0
  423. /package/dist/cli-bundle/chunks/{chunk-QTWWHFI3.js.map → chunk-FBBPCSJM.js.map} +0 -0
  424. /package/dist/cli-bundle/chunks/{chunk-EMFDZ7N3.js.map → chunk-FSOJCFDS.js.map} +0 -0
  425. /package/dist/cli-bundle/chunks/{chunk-M35R7LFX.js.map → chunk-FXKPUMIR.js.map} +0 -0
  426. /package/dist/cli-bundle/chunks/{chunk-II3WDRCM.js.map → chunk-HWHZ7EY7.js.map} +0 -0
  427. /package/dist/cli-bundle/chunks/{chunk-7R5YKVKO.js.map → chunk-ICEWMJYH.js.map} +0 -0
  428. /package/dist/cli-bundle/chunks/{chunk-UMTPQMEG.js.map → chunk-II4BRHKM.js.map} +0 -0
  429. /package/dist/cli-bundle/chunks/{chunk-QG6M6XQE.js.map → chunk-J7VSEFWB.js.map} +0 -0
  430. /package/dist/cli-bundle/chunks/{chunk-22YA6GCA.js.map → chunk-K2LBDYDC.js.map} +0 -0
  431. /package/dist/cli-bundle/chunks/{chunk-BQVESTOG.js.map → chunk-KCJZREBI.js.map} +0 -0
  432. /package/dist/cli-bundle/chunks/{chunk-5P2LQV2F.js.map → chunk-MTQK5ZSB.js.map} +0 -0
  433. /package/dist/cli-bundle/chunks/{chunk-LEC57E7K.js.map → chunk-NCGQ27PK.js.map} +0 -0
  434. /package/dist/cli-bundle/chunks/{chunk-5LZPDRFW.js.map → chunk-NMQNXH4U.js.map} +0 -0
  435. /package/dist/cli-bundle/chunks/{chunk-PRUB7RI4.js.map → chunk-OVSFW4KD.js.map} +0 -0
  436. /package/dist/cli-bundle/chunks/{chunk-4L7Q4OVT.js.map → chunk-PF5GLFPU.js.map} +0 -0
  437. /package/dist/cli-bundle/chunks/{chunk-YVYJQR6S.js.map → chunk-QUTJOHGK.js.map} +0 -0
  438. /package/dist/cli-bundle/chunks/{chunk-CSRFOIHG.js.map → chunk-RICT5QYR.js.map} +0 -0
  439. /package/dist/cli-bundle/chunks/{chunk-OUG4CL4H.js.map → chunk-RNKUCHUQ.js.map} +0 -0
  440. /package/dist/cli-bundle/chunks/{chunk-X7RKOJXL.js.map → chunk-SL233DQD.js.map} +0 -0
  441. /package/dist/cli-bundle/chunks/{chunk-USVOBLGB.js.map → chunk-U3WTMYBX.js.map} +0 -0
  442. /package/dist/cli-bundle/chunks/{chunk-DYZKSIVX.js.map → chunk-VE3BUO3R.js.map} +0 -0
  443. /package/dist/cli-bundle/chunks/{chunk-RNWE2HZR.js.map → chunk-W2ZESOQE.js.map} +0 -0
  444. /package/dist/cli-bundle/chunks/{chunk-GL3QKIET.js.map → chunk-XKJDCJEH.js.map} +0 -0
  445. /package/dist/cli-bundle/chunks/{chunk-SO2IOH37.js.map → chunk-XNQ3YH6N.js.map} +0 -0
  446. /package/dist/cli-bundle/chunks/{chunk-ZGEWEO7B.js.map → chunk-XXGAWTH5.js.map} +0 -0
  447. /package/dist/cli-bundle/chunks/{chunk-4EOS35RL.js.map → chunk-YBQF4CAW.js.map} +0 -0
  448. /package/dist/cli-bundle/chunks/{chunk-MTDEEUGV.js.map → chunk-YT4Z2OVB.js.map} +0 -0
  449. /package/dist/cli-bundle/chunks/{chunk-5NS6TJ2F.js.map → chunk-ZHCSGIUX.js.map} +0 -0
  450. /package/dist/cli-bundle/chunks/{claim-2BSYPJTJ.js.map → claim-G57ZJLZ4.js.map} +0 -0
  451. /package/dist/cli-bundle/chunks/{claim-EZ6JKY5X.js.map → claim-TRSDQO6L.js.map} +0 -0
  452. /package/dist/cli-bundle/chunks/{close-3TSX6BYF.js.map → close-4QMUQMON.js.map} +0 -0
  453. /package/dist/cli-bundle/chunks/{close-TQZK43Z5.js.map → close-NNZZTZ5V.js.map} +0 -0
  454. /package/dist/cli-bundle/chunks/{close-many-B7DBVA46.js.map → close-many-3UWKJRQK.js.map} +0 -0
  455. /package/dist/cli-bundle/chunks/{close-many-HB4UFCS3.js.map → close-many-A7U62CRI.js.map} +0 -0
  456. /package/dist/cli-bundle/chunks/{comments-M7PAINZT.js.map → comments-4EM7XR74.js.map} +0 -0
  457. /package/dist/cli-bundle/chunks/{comments-X7M7XM6I.js.map → comments-URWDZP2I.js.map} +0 -0
  458. /package/dist/cli-bundle/chunks/{context-EGUGU4K7.js.map → context-A46YAV2F.js.map} +0 -0
  459. /package/dist/cli-bundle/chunks/{context-V32ZAPL6.js.map → context-BCR34RKM.js.map} +0 -0
  460. /package/dist/cli-bundle/chunks/{copy-RMLXLZOL.js.map → copy-KBTIUW7L.js.map} +0 -0
  461. /package/dist/cli-bundle/chunks/{copy-NWFFRYWM.js.map → copy-X7V6AEDB.js.map} +0 -0
  462. /package/dist/cli-bundle/chunks/{create-UZLJXHLA.js.map → create-4KOAQ6ME.js.map} +0 -0
  463. /package/dist/cli-bundle/chunks/{create-GK4MX2LJ.js.map → create-ZPZKJDFQ.js.map} +0 -0
  464. /package/dist/cli-bundle/chunks/{delete-EFQLVEAS.js.map → delete-2ZI6CJZM.js.map} +0 -0
  465. /package/dist/cli-bundle/chunks/{delete-RMGNIL2S.js.map → delete-FGKVPUQZ.js.map} +0 -0
  466. /package/dist/cli-bundle/chunks/{deps-WKHUPVD3.js.map → deps-IUJOBF2H.js.map} +0 -0
  467. /package/dist/cli-bundle/chunks/{deps-K2I7QV4Y.js.map → deps-SJCEFU3C.js.map} +0 -0
  468. /package/dist/cli-bundle/chunks/{extension-4LPTFTV4.js.map → extension-VRYTNNSV.js.map} +0 -0
  469. /package/dist/cli-bundle/chunks/{extension-ASUPTDCC.js.map → extension-XFQG3BXL.js.map} +0 -0
  470. /package/dist/cli-bundle/chunks/{focus-UGROAMAX.js.map → focus-7N36RIMT.js.map} +0 -0
  471. /package/dist/cli-bundle/chunks/{focus-ELOPN2SR.js.map → focus-CFE33IYC.js.map} +0 -0
  472. /package/dist/cli-bundle/chunks/{get-OTXPLWYW.js.map → get-577VLZZ7.js.map} +0 -0
  473. /package/dist/cli-bundle/chunks/{get-IWZ7IMPS.js.map → get-LLFWSPXW.js.map} +0 -0
  474. /package/dist/cli-bundle/chunks/{history-HNWBUDMI.js.map → history-4FJK6Y3O.js.map} +0 -0
  475. /package/dist/cli-bundle/chunks/{history-TKTULEVE.js.map → history-ZXNWG6H4.js.map} +0 -0
  476. /package/dist/cli-bundle/chunks/{history-compact-EQXVPK3V.js.map → history-compact-AXR6R6GU.js.map} +0 -0
  477. /package/dist/cli-bundle/chunks/{history-compact-MMQC7MCW.js.map → history-compact-HXF3OT7G.js.map} +0 -0
  478. /package/dist/cli-bundle/chunks/{history-redact-SPIFIXVY.js.map → history-redact-GV633Z4H.js.map} +0 -0
  479. /package/dist/cli-bundle/chunks/{history-redact-UBDHBEJE.js.map → history-redact-UMPD4G3K.js.map} +0 -0
  480. /package/dist/cli-bundle/chunks/{history-repair-GMMHFAGH.js.map → history-repair-WHOK2ICG.js.map} +0 -0
  481. /package/dist/cli-bundle/chunks/{history-repair-7DSDRPMX.js.map → history-repair-X57HE5EA.js.map} +0 -0
  482. /package/dist/cli-bundle/chunks/{init-A6FTZ5UC.js.map → init-KQWZSNBX.js.map} +0 -0
  483. /package/dist/cli-bundle/chunks/{init-QGK4JFF6.js.map → init-N7MIIYCU.js.map} +0 -0
  484. /package/dist/cli-bundle/chunks/{learnings-A6DGBMG3.js.map → learnings-FPG7WAVW.js.map} +0 -0
  485. /package/dist/cli-bundle/chunks/{learnings-DR53TWRA.js.map → learnings-GZRBIEAN.js.map} +0 -0
  486. /package/dist/cli-bundle/chunks/{list-LJ5DBXC3.js.map → list-MZBCSKLU.js.map} +0 -0
  487. /package/dist/cli-bundle/chunks/{list-KOJN23UL.js.map → list-ZDQ2OBSO.js.map} +0 -0
  488. /package/dist/cli-bundle/chunks/{notes-K5I3TAYR.js.map → notes-LW53PFLH.js.map} +0 -0
  489. /package/dist/cli-bundle/chunks/{notes-7VLTHKPW.js.map → notes-WQAP67EC.js.map} +0 -0
  490. /package/dist/cli-bundle/chunks/{register-mutation-ZAGVKMBQ.js.map → register-mutation-ANZIWHUF.js.map} +0 -0
  491. /package/dist/cli-bundle/chunks/{register-mutation-RXRX4P7D.js.map → register-mutation-PLFHAS4N.js.map} +0 -0
  492. /package/dist/cli-bundle/chunks/{register-setup-2FEGSFLM.js.map → register-setup-KPTZ36D4.js.map} +0 -0
  493. /package/dist/cli-bundle/chunks/{register-setup-LTJG52WP.js.map → register-setup-TMEF6V7O.js.map} +0 -0
  494. /package/dist/cli-bundle/chunks/{restore-SJUWYOCK.js.map → restore-64JKQV7G.js.map} +0 -0
  495. /package/dist/cli-bundle/chunks/{restore-PI3WM4GK.js.map → restore-GKM26SAW.js.map} +0 -0
  496. /package/dist/cli-bundle/chunks/{scheduling-shortcuts-W4F2LKHW.js.map → scheduling-shortcuts-4ION7QAX.js.map} +0 -0
  497. /package/dist/cli-bundle/chunks/{scheduling-shortcuts-VWAMP2S2.js.map → scheduling-shortcuts-X6D6VSZR.js.map} +0 -0
  498. /package/dist/cli-bundle/chunks/{schema-N5ETYD4P.js.map → schema-OA4RSVMI.js.map} +0 -0
  499. /package/dist/cli-bundle/chunks/{schema-DXQRIEFM.js.map → schema-TA3NF3RG.js.map} +0 -0
  500. /package/dist/cli-bundle/chunks/{test-55RJCGRU.js.map → search-INCM5I4J.js.map} +0 -0
  501. /package/dist/cli-bundle/chunks/{test-47UQGEXE.js.map → search-UAIHEQZL.js.map} +0 -0
  502. /package/dist/cli-bundle/chunks/{stats-J563NJBY.js.map → stats-RHEMG4CE.js.map} +0 -0
  503. /package/dist/cli-bundle/chunks/{stats-ZFESFVQC.js.map → stats-WQWTIA5Y.js.map} +0 -0
  504. /package/dist/cli-bundle/chunks/{telemetry-BNGLIFEM.js.map → telemetry-G6UKGKJU.js.map} +0 -0
  505. /package/dist/cli-bundle/chunks/{telemetry-SC7HPRXX.js.map → telemetry-XA5D2QEO.js.map} +0 -0
  506. /package/dist/cli-bundle/chunks/{update-2BZEAI7B.js.map → test-XF7BYLMZ.js.map} +0 -0
  507. /package/dist/cli-bundle/chunks/{update-GCNLER2H.js.map → test-ZMQF23P3.js.map} +0 -0
  508. /package/dist/cli-bundle/chunks/{test-all-DN6KG4FX.js.map → test-all-WUBBJCPU.js.map} +0 -0
  509. /package/dist/cli-bundle/chunks/{test-all-5SFTTRNL.js.map → test-all-ZNQBMUOI.js.map} +0 -0
  510. /package/dist/cli-bundle/chunks/{test-runs-DZEDJ4GH.js.map → test-runs-N7LI7HLH.js.map} +0 -0
  511. /package/dist/cli-bundle/chunks/{test-runs-NHRBT7SN.js.map → test-runs-RFA42EEX.js.map} +0 -0
  512. /package/dist/cli-bundle/chunks/{update-many-OKYWFCBO.js.map → update-many-6XFR7TFG.js.map} +0 -0
  513. /package/dist/cli-bundle/chunks/{update-many-IRNV3OTG.js.map → update-many-NMRUQZL2.js.map} +0 -0
  514. /package/dist/cli-bundle/chunks/{upgrade-KP4I45V5.js.map → upgrade-EJTME2YQ.js.map} +0 -0
  515. /package/dist/cli-bundle/chunks/{upgrade-3RIAFQIK.js.map → upgrade-QMCSONWR.js.map} +0 -0
  516. /package/dist/cli-bundle/chunks/{validate-GVY4VE43.js.map → validate-3SUCHXXX.js.map} +0 -0
  517. /package/dist/cli-bundle/chunks/{validate-ADKGN37M.js.map → validate-KIIJY5RC.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  EXIT_CODE,
3
3
  PmCliError
4
- } from "./chunk-5QLHQK7V.js";
4
+ } from "./chunk-QWAJPGEI.js";
5
5
 
6
6
  // dist/core/shared/time.js
7
7
  !(function() {
@@ -209,4 +209,4 @@ export {
209
209
  compareTimestampStrings,
210
210
  resolveIsoOrRelative
211
211
  };
212
- //# sourceMappingURL=chunk-MTGMNUMJ.js.map
212
+ //# sourceMappingURL=chunk-B3LROPTV.js.map
@@ -15,27 +15,27 @@ import {
15
15
  parseLinkedTestMinLines,
16
16
  parseLinkedTestRegexList,
17
17
  parseLinkedTestStringList
18
- } from "./chunk-UMTPQMEG.js";
18
+ } from "./chunk-II4BRHKM.js";
19
19
  import {
20
20
  createStdinTokenResolver,
21
21
  parseCsvKv,
22
22
  parseOptionalNumber
23
- } from "./chunk-LEC57E7K.js";
23
+ } from "./chunk-NCGQ27PK.js";
24
24
  import {
25
25
  runInit
26
- } from "./chunk-LIVRA6VG.js";
26
+ } from "./chunk-EOFROIC5.js";
27
27
  import {
28
28
  locateItem,
29
29
  mutateItem,
30
30
  readLocatedItem
31
- } from "./chunk-GL3QKIET.js";
31
+ } from "./chunk-XKJDCJEH.js";
32
32
  import {
33
33
  resolveItemTypeRegistry
34
- } from "./chunk-BQVESTOG.js";
34
+ } from "./chunk-KCJZREBI.js";
35
35
  import {
36
36
  compareTimestampStrings,
37
37
  nowIso
38
- } from "./chunk-5P2LQV2F.js";
38
+ } from "./chunk-MTQK5ZSB.js";
39
39
  import {
40
40
  EXIT_CODE,
41
41
  ITEM_FILE_EXTENSIONS,
@@ -48,7 +48,7 @@ import {
48
48
  resolveGlobalPmRoot,
49
49
  resolvePmRoot,
50
50
  stableValueEquals
51
- } from "./chunk-I2VJM36R.js";
51
+ } from "./chunk-AZ75OVK4.js";
52
52
 
53
53
  // dist/cli/commands/test.js
54
54
  import { spawn } from "node:child_process";
@@ -1884,6 +1884,6 @@ export {
1884
1884
  runTest,
1885
1885
  _testOnlyTestCommand
1886
1886
  };
1887
- //# sourceMappingURL=chunk-NPNNW5TU.js.map
1887
+ //# sourceMappingURL=chunk-BBSUVIIT.js.map
1888
1888
 
1889
1889
  //# debugId=eca9038d-c58d-57e0-9b7d-a32f72ff68b8
@@ -2,21 +2,21 @@ import {
2
2
  TYPE_PRESET_NAMES,
3
3
  normalizeTypePresetName,
4
4
  resolveTypePresetDefinitions
5
- } from "./chunk-N7LDJRB4.js";
5
+ } from "./chunk-6KSFULO6.js";
6
6
  import {
7
7
  parseItemTypesFile,
8
8
  serializeItemTypesFile,
9
9
  upsertItemType
10
- } from "./chunk-H3DP6OUM.js";
10
+ } from "./chunk-4KFL5OYK.js";
11
11
  import {
12
12
  runExtension
13
- } from "./chunk-UA4ANRJY.js";
13
+ } from "./chunk-H3ZTSYPA.js";
14
14
  import {
15
15
  normalizePrefix
16
- } from "./chunk-5NS6TJ2F.js";
16
+ } from "./chunk-ZHCSGIUX.js";
17
17
  import {
18
18
  resolveItemTypeRegistry
19
- } from "./chunk-SO2IOH37.js";
19
+ } from "./chunk-XNQ3YH6N.js";
20
20
  import {
21
21
  DEFAULT_RUNTIME_SCHEMA_FILE_PATHS,
22
22
  EXIT_CODE,
@@ -35,7 +35,7 @@ import {
35
35
  runActiveOnWriteHooks,
36
36
  writeFileAtomic,
37
37
  writeSettings
38
- } from "./chunk-5QLHQK7V.js";
38
+ } from "./chunk-QWAJPGEI.js";
39
39
 
40
40
  // dist/cli/commands/init.js
41
41
  import fs2 from "node:fs/promises";
@@ -846,4 +846,4 @@ export {
846
846
  _testOnly,
847
847
  runInit
848
848
  };
849
- //# sourceMappingURL=chunk-47BYN6CA.js.map
849
+ //# sourceMappingURL=chunk-BYNJWB5F.js.map
@@ -1,17 +1,19 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5852197d-f013-5f21-9f20-ad46d309b19b")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="edfd2704-35c2-5e60-ade2-713d3db82c2b")}catch(e){}}();
3
3
  import {
4
4
  resolveAuthor
5
5
  } from "./chunk-T5RRNDA7.js";
6
6
  import {
7
7
  readHistoryEntries
8
- } from "./chunk-HMQMRHQJ.js";
8
+ } from "./chunk-EKMHDL6Z.js";
9
9
  import {
10
10
  EMPTY_REPLAY_DOCUMENT,
11
11
  normalizeReplayPatchOps,
12
12
  replayHash,
13
+ replayToCanonicalItemDocument,
14
+ replayToItemDocument,
13
15
  toReplayDocument
14
- } from "./chunk-FP7YLQ52.js";
16
+ } from "./chunk-WMQBNVZL.js";
15
17
  import {
16
18
  acquireLock,
17
19
  appendHistoryEntry,
@@ -19,21 +21,21 @@ import {
19
21
  enforceHistoryStreamPolicyForItem,
20
22
  locateItem,
21
23
  readLocatedItem
22
- } from "./chunk-GL3QKIET.js";
24
+ } from "./chunk-XKJDCJEH.js";
23
25
  import {
24
26
  normalizeItemId,
25
27
  normalizeRawItemId
26
- } from "./chunk-22YA6GCA.js";
28
+ } from "./chunk-K2LBDYDC.js";
27
29
  import {
28
30
  canonicalDocument,
29
31
  serializeItemDocument
30
- } from "./chunk-EMFDZ7N3.js";
32
+ } from "./chunk-FSOJCFDS.js";
31
33
  import {
32
34
  resolveItemTypeRegistry
33
- } from "./chunk-BQVESTOG.js";
35
+ } from "./chunk-KCJZREBI.js";
34
36
  import {
35
37
  nowIso
36
- } from "./chunk-5P2LQV2F.js";
38
+ } from "./chunk-MTQK5ZSB.js";
37
39
  import {
38
40
  EXIT_CODE,
39
41
  PmCliError,
@@ -49,7 +51,7 @@ import {
49
51
  resolvePmRoot,
50
52
  runActiveOnWriteHooks,
51
53
  writeFileAtomic
52
- } from "./chunk-I2VJM36R.js";
54
+ } from "./chunk-AZ75OVK4.js";
53
55
 
54
56
  // dist/cli/commands/restore.js
55
57
  import jsonPatch from "fast-json-patch";
@@ -187,10 +189,7 @@ function replayCurrentDocument(history) {
187
189
  body: currentReplay.body
188
190
  };
189
191
  }
190
- return canonicalDocument({
191
- metadata: currentReplay.metadata,
192
- body: currentReplay.body
193
- });
192
+ return canonicalDocument(replayToItemDocument(currentReplay));
194
193
  }
195
194
  async function resolveRestoreSubject(pmRoot, id, settings, typeToFolder) {
196
195
  const located = await locateItem(pmRoot, id, settings.id_prefix, settings.item_format, typeToFolder);
@@ -256,10 +255,7 @@ async function runRestore(id, target, options, global) {
256
255
  }
257
256
  const resolvedTarget = ensureReplayTarget(target, history);
258
257
  const replayDocument = ensureMaterializedRestoreTarget(replayToTarget(history, resolvedTarget.historyIndex), resolvedTarget);
259
- const restoredDocument = canonicalDocument({
260
- metadata: replayDocument.metadata,
261
- body: replayDocument.body
262
- }, { schema: settings.schema });
258
+ const restoredDocument = replayToCanonicalItemDocument(replayDocument, { schema: settings.schema });
263
259
  if (restoredDocument.metadata.id !== resolvedId) {
264
260
  throw new PmCliError(`Restore target resolved to item ${restoredDocument.metadata.id}, expected ${resolvedId}.`, EXIT_CODE.GENERIC_FAILURE);
265
261
  }
@@ -390,6 +386,6 @@ export {
390
386
  runRestore,
391
387
  _testOnlyRestoreCommand
392
388
  };
393
- //# sourceMappingURL=chunk-PSWSQHM7.js.map
389
+ //# sourceMappingURL=chunk-BZWIDTDE.js.map
394
390
 
395
- //# debugId=5852197d-f013-5f21-9f20-ad46d309b19b
391
+ //# debugId=edfd2704-35c2-5e60-ade2-713d3db82c2b
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../cli/commands/restore.ts"],"sourcesContent":["/**\n * @module cli/commands/restore\n *\n * Implements the pm restore command surface and its agent-facing runtime behavior.\n */\nimport jsonPatch from \"fast-json-patch\";\nimport fs from \"node:fs/promises\";\nimport { pathExists, readFileIfExists, writeFileAtomic } from \"../../core/fs/fs-utils.js\";\nimport { appendHistoryEntry, createHistoryEntry } from \"../../core/history/history.js\";\nimport {\n EMPTY_REPLAY_DOCUMENT,\n normalizeReplayPatchOps,\n replayHash,\n replayToCanonicalItemDocument,\n replayToItemDocument,\n toReplayDocument,\n type ReplayDocument as CanonicalReplayDocument,\n} from \"../../core/history/replay.js\";\nimport { enforceHistoryStreamPolicyForItem } from \"../../core/history/history-stream-policy.js\";\nimport { normalizeItemId, normalizeRawItemId } from \"../../core/item/id.js\";\nimport { canonicalDocument, serializeItemDocument } from \"../../core/item/item-format.js\";\nimport { resolveItemTypeRegistry } from \"../../core/item/type-registry.js\";\nimport { acquireLock } from \"../../core/lock/lock.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 getActiveExtensionRegistrations,\n projectAfterCommandItemSnapshot,\n recordAfterCommandAffectedItem,\n runActiveOnWriteHooks,\n} from \"../../core/extensions/index.js\";\nimport { locateItem, readLocatedItem } from \"../../core/store/item-store.js\";\nimport { getHistoryPath, getItemPath, getSettingsPath, resolvePmRoot } from \"../../core/store/paths.js\";\nimport { readSettings } from \"../../core/store/settings.js\";\nimport { resolveAuthor } from \"../../core/shared/author.js\";\nimport type { HistoryEntry, HistoryPatchOp, ItemDocument, ItemMetadata } from \"../../types/index.js\";\nimport { readHistoryEntries } from \"./history.js\";\n\ninterface ResolvedRestoreTarget {\n kind: \"version\" | \"timestamp\";\n raw: string;\n historyIndex: number;\n}\n\ninterface ResolvedRestoreSubject {\n id: string;\n historyPath: string;\n located: Awaited<ReturnType<typeof locateItem>>;\n historyPolicyWarnings: string[];\n}\n\n/**\n * Documents the restore command options payload exchanged by command, SDK, and package integrations.\n */\nexport interface RestoreCommandOptions {\n author?: string;\n message?: string;\n force?: boolean;\n}\n\n/**\n * Documents the restore result payload exchanged by command, SDK, and package integrations.\n */\nexport interface RestoreResult {\n item: ItemMetadata;\n restored_from: {\n kind: \"version\" | \"timestamp\";\n target: string;\n history_index: number;\n entry_ts: string;\n entry_op: string;\n };\n changed_fields: string[];\n warnings: string[];\n}\n\nfunction ensureReplayTarget(target: string, history: HistoryEntry[]): ResolvedRestoreTarget {\n const trimmed = target.trim();\n if (!trimmed) {\n throw new PmCliError(\"Missing restore target. Use a timestamp or version number.\", EXIT_CODE.USAGE);\n }\n\n if (/^\\d+$/.test(trimmed)) {\n const version = Number(trimmed);\n if (!Number.isSafeInteger(version) || version < 1 || version > history.length) {\n throw new PmCliError(\n `Restore version must be between 1 and ${history.length} for this item.`,\n EXIT_CODE.USAGE,\n );\n }\n return {\n kind: \"version\",\n raw: trimmed,\n historyIndex: version - 1,\n };\n }\n\n const parsedTarget = Date.parse(trimmed);\n if (!Number.isFinite(parsedTarget)) {\n throw new PmCliError(\n `Invalid restore target \"${target}\". Use a positive version number or ISO timestamp.`,\n EXIT_CODE.USAGE,\n );\n }\n\n let index = -1;\n for (let i = 0; i < history.length; i += 1) {\n const entryTimestamp = Date.parse(history[i].ts);\n if (!Number.isFinite(entryTimestamp)) {\n throw new PmCliError(\n `History for this item contains invalid timestamp at entry ${i + 1}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n if (entryTimestamp <= parsedTarget) {\n index = i;\n }\n }\n\n if (index < 0) {\n throw new PmCliError(`No history entries exist at or before timestamp ${trimmed}.`, EXIT_CODE.USAGE);\n }\n\n return {\n kind: \"timestamp\",\n raw: trimmed,\n historyIndex: index,\n };\n}\n\nfunction extractPatchFailureContext(\n patch: HistoryPatchOp[],\n error: unknown,\n): { patchIndex?: number; op?: string; path?: string; from?: string; reason?: string } {\n const context: { patchIndex?: number; op?: string; path?: string; from?: string; reason?: string } = {};\n if (error instanceof Error && error.message.trim().length > 0) {\n context.reason = error.message.trim();\n }\n if (typeof error !== \"object\" || error === null) {\n return context;\n }\n const candidate = error as {\n index?: unknown;\n operation?: unknown;\n };\n /* c8 ignore start -- parser-generated patch errors may omit index metadata in current fixtures. */\n if (typeof candidate.index === \"number\" && Number.isInteger(candidate.index) && candidate.index >= 0) {\n context.patchIndex = candidate.index;\n }\n /* c8 ignore stop */\n /* c8 ignore start -- operation payload metadata is optional in upstream json-patch failures. */\n const operationRecord =\n typeof candidate.operation === \"object\" && candidate.operation !== null\n ? (candidate.operation as { op?: unknown; path?: unknown; from?: unknown })\n : null;\n /* c8 ignore stop */\n if (operationRecord && typeof operationRecord.op === \"string\") {\n context.op = operationRecord.op;\n }\n if (operationRecord && typeof operationRecord.path === \"string\") {\n context.path = operationRecord.path;\n }\n if (operationRecord && typeof operationRecord.from === \"string\") {\n context.from = operationRecord.from;\n }\n if ((context.op === undefined || context.path === undefined) && context.patchIndex !== undefined) {\n const fallback = patch[context.patchIndex];\n /* c8 ignore start -- fallback enrichment paths are only exercised by malformed patch telemetry payloads. */\n if (fallback) {\n context.op = context.op ?? fallback.op;\n context.path = context.path ?? fallback.path;\n context.from = context.from ?? fallback.from;\n }\n /* c8 ignore stop */\n }\n return context;\n}\n\nfunction applyHistoryPatch(\n current: CanonicalReplayDocument,\n patch: HistoryPatchOp[],\n entryNumber: number,\n entryOp: string,\n): CanonicalReplayDocument {\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 (\n typeof applied !== \"object\" ||\n applied === null ||\n !(\"metadata\" in applied) ||\n !(\"body\" in applied) ||\n typeof (applied as { body: unknown }).body !== \"string\" ||\n typeof (applied as { metadata: unknown }).metadata !== \"object\" ||\n (applied as { metadata: unknown }).metadata === null\n ) {\n throw new PmCliError(\n `History replay produced an invalid document shape at entry ${entryNumber}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n const replay = applied as { metadata: Record<string, unknown>; body: string };\n return {\n metadata: replay.metadata,\n body: replay.body,\n };\n } catch (error: unknown) {\n if (error instanceof PmCliError) {\n throw error;\n }\n const failureContext = extractPatchFailureContext(patch, error);\n const contextTokens = [\n `history_op=${entryOp}`,\n /* c8 ignore next -- contextual fields are best-effort and may be absent depending on patch failure shape. */\n failureContext.patchIndex !== undefined ? `patch_index=${failureContext.patchIndex}` : null,\n /* c8 ignore next -- contextual fields are best-effort and may be absent depending on patch failure shape. */\n failureContext.op ? `op=${failureContext.op}` : null,\n /* c8 ignore next -- contextual fields are best-effort and may be absent depending on patch failure shape. */\n failureContext.path ? `path=${failureContext.path}` : null,\n /* c8 ignore next -- contextual fields are best-effort and may be absent depending on patch failure shape. */\n failureContext.from ? `from=${failureContext.from}` : null,\n ].filter((token): token is string => token !== null);\n /* c8 ignore start -- jsonPatch/structuredClone/normalizeReplayPatchOps always throw Error instances with non-empty messages here, so extractPatchFailureContext always sets reason; the empty-suffix fallback is unreachable through applyHistoryPatch. */\n const reasonSuffix = failureContext.reason ? ` ${failureContext.reason}` : \"\";\n /* c8 ignore stop */\n throw new PmCliError(\n `Failed to apply history patch at entry ${entryNumber} (${contextTokens.join(\", \")}).${reasonSuffix}`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n}\n\nfunction replayToTarget(history: HistoryEntry[], targetIndex: number): CanonicalReplayDocument {\n let document: CanonicalReplayDocument = structuredClone(EMPTY_REPLAY_DOCUMENT);\n\n for (let i = 0; i <= targetIndex; i += 1) {\n const entry = history[i];\n const beforeHash = replayHash(document);\n if (beforeHash !== entry.before_hash) {\n throw new PmCliError(\n `History hash mismatch before replay at entry ${i + 1}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n\n document = applyHistoryPatch(document, entry.patch, i + 1, entry.op);\n\n const afterHash = replayHash(document);\n if (afterHash !== entry.after_hash) {\n throw new PmCliError(\n `History hash mismatch after replay at entry ${i + 1}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n }\n\n return document;\n}\n\nfunction ensureMaterializedRestoreTarget(\n replayDocument: CanonicalReplayDocument,\n target: ResolvedRestoreTarget,\n): CanonicalReplayDocument {\n if (Object.keys(replayDocument.metadata).length > 0) {\n return replayDocument;\n }\n throw new PmCliError(\n `Restore target ${target.raw} resolves to a deleted state; choose a version or timestamp where the item exists.`,\n EXIT_CODE.USAGE,\n );\n}\n\nfunction replayCurrentDocument(history: HistoryEntry[]): ItemDocument {\n const currentReplay = replayToTarget(history, history.length - 1);\n if (Object.keys(currentReplay.metadata).length === 0) {\n return {\n metadata: {} as ItemMetadata,\n body: currentReplay.body,\n };\n }\n return canonicalDocument(replayToItemDocument(currentReplay));\n}\n\nasync function resolveRestoreSubject(\n pmRoot: string,\n id: string,\n settings: Awaited<ReturnType<typeof readSettings>>,\n typeToFolder: Record<string, string>,\n): Promise<ResolvedRestoreSubject> {\n const located = await locateItem(pmRoot, id, settings.id_prefix, settings.item_format, typeToFolder);\n if (located) {\n const historyPath = getHistoryPath(pmRoot, located.id);\n const historyPolicy = await enforceHistoryStreamPolicyForItem({\n pmRoot,\n settings,\n itemId: located.id,\n commandLabel: \"restore\",\n });\n return {\n id: located.id,\n historyPath,\n located,\n historyPolicyWarnings: historyPolicy.warnings,\n };\n }\n\n const normalizedId = normalizeItemId(id, settings.id_prefix);\n const rawNormalizedId = normalizeRawItemId(id);\n /* c8 ignore start -- raw-id fallback is covered by normalize-item-id utility tests. */\n const candidateIds = normalizedId === rawNormalizedId ? [normalizedId] : [normalizedId, rawNormalizedId];\n /* c8 ignore stop */\n for (const candidateId of candidateIds) {\n const historyPath = getHistoryPath(pmRoot, candidateId);\n if (await pathExists(historyPath)) {\n return {\n id: candidateId,\n historyPath,\n located: null,\n historyPolicyWarnings: [],\n };\n }\n }\n\n throw new PmCliError(`Item ${id} not found`, EXIT_CODE.NOT_FOUND);\n}\n\nfunction changedFields(beforeDocument: ItemDocument, afterDocument: ItemDocument): string[] {\n const beforeReplay = toReplayDocument(beforeDocument);\n const afterReplay = toReplayDocument(afterDocument);\n const patch = jsonPatch.compare(beforeReplay, afterReplay) as HistoryPatchOp[];\n const fields = new Set<string>();\n\n for (const op of patch) {\n if (op.path === \"/body\" || op.path.startsWith(\"/body/\")) {\n fields.add(\"body\");\n continue;\n }\n const segment = op.path.replace(/^\\/(?:metadata|front_matter)\\/?/, \"\").split(\"/\")[0];\n fields.add(segment.replaceAll(\"~1\", \"/\").replaceAll(\"~0\", \"~\"));\n }\n\n return Array.from(fields).sort((a, b) => a.localeCompare(b));\n}\n\n/**\n * Implements run restore for the public runtime surface of this module.\n */\nexport async function runRestore(\n id: string,\n target: string,\n options: RestoreCommandOptions,\n global: GlobalOptions,\n): Promise<RestoreResult> {\n const pmRoot = resolvePmRoot(process.cwd(), global.path);\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);\n }\n\n const settings = await readSettings(pmRoot);\n const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());\n const subject = await resolveRestoreSubject(pmRoot, id, settings, typeRegistry.type_to_folder);\n const resolvedId = subject.id;\n const historyRawBeforeLock = await readFileIfExists(subject.historyPath);\n const history = await readHistoryEntries(subject.historyPath, resolvedId);\n if (history.length === 0) {\n throw new PmCliError(`No history exists for ${resolvedId}; restore is unavailable.`, EXIT_CODE.NOT_FOUND);\n }\n\n const resolvedTarget = ensureReplayTarget(target, history);\n const replayDocument = ensureMaterializedRestoreTarget(replayToTarget(history, resolvedTarget.historyIndex), resolvedTarget);\n const restoredDocument = replayToCanonicalItemDocument(replayDocument, { schema: settings.schema });\n\n if (restoredDocument.metadata.id !== resolvedId) {\n throw new PmCliError(\n `Restore target resolved to item ${restoredDocument.metadata.id}, expected ${resolvedId}.`,\n EXIT_CODE.GENERIC_FAILURE,\n );\n }\n const loadedItemBeforeLock = subject.located ? await readLocatedItem(subject.located, { schema: settings.schema }) : null;\n const currentItemRawBeforeLock = loadedItemBeforeLock?.raw ?? null;\n\n const author = resolveAuthor(options.author, settings.author_default);\n const releaseLock = await acquireLock(\n pmRoot,\n resolvedId,\n settings.locks.ttl_seconds,\n author,\n Boolean(options.force),\n settings.governance.force_required_for_stale_lock,\n );\n\n try {\n const historyRawUnderLock = await readFileIfExists(subject.historyPath);\n if (historyRawUnderLock !== historyRawBeforeLock) {\n throw new PmCliError(\n `History for ${resolvedId} changed while waiting for lock; retry restore.`,\n EXIT_CODE.CONFLICT,\n );\n }\n const locatedUnderLock = await locateItem(\n pmRoot,\n resolvedId,\n settings.id_prefix,\n settings.item_format,\n typeRegistry.type_to_folder,\n );\n const loadedItemUnderLock = locatedUnderLock ? await readLocatedItem(locatedUnderLock, { schema: settings.schema }) : null;\n if ((loadedItemUnderLock?.raw ?? null) !== currentItemRawBeforeLock) {\n throw new PmCliError(`Item ${resolvedId} changed while waiting for lock; retry restore.`, EXIT_CODE.CONFLICT);\n }\n\n const existingItemPath = locatedUnderLock?.itemPath ?? null;\n const itemFormat = \"toon\";\n let resolvedCurrentDocument: ItemDocument;\n let resolvedOriginalRaw: string | null = null;\n if (loadedItemUnderLock) {\n resolvedCurrentDocument = loadedItemUnderLock.document;\n resolvedOriginalRaw = loadedItemUnderLock.raw;\n } else {\n resolvedCurrentDocument = replayCurrentDocument(history);\n }\n const assigned = resolvedCurrentDocument.metadata.assignee?.trim();\n const ownershipWarnings: string[] = [];\n const hasOwnershipConflict = assigned && assigned !== author && !options.force;\n if (hasOwnershipConflict) {\n if (settings.governance.ownership_enforcement === \"strict\") {\n throw new PmCliError(\n `Item ${resolvedId} is assigned to ${assigned}. Use --force to override.`,\n EXIT_CODE.CONFLICT,\n );\n }\n if (settings.governance.ownership_enforcement === \"warn\") {\n ownershipWarnings.push(`ownership_warning:assignee_conflict:${resolvedId}:${assigned}`);\n }\n }\n\n const serializedRestore = serializeItemDocument(restoredDocument, { format: itemFormat, schema: settings.schema });\n /* c8 ignore next -- restored item path typing is exercised in restore integration workflows. */\n const restoredItemPath = getItemPath(\n pmRoot,\n restoredDocument.metadata.type,\n resolvedId,\n itemFormat,\n typeRegistry.type_to_folder,\n );\n await writeFileAtomic(restoredItemPath, serializedRestore);\n if (existingItemPath && restoredItemPath !== existingItemPath) {\n await fs.rm(existingItemPath);\n }\n\n const historyEntry = createHistoryEntry({\n nowIso: nowIso(),\n author,\n op: \"restore\",\n before: resolvedCurrentDocument,\n after: restoredDocument,\n message: options.message,\n });\n\n try {\n await appendHistoryEntry(subject.historyPath, historyEntry);\n } catch (error: unknown) {\n if (existingItemPath && resolvedOriginalRaw !== null && restoredItemPath !== existingItemPath) {\n await writeFileAtomic(existingItemPath, resolvedOriginalRaw);\n await fs.rm(restoredItemPath, { force: true });\n } else if (existingItemPath && resolvedOriginalRaw !== null) {\n await writeFileAtomic(existingItemPath, resolvedOriginalRaw);\n } else {\n await fs.rm(restoredItemPath, { force: true });\n }\n throw error;\n }\n const restoreChangedFields = changedFields(resolvedCurrentDocument, restoredDocument);\n const hookWarnings = [\n ...(await runActiveOnWriteHooks({\n path: restoredItemPath,\n scope: \"project\",\n op: \"restore\",\n item_id: restoredDocument.metadata.id,\n item_type: restoredDocument.metadata.type,\n before: resolvedCurrentDocument,\n after: restoredDocument,\n changed_fields: [\"restored\"],\n })),\n ...(await runActiveOnWriteHooks({\n path: subject.historyPath,\n scope: \"project\",\n op: \"restore:history\",\n item_id: restoredDocument.metadata.id,\n item_type: restoredDocument.metadata.type,\n before: resolvedCurrentDocument,\n after: restoredDocument,\n changed_fields: [\"restored\"],\n })),\n ];\n recordAfterCommandAffectedItem({\n id: restoredDocument.metadata.id,\n op: \"restore\",\n item_type: restoredDocument.metadata.type,\n previous_status: resolvedCurrentDocument.metadata.status,\n status: restoredDocument.metadata.status,\n previous: projectAfterCommandItemSnapshot(resolvedCurrentDocument.metadata, restoreChangedFields),\n current: projectAfterCommandItemSnapshot(restoredDocument.metadata, restoreChangedFields),\n changed_fields: restoreChangedFields,\n });\n\n const targetEntry = history[resolvedTarget.historyIndex];\n return {\n item: restoredDocument.metadata,\n restored_from: {\n kind: resolvedTarget.kind,\n target: resolvedTarget.raw,\n history_index: resolvedTarget.historyIndex + 1,\n entry_ts: targetEntry.ts,\n entry_op: targetEntry.op,\n },\n changed_fields: restoreChangedFields,\n warnings: [...subject.historyPolicyWarnings, ...ownershipWarnings, ...hookWarnings],\n };\n } finally {\n await releaseLock();\n }\n}\n\nexport const _testOnlyRestoreCommand = {\n applyHistoryPatch,\n changedFields,\n ensureMaterializedRestoreTarget,\n ensureReplayTarget,\n extractPatchFailureContext,\n replayCurrentDocument,\n replayToTarget,\n resolveRestoreSubject,\n};\n"],"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iBAAiB,wBAAwB,SAAS;MAClD,QAAQ,iBAAiB,SAAS;MAClC,UAAU,gCAAgC,wBAAwB,UAAU,oBAAoB;MAChG,SAAS,gCAAgC,iBAAiB,UAAU,oBAAoB;MACxF,gBAAgB;KACjB;AAED,UAAM,cAAc,QAAQ,eAAe,YAAY;AACvD,WAAO;MACL,MAAM,iBAAiB;MACvB,eAAe;QACb,MAAM,eAAe;QACrB,QAAQ,eAAe;QACvB,eAAe,eAAe,eAAe;QAC7C,UAAU,YAAY;QACtB,UAAU,YAAY;;MAExB,gBAAgB;MAChB,UAAU,CAAC,GAAG,QAAQ,uBAAuB,GAAG,mBAAmB,GAAG,YAAY;;EAEtF;AACE,UAAM,YAAW;EACnB;AACF;AAEO,IAAM,0BAA0B;EACrC;EACA;EACA;EACA;EACA;EACA;EACA;EACA","debugId":"edfd2704-35c2-5e60-ade2-713d3db82c2b"}
@@ -2,11 +2,11 @@
2
2
  !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0ee33f6a-b2be-592b-b3f1-0bbaa84323d1")}catch(e){}}();
3
3
  import {
4
4
  resolveTypeName
5
- } from "./chunk-BQVESTOG.js";
5
+ } from "./chunk-KCJZREBI.js";
6
6
  import {
7
7
  EXIT_CODE,
8
8
  PmCliError
9
- } from "./chunk-I2VJM36R.js";
9
+ } from "./chunk-AZ75OVK4.js";
10
10
 
11
11
  // dist/cli/shared-parsers.js
12
12
  function parseLimit(raw, label = "--limit") {
@@ -52,6 +52,6 @@ export {
52
52
  parsePriority,
53
53
  parseType
54
54
  };
55
- //# sourceMappingURL=chunk-S673PVHD.js.map
55
+ //# sourceMappingURL=chunk-CNPWCUDR.js.map
56
56
 
57
57
  //# debugId=0ee33f6a-b2be-592b-b3f1-0bbaa84323d1
@@ -3,7 +3,7 @@ import {
3
3
  PmCliError,
4
4
  isPathWithinDirectory,
5
5
  pathExists
6
- } from "./chunk-5QLHQK7V.js";
6
+ } from "./chunk-QWAJPGEI.js";
7
7
 
8
8
  // dist/cli/commands/extension/shared.js
9
9
  import fs from "node:fs/promises";
@@ -115,4 +115,4 @@ export {
115
115
  parseExtensionManifest,
116
116
  validateExtensionDirectory
117
117
  };
118
- //# sourceMappingURL=chunk-TYQBGXH2.js.map
118
+ //# sourceMappingURL=chunk-DKWIPIJY.js.map
@@ -5,22 +5,25 @@ import {
5
5
  buildEventCorpus,
6
6
  buildPlanFlatCorpus,
7
7
  buildReminderCorpus,
8
+ buildSearchCorpus,
8
9
  executeEmbeddingRequest,
9
10
  executeVectorQuery,
10
11
  readVectorizationStatusLedger,
11
12
  resolveEmbeddingProviders,
13
+ resolveSearchCorpusFields,
12
14
  resolveSettingsWithSemanticRuntimeDefaults,
13
15
  resolveVectorStores
14
- } from "./chunk-NNMBNN6Q.js";
16
+ } from "./chunk-ETJKPURB.js";
15
17
  import {
16
18
  buildContentFilterEcho,
17
19
  buildGovernanceMissingFilterEcho,
18
20
  collectRuntimeFilterValues,
21
+ isStatusAllFilterInput,
19
22
  matchesRuntimeFilters,
20
23
  parseStatusFilterCsv,
21
24
  resolveContentFieldFilters,
22
25
  resolveMissingMetadataFilters
23
- } from "./chunk-4BFNWAMQ.js";
26
+ } from "./chunk-WFOITX4A.js";
24
27
  import {
25
28
  hasContentFieldFilter,
26
29
  itemMatchesContentFilters
@@ -29,31 +32,30 @@ import {
29
32
  hasMissingMetadataFilter,
30
33
  itemMatchesMissingMetadata,
31
34
  lifecycleClassifierFromStatusRegistry
32
- } from "./chunk-USKTNI7P.js";
35
+ } from "./chunk-7MMXBIRZ.js";
33
36
  import {
34
37
  parseLimit,
35
38
  parsePriority,
36
39
  parseType
37
- } from "./chunk-DYZKSIVX.js";
40
+ } from "./chunk-VE3BUO3R.js";
38
41
  import {
39
42
  collectRegisteredItemFieldNames,
40
43
  listAllDocumentCandidatesCached,
41
44
  listAllFrontMatter,
42
45
  toItemRecord
43
- } from "./chunk-X7RKOJXL.js";
44
- import "./chunk-5NS6TJ2F.js";
46
+ } from "./chunk-SL233DQD.js";
45
47
  import {
46
48
  isTerminalStatus,
47
49
  parseItemDocument
48
- } from "./chunk-QSH34DSQ.js";
50
+ } from "./chunk-5MWA46UN.js";
49
51
  import {
50
52
  resolveItemTypeRegistry
51
- } from "./chunk-SO2IOH37.js";
53
+ } from "./chunk-XNQ3YH6N.js";
52
54
  import {
53
55
  compareTimestampStrings,
54
56
  nowIso,
55
57
  resolveIsoOrRelative
56
- } from "./chunk-MTGMNUMJ.js";
58
+ } from "./chunk-B3LROPTV.js";
57
59
  import {
58
60
  EXIT_CODE,
59
61
  PmCliError,
@@ -72,7 +74,7 @@ import {
72
74
  runActiveOnReadHooks,
73
75
  toNonEmptyString,
74
76
  toNonEmptyStringOrUndefined
75
- } from "./chunk-5QLHQK7V.js";
77
+ } from "./chunk-QWAJPGEI.js";
76
78
 
77
79
  // dist/cli/commands/search.js
78
80
  import fs from "node:fs/promises";
@@ -337,11 +339,124 @@ async function rerankCandidatesWithEmbeddings(provider, model, query, candidates
337
339
  return scoreById;
338
340
  }
339
341
 
342
+ // dist/core/search/bm25.js
343
+ !(function() {
344
+ try {
345
+ var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
346
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "57c1eb74-63b5-5208-abe1-98da8308839d");
347
+ } catch (e2) {
348
+ }
349
+ })();
350
+ var DEFAULT_BM25_K1 = 1.2;
351
+ var DEFAULT_BM25_B = 0.75;
352
+ function tokenizeBm25(text) {
353
+ return tokenizeAlphaNumeric(text);
354
+ }
355
+ function buildTermFrequencies(tokens) {
356
+ const frequencies = /* @__PURE__ */ new Map();
357
+ for (const token of tokens) {
358
+ frequencies.set(token, (frequencies.get(token) ?? 0) + 1);
359
+ }
360
+ return frequencies;
361
+ }
362
+ function buildBm25Index(documents) {
363
+ const stats = [];
364
+ const documentFrequency = /* @__PURE__ */ new Map();
365
+ let totalLength = 0;
366
+ for (const document of documents) {
367
+ const tokens = tokenizeBm25(document.text);
368
+ const termFrequencies = buildTermFrequencies(tokens);
369
+ totalLength += tokens.length;
370
+ for (const term of termFrequencies.keys()) {
371
+ documentFrequency.set(term, (documentFrequency.get(term) ?? 0) + 1);
372
+ }
373
+ stats.push({ id: document.id, termFrequencies, length: tokens.length });
374
+ }
375
+ const documentCount = stats.length;
376
+ return {
377
+ documents: stats,
378
+ documentFrequency,
379
+ documentCount,
380
+ averageDocumentLength: documentCount > 0 ? totalLength / documentCount : 0
381
+ };
382
+ }
383
+ function inverseDocumentFrequency(documentCount, termDocumentFrequency) {
384
+ return Math.log(1 + (documentCount - termDocumentFrequency + 0.5) / (termDocumentFrequency + 0.5));
385
+ }
386
+ function scoreBm25Query(index, queryTokens, params) {
387
+ const scores = /* @__PURE__ */ new Map();
388
+ if (index.documentCount === 0 || index.averageDocumentLength === 0) {
389
+ return scores;
390
+ }
391
+ const distinctQueryTerms = [...new Set(queryTokens.filter((token) => token.length > 0))];
392
+ if (distinctQueryTerms.length === 0) {
393
+ return scores;
394
+ }
395
+ const idfByTerm = /* @__PURE__ */ new Map();
396
+ for (const term of distinctQueryTerms) {
397
+ const termDocumentFrequency = index.documentFrequency.get(term);
398
+ if (termDocumentFrequency === void 0) {
399
+ continue;
400
+ }
401
+ idfByTerm.set(term, inverseDocumentFrequency(index.documentCount, termDocumentFrequency));
402
+ }
403
+ if (idfByTerm.size === 0) {
404
+ return scores;
405
+ }
406
+ for (const document of index.documents) {
407
+ let score = 0;
408
+ for (const [term, idf] of idfByTerm) {
409
+ const termFrequency = document.termFrequencies.get(term);
410
+ if (termFrequency === void 0) {
411
+ continue;
412
+ }
413
+ const lengthNormalization = 1 - params.b + params.b * document.length / index.averageDocumentLength;
414
+ const denominator = termFrequency + params.k1 * lengthNormalization;
415
+ score += idf * (termFrequency * (params.k1 + 1) / denominator);
416
+ }
417
+ if (score > 0) {
418
+ scores.set(document.id, score);
419
+ }
420
+ }
421
+ return scores;
422
+ }
423
+ function resolveClampedParam(candidate, fallback, min, max) {
424
+ if (typeof candidate !== "number" || !Number.isFinite(candidate)) {
425
+ return fallback;
426
+ }
427
+ return Math.min(max, Math.max(min, candidate));
428
+ }
429
+ function flattenSearchCorpusText(corpus) {
430
+ const collectValueText = (value) => {
431
+ if (typeof value === "string") {
432
+ return [value];
433
+ }
434
+ if (typeof value === "number") {
435
+ return [String(value)];
436
+ }
437
+ if (Array.isArray(value)) {
438
+ return value.flatMap(collectValueText);
439
+ }
440
+ if (typeof value === "object" && value !== null) {
441
+ return Object.values(value).flatMap(collectValueText);
442
+ }
443
+ return [];
444
+ };
445
+ return collectValueText(Object.values(corpus)).join(" ");
446
+ }
447
+ function resolveBm25Params(settings) {
448
+ const bm25 = settings?.search?.bm25;
449
+ return {
450
+ k1: resolveClampedParam(bm25?.k1, DEFAULT_BM25_K1, 0, 1e3),
451
+ b: resolveClampedParam(bm25?.b, DEFAULT_BM25_B, 0, 1)
452
+ };
453
+ }
454
+
340
455
  // dist/cli/commands/search.js
341
456
  !(function() {
342
457
  try {
343
458
  var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
344
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "606dd777-967e-5059-86cf-4766b2a3ce55");
459
+ n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "717039d4-aae7-5501-9069-971b51a36c49");
345
460
  } catch (e2) {
346
461
  }
347
462
  })();
@@ -431,7 +546,7 @@ function buildCompactSearchFilterSummary(params) {
431
546
  const { mode, matchMode, options, includeLinked, titleExact, phraseExact, scoreThreshold, hybridSemanticWeight, runtimeFieldFilters } = params;
432
547
  const filters = {};
433
548
  if (options.status !== void 0) {
434
- filters.status = options.status;
549
+ filters.status = isStatusAllFilterInput(options.status) ? "all" : options.status;
435
550
  }
436
551
  if (options.type !== void 0) {
437
552
  filters.type = options.type;
@@ -505,7 +620,7 @@ function buildVerboseSearchFilters(params) {
505
620
  return {
506
621
  mode: effectiveMode,
507
622
  match_mode: matchMode,
508
- status: options.status ?? null,
623
+ status: isStatusAllFilterInput(options.status) ? "all" : options.status ?? null,
509
624
  type: options.type ?? null,
510
625
  tag: options.tag ?? null,
511
626
  priority: options.priority ?? null,
@@ -708,7 +823,9 @@ var _testOnlySearchCommand = {
708
823
  collectExactPhraseFields,
709
824
  collectLinkedPaths,
710
825
  combineHybridHits,
826
+ computeBuiltInBm25Hits,
711
827
  computeSemanticOrHybridHits,
828
+ resolveBuiltInBm25Mode,
712
829
  countOccurrences,
713
830
  dependencyEntries,
714
831
  documentContainsExactPhrase,
@@ -1080,9 +1197,10 @@ function buildHitHighlights(document, matchedFields, tokens) {
1080
1197
  }
1081
1198
  function scoreDocument(document, tokens, normalizedQuery, linkedCorpus, tuning, idPrefix, applyCoverageBonus = false) {
1082
1199
  const item = document.metadata;
1083
- const normalizedId = item.id.trim().toLowerCase();
1200
+ const normalizedId = normalizeSearchPhrase(item.id);
1084
1201
  const normalizedIdPrefix = typeof idPrefix === "string" ? idPrefix.trim().toLowerCase() : "";
1085
- const normalizedShortId = normalizedIdPrefix.length > 0 && normalizedId.startsWith(normalizedIdPrefix) ? normalizedId.slice(normalizedIdPrefix.length) : normalizedId;
1202
+ const normalizedIdPrefixPhrase = normalizeSearchPhrase(normalizedIdPrefix);
1203
+ const normalizedShortId = normalizedIdPrefixPhrase.length > 0 && normalizedId.startsWith(normalizedIdPrefixPhrase) ? normalizedId.slice(normalizedIdPrefixPhrase.length).trim() : normalizedId;
1086
1204
  if (normalizedQuery === normalizedId || normalizedQuery === normalizedShortId) {
1087
1205
  return {
1088
1206
  item,
@@ -1448,7 +1566,7 @@ function forceExactIdHitsToTop(rankedHits, keywordHits) {
1448
1566
  }));
1449
1567
  return [...promoted, ...remaining];
1450
1568
  }
1451
- function combineHybridHits(filteredById, semanticScores, keywordHits, hybridSemanticWeight) {
1569
+ function combineHybridHits(filteredById, semanticScores, keywordHits, hybridSemanticWeight, semanticFieldLabel = "semantic") {
1452
1570
  const keywordScores = new Map(keywordHits.map((entry) => [entry.item.id, entry.score]));
1453
1571
  const keywordMatches = new Map(keywordHits.map((entry) => [entry.item.id, entry.matched_fields]));
1454
1572
  const normalizedSemantic = normalizeScoreMap(semanticScores);
@@ -1465,7 +1583,7 @@ function combineHybridHits(filteredById, semanticScores, keywordHits, hybridSema
1465
1583
  }
1466
1584
  const matchedFields = /* @__PURE__ */ new Set();
1467
1585
  if (semanticScores.has(id)) {
1468
- matchedFields.add("semantic");
1586
+ matchedFields.add(semanticFieldLabel);
1469
1587
  }
1470
1588
  for (const field of keywordMatches.get(id) ?? []) {
1471
1589
  matchedFields.add(field);
@@ -1477,6 +1595,35 @@ function combineHybridHits(filteredById, semanticScores, keywordHits, hybridSema
1477
1595
  };
1478
1596
  }).filter((entry) => entry !== null);
1479
1597
  }
1598
+ function resolveBuiltInBm25Mode(params) {
1599
+ const normalized = params.configuredProvider?.trim().toLowerCase();
1600
+ if (normalized === "bm25") {
1601
+ return "explicit";
1602
+ }
1603
+ if (normalized === "auto" && !params.hasEmbeddingProvider && !params.hasExtensionSearchProvider) {
1604
+ return "auto-fallback";
1605
+ }
1606
+ return null;
1607
+ }
1608
+ function computeBuiltInBm25Hits(params) {
1609
+ const bm25Documents = params.filteredDocuments.map((document) => ({
1610
+ id: document.metadata.id,
1611
+ text: flattenSearchCorpusText(buildSearchCorpus(document, { fields: params.corpusFields }))
1612
+ }));
1613
+ const index = buildBm25Index(bm25Documents);
1614
+ const bm25Scores = scoreBm25Query(index, tokenizeBm25(params.query), params.bm25Params);
1615
+ const filteredById = new Map(params.filteredDocuments.map((document) => [document.metadata.id, document]));
1616
+ if (params.requestedMode === "semantic") {
1617
+ const semanticHits = [...bm25Scores].map(([id, score]) => ({
1618
+ item: filteredById.get(id).metadata,
1619
+ score,
1620
+ matched_fields: ["bm25"]
1621
+ }));
1622
+ return forceExactIdHitsToTop(semanticHits, params.keywordHits);
1623
+ }
1624
+ const hybridHits = combineHybridHits(filteredById, bm25Scores, params.keywordHits, params.hybridSemanticWeight, "bm25");
1625
+ return forceExactIdHitsToTop(hybridHits, params.keywordHits);
1626
+ }
1480
1627
  function mergeVectorHitsById(vectorHitGroups) {
1481
1628
  const bestById = /* @__PURE__ */ new Map();
1482
1629
  for (const group of vectorHitGroups) {
@@ -1800,6 +1947,11 @@ async function runSearch(rawQuery, rawOptions, global2) {
1800
1947
  const vectorResolution = resolveVectorStores(settings);
1801
1948
  const extensionSearchProvider = resolveExtensionSearchProvider(settings);
1802
1949
  const extensionVectorAdapter = resolveExtensionVectorAdapter(settings);
1950
+ const bm25Mode = resolveBuiltInBm25Mode({
1951
+ configuredProvider: toOptionalNonEmptyString(settings.search?.provider),
1952
+ hasEmbeddingProvider: providerResolution.active !== null,
1953
+ hasExtensionSearchProvider: extensionSearchProvider !== null
1954
+ });
1803
1955
  const queryExpansion = resolveQueryExpansionConfig(settings, providerResolution.active?.name ?? null);
1804
1956
  const rerank = resolveRerankConfig(settings, providerResolution.active?.model ?? toOptionalNonEmptyString(settings.search?.embedding_model) ?? "text-embedding-3-small");
1805
1957
  const queryExpansionProvider = resolveExtensionSearchProviderByName(queryExpansion.provider ?? void 0);
@@ -1855,7 +2007,22 @@ async function runSearch(rawQuery, rawOptions, global2) {
1855
2007
  applyCoverageBonus
1856
2008
  )).filter((entry) => entry !== null).filter((entry) => matchMode !== "and" || entry.matched_all_terms === true);
1857
2009
  let hits = keywordHits;
1858
- if (effectiveMode !== "keyword") {
2010
+ const useBuiltInBm25 = bm25Mode !== null && effectiveMode !== "keyword";
2011
+ if (bm25Mode !== null && effectiveMode !== "keyword") {
2012
+ hits = computeBuiltInBm25Hits({
2013
+ requestedMode: effectiveMode,
2014
+ query,
2015
+ filteredDocuments,
2016
+ keywordHits,
2017
+ corpusFields: resolveSearchCorpusFields(settings),
2018
+ bm25Params: resolveBm25Params(settings),
2019
+ hybridSemanticWeight
2020
+ });
2021
+ if (bm25Mode === "auto-fallback") {
2022
+ warnings.push(`search_${effectiveMode}_offline_bm25:no_embedding_provider:using_lexical_bm25`);
2023
+ }
2024
+ }
2025
+ if (effectiveMode !== "keyword" && !useBuiltInBm25) {
1859
2026
  const builtInSemanticWillRun = !extensionSearchProvider && providerResolution.active !== null && (vectorResolution.active !== null || extensionVectorAdapter !== null);
1860
2027
  if (modeWasExplicit && builtInSemanticWillRun) {
1861
2028
  await maybeEmitVectorIndexStaleWarning(pmRoot, filteredDocuments, warnings);
@@ -2050,14 +2217,15 @@ async function runSearch(rawQuery, rawOptions, global2) {
2050
2217
  ...warnings.length > 0 ? { warnings } : {}
2051
2218
  };
2052
2219
  }
2220
+
2053
2221
  export {
2054
- _testOnlySearchCommand,
2055
- classifyImplicitSemanticFallbackReason,
2056
2222
  collectErrorCauseCodes,
2057
- resolveHybridSemanticWeight,
2223
+ classifyImplicitSemanticFallbackReason,
2224
+ _testOnlySearchCommand,
2058
2225
  resolveSearchMaxResults,
2059
2226
  resolveSearchScoreThreshold,
2227
+ resolveHybridSemanticWeight,
2060
2228
  resolveSearchTuning,
2061
2229
  runSearch
2062
2230
  };
2063
- //# sourceMappingURL=search-AZR2JITW.js.map
2231
+ //# sourceMappingURL=chunk-DYOJJTCG.js.map