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
fix(adapters/detect): full 14-platform PLATFORM_ENV_VARS audit + opencode-plugin DRY
PR #376 follow-up. mikij flagged that src/opencode-plugin.ts hardcoded a
KILO_PID-only check that violated DRY against PLATFORM_ENV_VARS. Audit of
the canonical list itself surfaced the broader problem: half of the entries
were unverified placeholders, 4 platforms (antigravity, zed, pi, openclaw)
were entirely missing or incorrectly listed, and the plugin paradigm's
fallback to "opencode" was blind (didn't actively check OPENCODE env vars).
What ships
- Re-audited every entry against the platform's own runtime source code:
- kilo: dropped bare `KILO` (Kilo-Org/kilocode never sets it; only KILO_PID
is set unconditionally at packages/opencode/src/index.ts:140).
- jetbrains-copilot: dropped IDEA_HOME and JETBRAINS_CLIENT_ID (no
source-line evidence in any JetBrains repo). Kept IDEA_INITIAL_DIRECTORY.
- qwen-code: dropped QWEN_SESSION_ID (0 hits in QwenLM/qwen-code).
- openclaw: removed entirely from env-var tier (runtime never sets
OPENCLAW_HOME/OPENCLAW_CLI). Detection falls through to ~/.openclaw/
config-dir tier, which already worked.
- Added 3 new platforms with verified env vars:
- antigravity: ANTIGRAVITY_CLI_ALIAS — verified in Google's
google-gemini/gemini-cli packages/core/src/ide/detect-ide.ts (canonical
IDE detection map). Listed before vscode-copilot since Antigravity is an
Electron/VSCode fork.
- zed: ZED_SESSION_ID + ZED_TERM — verified in zed-industries/zed
crates/terminal/src/terminal.rs `insert_zed_terminal_env()` and
cross-confirmed by Google's gemini-cli detect-ide.ts.
- pi: PI_PROJECT_DIR — confirmed by our own consumers at
src/pi-extension.ts:154 and src/server.ts:153.
- Reordered fork pairs so collision detection works:
- kilo before opencode (Kilo sets OPENCODE=1 because it's an OpenCode fork).
- cursor + antigravity before vscode-copilot (both inherit VSCODE_PID).
- src/opencode-plugin.ts getPlatform() rewritten to iterate
PLATFORM_ENV_VARS instead of hardcoding KILO_PID. Filters to kilo+opencode
so a stray CLAUDE_PROJECT_DIR can't leak into the plugin's platform decision.
Symmetric: actively checks BOTH platform's env vars instead of blind
fallback. Per-line JSDoc credits PR #376 (mikij).
Tests
- tests/adapters/detect.test.ts: removed 5 broken assertions for unverified
env vars; added 4 assertions for new platforms (antigravity, zed×2, pi)
and a fork-collision test (KILO_PID + OPENCODE both set → kilo wins).
- tests/adapters/detect-config-dir.test.ts: rewrote priority chain from
OPENCLAW/CODEX assertions to fork-collision assertions
(KILO/OPENCODE, CURSOR/VSCODE, ANTIGRAVITY/VSCODE, CURSOR/CODEX).
Verification
- 451/451 adapter + plugin tests pass on next worktree.
- Typecheck clean.
Co-Authored-By: Mickey Lazarevic <noreply@github.com>
0 commit comments