feat: 整体更新同步

This commit is contained in:
2025-12-15 02:59:03 +08:00
parent ee1468492a
commit ed7c45b48e
15 changed files with 143 additions and 80 deletions

View File

@@ -32,8 +32,10 @@ aide-program (命令行工具)
├── aide init - 初始化配置
├── aide env - 环境检测(模块化)
├── aide config - 配置读写
├── aide flow - 进度追踪 + git 集成(已实现)
└── aide decide - 待定项 Web 确认(待实现)
├── aide flow - 进度追踪 + git 集成
└── aide decide - 待定项 Web 确认
├── aide decide submit '<json>' - 提交待定项并启动 Web 服务
└── aide decide result - 获取用户决策结果
```
---
@@ -150,7 +152,8 @@ ccoptimize/
| aide env ensure --verbose | ✅ 已实现 | 详细配置输出 |
| aide config get/set | ✅ 已实现 | 配置读写 |
| aide flow | ✅ 已实现 | 进度追踪 + git 集成 |
| aide decide | ⏳ 待实现 | 待定项 Web 确认 |
| aide decide submit | ✅ 已实现 | 提交待定项并启动 Web 服务 |
| aide decide result | ✅ 已实现 | 获取用户决策结果 |
代码位于 `aide-program/aide/`
@@ -209,18 +212,7 @@ ccoptimize/
## 五、待完成工作
### 5.1 aide decide 实现
**功能**:待定项 Web 确认界面
**设计文档**`aide-program/docs/commands/decide.md`
**主要工作**
- 实现 `aide/decide/server.py` - HTTP 服务
- 实现 `aide/decide/web/` - React 前端
-`main.py` 添加 CLI 路由
### 5.2 扩展环境模块(可选)
### 5.1 扩展环境模块(可选)
可按需添加更多环境检测模块:
- java - Java JDK 检测
@@ -229,12 +221,12 @@ ccoptimize/
- cargo_deps - Rust 项目依赖(类似 node_deps
- pub_deps - Flutter/Dart 项目依赖
### 5.3 整体验证
### 5.2 整体验证
完成 decide 后,需要进行完整工作流验证:
进行完整工作流验证:
1. `/aide:init``/aide:prep``/aide:exec` 完整流程测试
2. 验证 git 自动提交功能
3. 验证待定项 Web 界面
3. 验证待定项 Web 界面aide decide
---
@@ -261,13 +253,15 @@ ccoptimize/
## 七、版本信息
- 文档版本1.2.0
- 更新日期2025-12-14
- 项目阶段:设计完成,部分实现flow 已实现decide 待实现)
- 文档版本1.3.0
- 更新日期2025-12-15
- 项目阶段:设计完成,核心功能已实现
- 最近更新:
- aide env set 命令实现
- aide decide 子命令实现submit/result
- 支持 Web 界面待定项确认
- 支持自定义监听地址bind和访问地址url配置
- 推荐选项默认选中
- aide flow 子命令实现
- 新增 CHANGELOG.md用于 docs 阶段校验)
- 新增环境模块rust, node, flutter, android, node_deps
- 支持模块实例化命名(多项目场景)
- Skill 拆分aide基础+ env-config按需

View File

@@ -98,7 +98,7 @@ aide flow next-step "任务优化完成,生成待定项"
提交待定项数据:
```bash
aide decide '<json数据>'
aide decide submit '<json数据>'
```
告知用户访问链接进行确认。

View File

@@ -99,7 +99,7 @@ partition "阶段2: 任务优化" {
partition "阶段3: 待定项处理" {
if (有待定项?) then (是)
:aide decide '<json>';
:aide decide submit '<json>';
:告知用户访问链接;
:aide decide result;
:aide flow next-step "用户完成待定项确认";
@@ -163,7 +163,7 @@ stop
**处理流程**
1. 准备待定项 JSON 数据
2. 调用 `aide decide '<json>'` 启动 Web 服务
2. 调用 `aide decide submit '<json>'` 启动 Web 服务
3. 告知用户访问链接进行确认
4. 调用 `aide decide result` 获取决策结果
@@ -228,7 +228,7 @@ aide config get task.source
**命令**
```bash
aide decide '<json数据>'
aide decide submit '<json数据>'
aide decide result
```

View File

@@ -298,11 +298,11 @@ aide flow 会自动校验环节跳转是否合理:
**用途**:通过 Web 界面处理待定项确认
#### aide decide提交数据
#### aide decide submit(提交数据)
**语法**
```
aide decide '<json数据>'
aide decide submit '<json数据>'
```
**输入格式**:见 [数据格式文档](../../../../aide-program/docs/formats/data.md)
@@ -397,7 +397,7 @@ aide flow next-step "任务分析完成"
aide flow next-step "任务优化完成,生成待定项"
# 处理待定项
aide decide '{"task":"...", "items":[...]}'
aide decide submit '{"task":"...", "items":[...]}'
aide decide result
aide flow next-step "用户完成待定项确认"

View File

@@ -210,12 +210,20 @@ aide flow 会自动校验环节跳转是否合理:
通过 Web 界面处理待定项确认。
### aide decide
```
aide decide {submit,result} ...
子命令:
submit <json> 提交待定项数据并启动 Web 服务
result 获取用户决策结果
```
### aide decide submit
提交待定项数据并启动 Web 服务。
```bash
aide decide '<json数据>'
aide decide submit '<json数据>'
```
**JSON 格式**
@@ -255,11 +263,21 @@ aide decide '<json数据>'
}
```
**配置项**(在 `.aide/config.toml``[decide]` 节):
| 配置项 | 默认值 | 说明 |
|--------|--------|------|
| `port` | 3721 | 起始端口 |
| `bind` | `"127.0.0.1"` | 监听地址,设为 `"0.0.0.0"` 可允许外部访问 |
| `url` | `""` | 自定义访问地址,为空时自动生成 |
| `timeout` | 0 | 超时时间0 表示不超时 |
**输出**
```
→ Web 服务已启动
→ 请访问: http://localhost:3721
→ 等待用户完成决策...
✓ 决策已完成
```
### aide decide result
@@ -281,6 +299,7 @@ aide decide result
```
> 注:`note` 字段仅在用户添加备注时出现
> 注:如果数据中有 `recommend` 字段,对应选项会默认选中
---
@@ -390,7 +409,7 @@ aide flow next-part verify "实现完成,开始验证"
```bash
# 提交待定项JSON 数据较长时建议保存到文件后通过 cat 传入)
aide decide '{"task":"...", "items":[...]}'
aide decide submit '{"task":"...", "items":[...]}'
# 获取结果
aide decide result

View File

@@ -61,12 +61,12 @@ def cmd_decide_result() -> bool:
return False
if pending is None:
_print_error("未找到待定项数据", "请先执行 aide decide '<json>'")
_print_error("未找到待定项数据", "请先执行 aide decide submit '<json>'")
return False
session_id = pending.meta.session_id if pending.meta else None
if not session_id:
_print_error("决策结果已过期", "pending.json 已被更新,请重新执行 aide decide '<json>'")
_print_error("决策结果已过期", "pending.json 已被更新,请重新执行 aide decide submit '<json>'")
return False
try:
@@ -83,7 +83,7 @@ def cmd_decide_result() -> bool:
for path in storage.decisions_dir.glob("*.json")
)
if has_history:
_print_error("决策结果已过期", "pending.json 已被更新,请重新执行 aide decide '<json>'")
_print_error("决策结果已过期", "pending.json 已被更新,请重新执行 aide decide submit '<json>'")
else:
_print_error("尚无决策结果", "请等待用户在 Web 界面完成操作")
return False

View File

@@ -57,7 +57,7 @@ class DecideStorage:
"""保存用户决策为历史记录。"""
pending = self.load_pending()
if pending is None:
raise DecideError("未找到待定项数据,请先执行 aide decide '<json>'")
raise DecideError("未找到待定项数据,请先执行 aide decide submit '<json>'")
if pending.meta is None:
raise DecideError("pending.json 缺少 _meta.session_id")
record = DecisionRecord(

View File

@@ -48,9 +48,12 @@ aide-program 是 Aide 工作流体系的命令行工具,为 aide-plugin 提供
| `aide env set` | [commands/env.md](commands/env.md) | ✅ 已实现 | 设置环境配置(带验证) |
| `aide config` | [formats/config.md](formats/config.md) | ✅ 已实现 | 配置读写 |
| `aide flow` | [commands/flow.md](commands/flow.md) | ✅ 已实现 | 进度追踪与 git 集成 |
| `aide decide` | [commands/decide.md](commands/decide.md) | ⏳ 待实现 | 待定项 Web 确认 |
| `aide decide submit` | [commands/decide.md](commands/decide.md) | ✅ 已实现 | 提交待定项并启动 Web 服务 |
| `aide decide result` | [commands/decide.md](commands/decide.md) | ✅ 已实现 | 获取用户决策结果 |
补充:flow 的实现细节与验证清单见 [commands/flow/README.md](commands/flow/README.md)。
补充:
- flow 的实现细节与验证清单见 [commands/flow/README.md](commands/flow/README.md)
- decide 的实现细节与验证清单见 [commands/decide/README.md](commands/decide/README.md)
### 2.1 环境检测模块
@@ -113,8 +116,16 @@ aide-program/
│ ├── hooks.py
│ ├── types.py
│ └── ...
└── decide/ # 待实现
── ...
└── decide/ # 待定项确认(已实现
── cli.py # CLI 入口
├── server.py # HTTP 服务
├── storage.py # 数据存储
├── handlers.py # API 处理器
├── types.py # 数据类型
└── web/ # 前端资源
├── index.html
├── style.css
└── app.js
```
---

View File

@@ -51,13 +51,23 @@
## 三、接口规格
### 3.1 aide decide提交数据
### 3.1 命令一览
```
aide decide {submit,result} ...
子命令:
submit <json> 提交待定项数据并启动 Web 服务
result 获取用户决策结果
```
### 3.2 aide decide submit提交数据
**用途**:提交待定项数据并启动 Web 服务
**语法**
```
aide decide '<json数据>'
aide decide submit '<json数据>'
```
**输入**:待定项 JSON 数据(见数据格式章节)
@@ -67,9 +77,19 @@ aide decide '<json数据>'
→ Web 服务已启动
→ 请访问: http://localhost:3721
→ 等待用户完成决策...
✓ 决策已完成
```
### 3.2 aide decide result
**配置项**(见 [配置格式文档](../formats/config.md)
| 配置项 | 默认值 | 说明 |
|--------|--------|------|
| `decide.port` | 3721 | 起始端口 |
| `decide.bind` | `"127.0.0.1"` | 监听地址 |
| `decide.url` | `""` | 自定义访问地址 |
| `decide.timeout` | 0 | 超时时间(秒) |
### 3.3 aide decide result
**用途**:获取用户决策结果
@@ -90,11 +110,13 @@ aide decide result
**错误情况**
```
✗ 尚无决策结果,请等待用户完成操作
✗ 尚无决策结果
建议: 请等待用户在 Web 界面完成操作
```
```
✗ 未找到待定项数据,请先执行 aide decide '<json>'
✗ 未找到待定项数据
建议: 请先执行 aide decide submit '<json>'
```
---
@@ -112,7 +134,7 @@ participant "aide decide" as Decide
participant "Web Server" as Web
participant User
LLM -> Decide : aide decide '<json>'
LLM -> Decide : aide decide submit '<json>'
Decide -> Decide : 解析 JSON
Decide -> Decide : 保存待定项数据
Decide -> Web : 启动 HTTP 服务

View File

@@ -35,7 +35,7 @@
- Web 前端:使用纯 HTML/CSS/JavaScript无需构建工具直接嵌入 Python 代码或作为静态资源
2. **服务生命周期**
- `aide decide '<json>'` 启动服务并阻塞等待
- `aide decide submit '<json>'` 启动服务并阻塞等待
- 用户在 Web 界面提交决策后,服务自动关闭
- 服务关闭后LLM 调用 `aide decide result` 获取结果
@@ -159,7 +159,7 @@ participant "Web Browser" as Browser
participant User
== 提交待定项 ==
LLM -> CLI : aide decide '<json>'
LLM -> CLI : aide decide submit '<json>'
CLI -> CLI : 解析并验证 JSON
CLI -> CLI : 保存到 pending.json
CLI -> Server : 启动 HTTP 服务

View File

@@ -4,19 +4,27 @@
`aide decide` 提供两个子命令:
```
aide decide {submit,result} ...
子命令:
submit <json> 提交待定项数据并启动 Web 服务
result 获取用户决策结果
```
| 子命令 | 语法API 约定) | 成功输出 | 主要用途 |
|--------|------------------|----------|----------|
| (默认) | `aide decide '<json>'` | 输出访问链接,阻塞等待 | 提交待定项数据并启动 Web 服务 |
| submit | `aide decide submit '<json>'` | 输出访问链接,阻塞等待 | 提交待定项数据并启动 Web 服务 |
| result | `aide decide result` | 输出 JSON 结果 | 获取用户决策结果 |
## 二、命令详细规格
### 2.1 aide decide提交数据并启动服务
### 2.1 aide decide submit(提交数据并启动服务)
**语法**
```
aide decide '<json_data>'
aide decide submit '<json_data>'
```
**参数**
@@ -25,6 +33,15 @@ aide decide '<json_data>'
|------|------|------|------|
| `<json_data>` | string | 是 | 待定项 JSON 数据,需用引号包裹 |
**配置项**(见 [配置格式文档](../../formats/config.md)
| 配置项 | 默认值 | 说明 |
|--------|--------|------|
| `decide.port` | 3721 | 起始端口 |
| `decide.bind` | `"127.0.0.1"` | 监听地址,设为 `"0.0.0.0"` 可允许外部访问 |
| `decide.url` | `""` | 自定义访问地址,为空时自动生成 |
| `decide.timeout` | 0 | 超时时间0 表示不超时 |
**输入数据格式**
`aide-program/docs/formats/data.md` 的"待定项数据格式"章节。
@@ -143,12 +160,12 @@ aide decide result
```
✗ 未找到待定项数据
建议: 请先执行 aide decide '<json>'
建议: 请先执行 aide decide submit '<json>'
```
```
✗ 决策结果已过期
建议: 请重新执行 aide decide '<json>'
建议: 请重新执行 aide decide submit '<json>'
```
**行为流程**
@@ -283,7 +300,7 @@ stop
```bash
# 1. LLM 提交待定项数据
$ aide decide '{"task":"实现用户认证","source":"task.md","items":[...]}'
$ aide decide submit '{"task":"实现用户认证","source":"task.md","items":[...]}'
→ Web 服务已启动
→ 请访问: http://localhost:3721
→ 等待用户完成决策...
@@ -298,7 +315,7 @@ $ aide decide result
```bash
# 配置了超时时间的情况
$ aide decide '{"task":"...","source":"...","items":[...]}'
$ aide decide submit '{"task":"...","source":"...","items":[...]}'
→ Web 服务已启动
→ 请访问: http://localhost:3721
→ 等待用户完成决策...
@@ -315,7 +332,7 @@ $ aide decide result
/aide:prep 流程中:
1. LLM 分析任务,识别待定项
2. LLM 构造 JSON 数据
3. LLM 调用 aide decide '<json>'
3. LLM 调用 aide decide submit '<json>'
4. LLM 告知用户访问链接
5. 用户在 Web 界面完成决策
6. LLM 调用 aide decide result 获取结果

View File

@@ -26,10 +26,10 @@ aide decide 的数据存储负责管理待定项数据和决策记录的持久
**用途**:存储当前待处理的待定项数据
**生命周期**
- 创建:`aide decide '<json>'` 执行时
- 创建:`aide decide submit '<json>'` 执行时
- 读取Web 前端通过 API 获取
- 保留:决策完成后保留,用于 `aide decide result` 验证匹配性
- 覆盖:下次 `aide decide '<json>'` 执行时覆盖
- 覆盖:下次 `aide decide submit '<json>'` 执行时覆盖
**内容格式**与输入数据格式相同DecideInput
@@ -202,7 +202,7 @@ save_atomic(path: Path, data: dict) -> None:
| 文件 | 创建时机 | 删除时机 |
|------|----------|----------|
| pending.json | `aide decide '<json>'` | 不自动删除,下次覆盖 |
| pending.json | `aide decide submit '<json>'` | 不自动删除,下次覆盖 |
| {session_id}.json | 用户提交决策 | 不自动删除 |
### 5.2 历史记录清理
@@ -238,7 +238,7 @@ ensure_decisions_dir(root: Path) -> Path:
```
✗ 无法解析 pending.json: <具体错误>
建议: 文件可能已损坏,请重新执行 aide decide '<json>'
建议: 文件可能已损坏,请重新执行 aide decide submit '<json>'
```
### 6.2 文件缺失
@@ -246,7 +246,7 @@ ensure_decisions_dir(root: Path) -> Path:
| 场景 | 错误信息 |
|------|----------|
| .aide/ 不存在 | `✗ .aide 目录不存在,请先执行 aide init` |
| pending.json 不存在 | `✗ 未找到待定项数据,请先执行 aide decide '<json>'` |
| pending.json 不存在 | `✗ 未找到待定项数据,请先执行 aide decide submit '<json>'` |
| 历史记录不存在 | `✗ 尚无决策结果,请等待用户完成操作` |
### 6.3 数据不一致
@@ -255,7 +255,7 @@ ensure_decisions_dir(root: Path) -> Path:
```
✗ 决策结果已过期
建议: pending.json 已被更新,请重新执行 aide decide '<json>'
建议: pending.json 已被更新,请重新执行 aide decide submit '<json>'
```
## 七、方法签名原型

View File

@@ -14,7 +14,7 @@
**步骤**
1. 执行 `aide decide '<valid_json>'`
1. 执行 `aide decide submit '<valid_json>'`
**期望**
@@ -28,7 +28,7 @@
**步骤**
1. 执行 `aide decide 'invalid json'`
1. 执行 `aide decide submit 'invalid json'`
**期望**
@@ -41,7 +41,7 @@
**步骤**
1. 执行 `aide decide '{"task":"test"}'`(缺少必填字段)
1. 执行 `aide decide submit '{"task":"test"}'`(缺少必填字段)
**期望**
@@ -65,7 +65,7 @@
**步骤**
1. 执行 `aide decide '<json>'` 并立即中断Ctrl+C
1. 执行 `aide decide submit '<json>'` 并立即中断Ctrl+C
2. 执行 `aide decide result`
**期望**
@@ -94,7 +94,7 @@
**步骤**
1. 占用端口 3721`nc -l 3721`
2. 执行 `aide decide '<json>'`
2. 执行 `aide decide submit '<json>'`
**期望**
@@ -106,7 +106,7 @@
**步骤**
1. 占用端口 3721-3730
2. 执行 `aide decide '<json>'`
2. 执行 `aide decide submit '<json>'`
**期望**
@@ -294,7 +294,7 @@
**步骤**
1. 执行 `aide decide '<json>'`
1. 执行 `aide decide submit '<json>'`
2. 检查 `.aide/decisions/pending.json`
**期望**
@@ -321,9 +321,9 @@
**步骤**
1. 执行 `aide decide '<json1>'`
1. 执行 `aide decide submit '<json1>'`
2. 中断服务
3. 执行 `aide decide '<json2>'`
3. 执行 `aide decide submit '<json2>'`
4. 检查 pending.json
**期望**
@@ -349,7 +349,7 @@
**步骤**
1. 执行 `aide decide '<json>'`
1. 执行 `aide decide submit '<json>'`
2. 在浏览器中打开链接
3. 选择所有选项
4. 添加备注
@@ -384,7 +384,7 @@
**步骤**
1. 删除 .aide 目录
2. 执行 `aide decide '<json>'`
2. 执行 `aide decide submit '<json>'`
**期望**
@@ -408,7 +408,7 @@
**步骤**
1. 构造包含 100 个待定项的 JSON
2. 执行 `aide decide '<json>'`
2. 执行 `aide decide submit '<json>'`
**期望**

View File

@@ -171,10 +171,10 @@ manager = "pnpm"
| `url` | string | `""` | 自定义访问地址,为空时自动生成 `http://localhost:{port}` |
**使用场景**
- `aide decide '<json>'` 读取 `port` 作为起始端口
- `aide decide '<json>'` 读取 `timeout` 控制服务最长等待时间
- `aide decide '<json>'` 读取 `bind` 作为监听地址
- `aide decide '<json>'` 读取 `url` 作为输出的访问地址(支持自定义域名)
- `aide decide submit '<json>'` 读取 `port` 作为起始端口
- `aide decide submit '<json>'` 读取 `timeout` 控制服务最长等待时间
- `aide decide submit '<json>'` 读取 `bind` 作为监听地址
- `aide decide submit '<json>'` 读取 `url` 作为输出的访问地址(支持自定义域名)
**示例配置**
```toml

View File

@@ -13,7 +13,7 @@
### 2.1 输入格式LLM → aide decide
LLM 调用 `aide decide '<json>'` 时传入的数据格式。
LLM 调用 `aide decide submit '<json>'` 时传入的数据格式。
```
DecideInput: