@wirecat/drive-cli 0.71.0 → 0.72.1

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 (258) hide show
  1. package/README.md +150 -71
  2. package/contracts/wirecat.json +77 -8
  3. package/dist/bin/drive.js +2 -2
  4. package/dist/bundle/agent-GOCD4ZW2.js +46 -0
  5. package/dist/bundle/{all-profiles-3QJG2NAN.js → all-profiles-PZVP3G73.js} +67 -25
  6. package/dist/bundle/{anthropic-PSWTEU6G.js → anthropic-PUOTKSYV.js} +9 -9
  7. package/dist/bundle/{app-server-PVTA6ABR.js → app-server-MKDCXRZM.js} +97 -79
  8. package/dist/bundle/{bun-LU5LP3JI.js → bun-NS5YLOQT.js} +2 -2
  9. package/dist/bundle/{bun-sqlite-PYMKLBRU.js → bun-sqlite-KSKWRLLO.js} +9 -9
  10. package/dist/bundle/{chunk-COOOO5B3.js → chunk-2CG3LUQS.js} +4 -4
  11. package/dist/bundle/{chunk-YVI5SQPY.js → chunk-2TVHFJKV.js} +1 -1
  12. package/dist/bundle/chunk-35FIJGTT.js +52 -0
  13. package/dist/bundle/chunk-35GROSBS.js +3233 -0
  14. package/dist/bundle/{chunk-D5TGYUVU.js → chunk-3CH7I452.js} +9 -60
  15. package/dist/bundle/{chunk-ICDCAQ6K.js → chunk-3QBRS3JT.js} +13 -9
  16. package/dist/bundle/chunk-3T7JIHSO.js +353 -0
  17. package/dist/bundle/{chunk-Q7DOMFJ4.js → chunk-3VIEGRBA.js} +6 -6
  18. package/dist/bundle/chunk-3YCUYFTD.js +2159 -0
  19. package/dist/bundle/{chunk-CJLVYIOP.js → chunk-3ZGWJYSG.js} +30 -21
  20. package/dist/bundle/{chunk-YPFWNVHV.js → chunk-43PCMVTZ.js} +2 -100
  21. package/dist/bundle/{chunk-OF422U5D.js → chunk-4DK55MLP.js} +402 -402
  22. package/dist/bundle/chunk-4HP6KGBI.js +32 -0
  23. package/dist/bundle/chunk-4P6D6CUS.js +282 -0
  24. package/dist/bundle/chunk-4ZAQMDLD.js +1308 -0
  25. package/dist/bundle/chunk-4ZTB7LS3.js +87 -0
  26. package/dist/bundle/{chunk-6W763DZN.js → chunk-54O5NJRC.js} +14 -13
  27. package/dist/bundle/{chunk-MNLL5YLM.js → chunk-5BHP4FVM.js} +2 -2
  28. package/dist/bundle/{chunk-ACUAV6VX.js → chunk-6JU4KLAZ.js} +108 -72
  29. package/dist/bundle/{chunk-YMJ6IDGT.js → chunk-6KND2DYT.js} +38 -8
  30. package/dist/bundle/{chunk-4HWJOU7N.js → chunk-7YPZPJTB.js} +1 -1
  31. package/dist/bundle/chunk-A5XNUMW7.js +108 -0
  32. package/dist/bundle/{chunk-X4TIMMKJ.js → chunk-AG34MPVN.js} +1 -1
  33. package/dist/bundle/chunk-B5V2U7IS.js +221 -0
  34. package/dist/bundle/chunk-B6JC5RS3.js +696 -0
  35. package/dist/bundle/chunk-BDZXGDGI.js +80 -0
  36. package/dist/bundle/{chunk-B5KSXHJ7.js → chunk-BMTMGMGE.js} +1 -1
  37. package/dist/bundle/{chunk-ZCR3IRZ2.js → chunk-CP2TZXAG.js} +16 -9
  38. package/dist/bundle/{chunk-TAUBRNC5.js → chunk-DOEP4EPW.js} +72 -59
  39. package/dist/bundle/chunk-DQSOYH6N.js +20 -0
  40. package/dist/bundle/{chunk-QETR5HIZ.js → chunk-E2TMWONO.js} +4385 -2684
  41. package/dist/bundle/chunk-E5EYJU5R.js +7 -0
  42. package/dist/bundle/chunk-ECYOTDJM.js +14 -0
  43. package/dist/bundle/{chunk-HL52XXZX.js → chunk-EXHTGQR2.js} +3 -4
  44. package/dist/bundle/chunk-F4BX7TH2.js +15 -0
  45. package/dist/bundle/{chunk-ASMMG72J.js → chunk-FJQO5OHR.js} +261 -565
  46. package/dist/bundle/{chunk-RJOQH5YY.js → chunk-FKP4T7A4.js} +111 -859
  47. package/dist/bundle/{chunk-JDV7HNNQ.js → chunk-FTL3WXZB.js} +13 -26
  48. package/dist/bundle/{chunk-FP54WSIR.js → chunk-G2CH4FRW.js} +4 -4
  49. package/dist/bundle/chunk-G2KKMQRN.js +30 -0
  50. package/dist/bundle/{chunk-NYECVHFH.js → chunk-G4NHRFS7.js} +755 -0
  51. package/dist/bundle/{chunk-Y2NWGNUB.js → chunk-G7SKXAVZ.js} +5 -5
  52. package/dist/bundle/{chunk-FT3LN3HP.js → chunk-GFI3UUIU.js} +1 -1
  53. package/dist/bundle/chunk-GTPPUBYU.js +1876 -0
  54. package/dist/bundle/{chunk-QFR2PNJN.js → chunk-GTROGY74.js} +12 -12
  55. package/dist/bundle/{chunk-UTO2GO4P.js → chunk-GYAPDUF5.js} +45 -66
  56. package/dist/bundle/{chunk-GBKNJWOZ.js → chunk-HCMEU7AF.js} +8 -8
  57. package/dist/bundle/{chunk-FJH7DJWK.js → chunk-HDGJ7IDE.js} +6 -6
  58. package/dist/bundle/{chunk-Z3KUSRCF.js → chunk-HMN26CVU.js} +2 -2
  59. package/dist/bundle/{chunk-I4RWW3UD.js → chunk-HOICQNJX.js} +20 -5
  60. package/dist/bundle/{chunk-P7CUM5IB.js → chunk-HPS2YGSZ.js} +1 -1
  61. package/dist/bundle/{chunk-HMS6EEQL.js → chunk-HSASPXRW.js} +3 -3
  62. package/dist/bundle/{chunk-KGYVHPGE.js → chunk-IABPGOMT.js} +2 -2
  63. package/dist/bundle/{chunk-4QNW4NK6.js → chunk-IBQZT2YD.js} +1 -1
  64. package/dist/bundle/{chunk-PRW6SYA3.js → chunk-IE3R46YN.js} +313 -257
  65. package/dist/bundle/{chunk-7PDHGZN4.js → chunk-IE6O7463.js} +4 -4
  66. package/dist/bundle/{chunk-3UGYFXH6.js → chunk-IPBYU43F.js} +192 -379
  67. package/dist/bundle/{chunk-RWDKMU74.js → chunk-IS7STZEB.js} +3 -3
  68. package/dist/bundle/{chunk-GOWXXYEF.js → chunk-IV77ZFF4.js} +4 -4
  69. package/dist/bundle/{chunk-6XFIITOG.js → chunk-JDGF3YYS.js} +4811 -3486
  70. package/dist/bundle/{chunk-GPQ44Y2R.js → chunk-JHAACT4I.js} +2 -2
  71. package/dist/bundle/{chunk-SERXSCN3.js → chunk-JRED7BNX.js} +337 -390
  72. package/dist/bundle/{chunk-MIA7P6FZ.js → chunk-JSYUB4SM.js} +6 -6
  73. package/dist/bundle/{chunk-RESDD3Q4.js → chunk-JVM75M4H.js} +16 -3
  74. package/dist/bundle/{chunk-XF4EXO2C.js → chunk-JZ65CQWK.js} +6 -6
  75. package/dist/bundle/{chunk-QNRRK3CN.js → chunk-KBR7OC5S.js} +2 -2
  76. package/dist/bundle/chunk-KI6OOW6D.js +123 -0
  77. package/dist/bundle/chunk-KOI5G7NM.js +388 -0
  78. package/dist/bundle/{chunk-ZZ32DXTH.js → chunk-KPBUJQKT.js} +1 -1
  79. package/dist/bundle/{chunk-2LHAVY4U.js → chunk-KVBGIZ2C.js} +1 -1
  80. package/dist/bundle/chunk-L7P3LUDQ.js +286 -0
  81. package/dist/bundle/{chunk-SAKO3P4H.js → chunk-LKUWH6KU.js} +1 -1
  82. package/dist/bundle/chunk-MA6U4XH2.js +36 -0
  83. package/dist/bundle/{chunk-TAFHYHKA.js → chunk-MA7ETVTZ.js} +43 -186
  84. package/dist/bundle/{chunk-KYKW2W6X.js → chunk-MDJUYCHT.js} +1 -1
  85. package/dist/bundle/chunk-MEYYH47C.js +25 -0
  86. package/dist/bundle/{chunk-Z56QFOBR.js → chunk-MGC2BAD2.js} +1 -1
  87. package/dist/bundle/chunk-NMQRSEZM.js +37 -0
  88. package/dist/bundle/{chunk-5DPV7X27.js → chunk-NTZWY5R3.js} +321 -0
  89. package/dist/bundle/{chunk-OJSBWP3F.js → chunk-OBDPKDGB.js} +69 -7
  90. package/dist/bundle/{chunk-WVDCCYS3.js → chunk-ODTBJGWQ.js} +17 -17
  91. package/dist/bundle/chunk-PB6ACIME.js +80 -0
  92. package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
  93. package/dist/bundle/{chunk-72C4YOCH.js → chunk-PMAV3RNP.js} +7 -7
  94. package/dist/bundle/chunk-PSY67L73.js +783 -0
  95. package/dist/bundle/{chunk-6TNNT2MQ.js → chunk-PUVQOZ2N.js} +483 -176
  96. package/dist/bundle/{chunk-SDKQNOL5.js → chunk-QB7K6PIP.js} +6 -6
  97. package/dist/bundle/chunk-QK7GKFKB.js +188 -0
  98. package/dist/bundle/{chunk-4PA4DHYV.js → chunk-QMUWHKP5.js} +6 -6
  99. package/dist/bundle/chunk-QURQ2OU2.js +250 -0
  100. package/dist/bundle/{chunk-LXKYKRHD.js → chunk-R3EDZWXF.js} +8 -227
  101. package/dist/bundle/{chunk-KGERXYTV.js → chunk-RM4DO2WZ.js} +1 -1
  102. package/dist/bundle/chunk-S27UKJVL.js +730 -0
  103. package/dist/bundle/{chunk-22QQUKWA.js → chunk-S3SLDYTU.js} +1 -1
  104. package/dist/bundle/{chunk-FCS26CYQ.js → chunk-SAEBHENE.js} +4 -4
  105. package/dist/bundle/chunk-SM7Z2BQF.js +561 -0
  106. package/dist/bundle/{chunk-QXC6IEH6.js → chunk-SODB63MR.js} +201 -423
  107. package/dist/bundle/{chunk-2PUNKUYJ.js → chunk-SSFGSY77.js} +10320 -9907
  108. package/dist/bundle/{chunk-37MAA6F2.js → chunk-STUPCKAA.js} +11 -2221
  109. package/dist/bundle/{chunk-BKSQBBYG.js → chunk-SUQT4KI2.js} +9 -9
  110. package/dist/bundle/{chunk-YPNWIB6H.js → chunk-SWQDKO6D.js} +3 -3
  111. package/dist/bundle/chunk-SZ7XJZGH.js +2231 -0
  112. package/dist/bundle/{chunk-3N2OFXB5.js → chunk-T3OK6AYZ.js} +5 -5
  113. package/dist/bundle/{chunk-HKY7X6NY.js → chunk-TFIAD57H.js} +4 -4
  114. package/dist/bundle/chunk-TRYYWV7J.js +291 -0
  115. package/dist/bundle/{chunk-XMMFBPGC.js → chunk-TUL6MCTY.js} +3 -3
  116. package/dist/bundle/{chunk-6Y2BYFXQ.js → chunk-UC7JLE6J.js} +0 -7
  117. package/dist/bundle/{chunk-YJIGGUPI.js → chunk-UL5HSHFU.js} +4 -4
  118. package/dist/bundle/{chunk-3EBBLKIT.js → chunk-UT64BBEP.js} +4 -4
  119. package/dist/bundle/{chunk-26DHFMGZ.js → chunk-VBIZD5V5.js} +2 -2
  120. package/dist/bundle/chunk-VHTELRUA.js +50 -0
  121. package/dist/bundle/chunk-VOQICE3G.js +340 -0
  122. package/dist/bundle/{chunk-GZ2D4KXG.js → chunk-WDJRUNQN.js} +35 -12
  123. package/dist/bundle/{chunk-2UUWXPOB.js → chunk-X5CXANSA.js} +3 -3
  124. package/dist/bundle/{chunk-35SCQ4VI.js → chunk-X6HPQKAI.js} +43 -35
  125. package/dist/bundle/{chunk-COJSWDNU.js → chunk-XKWQDQ4B.js} +3 -3
  126. package/dist/bundle/{chunk-6SJOTNHF.js → chunk-XZEVHUKI.js} +6 -28
  127. package/dist/bundle/{chunk-JZHBZOJR.js → chunk-YE7DJB3F.js} +3 -3
  128. package/dist/bundle/chunk-YHWFF6DN.js +39 -0
  129. package/dist/bundle/{chunk-2BVVU7GG.js → chunk-YJVQ5GST.js} +1 -1
  130. package/dist/bundle/{chunk-ZM63SUHG.js → chunk-YRCGFSRR.js} +2 -2
  131. package/dist/bundle/{chunk-EOEU3AZN.js → chunk-ZNFXKFGF.js} +13 -13
  132. package/dist/bundle/{cli-556DERZL.js → cli-KXRWXGTS.js} +217 -114
  133. package/dist/bundle/command-contract-BGNT7MTQ.js +45 -0
  134. package/dist/bundle/{command-server-entry-AYLGNZWD.js → command-server-entry-7FZX74T6.js} +36 -34
  135. package/dist/bundle/{decode-QU24MWMN.js → decode-SZ6W34U3.js} +10 -10
  136. package/dist/bundle/{dispatch-4KODNOXV.js → dispatch-4KNSZ3PI.js} +10 -10
  137. package/dist/bundle/dist-PAKDDIBT.js +191 -0
  138. package/dist/bundle/drive.js +11 -11
  139. package/dist/bundle/{echarts-BXX4OQWC.js → echarts-ISH62J4E.js} +2 -2
  140. package/dist/bundle/{embed-KG27KG3D.js → embed-6ODGTZPK.js} +10 -10
  141. package/dist/bundle/{embedder-IPAVUQUV.js → embedder-6FY67FTQ.js} +15 -15
  142. package/dist/bundle/entry-2SA6ZX7E.js +25 -0
  143. package/dist/bundle/{failure-ESL7ETL4.js → failure-V3ILKUTX.js} +4 -4
  144. package/dist/bundle/first-run-ZNKPPD6M.js +31 -0
  145. package/dist/bundle/first-screen-WF6GYLPN.js +45 -0
  146. package/dist/bundle/google-QCADNPCQ.js +46 -0
  147. package/dist/bundle/{google-api-VCDBSNOW.js → google-api-ZTI3NKZX.js} +88 -73
  148. package/dist/bundle/grants-BPN5AGDK.js +133 -0
  149. package/dist/bundle/hast-util-from-html-X2DCPS3T.js +10531 -0
  150. package/dist/bundle/hast-util-to-html-VP6XLPKJ.js +998 -0
  151. package/dist/bundle/hast-util-to-mdast-IZ5PRX72.js +2272 -0
  152. package/dist/bundle/{identity-LOWMVGZY.js → identity-YX4IPGOO.js} +7 -6
  153. package/dist/bundle/{instructions-2VECIDXF.js → instructions-G5ZGHVFB.js} +1 -1
  154. package/dist/bundle/{login-7GBONT7V.js → login-CVX5VJX6.js} +96 -81
  155. package/dist/bundle/{mcp-O6ACR2DX.js → mcp-MQ2L5IIM.js} +2 -2
  156. package/dist/bundle/{mdast-util-from-markdown-FXEPSNER.js → mdast-util-from-markdown-HEZF7KJ4.js} +137 -195
  157. package/dist/bundle/mdast-util-gfm-AQW6R6MG.js +925 -0
  158. package/dist/bundle/mdast-util-to-hast-DF2QVIRV.js +879 -0
  159. package/dist/bundle/mdast-util-to-markdown-XYLXB3Z3.js +18 -0
  160. package/dist/bundle/meeting-combined-HKZJMJ6Q.js +28 -0
  161. package/dist/bundle/meeting-model-DSE4GRVE.js +29 -0
  162. package/dist/bundle/{meeting-semantic-G7PFOKU7.js → meeting-semantic-OHG2QN2G.js} +10 -10
  163. package/dist/bundle/{micromark-extension-gfm-GRL24TU6.js → micromark-extension-gfm-OE2GBORZ.js} +11 -78
  164. package/dist/bundle/{node-MPEQSFI3.js → node-NLJINXVQ.js} +2 -2
  165. package/dist/bundle/{node-sqlite-OLQMAYB4.js → node-sqlite-KDFQDYVZ.js} +10 -10
  166. package/dist/bundle/notes-search-3VBVSQ3R.js +70 -0
  167. package/dist/bundle/oauth-M3E62ZHC.js +22 -0
  168. package/dist/bundle/{open-OXTE672W.js → open-WVRUVBIZ.js} +8 -8
  169. package/dist/bundle/{openai-EB3TPIZY.js → openai-JJWOSJMV.js} +22 -21
  170. package/dist/bundle/{process-F6TKXWWA.js → process-LPVAYRO7.js} +1 -1
  171. package/dist/bundle/{program-4IFDZ7FM.js → program-ZJRIP25J.js} +276 -1149
  172. package/dist/bundle/{prompt-F5RRHPN2.js → prompt-XCDHTEAO.js} +8 -8
  173. package/dist/bundle/{reasons-UORHJDHK.js → reasons-REEEQDAZ.js} +6 -5
  174. package/dist/bundle/{recognize-DAVNZND3.js → recognize-OZLFDJAT.js} +7 -7
  175. package/dist/bundle/remote-MDPYVCZB.js +35 -0
  176. package/dist/bundle/{rerank-CND2GVLZ.js → rerank-FLZWJNHA.js} +11 -11
  177. package/dist/bundle/{serve-ZHSPUIGX.js → serve-5UV5VLRV.js} +19 -19
  178. package/dist/bundle/{server-YMAK4LHC.js → server-53A2X2MK.js} +89 -70
  179. package/dist/bundle/server-5GMURMDE.js +97 -0
  180. package/dist/bundle/{services-ZILSFJ6E.js → services-XSMH7BXB.js} +109 -89
  181. package/dist/bundle/{sqlite-runtime-S5VPMZQH.js → sqlite-runtime-E3L7ENFU.js} +9 -9
  182. package/dist/bundle/{start-CR6X25RT.js → start-4S2VNR4J.js} +7 -7
  183. package/dist/bundle/{state-YFPHVIIJ.js → state-TQI4JSH7.js} +9 -9
  184. package/dist/bundle/{store-CL4ZJZRI.js → store-GS7PU6PJ.js} +38 -23
  185. package/dist/bundle/{store-UODRT6X4.js → store-VYJPL7MW.js} +36 -25
  186. package/dist/bundle/store-maintenance-command-JJVYUZMG.js +85 -0
  187. package/dist/bundle/surface-JC4XVMZR.js +83 -0
  188. package/dist/bundle/tokens-KJQ5EAPW.js +133 -0
  189. package/dist/commands/documents.d.ts.map +1 -1
  190. package/dist/commands/documents.js +11 -1
  191. package/dist/commands/documents.js.map +1 -1
  192. package/dist/commands/remote.d.ts.map +1 -1
  193. package/dist/commands/remote.js +8 -22
  194. package/dist/commands/remote.js.map +1 -1
  195. package/dist/commands/sync.d.ts.map +1 -1
  196. package/dist/commands/sync.js +14 -4
  197. package/dist/commands/sync.js.map +1 -1
  198. package/dist/config.d.ts +5 -0
  199. package/dist/config.d.ts.map +1 -1
  200. package/dist/config.js +5 -0
  201. package/dist/config.js.map +1 -1
  202. package/dist/first-screen.d.ts.map +1 -1
  203. package/dist/first-screen.js +2 -1
  204. package/dist/first-screen.js.map +1 -1
  205. package/dist/generated/manifest.d.ts +2 -1
  206. package/dist/generated/manifest.d.ts.map +1 -1
  207. package/dist/generated/manifest.js +782 -0
  208. package/dist/generated/manifest.js.map +1 -1
  209. package/dist/generated/types.d.ts +262 -58
  210. package/dist/generated/types.d.ts.map +1 -1
  211. package/dist/google.d.ts.map +1 -1
  212. package/dist/google.js +5 -5
  213. package/dist/google.js.map +1 -1
  214. package/dist/model.d.ts +5 -2
  215. package/dist/model.d.ts.map +1 -1
  216. package/dist/model.js.map +1 -1
  217. package/dist/policy-keys.js +1 -1
  218. package/dist/policy-keys.js.map +1 -1
  219. package/dist/program.d.ts.map +1 -1
  220. package/dist/program.js +9 -4
  221. package/dist/program.js.map +1 -1
  222. package/dist/state.d.ts.map +1 -1
  223. package/dist/state.js +6 -1
  224. package/dist/state.js.map +1 -1
  225. package/dist/store.d.ts.map +1 -1
  226. package/dist/store.js +2 -7
  227. package/dist/store.js.map +1 -1
  228. package/dist/supported.d.ts +2 -2
  229. package/dist/supported.d.ts.map +1 -1
  230. package/dist/supported.js +2 -3
  231. package/dist/supported.js.map +1 -1
  232. package/dist/sync.d.ts +2 -1
  233. package/dist/sync.d.ts.map +1 -1
  234. package/dist/sync.js +5 -2
  235. package/dist/sync.js.map +1 -1
  236. package/dist/version.d.ts +1 -1
  237. package/dist/version.js +1 -1
  238. package/package.json +3 -3
  239. package/scenarios/find-decision.md +1 -1
  240. package/skills/drive-cli/SKILL.md +4 -2
  241. package/dist/bundle/chunk-J5Q5FS2N.js +0 -593
  242. package/dist/bundle/chunk-L46C6HQ7.js +0 -729
  243. package/dist/bundle/chunk-UDMNY63V.js +0 -899
  244. package/dist/bundle/chunk-VKE77B3F.js +0 -2
  245. package/dist/bundle/command-contract-VRTOAV6W.js +0 -43
  246. package/dist/bundle/entry-MVXQETWS.js +0 -25
  247. package/dist/bundle/first-run-4UVLW2WR.js +0 -31
  248. package/dist/bundle/first-screen-JAKAIINI.js +0 -41
  249. package/dist/bundle/google-22NXXJX5.js +0 -45
  250. package/dist/bundle/grants-MQMTVCRQ.js +0 -118
  251. package/dist/bundle/mdast-util-gfm-SZM5GBDF.js +0 -2103
  252. package/dist/bundle/meeting-combined-LVP4AZKA.js +0 -27
  253. package/dist/bundle/meeting-model-RAY5XDXZ.js +0 -29
  254. package/dist/bundle/oauth-SGH2I2BY.js +0 -22
  255. package/dist/bundle/remote-D5EYYIAU.js +0 -35
  256. package/dist/bundle/server-DUVJWP3Q.js +0 -80
  257. package/dist/bundle/store-maintenance-command-DY5XIBWR.js +0 -72
  258. package/dist/bundle/tokens-AF7QOFOF.js +0 -118
@@ -19,16 +19,16 @@ import {
19
19
  reference,
20
20
  string,
21
21
  variant
22
- } from "./chunk-OJSBWP3F.js";
22
+ } from "./chunk-OBDPKDGB.js";
23
23
  import {
24
24
  CliError,
25
25
  isCliError
26
- } from "./chunk-4QNW4NK6.js";
26
+ } from "./chunk-IBQZT2YD.js";
27
27
  import {
28
28
  __name
29
29
  } from "./chunk-ZVVMGPBJ.js";
30
30
 
31
- // node_modules/.pnpm/@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/types.js
31
+ // node_modules/.pnpm/@wirecat+cli-base@0.130.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/types.js
32
32
  var QUERY_LIMITS = {
33
33
  bytes: 8192,
34
34
  depth: 32,
@@ -72,328 +72,7 @@ function queryError(reason, span, alternative, context = {}, details = {}) {
72
72
  __name(queryError, "queryError");
73
73
  var walkQuery = /* @__PURE__ */ __name((node) => node.kind === "predicate" ? [node] : node.clauses.flatMap(({ node: node2 }) => walkQuery(node2)), "walkQuery");
74
74
 
75
- // node_modules/.pnpm/@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/dates.js
76
- var timezoneOf = /* @__PURE__ */ __name((given) => {
77
- const zone = given ?? Intl.DateTimeFormat().resolvedOptions().timeZone ?? "UTC";
78
- try {
79
- new Intl.DateTimeFormat("en", { timeZone: zone }).format(0);
80
- } catch {
81
- queryError("query.invalid-timezone", { start: 0, end: 0 }, "use an IANA timezone such as Europe/Madrid");
82
- }
83
- return zone;
84
- }, "timezoneOf");
85
- var calendar = /* @__PURE__ */ __name((value, span) => {
86
- if (!/^\d{4}-\d{2}-\d{2}$/u.test(value))
87
- queryError("query.invalid-date", span, "use an ISO date such as 2026-10-01");
88
- const year = Number(value.slice(0, 4)), month = Number(value.slice(5, 7)), day = Number(value.slice(8, 10));
89
- const date = /* @__PURE__ */ new Date(0);
90
- date.setUTCFullYear(year, month - 1, day);
91
- date.setUTCHours(0, 0, 0, 0);
92
- if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day)
93
- queryError("query.invalid-date", span);
94
- return date;
95
- }, "calendar");
96
- var dayBoundary = /* @__PURE__ */ __name((value, zone, next, span) => {
97
- const date = calendar(value, span);
98
- if (next)
99
- date.setUTCDate(date.getUTCDate() + 1);
100
- const wanted = date.getUTCFullYear() * 1e4 + (date.getUTCMonth() + 1) * 100 + date.getUTCDate();
101
- const formatter = new Intl.DateTimeFormat("en-CA", {
102
- timeZone: zone,
103
- year: "numeric",
104
- month: "2-digit",
105
- day: "2-digit",
106
- era: "short"
107
- });
108
- const dayAt = /* @__PURE__ */ __name((time) => {
109
- const parts = formatter.formatToParts(time);
110
- const value2 = /* @__PURE__ */ __name((name) => Number(parts.find((p) => p.type === name)?.value), "value");
111
- const year = parts.find((p) => p.type === "era")?.value === "BC" ? 1 - value2("year") : value2("year");
112
- return year * 1e4 + value2("month") * 100 + value2("day");
113
- }, "dayAt");
114
- let lo = date.getTime() - 2 * 864e5, hi = date.getTime() + 2 * 864e5;
115
- while (lo < hi) {
116
- const mid = Math.floor((lo + hi) / 2);
117
- if (dayAt(mid) < wanted)
118
- lo = mid + 1;
119
- else
120
- hi = mid;
121
- }
122
- if (dayAt(lo) !== wanted)
123
- queryError("query.invalid-date", span, "this calendar day does not exist in the selected timezone");
124
- return lo;
125
- }, "dayBoundary");
126
- var WALL = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?$/u;
127
- var wallTime = /* @__PURE__ */ __name((value, zone, span) => {
128
- const [, year, month, day, hour, minute, second = "0", fraction = "0"] = WALL.exec(value) ?? [];
129
- if (year === void 0)
130
- queryError("query.invalid-date", span, "use YYYY-MM-DDTHH:mm, with optional seconds");
131
- const wanted = Date.UTC(Number(year), Number(month) - 1, Number(day), Number(hour), Number(minute), Number(second), Number(fraction.padEnd(3, "0")));
132
- const check = new Date(wanted);
133
- if (check.getUTCDate() !== Number(day) || check.getUTCHours() !== Number(hour) || check.getUTCMinutes() !== Number(minute) || check.getUTCSeconds() !== Number(second))
134
- queryError("query.invalid-date", span);
135
- const formatter = new Intl.DateTimeFormat("en-CA", {
136
- timeZone: zone,
137
- year: "numeric",
138
- month: "2-digit",
139
- day: "2-digit",
140
- hour: "2-digit",
141
- minute: "2-digit",
142
- second: "2-digit",
143
- hourCycle: "h23"
144
- });
145
- const shown = /* @__PURE__ */ __name((instant) => {
146
- const parts = Object.fromEntries(formatter.formatToParts(instant).map((part) => [part.type, Number(part.value)]));
147
- return Date.UTC(parts.year ?? 0, (parts.month ?? 1) - 1, parts.day, parts.hour, parts.minute, parts.second) + (instant % 1e3 + 1e3) % 1e3;
148
- }, "shown");
149
- const found = /* @__PURE__ */ new Set();
150
- for (const probe of [wanted - 864e5, wanted, wanted + 864e5]) {
151
- const candidate = wanted - (shown(probe) - probe);
152
- if (shown(candidate) === wanted)
153
- found.add(candidate);
154
- }
155
- if (found.size !== 1)
156
- queryError("query.invalid-date", span, "this local time is skipped or repeated by daylight saving; add an offset");
157
- return [...found][0];
158
- }, "wallTime");
159
- var ZONED = /(?:Z|[+-]\d{2}:?\d{2})$/iu;
160
- var zonedMoment = /* @__PURE__ */ __name((value, zone, span, { end = false } = {}) => {
161
- if (/^\d{4}-\d{2}-\d{2}$/u.test(value))
162
- return dayBoundary(value, zone, end, span) - (end ? 1 : 0);
163
- if (!ZONED.test(value))
164
- return wallTime(value, zone, span);
165
- const time = Date.parse(value);
166
- if (!/^\d{4}-\d{2}-\d{2}T/u.test(value) || !Number.isFinite(time))
167
- queryError("query.invalid-date", span);
168
- calendar(value.slice(0, 10), span);
169
- return time;
170
- }, "zonedMoment");
171
- var AGO = /^(\d+)(m|h|d)$/u;
172
- var MOMENT = /^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,3})?)?(Z|[+-]\d{2}:\d{2})?$/u;
173
- var AGO_MS = { m: 6e4, h: 36e5, d: 864e5 };
174
- var dayOf = /* @__PURE__ */ __name((word, zone, now, span) => {
175
- const today = new Intl.DateTimeFormat("en-CA", {
176
- timeZone: zone,
177
- year: "numeric",
178
- month: "2-digit",
179
- day: "2-digit"
180
- }).format(now);
181
- if (word === "today")
182
- return today;
183
- const date = calendar(today, span);
184
- date.setUTCDate(date.getUTCDate() - 1);
185
- return date.toISOString().slice(0, 10);
186
- }, "dayOf");
187
- var dateEndpoint = /* @__PURE__ */ __name((value, zone, side, inclusive, span, now = Date.now()) => {
188
- if (value === "*")
189
- return { inclusive };
190
- const word = value.toLowerCase();
191
- if (word === "today" || word === "yesterday")
192
- return dateEndpoint(dayOf(word, zone, now, span), zone, side, inclusive, span);
193
- const [, amount, unit] = AGO.exec(word) ?? [];
194
- if (amount && unit)
195
- return { time: now - Number(amount) * (AGO_MS[unit] ?? 0), inclusive };
196
- if (/^\d{4}-\d{2}-\d{2}$/u.test(value))
197
- return {
198
- time: dayBoundary(value, zone, side === "lower" ? !inclusive : inclusive, span),
199
- inclusive: side === "lower"
200
- };
201
- const [, day, hour, minute, second = "0", offset] = MOMENT.exec(value) ?? [];
202
- if (day === void 0)
203
- queryError("query.invalid-date", span, "use an ISO date, a date and time such as 2026-10-01T09:00 (optional seconds and offset), today, yesterday or 30m/2h/7d ago");
204
- const moment = value.replace(" ", "T");
205
- if (offset === void 0)
206
- return { time: wallTime(moment, zone, span), inclusive };
207
- calendar(day, span);
208
- const time = Date.parse(moment);
209
- if (!Number.isFinite(time) || Number(hour) > 23 || Number(minute) > 59 || Number(second) > 59)
210
- queryError("query.invalid-date", span);
211
- return { time, inclusive };
212
- }, "dateEndpoint");
213
- var dateRange = /* @__PURE__ */ __name((lower, upper, lowerInclusive, upperInclusive, zone, span, now = Date.now()) => {
214
- const since = lower === upper && AGO.test(lower.toLowerCase());
215
- const lo = dateEndpoint(lower, zone, "lower", lowerInclusive, span, now);
216
- const hi = dateEndpoint(since ? "*" : upper, zone, "upper", upperInclusive, span, now);
217
- return {
218
- ...lo.time === void 0 ? {} : { lower: lo.time },
219
- ...hi.time === void 0 ? {} : { upper: hi.time },
220
- lower_inclusive: lo.inclusive,
221
- upper_inclusive: hi.inclusive
222
- };
223
- }, "dateRange");
224
-
225
- // node_modules/.pnpm/@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/evaluate.js
226
- var wordsOf = /* @__PURE__ */ __name((text) => text.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [], "wordsOf");
227
- var pattern = /* @__PURE__ */ __name((value) => new RegExp(`^${[...value].map((char) => char === "*" ? ".*" : char === "?" ? "." : char.replace(/[.+^${}()|[\]\\]/, "\\$&")).join("")}$`, "iu"), "pattern");
228
- var present = /* @__PURE__ */ __name((value) => value !== void 0 && value !== null && value !== "", "present");
229
- var matchOne = /* @__PURE__ */ __name((field, node, value, options) => {
230
- if (!present(value))
231
- return false;
232
- if (node.operator === "wildcard" && node.value === "*")
233
- return true;
234
- const text = String(value);
235
- switch (field.type) {
236
- case "txt": {
237
- const words = wordsOf(text);
238
- if (node.operator === "wildcard")
239
- return words.some((word) => pattern(node.value).test(word));
240
- const wanted = wordsOf(node.value);
241
- return words.some((_, at) => wanted.every((word, offset) => words[at + offset] === word));
242
- }
243
- case "num": {
244
- const number2 = Number(value);
245
- if (node.operator !== "range")
246
- return number2 === Number(node.value);
247
- const { value: lower, upper = "*", lower_inclusive: lowerInclusive, upper_inclusive: upperInclusive } = node;
248
- return (lower === "*" || (lowerInclusive ? number2 >= Number(lower) : number2 > Number(lower))) && (upper === "*" || (upperInclusive ? number2 <= Number(upper) : number2 < Number(upper)));
249
- }
250
- case "time": {
251
- const time = Date.parse(text);
252
- const [lower, upper, lowerInclusive, upperInclusive] = node.operator === "range" ? [node.value, node.upper ?? "*", node.lower_inclusive ?? true, node.upper_inclusive ?? true] : [node.value, node.value, true, true];
253
- const range = dateRange(lower, upper, lowerInclusive, upperInclusive, options.zone ?? "UTC", node.span, options.now);
254
- return (range.lower === void 0 || (range.lower_inclusive ? time >= range.lower : time > range.lower)) && (range.upper === void 0 || (range.upper_inclusive ? time <= range.upper : time < range.upper));
255
- }
256
- default:
257
- return node.operator === "wildcard" ? pattern(node.value).test(text) : text.toLowerCase() === node.value.toLowerCase();
258
- }
259
- }, "matchOne");
260
- var matches = /* @__PURE__ */ __name((node, item, byName, options) => {
261
- if (node.kind === "boolean") {
262
- const by = /* @__PURE__ */ __name((occur) => node.clauses.filter((clause) => clause.occur === occur), "by");
263
- const [must, should, mustNot] = [by("must"), by("should"), by("must_not")];
264
- const holds = /* @__PURE__ */ __name((clause) => matches(clause.node, item, byName, options), "holds");
265
- return must.every(holds) && !mustNot.some(holds) && (should.length === 0 || must.length > 0 || should.some(holds));
266
- }
267
- const field = byName.get(node.field);
268
- if (!field)
269
- throw new Error(`evaluate: no field "${node.field}"; validate the query first`);
270
- if (field.relation !== void 0) {
271
- if (!options.relation)
272
- throw new Error(`evaluate: "${node.field}" is a relation; pass options.relation`);
273
- return options.relation(node, item);
274
- }
275
- const value = item[node.field];
276
- return Array.isArray(value) ? value.some((one) => matchOne(field, node, one, options)) : matchOne(field, node, value, options);
277
- }, "matches");
278
- var evaluate = /* @__PURE__ */ __name((ast, fields, item, options = {}) => matches(ast.root, item, new Map(fields.map((field) => [field.name, field])), options), "evaluate");
279
-
280
- // node_modules/.pnpm/@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/fields.js
281
- var FIELD_TYPES = ["kw", "txt", "enum", "num", "time", "bool", "ref"];
282
- var OPERATORS_BY_TYPE = {
283
- kw: ["term", "phrase", "wildcard"],
284
- txt: ["term", "phrase", "wildcard"],
285
- enum: ["term"],
286
- num: ["term", "range"],
287
- time: ["term", "range"],
288
- bool: ["term"],
289
- ref: ["term", "phrase"]
290
- };
291
- var QUERY_BACKENDS = ["sql", "native"];
292
- var unwrap = /* @__PURE__ */ __name((schema) => schema.wrapped ? unwrap(schema.wrapped) : schema, "unwrap");
293
- var REFERENCE_SOURCE = reference.pipe[1].requirement.source;
294
- var typeOf = /* @__PURE__ */ __name((schema) => {
295
- const plain = unwrap(schema);
296
- const actions = plain.pipe ?? [];
297
- switch (plain.type) {
298
- case "picklist":
299
- return { type: "enum", values: (plain.options ?? []).map(String) };
300
- case "number":
301
- return { type: "num" };
302
- case "boolean":
303
- return { type: "bool" };
304
- case "string":
305
- if (actions.some((action) => action.type === "iso_timestamp"))
306
- return { type: "time" };
307
- if (actions.some((action) => action.requirement instanceof RegExp && action.requirement.source === REFERENCE_SOURCE))
308
- return { type: "ref" };
309
- return { type: "kw" };
310
- case "array":
311
- return plain.item ? typeOf(plain.item) : void 0;
312
- default:
313
- return void 0;
314
- }
315
- }, "typeOf");
316
- var exampleOf = /* @__PURE__ */ __name((name, type, values) => ({
317
- kw: `${name}:abc`,
318
- txt: `${name}:word*`,
319
- enum: `${name}:${values?.[0] ?? "x"}`,
320
- num: `${name}>0`,
321
- time: `${name}>=7d`,
322
- bool: `${name}:true`,
323
- ref: `${name}:"note:42"`
324
- })[type], "exampleOf");
325
- var queryFieldsOf = /* @__PURE__ */ __name((schema, annotations = {}) => {
326
- const entries = unwrap(schema).entries ?? {};
327
- const excluded = new Set(annotations.exclude ?? []);
328
- const words = new Set(annotations.text ?? []);
329
- const native = new Set(annotations.native ?? []);
330
- const negatable = new Set(annotations.negatable ?? []);
331
- const finish = /* @__PURE__ */ __name((field) => ({
332
- ...field,
333
- operators: OPERATORS_BY_TYPE[field.type],
334
- example: annotations.examples?.[field.name] ?? field.example ?? exampleOf(field.name, field.type, field.values),
335
- ...native.has(field.name) ? { native: true } : {},
336
- ...negatable.has(field.name) ? { negatable: true } : {},
337
- ...annotations.validate?.[field.name] ? { validate: annotations.validate[field.name] } : {}
338
- }), "finish");
339
- const own = Object.entries(entries).flatMap(([name, entry]) => {
340
- if (excluded.has(name))
341
- return [];
342
- const found = typeOf(entry);
343
- if (!found)
344
- return [];
345
- return [finish({ name, ...found, ...words.has(name) && found.type === "kw" ? { type: "txt" } : {} })];
346
- });
347
- const relations = Object.entries(annotations.relations ?? {}).map(([name, relation]) => finish({ name, ...relation }));
348
- const states = annotations.states ? [
349
- finish({
350
- name: "is",
351
- type: "enum",
352
- values: Object.keys(annotations.states),
353
- relation: Object.entries(annotations.states).map(([state, meaning]) => `${state}: ${meaning}`).join("; ")
354
- })
355
- ] : [];
356
- return [...own, ...relations, ...states];
357
- }, "queryFieldsOf");
358
-
359
- // node_modules/.pnpm/@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/help.js
360
- var shownOf = /* @__PURE__ */ __name((registry) => registry.backend === "native" ? registry.fields.filter((field) => field.native) : registry.fields, "shownOf");
361
- var leftOut = /* @__PURE__ */ __name((fields) => fields.filter((field) => field.negatable).map((field) => field.name), "leftOut");
362
- var has = /* @__PURE__ */ __name((fields, operator) => fields.some((field) => field.operators.includes(operator)), "has");
363
- var syntaxOf = /* @__PURE__ */ __name((shown, backend) => [
364
- "field:value",
365
- ...has(shown, "phrase") ? ['"a phrase"'] : [],
366
- ...has(shown, "wildcard") ? ["word*"] : [],
367
- ...backend === "native" ? ["terms joined by AND"] : ["AND OR NOT", "( )"],
368
- ...has(shown, "range") ? ["[a TO b] \xB7 > >= < <="] : []
369
- ].join(" \xB7 "), "syntaxOf");
370
- var kindOf = /* @__PURE__ */ __name((field) => field.values ? `${field.type}: ${field.values.join("|")}` : `${field.type}: ${field.operators.join(", ")}`, "kindOf");
371
- var fieldsHelp = /* @__PURE__ */ __name((registry, guide) => {
372
- const shown = shownOf(registry);
373
- const negatable = leftOut(shown);
374
- const rows = shown.map((field) => [field.name, kindOf(field), field.example]);
375
- const widths = [0, 1].map((at) => Math.max(...rows.map((row) => (row[at] ?? "").length)));
376
- return [
377
- "Fields:",
378
- ...rows.map(([name = "", kind = "", example = ""]) => ` ${name.padEnd(widths[0] ?? 0)} ${kind.padEnd(widths[1] ?? 0)} ${example}`.trimEnd()),
379
- ...registry.defaults && registry.defaults.length > 0 ? [`Defaults: ${registry.defaults.join(" ")} \u2014 name the field to change it`] : [],
380
- ...negatable.length > 0 ? [`Leave out: -${negatable[0]}:value or NOT ${negatable[0]}:value, for ${negatable.join(", ")}`] : [],
381
- `Syntax: ${syntaxOf(shown, registry.backend)}`,
382
- ...guide ? [`Guide: ${guide}`] : []
383
- ].join("\n");
384
- }, "fieldsHelp");
385
- var queryDescription = /* @__PURE__ */ __name((registry) => {
386
- const shown = shownOf(registry);
387
- if (shown.length === 0)
388
- return "field:value terms; this list filters by none yet, so any term is refused";
389
- const negatable = leftOut(shown);
390
- const terms = registry.backend === "native" ? `field:value terms joined by AND that narrow the list${negatable.length > 0 ? `; -field:value or NOT field:value leaves out what matches, for ${negatable.join(", ")} only` : ""}` : `field:value terms that narrow the list (Lucene: AND OR NOT, -field:value${has(shown, "range") ? ", [a TO b], > <" : ""})`;
391
- const fields = shown.map((field) => field.values ? `${field.name} (${field.values.join("|")})` : field.name);
392
- const defaults = registry.defaults?.length ? `; unless named: ${registry.defaults.join(" ")}` : "";
393
- return `${terms}; fields: ${fields.join(", ")}; e.g. ${shown[0]?.example ?? ""}${defaults}`;
394
- }, "queryDescription");
395
-
396
- // node_modules/.pnpm/@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/parser.js
75
+ // node_modules/.pnpm/@wirecat+cli-base@0.130.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/parser.js
397
76
  var whitespace = /* @__PURE__ */ __name((c) => /[ \t\n\r\u3000]/u.test(c), "whitespace");
398
77
  var reserved = /* @__PURE__ */ new Set([
399
78
  "+",
@@ -623,86 +302,407 @@ var parseLucene = /* @__PURE__ */ __name((text, { defaultField = "text", proximi
623
302
  return { node: node2, ...modifier ? { modifier } : {} };
624
303
  }
625
304
  }
626
- let node;
627
- if (peek().kind === "(") {
628
- const start2 = take().span.start;
629
- node = query(field, implicit);
630
- const end = expect(")").span.end;
631
- node = { ...node, span: { start: start2, end } };
632
- } else if (["[", "{"].includes(peek().kind)) {
633
- const opening = take();
634
- const lower = take();
635
- if (!["rangeValue", "quoted"].includes(lower.kind))
636
- fail("query.invalid-syntax", lower.span);
637
- const separator = take();
638
- if (separator.raw !== "TO")
639
- fail("query.invalid-syntax", separator.span);
640
- const upper = take();
641
- if (!["rangeValue", "quoted"].includes(upper.kind))
642
- fail("query.invalid-syntax", upper.span);
643
- const closing = take();
644
- if (!["]", "}"].includes(closing.kind))
645
- fail("query.invalid-syntax", closing.span);
646
- const decode = /* @__PURE__ */ __name((t) => decodeEscapes(t.kind === "quoted" ? t.raw.slice(1, -1) : t.raw, t.span, fail), "decode");
647
- node = built({
648
- kind: "predicate",
649
- field,
650
- operator: "range",
651
- value: decode(lower),
652
- upper: decode(upper),
653
- lower_inclusive: opening.kind === "[",
654
- upper_inclusive: closing.kind === "]",
655
- span: { start: start ?? opening.span.start, end: closing.span.end }
656
- });
657
- } else {
658
- const token = take();
659
- if (!["term", "number", "quoted", "regex"].includes(token.kind))
660
- fail("query.invalid-syntax", token.span);
661
- const raw = ["term", "number"].includes(token.kind) ? token.raw : token.raw.slice(1, -1);
662
- if (field === "fn")
663
- fail("query.unsupported-operator", token.span, "interval functions are not supported");
664
- const wildcard = ["term", "number"].includes(token.kind) && /(?<!\\)[*?]/u.test(raw);
665
- node = built({
666
- kind: "predicate",
667
- field,
668
- operator: token.kind === "regex" ? "regex" : token.kind === "quoted" ? "phrase" : wildcard ? "wildcard" : "term",
669
- value: token.kind === "regex" || wildcard ? raw : decodeEscapes(raw, token.span, fail),
670
- span: { start: start ?? token.span.start, end: token.span.end },
671
- ...implicit ? { implicit: true } : {}
672
- });
305
+ let node;
306
+ if (peek().kind === "(") {
307
+ const start2 = take().span.start;
308
+ node = query(field, implicit);
309
+ const end = expect(")").span.end;
310
+ node = { ...node, span: { start: start2, end } };
311
+ } else if (["[", "{"].includes(peek().kind)) {
312
+ const opening = take();
313
+ const lower = take();
314
+ if (!["rangeValue", "quoted"].includes(lower.kind))
315
+ fail("query.invalid-syntax", lower.span);
316
+ const separator = take();
317
+ if (separator.raw !== "TO")
318
+ fail("query.invalid-syntax", separator.span);
319
+ const upper = take();
320
+ if (!["rangeValue", "quoted"].includes(upper.kind))
321
+ fail("query.invalid-syntax", upper.span);
322
+ const closing = take();
323
+ if (!["]", "}"].includes(closing.kind))
324
+ fail("query.invalid-syntax", closing.span);
325
+ const decode = /* @__PURE__ */ __name((t) => decodeEscapes(t.kind === "quoted" ? t.raw.slice(1, -1) : t.raw, t.span, fail), "decode");
326
+ node = built({
327
+ kind: "predicate",
328
+ field,
329
+ operator: "range",
330
+ value: decode(lower),
331
+ upper: decode(upper),
332
+ lower_inclusive: opening.kind === "[",
333
+ upper_inclusive: closing.kind === "]",
334
+ span: { start: start ?? opening.span.start, end: closing.span.end }
335
+ });
336
+ } else {
337
+ const token = take();
338
+ if (!["term", "number", "quoted", "regex"].includes(token.kind))
339
+ fail("query.invalid-syntax", token.span);
340
+ const raw = ["term", "number"].includes(token.kind) ? token.raw : token.raw.slice(1, -1);
341
+ if (field === "fn")
342
+ fail("query.unsupported-operator", token.span, "interval functions are not supported");
343
+ const wildcard = ["term", "number"].includes(token.kind) && /(?<!\\)[*?]/u.test(raw);
344
+ node = built({
345
+ kind: "predicate",
346
+ field,
347
+ operator: token.kind === "regex" ? "regex" : token.kind === "quoted" ? "phrase" : wildcard ? "wildcard" : "term",
348
+ value: token.kind === "regex" || wildcard ? raw : decodeEscapes(raw, token.span, fail),
349
+ span: { start: start ?? token.span.start, end: token.span.end },
350
+ ...implicit ? { implicit: true } : {}
351
+ });
352
+ }
353
+ if (proximity && peek().kind === "~" && node.kind === "predicate" && node.operator === "phrase") {
354
+ take();
355
+ const distance = take();
356
+ if (distance.kind !== "number" || !/^\d+$/u.test(distance.raw))
357
+ fail("query.invalid-syntax", distance.span, 'write the distance as a whole number: "a b"~3');
358
+ node = { ...node, slop: Number(distance.raw), span: { start: node.span.start, end: distance.span.end } };
359
+ }
360
+ if (peek().kind === "~")
361
+ fail("query.unsupported-operator", peek().span, node.kind === "predicate" && node.operator === "phrase" ? "proximity (~) is not supported \u2014 drop the ~ for the exact phrase, or join the words with AND" : "fuzzy matching (~) is not supported \u2014 use a prefix such as word* to catch word forms");
362
+ if (["^", "@"].includes(peek().kind))
363
+ fail("query.unsupported-operator", peek().span, "boost and minimum-should-match are not supported");
364
+ return { node, ...modifier ? { modifier } : {} };
365
+ }, "clause");
366
+ const root = query(defaultField, true);
367
+ expect("EOF");
368
+ if (defaultField === "none") {
369
+ const bare = walkQuery(root).find((node) => node.implicit);
370
+ if (bare)
371
+ queryError("query.bare-word", bare.span, `"${bare.value}" has no field; write field:value`, context, {
372
+ word: bare.value
373
+ });
374
+ }
375
+ return { version: 1, language: "lucene-v1", root };
376
+ }, "parseLucene");
377
+ var implicitTextTerms = /* @__PURE__ */ __name((text) => {
378
+ const tokens = tokensOf(text);
379
+ if (tokens.some(({ kind }) => ["AND", "OR", "NOT", "+", "-", "!", "(", ")"].includes(kind)))
380
+ return /* @__PURE__ */ new Set();
381
+ return new Set(tokens.flatMap((token, index) => (token.kind === "term" || token.kind === "number") && ![":", "=", "<", ">", "<=", ">="].includes(tokens[index - 1]?.kind ?? "") && ![":", "=", "<", ">", "<=", ">="].includes(tokens[index + 1]?.kind ?? "") ? [token.span.start] : []));
382
+ }, "implicitTextTerms");
383
+
384
+ // node_modules/.pnpm/@wirecat+cli-base@0.130.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/dates.js
385
+ var timezoneOf = /* @__PURE__ */ __name((given) => {
386
+ const zone = given ?? Intl.DateTimeFormat().resolvedOptions().timeZone ?? "UTC";
387
+ try {
388
+ new Intl.DateTimeFormat("en", { timeZone: zone }).format(0);
389
+ } catch {
390
+ queryError("query.invalid-timezone", { start: 0, end: 0 }, "use an IANA timezone such as Europe/Madrid");
391
+ }
392
+ return zone;
393
+ }, "timezoneOf");
394
+ var calendar = /* @__PURE__ */ __name((value, span) => {
395
+ if (!/^\d{4}-\d{2}-\d{2}$/u.test(value))
396
+ queryError("query.invalid-date", span, "use an ISO date such as 2026-10-01");
397
+ const year = Number(value.slice(0, 4)), month = Number(value.slice(5, 7)), day = Number(value.slice(8, 10));
398
+ const date = /* @__PURE__ */ new Date(0);
399
+ date.setUTCFullYear(year, month - 1, day);
400
+ date.setUTCHours(0, 0, 0, 0);
401
+ if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day)
402
+ queryError("query.invalid-date", span);
403
+ return date;
404
+ }, "calendar");
405
+ var dayBoundary = /* @__PURE__ */ __name((value, zone, next, span) => {
406
+ const date = calendar(value, span);
407
+ if (next)
408
+ date.setUTCDate(date.getUTCDate() + 1);
409
+ const wanted = date.getUTCFullYear() * 1e4 + (date.getUTCMonth() + 1) * 100 + date.getUTCDate();
410
+ const formatter = new Intl.DateTimeFormat("en-CA", {
411
+ timeZone: zone,
412
+ year: "numeric",
413
+ month: "2-digit",
414
+ day: "2-digit",
415
+ era: "short"
416
+ });
417
+ const dayAt = /* @__PURE__ */ __name((time) => {
418
+ const parts = formatter.formatToParts(time);
419
+ const value2 = /* @__PURE__ */ __name((name) => Number(parts.find((p) => p.type === name)?.value), "value");
420
+ const year = parts.find((p) => p.type === "era")?.value === "BC" ? 1 - value2("year") : value2("year");
421
+ return year * 1e4 + value2("month") * 100 + value2("day");
422
+ }, "dayAt");
423
+ let lo = date.getTime() - 2 * 864e5, hi = date.getTime() + 2 * 864e5;
424
+ while (lo < hi) {
425
+ const mid = Math.floor((lo + hi) / 2);
426
+ if (dayAt(mid) < wanted)
427
+ lo = mid + 1;
428
+ else
429
+ hi = mid;
430
+ }
431
+ if (dayAt(lo) !== wanted)
432
+ queryError("query.invalid-date", span, "this calendar day does not exist in the selected timezone");
433
+ return lo;
434
+ }, "dayBoundary");
435
+ var WALL = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?$/u;
436
+ var wallTime = /* @__PURE__ */ __name((value, zone, span) => {
437
+ const [, year, month, day, hour, minute, second = "0", fraction = "0"] = WALL.exec(value) ?? [];
438
+ if (year === void 0)
439
+ queryError("query.invalid-date", span, "use YYYY-MM-DDTHH:mm, with optional seconds");
440
+ const wanted = Date.UTC(Number(year), Number(month) - 1, Number(day), Number(hour), Number(minute), Number(second), Number(fraction.padEnd(3, "0")));
441
+ const check = new Date(wanted);
442
+ if (check.getUTCDate() !== Number(day) || check.getUTCHours() !== Number(hour) || check.getUTCMinutes() !== Number(minute) || check.getUTCSeconds() !== Number(second))
443
+ queryError("query.invalid-date", span);
444
+ const formatter = new Intl.DateTimeFormat("en-CA", {
445
+ timeZone: zone,
446
+ year: "numeric",
447
+ month: "2-digit",
448
+ day: "2-digit",
449
+ hour: "2-digit",
450
+ minute: "2-digit",
451
+ second: "2-digit",
452
+ hourCycle: "h23"
453
+ });
454
+ const shown = /* @__PURE__ */ __name((instant) => {
455
+ const parts = Object.fromEntries(formatter.formatToParts(instant).map((part) => [part.type, Number(part.value)]));
456
+ return Date.UTC(parts.year ?? 0, (parts.month ?? 1) - 1, parts.day, parts.hour, parts.minute, parts.second) + (instant % 1e3 + 1e3) % 1e3;
457
+ }, "shown");
458
+ const found = /* @__PURE__ */ new Set();
459
+ for (const probe of [wanted - 864e5, wanted, wanted + 864e5]) {
460
+ const candidate = wanted - (shown(probe) - probe);
461
+ if (shown(candidate) === wanted)
462
+ found.add(candidate);
463
+ }
464
+ if (found.size !== 1)
465
+ queryError("query.invalid-date", span, "this local time is skipped or repeated by daylight saving; add an offset");
466
+ return [...found][0];
467
+ }, "wallTime");
468
+ var ZONED = /(?:Z|[+-]\d{2}:?\d{2})$/iu;
469
+ var zonedMoment = /* @__PURE__ */ __name((value, zone, span, { end = false } = {}) => {
470
+ if (/^\d{4}-\d{2}-\d{2}$/u.test(value))
471
+ return dayBoundary(value, zone, end, span) - (end ? 1 : 0);
472
+ if (!ZONED.test(value))
473
+ return wallTime(value, zone, span);
474
+ const time = Date.parse(value);
475
+ if (!/^\d{4}-\d{2}-\d{2}T/u.test(value) || !Number.isFinite(time))
476
+ queryError("query.invalid-date", span);
477
+ calendar(value.slice(0, 10), span);
478
+ return time;
479
+ }, "zonedMoment");
480
+ var AGO = /^(\d+)(m|h|d)$/u;
481
+ var MOMENT = /^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,3})?)?(Z|[+-]\d{2}:\d{2})?$/u;
482
+ var AGO_MS = { m: 6e4, h: 36e5, d: 864e5 };
483
+ var dayOf = /* @__PURE__ */ __name((word, zone, now, span) => {
484
+ const today = new Intl.DateTimeFormat("en-CA", {
485
+ timeZone: zone,
486
+ year: "numeric",
487
+ month: "2-digit",
488
+ day: "2-digit"
489
+ }).format(now);
490
+ if (word === "today")
491
+ return today;
492
+ const date = calendar(today, span);
493
+ date.setUTCDate(date.getUTCDate() - 1);
494
+ return date.toISOString().slice(0, 10);
495
+ }, "dayOf");
496
+ var dateEndpoint = /* @__PURE__ */ __name((value, zone, side, inclusive, span, now = Date.now()) => {
497
+ if (value === "*")
498
+ return { inclusive };
499
+ const word = value.toLowerCase();
500
+ if (word === "today" || word === "yesterday")
501
+ return dateEndpoint(dayOf(word, zone, now, span), zone, side, inclusive, span);
502
+ const [, amount, unit] = AGO.exec(word) ?? [];
503
+ if (amount && unit)
504
+ return { time: now - Number(amount) * (AGO_MS[unit] ?? 0), inclusive };
505
+ if (/^\d{4}-\d{2}-\d{2}$/u.test(value))
506
+ return {
507
+ time: dayBoundary(value, zone, side === "lower" ? !inclusive : inclusive, span),
508
+ inclusive: side === "lower"
509
+ };
510
+ const [, day, hour, minute, second = "0", offset] = MOMENT.exec(value) ?? [];
511
+ if (day === void 0)
512
+ queryError("query.invalid-date", span, "use an ISO date, a date and time such as 2026-10-01T09:00 (optional seconds and offset), today, yesterday or 30m/2h/7d ago");
513
+ const moment = value.replace(" ", "T");
514
+ if (offset === void 0)
515
+ return { time: wallTime(moment, zone, span), inclusive };
516
+ calendar(day, span);
517
+ const time = Date.parse(moment);
518
+ if (!Number.isFinite(time) || Number(hour) > 23 || Number(minute) > 59 || Number(second) > 59)
519
+ queryError("query.invalid-date", span);
520
+ return { time, inclusive };
521
+ }, "dateEndpoint");
522
+ var dateRange = /* @__PURE__ */ __name((lower, upper, lowerInclusive, upperInclusive, zone, span, now = Date.now()) => {
523
+ const since = lower === upper && AGO.test(lower.toLowerCase());
524
+ const lo = dateEndpoint(lower, zone, "lower", lowerInclusive, span, now);
525
+ const hi = dateEndpoint(since ? "*" : upper, zone, "upper", upperInclusive, span, now);
526
+ return {
527
+ ...lo.time === void 0 ? {} : { lower: lo.time },
528
+ ...hi.time === void 0 ? {} : { upper: hi.time },
529
+ lower_inclusive: lo.inclusive,
530
+ upper_inclusive: hi.inclusive
531
+ };
532
+ }, "dateRange");
533
+
534
+ // node_modules/.pnpm/@wirecat+cli-base@0.130.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/help.js
535
+ var shownOf = /* @__PURE__ */ __name((registry) => registry.backend === "native" ? registry.fields.filter((field) => field.native) : registry.fields, "shownOf");
536
+ var leftOut = /* @__PURE__ */ __name((fields) => fields.filter((field) => field.negatable).map((field) => field.name), "leftOut");
537
+ var has = /* @__PURE__ */ __name((fields, operator) => fields.some((field) => field.operators.includes(operator)), "has");
538
+ var syntaxOf = /* @__PURE__ */ __name((shown, backend) => [
539
+ "field:value",
540
+ ...has(shown, "phrase") ? ['"a phrase"'] : [],
541
+ ...has(shown, "wildcard") ? ["word*"] : [],
542
+ ...backend === "native" ? ["terms joined by AND"] : ["AND OR NOT", "( )"],
543
+ ...has(shown, "range") ? ["[a TO b] \xB7 > >= < <="] : []
544
+ ].join(" \xB7 "), "syntaxOf");
545
+ var kindOf = /* @__PURE__ */ __name((field) => field.values ? `${field.type}: ${field.values.join("|")}` : `${field.type}: ${field.operators.join(", ")}`, "kindOf");
546
+ var fieldsHelp = /* @__PURE__ */ __name((registry, guide) => {
547
+ const shown = shownOf(registry);
548
+ const negatable = leftOut(shown);
549
+ const rows = shown.map((field) => [field.name, kindOf(field), field.example]);
550
+ const widths = [0, 1].map((at) => Math.max(...rows.map((row) => (row[at] ?? "").length)));
551
+ return [
552
+ "Fields:",
553
+ ...rows.map(([name = "", kind = "", example = ""]) => ` ${name.padEnd(widths[0] ?? 0)} ${kind.padEnd(widths[1] ?? 0)} ${example}`.trimEnd()),
554
+ ...registry.defaults && registry.defaults.length > 0 ? [`Defaults: ${registry.defaults.join(" ")} \u2014 name the field to change it`] : [],
555
+ ...negatable.length > 0 ? [`Leave out: -${negatable[0]}:value or NOT ${negatable[0]}:value, for ${negatable.join(", ")}`] : [],
556
+ `Syntax: ${syntaxOf(shown, registry.backend)}`,
557
+ ...guide ? [`Guide: ${guide}`] : []
558
+ ].join("\n");
559
+ }, "fieldsHelp");
560
+ var queryDescription = /* @__PURE__ */ __name((registry) => {
561
+ const shown = shownOf(registry);
562
+ if (shown.length === 0)
563
+ return "field:value terms; this list filters by none yet, so any term is refused";
564
+ const negatable = leftOut(shown);
565
+ const terms = registry.backend === "native" ? `field:value terms joined by AND that narrow the list${negatable.length > 0 ? `; -field:value or NOT field:value leaves out what matches, for ${negatable.join(", ")} only` : ""}` : `field:value terms that narrow the list (Lucene: AND OR NOT, -field:value${has(shown, "range") ? ", [a TO b], > <" : ""})`;
566
+ const fields = shown.map((field) => field.values ? `${field.name} (${field.values.join("|")})` : field.name);
567
+ const defaults = registry.defaults?.length ? `; unless named: ${registry.defaults.join(" ")}` : "";
568
+ return `${terms}; fields: ${fields.join(", ")}; e.g. ${shown[0]?.example ?? ""}${defaults}`;
569
+ }, "queryDescription");
570
+
571
+ // node_modules/.pnpm/@wirecat+cli-base@0.130.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/evaluate.js
572
+ var wordsOf = /* @__PURE__ */ __name((text) => text.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [], "wordsOf");
573
+ var pattern = /* @__PURE__ */ __name((value) => new RegExp(`^${[...value].map((char) => char === "*" ? ".*" : char === "?" ? "." : char.replace(/[.+^${}()|[\]\\]/, "\\$&")).join("")}$`, "iu"), "pattern");
574
+ var present = /* @__PURE__ */ __name((value) => value !== void 0 && value !== null && value !== "", "present");
575
+ var matchOne = /* @__PURE__ */ __name((field, node, value, options) => {
576
+ if (!present(value))
577
+ return false;
578
+ if (node.operator === "wildcard" && node.value === "*")
579
+ return true;
580
+ const text = String(value);
581
+ switch (field.type) {
582
+ case "txt": {
583
+ const words = wordsOf(text);
584
+ if (node.operator === "wildcard")
585
+ return words.some((word) => pattern(node.value).test(word));
586
+ const wanted = wordsOf(node.value);
587
+ return words.some((_, at) => wanted.every((word, offset) => words[at + offset] === word));
588
+ }
589
+ case "num": {
590
+ const number2 = Number(value);
591
+ if (node.operator !== "range")
592
+ return number2 === Number(node.value);
593
+ const { value: lower, upper = "*", lower_inclusive: lowerInclusive, upper_inclusive: upperInclusive } = node;
594
+ return (lower === "*" || (lowerInclusive ? number2 >= Number(lower) : number2 > Number(lower))) && (upper === "*" || (upperInclusive ? number2 <= Number(upper) : number2 < Number(upper)));
673
595
  }
674
- if (proximity && peek().kind === "~" && node.kind === "predicate" && node.operator === "phrase") {
675
- take();
676
- const distance = take();
677
- if (distance.kind !== "number" || !/^\d+$/u.test(distance.raw))
678
- fail("query.invalid-syntax", distance.span, 'write the distance as a whole number: "a b"~3');
679
- node = { ...node, slop: Number(distance.raw), span: { start: node.span.start, end: distance.span.end } };
596
+ case "time": {
597
+ const time = Date.parse(text);
598
+ const [lower, upper, lowerInclusive, upperInclusive] = node.operator === "range" ? [node.value, node.upper ?? "*", node.lower_inclusive ?? true, node.upper_inclusive ?? true] : [node.value, node.value, true, true];
599
+ const range = dateRange(lower, upper, lowerInclusive, upperInclusive, options.zone ?? "UTC", node.span, options.now);
600
+ return (range.lower === void 0 || (range.lower_inclusive ? time >= range.lower : time > range.lower)) && (range.upper === void 0 || (range.upper_inclusive ? time <= range.upper : time < range.upper));
680
601
  }
681
- if (peek().kind === "~")
682
- fail("query.unsupported-operator", peek().span, node.kind === "predicate" && node.operator === "phrase" ? "proximity (~) is not supported \u2014 drop the ~ for the exact phrase, or join the words with AND" : "fuzzy matching (~) is not supported \u2014 use a prefix such as word* to catch word forms");
683
- if (["^", "@"].includes(peek().kind))
684
- fail("query.unsupported-operator", peek().span, "boost and minimum-should-match are not supported");
685
- return { node, ...modifier ? { modifier } : {} };
686
- }, "clause");
687
- const root = query(defaultField, true);
688
- expect("EOF");
689
- if (defaultField === "none") {
690
- const bare = walkQuery(root).find((node) => node.implicit);
691
- if (bare)
692
- queryError("query.bare-word", bare.span, `"${bare.value}" has no field; write field:value`, context, {
693
- word: bare.value
694
- });
602
+ default:
603
+ return node.operator === "wildcard" ? pattern(node.value).test(text) : text.toLowerCase() === node.value.toLowerCase();
695
604
  }
696
- return { version: 1, language: "lucene-v1", root };
697
- }, "parseLucene");
698
- var implicitTextTerms = /* @__PURE__ */ __name((text) => {
699
- const tokens = tokensOf(text);
700
- if (tokens.some(({ kind }) => ["AND", "OR", "NOT", "+", "-", "!", "(", ")"].includes(kind)))
701
- return /* @__PURE__ */ new Set();
702
- return new Set(tokens.flatMap((token, index) => (token.kind === "term" || token.kind === "number") && ![":", "=", "<", ">", "<=", ">="].includes(tokens[index - 1]?.kind ?? "") && ![":", "=", "<", ">", "<=", ">="].includes(tokens[index + 1]?.kind ?? "") ? [token.span.start] : []));
703
- }, "implicitTextTerms");
605
+ }, "matchOne");
606
+ var matches = /* @__PURE__ */ __name((node, item, byName, options) => {
607
+ if (node.kind === "boolean") {
608
+ const by = /* @__PURE__ */ __name((occur) => node.clauses.filter((clause) => clause.occur === occur), "by");
609
+ const [must, should, mustNot] = [by("must"), by("should"), by("must_not")];
610
+ const holds = /* @__PURE__ */ __name((clause) => matches(clause.node, item, byName, options), "holds");
611
+ return must.every(holds) && !mustNot.some(holds) && (should.length === 0 || must.length > 0 || should.some(holds));
612
+ }
613
+ const field = byName.get(node.field);
614
+ if (!field)
615
+ throw new Error(`evaluate: no field "${node.field}"; validate the query first`);
616
+ if (field.relation !== void 0) {
617
+ if (!options.relation)
618
+ throw new Error(`evaluate: "${node.field}" is a relation; pass options.relation`);
619
+ return options.relation(node, item);
620
+ }
621
+ const value = item[node.field];
622
+ return Array.isArray(value) ? value.some((one) => matchOne(field, node, one, options)) : matchOne(field, node, value, options);
623
+ }, "matches");
624
+ var evaluate = /* @__PURE__ */ __name((ast, fields, item, options = {}) => matches(ast.root, item, new Map(fields.map((field) => [field.name, field])), options), "evaluate");
625
+
626
+ // node_modules/.pnpm/@wirecat+cli-base@0.130.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/fields.js
627
+ var FIELD_TYPES = ["kw", "txt", "enum", "num", "time", "bool", "ref"];
628
+ var OPERATORS_BY_TYPE = {
629
+ kw: ["term", "phrase", "wildcard"],
630
+ txt: ["term", "phrase", "wildcard"],
631
+ enum: ["term"],
632
+ num: ["term", "range"],
633
+ time: ["term", "range"],
634
+ bool: ["term"],
635
+ ref: ["term", "phrase"]
636
+ };
637
+ var QUERY_BACKENDS = ["sql", "native"];
638
+ var unwrap = /* @__PURE__ */ __name((schema) => schema.wrapped ? unwrap(schema.wrapped) : schema, "unwrap");
639
+ var REFERENCE_SOURCE = reference.pipe[1].requirement.source;
640
+ var typeOf = /* @__PURE__ */ __name((schema) => {
641
+ const plain = unwrap(schema);
642
+ const actions = plain.pipe ?? [];
643
+ switch (plain.type) {
644
+ case "picklist":
645
+ return { type: "enum", values: (plain.options ?? []).map(String) };
646
+ case "number":
647
+ return { type: "num" };
648
+ case "boolean":
649
+ return { type: "bool" };
650
+ case "string":
651
+ if (actions.some((action) => action.type === "iso_timestamp"))
652
+ return { type: "time" };
653
+ if (actions.some((action) => action.requirement instanceof RegExp && action.requirement.source === REFERENCE_SOURCE))
654
+ return { type: "ref" };
655
+ return { type: "kw" };
656
+ case "array":
657
+ return plain.item ? typeOf(plain.item) : void 0;
658
+ default:
659
+ return void 0;
660
+ }
661
+ }, "typeOf");
662
+ var exampleOf = /* @__PURE__ */ __name((name, type, values) => ({
663
+ kw: `${name}:abc`,
664
+ txt: `${name}:word*`,
665
+ enum: `${name}:${values?.[0] ?? "x"}`,
666
+ num: `${name}>0`,
667
+ time: `${name}>=7d`,
668
+ bool: `${name}:true`,
669
+ ref: `${name}:"note:42"`
670
+ })[type], "exampleOf");
671
+ var queryFieldsOf = /* @__PURE__ */ __name((schema, annotations = {}) => {
672
+ const entries = unwrap(schema).entries ?? {};
673
+ const excluded = new Set(annotations.exclude ?? []);
674
+ const words = new Set(annotations.text ?? []);
675
+ const native = new Set(annotations.native ?? []);
676
+ const negatable = new Set(annotations.negatable ?? []);
677
+ const finish = /* @__PURE__ */ __name((field) => ({
678
+ ...field,
679
+ operators: OPERATORS_BY_TYPE[field.type],
680
+ example: annotations.examples?.[field.name] ?? field.example ?? exampleOf(field.name, field.type, field.values),
681
+ ...native.has(field.name) ? { native: true } : {},
682
+ ...negatable.has(field.name) ? { negatable: true } : {},
683
+ ...annotations.validate?.[field.name] ? { validate: annotations.validate[field.name] } : {}
684
+ }), "finish");
685
+ const own = Object.entries(entries).flatMap(([name, entry]) => {
686
+ if (excluded.has(name))
687
+ return [];
688
+ const found = typeOf(entry);
689
+ if (!found)
690
+ return [];
691
+ return [finish({ name, ...found, ...words.has(name) && found.type === "kw" ? { type: "txt" } : {} })];
692
+ });
693
+ const relations = Object.entries(annotations.relations ?? {}).map(([name, relation]) => finish({ name, ...relation }));
694
+ const states = annotations.states ? [
695
+ finish({
696
+ name: "is",
697
+ type: "enum",
698
+ values: Object.keys(annotations.states),
699
+ relation: Object.entries(annotations.states).map(([state, meaning]) => `${state}: ${meaning}`).join("; ")
700
+ })
701
+ ] : [];
702
+ return [...own, ...relations, ...states];
703
+ }, "queryFieldsOf");
704
704
 
705
- // node_modules/.pnpm/@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/validate.js
705
+ // node_modules/.pnpm/@wirecat+cli-base@0.130.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/validate.js
706
706
  var inContext = /* @__PURE__ */ __name((context, run) => {
707
707
  try {
708
708
  run();
@@ -777,7 +777,7 @@ var validateQuery = /* @__PURE__ */ __name((ast, registry, options = {}) => {
777
777
  }, "validateQuery");
778
778
  var fieldsNamed = /* @__PURE__ */ __name((ast) => new Set(walkQuery(ast.root).map((node) => node.field)), "fieldsNamed");
779
779
 
780
- // node_modules/.pnpm/@wirecat+cli-base@0.102.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/registry.js
780
+ // node_modules/.pnpm/@wirecat+cli-base@0.130.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/query/registry.js
781
781
  var describeQuery = /* @__PURE__ */ __name((registry) => ({
782
782
  entity: registry.entity,
783
783
  backend: registry.backend,