You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.MD
+72-34Lines changed: 72 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,19 +9,28 @@ OpenCode plugin for Google Antigravity OAuth. Intercepts `fetch()` calls to `gen
9
9
## Build & Test Commands
10
10
11
11
```bash
12
-
npm install # Install dependencies
13
-
npm run build # Compile (tsc -p tsconfig.build.json)
14
-
npm run typecheck # Type-check only (tsc --noEmit)
15
-
npm test# Run all tests (vitest run)
16
-
npx vitest run src/plugin/auth.test.ts # Single test file
17
-
npx vitest run -t "test name here"# Single test by name
18
-
npx vitest --watch src/plugin/auth.test.ts # Watch mode, single file
19
-
npm run test:coverage # Coverage report
20
-
npm run test:e2e:models # E2E: model availability check
21
-
npm run test:e2e:regression # E2E: regression suite
12
+
bun install # Install dependencies
13
+
bun run build # Compile (tsc -p tsconfig.build.json)
14
+
bun run typecheck # Type-check only (tsc --noEmit)
15
+
bun run test# Run all unit tests (bun test --isolate across packages)
16
+
bun test --isolate src/plugin/auth.test.ts # Single test file
17
+
bun test --isolate -t "test name here"# Single test by name (uses bun:test's -t filter)
18
+
bun test --isolate --watch src/plugin/auth.test.ts # Watch mode, single file
19
+
bun run test:e2e # Deterministic e2e flows (mock Antigravity server, no network)
20
+
bun run test:e2e:models # Live Antigravity model inventory (CI-gated, network)
21
+
bun run test:e2e:regression # Cross-model + Gemini CLI regression (network)
22
+
bun run --cwd packages/opencode smoke:tui # Pack-and-install smoke test for the TUI subpath
22
23
```
23
24
24
-
No linter or formatter is configured. Style is enforced by convention (see below).
25
+
Format and lint via Biome:
26
+
27
+
```bash
28
+
bun run format # biome format --write .
29
+
bun run format:check # biome format . (CI gate)
30
+
bun run lint # biome lint . (CI gate)
31
+
```
32
+
33
+
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`.
25
34
26
35
## TypeScript Configuration
27
36
@@ -70,7 +79,7 @@ No linter or formatter is configured. Style is enforced by convention (see below
70
79
71
80
### Formatting
72
81
- 2-space indentation
73
-
-Double quotes for strings
82
+
-Single quotes for strings (Biome `quoteStyle: single`)
74
83
- Trailing commas in multiline constructs
75
84
- No semicolons (project convention)
76
85
@@ -80,24 +89,49 @@ No linter or formatter is configured. Style is enforced by convention (see below
80
89
81
90
## Module Structure
82
91
92
+
The repository is a Bun workspace with three packages. The pre-monorepo
93
+
single-root-`src/` layout was retired when the project split into
94
+
`packages/{core,opencode,pi}` so the harness-agnostic engine, the host
95
+
adapter, and the Pi host can ship on independent cadences.
96
+
83
97
```
84
-
src/
85
-
├── plugin.ts # Main entry, fetch interceptor
86
-
├── constants.ts # Endpoints, headers, API config, system prompts
├── paths.ts # Pi AGENT_DIR + account-pool path resolution
134
+
└── stream.ts # Stream factory consumed by `index.ts`
101
135
```
102
136
103
137
## Key Design Patterns
@@ -130,15 +164,19 @@ Per-account device fingerprints stored in `antigravity-accounts.json`. Each fing
130
164
131
165
## Testing
132
166
133
-
- Framework: **Vitest 3**with native ESM
134
-
- Config: `vitest.config.ts`
135
-
- Tests colocated: `src/plugin/foo.test.ts` next to `src/plugin/foo.ts`
136
-
- Use `describe`/`it`/`expect`— standard Vitest API
137
-
- Mock with `vi.fn()`, `vi.spyOn()`, `vi.mock()`
167
+
- Framework: **Bun's test runner**(`bun test`; the `bun:test` module re-exports a jest-compatible namespace)
168
+
- 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.
169
+
- 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.
170
+
- Use `describe`/`it`/`expect`from `bun:test` — the standard API.
171
+
- 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).
0 commit comments