Commit Graph

148 Commits

Author SHA1 Message Date
googleworkspace-bot 643fb7a951 chore: release versions (#313)
Release / plan (push) Has been cancelled
Release / build-global-artifacts (push) Has been cancelled
Release / host (push) Has been cancelled
Release / publish-npm (push) Has been cancelled
Release / announce (push) Has been cancelled
Release / build-local-artifacts (${{ join(matrix.targets, ', ') }}) (push) Has been cancelled
v0.8.1
2026-03-08 18:26:33 -06:00
github-actions[bot] 6f67da39b6 style: cargo fmt 2026-03-09 00:21:14 +00:00
Shane Huntley 4d41e52198 fix(auth): prioritize local project configuration over global ADC for quota attribution (#295)
* fix(auth): prioritize local project configuration over global ADC for quota attribution

* chore: add changeset for project ID priority fix
2026-03-08 18:20:56 -06:00
googleworkspace-bot 95bb24e9c2 chore: release versions (#277)
Release / plan (push) Has been cancelled
Release / build-global-artifacts (push) Has been cancelled
Release / build-local-artifacts (${{ join(matrix.targets, ', ') }}) (push) Has been cancelled
Release / host (push) Has been cancelled
Release / publish-npm (push) Has been cancelled
Release / announce (push) Has been cancelled
v0.8.0
2026-03-06 18:31:47 -07:00
Steve Bazyl dd3fc9074d fix!: Remove MCP server mode (#275)
* BREAKING CHANGE: Remove MCP server mode

* Add changeset file
2026-03-06 11:33:23 -07:00
googleworkspace-bot 59ad87327b chore: release versions (#243)
Release / plan (push) Has been cancelled
Release / build-global-artifacts (push) Has been cancelled
Release / build-local-artifacts (${{ join(matrix.targets, ', ') }}) (push) Has been cancelled
Release / host (push) Has been cancelled
Release / publish-npm (push) Has been cancelled
Release / announce (push) Has been cancelled
v0.7.0
2026-03-05 19:54:41 -08:00
Justin Poehnelt d34576c5c7 chore: Remove a subset of skills and recipes along with their service entries and registry references (#254) 2026-03-05 19:51:59 -08:00
Justin Poehnelt d6372105eb feat!: remove multi-account, DWD, and impersonation support (#253)
* feat!: remove multi-account, DWD, and impersonation support

BREAKING CHANGE: Remove domain-wide delegation, multi-account support,
and impersonation from the CLI authentication flow.

Removed:
- `gws auth list` and `gws auth default` commands
- `--account` flag from `gws auth login` and `gws auth logout`
- `GOOGLE_WORKSPACE_CLI_ACCOUNT` env var
- `GOOGLE_WORKSPACE_CLI_IMPERSONATED_USER` env var
- Per-account credential storage (accounts.json registry)
- Service account impersonation (subject/DWD)

Preserved:
- `GOOGLE_WORKSPACE_CLI_TOKEN` (raw access token)
- `GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE` (SA key path)
- `GOOGLE_WORKSPACE_CLI_CLIENT_ID` / `CLIENT_SECRET` (OAuth config)
- `GOOGLE_WORKSPACE_CLI_CONFIG_DIR` (config dir override)

* chore: update changeset description

* docs: remove multi-account and DWD references from docs

---------

Co-authored-by: jpoehnelt-bot <jpoehnelt-bot@users.noreply.github.com>
2026-03-05 22:43:43 -05:00
Steve Bazyl e1505afe12 chore: Remove dwd support (#250)
* chore: Remove dwd support

* Add changeset file

* chore: regenerate skills [skip ci]

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-03-05 19:26:27 -08:00
Justin Poehnelt a38f313d3c docs: add note 2026-03-05 19:15:15 -08:00
Adeel Khan 54b3b31728 fix: quota header discovery (#242) 2026-03-05 18:03:20 -08:00
Sean G 6b150d4ec7 fix: use .zip for Windows npm installer to fix Git Bash install failure (#240)
The Windows npm installer was configured to use .tar.gz archives, which
routes through the system tar binary. In Git Bash on Windows, MSYS tar
interprets "C:" in Windows paths as a remote hostname, causing:

  tar: Cannot connect to C: resolve failed

Changing to .zip routes through the existing PowerShell Expand-Archive
code path in binary-install.js, which handles Windows paths correctly
and works in both PowerShell and Git Bash.

Fixes #152
2026-03-05 18:02:30 -08:00
googleworkspace-bot f07dd2b2c9 chore: release versions (#228)
Release / plan (push) Has been cancelled
Release / build-global-artifacts (push) Has been cancelled
Release / build-local-artifacts (${{ join(matrix.targets, ', ') }}) (push) Has been cancelled
Release / host (push) Has been cancelled
Release / publish-npm (push) Has been cancelled
Release / announce (push) Has been cancelled
v0.6.3
2026-03-05 16:49:35 -08:00
Justin Poehnelt 88353fd81b chore: fix changeset package names 2026-03-05 17:42:14 -07:00
Andrew Barnes a2cc523e3a fix: add x86_64-unknown-linux-musl build target for npm install (#112)
When glibc isn't compatible (Alpine, NixOS, Docker scratch images),
the npm install script falls back to a static musl binary. However,
no musl target was configured in dist-workspace.toml, causing the
fallback to fail with "Platform not supported".

Fixes #86
2026-03-05 16:33:39 -08:00
Frank c86b964de4 fix: respect account selection in MCP server and CLI --account flag (#223)
* fix: respect account selection in MCP server and CLI --account flag (#221, #181)

MCP server now reads GOOGLE_WORKSPACE_CLI_ACCOUNT env var and passes it
to get_token instead of always using None (default account).

CLI filter_args_for_subcommand now dynamically locates the service name
instead of hardcoding skip(2), fixing --account before service name
causing unrecognized subcommand errors.

* fix: skip --api-version in first_arg detection

The first_arg loop only skipped --account but not --api-version,
so `gws --api-version v3 drive ...` would misidentify --api-version
as the service name. Now both global flags are consistently skipped.
2026-03-05 16:31:57 -08:00
Justin Poehnelt 322529d8a9 fix: document all environment variables and enable CONFIG_DIR override (#222)
* docs: document all environment variables and enable CONFIG_DIR override (#171)

* docs: clarify env vars are trusted inputs in AGENTS.md

* chore: add Gemini Code Assist style guide

---------

Co-authored-by: jpoehnelt-bot <jpoehnelt-bot@users.noreply.github.com>
2026-03-05 16:09:01 -08:00
Shreyas Karnik 6daf90d331 fix(mcp): conditionally include body/upload in tool schemas, drop empty body on execution (#213)
* fix(mcp): conditionally include body/upload in full-mode tool schemas and drop empty body on execution

Full-mode tool schemas now only include `body` when the Discovery Document
method defines a request body, and `upload` when `supportsMediaUpload` is
true. This prevents LLMs from hallucinating these fields on GET-only methods.

Additionally, empty body objects (`{}`) are filtered out before execution
in both compact and full modes, and empty upload strings are ignored. LLMs
commonly send "body": {} on read-only methods, which causes Google APIs to
return HTTP 400.

* style: cargo fmt and add changeset for MCP tool schema fix

* fix(mcp): conditionally include page_all only for paginated methods

Only include the page_all property in full-mode tool schemas when the
method has a pageToken parameter, preventing LLMs from attempting
pagination on non-paginable methods.

* docs: update changeset to include page_all conditional change
2026-03-05 15:37:17 -08:00
github-actions[bot] 8a897e955b style: cargo fmt 2026-03-05 23:36:21 +00:00
Andrew Barnes c80eb5274d fix: replace strip_suffix(".readonly").unwrap() with unwrap_or (#192)
Two call sites in auth_commands.rs and setup_tui.rs used
.strip_suffix(".readonly").unwrap(), which panics if a scope URL
flagged as is_readonly doesn't end with ".readonly".

Replace with .unwrap_or() to gracefully fall back to the original
URL rather than crashing on inconsistent discovery data.
2026-03-05 15:35:56 -08:00
Chris Wood ff53538b9f fix: prevent gmail.metadata scope from blocking query parameters (#200)
* fix: select broadest scope instead of all method scopes

Discovery Documents list method scopes as alternatives (any one grants
access), but passing all of them to yup_oauth2 caused Google to include
restrictive scopes like gmail.metadata in the token. The API then
enforced that scope's restrictions, blocking query parameters like `q`.

Select only the first (broadest) scope from the method's scope list.

* fix: filter gmail.metadata from login scopes and remove token cache superset fallback

gmail.metadata restricts API behavior (blocks `q` parameter) even when
broader scopes are present in the token. Filter it out during login when
broader Gmail scopes like gmail.modify or mail.google.com are selected.

Also remove the superset fallback in token storage to prevent stale
all-scopes tokens from being reused when a narrower scope is requested.

* fix: apply select_scope to MCP server code path

The MCP server had the same bug as the CLI — passing all method scopes
to get_token. Use select_scope to pick only the broadest scope.

* style: fix cargo fmt formatting issues

---------

Co-authored-by: Justin Poehnelt <jpoehnelt@google.com>
2026-03-05 15:31:01 -08:00
Adeel Khan 2173a929d3 fix(client): For ADC, send x-goog-user-project header (#215)
* fix(client): send x-goog-user-project header from ADC quota project

When using Application Default Credentials with a quota_project_id set,
API requests failed with 403 because the quota project header was never
sent. Read quota_project_id from ADC and set it as a default header.

* Update src/auth.rs

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-03-05 15:29:22 -08:00
Josh 5fa5f60db5 fix: migrate to new Darwin SDK pattern in nix flake (#154)
Replace removed `darwin.apple_sdk.frameworks.Security` with `apple-sdk`,
following the nixpkgs Darwin SDK migration (NixOS/nixpkgs#354146).

Co-authored-by: joshgodsiff <josh.godsiff@gmail.com>
2026-03-05 15:09:05 -08:00
googleworkspace-bot bc84ba71a4 chore: release versions (#218) 2026-03-05 15:02:27 -08:00
jpoehnelt-bot 1f47420caa fix: extract CLA label job into dedicated workflow to prevent feedback loop 2026-03-05 16:00:49 -07:00
Justin Poehnelt 49f2e4aa79 ci: Add concurrency control to the automation workflow. 2026-03-05 15:55:10 -07:00
Joe Eftekhari 132c3b19a7 fix: warn on credential file permission failures instead of ignoring (#124)
Replaced silent `let _ =` on set_permissions calls in save_encrypted
with eprintln! warnings so users are aware if their credential files
end up with insecure permissions. Also log keyring access failures
instead of silently falling through to file storage.
2026-03-05 14:50:55 -08:00
Andrew Barnes 9a780d73d4 fix: log token cache errors instead of silently swallowing them (#193)
load_from_disk used four nested if-let-Ok blocks that silently
returned an empty HashMap on any failure. When the encryption key
rotated or the cache file was corrupted, tokens silently stopped
loading and users were forced to re-authenticate with no explanation.

Replace with explicit match arms that log specific warnings to
stderr for each failure mode:
- Decryption failure (key changed, corrupted data)
- Invalid UTF-8 in decrypted data
- JSON deserialization failure

File-not-found is still silent since that's normal on first run.
2026-03-05 14:37:29 -08:00
Justin Poehnelt 1ff5bc820f ci: use pull_request_target 2026-03-05 15:34:44 -07:00
Justin Poehnelt 28fa25a513 Clean up nits from PR #175 auth fix (#217)
- Update stale docstring on resolve_account to reflect fallthrough behavior
- Add breadcrumb comment on string-based error matching in main.rs
- Move identity scope injection before authenticator build for readability

Co-authored-by: jpoehnelt-bot <jpoehnelt-bot@users.noreply.github.com>
2026-03-05 14:31:15 -08:00
googleworkspace-bot aaa5c44c6a chore: release versions (#207)
Release / plan (push) Has been cancelled
Release / build-global-artifacts (push) Has been cancelled
Release / build-local-artifacts (${{ join(matrix.targets, ', ') }}) (push) Has been cancelled
Release / host (push) Has been cancelled
Release / publish-npm (push) Has been cancelled
Release / announce (push) Has been cancelled
v0.6.1
2026-03-05 14:30:21 -08:00
Justin Poehnelt 4b2702e539 ci: add path filtering to skip expensive jobs on non-Rust changes (#216)
- Add dorny/paths-filter to detect .rs, Cargo.toml/Lock, flake.nix/lock changes
- Gate test, lint, nix, skills, and build jobs behind change detection
- Remove duplicate coverage job (already in coverage.yml with Codecov upload)
- Main pushes always run all jobs unconditionally

Co-authored-by: jpoehnelt-bot <jpoehnelt-bot@users.noreply.github.com>
2026-03-05 14:28:17 -08:00
Harshal Patil a926e3f4c0 fix: auth failures when accounts.json registry is missing (#175)
Three related bugs caused all API calls to fail with "Access denied.
No credentials provided" even after successful `gws auth login`:

1. resolve_account() rejected valid credentials.enc as "legacy" when
   accounts.json was absent, instead of falling through to use them.

2. main.rs silently swallowed all auth errors (Err(_) => None),
   masking real failures behind a generic "no credentials" message.

3. auth login didn't include openid/email scopes, so
   fetch_userinfo_email() couldn't identify the user, causing
   credentials to be saved without an accounts.json entry.

{attribution.commit: ""}
2026-03-05 14:24:37 -08:00
Justin Poehnelt 78817b048c ci: auto-trigger Gemini Code Assist review on PR push (#209) 2026-03-05 13:54:03 -08:00
Justin Poehnelt 3d59b2e5a9 fix: isolate flaky auth tests from host ADC credentials (#208)
* fix: isolate flaky auth tests from host ADC credentials

Fixes #206

Both test_load_credentials_no_options and
test_get_token_env_var_empty_falls_through now override HOME to a
temp dir and clear GOOGLE_APPLICATION_CREDENTIALS, preventing the
well-known ADC path from matching on CI runners that have gcloud
credentials.

* refactor: use RAII EnvVarGuard for panic-safe env var cleanup in tests

- Introduce EnvVarGuard struct that saves/restores env vars on Drop
- Replace all manual save/restore patterns in auth tests
- Fix bug where test_get_token_env_var_empty_falls_through did not
  restore GOOGLE_WORKSPACE_CLI_TOKEN
- Ensures cleanup runs even if a test panics

* fix: use var_os/OsString in EnvVarGuard for non-UTF-8 safety

---------

Co-authored-by: jpoehnelt-bot <jpoehnelt-bot@users.noreply.github.com>
2026-03-05 13:48:59 -08:00
github-actions[bot] 24a25a6ee6 style: cargo fmt 2026-03-05 21:10:22 +00:00
Frank cb1f988344 fix(executor): add Content-Length: 0 for body-less POST requests (#183)
* fix(executor): add Content-Length: 0 header for body-less POST/PUT/PATCH requests

Google API servers return HTTP 411 (Length Required) when a POST request
is sent without a Content-Length header, even if there is no body.
This affects all Discovery API methods where httpMethod is POST but no
requestBody is defined (e.g. gmail users.messages.trash).

Fixes #182

* chore: add changeset for content-length fix
2026-03-05 13:10:02 -08:00
Justin Poehnelt 88cb65ce80 chore: auto triage and fmt (#204)
* chore: auto triage and fmt

* chore: address PR review — add area:core, setup.rs to auth, move formatter

---------

Co-authored-by: jpoehnelt-bot <jpoehnelt-bot@users.noreply.github.com>
2026-03-05 13:07:43 -08:00
googleworkspace-bot 0ba49d1584 chore: release versions (#199)
Release / plan (push) Has been cancelled
Release / build-global-artifacts (push) Has been cancelled
Release / build-local-artifacts (${{ join(matrix.targets, ', ') }}) (push) Has been cancelled
Release / host (push) Has been cancelled
Release / publish-npm (push) Has been cancelled
Release / announce (push) Has been cancelled
v0.6.0
2026-03-05 13:03:38 -08:00
Justin Poehnelt d4080512b1 style: cargo fmt 2026-03-05 13:54:31 -07:00
Justin Poehnelt c532ea6ad8 chore: use labels (#203) 2026-03-05 12:49:44 -08:00
zerone0x b38b760d79 feat: add Application Default Credentials (ADC) support (#125)
* feat: add Application Default Credentials (ADC) support (#103)

Extends the credential chain in get_token() to include ADC as a 4th source:
  1. GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE env var
  2. Encrypted credentials (~/.config/gws/credentials.enc)
  3. Plaintext credentials (~/.config/gws/credentials.json)
  4. ADC — GOOGLE_APPLICATION_CREDENTIALS env var, then
     ~/.config/gcloud/application_default_credentials.json

Both authorized_user and service_account ADC formats are detected via the
'type' field and parsed accordingly.  This means users can authenticate with:
  gcloud auth application-default login --client-id-file=client_secret.json

and gws will automatically pick up those credentials.

Closes #103

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(auth): address review feedback on ADC support

- Extract duplicated JSON credential parsing into parse_credential_file()
  helper to reduce duplication between GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE
  and ADC code paths; uses serde_json::from_value to avoid second string parse
- Fix well-known ADC path on macOS: dirs::config_dir() returns
  ~/Library/Application Support on macOS, not ~/.config; use
  dirs::home_dir().join('.config/gcloud/...') instead
- Hard-error when GOOGLE_APPLICATION_CREDENTIALS points to a missing file
  (was: silently fall through to 'No credentials found')
- Add test_load_credentials_adc_env_var_service_account covering service
  account credentials loaded via GOOGLE_APPLICATION_CREDENTIALS
- Remove unnecessary unsafe blocks from env var tests (set_var/remove_var
  are not unsafe functions; thread safety is already handled by serial_test)
- Update changeset to include GOOGLE_WORKSPACE_CLI_TOKEN at top of lookup
  order and clarify ADC fallback behaviour

Addresses review feedback from jpoehnelt on #125.

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-05 13:23:13 -07:00
googleworkspace-bot c6095ddb27 chore: release versions (#180)
Release / plan (push) Has been cancelled
Release / build-global-artifacts (push) Has been cancelled
Release / build-local-artifacts (${{ join(matrix.targets, ', ') }}) (push) Has been cancelled
Release / host (push) Has been cancelled
Release / publish-npm (push) Has been cancelled
Release / announce (push) Has been cancelled
v0.5.0
2026-03-05 09:56:15 -08:00
Hafez 5205467ecb fix(setup): drain stale keypresses between TUI screen transitions (#186)
* fix(setup): drain stale keypresses between TUI screen transitions

The picker's vim-style j/k navigation can leave buffered keypresses in
crossterm's event queue that leak into the next input field, corrupting
pre-populated values like client_id.

* refactor: extract drain logic into helper, add changeset
2026-03-05 09:39:05 -08:00
Justin Poehnelt 62d6ddbfa9 chore: steps to reduce contributor friction (#185)
* chore: steps to reduce contributor friction

* Update CLAUDE.md

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-03-05 09:08:50 -08:00
Justin Poehnelt 473dd30500 chore: cargo fmt 2026-03-05 09:17:50 -07:00
Frank 9cf6e0e66d feat(mcp): add compact tool mode to reduce context window usage (#172) 2026-03-05 08:17:19 -08:00
Justin Poehnelt 0a16d0bca3 fix: allow services flag for login and improve default list for consumer accounts (#177)
* feat: add -s/--services flag to auth login for scope picker filtering

* fix: restrict recommended scope template to minimal consumer scopes

* refactor: address PR review comments — dedup parsing, extract helpers, use is_none_or
2026-03-05 08:14:54 -08:00
Mattia Righetti fa04502d14 chore(docs): easier cmd to install from source (#176)
* chore(docs): easier cmd to install from source

* Apply suggestion from @gemini-code-assist[bot]

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-03-05 08:10:25 -08:00
googleworkspace-bot f6d74b0074 chore: release versions (#147)
Release / plan (push) Has been cancelled
Release / build-global-artifacts (push) Has been cancelled
Release / build-local-artifacts (${{ join(matrix.targets, ', ') }}) (push) Has been cancelled
Release / host (push) Has been cancelled
Release / publish-npm (push) Has been cancelled
Release / announce (push) Has been cancelled
v0.4.4
2026-03-05 01:14:25 -08:00