@wirecat/drive-cli 0.68.0 → 0.70.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 (225) hide show
  1. package/contracts/wirecat.json +14 -13
  2. package/dist/age.d.ts +0 -36
  3. package/dist/age.d.ts.map +1 -1
  4. package/dist/age.js +0 -22
  5. package/dist/age.js.map +1 -1
  6. package/dist/bin/drive.js +2 -2
  7. package/dist/bundle/{all-profiles-BU6XUFUP.js → all-profiles-FW3GK3QO.js} +24 -34
  8. package/dist/bundle/{anthropic-ZP5B7S2Z.js → anthropic-QVKJT3II.js} +8 -8
  9. package/dist/bundle/{app-server-EB4DH6T7.js → app-server-QU73RD5R.js} +68 -76
  10. package/dist/bundle/{bun-PWMM6L45.js → bun-5XCD5CBB.js} +2 -2
  11. package/dist/bundle/{bun-sqlite-6VPR2SVC.js → bun-sqlite-TIGSVNSV.js} +9 -9
  12. package/dist/bundle/{chunk-7BXVI7XF.js → chunk-2SBC4DVV.js} +4 -4
  13. package/dist/bundle/{chunk-UFPRP7MG.js → chunk-3AHBZP33.js} +10 -15
  14. package/dist/bundle/{chunk-QRSPFCRY.js → chunk-3CHW7JGR.js} +17 -17
  15. package/dist/bundle/chunk-3TCMANIM.js +387 -0
  16. package/dist/bundle/{chunk-EOC7RHJ2.js → chunk-3UWRAIWA.js} +5 -7
  17. package/dist/bundle/{chunk-5G2BY4B6.js → chunk-3UZ4OH22.js} +32 -31
  18. package/dist/bundle/{chunk-UIKVP23D.js → chunk-4WK26MPY.js} +1 -1
  19. package/dist/bundle/{chunk-WUFZGPXX.js → chunk-54BQWRJL.js} +7 -7
  20. package/dist/bundle/{chunk-EA2OB75T.js → chunk-54NDYVZA.js} +1 -1
  21. package/dist/bundle/{chunk-QKY24RWV.js → chunk-5JTB4URG.js} +12 -12
  22. package/dist/bundle/{chunk-M4OP5ASJ.js → chunk-66PL7P4C.js} +1 -1
  23. package/dist/bundle/{chunk-JMZQBRRZ.js → chunk-6BMTW5A6.js} +9 -9
  24. package/dist/bundle/{chunk-CVAJMRRD.js → chunk-6DPOWBKA.js} +6 -6
  25. package/dist/bundle/{chunk-YUGTJBV3.js → chunk-7C5KENNU.js} +3 -3
  26. package/dist/bundle/chunk-7DJNURKV.js +823 -0
  27. package/dist/bundle/{chunk-5TK2YQCO.js → chunk-7IBENBCK.js} +2 -2
  28. package/dist/bundle/chunk-7QSRODXM.js +259 -0
  29. package/dist/bundle/{chunk-HCZYJMBP.js → chunk-ABZ2NYDT.js} +1 -1
  30. package/dist/bundle/chunk-AV5UKJZM.js +729 -0
  31. package/dist/bundle/{chunk-IVOG6T6P.js → chunk-BBFXQPKD.js} +3 -3
  32. package/dist/bundle/{chunk-BXHFJTU5.js → chunk-BBRMDMIR.js} +3 -3
  33. package/dist/bundle/{chunk-DYLYH7VE.js → chunk-BD2K2ONK.js} +4 -4
  34. package/dist/bundle/{chunk-AIEMFRBU.js → chunk-BFKFKDPC.js} +1 -1
  35. package/dist/bundle/{chunk-JZ3MT7IE.js → chunk-BXPC5TFG.js} +2 -2
  36. package/dist/bundle/chunk-DHX27E5M.js +31 -0
  37. package/dist/bundle/{chunk-6QR7NKMG.js → chunk-DR57KDAY.js} +109 -5
  38. package/dist/bundle/{chunk-2VYEGKQ3.js → chunk-DVI72ZQG.js} +1 -1
  39. package/dist/bundle/{chunk-WGX4DZPW.js → chunk-DVVUJ254.js} +2 -2
  40. package/dist/bundle/{chunk-PJ3FKBXG.js → chunk-EDO5LZVF.js} +1 -1
  41. package/dist/bundle/{chunk-QTRYJZL7.js → chunk-EG62WVR2.js} +6 -6
  42. package/dist/bundle/{chunk-WCNTDETD.js → chunk-F5KJWRF5.js} +98 -6
  43. package/dist/bundle/{chunk-D4MVEOU2.js → chunk-FADAOLGB.js} +4 -4
  44. package/dist/bundle/{chunk-FAMXUI2X.js → chunk-FCSHWUMW.js} +5 -5
  45. package/dist/bundle/{chunk-O7T3WGCV.js → chunk-FN3RXBO7.js} +6 -6
  46. package/dist/bundle/{chunk-5W65QTYS.js → chunk-FONIFRYI.js} +4 -4
  47. package/dist/bundle/{chunk-UUQJVKPB.js → chunk-FVTKFIQH.js} +2340 -1436
  48. package/dist/bundle/{chunk-7A77GYCE.js → chunk-FYPW7NMH.js} +4 -4
  49. package/dist/bundle/{chunk-FIVFP53N.js → chunk-GA3URWIF.js} +1 -1
  50. package/dist/bundle/{chunk-GTLXBAJV.js → chunk-GAHIHE4K.js} +3035 -2482
  51. package/dist/bundle/{chunk-CMWFYZ45.js → chunk-GJZSVSV3.js} +2 -2
  52. package/dist/bundle/{chunk-QWGEOQHA.js → chunk-GK3BJMGK.js} +1 -1
  53. package/dist/bundle/{chunk-TI2OANJZ.js → chunk-GPDPEHYX.js} +1 -1
  54. package/dist/bundle/{chunk-KPKIHJIT.js → chunk-GV5DGHSA.js} +4 -4
  55. package/dist/bundle/{chunk-JRFKCYMW.js → chunk-HHAZ6DCY.js} +23 -6
  56. package/dist/bundle/{chunk-ZVQDOKDY.js → chunk-HK225DAG.js} +1 -1
  57. package/dist/bundle/{chunk-MW46BLWH.js → chunk-HRATXUFH.js} +22 -20
  58. package/dist/bundle/{chunk-Z5BMYI2V.js → chunk-HWUPU6WX.js} +8 -8
  59. package/dist/bundle/{chunk-6WAC2LOS.js → chunk-HYXXMSVD.js} +8614 -8597
  60. package/dist/bundle/{chunk-YYIWPH53.js → chunk-I7YSHUPW.js} +13 -13
  61. package/dist/bundle/{chunk-MWCPKUU4.js → chunk-IFTX7AQU.js} +5 -5
  62. package/dist/bundle/{chunk-SOS4U2RF.js → chunk-IGNIUDI3.js} +71 -49
  63. package/dist/bundle/{chunk-7JKECODO.js → chunk-ILAQIBEO.js} +1 -11
  64. package/dist/bundle/{chunk-CK2SQ2CE.js → chunk-KSJAFMU5.js} +78 -31
  65. package/dist/bundle/{chunk-ZSVMZH5O.js → chunk-LINBDWJK.js} +2 -2
  66. package/dist/bundle/{chunk-43NEDPXB.js → chunk-LMJBQFW6.js} +6 -6
  67. package/dist/bundle/{chunk-IJCUAKR5.js → chunk-ML3R2UHV.js} +4 -4
  68. package/dist/bundle/{chunk-PGPHEC2X.js → chunk-MXNQZAJQ.js} +2 -2
  69. package/dist/bundle/{chunk-RT5NT62B.js → chunk-NP7LJATI.js} +16 -70
  70. package/dist/bundle/chunk-OY7TNUEC.js +16 -0
  71. package/dist/bundle/{chunk-74NCZKRW.js → chunk-P77FL6RY.js} +18 -18
  72. package/dist/bundle/chunk-P7PLKNPX.js +3611 -0
  73. package/dist/bundle/{chunk-QVJMFZFW.js → chunk-PAPY6Q6H.js} +1 -1
  74. package/dist/bundle/{chunk-Q6BD6RUH.js → chunk-PN4JYURZ.js} +102 -57
  75. package/dist/bundle/{chunk-MOKEB656.js → chunk-PR7XD2DI.js} +2 -2
  76. package/dist/bundle/{chunk-UPCEHSIZ.js → chunk-Q5C6YKAY.js} +21 -16
  77. package/dist/bundle/{chunk-EXWZCI5G.js → chunk-QBAOIMVB.js} +1 -1
  78. package/dist/bundle/{chunk-ULNN3LCY.js → chunk-RCTOWLCD.js} +44 -37
  79. package/dist/bundle/{chunk-7TNQZKRD.js → chunk-REM5WHHQ.js} +77 -76
  80. package/dist/bundle/{chunk-Y2QVNVHK.js → chunk-RHSBXOQM.js} +1 -1
  81. package/dist/bundle/{chunk-UYBLNGZ2.js → chunk-RLNZ7NX5.js} +2 -2
  82. package/dist/bundle/chunk-RQNRYF6D.js +170 -0
  83. package/dist/bundle/{chunk-PV3AWPHR.js → chunk-SONPLYV7.js} +5 -5
  84. package/dist/bundle/{chunk-CRIEW4FP.js → chunk-T5D4OGDC.js} +2 -2
  85. package/dist/bundle/{chunk-MLSXHTUB.js → chunk-TGS5VPJD.js} +1228 -455
  86. package/dist/bundle/chunk-TNKQDS5A.js +335 -0
  87. package/dist/bundle/{chunk-DU23ET2O.js → chunk-VVN6GHAZ.js} +60 -81
  88. package/dist/bundle/{chunk-PWIEOATY.js → chunk-WJK6KTCS.js} +325 -14
  89. package/dist/bundle/{chunk-U52QE4QV.js → chunk-WWE5GO6G.js} +3 -3
  90. package/dist/bundle/{chunk-6HFZZ2PW.js → chunk-XOL346TJ.js} +2 -2
  91. package/dist/bundle/{chunk-ZAIE3G5I.js → chunk-XZBA6FVH.js} +3 -3
  92. package/dist/bundle/chunk-YCL3SK4T.js +1978 -0
  93. package/dist/bundle/{chunk-DIZBJLPM.js → chunk-YRUR3E3E.js} +68 -78
  94. package/dist/bundle/{chunk-EEE4H2PA.js → chunk-YZPE72GE.js} +12 -12
  95. package/dist/bundle/{chunk-F7KAMSXA.js → chunk-ZCXWV4XO.js} +4 -4
  96. package/dist/bundle/{chunk-NV75QPML.js → chunk-ZHZYGY5R.js} +4 -4
  97. package/dist/bundle/{cli-L7P36YUH.js → cli-K4D4DIGQ.js} +137 -88
  98. package/dist/bundle/command-contract-V3F452QI.js +43 -0
  99. package/dist/bundle/{command-server-entry-H3VGPOLJ.js → command-server-entry-WREK3QBB.js} +33 -31
  100. package/dist/bundle/decode-SEETPKBH.js +299 -0
  101. package/dist/bundle/{dispatch-WBEOHZDV.js → dispatch-SQCEURVK.js} +9 -9
  102. package/dist/bundle/drive.js +11 -11
  103. package/dist/bundle/{echarts-SDZA2SWG.js → echarts-WZ5RKFCX.js} +2 -2
  104. package/dist/bundle/{embed-WUKOASQG.js → embed-B2UCRZZR.js} +9 -9
  105. package/dist/bundle/{embedder-UBRAXRDZ.js → embedder-4R6Z7G7L.js} +12 -12
  106. package/dist/bundle/entry-ORZYRJ5N.js +25 -0
  107. package/dist/bundle/{failure-X6PSLVSO.js → failure-CYNXH3RQ.js} +4 -4
  108. package/dist/bundle/first-run-KAKA6KBY.js +31 -0
  109. package/dist/bundle/first-screen-R645UHRH.js +41 -0
  110. package/dist/bundle/google-BSO3YB7N.js +45 -0
  111. package/dist/bundle/{google-api-SQQ4BSNR.js → google-api-SAND2F7L.js} +70 -63
  112. package/dist/bundle/grants-PLNFYARD.js +118 -0
  113. package/dist/bundle/{identity-SRL6RSU2.js → identity-JVVGS4U6.js} +6 -6
  114. package/dist/bundle/{instructions-7T6JJIFS.js → instructions-JSMTSB22.js} +1 -1
  115. package/dist/bundle/{login-N243GGEE.js → login-6WG3YBDU.js} +78 -71
  116. package/dist/bundle/{mcp-TDKGDB4V.js → mcp-VFIOZDVY.js} +2 -2
  117. package/dist/bundle/meeting-combined-SUKMFK3F.js +27 -0
  118. package/dist/bundle/meeting-model-S4YGKIFI.js +29 -0
  119. package/dist/bundle/meeting-semantic-5U7JQCFF.js +25 -0
  120. package/dist/bundle/{node-BZDMUFTW.js → node-VJMVHOWD.js} +2 -2
  121. package/dist/bundle/{node-sqlite-SZQCCMV2.js → node-sqlite-DCNT3HVE.js} +10 -10
  122. package/dist/bundle/oauth-KCMNQ3ZP.js +22 -0
  123. package/dist/bundle/{open-RVTPKDA3.js → open-NFOEHVW7.js} +8 -8
  124. package/dist/bundle/{openai-6NN63BMH.js → openai-D47WY7EC.js} +32 -30
  125. package/dist/bundle/{process-756VBE7E.js → process-Q2FRU5VA.js} +1 -1
  126. package/dist/bundle/{program-B4QBJYB5.js → program-T2AJJQEM.js} +1327 -1329
  127. package/dist/bundle/{prompt-HGP2DSRW.js → prompt-YJSDABXN.js} +8 -8
  128. package/dist/bundle/{reasons-KSYP5VDJ.js → reasons-WEHPCSJX.js} +5 -5
  129. package/dist/bundle/{recognize-26SHB7HI.js → recognize-6OBEIEB3.js} +7 -7
  130. package/dist/bundle/{remote-Z4PWHZ5N.js → remote-3SL2QJ7T.js} +13 -13
  131. package/dist/bundle/{rerank-QHJZJK3Q.js → rerank-L6F5SLIB.js} +10 -10
  132. package/dist/bundle/{serve-MYJW5IEM.js → serve-GYSWIWH4.js} +12 -12
  133. package/dist/bundle/server-BI46BSRE.js +80 -0
  134. package/dist/bundle/{server-XFW3V7CR.js → server-GWWP3RIT.js} +62 -53
  135. package/dist/bundle/{services-IQG2RVTO.js → services-BDQBRXT5.js} +91 -51
  136. package/dist/bundle/{sqlite-runtime-X4GB5PBV.js → sqlite-runtime-ZSZGAUYB.js} +9 -9
  137. package/dist/bundle/{start-C6EXYXAL.js → start-BJ275RUK.js} +7 -7
  138. package/dist/bundle/{state-ATQK2X3W.js → state-HLNGFI2T.js} +9 -9
  139. package/dist/bundle/{store-QUBUPK6F.js → store-I43KZNJW.js} +35 -26
  140. package/dist/bundle/{store-MEHEUOJH.js → store-OSRTGYGI.js} +23 -19
  141. package/dist/bundle/store-maintenance-command-FO7LEVSL.js +72 -0
  142. package/dist/bundle/tokens-DB7O7QNB.js +118 -0
  143. package/dist/catalog.d.ts +0 -28
  144. package/dist/catalog.d.ts.map +1 -1
  145. package/dist/catalog.js +0 -82
  146. package/dist/catalog.js.map +1 -1
  147. package/dist/commands/catalog.d.ts +3 -8
  148. package/dist/commands/catalog.d.ts.map +1 -1
  149. package/dist/commands/catalog.js +36 -109
  150. package/dist/commands/catalog.js.map +1 -1
  151. package/dist/commands/context.d.ts +3 -0
  152. package/dist/commands/context.d.ts.map +1 -1
  153. package/dist/commands/context.js +20 -0
  154. package/dist/commands/context.js.map +1 -1
  155. package/dist/commands/documents.d.ts.map +1 -1
  156. package/dist/commands/documents.js +30 -72
  157. package/dist/commands/documents.js.map +1 -1
  158. package/dist/commands/folders.d.ts +1 -1
  159. package/dist/commands/folders.d.ts.map +1 -1
  160. package/dist/commands/folders.js +45 -48
  161. package/dist/commands/folders.js.map +1 -1
  162. package/dist/commands/knowledge.d.ts +4 -21
  163. package/dist/commands/knowledge.d.ts.map +1 -1
  164. package/dist/commands/knowledge.js +3 -241
  165. package/dist/commands/knowledge.js.map +1 -1
  166. package/dist/commands/mirrors.d.ts +2 -2
  167. package/dist/commands/mirrors.d.ts.map +1 -1
  168. package/dist/commands/mirrors.js +46 -202
  169. package/dist/commands/mirrors.js.map +1 -1
  170. package/dist/commands/search.d.ts +1 -3
  171. package/dist/commands/search.d.ts.map +1 -1
  172. package/dist/commands/search.js +20 -42
  173. package/dist/commands/search.js.map +1 -1
  174. package/dist/commands/sync.d.ts.map +1 -1
  175. package/dist/commands/sync.js +36 -53
  176. package/dist/commands/sync.js.map +1 -1
  177. package/dist/contract-overrides.d.ts +0 -2
  178. package/dist/contract-overrides.d.ts.map +1 -1
  179. package/dist/contract-overrides.js +0 -317
  180. package/dist/contract-overrides.js.map +1 -1
  181. package/dist/knowledge.d.ts +1 -1
  182. package/dist/knowledge.d.ts.map +1 -1
  183. package/dist/knowledge.js +4 -3
  184. package/dist/knowledge.js.map +1 -1
  185. package/dist/list-queries.d.ts +0 -31
  186. package/dist/list-queries.d.ts.map +1 -1
  187. package/dist/list-queries.js +0 -36
  188. package/dist/list-queries.js.map +1 -1
  189. package/dist/policy.d.ts +1 -1
  190. package/dist/policy.d.ts.map +1 -1
  191. package/dist/policy.js +3 -3
  192. package/dist/policy.js.map +1 -1
  193. package/dist/program.d.ts.map +1 -1
  194. package/dist/program.js +2 -3
  195. package/dist/program.js.map +1 -1
  196. package/dist/provider-json.d.ts.map +1 -1
  197. package/dist/provider-json.js +5 -5
  198. package/dist/provider-json.js.map +1 -1
  199. package/dist/reasons.d.ts.map +1 -1
  200. package/dist/reasons.js +0 -10
  201. package/dist/reasons.js.map +1 -1
  202. package/dist/version.d.ts +1 -1
  203. package/dist/version.js +1 -1
  204. package/package.json +3 -3
  205. package/dist/bundle/chunk-2UHQVRH2.js +0 -1235
  206. package/dist/bundle/chunk-AXYG2DDY.js +0 -4721
  207. package/dist/bundle/chunk-J5LXL435.js +0 -1316
  208. package/dist/bundle/chunk-R5FTCNLJ.js +0 -76
  209. package/dist/bundle/command-contract-EYFGMKIG.js +0 -41
  210. package/dist/bundle/decode-JEU6JWCV.js +0 -165
  211. package/dist/bundle/entry-C4NUQFTF.js +0 -25
  212. package/dist/bundle/first-run-PKHBS7B4.js +0 -30
  213. package/dist/bundle/first-screen-QOVOM4BF.js +0 -39
  214. package/dist/bundle/google-XXHSMTVK.js +0 -45
  215. package/dist/bundle/grants-2U4JVT6O.js +0 -111
  216. package/dist/bundle/oauth-CMAFXX6A.js +0 -22
  217. package/dist/bundle/server-HBZPIHDX.js +0 -74
  218. package/dist/bundle/store-maintenance-command-33ULVDWY.js +0 -65
  219. package/dist/bundle/tokens-A2GP4F34.js +0 -111
  220. package/dist/knowledge-query.d.ts +0 -77
  221. package/dist/knowledge-query.d.ts.map +0 -1
  222. package/dist/knowledge-query.js +0 -104
  223. package/dist/knowledge-query.js.map +0 -1
  224. package/dist/bundle/{chunk-XWBPP2HX.js → chunk-ZI3YTXSF.js} +0 -0
  225. package/dist/bundle/{mdast-util-from-markdown-CE73EWJ2.js → mdast-util-from-markdown-FXEPSNER.js} +3 -3
@@ -2,25 +2,310 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  storePath
5
- } from "./chunk-CRIEW4FP.js";
5
+ } from "./chunk-T5D4OGDC.js";
6
6
  import {
7
- resolvePaths
8
- } from "./chunk-MW46BLWH.js";
7
+ resolvePaths,
8
+ writeSecurely
9
+ } from "./chunk-HRATXUFH.js";
9
10
  import {
10
11
  singleLine
11
- } from "./chunk-HCZYJMBP.js";
12
+ } from "./chunk-ABZ2NYDT.js";
12
13
  import {
13
14
  CliError
14
- } from "./chunk-EA2OB75T.js";
15
+ } from "./chunk-54NDYVZA.js";
15
16
  import {
16
17
  __name
17
18
  } from "./chunk-ZVVMGPBJ.js";
18
19
 
19
- // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/store/shared-config.js
20
- import { mkdirSync, readFileSync, renameSync, statSync, writeFileSync } from "node:fs";
20
+ // node_modules/.pnpm/@wirecat+cli-core@0.666.0_@wirecat+cli-base@0.101.0_commander@15.0.0_esbuild@0.28.2_typ_02b130a271480a962759fcca79b3d7ec/node_modules/@wirecat/cli-core/dist/store/shared-config.js
21
+ import { existsSync, mkdirSync, readFileSync, renameSync, statSync, writeFileSync } from "node:fs";
21
22
  import { dirname, join, resolve } from "node:path";
22
23
 
23
- // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/domain/task-categories.js
24
+ // node_modules/.pnpm/@wirecat+cli-core@0.666.0_@wirecat+cli-base@0.101.0_commander@15.0.0_esbuild@0.28.2_typ_02b130a271480a962759fcca79b3d7ec/node_modules/@wirecat/cli-core/dist/domain/config-repair.js
25
+ var REPAIR_WORDS = {
26
+ byte_order_mark: "an invisible byte-order mark at the start",
27
+ comment: "a comment, which JSON does not allow",
28
+ trailing_comma: "a comma before a closing bracket",
29
+ missing_comma: "a missing comma",
30
+ unquoted_key: "a key without double quotes",
31
+ single_quotes: "text in single quotes",
32
+ missing_closer: "the file stops before its closing brackets \u2014 whatever followed this line was already lost"
33
+ };
34
+ var GiveUp = class {
35
+ static {
36
+ __name(this, "GiveUp");
37
+ }
38
+ at;
39
+ why;
40
+ constructor(at, why) {
41
+ this.at = at;
42
+ this.why = why;
43
+ }
44
+ };
45
+ var NUMBER = /^-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?/;
46
+ var LITERAL = /^(true|false|null)/;
47
+ var KEY = /^[A-Za-z_$][\w$.-]*/;
48
+ var ENDS_VALUE = /^[\s,\]}/]?$/;
49
+ var repairConfigText = /* @__PURE__ */ __name((text) => {
50
+ try {
51
+ JSON.parse(text);
52
+ return { state: "valid" };
53
+ } catch {
54
+ }
55
+ const fixes = [];
56
+ const lineAt = /* @__PURE__ */ __name((offset) => text.slice(0, offset).split("\n").length, "lineAt");
57
+ const fix = /* @__PURE__ */ __name((kind, offset) => fixes.push({ kind, line: lineAt(offset) }), "fix");
58
+ const giveUp = /* @__PURE__ */ __name((why, offset = at) => {
59
+ throw new GiveUp(offset, why);
60
+ }, "giveUp");
61
+ let at = 0;
62
+ let truncated = false;
63
+ let last = "open";
64
+ let lastEnd = 0;
65
+ const previous = /* @__PURE__ */ __name(() => last, "previous");
66
+ const skip = /* @__PURE__ */ __name(() => {
67
+ for (; ; ) {
68
+ while (/\s/.test(text[at] ?? ""))
69
+ at++;
70
+ if (text.startsWith("//", at)) {
71
+ fix("comment", at);
72
+ while (at < text.length && text[at] !== "\n")
73
+ at++;
74
+ } else if (text.startsWith("/*", at)) {
75
+ const end = text.indexOf("*/", at + 2);
76
+ if (end < 0)
77
+ giveUp("a /* comment is never closed");
78
+ fix("comment", at);
79
+ at = end + 2;
80
+ } else
81
+ return;
82
+ }
83
+ }, "skip");
84
+ const string = /* @__PURE__ */ __name(() => {
85
+ const quote = text[at];
86
+ const start = at;
87
+ if (quote === "'")
88
+ fix("single_quotes", at);
89
+ at++;
90
+ let body = "";
91
+ for (; ; ) {
92
+ if (at >= text.length)
93
+ giveUp("the file stops inside a quoted text", start);
94
+ const char = text[at];
95
+ if (char === quote)
96
+ break;
97
+ if (text.charCodeAt(at) < 32)
98
+ giveUp("a line break inside a quoted text");
99
+ if (char === "\\") {
100
+ const next = text[at + 1] ?? "";
101
+ if (quote === "'" && next === "'")
102
+ body += "'";
103
+ else if (/^["\\/bfnrt]$/.test(next))
104
+ body += `\\${next}`;
105
+ else if (next === "u" && /^[0-9a-fA-F]{4}$/.test(text.slice(at + 2, at + 6))) {
106
+ body += text.slice(at, at + 6);
107
+ at += 4;
108
+ } else
109
+ giveUp("an escape JSON has no meaning for");
110
+ at += 2;
111
+ continue;
112
+ }
113
+ body += char === '"' ? '\\"' : char;
114
+ at++;
115
+ }
116
+ at++;
117
+ return JSON.parse(`"${body}"`);
118
+ }, "string");
119
+ const key = /* @__PURE__ */ __name(() => {
120
+ const char = text[at] ?? "";
121
+ if (char === '"' || char === "'")
122
+ return string();
123
+ const word = KEY.exec(text.slice(at))?.[0];
124
+ if (!word)
125
+ return giveUp("something other than a key where a key should be");
126
+ fix("unquoted_key", at);
127
+ at += word.length;
128
+ return word;
129
+ }, "key");
130
+ const scalar = /* @__PURE__ */ __name(() => {
131
+ const char = text[at] ?? "";
132
+ if (char === '"' || char === "'")
133
+ return { json: JSON.stringify(string()) };
134
+ const word = (NUMBER.exec(text.slice(at)) ?? LITERAL.exec(text.slice(at)))?.[0];
135
+ if (!word || !ENDS_VALUE.test(text[at + word.length] ?? ""))
136
+ return giveUp("a value that is not JSON \u2014 text needs quotes, and only true, false and null go without");
137
+ if (at + word.length === text.length && NUMBER.test(word))
138
+ giveUp("the file stops inside a number");
139
+ at += word.length;
140
+ return { json: word };
141
+ }, "scalar");
142
+ const members = /* @__PURE__ */ __name((close, one) => {
143
+ const out = [];
144
+ at++;
145
+ last = "open";
146
+ let comma = -1;
147
+ for (; ; ) {
148
+ skip();
149
+ if (truncated)
150
+ return out;
151
+ if (at >= text.length) {
152
+ if (previous() === "close")
153
+ giveUp("the file stops after a closing bracket, so which brackets are missing has two readings");
154
+ if (previous() === "comma")
155
+ fix("trailing_comma", comma);
156
+ fix("missing_closer", text.length);
157
+ truncated = true;
158
+ return out;
159
+ }
160
+ const char = text[at];
161
+ if (char === close) {
162
+ if (previous() === "comma")
163
+ fix("trailing_comma", comma);
164
+ at++;
165
+ last = "close";
166
+ return out;
167
+ }
168
+ if (char === "}" || char === "]")
169
+ giveUp(`a ${char} where ${close} should close`);
170
+ if (char === ",") {
171
+ if (previous() !== "value" && previous() !== "close")
172
+ giveUp("a comma with nothing before it");
173
+ comma = at;
174
+ at++;
175
+ last = "comma";
176
+ continue;
177
+ }
178
+ if (previous() === "value" || previous() === "close") {
179
+ if (lineAt(at) === lineAt(lastEnd))
180
+ giveUp("two entries on one line with no comma between them");
181
+ fix("missing_comma", lastEnd);
182
+ }
183
+ out.push(one());
184
+ }
185
+ }, "members");
186
+ const value = /* @__PURE__ */ __name(() => {
187
+ const char = text[at] ?? "";
188
+ let node;
189
+ if (char === "{") {
190
+ const seen = /* @__PURE__ */ new Set();
191
+ node = {
192
+ object: members("}", () => {
193
+ const start = at;
194
+ const name = key();
195
+ if (seen.has(name))
196
+ giveUp("a key appears twice in one object", start);
197
+ seen.add(name);
198
+ skip();
199
+ if (at >= text.length)
200
+ giveUp("the file stops after a key, before its value");
201
+ if (text[at] !== ":")
202
+ giveUp("a key with no colon after it");
203
+ at++;
204
+ skip();
205
+ if (at >= text.length)
206
+ giveUp("the file stops after a key, before its value");
207
+ return [name, value()];
208
+ })
209
+ };
210
+ } else if (char === "[") {
211
+ node = {
212
+ array: members("]", () => {
213
+ return value();
214
+ })
215
+ };
216
+ } else
217
+ node = scalar();
218
+ if (!truncated) {
219
+ last = "json" in node ? "value" : "close";
220
+ lastEnd = at;
221
+ }
222
+ return node;
223
+ }, "value");
224
+ try {
225
+ if (text.includes("\0") || text.includes(String.fromCharCode(65533)))
226
+ giveUp("the file is not text", 0);
227
+ if (text.charCodeAt(0) === 65279) {
228
+ fix("byte_order_mark", 0);
229
+ at = 1;
230
+ }
231
+ skip();
232
+ if (text[at] !== "{")
233
+ giveUp(at >= text.length ? "the file is empty" : "the file does not start with {");
234
+ const root = value();
235
+ skip();
236
+ if (at < text.length)
237
+ giveUp("more text after the closing }");
238
+ const repaired = `${serialise(root, "")}
239
+ `;
240
+ JSON.parse(repaired);
241
+ return { state: "repaired", text: repaired, fixes };
242
+ } catch (error) {
243
+ if (!(error instanceof GiveUp))
244
+ throw error;
245
+ const before = text.slice(0, error.at).split("\n");
246
+ return {
247
+ state: "refused",
248
+ line: before.length,
249
+ column: (before.at(-1)?.length ?? 0) + 1,
250
+ why: error.why
251
+ };
252
+ }
253
+ }, "repairConfigText");
254
+ var serialise = /* @__PURE__ */ __name((node, indent) => {
255
+ if ("json" in node)
256
+ return node.json;
257
+ const inner = `${indent} `;
258
+ const parts = "object" in node ? node.object.map(([name, item]) => `${inner}${JSON.stringify(name)}: ${serialise(item, inner)}`) : node.array.map((item) => `${inner}${serialise(item, inner)}`);
259
+ const [open, close] = "object" in node ? ["{", "}"] : ["[", "]"];
260
+ return parts.length === 0 ? `${open}${close}` : `${open}
261
+ ${parts.join(",\n")}
262
+ ${indent}${close}`;
263
+ }, "serialise");
264
+ var SAFE_REPAIRS = /* @__PURE__ */ new Set([
265
+ "byte_order_mark",
266
+ "comment",
267
+ "trailing_comma",
268
+ "missing_comma"
269
+ ]);
270
+ var FIX_FOR = {
271
+ unquoted_key: /* @__PURE__ */ __name((line) => `put the key on line ${line} in double quotes`, "unquoted_key"),
272
+ single_quotes: /* @__PURE__ */ __name((line) => `use double quotes for the text on line ${line}`, "single_quotes"),
273
+ missing_closer: /* @__PURE__ */ __name((line) => `add the closing } or ] the file lacks after line ${line}, and check that nothing after it was lost`, "missing_closer")
274
+ };
275
+ var FIX_FOR_REFUSAL = [
276
+ [/no comma between/, (line, before) => `add a comma after ${before} on line ${line}`],
277
+ [/no colon after/, (line) => `add a colon after the key on line ${line}`],
278
+ [/comma with nothing before/, (line) => `remove the extra comma on line ${line}`],
279
+ [/inside a quoted text/, (line) => `close the quotes on line ${line}`],
280
+ [/value that is not JSON/, (line) => `put the value on line ${line} in double quotes`],
281
+ [/key appears twice/, (line) => `keep one of the two keys named on line ${line}; the file holds both`]
282
+ ];
283
+ var shown = /* @__PURE__ */ __name((line) => line.trim().replace(/("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|[^\s"',:{}[\]]+)(\s*:)?/g, (token, _value, key) => key || /^(true|false|null)$/.test(token) ? token : '"\u2026"'), "shown");
284
+ var explainBrokenJson = /* @__PURE__ */ __name((text, result) => {
285
+ const lines = text.replace(/^\uFEFF/u, "").split(/\r?\n/);
286
+ const around = /* @__PURE__ */ __name((line2) => {
287
+ const near = lines[line2 - 1]?.trim() ? lines[line2 - 1] : lines[line2 - 2];
288
+ return near ? ` \u2014 near \`${shown(near)}\`` : "";
289
+ }, "around");
290
+ if (result.state === "repaired") {
291
+ const asked = result.fixes.find((one) => !SAFE_REPAIRS.has(one.kind)) ?? result.fixes[0];
292
+ if (!asked)
293
+ return "it is not valid JSON";
294
+ const fix2 = FIX_FOR[asked.kind]?.(asked.line);
295
+ return `line ${asked.line} has ${REPAIR_WORDS[asked.kind]}${around(asked.line)}${fix2 ? `; likely fix: ${fix2}` : ""}`;
296
+ }
297
+ if (result.state === "valid")
298
+ return "it is valid JSON";
299
+ const { line, why } = result;
300
+ const column = line === 1 && text.charCodeAt(0) === 65279 ? result.column - 1 : result.column;
301
+ const head = (lines[line - 1] ?? "").slice(0, column - 1);
302
+ const entry = head.slice(Math.max(head.lastIndexOf(","), head.lastIndexOf("{"), head.lastIndexOf("[")) + 1);
303
+ const before = shown(entry) || shown(lines[line - 2] ?? "");
304
+ const fix = FIX_FOR_REFUSAL.find(([pattern]) => pattern.test(why))?.[1](line, `\`${before}\``);
305
+ return `line ${line}, column ${column}: ${why}${around(line)}; likely fix: ${fix ?? "correct that part by hand"}`;
306
+ }, "explainBrokenJson");
307
+
308
+ // node_modules/.pnpm/@wirecat+cli-core@0.666.0_@wirecat+cli-base@0.101.0_commander@15.0.0_esbuild@0.28.2_typ_02b130a271480a962759fcca79b3d7ec/node_modules/@wirecat/cli-core/dist/domain/task-categories.js
24
309
  var DEFAULT_TASK_CATEGORIES = [
25
310
  {
26
311
  name: "taxes",
@@ -775,7 +1060,7 @@ var storedTaskCategories = /* @__PURE__ */ __name((json) => {
775
1060
  }
776
1061
  }, "storedTaskCategories");
777
1062
 
778
- // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/store/shared-config.js
1063
+ // node_modules/.pnpm/@wirecat+cli-core@0.666.0_@wirecat+cli-base@0.101.0_commander@15.0.0_esbuild@0.28.2_typ_02b130a271480a962759fcca79b3d7ec/node_modules/@wirecat/cli-core/dist/store/shared-config.js
779
1064
  var SECTION = "task_categories";
780
1065
  var sharedConfigPath = /* @__PURE__ */ __name((store, env = process.env) => {
781
1066
  const paths = resolvePaths({ appName: "WireCat", prefix: "WIRECAT", env });
@@ -783,10 +1068,33 @@ var sharedConfigPath = /* @__PURE__ */ __name((store, env = process.env) => {
783
1068
  return join(paths.config, "config.json");
784
1069
  return resolve(store) === resolve(storePath({ ...env, MESSAGING_STORE: void 0 })) ? join(paths.config, "config.json") : join(dirname(store), "config.json");
785
1070
  }, "sharedConfigPath");
1071
+ var backupPathFor = /* @__PURE__ */ __name((file) => {
1072
+ const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
1073
+ let path = `${file}.bak-${stamp}`;
1074
+ for (let n = 2; existsSync(path); n++)
1075
+ path = `${file}.bak-${stamp}-${n}`;
1076
+ return path;
1077
+ }, "backupPathFor");
1078
+ var mended = /* @__PURE__ */ __name((path, bytes) => {
1079
+ const text = bytes.toString("utf8");
1080
+ const result = repairConfigText(text);
1081
+ if (result.state === "repaired" && result.fixes.every((one) => SAFE_REPAIRS.has(one.kind))) {
1082
+ try {
1083
+ writeSecurely(backupPathFor(path), bytes, statSync(path).mode & 511);
1084
+ writeSecurely(path, result.text, 384);
1085
+ } catch {
1086
+ }
1087
+ return JSON.parse(result.text);
1088
+ }
1089
+ throw new CliError("configuration_error", `${path} is not valid JSON, ${explainBrokenJson(text, result)}`, {
1090
+ reason: "config.invalid_json",
1091
+ file: path
1092
+ });
1093
+ }, "mended");
786
1094
  var readJson = /* @__PURE__ */ __name((path) => {
787
- let text;
1095
+ let bytes;
788
1096
  try {
789
- text = readFileSync(path, "utf8");
1097
+ bytes = readFileSync(path);
790
1098
  } catch (error) {
791
1099
  if (error.code === "ENOENT")
792
1100
  return void 0;
@@ -794,9 +1102,9 @@ var readJson = /* @__PURE__ */ __name((path) => {
794
1102
  }
795
1103
  let parsed;
796
1104
  try {
797
- parsed = JSON.parse(text.replace(/^\uFEFF/u, ""));
798
- } catch (error) {
799
- throw new CliError("configuration_error", `${path} is not valid JSON: ${error.message}`);
1105
+ parsed = JSON.parse(bytes.toString("utf8"));
1106
+ } catch {
1107
+ parsed = mended(path, bytes);
800
1108
  }
801
1109
  if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
802
1110
  throw new CliError("configuration_error", `${path} must hold a JSON object`);
@@ -871,6 +1179,8 @@ var taskCategoriesReader = /* @__PURE__ */ __name((path) => {
871
1179
  }, "taskCategoriesReader");
872
1180
 
873
1181
  export {
1182
+ REPAIR_WORDS,
1183
+ repairConfigText,
874
1184
  DEFAULT_TASK_CATEGORIES,
875
1185
  FALLBACK_CATEGORY,
876
1186
  unlistedNote,
@@ -878,6 +1188,7 @@ export {
878
1188
  taskCategoryValue,
879
1189
  storedTaskCategories,
880
1190
  sharedConfigPath,
1191
+ backupPathFor,
881
1192
  readTaskCategoryEdits,
882
1193
  applyTaskCategoryEdits,
883
1194
  editsFrom,
@@ -2,16 +2,16 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  alive
5
- } from "./chunk-UIKVP23D.js";
5
+ } from "./chunk-4WK26MPY.js";
6
6
  import {
7
7
  resolvePaths,
8
8
  writeSecurely
9
- } from "./chunk-MW46BLWH.js";
9
+ } from "./chunk-HRATXUFH.js";
10
10
  import {
11
11
  __name
12
12
  } from "./chunk-ZVVMGPBJ.js";
13
13
 
14
- // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/background/lock.js
14
+ // node_modules/.pnpm/@wirecat+cli-core@0.666.0_@wirecat+cli-base@0.101.0_commander@15.0.0_esbuild@0.28.2_typ_02b130a271480a962759fcca79b3d7ec/node_modules/@wirecat/cli-core/dist/background/lock.js
15
15
  import { existsSync, linkSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
16
16
  import { dirname, join } from "node:path";
17
17
  var lockPath = /* @__PURE__ */ __name((app, profile, env) => join(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env }).state, "serve", `${profile}.lock`), "lockPath");
@@ -2,10 +2,10 @@ import { createRequire as __bundleRequire } from "node:module";
2
2
  const require = __bundleRequire(import.meta.url);
3
3
  import {
4
4
  REASONS
5
- } from "./chunk-7JKECODO.js";
5
+ } from "./chunk-ILAQIBEO.js";
6
6
 
7
7
  // dist/version.js
8
- var VERSION = "0.68.0";
8
+ var VERSION = "0.70.0";
9
9
 
10
10
  // dist/identity.js
11
11
  var PACKAGE = "@wirecat/drive-cli";
@@ -4,15 +4,15 @@ import {
4
4
  MAX_SECRET_INPUT,
5
5
  bufferedInput,
6
6
  inputPolicy
7
- } from "./chunk-PGPHEC2X.js";
7
+ } from "./chunk-MXNQZAJQ.js";
8
8
  import {
9
9
  CliError
10
- } from "./chunk-EA2OB75T.js";
10
+ } from "./chunk-54NDYVZA.js";
11
11
  import {
12
12
  __name
13
13
  } from "./chunk-ZVVMGPBJ.js";
14
14
 
15
- // node_modules/.pnpm/@wirecat+cli-core@0.656.0_@wirecat+cli-base@0.99.0_commander@15.0.0_esbuild@0.28.2_type_dceb8977715cf47b69a8fd97c630c977/node_modules/@wirecat/cli-core/dist/terminal/prompt.js
15
+ // node_modules/.pnpm/@wirecat+cli-core@0.666.0_@wirecat+cli-base@0.101.0_commander@15.0.0_esbuild@0.28.2_typ_02b130a271480a962759fcca79b3d7ec/node_modules/@wirecat/cli-core/dist/terminal/prompt.js
16
16
  import { createInterface } from "node:readline";
17
17
  import { Writable } from "node:stream";
18
18
  var EMPTY_TRIES = 3;