Jelajahi Sumber

更新文档

黄中银 2 minggu lalu
induk
melakukan
b8d6baf721
2 mengubah file dengan 137 tambahan dan 91 penghapusan
  1. 39 10
      CLAUDE.md
  2. 98 81
      README.md

+ 39 - 10
CLAUDE.md

@@ -1,20 +1,35 @@
 # ApqInstaller 项目配置
 
 ## 项目概述
+
 ApqInstaller 是一个基于 Tauri + Vue 3 的桌面应用,用于帮助用户安装 Claude Code 及 VS Code 插件。
 
 ## 技术栈
+
 - **前端框架**: Vue 3 + TypeScript
 - **构建工具**: Vite
 - **桌面框架**: Tauri 2.0 (Rust)
 - **状态管理**: Pinia
 - **国际化**: vue-i18n
+- **UI 组件库**: Element Plus
 - **样式**: SCSS
 
 ## 项目结构
+
 - `src-tauri/` - Tauri 后端代码 (Rust)
   - `src/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` - 窗口管理命令
   - `src/utils/` - 工具函数
+    - `http.rs` - HTTP 请求工具
+    - `shell.rs` - Shell 命令执行工具
   - `tauri.conf.json` - Tauri 配置文件
   - `Cargo.toml` - Rust 依赖配置
 - `src/` - Vue 前端代码
@@ -24,31 +39,45 @@ ApqInstaller 是一个基于 Tauri + Vue 3 的桌面应用,用于帮助用户
   - `stores/` - Pinia 状态管理
   - `i18n/` - 国际化配置
   - `styles/` - 样式文件
+  - `types/` - TypeScript 类型定义
 - `shared/` - 前后端共享类型定义
 - `scripts/` - 构建和发布脚本
+- `tests/` - 测试文件
+- `docs/` - 文档
 
 ## 开发命令
+
 - `npm run dev` - 启动前端开发服务器
-- `npm run tauri dev` - 启动 Tauri 开发模式(推荐)
-- `npm run tauri build` - 构建生产版本
+- `npm run tauri:dev` - 启动 Tauri 开发模式(推荐)
+- `npm run tauri:build` - 构建生产版本
+- `npm run tauri:build:debug` - 构建调试版本
+- `npm run typecheck` - TypeScript 类型检查
+- `npm run lint` - ESLint 代码检查
+- `npm run test` - 运行测试
+- `npm run version:bump` - 版本号更新
+
+## 平台构建脚本
+
 - `build-win.bat` - Windows 平台构建
+- `build-linux.sh` - Linux 平台构建
+- `build-mac.sh` - macOS 平台构建
+- `release-win.bat` - Windows 发布构建
+- `set-version.bat` - 版本号设置
 
 ## 编码规范
+
 - 使用 TypeScript 进行类型安全开发
 - 遵循 ESLint 配置的代码规范
 - 组件使用 Vue 3 Composition API
 - Rust 代码遵循 Rust 标准风格
 
 ## 编译构建规范
-- 在 Windows 上构建时使用 `build-win.bat`
+
 - 需要安装 Rust 工具链 (https://rustup.rs/)
-- 需要安装 Visual Studio Build Tools
+- Windows 平台需要安装 Visual Studio Build Tools
+- 默认构建产物位于 `src-tauri/target/release/bundle/`
+- Windows 平台的本地构建应该使用 `build-win.bat` 脚本,这会自动将构建产物自动复制到 `release/`
 
 ## 测试规范
-- 不要在本机进行软件安装功能的测试,因为本项目支持安装的软件均已安装过了,重复安装可能会引起问题。
 
-## 从 Electron 迁移说明
-本项目已从 Electron 迁移到 Tauri 2.0:
-- 原 `electron/` 目录的功能已迁移到 `src-tauri/src/commands/`
-- 前端 API 调用从 `window.electronAPI` 改为使用 `@tauri-apps/api`
-- 构建产物从 `release/` 改为 `src-tauri/target/release/bundle/`
+- 不要在本机进行软件安装功能的测试,因为本项目支持安装的软件均已安装过了,重复安装可能会引起问题。

+ 98 - 81
README.md

@@ -1,14 +1,13 @@
 # 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)
+一个基于 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