@wirecat/drive-cli 0.72.0 → 0.73.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 (205) hide show
  1. package/README.md +4 -0
  2. package/contracts/wirecat.json +82 -18
  3. package/dist/bin/drive.js +2 -2
  4. package/dist/bundle/agent-ZOHMLVWI.js +46 -0
  5. package/dist/bundle/{all-profiles-GXGDVNQJ.js → all-profiles-HGQGKCKQ.js} +14 -14
  6. package/dist/bundle/{anthropic-H5C4GQHC.js → anthropic-2L5DN3HF.js} +8 -8
  7. package/dist/bundle/{app-server-EQ3UK4C7.js → app-server-TRSOKYYF.js} +79 -79
  8. package/dist/bundle/{bun-DTJVSRY3.js → bun-AFA5HULK.js} +2 -2
  9. package/dist/bundle/{bun-sqlite-JIFY7MAE.js → bun-sqlite-5MW2BWV4.js} +9 -9
  10. package/dist/bundle/{chunk-FRCJHGZM.js → chunk-2G24DYSZ.js} +2 -2
  11. package/dist/bundle/{chunk-FUDUXIVG.js → chunk-2MCMUZCE.js} +1 -1
  12. package/dist/bundle/{chunk-COJTCEZP.js → chunk-2NAMKBBV.js} +31 -23
  13. package/dist/bundle/{chunk-CIFE4KPX.js → chunk-2WAGRBQT.js} +50 -47
  14. package/dist/bundle/{chunk-ZKWT6HXT.js → chunk-33RQ3YVC.js} +1 -1
  15. package/dist/bundle/{chunk-E3VWZC3K.js → chunk-36256UTA.js} +12 -12
  16. package/dist/bundle/{chunk-KP2XMCNT.js → chunk-4FTGSEBR.js} +6 -6
  17. package/dist/bundle/{chunk-MUFF2YTH.js → chunk-4KOMZRN6.js} +2 -2
  18. package/dist/bundle/{chunk-J4NUHSM7.js → chunk-4LLO4USI.js} +1 -1
  19. package/dist/bundle/{chunk-CWPYDT73.js → chunk-4VTAPSZE.js} +4 -4
  20. package/dist/bundle/{chunk-OLDQLEPA.js → chunk-4ZP3IK5I.js} +6 -6
  21. package/dist/bundle/{chunk-M2ZWYVWO.js → chunk-5CYWWYIG.js} +6 -1
  22. package/dist/bundle/{chunk-AA4LKC6W.js → chunk-5EZCDENA.js} +78 -35
  23. package/dist/bundle/{chunk-GWCDOYSC.js → chunk-5R2VPXVT.js} +1 -1
  24. package/dist/bundle/{chunk-KF3ZBQJV.js → chunk-5SQHQRNO.js} +4 -4
  25. package/dist/bundle/{chunk-77OBW43F.js → chunk-6AVHD6WB.js} +6 -6
  26. package/dist/bundle/{chunk-K652FYCO.js → chunk-6EC3LAVC.js} +2 -2
  27. package/dist/bundle/{chunk-ST35FIUG.js → chunk-6HZKX65K.js} +3 -3
  28. package/dist/bundle/{chunk-VAR3MJU6.js → chunk-6TGZCOYR.js} +3 -3
  29. package/dist/bundle/{chunk-D4JNCXS7.js → chunk-6V5556NF.js} +7 -7
  30. package/dist/bundle/{chunk-BM6V7456.js → chunk-6WZLP4CI.js} +5 -5
  31. package/dist/bundle/{chunk-ML2QIWX2.js → chunk-77SAHCDZ.js} +4 -4
  32. package/dist/bundle/{chunk-NNGA4QDR.js → chunk-AGATODLO.js} +12 -12
  33. package/dist/bundle/{chunk-OLCU7Q2B.js → chunk-B6YBN6VK.js} +1 -1
  34. package/dist/bundle/{chunk-TTPWKTVR.js → chunk-BAG4KIN5.js} +1 -1
  35. package/dist/bundle/{chunk-U7VEJ3CW.js → chunk-BAHWXDWN.js} +29 -190
  36. package/dist/bundle/{chunk-4HPXWYTE.js → chunk-BFESDJPU.js} +1 -1
  37. package/dist/bundle/{chunk-QSLOACDT.js → chunk-BOHC2GPY.js} +36 -36
  38. package/dist/bundle/{chunk-BO6EDBYJ.js → chunk-BY5D2LXE.js} +3 -3
  39. package/dist/bundle/{chunk-FBEZSA76.js → chunk-CMB6URN7.js} +5 -5
  40. package/dist/bundle/{chunk-4JS32SRX.js → chunk-CY2MNN3I.js} +5 -5
  41. package/dist/bundle/{chunk-PRYMT3OG.js → chunk-DAYHLKTM.js} +2 -2
  42. package/dist/bundle/{chunk-YWOLQEDV.js → chunk-DOUFW7RK.js} +3 -3
  43. package/dist/bundle/{chunk-CKB4XZZJ.js → chunk-DZG5SAO6.js} +14 -14
  44. package/dist/bundle/{chunk-FTG5QBSD.js → chunk-E3UFICXC.js} +35 -31
  45. package/dist/bundle/{chunk-QDUIVMEW.js → chunk-EBGI3Z6U.js} +1 -1
  46. package/dist/bundle/{chunk-ZJKXSMXK.js → chunk-EQGVNLUN.js} +42 -42
  47. package/dist/bundle/{chunk-WMG3H2VK.js → chunk-F5XMZDR5.js} +2 -2
  48. package/dist/bundle/{chunk-6ZW2ZJYC.js → chunk-FITKBN46.js} +2 -2
  49. package/dist/bundle/{chunk-ZFDSJ5YJ.js → chunk-FRQBKAPV.js} +6 -6
  50. package/dist/bundle/{chunk-DHMNCOQI.js → chunk-GW7L2G4I.js} +57 -57
  51. package/dist/bundle/{chunk-FIZOPJYY.js → chunk-HGXFOXSA.js} +1 -1
  52. package/dist/bundle/{chunk-N24YSLED.js → chunk-HYJEBBFK.js} +1892 -588
  53. package/dist/bundle/{chunk-SQHDSIFL.js → chunk-I2KGZ6XQ.js} +6 -6
  54. package/dist/bundle/{chunk-XZ7MO6EU.js → chunk-I3DZHZHM.js} +7 -7
  55. package/dist/bundle/{chunk-ZFUZEFU6.js → chunk-I3MLLVPE.js} +3 -3
  56. package/dist/bundle/{chunk-5BNMWSU2.js → chunk-IDJKYHVG.js} +2246 -2047
  57. package/dist/bundle/{chunk-SPNPJ3FZ.js → chunk-IEGU6GG7.js} +1 -1
  58. package/dist/bundle/{chunk-ZPUY3COZ.js → chunk-IKW3PRNG.js} +13 -13
  59. package/dist/bundle/{chunk-R57QUYBG.js → chunk-J3I4WOBI.js} +3 -3
  60. package/dist/bundle/{chunk-DCPWZIOV.js → chunk-JA37PJL4.js} +11 -11
  61. package/dist/bundle/{chunk-OAONP6KI.js → chunk-JJGKHGBX.js} +8 -8
  62. package/dist/bundle/{chunk-UIQ35CA5.js → chunk-JWNM6FCC.js} +1 -1
  63. package/dist/bundle/{chunk-R32DHS6J.js → chunk-JZYNXTMH.js} +51 -15
  64. package/dist/bundle/{chunk-QKBPCX7Y.js → chunk-K34B37AP.js} +1 -1
  65. package/dist/bundle/{chunk-HAGXTGJC.js → chunk-KERX3BQL.js} +4 -4
  66. package/dist/bundle/{chunk-QUZFDU4K.js → chunk-KV232TIK.js} +4 -4
  67. package/dist/bundle/{chunk-RSPBVKOC.js → chunk-KXETGAU4.js} +8 -8
  68. package/dist/bundle/{chunk-VPQSI5IU.js → chunk-L5ZZ6RLL.js} +2 -2
  69. package/dist/bundle/{chunk-OPIPG6AP.js → chunk-LGRZNEMA.js} +8 -8
  70. package/dist/bundle/{chunk-X5BGAZC5.js → chunk-M3VJTLFM.js} +6 -6
  71. package/dist/bundle/{chunk-5H747A76.js → chunk-MTH76YSQ.js} +500 -1428
  72. package/dist/bundle/{chunk-75DAHQOV.js → chunk-NA4HEM4Z.js} +3 -3
  73. package/dist/bundle/{chunk-5KWCO56H.js → chunk-OCZWU2H4.js} +2 -2
  74. package/dist/bundle/{chunk-GUMKKRE6.js → chunk-OHKAL25R.js} +63 -63
  75. package/dist/bundle/{chunk-O7CZZ36M.js → chunk-P2FOF6RR.js} +3 -3
  76. package/dist/bundle/{chunk-OHR6IZNH.js → chunk-PMYTDTT4.js} +8 -1
  77. package/dist/bundle/{chunk-XQZEMRCU.js → chunk-PQSCABAC.js} +10 -10
  78. package/dist/bundle/{chunk-GU6ICH53.js → chunk-PSFACXOC.js} +2 -2
  79. package/dist/bundle/{chunk-NBMGDRP4.js → chunk-PSWVHX53.js} +1 -1
  80. package/dist/bundle/{chunk-KFZCHJRT.js → chunk-Q2L3W7PS.js} +2 -2
  81. package/dist/bundle/{chunk-VQPT3Y7W.js → chunk-QMDVQ4AN.js} +12 -12
  82. package/dist/bundle/{chunk-GXGSC622.js → chunk-QZXFWDTX.js} +6 -6
  83. package/dist/bundle/{chunk-R64OSDOD.js → chunk-R2GLRHNK.js} +5 -5
  84. package/dist/bundle/{chunk-FNAYSZWK.js → chunk-R6K36FZ7.js} +23 -23
  85. package/dist/bundle/{chunk-7EFM6AW3.js → chunk-RHS3OBO5.js} +4 -4
  86. package/dist/bundle/{chunk-UJY26HW4.js → chunk-RNLLWYPV.js} +1 -1
  87. package/dist/bundle/{chunk-6CCO3JCM.js → chunk-RX6D64YA.js} +20 -20
  88. package/dist/bundle/{chunk-FBQJN74J.js → chunk-S7EQIYNF.js} +1 -1
  89. package/dist/bundle/{chunk-DWRUOLBF.js → chunk-SIC2CGYE.js} +4 -4
  90. package/dist/bundle/{chunk-55FH6IEL.js → chunk-SNY4WYPH.js} +5 -5
  91. package/dist/bundle/{chunk-A3S7QM5L.js → chunk-SQODI3DH.js} +2 -2
  92. package/dist/bundle/{chunk-EVG3AA5M.js → chunk-SRRNRQSQ.js} +2 -2
  93. package/dist/bundle/{chunk-IVGVVSPW.js → chunk-SYQKLEP3.js} +4 -4
  94. package/dist/bundle/{chunk-5U3NCE5R.js → chunk-TAQUEQ5B.js} +8 -8
  95. package/dist/bundle/{chunk-GIEZYBRC.js → chunk-TPIGO4JJ.js} +1 -1
  96. package/dist/bundle/{chunk-DOQMH4DC.js → chunk-U5SB2WDG.js} +12 -10
  97. package/dist/bundle/{chunk-KWDZ3KVH.js → chunk-UDP7EQNY.js} +4 -4
  98. package/dist/bundle/{chunk-4IUNYYYL.js → chunk-UZAOKKGK.js} +753 -494
  99. package/dist/bundle/{chunk-K6ZWNTXY.js → chunk-V5GIK53Z.js} +17 -17
  100. package/dist/bundle/{chunk-2Q325BBD.js → chunk-VENGEFU4.js} +8 -8
  101. package/dist/bundle/{chunk-N4GTCPML.js → chunk-VHPNTMJJ.js} +1 -1
  102. package/dist/bundle/{chunk-UWG3PRY7.js → chunk-VM3IERRK.js} +7 -7
  103. package/dist/bundle/{chunk-KLPFDFLI.js → chunk-VQ7K2EAW.js} +9 -9
  104. package/dist/bundle/{chunk-3FRQ6V4T.js → chunk-VQC4GYIQ.js} +3 -3
  105. package/dist/bundle/{chunk-XC6TRWLZ.js → chunk-VZTDELYM.js} +3 -3
  106. package/dist/bundle/{chunk-ASTKHB6B.js → chunk-W3OKRT6L.js} +179 -135
  107. package/dist/bundle/{chunk-KX4C32WD.js → chunk-WB46DJSK.js} +2 -2
  108. package/dist/bundle/{chunk-BPA3R4KN.js → chunk-WITO2RZO.js} +1 -1
  109. package/dist/bundle/{chunk-OESP4PHB.js → chunk-WJ7E6TPR.js} +17 -17
  110. package/dist/bundle/{chunk-YAIOEPKU.js → chunk-WUVNBZWC.js} +191 -160
  111. package/dist/bundle/{chunk-47L262VI.js → chunk-ZDYWRT3X.js} +7 -7
  112. package/dist/bundle/{chunk-IMAWQC5K.js → chunk-ZQMURHTL.js} +6 -6
  113. package/dist/bundle/{cli-2P5FW2RL.js → cli-A7MMBLGR.js} +107 -107
  114. package/dist/bundle/command-contract-WCGIIXYM.js +45 -0
  115. package/dist/bundle/{command-server-entry-KP2UDGLA.js → command-server-entry-557ZCX63.js} +35 -35
  116. package/dist/bundle/{decode-K2JZ5D6V.js → decode-3IPZIY2P.js} +8 -8
  117. package/dist/bundle/{dispatch-KOQZA74A.js → dispatch-UWS7A35Q.js} +9 -9
  118. package/dist/bundle/drive.js +11 -11
  119. package/dist/bundle/{echarts-URO3QGCG.js → echarts-JLCV6NKC.js} +2 -2
  120. package/dist/bundle/{embed-JLIPWTNN.js → embed-Q6H3QSMC.js} +9 -9
  121. package/dist/bundle/{embedder-LUTDO3HS.js → embedder-536EI65E.js} +12 -12
  122. package/dist/bundle/entry-3PKJTP5E.js +25 -0
  123. package/dist/bundle/{failure-GJMQLM7O.js → failure-W3VT5D3H.js} +4 -4
  124. package/dist/bundle/first-run-XTLP6VXF.js +31 -0
  125. package/dist/bundle/first-screen-3GQGULPE.js +45 -0
  126. package/dist/bundle/google-MEPVU4EP.js +46 -0
  127. package/dist/bundle/{google-api-RFXKRLL4.js → google-api-SY25TRXJ.js} +85 -85
  128. package/dist/bundle/grants-77W5MSWQ.js +133 -0
  129. package/dist/bundle/{identity-FXPB5EMT.js → identity-ZBMVHXUY.js} +6 -6
  130. package/dist/bundle/{instructions-IROIUVZI.js → instructions-XQOWVU6J.js} +1 -1
  131. package/dist/bundle/{login-WIY5VQU7.js → login-LXXYFMD3.js} +91 -91
  132. package/dist/bundle/{mcp-NJIOKW3E.js → mcp-VNOYBWW2.js} +2 -2
  133. package/dist/bundle/meeting-combined-NWWZCYN4.js +28 -0
  134. package/dist/bundle/meeting-model-K7UQ7TO5.js +29 -0
  135. package/dist/bundle/{meeting-semantic-62QNQMOM.js → meeting-semantic-Z7FAOSLQ.js} +10 -10
  136. package/dist/bundle/{node-IACCI2CW.js → node-MPZ3SVB4.js} +2 -2
  137. package/dist/bundle/{node-sqlite-WYIRC7C7.js → node-sqlite-VL5BMY34.js} +10 -10
  138. package/dist/bundle/notes-search-MF7QKFQD.js +74 -0
  139. package/dist/bundle/oauth-EYJXUTXZ.js +22 -0
  140. package/dist/bundle/{open-H32B6BCT.js → open-SERV3YXC.js} +8 -8
  141. package/dist/bundle/{openai-VHMPJJUG.js → openai-HUXETQVC.js} +20 -20
  142. package/dist/bundle/{process-RNHPF5OK.js → process-RFIII6TW.js} +1 -1
  143. package/dist/bundle/{program-GYMJ3DDH.js → program-VQ6IKDBJ.js} +353 -131
  144. package/dist/bundle/{prompt-TOG2CRCE.js → prompt-LCD5ZR7Q.js} +8 -8
  145. package/dist/bundle/{reasons-TLFQ45YX.js → reasons-GDQIXGWT.js} +5 -5
  146. package/dist/bundle/{recognize-GYGY45EY.js → recognize-GWKRFWHF.js} +7 -7
  147. package/dist/bundle/{remote-6XN2QLI5.js → remote-XM2CRZJY.js} +13 -13
  148. package/dist/bundle/{rerank-HJO3O4TW.js → rerank-HR5J35V6.js} +10 -10
  149. package/dist/bundle/{serve-XPCNLHCR.js → serve-PP3XR3GA.js} +12 -12
  150. package/dist/bundle/{server-WPT3NC5B.js → server-DD3DE536.js} +71 -71
  151. package/dist/bundle/server-NB4RGNYM.js +97 -0
  152. package/dist/bundle/{services-253KKKVU.js → services-4Y7R425J.js} +62 -58
  153. package/dist/bundle/{sqlite-runtime-EZASGJXW.js → sqlite-runtime-CVYBPVKO.js} +9 -9
  154. package/dist/bundle/{start-UHI35JFL.js → start-2KFZDMWM.js} +7 -7
  155. package/dist/bundle/{state-KJTSPFGK.js → state-AUXW4REW.js} +9 -9
  156. package/dist/bundle/{store-62J2H2A3.js → store-B7X6UN75.js} +28 -28
  157. package/dist/bundle/{store-G5B7T7M7.js → store-RADARFIH.js} +26 -26
  158. package/dist/bundle/store-maintenance-command-UTZWPNUF.js +85 -0
  159. package/dist/bundle/surface-4MUNDC3D.js +83 -0
  160. package/dist/bundle/tokens-AIKNGAOI.js +133 -0
  161. package/dist/commands/file-edit.d.ts +18 -0
  162. package/dist/commands/file-edit.d.ts.map +1 -0
  163. package/dist/commands/file-edit.js +39 -0
  164. package/dist/commands/file-edit.js.map +1 -0
  165. package/dist/commands/remote.d.ts +4 -0
  166. package/dist/commands/remote.d.ts.map +1 -1
  167. package/dist/commands/remote.js +59 -17
  168. package/dist/commands/remote.js.map +1 -1
  169. package/dist/config.d.ts +2 -0
  170. package/dist/config.d.ts.map +1 -1
  171. package/dist/config.js +17 -1
  172. package/dist/config.js.map +1 -1
  173. package/dist/drive-files.d.ts +26 -0
  174. package/dist/drive-files.d.ts.map +1 -0
  175. package/dist/drive-files.js +127 -0
  176. package/dist/drive-files.js.map +1 -0
  177. package/dist/program.d.ts.map +1 -1
  178. package/dist/program.js +52 -1
  179. package/dist/program.js.map +1 -1
  180. package/dist/reasons.d.ts.map +1 -1
  181. package/dist/reasons.js +5 -0
  182. package/dist/reasons.js.map +1 -1
  183. package/dist/upload.d.ts +3 -1
  184. package/dist/upload.d.ts.map +1 -1
  185. package/dist/upload.js +5 -4
  186. package/dist/upload.js.map +1 -1
  187. package/dist/version.d.ts +1 -1
  188. package/dist/version.js +1 -1
  189. package/package.json +3 -3
  190. package/skills/drive-cli/SKILL.md +4 -0
  191. package/dist/bundle/agent-23OB2NZP.js +0 -46
  192. package/dist/bundle/command-contract-BMQT2G5X.js +0 -45
  193. package/dist/bundle/entry-AVF6LMG7.js +0 -25
  194. package/dist/bundle/first-run-VYTIEUDA.js +0 -31
  195. package/dist/bundle/first-screen-QVZPF7KL.js +0 -45
  196. package/dist/bundle/google-VX7IPACN.js +0 -46
  197. package/dist/bundle/grants-4XWJFVD6.js +0 -133
  198. package/dist/bundle/meeting-combined-JUNV35GM.js +0 -28
  199. package/dist/bundle/meeting-model-XY4UNWWK.js +0 -29
  200. package/dist/bundle/notes-search-DEDUJKSN.js +0 -70
  201. package/dist/bundle/oauth-HXBXF4VI.js +0 -22
  202. package/dist/bundle/server-UBJZ66XE.js +0 -97
  203. package/dist/bundle/store-maintenance-command-C6T4YLVF.js +0 -85
  204. package/dist/bundle/surface-3OT64BHS.js +0 -83
  205. package/dist/bundle/tokens-EHYO6D2X.js +0 -133
@@ -10,7 +10,7 @@ import {
10
10
  describeDriveProgram,
11
11
  examples,
12
12
  markProfileFree
13
- } from "./chunk-3FRQ6V4T.js";
13
+ } from "./chunk-VQC4GYIQ.js";
14
14
  import {
15
15
  apiMethod,
16
16
  apiMethods,
@@ -19,11 +19,12 @@ import {
19
19
  schemas,
20
20
  validateApiParams,
21
21
  validateRequest
22
- } from "./chunk-R57QUYBG.js";
22
+ } from "./chunk-J3I4WOBI.js";
23
23
  import {
24
24
  CATALOG_FIELDS,
25
25
  DEFAULTS_ONLY,
26
26
  DEFAULT_LEVELS,
27
+ DELETE_KEY,
27
28
  FILES_QUERY,
28
29
  PROFILE_ONLY,
29
30
  SESSIONS_QUERY,
@@ -37,6 +38,7 @@ import {
37
38
  addDocumentMirrorCommands,
38
39
  addDocumentSearchCommand,
39
40
  addDocumentSyncCommands,
41
+ addFileEditCommands,
40
42
  addLocalDocumentCommands,
41
43
  application,
42
44
  bindQuery,
@@ -77,14 +79,14 @@ import {
77
79
  unknownProfile,
78
80
  withDefaults,
79
81
  writeConfig
80
- } from "./chunk-ASTKHB6B.js";
82
+ } from "./chunk-W3OKRT6L.js";
81
83
  import {
82
84
  operations
83
85
  } from "./chunk-G4NHRFS7.js";
84
86
  import {
85
87
  MAX_ENTRIES,
86
88
  supported
87
- } from "./chunk-A3S7QM5L.js";
89
+ } from "./chunk-SQODI3DH.js";
88
90
  import {
89
91
  DOC,
90
92
  DOCUMENT_LIST_FIELDS,
@@ -96,17 +98,19 @@ import {
96
98
  documentIngestion,
97
99
  documentKnowledge,
98
100
  fileMirrorState,
101
+ fileText,
102
+ fileVersions,
99
103
  markdownBlocks,
100
104
  mergeBlocks,
101
105
  metadataJson,
102
106
  normalizeInlines,
103
107
  spliceMarkdown,
104
108
  syncDocuments
105
- } from "./chunk-5BNMWSU2.js";
109
+ } from "./chunk-IDJKYHVG.js";
106
110
  import {
107
111
  googleError,
108
112
  offlineRefused
109
- } from "./chunk-FBQJN74J.js";
113
+ } from "./chunk-S7EQIYNF.js";
110
114
  import {
111
115
  DISCOVERY_DESCRIPTIONS,
112
116
  MEMO_SCENARIOS,
@@ -118,7 +122,6 @@ import {
118
122
  appDoctorCommand,
119
123
  appMcpCommand,
120
124
  checkJson,
121
- commandRuns,
122
125
  commandsText,
123
126
  createProgram,
124
127
  entityFields,
@@ -132,82 +135,83 @@ import {
132
135
  signInSteps,
133
136
  skillCommand,
134
137
  upgradeCommand
135
- } from "./chunk-5H747A76.js";
136
- import "./chunk-GWCDOYSC.js";
137
- import "./chunk-SPNPJ3FZ.js";
138
- import "./chunk-FTG5QBSD.js";
139
- import "./chunk-SQHDSIFL.js";
140
- import "./chunk-E3VWZC3K.js";
141
- import "./chunk-VQPT3Y7W.js";
142
- import "./chunk-IVGVVSPW.js";
143
- import "./chunk-BO6EDBYJ.js";
144
- import "./chunk-R32DHS6J.js";
138
+ } from "./chunk-MTH76YSQ.js";
139
+ import "./chunk-5R2VPXVT.js";
140
+ import "./chunk-IEGU6GG7.js";
141
+ import "./chunk-E3UFICXC.js";
142
+ import "./chunk-I2KGZ6XQ.js";
143
+ import "./chunk-36256UTA.js";
144
+ import "./chunk-QMDVQ4AN.js";
145
+ import "./chunk-SYQKLEP3.js";
146
+ import "./chunk-BY5D2LXE.js";
147
+ import "./chunk-JZYNXTMH.js";
145
148
  import {
146
149
  storeInfo
147
- } from "./chunk-GUMKKRE6.js";
148
- import "./chunk-OAONP6KI.js";
149
- import "./chunk-U7VEJ3CW.js";
150
- import "./chunk-2Q325BBD.js";
151
- import "./chunk-YWOLQEDV.js";
152
- import "./chunk-47L262VI.js";
153
- import "./chunk-KFZCHJRT.js";
150
+ } from "./chunk-OHKAL25R.js";
151
+ import "./chunk-JJGKHGBX.js";
152
+ import "./chunk-BAHWXDWN.js";
153
+ import "./chunk-VENGEFU4.js";
154
+ import "./chunk-DOUFW7RK.js";
155
+ import "./chunk-ZDYWRT3X.js";
156
+ import "./chunk-Q2L3W7PS.js";
154
157
  import {
155
158
  RecipientList,
156
159
  SendJournal,
157
160
  apiPlainJson,
158
161
  checkApiBody,
159
162
  checkApiParameter,
163
+ commandRuns,
160
164
  identifier,
161
165
  newOperationId,
162
166
  parseApiJson,
163
167
  readApiBody,
164
168
  sendGuard
165
- } from "./chunk-N24YSLED.js";
169
+ } from "./chunk-HYJEBBFK.js";
166
170
  import {
167
171
  columnName,
168
172
  readSpreadsheet
169
- } from "./chunk-QSLOACDT.js";
170
- import "./chunk-NNGA4QDR.js";
173
+ } from "./chunk-BOHC2GPY.js";
174
+ import "./chunk-AGATODLO.js";
171
175
  import {
172
176
  latestVersion,
173
177
  runUpdate,
174
178
  updateNotice
175
- } from "./chunk-KWDZ3KVH.js";
176
- import "./chunk-4HPXWYTE.js";
179
+ } from "./chunk-UDP7EQNY.js";
180
+ import "./chunk-BFESDJPU.js";
177
181
  import {
178
182
  queryTerms,
179
183
  termField,
180
184
  typedQuery,
181
185
  unfilteredQuery,
182
186
  withQuery
183
- } from "./chunk-CKB4XZZJ.js";
184
- import "./chunk-CIFE4KPX.js";
187
+ } from "./chunk-DZG5SAO6.js";
188
+ import "./chunk-2WAGRBQT.js";
185
189
  import {
186
190
  modelGateway
187
- } from "./chunk-ZPUY3COZ.js";
188
- import "./chunk-QDUIVMEW.js";
189
- import "./chunk-PRYMT3OG.js";
190
- import "./chunk-77OBW43F.js";
191
- import "./chunk-KLPFDFLI.js";
192
- import "./chunk-BM6V7456.js";
193
- import "./chunk-75DAHQOV.js";
194
- import "./chunk-UWG3PRY7.js";
191
+ } from "./chunk-IKW3PRNG.js";
192
+ import "./chunk-EBGI3Z6U.js";
193
+ import "./chunk-DAYHLKTM.js";
194
+ import "./chunk-6AVHD6WB.js";
195
+ import "./chunk-VQ7K2EAW.js";
196
+ import "./chunk-6WZLP4CI.js";
197
+ import "./chunk-NA4HEM4Z.js";
198
+ import "./chunk-VM3IERRK.js";
195
199
  import "./chunk-HTQTIKWP.js";
196
- import "./chunk-OHR6IZNH.js";
197
- import "./chunk-ML2QIWX2.js";
198
- import "./chunk-FBEZSA76.js";
199
- import "./chunk-OLDQLEPA.js";
200
+ import "./chunk-PMYTDTT4.js";
201
+ import "./chunk-77SAHCDZ.js";
202
+ import "./chunk-CMB6URN7.js";
203
+ import "./chunk-4ZP3IK5I.js";
200
204
  import {
201
205
  applyDocumentTransfer,
202
206
  previewDocumentTransfer
203
- } from "./chunk-OESP4PHB.js";
204
- import "./chunk-R64OSDOD.js";
207
+ } from "./chunk-WJ7E6TPR.js";
208
+ import "./chunk-R2GLRHNK.js";
205
209
  import "./chunk-NTZWY5R3.js";
206
- import "./chunk-D4JNCXS7.js";
207
- import "./chunk-J4NUHSM7.js";
208
- import "./chunk-NBMGDRP4.js";
209
- import "./chunk-FRCJHGZM.js";
210
- import "./chunk-QUZFDU4K.js";
210
+ import "./chunk-6V5556NF.js";
211
+ import "./chunk-4LLO4USI.js";
212
+ import "./chunk-PSWVHX53.js";
213
+ import "./chunk-2G24DYSZ.js";
214
+ import "./chunk-KV232TIK.js";
211
215
  import {
212
216
  CEILING_KEY,
213
217
  FETCH,
@@ -243,79 +247,79 @@ import {
243
247
  settingRows,
244
248
  sharedContracts,
245
249
  snakeKeys
246
- } from "./chunk-YAIOEPKU.js";
247
- import "./chunk-XZ7MO6EU.js";
250
+ } from "./chunk-WUVNBZWC.js";
251
+ import "./chunk-I3DZHZHM.js";
248
252
  import {
249
253
  setupPermissionCeiling
250
- } from "./chunk-7EFM6AW3.js";
251
- import "./chunk-FIZOPJYY.js";
254
+ } from "./chunk-RHS3OBO5.js";
255
+ import "./chunk-HGXFOXSA.js";
252
256
  import {
253
257
  guardedWrite
254
- } from "./chunk-HAGXTGJC.js";
258
+ } from "./chunk-KERX3BQL.js";
255
259
  import {
256
260
  modelTarget
257
- } from "./chunk-4JS32SRX.js";
261
+ } from "./chunk-CY2MNN3I.js";
258
262
  import {
259
263
  readOnlyLockOf,
260
264
  readOnlyRefusal
261
- } from "./chunk-5KWCO56H.js";
262
- import "./chunk-IMAWQC5K.js";
265
+ } from "./chunk-OCZWU2H4.js";
266
+ import "./chunk-ZQMURHTL.js";
263
267
  import {
264
268
  hostFetch
265
- } from "./chunk-ZFDSJ5YJ.js";
266
- import "./chunk-ZFUZEFU6.js";
267
- import "./chunk-KF3ZBQJV.js";
268
- import "./chunk-ST35FIUG.js";
269
- import "./chunk-KX4C32WD.js";
269
+ } from "./chunk-FRQBKAPV.js";
270
+ import "./chunk-I3MLLVPE.js";
271
+ import "./chunk-5SQHQRNO.js";
272
+ import "./chunk-6HZKX65K.js";
273
+ import "./chunk-WB46DJSK.js";
270
274
  import {
271
275
  openStore
272
- } from "./chunk-4IUNYYYL.js";
273
- import "./chunk-VAR3MJU6.js";
274
- import "./chunk-O7CZZ36M.js";
275
- import "./chunk-DCPWZIOV.js";
276
- import "./chunk-5U3NCE5R.js";
277
- import "./chunk-OPIPG6AP.js";
278
- import "./chunk-TTPWKTVR.js";
279
- import "./chunk-X5BGAZC5.js";
280
- import "./chunk-FNAYSZWK.js";
281
- import "./chunk-UJY26HW4.js";
276
+ } from "./chunk-UZAOKKGK.js";
277
+ import "./chunk-6TGZCOYR.js";
278
+ import "./chunk-P2FOF6RR.js";
279
+ import "./chunk-JA37PJL4.js";
280
+ import "./chunk-TAQUEQ5B.js";
281
+ import "./chunk-LGRZNEMA.js";
282
+ import "./chunk-BAG4KIN5.js";
283
+ import "./chunk-M3VJTLFM.js";
284
+ import "./chunk-R6K36FZ7.js";
285
+ import "./chunk-RNLLWYPV.js";
282
286
  import {
283
287
  inRun
284
- } from "./chunk-COJTCEZP.js";
285
- import "./chunk-6ZW2ZJYC.js";
286
- import "./chunk-XC6TRWLZ.js";
287
- import "./chunk-DHMNCOQI.js";
288
+ } from "./chunk-2NAMKBBV.js";
289
+ import "./chunk-FITKBN46.js";
290
+ import "./chunk-VZTDELYM.js";
291
+ import "./chunk-GW7L2G4I.js";
288
292
  import {
289
293
  timezoneOf,
290
294
  zonedMoment
291
- } from "./chunk-XQZEMRCU.js";
292
- import "./chunk-RSPBVKOC.js";
293
- import "./chunk-GIEZYBRC.js";
295
+ } from "./chunk-PQSCABAC.js";
296
+ import "./chunk-KXETGAU4.js";
297
+ import "./chunk-TPIGO4JJ.js";
294
298
  import "./chunk-D72URWJE.js";
295
299
  import {
296
300
  installerOf
297
- } from "./chunk-QKBPCX7Y.js";
301
+ } from "./chunk-K34B37AP.js";
298
302
  import {
299
303
  DRIVE_APP,
300
304
  PACKAGE,
301
305
  VERSION
302
- } from "./chunk-MUFF2YTH.js";
306
+ } from "./chunk-4KOMZRN6.js";
303
307
  import {
304
308
  REASONS
305
- } from "./chunk-M2ZWYVWO.js";
306
- import "./chunk-N4GTCPML.js";
307
- import "./chunk-UIQ35CA5.js";
309
+ } from "./chunk-5CYWWYIG.js";
310
+ import "./chunk-VHPNTMJJ.js";
311
+ import "./chunk-JWNM6FCC.js";
308
312
  import {
309
313
  storePath
310
- } from "./chunk-WMG3H2VK.js";
314
+ } from "./chunk-F5XMZDR5.js";
311
315
  import {
312
316
  processStreams,
313
317
  saveConfigFile,
314
318
  writeSecurely
315
- } from "./chunk-6CCO3JCM.js";
316
- import "./chunk-55FH6IEL.js";
317
- import "./chunk-FUDUXIVG.js";
318
- import "./chunk-EVG3AA5M.js";
319
+ } from "./chunk-RX6D64YA.js";
320
+ import "./chunk-SNY4WYPH.js";
321
+ import "./chunk-2MCMUZCE.js";
322
+ import "./chunk-SRRNRQSQ.js";
319
323
  import {
320
324
  array,
321
325
  boolean,
@@ -338,11 +342,11 @@ import {
338
342
  string,
339
343
  unknown,
340
344
  writes
341
- } from "./chunk-GXGSC622.js";
345
+ } from "./chunk-QZXFWDTX.js";
342
346
  import {
343
347
  CliError,
344
348
  isCliError
345
- } from "./chunk-OLCU7Q2B.js";
349
+ } from "./chunk-B6YBN6VK.js";
346
350
  import "./chunk-Y5E2WNWB.js";
347
351
  import {
348
352
  __commonJS,
@@ -861,8 +865,8 @@ var require_graceful_fs = __commonJS({
861
865
  function patch(fs2) {
862
866
  polyfills(fs2);
863
867
  fs2.gracefulify = patch;
864
- fs2.createReadStream = createReadStream2;
865
- fs2.createWriteStream = createWriteStream2;
868
+ fs2.createReadStream = createReadStream3;
869
+ fs2.createWriteStream = createWriteStream3;
866
870
  var fs$readFile = fs2.readFile;
867
871
  fs2.readFile = readFile;
868
872
  function readFile(path, options, cb) {
@@ -1085,14 +1089,14 @@ var require_graceful_fs = __commonJS({
1085
1089
  });
1086
1090
  }
1087
1091
  __name(WriteStream$open, "WriteStream$open");
1088
- function createReadStream2(path, options) {
1092
+ function createReadStream3(path, options) {
1089
1093
  return new fs2.ReadStream(path, options);
1090
1094
  }
1091
- __name(createReadStream2, "createReadStream");
1092
- function createWriteStream2(path, options) {
1095
+ __name(createReadStream3, "createReadStream");
1096
+ function createWriteStream3(path, options) {
1093
1097
  return new fs2.WriteStream(path, options);
1094
1098
  }
1095
- __name(createWriteStream2, "createWriteStream");
1099
+ __name(createWriteStream3, "createWriteStream");
1096
1100
  var fs$open = fs2.open;
1097
1101
  fs2.open = open2;
1098
1102
  function open2(path, flags, mode, cb) {
@@ -2187,7 +2191,7 @@ var profileLocked2 = /* @__PURE__ */ __name((env, name) => import_proper_lockfil
2187
2191
  var removal = {
2188
2192
  signOut: /* @__PURE__ */ __name(async (profile, { env, keyring, mayRevoke }) => {
2189
2193
  const storage = readConfig(env).profiles[profile]?.storage ?? "keyring";
2190
- const { sessionKeeper } = await import("./tokens-EHYO6D2X.js");
2194
+ const { sessionKeeper } = await import("./tokens-AIKNGAOI.js");
2191
2195
  const { revoked } = await sessionKeeper({
2192
2196
  env,
2193
2197
  name: profile,
@@ -2565,7 +2569,7 @@ var installModelCommands = /* @__PURE__ */ __name((program, { env, output, strea
2565
2569
  const download = /* @__PURE__ */ __name(async (kind, id, acceptTerms) => {
2566
2570
  if (policyFlags().offline)
2567
2571
  throw offlineRefused("downloading a model needs the network");
2568
- const { downloadImageModel, downloadTextModel } = await import("./services-253KKKVU.js");
2572
+ const { downloadImageModel, downloadTextModel } = await import("./services-4Y7R425J.js");
2569
2573
  const progress = /* @__PURE__ */ __name((line) => {
2570
2574
  if (!program.opts().quiet)
2571
2575
  streams.diagnostic(line);
@@ -3864,6 +3868,9 @@ var installMirrorCommands = /* @__PURE__ */ __name((program, context, { call })
3864
3868
  });
3865
3869
  }, "installMirrorCommands");
3866
3870
 
3871
+ // dist/commands/remote.js
3872
+ import { createHash as createHash4 } from "node:crypto";
3873
+
3867
3874
  // dist/age.js
3868
3875
  var SYNC = defineSteps([
3869
3876
  { id: "sync.run", command: "sync", args: [], why: "copy the changes Google has made into the local store" }
@@ -3947,6 +3954,113 @@ var saveDownload = /* @__PURE__ */ __name(async (path, overwrite, read, createDi
3947
3954
  return size2;
3948
3955
  }, "saveDownload");
3949
3956
 
3957
+ // dist/drive-files.js
3958
+ import { createHash as createHash3 } from "node:crypto";
3959
+ import { createReadStream, createWriteStream as createWriteStream2 } from "node:fs";
3960
+ import { Readable } from "node:stream";
3961
+ import { pipeline as pipeline2 } from "node:stream/promises";
3962
+ var FIELDS = "id,name,mimeType,trashed,size,sha256Checksum,md5Checksum,modifiedTime";
3963
+ var NATIVE = "application/vnd.google-apps.";
3964
+ var EXTRACTED = /\.(pdf|docx|xlsx)$/iu;
3965
+ var EXTRACTED_MIME = /* @__PURE__ */ new Set([
3966
+ "application/pdf",
3967
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
3968
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
3969
+ ]);
3970
+ var sha256Of = /* @__PURE__ */ __name((path) => new Promise((done2, fail) => {
3971
+ const hash = createHash3("sha256");
3972
+ createReadStream(path).on("data", (chunk) => hash.update(chunk)).on("error", fail).on("end", () => done2(hash.digest("hex")));
3973
+ }), "sha256Of");
3974
+ var unsupported = /* @__PURE__ */ __name((what) => () => {
3975
+ throw new Error(`drive's file edits do not ${what}`);
3976
+ }, "unsupported");
3977
+ var driveFileTarget = /* @__PURE__ */ __name((port) => {
3978
+ const meta = /* @__PURE__ */ __name(async (id) => {
3979
+ try {
3980
+ return await port.call("drive.files.get", { fileId: id, fields: FIELDS, supportsAllDrives: true });
3981
+ } catch (error) {
3982
+ if (isCliError(error) && error.code === "not_found")
3983
+ return void 0;
3984
+ throw error;
3985
+ }
3986
+ }, "meta");
3987
+ const editable = /* @__PURE__ */ __name((id, file) => {
3988
+ const mime = file.mimeType ?? "";
3989
+ if (mime === FOLDER)
3990
+ throw new CliError("validation_error", `${id} is a folder; give the id of a file`, { reason: "file.not-a-file" });
3991
+ if (mime.startsWith(NATIVE))
3992
+ throw new CliError("validation_error", `${id} is a Google ${mime.slice(NATIVE.length)} file, which has no stored content to edit. Change a Google Doc with ${port.prefix} documents update and a Google Sheet with ${port.prefix} sheets update`, { reason: "file.native-google" });
3993
+ if (port.plainText && (EXTRACTED_MIME.has(mime) || EXTRACTED.test(file.name ?? "")))
3994
+ throw new CliError("validation_error", `${id} is not a plain-text file; change a .docx with files documents update and a .xlsx with files sheets update`, { reason: "file.not-plain-text" });
3995
+ return file;
3996
+ }, "editable");
3997
+ const there = /* @__PURE__ */ __name(async (id) => {
3998
+ const file = await meta(id);
3999
+ return file && !file.trashed ? editable(id, file) : void 0;
4000
+ }, "there");
4001
+ const holds = /* @__PURE__ */ __name(async (id, file, sha256) => {
4002
+ if (file.sha256Checksum === sha256)
4003
+ return true;
4004
+ const source = await port.download(id);
4005
+ const hash = createHash3("sha256");
4006
+ if (source instanceof Uint8Array)
4007
+ hash.update(source);
4008
+ else
4009
+ for await (const chunk of source)
4010
+ hash.update(chunk);
4011
+ return hash.digest("hex") === sha256;
4012
+ }, "holds");
4013
+ const changed = /* @__PURE__ */ __name((id) => new CliError("conflict", `${id} is not the file that was read`, { reason: "mirror.remote-changed" }), "changed");
4014
+ return {
4015
+ identity: port.identity,
4016
+ exists: /* @__PURE__ */ __name(async (id) => await there(id) !== void 0, "exists"),
4017
+ download: /* @__PURE__ */ __name(async (id, into) => {
4018
+ const file = await meta(id);
4019
+ if (!file || file.trashed)
4020
+ throw new CliError("not_found", `no file ${id} in Google Drive`, { reason: "file.not-found" });
4021
+ editable(id, file);
4022
+ const source = await port.download(id);
4023
+ await pipeline2(source instanceof Uint8Array ? Readable.from([source]) : source, createWriteStream2(into, { flags: "wx", mode: 384 }));
4024
+ }, "download"),
4025
+ upload: /* @__PURE__ */ __name(async (id, from, expect) => {
4026
+ if ("absent" in expect)
4027
+ throw new CliError("not_found", `no file ${id} in Google Drive to write; Google Drive names a file by its id, so a new file goes there with ${port.prefix} files upload`, { reason: "file.not-found" });
4028
+ const file = await there(id);
4029
+ if (!file || !await holds(id, file, expect.sha256))
4030
+ throw changed(id);
4031
+ const done2 = await port.replace(id, from, file.mimeType);
4032
+ return {
4033
+ path: id,
4034
+ id: done2.id,
4035
+ size: done2.size,
4036
+ sha256: await sha256Of(from),
4037
+ md5: done2.md5,
4038
+ modifiedAt: (/* @__PURE__ */ new Date()).toISOString()
4039
+ };
4040
+ }, "upload"),
4041
+ list: unsupported("list folders"),
4042
+ trash: unsupported("trash files"),
4043
+ ensureFolder: unsupported("create folders")
4044
+ };
4045
+ }, "driveFileTarget");
4046
+ var bytesOf = /* @__PURE__ */ __name(async (source, max) => {
4047
+ if (source instanceof Uint8Array)
4048
+ return source;
4049
+ const chunks = [];
4050
+ let size2 = 0;
4051
+ for await (const chunk of source) {
4052
+ size2 += chunk.length;
4053
+ if (size2 > max) {
4054
+ source.destroy();
4055
+ throw new CliError("validation_error", `the file is larger than ${max} bytes; save it with --output`, {
4056
+ reason: "file.too-large"
4057
+ });
4058
+ }
4059
+ chunks.push(chunk);
4060
+ }
4061
+ return Buffer.concat(chunks);
4062
+ }, "bytesOf");
4063
+
3950
4064
  // dist/output.js
3951
4065
  var VERBATIM = /* @__PURE__ */ new Set([
3952
4066
  "frontMatter",
@@ -21212,6 +21326,33 @@ var localTimes = /* @__PURE__ */ __name((value, zone) => {
21212
21326
  return { value: result, changed };
21213
21327
  }, "localTimes");
21214
21328
 
21329
+ // dist/commands/file-edit.js
21330
+ var plainText = /* @__PURE__ */ __name((command) => command.name() === "update" && command.parent?.name() === "files", "plainText");
21331
+ var installFileEditCommands = /* @__PURE__ */ __name((files, edits, output, untrash) => {
21332
+ addFileEditCommands(files, {
21333
+ words: DRIVE_WORDS,
21334
+ output: /* @__PURE__ */ __name((body) => output(body), "output"),
21335
+ path: fileId,
21336
+ reread: /* @__PURE__ */ __name((input) => `${edits.prefix()} files download ${input} --json`, "reread"),
21337
+ stdin: /* @__PURE__ */ __name(() => edits.stdin(), "stdin"),
21338
+ write: /* @__PURE__ */ __name(async (extra, act, command) => {
21339
+ await edits.check(extra);
21340
+ return act(edits.port(plainText(command)));
21341
+ }, "write"),
21342
+ read: /* @__PURE__ */ __name((act) => act(edits.port(false)), "read"),
21343
+ restoreFromTrash: /* @__PURE__ */ __name((input) => untrash(fileId(input)), "restoreFromTrash"),
21344
+ deleteKey: DELETE_KEY
21345
+ });
21346
+ for (const command of files.commands.flatMap((one) => [one, ...one.commands]))
21347
+ if (hasSharedContract(command) && metaOf(command).examples?.length)
21348
+ overrideSharedContract(command, "Google Drive names a file by its id, not a path, and files update writes only over a file already there.", (one) => {
21349
+ const lines = (metaOf(one).examples ?? []).filter((line) => !line.endsWith('update /notes.md --text "# Notes"')).map((line) => line.replace(/\/(notes\.md|budget\.xlsx|report\.docx)/u, "FILE_ID"));
21350
+ annotate(one, { examples: lines });
21351
+ if (one.name() === "update" && one.parent === files)
21352
+ one.summary(one.summary().replace(", or create a text file", "")).description(one.description().replace(", or create a text file", ""));
21353
+ });
21354
+ }, "installFileEditCommands");
21355
+
21215
21356
  // dist/sheets-input.js
21216
21357
  var cellRectangle = /* @__PURE__ */ __name((range2) => {
21217
21358
  const match = /^([A-Za-z]{1,3})([1-9]\d*)(?::([A-Za-z]{1,3})([1-9]\d*))?$/.exec(range2);
@@ -21381,6 +21522,8 @@ var installSheetsCommands = /* @__PURE__ */ __name((program, { call, output }) =
21381
21522
  }, "installSheetsCommands");
21382
21523
 
21383
21524
  // dist/commands/remote.js
21525
+ var TEXT_LIMIT = 2e5;
21526
+ var MAX_TEXT_BYTES = 64 * 1024 * 1024;
21384
21527
  var API_METHOD_QUERY = {
21385
21528
  entity: "api_method",
21386
21529
  backend: "native",
@@ -21436,18 +21579,48 @@ var installRemoteCommands = /* @__PURE__ */ __name((program, helpers) => {
21436
21579
  installSheetsCommands(program, helpers);
21437
21580
  const files = annotate(program.command("files"), { effects: GOOGLE_READ }).description("read and change files in Google Drive; nothing is imported");
21438
21581
  for (const exporting of [false, true]) {
21439
- const command = examples(annotate(files.command(exporting ? "export" : "download"), { effects: FETCH }).argument("<file>", fileArgument).description(exporting ? "export a Google document to a local file" : "download a stored file to a local file"), [
21440
- exporting ? "drive personal files export DOC_ID --format pdf --output document.pdf" : "drive personal files download FILE_ID --output download.bin"
21441
- ]).requiredOption("--output <file>", "local file to write").option("--overwrite", "replace an existing output file");
21582
+ const command = examples(annotate(files.command(exporting ? "export" : "download"), { effects: FETCH }).argument("<file>", fileArgument).summary(exporting ? "export a Google document to a local file" : "download a stored file, or answer its text").description(exporting ? "export a Google document to a local file" : `download a stored file to a local file, or answer its text and sha256 without --output. A text longer than ${TEXT_LIMIT.toLocaleString("en")} characters is cut there with truncated: true and no sha256: never write a cut text back over the file, it would lose the rest`), exporting ? ["drive personal files export DOC_ID --format pdf --output document.pdf"] : [
21583
+ "drive personal files download FILE_ID --output download.bin",
21584
+ "drive personal files download FILE_ID --json"
21585
+ ]);
21442
21586
  if (exporting)
21443
- command.addOption(new Option("--format <format>", "format Google should export").choices(Object.keys(EXPORT_FORMATS)).makeOptionMandatory());
21587
+ command.requiredOption("--output <file>", "local file to write").addOption(new Option("--format <format>", "format Google should export").choices(Object.keys(EXPORT_FORMATS)).makeOptionMandatory());
21588
+ else
21589
+ command.option("--output <file>", "local file to write, instead of answering the text");
21590
+ command.option("--overwrite", "replace an existing output file");
21444
21591
  command.action(async (input, args) => {
21445
21592
  const id = fileId(input);
21593
+ if (args.output === void 0)
21594
+ return output(itemOf(await textOf(id)));
21446
21595
  const mime = args.format ? EXPORT_FORMATS[args.format] : void 0;
21447
21596
  const bytes = await saveDownload(args.output, args.overwrite === true, () => helpers.download(id, mime), helpers.mcp === true);
21448
21597
  output(itemOf({ id, bytes, ...args.format ? { format: args.format } : {} }));
21449
21598
  });
21450
21599
  }
21600
+ const textOf = /* @__PURE__ */ __name(async (id) => {
21601
+ const file = await call("drive.files.get", {
21602
+ fileId: id,
21603
+ fields: "id,name,mimeType,size",
21604
+ supportsAllDrives: true
21605
+ });
21606
+ const mime = file.mimeType ?? "application/octet-stream";
21607
+ if (mime.startsWith("application/vnd.google-apps."))
21608
+ throw new CliError("validation_error", `${id} is a Google ${mime.slice("application/vnd.google-apps.".length)} file with no stored content; read a Google Doc with documents get, or save any native file with files export`, { reason: "file.native-google" });
21609
+ const bytes = await bytesOf(await helpers.download(id), MAX_TEXT_BYTES);
21610
+ const name = file.name ?? id;
21611
+ const text = await fileText(bytes, { name, mime }, "drive");
21612
+ const truncated = text.length > TEXT_LIMIT;
21613
+ const whole = !truncated && Buffer.from(bytes).toString("utf8") === text;
21614
+ return {
21615
+ id,
21616
+ name,
21617
+ mime_type: mime,
21618
+ size: bytes.byteLength,
21619
+ sha256: whole ? createHash4("sha256").update(bytes).digest("hex") : null,
21620
+ text: text.slice(0, TEXT_LIMIT),
21621
+ truncated
21622
+ };
21623
+ }, "textOf");
21451
21624
  bindQuery(page(examples(annotate(files.command("list"), { effects: GOOGLE_READ }).description("list files in Google Drive, one page at a time"), ["drive personal files list --parent FOLDER_ID", `drive personal files list 'name:"Example plan"' --limit 20`])), FILES_QUERY, fileRow).option("--parent <id>", "only the files directly inside this folder id").option("--timezone <zone>", "zone for query dates without an offset").action(async (words, args) => {
21452
21625
  const { query, timezone } = driveFileQuery(words, args.timezone);
21453
21626
  const typed2 = typedQuery(words);
@@ -21472,9 +21645,8 @@ var installRemoteCommands = /* @__PURE__ */ __name((program, helpers) => {
21472
21645
  ...args.oldParent ? { removeParents: fileId(args.oldParent) } : {},
21473
21646
  supportsAllDrives: true
21474
21647
  }, {}))));
21475
- examples(annotate(files.command("update"), { effects: GOOGLE_WRITE }).description("change a file's Google Drive metadata").argument("<file>", fileArgument), [`drive personal files update FILE_ID --body '{"name":"Renamed"}'`]).requiredOption("--body <json>", "the metadata fields to change, as a JSON object", jsonObject).action(async (id, args) => output(itemOf(await call("drive.files.update", { fileId: fileId(id), supportsAllDrives: true }, args.body))));
21476
- for (const name of ["trash", "restore"])
21477
- examples(annotate(files.command(name), { effects: GOOGLE_WRITE }).description(name === "trash" ? "move a file to the Google Drive trash" : "take a file out of the trash").argument("<file>", fileArgument), [`drive personal files ${name} FILE_ID`]).action(async (id) => output(itemOf(await call("drive.files.update", { fileId: fileId(id), supportsAllDrives: true }, { trashed: name === "trash" }))));
21648
+ const trashed = /* @__PURE__ */ __name((id, trashed2) => call("drive.files.update", { fileId: id, supportsAllDrives: true }, { trashed: trashed2 }), "trashed");
21649
+ examples(annotate(files.command("trash"), { effects: GOOGLE_WRITE }).description("move a file to the Google Drive trash").argument("<file>", fileArgument), ["drive personal files trash FILE_ID"]).action(async (id) => output(itemOf(await trashed(fileId(id), true))));
21478
21650
  examples(annotate(files.command("mkdir"), { effects: GOOGLE_WRITE }).description("create an empty folder in Google Drive").argument("<name>", "folder name"), ["drive personal files mkdir Reports --parent FOLDER_ID"]).option("--parent <id>", "folder id to create it in; My Drive when omitted").action(async (name, args) => output(itemOf(await call("drive.files.create", { supportsAllDrives: true }, {
21479
21651
  name,
21480
21652
  mimeType: "application/vnd.google-apps.folder",
@@ -21484,6 +21656,7 @@ var installRemoteCommands = /* @__PURE__ */ __name((program, helpers) => {
21484
21656
  ...args.name ? { name: args.name } : {},
21485
21657
  ...args.parent ? { parent: fileId(args.parent) } : {}
21486
21658
  }))));
21659
+ installFileEditCommands(files, helpers.edits, output, (id) => trashed(id, false));
21487
21660
  const documents = program.commands.find((command) => command.name() === "documents");
21488
21661
  const documentArgument = "document id or Google Docs URL";
21489
21662
  examples(annotate(documents.command("get"), { effects: GOOGLE_READ }).argument("<document>", documentArgument).description("read a document live from Google Docs, as JSON with every tab"), ["drive personal documents get DOC_ID --json"]).action(async (id) => output(itemOf(await call("docs.documents.get", { documentId: fileId(id), includeTabsContent: true }))));
@@ -21601,7 +21774,7 @@ var installSessionCommands = /* @__PURE__ */ __name((program, context) => {
21601
21774
  const app = application(env, { file: args.clientFile, clientId: args.clientId, profile: selected() });
21602
21775
  if (!app.clientSecret)
21603
21776
  streams.diagnostic("your Google app has no secret here, and Google refuses a Desktop app without one: set DRIVE_GOOGLE_CLIENT_SECRET\n");
21604
- const { login } = await import("./login-WIY5VQU7.js");
21777
+ const { login } = await import("./login-LXXYFMD3.js");
21605
21778
  output(itemOf(await login({
21606
21779
  env,
21607
21780
  profile: selected(),
@@ -21632,7 +21805,7 @@ var installSessionCommands = /* @__PURE__ */ __name((program, context) => {
21632
21805
  const name = selected();
21633
21806
  const config = readConfig(env);
21634
21807
  const profile = activeProfile(env, name);
21635
- const { credentials } = await import("./tokens-EHYO6D2X.js");
21808
+ const { credentials } = await import("./tokens-AIKNGAOI.js");
21636
21809
  const store = credentials(env, profile.storage, options.keyring);
21637
21810
  store.remove(name);
21638
21811
  writeConfig(env, config);
@@ -21679,7 +21852,7 @@ var selection = /* @__PURE__ */ __name((env, name, source) => {
21679
21852
  return { profile, state, options: { source, destination, collection: `google-drive:${profile.principal}`, env } };
21680
21853
  }, "selection");
21681
21854
  var checkStoreImport = /* @__PURE__ */ __name(async (env, name, source, bindings) => {
21682
- const { ensureSqlite } = await import("./sqlite-runtime-EZASGJXW.js");
21855
+ const { ensureSqlite } = await import("./sqlite-runtime-CVYBPVKO.js");
21683
21856
  await ensureSqlite();
21684
21857
  const { state, options } = selection(env, name, source);
21685
21858
  const preview = await previewDocumentTransfer({ ...options, bindings });
@@ -21892,7 +22065,7 @@ var installTranscriptCommands = /* @__PURE__ */ __name((program, context) => {
21892
22065
  // dist/commands/upgrade.js
21893
22066
  import { join as join8 } from "node:path";
21894
22067
 
21895
- // node_modules/.pnpm/@wirecat+cli-core@0.722.0_@wirecat+cli-base@0.128.0_commander@15.0.0_esbuild@0.28.2_typ_a55806ccf2eb39d6be3eaf4c54d1a60a/node_modules/@wirecat/cli-core/dist/update/index.js
22068
+ // node_modules/.pnpm/@wirecat+cli-core@0.735.0_@wirecat+cli-base@0.132.0_commander@15.0.0_esbuild@0.28.2_typ_7fb22530c6bf05ba7be1bbee4c3f13e5/node_modules/@wirecat/cli-core/dist/update/index.js
21896
22069
  import { realpathSync } from "node:fs";
21897
22070
  import { fileURLToPath } from "node:url";
21898
22071
  var npmRegistry = /* @__PURE__ */ __name(() => hostFetch({ hosts: ["registry.npmjs.org"] }), "npmRegistry");
@@ -22321,7 +22494,7 @@ var openIndex = /* @__PURE__ */ __name(async (env, name, rescan = false) => {
22321
22494
  activeProfile(env, name);
22322
22495
  if (env.DRIVE_STORE)
22323
22496
  throw new CliError("configuration_error", "DRIVE_STORE has been retired; use MESSAGING_STORE to select the shared database", { reason: "store.override-retired" });
22324
- const { openAppStore } = await import("./cli-2P5FW2RL.js");
22497
+ const { openAppStore } = await import("./cli-A7MMBLGR.js");
22325
22498
  const store = await openAppStore(env, { app: { command: "drive", version: VERSION }, provider: DRIVE_PROVIDER });
22326
22499
  const index = indexOver(store, env);
22327
22500
  try {
@@ -22369,7 +22542,7 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
22369
22542
  linkMessages: /* @__PURE__ */ __name((documents, since) => store.notes.linkMessages({ documents, ...since ? { since } : {} }), "linkMessages"),
22370
22543
  knowledge: documentKnowledge2(store, async (principal) => (await folder(principal, false))?.id),
22371
22544
  openPictures: /* @__PURE__ */ __name(async () => {
22372
- const { openPictureEmbedderFor, savePicture } = await import("./services-253KKKVU.js");
22545
+ const { openPictureEmbedderFor, savePicture } = await import("./services-4Y7R425J.js");
22373
22546
  const embedder = pictureEmbedder ?? await openPictureEmbedderFor({ env, command: "drive" });
22374
22547
  return {
22375
22548
  save: /* @__PURE__ */ __name((reference, bytes) => savePicture(store, { ref: reference }, bytes, { embedder }), "save"),
@@ -22388,7 +22561,7 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
22388
22561
  has_more: false,
22389
22562
  meaning_skipped: "this Google account has no imported sources"
22390
22563
  };
22391
- const { searchNotes } = await import("./services-253KKKVU.js");
22564
+ const { searchNotes } = await import("./services-4Y7R425J.js");
22392
22565
  const result = await searchNotes(store, query, {
22393
22566
  ...options,
22394
22567
  folderIds: selected ? [selected.id] : [],
@@ -22421,7 +22594,7 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
22421
22594
  };
22422
22595
  }, "search"),
22423
22596
  embed: /* @__PURE__ */ __name(async (max) => {
22424
- const { embedNotes } = await import("./services-253KKKVU.js");
22597
+ const { embedNotes } = await import("./services-4Y7R425J.js");
22425
22598
  return embedNotes(store, { maxChunks: max, env, command: "drive" });
22426
22599
  }, "embed"),
22427
22600
  close: /* @__PURE__ */ __name(() => store.close(), "close")
@@ -22429,17 +22602,17 @@ var indexOver = /* @__PURE__ */ __name((store, env, pictureEmbedder) => {
22429
22602
  }, "indexOver");
22430
22603
 
22431
22604
  // dist/upload.js
22432
- import { createHash as createHash3 } from "node:crypto";
22433
- import { createReadStream, mkdirSync as mkdirSync3, readFileSync as readFileSync5, rmSync as rmSync2, statSync as statSync2, writeFileSync as writeFileSync2 } from "node:fs";
22605
+ import { createHash as createHash5 } from "node:crypto";
22606
+ import { createReadStream as createReadStream2, mkdirSync as mkdirSync3, readFileSync as readFileSync5, rmSync as rmSync2, statSync as statSync2, writeFileSync as writeFileSync2 } from "node:fs";
22434
22607
  import { open } from "node:fs/promises";
22435
22608
  import { basename, join as join10, resolve as resolve5 } from "node:path";
22436
22609
  var START = "https://www.googleapis.com/upload/drive/v3/files";
22437
- var FIELDS = "id,name,size,md5Checksum,mimeType,parents";
22610
+ var FIELDS2 = "id,name,size,md5Checksum,mimeType,parents";
22438
22611
  var QUANTUM = 256 * 1024;
22439
22612
  var CHUNK_BYTES = 32 * QUANTUM;
22440
22613
  var md5Of = /* @__PURE__ */ __name((path) => new Promise((done2, fail) => {
22441
- const hash = createHash3("md5");
22442
- createReadStream(path).on("data", (chunk) => hash.update(chunk)).on("error", fail).on("end", () => done2(hash.digest("hex")));
22614
+ const hash = createHash5("md5");
22615
+ createReadStream2(path).on("data", (chunk) => hash.update(chunk)).on("error", fail).on("end", () => done2(hash.digest("hex")));
22443
22616
  }), "md5Of");
22444
22617
  var nextByte = /* @__PURE__ */ __name((response) => {
22445
22618
  const range2 = /bytes=0-(\d+)/.exec(response.header("range") ?? "");
@@ -22458,11 +22631,12 @@ var uploadFile = /* @__PURE__ */ __name(async (input) => {
22458
22631
  throw new CliError("validation_error", "upload takes one file, not a folder", { reason: "file.not-a-file" });
22459
22632
  const size2 = stat.size;
22460
22633
  const name = input.name ?? basename(path);
22634
+ const replacing = input.fileId;
22461
22635
  const chunk = input.chunkBytes ?? CHUNK_BYTES;
22462
22636
  if (chunk % QUANTUM !== 0)
22463
22637
  throw new CliError("validation_error", "a chunk must be a multiple of 256 KiB");
22464
22638
  const sleep = input.sleep ?? ((ms) => new Promise((wake) => setTimeout(wake, ms)));
22465
- const key = createHash3("sha256").update(JSON.stringify([path, size2, stat.mtimeMs, name, input.parent ?? ""])).digest("hex").slice(0, 24);
22639
+ const key = createHash5("sha256").update(JSON.stringify([path, size2, stat.mtimeMs, name, input.parent ?? "", ...replacing ? [replacing] : []])).digest("hex").slice(0, 24);
22466
22640
  const checkpointPath = join10(input.stateDir, "uploads", `${key}.json`);
22467
22641
  const readCheckpoint = /* @__PURE__ */ __name(() => {
22468
22642
  try {
@@ -22484,10 +22658,10 @@ var uploadFile = /* @__PURE__ */ __name(async (input) => {
22484
22658
  }, "saveCheckpoint");
22485
22659
  const clearCheckpoint = /* @__PURE__ */ __name(() => rmSync2(checkpointPath, { force: true }), "clearCheckpoint");
22486
22660
  const start = /* @__PURE__ */ __name(async () => {
22487
- const metadata = JSON.stringify({ name, ...input.parent ? { parents: [input.parent] } : {} });
22661
+ const metadata = JSON.stringify(replacing ? {} : { name, ...input.parent ? { parents: [input.parent] } : {} });
22488
22662
  const response = await input.request({
22489
- url: `${START}?uploadType=resumable&supportsAllDrives=true&fields=${FIELDS}`,
22490
- method: "POST",
22663
+ url: `${START}${replacing ? `/${replacing}` : ""}?uploadType=resumable&supportsAllDrives=true&fields=${FIELDS2}`,
22664
+ method: replacing ? "PATCH" : "POST",
22491
22665
  headers: {
22492
22666
  "Content-Type": "application/json; charset=UTF-8",
22493
22667
  "X-Upload-Content-Type": input.mime ?? "application/octet-stream",
@@ -22707,7 +22881,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
22707
22881
  }, "output");
22708
22882
  const signal = /* @__PURE__ */ __name(() => environment().signal, "signal");
22709
22883
  const signedIn = /* @__PURE__ */ __name(async (name, scope2) => {
22710
- const { authorizedClient, checkAuthorization } = await import("./tokens-EHYO6D2X.js");
22884
+ const { authorizedClient, checkAuthorization } = await import("./tokens-AIKNGAOI.js");
22711
22885
  const client = authorizedClient(env, name, environment().keyring, signal());
22712
22886
  await checkAuthorization(client, scope2);
22713
22887
  return client;
@@ -22717,7 +22891,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
22717
22891
  const fake = environment().source;
22718
22892
  if (fake)
22719
22893
  return fake(name);
22720
- const [{ googleSource }, client] = await Promise.all([import("./google-VX7IPACN.js"), signedIn(name)]);
22894
+ const [{ googleSource }, client] = await Promise.all([import("./google-MEPVU4EP.js"), signedIn(name)]);
22721
22895
  return googleSource(client);
22722
22896
  }, "source");
22723
22897
  const withIndex = /* @__PURE__ */ __name(async (fn, profile) => {
@@ -22867,7 +23041,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
22867
23041
  if (fake)
22868
23042
  return await fake.call(method, params, body);
22869
23043
  const [{ googleApi }, client] = await Promise.all([
22870
- import("./google-api-RFXKRLL4.js"),
23044
+ import("./google-api-SY25TRXJ.js"),
22871
23045
  signedIn(selected(), descriptor.scope)
22872
23046
  ]);
22873
23047
  return await googleApi(client).call(method, params, body);
@@ -22893,11 +23067,59 @@ var installDrive = /* @__PURE__ */ __name((program) => {
22893
23067
  if (fake)
22894
23068
  return fake(id, mime);
22895
23069
  const [{ googleDownload }, client] = await Promise.all([
22896
- import("./google-api-RFXKRLL4.js"),
23070
+ import("./google-api-SY25TRXJ.js"),
22897
23071
  signedIn(selected(), apiMethod(method).scope)
22898
23072
  ]);
22899
23073
  return googleDownload(client)(id, mime);
22900
23074
  }, "download"),
23075
+ replace: /* @__PURE__ */ __name(async (id, from, mime) => {
23076
+ const method = "drive.files.update";
23077
+ const flags = policyFlags();
23078
+ for (const key of methodPolicyKeys(method))
23079
+ await checkPolicy(env, selected(), key, true, flags, askOnce);
23080
+ const act = /* @__PURE__ */ __name(async () => {
23081
+ let request = environment().uploadRequest;
23082
+ if (!request) {
23083
+ const [{ googleUploadRequest }, client] = await Promise.all([
23084
+ import("./google-api-SY25TRXJ.js"),
23085
+ signedIn(selected(), apiMethod(method).scope)
23086
+ ]);
23087
+ request = googleUploadRequest(client);
23088
+ }
23089
+ return uploadFile({
23090
+ path: from,
23091
+ fileId: id,
23092
+ ...mime ? { mime } : {},
23093
+ stateDir: profileDir(env, selected()),
23094
+ request
23095
+ });
23096
+ }, "act");
23097
+ return guardedGoogleWrite(env, selected(), `api.${method}`, act, flags, askOnce, newOperationId());
23098
+ }, "replace"),
23099
+ edits: {
23100
+ port: /* @__PURE__ */ __name((plainText2) => {
23101
+ const stop = signal();
23102
+ return {
23103
+ target: driveFileTarget({
23104
+ call: /* @__PURE__ */ __name((method, params, body) => remote.call(method, params, body), "call"),
23105
+ download: /* @__PURE__ */ __name((id) => remote.download(id), "download"),
23106
+ replace: /* @__PURE__ */ __name((id, from, mime) => remote.replace(id, from, mime), "replace"),
23107
+ identity: /* @__PURE__ */ __name(async () => activeProfile(env, selected()).principal ?? selected(), "identity"),
23108
+ prefix: `drive ${selected()}`,
23109
+ plainText: plainText2
23110
+ }),
23111
+ versions: fileVersions(join11(profileDir(env, selected()), "files.versions")),
23112
+ ...stop ? { signal: stop } : {}
23113
+ };
23114
+ }, "port"),
23115
+ check: /* @__PURE__ */ __name(async (keys) => {
23116
+ const flags = policyFlags();
23117
+ for (const key of keys)
23118
+ await checkPolicy(env, selected(), key, true, flags, askOnce);
23119
+ }, "check"),
23120
+ prefix: /* @__PURE__ */ __name(() => `drive ${selected()}`, "prefix"),
23121
+ stdin: /* @__PURE__ */ __name(() => environment().stdin ?? process.stdin, "stdin")
23122
+ },
22901
23123
  upload: /* @__PURE__ */ __name(async (path, args) => {
22902
23124
  const method = "drive.files.create";
22903
23125
  const flags = policyFlags();
@@ -22911,7 +23133,7 @@ var installDrive = /* @__PURE__ */ __name((program) => {
22911
23133
  let request = environment().uploadRequest;
22912
23134
  if (!request) {
22913
23135
  const [{ googleUploadRequest }, client] = await Promise.all([
22914
- import("./google-api-RFXKRLL4.js"),
23136
+ import("./google-api-SY25TRXJ.js"),
22915
23137
  signedIn(selected(), apiMethod(method).scope)
22916
23138
  ]);
22917
23139
  request = googleUploadRequest(client);
@@ -23022,7 +23244,7 @@ Availability: unavailable \u2014 ${availability.reason}
23022
23244
  refuseUnderReadOnly(env, "change a setting");
23023
23245
  return previewWrite();
23024
23246
  }
23025
- if (agent() && EXPORTS.has(words)) {
23247
+ if (agent() && EXPORTS.has(words) && !(words === "files download" && action.opts().output === void 0)) {
23026
23248
  const name = action.opts().output;
23027
23249
  if (typeof name !== "string" || !/^[A-Za-z0-9][A-Za-z0-9._-]{0,199}$/.test(name))
23028
23250
  throw new CliError("validation_error", "MCP exports take a filename inside the profile export folder");
@@ -23124,7 +23346,7 @@ var mcpCommand = /* @__PURE__ */ __name(() => {
23124
23346
  const environment = environmentOf(action);
23125
23347
  if (environment.api)
23126
23348
  return;
23127
- const { grantAvailability } = await import("./grants-4XWJFVD6.js");
23349
+ const { grantAvailability } = await import("./grants-77W5MSWQ.js");
23128
23350
  availability = grantAvailability(rootOf(root), environment.env ?? process.env, environment.keyring);
23129
23351
  });
23130
23352
  }, "mcpCommand");