import path from "node:path";
import os from "node:os";
export const ALL_APPS = [
    "acode",
    "claude",
    "claudecode",
    "codex",
    "gemini",
    "opencode",
    "openclaw",
];
export const DEFAULT_APP_FLAGS = {
    acode: false,
    claude: false,
    claudecode: false,
    codex: false,
    gemini: false,
    opencode: false,
    openclaw: false,
};
export function normalizeAppFlags(flags) {
    return {
        acode: Boolean(flags?.acode),
        claude: false,
        claudecode: Boolean(flags?.claudecode) || Boolean(flags?.claude),
        codex: Boolean(flags?.codex),
        gemini: Boolean(flags?.gemini),
        opencode: Boolean(flags?.opencode),
        openclaw: Boolean(flags?.openclaw),
    };
}
export function resolvePaths(options = {}) {
    const rootDir = options.rootDir ?? path.join(os.homedir(), ".cc-switch-sdk-node");
    const paths = {
        stateFile: options.paths?.stateFile ?? path.join(rootDir, "state.json"),
        backupDir: options.paths?.backupDir ?? path.join(rootDir, "backups"),
        claudeConfigFile: options.paths?.claudeConfigFile ??
            path.join(os.homedir(), ".claude.json"),
        claudeSkillsDir: options.paths?.claudeSkillsDir ??
            path.join(os.homedir(), ".claude", "skills"),
        claudecodeConfigFile: options.paths?.claudecodeConfigFile ??
            path.join(os.homedir(), ".claudecode", "opencode.json"),
        claudecodeSkillsDir: options.paths?.claudecodeSkillsDir ??
            path.join(os.homedir(), ".claudecode", "skills"),
        codexConfigFile: options.paths?.codexConfigFile ??
            path.join(os.homedir(), ".codex", "config.toml"),
        codexSkillsDir: options.paths?.codexSkillsDir ??
            path.join(os.homedir(), ".codex", "skills"),
        acodeConfigFile: options.paths?.acodeConfigFile ??
            path.join(os.homedir(), ".acode", "config.json"),
        acodeSkillsDir: options.paths?.acodeSkillsDir ??
            path.join(os.homedir(), ".acode", "skills"),
        opencodeConfigFile: options.paths?.opencodeConfigFile ??
            path.join(os.homedir(), ".opencode", "config.json"),
        opencodeSkillsDir: options.paths?.opencodeSkillsDir ??
            path.join(os.homedir(), ".opencode", "skills"),
        ssotSkillsDir: options.paths?.ssotSkillsDir ?? path.join(rootDir, "skills"),
    };
    return {
        paths,
        skillSyncMethod: options.skillSyncMethod ?? "auto",
    };
}
