|
|
@@ -1,14 +1,13 @@
|
|
|
# Claude AI Installer
|
|
|
|
|
|
-[](https://github.com/anthropics/claude-ai-installer/actions/workflows/release.yml)
|
|
|
+一个基于 Tauri + Vue 3 的桌面应用,帮助用户一键安装 Claude Code 及相关开发工具。
|
|
|
|
|
|
-一个基于 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.
|
|
|
+A desktop application built with Tauri + 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
|
|
|
@@ -17,25 +16,28 @@ A desktop application built with Electron + Vue 3 to help users install Claude C
|
|
|
- **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
|
|
|
+
|
|
|
- 自定义无边框窗口
|
|
|
- 深色/浅色主题
|
|
|
- 国际化支持(中文/英文)
|
|
|
@@ -45,34 +47,42 @@ A desktop application built with Electron + Vue 3 to help users install Claude C
|
|
|
|
|
|
## 技术栈 / Tech Stack
|
|
|
|
|
|
-| 类别 | 技术 |
|
|
|
-|------|------|
|
|
|
-| 前端框架 | Vue 3 + TypeScript |
|
|
|
-| 构建工具 | Vite |
|
|
|
-| 桌面框架 | Electron |
|
|
|
-| 状态管理 | Pinia |
|
|
|
-| UI 组件库 | Element Plus |
|
|
|
-| 国际化 | vue-i18n |
|
|
|
-| 样式 | SCSS |
|
|
|
-| 测试 | Vitest |
|
|
|
+| 类别 | 技术 |
|
|
|
+| ------ | ------------------ |
|
|
|
+| 前端框架 | Vue 3 + TypeScript |
|
|
|
+| 构建工具 | Vite |
|
|
|
+| 桌面框架 | Tauri 2.0 (Rust) |
|
|
|
+| 状态管理 | 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-tauri/ # Tauri 后端代码 (Rust)
|
|
|
+│ ├── src/
|
|
|
+│ │ ├── main.rs # 主入口
|
|
|
+│ │ ├── lib.rs # 库入口
|
|
|
+│ │ └── commands/ # Tauri 命令模块
|
|
|
+│ │ ├── claude_code.rs # Claude Code 相关命令
|
|
|
+│ │ ├── config.rs # 配置管理命令
|
|
|
+│ │ ├── install.rs # 安装功能命令
|
|
|
+│ │ ├── logs.rs # 日志管理命令
|
|
|
+│ │ ├── software.rs # 软件检测命令
|
|
|
+│ │ ├── system.rs # 系统信息命令
|
|
|
+│ │ ├── updater.rs # 更新功能命令
|
|
|
+│ │ ├── vscode.rs # VS Code 相关命令
|
|
|
+│ │ └── window.rs # 窗口管理命令
|
|
|
+│ ├── tauri.conf.json # Tauri 配置文件
|
|
|
+│ └── Cargo.toml # Rust 依赖配置
|
|
|
├── src/ # Vue 前端代码
|
|
|
│ ├── main.ts # Vue 应用入口
|
|
|
│ ├── App.vue # 根组件
|
|
|
-│ ├── components/common/ # 通用组件
|
|
|
+│ ├── api/ # Tauri API 封装
|
|
|
+│ ├── components/ # Vue 组件
|
|
|
│ │ ├── TitleBar.vue # 自定义标题栏
|
|
|
│ │ ├── InstallLog.vue # 安装日志显示
|
|
|
│ │ ├── MirrorSelector.vue # 镜像选择器
|
|
|
@@ -86,10 +96,10 @@ ClaudeCodeInstaller/
|
|
|
│ │ └── BatchInstallView.vue # 批量安装页
|
|
|
│ ├── stores/ # Pinia 状态管理
|
|
|
│ ├── i18n/ # 国际化配置
|
|
|
-│ └── styles/ # 样式文件
|
|
|
-├── shared/ # 主进程/渲染进程共享类型
|
|
|
+│ ├── styles/ # 样式文件
|
|
|
+│ └── types/ # TypeScript 类型定义
|
|
|
+├── shared/ # 前后端共享类型定义
|
|
|
├── scripts/ # 构建和发布脚本
|
|
|
-├── launcher/ # 便携版启动器
|
|
|
├── public/icons/ # 应用图标
|
|
|
└── tests/ # 测试文件
|
|
|
```
|
|
|
@@ -100,6 +110,8 @@ ClaudeCodeInstaller/
|
|
|
|
|
|
- Node.js >= 18
|
|
|
- npm 或 pnpm
|
|
|
+- Rust 工具链 (https://rustup.rs/)
|
|
|
+- Windows 平台需要安装 Visual Studio Build Tools
|
|
|
|
|
|
### 安装依赖 / Install Dependencies
|
|
|
|
|
|
@@ -110,118 +122,123 @@ npm install
|
|
|
### 开发模式 / Development Mode
|
|
|
|
|
|
```bash
|
|
|
+# 启动前端开发服务器
|
|
|
npm run dev
|
|
|
+
|
|
|
+# 启动 Tauri 开发模式(推荐)
|
|
|
+npm run tauri:dev
|
|
|
```
|
|
|
|
|
|
### 构建 / Build
|
|
|
|
|
|
```bash
|
|
|
-# Windows
|
|
|
-npm run build:win
|
|
|
-# 或使用批处理脚本
|
|
|
+# Windows(使用批处理脚本)
|
|
|
build-win.bat
|
|
|
|
|
|
# macOS
|
|
|
-npm run build:mac
|
|
|
+build-mac.sh
|
|
|
|
|
|
# Linux
|
|
|
-npm run build:linux
|
|
|
+build-linux.sh
|
|
|
|
|
|
-# 所有平台
|
|
|
-npm run build:all
|
|
|
+# 或使用 npm 命令
|
|
|
+npm run tauri:build
|
|
|
+npm run tauri:build:debug # 调试版本
|
|
|
```
|
|
|
|
|
|
### 测试 / Testing
|
|
|
|
|
|
```bash
|
|
|
-# 运行测试(监听模式)
|
|
|
+# 运行测试
|
|
|
npm run test
|
|
|
-
|
|
|
-# 运行测试(单次)
|
|
|
-npm run test:run
|
|
|
-
|
|
|
-# 运行测试(带覆盖率)
|
|
|
-npm run test:coverage
|
|
|
```
|
|
|
|
|
|
### 代码检查 / Linting
|
|
|
|
|
|
```bash
|
|
|
npm run lint
|
|
|
+npm run typecheck # TypeScript 类型检查
|
|
|
```
|
|
|
|
|
|
## 发布 / Release
|
|
|
|
|
|
-### 本地发布 / Local Release
|
|
|
+### 版本管理 / Version Management
|
|
|
|
|
|
```bash
|
|
|
-# 补丁版本
|
|
|
-npm run release:patch
|
|
|
-
|
|
|
-# 次版本
|
|
|
-npm run release:minor
|
|
|
+# 更新版本号
|
|
|
+npm run version:bump
|
|
|
|
|
|
-# 主版本
|
|
|
-npm run release:major
|
|
|
+# Windows 设置版本
|
|
|
+set-version.bat
|
|
|
```
|
|
|
|
|
|
### 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
|
|
|
+# 1. 更新版本号
|
|
|
+npm run version:bump
|
|
|
+
|
|
|
+# 2. 提交并创建标签
|
|
|
+git add .
|
|
|
+git commit -m "release: vX.X.X"
|
|
|
+git tag vX.X.X
|
|
|
|
|
|
-# 2. 推送标签到 GitHub
|
|
|
+# 3. 推送标签到 GitHub
|
|
|
git push origin --tags
|
|
|
|
|
|
-# 3. GitHub Actions 自动构建并发布
|
|
|
+# 4. GitHub Actions 自动构建并发布
|
|
|
```
|
|
|
|
|
|
## 构建产物 / Build Outputs
|
|
|
|
|
|
-| 平台 | 格式 |
|
|
|
-|------|------|
|
|
|
-| Windows | NSIS 安装包、便携版 |
|
|
|
-| macOS | DMG、ZIP(x64 和 arm64) |
|
|
|
-| Linux | AppImage、DEB、RPM |
|
|
|
+默认构建产物位于 `src-tauri/target/release/bundle/`
|
|
|
+
|
|
|
+| 平台 | 格式 |
|
|
|
+| ------- | -------------------- |
|
|
|
+| Windows | NSIS 安装包、MSI |
|
|
|
+| macOS | DMG、APP(x64 和 arm64) |
|
|
|
+| Linux | AppImage、DEB |
|
|
|
|
|
|
## 架构图 / Architecture
|
|
|
|
|
|
```
|
|
|
-┌──────────────────┐ IPC ┌──────────────────┐
|
|
|
-│ Vue Frontend │ <──────────> │ Electron Main │
|
|
|
-│ (Renderer) │ │ Process │
|
|
|
-└────────┬─────────┘ └────────┬─────────┘
|
|
|
- │ │
|
|
|
- ▼ ▼
|
|
|
-┌──────────────────┐ ┌──────────────────┐
|
|
|
-│ Pinia Stores │ │ Installer Module │
|
|
|
-│ - install │ │ - 文件下载 │
|
|
|
-│ - versions │ │ - 命令执行 │
|
|
|
-│ - settings │ │ - 权限提升 │
|
|
|
-│ - system │ └────────┬─────────┘
|
|
|
-└──────────────────┘ │
|
|
|
- ▼
|
|
|
- ┌──────────────────┐
|
|
|
- │ External Tools │
|
|
|
- │ - msiexec │
|
|
|
- │ - npm/pnpm │
|
|
|
- │ - VS Code CLI │
|
|
|
- └──────────────────┘
|
|
|
+┌──────────────────┐ Tauri IPC ┌──────────────────┐
|
|
|
+│ Vue Frontend │ <───────────> │ Tauri Backend │
|
|
|
+│ (WebView) │ │ (Rust) │
|
|
|
+└────────┬─────────┘ └────────┬─────────┘
|
|
|
+ │ │
|
|
|
+ ▼ ▼
|
|
|
+┌──────────────────┐ ┌──────────────────┐
|
|
|
+│ Pinia Stores │ │ Commands Module │
|
|
|
+│ - install │ │ - claude_code │
|
|
|
+│ - versions │ │ - install │
|
|
|
+│ - settings │ │ - software │
|
|
|
+│ - system │ │ - vscode │
|
|
|
+└──────────────────┘ └────────┬─────────┘
|
|
|
+ │
|
|
|
+ ▼
|
|
|
+ ┌──────────────────┐
|
|
|
+ │ External Tools │
|
|
|
+ │ - msiexec │
|
|
|
+ │ - npm/pnpm │
|
|
|
+ │ - VS Code CLI │
|
|
|
+ └──────────────────┘
|
|
|
```
|
|
|
|
|
|
## 许可证 / License
|