docs: 更新API文档+工作流文档(分支检测+对比接口)

This commit is contained in:
jiawei.chen 2026-07-08 17:01:13 +08:00
parent 8c45c925c9
commit 0efea38728
2 changed files with 58 additions and 1 deletions

View File

@ -62,7 +62,25 @@ python3 main.py diff -r <repo-url> -a HEAD~3
## 三、UI 变更检查 + 自动修复
### 3.1 检测模式
### 3.1 仓库管理 - 分支自动检测
```
输入 Git 仓库 URL
→ 失焦/点击「最新分支」按钮
→ git ls-remote --heads 获取所有远程分支
→ git for-each-ref --sort=-committerdate 找到最新提交分支
→ 自动切换到最新分支
→ 显示分支列表(数量 + commit hash + 最新/默认标签)
→ 点击「扫描」→ clone → AST 分析 → DDD 建模
```
**分支功能:**
- 自动检测:失焦后自动扫描远程分支
- 手动检测:点击「⚡最新分支」按钮,自动找到最近提交的分支并切换
- 下拉列表:显示所有分支 + commit hash 前 8 位 + 最新/默认标签
- 分支对比:POST /api/repos/compare 对比任意两个分支的变更文件
### 3.2 检测模式
```
输入前端仓库 URL
→ 克隆前端代码

View File

@ -39,6 +39,45 @@ Base URL: `http://localhost:5002`
---
## 仓库分支
### GET /api/repos/branches?url=<repo-url>
获取远程仓库所有分支列表,自动识别最新提交分支。
**响应:**
```json
{
"branches": [{"name": "dev", "commit": "8c45c92"}, {"name": "main", "commit": "6f6053f"}],
"total": 15,
"default": "main",
"latest": "dev"
}
```
### POST /api/repos/compare
对比两个分支的变更文件列表。
**请求体:**
```json
{
"url": "https://github.com/user/repo.git",
"base": "main",
"compare": "dev"
}
```
**响应:**
```json
{
"base": "main",
"compare": "dev",
"changed_files": ["agent/llm_client.py", "backend/app.py"],
"total_changes": 2
}
```
---
## 仓库管理
### GET /api/repos