# Claude AI Installer [![Release](https://github.com/anthropics/claude-ai-installer/actions/workflows/release.yml/badge.svg)](https://github.com/anthropics/claude-ai-installer/actions/workflows/release.yml) 一个基于 Electron + Vue 3 的桌面应用,帮助用户一键安装 Claude Code 及相关开发工具。 A desktop application built with Electron + Vue 3 to help users install Claude Code and related development tools with one click. ## 功能特性 / Features ### 软件安装 / Software Installation - **Node.js** - 支持 LTS 版本和指定版本安装 - **pnpm** - 通过 npm 全局安装 pnpm 包管理器 - **VS Code** - 下载并安装 Visual Studio Code - **Git** - 下载并安装 Git(支持镜像源) - **Claude Code** - 通过 pnpm/npm 安装 Claude Code CLI (`@anthropic-ai/claude-code`) - **Claude Code VS Code 扩展** - 安装 `anthropic.claude-code` 扩展 ### 批量安装 / Batch Installation - 一键安装所有必需软件 - 可配置各组件的安装选项 - 自定义安装路径(仅 Windows) ### 镜像支持 / Mirror Support - Git 镜像:华为云镜像、GitHub 官方 - Node.js 镜像:官方源、npmmirror(中国镜像) - 可配置 npm/pnpm registry ### 系统特性 / System Features - 跨平台支持(Windows、macOS、Linux) - 管理员权限检测 - 包管理器检测(macOS brew、Linux apt) - 网络连接检查 - 安装进度实时追踪 - 自动更新功能 - 便携版支持 ### 界面特性 / UI Features - 自定义无边框窗口 - 深色/浅色主题 - 国际化支持(中文/英文) - 标签页导航 - 实时安装日志 - 软件安装状态指示 ## 技术栈 / Tech Stack | 类别 | 技术 | |------|------| | 前端框架 | Vue 3 + TypeScript | | 构建工具 | Vite | | 桌面框架 | Electron | | 状态管理 | Pinia | | UI 组件库 | Element Plus | | 国际化 | vue-i18n | | 样式 | SCSS | | 测试 | Vitest | ## 项目结构 / Project Structure ``` ClaudeCodeInstaller/ ├── electron/ # Electron 主进程代码 │ ├── main.ts # 主进程入口 │ ├── preload.ts # 预加载脚本(IPC 桥接) │ └── modules/ # 后端模块 │ ├── installer.ts # 核心安装逻辑 │ ├── ipc-handlers.ts # IPC 处理器 │ ├── version-fetcher.ts # 版本获取 │ ├── claude-code-installer.ts # Claude Code 安装器 │ └── ... ├── src/ # Vue 前端代码 │ ├── main.ts # Vue 应用入口 │ ├── App.vue # 根组件 │ ├── components/common/ # 通用组件 │ │ ├── TitleBar.vue # 自定义标题栏 │ │ ├── InstallLog.vue # 安装日志显示 │ │ ├── MirrorSelector.vue # 镜像选择器 │ │ └── ... │ ├── views/ # 页面视图 │ │ ├── IntroView.vue # 介绍页 │ │ ├── NodejsView.vue # Node.js 安装页 │ │ ├── VscodeView.vue # VS Code 安装页 │ │ ├── GitView.vue # Git 安装页 │ │ ├── ClaudeCodeView.vue # Claude Code 安装页 │ │ └── BatchInstallView.vue # 批量安装页 │ ├── stores/ # Pinia 状态管理 │ ├── i18n/ # 国际化配置 │ └── styles/ # 样式文件 ├── shared/ # 主进程/渲染进程共享类型 ├── scripts/ # 构建和发布脚本 ├── launcher/ # 便携版启动器 ├── public/icons/ # 应用图标 └── tests/ # 测试文件 ``` ## 开发指南 / Development Guide ### 环境要求 / Prerequisites - Node.js >= 18 - npm 或 pnpm ### 安装依赖 / Install Dependencies ```bash npm install ``` ### 开发模式 / Development Mode ```bash npm run dev ``` ### 构建 / Build ```bash # Windows npm run build:win # 或使用批处理脚本 build-win.bat # macOS npm run build:mac # Linux npm run build:linux # 所有平台 npm run build:all ``` ### 测试 / Testing ```bash # 运行测试(监听模式) npm run test # 运行测试(单次) npm run test:run # 运行测试(带覆盖率) npm run test:coverage ``` ### 代码检查 / Linting ```bash npm run lint ``` ## 发布 / Release ### 本地发布 / Local Release ```bash # 补丁版本 npm run release:patch # 次版本 npm run release:minor # 主版本 npm run release:major ``` ### GitHub Actions 自动发布 / GitHub Actions Auto Release 项目配置了 GitHub Actions 工作流,支持自动构建和发布: **构建工作流 (build.yml)** - 触发条件:推送到 `main`/`develop` 分支或创建 PR - 自动在 Windows、macOS、Linux 三个平台并行构建 - 运行测试和类型检查 - 上传构建产物为 Artifacts **发布工作流 (release.yml)** - 触发条件:推送以 `v` 开头的标签(如 `v1.0.0`) - 自动构建所有平台的安装包 - 自动创建 GitHub Release 并上传安装包 **发布步骤:** ```bash # 1. 更新版本号并创建标签 npm run release:patch # 或 release:minor / release:major # 2. 推送标签到 GitHub git push origin --tags # 3. GitHub Actions 自动构建并发布 ``` ## 构建产物 / Build Outputs | 平台 | 格式 | |------|------| | Windows | NSIS 安装包、便携版 | | macOS | DMG、ZIP(x64 和 arm64) | | Linux | AppImage、DEB、RPM | ## 架构图 / Architecture ``` ┌──────────────────┐ IPC ┌──────────────────┐ │ Vue Frontend │ <──────────> │ Electron Main │ │ (Renderer) │ │ Process │ └────────┬─────────┘ └────────┬─────────┘ │ │ ▼ ▼ ┌──────────────────┐ ┌──────────────────┐ │ Pinia Stores │ │ Installer Module │ │ - install │ │ - 文件下载 │ │ - versions │ │ - 命令执行 │ │ - settings │ │ - 权限提升 │ │ - system │ └────────┬─────────┘ └──────────────────┘ │ ▼ ┌──────────────────┐ │ External Tools │ │ - msiexec │ │ - npm/pnpm │ │ - VS Code CLI │ └──────────────────┘ ``` ## 许可证 / License MIT ## 贡献 / Contributing 欢迎提交 Issue 和 Pull Request! Issues and Pull Requests are welcome!