3de9101的任务收尾

This commit is contained in:
2025-12-19 03:58:34 +08:00
parent 3de9101705
commit 4cf9fc7a60
21 changed files with 315 additions and 2641 deletions

View File

@@ -1,5 +1,5 @@
{
"next_number": 20,
"next_number": 21,
"branches": [
{
"number": 1,
@@ -222,6 +222,18 @@
"status": "finished",
"end_commit": "de4a3a63975faf59c89a28c2e29c1ac58a48789b",
"finished_at": "2025-12-19T02:30:45+08:00"
},
{
"number": 20,
"branch_name": "aide/020",
"source_branch": "master",
"start_commit": "3de91017057046f93c9d2a52300a83314e1f7e58",
"task_id": "2025-12-19T03-01-27",
"task_summary": "开始任务准备: 调整 commands/skills/aide-program 体系",
"started_at": "2025-12-19T03:01:27+08:00",
"status": "finished",
"end_commit": "3ed7848bd721f2c7f5fb7b247259c5c3a201ded6",
"finished_at": "2025-12-19T03:58:34+08:00"
}
]
}

View File

@@ -1,5 +1,16 @@
# Git 分支概况
## aide/020
- **任务**: 开始任务准备: 调整 commands/skills/aide-program 体系
- **任务ID**: 2025-12-19T03-01-27
- **源分支**: master
- **起始提交**: 3de9101
- **结束提交**: 3ed7848
- **状态**: finished
- **起始时间**: 2025-12-19 03:01
- **结束时间**: 2025-12-19 03:58
## aide/019
- **任务**: 开始任务准备: Aide 体系多项调整任务

View File

@@ -0,0 +1,219 @@
{
"task_id": "2025-12-19T03-01-27",
"current_phase": "finish",
"current_step": 26,
"started_at": "2025-12-19T03:01:27+08:00",
"history": [
{
"timestamp": "2025-12-19T03:01:27+08:00",
"action": "start",
"phase": "task-optimize",
"step": 1,
"summary": "开始任务准备: 调整 commands/skills/aide-program 体系",
"git_commit": "509876676c0dad2007412140a1616c957d667a3b"
},
{
"timestamp": "2025-12-19T03:12:25+08:00",
"action": "next-step",
"phase": "task-optimize",
"step": 2,
"summary": "任务细则已确认",
"git_commit": "01cf08937b85be33f7838aeac75a43af743c7993"
},
{
"timestamp": "2025-12-19T03:12:37+08:00",
"action": "next-part",
"phase": "flow-design",
"step": 3,
"summary": "进入流程设计环节",
"git_commit": "0ada83ec47251ed4862b1dbcb79d75a7c5bbfcae"
},
{
"timestamp": "2025-12-19T03:13:45+08:00",
"action": "next-step",
"phase": "flow-design",
"step": 4,
"summary": "流程图设计完成",
"git_commit": "d34d4bec9ada31612443dbfc64a767962d78841c"
},
{
"timestamp": "2025-12-19T03:13:58+08:00",
"action": "next-part",
"phase": "impl",
"step": 5,
"summary": "流程设计完成,进入实现环节",
"git_commit": "47de3641d288675c35730fb809f8030dd5bf9178"
},
{
"timestamp": "2025-12-19T03:14:53+08:00",
"action": "next-step",
"phase": "impl",
"step": 6,
"summary": "完成 config.py 修改:添加 plantuml 配置项",
"git_commit": "1b22454beef76d84b79fb4ad1a4058c79930bdeb"
},
{
"timestamp": "2025-12-19T03:15:42+08:00",
"action": "next-step",
"phase": "impl",
"step": 7,
"summary": "完成 run.md 修改finish 清理 + 流程图配置",
"git_commit": "bb9e4bac909820f6d4861896feab35c7282173f4"
},
{
"timestamp": "2025-12-19T03:16:01+08:00",
"action": "next-part",
"phase": "verify",
"step": 8,
"summary": "实现完成,进入验证环节",
"git_commit": "767f723665eddceabcd1e6f5c8fca596df61a0cf"
},
{
"timestamp": "2025-12-19T03:17:26+08:00",
"action": "next-step",
"phase": "verify",
"step": 9,
"summary": "验证完成: 所有修改语法正确,内容完整",
"git_commit": "63d15dcb6dc534ecf0ac692a38ddb7f6a35bb9f9"
},
{
"timestamp": "2025-12-19T03:17:53+08:00",
"action": "next-part",
"phase": "docs",
"step": 10,
"summary": "验证通过,进入文档环节",
"git_commit": "45aaf52696fa798de49463a4f8c4952b4f9fb818"
},
{
"timestamp": "2025-12-19T03:18:33+08:00",
"action": "next-step",
"phase": "docs",
"step": 11,
"summary": "文档更新完成",
"git_commit": "29cf81ac1707aadfe1fa3d61842cd9da1b52f785"
},
{
"timestamp": "2025-12-19T03:18:55+08:00",
"action": "next-part",
"phase": "confirm",
"step": 12,
"summary": "文档更新完成,进入用户确认环节",
"git_commit": "5871ce8d1655657fc81540eff5ede9bc44d00b82"
},
{
"timestamp": "2025-12-19T03:33:30+08:00",
"action": "back-part",
"phase": "task-optimize",
"step": 13,
"summary": "用户要求返工:移除 win-install/linux-install 及半自动化安装程序",
"git_commit": "0572fcca0c7d4226a3dd4c463907af020b31464f"
},
{
"timestamp": "2025-12-19T03:47:04+08:00",
"action": "next-step",
"phase": "task-optimize",
"step": 14,
"summary": "返工任务细则已确认",
"git_commit": "bd53a118cd61ffa0ab5d37d7d70c43b5fbdcafac"
},
{
"timestamp": "2025-12-19T03:47:24+08:00",
"action": "next-part",
"phase": "flow-design",
"step": 15,
"summary": "进入返工流程设计环节",
"git_commit": "e283007dc7fb57bd2874880ab1c81c08472855d6"
},
{
"timestamp": "2025-12-19T03:48:25+08:00",
"action": "next-step",
"phase": "flow-design",
"step": 16,
"summary": "返工流程图设计完成",
"git_commit": "0fcbb32a423f226f63bb167cf31100ebc4d052ad"
},
{
"timestamp": "2025-12-19T03:48:38+08:00",
"action": "next-part",
"phase": "impl",
"step": 17,
"summary": "流程设计完成,进入返工实现环节",
"git_commit": "7d62e0b69f5edaa4fe1c993a69ad23732e96574e"
},
{
"timestamp": "2025-12-19T03:52:05+08:00",
"action": "next-step",
"phase": "impl",
"step": 18,
"summary": "完成文档引用清理",
"git_commit": "4db60843b69b608dfa9413b50ddccd667ad24f45"
},
{
"timestamp": "2025-12-19T03:53:09+08:00",
"action": "next-step",
"phase": "impl",
"step": 19,
"summary": "完成 back-part 警告修改",
"git_commit": "eb033993a09af192b3f8b7f18de3116702974281"
},
{
"timestamp": "2025-12-19T03:53:34+08:00",
"action": "next-part",
"phase": "verify",
"step": 20,
"summary": "实现完成,进入验证环节",
"git_commit": "1a4ac906a1fdcdd7c4cd5c1c692eb2ac8984f687"
},
{
"timestamp": "2025-12-19T03:55:20+08:00",
"action": "next-step",
"phase": "verify",
"step": 21,
"summary": "验证完成: 所有修改正确",
"git_commit": "cfd43cdfed0c79629466e6db0bb7d0a26f110288"
},
{
"timestamp": "2025-12-19T03:55:43+08:00",
"action": "next-part",
"phase": "docs",
"step": 22,
"summary": "验证通过,进入文档环节",
"git_commit": "6962cc5d53e55709798b67b079ef80206623d616"
},
{
"timestamp": "2025-12-19T03:56:11+08:00",
"action": "next-step",
"phase": "docs",
"step": 23,
"summary": "文档更新完成",
"git_commit": "4234fc42af2e00fc008d851baa19e0b20ed0e4b5"
},
{
"timestamp": "2025-12-19T03:56:37+08:00",
"action": "next-part",
"phase": "confirm",
"step": 24,
"summary": "文档更新完成,进入用户确认环节",
"git_commit": "1ba81d0844189cc6b4d3ea4603a82d71c2638c1b"
},
{
"timestamp": "2025-12-19T03:58:22+08:00",
"action": "next-step",
"phase": "confirm",
"step": 25,
"summary": "用户确认通过",
"git_commit": "727ece8c8cfdb5af45265458cfad799a69fc0d65"
},
{
"timestamp": "2025-12-19T03:58:34+08:00",
"action": "next-part",
"phase": "finish",
"step": 26,
"summary": "用户确认通过,进入收尾",
"git_commit": "3ed7848bd721f2c7f5fb7b247259c5c3a201ded6"
}
],
"source_branch": "master",
"start_commit": "3de91017057046f93c9d2a52300a83314e1f7e58",
"task_branch": "aide/020"
}

View File

@@ -68,12 +68,11 @@ ccoptimize/
│ │ └── decide/ 待定项确认
│ ├── bin/ 可执行脚本
│ ├── docs/ 程序文档
── lib/ 依赖库
│ └── offline-installer/ 离线安装器
── lib/ 依赖库
├── aide-marketplace/ 插件市场(~21 文件)
│ ├── .claude-plugin/ 市场配置
│ └── aide-plugin/ Aide 插件(版本 2.1.0
│ ├── commands/ 斜杠命令(含 auto-run/install-linux/win
│ ├── commands/ 斜杠命令
│ ├── skills/ 技能定义
│ └── docs/ 插件文档
├── docs/ 项目文档

View File

@@ -31,7 +31,6 @@ ccoptimize/
│ ├── bin/ 可执行脚本
│ ├── docs/ 程序文档
│ ├── lib/ 依赖库plantuml.jar
│ ├── offline-installer/ 离线安装器
│ ├── .venv/ [ignored] 虚拟环境
│ ├── requirements.txt 依赖清单
│ └── .gitignore 忽略规则
@@ -76,7 +75,6 @@ ccoptimize/
- `aide/decide/` - 待定项确认模块
- `bin/` - 可执行脚本
- `docs/` - 程序文档
- `offline-installer/` - 离线安装器Linux/Windows
### 区块 2aide-marketplace插件市场
@@ -86,7 +84,7 @@ ccoptimize/
- **状态**:已完成
- **说明**Aide 插件市场和 aide-plugin 源码(版本 2.1.0),包括:
- `.claude-plugin/` - 市场配置
- `aide-plugin/commands/` - 斜杠命令定义(含 auto-run、install-linux、install-win
- `aide-plugin/commands/` - 斜杠命令定义
- `aide-plugin/skills/` - 技能定义
- `aide-plugin/docs/` - 插件文档

View File

@@ -19,8 +19,6 @@ aide-marketplace/
├── commands/ 斜杠命令定义
│ ├── auto-run.md /aide:auto-run 全自动任务执行572 行)
│ ├── docs.md /aide:docs 文档管理400 行)
│ ├── install-linux.md /aide:install-linux Linux 环境安装692 行)
│ ├── install-win.md /aide:install-win Windows 环境安装
│ ├── load.md /aide:load 项目认知载入96 行)
│ ├── run.md /aide:run 任务执行392 行)
│ └── setup.md /aide:setup 环境配置93 行)
@@ -53,8 +51,6 @@ aide-marketplace/
| aide-plugin/.claude-plugin/plugin.json | 配置 | 插件元数据,版本 2.1.0 |
| aide-plugin/commands/auto-run.md | Command | /aide:auto-run 全自动任务执行流程 |
| aide-plugin/commands/docs.md | Command | /aide:docs 项目文档管理流程 |
| aide-plugin/commands/install-linux.md | Command | /aide:install-linux Linux 环境安装流程 |
| aide-plugin/commands/install-win.md | Command | /aide:install-win Windows 环境安装流程 |
| aide-plugin/commands/load.md | Command | /aide:load 项目认知载入流程 |
| aide-plugin/commands/run.md | Command | /aide:run 任务执行核心流程 |
| aide-plugin/commands/setup.md | Command | /aide:setup 环境配置流程 |
@@ -70,8 +66,6 @@ aide-marketplace/
| 命令 | 职责 | 触发 Skill | 独立运行 |
|------|------|------------|----------|
| `/aide:setup` | 环境配置(分析、检测、修复) | env-config | 是 |
| `/aide:install-linux` | Linux 环境安装 | aide | 是 |
| `/aide:install-win` | Windows 环境安装 | aide | 是 |
| `/aide:load` | 项目认知载入 | aide | 否(由 run 调用) |
| `/aide:docs` | 项目文档创建和维护 | aide | 是 |
| `/aide:run` | 任务执行(核心命令) | aide | 否 |
@@ -179,6 +173,5 @@ task-optimize → flow-design → impl → verify → docs → finish
2. **版本管理**:当前版本 2.1.0
- 2.0.8 → 2.1.0:新增 `/aide:auto-run` 全自动任务执行命令
-`/aide:init``/aide:prep``/aide:exec` 已重组为 `/aide:setup``/aide:load``/aide:docs``/aide:run`
- 新增 `/aide:install-linux``/aide:install-win` 环境安装命令
3. **触发机制**Skills 按需触发,避免信息过载

View File

@@ -91,15 +91,6 @@ aide-program/
│ └── data.md 数据格式
├── lib/ 依赖库
│ └── plantuml.jar PlantUML二进制
├── offline-installer/ 离线安装器目录
│ ├── linux/ Linux 安装
│ │ ├── install.sh 安装脚本470 行)
│ │ ├── README.md 安装说明
│ │ └── resources.json 资源配置
│ └── windows/ Windows 安装
│ ├── install.ps1 PowerShell 安装脚本405 行)
│ ├── README.md 安装说明
│ └── resources.json 资源配置
├── .venv/ [ignored] 虚拟环境
├── requirements.txt Python 依赖
└── .gitignore 忽略规则

View File

@@ -6,6 +6,33 @@
### 新增功能
**PlantUML 渲染配置**
- 新增 `plantuml.font_name` 配置项:默认字体 "Arial"
- 新增 `plantuml.dpi` 配置项:默认 DPI 300
- 新增 `plantuml.scale` 配置项:默认缩放 0.5
- run.md 流程图示例更新:添加配置获取说明和 skinparam/scale 示例
**finish 环节清理任务计划文件**
- run.md finish 环节新增清理任务计划文件(`.aide/task-plans/`)的指导
**返工流程警告增强**
- `aide flow back-part` 输出确认 key 前,新增 rework skill 学习提示
- 明确要求完成准备工作后才能确认返工
### 移除
**移除安装命令和离线安装程序**
- 删除 `/aide:install-linux` 命令(`aide-marketplace/aide-plugin/commands/install-linux.md`
- 删除 `/aide:install-win` 命令(`aide-marketplace/aide-plugin/commands/install-win.md`
- 删除 `aide-program/offline-installer/` 目录及其全部内容
- 清理项目文档中的相关引用
### 新增功能
**返工流程优化**
- 新增 `rework` skill提供返工流程指南包含返工类型判断、文档更新格式、用户提醒模板

View File

@@ -1,7 +1,7 @@
{
"name": "aide-plugin",
"description": "Aide 工作流体系插件,提供环境配置、项目认知、文档管理和任务执行(含全自动模式)的标准化流程",
"version": "2.1.0",
"version": "2.1.2",
"author": {
"name": "Aide Team"
},

View File

@@ -1,691 +0,0 @@
# Aide Linux 环境安装
你正在执行 Aide Linux 环境安装流程。这是一个**独立运行**的命令,用于在 Linux 系统上安装 aide 所需的全部环境依赖。
## 概述
本命令将检测并安装以下工具:
- **uv** - Python 包管理器(用于管理 Python 和依赖)
- **Python** - aide 运行时环境(通过 uv 安装)
- **Java JRE** - PlantUML 运行依赖(用于生成流程图)
---
## 开始
### 1. 系统检测
首先确认当前系统是 Linux
```bash
uname -s
```
如果不是 Linux 系统,请提示用户使用 `/aide:install-win` 命令。
### 2. 发行版识别
检测 Linux 发行版类型:
```bash
# 读取发行版信息
cat /etc/os-release 2>/dev/null || lsb_release -a 2>/dev/null
```
根据发行版确定包管理器:
- **Debian/Ubuntu**: apt
- **RHEL/Fedora/CentOS**: dnf (或 yum)
- **Arch/Manjaro**: pacman
- **openSUSE**: zypper
- **其他**: 手动安装
### 3. 环境检测
检测当前环境中各工具的可用性:
#### 3.1 检测 uv
```bash
uv --version 2>/dev/null
```
#### 3.2 检测 Python
```bash
# 先尝试 uv 管理的 Python
uv python list 2>/dev/null
# 如果 uv 不可用,检测系统 Python
python3 --version 2>/dev/null
python --version 2>/dev/null
```
#### 3.3 检测 Java
```bash
java -version 2>&1
```
#### 3.4 汇总检测结果
根据检测结果,列出:
- 已安装的工具及版本
- 缺失的工具
如果所有工具都已安装跳转到「aide PATH 配置」章节。
---
### 4. 安装模式选择
向用户询问安装模式:
**模式 A自动安装**
- 生成安装报告,用户确认后自动执行安装
- 适合希望快速完成的用户
**模式 B手动指南**
- 生成详细的操作指南和自动化脚本
- 用户可以自行选择执行
- 适合需要完全控制安装过程的用户
使用 AskUserQuestion 工具询问用户选择。
---
### 5. 模式 A自动安装
#### 5.1 生成安装报告
在执行任何安装操作前,必须先生成安装报告,内容包括:
**将要执行的操作**
- 列出每个需要安装的工具
- 说明安装命令
**安装位置**
- uv: `~/.local/bin/``~/.cargo/bin/`
- Python: 由 uv 管理,位于 `~/.local/share/uv/python/`
- Java: 系统包管理器默认位置或 `/opt/java/`
**可能的副作用**
- 会修改 shell 配置文件 (~/.bashrc, ~/.zshrc)
- Java 安装可能需要 sudo 权限
**潜在风险**
- 如果已有其他 Python 安装,可能产生版本冲突
- 需要网络连接下载安装包
#### 5.2 请求用户确认
使用 AskUserQuestion 工具,展示报告并请求用户确认。
如果用户不确认,取消安装并退出。
#### 5.3 执行安装
##### 安装 uv如需要
```bash
# 使用官方安装脚本
curl -LsSf https://astral.sh/uv/install.sh | sh
```
安装后重新加载 shell 环境:
```bash
# 加载新的 PATH
source ~/.bashrc 2>/dev/null || source ~/.zshrc 2>/dev/null
# 或者直接添加到当前会话
export PATH="$HOME/.local/bin:$PATH"
# 验证安装
uv --version
```
##### 安装 Python如需要
```bash
# 使用 uv 安装 Python 3.11
uv python install 3.11
# 验证安装
uv python list
```
##### 安装 Java JRE如需要
根据发行版使用对应的包管理器:
**Debian/Ubuntu (apt)**
```bash
sudo apt update
sudo apt install -y openjdk-17-jre-headless
```
**RHEL/Fedora (dnf)**
```bash
sudo dnf install -y java-17-openjdk-headless
```
**CentOS (yum)**
```bash
sudo yum install -y java-17-openjdk-headless
```
**Arch (pacman)**
```bash
sudo pacman -S --noconfirm jre17-openjdk-headless
```
**openSUSE (zypper)**
```bash
sudo zypper install -y java-17-openjdk-headless
```
**无包管理器或其他发行版**
提供 Adoptium Temurin JRE 下载链接:
- https://adoptium.net/temurin/releases/?os=linux&arch=x64&package=jre
指导用户下载 tarball 并手动安装:
```bash
# 下载后解压
tar -xzf OpenJDK17U-jre_x64_linux_*.tar.gz -C /opt/
# 创建符号链接
sudo ln -sf /opt/jdk-17*/bin/java /usr/local/bin/java
```
安装后验证:
```bash
java -version
```
#### 5.4 汇报安装结果
列出每个工具的安装状态和版本。
---
### 6. 模式 B手动指南
#### 6.1 生成 Markdown 操作指南
创建文件 `aide-install-guide.md`,内容包括:
```markdown
# Aide 环境安装指南 (Linux)
## 1. 安装 uv
uv 是 Astral 开发的高性能 Python 包管理器。
### 方法一:官方脚本(推荐)
```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```
安装后重新加载 shell
```bash
source ~/.bashrc # 或 source ~/.zshrc
```
### 方法二:手动下载
1. 访问 https://github.com/astral-sh/uv/releases
2. 下载 `uv-x86_64-unknown-linux-gnu.tar.gz`
3. 解压到 `~/.local/bin/`
4. 确保 `~/.local/bin` 在 PATH 中
### 验证安装
```bash
uv --version
```
## 2. 安装 Python
使用 uv 安装受管理的 Python
```bash
uv python install 3.11
```
### 验证安装
```bash
uv python list
```
## 3. 安装 Java JRE
Java 用于运行 PlantUML 生成流程图。
### Debian/Ubuntu
```bash
sudo apt update
sudo apt install openjdk-17-jre-headless
```
### RHEL/Fedora
```bash
sudo dnf install java-17-openjdk-headless
```
### Arch Linux
```bash
sudo pacman -S jre17-openjdk-headless
```
### 手动安装(通用)
1. 访问 https://adoptium.net/temurin/releases/?os=linux&arch=x64&package=jre
2. 下载 tarball
3. 解压并配置:
```bash
tar -xzf OpenJDK17U-jre_x64_linux_*.tar.gz -C /opt/
sudo ln -sf /opt/jdk-17*/bin/java /usr/local/bin/java
```
### 验证安装
```bash
java -version
```
## 4. 配置 aide PATH
将 aide-program 添加到 PATH
### Bash 用户
```bash
echo 'export PATH="$PATH:/path/to/aide-program/bin"' >> ~/.bashrc
source ~/.bashrc
```
### Zsh 用户
```bash
echo 'export PATH="$PATH:/path/to/aide-program/bin"' >> ~/.zshrc
source ~/.zshrc
```
### Fish 用户
```fish
set -Ua fish_user_paths /path/to/aide-program/bin
```
## 5. 验证安装
```bash
aide env ensure --runtime
```
## 常见问题
### Q: uv 安装后命令找不到?
A: 运行 `source ~/.bashrc` 或重新打开终端。
### Q: Python 版本冲突?
A: uv 管理的 Python 独立于系统 Python不会冲突。
### Q: sudo 权限问题?
A: Java 安装需要 root 权限,或使用 Adoptium tarball 安装到用户目录。
```
#### 6.2 生成 Shell 安装脚本
创建文件 `aide-install.sh`
```bash
#!/bin/bash
#
# Aide 环境自动安装脚本 (Linux)
#
# 此脚本用于安装 aide 工具所需的环境依赖:
# - uv (Python 包管理器)
# - Python (通过 uv 安装)
# - Java JRE (用于 PlantUML)
#
# 用法:
# chmod +x aide-install.sh
# ./aide-install.sh [--aide-path /path/to/aide-program]
#
# 选项:
# --aide-path PATH 指定 aide-program 目录路径
# --skip-uv 跳过 uv 安装
# --skip-python 跳过 Python 安装
# --skip-java 跳过 Java 安装
# -h, --help 显示帮助信息
#
set -e
# 颜色定义
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
# 输出函数
success() { echo -e "${GREEN}✓${NC} $1"; }
warning() { echo -e "${YELLOW}⚠${NC} $1"; }
error() { echo -e "${RED}✗${NC} $1"; }
info() { echo -e "${CYAN}→${NC} $1"; }
# 默认值
AIDE_PATH=""
SKIP_UV=false
SKIP_PYTHON=false
SKIP_JAVA=false
# 解析参数
while [[ $# -gt 0 ]]; do
case $1 in
--aide-path)
AIDE_PATH="$2"
shift 2
;;
--skip-uv)
SKIP_UV=true
shift
;;
--skip-python)
SKIP_PYTHON=true
shift
;;
--skip-java)
SKIP_JAVA=true
shift
;;
-h|--help)
echo "用法: $0 [选项]"
echo ""
echo "选项:"
echo " --aide-path PATH 指定 aide-program 目录路径"
echo " --skip-uv 跳过 uv 安装"
echo " --skip-python 跳过 Python 安装"
echo " --skip-java 跳过 Java 安装"
echo " -h, --help 显示帮助信息"
exit 0
;;
*)
error "未知选项: $1"
exit 1
;;
esac
done
# 检测命令是否可用
command_exists() {
command -v "$1" >/dev/null 2>&1
}
# 检测发行版
detect_distro() {
if [ -f /etc/os-release ]; then
. /etc/os-release
echo "$ID"
elif command_exists lsb_release; then
lsb_release -is | tr '[:upper:]' '[:lower:]'
else
echo "unknown"
fi
}
# 获取包管理器
get_package_manager() {
local distro=$(detect_distro)
case $distro in
ubuntu|debian|linuxmint|pop)
echo "apt"
;;
fedora|rhel|centos|rocky|almalinux)
if command_exists dnf; then
echo "dnf"
else
echo "yum"
fi
;;
arch|manjaro|endeavouros)
echo "pacman"
;;
opensuse*)
echo "zypper"
;;
*)
echo "unknown"
;;
esac
}
echo "========================================"
echo " Aide 环境安装脚本 (Linux) "
echo "========================================"
echo ""
DISTRO=$(detect_distro)
PKG_MANAGER=$(get_package_manager)
info "检测到发行版: $DISTRO"
info "包管理器: $PKG_MANAGER"
echo ""
# 1. 安装 uv
if [ "$SKIP_UV" = false ]; then
info "检测 uv..."
if command_exists uv; then
UV_VERSION=$(uv --version 2>&1)
success "uv 已安装: $UV_VERSION"
else
info "安装 uv..."
curl -LsSf https://astral.sh/uv/install.sh | sh
# 加载新的 PATH
export PATH="$HOME/.local/bin:$PATH"
if command_exists uv; then
success "uv 安装成功"
else
warning "uv 安装后需要重启终端"
fi
fi
fi
# 2. 安装 Python
if [ "$SKIP_PYTHON" = false ]; then
info "检测 Python..."
if command_exists uv; then
PYTHON_LIST=$(uv python list 2>&1 || true)
if echo "$PYTHON_LIST" | grep -q "3\."; then
success "Python 已通过 uv 安装"
else
info "通过 uv 安装 Python 3.11..."
uv python install 3.11
success "Python 3.11 安装成功"
fi
else
warning "uv 不可用,无法安装 Python"
fi
fi
# 3. 安装 Java
if [ "$SKIP_JAVA" = false ]; then
info "检测 Java..."
if command_exists java; then
JAVA_VERSION=$(java -version 2>&1 | head -n 1)
success "Java 已安装: $JAVA_VERSION"
else
info "安装 Java JRE..."
case $PKG_MANAGER in
apt)
sudo apt update
sudo apt install -y openjdk-17-jre-headless
;;
dnf)
sudo dnf install -y java-17-openjdk-headless
;;
yum)
sudo yum install -y java-17-openjdk-headless
;;
pacman)
sudo pacman -S --noconfirm jre17-openjdk-headless
;;
zypper)
sudo zypper install -y java-17-openjdk-headless
;;
*)
warning "未检测到支持的包管理器,请手动安装 Java JRE"
info "下载地址: https://adoptium.net/temurin/releases/?os=linux&arch=x64&package=jre"
;;
esac
if command_exists java; then
success "Java 安装成功"
fi
fi
fi
# 4. 配置 aide PATH
if [ -n "$AIDE_PATH" ]; then
BIN_PATH="$AIDE_PATH/bin"
if [ -d "$BIN_PATH" ]; then
# 检测当前 shell
SHELL_NAME=$(basename "$SHELL")
case $SHELL_NAME in
bash)
RC_FILE="$HOME/.bashrc"
;;
zsh)
RC_FILE="$HOME/.zshrc"
;;
*)
RC_FILE="$HOME/.profile"
;;
esac
if ! grep -q "$BIN_PATH" "$RC_FILE" 2>/dev/null; then
info "添加 aide 到 PATH ($RC_FILE)..."
echo "" >> "$RC_FILE"
echo "# Aide" >> "$RC_FILE"
echo "export PATH=\"\$PATH:$BIN_PATH\"" >> "$RC_FILE"
export PATH="$PATH:$BIN_PATH"
success "aide 已添加到 PATH"
else
success "aide 已在 PATH 中"
fi
else
warning "aide-program/bin 目录不存在: $BIN_PATH"
fi
fi
echo ""
echo "========================================"
echo " 安装完成!请重启终端后使用 "
echo "========================================"
```
#### 6.3 保存文件
将上述两个文件保存到当前工作目录,并告知用户文件位置。
同时设置脚本执行权限:
```bash
chmod +x aide-install.sh
```
---
### 7. aide PATH 配置
检测 aide-program 的位置(通常是本仓库的 `aide-program/bin` 目录)。
#### 7.1 检测当前 PATH
```bash
echo $PATH | tr ':' '\n' | grep -i aide
```
#### 7.2 如果 aide 不在 PATH 中
检测用户的 shell 类型:
```bash
echo $SHELL
```
根据 shell 类型生成配置命令:
**Bash**
```bash
echo 'export PATH="$PATH:/完整路径/aide-program/bin"' >> ~/.bashrc
source ~/.bashrc
```
**Zsh**
```bash
echo 'export PATH="$PATH:/完整路径/aide-program/bin"' >> ~/.zshrc
source ~/.zshrc
```
**Fish**
```fish
set -Ua fish_user_paths /完整路径/aide-program/bin
```
#### 7.3 验证配置
```bash
which aide
aide --help
```
---
### 8. 最终验证
运行 aide 环境检测:
```bash
aide env ensure --runtime
```
如果验证通过,显示成功信息。
如果验证失败,显示问题诊断和解决建议。
---
## 完成
安装完成后,向用户汇报:
```
环境安装完成:
- uv: [版本]
- Python: [版本]
- Java: [版本]
- aide: [PATH 状态]
- 发行版: [检测到的发行版]
下一步:
- 运行 /aide:setup 配置项目环境
- 或直接使用 /aide:run 执行任务
```
---
## 注意事项
- 此命令是**独立运行**的,通常在首次使用 aide 前执行一次
- 所有安装操作都需要用户确认,不会静默修改系统
- Java 安装可能需要 sudo 权限
- 如果安装过程中断,可以重新运行此命令继续
- 建议在安装完成后重启终端以确保环境变量生效

View File

@@ -1,535 +0,0 @@
# Aide Windows 环境安装
你正在执行 Aide Windows 环境安装流程。这是一个**独立运行**的命令,用于在 Windows 系统上安装 aide 所需的全部环境依赖。
## 概述
本命令将检测并安装以下工具:
- **uv** - Python 包管理器(用于管理 Python 和依赖)
- **Python** - aide 运行时环境(通过 uv 安装)
- **Java JRE** - PlantUML 运行依赖(用于生成流程图)
---
## 开始
### 1. 系统检测
首先确认当前系统是 Windows
```powershell
# 检测操作系统
$env:OS
```
如果不是 Windows 系统,请提示用户使用 `/aide:install-linux` 命令。
### 2. 环境检测
检测当前环境中各工具的可用性:
#### 2.1 检测 uv
```powershell
uv --version
```
#### 2.2 检测 Python
```powershell
# 先尝试 uv 管理的 Python
uv python list 2>$null
# 如果 uv 不可用,检测系统 Python
python --version 2>$null
python3 --version 2>$null
```
#### 2.3 检测 Java
```powershell
java -version 2>&1
```
#### 2.4 汇总检测结果
根据检测结果,列出:
- 已安装的工具及版本
- 缺失的工具
如果所有工具都已安装跳转到「aide PATH 配置」章节。
---
### 3. 安装模式选择
向用户询问安装模式:
**模式 A自动安装**
- 生成安装报告,用户确认后自动执行安装
- 适合希望快速完成的用户
**模式 B手动指南**
- 生成详细的操作指南和自动化脚本
- 用户可以自行选择执行
- 适合需要完全控制安装过程的用户
使用 AskUserQuestion 工具询问用户选择。
---
### 4. 模式 A自动安装
#### 4.1 生成安装报告
在执行任何安装操作前,必须先生成安装报告,内容包括:
**将要执行的操作**
- 列出每个需要安装的工具
- 说明安装命令
**安装位置**
- uv: `%USERPROFILE%\.local\bin\``%USERPROFILE%\.cargo\bin\`
- Python: 由 uv 管理,位于 `%USERPROFILE%\.local\share\uv\python\`
- Java: 取决于安装方式winget/scoop/手动)
**可能的副作用**
- 会修改用户 PATH 环境变量
- 可能需要重启终端生效
**潜在风险**
- 如果已有其他 Python 安装,可能产生版本冲突
- 需要网络连接下载安装包
#### 4.2 请求用户确认
使用 AskUserQuestion 工具,展示报告并请求用户确认。
如果用户不确认,取消安装并退出。
#### 4.3 执行安装
##### 安装 uv如需要
```powershell
# 使用官方安装脚本
irm https://astral.sh/uv/install.ps1 | iex
```
安装后验证:
```powershell
# 刷新环境变量
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","User") + ";" + [System.Environment]::GetEnvironmentVariable("Path","Machine")
# 验证安装
uv --version
```
##### 安装 Python如需要
```powershell
# 使用 uv 安装 Python 3.11
uv python install 3.11
# 验证安装
uv python list
```
##### 安装 Java JRE如需要
检测可用的包管理器:
```powershell
# 检测 winget
winget --version 2>$null
# 检测 scoop
scoop --version 2>$null
# 检测 chocolatey
choco --version 2>$null
```
根据可用的包管理器选择安装方式:
**使用 winget推荐**
```powershell
winget install EclipseAdoptium.Temurin.17.JRE
```
**使用 scoop**
```powershell
scoop bucket add java
scoop install temurin17-jre
```
**使用 chocolatey**
```powershell
choco install temurin17jre -y
```
**无包管理器**
提供 Adoptium Temurin JRE 下载链接:
- https://adoptium.net/temurin/releases/?os=windows&arch=x64&package=jre
指导用户下载并手动安装 MSI 包。
安装后验证:
```powershell
java -version
```
#### 4.4 汇报安装结果
列出每个工具的安装状态和版本。
---
### 5. 模式 B手动指南
#### 5.1 生成 Markdown 操作指南
创建文件 `aide-install-guide.md`,内容包括:
```markdown
# Aide 环境安装指南 (Windows)
## 1. 安装 uv
uv 是 Astral 开发的高性能 Python 包管理器。
### 方法一PowerShell 脚本(推荐)
```powershell
irm https://astral.sh/uv/install.ps1 | iex
```
### 方法二:手动下载
1. 访问 https://github.com/astral-sh/uv/releases
2. 下载 `uv-x86_64-pc-windows-msvc.zip`
3. 解压到 `%USERPROFILE%\.local\bin\`
4. 将该目录添加到 PATH
### 验证安装
```powershell
uv --version
```
## 2. 安装 Python
使用 uv 安装受管理的 Python
```powershell
uv python install 3.11
```
### 验证安装
```powershell
uv python list
```
## 3. 安装 Java JRE
Java 用于运行 PlantUML 生成流程图。
### 方法一:使用 winget推荐
```powershell
winget install EclipseAdoptium.Temurin.17.JRE
```
### 方法二:使用 scoop
```powershell
scoop bucket add java
scoop install temurin17-jre
```
### 方法三:手动下载
1. 访问 https://adoptium.net/temurin/releases/?os=windows&arch=x64&package=jre
2. 下载 MSI 安装包
3. 运行安装程序
### 验证安装
```powershell
java -version
```
## 4. 配置 aide PATH
将 aide-program 添加到系统 PATH
```powershell
# 获取 aide-program 路径(根据实际位置调整)
$aidePath = "C:\path\to\aide-program\bin"
# 添加到用户 PATH
$currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
if ($currentPath -notlike "*$aidePath*") {
[Environment]::SetEnvironmentVariable("Path", "$currentPath;$aidePath", "User")
}
```
## 5. 验证安装
```powershell
# 重启终端后运行
aide env ensure --runtime
```
## 常见问题
### Q: uv 安装后命令找不到?
A: 重启终端或手动刷新环境变量。
### Q: Python 版本冲突?
A: uv 管理的 Python 独立于系统 Python不会冲突。
### Q: Java 安装后仍然找不到?
A: 检查 JAVA_HOME 和 PATH 是否正确配置。
```
#### 5.2 生成 PowerShell 安装脚本
创建文件 `aide-install.ps1`
```powershell
#Requires -Version 5.1
<#
.SYNOPSIS
Aide 环境自动安装脚本 (Windows)
.DESCRIPTION
此脚本用于安装 aide 工具所需的环境依赖:
- uv (Python 包管理器)
- Python (通过 uv 安装)
- Java JRE (用于 PlantUML)
.PARAMETER AideProgramPath
aide-program 目录的路径
.PARAMETER SkipUv
跳过 uv 安装
.PARAMETER SkipPython
跳过 Python 安装
.PARAMETER SkipJava
跳过 Java 安装
.EXAMPLE
.\aide-install.ps1 -AideProgramPath "C:\projects\aide-program"
.NOTES
作者: aide
版本: 1.0
#>
param(
[string]$AideProgramPath,
[switch]$SkipUv,
[switch]$SkipPython,
[switch]$SkipJava
)
# 颜色输出函数
function Write-Success { Write-Host "✓ $args" -ForegroundColor Green }
function Write-Warning { Write-Host "⚠ $args" -ForegroundColor Yellow }
function Write-Error { Write-Host "✗ $args" -ForegroundColor Red }
function Write-Info { Write-Host "→ $args" -ForegroundColor Cyan }
# 检测工具是否可用
function Test-Command {
param([string]$Command)
$null -ne (Get-Command $Command -ErrorAction SilentlyContinue)
}
# 刷新环境变量
function Update-Path {
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","User") + ";" + [System.Environment]::GetEnvironmentVariable("Path","Machine")
}
Write-Host "========================================" -ForegroundColor Cyan
Write-Host " Aide 环境安装脚本 (Windows) " -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# 1. 安装 uv
if (-not $SkipUv) {
Write-Info "检测 uv..."
if (Test-Command "uv") {
$uvVersion = uv --version 2>&1
Write-Success "uv 已安装: $uvVersion"
} else {
Write-Info "安装 uv..."
try {
Invoke-RestMethod https://astral.sh/uv/install.ps1 | Invoke-Expression
Update-Path
if (Test-Command "uv") {
Write-Success "uv 安装成功"
} else {
Write-Error "uv 安装后仍无法找到,请重启终端后重试"
}
} catch {
Write-Error "uv 安装失败: $_"
}
}
}
# 2. 安装 Python
if (-not $SkipPython) {
Write-Info "检测 Python..."
if (Test-Command "uv") {
$pythonList = uv python list 2>&1
if ($pythonList -match "3\.\d+") {
Write-Success "Python 已通过 uv 安装"
} else {
Write-Info "通过 uv 安装 Python 3.11..."
uv python install 3.11
Write-Success "Python 3.11 安装成功"
}
} else {
Write-Warning "uv 不可用,无法安装 Python"
}
}
# 3. 安装 Java
if (-not $SkipJava) {
Write-Info "检测 Java..."
if (Test-Command "java") {
$javaVersion = java -version 2>&1 | Select-Object -First 1
Write-Success "Java 已安装: $javaVersion"
} else {
Write-Info "安装 Java JRE..."
if (Test-Command "winget") {
Write-Info "使用 winget 安装..."
winget install EclipseAdoptium.Temurin.17.JRE --silent
Update-Path
} elseif (Test-Command "scoop") {
Write-Info "使用 scoop 安装..."
scoop bucket add java
scoop install temurin17-jre
} elseif (Test-Command "choco") {
Write-Info "使用 chocolatey 安装..."
choco install temurin17jre -y
Update-Path
} else {
Write-Warning "未检测到包管理器,请手动安装 Java JRE"
Write-Info "下载地址: https://adoptium.net/temurin/releases/?os=windows&arch=x64&package=jre"
}
if (Test-Command "java") {
Write-Success "Java 安装成功"
}
}
}
# 4. 配置 aide PATH
if ($AideProgramPath) {
$binPath = Join-Path $AideProgramPath "bin"
if (Test-Path $binPath) {
$currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
if ($currentPath -notlike "*$binPath*") {
Write-Info "添加 aide 到 PATH..."
[Environment]::SetEnvironmentVariable("Path", "$currentPath;$binPath", "User")
Update-Path
Write-Success "aide 已添加到 PATH"
} else {
Write-Success "aide 已在 PATH 中"
}
} else {
Write-Warning "aide-program/bin 目录不存在: $binPath"
}
}
Write-Host ""
Write-Host "========================================" -ForegroundColor Cyan
Write-Host " 安装完成!请重启终端后使用 " -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
```
#### 5.3 保存文件
将上述两个文件保存到当前工作目录,并告知用户文件位置。
---
### 6. aide PATH 配置
检测 aide-program 的位置(通常是本仓库的 `aide-program/bin` 目录)。
#### 6.1 检测当前 PATH
```powershell
$env:Path -split ";" | Where-Object { $_ -like "*aide*" }
```
#### 6.2 如果 aide 不在 PATH 中
生成配置命令:
```powershell
# 获取 aide-program 完整路径
$aidePath = "完整路径\aide-program\bin"
# 方法一:临时添加(当前会话)
$env:Path += ";$aidePath"
# 方法二:永久添加(用户级别)
$currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
[Environment]::SetEnvironmentVariable("Path", "$currentPath;$aidePath", "User")
```
#### 6.3 验证配置
```powershell
# 重启终端后
aide --help
```
---
### 7. 最终验证
运行 aide 环境检测:
```powershell
aide env ensure --runtime
```
如果验证通过,显示成功信息。
如果验证失败,显示问题诊断和解决建议。
---
## 完成
安装完成后,向用户汇报:
```
环境安装完成:
- uv: [版本]
- Python: [版本]
- Java: [版本]
- aide: [PATH 状态]
下一步:
- 运行 /aide:setup 配置项目环境
- 或直接使用 /aide:run 执行任务
```
---
## 注意事项
- 此命令是**独立运行**的,通常在首次使用 aide 前执行一次
- 所有安装操作都需要用户确认,不会静默修改系统
- 如果安装过程中断,可以重新运行此命令继续
- 建议在安装完成后重启终端以确保环境变量生效

View File

@@ -274,8 +274,23 @@ aide config get flow.diagram_path
##### 流程图示例结构
**必须在 PlantUML 文件头部添加渲染配置**
```bash
# 获取配置值
aide config get plantuml.font_name # 默认 "Arial"
aide config get plantuml.dpi # 默认 300
aide config get plantuml.scale # 默认 0.5
```
将获取的值添加到 PlantUML 文件头部:
```plantuml
@startuml
skinparam defaultFontName "Arial"
skinparam dpi 300
scale 0.5
' 主程序流程图
start
:初始化配置;
@@ -395,6 +410,12 @@ aide flow next-part finish "用户确认通过,进入收尾"
```
- 清理临时文件
- 清理任务计划文件(如有):
```bash
# 获取任务计划目录
aide config get task.plans_path
# 删除目录下的所有文件guide.md, spec-*.md 等)
```
- 检查遗漏的 TODO
- 向用户汇报完成情况

View File

@@ -302,6 +302,21 @@ jar_path = "lib/plantuml.jar"
# 默认使用系统 PATH 中的 java
# java_path = "/usr/bin/java"
# 流程图渲染配置
# LLM 编写 PlantUML 时应在文件头部添加这些配置:
# skinparam defaultFontName "<font_name>"
# skinparam dpi <dpi>
# scale <scale>
# 默认字体名称
font_name = "Arial"
# DPI 值(影响图片清晰度)
dpi = 300
# 缩放系数0.5 表示缩小到 50%
scale = 0.5
################################################################################
# [decide] - 待定项确认配置
################################################################################

View File

@@ -55,8 +55,11 @@ class FlowTracker:
# 生成新的确认 key
key = self.storage.save_back_confirm_state(phase, reason)
output.warn("返工需要确认。请先完成准备工作,然后执行:")
output.info(f"aide flow back-confirm --key {key}")
output.warn("返工需要确认。请先完成以下准备工作:")
output.info("1. 触发 rework skill 学习返工流程指南")
output.info("2. 按照指南更新任务文档(记录返工原因和新需求)")
output.info("3. 完成准备工作后执行:")
output.info(f" aide flow back-confirm --key {key}")
return True
except FlowError as exc:

View File

@@ -1,209 +0,0 @@
# Aide 离线安装程序 (Linux)
本目录包含 Aide 工具的 Linux 离线安装程序,用于在无网络或受限网络环境下安装所需的环境依赖。
## 概述
此离线安装程序可以安装以下组件:
- **uv** - 高性能 Python 包管理器
- **Java JRE 17** - PlantUML 运行依赖
- **Python 3.11** - Aide 运行时(通过 uv 安装,需要网络)
## 使用步骤
### 第 1 步:下载资源文件
参考 `resources.json` 中的下载链接,下载以下文件到本目录:
| 文件名 | 说明 | 下载链接 |
|--------|------|----------|
| `uv-x86_64-unknown-linux-gnu.tar.gz` | uv 安装包 | [GitHub Releases](https://github.com/astral-sh/uv/releases/latest) |
| `OpenJDK17U-jre_x64_linux_hotspot_*.tar.gz` | Java JRE 17 | [Adoptium](https://adoptium.net/temurin/releases/?os=linux&arch=x64&package=jre&version=17) |
> **注意**Java JRE 的版本号可能会更新,请下载最新的 JRE 17 版本。脚本会自动识别 `OpenJDK17U-jre_x64_linux_*.tar.gz` 格式的文件。
### 第 2 步:运行安装脚本
```bash
# 添加执行权限
chmod +x install.sh
# 运行安装脚本
./install.sh
```
### 第 3 步:配置 aide PATH可选
如果要将 aide 添加到系统 PATH运行时指定 aide-program 路径:
```bash
./install.sh --aide-path /path/to/aide-program
```
### 第 4 步:安装 Python
由于 Python 需要通过 uv 下载,离线安装无法自动完成。请在有网络的环境下运行:
```bash
uv python install 3.11
```
> **提示**:如果需要完全离线安装,可以在有网络的机器上提前运行此命令,然后复制 `~/.local/share/uv/python/` 目录到目标机器。
### 第 5 步:刷新环境并验证
```bash
# 刷新 shell 环境
source ~/.bashrc # 或 source ~/.zshrc
# 检查各组件版本
uv --version
java -version
# 验证 aide 环境
aide env ensure --runtime
```
## 命令行选项
```bash
./install.sh [选项]
```
| 选项 | 说明 |
|------|------|
| `--aide-path PATH` | 指定 aide-program 目录路径,自动添加到 PATH |
| `--java-path PATH` | 指定 Java 安装路径(默认 `~/.local/java/jre-17` |
| `--system-java` | 安装 Java 到 `/opt/java/jre-17`(需要 sudo |
| `--silent` | 静默安装模式,不显示交互提示 |
| `--skip-uv` | 跳过 uv 安装 |
| `--skip-java` | 跳过 Java 安装 |
| `-h, --help` | 显示帮助信息 |
## 示例
### 交互式安装(用户目录)
```bash
./install.sh
```
### 静默安装
```bash
./install.sh --silent
```
### 系统级安装(需要 sudo
```bash
./install.sh --system-java
```
### 完整安装(包含 aide PATH 配置)
```bash
./install.sh --aide-path ~/projects/ccoptimize/aide-program
```
### 仅安装 uv
```bash
./install.sh --skip-java
```
## 安装位置
### 用户级安装(默认)
| 组件 | 安装位置 |
|------|----------|
| uv | `~/.local/bin/` |
| Java JRE | `~/.local/java/jre-17/` |
| Python | `~/.local/share/uv/python/` (通过 uv 管理) |
### 系统级安装(--system-java
| 组件 | 安装位置 |
|------|----------|
| uv | `~/.local/bin/` |
| Java JRE | `/opt/java/jre-17/` |
## 环境变量
安装程序会自动在 shell 配置文件中添加以下内容:
```bash
# ~/.bashrc 或 ~/.zshrc
export PATH="$PATH:~/.local/bin"
export PATH="$PATH:~/.local/java/jre-17/bin" # 或 /opt/java/jre-17/bin
export JAVA_HOME="~/.local/java/jre-17" # 或 /opt/java/jre-17
```
## 支持的 Shell
- Bash (`~/.bashrc`)
- Zsh (`~/.zshrc`)
- Fish (`~/.config/fish/config.fish`)
- 其他 (`~/.profile`)
## 故障排除
### Q: 运行脚本时提示"权限不足"
A: 确保脚本有执行权限:
```bash
chmod +x install.sh
```
### Q: 安装后命令找不到?
A: 刷新 shell 环境:
```bash
source ~/.bashrc # 或 source ~/.zshrc
```
或者重新打开终端。
### Q: 系统安装 Java 失败?
A: 使用 `--system-java` 选项需要 sudo 权限。或者使用默认的用户级安装。
### Q: uv python install 失败?
A: 此命令需要网络连接。如果在完全离线环境,请在有网络的机器上提前下载 Python然后复制缓存目录。
### Q: 如何完全卸载?
A: 删除以下目录和配置:
```bash
# 删除安装的文件
rm -f ~/.local/bin/uv ~/.local/bin/uvx
rm -rf ~/.local/java/jre-17 # 或 sudo rm -rf /opt/java/jre-17
# 编辑 shell 配置文件,移除相关的 PATH 和 JAVA_HOME 设置
nano ~/.bashrc # 或 ~/.zshrc
```
## 文件清单
```
linux/
├── README.md # 本说明文件
├── resources.json # 资源清单(含下载链接)
├── install.sh # 主安装脚本
├── uv-x86_64-unknown-linux-gnu.tar.gz # [需下载]
└── OpenJDK17U-jre_x64_linux_*.tar.gz # [需下载]
```
## 不同发行版说明
此离线安装程序适用于所有 Linux 发行版x86_64 架构),包括:
- Ubuntu / Debian
- Fedora / RHEL / CentOS
- Arch Linux / Manjaro
- openSUSE
- 其他 x64 Linux 发行版
如果您的系统是 ARM 架构(如 Raspberry Pi请从发布页面下载对应架构的资源文件。

View File

@@ -1,470 +0,0 @@
#!/bin/bash
#
# Aide 离线环境安装脚本 (Linux)
#
# 此脚本从本地资源文件安装 aide 工具所需的环境依赖:
# - uv (Python 包管理器)
# - Java JRE (用于 PlantUML)
#
# 运行前请确保已下载所有必需的资源文件到脚本所在目录。
# 参见 resources.json 获取资源下载链接。
#
# 用法:
# chmod +x install.sh
# ./install.sh [选项]
#
# 选项:
# --aide-path PATH 指定 aide-program 目录路径
# --java-path PATH 指定 Java 安装路径(默认 ~/.local/java/jre-17
# --system-java 使用 /opt/java/jre-17需要 sudo
# --silent 静默安装模式
# --skip-uv 跳过 uv 安装
# --skip-java 跳过 Java 安装
# -h, --help 显示帮助信息
#
# 作者: Aide Team
# 版本: 1.0.0
#
set -e
# ============================================================
# 配置
# ============================================================
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# 资源文件名
UV_TAR_FILE="uv-x86_64-unknown-linux-gnu.tar.gz"
JAVA_TAR_FILE="OpenJDK17U-jre_x64_linux_hotspot_17.0.9_9.tar.gz"
# 默认安装路径
UV_INSTALL_PATH="$HOME/.local/bin"
JAVA_INSTALL_PATH="$HOME/.local/java/jre-17"
# 默认选项
AIDE_PATH=""
SILENT=false
SKIP_UV=false
SKIP_JAVA=false
SYSTEM_JAVA=false
# ============================================================
# 颜色定义
# ============================================================
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
# ============================================================
# 辅助函数
# ============================================================
success() { echo -e "${GREEN}${NC} $1"; }
warning() { echo -e "${YELLOW}${NC} $1"; }
error() { echo -e "${RED}${NC} $1"; }
info() { echo -e "${CYAN}${NC} $1"; }
header() {
echo ""
echo -e "${CYAN}========================================${NC}"
echo -e "${CYAN} $1${NC}"
echo -e "${CYAN}========================================${NC}"
echo ""
}
command_exists() {
command -v "$1" >/dev/null 2>&1
}
get_shell_rc() {
case "$(basename "$SHELL")" in
bash) echo "$HOME/.bashrc" ;;
zsh) echo "$HOME/.zshrc" ;;
fish) echo "$HOME/.config/fish/config.fish" ;;
*) echo "$HOME/.profile" ;;
esac
}
add_to_path() {
local path_to_add="$1"
local rc_file
rc_file=$(get_shell_rc)
if [[ "$SHELL" == *"fish"* ]]; then
if ! grep -q "$path_to_add" "$rc_file" 2>/dev/null; then
echo "set -gx PATH \$PATH $path_to_add" >> "$rc_file"
return 0
fi
else
if ! grep -q "$path_to_add" "$rc_file" 2>/dev/null; then
echo "" >> "$rc_file"
echo "# Added by Aide installer" >> "$rc_file"
echo "export PATH=\"\$PATH:$path_to_add\"" >> "$rc_file"
return 0
fi
fi
return 1
}
set_java_home() {
local java_path="$1"
local rc_file
rc_file=$(get_shell_rc)
if [[ "$SHELL" == *"fish"* ]]; then
if ! grep -q "JAVA_HOME" "$rc_file" 2>/dev/null; then
echo "set -gx JAVA_HOME $java_path" >> "$rc_file"
fi
else
if ! grep -q "JAVA_HOME" "$rc_file" 2>/dev/null; then
echo "export JAVA_HOME=\"$java_path\"" >> "$rc_file"
fi
fi
}
show_help() {
echo "用法: $0 [选项]"
echo ""
echo "Aide 离线环境安装脚本 (Linux)"
echo ""
echo "选项:"
echo " --aide-path PATH 指定 aide-program 目录路径"
echo " --java-path PATH 指定 Java 安装路径(默认 ~/.local/java/jre-17"
echo " --system-java 使用 /opt/java/jre-17需要 sudo"
echo " --silent 静默安装模式"
echo " --skip-uv 跳过 uv 安装"
echo " --skip-java 跳过 Java 安装"
echo " -h, --help 显示帮助信息"
echo ""
echo "示例:"
echo " $0 # 交互式安装"
echo " $0 --silent # 静默安装"
echo " $0 --aide-path /path/to/aide # 配置 aide PATH"
echo " $0 --system-java # 安装 Java 到 /opt需要 sudo"
}
# ============================================================
# 解析参数
# ============================================================
while [[ $# -gt 0 ]]; do
case $1 in
--aide-path)
AIDE_PATH="$2"
shift 2
;;
--java-path)
JAVA_INSTALL_PATH="$2"
shift 2
;;
--system-java)
SYSTEM_JAVA=true
JAVA_INSTALL_PATH="/opt/java/jre-17"
shift
;;
--silent)
SILENT=true
shift
;;
--skip-uv)
SKIP_UV=true
shift
;;
--skip-java)
SKIP_JAVA=true
shift
;;
-h|--help)
show_help
exit 0
;;
*)
error "未知选项: $1"
echo "运行 '$0 --help' 查看帮助"
exit 1
;;
esac
done
# ============================================================
# 主逻辑
# ============================================================
header "Aide 离线安装程序 (Linux)"
# 检查资源文件
info "检查资源文件..."
missing_resources=()
if [ "$SKIP_UV" = false ]; then
uv_tar_path="$SCRIPT_DIR/$UV_TAR_FILE"
if [ ! -f "$uv_tar_path" ]; then
missing_resources+=("$UV_TAR_FILE")
fi
fi
if [ "$SKIP_JAVA" = false ]; then
java_tar_path="$SCRIPT_DIR/$JAVA_TAR_FILE"
if [ ! -f "$java_tar_path" ]; then
# 尝试匹配通配符
java_tar_path=$(find "$SCRIPT_DIR" -name "OpenJDK17U-jre_x64_linux_*.tar.gz" 2>/dev/null | head -n 1)
if [ -z "$java_tar_path" ]; then
missing_resources+=("$JAVA_TAR_FILE (或任意 OpenJDK17U-jre_x64_linux_*.tar.gz)")
else
JAVA_TAR_FILE=$(basename "$java_tar_path")
fi
fi
fi
if [ ${#missing_resources[@]} -gt 0 ]; then
error "缺少以下资源文件:"
for resource in "${missing_resources[@]}"; do
echo " - $resource"
done
echo ""
info "请参考 resources.json 下载所需文件后重新运行此脚本"
exit 1
fi
success "所有资源文件已就绪"
# 确认安装
if [ "$SILENT" = false ]; then
echo ""
info "将要安装以下组件:"
if [ "$SKIP_UV" = false ]; then
echo " - uv (Python 包管理器) -> $UV_INSTALL_PATH"
fi
if [ "$SKIP_JAVA" = false ]; then
echo " - Java JRE 17 -> $JAVA_INSTALL_PATH"
fi
echo ""
read -p "是否继续? (Y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Nn]$ ]]; then
info "安装已取消"
exit 0
fi
fi
# ============================================================
# 安装 uv
# ============================================================
if [ "$SKIP_UV" = false ]; then
echo ""
info "安装 uv..."
if command_exists uv; then
uv_version=$(uv --version 2>&1)
success "uv 已安装: $uv_version"
else
uv_tar_path="$SCRIPT_DIR/$UV_TAR_FILE"
# 创建安装目录
mkdir -p "$UV_INSTALL_PATH"
# 解压
info "解压 uv..."
temp_dir=$(mktemp -d)
tar -xzf "$uv_tar_path" -C "$temp_dir"
# 查找并复制 uv 可执行文件
uv_exe=$(find "$temp_dir" -name "uv" -type f | head -n 1)
if [ -n "$uv_exe" ]; then
cp "$uv_exe" "$UV_INSTALL_PATH/"
chmod +x "$UV_INSTALL_PATH/uv"
# 同时复制 uvx如果存在
uvx_exe=$(find "$temp_dir" -name "uvx" -type f | head -n 1)
if [ -n "$uvx_exe" ]; then
cp "$uvx_exe" "$UV_INSTALL_PATH/"
chmod +x "$UV_INSTALL_PATH/uvx"
fi
success "uv 已解压到 $UV_INSTALL_PATH"
else
error "在压缩包中找不到 uv 可执行文件"
rm -rf "$temp_dir"
exit 1
fi
# 清理临时目录
rm -rf "$temp_dir"
# 添加到 PATH
if add_to_path "$UV_INSTALL_PATH"; then
success "已添加 $UV_INSTALL_PATH 到 PATH"
else
info "uv 路径已在 shell 配置中"
fi
# 更新当前会话的 PATH
export PATH="$PATH:$UV_INSTALL_PATH"
# 验证
if command_exists uv; then
success "uv 安装成功"
else
warning "uv 安装完成,但需要重启终端或运行 'source $(get_shell_rc)'"
fi
fi
fi
# ============================================================
# 安装 Java JRE
# ============================================================
if [ "$SKIP_JAVA" = false ]; then
echo ""
info "安装 Java JRE..."
if command_exists java; then
java_version=$(java -version 2>&1 | head -n 1)
success "Java 已安装: $java_version"
else
java_tar_path="$SCRIPT_DIR/$JAVA_TAR_FILE"
# 创建安装目录
if [ "$SYSTEM_JAVA" = true ]; then
sudo mkdir -p "$(dirname "$JAVA_INSTALL_PATH")"
else
mkdir -p "$(dirname "$JAVA_INSTALL_PATH")"
fi
# 解压
info "解压 Java JRE..."
temp_dir=$(mktemp -d)
tar -xzf "$java_tar_path" -C "$temp_dir"
# 查找解压后的 JRE 目录
jre_dir=$(find "$temp_dir" -maxdepth 1 -type d -name "jdk-*-jre" | head -n 1)
if [ -z "$jre_dir" ]; then
jre_dir=$(find "$temp_dir" -maxdepth 1 -type d | tail -n 1)
fi
if [ -n "$jre_dir" ] && [ "$jre_dir" != "$temp_dir" ]; then
# 移动到目标位置
if [ "$SYSTEM_JAVA" = true ]; then
sudo rm -rf "$JAVA_INSTALL_PATH" 2>/dev/null || true
sudo mv "$jre_dir" "$JAVA_INSTALL_PATH"
else
rm -rf "$JAVA_INSTALL_PATH" 2>/dev/null || true
mv "$jre_dir" "$JAVA_INSTALL_PATH"
fi
success "Java JRE 已安装到 $JAVA_INSTALL_PATH"
else
error "在压缩包中找不到 JRE 目录"
rm -rf "$temp_dir"
exit 1
fi
# 清理临时目录
rm -rf "$temp_dir"
# 配置 JAVA_HOME
set_java_home "$JAVA_INSTALL_PATH"
export JAVA_HOME="$JAVA_INSTALL_PATH"
info "已设置 JAVA_HOME = $JAVA_INSTALL_PATH"
# 添加到 PATH
java_bin_path="$JAVA_INSTALL_PATH/bin"
if add_to_path "$java_bin_path"; then
success "已添加 Java bin 到 PATH"
else
info "Java bin 路径已在 shell 配置中"
fi
# 更新当前会话的 PATH
export PATH="$PATH:$java_bin_path"
# 创建符号链接(仅系统安装)
if [ "$SYSTEM_JAVA" = true ]; then
sudo ln -sf "$java_bin_path/java" /usr/local/bin/java 2>/dev/null || true
fi
# 验证
if command_exists java; then
java_version=$(java -version 2>&1 | head -n 1)
success "Java 安装成功: $java_version"
else
warning "Java 安装完成,但需要重启终端或运行 'source $(get_shell_rc)'"
fi
fi
fi
# ============================================================
# 安装 Python (通过 uv)
# ============================================================
echo ""
info "配置 Python..."
if command_exists uv; then
python_list=$(uv python list 2>&1 || true)
if echo "$python_list" | grep -q "3\."; then
success "Python 已通过 uv 安装"
else
info "通过 uv 安装 Python 3.11..."
if uv python install 3.11 2>/dev/null; then
success "Python 3.11 安装成功"
else
warning "Python 安装需要网络连接,请稍后手动运行: uv python install 3.11"
fi
fi
else
warning "uv 不可用,无法安装 Python。请重启终端后运行: uv python install 3.11"
fi
# ============================================================
# 配置 aide PATH
# ============================================================
if [ -n "$AIDE_PATH" ]; then
echo ""
info "配置 aide PATH..."
aide_bin_path="$AIDE_PATH/bin"
if [ -d "$aide_bin_path" ]; then
if add_to_path "$aide_bin_path"; then
success "已添加 aide 到 PATH: $aide_bin_path"
else
info "aide 已在 PATH 中"
fi
export PATH="$PATH:$aide_bin_path"
else
warning "aide-program/bin 目录不存在: $aide_bin_path"
fi
fi
# ============================================================
# 完成
# ============================================================
header "安装完成"
info "已安装组件:"
if command_exists uv; then
echo -e " ${GREEN}${NC} uv: $(uv --version 2>&1)"
else
echo -e " ${YELLOW}${NC} uv: 需要重启终端"
fi
if command_exists java; then
echo -e " ${GREEN}${NC} Java: $(java -version 2>&1 | head -n 1)"
else
echo -e " ${YELLOW}${NC} Java: 需要重启终端"
fi
echo ""
info "下一步:"
echo " 1. 重启终端或运行: source $(get_shell_rc)"
echo " 2. 运行 'uv python install 3.11' 安装 Python如尚未安装"
echo " 3. 运行 'aide env ensure --runtime' 验证安装"
echo ""

View File

@@ -1,62 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Aide 离线安装资源清单 (Linux)",
"description": "包含所有需要下载的资源文件信息",
"version": "1.0.0",
"platform": "linux",
"arch": "x64",
"resources": [
{
"id": "uv",
"name": "uv (Python 包管理器)",
"version": "latest",
"required": true,
"filename": "uv-x86_64-unknown-linux-gnu.tar.gz",
"url": "https://github.com/astral-sh/uv/releases/latest/download/uv-x86_64-unknown-linux-gnu.tar.gz",
"checksum": {
"algorithm": "sha256",
"value": "请从发布页面获取"
},
"install_path": "~/.local/bin",
"notes": "解压后将 uv 可执行文件放入安装路径"
},
{
"id": "java_jre",
"name": "Eclipse Temurin JRE 17",
"version": "17",
"required": true,
"filename": "OpenJDK17U-jre_x64_linux_hotspot_17.0.9_9.tar.gz",
"url": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.9%2B9/OpenJDK17U-jre_x64_linux_hotspot_17.0.9_9.tar.gz",
"checksum": {
"algorithm": "sha256",
"value": "请从发布页面获取"
},
"install_path": "/opt/java/jre-17 或 ~/.local/java/jre-17",
"notes": "解压后配置 JAVA_HOME 和 PATH"
}
],
"download_instructions": {
"zh": [
"1. 访问上述每个资源的 url 下载文件",
"2. 将下载的文件保存到此目录(与本文件同目录)",
"3. 确保文件名与 filename 字段一致",
"4. 运行 chmod +x install.sh && ./install.sh"
],
"en": [
"1. Visit the url for each resource and download the file",
"2. Save the downloaded files to this directory",
"3. Ensure filenames match the filename field",
"4. Run chmod +x install.sh && ./install.sh"
]
},
"post_install": {
"python": {
"note": "Python 将通过 uv python install 命令安装",
"offline_option": "如需完全离线安装 Python请提前运行 'uv python install 3.11' 下载 Python 到本地缓存"
},
"aide": {
"note": "安装完成后需要将 aide-program/bin 添加到 PATH",
"path_variable": "$PATH"
}
}
}

View File

@@ -1,167 +0,0 @@
# Aide 离线安装程序 (Windows)
本目录包含 Aide 工具的 Windows 离线安装程序,用于在无网络或受限网络环境下安装所需的环境依赖。
## 概述
此离线安装程序可以安装以下组件:
- **uv** - 高性能 Python 包管理器
- **Java JRE 17** - PlantUML 运行依赖
- **Python 3.11** - Aide 运行时(通过 uv 安装,需要网络)
## 使用步骤
### 第 1 步:下载资源文件
参考 `resources.json` 中的下载链接,下载以下文件到本目录:
| 文件名 | 说明 | 下载链接 |
|--------|------|----------|
| `uv-x86_64-pc-windows-msvc.zip` | uv 安装包 | [GitHub Releases](https://github.com/astral-sh/uv/releases/latest) |
| `OpenJDK17U-jre_x64_windows_hotspot_17.0.9_9.zip` | Java JRE 17 | [Adoptium](https://adoptium.net/temurin/releases/?os=windows&arch=x64&package=jre&version=17) |
> **注意**Java JRE 的版本号可能会更新,请下载最新的 JRE 17 版本,并相应修改 `resources.json` 中的文件名。
### 第 2 步:运行安装脚本
1. 以管理员身份打开 PowerShell
2. 导航到本目录
3. 运行安装脚本:
```powershell
# 设置执行策略(如需要)
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# 运行安装脚本
.\install.ps1
```
### 第 3 步:配置 aide PATH可选
如果要将 aide 添加到系统 PATH运行时指定 aide-program 路径:
```powershell
.\install.ps1 -AideProgramPath "C:\path\to\aide-program"
```
### 第 4 步:安装 Python
由于 Python 需要通过 uv 下载,离线安装无法自动完成。请在有网络的环境下运行:
```powershell
uv python install 3.11
```
> **提示**:如果需要完全离线安装,可以在有网络的机器上提前运行此命令,然后复制 `~/.local/share/uv/python/` 目录到目标机器。
### 第 5 步:验证安装
重启终端后运行:
```powershell
# 检查各组件版本
uv --version
java -version
# 验证 aide 环境
aide env ensure --runtime
```
## 命令行选项
```powershell
.\install.ps1 [-AideProgramPath <path>] [-Silent] [-SkipJava] [-SkipUv]
```
| 选项 | 说明 |
|------|------|
| `-AideProgramPath` | 指定 aide-program 目录路径,自动添加到 PATH |
| `-Silent` | 静默安装模式,不显示交互提示 |
| `-SkipJava` | 跳过 Java JRE 安装 |
| `-SkipUv` | 跳过 uv 安装 |
## 示例
### 交互式安装
```powershell
.\install.ps1
```
### 静默安装
```powershell
.\install.ps1 -Silent
```
### 完整安装(包含 aide PATH 配置)
```powershell
.\install.ps1 -AideProgramPath "C:\projects\ccoptimize\aide-program"
```
### 仅安装 uv
```powershell
.\install.ps1 -SkipJava
```
## 安装位置
| 组件 | 安装位置 |
|------|----------|
| uv | `%USERPROFILE%\.local\bin\` |
| Java JRE | `%LOCALAPPDATA%\Programs\Java\jre-17\` |
| Python | `%USERPROFILE%\.local\share\uv\python\` (通过 uv 管理) |
## 环境变量
安装程序会自动配置以下环境变量:
| 变量 | 值 |
|------|-----|
| `PATH` | 添加 uv 和 Java bin 目录 |
| `JAVA_HOME` | Java JRE 安装路径 |
## 故障排除
### Q: 运行脚本时提示"无法加载文件,因为在此系统上禁止运行脚本"
A: 运行以下命令修改执行策略:
```powershell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
```
### Q: 安装后命令找不到?
A: 重启 PowerShell 或手动刷新环境变量:
```powershell
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","User") + ";" + [System.Environment]::GetEnvironmentVariable("Path","Machine")
```
### Q: Java 安装后 java 命令仍然找不到?
A: 检查 JAVA_HOME 和 PATH 是否正确设置:
```powershell
$env:JAVA_HOME
$env:Path -split ";" | Where-Object { $_ -like "*java*" }
```
### Q: 如何完全卸载?
A: 删除以下目录和环境变量:
1. 删除 `%USERPROFILE%\.local\bin\uv.exe`
2. 删除 `%LOCALAPPDATA%\Programs\Java\jre-17\`
3. 从用户 PATH 中移除相关路径
4. 删除 JAVA_HOME 环境变量
## 文件清单
```
windows/
├── README.md # 本说明文件
├── resources.json # 资源清单(含下载链接)
├── install.ps1 # 主安装脚本
├── uv-x86_64-pc-windows-msvc.zip # [需下载]
└── OpenJDK17U-jre_x64_windows_*.zip # [需下载]
```

View File

@@ -1,405 +0,0 @@
#Requires -Version 5.1
<#
.SYNOPSIS
Aide 离线环境安装脚本 (Windows)
.DESCRIPTION
此脚本从本地资源文件安装 aide 工具所需的环境依赖:
- uv (Python 包管理器)
- Java JRE (用于 PlantUML)
运行前请确保已下载所有必需的资源文件到脚本所在目录。
参见 resources.json 获取资源下载链接。
.PARAMETER AideProgramPath
aide-program 目录的路径(可选,用于配置 PATH
.PARAMETER Silent
静默安装模式,不显示交互提示
.PARAMETER SkipJava
跳过 Java 安装
.PARAMETER SkipUv
跳过 uv 安装
.EXAMPLE
.\install.ps1
交互式安装
.EXAMPLE
.\install.ps1 -Silent -AideProgramPath "C:\aide\aide-program"
静默安装并配置 aide PATH
.NOTES
作者: Aide Team
版本: 1.0.0
要求: Windows 10/11, PowerShell 5.1+
#>
param(
[string]$AideProgramPath,
[switch]$Silent,
[switch]$SkipJava,
[switch]$SkipUv
)
# ============================================================
# 配置
# ============================================================
$ErrorActionPreference = "Stop"
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
# 资源文件名
$UvZipFile = "uv-x86_64-pc-windows-msvc.zip"
$JavaZipFile = "OpenJDK17U-jre_x64_windows_hotspot_17.0.9_9.zip"
# 安装路径
$UvInstallPath = "$env:USERPROFILE\.local\bin"
$JavaInstallPath = "$env:LOCALAPPDATA\Programs\Java\jre-17"
# ============================================================
# 辅助函数
# ============================================================
function Write-Success {
param([string]$Message)
Write-Host "$Message" -ForegroundColor Green
}
function Write-Warning {
param([string]$Message)
Write-Host "$Message" -ForegroundColor Yellow
}
function Write-Error {
param([string]$Message)
Write-Host "$Message" -ForegroundColor Red
}
function Write-Info {
param([string]$Message)
Write-Host "$Message" -ForegroundColor Cyan
}
function Write-Header {
param([string]$Message)
Write-Host ""
Write-Host "========================================" -ForegroundColor Cyan
Write-Host " $Message" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
}
function Test-Command {
param([string]$Command)
$null -ne (Get-Command $Command -ErrorAction SilentlyContinue)
}
function Update-PathEnvironment {
# 刷新当前会话的 PATH
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "User") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "Machine")
}
function Add-ToUserPath {
param([string]$PathToAdd)
$currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
if ($currentPath -notlike "*$PathToAdd*") {
[Environment]::SetEnvironmentVariable("Path", "$currentPath;$PathToAdd", "User")
Update-PathEnvironment
return $true
}
return $false
}
function Test-FileChecksum {
param(
[string]$FilePath,
[string]$ExpectedHash,
[string]$Algorithm = "SHA256"
)
if ([string]::IsNullOrWhiteSpace($ExpectedHash) -or $ExpectedHash -eq "请从发布页面获取") {
Write-Warning "跳过校验和验证(未提供预期值)"
return $true
}
$actualHash = (Get-FileHash -Path $FilePath -Algorithm $Algorithm).Hash
return $actualHash -eq $ExpectedHash
}
function Expand-ArchiveToPath {
param(
[string]$ZipPath,
[string]$DestinationPath,
[switch]$CreateIfNotExists
)
if ($CreateIfNotExists -and -not (Test-Path $DestinationPath)) {
New-Item -ItemType Directory -Path $DestinationPath -Force | Out-Null
}
Expand-Archive -Path $ZipPath -DestinationPath $DestinationPath -Force
}
# ============================================================
# 主逻辑
# ============================================================
Write-Header "Aide 离线安装程序 (Windows)"
# 检查资源文件
Write-Info "检查资源文件..."
$missingResources = @()
if (-not $SkipUv) {
$uvZipPath = Join-Path $ScriptDir $UvZipFile
if (-not (Test-Path $uvZipPath)) {
$missingResources += $UvZipFile
}
}
if (-not $SkipJava) {
$javaZipPath = Join-Path $ScriptDir $JavaZipFile
if (-not (Test-Path $javaZipPath)) {
$missingResources += $JavaZipFile
}
}
if ($missingResources.Count -gt 0) {
Write-Error "缺少以下资源文件:"
foreach ($resource in $missingResources) {
Write-Host " - $resource" -ForegroundColor Red
}
Write-Host ""
Write-Info "请参考 resources.json 下载所需文件后重新运行此脚本"
exit 1
}
Write-Success "所有资源文件已就绪"
# 确认安装
if (-not $Silent) {
Write-Host ""
Write-Info "将要安装以下组件:"
if (-not $SkipUv) {
Write-Host " - uv (Python 包管理器) -> $UvInstallPath"
}
if (-not $SkipJava) {
Write-Host " - Java JRE 17 -> $JavaInstallPath"
}
Write-Host ""
$confirm = Read-Host "是否继续? (Y/n)"
if ($confirm -eq "n" -or $confirm -eq "N") {
Write-Info "安装已取消"
exit 0
}
}
# ============================================================
# 安装 uv
# ============================================================
if (-not $SkipUv) {
Write-Host ""
Write-Info "安装 uv..."
# 检查是否已安装
if (Test-Command "uv") {
$uvVersion = uv --version 2>&1
Write-Success "uv 已安装: $uvVersion"
} else {
$uvZipPath = Join-Path $ScriptDir $UvZipFile
# 创建安装目录
if (-not (Test-Path $UvInstallPath)) {
New-Item -ItemType Directory -Path $UvInstallPath -Force | Out-Null
Write-Info "创建目录: $UvInstallPath"
}
# 解压
Write-Info "解压 uv..."
$tempDir = Join-Path $env:TEMP "uv-extract-$(Get-Random)"
Expand-ArchiveToPath -ZipPath $uvZipPath -DestinationPath $tempDir -CreateIfNotExists
# 复制 uv.exe
$uvExe = Get-ChildItem -Path $tempDir -Filter "uv.exe" -Recurse | Select-Object -First 1
if ($uvExe) {
Copy-Item -Path $uvExe.FullName -Destination $UvInstallPath -Force
# 同时复制 uvx.exe (如果存在)
$uvxExe = Get-ChildItem -Path $tempDir -Filter "uvx.exe" -Recurse | Select-Object -First 1
if ($uvxExe) {
Copy-Item -Path $uvxExe.FullName -Destination $UvInstallPath -Force
}
Write-Success "uv 已解压到 $UvInstallPath"
} else {
Write-Error "在压缩包中找不到 uv.exe"
exit 1
}
# 清理临时目录
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
# 添加到 PATH
if (Add-ToUserPath $UvInstallPath) {
Write-Success "已添加 $UvInstallPath 到 PATH"
} else {
Write-Info "uv 路径已在 PATH 中"
}
# 验证
Update-PathEnvironment
if (Test-Command "uv") {
Write-Success "uv 安装成功"
} else {
Write-Warning "uv 安装完成,但需要重启终端后才能使用"
}
}
}
# ============================================================
# 安装 Java JRE
# ============================================================
if (-not $SkipJava) {
Write-Host ""
Write-Info "安装 Java JRE..."
# 检查是否已安装
if (Test-Command "java") {
$javaVersion = java -version 2>&1 | Select-Object -First 1
Write-Success "Java 已安装: $javaVersion"
} else {
$javaZipPath = Join-Path $ScriptDir $JavaZipFile
# 创建安装目录的父目录
$javaParentDir = Split-Path $JavaInstallPath -Parent
if (-not (Test-Path $javaParentDir)) {
New-Item -ItemType Directory -Path $javaParentDir -Force | Out-Null
}
# 解压
Write-Info "解压 Java JRE..."
$tempDir = Join-Path $env:TEMP "java-extract-$(Get-Random)"
Expand-ArchiveToPath -ZipPath $javaZipPath -DestinationPath $tempDir -CreateIfNotExists
# 找到解压后的 JRE 目录
$jreDir = Get-ChildItem -Path $tempDir -Directory | Where-Object { $_.Name -like "jdk-*-jre" -or $_.Name -like "jre*" } | Select-Object -First 1
if (-not $jreDir) {
$jreDir = Get-ChildItem -Path $tempDir -Directory | Select-Object -First 1
}
if ($jreDir) {
# 移动到目标位置
if (Test-Path $JavaInstallPath) {
Remove-Item -Path $JavaInstallPath -Recurse -Force
}
Move-Item -Path $jreDir.FullName -Destination $JavaInstallPath -Force
Write-Success "Java JRE 已安装到 $JavaInstallPath"
} else {
Write-Error "在压缩包中找不到 JRE 目录"
exit 1
}
# 清理临时目录
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
# 配置 JAVA_HOME
[Environment]::SetEnvironmentVariable("JAVA_HOME", $JavaInstallPath, "User")
$env:JAVA_HOME = $JavaInstallPath
Write-Info "已设置 JAVA_HOME = $JavaInstallPath"
# 添加到 PATH
$javaBinPath = Join-Path $JavaInstallPath "bin"
if (Add-ToUserPath $javaBinPath) {
Write-Success "已添加 Java bin 到 PATH"
} else {
Write-Info "Java bin 路径已在 PATH 中"
}
# 验证
Update-PathEnvironment
if (Test-Command "java") {
$javaVersion = java -version 2>&1 | Select-Object -First 1
Write-Success "Java 安装成功: $javaVersion"
} else {
Write-Warning "Java 安装完成,但需要重启终端后才能使用"
}
}
}
# ============================================================
# 安装 Python (通过 uv)
# ============================================================
Write-Host ""
Write-Info "配置 Python..."
if (Test-Command "uv") {
$pythonList = uv python list 2>&1
if ($pythonList -match "3\.\d+") {
Write-Success "Python 已通过 uv 安装"
} else {
Write-Info "通过 uv 安装 Python 3.11..."
try {
uv python install 3.11
Write-Success "Python 3.11 安装成功"
} catch {
Write-Warning "Python 安装需要网络连接,请稍后手动运行: uv python install 3.11"
}
}
} else {
Write-Warning "uv 不可用,无法安装 Python。请重启终端后运行: uv python install 3.11"
}
# ============================================================
# 配置 aide PATH
# ============================================================
if ($AideProgramPath) {
Write-Host ""
Write-Info "配置 aide PATH..."
$aideBinPath = Join-Path $AideProgramPath "bin"
if (Test-Path $aideBinPath) {
if (Add-ToUserPath $aideBinPath) {
Write-Success "已添加 aide 到 PATH: $aideBinPath"
} else {
Write-Info "aide 已在 PATH 中"
}
} else {
Write-Warning "aide-program/bin 目录不存在: $aideBinPath"
}
}
# ============================================================
# 完成
# ============================================================
Write-Header "安装完成"
Write-Info "已安装组件:"
if (Test-Command "uv") {
Write-Host " ✓ uv: $(uv --version 2>&1)" -ForegroundColor Green
} else {
Write-Host " ⚠ uv: 需要重启终端" -ForegroundColor Yellow
}
if (Test-Command "java") {
Write-Host " ✓ Java: $(java -version 2>&1 | Select-Object -First 1)" -ForegroundColor Green
} else {
Write-Host " ⚠ Java: 需要重启终端" -ForegroundColor Yellow
}
Write-Host ""
Write-Info "下一步:"
Write-Host " 1. 重启终端使环境变量生效"
Write-Host " 2. 运行 'uv python install 3.11' 安装 Python如尚未安装"
Write-Host " 3. 运行 'aide env ensure --runtime' 验证安装"
Write-Host ""

View File

@@ -1,62 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Aide 离线安装资源清单 (Windows)",
"description": "包含所有需要下载的资源文件信息",
"version": "1.0.0",
"platform": "windows",
"arch": "x64",
"resources": [
{
"id": "uv",
"name": "uv (Python 包管理器)",
"version": "latest",
"required": true,
"filename": "uv-x86_64-pc-windows-msvc.zip",
"url": "https://github.com/astral-sh/uv/releases/latest/download/uv-x86_64-pc-windows-msvc.zip",
"checksum": {
"algorithm": "sha256",
"value": "请从发布页面获取"
},
"install_path": "%USERPROFILE%\\.local\\bin",
"notes": "解压后将 uv.exe 放入安装路径"
},
{
"id": "java_jre",
"name": "Eclipse Temurin JRE 17",
"version": "17",
"required": true,
"filename": "OpenJDK17U-jre_x64_windows_hotspot_17.0.9_9.zip",
"url": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.9%2B9/OpenJDK17U-jre_x64_windows_hotspot_17.0.9_9.zip",
"checksum": {
"algorithm": "sha256",
"value": "请从发布页面获取"
},
"install_path": "%LOCALAPPDATA%\\Programs\\Java\\jre-17",
"notes": "解压后配置 JAVA_HOME 和 PATH"
}
],
"download_instructions": {
"zh": [
"1. 访问上述每个资源的 url 下载文件",
"2. 将下载的文件保存到此目录(与本文件同目录)",
"3. 确保文件名与 filename 字段一致",
"4. 以管理员身份运行 install.ps1"
],
"en": [
"1. Visit the url for each resource and download the file",
"2. Save the downloaded files to this directory",
"3. Ensure filenames match the filename field",
"4. Run install.ps1 as Administrator"
]
},
"post_install": {
"python": {
"note": "Python 将通过 uv python install 命令安装",
"offline_option": "如需完全离线安装 Python请提前运行 'uv python install 3.11' 下载 Python 到本地缓存"
},
"aide": {
"note": "安装完成后需要将 aide-program/bin 添加到 PATH",
"path_variable": "%PATH%"
}
}
}

View File

@@ -1,14 +0,0 @@
> commands & skills都是将会提供给你使用的指导规范以及工具和能力下文中会用LLM来指代你的角色
对现有的 commands & skills & aide program 体系做一些调整:
1. finish里更新状态文件之后清理时添加对任务计划文件的清理
2. 关于写流程图的部分添加一些内容保证编写的plantuml带有下述信息
```plantuml
skinparam defaultFontName "Arial"
skinparam dpi 300
scale 0.5
```
- 其中字体名、dpi、缩放系数要用aide从环境配置中获取
- 默认值分别是 Arial、300、0.5