{"id":48997946,"url":"https://github.com/vibheksoni/opencode-antigravity-auth","last_synced_at":"2026-04-23T22:00:41.634Z","repository":{"id":351928566,"uuid":"1213043214","full_name":"vibheksoni/opencode-antigravity-auth","owner":"vibheksoni","description":"Antigravity auth, headless bridge, account rotation, quota tooling, and runtime metadata for OpenCode on Windows.","archived":false,"fork":false,"pushed_at":"2026-04-20T20:09:11.000Z","size":458,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-22T21:03:38.449Z","etag":null,"topics":["account-rotation","ai-tooling","antigravity","auth-plugin","claude","developer-tools","gemini","google-oauth","headless","language-server","llm","oauth","oauth2","opencode","opencode-plugin","plugin","quota-management","runtime-metadata","typescript","windows"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vibheksoni.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-17T01:45:21.000Z","updated_at":"2026-04-22T01:36:41.000Z","dependencies_parsed_at":"2026-04-22T21:00:42.030Z","dependency_job_id":null,"html_url":"https://github.com/vibheksoni/opencode-antigravity-auth","commit_stats":null,"previous_names":["vibheksoni/opencode-antigravity-auth"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vibheksoni/opencode-antigravity-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vibheksoni%2Fopencode-antigravity-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vibheksoni%2Fopencode-antigravity-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vibheksoni%2Fopencode-antigravity-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vibheksoni%2Fopencode-antigravity-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vibheksoni","download_url":"https://codeload.github.com/vibheksoni/opencode-antigravity-auth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vibheksoni%2Fopencode-antigravity-auth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32200159,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-23T20:19:26.138Z","status":"ssl_error","status_checked_at":"2026-04-23T20:19:23.520Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["account-rotation","ai-tooling","antigravity","auth-plugin","claude","developer-tools","gemini","google-oauth","headless","language-server","llm","oauth","oauth2","opencode","opencode-plugin","plugin","quota-management","runtime-metadata","typescript","windows"],"created_at":"2026-04-18T17:38:04.463Z","updated_at":"2026-04-23T22:00:41.570Z","avatar_url":"https://github.com/vibheksoni.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# opencode-antigravity-auth\n\nAntigravity auth and runtime plugin for OpenCode.\n\nThis repo contains the current local implementation for:\n\n- Google OAuth login against Antigravity-compatible flows\n- multi-account persistence and rotation\n- Cloud Code endpoint routing\n- runtime Antigravity metadata extraction from the local app\n- runtime model discovery with safe fallback behavior\n\n## Overview\n\nThe plugin is designed to make OpenCode behave more like the local Antigravity IDE integration.\n\nCurrent focus areas:\n\n- `google-auth-library` OAuth flow instead of a hand-rolled exchange path\n- dynamic localhost OAuth callback port\n- support for both the standard and GCP ToS OAuth client pairs\n- local app metadata extraction from the installed Antigravity app before falling back to baked-in defaults\n- Antigravity runtime model discovery without breaking when discovery is denied\n\n## Install\n\n### 1. Clone the repo\n\n```powershell\ngit clone https://github.com/vibheksoni/opencode-antigravity-auth.git\ncd opencode-antigravity-auth\n```\n\n### 2. Install dependencies\n\n```powershell\n$env:NODE_ENV=''\nnpm install --include=dev\n```\n\n### 3. Build the plugin\n\n```powershell\nbun run build\n```\n\n## Setup In OpenCode\n\n### 1. Add the plugin to your OpenCode config\n\nAdd the local plugin path to your OpenCode config.\n\nExample:\n\n```json\n{\n  \"plugin\": [\n    \"path/to/opencode-antigravity-auth\"\n  ]\n}\n```\n\n### 2. Start OpenCode\n\n```powershell\nopencode\n```\n\n### 3. Authenticate\n\nInside OpenCode:\n\n```powershell\nopencode auth login\n```\n\nChoose:\n\n1. Provider: `google`\n2. Method: `OAuth with Google (Antigravity)`\n3. OAuth client: `Standard` or `GCP ToS`\n\n### 4. Verify the provider registry\n\n```powershell\nopencode models google\n```\n\n## Standalone Account Helper\n\nIf you want a direct account flow outside the OpenCode auth menu, use the helper CLI after building.\n\nExamples:\n\n```powershell\nbun run account\nbun run account -- --no-browser\nbun run account -- --gcp-tos\n```\n\nAvailable commands:\n\n```powershell\nbun run account -- help\nbun run account -- list\nbun run account -- clear\n```\n\n## Current Behavior\n\n### OAuth\n\nThe plugin now uses `google-auth-library` for:\n\n- auth URL generation\n- authorization code exchange\n- token refresh\n\nIt also supports:\n\n- dynamic localhost callback ports\n- standard Antigravity OAuth client pair\n- GCP ToS OAuth client pair\n\n### Local App Metadata Extraction\n\nAt startup the plugin tries to discover live Antigravity runtime metadata from the local app.\n\nSources checked:\n\n- installed Antigravity app\n- local formatted app copy\n- explicit override via `OPENCODE_ANTIGRAVITY_APP_DIR`\n\nIt extracts:\n\n- `product.json` `ideVersion`\n- OAuth client IDs and secrets from `out/main.js`\n\nFallback order:\n\n1. local app metadata\n2. explicit environment variables\n3. remote version fetch for version only\n4. current baked-in non-sensitive defaults\n\nSupported environment overrides:\n\n- `OPENCODE_ANTIGRAVITY_APP_DIR`\n- `OPENCODE_ANTIGRAVITY_CLIENT_ID`\n- `OPENCODE_ANTIGRAVITY_CLIENT_SECRET`\n- `OPENCODE_ANTIGRAVITY_GCP_TOS_CLIENT_ID`\n- `OPENCODE_ANTIGRAVITY_GCP_TOS_CLIENT_SECRET`\n\n### Model Handling\n\nThe plugin uses two model sources:\n\n- static fallback provider models already present in the Google provider config\n- runtime-discovered Antigravity models from `fetchAvailableModels`\n\nImportant behavior:\n\n- runtime-discovered models are merged into the provider registry\n- if discovery fails or returns `403`, the static fallback catalog is kept\n- runtime-discovered entries are converted into full OpenCode provider model objects\n\n## Important Files\n\n| File | Purpose |\n| --- | --- |\n| `src/plugin.ts` | Main plugin auth/provider/runtime flow |\n| `src/antigravity/oauth.ts` | OAuth URL generation and token exchange |\n| `src/plugin/token.ts` | Refresh flow |\n| `src/plugin/project.ts` | Project bootstrap and `loadCodeAssist` handling |\n| `src/plugin/cloud-code.ts` | Cloud Code endpoint selection |\n| `src/plugin/runtime-metadata.ts` | Local app metadata extraction |\n| `src/plugin/model-catalog.ts` | Runtime model discovery |\n| `src/plugin/account-persistence.ts` | Shared account save and dedupe logic |\n| `src/cli/account.ts` | Standalone account helper |\n\n## Build And Test\n\nBuild:\n\n```powershell\n$env:NODE_ENV=''\nbun run build\n```\n\nFull test run:\n\n```powershell\nbun test\n```\n\nTargeted test run:\n\n```powershell\nbun test src/plugin/auth.test.ts\nbun test src/plugin/model-catalog.test.ts\nbun test src/plugin/request.test.ts\n```\n\n## Current Limitations\n\nThis plugin is closer to the local Antigravity app than older versions, but it is still not a byte-for-byte recreation.\n\nKnown remaining gaps:\n\n- enterprise admin-controls UX is not fully mirrored\n- project-picker UX is not fully recreated\n- some Antigravity UI and state-sync behavior is still app-specific\n\n## Safety\n\nThis is unofficial integration code.\n\n- upstream app behavior can change\n- local app metadata extraction is best-effort\n- fallback paths are intentionally kept so the plugin still works when extraction fails\n\n## Acknowledgements\n\nCredit to the original work at [NoeFabris/opencode-antigravity-auth](https://github.com/NoeFabris/opencode-antigravity-auth).\n\nThat repo is outdated relative to this codebase. This version has diverged significantly and adds substantial fixes and improvements, including the newer OAuth flow, local app metadata extraction, runtime model handling, Windows-focused workflow support, and continued local maintenance.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvibheksoni%2Fopencode-antigravity-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvibheksoni%2Fopencode-antigravity-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvibheksoni%2Fopencode-antigravity-auth/lists"}