gworkspace
v0.2.2
Published
Native Google Workspace CLI (no MCP)
Readme
gw
gw is a native Google Workspace CLI with direct Google API access.
It is built for direct execution: less ceremony, more signal.
What it does
- Browser-based OAuth login (localhost callback)
- Calendar read access (event listing)
- Gmail read access (search + metadata fetch)
- Drive read access (search + recent + file metadata)
- Google Chat read access (spaces + messages)
- Time utilities for reliable local/UTC context
- Compatibility aliases for Workspace-style command names
Quick start
- Create a Google Cloud Desktop OAuth client.
- Download the OAuth client JSON.
- Save it to
~/.config/gworkspace/credentials.json(or pass--credentials).
gw auth login
gw auth status
gw time nowauth login opens your browser, waits for OAuth callback on localhost, then stores token at ~/.config/gworkspace/token.json.
Install and run
Run from source
bun install
bun run build
node dist/index.js --helpInstall globally (optional)
bun install -g .
gw --helpHelp
gw --help
gw -h
gw help
gw help auth
gw auth --helpCommon workflows
Morning context pull
gw time now
gw calendar list --from 2026-02-18T00:00:00Z --to 2026-02-18T23:59:59Z
gw gmail search --query "newer_than:1d" --max 20Project document scan
gw drive search --query "name contains 'spec' and trashed = false"
gw drive get --id <fileId>Message triage
gw gmail search --query "is:unread newer_than:7d" --max 25
gw gmail get --id <messageId>Command surface
Auth
gw auth login [--credentials path/to/credentials.json] [--no-open]gw auth statusgw auth logout
Calendar
gw calendar list --from <ISO> --to <ISO> [--calendarId primary] [--max 20]gw calendar list today [--calendarId primary] [--max 20]
Gmail
gw gmail search --query "<gmail query>" [--max 20] [--pageToken <token>]gw gmail list today [--max 20]gw gmail get --id <messageId>
Drive
gw drive search --query "<drive query>" [--max 20]gw drive recent [--max 20]gw drive get --id <fileId>
Time
gw time nowgw time dategw time zone
Chat
gw chat spaces [--max 20] [--filter "spaceType = SPACE"] [--pageToken <token>]gw chat messages --space spaces/<spaceId> [--max 20] [--orderBy "createTime desc"] [--pageToken <token>]gw chat list today --space spaces/<spaceId> [--max 20]
Workspace-style aliases (compat)
gw calendar_getEvents --timeMin 2026-02-18T00:00:00Z --timeMax 2026-02-19T00:00:00Z
gw gmail_search --query "newer_than:7d" --max 20
gw drive_search --query "trashed = false" --max 20Security notes
- OAuth tokens are stored locally, not committed by default.
- Uses Desktop OAuth credentials JSON for browser login.
- Scopes are read-only:
calendar.readonlygmail.readonlydrive.readonlychat.spaces.readonlychat.messages.readonly
- If you rotate credentials, run
gw auth logoutthengw auth login.
Troubleshooting
Credentials file not found- Create/download Desktop OAuth credentials and pass
--credentials /path/to/credentials.json, or place it at~/.config/gworkspace/credentials.json.
- Create/download Desktop OAuth credentials and pass
- Browser did not open
- Run
gw auth login --no-openand open the URL manually.
- Run
- Login timeout
- Re-run login and complete consent in the browser within the timeout window.
No token found- Run
gw auth loginfirst.
- Run
Docs
docs/auth.md- OAuth browser flow, token storage, and troubleshooting.docs/commands.md- full command reference and examples.
Repo layout
src/
index.ts # tiny entrypoint
cli.ts # command routing
usage.ts # help output
config.ts # paths + scopes
auth/
index.ts # auth commands + authorize()
oauth.ts # browser OAuth flow
token.ts # token read/write/delete
commands/
calendar.ts
gmail.ts
drive.ts
chat.ts
time.ts
lib/
args.ts # argv parsing helpers
io.ts # JSON output + fail handling
types.ts # shared typesDevelopment
bun run check
bun run build
node dist/index.js --help