mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-02 13:39:41 +02:00
Adds Antigravity as a sixth CLI backend alongside Claude Code, shell, OpenCode, Codex and Gemini, following the existing pluggable-resolver pattern. - `utils/antigravity-cli-resolver.ts` resolves the CLI, mirroring the other resolvers; `GET /api/antigravity/status` reports availability and path. - `ANTIGRAVITY_*` joins the `ALLOWED_ENV_PREFIXES` allowlist in schemas.ts, so env overrides stay CLI-scoped rather than blanket-forwarded. - Session, tmux-manager, mux-interface and types carry the new mode; secrets are injected via socket-scoped `tmux setenv`, never on the spawn command line, so the mode requires tmux with no direct PTY fallback like the other external CLIs. - Frontend: Run-dropdown entry, agent-type option, `ag` tab badge and toolbar colours. `runAntigravity()` routes remote/docker cases through `POST /api/quick-start` and skips the local status probe for them. Tests: test/antigravity-mode.test.ts, plus run-mode-ui and system-routes coverage. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
66 lines
1.9 KiB
TypeScript
66 lines
1.9 KiB
TypeScript
/**
|
|
* @fileoverview Resolve the Antigravity CLI (`agy`) binary across common install paths.
|
|
*
|
|
* Mirrors gemini-cli-resolver.ts. Google's installer (antigravity.google/cli/install.sh)
|
|
* places the binary at ~/.local/bin/agy; the other locations cover manual installs.
|
|
*
|
|
* @module utils/antigravity-cli-resolver
|
|
*/
|
|
|
|
import { execSync } from 'node:child_process';
|
|
import { existsSync } from 'node:fs';
|
|
import { dirname, join } from 'node:path';
|
|
import { homedir } from 'node:os';
|
|
import { EXEC_TIMEOUT_MS } from '../config/exec-timeout.js';
|
|
|
|
/** Common directories where the Antigravity CLI binary may be installed */
|
|
const ANTIGRAVITY_SEARCH_DIRS = [
|
|
join(homedir(), '.local', 'bin'),
|
|
join(homedir(), '.antigravity', 'bin'),
|
|
'/usr/local/bin',
|
|
join(homedir(), 'bin'),
|
|
];
|
|
|
|
/** Cached directory containing the agy binary (empty string = searched but not found) */
|
|
let _antigravityDir: string | null = null;
|
|
|
|
/**
|
|
* Finds the directory containing the `agy` binary.
|
|
* Checks `which agy` first, then falls back to common install locations.
|
|
*
|
|
* @returns Directory path, or null if not found
|
|
*/
|
|
export function resolveAntigravityDir(): string | null {
|
|
if (_antigravityDir !== null) return _antigravityDir || null;
|
|
|
|
try {
|
|
const result = execSync('which agy', {
|
|
encoding: 'utf-8',
|
|
timeout: EXEC_TIMEOUT_MS,
|
|
}).trim();
|
|
if (result && existsSync(result)) {
|
|
_antigravityDir = dirname(result);
|
|
return _antigravityDir;
|
|
}
|
|
} catch {
|
|
// agy not in PATH, will check common locations
|
|
}
|
|
|
|
for (const dir of ANTIGRAVITY_SEARCH_DIRS) {
|
|
if (existsSync(join(dir, 'agy'))) {
|
|
_antigravityDir = dir;
|
|
return _antigravityDir;
|
|
}
|
|
}
|
|
|
|
_antigravityDir = '';
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
* Check if the Antigravity CLI is available on the system.
|
|
*/
|
|
export function isAntigravityAvailable(): boolean {
|
|
return resolveAntigravityDir() !== null;
|
|
}
|