@wirecat/drive-cli 0.0.0-stage → 0.1.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 (127) hide show
  1. package/LICENSE +204 -0
  2. package/README.md +194 -2
  3. package/dist/api-contract.d.ts +7 -0
  4. package/dist/api-contract.d.ts.map +1 -0
  5. package/dist/api-contract.js +42 -0
  6. package/dist/api-contract.js.map +1 -0
  7. package/dist/bin/drive.d.ts +3 -0
  8. package/dist/bin/drive.d.ts.map +1 -0
  9. package/dist/bin/drive.js +41 -0
  10. package/dist/bin/drive.js.map +1 -0
  11. package/dist/config.d.ts +74 -0
  12. package/dist/config.d.ts.map +1 -0
  13. package/dist/config.js +83 -0
  14. package/dist/config.js.map +1 -0
  15. package/dist/documents.d.ts +4 -0
  16. package/dist/documents.d.ts.map +1 -0
  17. package/dist/documents.js +36 -0
  18. package/dist/documents.js.map +1 -0
  19. package/dist/errors.d.ts +3 -0
  20. package/dist/errors.d.ts.map +1 -0
  21. package/dist/errors.js +39 -0
  22. package/dist/errors.js.map +1 -0
  23. package/dist/extraction.d.ts +14 -0
  24. package/dist/extraction.d.ts.map +1 -0
  25. package/dist/extraction.js +49 -0
  26. package/dist/extraction.js.map +1 -0
  27. package/dist/generated/definitions.d.ts +3 -0
  28. package/dist/generated/definitions.d.ts.map +1 -0
  29. package/dist/generated/definitions.js +9798 -0
  30. package/dist/generated/definitions.js.map +1 -0
  31. package/dist/generated/manifest.d.ts +3 -0
  32. package/dist/generated/manifest.d.ts.map +1 -0
  33. package/dist/generated/manifest.js +8346 -0
  34. package/dist/generated/manifest.js.map +1 -0
  35. package/dist/generated/metadata.d.ts +74 -0
  36. package/dist/generated/metadata.d.ts.map +1 -0
  37. package/dist/generated/metadata.js +342 -0
  38. package/dist/generated/metadata.js.map +1 -0
  39. package/dist/generated/schemas.d.ts +649 -0
  40. package/dist/generated/schemas.d.ts.map +1 -0
  41. package/dist/generated/schemas.js +2602 -0
  42. package/dist/generated/schemas.js.map +1 -0
  43. package/dist/generated/types.d.ts +3940 -0
  44. package/dist/generated/types.d.ts.map +1 -0
  45. package/dist/generated/types.js +5 -0
  46. package/dist/generated/types.js.map +1 -0
  47. package/dist/google-api.d.ts +15 -0
  48. package/dist/google-api.d.ts.map +1 -0
  49. package/dist/google-api.js +94 -0
  50. package/dist/google-api.js.map +1 -0
  51. package/dist/google.d.ts +8 -0
  52. package/dist/google.d.ts.map +1 -0
  53. package/dist/google.js +173 -0
  54. package/dist/google.js.map +1 -0
  55. package/dist/index.d.ts +9 -0
  56. package/dist/index.d.ts.map +1 -0
  57. package/dist/index.js +7 -0
  58. package/dist/index.js.map +1 -0
  59. package/dist/knowledge-commands.d.ts +19 -0
  60. package/dist/knowledge-commands.d.ts.map +1 -0
  61. package/dist/knowledge-commands.js +155 -0
  62. package/dist/knowledge-commands.js.map +1 -0
  63. package/dist/knowledge.d.ts +38 -0
  64. package/dist/knowledge.d.ts.map +1 -0
  65. package/dist/knowledge.js +222 -0
  66. package/dist/knowledge.js.map +1 -0
  67. package/dist/login.d.ts +25 -0
  68. package/dist/login.d.ts.map +1 -0
  69. package/dist/login.js +116 -0
  70. package/dist/login.js.map +1 -0
  71. package/dist/mcp.d.ts +35 -0
  72. package/dist/mcp.d.ts.map +1 -0
  73. package/dist/mcp.js +147 -0
  74. package/dist/mcp.js.map +1 -0
  75. package/dist/model.d.ts +100 -0
  76. package/dist/model.d.ts.map +1 -0
  77. package/dist/model.js +3 -0
  78. package/dist/model.js.map +1 -0
  79. package/dist/oauth-application.d.ts +5 -0
  80. package/dist/oauth-application.d.ts.map +1 -0
  81. package/dist/oauth-application.js +8 -0
  82. package/dist/oauth-application.js.map +1 -0
  83. package/dist/policy.d.ts +16 -0
  84. package/dist/policy.d.ts.map +1 -0
  85. package/dist/policy.js +65 -0
  86. package/dist/policy.js.map +1 -0
  87. package/dist/profile-lock.d.ts +5 -0
  88. package/dist/profile-lock.d.ts.map +1 -0
  89. package/dist/profile-lock.js +27 -0
  90. package/dist/profile-lock.js.map +1 -0
  91. package/dist/program.d.ts +20 -0
  92. package/dist/program.d.ts.map +1 -0
  93. package/dist/program.js +653 -0
  94. package/dist/program.js.map +1 -0
  95. package/dist/registry.d.ts +7 -0
  96. package/dist/registry.d.ts.map +1 -0
  97. package/dist/registry.js +15 -0
  98. package/dist/registry.js.map +1 -0
  99. package/dist/remote-commands.d.ts +10 -0
  100. package/dist/remote-commands.d.ts.map +1 -0
  101. package/dist/remote-commands.js +169 -0
  102. package/dist/remote-commands.js.map +1 -0
  103. package/dist/schema.d.ts +6 -0
  104. package/dist/schema.d.ts.map +1 -0
  105. package/dist/schema.js +77 -0
  106. package/dist/schema.js.map +1 -0
  107. package/dist/state.d.ts +11 -0
  108. package/dist/state.d.ts.map +1 -0
  109. package/dist/state.js +90 -0
  110. package/dist/state.js.map +1 -0
  111. package/dist/store.d.ts +5 -0
  112. package/dist/store.d.ts.map +1 -0
  113. package/dist/store.js +135 -0
  114. package/dist/store.js.map +1 -0
  115. package/dist/sync.d.ts +20 -0
  116. package/dist/sync.d.ts.map +1 -0
  117. package/dist/sync.js +278 -0
  118. package/dist/sync.js.map +1 -0
  119. package/dist/tokens.d.ts +26 -0
  120. package/dist/tokens.d.ts.map +1 -0
  121. package/dist/tokens.js +83 -0
  122. package/dist/tokens.js.map +1 -0
  123. package/dist/version.d.ts +2 -0
  124. package/dist/version.d.ts.map +1 -0
  125. package/dist/version.js +3 -0
  126. package/dist/version.js.map +1 -0
  127. package/package.json +82 -4
package/LICENSE ADDED
@@ -0,0 +1,204 @@
1
+ Copyright (c) 2026 Viacheslav Ptsarev
2
+
3
+
4
+ Apache License
5
+ Version 2.0, January 2004
6
+ http://www.apache.org/licenses/
7
+
8
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
9
+
10
+ 1. Definitions.
11
+
12
+ "License" shall mean the terms and conditions for use, reproduction,
13
+ and distribution as defined by Sections 1 through 9 of this document.
14
+
15
+ "Licensor" shall mean the copyright owner or entity authorized by
16
+ the copyright owner that is granting the License.
17
+
18
+ "Legal Entity" shall mean the union of the acting entity and all
19
+ other entities that control, are controlled by, or are under common
20
+ control with that entity. For the purposes of this definition,
21
+ "control" means (i) the power, direct or indirect, to cause the
22
+ direction or management of such entity, whether by contract or
23
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
24
+ outstanding shares, or (iii) beneficial ownership of such entity.
25
+
26
+ "You" (or "Your") shall mean an individual or Legal Entity
27
+ exercising permissions granted by this License.
28
+
29
+ "Source" form shall mean the preferred form for making modifications,
30
+ including but not limited to software source code, documentation
31
+ source, and configuration files.
32
+
33
+ "Object" form shall mean any form resulting from mechanical
34
+ transformation or translation of a Source form, including but
35
+ not limited to compiled object code, generated documentation,
36
+ and conversions to other media types.
37
+
38
+ "Work" shall mean the work of authorship, whether in Source or
39
+ Object form, made available under the License, as indicated by a
40
+ copyright notice that is included in or attached to the work
41
+ (an example is provided in the Appendix below).
42
+
43
+ "Derivative Works" shall mean any work, whether in Source or Object
44
+ form, that is based on (or derived from) the Work and for which the
45
+ editorial revisions, annotations, elaborations, or other modifications
46
+ represent, as a whole, an original work of authorship. For the purposes
47
+ of this License, Derivative Works shall not include works that remain
48
+ separable from, or merely link (or bind by name) to the interfaces of,
49
+ the Work and Derivative Works thereof.
50
+
51
+ "Contribution" shall mean any work of authorship, including
52
+ the original version of the Work and any modifications or additions
53
+ to that Work or Derivative Works thereof, that is intentionally
54
+ submitted to Licensor for inclusion in the Work by the copyright owner
55
+ or by an individual or Legal Entity authorized to submit on behalf of
56
+ the copyright owner. For the purposes of this definition, "submitted"
57
+ means any form of electronic, verbal, or written communication sent
58
+ to the Licensor or its representatives, including but not limited to
59
+ communication on electronic mailing lists, source code control systems,
60
+ and issue tracking systems that are managed by, or on behalf of, the
61
+ Licensor for the purpose of discussing and improving the Work, but
62
+ excluding communication that is conspicuously marked or otherwise
63
+ designated in writing by the copyright owner as "Not a Contribution."
64
+
65
+ "Contributor" shall mean Licensor and any individual or Legal Entity
66
+ on behalf of whom a Contribution has been received by Licensor and
67
+ subsequently incorporated within the Work.
68
+
69
+ 2. Grant of Copyright License. Subject to the terms and conditions of
70
+ this License, each Contributor hereby grants to You a perpetual,
71
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
72
+ copyright license to reproduce, prepare Derivative Works of,
73
+ publicly display, publicly perform, sublicense, and distribute the
74
+ Work and such Derivative Works in Source or Object form.
75
+
76
+ 3. Grant of Patent License. Subject to the terms and conditions of
77
+ this License, each Contributor hereby grants to You a perpetual,
78
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
79
+ (except as stated in this section) patent license to make, have made,
80
+ use, offer to sell, sell, import, and otherwise transfer the Work,
81
+ where such license applies only to those patent claims licensable
82
+ by such Contributor that are necessarily infringed by their
83
+ Contribution(s) alone or by combination of their Contribution(s)
84
+ with the Work to which such Contribution(s) was submitted. If You
85
+ institute patent litigation against any entity (including a
86
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
87
+ or a Contribution incorporated within the Work constitutes direct
88
+ or contributory patent infringement, then any patent licenses
89
+ granted to You under this License for that Work shall terminate
90
+ as of the date such litigation is filed.
91
+
92
+ 4. Redistribution. You may reproduce and distribute copies of the
93
+ Work or Derivative Works thereof in any medium, with or without
94
+ modifications, and in Source or Object form, provided that You
95
+ meet the following conditions:
96
+
97
+ (a) You must give any other recipients of the Work or
98
+ Derivative Works a copy of this License; and
99
+
100
+ (b) You must cause any modified files to carry prominent notices
101
+ stating that You changed the files; and
102
+
103
+ (c) You must retain, in the Source form of any Derivative Works
104
+ that You distribute, all copyright, patent, trademark, and
105
+ attribution notices from the Source form of the Work,
106
+ excluding those notices that do not pertain to any part of
107
+ the Derivative Works; and
108
+
109
+ (d) If the Work includes a "NOTICE" text file as part of its
110
+ distribution, then any Derivative Works that You distribute must
111
+ include a readable copy of the attribution notices contained
112
+ within such NOTICE file, excluding those notices that do not
113
+ pertain to any part of the Derivative Works, in at least one
114
+ of the following places: within a NOTICE text file distributed
115
+ as part of the Derivative Works; within the Source form or
116
+ documentation, if provided along with the Derivative Works; or,
117
+ within a display generated by the Derivative Works, if and
118
+ wherever such third-party notices normally appear. The contents
119
+ of the NOTICE file are for informational purposes only and
120
+ do not modify the License. You may add Your own attribution
121
+ notices within Derivative Works that You distribute, alongside
122
+ or as an addendum to the NOTICE text from the Work, provided
123
+ that such additional attribution notices cannot be construed
124
+ as modifying the License.
125
+
126
+ You may add Your own copyright statement to Your modifications and
127
+ may provide additional or different license terms and conditions
128
+ for use, reproduction, or distribution of Your modifications, or
129
+ for any such Derivative Works as a whole, provided Your use,
130
+ reproduction, and distribution of the Work otherwise complies with
131
+ the conditions stated in this License.
132
+
133
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
134
+ any Contribution intentionally submitted for inclusion in the Work
135
+ by You to the Licensor shall be under the terms and conditions of
136
+ this License, without any additional terms or conditions.
137
+ Notwithstanding the above, nothing herein shall supersede or modify
138
+ the terms of any separate license agreement you may have executed
139
+ with Licensor regarding such Contributions.
140
+
141
+ 6. Trademarks. This License does not grant permission to use the trade
142
+ names, trademarks, service marks, or product names of the Licensor,
143
+ except as required for reasonable and customary use in describing the
144
+ origin of the Work and reproducing the content of the NOTICE file.
145
+
146
+ 7. Disclaimer of Warranty. Unless required by applicable law or
147
+ agreed to in writing, Licensor provides the Work (and each
148
+ Contributor provides its Contributions) on an "AS IS" BASIS,
149
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
150
+ implied, including, without limitation, any warranties or conditions
151
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
152
+ PARTICULAR PURPOSE. You are solely responsible for determining the
153
+ appropriateness of using or redistributing the Work and assume any
154
+ risks associated with Your exercise of permissions under this License.
155
+
156
+ 8. Limitation of Liability. In no event and under no legal theory,
157
+ whether in tort (including negligence), contract, or otherwise,
158
+ unless required by applicable law (such as deliberate and grossly
159
+ negligent acts) or agreed to in writing, shall any Contributor be
160
+ liable to You for damages, including any direct, indirect, special,
161
+ incidental, or consequential damages of any character arising as a
162
+ result of this License or out of the use or inability to use the
163
+ Work (including but not limited to damages for loss of goodwill,
164
+ work stoppage, computer failure or malfunction, or any and all
165
+ other commercial damages or losses), even if such Contributor
166
+ has been advised of the possibility of such damages.
167
+
168
+ 9. Accepting Warranty or Additional Liability. While redistributing
169
+ the Work or Derivative Works thereof, You may choose to offer,
170
+ and charge a fee for, acceptance of support, warranty, indemnity,
171
+ or other liability obligations and/or rights consistent with this
172
+ License. However, in accepting such obligations, You may act only
173
+ on Your own behalf and on Your sole responsibility, not on behalf
174
+ of any other Contributor, and only if You agree to indemnify,
175
+ defend, and hold each Contributor harmless for any liability
176
+ incurred by, or claims asserted against, such Contributor by reason
177
+ of your accepting any such warranty or additional liability.
178
+
179
+ END OF TERMS AND CONDITIONS
180
+
181
+ APPENDIX: How to apply the Apache License to your work.
182
+
183
+ To apply the Apache License to your work, attach the following
184
+ boilerplate notice, with the fields enclosed by brackets "[]"
185
+ replaced with your own identifying information. (Don't include
186
+ the brackets!) The text should be enclosed in the appropriate
187
+ comment syntax for the file format. We also recommend that a
188
+ file or class name and description of purpose be included on the
189
+ same "printed page" as the copyright notice for easier
190
+ identification within third-party archives.
191
+
192
+ Copyright [yyyy] [name of copyright owner]
193
+
194
+ Licensed under the Apache License, Version 2.0 (the "License");
195
+ you may not use this file except in compliance with the License.
196
+ You may obtain a copy of the License at
197
+
198
+ http://www.apache.org/licenses/LICENSE-2.0
199
+
200
+ Unless required by applicable law or agreed to in writing, software
201
+ distributed under the License is distributed on an "AS IS" BASIS,
202
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
203
+ See the License for the specific language governing permissions and
204
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,195 @@
1
- # Temporary Holding Version
1
+ <img src="https://raw.githubusercontent.com/WireCatLabs/drive-cli/main/docs/images/social-preview.png" alt="Google Drive for your AI agents: Docs as local Markdown, search with sources" width="100%">
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ # drive-cli
4
+
5
+ `drive` imports selected Google Drive folders into local Markdown snapshots and searchable
6
+ documents. It reads Google Docs across all tabs, keeps source identity through renames and moves,
7
+ and reuses WireCat's shared keyword search and optional local embeddings. Shared tags, notes,
8
+ editor identities and evidence-backed memories stay attached to the imported documents.
9
+
10
+ Drive uses Google's official Node clients.
11
+ Sources supported now: native Google Docs and uploaded Markdown/TXT. Other types and shortcuts
12
+ are reported as skipped; shortcuts are not followed outside the selected scope.
13
+
14
+ ## Install
15
+
16
+ Install the compiled CLI with Node 22.16+ on the 22.x line or Node 24+. A source build is not
17
+ required:
18
+
19
+ ```sh
20
+ npm install -g @wirecat/drive-cli
21
+ drive --version
22
+ drive --help
23
+ ```
24
+
25
+ See [installation and Google connection](docs/installation.md). Source builds are for
26
+ [contributors](docs/dev/DEVELOPMENT.md).
27
+
28
+ ## Sign in and choose folders
29
+
30
+ Sign in with WireCat's included Google application. Each user approves their own account in the
31
+ browser. You can also create your own Desktop client as explained in the
32
+ [installation guide](docs/installation.md). Connect your account, then choose a folder:
33
+
34
+ ```sh
35
+ drive personal session start
36
+ drive personal folders add https://drive.google.com/drive/folders/FOLDER_ID
37
+ drive personal sync --json
38
+ ```
39
+
40
+ For Google Cloud setup and an isolated first run, follow the
41
+ [browser sign-in and live validation guide](docs/dev/GOOGLE_OAUTH.md).
42
+
43
+ Sign-in opens the system browser and receives Google's callback on a temporary loopback port.
44
+ `--no-browser` prints the URL. `drive.readonly` grants account-wide reading; our selected-folder
45
+ scope limits ingestion. Sync reads remote files. Optional remote management commands need a
46
+ new sign-in with `session start --write`; history events need `session start --activity`.
47
+
48
+ Credentials use the OS keyring. Without one, explicitly choose `--credential-storage file`;
49
+ the shared helper writes an owner-only private file. Tokens never enter regular config, output
50
+ or diagnostics. `DRIVE_GOOGLE_CLIENT_ID` and `DRIVE_GOOGLE_CLIENT_SECRET` can provide application
51
+ settings instead of the bundled application; `--client-file` takes priority. The included Desktop
52
+ client identity is public application metadata, separate from private user tokens. Public distribution with
53
+ this restricted scope needs Google verification; external Testing grants usually expire in
54
+ seven days. [Google OAuth guide](https://developers.google.com/identity/protocols/oauth2/native-app),
55
+ [Drive permissions](https://developers.google.com/workspace/drive/api/guides/api-specific-auth).
56
+
57
+ Use `--profile work` for another account. Each Google account has one local profile. `session list`
58
+ lists configured profiles. `session end` removes local sign-in while retaining cached data and
59
+ configuration so re-login preserves document identities.
60
+
61
+ ## Search and export
62
+
63
+ ```sh
64
+ drive personal search 'budget decision' --json
65
+ drive personal search 'budget' --exact --json
66
+ drive personal documents list --json
67
+ drive personal documents show DOC_ID --json
68
+ drive personal documents export DOC_ID --out ./document.md
69
+ drive personal status --json
70
+ drive commands sync --json
71
+ ```
72
+
73
+ Search results include the original Google URL. `documents show` includes each tab's text, ID
74
+ and title. Native Markdown exports are saved separately from the all-tab text used for indexing.
75
+ Export refuses to overwrite an existing destination file.
76
+
77
+ Semantic search uses an already-downloaded shared text model. Prepare the existing model cache
78
+ with `tg personal models text download e5-small` or its `max` equivalent, then use `drive personal sync --embed`.
79
+ There is no replacement model downloader or implicit download here. Missing models are reported.
80
+ `--exact` searches words without semantic retrieval.
81
+
82
+ ## Keep it current
83
+
84
+ ```sh
85
+ drive personal sync --max 200 --json
86
+ drive personal folders remove FOLDER_ID
87
+ drive personal sync --json
88
+ ```
89
+
90
+ A batch is persisted before processing; interrupted work resumes next run. The change cursor
91
+ advances when the batch completes. Incomplete discovery preserves the prior checkpoint and
92
+ documents. A per-profile heartbeat lock prevents simultaneous syncs and recovers after crashes.
93
+
94
+ Confirmed removals and scope exits remove sources from search and delete their snapshots.
95
+ Removing the last selected folder reconciles to an empty cache on the next sync. Unsupported,
96
+ restricted and oversized sources have explicit coverage status. Transient failures remain pending;
97
+ a partial sync with errors exits nonzero. Doc IDs, rather than names, distinguish duplicates.
98
+
99
+ ## Storage and coverage
100
+
101
+ The shared path helper chooses platform-appropriate config, data and cache directories under
102
+ drive-cli. Override with `DRIVE_CONFIG_DIR`, `DRIVE_STATE_DIR` and `DRIVE_CACHE_DIR`. Snapshots are
103
+ `profiles/<profile>/documents/<file-id>.md` plus private JSON metadata and raw Docs responses.
104
+
105
+ The database defaults to `drive.db` in this CLI's state directory. It uses the released shared
106
+ WireCat store and search engine. It defaults to a separate file so connecting Google does not
107
+ implicitly migrate an existing messenger database. `DRIVE_STORE` selects another compatible
108
+ database explicitly. Review shared package versions and schema compatibility before sharing.
109
+
110
+ Search covers body text, nested tables and footnotes from all tabs. Images, headers, footers,
111
+ comments and suggested edits are excluded. Image assets are not downloaded. Search text and Google’s native Markdown export are separate representations; inspect the export
112
+ when layout or tab coverage matters.
113
+
114
+ Folder scans cap at 10,000 entries. Text caps at 200,000 characters and snapshots at 50 MiB, with
115
+ bounded pagination. Oversized input is refused rather than truncated. Google's native export
116
+ also has its own 10 MB limit. Documents changing during export remain pending for retry.
117
+
118
+ ## Development
119
+
120
+ The tracked zoom-cli template was copied and pruned. Shared WireCat standards, packaging,
121
+ release-job separation and installed-package checks remain. Google logic stays here; SQL,
122
+ chunking, embeddings and search implementations remain in shared packages.
123
+
124
+ ```sh
125
+ pnpm standards:check
126
+ pnpm lint
127
+ pnpm typecheck
128
+ pnpm test
129
+ pnpm build
130
+ pnpm smoke
131
+ pnpm docs:check
132
+ ```
133
+
134
+ See [architecture](docs/dev/ARCHITECTURE.md), [testing](docs/dev/TESTING.md),
135
+ [development](docs/dev/DEVELOPMENT.md) and [releasing](docs/dev/RELEASING.md).
136
+
137
+ ## Document knowledge and remote actions
138
+
139
+ ```sh
140
+ drive personal tags add DOC_ID project-budget review
141
+ drive personal documents list --tag review
142
+ drive personal notes add DOC_ID 'Check the assumptions' --title Review
143
+ drive personal people list DOC_ID
144
+ drive personal documents context DOC_ID
145
+ drive personal memories add DOC_ID 'Budget approved for Q4' --scope work --kind fact
146
+ drive personal memories extract DOC_ID --scope work
147
+ drive personal documents history DOC_ID
148
+ drive api methods --service docs
149
+ ```
150
+
151
+ AI extraction explicitly sends selected cached text to the configured model. It previews proposals
152
+ unless `--save` is given; saved proposals include source quotes, snapshot hashes and model authorship.
153
+ Use the shared model setup with `models configure --provider openai --model MODEL_ID`. Provider keys
154
+ come from the corresponding API-key environment variable and never enter regular configuration.
155
+ Source content changes and scope removals mark source-backed memories stale. User notes stay local.
156
+
157
+ The generated API exposes 68 Drive, Docs and Activity methods. Convenient commands include
158
+ file listing/copying/moving, trash/restore, folder creation, Docs creation/batch updates, comments,
159
+ permissions, revisions and Shared Drives. Read grants remain the default. JSON API calls require
160
+ explicit flags for mutation and permanent deletion; Google still enforces file roles and API policy.
161
+
162
+ Read the [knowledge and API command guide](docs/dev/KNOWLEDGE_AND_API.md) for complete examples,
163
+ permissions, history limits, AI settings and supported request formats. Contributor checks use
164
+ isolated sources and mocked provider requests; see the [testing guide](docs/dev/TESTING.md).
165
+
166
+ ## Shared CLI conventions
167
+
168
+ Drive now uses MAX's API generation approach: committed Google Discovery snapshots feed a
169
+ provider adapter into cli-core's shared code generators. cli-messaging builds the generated
170
+ commands and validates their input; Google's SDK remains the transport. `pnpm generate` rebuilds
171
+ types, validators, the operation manifest, coverage and [command reference](docs/commands.md).
172
+ `pnpm generate:check` checks freshness offline. Only `pnpm spec:sync` fetches a new public specification.
173
+
174
+ ```sh
175
+ drive personal api drive-files-get --help
176
+ drive schema docs.documents.batchUpdate --json
177
+ drive personal --dry-run api drive-files-get --file-id synthetic-doc --json
178
+ drive complete zsh
179
+ drive personal --read-only mcp --tools --json
180
+ ```
181
+
182
+ Profiles accept `drive work ...` as well as `--profile work`. Shared permission levels are deny,
183
+ readonly, ask and allow, configured under profile/default permissions. OAuth permission is a
184
+ separate gate. `--read-only` also stops local mutations; `--yes` and `--allow-dangerous` answer
185
+ confirmation but cannot override a denial. `--offline` refuses commands that may require network.
186
+ Writes use the shared journal and uncertain Google outcomes are reported without automatic retry.
187
+
188
+ MCP stdio tools derive from the same command registry and call the CLI executor with its guards.
189
+ They exclude sign-in/config changes, arbitrary file export, body-file access and raw API dispatch.
190
+ Generated typed methods remain available according to the profile's permissions. Agent-facing
191
+ output shows control characters visibly; results use a shared output buffer and optional deadline.
192
+
193
+ See the [alignment guide](docs/dev/CLI_ALIGNMENT.md) for policy examples, generation, compatibility
194
+ checks and the remaining differences from MAX. The shared package pins now match the reviewed
195
+ MAX versions; existing stores still require an explicit path and compatibility review.
@@ -0,0 +1,7 @@
1
+ import type { ManifestOperation } from "@wirecat/cli-core/codegen";
2
+ import { operations } from "./generated/manifest.js";
3
+ import { schemas } from "./generated/schemas.js";
4
+ export { operations, schemas };
5
+ export declare const operationOf: (name: string) => ManifestOperation;
6
+ export declare const validateRequest: (name: string, params: Record<string, unknown>, body?: Record<string, unknown>) => void;
7
+ //# sourceMappingURL=api-contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-contract.d.ts","sourceRoot":"","sources":["../src/api-contract.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAElE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAEhD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,CAAA;AAC9B,eAAO,MAAM,WAAW,SAAU,MAAM,KAAG,iBAI1C,CAAA;AACD,eAAO,MAAM,eAAe,SAAU,MAAM,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,SA6B5G,CAAA"}
@@ -0,0 +1,42 @@
1
+ import { CliError } from "@wirecat/cli-core";
2
+ import { apiJson, checkApiBody, checkApiParameter } from "@wirecat/cli-messaging/cli";
3
+ import { operations } from "./generated/manifest.js";
4
+ import { schemas } from "./generated/schemas.js";
5
+ export { operations, schemas };
6
+ export const operationOf = (name) => {
7
+ const operation = operations.find((item) => item.id === name);
8
+ if (!operation)
9
+ throw new CliError("validation_error", "unknown Google method; run drive api methods");
10
+ return operation;
11
+ };
12
+ export const validateRequest = (name, params, body) => {
13
+ const operation = operationOf(name);
14
+ const allowed = new Map(operation.parameters.map((parameter) => [parameter.name, parameter]));
15
+ for (const key of Object.keys(params))
16
+ if (!allowed.has(key))
17
+ throw new CliError("validation_error", "unknown or unsupported API parameter; inspect the generated method help");
18
+ for (const parameter of operation.parameters) {
19
+ const value = params[parameter.name];
20
+ if (value === undefined || value === null) {
21
+ if (parameter.required)
22
+ throw new CliError("validation_error", `required API parameter: ${parameter.name}`);
23
+ continue;
24
+ }
25
+ const node = parameter.schema;
26
+ const raw = Array.isArray(value) ? value.join(",") : String(value);
27
+ const problem = checkApiParameter(parameter.name, node, raw, schemas);
28
+ if (problem)
29
+ throw new CliError("validation_error", problem);
30
+ if (node.type === "string" &&
31
+ ((node.pattern && !new RegExp(node.pattern).test(raw)) ||
32
+ (node.minLength !== undefined && raw.length < node.minLength) ||
33
+ (node.maxLength !== undefined && raw.length > node.maxLength)))
34
+ throw new CliError("validation_error", `API parameter ${parameter.name} violates its declared constraints`);
35
+ }
36
+ if (body !== undefined && !operation.request)
37
+ throw new CliError("validation_error", "this Google method does not accept a JSON body");
38
+ checkApiBody(operation, body === undefined ? undefined : apiJson(body), schemas);
39
+ if (params.alt === "media")
40
+ throw new CliError("validation_error", "this API surface supports JSON; use document export for content");
41
+ };
42
+ //# sourceMappingURL=api-contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-contract.js","sourceRoot":"","sources":["../src/api-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE5C,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,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AC7G,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=drive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drive.d.ts","sourceRoot":"","sources":["../../src/bin/drive.ts"],"names":[],"mappings":""}
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+ import { execFile } from "node:child_process";
3
+ import { CliError, exitCodeFor, isCliError } from "@wirecat/cli-core";
4
+ import { CommanderError } from "commander";
5
+ import { createProgram } from "../program.js";
6
+ const controller = new AbortController();
7
+ const cancelled = () => controller.abort();
8
+ process.once("SIGINT", cancelled);
9
+ process.once("SIGTERM", cancelled);
10
+ try {
11
+ await createProgram({
12
+ signal: controller.signal,
13
+ openBrowser: (url) => new Promise((resolve, reject) => {
14
+ const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "rundll32.exe" : "xdg-open";
15
+ const args = process.platform === "win32" ? ["url.dll,FileProtocolHandler", url] : [url];
16
+ execFile(command, args, { timeout: 10000, windowsHide: true }, (error) => error ? reject(new CliError("configuration_error", "open the printed Google sign-in URL")) : resolve());
17
+ }),
18
+ }).parseAsync(process.argv);
19
+ }
20
+ catch (error) {
21
+ if (error instanceof CommanderError) {
22
+ if (error.exitCode === 0)
23
+ process.exitCode = 0;
24
+ else {
25
+ process.stderr.write(`${JSON.stringify({ error: { code: "validation_error", message: "invalid command arguments; use drive --help" } })}\n`);
26
+ process.exitCode = exitCodeFor("validation_error");
27
+ }
28
+ }
29
+ else {
30
+ const safe = isCliError(error)
31
+ ? error
32
+ : new CliError("provider_error", "operation failed; credential and provider details were not logged");
33
+ process.stderr.write(`${JSON.stringify({ error: { code: safe.code, message: safe.message, ...safe.details } })}\n`);
34
+ process.exitCode = exitCodeFor(safe.code);
35
+ }
36
+ }
37
+ finally {
38
+ process.removeListener("SIGINT", cancelled);
39
+ process.removeListener("SIGTERM", cancelled);
40
+ }
41
+ //# sourceMappingURL=drive.js.map
@@ -0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AC9C,CAAC"}
@@ -0,0 +1,74 @@
1
+ import * as v from "valibot";
2
+ export declare const ConfigSchema: v.StrictObjectSchema<{
3
+ readonly profiles: v.RecordSchema<v.StringSchema<undefined>, v.StrictObjectSchema<{
4
+ readonly embeddingProvider: v.OptionalSchema<v.PicklistSchema<["local", "openai"], undefined>, undefined>;
5
+ readonly embeddingModel: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>, undefined>;
6
+ readonly embeddingBaseUrl: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
7
+ readonly embeddingDims: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 65536, undefined>]>, undefined>;
8
+ readonly analysisProvider: v.OptionalSchema<v.PicklistSchema<["agent", "openai", "anthropic"], undefined>, undefined>;
9
+ readonly analysisModel: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>, undefined>;
10
+ readonly analysisBaseUrl: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
11
+ readonly models: v.OptionalSchema<v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, v.StrictObjectSchema<{
12
+ readonly provider: v.OptionalSchema<v.PicklistSchema<["off", "openai", "anthropic"], undefined>, undefined>;
13
+ readonly model: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>, undefined>;
14
+ readonly baseUrl: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
15
+ }, undefined>, undefined>, undefined>;
16
+ readonly readOnly: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
17
+ readonly permissions: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.PicklistSchema<readonly ["deny", "readonly", "ask", "allow"], undefined>, undefined>, undefined>;
18
+ readonly principal: v.StringSchema<undefined>;
19
+ readonly roots: v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
20
+ readonly storage: v.PicklistSchema<["keyring", "file"], undefined>;
21
+ }, undefined>, undefined>;
22
+ readonly defaults: v.OptionalSchema<v.StrictObjectSchema<{
23
+ embeddingProvider: v.OptionalSchema<v.PicklistSchema<["local", "openai"], undefined>, undefined>;
24
+ embeddingModel: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>, undefined>;
25
+ embeddingBaseUrl: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
26
+ embeddingDims: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 65536, undefined>]>, undefined>;
27
+ analysisProvider: v.OptionalSchema<v.PicklistSchema<["agent", "openai", "anthropic"], undefined>, undefined>;
28
+ analysisModel: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>, undefined>;
29
+ analysisBaseUrl: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
30
+ models: v.OptionalSchema<v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, v.StrictObjectSchema<{
31
+ readonly provider: v.OptionalSchema<v.PicklistSchema<["off", "openai", "anthropic"], undefined>, undefined>;
32
+ readonly model: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>, undefined>;
33
+ readonly baseUrl: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "use an HTTP/S endpoint without credentials, query or fragment">]>, undefined>;
34
+ }, undefined>, undefined>, undefined>;
35
+ readOnly: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
36
+ permissions: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.PicklistSchema<readonly ["deny", "readonly", "ask", "allow"], undefined>, undefined>, undefined>;
37
+ }, undefined>, undefined>;
38
+ readonly defaultProfile: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
39
+ }, undefined>;
40
+ export type Config = v.InferOutput<typeof ConfigSchema>;
41
+ export declare const paths: (env: NodeJS.ProcessEnv) => import("@wirecat/cli-core").Paths;
42
+ export declare const readConfig: (env: NodeJS.ProcessEnv) => Config;
43
+ export declare const writeConfig: (env: NodeJS.ProcessEnv, config: Config) => void;
44
+ export declare const profileName: (profile: string) => string;
45
+ export declare const fileId: (input: string) => string;
46
+ export declare const activeProfile: (env: NodeJS.ProcessEnv, name: string) => {
47
+ embeddingProvider?: "local" | "openai" | undefined;
48
+ embeddingModel?: string | undefined;
49
+ embeddingBaseUrl?: string | undefined;
50
+ embeddingDims?: number | undefined;
51
+ analysisProvider?: "agent" | "anthropic" | "openai" | undefined;
52
+ analysisModel?: string | undefined;
53
+ analysisBaseUrl?: string | undefined;
54
+ models?: {
55
+ [x: string]: {
56
+ provider?: "anthropic" | "off" | "openai" | undefined;
57
+ model?: string | undefined;
58
+ baseUrl?: string | undefined;
59
+ };
60
+ } | undefined;
61
+ readOnly?: boolean | undefined;
62
+ permissions?: {
63
+ [x: string]: "allow" | "ask" | "deny" | "readonly";
64
+ } | undefined;
65
+ principal: string;
66
+ roots: string[];
67
+ storage: "file" | "keyring";
68
+ };
69
+ export interface OAuthApplication {
70
+ clientId: string;
71
+ clientSecret?: string;
72
+ }
73
+ export declare const application: (env: NodeJS.ProcessEnv, file?: string) => OAuthApplication;
74
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAc5B,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAIvB,CAAA;AACF,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,YAAY,CAAC,CAAA;AACvD,eAAO,MAAM,KAAK,QAAS,MAAM,CAAC,UAAU,sCAAiE,CAAA;AAC7G,eAAO,MAAM,UAAU,QAAS,MAAM,CAAC,UAAU,KAAG,MAMnD,CAAA;AACD,eAAO,MAAM,WAAW,QAAS,MAAM,CAAC,UAAU,UAAU,MAAM,SAIjE,CAAA;AACD,eAAO,MAAM,WAAW,6BAAoB,CAAA;AAC5C,eAAO,MAAM,MAAM,UAAW,MAAM,KAAG,MAUtC,CAAA;AACD,eAAO,MAAM,aAAa,QAAS,MAAM,CAAC,UAAU,QAAQ,MAAM;;;;;;;;;;;;;;;;;;;;;;CAKjE,CAAA;AACD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AACD,eAAO,MAAM,WAAW,QAAS,MAAM,CAAC,UAAU,SAAS,MAAM,KAAG,gBA6BnE,CAAA"}