@wirecat/notion-cli 0.5.0 → 0.7.0

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 (241) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +5 -0
  3. package/contracts/wirecat.json +55 -2
  4. package/dist/bin/notion.js +2 -2
  5. package/dist/bundle/agent-AILW4JPO.js +42 -0
  6. package/dist/bundle/{all-profiles-V37KCXH3.js → all-profiles-CKOACXTW.js} +64 -21
  7. package/dist/bundle/{anthropic-Q4S3BYXD.js → anthropic-DWBBVTU3.js} +6 -6
  8. package/dist/bundle/{app-server-43SR3ACI.js → app-server-BHFYNCDE.js} +86 -65
  9. package/dist/bundle/{bun-M3J2QTR3.js → bun-ICK2XT7J.js} +2 -2
  10. package/dist/bundle/{bun-sqlite-EJ3W2PSV.js → bun-sqlite-LU5V5Y4A.js} +7 -7
  11. package/dist/bundle/{chunk-KHWOLBHQ.js → chunk-2OZVCNU5.js} +2 -2
  12. package/dist/bundle/{chunk-O5YB7FQD.js → chunk-2RNJ2JP3.js} +4 -4
  13. package/dist/bundle/{chunk-TP7GDWVF.js → chunk-364ET7LV.js} +1 -1
  14. package/dist/bundle/{chunk-TDNURSU6.js → chunk-3AKMIKND.js} +19 -19
  15. package/dist/bundle/{chunk-O3DYRCIT.js → chunk-3DGHBXH2.js} +1 -1
  16. package/dist/bundle/chunk-3KOJNZH3.js +80 -0
  17. package/dist/bundle/{chunk-DSP36YHQ.js → chunk-3T3OAYL4.js} +2 -2
  18. package/dist/bundle/{chunk-W7HM2VGO.js → chunk-3YXYA6HB.js} +1 -1
  19. package/dist/bundle/chunk-3ZSUVFR7.js +398 -0
  20. package/dist/bundle/{chunk-GCZ6MAEN.js → chunk-46JBCXLI.js} +43 -64
  21. package/dist/bundle/{chunk-DB2XKHI4.js → chunk-4FHKSSXQ.js} +2 -2
  22. package/dist/bundle/chunk-4HP6KGBI.js +32 -0
  23. package/dist/bundle/chunk-4ZAQMDLD.js +1308 -0
  24. package/dist/bundle/chunk-4ZTB7LS3.js +87 -0
  25. package/dist/bundle/{chunk-BNEE35WD.js → chunk-5NFIUY2P.js} +4 -4
  26. package/dist/bundle/{chunk-E5WLE7BM.js → chunk-63SW4UXG.js} +3 -4
  27. package/dist/bundle/{chunk-NHHJHXMQ.js → chunk-64IK7JFO.js} +2 -2
  28. package/dist/bundle/{chunk-HZRQLAHO.js → chunk-6MQSBWWF.js} +1 -1
  29. package/dist/bundle/{chunk-2FJNMADN.js → chunk-6UZ5D2WP.js} +10 -10
  30. package/dist/bundle/chunk-6VPC5Z56.js +2145 -0
  31. package/dist/bundle/chunk-7COTHS6G.js +388 -0
  32. package/dist/bundle/{chunk-TOSCB4SO.js → chunk-A3RJ6FD5.js} +29 -10
  33. package/dist/bundle/chunk-ADCAWRRX.js +2366 -0
  34. package/dist/bundle/{chunk-PPHBRESD.js → chunk-ALAPDLCP.js} +2 -2
  35. package/dist/bundle/{chunk-ONZVPE24.js → chunk-B6DJQBZI.js} +6 -6
  36. package/dist/bundle/{chunk-N2XADGL4.js → chunk-BFCRGLOF.js} +4 -4
  37. package/dist/bundle/{chunk-5P5TXU2K.js → chunk-BFHPT67P.js} +9581 -10764
  38. package/dist/bundle/{chunk-NA6QLHBZ.js → chunk-BQ6CXCLP.js} +10 -8
  39. package/dist/bundle/{chunk-JCKWQGCD.js → chunk-BXXHUO7Y.js} +110 -862
  40. package/dist/bundle/chunk-DCSPCOPB.js +221 -0
  41. package/dist/bundle/chunk-DQSOYH6N.js +20 -0
  42. package/dist/bundle/chunk-ECYOTDJM.js +14 -0
  43. package/dist/bundle/chunk-EMIJVLOA.js +30 -0
  44. package/dist/bundle/{chunk-DFCHHR5M.js → chunk-EUF5JNPG.js} +1 -1
  45. package/dist/bundle/{chunk-RIGE67FR.js → chunk-EWXMIKZN.js} +43 -33
  46. package/dist/bundle/chunk-F4BX7TH2.js +15 -0
  47. package/dist/bundle/{chunk-QYXWRKNA.js → chunk-FHYV4VWY.js} +16 -9
  48. package/dist/bundle/{chunk-WE4UFASG.js → chunk-FNESLLZS.js} +29 -1
  49. package/dist/bundle/chunk-FO3XY2Y2.js +108 -0
  50. package/dist/bundle/chunk-HJDQTM3T.js +353 -0
  51. package/dist/bundle/chunk-HOO53OYK.js +561 -0
  52. package/dist/bundle/{chunk-KHZ2RGXI.js → chunk-HSVKU4OJ.js} +153 -572
  53. package/dist/bundle/{chunk-CDK5E45T.js → chunk-IEY7KS6Q.js} +2 -100
  54. package/dist/bundle/{chunk-RJMQGG3P.js → chunk-ITW26OBI.js} +65 -49
  55. package/dist/bundle/{chunk-FBZI4Z3Z.js → chunk-ITWINZ6R.js} +13 -26
  56. package/dist/bundle/{chunk-J3NKZ6MO.js → chunk-IYZWHCZJ.js} +155 -435
  57. package/dist/bundle/{chunk-W53EJOFQ.js → chunk-J3DZVB67.js} +1 -1
  58. package/dist/bundle/{chunk-FKA7DOCK.js → chunk-JEZJFQQW.js} +1 -1
  59. package/dist/bundle/chunk-JPGN473W.js +50 -0
  60. package/dist/bundle/{chunk-NTG657MI.js → chunk-JVRBW5LH.js} +7 -64
  61. package/dist/bundle/chunk-KBY42GKW.js +785 -0
  62. package/dist/bundle/{chunk-DO7BLXO3.js → chunk-KWBLDSRV.js} +16 -3
  63. package/dist/bundle/chunk-L7P3LUDQ.js +286 -0
  64. package/dist/bundle/{chunk-PWRRDDMZ.js → chunk-LBRTLZHI.js} +249 -555
  65. package/dist/bundle/{chunk-B3FSLAIU.js → chunk-LEPPRULN.js} +20 -6
  66. package/dist/bundle/{chunk-WPP76PSX.js → chunk-LVAFTQ45.js} +32 -24
  67. package/dist/bundle/{chunk-PAW6RRCW.js → chunk-MB4HXDBT.js} +8 -210
  68. package/dist/bundle/chunk-MEYYH47C.js +25 -0
  69. package/dist/bundle/{chunk-UZSBGECU.js → chunk-N3NJPHZB.js} +1 -65
  70. package/dist/bundle/{chunk-BWLBSQSU.js → chunk-NCCRLAAI.js} +4 -4
  71. package/dist/bundle/chunk-NMQRSEZM.js +37 -0
  72. package/dist/bundle/{chunk-H3E2PZ5Y.js → chunk-NV7NNL5T.js} +7 -7
  73. package/dist/bundle/chunk-OALFRUMI.js +67 -0
  74. package/dist/bundle/{chunk-CWXOXIWS.js → chunk-OCGNOJYD.js} +1 -1
  75. package/dist/bundle/chunk-OFMCU3BH.js +72 -0
  76. package/dist/bundle/{chunk-MGUEZYFA.js → chunk-OLAGFJDM.js} +13 -2143
  77. package/dist/bundle/{chunk-E2AFUJDR.js → chunk-OP2BH55P.js} +3 -3
  78. package/dist/bundle/{chunk-P5BHKKBI.js → chunk-OS4WPXPZ.js} +4 -4
  79. package/dist/bundle/{chunk-XUPN2EHR.js → chunk-OW5HW3TD.js} +23 -7
  80. package/dist/bundle/{chunk-ECC2UX7X.js → chunk-PDVXG3T3.js} +6 -6
  81. package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
  82. package/dist/bundle/{chunk-G2MJYXZG.js → chunk-PSMRUOII.js} +4 -4
  83. package/dist/bundle/{chunk-DBEQI5YM.js → chunk-QK52ARAU.js} +3 -3
  84. package/dist/bundle/{chunk-QWYMXFKM.js → chunk-QMNEDK7Z.js} +3 -3
  85. package/dist/bundle/chunk-R4JV3VLU.js +714 -0
  86. package/dist/bundle/{chunk-C32AKHTY.js → chunk-REOBWSGV.js} +35 -12
  87. package/dist/bundle/{chunk-X2M6NIQG.js → chunk-RNVYNPXT.js} +1 -1
  88. package/dist/bundle/{chunk-HHVFIXDO.js → chunk-RXGX2CZX.js} +399 -399
  89. package/dist/bundle/{chunk-W5JZMXGW.js → chunk-S35UJBFZ.js} +75 -75
  90. package/dist/bundle/{chunk-MVA5HVKL.js → chunk-S4UUN6LD.js} +18 -0
  91. package/dist/bundle/chunk-S5P7THM5.js +72 -0
  92. package/dist/bundle/{chunk-NE43YXKL.js → chunk-SRVTGI3M.js} +3 -3
  93. package/dist/bundle/chunk-TRYYWV7J.js +291 -0
  94. package/dist/bundle/chunk-TWY543BS.js +39 -0
  95. package/dist/bundle/{chunk-KFVDL2QS.js → chunk-UC7JLE6J.js} +1 -89
  96. package/dist/bundle/{chunk-3RL2MIUF.js → chunk-UO4O6WQ4.js} +8 -8
  97. package/dist/bundle/chunk-UPL474OW.js +94 -0
  98. package/dist/bundle/chunk-UQVUXG7H.js +594 -0
  99. package/dist/bundle/chunk-UYEDQGMI.js +340 -0
  100. package/dist/bundle/chunk-VNWF4I7E.js +34 -0
  101. package/dist/bundle/{chunk-FPUGMDJV.js → chunk-VRBEYOJL.js} +1 -1
  102. package/dist/bundle/{chunk-BBSFQ3PU.js → chunk-VXKD533R.js} +1646 -1337
  103. package/dist/bundle/{chunk-ECEZOLOD.js → chunk-VYZ2J7DT.js} +4 -4
  104. package/dist/bundle/{chunk-TD2JZ25O.js → chunk-WJFQMOVM.js} +113 -80
  105. package/dist/bundle/{chunk-MNRMKWCN.js → chunk-WUNEJRLJ.js} +6 -6
  106. package/dist/bundle/chunk-WVN2KTNS.js +52 -0
  107. package/dist/bundle/{chunk-GTY6N5KZ.js → chunk-X5LUHN62.js} +2 -2
  108. package/dist/bundle/{chunk-LBYGJKXW.js → chunk-X737FHZP.js} +4 -4
  109. package/dist/bundle/chunk-YHWFF6DN.js +39 -0
  110. package/dist/bundle/chunk-YSF5JBRA.js +36 -0
  111. package/dist/bundle/{chunk-QIG55MZH.js → chunk-ZGUUP2T3.js} +12 -12
  112. package/dist/bundle/{chunk-AT5I34AN.js → chunk-ZMKAI3F3.js} +3 -3
  113. package/dist/bundle/command-contract-C2CF4QAH.js +41 -0
  114. package/dist/bundle/{command-server-entry-LJ627ZUA.js → command-server-entry-F3B2KSPO.js} +30 -27
  115. package/dist/bundle/{decode-PX2LZ5Y2.js → decode-FDHFF7GC.js} +6 -6
  116. package/dist/bundle/{definitions-M3U4UYHN.js → definitions-MB65223J.js} +72 -18
  117. package/dist/bundle/{dispatch-KOISQ5QJ.js → dispatch-IXKG5Z5Y.js} +8 -8
  118. package/dist/bundle/dist-PAKDDIBT.js +191 -0
  119. package/dist/bundle/{echarts-FVTUDXDU.js → echarts-PGJPVPA4.js} +2 -2
  120. package/dist/bundle/{embed-CCSDK43I.js → embed-U6X7CNNK.js} +7 -7
  121. package/dist/bundle/{embedder-VHI4DHB7.js → embedder-3ROL6ROQ.js} +10 -10
  122. package/dist/bundle/{failure-FZ6VYKEQ.js → failure-IYMRXM2X.js} +3 -3
  123. package/dist/bundle/first-run-PNVNHGR7.js +29 -0
  124. package/dist/bundle/first-screen-DEDD64YH.js +41 -0
  125. package/dist/bundle/hast-util-from-html-X2DCPS3T.js +10531 -0
  126. package/dist/bundle/hast-util-to-html-IIFHILP5.js +998 -0
  127. package/dist/bundle/hast-util-to-mdast-3CSMIWK2.js +2272 -0
  128. package/dist/bundle/{instructions-HET7BCYK.js → instructions-MJQWRI2D.js} +1 -1
  129. package/dist/bundle/{mcp-RGNRW77S.js → mcp-JNHOSK4L.js} +2 -2
  130. package/dist/bundle/{mdast-util-from-markdown-R66F4HZA.js → mdast-util-from-markdown-XCR5KW5S.js} +138 -195
  131. package/dist/bundle/{mdast-util-gfm-LN2ELINH.js → mdast-util-gfm-JO7PHUIB.js} +28 -357
  132. package/dist/bundle/mdast-util-to-hast-AYJV7KAE.js +879 -0
  133. package/dist/bundle/mdast-util-to-markdown-DOXGHRI7.js +1854 -0
  134. package/dist/bundle/meeting-combined-HEC25QPY.js +25 -0
  135. package/dist/bundle/meeting-model-R7QPDNZZ.js +27 -0
  136. package/dist/bundle/{meeting-semantic-UD26T37N.js → meeting-semantic-7WPLMBNT.js} +7 -7
  137. package/dist/bundle/{micromark-extension-gfm-5X7YT43T.js → micromark-extension-gfm-PQ7DWZM7.js} +12 -78
  138. package/dist/bundle/{node-CXZIFHZC.js → node-3UXNV3CD.js} +2 -2
  139. package/dist/bundle/{node-sqlite-ME7KMORI.js → node-sqlite-ULWDWM3I.js} +8 -8
  140. package/dist/bundle/notes-search-7PE3E3C7.js +64 -0
  141. package/dist/bundle/notion.js +14 -14
  142. package/dist/bundle/oauth-LNUZMA72.js +20 -0
  143. package/dist/bundle/{open-HA6D3SXR.js → open-HGHC35M4.js} +6 -6
  144. package/dist/bundle/{openai-H5AJPZBX.js → openai-ISSP57MV.js} +21 -18
  145. package/dist/bundle/{process-5RUXWGYS.js → process-PB2WCOR2.js} +1 -1
  146. package/dist/bundle/{program-F3NBTZ7J.js → program-GASBJRMG.js} +7574 -7047
  147. package/dist/bundle/{prompt-6XSUOLHK.js → prompt-3VGQVX2B.js} +6 -6
  148. package/dist/bundle/{recognize-2Y7AUVGG.js → recognize-7Q2P3NME.js} +5 -5
  149. package/dist/bundle/{remote-KCABPXQ3.js → remote-BBAWKVIT.js} +12 -11
  150. package/dist/bundle/{rerank-BTN7LUVA.js → rerank-H4PUS4HV.js} +8 -8
  151. package/dist/bundle/{schemas-VVLTLMXS.js → schemas-TTVUADHT.js} +39 -60
  152. package/dist/bundle/{serve-CYEMVRFC.js → serve-FZNSKY7R.js} +11 -11
  153. package/dist/bundle/{server-WFIICGMI.js → server-BRRNDW6L.js} +78 -56
  154. package/dist/bundle/server-CQJ4LKAZ.js +90 -0
  155. package/dist/bundle/{services-L4W6ZWDG.js → services-PEU557KZ.js} +103 -88
  156. package/dist/bundle/{sqlite-runtime-IKMYLRQC.js → sqlite-runtime-4IZJ4YUM.js} +7 -7
  157. package/dist/bundle/{state-LMUP636P.js → state-MX3JVT5Q.js} +7 -7
  158. package/dist/bundle/{store-W2JC2JP4.js → store-JUT34REM.js} +24 -20
  159. package/dist/bundle/{store-A2QZFBOX.js → store-PP4BPADZ.js} +30 -18
  160. package/dist/bundle/store-maintenance-command-GRFTJBSB.js +77 -0
  161. package/dist/bundle/surface-FPWES3NY.js +76 -0
  162. package/dist/commands/account.d.ts +3 -0
  163. package/dist/commands/account.d.ts.map +1 -0
  164. package/dist/commands/account.js +22 -0
  165. package/dist/commands/account.js.map +1 -0
  166. package/dist/commands/api.d.ts +7 -2
  167. package/dist/commands/api.d.ts.map +1 -1
  168. package/dist/commands/api.js +19 -141
  169. package/dist/commands/api.js.map +1 -1
  170. package/dist/commands/library.d.ts.map +1 -1
  171. package/dist/commands/library.js +14 -6
  172. package/dist/commands/library.js.map +1 -1
  173. package/dist/config.d.ts +11 -13
  174. package/dist/config.d.ts.map +1 -1
  175. package/dist/config.js +63 -54
  176. package/dist/config.js.map +1 -1
  177. package/dist/context.d.ts +11 -3
  178. package/dist/context.d.ts.map +1 -1
  179. package/dist/context.js +20 -7
  180. package/dist/context.js.map +1 -1
  181. package/dist/generated/definitions.d.ts.map +1 -1
  182. package/dist/generated/definitions.js +72 -18
  183. package/dist/generated/definitions.js.map +1 -1
  184. package/dist/generated/manifest.d.ts.map +1 -1
  185. package/dist/generated/manifest.js +49 -0
  186. package/dist/generated/manifest.js.map +1 -1
  187. package/dist/generated/schemas.d.ts.map +1 -1
  188. package/dist/generated/schemas.js +32 -32
  189. package/dist/generated/schemas.js.map +1 -1
  190. package/dist/generated/types.d.ts +125 -25
  191. package/dist/generated/types.d.ts.map +1 -1
  192. package/dist/generated/wirecat-config.d.ts +13 -0
  193. package/dist/generated/wirecat-config.d.ts.map +1 -0
  194. package/dist/generated/wirecat-config.js +82 -0
  195. package/dist/generated/wirecat-config.js.map +1 -0
  196. package/dist/library.d.ts +3 -0
  197. package/dist/library.d.ts.map +1 -1
  198. package/dist/library.js +11 -1
  199. package/dist/library.js.map +1 -1
  200. package/dist/notion/client.d.ts +2 -6
  201. package/dist/notion/client.d.ts.map +1 -1
  202. package/dist/notion/client.js +7 -8
  203. package/dist/notion/client.js.map +1 -1
  204. package/dist/notion/errors.d.ts +5 -0
  205. package/dist/notion/errors.d.ts.map +1 -1
  206. package/dist/notion/errors.js +21 -1
  207. package/dist/notion/errors.js.map +1 -1
  208. package/dist/notion/port.d.ts +10 -0
  209. package/dist/notion/port.d.ts.map +1 -1
  210. package/dist/notion/port.js +19 -0
  211. package/dist/notion/port.js.map +1 -1
  212. package/dist/program.d.ts.map +1 -1
  213. package/dist/program.js +2 -0
  214. package/dist/program.js.map +1 -1
  215. package/dist/sync/files.d.ts +12 -0
  216. package/dist/sync/files.d.ts.map +1 -1
  217. package/dist/sync/files.js.map +1 -1
  218. package/dist/sync/from-config.d.ts +13 -0
  219. package/dist/sync/from-config.d.ts.map +1 -0
  220. package/dist/sync/from-config.js +32 -0
  221. package/dist/sync/from-config.js.map +1 -0
  222. package/dist/sync/source.d.ts +2 -1
  223. package/dist/sync/source.d.ts.map +1 -1
  224. package/dist/sync/source.js +48 -48
  225. package/dist/sync/source.js.map +1 -1
  226. package/dist/sync/users.d.ts +4 -1
  227. package/dist/sync/users.d.ts.map +1 -1
  228. package/dist/sync/users.js +3 -1
  229. package/dist/sync/users.js.map +1 -1
  230. package/dist/version.d.ts +1 -1
  231. package/dist/version.js +1 -1
  232. package/package.json +8 -8
  233. package/dist/bundle/chunk-6EOZTUHT.js +0 -726
  234. package/dist/bundle/command-contract-TVRFW2IX.js +0 -38
  235. package/dist/bundle/first-run-7JKE5AHN.js +0 -29
  236. package/dist/bundle/first-screen-ZROHOEYJ.js +0 -38
  237. package/dist/bundle/meeting-combined-SSTOJUIJ.js +0 -24
  238. package/dist/bundle/meeting-model-K7TPS4S5.js +0 -26
  239. package/dist/bundle/oauth-XBTROXHB.js +0 -20
  240. package/dist/bundle/server-UC2FNNXX.js +0 -72
  241. package/dist/bundle/store-maintenance-command-LRGQJPSZ.js +0 -63
@@ -7,7 +7,7 @@ import {
7
7
  isoTime,
8
8
  parseRegistry,
9
9
  text
10
- } from "./chunk-TOSCB4SO.js";
10
+ } from "./chunk-A3RJ6FD5.js";
11
11
  import {
12
12
  array,
13
13
  getDotPath,
@@ -21,11 +21,11 @@ import {
21
21
  strictObject,
22
22
  string,
23
23
  unknown
24
- } from "./chunk-MVA5HVKL.js";
24
+ } from "./chunk-S4UUN6LD.js";
25
25
  import {
26
26
  CliError,
27
27
  visibleControls
28
- } from "./chunk-DB2XKHI4.js";
28
+ } from "./chunk-4FHKSSXQ.js";
29
29
  import {
30
30
  __commonJS,
31
31
  __name,
@@ -1898,7 +1898,7 @@ var require_cli_table3 = __commonJS({
1898
1898
  }
1899
1899
  });
1900
1900
 
1901
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/paths.js
1901
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/paths.js
1902
1902
  import { realpathSync } from "node:fs";
1903
1903
  import { homedir, userInfo } from "node:os";
1904
1904
  import { join, posix, win32 } from "node:path";
@@ -1972,7 +1972,64 @@ var homeIsMoved = /* @__PURE__ */ __name(({ env = process.env, platform = proces
1972
1972
  var isMovedRun = /* @__PURE__ */ __name((options) => pathsAreOverridden(options) || homeIsMoved(options), "isMovedRun");
1973
1973
  var configFilePath = /* @__PURE__ */ __name((configDir, fileName = "config.json") => join(configDir, fileName), "configFilePath");
1974
1974
 
1975
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/retry.js
1975
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/drain.js
1976
+ var waitForDrain = /* @__PURE__ */ __name((stream, signal) => {
1977
+ if (signal?.aborted)
1978
+ return Promise.reject(signal.reason);
1979
+ if (stream.destroyed)
1980
+ return Promise.reject(new Error("output stream closed"));
1981
+ if (!stream.writableNeedDrain)
1982
+ return Promise.resolve();
1983
+ return new Promise((resolve2, reject) => {
1984
+ const cleanup = /* @__PURE__ */ __name(() => {
1985
+ stream.off("drain", drained).off("error", failed).off("close", closed);
1986
+ signal?.removeEventListener("abort", aborted);
1987
+ }, "cleanup");
1988
+ const drained = /* @__PURE__ */ __name(() => {
1989
+ cleanup();
1990
+ resolve2();
1991
+ }, "drained");
1992
+ const failed = /* @__PURE__ */ __name((error) => {
1993
+ cleanup();
1994
+ reject(error);
1995
+ }, "failed");
1996
+ const closed = /* @__PURE__ */ __name(() => failed(new Error("output stream closed before drain")), "closed");
1997
+ const aborted = /* @__PURE__ */ __name(() => failed(signal?.reason), "aborted");
1998
+ stream.once("drain", drained).once("error", failed).once("close", closed);
1999
+ signal?.addEventListener("abort", aborted, { once: true });
2000
+ });
2001
+ }, "waitForDrain");
2002
+
2003
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/streams.js
2004
+ var processStreams = {
2005
+ drain: /* @__PURE__ */ __name(async (signal) => {
2006
+ await Promise.all([waitForDrain(process.stdout, signal), waitForDrain(process.stderr, signal)]);
2007
+ }, "drain"),
2008
+ data: /* @__PURE__ */ __name((text2) => {
2009
+ process.stdout.write(`${text2}
2010
+ `);
2011
+ }, "data"),
2012
+ diagnostic: /* @__PURE__ */ __name((text2) => {
2013
+ process.stderr.write(`${text2}
2014
+ `);
2015
+ }, "diagnostic"),
2016
+ progress: /* @__PURE__ */ __name((text2) => {
2017
+ process.stderr.write(`\r${text2.padEnd(72)}${text2 === "" ? "\r" : ""}`);
2018
+ }, "progress")
2019
+ };
2020
+ var captureStreams = /* @__PURE__ */ __name(() => {
2021
+ const stdout = [];
2022
+ const stderr = [];
2023
+ return {
2024
+ stdout,
2025
+ stderr,
2026
+ data: /* @__PURE__ */ __name((text2) => stdout.push(text2), "data"),
2027
+ diagnostic: /* @__PURE__ */ __name((text2) => stderr.push(text2), "diagnostic"),
2028
+ progress: /* @__PURE__ */ __name((text2) => stderr.push(text2), "progress")
2029
+ };
2030
+ }, "captureStreams");
2031
+
2032
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/retry.js
1976
2033
  var DEFAULT_RETRY = {
1977
2034
  retries: 1,
1978
2035
  baseDelayMs: 250,
@@ -1984,7 +2041,7 @@ var backoffMs = /* @__PURE__ */ __name((attempt, config, random) => {
1984
2041
  return Math.round(random() * ceiling);
1985
2042
  }, "backoffMs");
1986
2043
 
1987
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/result-fields.js
2044
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/result-fields.js
1988
2045
  var forbidden = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
1989
2046
  var validate = /* @__PURE__ */ __name((paths) => {
1990
2047
  if (paths.length === 0 || paths.length > 128 || paths.some((path) => path.length > 256 || !/^[A-Za-z][A-Za-z0-9_]*(?:\.[A-Za-z][A-Za-z0-9_]*)*$/.test(path) || path.split(".").some((part) => forbidden.has(part))))
@@ -2049,7 +2106,7 @@ var projectFields = /* @__PURE__ */ __name((value, fields) => {
2049
2106
  return project(value, fields);
2050
2107
  }, "projectFields");
2051
2108
 
2052
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/batch.js
2109
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/batch.js
2053
2110
  var BATCH_LIMITS = Object.freeze({
2054
2111
  requests: 32,
2055
2112
  input_bytes: 262144,
@@ -2176,7 +2233,7 @@ var runBatch = /* @__PURE__ */ __name(async (requests, options = {}) => {
2176
2233
  };
2177
2234
  }, "runBatch");
2178
2235
 
2179
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/config.js
2236
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/config.js
2180
2237
  import { randomBytes } from "node:crypto";
2181
2238
  import { mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
2182
2239
  import { dirname, join as join2 } from "node:path";
@@ -2220,16 +2277,16 @@ var saveConfigFile = /* @__PURE__ */ __name((path, config) => {
2220
2277
  `, 384);
2221
2278
  }, "saveConfigFile");
2222
2279
 
2223
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/constants.js
2280
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/constants.js
2224
2281
  var BASE_CONSTANTS = new URL("../constants.json", new URL("constants.js", import.meta.resolve("@wirecat/cli-base")).href);
2225
2282
  var baseConstantsSchema = object({});
2226
2283
  var LayerSchema = record(string(), unknown());
2227
2284
 
2228
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/credentials.js
2285
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/credentials.js
2229
2286
  import { readFileSync as readFileSync2 } from "node:fs";
2230
2287
  import { join as join3, resolve } from "node:path";
2231
2288
 
2232
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/keyring.js
2289
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/keyring.js
2233
2290
  import { createRequire } from "node:module";
2234
2291
  var ENTRY_OPTIONS = { linux: { store: "secret-service" } };
2235
2292
  var require2 = createRequire(new URL("keyring.js", import.meta.resolve("@wirecat/cli-base")).href);
@@ -2255,7 +2312,7 @@ var systemKeyring = {
2255
2312
  delete: /* @__PURE__ */ __name((service, account) => entry(service, account).deletePassword(), "delete")
2256
2313
  };
2257
2314
 
2258
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/credentials.js
2315
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/credentials.js
2259
2316
  var movedRunService = /* @__PURE__ */ __name((service, configDir) => `${service}:${resolve(configDir)}`, "movedRunService");
2260
2317
  var warnedRuns = /* @__PURE__ */ new WeakSet();
2261
2318
  var Credentials = class {
@@ -2399,7 +2456,7 @@ var Credentials = class {
2399
2456
  }
2400
2457
  };
2401
2458
 
2402
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/time.js
2459
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/time.js
2403
2460
  var abortError = /* @__PURE__ */ __name(() => new DOMException("The operation was aborted.", "AbortError"), "abortError");
2404
2461
  var realSleep = /* @__PURE__ */ __name((ms, signal) => new Promise((resolve2, reject) => {
2405
2462
  if (signal?.aborted) {
@@ -2414,10 +2471,10 @@ var realSleep = /* @__PURE__ */ __name((ms, signal) => new Promise((resolve2, re
2414
2471
  }), "realSleep");
2415
2472
  var wallClock = /* @__PURE__ */ __name(() => /* @__PURE__ */ new Date(), "wallClock");
2416
2473
 
2417
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/logging.js
2474
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/logging.js
2418
2475
  import { appendFileSync } from "node:fs";
2419
2476
 
2420
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/log.js
2477
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/log.js
2421
2478
  var LOG_SEVERITIES = ["trace", "debug", "info", "warn", "error", "fatal"];
2422
2479
  var logRecordSchema = strictObject({
2423
2480
  time: isoTime,
@@ -2495,7 +2552,7 @@ var traceIdOf = /* @__PURE__ */ __name((traceparent) => {
2495
2552
  return traceId;
2496
2553
  }, "traceIdOf");
2497
2554
 
2498
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/logging.js
2555
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/logging.js
2499
2556
  var REDACTED_FIELDS = [
2500
2557
  "authorization",
2501
2558
  "Authorization",
@@ -2589,7 +2646,7 @@ var silent = {
2589
2646
  }, "error")
2590
2647
  };
2591
2648
 
2592
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/pretty.js
2649
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/pretty.js
2593
2650
  var import_cli_table3 = __toESM(require_cli_table3(), 1);
2594
2651
  import { styleText } from "node:util";
2595
2652
  var renderPretty = /* @__PURE__ */ __name((value, options) => {
@@ -2663,64 +2720,7 @@ var BORDERLESS = {
2663
2720
  middle: ""
2664
2721
  };
2665
2722
 
2666
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/drain.js
2667
- var waitForDrain = /* @__PURE__ */ __name((stream, signal) => {
2668
- if (signal?.aborted)
2669
- return Promise.reject(signal.reason);
2670
- if (stream.destroyed)
2671
- return Promise.reject(new Error("output stream closed"));
2672
- if (!stream.writableNeedDrain)
2673
- return Promise.resolve();
2674
- return new Promise((resolve2, reject) => {
2675
- const cleanup = /* @__PURE__ */ __name(() => {
2676
- stream.off("drain", drained).off("error", failed).off("close", closed);
2677
- signal?.removeEventListener("abort", aborted);
2678
- }, "cleanup");
2679
- const drained = /* @__PURE__ */ __name(() => {
2680
- cleanup();
2681
- resolve2();
2682
- }, "drained");
2683
- const failed = /* @__PURE__ */ __name((error) => {
2684
- cleanup();
2685
- reject(error);
2686
- }, "failed");
2687
- const closed = /* @__PURE__ */ __name(() => failed(new Error("output stream closed before drain")), "closed");
2688
- const aborted = /* @__PURE__ */ __name(() => failed(signal?.reason), "aborted");
2689
- stream.once("drain", drained).once("error", failed).once("close", closed);
2690
- signal?.addEventListener("abort", aborted, { once: true });
2691
- });
2692
- }, "waitForDrain");
2693
-
2694
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/streams.js
2695
- var processStreams = {
2696
- drain: /* @__PURE__ */ __name(async (signal) => {
2697
- await Promise.all([waitForDrain(process.stdout, signal), waitForDrain(process.stderr, signal)]);
2698
- }, "drain"),
2699
- data: /* @__PURE__ */ __name((text2) => {
2700
- process.stdout.write(`${text2}
2701
- `);
2702
- }, "data"),
2703
- diagnostic: /* @__PURE__ */ __name((text2) => {
2704
- process.stderr.write(`${text2}
2705
- `);
2706
- }, "diagnostic"),
2707
- progress: /* @__PURE__ */ __name((text2) => {
2708
- process.stderr.write(`\r${text2.padEnd(72)}${text2 === "" ? "\r" : ""}`);
2709
- }, "progress")
2710
- };
2711
- var captureStreams = /* @__PURE__ */ __name(() => {
2712
- const stdout = [];
2713
- const stderr = [];
2714
- return {
2715
- stdout,
2716
- stderr,
2717
- data: /* @__PURE__ */ __name((text2) => stdout.push(text2), "data"),
2718
- diagnostic: /* @__PURE__ */ __name((text2) => stderr.push(text2), "diagnostic"),
2719
- progress: /* @__PURE__ */ __name((text2) => stderr.push(text2), "progress")
2720
- };
2721
- }, "captureStreams");
2722
-
2723
- // node_modules/.pnpm/@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/renderer.js
2723
+ // node_modules/.pnpm/@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/renderer.js
2724
2724
  var createRenderer = /* @__PURE__ */ __name(({ format, color, streams = processStreams, quiet = false }) => {
2725
2725
  const mark = /* @__PURE__ */ __name((symbol, message) => format === "pretty" ? `${symbol} ${visibleControls(message)}` : visibleControls(message), "mark");
2726
2726
  const say = /* @__PURE__ */ __name((symbol) => (message) => {
@@ -592,6 +592,23 @@ function exactOptional(wrapped, default_) {
592
592
  }
593
593
  __name(exactOptional, "exactOptional");
594
594
  // @__NO_SIDE_EFFECTS__
595
+ function function_(message$1) {
596
+ return _standardSchema({
597
+ kind: "schema",
598
+ type: "function",
599
+ reference: function_,
600
+ expects: "Function",
601
+ async: false,
602
+ message: message$1,
603
+ "~run"(dataset, config$1) {
604
+ if (typeof dataset.value === "function") dataset.typed = true;
605
+ else _addIssue(this, "type", dataset, config$1);
606
+ return dataset;
607
+ }
608
+ });
609
+ }
610
+ __name(function_, "function_");
611
+ // @__NO_SIDE_EFFECTS__
595
612
  function lazy(getter) {
596
613
  return _standardSchema({
597
614
  kind: "schema",
@@ -1364,6 +1381,7 @@ export {
1364
1381
  boolean,
1365
1382
  custom,
1366
1383
  exactOptional,
1384
+ function_,
1367
1385
  lazy,
1368
1386
  literal,
1369
1387
  looseObject,
@@ -0,0 +1,72 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ CliError,
5
+ errorCodes
6
+ } from "./chunk-4FHKSSXQ.js";
7
+ import {
8
+ __name
9
+ } from "./chunk-ZVVMGPBJ.js";
10
+
11
+ // node_modules/.pnpm/@wirecat+cli-core@0.718.0_@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typ_cfff6f86942c54bd7564e982a7834a83/node_modules/@wirecat/cli-core/dist/errors/failures.js
12
+ var isCliFailure = /* @__PURE__ */ __name((value) => value instanceof Error && value.name === "CliError" && errorCodes.includes(value.code), "isCliFailure");
13
+ var isCommanderFailure = /* @__PURE__ */ __name((value) => {
14
+ const { code, exitCode } = value ?? {};
15
+ return value instanceof Error && typeof code === "string" && code.startsWith("commander.") && typeof exitCode === "number";
16
+ }, "isCommanderFailure");
17
+ var USAGE_REASONS = {
18
+ "commander.unknownCommand": "usage.unknown-command",
19
+ "commander.unknownOption": "usage.unknown-option"
20
+ };
21
+ var usageReason = /* @__PURE__ */ __name((code) => USAGE_REASONS[code], "usageReason");
22
+ var failureKey = /* @__PURE__ */ __name((error) => isCliFailure(error) ? error.code : error instanceof Error ? error.name : "error", "failureKey");
23
+ var SQLITE_CORRUPT = 11;
24
+ var SQLITE_NOTADB = 26;
25
+ var DAMAGED_TEXT = /database disk image is malformed|file is not a database|fts5: corruption/i;
26
+ var sqliteCode = /* @__PURE__ */ __name((error) => {
27
+ const { errcode, errno, name } = error ?? {};
28
+ const code = typeof errcode === "number" ? errcode : name === "SQLiteError" && typeof errno === "number" ? errno : null;
29
+ return code === null ? void 0 : code & 255;
30
+ }, "sqliteCode");
31
+ var damageIn = /* @__PURE__ */ __name((error) => {
32
+ if (isCliFailure(error) || isCommanderFailure(error))
33
+ return void 0;
34
+ let at = error;
35
+ for (let depth = 0; depth < 5 && at instanceof Error; depth += 1) {
36
+ const code = sqliteCode(at);
37
+ if (code !== void 0 && [SQLITE_CORRUPT, SQLITE_NOTADB].includes(code) || DAMAGED_TEXT.test(at.message))
38
+ return at;
39
+ at = at.cause;
40
+ }
41
+ return void 0;
42
+ }, "damageIn");
43
+ var wrapping = /* @__PURE__ */ __name((error, original) => {
44
+ Object.defineProperty(error, "cause", { value: original, configurable: true, writable: true });
45
+ if (original instanceof Error && original.stack)
46
+ error.stack = original.stack;
47
+ return error;
48
+ }, "wrapping");
49
+ var storeDamaged = /* @__PURE__ */ __name((error, next) => damageIn(error) ? wrapping(new CliError("configuration_error", `the store file is damaged${next ? `; \`${next}\` says what is damaged and what to do` : ""}`, { reason: "store.damaged" }), error) : error, "storeDamaged");
50
+ var damagedFile = /* @__PURE__ */ __name(async (files, work) => {
51
+ try {
52
+ return await work();
53
+ } catch (error) {
54
+ if (!damageIn(error))
55
+ throw error;
56
+ throw wrapping(new CliError("validation_error", `${files.join(" or ")} is damaged or not a database`, {
57
+ reason: "store.file-damaged"
58
+ }), error);
59
+ }
60
+ }, "damagedFile");
61
+ var isStoreDamage = /* @__PURE__ */ __name((error) => damageIn(error) !== void 0, "isStoreDamage");
62
+
63
+ export {
64
+ isCliFailure,
65
+ isCommanderFailure,
66
+ usageReason,
67
+ failureKey,
68
+ sqliteCode,
69
+ storeDamaged,
70
+ damagedFile,
71
+ isStoreDamage
72
+ };
@@ -3,17 +3,17 @@ const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  OAuthError,
5
5
  OAuthErrorCode
6
- } from "./chunk-5D4AEUVA.js";
6
+ } from "./chunk-PL5P7UKW.js";
7
7
  import {
8
8
  ACCESS_SECONDS,
9
9
  REFRESH_SECONDS,
10
10
  readStored
11
- } from "./chunk-LBYGJKXW.js";
11
+ } from "./chunk-X737FHZP.js";
12
12
  import {
13
13
  __name
14
14
  } from "./chunk-ZVVMGPBJ.js";
15
15
 
16
- // node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/mcp/http/oauth.js
16
+ // node_modules/.pnpm/@wirecat+cli-core@0.718.0_@wirecat+cli-base@0.125.0_commander@15.0.0_esbuild@0.28.2_typ_cfff6f86942c54bd7564e982a7834a83/node_modules/@wirecat/cli-core/dist/mcp/http/oauth.js
17
17
  import { createHash, randomBytes, randomInt, timingSafeEqual } from "node:crypto";
18
18
  import { chmodSync, mkdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
19
19
  import { dirname } from "node:path";
@@ -0,0 +1,291 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ __name
5
+ } from "./chunk-ZVVMGPBJ.js";
6
+
7
+ // node_modules/.pnpm/unist-util-is@6.0.1/node_modules/unist-util-is/lib/index.js
8
+ var convert = (
9
+ // Note: overloads in JSDoc can’t yet use different `@template`s.
10
+ /**
11
+ * @type {(
12
+ * (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &
13
+ * (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &
14
+ * (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &
15
+ * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &
16
+ * ((test?: Test) => Check)
17
+ * )}
18
+ */
19
+ /**
20
+ * @param {Test} [test]
21
+ * @returns {Check}
22
+ */
23
+ /* @__PURE__ */ __name((function(test) {
24
+ if (test === null || test === void 0) {
25
+ return ok;
26
+ }
27
+ if (typeof test === "function") {
28
+ return castFactory(test);
29
+ }
30
+ if (typeof test === "object") {
31
+ return Array.isArray(test) ? anyFactory(test) : (
32
+ // Cast because `ReadonlyArray` goes into the above but `isArray`
33
+ // narrows to `Array`.
34
+ propertiesFactory(
35
+ /** @type {Props} */
36
+ test
37
+ )
38
+ );
39
+ }
40
+ if (typeof test === "string") {
41
+ return typeFactory(test);
42
+ }
43
+ throw new Error("Expected function, string, or object as test");
44
+ }), "convert")
45
+ );
46
+ function anyFactory(tests) {
47
+ const checks = [];
48
+ let index = -1;
49
+ while (++index < tests.length) {
50
+ checks[index] = convert(tests[index]);
51
+ }
52
+ return castFactory(any);
53
+ function any(...parameters) {
54
+ let index2 = -1;
55
+ while (++index2 < checks.length) {
56
+ if (checks[index2].apply(this, parameters)) return true;
57
+ }
58
+ return false;
59
+ }
60
+ __name(any, "any");
61
+ }
62
+ __name(anyFactory, "anyFactory");
63
+ function propertiesFactory(check) {
64
+ const checkAsRecord = (
65
+ /** @type {Record<string, unknown>} */
66
+ check
67
+ );
68
+ return castFactory(all);
69
+ function all(node) {
70
+ const nodeAsRecord = (
71
+ /** @type {Record<string, unknown>} */
72
+ /** @type {unknown} */
73
+ node
74
+ );
75
+ let key;
76
+ for (key in check) {
77
+ if (nodeAsRecord[key] !== checkAsRecord[key]) return false;
78
+ }
79
+ return true;
80
+ }
81
+ __name(all, "all");
82
+ }
83
+ __name(propertiesFactory, "propertiesFactory");
84
+ function typeFactory(check) {
85
+ return castFactory(type);
86
+ function type(node) {
87
+ return node && node.type === check;
88
+ }
89
+ __name(type, "type");
90
+ }
91
+ __name(typeFactory, "typeFactory");
92
+ function castFactory(testFunction) {
93
+ return check;
94
+ function check(value, index, parent) {
95
+ return Boolean(
96
+ looksLikeANode(value) && testFunction.call(
97
+ this,
98
+ value,
99
+ typeof index === "number" ? index : void 0,
100
+ parent || void 0
101
+ )
102
+ );
103
+ }
104
+ __name(check, "check");
105
+ }
106
+ __name(castFactory, "castFactory");
107
+ function ok() {
108
+ return true;
109
+ }
110
+ __name(ok, "ok");
111
+ function looksLikeANode(value) {
112
+ return value !== null && typeof value === "object" && "type" in value;
113
+ }
114
+ __name(looksLikeANode, "looksLikeANode");
115
+
116
+ // node_modules/.pnpm/unist-util-visit-parents@6.1.0/node_modules/unist-util-visit-parents/lib/color.node.js
117
+ function color(d) {
118
+ return "\x1B[33m" + d + "\x1B[39m";
119
+ }
120
+ __name(color, "color");
121
+
122
+ // node_modules/.pnpm/unist-util-visit-parents@6.1.0/node_modules/unist-util-visit-parents/lib/index.js
123
+ var empty = [];
124
+ var CONTINUE = true;
125
+ var EXIT = false;
126
+ var SKIP = "skip";
127
+ function visitParents(tree, testOrEnterOrVisitors, enterOrVisitorsOrReverse, reverse) {
128
+ if (!tree || typeof tree !== "object") {
129
+ throw new Error("Unexpected value `" + tree + "` for `tree`, expected node");
130
+ }
131
+ let preorder = true;
132
+ let check;
133
+ let visitors;
134
+ let enter;
135
+ let exit;
136
+ if (typeof enterOrVisitorsOrReverse === "function" || enterOrVisitorsOrReverse && typeof enterOrVisitorsOrReverse === "object") {
137
+ check = /** @type {Test} */
138
+ testOrEnterOrVisitors;
139
+ visitors = enterOrVisitorsOrReverse;
140
+ if (reverse) preorder = false;
141
+ } else {
142
+ visitors = /** @type {Visitors | Visitor} */
143
+ testOrEnterOrVisitors;
144
+ if (enterOrVisitorsOrReverse) preorder = false;
145
+ }
146
+ if (typeof visitors === "function") {
147
+ enter = visitors;
148
+ } else if (visitors && typeof visitors === "object") {
149
+ if (visitors.enter === null || visitors.enter === void 0) {
150
+ } else if (typeof visitors.enter === "function") {
151
+ enter = visitors.enter;
152
+ } else {
153
+ throw new Error(
154
+ "Unexpected value `" + visitors.enter + "` for `visitors.enter`, expected optional visitor"
155
+ );
156
+ }
157
+ if (typeof visitors.exit === "function") {
158
+ exit = visitors.exit;
159
+ } else {
160
+ throw new Error(
161
+ "Unexpected value `" + visitors.exit + "` for `visitors.exit`, expected visitor (pass a visitor directly if you only want an enter visitor)"
162
+ );
163
+ }
164
+ } else {
165
+ throw new Error(
166
+ "Unexpected value `" + visitors + "` for `enter` or `visitors`, expected visitor or object with visitors"
167
+ );
168
+ }
169
+ const is2 = convert(check);
170
+ const step = preorder ? 1 : -1;
171
+ factory(tree, void 0, [])();
172
+ function factory(node, index, parents) {
173
+ const value = (
174
+ /** @type {Record<string, unknown>} */
175
+ node && typeof node === "object" ? node : {}
176
+ );
177
+ if (typeof value.type === "string") {
178
+ const name = (
179
+ // `hast`
180
+ typeof value.tagName === "string" ? value.tagName : (
181
+ // `xast`
182
+ typeof value.name === "string" ? value.name : void 0
183
+ )
184
+ );
185
+ Object.defineProperty(visit2, "name", {
186
+ value: "node (" + color(node.type + (name ? "<" + name + ">" : "")) + ")"
187
+ });
188
+ }
189
+ return visit2;
190
+ function visit2() {
191
+ const matches = !check || is2(node, index, parents[parents.length - 1] || void 0);
192
+ let result = empty;
193
+ if (enter && matches) {
194
+ result = toResult(enter(node, parents, index));
195
+ if (result[0] === EXIT) {
196
+ return result;
197
+ }
198
+ }
199
+ if ("children" in node && node.children) {
200
+ const nodeAsParent = (
201
+ /** @type {UnistParent} */
202
+ node
203
+ );
204
+ if (nodeAsParent.children && result[0] !== SKIP) {
205
+ let offset = (preorder ? -1 : nodeAsParent.children.length) + step;
206
+ const grandparents = [...parents, nodeAsParent];
207
+ while (offset > -1 && offset < nodeAsParent.children.length) {
208
+ const child = nodeAsParent.children[offset];
209
+ const subresult = factory(child, offset, grandparents)();
210
+ if (subresult[0] === EXIT) {
211
+ return subresult;
212
+ }
213
+ offset = typeof subresult[1] === "number" ? subresult[1] : offset + step;
214
+ }
215
+ }
216
+ }
217
+ if (exit && matches) {
218
+ const exitResult = toResult(exit(node, parents, index));
219
+ if (exitResult[0] === SKIP) {
220
+ throw new Error(
221
+ "Unexpected value `" + exitResult[0] + "` from `exit`, expected `CONTINUE`, `EXIT`, index, or nothing"
222
+ );
223
+ }
224
+ if (exitResult[0] === EXIT || typeof exitResult[1] === "number") {
225
+ return exitResult;
226
+ }
227
+ }
228
+ return result;
229
+ }
230
+ __name(visit2, "visit");
231
+ }
232
+ __name(factory, "factory");
233
+ }
234
+ __name(visitParents, "visitParents");
235
+ function toResult(value) {
236
+ if (Array.isArray(value)) {
237
+ return value;
238
+ }
239
+ if (typeof value === "number") {
240
+ return [CONTINUE, value];
241
+ }
242
+ return value === null || value === void 0 ? empty : [value];
243
+ }
244
+ __name(toResult, "toResult");
245
+
246
+ // node_modules/.pnpm/unist-util-visit@5.2.0/node_modules/unist-util-visit/lib/index.js
247
+ function visit(tree, testOrEnterOrVisitors, enterOrVisitorsOrReverse, maybeReverse) {
248
+ let check;
249
+ let visitors;
250
+ let reverse;
251
+ if (typeof enterOrVisitorsOrReverse === "function" || enterOrVisitorsOrReverse && typeof enterOrVisitorsOrReverse === "object") {
252
+ check = /** @type {Test} */
253
+ testOrEnterOrVisitors;
254
+ visitors = enterOrVisitorsOrReverse;
255
+ reverse = maybeReverse;
256
+ } else {
257
+ visitors = /** @type {Visitor | Visitors} */
258
+ testOrEnterOrVisitors;
259
+ reverse = enterOrVisitorsOrReverse;
260
+ }
261
+ if (typeof visitors === "function") {
262
+ visitParents(tree, check, wrap(visitors), reverse);
263
+ } else {
264
+ visitParents(tree, check, wrapVisitors(visitors), reverse);
265
+ }
266
+ }
267
+ __name(visit, "visit");
268
+ function wrapVisitors(visitors) {
269
+ if (!visitors || typeof visitors !== "object") return visitors;
270
+ return {
271
+ enter: typeof visitors.enter === "function" ? wrap(visitors.enter) : visitors.enter,
272
+ exit: typeof visitors.exit === "function" ? wrap(visitors.exit) : visitors.exit
273
+ };
274
+ }
275
+ __name(wrapVisitors, "wrapVisitors");
276
+ function wrap(visitor) {
277
+ return overload;
278
+ function overload(node, parents, index) {
279
+ return visitor(node, index, parents[parents.length - 1]);
280
+ }
281
+ __name(overload, "overload");
282
+ }
283
+ __name(wrap, "wrap");
284
+
285
+ export {
286
+ convert,
287
+ EXIT,
288
+ SKIP,
289
+ visitParents,
290
+ visit
291
+ };