2025-12-23 02:48:48 +01:00
|
|
|
import path from "node:path";
|
|
|
|
|
|
2026-01-06 00:56:29 +00:00
|
|
|
import { resolveConfigDir, resolveUserPath } from "../utils.js";
|
2025-12-23 02:48:48 +01:00
|
|
|
|
2026-01-04 14:32:47 +00:00
|
|
|
export function resolveClawdbotAgentDir(): string {
|
2026-01-06 00:56:29 +00:00
|
|
|
const defaultAgentDir = path.join(resolveConfigDir(), "agent");
|
2025-12-23 02:48:48 +01:00
|
|
|
const override =
|
2026-01-04 14:32:47 +00:00
|
|
|
process.env.CLAWDBOT_AGENT_DIR?.trim() ||
|
2025-12-23 02:48:48 +01:00
|
|
|
process.env.PI_CODING_AGENT_DIR?.trim() ||
|
2026-01-06 00:56:29 +00:00
|
|
|
defaultAgentDir;
|
2025-12-23 02:48:48 +01:00
|
|
|
return resolveUserPath(override);
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-04 14:32:47 +00:00
|
|
|
export function ensureClawdbotAgentEnv(): string {
|
|
|
|
|
const dir = resolveClawdbotAgentDir();
|
|
|
|
|
if (!process.env.CLAWDBOT_AGENT_DIR) process.env.CLAWDBOT_AGENT_DIR = dir;
|
2025-12-23 02:48:48 +01:00
|
|
|
if (!process.env.PI_CODING_AGENT_DIR) process.env.PI_CODING_AGENT_DIR = dir;
|
|
|
|
|
return dir;
|
|
|
|
|
}
|