fix(coding-agent): expand tilde in PI_CODING_AGENT_DIR env var (#778)

This commit is contained in:
Aliou Diallo 2026-01-16 17:53:58 +01:00 committed by GitHub
parent 12ab69fbad
commit 09d9107d7f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View file

@ -122,7 +122,14 @@ export const ENV_AGENT_DIR = `${APP_NAME.toUpperCase()}_CODING_AGENT_DIR`;
/** Get the agent config directory (e.g., ~/.pi/agent/) */
export function getAgentDir(): string {
return process.env[ENV_AGENT_DIR] || join(homedir(), CONFIG_DIR_NAME, "agent");
const envDir = process.env[ENV_AGENT_DIR];
if (envDir) {
// Expand tilde to home directory
if (envDir === "~") return homedir();
if (envDir.startsWith("~/")) return homedir() + envDir.slice(1);
return envDir;
}
return join(homedir(), CONFIG_DIR_NAME, "agent");
}
/** Get path to user's custom themes directory */