cli Documentation

Google Workspace CLI — one command-line tool for Drive, Gmail, Calendar, Sheets, Docs, Chat, Admin, and more. Dynamically built from Google Discovery Service.

RAW Doc

File: README.md

gws

One CLI for all of Google Workspace — built for humans and AI agents.
Drive, Gmail, Calendar, and every Workspace API. Zero boilerplate. Structured JSON output. 40+ agent skills included.

[!NOTE]
This is not an officially supported Google product.




⬇️ Download the latest release for your OS

gws doesn't ship a static list of commands. It reads Google's own Discovery Service at runtime and builds its entire command surface dynamically. When Google Workspace adds an API endpoint or method, gws picks it up automatically.

[!IMPORTANT]
This project is under active development. Expect breaking changes as we march toward v1.0.

Contents

Prerequisites

  • Node.js 18+ — for npm install (or download a pre-built binary from GitHub Releases)
  • A Google Cloud project — required for OAuth credentials. You can create one via the Google Cloud Console or with the gcloud CLI or with the gws auth setup command.
  • A Google account with access to Google Workspace

Installation

The recommended way to install gws is to download the pre-built binary for your OS and architecture from the GitHub Releases page. Extract the archive and place the gws binary in your $PATH.

For convenience, you can also use npm to automate downloading the appropriate binary from GitHub Releases:

bash
npm install @googleworkspace/cli

Or build from source:

bash
cargo install --git https://github.com/googleworkspace/cli --locked

A Nix flake is also available at github:googleworkspace/cli

bash
nix run github:googleworkspace/cli

On macOS and Linux, you can also install via Homebrew:

bash
brew install googleworkspace-cli

Quick Start

bash
gws auth setup     # walks you through Google Cloud project config
gws auth login     # subsequent OAuth login
gws drive files list --params '{"pageSize": 5}'

Why gws?

For humans — stop writing curl calls against REST docs. gws gives you --help on every resource, --dry-run to preview requests, and auto‑pagination.

For AI agents — every response is structured JSON. Pair it with the included agent skills and your LLM can manage Workspace without custom tooling.

bash
# List the 10 most recent files
gws drive files list --params '{"pageSize": 10}'

# Create a spreadsheet
gws sheets spreadsheets create --json '{"properties": {"title": "Q1 Budget"}}'

# Send a Chat message
gws chat spaces messages create \
  --params '{"parent": "spaces/xyz"}' \
  --json '{"text": "Deploy complete."}' \
  --dry-run

# Introspect any method's request/response schema
gws schema drive.files.list

# Stream paginated results as NDJSON
gws drive files list --params '{"pageSize": 100}' --page-all | jq -r '.files[].name'

Authentication

The CLI supports multiple auth workflows so it works on your laptop, in CI, and on a server.

Which setup should I use?

I have… Use
gcloud installed and authenticated gws auth setup (fastest)
A GCP project but no gcloud Manual OAuth setup
An existing OAuth access token GOOGLE_WORKSPACE_CLI_TOKEN
Existing Credentials GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE

Interactive (local desktop)

Credentials are encrypted at rest (AES-256-GCM) with the key stored in your OS keyring (or ~/.config/gws/.encryption_key when GOOGLE_WORKSPACE_CLI_KEYRING_BACKEND=file).

bash
gws auth setup       # one-time: creates a Cloud project, enables APIs, logs you in
gws auth login       # subsequent scope selection and login

gws auth setup requires the gcloud CLI. If you don't have gcloud, use the manual setup below instead.

[!WARNING]
Scope limits in testing mode: If your OAuth app is unverified (testing mode),
Google limits consent to ~25 scopes. The recommended scope preset includes 85+
scopes and will fail for unverified apps (especially for @gmail.com accounts).
Choose individual services instead to filter the scope picker:

bash
gws auth login -s drive,gmail,sheets

Manual OAuth setup (Google Cloud Console)

Use this when gws auth setup cannot automate project/client creation, or when you want explicit control.

  1. Open Google Cloud Console in the target project:
    • OAuth consent screen: https://console.cloud.google.com/apis/credentials/consent?project=
    • Credentials: https://console.cloud.google.com/apis/credentials?project=
  2. Configure OAuth branding/audience if prompted:
    • App type: External (testing mode is fine)
  3. Add your account under Test users
  4. Create an OAuth client:
    • Type: Desktop app
  5. Download the client JSON and save it to:
    • ~/.config/gws/client_secret.json

[!IMPORTANT]
You must add yourself as a test user. In the OAuth consent screen, click
Test users → Add users and enter your Google account email. Without this,
login will fail with a generic "Access blocked" error.

Then run:

bash
gws auth login

Browser-assisted auth (human or agent)

You can complete OAuth either manually or with browser automation.

  • Human flow: run gws auth login, open the printed URL, approve scopes.
  • Agent-assisted flow: the agent opens the URL, selects account, handles consent prompts, and returns control once the localhost callback succeeds.

If consent shows "Google hasn't verified this app" (testing mode), click Continue.
If scope checkboxes appear, select required scopes (or Select all) before continuing.

Headless / CI (export flow)

  1. Complete interactive auth on a machine with a browser.
  2. Export credentials:
    bash
    gws auth export --unmasked > credentials.json
  3. On the headless machine:
    bash
    export GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE=/path/to/credentials.json
    gws drive files list   # just works

Service Account (server-to-server)

Point to your key file; no login needed.

bash
export GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE=/path/to/service-account.json
gws drive files list

Pre-obtained Access Token

Useful when another tool (e.g. gcloud) already mints tokens for your environment.

bash
export GOOGLE_WORKSPACE_CLI_TOKEN=$(gcloud auth print-access-token)

Precedence

Priority Source Set via
1 Access token GOOGLE_WORKSPACE_CLI_TOKEN
2 Credentials file GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE
3 Encrypted credentials gws auth login
4 Plaintext credentials ~/.config/gws/credentials.json

Environment variables can also live in a .env file.

AI Agent Skills

The repo ships 100+ Agent Skills (SKILL.md files) — one for every supported API, plus higher-level helpers for common workflows and 50 curated recipes for Gmail, Drive, Docs, Calendar, and Sheets. See the full Skills Index for the complete list.

bash
# Install all skills at once
npx skills add https://github.com/googleworkspace/cli

# Or pick only what you need
npx skills add https://github.com/googleworkspace/cli/tree/main/skills/gws-drive
npx skills add https://github.com/googleworkspace/cli/tree/main/skills/gws-gmail

OpenClaw setup

bash
# Symlink all skills (stays in sync with repo)
ln -s $(pwd)/skills/gws-* ~/.openclaw/skills/

# Or copy specific skills
cp -r skills/gws-drive skills/gws-gmail ~/.openclaw/skills/

The gws-shared skill includes an install block so OpenClaw auto-installs the CLI via npm if gws isn't on PATH.

Gemini CLI Extension

  1. Authenticate the CLI first:

    bash
    gws auth setup
  2. Install the extension into the Gemini CLI:

    bash
    gemini extensions install https://github.com/googleworkspace/cli

Installing this extension gives your Gemini CLI agent direct access to all gws commands and Google Workspace agent skills. Because gws handles its own authentication securely, you simply need to authenticate your terminal once prior to using the agent, and the extension will automatically inherit your credentials.

Advanced Usage

Multipart Uploads

bash
gws drive files create --json '{"name": "report.pdf"}' --upload ./report.pdf

Pagination

Flag Description Default
--page-all Auto-paginate, one JSON line per page (NDJSON) off
--page-limit <N> Max pages to fetch 10
--page-delay <MS> Delay between pages 100 ms

Google Sheets — Shell Escaping

Sheets ranges use ! which bash interprets as history expansion. Always wrap values in single quotes:

bash
# Read cells A1:C10 from "Sheet1"
gws sheets spreadsheets values get \
  --params '{"spreadsheetId": "SPREADSHEET_ID", "range": "Sheet1!A1:C10"}'

# Append rows
gws sheets spreadsheets values append \
  --params '{"spreadsheetId": "ID", "range": "Sheet1!A1", "valueInputOption": "USER_ENTERED"}' \
  --json '{"values": [["Name", "Score"], ["Alice", 95]]}'

Helper Commands

Some services ship hand-crafted helper commands alongside the auto-generated Discovery surface. Helper commands are prefixed with + so they are visually distinct and never collide with Discovery-generated method names.

Time-aware helpers (+agenda, +standup-report, +weekly-digest, +meeting-prep) automatically use your Google account timezone (fetched from Calendar Settings API and cached for 24 hours). Override with --timezone/--tz on +agenda, or set the --timezone flag for explicit control.

Run gws <service> --help to see both Discovery methods and helper commands together.

bash
gws gmail --help      # shows +send, +reply, +reply-all, +forward, +triage, +watch …
gws calendar --help   # shows +insert, +agenda …
gws drive --help      # shows +upload …

Full helper reference:

Service Command Description
gmail +send Send an email
gmail +reply Reply to a message (handles threading automatically)
gmail +reply-all Reply-all to a message
gmail +forward Forward a message to new recipients
gmail +triage Show unread inbox summary (sender, subject, date)
gmail +watch Watch for new emails and stream them as NDJSON
sheets +append Append a row to a spreadsheet
sheets +read Read values from a spreadsheet
docs +write Append text to a document
chat +send Send a message to a space
drive +upload Upload a file with automatic metadata
calendar +insert Create a new event
calendar +agenda Show upcoming events (uses Google account timezone; override with --timezone)
script +push Replace all files in an Apps Script project with local files
workflow +standup-report Today's meetings + open tasks as a standup summary
workflow +meeting-prep Prepare for your next meeting: agenda, attendees, and linked docs
workflow +email-to-task Convert a Gmail message into a Google Tasks entry
workflow +weekly-digest Weekly summary: this week's meetings + unread email count
workflow +file-announce Announce a Drive file in a Chat space
events +subscribe Subscribe to Workspace events and stream them as NDJSON
events +renew Renew/reactivate Workspace Events subscriptions
modelarmor +sanitize-prompt Sanitize a user prompt through a Model Armor template
modelarmor +sanitize-response Sanitize a model response through a Model Armor template
modelarmor +create-template Create a new Model Armor template

Examples:

bash
# Send an email
gws gmail +send --to [email protected] --subject "Hello" --body "Hi there"

# Reply to a message
gws gmail +reply --message-id MESSAGE_ID --body "Thanks!"

# Append a row to a spreadsheet
gws sheets +append --spreadsheet SPREADSHEET_ID --values "Alice,95"

# Show today's calendar agenda
gws calendar +agenda

# Upload a file to Drive
gws drive +upload ./report.pdf --name "Q1 Report"

# Morning standup summary
gws workflow +standup-report

# Show today's agenda in a specific timezone
gws calendar +agenda --today --timezone America/New_York

Model Armor (Response Sanitization)

Integrate Google Cloud Model Armor to scan API responses for prompt injection before they reach your agent.

bash
gws gmail users messages get --params '...' \
  --sanitize "projects/P/locations/L/templates/T"
Variable Description
GOOGLE_WORKSPACE_CLI_SANITIZE_TEMPLATE Default Model Armor template
GOOGLE_WORKSPACE_CLI_SANITIZE_MODE warn (default) or block

Environment Variables

All variables are optional. See .env.example for a copy-paste template.

Variable Description
GOOGLE_WORKSPACE_CLI_TOKEN Pre-obtained OAuth2 access token (highest priority)
GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE Path to OAuth credentials JSON (user or service account)
GOOGLE_WORKSPACE_CLI_CLIENT_ID OAuth client ID (alternative to client_secret.json)
GOOGLE_WORKSPACE_CLI_CLIENT_SECRET OAuth client secret (paired with CLIENT_ID)
GOOGLE_WORKSPACE_CLI_CONFIG_DIR Override config directory (default: ~/.config/gws)
GOOGLE_WORKSPACE_CLI_SANITIZE_TEMPLATE Default Model Armor template
GOOGLE_WORKSPACE_CLI_SANITIZE_MODE warn (default) or block
GOOGLE_WORKSPACE_CLI_LOG Log level for stderr (e.g., gws=debug). Off by default.
GOOGLE_WORKSPACE_CLI_LOG_FILE Directory for JSON log files with daily rotation. Off by default.
GOOGLE_WORKSPACE_PROJECT_ID GCP project ID override for quota/billing and fallback for helper commands

Environment variables can also be set in a .env file (loaded via dotenvy).

Exit Codes

gws uses structured exit codes so scripts can branch on the failure type without parsing error output.

Code Meaning Example cause
0 Success Command completed normally
1 API error Google returned a 4xx/5xx response
2 Auth error Credentials missing, expired, or invalid
3 Validation error Bad arguments, unknown service, invalid flag
4 Discovery error Could not fetch the API schema document
5 Internal error Unexpected failure
bash
gws drive files list --params '{"fileId": "bad"}'
echo $?   # 1 — API error

gws unknown-service files list
echo $?   # 3 — validation error (unknown service)

Architecture

gws uses a two-phase parsing strategy:

  1. Read argv[1] to identify the service (e.g. drive)
  2. Fetch the service's Discovery Document (cached 24 h)
  3. Build a clap::Command tree from the document's resources and methods
  4. Re-parse the remaining arguments
  5. Authenticate, build the HTTP request, execute

All output — success, errors, download metadata — is structured JSON.

Troubleshooting

"Access blocked" or 403 during login

Your OAuth app is in testing mode and your account is not listed as a test user.

Fix: Open the OAuth consent screen in your GCP project → Test users → Add users → enter your Google account email. Then retry gws auth login.

"Google hasn't verified this app"

Expected when your app is in testing mode. Click Advanced → Go to <app name> (unsafe) to proceed. This is safe for personal use; verification is only required to publish the app to other users.

Unverified (testing mode) apps are limited to ~25 OAuth scopes. The recommended scope preset includes many scopes and will exceed this limit.

Fix: Select only the scopes you need:

bash
gws auth login --scopes drive,gmail,calendar

`gcloud` CLI not found

gws auth setup requires the gcloud CLI to automate project creation. You have three options:

  1. Install gcloud and use gcloud directly.
  2. Re-run gws auth setup which wraps gcloud calls.
  3. Skip gcloud entirely — set up OAuth credentials manually in the Cloud Console

`redirect_uri_mismatch`

The OAuth client was not created as a Desktop app type. In the Credentials page, delete the existing client, create a new one with type Desktop app, and download the new JSON.

API not enabled — `accessNotConfigured`

If a required Google API is not enabled for your GCP project, you will see a
403 error with reason accessNotConfigured:

json
{
  "error": {
    "code": 403,
    "message": "Gmail API has not been used in project 549352339482 ...",
    "reason": "accessNotConfigured",
    "enable_url": "https://console.developers.google.com/apis/api/gmail.googleapis.com/overview?project=549352339482"
  }
}

gws also prints an actionable hint to stderr:

text
💡 API not enabled for your GCP project.
   Enable it at: https://console.developers.google.com/apis/api/gmail.googleapis.com/overview?project=549352339482
   After enabling, wait a few seconds and retry your command.

Steps to fix:

  1. Click the enable_url link (or copy it from the enable_url JSON field).
  2. In the GCP Console, click Enable.
  3. Wait ~10 seconds, then retry your gws command.

[!TIP]
You can also run gws auth setup which walks you through enabling all required
APIs for your project automatically.

Development

bash
cargo build                       # dev build
cargo clippy -- -D warnings       # lint
cargo test                        # unit tests
./scripts/coverage.sh             # HTML coverage report → target/llvm-cov/html/

License

Apache-2.0

Disclaimer

[!CAUTION]
This is not an officially supported Google product.


File: crates/google-workspace-cli/src/helpers/README.md

Helper Commands (`+verb`) — Guidelines

Design Principle

The core design of gws is schema-driven: commands are dynamically generated from Google Discovery Documents at runtime. This avoids maintaining a hardcoded, unbounded argument surface. Helpers must complement this design, not duplicate it.

When a Helper is Justified

A +helper command should exist only when it provides value that Discovery-based commands cannot:

Justification Example Why Discovery Can't Do It
Multi-step orchestration +subscribe Creates Pub/Sub topic → subscription → Workspace Events subscription (3 APIs)
Format translation +write Transforms Markdown → Docs batchUpdate JSON
Multi-API composition +triage Lists messages then fetches N metadata payloads concurrently
Complex body construction +send, +reply Builds RFC 2822 MIME from simple flags
Multipart upload +upload Handles resumable upload protocol with progress
Workflow recipes +standup-report Chains calls across multiple services

Litmus test: Can the user achieve the same result with gws <service> <resource> <method> --params '{...}'? If yes, don't add a helper.

Anti-Patterns

❌ Anti-pattern 1: Single API Call Wrapper

If a helper wraps one API call that Discovery already exposes, reject it.

Real example: +revisions (PR #563) wrapped gws drive files-revisions list — same single API call, zero added value.

❌ Anti-pattern 2: Unbounded Flag Accumulation

Adding flags to expose data that is already in the API response creates unbounded surface area.

Real example: --thread-id, --delivered-to, --sent-last on +triage (PR #597) — all three values are already present in the Gmail API response. Agents and users should extract them with --format or jq, not new flags.

Why this is harmful: Every API response contains dozens of fields. If we add a flag for each one, helpers become unbounded maintenance burdens — the exact problem Discovery-driven design solves.

❌ Anti-pattern 3: Duplicating Discovery Parameters

Don't re-expose Discovery-defined parameters (e.g., pageSize, fields, orderBy) as custom helper flags. Use --params passthrough instead.

Flag Design Rules

Helper flags must control orchestration logic, not API parameters or output fields.

✅ Good Flags (control orchestration)

Flag Helper Why It's Good
--spreadsheet, --range +read Identifies which resource to operate on
--to, --subject, --body +send Inputs to MIME construction (format translation)
--dry-run +subscribe Controls whether API calls are actually made
--subscription +subscribe Switches between "create new" vs. "use existing" orchestration path
--target, --project +subscribe Required for multi-service resource creation

❌ Bad Flags (expose API response data)

Flag Why It's Bad Alternative
--thread-id Already in API response jq '.threadId'
--delivered-to Already in response headers `jq '.payload.headers[]
--include-labels Output field filtering --format or jq

Decision Checklist for New Flags

  1. Does this flag control what API call to make or how to orchestrate multiple calls? → ✅ Add it
  2. Does this flag control what data appears in output? → ❌ Use --format/jq
  3. Does this flag duplicate a Discovery parameter? → ❌ Use --params
  4. Could the user achieve this with existing flags + post-processing? → ❌ Don't add it

Architecture

Helpers are implemented using the Helper trait defined in mod.rs.

  • inject_commands: Adds subcommands to the main service command. All helper commands are always shown regardless of authentication state.
  • handle: Implementation of the command logic. Returns Ok(true) if the command was handled, or Ok(false) to let the default raw resource handler attempt to handle it.

Adding a New Helper — Checklist

  1. Passes the litmus test — cannot be done with a single Discovery command
  2. Flags are bounded — only flags controlling orchestration, not API params/output
  3. Uses shared infrastructure:
    • crate::client::build_client() for HTTP
    • crate::validate::validate_resource_name() for user-supplied resource IDs
    • crate::validate::encode_path_segment() for URL path segments
    • crate::output::sanitize_for_terminal() for error messages
  4. Has tests — at minimum: command registration, required args, happy path
  5. Supports --dry-run where the helper creates or mutates resources

Development Steps

  1. Create src/helpers/<service>.rs
  2. Implement the Helper trait
  3. Register it in src/helpers/mod.rs
  4. Prefix the command with + (e.g., +create)

File: crates/google-workspace-cli/README.md

google-workspace-cli

One CLI for all of Google Workspace — built for humans and AI agents.

gws dynamically generates its command surface at runtime by reading Google's Discovery Service. Drive, Gmail, Calendar, and every Workspace API — zero boilerplate, structured JSON output, 40+ agent skills included.

Install

Download the pre-built binary for your OS and architecture from the GitHub Releases page.

Alternatively, you can use package managers as a convenience layer:

bash
npm install @googleworkspace/cli    # npm (downloads GitHub release binary)
cargo install google-workspace-cli     # crates.io
nix run github:googleworkspace/cli     # nix

Quick Start

bash
gws auth login
gws drive files list --params '{"pageSize": 5}'
gws gmail users.messages list --params '{"maxResults": 3}'

Documentation

See the full README for authentication setup, helper commands, agent skills, and more.

License

Apache-2.0 — see LICENSE.


File: crates/google-workspace/README.md

google-workspace

Core Rust library for interacting with Google Workspace APIs via the Discovery Service.

This crate provides the foundational types and utilities used by the google-workspace-cli (gws) command-line tool, and can be used independently for programmatic access.

Dynamic Discovery — this library fetches Google's Discovery Documents at runtime rather than relying on generated client crates. When Google adds or updates an API endpoint, your code picks it up automatically.

Modules

Module Description
discovery Discovery Document types (RestDescription, RestMethod, etc.) and async fetch with optional disk caching
services Service registry mapping aliases (e.g., drive) to API name/version pairs
error Structured GwsError enum with exit codes and JSON serialization
validate Input validation: path safety, resource name checks, URL encoding
client HTTP client builder with automatic retry logic

Usage

rust
use google_workspace::discovery::fetch_discovery_document;
use google_workspace::services::resolve_service;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let (api, version) = resolve_service("drive").unwrap();
    let doc = fetch_discovery_document(api, version, None).await?;

    println!("{} {} — {} resources",
        doc.name, doc.version,
        doc.resources.len(),
    );
    Ok(())
}

License

Apache-2.0 — see LICENSE.


File: docs/CODE_OF_CONDUCT.md

Code of Conduct

Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of
experience, education, socio-economic status, nationality, personal appearance,
race, religion, or sexual identity and orientation.

Our Standards

Examples of behavior that contributes to creating a positive environment
include:

  • Using welcoming and inclusive language
  • Being respectful of differing viewpoints and experiences
  • Gracefully accepting constructive criticism
  • Focusing on what is best for the community
  • Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

  • The use of sexualized language or imagery and unwelcome sexual attention or
    advances
  • Trolling, insulting/derogatory comments, and personal or political attacks
  • Public or private harassment
  • Publishing others' private information, such as a physical or electronic
    address, without explicit permission
  • Other conduct which could reasonably be considered inappropriate in a
    professional setting

Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, or to ban temporarily or permanently any
contributor for other behaviors that they deem inappropriate, threatening,
offensive, or harmful.

Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

This Code of Conduct also applies outside the project spaces when the Project
Steward has a reasonable belief that an individual's behavior may have a
negative impact on the project or its community.

Conflict Resolution

We do not believe that all conflict is bad; healthy debate and disagreement
often yield positive results. However, it is never okay to be disrespectful or
to engage in behavior that violates the project’s code of conduct.

If you see someone violating the code of conduct, you are encouraged to address
the behavior directly with those involved. Many issues can be resolved quickly
and easily, and this gives people more control over the outcome of their
dispute. If you are unable to resolve the matter for any reason, or if the
behavior is threatening or harassing, report it. We are dedicated to providing
an environment where participants feel welcome and safe.

Reports should be directed to the Project Maintainers ([email protected]). It is the Project Steward’s duty to
receive and address reported violations of the code of conduct. They will then
work with a committee consisting of representatives from the Open Source
Programs Office and the Google Open Source Strategy team. If for any reason you
are uncomfortable reaching out to the Project Steward, please email
[email protected].

We will investigate every complaint, but you may not receive a direct response.
We will use our discretion in determining when and how to follow up on reported
incidents, which may range from not taking action to permanent expulsion from
the project and project-sponsored spaces. We will notify the accused of the
report and provide them an opportunity to discuss it before any action is taken.
The identity of the reporter will be omitted from the details of the report
supplied to the accused. In potentially harmful situations, such as ongoing
harassment or threats to anyone's safety, we may take action without notice.

Attribution

This Code of Conduct is adapted from the Contributor Covenant, version 1.4,
available at
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html


File: docs/CONTRIBUTING.md

How to contribute

We'd love to accept your patches and contributions to this project.

Before you begin

Sign our Contributor License Agreement

Contributions to this project must be accompanied by a
Contributor License Agreement (CLA).
You (or your employer) retain the copyright to your contribution; this simply
gives us permission to use and redistribute your contributions as part of the
project.

If you or your current employer have already signed the Google CLA (even if it
was for a different project), you probably don't need to do it again.

Visit https://cla.developers.google.com/ to see your current agreements or to
sign a new one.

Review our community guidelines

This project follows
Google's Open Source Community Guidelines.

Contribution process

Code reviews

All submissions, including submissions by project members, require review. We
use GitHub pull requests for this purpose. Consult
GitHub Help for more
information on using pull requests.

Updating CI Smoketest Credentials

If the OAuth refresh token used in the GitHub Actions smoketest expires or needs additional scopes, you can generate a new one and update the repository secret using the GitHub CLI (gh).

  1. Set the credentials file path to output plaintext JSON:

    bash
    export GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE=smoketest-creds.json
  2. Authenticate with the required scopes:

    bash
    cargo run -- auth login --scopes https://www.googleapis.com/auth/drive,https://www.googleapis.com/auth/gmail.readonly,https://www.googleapis.com/auth/calendar.readonly,https://www.googleapis.com/auth/presentations.readonly,https://www.googleapis.com/auth/tasks.readonly
  3. Export and set the GitHub actions secret:

    bash
    cargo run --quiet -- auth export --unmasked | base64 | gh secret set GOOGLE_CREDENTIALS_JSON
  4. Clean up:

    bash
    rm smoketest-creds.json
    unset GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE

Development Patterns

Changesets

Every PR must include a changeset file at .changeset/<descriptive-name>.md:

markdown
---
"@googleworkspace/cli": patch
---

Brief description of the change

Use patch for fixes/chores, minor for new features, major for breaking changes.

Input Validation & URL Safety

This CLI is designed to be invoked by AI/LLM agents, so all user-supplied inputs must be treated as potentially adversarial. See AGENTS.md for the full reference. The key rules are:

What you're doing What to use
Accepting a file path (--output-dir, --dir) validate::validate_safe_output_dir() or validate_safe_dir_path()
Embedding a value in a URL path segment helpers::encode_path_segment()
Passing query parameters reqwest .query() builder (never string interpolation)
Using a resource name in a URL (--project, --space) helpers::validate_resource_name()
Accepting an enum flag (--msg-format) clap value_parser (see gmail/mod.rs)

Testing Expectations

  • All new validation logic must include both happy-path and error-path tests
  • Tests that modify the process CWD must use #[serial] from serial_test
  • Tempdir paths should be canonicalized before use to handle macOS /var → /private/var symlinks
  • Run the full suite before submitting: cargo test && cargo clippy -- -D warnings

File: docs/skills.md

Skills Index

Auto-generated by gws generate-skills. Do not edit manually.

Services

Core Google Workspace API skills.

Skill Description
gws-shared gws CLI: Shared patterns for authentication, global flags, and output formatting.
gws-drive Google Drive: Manage files, folders, and shared drives.
gws-sheets Google Sheets: Read and write spreadsheets.
gws-gmail Gmail: Send, read, and manage email.
gws-calendar Google Calendar: Manage calendars and events.
gws-admin-reports Google Workspace Admin SDK: Audit logs and usage reports.
gws-docs Read and write Google Docs.
gws-slides Google Slides: Read and write presentations.
gws-tasks Google Tasks: Manage task lists and tasks.
gws-people Google People: Manage contacts and profiles.
gws-chat Google Chat: Manage Chat spaces and messages.
gws-classroom Google Classroom: Manage classes, rosters, and coursework.
gws-forms Read and write Google Forms.
gws-keep Manage Google Keep notes.
gws-meet Manage Google Meet conferences.
gws-events Subscribe to Google Workspace events.
gws-modelarmor Google Model Armor: Filter user-generated content for safety.
gws-workflow Google Workflow: Cross-service productivity workflows.
gws-script Manage Google Apps Script projects.

Helpers

Shortcut commands for common operations.

Skill Description
gws-drive-upload Google Drive: Upload a file with automatic metadata.
gws-sheets-append Google Sheets: Append a row to a spreadsheet.
gws-sheets-read Google Sheets: Read values from a spreadsheet.
gws-gmail-send Gmail: Send an email.
gws-gmail-triage Gmail: Show unread inbox summary (sender, subject, date).
gws-gmail-reply Gmail: Reply to a message (handles threading automatically).
gws-gmail-reply-all Gmail: Reply-all to a message (handles threading automatically).
gws-gmail-forward Gmail: Forward a message to new recipients.
gws-gmail-read Gmail: Read a message and extract its body or headers.
gws-gmail-watch Gmail: Watch for new emails and stream them as NDJSON.
gws-calendar-insert Google Calendar: Create a new event.
gws-calendar-agenda Google Calendar: Show upcoming events across all calendars.
gws-docs-write Google Docs: Append text to a document.
gws-chat-send Google Chat: Send a message to a space.
gws-events-subscribe Google Workspace Events: Subscribe to Workspace events and stream them as NDJSON.
gws-events-renew Google Workspace Events: Renew/reactivate Workspace Events subscriptions.
gws-modelarmor-sanitize-prompt Google Model Armor: Sanitize a user prompt through a Model Armor template.
gws-modelarmor-sanitize-response Google Model Armor: Sanitize a model response through a Model Armor template.
gws-modelarmor-create-template Google Model Armor: Create a new Model Armor template.
gws-workflow-standup-report Google Workflow: Today's meetings + open tasks as a standup summary.
gws-workflow-meeting-prep Google Workflow: Prepare for your next meeting: agenda, attendees, and linked docs.
gws-workflow-email-to-task Google Workflow: Convert a Gmail message into a Google Tasks entry.
gws-workflow-weekly-digest Google Workflow: Weekly summary: this week's meetings + unread email count.
gws-workflow-file-announce Google Workflow: Announce a Drive file in a Chat space.
gws-script-push Google Apps Script: Upload local files to an Apps Script project.

Personas

Role-based skill bundles.

Skill Description
persona-exec-assistant Manage an executive's schedule, inbox, and communications.
persona-project-manager Coordinate projects — track tasks, schedule meetings, and share docs.
persona-hr-coordinator Handle HR workflows — onboarding, announcements, and employee comms.
persona-sales-ops Manage sales workflows — track deals, schedule calls, client comms.
persona-it-admin Administer IT — monitor security and configure Workspace.
persona-content-creator Create, organize, and distribute content across Workspace.
persona-customer-support Manage customer support — track tickets, respond, escalate issues.
persona-event-coordinator Plan and manage events — scheduling, invitations, and logistics.
persona-team-lead Lead a team — run standups, coordinate tasks, and communicate.
persona-researcher Organize research — manage references, notes, and collaboration.

Recipes

Multi-step task sequences with real commands.

Skill Description
recipe-label-and-archive-emails Apply Gmail labels to matching messages and archive them to keep your inbox clean.
recipe-draft-email-from-doc Read content from a Google Doc and use it as the body of a Gmail message.
recipe-organize-drive-folder Create a Google Drive folder structure and move files into the right locations.
recipe-share-folder-with-team Share a Google Drive folder and all its contents with a list of collaborators.
recipe-email-drive-link Share a Google Drive file and email the link with a message to recipients.
recipe-create-doc-from-template Copy a Google Docs template, fill in content, and share with collaborators.
recipe-create-expense-tracker Set up a Google Sheets spreadsheet for tracking expenses with headers and initial entries.
recipe-copy-sheet-for-new-month Duplicate a Google Sheets template tab for a new month of tracking.
recipe-block-focus-time Create recurring focus time blocks on Google Calendar to protect deep work hours.
recipe-reschedule-meeting Move a Google Calendar event to a new time and automatically notify all attendees.
recipe-create-gmail-filter Create a Gmail filter to automatically label, star, or categorize incoming messages.
recipe-schedule-recurring-event Create a recurring Google Calendar event with attendees.
recipe-find-free-time Query Google Calendar free/busy status for multiple users to find a meeting slot.
recipe-bulk-download-folder List and download all files from a Google Drive folder.
recipe-find-large-files Identify large Google Drive files consuming storage quota.
recipe-create-shared-drive Create a Google Shared Drive and add members with appropriate roles.
recipe-log-deal-update Append a deal status update to a Google Sheets sales tracking spreadsheet.
recipe-collect-form-responses Retrieve and review responses from a Google Form.
recipe-post-mortem-setup Create a Google Docs post-mortem, schedule a Google Calendar review, and notify via Chat.
recipe-create-task-list Set up a new Google Tasks list with initial tasks.
recipe-review-overdue-tasks Find Google Tasks that are past due and need attention.
recipe-watch-drive-changes Subscribe to change notifications on a Google Drive file or folder.
recipe-create-classroom-course Create a Google Classroom course and invite students.
recipe-create-meet-space Create a Google Meet meeting space and share the join link.
recipe-review-meet-participants Review who attended a Google Meet conference and for how long.
recipe-create-presentation Create a new Google Slides presentation and add initial slides.
recipe-save-email-attachments Find Gmail messages with attachments and save them to a Google Drive folder.
recipe-send-team-announcement Send a team announcement via both Gmail and a Google Chat space.
recipe-create-feedback-form Create a Google Form for feedback and share it via Gmail.
recipe-sync-contacts-to-sheet Export Google Contacts directory to a Google Sheets spreadsheet.
recipe-share-event-materials Share Google Drive files with all attendees of a Google Calendar event.
recipe-create-vacation-responder Enable a Gmail out-of-office auto-reply with a custom message and date range.
recipe-create-events-from-sheet Read event data from a Google Sheets spreadsheet and create Google Calendar entries for each row.
recipe-plan-weekly-schedule Review your Google Calendar week, identify gaps, and add events to fill them.
recipe-share-doc-and-notify Share a Google Docs document with edit access and email collaborators the link.
recipe-backup-sheet-as-csv Export a Google Sheets spreadsheet as a CSV file for local backup or processing.
recipe-save-email-to-doc Save a Gmail message body into a Google Doc for archival or reference.
recipe-compare-sheet-tabs Read data from two tabs in a Google Sheet to compare and identify differences.
recipe-batch-invite-to-event Add a list of attendees to an existing Google Calendar event and send notifications.
recipe-forward-labeled-emails Find Gmail messages with a specific label and forward them to another address.
recipe-generate-report-from-sheet Read data from a Google Sheet and create a formatted Google Docs report.