You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A CLI that generates its entire command surface dynamically from Google Discovery Service JSON documents. Includes skills for AI agents.
3
+
**One CLI for all of Google Workspace.** Drive, Gmail, Calendar, Sheets, Docs, Chat, Admin — 24 services, 700+ API methods, zero boilerplate.
4
+
5
+
`gws` doesn't ship a static list of commands. It reads Google's own [Discovery Service](https://developers.google.com/discovery) at runtime and builds its entire command surface dynamically. When Google adds an API endpoint, `gws` picks it up automatically.
4
6
5
7
> [!IMPORTANT]
6
-
> This project is currently under active development and is not yet ready for production use.
8
+
> This project is under active development and is not yet ready for production use.
gws setup # walks you through Google Cloud project config + OAuth login
18
+
gws drive files list --params '{"pageSize": 5}'
14
19
```
15
20
16
21
Or build from source:
@@ -19,245 +24,188 @@ Or build from source:
19
24
cargo install --path .
20
25
```
21
26
22
-
## AI Agents & Skills
23
-
24
-
This repository includes [Agent Skills](https://github.com/vercel-labs/agent-skills) definitions (`SKILL.md`) for every supported Google Workspace API. Skills are prefixed with `gws-` to avoid namespace collisions when installed globally.
25
-
26
-
You can install these skills directly into your AI agent using `npx`:
The `gws-shared` skill includes an `install` block so OpenClaw can auto-install the CLI via `npm i -g @googleworkspace/cli` if the `gws` binary isn't found on PATH.
31
+
**For humans** — stop writing `curl` calls against REST docs. `gws` gives you tab‑completion, `--help` on every resource, `--dry-run` to preview requests, and auto‑pagination.
63
32
64
-
## Usage
33
+
**For AI agents** — every response is structured JSON. Pair it with the included agent skills and your LLM can manage Workspace without custom tooling.
65
34
66
35
```bash
67
-
# List files in Drive
36
+
# List the 10 most recent files
68
37
gws drive files list --params '{"pageSize": 10}'
69
38
70
-
# Get a file's metadata
71
-
gws drive files get --params '{"fileId": "abc123"}'
72
-
73
39
# Create a spreadsheet
74
-
gws sheets spreadsheets create --json '{"properties": {"title": "My Sheet"}}'
75
-
76
-
# List Gmail messages
77
-
gws gmail users messages list --params '{"userId": "me"}'
For interactive use on your personal machine where a web browser is available.
55
+
---
100
56
101
-
**Security**: By default, credentials and access tokens are encrypted at rest using AES-256-GCM. The encryption key is stored securely in your OS Keyring (Apple Keychain, Secret Service, or Windows Credential Manager). If a keyring is unavailable (e.g., headless Linux), it falls back to a strictly permissioned (`0600`) local key file.
57
+
## Authentication
102
58
103
-
**Google Cloud Setup & Login:**
104
-
The CLI includes a built-in setup wizard to help you configure your Google Cloud Project, enable APIs, and generate the necessary OAuth credentials. Note that this requires the [`gcloud` CLI](https://cloud.google.com/sdk/docs/install) to be installed and authenticated (`gcloud auth login`).
59
+
The CLI supports multiple auth workflows so it works on your laptop, in CI, and on a server.
105
60
106
-
```bash
107
-
# Run the interactive setup and login wizard
108
-
gws setup
61
+
### Interactive (local desktop)
109
62
110
-
# Or login directly if you already have client_secret.json configured
111
-
gws auth login
63
+
Credentials are encrypted at rest (AES-256-GCM) with the key stored in your OS keyring.
gws setup # one-time: creates a Cloud project, enables APIs, logs you in
67
+
gws auth login # subsequent logins
115
68
```
116
69
117
-
### 2. Headless & CI/CD Auth (Export Flow)
70
+
> Requires the [`gcloud` CLI](https://cloud.google.com/sdk/docs/install) to be installed and authenticated.
118
71
119
-
For remote servers, SSH sessions, or CI/CD pipelines where a browser is unavailable, use the export flow.
72
+
### Headless / CI (export flow)
120
73
121
-
1.On your **local machine** (with a browser), complete the Interactive Auth steps above.
122
-
2. Export your credentials to a portable JSON format:
74
+
1.Complete interactive auth on a machinewith a browser.
75
+
2. Export credentials:
123
76
```bash
124
77
gws auth export --unmasked > credentials.json
125
78
```
126
-
3. On your **headless machine**, securely transfer `credentials.json` and point the CLI to it. The CLI will automatically use this payload to mint fresh access tokens.
*Note: You can also strictly provide a short-lived access token directly via environment variable (e.g. `export GOOGLE_WORKSPACE_CLI_TOKEN=$(gcloud auth print-access-token)`), though this token will naturally expire in ~1 hour.*
135
-
136
-
### 3. Service Account Auth (Server-to-Server)
85
+
### Service Account (server-to-server)
137
86
138
-
For automated programmatic access. Point `GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE`to your service account JSON key file. No login step is required.
### 4. Pre-obtained Access Token (CI/CD or External)
100
+
### Pre-obtained Access Token
153
101
154
-
The simplest way to authenticate if you already possess a short-lived access token. This is often used in CI/CD pipelines where another tool (like`gcloud`) mints the token for the environment.
102
+
Useful when another tool (e.g.`gcloud`) already mints tokens for your environment.
Environment variables can also live in a `.env` file.
162
118
163
119
---
164
120
165
-
### Auth Precedence Order
121
+
##AI Agent Skills
166
122
167
-
The CLI evaluates authentication sources in the following strict order:
123
+
The repo ships 40+ [Agent Skills](https://github.com/vercel-labs/agent-skills) (`SKILL.md` files) — one for every supported API, plus higher-level helpers for common workflows like sending email, triaging a Gmail inbox, or subscribing to calendar events.
168
124
169
-
| Priority | Source | How to set |
170
-
|----------|--------|------------|
171
-
| 1 (highest) | Raw access token |`GOOGLE_WORKSPACE_CLI_TOKEN` env var |
172
-
| 2 | Credentials file (user or service account) |`GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE` env var |
173
-
| 3 | Encrypted credentials & token cache |`~/.config/gws/credentials.enc` and `token_cache.json` (created by `gws auth login`, secured via OS Keyring) |
0 commit comments