/** * @file Where Antigravity's CLI (`agy`) keeps its data. `agy` has no home * override of its own — everything is under `~/.gemini`: its conversations and * transcripts in `antigravity-cli/`, and the user's global hooks in * `config/hooks.json`, shared with the Antigravity IDE. `AGENTHUB_GEMINI_DIR` * points AgentHub elsewhere (tests; a pane whose HOME differs). `agyCliDirs` * also names the resolved path when a symlink leads elsewhere, since agy may * report either in a hook. * @author Nguyễn Ngọc Trí Vĩ */ const fs = require("node:fs"); const path = require("node:path"); const os = require("node:os"); /** `~/.gemini`, or `AGENTHUB_GEMINI_DIR`; read at call time. */ function getGeminiDir() { return process.env.AGENTHUB_GEMINI_DIR || path.join(os.homedir(), ".gemini"); } /** The CLI's own data: `conversations/.db`, `brain//…`. */ function getAgyCliDir() { return path.join(getGeminiDir(), "antigravity-cli"); } /** The CLI dir as configured and, when a symlink leads elsewhere, as resolved. */ function agyCliDirs() { const raw = path.resolve(getAgyCliDir()); let real = raw; try { real = fs.realpathSync(raw); } catch { try { real = path.join(fs.realpathSync(getGeminiDir()), "antigravity-cli"); } catch { /* neither exists yet */ } } return real === raw ? [raw] : [raw, real]; } module.exports = { getGeminiDir, getAgyCliDir, agyCliDirs };