feat: add --dev/--profile CLI profiles

This commit is contained in:
Peter Steinberger
2026-01-05 01:25:37 +01:00
parent f601dac30d
commit c6de1b1f7d
19 changed files with 516 additions and 25 deletions

View File

@@ -104,6 +104,15 @@ export function resolveUserPath(input: string): string {
return path.resolve(trimmed);
}
export function resolveConfigDir(
env: NodeJS.ProcessEnv = process.env,
homedir: () => string = os.homedir,
): string {
const override = env.CLAWDBOT_STATE_DIR?.trim();
if (override) return resolveUserPath(override);
return path.join(homedir(), ".clawdbot");
}
export function resolveHomeDir(): string | undefined {
const envHome = process.env.HOME?.trim();
if (envHome) return envHome;
@@ -133,5 +142,5 @@ export function shortenHomeInString(input: string): string {
return input.split(home).join("~");
}
// Fixed configuration root; legacy ~/.clawdbot is no longer used.
export const CONFIG_DIR = path.join(os.homedir(), ".clawdbot");
// Configuration root; can be overridden via CLAWDBOT_STATE_DIR.
export const CONFIG_DIR = resolveConfigDir();