Skip to content

feat(providers): add 1-click local CLI/IDE import modal for Antigravity - #18181

Open
ziuus wants to merge 16 commits into
cheaper-inference:release/v3.8.53from
ziuus:feat/antigravity-local-import
Open

ziuus wants to merge 16 commits into
cheaper-inference:release/v3.8.53from
ziuus:feat/antigravity-local-import

Conversation

@ziuus

@ziuus ziuus commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds an Import auth connection option and modal for Antigravity (agy / Google Cloud Code), mirroring the existing local import patterns for Codex and Claude CLI.

Related Issues

Changes

  1. Multi-source local detection cascade (src/lib/oauth/utils/agyAuthImport.ts):
    • Probes Linux Secret Service keyring via secret-tool (service=gemini, username=antigravity)
    • Checks AGY_TOKEN_FILE env override
    • Scans standard CLI paths (~/.gemini/antigravity-cli/, ~/.config/agentcontrol/profiles/*/)
    • Scans Antigravity IDE SQLite state database (state.vscdb)
  2. Backend auto-detection (src/app/api/providers/agy-auth/apply-local/route.ts):
    • Migrated from hardcoded single-file read to detectLocalAgyTokenRaw cascade.
  3. Import modal & UI buttons (ImportAgyAuthModal.tsx, ConnectionsHeaderToolbar.tsx, EmptyConnectionsPlaceholder.tsx):
    • Added 1-Click Local CLI / IDE detection tab
    • Added single file upload & paste tab
    • Added bulk JSON import tab
    • Wired modal state into ProviderDetailPageClient and ProviderModalsPanel.
  4. Unit tests (tests/unit/agy-auth-import.test.ts):
    • 7/7 tests passing including detectLocalAgyTokenRaw suite.

@ziuus
ziuus requested a review from diegosouzapw as a code owner October 26, 2026 01:42

@NabiBukhsh-AI NabiBukhsh-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this @ziuus I took a look through the changes and noticed a few edge cases and repository conventions that might help get this merged smoothly:

1. Missing Changelog Fragment

OmniRoute requires a changelog fragment for new features. Adding one under changelog.d/features/18181-antigravity-local-import.md will keep the CI checks green.

2. Scope Creep in bin/cli/

There are changes included in bin/cli/commands/doctor.mjs, runtime.mjs, setup-claude.mjs, and nativeDeps.mjs regarding better-sqlite3 and npm install-scripts. Extracting these into a separate PR will keep this PR atomic and easier for maintainers to review.

3. Cross-Platform Path Detection in agyAuthImport.ts

In detectLocalAgyTokenRaw():

  • The path check for state.vscdb currently only checks Linux paths (~/.config/Antigravity/...).
  • On macOS, Antigravity/VS Code stores user state in: ~/Library/Application Support/Antigravity/User/globalStorage/state.vscdb
  • On Windows, it is under: %APPDATA%\Antigravity\User\globalStorage\state.vscdb
    Adding platform-aware path resolution (process.platform === 'darwin', etc.) will allow macOS and Windows users to use local import as well.

4. Direct sqlite3 CLI Invocation

await execFileAsync("sqlite3", [dbPath, ...]) relies on the host having the sqlite3 CLI binary installed on $PATH. On systems without the command-line tool installed, this will throw ENOENT. Since OmniRoute already bundles better-sqlite3, reading the SQLite DB directly or adding a fallback prevents silent detection failures.

5. i18n Sync

New keys were added to src/i18n/messages/en.json. Running npm run i18n:sync will keep the other locale dictionaries synchronized so docs/i18n checks pass.

- Add detectLocalAgyTokenRaw cascade supporting Linux Secret Service keyring, AGY_TOKEN_FILE, default paths, and IDE SQLite database
- Update /api/providers/agy-auth/apply-local route to use multi-source auto-detection
- Add ImportAgyAuthModal with 1-click local detection, single file/paste, and bulk import
- Add 'Import auth' buttons to ConnectionsHeaderToolbar and EmptyConnectionsPlaceholder
- Wire modal state in ProviderDetailPageClient and ProviderModalsPanel
- Add unit tests for detectLocalAgyTokenRaw (7/7 pass)
@ziuus
ziuus force-pushed the feat/antigravity-local-import branch from 9fe942e to db37b5a Compare October 26, 2026 14:00
@ziuus

ziuus commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the thorough review @NabiBukhsh-AI! All 5 points have been addressed in the latest update:

  1. Changelog Fragment: Added changelog.d/features/18181-antigravity-local-import.md following the repo convention.
  2. Scope Creep in bin/cli/: Rebased cleanly onto upstream release/v3.8.50, completely dropping all unrelated changes in bin/cli/.
  3. Cross-Platform Path Detection: Added platform-aware state.vscdb paths for macOS (~/Library/Application Support/Antigravity/...), Windows (%APPDATA%\Antigravity\...), and Linux.
  4. SQLite Execution: Integrated OmniRoute's driverFactory (tryOpenSync) with graceful fallback to sqlite3 CLI, avoiding ENOENT on systems without the command-line tool installed.
  5. i18n Sync: Synchronized all 42 locale message dictionaries via npm run i18n:sync-ui.

All unit tests pass (7/7). Ready for review!

…l import

- Add changelog fragment changelog.d/features/18181-antigravity-local-import.md
- Add cross-platform state.vscdb paths for macOS, Windows, and Linux
- Use driverFactory with graceful sqlite3 fallback avoiding ENOENT
- Sync UI localization dictionaries via i18n:sync-ui
@ziuus
ziuus force-pushed the feat/antigravity-local-import branch from db37b5a to 4565bb6 Compare October 26, 2026 14:03
@ziuus

ziuus commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

Addressed all 5 review points in commit 4565bb6:

  1. Changelog Fragment: Added changelog.d/features/18181-antigravity-local-import.md following repo conventions; verified with npm run check:changelog-integrity.
  2. Scope Isolation: Rebased cleanly on top of ci-upstream/release/v3.8.50, eliminating the 3 unrelated bin/cli/ commits from this PR.
  3. Cross-Platform Path Resolution: Added getAntigravityIdeDbCandidates() resolving platform-aware paths for macOS (Library/Application Support), Windows (%APPDATA%), and Linux (${XDG_CONFIG_HOME:-~/.config}).
  4. SQLite Reading: Extracted DB access via driverFactory (better-sqlite3 / node:sqlite) with graceful fallback to sqlite3 CLI so systems without the CLI binary installed do not fail with ENOENT.
  5. i18n Dictionaries: Synced importAgyAuth across all 42 locale dictionaries via npm run i18n:sync-ui.

All unit tests pass (node --test tests/unit/agy-auth-import.test.ts — 10/10 passing).

ziuus and others added 3 commits October 29, 2026 01:37
Resolves the agyAuthImport.ts import conflict by keeping the release's @/lib/db/providers import (no localDb barrel, Hard Rule #2) and restores every non-English locale catalog to the release side, dropping the stale v3.8.50 key re-orderings and the pt-BR __MISSING__ marker; in.json was removed on the release.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
…e Antigravity import modal

- detectLocalAgyTokenRaw no longer reads the Antigravity IDE state.vscdb: its apiKey was stored as both access and refresh token without a verified payload shape; the cascade is split into small helpers (AGY_TOKEN_FILE, keyring with refresh token, CLI token files, AgentControl profiles) and keeps the static no_local_login message.
- ImportAgyAuthModal routes every label and toast through t() (46 new providers.agyImport* keys, translated in all 66 locales), uses the kit SegmentedControl/Input/Textarea/Checkbox and is split into tab components and hooks under the complexity ratchets.
- Tests: AGY_TOKEN_FILE is restored with delete when it was unset; new cases for the 404 no_local_login path with an isolated HOME, the default CLI token file, the IDE database being ignored, and the apply-local route (404 and malformed body).

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
@ziuus
ziuus changed the base branch from release/v3.8.50 to release/v3.8.53 October 30, 2026 06:01

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(providers): 1-click local CLI/IDE account import for Antigravity (agy)

2 participants