import { join } from 'node:path';
import { readFile, writeFile } from 'node:fs/promises';
import { existsSync } from 'node:fs';
export function getLocalClawxJsonPath(workDir) {
    return join(workDir, 'clawx.json');
}
export function getGlobalClawxJsonPath() {
    const home = process.env.HOME || process.env.USERPROFILE || '';
    return join(home, '.clawx', 'clawx.json');
}
export function readJsonConfigFile(filePath) {
    if (!existsSync(filePath)) {
        return {};
    }
    try {
        const content = readFile(filePath, 'utf8');
        return JSON.parse(content);
    }
    catch {
        return {};
    }
}
export function writeJsonConfigFile(filePath, data) {
    void writeFile(filePath, JSON.stringify(data, null, 2), 'utf8');
}
//# sourceMappingURL=json-config.js.map