import { homedir } from 'node:os';
import { i18n } from './index2.mjs';
import { j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
import 'node:fs';
import 'node:process';
import 'node:url';

const CLAUDE_DIR = join(homedir(), ".claude");
const SETTINGS_FILE = join(CLAUDE_DIR, "settings.json");
join(CLAUDE_DIR, "CLAUDE.md");
const CLAUDE_AGENTS_DIR = join(CLAUDE_DIR, "agents");
const ClAUDE_CONFIG_FILE = join(homedir(), ".claude.json");
const CLAUDE_VSC_CONFIG_FILE = join(CLAUDE_DIR, "config.json");
const CLAVUE_DIR = join(homedir(), ".clavue");
const CLAVUE_SETTINGS_FILE = join(CLAVUE_DIR, "settings.json");
const CLAVUE_CONFIG_FILE = join(CLAVUE_DIR, ".clavue.json");
const CLAVUE_CREDENTIALS_FILE = join(CLAVUE_DIR, ".credentials.json");
const CODEX_DIR = join(homedir(), ".codex");
const CODEX_CONFIG_FILE = join(CODEX_DIR, "config.toml");
const CODEX_AUTH_FILE = join(CODEX_DIR, "auth.json");
const CODEX_AGENTS_FILE = join(CODEX_DIR, "AGENTS.md");
const CODEX_PROMPTS_DIR = join(CODEX_DIR, "prompts");
const AIDER_DIR = join(homedir(), ".aider");
join(AIDER_DIR, ".aider.conf.yml");
join(AIDER_DIR, ".env");
const CONTINUE_DIR = join(homedir(), ".continue");
join(CONTINUE_DIR, "config.json");
const CLINE_DIR = join(homedir(), ".cline");
join(CLINE_DIR, "config.json");
const CURSOR_DIR = join(homedir(), ".cursor");
join(CURSOR_DIR, "config.json");
const CCJK_CONFIG_DIR = join(homedir(), ".ccjk");
const CCJK_CONFIG_FILE = join(CCJK_CONFIG_DIR, "config.toml");
join(CCJK_CONFIG_DIR, "state.json");
const CCJK_PLUGINS_DIR = join(CCJK_CONFIG_DIR, "plugins");
const CCJK_SKILLS_DIR = join(CLAUDE_DIR, "skills");
join(CCJK_CONFIG_DIR, "groups");
const CCJK_CLOUD_PLUGINS_DIR = join(CCJK_CONFIG_DIR, "cloud-plugins");
const CCJK_CLOUD_PLUGINS_CACHE_DIR = join(CCJK_CLOUD_PLUGINS_DIR, "cache");
join(CCJK_CLOUD_PLUGINS_CACHE_DIR, "plugins.json");
const CCJK_CLOUD_PLUGINS_INSTALLED_DIR = join(CCJK_CLOUD_PLUGINS_DIR, "installed");
const CLOUD_ENDPOINTS = {
  /**
   * Main API - Core cloud services
   * Used for: project analysis, templates, telemetry
   */
  MAIN: {
    BASE_URL: "https://api.claudehome.cn",
    API_VERSION: "/api/v1"
  },
  /**
   * Plugins API - Marketplace and cloud plugins
   * Used for: plugin discovery, installation, ratings
   */
  PLUGINS: {
    BASE_URL: "https://api.claudehome.cn",
    API_VERSION: "/v1"
  },
  /**
   * Remote API - Real-time features
   * Used for: notifications, WebSocket connections
   */
  REMOTE: {
    BASE_URL: "https://remote-api.claudehome.cn",
    API_VERSION: "/api/v1"
    // Remote API uses /api/v1 prefix
  }
};
function getCloudApiUrl(endpoint) {
  const config = CLOUD_ENDPOINTS[endpoint];
  return `${config.BASE_URL}${config.API_VERSION}`;
}
function getCloudBaseUrl(endpoint) {
  return CLOUD_ENDPOINTS[endpoint].BASE_URL;
}
const CCJK_CLOUD_API_URL = getCloudApiUrl("PLUGINS");
const LEGACY_ZCF_CONFIG_DIR = join(homedir(), ".ufomiao", "zcf");
const LEGACY_ZCF_CONFIG_FILE = join(LEGACY_ZCF_CONFIG_DIR, "config.toml");
const LEGACY_ZCF_CONFIG_FILES = [
  join(CLAUDE_DIR, ".zcf-config.json"),
  join(homedir(), ".zcf.json"),
  LEGACY_ZCF_CONFIG_FILE
];
const ZCF_CONFIG_DIR = CCJK_CONFIG_DIR;
const ZCF_CONFIG_FILE = CCJK_CONFIG_FILE;
const CODE_TOOL_TYPES = ["claude-code", "clavue", "codex", "aider", "continue", "cline", "cursor"];
const DEFAULT_CODE_TOOL_TYPE = "clavue";
const CLAUDE_FAMILY_CODE_TOOL_TYPES = ["claude-code", "clavue"];
const CODE_TOOL_BANNERS = {
  "claude-code": "for Claude Code",
  "clavue": "for Clavue",
  "codex": "for Codex",
  "aider": "for Aider",
  "continue": "for Continue",
  "cline": "for Cline",
  "cursor": "for Cursor CLI"
};
const CODE_TOOL_ALIASES = {
  cc: "claude-code",
  clavue: "clavue",
  cv: "clavue",
  mc: "clavue",
  myclaude: "clavue",
  mycode: "clavue",
  cx: "codex",
  ad: "aider",
  ct: "continue",
  cl: "cline",
  cu: "cursor"
};
const CODE_TOOL_INFO = {
  "claude-code": {
    name: "Claude Code",
    description: "Anthropic official CLI for Claude",
    website: "https://claude.ai/code",
    installCmd: "npm install -g @anthropic-ai/claude-code",
    configFormat: "json",
    category: "cli",
    runtimeCommand: "claude",
    configBackend: "claude-family",
    nativeSlashCommands: [
      "/help",
      "/clear",
      "/exit",
      "/quit",
      "/resume",
      "/compact",
      "/context",
      "/status",
      "/plan",
      "/execute",
      "/rewind",
      "/mcp",
      "/doctor",
      "/settings",
      "/config",
      "/version",
      "/agents",
      "/skills",
      "/commands",
      "/tasks",
      "/memory",
      "/memories",
      "/model",
      "/cost",
      "/permissions",
      "/hooks",
      "/init",
      "/login",
      "/logout",
      "/bug",
      "/terminal",
      "/ide",
      "/review",
      "/pr",
      "/vim",
      "/listen",
      "/add",
      "/install",
      "/allowed-tools",
      "/think",
      "/thinking"
    ],
    managesProviderProfiles: false
  },
  "clavue": {
    name: "Clavue",
    description: "Execution-first AI coding CLI with provider profiles",
    website: "https://www.clavue.com",
    installCmd: "npm install -g clavue",
    configFormat: "json",
    category: "cli",
    runtimeCommand: "clavue",
    configBackend: "claude-family",
    nativeSlashCommands: [
      "/help",
      "/clear",
      "/exit",
      "/quit",
      "/resume",
      "/compact",
      "/context",
      "/status",
      "/plan",
      "/execute",
      "/rewind",
      "/mcp",
      "/doctor",
      "/settings",
      "/config",
      "/version",
      "/agents",
      "/skills",
      "/commands",
      "/tasks",
      "/memory",
      "/memories",
      "/model",
      "/cost",
      "/permissions",
      "/hooks",
      "/init",
      "/login",
      "/logout",
      "/bug",
      "/terminal",
      "/ide",
      "/review",
      "/pr",
      "/vim",
      "/listen",
      "/add",
      "/install",
      "/allowed-tools",
      "/think",
      "/thinking",
      "/goal",
      "/provider",
      "/team",
      "/mao"
    ],
    managesProviderProfiles: true
  },
  "codex": {
    name: "Codex",
    description: "OpenAI Codex CLI",
    website: "https://openai.com/codex",
    installCmd: "npm install -g @openai/codex",
    configFormat: "toml",
    category: "cli",
    runtimeCommand: "codex",
    configBackend: "tool-specific",
    nativeSlashCommands: [
      "/goal"
    ]
  },
  "aider": {
    name: "Aider",
    description: "AI pair programming in terminal",
    website: "https://aider.chat",
    installCmd: "pip install aider-chat",
    configFormat: "yaml",
    category: "cli",
    runtimeCommand: "aider",
    configBackend: "tool-specific"
  },
  "continue": {
    name: "Continue",
    description: "Open-source AI code assistant",
    website: "https://continue.dev",
    installCmd: "pip install continuedev",
    configFormat: "json",
    category: "extension",
    runtimeCommand: "continue",
    configBackend: "tool-specific"
  },
  "cline": {
    name: "Cline",
    description: "Autonomous coding agent for VS Code",
    website: "https://cline.bot",
    installCmd: "code --install-extension saoudrizwan.claude-dev",
    configFormat: "json",
    category: "extension",
    runtimeCommand: "cline",
    configBackend: "tool-specific"
  },
  "cursor": {
    name: "Cursor CLI",
    description: "AI-first code editor CLI",
    website: "https://cursor.com/cli",
    installCmd: "curl https://cursor.com/install -fsSL | bash",
    configFormat: "json",
    category: "editor",
    runtimeCommand: "cursor",
    configBackend: "tool-specific"
  }
};
function isCodeToolType(value) {
  return CODE_TOOL_TYPES.includes(value);
}
function isClaudeFamilyCodeTool(value) {
  return CLAUDE_FAMILY_CODE_TOOL_TYPES.includes(value);
}
function getCodeToolRuntimeCommand(codeTool) {
  return CODE_TOOL_INFO[codeTool].runtimeCommand;
}
function getCodeToolNativeSlashCommands(codeTool) {
  return CODE_TOOL_INFO[codeTool].nativeSlashCommands || [];
}
const API_DEFAULT_URL = "https://api.anthropic.com";
function resolveCodeToolType(value) {
  if (isCodeToolType(value)) {
    return value;
  }
  if (typeof value === "string" && value in CODE_TOOL_ALIASES) {
    return CODE_TOOL_ALIASES[value];
  }
  return DEFAULT_CODE_TOOL_TYPE;
}
const SUPPORTED_LANGS = ["zh-CN", "en"];
const LANG_LABELS = {
  "zh-CN": "\u7B80\u4F53\u4E2D\u6587",
  "en": "English"
};
const AI_OUTPUT_LANGUAGES = {
  "zh-CN": { directive: "Always respond in Chinese-simplified" },
  "en": { directive: "Always respond in English" },
  "custom": { directive: "" }
};
function getAiOutputLanguageLabel(lang) {
  if (lang in LANG_LABELS) {
    return LANG_LABELS[lang];
  }
  if (lang === "custom" && i18n?.isInitialized) {
    try {
      return i18n.t("language:labels.custom");
    } catch {
    }
  }
  return lang;
}

export { AIDER_DIR, AI_OUTPUT_LANGUAGES, API_DEFAULT_URL, CCJK_CLOUD_API_URL, CCJK_CLOUD_PLUGINS_CACHE_DIR, CCJK_CLOUD_PLUGINS_DIR, CCJK_CLOUD_PLUGINS_INSTALLED_DIR, CCJK_CONFIG_DIR, CCJK_CONFIG_FILE, CCJK_PLUGINS_DIR, CCJK_SKILLS_DIR, CLAUDE_AGENTS_DIR, CLAUDE_DIR, CLAUDE_FAMILY_CODE_TOOL_TYPES, CLAUDE_VSC_CONFIG_FILE, CLAVUE_CONFIG_FILE, CLAVUE_CREDENTIALS_FILE, CLAVUE_DIR, CLAVUE_SETTINGS_FILE, CLINE_DIR, CLOUD_ENDPOINTS, CODEX_AGENTS_FILE, CODEX_AUTH_FILE, CODEX_CONFIG_FILE, CODEX_DIR, CODEX_PROMPTS_DIR, CODE_TOOL_ALIASES, CODE_TOOL_BANNERS, CODE_TOOL_INFO, CODE_TOOL_TYPES, CONTINUE_DIR, CURSOR_DIR, ClAUDE_CONFIG_FILE, DEFAULT_CODE_TOOL_TYPE, LANG_LABELS, LEGACY_ZCF_CONFIG_DIR, LEGACY_ZCF_CONFIG_FILE, LEGACY_ZCF_CONFIG_FILES, SETTINGS_FILE, SUPPORTED_LANGS, ZCF_CONFIG_DIR, ZCF_CONFIG_FILE, getAiOutputLanguageLabel, getCloudApiUrl, getCloudBaseUrl, getCodeToolNativeSlashCommands, getCodeToolRuntimeCommand, isClaudeFamilyCodeTool, isCodeToolType, resolveCodeToolType };
