@wirecat/drive-cli 0.55.0 → 0.57.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 (132) hide show
  1. package/dist/bin/drive.js +2 -2
  2. package/dist/bundle/{all-profiles-I5KJKZPF.js → all-profiles-7LSZ3CC3.js} +9 -9
  3. package/dist/bundle/{anthropic-DPM7BRKX.js → anthropic-3QRM4QXB.js} +5 -5
  4. package/dist/bundle/{app-server-FTGLOZ2K.js → app-server-WWNMUHID.js} +48 -48
  5. package/dist/bundle/{bun-XRO6XJHQ.js → bun-NIIYUR5F.js} +2 -2
  6. package/dist/bundle/{bun-sqlite-7JJX6OUT.js → bun-sqlite-GSLSN3OT.js} +4 -4
  7. package/dist/bundle/{chunk-NPMVPKBD.js → chunk-2QLLKDE5.js} +48 -47
  8. package/dist/bundle/{chunk-P4ABC6C4.js → chunk-2ULJW5BA.js} +2 -2
  9. package/dist/bundle/{chunk-AR2HRFQO.js → chunk-373WJIHE.js} +2 -2
  10. package/dist/bundle/{chunk-K2DMCTTF.js → chunk-3BXSLNWW.js} +129 -97
  11. package/dist/bundle/{chunk-BO7ZKZCH.js → chunk-4F2VRJZE.js} +121 -46
  12. package/dist/bundle/{chunk-NDUYK676.js → chunk-4UQLL6RJ.js} +10 -9
  13. package/dist/bundle/{chunk-NFOUG7ES.js → chunk-566W4Q6L.js} +2 -2
  14. package/dist/bundle/{chunk-E7RDXCV2.js → chunk-5KNIVHP6.js} +5 -5
  15. package/dist/bundle/{chunk-VXZULAWV.js → chunk-64E6QXXQ.js} +14 -13
  16. package/dist/bundle/{chunk-FNDQFFLP.js → chunk-6CFSDU56.js} +11 -11
  17. package/dist/bundle/{chunk-ORRQDSDH.js → chunk-6ZA4NR5H.js} +3 -3
  18. package/dist/bundle/{chunk-PFTIYWOK.js → chunk-7SNS443B.js} +4 -4
  19. package/dist/bundle/{chunk-JPFF6MNK.js → chunk-AHBUTDS7.js} +8 -8
  20. package/dist/bundle/{chunk-TIEEVT2Z.js → chunk-AKPFH3KC.js} +1 -1
  21. package/dist/bundle/{chunk-FDCGTODC.js → chunk-AL7MY7MW.js} +1 -1
  22. package/dist/bundle/{chunk-RMQGFLT2.js → chunk-B3TPS7BW.js} +6 -6
  23. package/dist/bundle/{chunk-2DZMGPUC.js → chunk-B64EY2SC.js} +123 -34
  24. package/dist/bundle/{chunk-2OGANEKA.js → chunk-CD736BG3.js} +2 -2
  25. package/dist/bundle/{chunk-C4QKY33N.js → chunk-CGCQNYB3.js} +2 -2
  26. package/dist/bundle/{chunk-2KARCTUU.js → chunk-EE7R457T.js} +949 -581
  27. package/dist/bundle/{chunk-TQFCPUIM.js → chunk-EFEI724Z.js} +1 -1
  28. package/dist/bundle/{chunk-JBBZCTTF.js → chunk-EFX6FIDM.js} +1 -1
  29. package/dist/bundle/{chunk-DNJ43DT5.js → chunk-ELIYJXIY.js} +2 -2
  30. package/dist/bundle/{chunk-NPKFXGYG.js → chunk-EN7OZ5JH.js} +41 -23
  31. package/dist/bundle/{chunk-IXXVCKWL.js → chunk-G34Y5RAC.js} +26 -26
  32. package/dist/bundle/{chunk-TBD362SJ.js → chunk-GIQFBXQN.js} +11 -7
  33. package/dist/bundle/{chunk-KWKRTYRL.js → chunk-GKHUHRSL.js} +4 -4
  34. package/dist/bundle/{chunk-VGTDXEYD.js → chunk-HNUSPNUQ.js} +26 -13
  35. package/dist/bundle/{chunk-XTNEYXAQ.js → chunk-IJ2S53WJ.js} +5 -5
  36. package/dist/bundle/{chunk-FUKJQZED.js → chunk-ISK4K7UE.js} +1 -1
  37. package/dist/bundle/{chunk-YP5FDMTG.js → chunk-J2HGHSLX.js} +2 -2
  38. package/dist/bundle/{chunk-ULPS2OAL.js → chunk-JIGMCW4C.js} +4 -4
  39. package/dist/bundle/{chunk-ALMQEGYO.js → chunk-JLKNUFL2.js} +2 -2
  40. package/dist/bundle/{chunk-UDWMRZL6.js → chunk-JUKVJ7M2.js} +21 -21
  41. package/dist/bundle/{chunk-LAVWTS4P.js → chunk-KHNDZNQA.js} +5333 -5108
  42. package/dist/bundle/{chunk-GB5YM5HK.js → chunk-KM4Y55ZE.js} +5 -5
  43. package/dist/bundle/{chunk-CP6M5P4X.js → chunk-KYNTSA6K.js} +3 -3
  44. package/dist/bundle/{chunk-4XRLPQ3N.js → chunk-L4BBK7UX.js} +2 -2
  45. package/dist/bundle/chunk-LBFFI6FE.js +247 -0
  46. package/dist/bundle/{chunk-EOEDICIE.js → chunk-LSSIVBQI.js} +1 -1
  47. package/dist/bundle/{chunk-D6SRTPCV.js → chunk-NLLWLCUZ.js} +2 -2
  48. package/dist/bundle/{chunk-6OJMA4ZT.js → chunk-O5KDIVGE.js} +389 -255
  49. package/dist/bundle/{chunk-2LLNPNMB.js → chunk-OOR6PEHV.js} +1 -1
  50. package/dist/bundle/{chunk-UIPT6IAU.js → chunk-OYNSFQ7K.js} +1 -1
  51. package/dist/bundle/{chunk-67A2YFAT.js → chunk-OZJMZSFB.js} +4 -4
  52. package/dist/bundle/{chunk-GC4JNVYF.js → chunk-Q3TMNETS.js} +98 -37
  53. package/dist/bundle/{chunk-5DEEBWDI.js → chunk-QAT6UXZZ.js} +38 -37
  54. package/dist/bundle/{chunk-VY3TYRCK.js → chunk-R5GJZPRF.js} +114 -59
  55. package/dist/bundle/{chunk-4I7EBJJV.js → chunk-RAEKC6TV.js} +6 -6
  56. package/dist/bundle/{chunk-HNR2BJJU.js → chunk-RB674T6L.js} +75 -17
  57. package/dist/bundle/{chunk-NCCL4QWR.js → chunk-SRNXTXJN.js} +3 -3
  58. package/dist/bundle/{chunk-TD4RAOMZ.js → chunk-TKVSJV5P.js} +3 -3
  59. package/dist/bundle/{chunk-W6DMCGMK.js → chunk-TR5656OS.js} +47 -22
  60. package/dist/bundle/{chunk-VY2AUZMJ.js → chunk-TZHCS5MG.js} +2 -2
  61. package/dist/bundle/{chunk-KM7Q67Z3.js → chunk-U2RSVKR5.js} +1 -1
  62. package/dist/bundle/{chunk-IDK5QUBJ.js → chunk-UKMFPBAO.js} +4 -4
  63. package/dist/bundle/{chunk-GIRVMZD3.js → chunk-VTJF2L5E.js} +16 -16
  64. package/dist/bundle/{chunk-AQNY57J2.js → chunk-W5FOPSJZ.js} +7 -7
  65. package/dist/bundle/{chunk-FKHWVVMV.js → chunk-W6FYYQ2J.js} +3 -3
  66. package/dist/bundle/{chunk-VVMCGF5X.js → chunk-WAVJWGUC.js} +1811 -883
  67. package/dist/bundle/{chunk-FDM3JMQZ.js → chunk-WBYCUBYM.js} +89 -36
  68. package/dist/bundle/{chunk-TIVC4DB5.js → chunk-WJOKTIOJ.js} +2 -2
  69. package/dist/bundle/{chunk-7MVKSPEG.js → chunk-WJPVGXKA.js} +6 -6
  70. package/dist/bundle/{chunk-N4VNUOOD.js → chunk-XGNADVIA.js} +18 -18
  71. package/dist/bundle/{chunk-J6XLM4QW.js → chunk-XJVK7ETL.js} +28 -10
  72. package/dist/bundle/{chunk-3K4H2DTA.js → chunk-YZ6SYLDC.js} +12 -3
  73. package/dist/bundle/command-contract-XIACCAZL.js +35 -0
  74. package/dist/bundle/{decode-3LX3BLZM.js → decode-5MHMPYKE.js} +4 -4
  75. package/dist/bundle/drive.js +6 -6
  76. package/dist/bundle/{echarts-YNGCOYHW.js → echarts-CLB22SZS.js} +2 -2
  77. package/dist/bundle/{embed-FICTRZJL.js → embed-TF66ODAR.js} +5 -5
  78. package/dist/bundle/{embedder-DSMRCRSH.js → embedder-EDWOIAC2.js} +8 -8
  79. package/dist/bundle/{entry-4ZX3BNXK.js → entry-CWYCQ53A.js} +8 -6
  80. package/dist/bundle/{first-run-GRBQ3SQ5.js → first-run-YIH7EHJI.js} +9 -9
  81. package/dist/bundle/first-screen-THH3XD5Y.js +33 -0
  82. package/dist/bundle/{google-QV2B2KZA.js → google-A4F2WFO4.js} +9 -9
  83. package/dist/bundle/{google-api-EVO7F3WB.js → google-api-ZXGQOJUI.js} +51 -51
  84. package/dist/bundle/grants-3Z7DG3W3.js +98 -0
  85. package/dist/bundle/{identity-TKAX75OT.js → identity-4IO7WGG4.js} +4 -4
  86. package/dist/bundle/{instructions-GJHHFV64.js → instructions-BXZZNAMS.js} +1 -1
  87. package/dist/bundle/{login-R2YEAKEM.js → login-A4QHJ5DA.js} +57 -57
  88. package/dist/bundle/{mcp-EMNFFY4N.js → mcp-VVMPUDSL.js} +2 -2
  89. package/dist/bundle/{node-GFOH6FKP.js → node-R6ZNQ3NT.js} +2 -2
  90. package/dist/bundle/{node-sqlite-NZIBED3C.js → node-sqlite-AFQTE4XZ.js} +4 -4
  91. package/dist/bundle/{oauth-WUHT2JII.js → oauth-46XBJBML.js} +6 -6
  92. package/dist/bundle/{open-INBNHORD.js → open-WJCRBIP7.js} +3 -3
  93. package/dist/bundle/{openai-BMREUGJP.js → openai-3TIBDWZA.js} +13 -13
  94. package/dist/bundle/{process-XVDX4SPD.js → process-P36JP33R.js} +1 -1
  95. package/dist/bundle/{program-DUWFQOSL.js → program-AHZH65IT.js} +85 -77
  96. package/dist/bundle/{prompt-S7GHCPGR.js → prompt-FFGBIT4A.js} +4 -4
  97. package/dist/bundle/{reasons-T24V3AYS.js → reasons-VHCVYH54.js} +3 -3
  98. package/dist/bundle/{recognize-T3DABMW5.js → recognize-4EAKIMON.js} +3 -3
  99. package/dist/bundle/{remote-ASYGFT6E.js → remote-HX3JP4EH.js} +6 -6
  100. package/dist/bundle/{rerank-BQ5U252K.js → rerank-BW3A4PUU.js} +6 -6
  101. package/dist/bundle/{serve-JMLNKCUZ.js → serve-YYOOLIBS.js} +8 -8
  102. package/dist/bundle/{server-5E6RC7GZ.js → server-G6XTEEFI.js} +38 -38
  103. package/dist/bundle/server-YKYEUIJT.js +63 -0
  104. package/dist/bundle/{services-NFB3XSON.js → services-OAPILZOW.js} +45 -25
  105. package/dist/bundle/{sqlite-runtime-TAMYMQFR.js → sqlite-runtime-GTXDK4PE.js} +4 -4
  106. package/dist/bundle/{state-DS4G3ZXV.js → state-XG335LGZ.js} +5 -5
  107. package/dist/bundle/{store-MLMKYJLC.js → store-7KOXJNQP.js} +14 -12
  108. package/dist/bundle/{store-HAS2LRFE.js → store-N53SJOPS.js} +33 -15
  109. package/dist/bundle/store-maintenance-command-W3TI52X2.js +52 -0
  110. package/dist/bundle/tokens-P7TEHKDD.js +96 -0
  111. package/dist/commands/knowledge.d.ts.map +1 -1
  112. package/dist/commands/knowledge.js +10 -2
  113. package/dist/commands/knowledge.js.map +1 -1
  114. package/dist/config.d.ts +6 -0
  115. package/dist/config.d.ts.map +1 -1
  116. package/dist/config.js +4 -12
  117. package/dist/config.js.map +1 -1
  118. package/dist/profile-lock.js +2 -2
  119. package/dist/profile-lock.js.map +1 -1
  120. package/dist/reasons.js +1 -1
  121. package/dist/reasons.js.map +1 -1
  122. package/dist/version.d.ts +1 -1
  123. package/dist/version.js +1 -1
  124. package/package.json +3 -3
  125. package/dist/bundle/chunk-3NAVOBGH.js +0 -331
  126. package/dist/bundle/command-contract-VXLGE6NV.js +0 -35
  127. package/dist/bundle/first-screen-JK3MZVCU.js +0 -33
  128. package/dist/bundle/grants-B642KK5M.js +0 -98
  129. package/dist/bundle/server-QI4C3CQT.js +0 -63
  130. package/dist/bundle/store-maintenance-command-LI3JR22B.js +0 -52
  131. package/dist/bundle/tokens-UMSAYGOH.js +0 -96
  132. /package/dist/bundle/{chunk-NPGVOZVK.js → chunk-HPXYN7F3.js} +0 -0
@@ -1,331 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- operations
5
- } from "./chunk-2KARCTUU.js";
6
- import {
7
- DRIVE_APP
8
- } from "./chunk-D6SRTPCV.js";
9
- import {
10
- commandPathKey,
11
- commandPermissions
12
- } from "./chunk-2DZMGPUC.js";
13
- import {
14
- AI_ENTRIES,
15
- checkConfigText,
16
- issueMessage,
17
- settingsFor,
18
- usableProfileName
19
- } from "./chunk-BO7ZKZCH.js";
20
- import {
21
- LEVELS
22
- } from "./chunk-W6DMCGMK.js";
23
- import {
24
- MAX_TEXT_CHARS
25
- } from "./chunk-AR2HRFQO.js";
26
- import {
27
- resolvePaths,
28
- saveConfigFile
29
- } from "./chunk-N4VNUOOD.js";
30
- import {
31
- CliError,
32
- array,
33
- boolean,
34
- integer,
35
- literal,
36
- maxValue,
37
- minLength,
38
- minValue,
39
- number,
40
- object,
41
- optional,
42
- parse,
43
- picklist,
44
- pipe,
45
- record,
46
- regex,
47
- strictObject,
48
- string,
49
- union
50
- } from "./chunk-TBD362SJ.js";
51
- import {
52
- __name
53
- } from "./chunk-ZVVMGPBJ.js";
54
-
55
- // dist/policy-keys.js
56
- var permissionKeys = /* @__PURE__ */ __name((paths2) => {
57
- const keys = /* @__PURE__ */ new Set([
58
- "mcp.authority",
59
- "mcp",
60
- "sheets.create",
61
- "sheets.rename",
62
- "sheets.insert",
63
- "sheets.format",
64
- "sheets.update"
65
- ]);
66
- for (const path of paths2)
67
- keys.add(path.join("."));
68
- for (const operation of operations)
69
- for (const key of methodPolicyKeys(operation.id))
70
- keys.add(key);
71
- return keys;
72
- }, "permissionKeys");
73
- var permissionNames = /* @__PURE__ */ __name((keys) => {
74
- const names = /* @__PURE__ */ new Set();
75
- for (const key of keys) {
76
- const parts = key.split(".");
77
- for (let end = 1; end <= parts.length; end++)
78
- names.add(parts.slice(0, end).join("."));
79
- }
80
- return names;
81
- }, "permissionNames");
82
- var DEFAULT_LEVELS = {
83
- "mcp.authority": "deny",
84
- ...Object.fromEntries(operations.filter((op) => op.effect === "destructive").map((op) => [`api.${op.id}`, "ask"]))
85
- };
86
- var methodPolicyKeys = /* @__PURE__ */ __name((method, body) => {
87
- const parts = method.split(".");
88
- const verb = parts.at(-1);
89
- const alias = method.startsWith("drive.files.") ? `files.${verb}` : method.startsWith("docs.documents.") ? `documents.${verb === "batchUpdate" ? "update" : verb}` : method.startsWith("sheets.spreadsheets.") ? `sheets.${method === "sheets.spreadsheets.get" ? "info" : method === "sheets.spreadsheets.values.get" ? "show" : verb === "append" ? "add" : verb}` : method === "driveactivity.activity.query" ? "documents.history" : method.startsWith("drive.") ? `${parts[1]}.${verb}` : void 0;
90
- const keys = [`api.${method}`, ...alias ? [alias] : []];
91
- if (method === "drive.replies.create" && body)
92
- keys.push(body.action === "resolve" ? "comments.resolve" : body.action === "reopen" ? "comments.reopen" : "comments.reply");
93
- if (method === "drive.replies.create" && body?.content !== void 0)
94
- keys.push("comments.reply");
95
- if (method === "sheets.spreadsheets.batchUpdate" && Array.isArray(body?.requests)) {
96
- const object2 = /* @__PURE__ */ __name((value) => !!value && typeof value === "object" && !Array.isArray(value), "object");
97
- for (const request of body.requests) {
98
- if (!object2(request))
99
- continue;
100
- if (request.addSheet || request.duplicateSheet)
101
- keys.push("sheets.create");
102
- if (object2(request.updateSheetProperties)) {
103
- const update = request.updateSheetProperties;
104
- if (object2(update.properties) && update.properties.title !== void 0 || String(update.fields).split(",").some((field) => field.trim() === "title" || field.trim() === "*"))
105
- keys.push("sheets.rename");
106
- if (object2(update.properties) && update.properties.gridProperties)
107
- keys.push("sheets.insert");
108
- }
109
- if (request.insertDimension || request.appendDimension || request.insertRange)
110
- keys.push("sheets.insert");
111
- if (request.repeatCell || request.updateCells || request.appendCells || request.updateBorders || request.addConditionalFormatRule || request.updateConditionalFormatRule || request.deleteConditionalFormatRule || request.addBanding || request.updateBanding || request.deleteBanding)
112
- keys.push("sheets.format");
113
- if (request.updateCells || request.appendCells || request.findReplace || request.pasteData || request.copyPaste || request.cutPaste || request.autoFill)
114
- keys.push("sheets.update");
115
- if (request.pasteData || request.copyPaste || request.cutPaste || request.autoFill)
116
- keys.push("sheets.format");
117
- if (object2(request.repeatCell) && (String(request.repeatCell.fields).split(",").some((field) => field.trim() === "*" || field.includes("userEnteredValue")) || object2(request.repeatCell.cell) && request.repeatCell.cell.userEnteredValue !== void 0))
118
- keys.push("sheets.update");
119
- }
120
- }
121
- return [...new Set(keys)];
122
- }, "methodPolicyKeys");
123
-
124
- // dist/config.js
125
- import { readFileSync } from "node:fs";
126
- import { join } from "node:path";
127
-
128
- // dist/oauth-application.js
129
- var WIRECAT_APPLICATION = Object.freeze({
130
- clientId: "240274586781-vssrlm9c0l3n1ti12ce7tg95ro4bghal.apps.googleusercontent.com",
131
- // biome-ignore lint/security/noSecrets: public installed-app OAuth identity, non-confidential per Google native-app guidance
132
- clientSecret: "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"
133
- // gitleaks:allow -- public installed-app identity
134
- });
135
-
136
- // dist/config.js
137
- var Common = {
138
- ...AI_ENTRIES,
139
- permissions: optional(record(string(), picklist(LEVELS))),
140
- max_text_chars: optional(pipe(number(), integer(), minValue(1), maxValue(MAX_TEXT_CHARS)))
141
- };
142
- var RunSettings = {
143
- record: optional(boolean()),
144
- keep_runs_for_days: optional(pipe(number(), integer(), minValue(1))),
145
- keep_successful_runs_for_days: optional(pipe(number(), integer(), minValue(1))),
146
- runs_size_limit_mb: optional(pipe(number(), integer(), minValue(1))),
147
- record_input: optional(union([boolean(), literal("failed")]))
148
- };
149
- var SharedDefaults = {
150
- limit: optional(pipe(number(), integer(), minValue(1))),
151
- sends_per_hour: optional(pipe(number(), integer(), minValue(0))),
152
- update_check: optional(boolean()),
153
- skill_hint: optional(boolean())
154
- };
155
- var DEFAULTS_ONLY = /* @__PURE__ */ new Set([...Object.keys(RunSettings), "update_check", "skill_hint"]);
156
- var SETTING_NAMES = /* @__PURE__ */ new Set([...Object.keys(Common), "picture_search", ...DEFAULTS_ONLY]);
157
- var Mirror = strictObject({
158
- id: pipe(string(), regex(/^[a-z0-9-]{1,40}$/)),
159
- path: pipe(string(), minLength(1)),
160
- folder: pipe(string(), regex(/^[A-Za-z0-9_-]{1,200}$/))
161
- });
162
- var Profile = strictObject({
163
- principal: string(),
164
- roots: optional(array(pipe(string(), regex(/^[A-Za-z0-9_-]{1,200}$/))), []),
165
- mirrors: optional(array(Mirror)),
166
- storage: picklist(["keyring", "file"]),
167
- picture_search: optional(boolean()),
168
- ...Common
169
- });
170
- var ConfigSchema = strictObject({
171
- profiles: optional(record(string(), Profile), {}),
172
- defaults: optional(strictObject({ ...Common, ...RunSettings, ...SharedDefaults }))
173
- });
174
- var keyOf = /* @__PURE__ */ __name((path) => {
175
- if (path[0] !== "api" || path[1] === void 0)
176
- return commandPathKey(path);
177
- if (["call", "list", "show"].includes(path[1]))
178
- return null;
179
- const operation = operations.find((one) => one.command === path[1]);
180
- return operation ? `api.${operation.id}` : commandPathKey(path);
181
- }, "keyOf");
182
- var configuration = settingsFor(DRIVE_APP, {
183
- // drive's own schema decides what the file may hold, so `doctor` names a profile that lacks its principal.
184
- schema: ConfigSchema,
185
- profile: {
186
- principal: optional(string()),
187
- roots: optional(array(pipe(string(), regex(/^[A-Za-z0-9_-]{1,200}$/)))),
188
- mirrors: optional(array(Mirror)),
189
- storage: optional(picklist(["keyring", "file"])),
190
- max_text_chars: Common.max_text_chars
191
- },
192
- permissions: commandPermissions({ keyOf, extra: [...permissionKeys([])], defaults: DEFAULT_LEVELS })
193
- });
194
- var paths = /* @__PURE__ */ __name((env) => resolvePaths({ appName: "drive-cli", prefix: "DRIVE", env }), "paths");
195
- var configPath = /* @__PURE__ */ __name((env) => join(paths(env).config, "config.json"), "configPath");
196
- var TOOL = "drive";
197
- var isNode = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isNode");
198
- var withoutIncomplete = /* @__PURE__ */ __name((raw, issues) => {
199
- const incomplete = new Set(issues.flatMap((issue) => issue.kind === "missing_setting" && issue.profile ? [issue.profile] : []));
200
- if (!incomplete.size || !isNode(raw) || !isNode(raw.profiles))
201
- return void 0;
202
- return {
203
- ...raw,
204
- profiles: Object.fromEntries(Object.entries(raw.profiles).filter(([name]) => !incomplete.has(name)))
205
- };
206
- }, "withoutIncomplete");
207
- var examine = /* @__PURE__ */ __name((text, file, knownPermissions) => {
208
- const check = /* @__PURE__ */ __name((body) => checkConfigText(body, { file, tool: TOOL, schema: ConfigSchema, ...knownPermissions ? { knownPermissions } : {} }), "check");
209
- const first = check(text);
210
- if (first.issues.some((issue) => issue.kind === "invalid_json"))
211
- return { raw: {}, config: { profiles: {} }, issues: first.issues };
212
- const raw = JSON.parse(text);
213
- if (first.config)
214
- return { raw, config: first.config, issues: first.issues };
215
- const rest = withoutIncomplete(raw, first.issues);
216
- const second = rest && check(JSON.stringify(rest));
217
- return {
218
- raw,
219
- config: second?.config ?? { profiles: {} },
220
- // Saved permissions are checked only in what loads, and the first pass loaded nothing.
221
- issues: [...first.issues, ...(second?.issues ?? []).filter((issue) => issue.kind === "unknown_permission")]
222
- };
223
- }, "examine");
224
- var inspectConfig = /* @__PURE__ */ __name((env, knownPermissions) => {
225
- const path = configPath(env);
226
- let text;
227
- try {
228
- text = readFileSync(path, "utf8");
229
- } catch {
230
- return { path, found: false, raw: {}, config: { profiles: {} }, issues: [] };
231
- }
232
- return { path, found: true, ...examine(text, path, knownPermissions) };
233
- }, "inspectConfig");
234
- var configIssues = /* @__PURE__ */ __name((raw, file, knownPermissions) => examine(JSON.stringify(raw), file, knownPermissions).issues, "configIssues");
235
- var refusal = /* @__PURE__ */ __name((issues) => new CliError("configuration_error", issueMessage(issues)), "refusal");
236
- var readConfig = /* @__PURE__ */ __name((env, knownPermissions) => {
237
- const { config, issues } = inspectConfig(env, knownPermissions);
238
- if (issues.length)
239
- throw refusal(issues);
240
- return config;
241
- }, "readConfig");
242
- var writeConfig = /* @__PURE__ */ __name((env, config) => {
243
- const [issue] = configIssues(config, "drive settings");
244
- if (issue)
245
- throw new CliError("configuration_error", `drive settings: ${issue.profile === void 0 ? "" : `profile ${issue.profile}: `}${issue.what}`);
246
- saveConfigFile(configPath(env), parse(ConfigSchema, config));
247
- }, "writeConfig");
248
- var profileName = usableProfileName;
249
- var fileId = /* @__PURE__ */ __name((input) => {
250
- let id = input;
251
- if (input.startsWith("https://")) {
252
- const url = new URL(input);
253
- if (url.hostname !== "drive.google.com" && url.hostname !== "docs.google.com")
254
- throw new CliError("validation_error", "use a Google Drive/Docs URL or file ID");
255
- id = url.pathname.match(/\/(?:folders|d)\/([^/]+)/)?.[1] ?? "";
256
- }
257
- if (!/^[A-Za-z0-9_-]{1,200}$/.test(id))
258
- throw new CliError("validation_error", "invalid Google file ID");
259
- return id;
260
- }, "fileId");
261
- var unknownProfile = /* @__PURE__ */ __name((name, profiles) => new CliError("validation_error", profiles.length ? `no profile ${name} here \u2014 profiles here: ${profiles.join(", ")}; a new one signs in with drive ${name} session start` : `no profiles here yet; create one with drive ${name} session start`, { reason: "profile.unknown", profiles }), "unknownProfile");
262
- var activeProfile = /* @__PURE__ */ __name((env, name) => {
263
- const config = readConfig(env);
264
- const profile = config.profiles[profileName(name)];
265
- if (!profile)
266
- throw unknownProfile(name, Object.keys(config.profiles).sort());
267
- return profile;
268
- }, "activeProfile");
269
- var checkTextLimit = /* @__PURE__ */ __name((value) => {
270
- if (typeof value !== "number" || !Number.isInteger(value) || value < 1)
271
- throw new CliError("validation_error", "max_text_chars must be a positive whole number of characters");
272
- if (value > MAX_TEXT_CHARS)
273
- throw new CliError("validation_error", `max_text_chars can be at most ${MAX_TEXT_CHARS}: the document readers return at most that many characters`);
274
- return value;
275
- }, "checkTextLimit");
276
- var textLimit = /* @__PURE__ */ __name((env, name) => activeProfile(env, name).max_text_chars ?? readConfig(env).defaults?.max_text_chars ?? MAX_TEXT_CHARS, "textLimit");
277
- var pictureSearch = /* @__PURE__ */ __name((env, name) => activeProfile(env, name).picture_search ?? false, "pictureSearch");
278
- var application = /* @__PURE__ */ __name((env, file) => {
279
- if (!file) {
280
- if (!env.DRIVE_GOOGLE_CLIENT_ID) {
281
- if (env.DRIVE_GOOGLE_CLIENT_SECRET)
282
- throw new CliError("configuration_error", "DRIVE_GOOGLE_CLIENT_SECRET requires DRIVE_GOOGLE_CLIENT_ID");
283
- return { ...WIRECAT_APPLICATION };
284
- }
285
- return {
286
- clientId: env.DRIVE_GOOGLE_CLIENT_ID,
287
- ...env.DRIVE_GOOGLE_CLIENT_SECRET ? { clientSecret: env.DRIVE_GOOGLE_CLIENT_SECRET } : {}
288
- };
289
- }
290
- try {
291
- const data = parse(object({
292
- installed: object({ client_id: pipe(string(), minLength(1)), client_secret: optional(string()) })
293
- }), JSON.parse(readFileSync(file, "utf8")));
294
- return {
295
- clientId: data.installed.client_id,
296
- ...data.installed.client_secret ? { clientSecret: data.installed.client_secret } : {}
297
- };
298
- } catch {
299
- throw new CliError("configuration_error", "could not read a valid Desktop OAuth client JSON; file contents were not logged");
300
- }
301
- }, "application");
302
- var selectedFolders = /* @__PURE__ */ __name((env, profile, filter = {}) => activeProfile(env, profile).roots.flatMap((id) => filter.id === void 0 || id === filter.id ? [{ id }] : []), "selectedFolders");
303
- var configuredMirrors = /* @__PURE__ */ __name((env, profile, filter = {}) => (activeProfile(env, profile).mirrors ?? []).filter((row) => Object.entries(filter).every(([key, value]) => row[key] === value)), "configuredMirrors");
304
- var configuredSessions = /* @__PURE__ */ __name((env, filter, knownPermissions) => Object.entries(readConfig(env, knownPermissions).profiles).flatMap(([name, row]) => (filter.profile === void 0 || filter.profile === name) && (filter.storage === void 0 || filter.storage === row.storage) ? [{ profile: name, selected_folders: row.roots.length, storage: row.storage }] : []), "configuredSessions");
305
-
306
- export {
307
- permissionKeys,
308
- permissionNames,
309
- DEFAULT_LEVELS,
310
- methodPolicyKeys,
311
- DEFAULTS_ONLY,
312
- SETTING_NAMES,
313
- configuration,
314
- paths,
315
- inspectConfig,
316
- configIssues,
317
- refusal,
318
- readConfig,
319
- writeConfig,
320
- profileName,
321
- fileId,
322
- unknownProfile,
323
- activeProfile,
324
- checkTextLimit,
325
- textLimit,
326
- pictureSearch,
327
- application,
328
- selectedFolders,
329
- configuredMirrors,
330
- configuredSessions
331
- };
@@ -1,35 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- SCHEMA_DIALECT,
5
- commandContract,
6
- commandPathOf,
7
- findCommand,
8
- outputOf
9
- } from "./chunk-4I7EBJJV.js";
10
- import "./chunk-K2DMCTTF.js";
11
- import "./chunk-BO7ZKZCH.js";
12
- import "./chunk-NDUYK676.js";
13
- import "./chunk-KM7Q67Z3.js";
14
- import "./chunk-W6DMCGMK.js";
15
- import "./chunk-P4ABC6C4.js";
16
- import "./chunk-PFTIYWOK.js";
17
- import "./chunk-IDK5QUBJ.js";
18
- import "./chunk-ALMQEGYO.js";
19
- import "./chunk-67A2YFAT.js";
20
- import "./chunk-VY3TYRCK.js";
21
- import "./chunk-J6XLM4QW.js";
22
- import "./chunk-NPGVOZVK.js";
23
- import "./chunk-RMQGFLT2.js";
24
- import "./chunk-C4QKY33N.js";
25
- import "./chunk-N4VNUOOD.js";
26
- import "./chunk-TBD362SJ.js";
27
- import "./chunk-Y5E2WNWB.js";
28
- import "./chunk-ZVVMGPBJ.js";
29
- export {
30
- SCHEMA_DIALECT,
31
- commandContract,
32
- commandPathOf,
33
- findCommand,
34
- outputOf
35
- };
@@ -1,33 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- WIRECAT_TOOLS,
5
- firstScreen,
6
- installHelp
7
- } from "./chunk-AQNY57J2.js";
8
- import "./chunk-HTQTIKWP.js";
9
- import "./chunk-4I7EBJJV.js";
10
- import "./chunk-K2DMCTTF.js";
11
- import "./chunk-BO7ZKZCH.js";
12
- import "./chunk-NDUYK676.js";
13
- import "./chunk-KM7Q67Z3.js";
14
- import "./chunk-W6DMCGMK.js";
15
- import "./chunk-P4ABC6C4.js";
16
- import "./chunk-PFTIYWOK.js";
17
- import "./chunk-IDK5QUBJ.js";
18
- import "./chunk-ALMQEGYO.js";
19
- import "./chunk-67A2YFAT.js";
20
- import "./chunk-VY3TYRCK.js";
21
- import "./chunk-J6XLM4QW.js";
22
- import "./chunk-NPGVOZVK.js";
23
- import "./chunk-RMQGFLT2.js";
24
- import "./chunk-C4QKY33N.js";
25
- import "./chunk-N4VNUOOD.js";
26
- import "./chunk-TBD362SJ.js";
27
- import "./chunk-Y5E2WNWB.js";
28
- import "./chunk-ZVVMGPBJ.js";
29
- export {
30
- WIRECAT_TOOLS,
31
- firstScreen,
32
- installHelp
33
- };
@@ -1,98 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- GOOGLE_WRITE
5
- } from "./chunk-CP6M5P4X.js";
6
- import {
7
- apiMethod
8
- } from "./chunk-TD4RAOMZ.js";
9
- import {
10
- covers,
11
- grantedScopes
12
- } from "./chunk-6OJMA4ZT.js";
13
- import "./chunk-3NAVOBGH.js";
14
- import {
15
- READ_SCOPE,
16
- WRITE_SCOPE
17
- } from "./chunk-2KARCTUU.js";
18
- import "./chunk-UDWMRZL6.js";
19
- import "./chunk-TIEEVT2Z.js";
20
- import "./chunk-FDM3JMQZ.js";
21
- import "./chunk-2LLNPNMB.js";
22
- import "./chunk-HNR2BJJU.js";
23
- import "./chunk-SBZB7HMU.js";
24
- import "./chunk-D6SRTPCV.js";
25
- import "./chunk-2OGANEKA.js";
26
- import "./chunk-FDCGTODC.js";
27
- import "./chunk-KWKRTYRL.js";
28
- import "./chunk-NPMVPKBD.js";
29
- import "./chunk-2DZMGPUC.js";
30
- import "./chunk-NPKFXGYG.js";
31
- import "./chunk-NCCL4QWR.js";
32
- import "./chunk-LAVWTS4P.js";
33
- import "./chunk-VGTDXEYD.js";
34
- import "./chunk-IXXVCKWL.js";
35
- import "./chunk-GIRVMZD3.js";
36
- import "./chunk-AQNY57J2.js";
37
- import "./chunk-HTQTIKWP.js";
38
- import "./chunk-4I7EBJJV.js";
39
- import "./chunk-K2DMCTTF.js";
40
- import {
41
- describeProgram,
42
- flatten
43
- } from "./chunk-BO7ZKZCH.js";
44
- import "./chunk-NDUYK676.js";
45
- import "./chunk-KM7Q67Z3.js";
46
- import "./chunk-W6DMCGMK.js";
47
- import "./chunk-P4ABC6C4.js";
48
- import "./chunk-PFTIYWOK.js";
49
- import "./chunk-FNDQFFLP.js";
50
- import "./chunk-E7RDXCV2.js";
51
- import "./chunk-UIPT6IAU.js";
52
- import "./chunk-IDK5QUBJ.js";
53
- import "./chunk-VXZULAWV.js";
54
- import "./chunk-ALMQEGYO.js";
55
- import "./chunk-FKHWVVMV.js";
56
- import "./chunk-VY2AUZMJ.js";
57
- import "./chunk-4XRLPQ3N.js";
58
- import "./chunk-DNJ43DT5.js";
59
- import "./chunk-ORRQDSDH.js";
60
- import "./chunk-GB5YM5HK.js";
61
- import "./chunk-5DPV7X27.js";
62
- import "./chunk-67A2YFAT.js";
63
- import "./chunk-TIVC4DB5.js";
64
- import "./chunk-VVMCGF5X.js";
65
- import "./chunk-AR2HRFQO.js";
66
- import "./chunk-VY3TYRCK.js";
67
- import "./chunk-J6XLM4QW.js";
68
- import "./chunk-NPGVOZVK.js";
69
- import "./chunk-JPFF6MNK.js";
70
- import "./chunk-RMQGFLT2.js";
71
- import "./chunk-C4QKY33N.js";
72
- import "./chunk-7MVKSPEG.js";
73
- import "./chunk-N4VNUOOD.js";
74
- import "./chunk-TBD362SJ.js";
75
- import "./chunk-Y5E2WNWB.js";
76
- import "./chunk-EOEDICIE.js";
77
- import {
78
- __name
79
- } from "./chunk-ZVVMGPBJ.js";
80
-
81
- // dist/grants.js
82
- var requiredScope = /* @__PURE__ */ __name((command) => command.api_operation ? apiMethod(command.api_operation).scope : command.effects?.remote === GOOGLE_WRITE.remote && command.effects.local === GOOGLE_WRITE.local ? WRITE_SCOPE : void 0, "requiredScope");
83
- var grantAvailability = /* @__PURE__ */ __name((program, env, keyring) => {
84
- const commands = new Map(flatten(describeProgram(program)).map((info) => [info.path.join(" "), info]));
85
- return (path, profile) => {
86
- const command = commands.get(path.join(" "));
87
- const required = command && requiredScope(command);
88
- if (!required || required === READ_SCOPE)
89
- return void 0;
90
- const granted = grantedScopes(env, profile, keyring);
91
- if (!granted || covers(granted, required))
92
- return void 0;
93
- return { available: false, reason: `the OAuth grant needs ${required}`, permission: "oauth.scope" };
94
- };
95
- }, "grantAvailability");
96
- export {
97
- grantAvailability
98
- };
@@ -1,63 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- PER_RUN,
5
- createServer,
6
- envelope,
7
- serveOverHttpUntilStopped,
8
- serveOverStdio
9
- } from "./chunk-5DEEBWDI.js";
10
- import "./chunk-FDM3JMQZ.js";
11
- import "./chunk-JBBZCTTF.js";
12
- import "./chunk-GC4JNVYF.js";
13
- import "./chunk-HNR2BJJU.js";
14
- import "./chunk-3K4H2DTA.js";
15
- import "./chunk-TQFCPUIM.js";
16
- import "./chunk-5D4AEUVA.js";
17
- import "./chunk-KWKRTYRL.js";
18
- import "./chunk-2DZMGPUC.js";
19
- import "./chunk-NPKFXGYG.js";
20
- import "./chunk-NCCL4QWR.js";
21
- import "./chunk-LAVWTS4P.js";
22
- import "./chunk-VGTDXEYD.js";
23
- import "./chunk-IXXVCKWL.js";
24
- import "./chunk-GIRVMZD3.js";
25
- import "./chunk-4I7EBJJV.js";
26
- import "./chunk-K2DMCTTF.js";
27
- import "./chunk-BO7ZKZCH.js";
28
- import "./chunk-NDUYK676.js";
29
- import "./chunk-KM7Q67Z3.js";
30
- import "./chunk-W6DMCGMK.js";
31
- import "./chunk-P4ABC6C4.js";
32
- import "./chunk-PFTIYWOK.js";
33
- import "./chunk-E7RDXCV2.js";
34
- import "./chunk-UIPT6IAU.js";
35
- import "./chunk-IDK5QUBJ.js";
36
- import "./chunk-ALMQEGYO.js";
37
- import "./chunk-VY2AUZMJ.js";
38
- import "./chunk-DNJ43DT5.js";
39
- import "./chunk-ORRQDSDH.js";
40
- import "./chunk-GB5YM5HK.js";
41
- import "./chunk-5DPV7X27.js";
42
- import "./chunk-67A2YFAT.js";
43
- import "./chunk-VVMCGF5X.js";
44
- import "./chunk-AR2HRFQO.js";
45
- import "./chunk-VY3TYRCK.js";
46
- import "./chunk-J6XLM4QW.js";
47
- import "./chunk-NPGVOZVK.js";
48
- import "./chunk-JPFF6MNK.js";
49
- import "./chunk-RMQGFLT2.js";
50
- import "./chunk-C4QKY33N.js";
51
- import "./chunk-7MVKSPEG.js";
52
- import "./chunk-N4VNUOOD.js";
53
- import "./chunk-TBD362SJ.js";
54
- import "./chunk-Y5E2WNWB.js";
55
- import "./chunk-EOEDICIE.js";
56
- import "./chunk-ZVVMGPBJ.js";
57
- export {
58
- PER_RUN,
59
- createServer,
60
- envelope,
61
- serveOverHttpUntilStopped,
62
- serveOverStdio
63
- };
@@ -1,52 +0,0 @@
1
- import { createRequire as __bundleRequire } from "node:module";
2
- const require = __bundleRequire(import.meta.url);
3
- import {
4
- buildStems,
5
- storeMaintenanceCommands,
6
- storeSummary
7
- } from "./chunk-NPMVPKBD.js";
8
- import "./chunk-2DZMGPUC.js";
9
- import "./chunk-NPKFXGYG.js";
10
- import "./chunk-NCCL4QWR.js";
11
- import "./chunk-LAVWTS4P.js";
12
- import "./chunk-VGTDXEYD.js";
13
- import "./chunk-IXXVCKWL.js";
14
- import "./chunk-GIRVMZD3.js";
15
- import "./chunk-HTQTIKWP.js";
16
- import "./chunk-BO7ZKZCH.js";
17
- import "./chunk-NDUYK676.js";
18
- import "./chunk-KM7Q67Z3.js";
19
- import "./chunk-W6DMCGMK.js";
20
- import "./chunk-P4ABC6C4.js";
21
- import "./chunk-PFTIYWOK.js";
22
- import "./chunk-E7RDXCV2.js";
23
- import "./chunk-UIPT6IAU.js";
24
- import "./chunk-IDK5QUBJ.js";
25
- import "./chunk-ALMQEGYO.js";
26
- import "./chunk-FKHWVVMV.js";
27
- import "./chunk-VY2AUZMJ.js";
28
- import "./chunk-4XRLPQ3N.js";
29
- import "./chunk-DNJ43DT5.js";
30
- import "./chunk-ORRQDSDH.js";
31
- import "./chunk-GB5YM5HK.js";
32
- import "./chunk-5DPV7X27.js";
33
- import "./chunk-67A2YFAT.js";
34
- import "./chunk-VVMCGF5X.js";
35
- import "./chunk-AR2HRFQO.js";
36
- import "./chunk-VY3TYRCK.js";
37
- import "./chunk-J6XLM4QW.js";
38
- import "./chunk-NPGVOZVK.js";
39
- import "./chunk-JPFF6MNK.js";
40
- import "./chunk-RMQGFLT2.js";
41
- import "./chunk-C4QKY33N.js";
42
- import "./chunk-7MVKSPEG.js";
43
- import "./chunk-N4VNUOOD.js";
44
- import "./chunk-TBD362SJ.js";
45
- import "./chunk-Y5E2WNWB.js";
46
- import "./chunk-EOEDICIE.js";
47
- import "./chunk-ZVVMGPBJ.js";
48
- export {
49
- buildStems,
50
- storeMaintenanceCommands,
51
- storeSummary
52
- };