Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
f3c89e8
fix(plugin): drop the .gitignore self-ignore entry from GITIGNORE_ENT…
iceteaSA Jul 6, 2026
bc1a749
build: migrate workspace commands to bun
iceteaSA Jul 22, 2026
ec39690
test: migrate suites to bun with isolated paths
iceteaSA Jul 22, 2026
15dd229
build: add parity development and quality gates
iceteaSA Jul 22, 2026
37f6dbb
test: characterize oauth fingerprint plugin and streaming boundaries
iceteaSA Jul 22, 2026
de9f511
fix: bound active fetch response wait to fifteen seconds
iceteaSA Jul 22, 2026
a05cabb
feat: dispose plugin account cache and timer resources
iceteaSA Jul 22, 2026
293f942
feat(core): add atomic write and fenced file lock
iceteaSA Jul 22, 2026
62ba52f
refactor(core): centralize lock-held account storage
iceteaSA Jul 22, 2026
92afe7e
refactor(core): move account runtime and rotation primitives
iceteaSA Jul 22, 2026
796f8f6
feat(core): add attributed quota manager with backoff
iceteaSA Jul 22, 2026
f40d8d8
refactor(opencode): extract catalog command tool and routing modules
iceteaSA Jul 22, 2026
b7778db
refactor(opencode): extract oauth and auth loader orchestration
iceteaSA Jul 22, 2026
835870c
refactor(opencode): isolate fetch interception and retry state
Jul 22, 2026
a3fbb4c
refactor(opencode)!: thin composition root and 2.0.0 breaking exports
iceteaSA Jul 22, 2026
66f18eb
build(opencode): migrate host sdk to plugin v1
iceteaSA Jul 22, 2026
73d8cc1
feat(opencode): add precompiled antigravity sidebar
iceteaSA Jul 22, 2026
5bc1fd2
feat(opencode): add authenticated tui rpc
iceteaSA Jul 22, 2026
4664bf5
test(opencode): cover tui rpc notification polling
iceteaSA Jul 22, 2026
5ce34a3
feat(opencode): add antigravity command dialogs
iceteaSA Jul 22, 2026
5d06967
feat(opencode): persist freshness-merged sidebar state
iceteaSA Jul 22, 2026
a3bfdea
feat(opencode): add standalone antigravity auth cli
iceteaSA Jul 22, 2026
a5fb5cc
test(e2e): gate deterministic antigravity flows
iceteaSA Jul 22, 2026
901552f
docs: document full antigravity architecture
iceteaSA Jul 22, 2026
e5c5b6b
docs: map the complete antigravity codebase
iceteaSA Jul 22, 2026
4acdb3f
docs: complete operator and contributor guides
iceteaSA Jul 22, 2026
2001bb7
fix: address branch review musts (lock, tui isolation, e2e guard, sec…
iceteaSA Jul 22, 2026
df99127
fix: resolve remaining branch review musts (tui barrel, lock toctou, …
iceteaSA Jul 23, 2026
298522f
fix: fence quota wrapper disposal and prove lock post-rename verifica…
iceteaSA Jul 23, 2026
651f601
docs: correct false at-rest, pi-parity, and killswitch-default claims
iceteaSA Jul 23, 2026
c57b0e1
docs: escape pipes in routing and killswitch command tables
iceteaSA Jul 23, 2026
9bd0a86
fix(core): fail closed on unreadable account storage with regression …
iceteaSA Jul 23, 2026
d78f236
ci: run the scoped unit gate instead of raw bun test
iceteaSA Jul 23, 2026
8fbfba0
fix(e2e): scope temp-root cleanup to roots owned by this process
iceteaSA Jul 23, 2026
e1b8418
docs(opencode): document the supported plugin install flow
iceteaSA Jul 23, 2026
af65acf
docs: update AGENTS.MD for the bun and biome toolchain
iceteaSA Jul 23, 2026
f2fdcf4
fix(e2e): per-file scope for orphan-root sweep
iceteaSA Jul 24, 2026
6af688e
fix(core): strict per-record validation on account storage
iceteaSA Jul 24, 2026
7e8f865
fix(opencode): oauth callbacks abort on persistence failure
iceteaSA Jul 24, 2026
57a3398
docs: manual tui.json config uses singular plugin key
iceteaSA Jul 24, 2026
32403e3
chore(lint): make biome lint gate enforcing with --error-on-warnings
iceteaSA Jul 24, 2026
fa76230
docs: align module structure and trim stale references
iceteaSA Jul 24, 2026
474f61c
fix(e2e): delete temp roots after harness disposal without leaking
iceteaSA Jul 24, 2026
d35b767
fix(opencode): redact account email from sidebar state
iceteaSA Jul 23, 2026
01abdb8
fix(opencode): avoid queued command messages when tui connected
iceteaSA Jul 23, 2026
7170a53
fix(tui): keep notification cursor across remounts
iceteaSA Jul 23, 2026
a2fd982
feat(tui): fleet-parity sidebar, preferences, and data-first dialogs
iceteaSA Jul 23, 2026
8880e6e
fix(tui): use single-line border to match fleet sidebar
iceteaSA Jul 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
25 changes: 21 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,31 @@ jobs:
with:
node-version: 24

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3

- name: Install dependencies
run: npm install
run: bun install --frozen-lockfile

- name: Run type check
run: npm run typecheck
run: bun run typecheck

- name: Build
run: npm run build
run: bun run build

- name: Smoke test TUI
run: bun run --cwd packages/opencode smoke:tui

- name: Run tests
run: npm test
run: bun run test

- name: Run E2E tests
run: bun run test:e2e

- name: Check formatting
run: bun run format:check

- name: Lint
run: bun run lint
34 changes: 28 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,34 @@ jobs:
with:
node-version: "24"

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3

- name: Install dependencies
run: npm install
run: bun install --frozen-lockfile

- name: TypeScript typecheck
run: npm run typecheck
run: bun run typecheck

- name: Build
run: npm run build
run: bun run build

- name: Smoke test TUI
run: bun run --cwd packages/opencode smoke:tui

- name: Test
run: npm test
run: bun run test

- name: Run E2E tests
run: bun run test:e2e

- name: Check formatting
run: bun run format:check

- name: Lint
run: bun run lint

publish-npm:
name: Publish ${{ matrix.package }} to npm
Expand Down Expand Up @@ -72,11 +89,16 @@ jobs:
node-version: "24"
registry-url: "https://registry.npmjs.org"

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3

- name: Ensure latest npm (for trusted publishing)
run: npm install -g npm@latest

- name: Install dependencies
run: npm install
run: bun install --frozen-lockfile

- name: Resolve release version
id: version
Expand All @@ -89,7 +111,7 @@ jobs:
run: node scripts/version-sync.mjs "${{ steps.version.outputs.version }}"

- name: Build
run: npm run build
run: bun run build

- name: Check whether package version is already published
id: published
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ out
dist
*.tgz

# precompiled OpenTUI sidebar tree (regenerated by build:tui)
packages/opencode/src/tui-compiled/

# code coverage
coverage
*.lcov
Expand Down
106 changes: 72 additions & 34 deletions AGENTS.MD
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,28 @@ OpenCode plugin for Google Antigravity OAuth. Intercepts `fetch()` calls to `gen
## Build & Test Commands

```bash
npm install # Install dependencies
npm run build # Compile (tsc -p tsconfig.build.json)
npm run typecheck # Type-check only (tsc --noEmit)
npm test # Run all tests (vitest run)
npx vitest run src/plugin/auth.test.ts # Single test file
npx vitest run -t "test name here" # Single test by name
npx vitest --watch src/plugin/auth.test.ts # Watch mode, single file
npm run test:coverage # Coverage report
npm run test:e2e:models # E2E: model availability check
npm run test:e2e:regression # E2E: regression suite
bun install # Install dependencies
bun run build # Compile (tsc -p tsconfig.build.json)
bun run typecheck # Type-check only (tsc --noEmit)
bun run test # Run all unit tests (bun test --isolate across packages)
bun test --isolate src/plugin/auth.test.ts # Single test file
bun test --isolate -t "test name here" # Single test by name (uses bun:test's -t filter)
bun test --isolate --watch src/plugin/auth.test.ts # Watch mode, single file
bun run test:e2e # Deterministic e2e flows (mock Antigravity server, no network)
bun run test:e2e:models # Live Antigravity model inventory (CI-gated, network)
bun run test:e2e:regression # Cross-model + Gemini CLI regression (network)
bun run --cwd packages/opencode smoke:tui # Pack-and-install smoke test for the TUI subpath
```

No linter or formatter is configured. Style is enforced by convention (see below).
Format and lint via Biome:

```bash
bun run format # biome format --write .
bun run format:check # biome format . (CI gate)
bun run lint # biome lint . (CI gate)
```

Pre-commit hooks (`.lefthook.yml`) run Biome on changed `*.{ts,tsx,js,mjs,json,jsonc,yml,yaml}` files via `bunx biome check --staged --no-errors-on-unmatched`. The repo pins the toolchain in `mise.toml` (`bun = "1.3"`, `node = "24"`) and CI uses `oven-sh/setup-bun@v2` with `bun-version: 1.3`.

## TypeScript Configuration

Expand Down Expand Up @@ -70,7 +79,7 @@ No linter or formatter is configured. Style is enforced by convention (see below

### Formatting
- 2-space indentation
- Double quotes for strings
- Single quotes for strings (Biome `quoteStyle: single`)
- Trailing commas in multiline constructs
- No semicolons (project convention)

Expand All @@ -80,24 +89,49 @@ No linter or formatter is configured. Style is enforced by convention (see below

## Module Structure

The repository is a Bun workspace with three packages. The pre-monorepo
single-root-`src/` layout was retired when the project split into
`packages/{core,opencode,pi}` so the harness-agnostic engine, the host
adapter, and the Pi host can ship on independent cadences.

```
src/
├── plugin.ts # Main entry, fetch interceptor
├── constants.ts # Endpoints, headers, API config, system prompts
├── antigravity/oauth.ts # OAuth token exchange
└── plugin/
├── auth.ts # Token validation & refresh
├── request.ts # Request transformation (core logic)
├── request-helpers.ts # Schema cleaning, thinking filters
├── thinking-recovery.ts # Turn boundary detection
├── recovery.ts # Session recovery (tool_result_missing)
├── quota.ts # Quota checking (API usage stats)
├── cache.ts # Auth & signature caching
├── accounts.ts # Multi-account management & storage
├── storage.ts # Persistent storage schemas (Zod)
├── fingerprint.ts # Device fingerprint generation & headers
├── project.ts # Managed project context resolution
└── debug.ts # Debug logging utilities
packages/
├── core/ # Harness-agnostic engine — auth, transform, storage, fingerprinting
│ └── src/
│ ├── index.ts # Public barrel
│ ├── account-manager.ts # Per-account selection, rate-limit, quota, fingerprint
│ ├── account-storage.ts # v4 schema + lock-held read-modify-write + fail-closed unreadable
│ ├── agy-transport.ts # Bounded TLS pool, gzip/chunk decode, idle watchdog
│ ├── agy-request-metadata.ts
│ ├── antigravity/oauth.ts # OAuth token exchange + refresh
│ ├── auth.ts # Token validation helpers
│ ├── file-lock.ts # Fenced file lock for concurrent writes
│ ├── fingerprint.ts # Device fingerprint construction
│ ├── model-registry.ts # Anthropic / Gemini / GPT-OSS model definitions
│ ├── project.ts # Managed project resolution
│ ├── quota-manager.ts # Quota caching + fallbacks
│ ├── rotation.ts # Account rotation state
│ └── transform/ # Claude / Gemini / cross-model sanitizer + tests
├── opencode/ # OpenCode host adapter — plugin entry, fetch interceptor, TUI
│ └── src/
│ ├── cli.ts # `antigravity-auth` CLI (login / list / quota)
│ ├── plugin/ # Plugin factory, OAuth methods, account access, fetch
│ │ ├── fetch-interceptor.ts # Outer/inner loop, retry/quota/routing pipeline
│ │ ├── auth-loader.ts # Host `auth.loader()` integration
│ │ ├── oauth-methods.ts # OAuth menu + callbacks
│ │ ├── persist-account-pool.ts # Lock-held append after fresh OAuth login
│ │ ├── storage.ts # Host-path adapter for account pool (re-exports core errors)
│ │ └── ui/ # TUI sidebar, auth menu, quota-status, command dialogs
│ ├── tui/ # Precompiled + raw TUI sources
│ ├── rpc/ # Loopback RPC server + client (sidebar notifications)
│ └── hooks/ # Lifecycle hooks (auto-update checker, etc.)
└── pi/ # Pi host adapter — thinner facade around core
└── src/
├── index.ts # Public barrel — `streamCortexKitAntigravity` + OAuth helpers
├── convert.ts # Pi <-> Antigravity message-shape conversion
├── credential-cache.ts # Packed refresh token cache
├── paths.ts # Pi AGENT_DIR + account-pool path resolution
└── stream.ts # Stream factory consumed by `index.ts`
```

## Key Design Patterns
Expand Down Expand Up @@ -130,15 +164,19 @@ Per-account device fingerprints stored in `antigravity-accounts.json`. Each fing

## Testing

- Framework: **Vitest 3** with native ESM
- Config: `vitest.config.ts`
- Tests colocated: `src/plugin/foo.test.ts` next to `src/plugin/foo.ts`
- Use `describe`/`it`/`expect` standard Vitest API
- Mock with `vi.fn()`, `vi.spyOn()`, `vi.mock()`
- Framework: **Bun's test runner** (`bun test`; the `bun:test` module re-exports a jest-compatible namespace)
- Config: no per-package config — Bun discovers `*.test.ts` next to source. The `bunfig.toml` at the root and in each workspace preloads `test/setup.ts` (env-isolation + a per-test mkdtemp root + a `globalThis.stubbed` / `unstubAllGlobals` / `freshImport` helper). The e2e workspace uses `bunfig.toml` `root = "./src"` so its tests stay isolated from the unit workspace.
- Tests colocated: `src/plugin/foo.test.ts` next to `src/plugin/foo.ts`. The e2e workspace uses `*.e2e.test.ts` so the root `bun run test` and `bun run test:e2e` selectors can target them precisely.
- Use `describe`/`it`/`expect` from `bun:test` — the standard API.
- Mock with `mock()`, `spyOn()`, and the `jest` namespace exported from `bun:test` (`jest.fn`, `jest.spyOn`, `jest.setSystemTime`, etc.). The `test/setup.ts` preload patches `jest.setSystemTime` / `jest.useRealTimers` so they also spy on `Date.now()` (Bun's `bun:test` clock only fakes the timer queue, not the wall clock).

## Documentation

- [README.md](README.md) — Installation & usage
- [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) — Detailed architecture guide
- [docs/ANTIGRAVITY_API_SPEC.md](docs/ANTIGRAVITY_API_SPEC.md) — API reference
- [CHANGELOG.md](CHANGELOG.md) — Version history
- [ARCHITECTURE.md](ARCHITECTURE.md) and [STRUCTURE.md](STRUCTURE.md) — repo-level architecture and file-system map
- [biome.json](biome.json) — formatter + linter config
- [lefthook.yml](lefthook.yml) — pre-commit Biome hook
- [mise.toml](mise.toml) — pinned `bun` + `node` versions
Loading