@unbrained/pm-cli 2026.7.6 → 2026.7.8

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 (688) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/dist/cli/commands/annotation-command.d.ts +1 -0
  3. package/dist/cli/commands/annotation-command.js +29 -2
  4. package/dist/cli/commands/annotation-command.js.map +1 -1
  5. package/dist/cli/commands/comments.js +3 -4
  6. package/dist/cli/commands/comments.js.map +1 -1
  7. package/dist/cli/commands/completion.js +10 -2
  8. package/dist/cli/commands/completion.js.map +1 -1
  9. package/dist/cli/commands/context.d.ts +1 -0
  10. package/dist/cli/commands/context.js +4 -4
  11. package/dist/cli/commands/context.js.map +1 -1
  12. package/dist/cli/commands/extension/bundled-catalog.d.ts +3 -0
  13. package/dist/cli/commands/extension/bundled-catalog.js +38 -28
  14. package/dist/cli/commands/extension/bundled-catalog.js.map +1 -1
  15. package/dist/cli/commands/extension/install-sources.js +81 -18
  16. package/dist/cli/commands/extension/install-sources.js.map +1 -1
  17. package/dist/cli/commands/extension.d.ts +23 -19
  18. package/dist/cli/commands/extension.js +167 -57
  19. package/dist/cli/commands/extension.js.map +1 -1
  20. package/dist/cli/commands/health.js +9 -5
  21. package/dist/cli/commands/health.js.map +1 -1
  22. package/dist/cli/commands/learnings.js +5 -3
  23. package/dist/cli/commands/learnings.js.map +1 -1
  24. package/dist/cli/commands/notes.js +5 -3
  25. package/dist/cli/commands/notes.js.map +1 -1
  26. package/dist/cli/commands/reindex.js +4 -3
  27. package/dist/cli/commands/reindex.js.map +1 -1
  28. package/dist/cli/commands/search.js +4 -4
  29. package/dist/cli/commands/search.js.map +1 -1
  30. package/dist/cli/commands/test.d.ts +9 -0
  31. package/dist/cli/commands/test.js +144 -105
  32. package/dist/cli/commands/test.js.map +1 -1
  33. package/dist/cli/extension-command-help.js +10 -2
  34. package/dist/cli/extension-command-help.js.map +1 -1
  35. package/dist/cli/help-content.js +28 -2
  36. package/dist/cli/help-content.js.map +1 -1
  37. package/dist/cli/register-list-query.d.ts +1 -1
  38. package/dist/cli/register-list-query.js +19 -27
  39. package/dist/cli/register-list-query.js.map +1 -1
  40. package/dist/cli/register-operations.d.ts +0 -8
  41. package/dist/cli/register-operations.js +41 -46
  42. package/dist/cli/register-operations.js.map +1 -1
  43. package/dist/cli/register-setup.js +119 -13
  44. package/dist/cli/register-setup.js.map +1 -1
  45. package/dist/cli/registration-helpers.d.ts +5 -1
  46. package/dist/cli/registration-helpers.js +14 -2
  47. package/dist/cli/registration-helpers.js.map +1 -1
  48. package/dist/cli-bundle/chunks/append-CDPAYYSB.js +11 -0
  49. package/dist/cli-bundle/chunks/{gc-2DNMPXMC.js → append-RSPHC423.js} +8 -9
  50. package/dist/cli-bundle/chunks/{chunk-LK6XLOGP.js → chunk-2BVD4ZD2.js} +288 -233
  51. package/dist/cli-bundle/chunks/chunk-2BVD4ZD2.js.map +7 -0
  52. package/dist/cli-bundle/chunks/{chunk-TKD5VCTD.js → chunk-2RADY7IB.js} +517 -195
  53. package/dist/cli-bundle/chunks/chunk-2RADY7IB.js.map +1 -0
  54. package/dist/cli-bundle/chunks/{chunk-COSPOP7H.js → chunk-3FRNNVWY.js} +518 -196
  55. package/dist/cli-bundle/chunks/chunk-3FRNNVWY.js.map +7 -0
  56. package/dist/cli-bundle/chunks/{chunk-24YG75HI.js → chunk-3FUXM574.js} +8 -8
  57. package/dist/cli-bundle/chunks/{chunk-IWVU4C2F.js → chunk-3SHDAKMF.js} +3 -3
  58. package/dist/cli-bundle/chunks/{chunk-O6AWCQRQ.js → chunk-3UXIMY62.js} +4 -6
  59. package/dist/cli-bundle/chunks/{chunk-O6AWCQRQ.js.map → chunk-3UXIMY62.js.map} +1 -1
  60. package/dist/cli-bundle/chunks/{chunk-MUH7A3FD.js → chunk-3V5C7PUH.js} +2 -2
  61. package/dist/cli-bundle/chunks/{chunk-ALFPSEWO.js → chunk-3YJDIJIE.js} +4 -6
  62. package/dist/cli-bundle/chunks/{chunk-ALFPSEWO.js.map → chunk-3YJDIJIE.js.map} +1 -1
  63. package/dist/cli-bundle/chunks/{chunk-EGY6JBQ3.js → chunk-4I7KS5ES.js} +2 -2
  64. package/dist/cli-bundle/chunks/{chunk-CRVYGJUI.js → chunk-4OCWJ2AP.js} +13 -17
  65. package/dist/cli-bundle/chunks/{chunk-CRVYGJUI.js.map → chunk-4OCWJ2AP.js.map} +1 -1
  66. package/dist/cli-bundle/chunks/{chunk-GJ7QC5DJ.js → chunk-5STY7NVM.js} +8 -8
  67. package/dist/cli-bundle/chunks/{chunk-JJP45OEI.js → chunk-5VAZHYVQ.js} +2 -2
  68. package/dist/cli-bundle/chunks/{chunk-CFB33L7W.js → chunk-6FU5BVRB.js} +12 -14
  69. package/dist/cli-bundle/chunks/{chunk-CFB33L7W.js.map → chunk-6FU5BVRB.js.map} +1 -1
  70. package/dist/cli-bundle/chunks/{chunk-22KBU3MW.js → chunk-6RR4XM5H.js} +3 -3
  71. package/dist/cli-bundle/chunks/{chunk-K46RF36U.js → chunk-6TD5QGIB.js} +7 -7
  72. package/dist/cli-bundle/chunks/chunk-6TD5QGIB.js.map +1 -0
  73. package/dist/cli-bundle/chunks/{chunk-IX5BXEMX.js → chunk-6WCXSC5V.js} +12 -16
  74. package/dist/cli-bundle/chunks/{chunk-IX5BXEMX.js.map → chunk-6WCXSC5V.js.map} +1 -1
  75. package/dist/cli-bundle/chunks/{chunk-ZWBEPGD7.js → chunk-6ZKDMEVT.js} +7 -9
  76. package/dist/cli-bundle/chunks/{chunk-ZWBEPGD7.js.map → chunk-6ZKDMEVT.js.map} +1 -1
  77. package/dist/cli-bundle/chunks/{chunk-KUOOJR35.js → chunk-7QKSLAHB.js} +2 -2
  78. package/dist/cli-bundle/chunks/{chunk-MVSP7WGJ.js → chunk-7TBUV7XS.js} +8 -12
  79. package/dist/cli-bundle/chunks/{chunk-MVSP7WGJ.js.map → chunk-7TBUV7XS.js.map} +1 -1
  80. package/dist/cli-bundle/chunks/{chunk-NGXQ3PFT.js → chunk-7UCBLJDF.js} +2 -2
  81. package/dist/cli-bundle/chunks/{chunk-F3K4JGFD.js → chunk-AEOFBBWO.js} +6 -8
  82. package/dist/cli-bundle/chunks/{chunk-F3K4JGFD.js.map → chunk-AEOFBBWO.js.map} +1 -1
  83. package/dist/cli-bundle/chunks/chunk-ASMRSIDX.js +10498 -0
  84. package/dist/cli-bundle/chunks/chunk-ASMRSIDX.js.map +7 -0
  85. package/dist/cli-bundle/chunks/{chunk-7DT4WSH2.js → chunk-BFNFTHWQ.js} +3 -3
  86. package/dist/cli-bundle/chunks/chunk-BPJ5NYSJ.js +5509 -0
  87. package/dist/cli-bundle/chunks/chunk-BPJ5NYSJ.js.map +7 -0
  88. package/dist/cli-bundle/chunks/{chunk-Y46GD4IX.js → chunk-C3YU3TXX.js} +2 -2
  89. package/dist/cli-bundle/chunks/{chunk-VPIM42PC.js → chunk-C6XSTACC.js} +11 -7
  90. package/dist/cli-bundle/chunks/chunk-C6XSTACC.js.map +7 -0
  91. package/dist/cli-bundle/chunks/{chunk-AZYGZGGI.js → chunk-CGDUIPJL.js} +3 -3
  92. package/dist/cli-bundle/chunks/{chunk-FT3QTERD.js → chunk-CXH7EMSB.js} +5 -7
  93. package/dist/cli-bundle/chunks/{chunk-FT3QTERD.js.map → chunk-CXH7EMSB.js.map} +1 -1
  94. package/dist/cli-bundle/chunks/{chunk-DMRNBQOI.js → chunk-D63PEJTB.js} +256 -36
  95. package/dist/cli-bundle/chunks/chunk-D63PEJTB.js.map +1 -0
  96. package/dist/cli-bundle/chunks/{chunk-RCQZK2GO.js → chunk-D6J5673C.js} +7 -9
  97. package/dist/cli-bundle/chunks/{chunk-RCQZK2GO.js.map → chunk-D6J5673C.js.map} +1 -1
  98. package/dist/cli-bundle/chunks/{chunk-3UJRFJ5R.js → chunk-DUBC6TI3.js} +28 -34
  99. package/dist/cli-bundle/chunks/{chunk-3UJRFJ5R.js.map → chunk-DUBC6TI3.js.map} +1 -1
  100. package/dist/cli-bundle/chunks/{chunk-NC33K5ZS.js → chunk-EEJKHF7M.js} +7 -6
  101. package/dist/cli-bundle/chunks/{chunk-NC33K5ZS.js.map → chunk-EEJKHF7M.js.map} +2 -2
  102. package/dist/cli-bundle/chunks/{chunk-XG625QP4.js → chunk-EP2CKDS7.js} +2 -2
  103. package/dist/cli-bundle/chunks/{chunk-NZEHECMW.js → chunk-EYPIUFWJ.js} +24 -32
  104. package/dist/cli-bundle/chunks/{chunk-NZEHECMW.js.map → chunk-EYPIUFWJ.js.map} +1 -1
  105. package/dist/cli-bundle/chunks/{chunk-45FYNUFJ.js → chunk-F5DDGY6R.js} +6 -6
  106. package/dist/cli-bundle/chunks/{chunk-45FYNUFJ.js.map → chunk-F5DDGY6R.js.map} +1 -1
  107. package/dist/cli-bundle/chunks/{chunk-4ZBE5GUN.js → chunk-FFB3WITE.js} +10 -16
  108. package/dist/cli-bundle/chunks/{chunk-4ZBE5GUN.js.map → chunk-FFB3WITE.js.map} +1 -1
  109. package/dist/cli-bundle/chunks/{chunk-7D7OOEYG.js → chunk-FJR2S7S4.js} +10 -14
  110. package/dist/cli-bundle/chunks/{chunk-7D7OOEYG.js.map → chunk-FJR2S7S4.js.map} +1 -1
  111. package/dist/cli-bundle/chunks/chunk-FL625JJM.js +6792 -0
  112. package/dist/cli-bundle/chunks/chunk-FL625JJM.js.map +7 -0
  113. package/dist/cli-bundle/chunks/{chunk-LPSSSDJR.js → chunk-FOJEBRDD.js} +16 -20
  114. package/dist/cli-bundle/chunks/{chunk-LPSSSDJR.js.map → chunk-FOJEBRDD.js.map} +1 -1
  115. package/dist/cli-bundle/chunks/{chunk-EOKXK3R3.js → chunk-G4FKP4ID.js} +1220 -398
  116. package/dist/cli-bundle/chunks/chunk-G4FKP4ID.js.map +1 -0
  117. package/dist/cli-bundle/chunks/chunk-GE44TQMC.js +6726 -0
  118. package/dist/cli-bundle/chunks/chunk-GE44TQMC.js.map +1 -0
  119. package/dist/cli-bundle/chunks/{chunk-XUC7PI2H.js → chunk-GLMJLBLR.js} +6 -10
  120. package/dist/cli-bundle/chunks/{chunk-XUC7PI2H.js.map → chunk-GLMJLBLR.js.map} +1 -1
  121. package/dist/cli-bundle/chunks/{chunk-GANUTS7W.js → chunk-GO2X6ZRB.js} +4 -6
  122. package/dist/cli-bundle/chunks/{chunk-GANUTS7W.js.map → chunk-GO2X6ZRB.js.map} +1 -1
  123. package/dist/cli-bundle/chunks/{chunk-CFNGIXZP.js → chunk-GQOKFX2G.js} +22 -26
  124. package/dist/cli-bundle/chunks/{chunk-CFNGIXZP.js.map → chunk-GQOKFX2G.js.map} +1 -1
  125. package/dist/cli-bundle/chunks/{chunk-XHET7YUZ.js → chunk-GSQVQINP.js} +8 -10
  126. package/dist/cli-bundle/chunks/{chunk-XHET7YUZ.js.map → chunk-GSQVQINP.js.map} +1 -1
  127. package/dist/cli-bundle/chunks/chunk-HI27UADG.js +5434 -0
  128. package/dist/cli-bundle/chunks/chunk-HI27UADG.js.map +1 -0
  129. package/dist/cli-bundle/chunks/{chunk-I36Y7PCE.js → chunk-HZZ3AC27.js} +6 -6
  130. package/dist/cli-bundle/chunks/{chunk-I36Y7PCE.js.map → chunk-HZZ3AC27.js.map} +1 -1
  131. package/dist/cli-bundle/chunks/{chunk-OGWQ2IEP.js → chunk-IINCZYM3.js} +8 -12
  132. package/dist/cli-bundle/chunks/{chunk-OGWQ2IEP.js.map → chunk-IINCZYM3.js.map} +1 -1
  133. package/dist/cli-bundle/chunks/{chunk-EKFNL33R.js → chunk-INOWVPUD.js} +37 -16
  134. package/dist/cli-bundle/chunks/chunk-INOWVPUD.js.map +1 -0
  135. package/dist/cli-bundle/chunks/{chunk-4LELACOL.js → chunk-IYRG5AEC.js} +15 -23
  136. package/dist/cli-bundle/chunks/{chunk-4LELACOL.js.map → chunk-IYRG5AEC.js.map} +1 -1
  137. package/dist/cli-bundle/chunks/{chunk-MVYWGY2A.js → chunk-J6AD3GWC.js} +2 -2
  138. package/dist/cli-bundle/chunks/{chunk-D2XRLB55.js → chunk-JH5XDDYS.js} +14 -20
  139. package/dist/cli-bundle/chunks/{chunk-D2XRLB55.js.map → chunk-JH5XDDYS.js.map} +1 -1
  140. package/dist/cli-bundle/chunks/{chunk-HOVCGJSD.js → chunk-JYVPLGOW.js} +9 -11
  141. package/dist/cli-bundle/chunks/{chunk-HOVCGJSD.js.map → chunk-JYVPLGOW.js.map} +1 -1
  142. package/dist/cli-bundle/chunks/{chunk-MA4SM3QZ.js → chunk-K52C6YPA.js} +12 -18
  143. package/dist/cli-bundle/chunks/{chunk-MA4SM3QZ.js.map → chunk-K52C6YPA.js.map} +1 -1
  144. package/dist/cli-bundle/chunks/{chunk-R5BMJX33.js → chunk-KFL3XHMA.js} +2 -2
  145. package/dist/cli-bundle/chunks/chunk-KMXVZ2P7.js +10320 -0
  146. package/dist/cli-bundle/chunks/chunk-KMXVZ2P7.js.map +1 -0
  147. package/dist/cli-bundle/chunks/{chunk-4CJFCTLM.js → chunk-LD2NBQ5T.js} +6 -8
  148. package/dist/cli-bundle/chunks/{chunk-4CJFCTLM.js.map → chunk-LD2NBQ5T.js.map} +1 -1
  149. package/dist/cli-bundle/chunks/{chunk-6QBJLYBP.js → chunk-LG4N6YOK.js} +8 -7
  150. package/dist/cli-bundle/chunks/{chunk-6QBJLYBP.js.map → chunk-LG4N6YOK.js.map} +1 -1
  151. package/dist/cli-bundle/chunks/{chunk-L5PSPMZ4.js → chunk-LHDHS4Z6.js} +10 -14
  152. package/dist/cli-bundle/chunks/{chunk-L5PSPMZ4.js.map → chunk-LHDHS4Z6.js.map} +1 -1
  153. package/dist/cli-bundle/chunks/{chunk-M7JNBQAD.js → chunk-MCH6IKK7.js} +4 -6
  154. package/dist/cli-bundle/chunks/{chunk-M7JNBQAD.js.map → chunk-MCH6IKK7.js.map} +1 -1
  155. package/dist/cli-bundle/chunks/{chunk-57NWPFF2.js → chunk-MFLLULHU.js} +281 -233
  156. package/dist/cli-bundle/chunks/chunk-MFLLULHU.js.map +1 -0
  157. package/dist/cli-bundle/chunks/{chunk-EGAP5OWD.js → chunk-ML27MHNM.js} +35 -17
  158. package/dist/cli-bundle/chunks/chunk-ML27MHNM.js.map +1 -0
  159. package/dist/cli-bundle/chunks/{chunk-3N6RRO2Q.js → chunk-MYHFZNBO.js} +20 -24
  160. package/dist/cli-bundle/chunks/{chunk-3N6RRO2Q.js.map → chunk-MYHFZNBO.js.map} +1 -1
  161. package/dist/cli-bundle/chunks/{chunk-6LLVNJXT.js → chunk-NGBWEYNY.js} +12 -18
  162. package/dist/cli-bundle/chunks/{chunk-6LLVNJXT.js.map → chunk-NGBWEYNY.js.map} +1 -1
  163. package/dist/cli-bundle/chunks/{chunk-GDDAGPWJ.js → chunk-NRMDT4OV.js} +10 -14
  164. package/dist/cli-bundle/chunks/{chunk-GDDAGPWJ.js.map → chunk-NRMDT4OV.js.map} +1 -1
  165. package/dist/cli-bundle/chunks/chunk-NTOOEVJ4.js +5359 -0
  166. package/dist/cli-bundle/chunks/chunk-NTOOEVJ4.js.map +1 -0
  167. package/dist/cli-bundle/chunks/{chunk-W6DYWXPQ.js → chunk-P2WE5KCU.js} +261 -34
  168. package/dist/cli-bundle/chunks/{chunk-W6DYWXPQ.js.map → chunk-P2WE5KCU.js.map} +4 -4
  169. package/dist/cli-bundle/chunks/{chunk-YN7Y6DQZ.js → chunk-PAWPLIWW.js} +14 -20
  170. package/dist/cli-bundle/chunks/{chunk-YN7Y6DQZ.js.map → chunk-PAWPLIWW.js.map} +1 -1
  171. package/dist/cli-bundle/chunks/{chunk-MWMVPCIE.js → chunk-PCBZ2VJD.js} +7 -7
  172. package/dist/cli-bundle/chunks/{chunk-ZSUS2OD3.js → chunk-PJPZTE7P.js} +1216 -387
  173. package/dist/cli-bundle/chunks/chunk-PJPZTE7P.js.map +7 -0
  174. package/dist/cli-bundle/chunks/{chunk-B6DUFX6H.js → chunk-Q3CFSOQZ.js} +7 -7
  175. package/dist/cli-bundle/chunks/{chunk-NO442GWJ.js → chunk-QJZM5WO5.js} +5 -5
  176. package/dist/cli-bundle/chunks/{chunk-NO442GWJ.js.map → chunk-QJZM5WO5.js.map} +2 -2
  177. package/dist/cli-bundle/chunks/{chunk-QLMX7SRD.js → chunk-QLEH6FTQ.js} +6 -6
  178. package/dist/cli-bundle/chunks/chunk-QLEH6FTQ.js.map +7 -0
  179. package/dist/cli-bundle/chunks/{chunk-GBAX2ZAQ.js → chunk-QYZMZD4L.js} +10 -12
  180. package/dist/cli-bundle/chunks/{chunk-GBAX2ZAQ.js.map → chunk-QYZMZD4L.js.map} +1 -1
  181. package/dist/cli-bundle/chunks/{chunk-W3DSJQIO.js → chunk-RDJXIAJB.js} +7 -11
  182. package/dist/cli-bundle/chunks/{chunk-W3DSJQIO.js.map → chunk-RDJXIAJB.js.map} +1 -1
  183. package/dist/cli-bundle/chunks/{chunk-7WBAJSS6.js → chunk-RFHLRMLQ.js} +6 -8
  184. package/dist/cli-bundle/chunks/{chunk-7WBAJSS6.js.map → chunk-RFHLRMLQ.js.map} +1 -1
  185. package/dist/cli-bundle/chunks/{chunk-SGMFPXKR.js → chunk-RL24NAUX.js} +10 -12
  186. package/dist/cli-bundle/chunks/{chunk-SGMFPXKR.js.map → chunk-RL24NAUX.js.map} +1 -1
  187. package/dist/cli-bundle/chunks/{chunk-46CUF5L6.js → chunk-RLHQ3G4M.js} +99 -51
  188. package/dist/cli-bundle/chunks/chunk-RLHQ3G4M.js.map +7 -0
  189. package/dist/cli-bundle/chunks/{chunk-UH7T2DAX.js → chunk-SCJPFQQT.js} +12 -18
  190. package/dist/cli-bundle/chunks/{chunk-UH7T2DAX.js.map → chunk-SCJPFQQT.js.map} +1 -1
  191. package/dist/cli-bundle/chunks/{chunk-B6XS3R3O.js → chunk-SIQGG335.js} +12 -16
  192. package/dist/cli-bundle/chunks/{chunk-B6XS3R3O.js.map → chunk-SIQGG335.js.map} +1 -1
  193. package/dist/cli-bundle/chunks/{chunk-E42XTBSP.js → chunk-SN5X5GTU.js} +8 -12
  194. package/dist/cli-bundle/chunks/{chunk-E42XTBSP.js.map → chunk-SN5X5GTU.js.map} +1 -1
  195. package/dist/cli-bundle/chunks/{chunk-CL36D4PC.js → chunk-TKWTJGD6.js} +36 -15
  196. package/dist/cli-bundle/chunks/chunk-TKWTJGD6.js.map +7 -0
  197. package/dist/cli-bundle/chunks/{chunk-VIIUS6N6.js → chunk-TR2C6V5T.js} +37 -19
  198. package/dist/cli-bundle/chunks/chunk-TR2C6V5T.js.map +7 -0
  199. package/dist/cli-bundle/chunks/chunk-TTCJCKUJ.js +5514 -0
  200. package/dist/cli-bundle/chunks/chunk-TTCJCKUJ.js.map +7 -0
  201. package/dist/cli-bundle/chunks/{chunk-KGFUY7WN.js → chunk-TU5P744I.js} +4 -4
  202. package/dist/cli-bundle/chunks/{chunk-TULGS6X6.js → chunk-TUDAYIO7.js} +529 -46
  203. package/dist/cli-bundle/chunks/chunk-TUDAYIO7.js.map +1 -0
  204. package/dist/cli-bundle/chunks/{chunk-MLIYFOE7.js → chunk-U72GF3I2.js} +12 -8
  205. package/dist/cli-bundle/chunks/chunk-U72GF3I2.js.map +1 -0
  206. package/dist/cli-bundle/chunks/{chunk-ZZD4J5XY.js → chunk-UCRYCT5M.js} +30 -36
  207. package/dist/cli-bundle/chunks/{chunk-ZZD4J5XY.js.map → chunk-UCRYCT5M.js.map} +1 -1
  208. package/dist/cli-bundle/chunks/{chunk-JDDLOQAE.js → chunk-UEATYUZW.js} +2 -2
  209. package/dist/cli-bundle/chunks/{chunk-JVH7QBVV.js → chunk-UFNFHCAC.js} +2 -2
  210. package/dist/cli-bundle/chunks/{chunk-NB7RLQFW.js → chunk-UH6VFRV6.js} +5 -7
  211. package/dist/cli-bundle/chunks/{chunk-NB7RLQFW.js.map → chunk-UH6VFRV6.js.map} +1 -1
  212. package/dist/cli-bundle/chunks/{chunk-SQOIV3OQ.js → chunk-UIHDZS6X.js} +11 -15
  213. package/dist/cli-bundle/chunks/{chunk-SQOIV3OQ.js.map → chunk-UIHDZS6X.js.map} +1 -1
  214. package/dist/cli-bundle/chunks/{chunk-W572BIEB.js → chunk-UURYLDDC.js} +14 -18
  215. package/dist/cli-bundle/chunks/{chunk-W572BIEB.js.map → chunk-UURYLDDC.js.map} +1 -1
  216. package/dist/cli-bundle/chunks/{chunk-G64OCSKU.js → chunk-UVFJSKTF.js} +9 -13
  217. package/dist/cli-bundle/chunks/{chunk-G64OCSKU.js.map → chunk-UVFJSKTF.js.map} +1 -1
  218. package/dist/cli-bundle/chunks/{chunk-SMB7RV23.js → chunk-W2VFNVSJ.js} +6 -8
  219. package/dist/cli-bundle/chunks/{chunk-SMB7RV23.js.map → chunk-W2VFNVSJ.js.map} +1 -1
  220. package/dist/cli-bundle/chunks/{chunk-HIHMT6WS.js → chunk-WVEMZZCR.js} +5 -5
  221. package/dist/cli-bundle/chunks/{chunk-HIHMT6WS.js.map → chunk-WVEMZZCR.js.map} +2 -2
  222. package/dist/cli-bundle/chunks/{chunk-3VHSI5FL.js → chunk-XN5BEN2B.js} +94 -53
  223. package/dist/cli-bundle/chunks/chunk-XN5BEN2B.js.map +1 -0
  224. package/dist/cli-bundle/chunks/{chunk-SCUR7K7N.js → chunk-XPSGJ4IV.js} +541 -44
  225. package/dist/cli-bundle/chunks/chunk-XPSGJ4IV.js.map +7 -0
  226. package/dist/cli-bundle/chunks/{chunk-ZJ262CED.js → chunk-YQEKE4FO.js} +13 -21
  227. package/dist/cli-bundle/chunks/{chunk-ZJ262CED.js.map → chunk-YQEKE4FO.js.map} +1 -1
  228. package/dist/cli-bundle/chunks/{chunk-EBRZZ54H.js → chunk-YR5R4FMQ.js} +26 -34
  229. package/dist/cli-bundle/chunks/{chunk-EBRZZ54H.js.map → chunk-YR5R4FMQ.js.map} +1 -1
  230. package/dist/cli-bundle/chunks/{chunk-XB7KFVFI.js → chunk-YSRXFGNV.js} +7 -9
  231. package/dist/cli-bundle/chunks/{chunk-XB7KFVFI.js.map → chunk-YSRXFGNV.js.map} +1 -1
  232. package/dist/cli-bundle/chunks/{chunk-HFDADVJZ.js → chunk-YUCKM3MD.js} +10 -14
  233. package/dist/cli-bundle/chunks/{chunk-HFDADVJZ.js.map → chunk-YUCKM3MD.js.map} +1 -1
  234. package/dist/cli-bundle/chunks/{chunk-SQYJ4HF2.js → chunk-YUMNZS3X.js} +6 -8
  235. package/dist/cli-bundle/chunks/{chunk-SQYJ4HF2.js.map → chunk-YUMNZS3X.js.map} +1 -1
  236. package/dist/cli-bundle/chunks/{chunk-AGHMOTGM.js → chunk-Z2JQH2MG.js} +2 -2
  237. package/dist/cli-bundle/chunks/{chunk-ZGK4L4JM.js → chunk-Z6RLSNUX.js} +4 -6
  238. package/dist/cli-bundle/chunks/{chunk-ZGK4L4JM.js.map → chunk-Z6RLSNUX.js.map} +1 -1
  239. package/dist/cli-bundle/chunks/{chunk-Y4M7CPQP.js → chunk-ZMOPZFVT.js} +4 -4
  240. package/dist/cli-bundle/chunks/close-E3RLZSP2.js +12 -0
  241. package/dist/cli-bundle/chunks/{close-2SSSHHUZ.js → close-K6BFI3OX.js} +5 -9
  242. package/dist/cli-bundle/chunks/close-many-6NBL3PM4.js +26 -0
  243. package/dist/cli-bundle/chunks/close-many-X4YKS3RO.js +22 -0
  244. package/dist/cli-bundle/chunks/comments-PLFK5ZKK.js +17 -0
  245. package/dist/cli-bundle/chunks/comments-ZNOD5PTV.js +13 -0
  246. package/dist/cli-bundle/chunks/copy-F7BUFY4J.js +9 -0
  247. package/dist/cli-bundle/chunks/{copy-32ROBIDL.js → copy-VH3L4MN2.js} +4 -8
  248. package/dist/cli-bundle/chunks/create-AMBMYP6F.js +25 -0
  249. package/dist/cli-bundle/chunks/{create-E77SDCUP.js → create-TRIBYORN.js} +9 -14
  250. package/dist/cli-bundle/chunks/delete-6KQHZYIP.js +10 -0
  251. package/dist/cli-bundle/chunks/{delete-RA5KTCLB.js → delete-ZNXUNCZR.js} +4 -8
  252. package/dist/cli-bundle/chunks/deps-CVDY7FFK.js +13 -0
  253. package/dist/cli-bundle/chunks/{deps-32SU7HO5.js → deps-SZXQHV73.js} +4 -8
  254. package/dist/cli-bundle/chunks/{docs-RRUPT7O2.js → docs-DR74ITCD.js} +6 -10
  255. package/dist/cli-bundle/chunks/docs-WCVYY6I7.js +14 -0
  256. package/dist/cli-bundle/chunks/files-H5YCA74Z.js +18 -0
  257. package/dist/cli-bundle/chunks/{files-PYKR2UUG.js → files-QEFQ2M3H.js} +6 -10
  258. package/dist/cli-bundle/chunks/{contracts-NYPEW2G4.js → focus-55TRYSNA.js} +7 -9
  259. package/dist/cli-bundle/chunks/focus-N2QGNS5D.js +10 -0
  260. package/dist/cli-bundle/chunks/history-compact-GWQ4UOEI.js +21 -0
  261. package/dist/cli-bundle/chunks/{history-compact-3MNXLKAT.js → history-compact-JJZ4EFL3.js} +9 -13
  262. package/dist/cli-bundle/chunks/history-redact-4GJOLXCM.js +17 -0
  263. package/dist/cli-bundle/chunks/{history-redact-P6DYF55G.js → history-redact-TPPUT3A5.js} +7 -11
  264. package/dist/cli-bundle/chunks/history-repair-HVCVCGUF.js +19 -0
  265. package/dist/cli-bundle/chunks/{history-repair-ZJQFMWPD.js → history-repair-J7PIZ6ZP.js} +9 -13
  266. package/dist/cli-bundle/chunks/{append-BGML6VLD.js → learnings-KB6BT4NR.js} +9 -11
  267. package/dist/cli-bundle/chunks/learnings-YYY3U2Y7.js +13 -0
  268. package/dist/cli-bundle/chunks/notes-BGG7VL72.js +13 -0
  269. package/dist/cli-bundle/chunks/notes-ZTHXVOKM.js +17 -0
  270. package/dist/cli-bundle/chunks/{plan-CHVE7PBR.js → plan-CJPKFRBK.js} +10 -15
  271. package/dist/cli-bundle/chunks/plan-MK2QY3GA.js +24 -0
  272. package/dist/cli-bundle/chunks/{profile-ZXGSKBJD.js → profile-AQNHXOYA.js} +9 -13
  273. package/dist/cli-bundle/chunks/{profile-LD23PSI6.js → profile-HTBFINKQ.js} +9 -13
  274. package/dist/cli-bundle/chunks/{register-list-query-B42JCCOI.js → register-list-query-EEF33SUJ.js} +43 -34
  275. package/dist/cli-bundle/chunks/register-list-query-EEF33SUJ.js.map +1 -0
  276. package/dist/cli-bundle/chunks/{register-list-query-OEYQHFXO.js → register-list-query-S4FBWIWN.js} +42 -33
  277. package/dist/cli-bundle/chunks/register-list-query-S4FBWIWN.js.map +7 -0
  278. package/dist/cli-bundle/chunks/{register-mutation-3QXIHCQG.js → register-mutation-L5Q7AUDN.js} +34 -39
  279. package/dist/cli-bundle/chunks/{register-mutation-3QXIHCQG.js.map → register-mutation-L5Q7AUDN.js.map} +1 -1
  280. package/dist/cli-bundle/chunks/{register-mutation-IAEST26S.js → register-mutation-QFLRBCI7.js} +36 -41
  281. package/dist/cli-bundle/chunks/{register-mutation-IAEST26S.js.map → register-mutation-QFLRBCI7.js.map} +1 -1
  282. package/dist/cli-bundle/chunks/{chunk-5BMM6XQY.js → register-operations-HDE4FVW4.js} +79 -46
  283. package/dist/cli-bundle/chunks/register-operations-HDE4FVW4.js.map +1 -0
  284. package/dist/cli-bundle/chunks/{chunk-Z3U3U5KD.js → register-operations-QDU43FCG.js} +78 -45
  285. package/dist/cli-bundle/chunks/register-operations-QDU43FCG.js.map +7 -0
  286. package/dist/cli-bundle/chunks/{register-setup-Q6KFNIOZ.js → register-setup-EGMTAXDC.js} +134 -32
  287. package/dist/cli-bundle/chunks/register-setup-EGMTAXDC.js.map +1 -0
  288. package/dist/cli-bundle/chunks/{register-setup-3ZVVX2VN.js → register-setup-PNIO3L2P.js} +133 -31
  289. package/dist/cli-bundle/chunks/register-setup-PNIO3L2P.js.map +7 -0
  290. package/dist/cli-bundle/chunks/{restore-5RQHAPMA.js → restore-BTBEZ5CK.js} +7 -11
  291. package/dist/cli-bundle/chunks/restore-EX4UUZL6.js +15 -0
  292. package/dist/cli-bundle/chunks/{schema-HBORFC6B.js → schema-DGSTYYQB.js} +6 -10
  293. package/dist/cli-bundle/chunks/{schema-245WW4G2.js → schema-HAIBEE24.js} +6 -10
  294. package/dist/cli-bundle/chunks/update-MP4XLU56.js +25 -0
  295. package/dist/cli-bundle/chunks/update-SDIRJGSY.js +21 -0
  296. package/dist/cli-bundle/chunks/update-many-34AIU6W7.js +31 -0
  297. package/dist/cli-bundle/chunks/update-many-JUPCNOKV.js +35 -0
  298. package/dist/cli-bundle/main.js +56 -32
  299. package/dist/cli-bundle/main.js.map +2 -2
  300. package/dist/cli-bundle/sdk-runtime.js +161 -107
  301. package/dist/cli-bundle/sdk-testing.js +7 -8
  302. package/dist/cli-bundle/sdk.js +154 -117
  303. package/dist/cli-bundle/sdk.js.map +2 -2
  304. package/dist/core/extensions/extension-types.d.ts +1 -0
  305. package/dist/core/extensions/extension-types.js +2 -2
  306. package/dist/core/extensions/extension-types.js.map +1 -1
  307. package/dist/core/extensions/loader.js +268 -231
  308. package/dist/core/extensions/loader.js.map +1 -1
  309. package/dist/core/history/drift-scan.js +3 -8
  310. package/dist/core/history/drift-scan.js.map +1 -1
  311. package/dist/core/output/mutation-projection.js +11 -5
  312. package/dist/core/output/mutation-projection.js.map +1 -1
  313. package/dist/core/search/cache.js +3 -3
  314. package/dist/core/search/cache.js.map +1 -1
  315. package/dist/core/search/semantic-defaults.d.ts +2 -0
  316. package/dist/core/search/semantic-defaults.js +11 -4
  317. package/dist/core/search/semantic-defaults.js.map +1 -1
  318. package/dist/core/search/vector-stores.d.ts +1 -1
  319. package/dist/core/search/vector-stores.js +33 -7
  320. package/dist/core/search/vector-stores.js.map +1 -1
  321. package/dist/mcp/server.d.ts +1 -1
  322. package/dist/sdk/cli-contracts/commander-types.js +3 -3
  323. package/dist/sdk/cli-contracts/commander-types.js.map +1 -1
  324. package/dist/sdk/cli-contracts/flag-contracts.js +12 -8
  325. package/dist/sdk/cli-contracts/flag-contracts.js.map +1 -1
  326. package/dist/sdk/cli-contracts/tool-parameter-tables.js +10 -2
  327. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  328. package/dist/sdk/cli-contracts/tool-schema.js +14 -8
  329. package/dist/sdk/cli-contracts/tool-schema.js.map +1 -1
  330. package/dist/sdk/index.d.ts +1 -1
  331. package/dist/sdk/index.js +3 -3
  332. package/dist/sdk/index.js.map +1 -1
  333. package/dist/sdk/runtime.d.ts +282 -8
  334. package/dist/sdk/runtime.js +453 -14
  335. package/dist/sdk/runtime.js.map +1 -1
  336. package/dist/sdk/start-task-status.d.ts +13 -0
  337. package/dist/sdk/start-task-status.js +19 -0
  338. package/dist/sdk/start-task-status.js.map +1 -0
  339. package/docs/COMMANDS.md +10 -1
  340. package/docs/EXTENSIONS.md +7 -20
  341. package/docs/RELEASING.md +6 -0
  342. package/docs/SDK.md +65 -0
  343. package/docs/TESTING.md +3 -0
  344. package/package.json +2 -1
  345. package/dist/cli-bundle/chunks/activity-WJCGCYPU.js +0 -18
  346. package/dist/cli-bundle/chunks/activity-Z6QUAUSG.js +0 -22
  347. package/dist/cli-bundle/chunks/aggregate-BDM6EIAR.js +0 -25
  348. package/dist/cli-bundle/chunks/aggregate-VQ2DHU3S.js +0 -21
  349. package/dist/cli-bundle/chunks/append-RKJYPU74.js +0 -15
  350. package/dist/cli-bundle/chunks/chunk-2XG4IZON.js +0 -218
  351. package/dist/cli-bundle/chunks/chunk-2XG4IZON.js.map +0 -7
  352. package/dist/cli-bundle/chunks/chunk-37E72CNS.js +0 -217
  353. package/dist/cli-bundle/chunks/chunk-37E72CNS.js.map +0 -1
  354. package/dist/cli-bundle/chunks/chunk-3GCS5SKL.js +0 -228
  355. package/dist/cli-bundle/chunks/chunk-3GCS5SKL.js.map +0 -1
  356. package/dist/cli-bundle/chunks/chunk-3KTN6IBA.js +0 -2330
  357. package/dist/cli-bundle/chunks/chunk-3KTN6IBA.js.map +0 -7
  358. package/dist/cli-bundle/chunks/chunk-3VHSI5FL.js.map +0 -1
  359. package/dist/cli-bundle/chunks/chunk-425E4QL5.js +0 -278
  360. package/dist/cli-bundle/chunks/chunk-425E4QL5.js.map +0 -7
  361. package/dist/cli-bundle/chunks/chunk-46CUF5L6.js.map +0 -7
  362. package/dist/cli-bundle/chunks/chunk-4BU75MF4.js +0 -87
  363. package/dist/cli-bundle/chunks/chunk-4BU75MF4.js.map +0 -7
  364. package/dist/cli-bundle/chunks/chunk-4HIFVN7N.js +0 -249
  365. package/dist/cli-bundle/chunks/chunk-4HIFVN7N.js.map +0 -7
  366. package/dist/cli-bundle/chunks/chunk-4IWYTWGF.js +0 -819
  367. package/dist/cli-bundle/chunks/chunk-4IWYTWGF.js.map +0 -1
  368. package/dist/cli-bundle/chunks/chunk-4MZVRJOE.js +0 -279
  369. package/dist/cli-bundle/chunks/chunk-4MZVRJOE.js.map +0 -1
  370. package/dist/cli-bundle/chunks/chunk-57NWPFF2.js.map +0 -1
  371. package/dist/cli-bundle/chunks/chunk-5AJXHQM7.js +0 -268
  372. package/dist/cli-bundle/chunks/chunk-5AJXHQM7.js.map +0 -1
  373. package/dist/cli-bundle/chunks/chunk-5BMM6XQY.js.map +0 -1
  374. package/dist/cli-bundle/chunks/chunk-5GZ7TDD6.js +0 -1868
  375. package/dist/cli-bundle/chunks/chunk-5GZ7TDD6.js.map +0 -7
  376. package/dist/cli-bundle/chunks/chunk-5VAA4YHR.js +0 -1749
  377. package/dist/cli-bundle/chunks/chunk-5VAA4YHR.js.map +0 -7
  378. package/dist/cli-bundle/chunks/chunk-64YKRTSV.js +0 -1961
  379. package/dist/cli-bundle/chunks/chunk-64YKRTSV.js.map +0 -1
  380. package/dist/cli-bundle/chunks/chunk-7C2O74AE.js +0 -23
  381. package/dist/cli-bundle/chunks/chunk-7C2O74AE.js.map +0 -7
  382. package/dist/cli-bundle/chunks/chunk-B7FRNMYN.js +0 -421
  383. package/dist/cli-bundle/chunks/chunk-B7FRNMYN.js.map +0 -1
  384. package/dist/cli-bundle/chunks/chunk-C5JBZRPU.js +0 -1985
  385. package/dist/cli-bundle/chunks/chunk-C5JBZRPU.js.map +0 -7
  386. package/dist/cli-bundle/chunks/chunk-CL36D4PC.js.map +0 -7
  387. package/dist/cli-bundle/chunks/chunk-COSPOP7H.js.map +0 -7
  388. package/dist/cli-bundle/chunks/chunk-COWTDV6B.js +0 -3461
  389. package/dist/cli-bundle/chunks/chunk-COWTDV6B.js.map +0 -7
  390. package/dist/cli-bundle/chunks/chunk-DEWEK6AN.js +0 -1858
  391. package/dist/cli-bundle/chunks/chunk-DEWEK6AN.js.map +0 -1
  392. package/dist/cli-bundle/chunks/chunk-DMRNBQOI.js.map +0 -1
  393. package/dist/cli-bundle/chunks/chunk-E3SZTQ4K.js +0 -1932
  394. package/dist/cli-bundle/chunks/chunk-E3SZTQ4K.js.map +0 -1
  395. package/dist/cli-bundle/chunks/chunk-EGAP5OWD.js.map +0 -1
  396. package/dist/cli-bundle/chunks/chunk-EKFNL33R.js.map +0 -1
  397. package/dist/cli-bundle/chunks/chunk-ENGQOEUY.js +0 -1704
  398. package/dist/cli-bundle/chunks/chunk-ENGQOEUY.js.map +0 -1
  399. package/dist/cli-bundle/chunks/chunk-EOKXK3R3.js.map +0 -1
  400. package/dist/cli-bundle/chunks/chunk-FLZSGSQR.js +0 -231
  401. package/dist/cli-bundle/chunks/chunk-FLZSGSQR.js.map +0 -7
  402. package/dist/cli-bundle/chunks/chunk-FOUYJE4A.js +0 -2090
  403. package/dist/cli-bundle/chunks/chunk-FOUYJE4A.js.map +0 -1
  404. package/dist/cli-bundle/chunks/chunk-G24G7ZAV.js +0 -1570
  405. package/dist/cli-bundle/chunks/chunk-G24G7ZAV.js.map +0 -1
  406. package/dist/cli-bundle/chunks/chunk-GEYZ4G4O.js +0 -239
  407. package/dist/cli-bundle/chunks/chunk-GEYZ4G4O.js.map +0 -1
  408. package/dist/cli-bundle/chunks/chunk-GPLPTGOV.js +0 -530
  409. package/dist/cli-bundle/chunks/chunk-GPLPTGOV.js.map +0 -7
  410. package/dist/cli-bundle/chunks/chunk-GZRDYONU.js +0 -1005
  411. package/dist/cli-bundle/chunks/chunk-GZRDYONU.js.map +0 -7
  412. package/dist/cli-bundle/chunks/chunk-HN6NSXNW.js +0 -277
  413. package/dist/cli-bundle/chunks/chunk-HN6NSXNW.js.map +0 -7
  414. package/dist/cli-bundle/chunks/chunk-IQNVQHOP.js +0 -309
  415. package/dist/cli-bundle/chunks/chunk-IQNVQHOP.js.map +0 -7
  416. package/dist/cli-bundle/chunks/chunk-JINYH2DB.js +0 -371
  417. package/dist/cli-bundle/chunks/chunk-JINYH2DB.js.map +0 -7
  418. package/dist/cli-bundle/chunks/chunk-JQXPY7DN.js +0 -2257
  419. package/dist/cli-bundle/chunks/chunk-JQXPY7DN.js.map +0 -7
  420. package/dist/cli-bundle/chunks/chunk-K46RF36U.js.map +0 -1
  421. package/dist/cli-bundle/chunks/chunk-KERMZVY5.js +0 -371
  422. package/dist/cli-bundle/chunks/chunk-KERMZVY5.js.map +0 -7
  423. package/dist/cli-bundle/chunks/chunk-KSRUHV2H.js +0 -76
  424. package/dist/cli-bundle/chunks/chunk-KSRUHV2H.js.map +0 -1
  425. package/dist/cli-bundle/chunks/chunk-LK6XLOGP.js.map +0 -7
  426. package/dist/cli-bundle/chunks/chunk-LP3HSFZ2.js +0 -140
  427. package/dist/cli-bundle/chunks/chunk-LP3HSFZ2.js.map +0 -1
  428. package/dist/cli-bundle/chunks/chunk-MAWDPCJW.js +0 -1601
  429. package/dist/cli-bundle/chunks/chunk-MAWDPCJW.js.map +0 -1
  430. package/dist/cli-bundle/chunks/chunk-MFAZSEM5.js +0 -1031
  431. package/dist/cli-bundle/chunks/chunk-MFAZSEM5.js.map +0 -1
  432. package/dist/cli-bundle/chunks/chunk-MFSCBT5Q.js +0 -995
  433. package/dist/cli-bundle/chunks/chunk-MFSCBT5Q.js.map +0 -1
  434. package/dist/cli-bundle/chunks/chunk-ML5X7DP2.js +0 -296
  435. package/dist/cli-bundle/chunks/chunk-ML5X7DP2.js.map +0 -1
  436. package/dist/cli-bundle/chunks/chunk-MLIYFOE7.js.map +0 -1
  437. package/dist/cli-bundle/chunks/chunk-MR6FJ7LL.js +0 -2043
  438. package/dist/cli-bundle/chunks/chunk-MR6FJ7LL.js.map +0 -7
  439. package/dist/cli-bundle/chunks/chunk-MXYA5SAJ.js +0 -2033
  440. package/dist/cli-bundle/chunks/chunk-MXYA5SAJ.js.map +0 -1
  441. package/dist/cli-bundle/chunks/chunk-N745W3B3.js +0 -1604
  442. package/dist/cli-bundle/chunks/chunk-N745W3B3.js.map +0 -7
  443. package/dist/cli-bundle/chunks/chunk-NMP5I3I5.js +0 -1615
  444. package/dist/cli-bundle/chunks/chunk-NMP5I3I5.js.map +0 -7
  445. package/dist/cli-bundle/chunks/chunk-NNHHXJB2.js +0 -20
  446. package/dist/cli-bundle/chunks/chunk-NNHHXJB2.js.map +0 -1
  447. package/dist/cli-bundle/chunks/chunk-PZUGEOPS.js +0 -143
  448. package/dist/cli-bundle/chunks/chunk-PZUGEOPS.js.map +0 -7
  449. package/dist/cli-bundle/chunks/chunk-QLMX7SRD.js.map +0 -7
  450. package/dist/cli-bundle/chunks/chunk-QX6HM775.js +0 -398
  451. package/dist/cli-bundle/chunks/chunk-QX6HM775.js.map +0 -7
  452. package/dist/cli-bundle/chunks/chunk-QZ342C63.js +0 -220
  453. package/dist/cli-bundle/chunks/chunk-QZ342C63.js.map +0 -7
  454. package/dist/cli-bundle/chunks/chunk-R2EMWY7Q.js +0 -368
  455. package/dist/cli-bundle/chunks/chunk-R2EMWY7Q.js.map +0 -1
  456. package/dist/cli-bundle/chunks/chunk-RFNYTESG.js +0 -520
  457. package/dist/cli-bundle/chunks/chunk-RFNYTESG.js.map +0 -1
  458. package/dist/cli-bundle/chunks/chunk-RKQOO2UM.js +0 -79
  459. package/dist/cli-bundle/chunks/chunk-RKQOO2UM.js.map +0 -7
  460. package/dist/cli-bundle/chunks/chunk-RQLT6ZWB.js +0 -282
  461. package/dist/cli-bundle/chunks/chunk-RQLT6ZWB.js.map +0 -7
  462. package/dist/cli-bundle/chunks/chunk-S3JS6YVZ.js +0 -274
  463. package/dist/cli-bundle/chunks/chunk-S3JS6YVZ.js.map +0 -1
  464. package/dist/cli-bundle/chunks/chunk-SCUR7K7N.js.map +0 -7
  465. package/dist/cli-bundle/chunks/chunk-SHQY2IDC.js +0 -1977
  466. package/dist/cli-bundle/chunks/chunk-SHQY2IDC.js.map +0 -7
  467. package/dist/cli-bundle/chunks/chunk-SPZ6DOGY.js +0 -1041
  468. package/dist/cli-bundle/chunks/chunk-SPZ6DOGY.js.map +0 -7
  469. package/dist/cli-bundle/chunks/chunk-T42JWV3F.js +0 -822
  470. package/dist/cli-bundle/chunks/chunk-T42JWV3F.js.map +0 -7
  471. package/dist/cli-bundle/chunks/chunk-TKD5VCTD.js.map +0 -1
  472. package/dist/cli-bundle/chunks/chunk-TULGS6X6.js.map +0 -1
  473. package/dist/cli-bundle/chunks/chunk-TZXRBVAM.js +0 -2306
  474. package/dist/cli-bundle/chunks/chunk-TZXRBVAM.js.map +0 -1
  475. package/dist/cli-bundle/chunks/chunk-VIIUS6N6.js.map +0 -7
  476. package/dist/cli-bundle/chunks/chunk-VPIM42PC.js.map +0 -7
  477. package/dist/cli-bundle/chunks/chunk-VQRSPVME.js +0 -368
  478. package/dist/cli-bundle/chunks/chunk-VQRSPVME.js.map +0 -1
  479. package/dist/cli-bundle/chunks/chunk-VY3VQ22F.js +0 -84
  480. package/dist/cli-bundle/chunks/chunk-VY3VQ22F.js.map +0 -1
  481. package/dist/cli-bundle/chunks/chunk-WG34ZNQQ.js +0 -3423
  482. package/dist/cli-bundle/chunks/chunk-WG34ZNQQ.js.map +0 -1
  483. package/dist/cli-bundle/chunks/chunk-WLSM645P.js +0 -2247
  484. package/dist/cli-bundle/chunks/chunk-WLSM645P.js.map +0 -1
  485. package/dist/cli-bundle/chunks/chunk-WRTENIX3.js +0 -215
  486. package/dist/cli-bundle/chunks/chunk-WRTENIX3.js.map +0 -1
  487. package/dist/cli-bundle/chunks/chunk-WSBLYDWV.js +0 -388
  488. package/dist/cli-bundle/chunks/chunk-WSBLYDWV.js.map +0 -1
  489. package/dist/cli-bundle/chunks/chunk-XC5BURG2.js +0 -306
  490. package/dist/cli-bundle/chunks/chunk-XC5BURG2.js.map +0 -1
  491. package/dist/cli-bundle/chunks/chunk-XDB7RWQT.js +0 -424
  492. package/dist/cli-bundle/chunks/chunk-XDB7RWQT.js.map +0 -7
  493. package/dist/cli-bundle/chunks/chunk-Y6BK55A3.js +0 -2128
  494. package/dist/cli-bundle/chunks/chunk-Y6BK55A3.js.map +0 -7
  495. package/dist/cli-bundle/chunks/chunk-Z3U3U5KD.js.map +0 -7
  496. package/dist/cli-bundle/chunks/chunk-ZO3XKAOP.js +0 -299
  497. package/dist/cli-bundle/chunks/chunk-ZO3XKAOP.js.map +0 -7
  498. package/dist/cli-bundle/chunks/chunk-ZSUS2OD3.js.map +0 -7
  499. package/dist/cli-bundle/chunks/claim-RFS7BROJ.js +0 -19
  500. package/dist/cli-bundle/chunks/claim-XP5AWZ5H.js +0 -23
  501. package/dist/cli-bundle/chunks/close-GEANHQ2J.js +0 -16
  502. package/dist/cli-bundle/chunks/close-many-CMZW7ITN.js +0 -31
  503. package/dist/cli-bundle/chunks/close-many-ZFDIG6M7.js +0 -27
  504. package/dist/cli-bundle/chunks/comments-MFSYVNNU.js +0 -21
  505. package/dist/cli-bundle/chunks/comments-XUBPXDYX.js +0 -17
  506. package/dist/cli-bundle/chunks/config-D7XQMONX.js +0 -18
  507. package/dist/cli-bundle/chunks/config-T4FHBSYN.js +0 -22
  508. package/dist/cli-bundle/chunks/context-DIU275XI.js +0 -48
  509. package/dist/cli-bundle/chunks/context-JCOYB4LZ.js +0 -44
  510. package/dist/cli-bundle/chunks/contracts-BVO7CSLK.js +0 -12
  511. package/dist/cli-bundle/chunks/copy-NAGLGMHZ.js +0 -13
  512. package/dist/cli-bundle/chunks/create-4V7SWNBB.js +0 -30
  513. package/dist/cli-bundle/chunks/delete-NQI5OSKN.js +0 -14
  514. package/dist/cli-bundle/chunks/deps-T7SCWXEX.js +0 -17
  515. package/dist/cli-bundle/chunks/docs-WL2IWGWV.js +0 -18
  516. package/dist/cli-bundle/chunks/eval-NF2J5SHR.js +0 -23
  517. package/dist/cli-bundle/chunks/eval-SKDT3MZU.js +0 -27
  518. package/dist/cli-bundle/chunks/extension-LAXKCAYE.js +0 -42
  519. package/dist/cli-bundle/chunks/extension-ZISPBRBC.js +0 -38
  520. package/dist/cli-bundle/chunks/files-EWRQHGIS.js +0 -22
  521. package/dist/cli-bundle/chunks/focus-4T7TM4MT.js +0 -18
  522. package/dist/cli-bundle/chunks/focus-L3YUASOD.js +0 -14
  523. package/dist/cli-bundle/chunks/gc-2PCTYYRI.js +0 -12
  524. package/dist/cli-bundle/chunks/get-7DMITJ3G.js +0 -23
  525. package/dist/cli-bundle/chunks/get-VKQXCXLL.js +0 -19
  526. package/dist/cli-bundle/chunks/health-CVSTAR2F.js +0 -31
  527. package/dist/cli-bundle/chunks/health-TV3GKTFN.js +0 -35
  528. package/dist/cli-bundle/chunks/history-D4JUX5XV.js +0 -20
  529. package/dist/cli-bundle/chunks/history-D4JUX5XV.js.map +0 -7
  530. package/dist/cli-bundle/chunks/history-LQ2UWZTE.js +0 -24
  531. package/dist/cli-bundle/chunks/history-LQ2UWZTE.js.map +0 -1
  532. package/dist/cli-bundle/chunks/history-compact-3MNXLKAT.js.map +0 -1
  533. package/dist/cli-bundle/chunks/history-compact-QWEO32FP.js +0 -25
  534. package/dist/cli-bundle/chunks/history-compact-QWEO32FP.js.map +0 -7
  535. package/dist/cli-bundle/chunks/history-redact-3OIVBVIY.js +0 -21
  536. package/dist/cli-bundle/chunks/history-redact-3OIVBVIY.js.map +0 -7
  537. package/dist/cli-bundle/chunks/history-redact-P6DYF55G.js.map +0 -1
  538. package/dist/cli-bundle/chunks/history-repair-I3E73UGQ.js +0 -23
  539. package/dist/cli-bundle/chunks/history-repair-I3E73UGQ.js.map +0 -7
  540. package/dist/cli-bundle/chunks/history-repair-ZJQFMWPD.js.map +0 -1
  541. package/dist/cli-bundle/chunks/init-C3LJPWQZ.js +0 -30
  542. package/dist/cli-bundle/chunks/init-C3LJPWQZ.js.map +0 -1
  543. package/dist/cli-bundle/chunks/init-J3DPGWQI.js +0 -26
  544. package/dist/cli-bundle/chunks/init-J3DPGWQI.js.map +0 -7
  545. package/dist/cli-bundle/chunks/learnings-5BO2SNDW.js +0 -21
  546. package/dist/cli-bundle/chunks/learnings-5BO2SNDW.js.map +0 -1
  547. package/dist/cli-bundle/chunks/learnings-OGP4JB4I.js +0 -17
  548. package/dist/cli-bundle/chunks/learnings-OGP4JB4I.js.map +0 -7
  549. package/dist/cli-bundle/chunks/list-O5NZVSPN.js +0 -36
  550. package/dist/cli-bundle/chunks/list-O5NZVSPN.js.map +0 -1
  551. package/dist/cli-bundle/chunks/list-Z55YCNTC.js +0 -32
  552. package/dist/cli-bundle/chunks/list-Z55YCNTC.js.map +0 -7
  553. package/dist/cli-bundle/chunks/next-GBNTGXFC.js +0 -28
  554. package/dist/cli-bundle/chunks/next-GBNTGXFC.js.map +0 -7
  555. package/dist/cli-bundle/chunks/next-QKW7PTKE.js +0 -32
  556. package/dist/cli-bundle/chunks/next-QKW7PTKE.js.map +0 -1
  557. package/dist/cli-bundle/chunks/notes-R5FZTKWF.js +0 -17
  558. package/dist/cli-bundle/chunks/notes-R5FZTKWF.js.map +0 -7
  559. package/dist/cli-bundle/chunks/notes-WCGIULVG.js +0 -21
  560. package/dist/cli-bundle/chunks/notes-WCGIULVG.js.map +0 -1
  561. package/dist/cli-bundle/chunks/plan-ADISFYH4.js +0 -29
  562. package/dist/cli-bundle/chunks/plan-ADISFYH4.js.map +0 -7
  563. package/dist/cli-bundle/chunks/plan-CHVE7PBR.js.map +0 -1
  564. package/dist/cli-bundle/chunks/profile-LD23PSI6.js.map +0 -7
  565. package/dist/cli-bundle/chunks/profile-ZXGSKBJD.js.map +0 -1
  566. package/dist/cli-bundle/chunks/register-list-query-B42JCCOI.js.map +0 -1
  567. package/dist/cli-bundle/chunks/register-list-query-OEYQHFXO.js.map +0 -7
  568. package/dist/cli-bundle/chunks/register-operations-I3M3U7DS.js +0 -19
  569. package/dist/cli-bundle/chunks/register-operations-I3M3U7DS.js.map +0 -7
  570. package/dist/cli-bundle/chunks/register-operations-UHKENLZV.js +0 -23
  571. package/dist/cli-bundle/chunks/register-operations-UHKENLZV.js.map +0 -1
  572. package/dist/cli-bundle/chunks/register-setup-3ZVVX2VN.js.map +0 -7
  573. package/dist/cli-bundle/chunks/register-setup-Q6KFNIOZ.js.map +0 -1
  574. package/dist/cli-bundle/chunks/restore-5RQHAPMA.js.map +0 -1
  575. package/dist/cli-bundle/chunks/restore-PNEIBBLW.js +0 -19
  576. package/dist/cli-bundle/chunks/restore-PNEIBBLW.js.map +0 -7
  577. package/dist/cli-bundle/chunks/scheduling-shortcuts-4G56YHVQ.js +0 -29
  578. package/dist/cli-bundle/chunks/scheduling-shortcuts-4G56YHVQ.js.map +0 -1
  579. package/dist/cli-bundle/chunks/scheduling-shortcuts-75DULBYP.js +0 -25
  580. package/dist/cli-bundle/chunks/scheduling-shortcuts-75DULBYP.js.map +0 -7
  581. package/dist/cli-bundle/chunks/schema-245WW4G2.js.map +0 -1
  582. package/dist/cli-bundle/chunks/schema-HBORFC6B.js.map +0 -7
  583. package/dist/cli-bundle/chunks/search-AOZC5SIK.js +0 -34
  584. package/dist/cli-bundle/chunks/search-AOZC5SIK.js.map +0 -7
  585. package/dist/cli-bundle/chunks/search-DRXPGHD7.js +0 -38
  586. package/dist/cli-bundle/chunks/search-DRXPGHD7.js.map +0 -1
  587. package/dist/cli-bundle/chunks/stats-NJG4NLHG.js +0 -21
  588. package/dist/cli-bundle/chunks/stats-NJG4NLHG.js.map +0 -1
  589. package/dist/cli-bundle/chunks/stats-RG6AG4N2.js +0 -17
  590. package/dist/cli-bundle/chunks/stats-RG6AG4N2.js.map +0 -7
  591. package/dist/cli-bundle/chunks/telemetry-HQC2JJIF.js +0 -14
  592. package/dist/cli-bundle/chunks/telemetry-HQC2JJIF.js.map +0 -7
  593. package/dist/cli-bundle/chunks/telemetry-MPNL3HHY.js +0 -18
  594. package/dist/cli-bundle/chunks/telemetry-MPNL3HHY.js.map +0 -1
  595. package/dist/cli-bundle/chunks/test-6CMOCWUC.js +0 -39
  596. package/dist/cli-bundle/chunks/test-6CMOCWUC.js.map +0 -7
  597. package/dist/cli-bundle/chunks/test-RI7XHBZL.js +0 -43
  598. package/dist/cli-bundle/chunks/test-RI7XHBZL.js.map +0 -1
  599. package/dist/cli-bundle/chunks/test-all-7R7YRZIA.js +0 -29
  600. package/dist/cli-bundle/chunks/test-all-7R7YRZIA.js.map +0 -7
  601. package/dist/cli-bundle/chunks/test-all-QEIORFYW.js +0 -33
  602. package/dist/cli-bundle/chunks/test-all-QEIORFYW.js.map +0 -1
  603. package/dist/cli-bundle/chunks/test-runs-5Y2BOU2S.js +0 -28
  604. package/dist/cli-bundle/chunks/test-runs-5Y2BOU2S.js.map +0 -1
  605. package/dist/cli-bundle/chunks/test-runs-PVGC3GRZ.js +0 -24
  606. package/dist/cli-bundle/chunks/test-runs-PVGC3GRZ.js.map +0 -7
  607. package/dist/cli-bundle/chunks/update-QVJDFEAP.js +0 -30
  608. package/dist/cli-bundle/chunks/update-QVJDFEAP.js.map +0 -1
  609. package/dist/cli-bundle/chunks/update-VQVHAY6X.js +0 -26
  610. package/dist/cli-bundle/chunks/update-VQVHAY6X.js.map +0 -7
  611. package/dist/cli-bundle/chunks/update-many-S7XWBSB3.js +0 -37
  612. package/dist/cli-bundle/chunks/update-many-S7XWBSB3.js.map +0 -7
  613. package/dist/cli-bundle/chunks/update-many-YIYW6XQ6.js +0 -41
  614. package/dist/cli-bundle/chunks/update-many-YIYW6XQ6.js.map +0 -1
  615. package/dist/cli-bundle/chunks/upgrade-OPRXA56R.js +0 -24
  616. package/dist/cli-bundle/chunks/upgrade-OPRXA56R.js.map +0 -7
  617. package/dist/cli-bundle/chunks/upgrade-WH4BTQLX.js +0 -28
  618. package/dist/cli-bundle/chunks/upgrade-WH4BTQLX.js.map +0 -1
  619. package/dist/cli-bundle/chunks/validate-4NTXSB62.js +0 -36
  620. package/dist/cli-bundle/chunks/validate-4NTXSB62.js.map +0 -1
  621. package/dist/cli-bundle/chunks/validate-MUFXQZMI.js +0 -32
  622. package/dist/cli-bundle/chunks/validate-MUFXQZMI.js.map +0 -7
  623. /package/dist/cli-bundle/chunks/{activity-WJCGCYPU.js.map → append-CDPAYYSB.js.map} +0 -0
  624. /package/dist/cli-bundle/chunks/{activity-Z6QUAUSG.js.map → append-RSPHC423.js.map} +0 -0
  625. /package/dist/cli-bundle/chunks/{chunk-24YG75HI.js.map → chunk-3FUXM574.js.map} +0 -0
  626. /package/dist/cli-bundle/chunks/{chunk-IWVU4C2F.js.map → chunk-3SHDAKMF.js.map} +0 -0
  627. /package/dist/cli-bundle/chunks/{chunk-MUH7A3FD.js.map → chunk-3V5C7PUH.js.map} +0 -0
  628. /package/dist/cli-bundle/chunks/{chunk-EGY6JBQ3.js.map → chunk-4I7KS5ES.js.map} +0 -0
  629. /package/dist/cli-bundle/chunks/{chunk-GJ7QC5DJ.js.map → chunk-5STY7NVM.js.map} +0 -0
  630. /package/dist/cli-bundle/chunks/{chunk-JJP45OEI.js.map → chunk-5VAZHYVQ.js.map} +0 -0
  631. /package/dist/cli-bundle/chunks/{chunk-22KBU3MW.js.map → chunk-6RR4XM5H.js.map} +0 -0
  632. /package/dist/cli-bundle/chunks/{chunk-KUOOJR35.js.map → chunk-7QKSLAHB.js.map} +0 -0
  633. /package/dist/cli-bundle/chunks/{chunk-NGXQ3PFT.js.map → chunk-7UCBLJDF.js.map} +0 -0
  634. /package/dist/cli-bundle/chunks/{chunk-7DT4WSH2.js.map → chunk-BFNFTHWQ.js.map} +0 -0
  635. /package/dist/cli-bundle/chunks/{chunk-Y46GD4IX.js.map → chunk-C3YU3TXX.js.map} +0 -0
  636. /package/dist/cli-bundle/chunks/{chunk-AZYGZGGI.js.map → chunk-CGDUIPJL.js.map} +0 -0
  637. /package/dist/cli-bundle/chunks/{chunk-XG625QP4.js.map → chunk-EP2CKDS7.js.map} +0 -0
  638. /package/dist/cli-bundle/chunks/{chunk-MVYWGY2A.js.map → chunk-J6AD3GWC.js.map} +0 -0
  639. /package/dist/cli-bundle/chunks/{chunk-R5BMJX33.js.map → chunk-KFL3XHMA.js.map} +0 -0
  640. /package/dist/cli-bundle/chunks/{chunk-MWMVPCIE.js.map → chunk-PCBZ2VJD.js.map} +0 -0
  641. /package/dist/cli-bundle/chunks/{chunk-B6DUFX6H.js.map → chunk-Q3CFSOQZ.js.map} +0 -0
  642. /package/dist/cli-bundle/chunks/{chunk-KGFUY7WN.js.map → chunk-TU5P744I.js.map} +0 -0
  643. /package/dist/cli-bundle/chunks/{chunk-JDDLOQAE.js.map → chunk-UEATYUZW.js.map} +0 -0
  644. /package/dist/cli-bundle/chunks/{chunk-JVH7QBVV.js.map → chunk-UFNFHCAC.js.map} +0 -0
  645. /package/dist/cli-bundle/chunks/{chunk-AGHMOTGM.js.map → chunk-Z2JQH2MG.js.map} +0 -0
  646. /package/dist/cli-bundle/chunks/{chunk-Y4M7CPQP.js.map → chunk-ZMOPZFVT.js.map} +0 -0
  647. /package/dist/cli-bundle/chunks/{aggregate-VQ2DHU3S.js.map → close-E3RLZSP2.js.map} +0 -0
  648. /package/dist/cli-bundle/chunks/{aggregate-BDM6EIAR.js.map → close-K6BFI3OX.js.map} +0 -0
  649. /package/dist/cli-bundle/chunks/{append-BGML6VLD.js.map → close-many-6NBL3PM4.js.map} +0 -0
  650. /package/dist/cli-bundle/chunks/{append-RKJYPU74.js.map → close-many-X4YKS3RO.js.map} +0 -0
  651. /package/dist/cli-bundle/chunks/{claim-XP5AWZ5H.js.map → comments-PLFK5ZKK.js.map} +0 -0
  652. /package/dist/cli-bundle/chunks/{claim-RFS7BROJ.js.map → comments-ZNOD5PTV.js.map} +0 -0
  653. /package/dist/cli-bundle/chunks/{close-GEANHQ2J.js.map → copy-F7BUFY4J.js.map} +0 -0
  654. /package/dist/cli-bundle/chunks/{close-2SSSHHUZ.js.map → copy-VH3L4MN2.js.map} +0 -0
  655. /package/dist/cli-bundle/chunks/{close-many-ZFDIG6M7.js.map → create-AMBMYP6F.js.map} +0 -0
  656. /package/dist/cli-bundle/chunks/{close-many-CMZW7ITN.js.map → create-TRIBYORN.js.map} +0 -0
  657. /package/dist/cli-bundle/chunks/{comments-XUBPXDYX.js.map → delete-6KQHZYIP.js.map} +0 -0
  658. /package/dist/cli-bundle/chunks/{comments-MFSYVNNU.js.map → delete-ZNXUNCZR.js.map} +0 -0
  659. /package/dist/cli-bundle/chunks/{config-D7XQMONX.js.map → deps-CVDY7FFK.js.map} +0 -0
  660. /package/dist/cli-bundle/chunks/{config-T4FHBSYN.js.map → deps-SZXQHV73.js.map} +0 -0
  661. /package/dist/cli-bundle/chunks/{context-DIU275XI.js.map → docs-DR74ITCD.js.map} +0 -0
  662. /package/dist/cli-bundle/chunks/{context-JCOYB4LZ.js.map → docs-WCVYY6I7.js.map} +0 -0
  663. /package/dist/cli-bundle/chunks/{contracts-BVO7CSLK.js.map → files-H5YCA74Z.js.map} +0 -0
  664. /package/dist/cli-bundle/chunks/{contracts-NYPEW2G4.js.map → files-QEFQ2M3H.js.map} +0 -0
  665. /package/dist/cli-bundle/chunks/{copy-32ROBIDL.js.map → focus-55TRYSNA.js.map} +0 -0
  666. /package/dist/cli-bundle/chunks/{copy-NAGLGMHZ.js.map → focus-N2QGNS5D.js.map} +0 -0
  667. /package/dist/cli-bundle/chunks/{create-4V7SWNBB.js.map → history-compact-GWQ4UOEI.js.map} +0 -0
  668. /package/dist/cli-bundle/chunks/{create-E77SDCUP.js.map → history-compact-JJZ4EFL3.js.map} +0 -0
  669. /package/dist/cli-bundle/chunks/{delete-NQI5OSKN.js.map → history-redact-4GJOLXCM.js.map} +0 -0
  670. /package/dist/cli-bundle/chunks/{delete-RA5KTCLB.js.map → history-redact-TPPUT3A5.js.map} +0 -0
  671. /package/dist/cli-bundle/chunks/{deps-T7SCWXEX.js.map → history-repair-HVCVCGUF.js.map} +0 -0
  672. /package/dist/cli-bundle/chunks/{deps-32SU7HO5.js.map → history-repair-J7PIZ6ZP.js.map} +0 -0
  673. /package/dist/cli-bundle/chunks/{docs-RRUPT7O2.js.map → learnings-KB6BT4NR.js.map} +0 -0
  674. /package/dist/cli-bundle/chunks/{docs-WL2IWGWV.js.map → learnings-YYY3U2Y7.js.map} +0 -0
  675. /package/dist/cli-bundle/chunks/{eval-NF2J5SHR.js.map → notes-BGG7VL72.js.map} +0 -0
  676. /package/dist/cli-bundle/chunks/{eval-SKDT3MZU.js.map → notes-ZTHXVOKM.js.map} +0 -0
  677. /package/dist/cli-bundle/chunks/{extension-LAXKCAYE.js.map → plan-CJPKFRBK.js.map} +0 -0
  678. /package/dist/cli-bundle/chunks/{extension-ZISPBRBC.js.map → plan-MK2QY3GA.js.map} +0 -0
  679. /package/dist/cli-bundle/chunks/{files-PYKR2UUG.js.map → profile-AQNHXOYA.js.map} +0 -0
  680. /package/dist/cli-bundle/chunks/{files-EWRQHGIS.js.map → profile-HTBFINKQ.js.map} +0 -0
  681. /package/dist/cli-bundle/chunks/{focus-4T7TM4MT.js.map → restore-BTBEZ5CK.js.map} +0 -0
  682. /package/dist/cli-bundle/chunks/{focus-L3YUASOD.js.map → restore-EX4UUZL6.js.map} +0 -0
  683. /package/dist/cli-bundle/chunks/{gc-2PCTYYRI.js.map → schema-DGSTYYQB.js.map} +0 -0
  684. /package/dist/cli-bundle/chunks/{gc-2DNMPXMC.js.map → schema-HAIBEE24.js.map} +0 -0
  685. /package/dist/cli-bundle/chunks/{get-7DMITJ3G.js.map → update-MP4XLU56.js.map} +0 -0
  686. /package/dist/cli-bundle/chunks/{get-VKQXCXLL.js.map → update-SDIRJGSY.js.map} +0 -0
  687. /package/dist/cli-bundle/chunks/{health-CVSTAR2F.js.map → update-many-34AIU6W7.js.map} +0 -0
  688. /package/dist/cli-bundle/chunks/{health-TV3GKTFN.js.map → update-many-JUPCNOKV.js.map} +0 -0
@@ -1,2306 +0,0 @@
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]="106509f0-71e6-5a15-915f-acf57240a3e4")}catch(e){}}();
3
- import {
4
- collectStaleVectorizationIds
5
- } from "./chunk-ROGZTCCB.js";
6
- import {
7
- applyFilterValueEcho,
8
- buildContentFilterEcho,
9
- buildGovernanceMissingFilterEcho,
10
- collectRuntimeFilterValues,
11
- isStatusAllFilterInput,
12
- matchesRuntimeFilters,
13
- parseStatusFilterCsv,
14
- resolveContentFieldFilters,
15
- resolveMissingMetadataFilters
16
- } from "./chunk-3VHSI5FL.js";
17
- import {
18
- hasContentFieldFilter,
19
- itemMatchesContentFilters
20
- } from "./chunk-QB7XMHJW.js";
21
- import {
22
- hasMissingMetadataFilter,
23
- itemMatchesMissingMetadata,
24
- lifecycleClassifierFromStatusRegistry
25
- } from "./chunk-MVYWGY2A.js";
26
- import {
27
- parseLimit,
28
- parsePriority,
29
- parseType
30
- } from "./chunk-22KBU3MW.js";
31
- import {
32
- buildEventCorpus,
33
- buildPlanFlatCorpus,
34
- buildReminderCorpus,
35
- buildSearchCorpus,
36
- executeEmbeddingRequest,
37
- executeVectorQuery,
38
- readVectorizationStatusLedger,
39
- resolveEmbeddingProviders,
40
- resolveSearchCorpusFields,
41
- resolveSettingsWithSemanticRuntimeDefaults,
42
- resolveVectorStores
43
- } from "./chunk-EOKXK3R3.js";
44
- import {
45
- resolveRegisteredSearchProvider,
46
- resolveRegisteredVectorStoreAdapter
47
- } from "./chunk-KGHH652T.js";
48
- import {
49
- collectRegisteredItemFieldNames,
50
- listAllDocumentCandidatesCached,
51
- listAllFrontMatter,
52
- toItemRecord
53
- } from "./chunk-ENGQOEUY.js";
54
- import {
55
- isTerminalStatus,
56
- parseItemDocument
57
- } from "./chunk-G24G7ZAV.js";
58
- import {
59
- compareTimestampStrings,
60
- nowIso,
61
- resolveIsoOrRelative
62
- } from "./chunk-3GCS5SKL.js";
63
- import {
64
- PmCliError,
65
- getActiveExtensionRegistrations,
66
- readSettings,
67
- runActiveOnReadHooks
68
- } from "./chunk-E3SZTQ4K.js";
69
- import {
70
- EXIT_CODE,
71
- coerceNumberInRange,
72
- coercePositiveInteger,
73
- getItemPath,
74
- getSettingsPath,
75
- isPathWithinDirectory,
76
- pathExists,
77
- resolveGlobalPmRoot,
78
- resolveItemTypeRegistry,
79
- resolvePmRoot,
80
- resolveRuntimeFieldRegistry,
81
- resolveRuntimeStatusRegistry,
82
- toNonEmptyString,
83
- toNonEmptyStringOrUndefined
84
- } from "./chunk-57NWPFF2.js";
85
-
86
- // dist/cli/commands/search.js
87
- import fs from "node:fs/promises";
88
- import path from "node:path";
89
-
90
- // dist/core/shared/text-normalization.js
91
- function normalizeLowercaseWhitespace(value) {
92
- return value.trim().toLowerCase().replace(/\s+/g, " ");
93
- }
94
- function tokenizeAlphaNumeric(value) {
95
- return normalizeLowercaseWhitespace(value).split(/[^a-z0-9]+/).filter((token) => token.length > 0);
96
- }
97
- function jaccardSimilarity(leftTokens, rightTokens) {
98
- if (leftTokens.length === 0 && rightTokens.length === 0) {
99
- return 1;
100
- }
101
- if (leftTokens.length === 0 || rightTokens.length === 0) {
102
- return 0;
103
- }
104
- const leftSet = new Set(leftTokens);
105
- const rightSet = new Set(rightTokens);
106
- let intersection = 0;
107
- for (const token of leftSet) {
108
- if (rightSet.has(token)) {
109
- intersection += 1;
110
- }
111
- }
112
- const union = (/* @__PURE__ */ new Set([...leftSet, ...rightSet])).size;
113
- return intersection / union;
114
- }
115
-
116
- // dist/core/search/relevance.js
117
- var DEFAULT_QUERY_EXPANSION_MAX_QUERIES = 4;
118
- var DEFAULT_RERANK_TOP_K = 20;
119
- var MAX_RERANK_TOP_K = 200;
120
- var QUERY_EXPANSION_STOP_WORDS = /* @__PURE__ */ new Set([
121
- "a",
122
- "an",
123
- "and",
124
- "for",
125
- "from",
126
- "in",
127
- "into",
128
- "of",
129
- "on",
130
- "or",
131
- "the",
132
- "to",
133
- "with"
134
- ]);
135
- function dedupeQueries(values, limit) {
136
- const deduped = [];
137
- const seen = /* @__PURE__ */ new Set();
138
- for (const entry of values) {
139
- const normalized = entry.trim().replaceAll(/\s+/g, " ");
140
- if (normalized.length === 0) {
141
- continue;
142
- }
143
- const dedupeKey = normalized.toLowerCase();
144
- if (seen.has(dedupeKey)) {
145
- continue;
146
- }
147
- seen.add(dedupeKey);
148
- deduped.push(normalized);
149
- if (deduped.length >= limit) {
150
- break;
151
- }
152
- }
153
- return deduped;
154
- }
155
- function singularizeSimple(token) {
156
- const normalizedToken = token.toLowerCase();
157
- if (normalizedToken.length > 4 && normalizedToken.endsWith("ies")) {
158
- return `${normalizedToken.slice(0, -3)}y`;
159
- }
160
- if (normalizedToken.length > 4 && (normalizedToken.endsWith("ches") || normalizedToken.endsWith("shes") || normalizedToken.endsWith("xes") || normalizedToken.endsWith("zes") || normalizedToken.endsWith("sses"))) {
161
- return normalizedToken.slice(0, -2);
162
- }
163
- if (normalizedToken.length > 3 && normalizedToken.endsWith("s") && !normalizedToken.endsWith("ss") && !normalizedToken.endsWith("us") && !normalizedToken.endsWith("is") && !normalizedToken.endsWith("as")) {
164
- return normalizedToken.slice(0, -1);
165
- }
166
- return normalizedToken;
167
- }
168
- function pluralizeSimple(token) {
169
- const normalizedToken = token.toLowerCase();
170
- if (normalizedToken.length > 2 && (!normalizedToken.endsWith("s") || normalizedToken.endsWith("ss"))) {
171
- if (normalizedToken.endsWith("y") && !/[aeiou]y$/u.test(normalizedToken)) {
172
- return `${normalizedToken.slice(0, -1)}ies`;
173
- }
174
- if (normalizedToken.endsWith("ch") || normalizedToken.endsWith("sh") || normalizedToken.endsWith("x") || normalizedToken.endsWith("z") || normalizedToken.endsWith("ss")) {
175
- return `${normalizedToken}es`;
176
- }
177
- return `${normalizedToken}s`;
178
- }
179
- return normalizedToken;
180
- }
181
- function buildDeterministicQueryExpansions(query, maxQueries = DEFAULT_QUERY_EXPANSION_MAX_QUERIES) {
182
- const normalizedQuery = query.trim().replaceAll(/\s+/g, " ");
183
- if (normalizedQuery.length === 0) {
184
- return [];
185
- }
186
- const tokens = tokenizeAlphaNumeric(normalizedQuery);
187
- if (tokens.length === 0) {
188
- return [normalizedQuery];
189
- }
190
- const contentTokens = tokens.filter((token) => !QUERY_EXPANSION_STOP_WORDS.has(token.toLowerCase()));
191
- const singularized = tokens.map((token) => singularizeSimple(token));
192
- const pluralized = contentTokens.map((token) => pluralizeSimple(token));
193
- return dedupeQueries([
194
- normalizedQuery,
195
- tokens.join(" "),
196
- contentTokens.join(" "),
197
- singularized.join(" "),
198
- pluralized.join(" ")
199
- ], Math.max(1, maxQueries));
200
- }
201
- function normalizeQueryExpansionOutput(raw) {
202
- const rawQueries = Array.isArray(raw) ? raw : raw?.queries;
203
- if (!Array.isArray(rawQueries)) {
204
- return [];
205
- }
206
- return dedupeQueries(rawQueries.filter((entry) => typeof entry === "string"), DEFAULT_QUERY_EXPANSION_MAX_QUERIES);
207
- }
208
- function mergeQueryExpansions(base, extra, maxQueries) {
209
- return dedupeQueries([...base, ...extra], Math.max(1, maxQueries));
210
- }
211
- function resolveQueryExpansionConfig(settings, fallbackProviderName) {
212
- const search = settings.search;
213
- const queryExpansion = search?.query_expansion;
214
- const configuredProvider = toNonEmptyString(queryExpansion?.provider);
215
- return {
216
- enabled: queryExpansion?.enabled === true,
217
- provider: configuredProvider ?? fallbackProviderName,
218
- max_queries: DEFAULT_QUERY_EXPANSION_MAX_QUERIES
219
- };
220
- }
221
- function resolveRerankConfig(settings, fallbackModel) {
222
- const search = settings.search;
223
- const rerank = search?.rerank;
224
- const configuredModel = toNonEmptyString(rerank?.model);
225
- const configuredTopK = coercePositiveInteger(rerank?.top_k);
226
- const normalizedTopK = configuredTopK ?? DEFAULT_RERANK_TOP_K;
227
- return {
228
- enabled: rerank?.enabled === true,
229
- model: configuredModel ?? fallbackModel,
230
- top_k: Math.min(MAX_RERANK_TOP_K, normalizedTopK)
231
- };
232
- }
233
- function normalizeRerankOutput(raw) {
234
- const rawHits = Array.isArray(raw) ? raw : raw?.hits;
235
- if (!Array.isArray(rawHits)) {
236
- return [];
237
- }
238
- const bestById = /* @__PURE__ */ new Map();
239
- for (const entry of rawHits) {
240
- if (typeof entry !== "object" || entry === null) {
241
- continue;
242
- }
243
- const id = toNonEmptyString(entry.id);
244
- const score = entry.score;
245
- if (!id || typeof score !== "number" || !Number.isFinite(score)) {
246
- continue;
247
- }
248
- const existing = bestById.get(id);
249
- if (existing === void 0 || score > existing) {
250
- bestById.set(id, score);
251
- }
252
- }
253
- const normalized = [...bestById.entries()].map(([id, score]) => ({ id, score }));
254
- normalized.sort((left, right) => {
255
- if (left.score !== right.score) {
256
- return right.score - left.score;
257
- }
258
- return left.id.localeCompare(right.id);
259
- });
260
- return normalized;
261
- }
262
- function dotProduct(left, right) {
263
- const size = left.length;
264
- let result = 0;
265
- for (let index = 0; index < size; index += 1) {
266
- result += left[index] * right[index];
267
- }
268
- return result;
269
- }
270
- function l2Norm(vector) {
271
- let sumSquares = 0;
272
- for (let index = 0; index < vector.length; index += 1) {
273
- sumSquares += vector[index] * vector[index];
274
- }
275
- return Math.sqrt(sumSquares);
276
- }
277
- function cosineSimilarityWithKnownLeftNorm(left, right, leftNorm) {
278
- if (!left || !right || left.length === 0 || right.length === 0 || left.length !== right.length) {
279
- return 0;
280
- }
281
- const numerator = dotProduct(left, right);
282
- const rightNorm = l2Norm(right);
283
- const denominator = leftNorm * rightNorm;
284
- if (!Number.isFinite(numerator) || !Number.isFinite(leftNorm) || !Number.isFinite(rightNorm) || !Number.isFinite(denominator) || denominator === 0) {
285
- return 0;
286
- }
287
- return Math.max(-1, Math.min(1, numerator / denominator));
288
- }
289
- async function rerankCandidatesWithEmbeddings(provider, model, query, candidates, timeoutMs) {
290
- if (candidates.length === 0) {
291
- return /* @__PURE__ */ new Map();
292
- }
293
- const effectiveModel = toNonEmptyString(model) ?? provider.model;
294
- const rerankProvider = effectiveModel === provider.model ? provider : { ...provider, model: effectiveModel };
295
- const payload = [query.trim(), ...candidates.map((entry) => entry.text)];
296
- const vectors = await executeEmbeddingRequest(rerankProvider, payload, timeoutMs ? { timeout_ms: timeoutMs } : {});
297
- const queryVector = vectors[0];
298
- if (!queryVector) {
299
- return /* @__PURE__ */ new Map();
300
- }
301
- const queryNorm = l2Norm(queryVector);
302
- const scoreById = /* @__PURE__ */ new Map();
303
- for (let index = 0; index < candidates.length; index += 1) {
304
- const candidate = candidates[index];
305
- const candidateVector = vectors[index + 1];
306
- if (!candidateVector) {
307
- continue;
308
- }
309
- const similarity = cosineSimilarityWithKnownLeftNorm(queryVector, candidateVector, queryNorm);
310
- scoreById.set(candidate.id, Math.max(0, Math.min(1, (similarity + 1) / 2)));
311
- }
312
- return scoreById;
313
- }
314
-
315
- // dist/core/search/bm25.js
316
- var DEFAULT_BM25_K1 = 1.2;
317
- var DEFAULT_BM25_B = 0.75;
318
- function tokenizeBm25(text) {
319
- return tokenizeAlphaNumeric(text);
320
- }
321
- function buildTermFrequencies(tokens) {
322
- const frequencies = /* @__PURE__ */ new Map();
323
- for (const token of tokens) {
324
- frequencies.set(token, (frequencies.get(token) ?? 0) + 1);
325
- }
326
- return frequencies;
327
- }
328
- function buildBm25Index(documents) {
329
- const stats = [];
330
- const documentFrequency = /* @__PURE__ */ new Map();
331
- let totalLength = 0;
332
- for (const document of documents) {
333
- const tokens = tokenizeBm25(document.text);
334
- const termFrequencies = buildTermFrequencies(tokens);
335
- totalLength += tokens.length;
336
- for (const term of termFrequencies.keys()) {
337
- documentFrequency.set(term, (documentFrequency.get(term) ?? 0) + 1);
338
- }
339
- stats.push({ id: document.id, termFrequencies, length: tokens.length });
340
- }
341
- const documentCount = stats.length;
342
- return {
343
- documents: stats,
344
- documentFrequency,
345
- documentCount,
346
- averageDocumentLength: documentCount > 0 ? totalLength / documentCount : 0
347
- };
348
- }
349
- function inverseDocumentFrequency(documentCount, termDocumentFrequency) {
350
- return Math.log(1 + (documentCount - termDocumentFrequency + 0.5) / (termDocumentFrequency + 0.5));
351
- }
352
- function scoreBm25Query(index, queryTokens, params) {
353
- const scores = /* @__PURE__ */ new Map();
354
- if (index.documentCount === 0 || index.averageDocumentLength === 0) {
355
- return scores;
356
- }
357
- const distinctQueryTerms = [...new Set(queryTokens.filter((token) => token.length > 0))];
358
- if (distinctQueryTerms.length === 0) {
359
- return scores;
360
- }
361
- const idfByTerm = /* @__PURE__ */ new Map();
362
- for (const term of distinctQueryTerms) {
363
- const termDocumentFrequency = index.documentFrequency.get(term);
364
- if (termDocumentFrequency === void 0) {
365
- continue;
366
- }
367
- idfByTerm.set(term, inverseDocumentFrequency(index.documentCount, termDocumentFrequency));
368
- }
369
- if (idfByTerm.size === 0) {
370
- return scores;
371
- }
372
- for (const document of index.documents) {
373
- let score = 0;
374
- for (const [term, idf] of idfByTerm) {
375
- const termFrequency = document.termFrequencies.get(term);
376
- if (termFrequency === void 0) {
377
- continue;
378
- }
379
- const lengthNormalization = 1 - params.b + params.b * document.length / index.averageDocumentLength;
380
- const denominator = termFrequency + params.k1 * lengthNormalization;
381
- score += idf * (termFrequency * (params.k1 + 1) / denominator);
382
- }
383
- if (score > 0) {
384
- scores.set(document.id, score);
385
- }
386
- }
387
- return scores;
388
- }
389
- function resolveClampedParam(candidate, fallback, min, max) {
390
- if (typeof candidate !== "number" || !Number.isFinite(candidate)) {
391
- return fallback;
392
- }
393
- return Math.min(max, Math.max(min, candidate));
394
- }
395
- function flattenSearchCorpusText(corpus) {
396
- const collectValueText = (value) => {
397
- if (typeof value === "string") {
398
- return [value];
399
- }
400
- if (typeof value === "number") {
401
- return [String(value)];
402
- }
403
- if (Array.isArray(value)) {
404
- return value.flatMap(collectValueText);
405
- }
406
- if (typeof value === "object" && value !== null) {
407
- return Object.values(value).flatMap(collectValueText);
408
- }
409
- return [];
410
- };
411
- return collectValueText(Object.values(corpus)).join(" ");
412
- }
413
- function resolveBm25Params(settings) {
414
- const bm25 = settings?.search?.bm25;
415
- return {
416
- k1: resolveClampedParam(bm25?.k1, DEFAULT_BM25_K1, 0, 1e3),
417
- b: resolveClampedParam(bm25?.b, DEFAULT_BM25_B, 0, 1)
418
- };
419
- }
420
-
421
- // dist/cli/commands/search.js
422
- var DEFAULT_COMPACT_SEARCH_FIELDS = [
423
- "id",
424
- "title",
425
- "status",
426
- "type",
427
- "priority",
428
- "updated_at",
429
- "score",
430
- "matched_fields"
431
- ];
432
- var SEARCH_HIT_FIELD_KEYS = /* @__PURE__ */ new Set(["score", "matched_fields", "highlights"]);
433
- var SEARCH_ITEM_FIELD_KEYS = /* @__PURE__ */ new Set([
434
- "id",
435
- "title",
436
- "description",
437
- "type",
438
- "status",
439
- "priority",
440
- "tags",
441
- "created_at",
442
- "updated_at",
443
- "deadline",
444
- "assignee",
445
- "author",
446
- "estimated_minutes",
447
- "acceptance_criteria",
448
- "dependencies",
449
- "comments",
450
- "notes",
451
- "learnings",
452
- "reminders",
453
- "events",
454
- "files",
455
- "tests",
456
- "docs",
457
- "close_reason",
458
- "parent",
459
- "reviewer",
460
- "risk",
461
- "confidence",
462
- "sprint",
463
- "release",
464
- "blocked_by",
465
- "blocked_reason",
466
- "reporter",
467
- "severity",
468
- "environment",
469
- "repro_steps",
470
- "resolution",
471
- "expected_result",
472
- "actual_result",
473
- "affected_version",
474
- "fixed_version",
475
- "component",
476
- "regression",
477
- "customer_impact",
478
- "definition_of_ready",
479
- "order",
480
- "rank",
481
- "goal",
482
- "objective",
483
- "value",
484
- "impact",
485
- "outcome",
486
- "why_now",
487
- "plan"
488
- ]);
489
- var LONG_QUERY_TOKEN_THRESHOLD = 2;
490
- var LONG_QUERY_TITLE_EXACT_BONUS = 120;
491
- var LONG_QUERY_PHRASE_MULTIPLIER = 6;
492
- var ALL_TERMS_COVERAGE_BONUS = 40;
493
- var EXACT_ID_MATCH_SCORE = 1e3;
494
- var SHORT_ID_MATCH_SCORE = 900;
495
- var HIGHLIGHT_OPEN = "\xAB";
496
- var HIGHLIGHT_CLOSE = "\xBB";
497
- var HIGHLIGHT_SNIPPET_RADIUS = 60;
498
- var INLINE_QUERY_FILTER_FIELDS = ["tag", "status", "type", "priority"];
499
- var COMPACT_SEARCH_VALUE_FILTER_ECHO_ENTRIES = [
500
- {
501
- optionKey: "status",
502
- summaryKey: "status",
503
- normalize: (value) => isStatusAllFilterInput(value) ? "all" : value
504
- },
505
- { optionKey: "type", summaryKey: "type" },
506
- { optionKey: "tag", summaryKey: "tag" },
507
- { optionKey: "priority", summaryKey: "priority" },
508
- { optionKey: "deadlineBefore", summaryKey: "deadline_before" },
509
- { optionKey: "deadlineAfter", summaryKey: "deadline_after" },
510
- { optionKey: "updatedAfter", summaryKey: "updated_after" },
511
- { optionKey: "updatedBefore", summaryKey: "updated_before" },
512
- { optionKey: "createdAfter", summaryKey: "created_after" },
513
- { optionKey: "createdBefore", summaryKey: "created_before" },
514
- { optionKey: "assignee", summaryKey: "assignee" },
515
- { optionKey: "sprint", summaryKey: "sprint" },
516
- { optionKey: "release", summaryKey: "release" },
517
- { optionKey: "parent", summaryKey: "parent" }
518
- ];
519
- function isNonEmptyRecord(value) {
520
- return typeof value === "object" && value !== null && !Array.isArray(value) && Object.keys(value).length > 0;
521
- }
522
- function buildCompactSearchFilterSummary(params) {
523
- const { mode, matchMode, options, includeLinked, titleExact, phraseExact, scoreThreshold, hybridSemanticWeight, runtimeFieldFilters } = params;
524
- const filters = {};
525
- applyFilterValueEcho(filters, options, COMPACT_SEARCH_VALUE_FILTER_ECHO_ENTRIES);
526
- Object.assign(filters, buildGovernanceMissingFilterEcho(options));
527
- Object.assign(filters, buildContentFilterEcho(options));
528
- if (matchMode !== "or") {
529
- filters.match_mode = matchMode;
530
- }
531
- if (includeLinked) {
532
- filters.include_linked = true;
533
- }
534
- if (titleExact) {
535
- filters.title_exact = true;
536
- }
537
- if (phraseExact) {
538
- filters.phrase_exact = true;
539
- }
540
- if (scoreThreshold > 0) {
541
- filters.score_threshold = scoreThreshold;
542
- }
543
- if (mode === "hybrid" && options.semanticWeight !== void 0) {
544
- filters.hybrid_semantic_weight = hybridSemanticWeight;
545
- }
546
- if (options.limit !== void 0) {
547
- filters.limit = options.limit;
548
- }
549
- if (isNonEmptyRecord(runtimeFieldFilters)) {
550
- filters.runtime_filters = runtimeFieldFilters;
551
- }
552
- return filters;
553
- }
554
- function buildVerboseSearchFilters(params) {
555
- const { effectiveMode, matchMode, options, includeLinked, titleExact, phraseExact, scoreThreshold, hybridSemanticWeight, queryExpansion, rerank, runtimeFieldFilters } = params;
556
- return {
557
- mode: effectiveMode,
558
- match_mode: matchMode,
559
- status: isStatusAllFilterInput(options.status) ? "all" : valueOrNull(options.status),
560
- type: valueOrNull(options.type),
561
- tag: valueOrNull(options.tag),
562
- priority: valueOrNull(options.priority),
563
- deadline_before: valueOrNull(options.deadlineBefore),
564
- deadline_after: valueOrNull(options.deadlineAfter),
565
- updated_after: valueOrNull(options.updatedAfter),
566
- updated_before: valueOrNull(options.updatedBefore),
567
- created_after: valueOrNull(options.createdAfter),
568
- created_before: valueOrNull(options.createdBefore),
569
- assignee: valueOrNull(options.assignee),
570
- sprint: valueOrNull(options.sprint),
571
- release: valueOrNull(options.release),
572
- parent: valueOrNull(options.parent),
573
- ...buildGovernanceMissingFilterEcho(options),
574
- ...buildContentFilterEcho(options),
575
- include_linked: includeLinked,
576
- title_exact: titleExact,
577
- phrase_exact: phraseExact,
578
- score_threshold: scoreThreshold,
579
- hybrid_semantic_weight: effectiveMode === "hybrid" ? hybridSemanticWeight : null,
580
- query_expansion_enabled: queryExpansion.enabled,
581
- query_expansion_provider: queryExpansion.provider,
582
- rerank_enabled: rerank.enabled,
583
- rerank_model: rerank.model,
584
- rerank_top_k: rerank.top_k,
585
- limit: valueOrNull(options.limit),
586
- runtime_filters: runtimeFieldFilters
587
- };
588
- }
589
- function valueOrNull(value) {
590
- return value ?? null;
591
- }
592
- function collectErrorCauseCodes(error) {
593
- const codes = [];
594
- let current = error;
595
- for (let depth = 0; depth < 5 && current && typeof current === "object"; depth += 1) {
596
- const code = current.code;
597
- if (typeof code === "string") {
598
- codes.push(code.toLowerCase());
599
- }
600
- current = current.cause;
601
- }
602
- return codes.join(" ");
603
- }
604
- function classifyImplicitSemanticFallbackReason(error) {
605
- const message = (error instanceof Error ? error.message : String(error)).toLowerCase();
606
- const causeCodes = collectErrorCauseCodes(error);
607
- const haystack = `${message} ${causeCodes}`;
608
- if (haystack.includes("timed out") || haystack.includes("timeout") || haystack.includes("etimedout")) {
609
- return "timeout";
610
- }
611
- if (haystack.includes("econnrefused") || haystack.includes("connection refused") || haystack.includes("connect ") || haystack.includes("enotfound") || haystack.includes("eai_again") || haystack.includes("econnreset") || haystack.includes("fetch failed")) {
612
- return "connection";
613
- }
614
- return "error";
615
- }
616
- function buildExplicitSemanticFallbackWarning(requestedMode, error) {
617
- const reason = classifyImplicitSemanticFallbackReason(error);
618
- return `search_${requestedMode}_fallback:${reason}:using_keyword_mode`;
619
- }
620
- async function maybeEmitVectorIndexStaleWarning(pmRoot, filteredDocuments, warnings) {
621
- try {
622
- const ledger = await readVectorizationStatusLedger(pmRoot);
623
- if (ledger.warnings.length > 0) {
624
- warnings.push(...ledger.warnings);
625
- }
626
- const staleIds = collectStaleVectorizationIds(filteredDocuments.map((document) => ({
627
- id: document.metadata.id,
628
- updated_at: document.metadata.updated_at
629
- })), ledger.entries);
630
- if (staleIds.length === 0) {
631
- return;
632
- }
633
- warnings.push(`vector_index_stale:${staleIds.length}`);
634
- process.stderr.write(`[pm] warning: ${staleIds.length} item${staleIds.length === 1 ? " is" : "s are"} new or modified since the last reindex and ${staleIds.length === 1 ? "is" : "are"} NOT in the semantic index yet \u2014 they will be missing from semantic/hybrid results until you run 'pm reindex --mode hybrid'. (Write-time embedding is governed by search.mutation_refresh_policy; staleness means the embed was skipped, failed, or the backend was unreachable.)
635
- `);
636
- } catch {
637
- }
638
- }
639
- function parseMode(raw, _context) {
640
- if (raw === void 0) {
641
- return "keyword";
642
- }
643
- const normalized = raw.trim().toLowerCase();
644
- if (normalized !== "keyword" && normalized !== "semantic" && normalized !== "hybrid") {
645
- throw new PmCliError("Search mode must be one of keyword|semantic|hybrid", EXIT_CODE.USAGE);
646
- }
647
- return normalized;
648
- }
649
- function parseIncludeLinked(raw) {
650
- return raw === true;
651
- }
652
- function parseTitleExact(raw) {
653
- return raw === true;
654
- }
655
- function parsePhraseExact(raw) {
656
- return raw === true;
657
- }
658
- function parseSemanticWeightOverride(raw) {
659
- return coerceNumberInRange(raw, 0, 1) ?? void 0;
660
- }
661
- function parseMatchMode(raw) {
662
- if (raw === void 0) {
663
- return "or";
664
- }
665
- const normalized = raw.trim().toLowerCase();
666
- if (normalized !== "and" && normalized !== "or" && normalized !== "exact") {
667
- throw new PmCliError("Search --match-mode must be one of and|or|exact", EXIT_CODE.USAGE);
668
- }
669
- return normalized;
670
- }
671
- function parseMinScoreOverride(raw) {
672
- if (raw === void 0 || raw === null || raw === "") {
673
- return void 0;
674
- }
675
- const parsed = typeof raw === "number" ? raw : Number(String(raw).trim());
676
- if (!Number.isFinite(parsed) || parsed < 0) {
677
- throw new PmCliError("Search --min-score must be a finite number >= 0", EXIT_CODE.USAGE);
678
- }
679
- return parsed;
680
- }
681
- function parseTimestampWindow(raw, fieldLabel) {
682
- if (raw == null)
683
- return void 0;
684
- const value = String(raw).trim();
685
- if (value.length === 0)
686
- return void 0;
687
- return resolveIsoOrRelative(value, /* @__PURE__ */ new Date(), fieldLabel);
688
- }
689
- function normalizeSearchPhrase(value) {
690
- return value.toLowerCase().replace(/\s+/g, " ").trim();
691
- }
692
- function parseDeadline(raw, fieldLabel) {
693
- if (raw === void 0)
694
- return void 0;
695
- return resolveIsoOrRelative(raw, /* @__PURE__ */ new Date(), fieldLabel);
696
- }
697
- function parseFieldSelectors(raw) {
698
- if (raw === void 0) {
699
- return void 0;
700
- }
701
- const selectors = raw.split(",").map((entry) => entry.trim()).filter((entry) => entry.length > 0);
702
- if (selectors.length === 0) {
703
- throw new PmCliError("Search --fields requires a comma-separated list of field names", EXIT_CODE.USAGE);
704
- }
705
- return [...new Set(selectors)];
706
- }
707
- function parseProjectionConfig(options) {
708
- const compactRequested = options.compact === true;
709
- const fullRequested = options.full === true;
710
- const fieldSelectors = parseFieldSelectors(options.fields);
711
- const enabledModes = Number(compactRequested) + Number(fullRequested) + Number(fieldSelectors !== void 0);
712
- if (enabledModes > 1) {
713
- throw new PmCliError("Search projection options are mutually exclusive. Use one of --compact, --full, or --fields.", EXIT_CODE.USAGE);
714
- }
715
- if (compactRequested) {
716
- return {
717
- mode: "compact",
718
- fields: [...DEFAULT_COMPACT_SEARCH_FIELDS]
719
- };
720
- }
721
- if (fullRequested) {
722
- return {
723
- mode: "full",
724
- fields: []
725
- };
726
- }
727
- if (fieldSelectors) {
728
- return {
729
- mode: "fields",
730
- fields: fieldSelectors
731
- };
732
- }
733
- return {
734
- mode: "full",
735
- fields: []
736
- };
737
- }
738
- var _testOnlySearchCommand = {
739
- applyFilters,
740
- applyExactQueryFilters,
741
- applyInlineQueryFilters,
742
- buildHitHighlights,
743
- buildVerboseSearchFilters,
744
- buildExplicitSemanticFallbackWarning,
745
- buildCompactSearchFilterSummary,
746
- buildHybridLexicalScore,
747
- buildRerankCorpus,
748
- buildSemanticHits,
749
- classifyImplicitSemanticFallbackReason,
750
- collectErrorCauseCodes,
751
- collectExactPhraseFields,
752
- collectLinkedPaths,
753
- combineHybridHits,
754
- computeBuiltInBm25Hits,
755
- computeSemanticOrHybridHits,
756
- resolveBuiltInBm25Mode,
757
- countOccurrences,
758
- dependencyEntries,
759
- documentContainsExactPhrase,
760
- emptySearchResult,
761
- highlightFieldSnippet,
762
- loadDocuments,
763
- markTokenRuns,
764
- parseInlineQueryFilters,
765
- maybeEmitVectorIndexStaleWarning,
766
- loadLinkedCorpus,
767
- mergeVectorHitsById,
768
- normalizeExtensionProviderHits,
769
- normalizeScoreMap,
770
- parseProjectionConfig,
771
- parseTimestampWindow,
772
- parseTokens,
773
- readSearchFieldValue,
774
- requireSemanticDependencies,
775
- resolveExtensionSearchProvider,
776
- resolveExtensionSearchProviderByName,
777
- resolveExtensionVectorAdapter,
778
- resolveLinkedCorpusRoots,
779
- scoreDocument,
780
- sortHits,
781
- stringArray,
782
- textEntries,
783
- validateSearchProjectionFields
784
- };
785
- function validateSearchProjectionFields(projection, runtimeFieldRegistry) {
786
- if (projection.mode !== "fields") {
787
- return;
788
- }
789
- const runtimeKeys = new Set(runtimeFieldRegistry.definitions.flatMap((field) => [field.key, field.metadata_key]));
790
- const unknown = projection.fields.filter((field) => {
791
- const normalized = field.trim();
792
- const itemKey = normalized.startsWith("item.") ? normalized.slice("item.".length) : normalized;
793
- return !SEARCH_HIT_FIELD_KEYS.has(normalized) && !SEARCH_ITEM_FIELD_KEYS.has(itemKey) && !runtimeKeys.has(itemKey);
794
- });
795
- if (unknown.length > 0) {
796
- throw new PmCliError(`Unknown search --fields value(s): ${unknown.join(", ")}`, EXIT_CODE.USAGE, {
797
- examples: [
798
- "pm search <query> --fields id,title,status,score",
799
- "pm search <query> --fields id,title,item.description,matched_fields"
800
- ],
801
- nextSteps: ["Use item.<field> for explicit item metadata fields, or run pm search --help for projection examples."]
802
- });
803
- }
804
- }
805
- function parseTokens(query) {
806
- const normalized = normalizeSearchPhrase(query);
807
- if (!normalized) {
808
- throw new PmCliError("Search query must not be empty", EXIT_CODE.USAGE);
809
- }
810
- return normalized.split(/\s+/).filter(Boolean);
811
- }
812
- function parseInlineQueryFilters(query) {
813
- const inlineFilters = {};
814
- const residualTokens = [];
815
- for (const token of query.split(/\s+/).filter((entry) => entry.length > 0)) {
816
- const separatorIndex = token.indexOf(":");
817
- const field = separatorIndex > 0 ? token.slice(0, separatorIndex).toLowerCase() : "";
818
- const value = separatorIndex > 0 ? token.slice(separatorIndex + 1) : "";
819
- const matchedField = INLINE_QUERY_FILTER_FIELDS.includes(field) ? field : void 0;
820
- if (matchedField && value.length > 0 && inlineFilters[matchedField] === void 0) {
821
- inlineFilters[matchedField] = value;
822
- continue;
823
- }
824
- residualTokens.push(token);
825
- }
826
- return {
827
- residualQuery: residualTokens.join(" "),
828
- inlineFilters
829
- };
830
- }
831
- function applyInlineQueryFilters(options, inlineFilters, warnings) {
832
- const merged = { ...options };
833
- for (const field of INLINE_QUERY_FILTER_FIELDS) {
834
- const inlineValue = inlineFilters[field];
835
- if (inlineValue === void 0) {
836
- continue;
837
- }
838
- if (toNonEmptyStringOrUndefined(merged[field]) !== void 0) {
839
- warnings.push(`search_inline_filter_ignored:${field}:flag_takes_precedence`);
840
- continue;
841
- }
842
- merged[field] = inlineValue;
843
- }
844
- return merged;
845
- }
846
- function stringArray(value) {
847
- return Array.isArray(value) ? value.filter((entry) => typeof entry === "string") : [];
848
- }
849
- function textEntries(value) {
850
- return Array.isArray(value) ? value.filter((entry) => typeof entry === "object" && entry !== null && typeof entry.text === "string") : [];
851
- }
852
- function dependencyEntries(value) {
853
- return Array.isArray(value) ? value.filter((entry) => typeof entry === "object" && entry !== null && typeof entry.id === "string" && typeof entry.kind === "string") : [];
854
- }
855
- function collectExactPhraseFields(document) {
856
- const item = document.metadata;
857
- return [
858
- item.title,
859
- item.description,
860
- item.status,
861
- stringArray(item.tags).join(" "),
862
- document.body,
863
- textEntries(item.comments).map((entry) => entry.text).join(" "),
864
- textEntries(item.notes).map((entry) => entry.text).join(" "),
865
- textEntries(item.learnings).map((entry) => entry.text).join(" "),
866
- buildReminderCorpus(item).join(" "),
867
- buildEventCorpus(item).join(" "),
868
- dependencyEntries(item.dependencies).map((entry) => `${entry.id} ${entry.kind}`).join(" "),
869
- buildPlanFlatCorpus(item)
870
- ];
871
- }
872
- function documentContainsExactPhrase(document, normalizedQuery) {
873
- return collectExactPhraseFields(document).some((fieldValue) => normalizeSearchPhrase(fieldValue).includes(normalizedQuery));
874
- }
875
- function applyExactQueryFilters(items, normalizedQuery, options) {
876
- if (!options.titleExact && !options.phraseExact) {
877
- return items;
878
- }
879
- return items.filter((document) => {
880
- if (options.titleExact && normalizeSearchPhrase(document.metadata.title) !== normalizedQuery) {
881
- return false;
882
- }
883
- if (options.phraseExact && !documentContainsExactPhrase(document, normalizedQuery)) {
884
- return false;
885
- }
886
- return true;
887
- });
888
- }
889
- function assertSearchAssigneeFilter(assigneeFilter) {
890
- if (assigneeFilter && (assigneeFilter.toLowerCase() === "none" || assigneeFilter.toLowerCase() === "null")) {
891
- throw new PmCliError('--assignee no longer accepts "none" or "null".', EXIT_CODE.USAGE);
892
- }
893
- }
894
- function resolveSearchMetadataFilterSet(options, typeRegistry, statusFilter) {
895
- const assigneeFilter = options.assignee?.trim();
896
- assertSearchAssigneeFilter(assigneeFilter);
897
- const missingMetadataFilters = resolveMissingMetadataFilters(options);
898
- const contentFieldFilters = resolveContentFieldFilters(options);
899
- return {
900
- typeFilter: parseType(options.type, typeRegistry),
901
- tagFilter: options.tag?.trim().toLowerCase(),
902
- priorityFilter: parsePriority(options.priority),
903
- deadlineBefore: parseDeadline(options.deadlineBefore, "deadline-before"),
904
- deadlineAfter: parseDeadline(options.deadlineAfter, "deadline-after"),
905
- updatedAfter: parseTimestampWindow(options.updatedAfter, "updated-after"),
906
- updatedBefore: parseTimestampWindow(options.updatedBefore, "updated-before"),
907
- createdAfter: parseTimestampWindow(options.createdAfter, "created-after"),
908
- createdBefore: parseTimestampWindow(options.createdBefore, "created-before"),
909
- assigneeFilter,
910
- sprintFilter: options.sprint?.trim(),
911
- releaseFilter: options.release?.trim(),
912
- parentFilter: options.parent?.trim(),
913
- statusSet: statusFilter && statusFilter.length > 0 ? new Set(statusFilter) : void 0,
914
- missingMetadataFilters,
915
- missingMetadataActive: hasMissingMetadataFilter(missingMetadataFilters),
916
- contentFieldFilters,
917
- contentFiltersActive: hasContentFieldFilter(contentFieldFilters)
918
- };
919
- }
920
- function matchesScalarSearchFilters(item, filters) {
921
- return matchesIdentitySearchFilters(item, filters) && matchesTimestampSearchFilters(item, filters) && matchesOwnerSearchFilters(item, filters);
922
- }
923
- function matchesIdentitySearchFilters(item, filters) {
924
- if (filters.statusSet && !filters.statusSet.has(item.status))
925
- return false;
926
- if (filters.typeFilter && item.type !== filters.typeFilter)
927
- return false;
928
- if (filters.tagFilter && !stringArray(item.tags).includes(filters.tagFilter))
929
- return false;
930
- if (filters.priorityFilter !== void 0 && item.priority !== filters.priorityFilter)
931
- return false;
932
- return true;
933
- }
934
- function matchesTimestampSearchFilters(item, filters) {
935
- if (filters.deadlineBefore && (!item.deadline || compareTimestampStrings(item.deadline, filters.deadlineBefore) > 0))
936
- return false;
937
- if (filters.deadlineAfter && (!item.deadline || compareTimestampStrings(item.deadline, filters.deadlineAfter) < 0))
938
- return false;
939
- if (filters.updatedAfter && compareTimestampStrings(item.updated_at, filters.updatedAfter) < 0)
940
- return false;
941
- if (filters.updatedBefore && compareTimestampStrings(item.updated_at, filters.updatedBefore) > 0)
942
- return false;
943
- if (filters.createdAfter && compareTimestampStrings(item.created_at, filters.createdAfter) < 0)
944
- return false;
945
- if (filters.createdBefore && compareTimestampStrings(item.created_at, filters.createdBefore) > 0)
946
- return false;
947
- return true;
948
- }
949
- function matchesOwnerSearchFilters(item, filters) {
950
- if (filters.assigneeFilter !== void 0 && item.assignee !== filters.assigneeFilter)
951
- return false;
952
- if (filters.sprintFilter !== void 0 && item.sprint !== filters.sprintFilter)
953
- return false;
954
- if (filters.releaseFilter !== void 0 && item.release !== filters.releaseFilter)
955
- return false;
956
- if (filters.parentFilter !== void 0 && item.parent !== filters.parentFilter)
957
- return false;
958
- return true;
959
- }
960
- function matchesSearchMetadataFilters(document, filters, runtimeFieldFilters, lifecycleClassifier) {
961
- const item = document.metadata;
962
- if (!matchesScalarSearchFilters(item, filters)) {
963
- return false;
964
- }
965
- if (!matchesRuntimeFilters(item, runtimeFieldFilters)) {
966
- return false;
967
- }
968
- if (filters.missingMetadataActive && !itemMatchesMissingMetadata(item, filters.missingMetadataFilters, lifecycleClassifier)) {
969
- return false;
970
- }
971
- if (filters.contentFiltersActive && !itemMatchesContentFilters(item, filters.contentFieldFilters)) {
972
- return false;
973
- }
974
- return true;
975
- }
976
- function applyFilters(items, options, typeRegistry, runtimeFieldFilters, statusFilter, lifecycleClassifier) {
977
- const filters = resolveSearchMetadataFilterSet(options, typeRegistry, statusFilter);
978
- return items.filter((document) => matchesSearchMetadataFilters(document, filters, runtimeFieldFilters, lifecycleClassifier));
979
- }
980
- function countOccurrences(haystack, needle) {
981
- let count = 0;
982
- let index = 0;
983
- while (true) {
984
- const foundAt = haystack.indexOf(needle, index);
985
- if (foundAt < 0) {
986
- return count;
987
- }
988
- count += 1;
989
- index = foundAt + needle.length;
990
- }
991
- }
992
- function tokenizeForExactTokenMatch(value) {
993
- return tokenizeAlphaNumeric(value);
994
- }
995
- function collectLinkedPaths(item) {
996
- const fromFiles = (item.files ?? []).map((entry) => ({
997
- scope: entry.scope,
998
- path: entry.path.trim()
999
- }));
1000
- const fromDocs = (item.docs ?? []).map((entry) => ({
1001
- scope: entry.scope,
1002
- path: entry.path.trim()
1003
- }));
1004
- const fromTests = (item.tests ?? []).filter((entry) => typeof entry.path === "string" && entry.path.trim().length > 0).map((entry) => ({
1005
- scope: entry.scope,
1006
- path: entry.path.trim()
1007
- }));
1008
- const sorted = [...fromFiles, ...fromDocs, ...fromTests].filter((entry) => entry.path.length > 0).sort((a, b) => a.scope.localeCompare(b.scope) || a.path.localeCompare(b.path));
1009
- const deduped = /* @__PURE__ */ new Map();
1010
- for (const entry of sorted) {
1011
- deduped.set(`${entry.scope}:${entry.path}`, entry);
1012
- }
1013
- return [...deduped.values()];
1014
- }
1015
- async function resolveContainmentRoot(root) {
1016
- const resolved = path.resolve(root);
1017
- try {
1018
- const realpathRoot = await fs.realpath(resolved);
1019
- return {
1020
- resolved,
1021
- realpath: realpathRoot
1022
- };
1023
- } catch {
1024
- return null;
1025
- }
1026
- }
1027
- async function resolveLinkedCorpusRoots(projectRoot, globalRoot) {
1028
- const [projectContainmentRoot, globalContainmentRoot] = await Promise.all([
1029
- resolveContainmentRoot(projectRoot),
1030
- resolveContainmentRoot(globalRoot)
1031
- ]);
1032
- return {
1033
- projectContainmentRoot,
1034
- globalContainmentRoot
1035
- };
1036
- }
1037
- async function loadLinkedCorpus(document, roots) {
1038
- const linkedPaths = collectLinkedPaths(document.metadata);
1039
- const chunks = [];
1040
- for (const linkedPath of linkedPaths) {
1041
- const containmentRoot = linkedPath.scope === "global" ? roots.globalContainmentRoot : roots.projectContainmentRoot;
1042
- if (!containmentRoot) {
1043
- continue;
1044
- }
1045
- const resolved = path.resolve(containmentRoot.resolved, linkedPath.path);
1046
- if (!isPathWithinDirectory(containmentRoot.resolved, resolved)) {
1047
- continue;
1048
- }
1049
- let linkedRealpath;
1050
- try {
1051
- linkedRealpath = await fs.realpath(resolved);
1052
- } catch {
1053
- continue;
1054
- }
1055
- if (!isPathWithinDirectory(containmentRoot.realpath, linkedRealpath)) {
1056
- continue;
1057
- }
1058
- try {
1059
- await runActiveOnReadHooks({
1060
- path: resolved,
1061
- scope: linkedPath.scope
1062
- });
1063
- chunks.push(await fs.readFile(resolved, "utf8"));
1064
- } catch {
1065
- }
1066
- }
1067
- return chunks.join("\n");
1068
- }
1069
- var SEARCHABLE_FIELD_BUILDERS = [
1070
- { name: "title", weightKey: "title_weight", value: (document) => document.metadata.title },
1071
- { name: "description", weightKey: "description_weight", value: (document) => document.metadata.description },
1072
- { name: "tags", weightKey: "tags_weight", value: (document) => stringArray(document.metadata.tags).join(" ") },
1073
- {
1074
- name: "status",
1075
- weightKey: "status_weight",
1076
- value: (document) => typeof document.metadata.status === "string" ? document.metadata.status : ""
1077
- },
1078
- { name: "body", weightKey: "body_weight", value: (document) => document.body },
1079
- {
1080
- name: "comments",
1081
- weightKey: "comments_weight",
1082
- value: (document) => textEntries(document.metadata.comments).map((entry) => entry.text).join(" ")
1083
- },
1084
- {
1085
- name: "notes",
1086
- weightKey: "notes_weight",
1087
- value: (document) => textEntries(document.metadata.notes).map((entry) => entry.text).join(" ")
1088
- },
1089
- {
1090
- name: "learnings",
1091
- weightKey: "learnings_weight",
1092
- value: (document) => textEntries(document.metadata.learnings).map((entry) => entry.text).join(" ")
1093
- },
1094
- { name: "reminders", weightKey: "reminders_weight", value: (document) => buildReminderCorpus(document.metadata).join(" ") },
1095
- { name: "events", weightKey: "events_weight", value: (document) => buildEventCorpus(document.metadata).join(" ") },
1096
- {
1097
- name: "dependencies",
1098
- weightKey: "dependencies_weight",
1099
- value: (document) => dependencyEntries(document.metadata.dependencies).map((entry) => `${entry.id} ${entry.kind}`).join(" ")
1100
- },
1101
- { name: "plan", weightKey: "body_weight", value: (document) => buildPlanFlatCorpus(document.metadata) }
1102
- ];
1103
- var SEARCHABLE_FIELD_BUILDER_BY_NAME = new Map(SEARCHABLE_FIELD_BUILDERS.map((builder) => [builder.name, builder]));
1104
- function escapeRegExpLiteral(value) {
1105
- return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1106
- }
1107
- function markTokenRuns(text, tokens) {
1108
- const escaped = tokens.filter((token) => token.length > 0).sort((left, right) => right.length - left.length).map(escapeRegExpLiteral);
1109
- if (escaped.length === 0) {
1110
- return text;
1111
- }
1112
- const pattern = new RegExp(escaped.join("|"), "gi");
1113
- return text.replace(pattern, (match) => `${HIGHLIGHT_OPEN}${match}${HIGHLIGHT_CLOSE}`);
1114
- }
1115
- function highlightFieldSnippet(text, tokens) {
1116
- if (text.length === 0) {
1117
- return null;
1118
- }
1119
- const lowerText = text.toLowerCase();
1120
- let firstMatchIndex = -1;
1121
- for (const token of tokens) {
1122
- if (token.length === 0) {
1123
- continue;
1124
- }
1125
- const index = lowerText.indexOf(token);
1126
- if (index >= 0 && (firstMatchIndex < 0 || index < firstMatchIndex)) {
1127
- firstMatchIndex = index;
1128
- }
1129
- }
1130
- if (firstMatchIndex < 0) {
1131
- return null;
1132
- }
1133
- const windowStart = Math.max(0, firstMatchIndex - HIGHLIGHT_SNIPPET_RADIUS);
1134
- const windowEnd = Math.min(text.length, firstMatchIndex + HIGHLIGHT_SNIPPET_RADIUS);
1135
- const marked = markTokenRuns(text.slice(windowStart, windowEnd), tokens);
1136
- const prefix = windowStart > 0 ? "\u2026" : "";
1137
- const suffix = windowEnd < text.length ? "\u2026" : "";
1138
- return `${prefix}${marked}${suffix}`;
1139
- }
1140
- function buildHitHighlights(document, matchedFields, tokens) {
1141
- const highlights = [];
1142
- for (const field of matchedFields) {
1143
- const builder = SEARCHABLE_FIELD_BUILDER_BY_NAME.get(field);
1144
- if (builder === void 0) {
1145
- continue;
1146
- }
1147
- const snippet = highlightFieldSnippet(builder.value(document), tokens);
1148
- if (snippet !== null) {
1149
- highlights.push({ field, snippet });
1150
- }
1151
- }
1152
- return highlights;
1153
- }
1154
- function buildSearchableScoringFields(document, linkedCorpus, tuning) {
1155
- return [
1156
- ...SEARCHABLE_FIELD_BUILDERS.map((builder) => ({
1157
- name: builder.name,
1158
- value: builder.value(document),
1159
- weight: tuning[builder.weightKey]
1160
- })),
1161
- { name: "linked_content", value: linkedCorpus, weight: tuning.linked_content_weight }
1162
- ];
1163
- }
1164
- function buildExactIdSearchHit(item, normalizedQuery, idPrefix) {
1165
- const normalizedId = normalizeSearchPhrase(item.id);
1166
- const normalizedIdPrefix = typeof idPrefix === "string" ? idPrefix.trim().toLowerCase() : "";
1167
- const normalizedIdPrefixPhrase = normalizeSearchPhrase(normalizedIdPrefix);
1168
- const normalizedShortId = normalizedIdPrefixPhrase.length > 0 && normalizedId.startsWith(normalizedIdPrefixPhrase) ? normalizedId.slice(normalizedIdPrefixPhrase.length).trim() : normalizedId;
1169
- if (normalizedQuery !== normalizedId && normalizedQuery !== normalizedShortId) {
1170
- return null;
1171
- }
1172
- return {
1173
- item,
1174
- score: normalizedQuery === normalizedId ? EXACT_ID_MATCH_SCORE : SHORT_ID_MATCH_SCORE,
1175
- matched_fields: ["id"],
1176
- matched_all_terms: true,
1177
- exact_id_match: true
1178
- };
1179
- }
1180
- function scoreTokenMatches(tokens, titleTokenCounts, searchableFields, tuning, state) {
1181
- for (const token of tokens) {
1182
- const exactTitleMatches = titleTokenCounts.get(token) ?? 0;
1183
- if (exactTitleMatches > 0) {
1184
- state.score += exactTitleMatches * tuning.title_exact_bonus;
1185
- state.matched.add("title");
1186
- state.matchedTokens.add(token);
1187
- }
1188
- for (const field of searchableFields) {
1189
- const occurrences = countOccurrences(field.value.toLowerCase(), token);
1190
- if (occurrences > 0) {
1191
- state.score += occurrences * field.weight;
1192
- state.matched.add(field.name);
1193
- state.matchedTokens.add(token);
1194
- }
1195
- }
1196
- }
1197
- }
1198
- function scorePhraseMatches(item, normalizedQuery, searchableFields, state) {
1199
- const normalizedTitle = normalizeSearchPhrase(item.title);
1200
- if (normalizedTitle === normalizedQuery) {
1201
- state.score += LONG_QUERY_TITLE_EXACT_BONUS;
1202
- state.matched.add("title");
1203
- }
1204
- for (const field of searchableFields) {
1205
- const phraseOccurrences = countOccurrences(normalizeSearchPhrase(field.value), normalizedQuery);
1206
- if (phraseOccurrences > 0) {
1207
- state.score += phraseOccurrences * field.weight * LONG_QUERY_PHRASE_MULTIPLIER;
1208
- state.matched.add(field.name);
1209
- }
1210
- }
1211
- }
1212
- function scoreDocument(document, tokens, normalizedQuery, linkedCorpus, tuning, idPrefix, applyCoverageBonus = false) {
1213
- const item = document.metadata;
1214
- const exactIdHit = buildExactIdSearchHit(item, normalizedQuery, idPrefix);
1215
- if (exactIdHit) {
1216
- return exactIdHit;
1217
- }
1218
- const titleTokenCounts = /* @__PURE__ */ new Map();
1219
- for (const token of tokenizeForExactTokenMatch(item.title)) {
1220
- titleTokenCounts.set(token, (titleTokenCounts.get(token) ?? 0) + 1);
1221
- }
1222
- const searchableFields = buildSearchableScoringFields(document, linkedCorpus, tuning);
1223
- const state = { score: 0, matched: /* @__PURE__ */ new Set(), matchedTokens: /* @__PURE__ */ new Set() };
1224
- scoreTokenMatches(tokens, titleTokenCounts, searchableFields, tuning, state);
1225
- const distinctTokens = new Set(tokens);
1226
- const matchedAllTerms = distinctTokens.size > 0 && state.matchedTokens.size === distinctTokens.size;
1227
- if (applyCoverageBonus && distinctTokens.size > 1 && matchedAllTerms) {
1228
- state.score += ALL_TERMS_COVERAGE_BONUS;
1229
- }
1230
- const isLongPhraseQuery = tokens.length >= LONG_QUERY_TOKEN_THRESHOLD && normalizedQuery.includes(" ");
1231
- if (isLongPhraseQuery) {
1232
- scorePhraseMatches(item, normalizedQuery, searchableFields, state);
1233
- }
1234
- if (state.score <= 0) {
1235
- return null;
1236
- }
1237
- return {
1238
- item,
1239
- score: state.score,
1240
- matched_fields: [...state.matched].sort((a, b) => a.localeCompare(b)),
1241
- matched_all_terms: matchedAllTerms
1242
- };
1243
- }
1244
- function sortHits(items, statusRegistry) {
1245
- return [...items].sort((a, b) => {
1246
- const byScore = b.score - a.score;
1247
- if (byScore !== 0)
1248
- return byScore;
1249
- const aTerminal = isTerminalStatus(a.item.status, statusRegistry);
1250
- const bTerminal = isTerminalStatus(b.item.status, statusRegistry);
1251
- if (aTerminal !== bTerminal) {
1252
- return aTerminal ? 1 : -1;
1253
- }
1254
- const byPriority = a.item.priority - b.item.priority;
1255
- if (byPriority !== 0)
1256
- return byPriority;
1257
- const byUpdated = compareTimestampStrings(b.item.updated_at, a.item.updated_at);
1258
- if (byUpdated !== 0)
1259
- return byUpdated;
1260
- return a.item.id.localeCompare(b.item.id);
1261
- });
1262
- }
1263
- function buildHybridLexicalScore(document, tokens, normalizedQuery, includeLinked, linkedCorpusById, tuning, idPrefix, applyCoverageBonus = false) {
1264
- return scoreDocument(document, tokens, normalizedQuery, includeLinked ? linkedCorpusById.get(document.metadata.id) ?? "" : "", tuning, idPrefix, applyCoverageBonus);
1265
- }
1266
- function normalizeScoreMap(scoreById) {
1267
- if (scoreById.size === 0) {
1268
- return /* @__PURE__ */ new Map();
1269
- }
1270
- const values = [...scoreById.values()];
1271
- const minScore = Math.min(...values);
1272
- const maxScore = Math.max(...values);
1273
- if (maxScore === minScore) {
1274
- return new Map([...scoreById.keys()].map((id) => [id, 1]));
1275
- }
1276
- const normalized = /* @__PURE__ */ new Map();
1277
- for (const [id, score] of scoreById) {
1278
- normalized.set(id, (score - minScore) / (maxScore - minScore));
1279
- }
1280
- return normalized;
1281
- }
1282
- function resolveSearchMaxResults(settings) {
1283
- const candidate = settings.search?.max_results;
1284
- if (typeof candidate === "number" && Number.isFinite(candidate) && candidate > 0) {
1285
- return Math.floor(candidate);
1286
- }
1287
- return 50;
1288
- }
1289
- function resolveSearchScoreThreshold(settings) {
1290
- const candidate = settings.search?.score_threshold;
1291
- if (typeof candidate === "number" && Number.isFinite(candidate)) {
1292
- return candidate;
1293
- }
1294
- return 0;
1295
- }
1296
- function resolveHybridSemanticWeight(settings) {
1297
- const candidate = settings.search?.hybrid_semantic_weight;
1298
- if (typeof candidate === "number" && Number.isFinite(candidate) && candidate >= 0 && candidate <= 1) {
1299
- return candidate;
1300
- }
1301
- return 0.7;
1302
- }
1303
- function resolveSearchTuning(settings) {
1304
- const defaults = {
1305
- title_exact_bonus: 10,
1306
- title_weight: 8,
1307
- description_weight: 5,
1308
- tags_weight: 6,
1309
- status_weight: 2,
1310
- body_weight: 1,
1311
- comments_weight: 1,
1312
- notes_weight: 1,
1313
- learnings_weight: 1,
1314
- reminders_weight: 2,
1315
- events_weight: 2,
1316
- dependencies_weight: 3,
1317
- linked_content_weight: 1
1318
- };
1319
- const tuning = settings.search?.tuning;
1320
- if (!tuning)
1321
- return defaults;
1322
- const resolveWeight = (candidate, fallback) => {
1323
- if (typeof candidate === "number" && Number.isFinite(candidate) && candidate >= 0) {
1324
- return candidate;
1325
- }
1326
- return fallback;
1327
- };
1328
- return {
1329
- title_exact_bonus: resolveWeight(tuning.title_exact_bonus, defaults.title_exact_bonus),
1330
- title_weight: resolveWeight(tuning.title_weight, defaults.title_weight),
1331
- description_weight: resolveWeight(tuning.description_weight, defaults.description_weight),
1332
- tags_weight: resolveWeight(tuning.tags_weight, defaults.tags_weight),
1333
- status_weight: resolveWeight(tuning.status_weight, defaults.status_weight),
1334
- body_weight: resolveWeight(tuning.body_weight, defaults.body_weight),
1335
- comments_weight: resolveWeight(tuning.comments_weight, defaults.comments_weight),
1336
- notes_weight: resolveWeight(tuning.notes_weight, defaults.notes_weight),
1337
- learnings_weight: resolveWeight(tuning.learnings_weight, defaults.learnings_weight),
1338
- reminders_weight: resolveWeight(tuning.reminders_weight, defaults.reminders_weight),
1339
- events_weight: resolveWeight(tuning.events_weight, defaults.events_weight),
1340
- dependencies_weight: resolveWeight(tuning.dependencies_weight, defaults.dependencies_weight),
1341
- linked_content_weight: resolveWeight(tuning.linked_content_weight, defaults.linked_content_weight)
1342
- };
1343
- }
1344
- function emptySearchResult(query, mode, matchMode, options, includeLinked, scoreThreshold, hybridSemanticWeight, queryExpansion, rerank, projection, warnings, runtimeFieldFilters, countOnly = false) {
1345
- const countExtras = countOnly ? { total: 0, count_only: true } : {};
1346
- const compactSummaryMode = projection.mode === "compact" && options.compact === true;
1347
- if (compactSummaryMode) {
1348
- const compactFilters = buildCompactSearchFilterSummary({
1349
- mode,
1350
- matchMode,
1351
- options,
1352
- includeLinked,
1353
- titleExact: options.titleExact === true,
1354
- phraseExact: options.phraseExact === true,
1355
- scoreThreshold,
1356
- hybridSemanticWeight,
1357
- runtimeFieldFilters
1358
- });
1359
- return {
1360
- query: query.trim(),
1361
- mode,
1362
- items: [],
1363
- count: 0,
1364
- ...countExtras,
1365
- filters: compactFilters,
1366
- ...warnings.length > 0 ? { warnings } : {}
1367
- };
1368
- }
1369
- const projectionFields = projection.mode === "full" ? null : [...projection.fields];
1370
- return {
1371
- query: query.trim(),
1372
- mode,
1373
- items: [],
1374
- count: 0,
1375
- ...countExtras,
1376
- filters: buildVerboseSearchFilters({
1377
- effectiveMode: mode,
1378
- matchMode,
1379
- options,
1380
- includeLinked,
1381
- titleExact: options.titleExact === true,
1382
- phraseExact: options.phraseExact === true,
1383
- scoreThreshold,
1384
- hybridSemanticWeight,
1385
- queryExpansion,
1386
- rerank,
1387
- runtimeFieldFilters: runtimeFieldFilters ?? {}
1388
- }),
1389
- projection: {
1390
- mode: projection.mode,
1391
- fields: projectionFields
1392
- },
1393
- now: nowIso(),
1394
- ...warnings.length > 0 ? { warnings } : {}
1395
- };
1396
- }
1397
- function requireSemanticDependencies(requestedMode, providerResolution, vectorResolution, hasExtensionVectorQuery) {
1398
- if (!providerResolution.active) {
1399
- throw new PmCliError(`Search mode '${requestedMode}' requires a configured embedding provider in settings.providers.openai or settings.providers.ollama`, EXIT_CODE.USAGE);
1400
- }
1401
- if (!vectorResolution.active && !hasExtensionVectorQuery) {
1402
- throw new PmCliError(`Search mode '${requestedMode}' requires a configured vector store in settings.vector_store.qdrant/settings.vector_store.lancedb or an extension adapter selected by settings.vector_store.adapter`, EXIT_CODE.USAGE);
1403
- }
1404
- return {
1405
- provider: providerResolution.active,
1406
- vectorStore: vectorResolution.active ?? null
1407
- };
1408
- }
1409
- var toOptionalNonEmptyString = toNonEmptyStringOrUndefined;
1410
- function resolveExtensionSearchProviderByName(providerName) {
1411
- const registrations = getActiveExtensionRegistrations();
1412
- const resolved = resolveRegisteredSearchProvider(registrations, providerName);
1413
- if (!resolved) {
1414
- return null;
1415
- }
1416
- const runtimeDefinition = resolved.runtime_definition ?? resolved.definition;
1417
- const query = runtimeDefinition.query;
1418
- const queryExpansion = runtimeDefinition.queryExpansion ?? runtimeDefinition.query_expansion;
1419
- const rerank = runtimeDefinition.rerank;
1420
- const registeredName = toOptionalNonEmptyString(runtimeDefinition.name) ?? toOptionalNonEmptyString(resolved.definition.name) ?? providerName;
1421
- if (!registeredName) {
1422
- return null;
1423
- }
1424
- const hooks = {
1425
- providerName: registeredName,
1426
- ...typeof query === "function" ? { query } : {},
1427
- ...typeof queryExpansion === "function" ? { queryExpansion } : {},
1428
- ...typeof rerank === "function" ? { rerank } : {}
1429
- };
1430
- if (!hooks.query && !hooks.queryExpansion && !hooks.rerank) {
1431
- return null;
1432
- }
1433
- return hooks;
1434
- }
1435
- function resolveExtensionSearchProvider(settings) {
1436
- const providerName = toOptionalNonEmptyString(settings.search?.provider);
1437
- const resolved = resolveExtensionSearchProviderByName(providerName);
1438
- if (!resolved?.query) {
1439
- return null;
1440
- }
1441
- return {
1442
- providerName: resolved.providerName,
1443
- query: resolved.query
1444
- };
1445
- }
1446
- function resolveExtensionVectorAdapter(settings) {
1447
- const registrations = getActiveExtensionRegistrations();
1448
- const adapterName = toOptionalNonEmptyString(settings.vector_store?.adapter);
1449
- const resolved = resolveRegisteredVectorStoreAdapter(registrations, adapterName);
1450
- if (!resolved) {
1451
- return null;
1452
- }
1453
- const runtimeDefinition = resolved.runtime_definition ?? resolved.definition;
1454
- const query = runtimeDefinition.query;
1455
- if (typeof query !== "function") {
1456
- return null;
1457
- }
1458
- const upsert = runtimeDefinition.upsert;
1459
- const runtimeAdapterName = toOptionalNonEmptyString(runtimeDefinition.name) ?? toOptionalNonEmptyString(resolved.definition.name) ?? adapterName ?? "extension";
1460
- return {
1461
- adapterName: runtimeAdapterName,
1462
- query,
1463
- ...typeof upsert === "function" ? { upsert } : {}
1464
- };
1465
- }
1466
- function normalizeExtensionProviderHits(providerName, raw, filteredById) {
1467
- const rawHits = Array.isArray(raw) ? raw : raw?.hits;
1468
- if (!Array.isArray(rawHits)) {
1469
- throw new PmCliError(`Extension search provider "${providerName}" must return an array of hits or { hits: [...] }`, EXIT_CODE.GENERIC_FAILURE);
1470
- }
1471
- const seen = /* @__PURE__ */ new Set();
1472
- const hits = [];
1473
- for (const rawHit of rawHits) {
1474
- if (typeof rawHit !== "object" || rawHit === null) {
1475
- continue;
1476
- }
1477
- const id = toOptionalNonEmptyString(rawHit.id);
1478
- const score = rawHit.score;
1479
- if (!id || typeof score !== "number" || !Number.isFinite(score) || seen.has(id)) {
1480
- continue;
1481
- }
1482
- const document = filteredById.get(id);
1483
- if (!document) {
1484
- continue;
1485
- }
1486
- const matchedFieldsRaw = rawHit.matched_fields;
1487
- const matchedFields = Array.isArray(matchedFieldsRaw) && matchedFieldsRaw.every((entry) => typeof entry === "string") ? [...new Set(matchedFieldsRaw.map((entry) => entry.trim()).filter((entry) => entry.length > 0))].sort((a, b) => a.localeCompare(b)) : [`provider:${providerName}`];
1488
- seen.add(id);
1489
- hits.push({
1490
- item: document.metadata,
1491
- score,
1492
- matched_fields: matchedFields
1493
- });
1494
- }
1495
- return hits;
1496
- }
1497
- function buildSemanticHits(vectorHits, filteredById) {
1498
- const semanticHits = [];
1499
- const semanticScores = /* @__PURE__ */ new Map();
1500
- for (const vectorHit of vectorHits) {
1501
- if (semanticScores.has(vectorHit.id)) {
1502
- continue;
1503
- }
1504
- const document = filteredById.get(vectorHit.id);
1505
- if (!document) {
1506
- continue;
1507
- }
1508
- semanticScores.set(vectorHit.id, vectorHit.score);
1509
- semanticHits.push({
1510
- item: document.metadata,
1511
- score: vectorHit.score,
1512
- matched_fields: ["semantic"]
1513
- });
1514
- }
1515
- return {
1516
- semanticHits,
1517
- semanticScores
1518
- };
1519
- }
1520
- function forceExactIdHitsToTop(rankedHits, keywordHits) {
1521
- const exactIdHits = keywordHits.filter((hit) => hit.exact_id_match === true);
1522
- if (exactIdHits.length === 0) {
1523
- return rankedHits;
1524
- }
1525
- const exactIdIds = new Set(exactIdHits.map((hit) => hit.item.id));
1526
- const remaining = rankedHits.filter((hit) => !exactIdIds.has(hit.item.id));
1527
- const maxRemainingScore = remaining.reduce((max, hit) => Math.max(max, hit.score), 0);
1528
- const orderedExactHits = exactIdHits.sort((left, right) => right.score - left.score);
1529
- const bandBase = maxRemainingScore + orderedExactHits.length + 1;
1530
- const promoted = orderedExactHits.map((hit, index) => ({
1531
- // Spread the original keyword hit so flags like matched_all_terms /
1532
- // exact_id_match are preserved; only the band-slot score and the id-only
1533
- // matched_fields are overridden.
1534
- ...hit,
1535
- // Higher band slot for earlier (higher original keyword score) hits.
1536
- score: bandBase - index,
1537
- matched_fields: ["id"]
1538
- }));
1539
- return [...promoted, ...remaining];
1540
- }
1541
- function combineHybridHits(filteredById, semanticScores, keywordHits, hybridSemanticWeight, semanticFieldLabel = "semantic") {
1542
- const keywordScores = new Map(keywordHits.map((entry) => [entry.item.id, entry.score]));
1543
- const keywordMatches = new Map(keywordHits.map((entry) => [entry.item.id, entry.matched_fields]));
1544
- const normalizedSemantic = normalizeScoreMap(semanticScores);
1545
- const normalizedKeyword = normalizeScoreMap(keywordScores);
1546
- const candidateIds = /* @__PURE__ */ new Set([...semanticScores.keys(), ...keywordScores.keys()]);
1547
- const keywordWeight = 1 - hybridSemanticWeight;
1548
- return [...candidateIds].map((id) => {
1549
- const document = filteredById.get(id);
1550
- const semanticScore = normalizedSemantic.get(id) ?? 0;
1551
- const keywordScore = normalizedKeyword.get(id) ?? 0;
1552
- const combinedScore = semanticScore * hybridSemanticWeight + keywordScore * keywordWeight;
1553
- if (combinedScore <= 0) {
1554
- return null;
1555
- }
1556
- const matchedFields = /* @__PURE__ */ new Set();
1557
- if (semanticScores.has(id)) {
1558
- matchedFields.add(semanticFieldLabel);
1559
- }
1560
- for (const field of keywordMatches.get(id) ?? []) {
1561
- matchedFields.add(field);
1562
- }
1563
- return {
1564
- item: document.metadata,
1565
- score: combinedScore,
1566
- matched_fields: [...matchedFields].sort((a, b) => a.localeCompare(b))
1567
- };
1568
- }).filter((entry) => entry !== null);
1569
- }
1570
- function resolveBuiltInBm25Mode(params) {
1571
- const normalized = params.configuredProvider?.trim().toLowerCase();
1572
- if (normalized === "bm25") {
1573
- return "explicit";
1574
- }
1575
- if (normalized === "auto" && !params.hasEmbeddingProvider && !params.hasExtensionSearchProvider) {
1576
- return "auto-fallback";
1577
- }
1578
- return null;
1579
- }
1580
- function computeBuiltInBm25Hits(params) {
1581
- const bm25Documents = params.filteredDocuments.map((document) => ({
1582
- id: document.metadata.id,
1583
- text: flattenSearchCorpusText(buildSearchCorpus(document, { fields: params.corpusFields }))
1584
- }));
1585
- const index = buildBm25Index(bm25Documents);
1586
- const bm25Scores = scoreBm25Query(index, tokenizeBm25(params.query), params.bm25Params);
1587
- const filteredById = new Map(params.filteredDocuments.map((document) => [document.metadata.id, document]));
1588
- if (params.requestedMode === "semantic") {
1589
- const semanticHits = [...bm25Scores].map(([id, score]) => ({
1590
- item: filteredById.get(id).metadata,
1591
- score,
1592
- matched_fields: ["bm25"]
1593
- }));
1594
- return forceExactIdHitsToTop(semanticHits, params.keywordHits);
1595
- }
1596
- const hybridHits = combineHybridHits(filteredById, bm25Scores, params.keywordHits, params.hybridSemanticWeight, "bm25");
1597
- return forceExactIdHitsToTop(hybridHits, params.keywordHits);
1598
- }
1599
- function mergeVectorHitsById(vectorHitGroups) {
1600
- const bestById = /* @__PURE__ */ new Map();
1601
- for (const group of vectorHitGroups) {
1602
- for (const hit of group) {
1603
- const existing = bestById.get(hit.id);
1604
- if (!existing || hit.score > existing.score) {
1605
- bestById.set(hit.id, hit);
1606
- }
1607
- }
1608
- }
1609
- const merged = [...bestById.values()];
1610
- merged.sort((left, right) => {
1611
- if (left.score !== right.score) {
1612
- return right.score - left.score;
1613
- }
1614
- return left.id.localeCompare(right.id);
1615
- });
1616
- return merged;
1617
- }
1618
- function buildRerankCorpus(document) {
1619
- const metadata = document.metadata;
1620
- const tags = Array.isArray(metadata?.tags) ? metadata.tags.join(" ") : "";
1621
- return [
1622
- metadata?.title,
1623
- metadata?.description,
1624
- metadata?.type,
1625
- metadata?.status,
1626
- tags,
1627
- document.body
1628
- ].map((entry) => typeof entry === "string" ? entry.trim() : "").filter((entry) => entry.length > 0).join("\n");
1629
- }
1630
- async function resolveExpandedSemanticQueries(context, queryTrimmed) {
1631
- const baseExpandedQueries = context.queryExpansion.enabled ? buildDeterministicQueryExpansions(queryTrimmed, context.queryExpansion.max_queries) : [queryTrimmed];
1632
- const expandedQueries = baseExpandedQueries.length > 0 ? baseExpandedQueries : [queryTrimmed];
1633
- if (!context.queryExpansion.enabled) {
1634
- return expandedQueries;
1635
- }
1636
- if (context.queryExpansionExtension?.expand) {
1637
- try {
1638
- const rawExpansion = await Promise.resolve(context.queryExpansionExtension.expand({
1639
- query: queryTrimmed,
1640
- mode: context.requestedMode,
1641
- settings: context.settings
1642
- }));
1643
- return mergeQueryExpansions(expandedQueries, normalizeQueryExpansionOutput(rawExpansion), context.queryExpansion.max_queries);
1644
- } catch {
1645
- context.warnings.push(`search_query_expansion_provider_failed:${context.queryExpansionExtension.providerName}:using_builtin`);
1646
- return expandedQueries;
1647
- }
1648
- }
1649
- if (context.queryExpansion.provider && context.queryExpansion.provider !== "openai" && context.queryExpansion.provider !== "ollama") {
1650
- context.warnings.push(`search_query_expansion_provider_unavailable:${context.queryExpansion.provider}:using_builtin`);
1651
- }
1652
- return expandedQueries;
1653
- }
1654
- async function executeSemanticVectorQuery(context, semanticVector, semanticLimit, vectorQueryOptions) {
1655
- if (context.extensionVectorAdapter?.query) {
1656
- try {
1657
- return await Promise.resolve(context.extensionVectorAdapter.query({
1658
- vector: semanticVector,
1659
- limit: semanticLimit,
1660
- settings: context.settings
1661
- }));
1662
- } catch (error) {
1663
- if (!context.vectorStore) {
1664
- throw new PmCliError(`Extension vector adapter query failed and no built-in fallback store is configured (${error instanceof Error ? error.message : String(error)})`, EXIT_CODE.GENERIC_FAILURE);
1665
- }
1666
- context.warnings.push(`search_vector_adapter_failed:${context.extensionVectorAdapter.adapterName}:using_builtin`);
1667
- return await executeVectorQuery(context.vectorStore, semanticVector, semanticLimit, vectorQueryOptions);
1668
- }
1669
- }
1670
- if (context.vectorStore) {
1671
- return await executeVectorQuery(context.vectorStore, semanticVector, semanticLimit, vectorQueryOptions);
1672
- }
1673
- throw new PmCliError("Semantic search requires either a configured vector store or an extension vector adapter query handler", EXIT_CODE.USAGE);
1674
- }
1675
- function buildRerankCandidateContexts(hybridHits, filteredById, topK) {
1676
- const sortedForCandidates = [...hybridHits].sort((left, right) => {
1677
- if (left.score !== right.score) {
1678
- return right.score - left.score;
1679
- }
1680
- return left.item.id.localeCompare(right.item.id);
1681
- });
1682
- return sortedForCandidates.slice(0, topK).map((hit) => {
1683
- const document = filteredById.get(hit.item.id);
1684
- return document ? { hit, text: buildRerankCorpus(document) } : null;
1685
- }).filter((entry) => entry !== null);
1686
- }
1687
- async function resolveExtensionRerankScores(context, queryTrimmed, candidateContexts) {
1688
- if (!context.rerankExtension?.rerank) {
1689
- return null;
1690
- }
1691
- try {
1692
- const rawRerank = await Promise.resolve(context.rerankExtension.rerank({
1693
- query: queryTrimmed,
1694
- mode: "hybrid",
1695
- model: context.rerank.model,
1696
- top_k: context.rerank.top_k,
1697
- settings: context.settings,
1698
- candidates: candidateContexts.map((entry) => ({
1699
- id: entry.hit.item.id,
1700
- text: entry.text,
1701
- score: entry.hit.score
1702
- }))
1703
- }));
1704
- const normalizedRerank = normalizeRerankOutput(rawRerank);
1705
- if (normalizedRerank.length > 0) {
1706
- return new Map(normalizedRerank.map((entry) => [entry.id, entry.score]));
1707
- }
1708
- context.warnings.push(`search_rerank_provider_invalid_response:${context.rerankExtension.providerName}:using_builtin`);
1709
- return null;
1710
- } catch {
1711
- context.warnings.push(`search_rerank_provider_failed:${context.rerankExtension.providerName}:using_builtin`);
1712
- return null;
1713
- }
1714
- }
1715
- async function resolveRerankScores(context, queryTrimmed, candidateContexts) {
1716
- const extensionScores = await resolveExtensionRerankScores(context, queryTrimmed, candidateContexts);
1717
- if (extensionScores) {
1718
- return extensionScores;
1719
- }
1720
- const rerankCandidates = candidateContexts.map((entry) => ({
1721
- id: entry.hit.item.id,
1722
- text: entry.text
1723
- }));
1724
- try {
1725
- return await rerankCandidatesWithEmbeddings(context.provider, context.rerank.model, queryTrimmed, rerankCandidates, context.embeddingTimeoutMs);
1726
- } catch {
1727
- context.warnings.push("search_rerank_failed:using_hybrid_scores");
1728
- return null;
1729
- }
1730
- }
1731
- function applyRerankScores(hybridHits, rerankScores) {
1732
- const rerankedIds = new Set(rerankScores.keys());
1733
- const rerankedHits = hybridHits.map((hit) => {
1734
- const rerankScore = rerankScores.get(hit.item.id);
1735
- if (rerankScore === void 0) {
1736
- return hit;
1737
- }
1738
- const matchedFields = new Set(hit.matched_fields);
1739
- matchedFields.add("rerank");
1740
- return {
1741
- ...hit,
1742
- score: rerankScore,
1743
- matched_fields: [...matchedFields].sort((left, right) => left.localeCompare(right))
1744
- };
1745
- });
1746
- rerankedHits.sort((left, right) => {
1747
- const leftWasReranked = rerankedIds.has(left.item.id);
1748
- const rightWasReranked = rerankedIds.has(right.item.id);
1749
- if (leftWasReranked !== rightWasReranked) {
1750
- return leftWasReranked ? -1 : 1;
1751
- }
1752
- if (left.score !== right.score) {
1753
- return right.score - left.score;
1754
- }
1755
- return left.item.id.localeCompare(right.item.id);
1756
- });
1757
- return rerankedHits;
1758
- }
1759
- async function applyHybridRerank(context, queryTrimmed, hybridHits, filteredById) {
1760
- if (!context.rerank.enabled || hybridHits.length <= 1) {
1761
- return hybridHits;
1762
- }
1763
- const candidateContexts = buildRerankCandidateContexts(hybridHits, filteredById, context.rerank.top_k);
1764
- const rerankScores = await resolveRerankScores(context, queryTrimmed, candidateContexts);
1765
- return rerankScores && rerankScores.size > 0 ? applyRerankScores(hybridHits, rerankScores) : hybridHits;
1766
- }
1767
- async function computeSemanticOrHybridHits(context) {
1768
- const semanticLimit = context.limit ?? context.maxResults;
1769
- const embeddingOptions = context.embeddingTimeoutMs !== void 0 ? { timeout_ms: context.embeddingTimeoutMs } : {};
1770
- const vectorQueryOptions = context.vectorQueryTimeoutMs !== void 0 ? { timeout_ms: context.vectorQueryTimeoutMs } : {};
1771
- const queryTrimmed = context.query.trim();
1772
- const expandedQueries = await resolveExpandedSemanticQueries(context, queryTrimmed);
1773
- const queryVectors = await executeEmbeddingRequest(context.provider, expandedQueries, embeddingOptions);
1774
- const queryVectorGroups = await Promise.all(queryVectors.map(async (semanticVector) => await executeSemanticVectorQuery(context, semanticVector, semanticLimit, vectorQueryOptions)));
1775
- const vectorHits = mergeVectorHitsById(queryVectorGroups);
1776
- const filteredById = new Map(context.filteredDocuments.map((document) => [document.metadata.id, document]));
1777
- const { semanticHits, semanticScores } = buildSemanticHits(vectorHits, filteredById);
1778
- const vectorMatchCount = semanticScores.size;
1779
- if (context.requestedMode === "semantic") {
1780
- return { hits: forceExactIdHitsToTop(semanticHits, context.keywordHits), vectorMatchCount };
1781
- }
1782
- const hybridHits = await applyHybridRerank(context, queryTrimmed, combineHybridHits(filteredById, semanticScores, context.keywordHits, context.hybridSemanticWeight), filteredById);
1783
- return {
1784
- // GH-281: applied LAST (after any rerank reordering) so an exact full-ID /
1785
- // short-ID keyword match always ranks #1 in hybrid mode regardless of the
1786
- // semantic blend weight or rerank scores.
1787
- hits: forceExactIdHitsToTop(hybridHits, context.keywordHits),
1788
- vectorMatchCount
1789
- };
1790
- }
1791
- async function loadDocuments(pmRoot, itemFormat, typeToFolder, schema) {
1792
- const extensionFieldNames = collectRegisteredItemFieldNames(getActiveExtensionRegistrations());
1793
- const readDocumentBody = async (metadata, preferredPath, preferredFormat) => {
1794
- const tryRead = async (targetPath, format) => {
1795
- await runActiveOnReadHooks({ path: targetPath, scope: "project" });
1796
- const raw = await fs.readFile(targetPath, "utf8");
1797
- const parsed = parseItemDocument(raw, {
1798
- format,
1799
- schema,
1800
- extensionFieldNames,
1801
- onWarning: (warning) => listWarnings.push(warning)
1802
- });
1803
- return parsed.body;
1804
- };
1805
- try {
1806
- return await tryRead(preferredPath, preferredFormat);
1807
- } catch {
1808
- const alternateFormat = preferredFormat === "toon" ? "json_markdown" : "toon";
1809
- const alternatePath = getItemPath(pmRoot, metadata.type, metadata.id, alternateFormat, typeToFolder);
1810
- try {
1811
- return await tryRead(alternatePath, alternateFormat);
1812
- } catch {
1813
- listWarnings.push(`item_list_item_read_failed:${path.relative(pmRoot, alternatePath)}`);
1814
- return "";
1815
- }
1816
- }
1817
- };
1818
- const listWarnings = [];
1819
- const cachedDocuments = await listAllDocumentCandidatesCached(pmRoot, itemFormat, typeToFolder, listWarnings, schema);
1820
- const documents = [];
1821
- if (cachedDocuments.length === 0) {
1822
- const frontMatterDocuments = await listAllFrontMatter(pmRoot, itemFormat, typeToFolder, listWarnings, schema);
1823
- for (const metadata of frontMatterDocuments) {
1824
- const preferredPath = getItemPath(pmRoot, metadata.type, metadata.id, itemFormat, typeToFolder);
1825
- const body = await readDocumentBody(metadata, preferredPath, itemFormat);
1826
- documents.push({ metadata, body });
1827
- }
1828
- return {
1829
- documents,
1830
- warnings: [...new Set(listWarnings)].sort((left, right) => left.localeCompare(right))
1831
- };
1832
- }
1833
- for (const cachedDocument of cachedDocuments) {
1834
- if (typeof cachedDocument.body === "string") {
1835
- documents.push({
1836
- metadata: cachedDocument.metadata,
1837
- body: cachedDocument.body
1838
- });
1839
- continue;
1840
- }
1841
- const body = await readDocumentBody(cachedDocument.metadata, cachedDocument.item_path, cachedDocument.item_format);
1842
- documents.push({
1843
- metadata: cachedDocument.metadata,
1844
- body
1845
- });
1846
- }
1847
- return {
1848
- documents,
1849
- warnings: [...new Set(listWarnings)].sort((left, right) => left.localeCompare(right))
1850
- };
1851
- }
1852
- function readSearchFieldValue(hit, field) {
1853
- const normalized = field.trim();
1854
- if (normalized.length === 0) {
1855
- return null;
1856
- }
1857
- if (normalized === "score") {
1858
- return hit.score;
1859
- }
1860
- if (normalized === "matched_fields") {
1861
- return hit.matched_fields;
1862
- }
1863
- if (normalized.startsWith("item.")) {
1864
- const itemKey = normalized.slice("item.".length);
1865
- if (itemKey.length === 0) {
1866
- return null;
1867
- }
1868
- const itemRecord2 = toItemRecord(hit.item);
1869
- return itemRecord2[itemKey] ?? null;
1870
- }
1871
- const hitRecord = hit;
1872
- const itemRecord = toItemRecord(hit.item);
1873
- if (Object.prototype.hasOwnProperty.call(itemRecord, normalized)) {
1874
- return itemRecord[normalized] ?? null;
1875
- }
1876
- if (Object.prototype.hasOwnProperty.call(hitRecord, normalized)) {
1877
- return hitRecord[normalized] ?? null;
1878
- }
1879
- return null;
1880
- }
1881
- function projectSearchHits(hits, projection) {
1882
- if (projection.mode === "full") {
1883
- return hits.map(({ matched_all_terms: _matchedAllTerms, ...hit }) => hit);
1884
- }
1885
- return hits.map((hit) => {
1886
- const projected = {};
1887
- for (const field of projection.fields) {
1888
- projected[field] = readSearchFieldValue(hit, field);
1889
- }
1890
- return projected;
1891
- });
1892
- }
1893
- function resolveQueryExpansionExtension(queryExpansion) {
1894
- const provider = resolveExtensionSearchProviderByName(queryExpansion.provider ?? void 0);
1895
- return provider?.queryExpansion ? { providerName: provider.providerName, expand: provider.queryExpansion } : null;
1896
- }
1897
- function resolveRerankExtension(settings) {
1898
- const provider = resolveExtensionSearchProviderByName(toOptionalNonEmptyString(settings.search?.provider));
1899
- return provider?.rerank ? { providerName: provider.providerName, rerank: provider.rerank } : null;
1900
- }
1901
- function prepareSearchInput(rawQuery, rawOptions) {
1902
- const inlineWarnings = [];
1903
- const inlineParse = parseInlineQueryFilters(rawQuery);
1904
- const hasInlineFilters = Object.keys(inlineParse.inlineFilters).length > 0;
1905
- if (hasInlineFilters && inlineParse.residualQuery.trim().length === 0) {
1906
- throw new PmCliError("Inline field:value tokens consumed the entire query, leaving no search terms.", EXIT_CODE.USAGE, {
1907
- examples: ["pm search auth tag:area:search", "pm list --tag area:search --status open"],
1908
- nextSteps: [
1909
- "Add keyword terms alongside the inline filters, or use pm list for pure tag/status/type/priority filtering."
1910
- ]
1911
- });
1912
- }
1913
- const query = hasInlineFilters ? inlineParse.residualQuery : rawQuery;
1914
- const options = applyInlineQueryFilters(rawOptions, inlineParse.inlineFilters, inlineWarnings);
1915
- return {
1916
- query,
1917
- options,
1918
- inlineWarnings,
1919
- highlight: options.highlight === true,
1920
- includeLinked: parseIncludeLinked(options.includeLinked),
1921
- titleExact: parseTitleExact(options.titleExact),
1922
- phraseExact: parsePhraseExact(options.phraseExact),
1923
- matchMode: parseMatchMode(typeof options.matchMode === "string" ? options.matchMode : void 0),
1924
- minScoreOverride: parseMinScoreOverride(options.minScore),
1925
- countOnly: options.count === true,
1926
- tokens: parseTokens(query),
1927
- normalizedQuery: normalizeSearchPhrase(query),
1928
- limit: parseLimit(options.limit),
1929
- projection: parseProjectionConfig(options),
1930
- modeWasExplicit: typeof options.mode === "string" && options.mode.trim().length > 0
1931
- };
1932
- }
1933
- async function resolveSearchRuntimeContext(prepared, global) {
1934
- const pmRoot = resolvePmRoot(process.cwd(), global.path);
1935
- if (!await pathExists(getSettingsPath(pmRoot))) {
1936
- throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
1937
- }
1938
- const storedSettings = await readSettings(pmRoot);
1939
- const settings = resolveSettingsWithSemanticRuntimeDefaults(storedSettings).settings;
1940
- const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
1941
- const runtimeFieldRegistry = resolveRuntimeFieldRegistry(settings.schema);
1942
- validateSearchProjectionFields(prepared.projection, runtimeFieldRegistry);
1943
- const runtimeFieldFilters = collectRuntimeFilterValues(prepared.options, runtimeFieldRegistry, "search");
1944
- const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
1945
- const providerResolution = resolveEmbeddingProviders(settings);
1946
- const vectorResolution = resolveVectorStores(settings);
1947
- const extensionSearchProvider = resolveExtensionSearchProvider(settings);
1948
- const extensionVectorAdapter = resolveExtensionVectorAdapter(settings);
1949
- const semanticWeightOverride = parseSemanticWeightOverride(prepared.options.semanticWeight);
1950
- const queryExpansion = resolveQueryExpansionConfig(settings, providerResolution.active?.name ?? null);
1951
- const rerank = resolveRerankConfig(settings, providerResolution.active?.model ?? toOptionalNonEmptyString(settings.search?.embedding_model) ?? "text-embedding-3-small");
1952
- return {
1953
- pmRoot,
1954
- settings,
1955
- statusRegistry,
1956
- runtimeFieldRegistry,
1957
- runtimeFieldFilters,
1958
- typeRegistry,
1959
- maxResults: resolveSearchMaxResults(settings),
1960
- scoreThreshold: prepared.minScoreOverride ?? resolveSearchScoreThreshold(settings),
1961
- semanticWeightProvided: prepared.options.semanticWeight !== void 0,
1962
- semanticWeightOverride,
1963
- hybridSemanticWeight: semanticWeightOverride ?? resolveHybridSemanticWeight(settings),
1964
- tuning: resolveSearchTuning(settings),
1965
- providerResolution,
1966
- vectorResolution,
1967
- extensionSearchProvider,
1968
- extensionVectorAdapter,
1969
- bm25Mode: resolveBuiltInBm25Mode({
1970
- configuredProvider: toOptionalNonEmptyString(settings.search?.provider),
1971
- hasEmbeddingProvider: providerResolution.active !== null,
1972
- hasExtensionSearchProvider: extensionSearchProvider !== null
1973
- }),
1974
- queryExpansion,
1975
- queryExpansionExtension: resolveQueryExpansionExtension(queryExpansion),
1976
- rerank,
1977
- rerankExtension: resolveRerankExtension(settings),
1978
- effectiveMode: parseMode(prepared.options.mode, {
1979
- hasProvider: providerResolution.active !== null || extensionSearchProvider !== null,
1980
- hasVectorStore: vectorResolution.active !== null || extensionVectorAdapter !== null
1981
- })
1982
- };
1983
- }
1984
- async function loadFilteredSearchCorpus(prepared, runtime) {
1985
- const loadedDocuments = await loadDocuments(runtime.pmRoot, runtime.settings.item_format ?? "toon", runtime.typeRegistry.type_to_folder, runtime.settings.schema);
1986
- const statusFilter = parseStatusFilterCsv(typeof prepared.options.status === "string" ? prepared.options.status : void 0, runtime.statusRegistry, { strict: true });
1987
- const lifecycleClassifier = lifecycleClassifierFromStatusRegistry(runtime.statusRegistry);
1988
- const metadataFilteredDocuments = applyFilters(loadedDocuments.documents, prepared.options, runtime.typeRegistry, runtime.runtimeFieldFilters, statusFilter, lifecycleClassifier);
1989
- return {
1990
- warnings: loadedDocuments.warnings,
1991
- allDocuments: loadedDocuments.documents,
1992
- filteredDocuments: applyExactQueryFilters(metadataFilteredDocuments, prepared.normalizedQuery, {
1993
- titleExact: prepared.titleExact,
1994
- phraseExact: prepared.phraseExact || prepared.matchMode === "exact"
1995
- })
1996
- };
1997
- }
1998
- async function collectLinkedCorpusById(includeLinked, effectiveMode, filteredDocuments) {
1999
- const linkedCorpusById = /* @__PURE__ */ new Map();
2000
- if (!includeLinked || effectiveMode !== "keyword" && effectiveMode !== "hybrid") {
2001
- return linkedCorpusById;
2002
- }
2003
- const projectRoot = process.cwd();
2004
- const linkedCorpusRoots = await resolveLinkedCorpusRoots(projectRoot, resolveGlobalPmRoot(projectRoot));
2005
- const linkedCorpusEntries = await Promise.all(filteredDocuments.map(async (document) => [document.metadata.id, await loadLinkedCorpus(document, linkedCorpusRoots)]));
2006
- for (const [id, corpus] of linkedCorpusEntries) {
2007
- linkedCorpusById.set(id, corpus);
2008
- }
2009
- return linkedCorpusById;
2010
- }
2011
- async function computeKeywordSearchHits(prepared, runtime, filteredDocuments) {
2012
- const linkedCorpusById = await collectLinkedCorpusById(prepared.includeLinked, runtime.effectiveMode, filteredDocuments);
2013
- const applyCoverageBonus = prepared.matchMode === "or";
2014
- return filteredDocuments.map((document) => buildHybridLexicalScore(document, prepared.tokens, prepared.normalizedQuery, prepared.includeLinked, linkedCorpusById, runtime.tuning, runtime.settings.id_prefix, applyCoverageBonus)).filter((entry) => entry !== null).filter((entry) => prepared.matchMode !== "and" || entry.matched_all_terms === true);
2015
- }
2016
- function buildEmptySearchResultFromContext(response, countOnly) {
2017
- return emptySearchResult(response.query, response.effectiveMode, response.matchMode, response.options, response.includeLinked, response.scoreThreshold, response.hybridSemanticWeight, response.queryExpansion, response.rerank, response.projection, response.warnings, response.runtimeFieldFilters, countOnly);
2018
- }
2019
- async function executeBuiltInBm25Search(prepared, runtime, filteredDocuments, keywordHits, warnings) {
2020
- if (runtime.bm25Mode === null || runtime.effectiveMode === "keyword") {
2021
- return null;
2022
- }
2023
- const hits = computeBuiltInBm25Hits({
2024
- requestedMode: runtime.effectiveMode,
2025
- query: prepared.query,
2026
- filteredDocuments,
2027
- keywordHits,
2028
- corpusFields: resolveSearchCorpusFields(runtime.settings),
2029
- bm25Params: resolveBm25Params(runtime.settings),
2030
- hybridSemanticWeight: runtime.hybridSemanticWeight
2031
- });
2032
- if (runtime.bm25Mode === "auto-fallback") {
2033
- warnings.push(`search_${runtime.effectiveMode}_offline_bm25:no_embedding_provider:using_lexical_bm25`);
2034
- }
2035
- return hits;
2036
- }
2037
- async function executeExtensionSearchProvider(prepared, runtime, filteredDocuments, filteredById) {
2038
- if (!runtime.extensionSearchProvider) {
2039
- return null;
2040
- }
2041
- const canUseBuiltInSemantic = runtime.providerResolution.active !== null && (runtime.vectorResolution.active !== null || runtime.extensionVectorAdapter !== null);
2042
- try {
2043
- const providerResponse = await Promise.resolve(runtime.extensionSearchProvider.query({
2044
- query: prepared.query,
2045
- mode: runtime.effectiveMode,
2046
- tokens: prepared.tokens,
2047
- options: prepared.options,
2048
- settings: runtime.settings,
2049
- documents: filteredDocuments
2050
- }));
2051
- return normalizeExtensionProviderHits(runtime.extensionSearchProvider.providerName, providerResponse, filteredById);
2052
- } catch (error) {
2053
- if (!canUseBuiltInSemantic) {
2054
- throw new PmCliError(`Extension search provider "${runtime.extensionSearchProvider.providerName}" failed: ${error instanceof Error ? error.message : String(error)}`, EXIT_CODE.GENERIC_FAILURE);
2055
- }
2056
- return null;
2057
- }
2058
- }
2059
- function maybeApplyNoVectorFallback(effectiveMode, semanticResult, keywordHits, warnings) {
2060
- if (semanticResult.vectorMatchCount > 0) {
2061
- return semanticResult.hits;
2062
- }
2063
- warnings.push(`search_${effectiveMode}_degraded:no_vector_matches:results_are_lexical`);
2064
- return effectiveMode === "semantic" ? keywordHits : semanticResult.hits;
2065
- }
2066
- async function prepareBuiltInSemanticSearch(runtime, effectiveMode, filteredDocuments, warnings, modeWasExplicit) {
2067
- const builtInSemanticWillRun = !runtime.extensionSearchProvider && runtime.providerResolution.active !== null && (runtime.vectorResolution.active !== null || runtime.extensionVectorAdapter !== null);
2068
- if (modeWasExplicit && builtInSemanticWillRun) {
2069
- await maybeEmitVectorIndexStaleWarning(runtime.pmRoot, filteredDocuments, warnings);
2070
- }
2071
- if (!runtime.extensionSearchProvider) {
2072
- requireSemanticDependencies(effectiveMode, runtime.providerResolution, runtime.vectorResolution, runtime.extensionVectorAdapter !== null);
2073
- }
2074
- }
2075
- async function executeSemanticSearch(input) {
2076
- const { prepared, runtime, filteredDocuments, keywordHits, warnings, modeWasExplicit } = input;
2077
- let hits = keywordHits;
2078
- const bm25Hits = await executeBuiltInBm25Search(prepared, runtime, filteredDocuments, keywordHits, warnings);
2079
- const semanticMode = runtime.effectiveMode;
2080
- if (bm25Hits !== null || semanticMode === "keyword") {
2081
- return { effectiveMode: runtime.effectiveMode, hits: bm25Hits ?? hits };
2082
- }
2083
- try {
2084
- await prepareBuiltInSemanticSearch(runtime, semanticMode, filteredDocuments, warnings, modeWasExplicit);
2085
- if (filteredDocuments.length === 0 || prepared.limit === 0) {
2086
- return { effectiveMode: runtime.effectiveMode, hits: [] };
2087
- }
2088
- const filteredById = new Map(filteredDocuments.map((document) => [document.metadata.id, document]));
2089
- hits = await executeExtensionSearchProvider(prepared, runtime, filteredDocuments, filteredById) ?? hits;
2090
- if (hits === keywordHits) {
2091
- const { provider, vectorStore } = requireSemanticDependencies(semanticMode, runtime.providerResolution, runtime.vectorResolution, runtime.extensionVectorAdapter !== null);
2092
- const semanticResult = await computeSemanticOrHybridHits({
2093
- requestedMode: semanticMode,
2094
- query: prepared.query,
2095
- filteredDocuments,
2096
- keywordHits,
2097
- hybridSemanticWeight: runtime.hybridSemanticWeight,
2098
- limit: prepared.limit,
2099
- maxResults: runtime.maxResults,
2100
- provider,
2101
- vectorStore,
2102
- extensionVectorAdapter: runtime.extensionVectorAdapter,
2103
- queryExpansion: runtime.queryExpansion,
2104
- queryExpansionExtension: runtime.queryExpansionExtension,
2105
- rerank: runtime.rerank,
2106
- rerankExtension: runtime.rerankExtension,
2107
- warnings,
2108
- settings: runtime.settings
2109
- });
2110
- hits = maybeApplyNoVectorFallback(semanticMode, semanticResult, keywordHits, warnings);
2111
- }
2112
- return { effectiveMode: runtime.effectiveMode, hits };
2113
- } catch (error) {
2114
- warnings.push(buildExplicitSemanticFallbackWarning(runtime.effectiveMode, error));
2115
- return { effectiveMode: "keyword", hits: keywordHits };
2116
- }
2117
- }
2118
- function buildCountOnlySearchResult(response, total) {
2119
- if (response.projection.mode === "compact" && response.options.compact === true) {
2120
- return withSearchWarnings({
2121
- query: response.query.trim(),
2122
- mode: response.effectiveMode,
2123
- items: [],
2124
- count: total,
2125
- total,
2126
- count_only: true,
2127
- filters: buildCompactSearchFilterSummary({
2128
- mode: response.effectiveMode,
2129
- matchMode: response.matchMode,
2130
- options: response.options,
2131
- includeLinked: response.includeLinked,
2132
- titleExact: response.titleExact,
2133
- phraseExact: response.phraseExact,
2134
- scoreThreshold: response.scoreThreshold,
2135
- hybridSemanticWeight: response.hybridSemanticWeight,
2136
- runtimeFieldFilters: response.runtimeFieldFilters
2137
- })
2138
- }, response.warnings);
2139
- }
2140
- const projectionFields = response.projection.mode === "full" ? null : [...response.projection.fields];
2141
- return withSearchWarnings({
2142
- query: response.query.trim(),
2143
- mode: response.effectiveMode,
2144
- items: [],
2145
- count: total,
2146
- total,
2147
- count_only: true,
2148
- filters: buildVerboseSearchFilters({
2149
- effectiveMode: response.effectiveMode,
2150
- matchMode: response.matchMode,
2151
- options: response.options,
2152
- includeLinked: response.includeLinked,
2153
- titleExact: response.titleExact,
2154
- phraseExact: response.phraseExact,
2155
- scoreThreshold: response.scoreThreshold,
2156
- hybridSemanticWeight: response.hybridSemanticWeight,
2157
- queryExpansion: response.queryExpansion,
2158
- rerank: response.rerank,
2159
- runtimeFieldFilters: response.runtimeFieldFilters
2160
- }),
2161
- projection: {
2162
- mode: response.projection.mode,
2163
- fields: projectionFields
2164
- },
2165
- now: nowIso()
2166
- }, response.warnings);
2167
- }
2168
- function withSearchWarnings(result, warnings) {
2169
- if (warnings.length === 0) {
2170
- return result;
2171
- }
2172
- return { ...result, warnings };
2173
- }
2174
- function attachSearchHighlights(prepared, filteredDocuments, limited) {
2175
- if (!prepared.highlight) {
2176
- return { hits: limited, projection: prepared.projection };
2177
- }
2178
- const documentById = new Map(filteredDocuments.map((document) => [document.metadata.id, document]));
2179
- const hits = limited.map((hit) => ({
2180
- ...hit,
2181
- highlights: buildHitHighlights(documentById.get(hit.item.id), hit.matched_fields, prepared.tokens)
2182
- }));
2183
- if (prepared.projection.mode === "full" || prepared.projection.fields.includes("highlights")) {
2184
- return { hits, projection: prepared.projection };
2185
- }
2186
- return { hits, projection: { mode: prepared.projection.mode, fields: [...prepared.projection.fields, "highlights"] } };
2187
- }
2188
- function buildSearchResultForHits(response, projectedItems, total, limitedCount, effectiveProjection) {
2189
- const truncationExtras = limitedCount < total ? { total } : {};
2190
- if (response.projection.mode === "compact" && response.options.compact === true) {
2191
- return withSearchWarnings({
2192
- query: response.query.trim(),
2193
- mode: response.effectiveMode,
2194
- items: projectedItems,
2195
- count: projectedItems.length,
2196
- ...truncationExtras,
2197
- filters: buildCompactSearchFilterSummary({
2198
- mode: response.effectiveMode,
2199
- matchMode: response.matchMode,
2200
- options: response.options,
2201
- includeLinked: response.includeLinked,
2202
- titleExact: response.titleExact,
2203
- phraseExact: response.phraseExact,
2204
- scoreThreshold: response.scoreThreshold,
2205
- hybridSemanticWeight: response.hybridSemanticWeight,
2206
- runtimeFieldFilters: response.runtimeFieldFilters
2207
- })
2208
- }, response.warnings);
2209
- }
2210
- const finalProjectionFields = effectiveProjection.mode === "full" ? null : [...effectiveProjection.fields];
2211
- return {
2212
- query: response.query.trim(),
2213
- mode: response.effectiveMode,
2214
- items: projectedItems,
2215
- count: projectedItems.length,
2216
- ...truncationExtras,
2217
- filters: buildVerboseSearchFilters({
2218
- effectiveMode: response.effectiveMode,
2219
- matchMode: response.matchMode,
2220
- options: response.options,
2221
- includeLinked: response.includeLinked,
2222
- titleExact: response.titleExact,
2223
- phraseExact: response.phraseExact,
2224
- scoreThreshold: response.scoreThreshold,
2225
- hybridSemanticWeight: response.hybridSemanticWeight,
2226
- queryExpansion: response.queryExpansion,
2227
- rerank: response.rerank,
2228
- runtimeFieldFilters: response.runtimeFieldFilters
2229
- }),
2230
- projection: {
2231
- mode: effectiveProjection.mode,
2232
- fields: finalProjectionFields
2233
- },
2234
- now: nowIso(),
2235
- ...response.warnings.length > 0 ? { warnings: response.warnings } : {}
2236
- };
2237
- }
2238
- async function runSearch(rawQuery, rawOptions, global) {
2239
- const prepared = prepareSearchInput(rawQuery, rawOptions);
2240
- const runtime = await resolveSearchRuntimeContext(prepared, global);
2241
- const corpus = await loadFilteredSearchCorpus(prepared, runtime);
2242
- const warnings = corpus.warnings;
2243
- warnings.push(...prepared.inlineWarnings);
2244
- if (runtime.effectiveMode === "hybrid" && runtime.semanticWeightProvided && runtime.semanticWeightOverride === void 0) {
2245
- warnings.push("search_hybrid_semantic_weight_override_invalid:using_settings_default");
2246
- }
2247
- const responseBase = {
2248
- query: prepared.query,
2249
- matchMode: prepared.matchMode,
2250
- options: prepared.options,
2251
- includeLinked: prepared.includeLinked,
2252
- titleExact: prepared.titleExact,
2253
- phraseExact: prepared.phraseExact,
2254
- scoreThreshold: runtime.scoreThreshold,
2255
- hybridSemanticWeight: runtime.hybridSemanticWeight,
2256
- queryExpansion: runtime.queryExpansion,
2257
- rerank: runtime.rerank,
2258
- projection: prepared.projection,
2259
- warnings,
2260
- runtimeFieldFilters: runtime.runtimeFieldFilters
2261
- };
2262
- if (runtime.effectiveMode === "keyword" && (corpus.filteredDocuments.length === 0 || prepared.limit === 0)) {
2263
- return buildEmptySearchResultFromContext({ ...responseBase, effectiveMode: runtime.effectiveMode }, prepared.countOnly);
2264
- }
2265
- const keywordHits = await computeKeywordSearchHits(prepared, runtime, corpus.filteredDocuments);
2266
- const modeResult = await executeSemanticSearch({
2267
- prepared,
2268
- runtime,
2269
- filteredDocuments: corpus.filteredDocuments,
2270
- keywordHits,
2271
- warnings,
2272
- modeWasExplicit: prepared.modeWasExplicit
2273
- });
2274
- if (modeResult.effectiveMode !== "keyword" && modeResult.hits.length === 0 && (corpus.filteredDocuments.length === 0 || prepared.limit === 0)) {
2275
- return buildEmptySearchResultFromContext({ ...responseBase, effectiveMode: modeResult.effectiveMode }, prepared.countOnly);
2276
- }
2277
- const thresholded = modeResult.hits.filter((entry) => entry.exact_id_match === true || entry.score >= runtime.scoreThreshold);
2278
- const sorted = sortHits(thresholded, runtime.statusRegistry);
2279
- const total = sorted.length;
2280
- const resolvedLimit = prepared.limit ?? runtime.maxResults;
2281
- const limited = sorted.slice(0, resolvedLimit);
2282
- const response = { ...responseBase, effectiveMode: modeResult.effectiveMode };
2283
- if (prepared.countOnly) {
2284
- return buildCountOnlySearchResult(response, total);
2285
- }
2286
- const { hits: projectedHits, projection: effectiveProjection } = attachSearchHighlights(prepared, corpus.filteredDocuments, limited);
2287
- const projectedItems = projectSearchHits(projectedHits, effectiveProjection);
2288
- return buildSearchResultForHits(response, projectedItems, total, limited.length, effectiveProjection);
2289
- }
2290
-
2291
- export {
2292
- normalizeLowercaseWhitespace,
2293
- tokenizeAlphaNumeric,
2294
- jaccardSimilarity,
2295
- collectErrorCauseCodes,
2296
- classifyImplicitSemanticFallbackReason,
2297
- _testOnlySearchCommand,
2298
- resolveSearchMaxResults,
2299
- resolveSearchScoreThreshold,
2300
- resolveHybridSemanticWeight,
2301
- resolveSearchTuning,
2302
- runSearch
2303
- };
2304
- //# sourceMappingURL=chunk-TZXRBVAM.js.map
2305
-
2306
- //# debugId=106509f0-71e6-5a15-915f-acf57240a3e4