cli
AGENTS.md31k starsChanged 8 months agoApache-2.0View on GitHub
gws is a Rust CLI tool for interacting with Google Workspace APIs. It dynamically generates its command surface at runtime by parsing Google Discovery Service JSON documents. [!IMPORTANT] Dynamic Discovery: This project does NOT use generated Rust crates (e.g., google-drive3) for API interaction. Instead, it fetches the Discovery JSON at runtime and builds clap commands dynamically. When adding a new service, you only need to register it in crates/google-workspace/src/services.rs and verify the Discovery URL pattern in crates/google-workspace/src/discovery.rs. Do NOT add…
- Reads credentials
Adopted by
Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data
Who's talking about googleworkspace/cli
- A Hacker News story“Google Workspace CLI”Hacker News · Mar 5, 2026 · 953 points
- @sungkim.bsky.social“Google Workspace CLI github.com/googleworksp...”Bluesky · Mar 5, 2026 · 22 likes
- @proptermalone.bsky.social“CC driving Google's CLI: github.com/googleworksp...”Bluesky · Jul 18, 2026 · 16 likes
- @batsov.net“Seems AI agents finally motivated Google to release a comprehensive CLI for their Workspace apps (Drive, …”Bluesky · Mar 5, 2026 · 12 likes
- @jefferyharrell.bsky.social“PSA: Yes! Google has recently released a sort of prototype CLI for Google Workspace. So if you use Gmail …”Bluesky · Mar 7, 2026 · 9 likes
The biggest 5 of 93 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 93
Talked about on GitHub, Bluesky and Hacker News (93 times).
On GitHub · 50
- Apr 4, 2026Support skill dependencies via frontmatter `depends` field — vercel-labs/skills8 reactions · 3 comments
- Jun 10, 2026[Bug] `agy` multicall sandboxing blocks execution of `gws` commands (e.g., `gws gmail +triage`) — google-antigravity/antigravity-cli2 reactions
- Mar 8, 2026feat: Add Google Workspace CLI integration skill — nanocoai/nanoclaw2 reactions · 5 comments
- Jul 26, 2026fix(agent-image): restore GWS_VERSION pin — agent image is unbuildable on dev — psd401/aistudio1 reaction · 1 comment
- Apr 15, 2026Feature: adopt/claim workflow for CLI-bundled skills (~/.agents convention) — runkids/skillshare1 reaction · 9 comments
45 more on GitHub
- Mar 28, 2026[Bug]: `-yg --agent` still prompts for "Installation scope" — not fully non-interactive — vercel-labs/skills1 reaction · 1 comment
- Mar 13, 2026feat: install Google Workspace CLI (gws) in container — openclaw/openclaw1 reaction · 1 comment
- Mar 11, 2026Make Kibana OAS discoverable — elastic/cli1 reaction · 6 comments
- Nov 25, 2026blog: correct statements other products' pages now contradict, and stale product history — datatorag/mcp-gateway0 reactions
- Nov 23, 2026install gws tool in our container image — TomasTomecek/bree0 reactions
- Nov 16, 2026مرشحون جدد للدليل (2026-11-16) — mgrd281/Skill-0 reactions
- Nov 11, 2026feat: AWS and Google Workspace tool installers — mifunedev/agro0 reactions
- Nov 9, 2026gws-cli: upstream update — robomotionio/robomotion-skills0 reactions
- Nov 9, 2026fix(account-integrations): a gws download failure no longer blocks install or update — Aeven-AI/Aeven0 reactions
- Oct 28, 2026개발 도구 설치: RTK AI 및 gws (Google Workspace CLI) — changu-hwang/blank-app0 reactions · 1 comment
- Oct 26, 2026HOSTING-1686: gws, m365 and az in the agent images — hoolia/apps.openshift.eu0 reactions
- Oct 16, 2026docs(skills): gws を最新版に追従 — Fandhe-AI/agent-reference-skills0 reactions
- Oct 4, 2026claude-code-plugins.github.googleworkspace.cli: init at 0.22.5 — sudosubin/agents.nix0 reactions
- Sep 29, 2026[Feature] googleworkspace/cli を利用したカレンダー情報取得ツールを Extension として追加 — ryuma-1/letta-code0 reactions
- Sep 27, 2026agent-skills.github.googleworkspace.cli: init at 0.22.5 — sudosubin/agents.nix0 reactions
- Sep 27, 2026Update skill: /googleworkspace-persona-project-manager (medium risk) — aiskillstore/marketplace0 reactions
- Sep 24, 2026refactor(google-workspace-cli): specification compliance — wei840222/omni-skills0 reactions
- Sep 23, 2026fix(build): gws скачивается по ссылке релиза, а не через REST API — nyxandro/osinara0 reactions · 1 comment
- Sep 15, 2026Google Workspace for Students has no Google Chat skill — StudentSuite/awesome-skills-plugins-for-students0 reactions
- Sep 11, 2026Keep the required Clippy check passing on current Rust — ratovarius/googleworkspace-cli0 reactions
- Sep 11, 2026Preserve saved credentials when decryption or Keychain fails — ratovarius/googleworkspace-cli0 reactions
- Sep 11, 2026Validate raw API and Docs append dry-runs without credentials — ratovarius/googleworkspace-cli0 reactions
- Sep 11, 2026Configure an explicit trusted root for exported/uploaded files — ratovarius/googleworkspace-cli0 reactions
- Sep 11, 2026Export a visual Google Docs review bundle — ratovarius/googleworkspace-cli0 reactions
- Sep 11, 2026Plan and apply revision-bound document text patches — ratovarius/googleworkspace-cli0 reactions
- Sep 11, 2026Read Google Docs as compact structured content — ratovarius/googleworkspace-cli0 reactions
- Sep 11, 2026Allow explicit use of fields absent from Discovery — ratovarius/googleworkspace-cli0 reactions
- Sep 1, 2026feat: google workspace skill via official gws cli — johndikeman/dude0 reactions · 1 comment
- Aug 27, 2026[Bug] Remove external-package auto-install buttons (LibreOffice, gws); ask the model to install instead — raffaelefarinaro/ciaobot0 reactions · 1 comment
- Aug 25, 2026[Agent] Connect Google Workspace: wire the existing loopback re-login into a one-click 'Connect' button — raffaelefarinaro/ciaobot0 reactions · 1 comment
- Aug 13, 2026Build a full-fledged CLI (noun-verb, OpenAPI-driven, gws-style) — ozand/aygacrm0 reactions · 2 comments
- Jul 23, 2026gws link is wrong — pantheon-systems-ps/wp2shell-audit0 reactions · 1 comment
- Jul 22, 2026Add Google Workspace CLI privacy policy site with GitHub Pages deployment — doitian/gwscli-privacy-policy0 reactions
- Jul 22, 2026[开源推荐] 一个命令行管理全部 Google Workspace 服务 — 521xueweihan/HelloGitHub0 reactions
- Jul 17, 2026New skill: /googleworkspace-gws-gmail-read (safe risk) — aiskillstore/marketplace0 reactions
- Jul 16, 2026feat(mise): add gws (Google Workspace CLI) via http backend — igou-io/igou-devenv0 reactions
- Jul 7, 2026Generate connector command surfaces from OpenAPI, Discovery, GraphQL, and XML specs — polymetrics-ai/cli0 reactions · 1 comment
- Jun 11, 2026Gws cli — bashfulrobot/nixerator0 reactions · 4 comments
- Jun 5, 2026Add google-workspace plugin (references googleworkspace/cli) — kzarzycki/agent-skills0 reactions · 30 comments
- May 24, 2026docs: fix stale CLI references — NousResearch/hermes-agent0 reactions · 2 comments
- May 22, 2026Add gws Claude skill — bashfulrobot/nixerator0 reactions · 1 comment
- May 22, 2026fix(dockerfile-agent): Google Workspace CLI install checksum verification fails — same wget filename mismatch class as #1240 — senara-solutions/mika0 reactions · 1 comment
- May 20, 2026How can I install gemini CLI extensions? — google-antigravity/antigravity-cli0 reactions · 1 comment
- May 20, 2026docs(google-workspace): fix dead gws CLI link to googleworkspace/cli — NousResearch/hermes-agent0 reactions · 1 comment
- May 19, 2026gws link is dead — NousResearch/hermes-agent0 reactions
On Bluesky · 39
- Mar 5, 2026Google Workspace CLI github.com/googleworksp... — @sungkim.bsky.social22 likes and reposts · 1 reply
- Jul 18, 2026CC driving Google's CLI: github.com/googleworksp... — @proptermalone.bsky.social16 likes and reposts · 1 reply
- Mar 5, 2026Seems AI agents finally motivated Google to release a comprehensive CLI for their Workspace apps (Drive, Gmail, Docs, etc)… — @batsov.net12 likes and reposts · 2 replies
- Mar 7, 2026PSA: Yes! Google has recently released a sort of prototype CLI for Google Workspace. So if you use Gmail specifically, it is now possible… — @jefferyharrell.bsky.social9 likes and reposts · 1 reply
- Mar 5, 2026oh wow google just released a cli for like all of their services. i can think of like a million useful things you could do with this.… — @atomly.com7 likes and reposts
34 more on Bluesky
- Mar 6, 2026J’attend un tel outil depuis un moment et le voilà. Mais pas uniquement en CLI : il y a du MCP (tant pis 😉) mais aussi des skills… — @titimoby.eu6 likes and reposts
- Mar 5, 2026Google Workspaceの公式のCLI リトで参照する #CLI #rito.blue — @tkusano.jp6 likes and reposts
- May 9, 2026not Gemini CLI, this thing github.com/googleworksp... — @proptermalone.bsky.social5 likes and reposts
- Mar 5, 2026CLI interfaces til softwareprodukter er en kæmpe trend. Årsagen er at AI agenter skal kunne bruge de softwareprodukter mennesker bruger på… — @kasperjunge.bsky.social4 likes and reposts · 1 reply
- Oct 18, 2026📦 googleworkspace / cli ⭐ 31,633 (+51) 🗒 Rust Google Workspace CLI — one command-line tool for Drive, Gmail, Calendar, Sheets, Docs,… — @github-trending-rs.bsky.social3 likes and reposts
- Jun 24, 2026googleworkspace / cli: Google Workspace CLI — one command-line tool for Drive, Gmail, Calendar, Sheets, Docs, Chat, Admin, and more.… — @rusttrending.bsky.social3 likes and reposts
- Mar 5, 2026Google finally launched an official Rust CLI (gmail, drive, sheets, gmail, calendar, admin, keep, meet 10+ more). #rust #rustlang… — @rustaceans.bsky.social3 likes and reposts · 1 reply
- Mar 5, 2026GmailやカレンダーなどをCLIで操作するためのツールらしい LLMエージェント連携も視野に入れているのが面白い yug1224 starred googleworkspace/cli https://github.com/googleworkspace/cli — @yug1224.com3 likes and reposts
- Mar 5, 2026Work with #Gmail, Sheets, Drive & Docs via #CLI or #MCP $ npm install -g @googleworkspace/cli $ npx skills add github:googleworkspace/cli… — @qdrddr.bsky.social2 likes and reposts
- Mar 5, 2026github.com/googleworks... — @ssp.sh2 likes and reposts
- Mar 5, 2026googleworkspace/cliツール、golangじゃなくてrustなんだな github.com/googleworksp... — @junyaogura.bsky.social2 likes and reposts
- Oct 13, 2026📦 googleworkspace / cli ⭐ 31,436 (+50) 🗒 Rust Google Workspace CLI — one command-line tool for Drive, Gmail, Calendar, Sheets, Docs,… — @github-trending-rs.bsky.social1 likes and repost
- May 6, 2026googleworkspace / cli: Google Workspace CLI — one command-line tool for Drive, Gmail, Calendar, Sheets, Docs, Chat, Admin, and more.… — @rusttrending.bsky.social1 likes and repost
- Mar 14, 2026Google released a new open-source CLI for Drive, Gmail, and Calendar, complete with AI agent skills. by Google Workspace Team… — @peterfriese.dev1 likes and repost · 1 reply
- Mar 11, 2026This looks super useful for Google Workspace agent automation: github.com/googleworksp... — @mikehadlow.com1 likes and repost
- Mar 11, 2026Google Workspace CLI — one command-line tool for Drive, Gmail, Calendar, Sheets, Docs, Chat, Admin, and more. Dynamically built from Google… — @samuelwong.bsky.social1 likes and repost
- Mar 10, 2026Google just released (open sourced project, not officially supported) GWS CLI that works seamlessly with claude code. This is quite nice… — @dsgoose.bsky.social1 likes and repost
- Mar 6, 2026GitHub - googleworkspace/cli: Google Workspace CLI — one command-line tool for Drive, Gmail, Calendar, Sheets, Docs, Chat, Admin, and more.… — @clipsoflogic.bsky.social1 likes and repost
- Mar 6, 2026Then Google shipped a CLI for workspace. An official CLI for the entire Workspace suite. Rust, open-sourced under Apache 2.0, MCP server… — @nuno.bsky.social1 likes and repost · 1 reply
- Mar 6, 2026I didn't expect "agentic AI" to usher in a resurgence of the Unix command line, but it makes sense in hindsight, as composition has more… — @jmoiron.bsky.social1 likes and repost · 1 reply
- Mar 5, 2026Already using Google Workspace CLI? Use skillshare to sync those powerful skills. skillshare install googleworkspace/cli --all --into gws… — @willie-hung.bsky.social1 likes and repost
- Mar 5, 2026github.com/googleworksp... これ、Rust なのに binary インストールは npm でやれ、とか書いててこういうセンスが絶望的に無理 — @hsbt.org1 likes and repost · 1 reply
- Mar 5, 2026It's finally here, Google Workspace CLI I'd be curious to see how hard it will be for Claude Code to convert a local markdown file into a… — @ivanzugec.com1 likes and repost
- Mar 5, 2026Google Workspace CLI — one command-line tool for Drive, Gmail, Calendar, Sheets, Docs, Chat, Admin, and more. Dynamically built from Google… — @diegopacheco.bsky.social1 likes and repost
- Mar 5, 2026googleworkspace/cli 🤩 Drive, Gmail, Calendar, and every Workspace API. Zero boilerplate. Structured JSON output. 40+ agent skills… — @spleck.net1 likes and repost
- Mar 5, 2026Googleworkspace/CLI | Discussion — @hackernewsbot.bsky.social1 likes and repost
- Mar 5, 2026github.com/googleworksp... I have wanted this forever and Google only does this once agents become a thing sigh — @interleave.love1 likes and repost
- Jun 24, 2026🎉 Celebrating! 🎉 (500+ new stars) 📦 googleworkspace / cli ⭐ 27,982 (+678) 🗒 Rust Google Workspace CLI — one command-line tool for… — @github-trending-rs.bsky.social0 likes and reposts · 2 replies
- Mar 6, 2026The agent ecosystem is moving fast. And this Google Workspace CLI may be a major infrastructure shift. GitHub: github.com/googleworks...… — @kanikabk.bsky.social0 likes and reposts · 1 reply
- Mar 5, 2026googleworkspace/cli: Google Workspace CLI — one command-line tool for Drive, Gmail, Calendar, Sheets, Docs, Chat, Admin, and more.… — @chrisshort.net0 likes and reposts · 1 reply
- Mar 5, 2026Strong example of the ‘CLI is the contract’ idea: Google Workspace CLI, designed for humans and agents (structured JSON). Fewer moving… — @oscarrenalias.bsky.social0 likes and reposts · 1 reply
- Mar 5, 2026Google Workspaceのコマンドラインインターフェース Google Workspace CLI 🔺 568 💬 59 🔗 HN Post | Article — @hacker-news-jp.bsky.social0 likes and reposts · 1 reply
- Mar 5, 2026Google Workspace CLI View Article | Join the HN Conversation Summary of HN discussion 🧵👇 — @hncompanion.com0 likes and reposts · 1 reply
- Mar 5, 20261/2 Google lanza CLI oficial para Workspace Google publica en GitHub su primera herramienta oficial de línea de comandos para gestionar… — @eltableroglobal.bsky.social0 likes and reposts · 1 reply
On Hacker News · 4
- Mar 5, 2026Google Workspace CLI953 points · 285 comments
- Mar 31, 2026Google Workspace no longer supports MCP2 points
- Mar 7, 2026Google Workspace CLI Removes MCP Support2 points
- Mar 4, 2026One CLI for all ofGoogle Workspace – built for humans and AI agents2 points · 1 comment
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository96 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- gws-admin-reportsSkill
- gws-calendar-agendaSkill
- gws-calendar-insertSkill
- gws-calendarSkill
- gws-chat-sendSkill
- gws-chatSkill
- gws-classroomSkill
- gws-docsSkill
- gws-docs-writeSkill
- gws-driveSkill
- gws-drive-uploadSkill
- gws-events-renewSkill
- gws-eventsSkill
- gws-events-subscribeSkill
- gws-formsSkill
- gws-gmail-forwardSkill
- gws-gmail-readSkill
- gws-gmail-reply-allSkill
- gws-gmail-replySkill
- gws-gmail-sendSkill
- gws-gmailSkill
- gws-gmail-triageSkill
- gws-gmail-watchSkill
- gws-keepSkill
- gws-meetSkill
- gws-modelarmor-create-templateSkill
- gws-modelarmor-sanitize-promptSkill
- gws-modelarmor-sanitize-responseSkill
- gws-modelarmorSkill
- gws-peopleSkill
- gws-script-pushSkill
- gws-scriptSkill
- gws-sharedSkill
- gws-sheets-appendSkill
- gws-sheets-readSkill
- gws-sheetsSkill
- gws-slidesSkill
- gws-tasksSkill
- gws-workflow-email-to-taskSkill
- gws-workflow-file-announceSkill
- gws-workflow-meeting-prepSkill
- gws-workflowSkill
- gws-workflow-standup-reportSkill
- gws-workflow-weekly-digestSkill
- persona-content-creatorSkill
- persona-customer-supportSkill
- persona-event-coordinatorSkill
- persona-exec-assistantSkill
- persona-hr-coordinatorSkill
- persona-it-adminSkill
- persona-project-managerSkill
- persona-researcherSkill
- persona-sales-opsSkill
- persona-team-leadSkill
- recipe-backup-sheet-as-csvSkill
- recipe-batch-invite-to-eventSkill
- recipe-block-focus-timeSkill
- recipe-bulk-download-folderSkill
- recipe-collect-form-responsesSkill
- The first 60 shown.
The file
We split this AGENTS.md into the rules it gives an agent
9 rules. About 0 are common, 5 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 26
Every PR must include a changeset file.
- Very specific: line 36
Use patch for fixes/chores, minor for new features, major for breaking changes.
- Very specific: line 88
Use double quotes for simple strings: Type "gws --help" Enter
- Distinctive: line 89
Use backtick quotes when the typed text contains JSON with double quotes:
- Distinctive: line 109
When adding new helpers or CLI flags that accept file paths, always validate using the shared helpers:
- Distinctive: line 152
When a user-supplied string is used as a GCP resource identifier (project ID, topic name, space name, etc.) that gets embedded in a URL …
- Distinctive: line 164
When adding a new helper or CLI command:
- Distinctive: line 175
Use these labels to categorize pull requests and issues:
- Very specific: line 239
All variables can also live in a .env file (loaded via dotenvy).
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
Project Overview
gws is a Rust CLI tool for interacting with Google Workspace APIs. It dynamically generates its command surface at runtime by parsing Google Discovery Service JSON documents.
[!IMPORTANT] Dynamic Discovery: This project does NOT use generated Rust crates (e.g.,
google-drive3) for API interaction. Instead, it fetches the Discovery JSON at runtime and buildsclapcommands dynamically. When adding a new service, you only need to register it incrates/google-workspace/src/services.rsand verify the Discovery URL pattern incrates/google-workspace/src/discovery.rs. Do NOT add new crates toCargo.tomlfor standard Google APIs.
[!NOTE] Package Manager: Use
pnpminstead ofnpmfor Node.js package management in this repository.
Build & Test
[!IMPORTANT] Test Coverage: The
codecov/patchcheck requires that new or modified lines are covered by tests. When adding code, extract testable helper functions rather than embedding logic inmain/runwhere it's hard to unit-test. Runcargo testlocally and verify new branches are exercised.
cargo build # Build in dev mode
cargo clippy -- -D warnings # Lint check
cargo test # Run testsChangesets
Every PR must include a changeset file. Create one at .changeset/<descriptive-name>.md:
---
"@googleworkspace/cli": patch
---
Brief description of the changeUse patch for fixes/chores, minor for new features, major for breaking changes. The CI policy check will fail without a changeset.
Architecture
The CLI uses a two-phase argument parsing strategy:
- Parse argv to extract the service name (e.g.,
drive) - Fetch the service's Discovery Document, build a dynamic
clap::Commandtree, then re-parse
Workspace Layout
The repository is a Cargo workspace with two crates:
| Crate | Package | Purpose |
crates/google-workspace/ | google-workspace | Publishable library — core types and helpers |
crates/google-workspace-cli/ | google-workspace-cli | Binary crate — the gws CLI |
Library (crates/google-workspace/src/)
| File | Purpose |
discovery.rs | Serde models for Discovery Document + async fetch/cache |
services.rs | Service alias → Discovery API name/version mapping |
error.rs | GwsError enum, exit codes, JSON serialization |
validate.rs | Path/URL/resource validators, encode_path_segment() |
client.rs | HTTP client with retry logic |
CLI (crates/google-workspace-cli/src/)
| File | Purpose |
main.rs | Entrypoint, two-phase CLI parsing, method resolution |
auth.rs | OAuth2 token acquisition via env vars, encrypted credentials, or ADC |
credential_store.rs | AES-256-GCM encryption/decryption of credential files |
auth_commands.rs | gws auth subcommands: login, logout, setup, status, export |
commands.rs | Recursive clap::Command builder from Discovery resources |
executor.rs | HTTP request construction, response handling, schema validation |
schema.rs | gws schema command — introspect API method schemas |
logging.rs | Opt-in structured logging (stderr + file) via tracing |
timezone.rs | Account timezone resolution: --timezone flag, Calendar Settings API |
Demo Videos
Demo recordings are generated with VHS (.tape files).
vhs docs/demo.tapeVHS quoting rules
- Use double quotes for simple strings:
Type "gws --help" Enter - Use backtick quotes when the typed text contains JSON with double quotes:
Type `gws drive files list --params '{"pageSize":5}'` Enter\"escapes inside double-quotedTypestrings are not supported by VHS and will cause parse errors.
Scene art
ASCII art title cards live in art/. The scripts/show-art.sh helper clears the screen and cats the file. Portrait scenes use scene*.txt; landscape chapters use long-*.txt.
Input Validation & URL Safety
[!IMPORTANT] This CLI is frequently invoked by AI/LLM agents. Always assume inputs can be adversarial — validate paths against traversal (
../../.ssh), restrict format strings to allowlists, reject control characters, and encode user values before embedding them in URLs.
[!NOTE] Environment variables are trusted inputs. The validation rules above apply to CLI arguments that may be passed by untrusted AI agents. Environment variables (e.g.
GOOGLE_WORKSPACE_CLI_CONFIG_DIR) are set by the user themselves — in their shell profile,.envfile, or deployment config — and are not subject to path traversal validation. This is consistent with standard conventions likeXDG_CONFIG_HOME,CARGO_HOME, etc.
Path Safety (crates/google-workspace/src/validate.rs)
When adding new helpers or CLI flags that accept file paths, always validate using the shared helpers:
| Scenario | Validator | Rejects |
File path for writing (--output-dir) | validate::validate_safe_output_dir() | Absolute paths, ../ traversal, symlinks outside CWD, control chars |
File path for reading (--dir) | validate::validate_safe_dir_path() | Absolute paths, ../ traversal, symlinks outside CWD, control chars |
Enum/allowlist values (--msg-format) | clap value_parser (see gmail/mod.rs) | Any value not in the allowlist |
// In your argument parser:
if let Some(output_dir) = matches.get_one::<String>("output-dir") {
crate::validate::validate_safe_output_dir(output_dir)?;
builder.output_dir(Some(output_dir.clone()));
}URL Encoding (crates/google-workspace-cli/src/helpers/mod.rs)
User-supplied values embedded in URL path segments must be percent-encoded. Use the shared helper:
// CORRECT — encodes slashes, spaces, and special characters
let url = format!(
"https://www.googleapis.com/drive/v3/files/{}",
crate::helpers::encode_path_segment(file_id),
);
// WRONG — raw user input in URL path
let url = format!("https://www.googleapis.com/drive/v3/files/{}", file_id);For query parameters, use reqwest's .query() builder which handles encoding automatically:
// CORRECT — reqwest encodes query values
client.get(url).query(&[("q", user_query)]).send().await?;
// WRONG — manual string interpolation in query strings
let url = format!("{}?q={}", base_url, user_query);Resource Name Validation (crates/google-workspace-cli/src/helpers/mod.rs)
When a user-supplied string is used as a GCP resource identifier (project ID, topic name, space name, etc.) that gets embedded in a URL path, validate it first:
// Validates the string does not contain path traversal segments (`..`), control characters, or URL-breaking characters like `?` and `#`.
let project = crate::validate::validate_resource_name(&project_id)?;
let url = format!("https://pubsub.googleapis.com/v1/projects/{}/topics/my-topic", project);This prevents injection of query parameters, path traversal, or other malicious payloads through resource name arguments like --project or --space.
Checklist for New Features
When adding a new helper or CLI command:
- File paths → Use
validate_safe_output_dir/validate_safe_dir_path - Enum flags → Constrain via clap
value_parserorvalidate_msg_format - URL path segments → Use
encode_path_segment() - Query parameters → Use reqwest
.query()builder - Resource names (project IDs, space names, topic names) → Use
validate_resource_name() - Write tests for both the happy path AND the rejection path (e.g., pass
../../.sshand assertErr)
PR Labels
Use these labels to categorize pull requests and issues:
area: discovery— Discovery document fetching, caching, parsingarea: http— Request execution, URL building, response handlingarea: docs— README, contributing guides, documentationarea: tui— Setup wizard, picker, input fieldsarea: distribution— Nix flake, npm packaging, GitHub Actions release workflow, install methodsarea: auth— OAuth, credentials, multi-account, ADCarea: skills— AI skill generation and management
Helper Commands (+verb)
Helpers are handwritten commands prefixed with + that provide value the schema-driven Discovery commands cannot: multi-step orchestration, format translation (e.g., Markdown → Docs JSON), or multi-API composition.
[!IMPORTANT] Do NOT add a helper that wraps a single API call already available via Discovery, adds flags to expose data already in the API response, or re-implements Discovery parameters as custom flags. Helper flags must control orchestration logic — use
--paramsand--format/jqfor API parameters and output filtering.
See src/helpers/README.md for full guidelines, anti-patterns, and a checklist for new helpers.
Environment Variables
Authentication
| Variable | Description |
GOOGLE_WORKSPACE_CLI_TOKEN | Pre-obtained OAuth2 access token (highest priority; bypasses all credential file loading) |
GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE | Path to OAuth credentials JSON (no default; if unset, falls back to encrypted credentials in ~/.config/gws/) |
GOOGLE_WORKSPACE_CLI_KEYRING_BACKEND | Keyring backend: keyring (default, uses OS keyring with file fallback) or file (file only, for Docker/CI/headless) |
| GOOGLE_APPLICATION_CREDENTIALS | Standard Google ADC path; used as fallback when no gws-specific credentials are configured |
Configuration
| Variable | Description |
GOOGLE_WORKSPACE_CLI_CONFIG_DIR | Override the config directory (default: ~/.config/gws) |
OAuth Client
| Variable | Description |
GOOGLE_WORKSPACE_CLI_CLIENT_ID | OAuth client ID (for gws auth login when no client_secret.json is saved) |
GOOGLE_WORKSPACE_CLI_CLIENT_SECRET | OAuth client secret (paired with CLIENT_ID above) |
Sanitization (Model Armor)
| Variable | Description |
GOOGLE_WORKSPACE_CLI_SANITIZE_TEMPLATE | Default Model Armor template (overridden by --sanitize flag) |
GOOGLE_WORKSPACE_CLI_SANITIZE_MODE | warn (default) or block |
Helpers
| Variable | Description |
GOOGLE_WORKSPACE_PROJECT_ID | GCP project ID override for quota/billing and fallback for helper commands (overridden by --project flag) |
Logging
| Variable | Description |
GOOGLE_WORKSPACE_CLI_LOG | Log level filter for stderr output (e.g., gws=debug). Off by default. |
GOOGLE_WORKSPACE_CLI_LOG_FILE | Directory for JSON-line log files with daily rotation. Off by default. |
All variables can also live in a .env file (loaded via dotenvy).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

