import { homedir } from "node:os";
import { join, resolve } from "node:path";
export function getAgentDir() {
    const configured = process.env.PI_CODING_AGENT_DIR?.trim();
    if (!configured) {
        return join(homedir(), ".spectral", "agent");
    }
    if (configured === "~") {
        return homedir();
    }
    if (configured.startsWith("~/")) {
        return resolve(homedir(), configured.slice(2));
    }
    return resolve(configured);
}
export function getAgentPath(...segments) {
    return join(getAgentDir(), ...segments);
}
