ccg-workflow 1.6.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +175 -408
- package/bin/codeagent-wrapper-linux-arm64 +0 -0
- package/bin/codeagent-wrapper-windows-arm64.exe +0 -0
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +1 -1
- package/dist/shared/{ccg-workflow.CjatSnB0.mjs → ccg-workflow._fNXxrRQ.mjs} +194 -286
- package/package.json +1 -1
- package/templates/commands/analyze.md +130 -57
- package/templates/commands/backend.md +92 -152
- package/templates/commands/clean-branches.md +81 -66
- package/templates/commands/commit.md +81 -117
- package/templates/commands/debug.md +117 -90
- package/templates/commands/feat.md +68 -282
- package/templates/commands/frontend.md +92 -154
- package/templates/commands/init.md +100 -36
- package/templates/commands/optimize.md +137 -70
- package/templates/commands/review.md +123 -63
- package/templates/commands/rollback.md +86 -60
- package/templates/commands/test.md +143 -54
- package/templates/commands/workflow.md +244 -0
- package/templates/commands/worktree.md +78 -226
- package/templates/commands/bugfix.md +0 -114
- package/templates/commands/code.md +0 -255
- package/templates/commands/dev.md +0 -179
- package/templates/commands/think.md +0 -102
|
@@ -1,102 +1,117 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
3
|
-
allowed-tools: Read(**), Exec(git fetch, git config, git branch, git remote, git push, git for-each-ref, git log), Write()
|
|
4
|
-
argument-hint: [--base <branch>] [--stale <days>] [--remote] [--force] [--dry-run] [--yes]
|
|
5
|
-
# examples:
|
|
6
|
-
# - /git-cleanBranches --dry-run
|
|
7
|
-
# - /git-cleanBranches --base release/v2.1 --stale 90
|
|
8
|
-
# - /git-cleanBranches --remote --yes
|
|
2
|
+
description: '清理 Git 分支:安全清理已合并或过期分支,默认 dry-run 模式'
|
|
9
3
|
---
|
|
10
4
|
|
|
11
|
-
#
|
|
5
|
+
# Clean-Branches - 清理 Git 分支
|
|
12
6
|
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
安全识别并清理已合并或长期未更新的分支。
|
|
8
|
+
|
|
9
|
+
## 使用方法
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
/clean-branches [options]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 选项
|
|
16
|
+
|
|
17
|
+
| 选项 | 说明 |
|
|
18
|
+
|------|------|
|
|
19
|
+
| `--base <branch>` | 基准分支(默认 main/master) |
|
|
20
|
+
| `--stale <days>` | 清理超过 N 天未更新的分支 |
|
|
21
|
+
| `--remote` | 同时清理远程分支 |
|
|
22
|
+
| `--dry-run` | 只预览,不执行(**默认**) |
|
|
23
|
+
| `--yes` | 跳过确认直接删除 |
|
|
24
|
+
| `--force` | 强制删除未合并分支 |
|
|
15
25
|
|
|
16
26
|
---
|
|
17
27
|
|
|
18
|
-
##
|
|
28
|
+
## 执行工作流
|
|
19
29
|
|
|
20
|
-
|
|
21
|
-
# [最安全] 预览将要清理的分支,不执行任何删除
|
|
22
|
-
/git-cleanBranches --dry-run
|
|
30
|
+
### 🔍 阶段 1:预检
|
|
23
31
|
|
|
24
|
-
|
|
25
|
-
/git-cleanBranches --stale 90
|
|
32
|
+
`[模式:准备]`
|
|
26
33
|
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
1. 同步远端:`git fetch --all --prune`
|
|
35
|
+
2. 读取保护分支配置
|
|
36
|
+
3. 确定基准分支
|
|
29
37
|
|
|
30
|
-
|
|
31
|
-
/git-cleanBranches --force outdated-feature
|
|
32
|
-
```
|
|
38
|
+
### 📋 阶段 2:分析识别
|
|
33
39
|
|
|
34
|
-
|
|
40
|
+
`[模式:分析]`
|
|
35
41
|
|
|
36
|
-
|
|
37
|
-
- `--
|
|
38
|
-
- `--remote`:同时清理远程已合并/过期的分支。
|
|
39
|
-
- `--dry-run`:**默认行为**。仅列出将要删除的分支,不执行任何操作。
|
|
40
|
-
- `--yes`:跳过逐一确认的步骤,直接删除所有已识别的分支(适合 CI/CD)。
|
|
41
|
-
- `--force`:使用 `-D` 强制删除本地分支(即使未合并)。
|
|
42
|
+
**已合并分支**:
|
|
43
|
+
- 已完全合并到 `--base` 的分支
|
|
42
44
|
|
|
43
|
-
|
|
45
|
+
**过期分支**(如指定 `--stale`):
|
|
46
|
+
- 最后提交在 N 天前的分支
|
|
44
47
|
|
|
45
|
-
|
|
48
|
+
**排除**:
|
|
49
|
+
- 从待清理列表中移除保护分支
|
|
46
50
|
|
|
47
|
-
|
|
48
|
-
- **更新信息**:自动执行 `git fetch --all --prune`,确保分支状态最新。
|
|
49
|
-
- **读取保护分支**:从 Git 配置读取不应被清理的分支列表(见下文“Configuration”)。
|
|
50
|
-
- **确定基准**:使用 `--base` 参数或自动识别的 `main`/`master` 作为比较基准。
|
|
51
|
+
### 📊 阶段 3:报告预览
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
- **已合并分支**:找出已完全合并到 `--base` 的本地(及远程,如加 `--remote`)分支。
|
|
54
|
-
- **过期分支**:如指定 `--stale <days>`,找出最后一次提交在 N 天前的分支。
|
|
55
|
-
- **排除保护分支**:从待清理列表中移除所有已配置的保护分支。
|
|
53
|
+
`[模式:报告]`
|
|
56
54
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
- 若无 `--yes` 参数,**命令到此结束**,等待用户确认后再次执行(不带 `--dry-run`)。
|
|
55
|
+
```markdown
|
|
56
|
+
## 将要删除的分支
|
|
60
57
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
- 本地用 `git branch -d <branch>`;远程用 `git push origin --delete <branch>`。
|
|
65
|
-
- 若指定 `--force`,本地删除会改用 `git branch -D <branch>`。
|
|
58
|
+
### 已合并分支
|
|
59
|
+
- feature/old-feature (合并于 3 天前)
|
|
60
|
+
- bugfix/fixed-issue (合并于 7 天前)
|
|
66
61
|
|
|
67
|
-
|
|
62
|
+
### 过期分支
|
|
63
|
+
- experiment/old-test (最后更新 90 天前)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### ✅ 阶段 4:执行清理
|
|
68
67
|
|
|
69
|
-
|
|
68
|
+
`[模式:执行]`
|
|
70
69
|
|
|
71
|
-
|
|
70
|
+
仅在不带 `--dry-run` 且确认后执行:
|
|
72
71
|
|
|
73
72
|
```bash
|
|
74
|
-
#
|
|
75
|
-
git
|
|
73
|
+
# 本地分支
|
|
74
|
+
git branch -d <branch>
|
|
76
75
|
|
|
77
|
-
#
|
|
76
|
+
# 远程分支(如果 --remote)
|
|
77
|
+
git push origin --delete <branch>
|
|
78
|
+
|
|
79
|
+
# 强制删除(如果 --force)
|
|
80
|
+
git branch -D <branch>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 保护分支配置
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# 添加保护分支
|
|
89
|
+
git config --add branch.cleanup.protected develop
|
|
78
90
|
git config --add branch.cleanup.protected 'release/*'
|
|
79
91
|
|
|
80
|
-
#
|
|
92
|
+
# 查看保护分支
|
|
81
93
|
git config --get-all branch.cleanup.protected
|
|
82
94
|
```
|
|
83
95
|
|
|
84
96
|
---
|
|
85
97
|
|
|
86
|
-
##
|
|
98
|
+
## 示例
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# 预览将清理的分支
|
|
102
|
+
/clean-branches --dry-run
|
|
87
103
|
|
|
88
|
-
|
|
89
|
-
-
|
|
90
|
-
- **谨慎 `--force`**:除非你百分百确定某个未合并分支是无用功,否则不要强制删除。
|
|
91
|
-
- **团队协作**:在清理共享的远程分支前,先在团队频道通知一声。
|
|
92
|
-
- **定期运行**:每月或每季度运行一次,保持仓库清爽。
|
|
104
|
+
# 清理已合并且超过 90 天未动的分支
|
|
105
|
+
/clean-branches --stale 90
|
|
93
106
|
|
|
94
|
-
|
|
107
|
+
# 清理已合并到 release/v2.1 的分支
|
|
108
|
+
/clean-branches --base release/v2.1 --remote --yes
|
|
109
|
+
```
|
|
95
110
|
|
|
96
|
-
##
|
|
111
|
+
## 最佳实践
|
|
97
112
|
|
|
98
|
-
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
113
|
+
1. **优先 dry-run** – 先预览再执行
|
|
114
|
+
2. **活用 --base** – 适配 release 工作流
|
|
115
|
+
3. **谨慎 --force** – 除非确定无用
|
|
116
|
+
4. **团队协作** – 清理远程分支前先通知
|
|
117
|
+
5. **定期运行** – 每月/季度一次保持清爽
|
|
@@ -1,158 +1,122 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
3
|
-
allowed-tools: Read(**), Exec(git status, git diff, git add, git restore --staged, git commit, git rev-parse, git config), Write(.git/COMMIT_EDITMSG)
|
|
4
|
-
argument-hint: [--no-verify] [--all] [--amend] [--signoff] [--emoji] [--scope <scope>] [--type <type>]
|
|
5
|
-
# examples:
|
|
6
|
-
# - /git-commit # 分析当前改动,生成提交信息
|
|
7
|
-
# - /git-commit --all # 暂存所有改动并提交
|
|
8
|
-
# - /git-commit --no-verify # 跳过 Git 钩子检查
|
|
9
|
-
# - /git-commit --emoji # 在提交信息中包含 emoji
|
|
10
|
-
# - /git-commit --scope ui --type feat # 指定作用域和类型
|
|
11
|
-
# - /git-commit --amend --signoff # 修补上次提交并签名
|
|
2
|
+
description: '智能 Git 提交:分析改动生成 Conventional Commit 信息,支持拆分建议'
|
|
12
3
|
---
|
|
13
4
|
|
|
14
|
-
#
|
|
5
|
+
# Commit - 智能 Git 提交
|
|
15
6
|
|
|
16
|
-
|
|
7
|
+
分析当前改动,生成 Conventional Commits 风格的提交信息。
|
|
17
8
|
|
|
18
|
-
|
|
19
|
-
- 判断是否需要**拆分为多次提交**
|
|
20
|
-
- 为每个提交生成 **Conventional Commits** 风格的信息(可选 emoji)
|
|
21
|
-
- 按需执行 `git add` 与 `git commit`(默认运行本地 Git 钩子;可 `--no-verify` 跳过)
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## Usage
|
|
9
|
+
## 使用方法
|
|
26
10
|
|
|
27
11
|
```bash
|
|
28
|
-
/
|
|
29
|
-
/git-commit --no-verify
|
|
30
|
-
/git-commit --emoji
|
|
31
|
-
/git-commit --all --signoff
|
|
32
|
-
/git-commit --amend
|
|
33
|
-
/git-commit --scope ui --type feat --emoji
|
|
12
|
+
/commit [options]
|
|
34
13
|
```
|
|
35
14
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
- `--no-verify`:跳过本地 Git 钩子(`pre-commit`/`commit-msg` 等)。
|
|
39
|
-
- `--all`:当暂存区为空时,自动 `git add -A` 将所有改动纳入本次提交。
|
|
40
|
-
- `--amend`:在不创建新提交的情况下**修补**上一次提交(保持提交作者与时间,除非本地 Git 配置另有指定)。
|
|
41
|
-
- `--signoff`:附加 `Signed-off-by` 行(遵循 DCO 流程时使用)。
|
|
42
|
-
- `--emoji`:在提交信息中包含 emoji 前缀(省略则使用纯文本)。
|
|
43
|
-
- `--scope <scope>`:指定提交作用域(如 `ui`、`docs`、`api`),写入消息头部。
|
|
44
|
-
- `--type <type>`:强制提交类型(如 `feat`、`fix`、`docs` 等),覆盖自动判断。
|
|
15
|
+
## 选项
|
|
45
16
|
|
|
46
|
-
|
|
17
|
+
| 选项 | 说明 |
|
|
18
|
+
|------|------|
|
|
19
|
+
| `--no-verify` | 跳过 Git 钩子 |
|
|
20
|
+
| `--all` | 暂存所有改动 |
|
|
21
|
+
| `--amend` | 修补上次提交 |
|
|
22
|
+
| `--signoff` | 附加签名 |
|
|
23
|
+
| `--emoji` | 包含 emoji 前缀 |
|
|
24
|
+
| `--scope <scope>` | 指定作用域 |
|
|
25
|
+
| `--type <type>` | 指定提交类型 |
|
|
47
26
|
|
|
48
27
|
---
|
|
49
28
|
|
|
50
|
-
##
|
|
29
|
+
## 执行工作流
|
|
51
30
|
|
|
52
|
-
1
|
|
53
|
-
- 通过 `git rev-parse --is-inside-work-tree` 判断是否位于 Git 仓库。
|
|
54
|
-
- 读取当前分支/HEAD 状态;如处于 rebase/merge 冲突状态,先提示处理冲突后再继续。
|
|
31
|
+
### 🔍 阶段 1:仓库校验
|
|
55
32
|
|
|
56
|
-
|
|
57
|
-
- 用 `git status --porcelain` 与 `git diff` 获取已暂存与未暂存的改动。
|
|
58
|
-
- 若已暂存文件为 0:
|
|
59
|
-
- 若传入 `--all` → 执行 `git add -A`。
|
|
60
|
-
- 否则提示你选择:继续仅分析未暂存改动并给出**建议**,或取消命令后手动分组暂存。
|
|
33
|
+
`[模式:检查]`
|
|
61
34
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
35
|
+
1. 验证 Git 仓库状态
|
|
36
|
+
2. 检测 rebase/merge 冲突
|
|
37
|
+
3. 读取当前分支/HEAD 状态
|
|
65
38
|
|
|
66
|
-
|
|
67
|
-
- 自动推断 `type`(`feat`/`fix`/`docs`/`refactor`/`test`/`chore`/`perf`/`style`/`ci`/`revert` …)与可选 `scope`。
|
|
68
|
-
- 生成消息头:`[<emoji>] <type>(<scope>)?: <subject>`(首行 ≤ 72 字符,祈使语气,仅在使用 `--emoji` 时包含 emoji)。
|
|
69
|
-
- 生成消息体:要点列表(动机、实现要点、影响范围、BREAKING CHANGE 如有)。
|
|
70
|
-
- 根据 Git 历史提交的主要语言选择提交信息语言。优先检查最近提交主题(例如 `git log -n 50 --pretty=%s`)判断中文/英文;若无法判断,则回退到仓库主要语言或英文。
|
|
71
|
-
- 将草稿写入 `.git/COMMIT_EDITMSG`,并用于 `git commit`。
|
|
39
|
+
### 📋 阶段 2:改动检测
|
|
72
40
|
|
|
73
|
-
|
|
74
|
-
- 单提交场景:`git commit [-S] [--no-verify] [-s] -F .git/COMMIT_EDITMSG`
|
|
75
|
-
- 多提交场景(如接受拆分建议):按分组给出 `git add <paths> && git commit ...` 的明确指令;若允许执行则逐一完成。
|
|
41
|
+
`[模式:分析]`
|
|
76
42
|
|
|
77
|
-
|
|
78
|
-
|
|
43
|
+
1. 获取已暂存与未暂存改动
|
|
44
|
+
2. 若暂存区为空:
|
|
45
|
+
- `--all` → 执行 `git add -A`
|
|
46
|
+
- 否则提示选择
|
|
79
47
|
|
|
80
|
-
|
|
48
|
+
### ✂️ 阶段 3:拆分建议
|
|
81
49
|
|
|
82
|
-
|
|
50
|
+
`[模式:建议]`
|
|
83
51
|
|
|
84
|
-
|
|
85
|
-
-
|
|
86
|
-
-
|
|
87
|
-
-
|
|
88
|
-
- **遵循 Conventional Commits**:`<type>(<scope>): <subject>`。
|
|
52
|
+
按以下维度聚类:
|
|
53
|
+
- 关注点(源代码 vs 文档/测试)
|
|
54
|
+
- 文件模式(不同目录/包)
|
|
55
|
+
- 改动类型(新增 vs 删除)
|
|
89
56
|
|
|
90
|
-
|
|
57
|
+
若检测到多组独立变更(>300 行 / 跨多个顶级目录),建议拆分。
|
|
91
58
|
|
|
92
|
-
|
|
59
|
+
### ✍️ 阶段 4:生成提交信息
|
|
93
60
|
|
|
94
|
-
|
|
95
|
-
- 🐛 `fix`:缺陷修复(含 🔥 删除代码/文件、🚑️ 紧急修复、👽️ 适配外部 API 变更、🔒️ 安全修复、🚨 解决告警、💚 修复 CI)
|
|
96
|
-
- 📝 `docs`:文档与注释
|
|
97
|
-
- 🎨 `style`:风格/格式(不改语义)
|
|
98
|
-
- ♻️ `refactor`:重构(不新增功能、不修缺陷)
|
|
99
|
-
- ⚡️ `perf`:性能优化
|
|
100
|
-
- ✅ `test`:新增/修复测试、快照
|
|
101
|
-
- 🔧 `chore`:构建/工具/杂务(合并分支、更新配置、发布标记、依赖 pin、.gitignore 等)
|
|
102
|
-
- 👷 `ci`:CI/CD 配置与脚本
|
|
103
|
-
- ⏪️ `revert`:回滚提交
|
|
104
|
-
- 💥 `feat`:破坏性变更(`BREAKING CHANGE:` 段落中说明)
|
|
61
|
+
`[模式:生成]`
|
|
105
62
|
|
|
106
|
-
|
|
107
|
-
> 仅在指定 `--emoji` 标志时才会包含 emoji。
|
|
63
|
+
**格式**:`[emoji] <type>(<scope>): <subject>`
|
|
108
64
|
|
|
109
|
-
|
|
65
|
+
- 首行 ≤ 72 字符
|
|
66
|
+
- 祈使语气
|
|
67
|
+
- 消息体:动机、实现要点、影响范围
|
|
68
|
+
|
|
69
|
+
**语言**:根据最近 50 次提交判断中文/英文
|
|
110
70
|
|
|
111
|
-
|
|
71
|
+
### ✅ 阶段 5:执行提交
|
|
112
72
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
73
|
+
`[模式:执行]`
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
git commit [-S] [--no-verify] [-s] -F .git/COMMIT_EDITMSG
|
|
77
|
+
```
|
|
118
78
|
|
|
119
79
|
---
|
|
120
80
|
|
|
121
|
-
##
|
|
81
|
+
## Type 与 Emoji 映射
|
|
82
|
+
|
|
83
|
+
| Emoji | Type | 说明 |
|
|
84
|
+
|-------|------|------|
|
|
85
|
+
| ✨ | `feat` | 新增功能 |
|
|
86
|
+
| 🐛 | `fix` | 缺陷修复 |
|
|
87
|
+
| 📝 | `docs` | 文档更新 |
|
|
88
|
+
| 🎨 | `style` | 代码格式 |
|
|
89
|
+
| ♻️ | `refactor` | 重构 |
|
|
90
|
+
| ⚡️ | `perf` | 性能优化 |
|
|
91
|
+
| ✅ | `test` | 测试相关 |
|
|
92
|
+
| 🔧 | `chore` | 构建/工具 |
|
|
93
|
+
| 👷 | `ci` | CI/CD |
|
|
94
|
+
| ⏪️ | `revert` | 回滚 |
|
|
122
95
|
|
|
123
|
-
|
|
96
|
+
---
|
|
124
97
|
|
|
125
|
-
|
|
126
|
-
- 🐛 fix(api): handle token refresh race condition
|
|
127
|
-
- 📝 docs: update API usage examples
|
|
128
|
-
- ♻️ refactor(core): extract retry logic into helper
|
|
129
|
-
- ✅ test: add unit tests for rate limiter
|
|
130
|
-
- 🔧 chore: update git hooks and repository settings
|
|
131
|
-
- ⏪️ revert: revert "feat(core): introduce streaming API"
|
|
98
|
+
## 示例
|
|
132
99
|
|
|
133
|
-
|
|
100
|
+
```bash
|
|
101
|
+
# 基本提交
|
|
102
|
+
/commit
|
|
134
103
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
- docs: update API usage examples
|
|
138
|
-
- refactor(core): extract retry logic into helper
|
|
139
|
-
- test: add unit tests for rate limiter
|
|
140
|
-
- chore: update git hooks and repository settings
|
|
141
|
-
- revert: revert "feat(core): introduce streaming API"
|
|
104
|
+
# 暂存所有并提交
|
|
105
|
+
/commit --all
|
|
142
106
|
|
|
143
|
-
|
|
107
|
+
# 带 emoji 提交
|
|
108
|
+
/commit --emoji
|
|
144
109
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
- `test: add unit tests for payment types`
|
|
148
|
-
- `fix: address linter warnings in new files` ←(如你的仓库有钩子报错)
|
|
110
|
+
# 指定类型和作用域
|
|
111
|
+
/commit --scope ui --type feat --emoji
|
|
149
112
|
|
|
150
|
-
|
|
113
|
+
# 修补上次提交
|
|
114
|
+
/commit --amend --signoff
|
|
115
|
+
```
|
|
151
116
|
|
|
152
|
-
##
|
|
117
|
+
## 关键规则
|
|
153
118
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
- **可审可控**:如开启 `confirm: true`,每个实际 `git add`/`git commit` 步骤都会进行二次确认。
|
|
119
|
+
1. **仅使用 Git** – 不调用包管理器
|
|
120
|
+
2. **尊重钩子** – 默认执行,`--no-verify` 可跳过
|
|
121
|
+
3. **不改源码** – 只读写 `.git/COMMIT_EDITMSG`
|
|
122
|
+
4. **原子提交** – 一次提交只做一件事
|
|
@@ -1,133 +1,160 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
2
|
+
description: '多模型调试:Codex 后端诊断 + Gemini 前端诊断,交叉验证定位问题'
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
`/debug <问题描述>`
|
|
5
|
+
# Debug - 多模型调试
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
- 问题描述: $ARGUMENTS
|
|
10
|
-
- 使用 ace-tool 检索相关代码上下文
|
|
11
|
-
- Codex 专注后端/逻辑问题,Gemini 专注前端/UI问题
|
|
7
|
+
双模型并行诊断,交叉验证快速定位问题根因。
|
|
12
8
|
|
|
13
|
-
##
|
|
9
|
+
## 多模型调用语法
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
**⚠️ 必须使用 heredoc 语法调用外部模型**:
|
|
16
12
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
```bash
|
|
14
|
+
~/.claude/bin/codeagent-wrapper --backend <codex|gemini> - "$PWD" <<'EOF'
|
|
15
|
+
<任务内容>
|
|
16
|
+
EOF
|
|
17
|
+
```
|
|
22
18
|
|
|
23
|
-
|
|
19
|
+
- `--backend codex` – 后端/逻辑问题诊断
|
|
20
|
+
- `--backend gemini` – 前端/UI 问题诊断
|
|
21
|
+
- `$PWD` – 当前工作目录
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
---
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
## 使用方法
|
|
28
26
|
|
|
29
27
|
```bash
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
ROLE_FILE: ~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/debugger.md
|
|
28
|
+
/debug <问题描述>
|
|
29
|
+
```
|
|
33
30
|
|
|
34
|
-
|
|
35
|
-
诊断问题: {{问题描述}}
|
|
36
|
-
Context: {{从 ace-tool 获取的相关代码}}
|
|
37
|
-
</TASK>
|
|
31
|
+
## 你的角色
|
|
38
32
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
你是**调试协调者**,编排多模型诊断流程:
|
|
34
|
+
- **Codex** – 后端诊断(**后端问题权威**)
|
|
35
|
+
- **Gemini** – 前端诊断(**前端问题权威**)
|
|
36
|
+
- **Claude (自己)** – 综合诊断、执行修复
|
|
42
37
|
|
|
43
|
-
|
|
44
|
-
# Gemini 前端诊断
|
|
45
|
-
codeagent-wrapper --backend {{FRONTEND_PRIMARY}} - $PROJECT_DIR <<'EOF'
|
|
46
|
-
ROLE_FILE: ~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/debugger.md
|
|
38
|
+
---
|
|
47
39
|
|
|
48
|
-
|
|
49
|
-
诊断问题: {{问题描述}}
|
|
50
|
-
Context: {{从 ace-tool 获取的相关代码}}
|
|
51
|
-
</TASK>
|
|
40
|
+
## 执行工作流
|
|
52
41
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
42
|
+
**问题描述**:$ARGUMENTS
|
|
43
|
+
|
|
44
|
+
### 🔍 阶段 0:Prompt 增强(可选)
|
|
45
|
+
|
|
46
|
+
`[模式:准备]` - 增强问题描述
|
|
47
|
+
|
|
48
|
+
**如果 ace-tool MCP 可用**,调用 `mcp__ace-tool__enhance_prompt`:
|
|
49
|
+
- 输入原始问题描述
|
|
50
|
+
- 获取增强后的详细问题分析
|
|
51
|
+
- 用增强后的描述替代原始 $ARGUMENTS
|
|
52
|
+
|
|
53
|
+
### 🔍 阶段 1:上下文收集
|
|
54
|
+
|
|
55
|
+
`[模式:研究]`
|
|
56
|
+
|
|
57
|
+
1. 调用 `mcp__ace-tool__search_context` 检索相关代码(如可用)
|
|
58
|
+
2. 收集错误日志、堆栈信息、复现步骤
|
|
59
|
+
3. 识别问题类型:[后端/前端/全栈]
|
|
60
|
+
|
|
61
|
+
### 🔬 阶段 2:并行诊断
|
|
56
62
|
|
|
57
|
-
|
|
58
|
-
- **Gemini** + `debugger` 角色 → 前端诊断
|
|
63
|
+
`[模式:诊断]`
|
|
59
64
|
|
|
60
|
-
|
|
65
|
+
**并行调用 Codex + Gemini**:
|
|
61
66
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
3. **UltraThink 综合**:
|
|
65
|
-
- 整合所有假设,按可能性排序
|
|
66
|
-
- 筛选出 **Top 1-2 最可能原因**
|
|
67
|
-
- 设计验证策略
|
|
67
|
+
**执行步骤**:
|
|
68
|
+
1. 使用 **Bash 工具的 `run_in_background: true` 参数**启动两个后台进程:
|
|
68
69
|
|
|
69
|
-
|
|
70
|
+
**Codex 诊断进程**:
|
|
71
|
+
```
|
|
72
|
+
Bash({
|
|
73
|
+
command: "~/.claude/bin/codeagent-wrapper --backend codex - \"$PWD\" <<'EOF_CODEX'
|
|
74
|
+
角色:后端调试专家
|
|
75
|
+
|
|
76
|
+
问题:$ARGUMENTS
|
|
77
|
+
|
|
78
|
+
任务:
|
|
79
|
+
1. 分析逻辑错误、数据流、异常处理
|
|
80
|
+
2. 检查 API、数据库、服务间通信
|
|
81
|
+
3. 输出诊断假设(按可能性排序)
|
|
82
|
+
EOF_CODEX",
|
|
83
|
+
run_in_background: true,
|
|
84
|
+
timeout: 3600000,
|
|
85
|
+
description: "Codex 后端诊断"
|
|
86
|
+
})
|
|
87
|
+
```
|
|
70
88
|
|
|
71
|
-
|
|
89
|
+
**Gemini 诊断进程**:
|
|
90
|
+
```
|
|
91
|
+
Bash({
|
|
92
|
+
command: "~/.claude/bin/codeagent-wrapper --backend gemini - \"$PWD\" <<'EOF_GEMINI'
|
|
93
|
+
角色:前端调试专家
|
|
94
|
+
|
|
95
|
+
问题:$ARGUMENTS
|
|
96
|
+
|
|
97
|
+
任务:
|
|
98
|
+
1. 分析 UI 渲染、状态管理、事件绑定
|
|
99
|
+
2. 检查组件生命周期、样式冲突
|
|
100
|
+
3. 输出诊断假设(按可能性排序)
|
|
101
|
+
EOF_GEMINI",
|
|
102
|
+
run_in_background: true,
|
|
103
|
+
timeout: 3600000,
|
|
104
|
+
description: "Gemini 前端诊断"
|
|
105
|
+
})
|
|
72
106
|
```
|
|
107
|
+
|
|
108
|
+
2. 使用 `TaskOutput` 监控并获取 2 个模型的诊断结果。
|
|
109
|
+
|
|
110
|
+
**⚠️ 强制规则:必须等待 TaskOutput 返回两个模型的完整结果后才能进入下一阶段,禁止跳过或提前继续!**
|
|
111
|
+
|
|
112
|
+
### 🔀 阶段 3:假设整合
|
|
113
|
+
|
|
114
|
+
`[模式:验证]`
|
|
115
|
+
|
|
116
|
+
1. 交叉验证双方诊断结果
|
|
117
|
+
2. 筛选 **Top 1-2 最可能原因**
|
|
118
|
+
3. 设计验证策略
|
|
119
|
+
|
|
120
|
+
### ⛔ 阶段 4:用户确认(Hard Stop)
|
|
121
|
+
|
|
122
|
+
`[模式:确认]`
|
|
123
|
+
|
|
124
|
+
```markdown
|
|
73
125
|
## 🔍 诊断结果
|
|
74
126
|
|
|
75
127
|
### Codex 分析(后端视角)
|
|
76
|
-
|
|
128
|
+
<诊断摘要>
|
|
77
129
|
|
|
78
130
|
### Gemini 分析(前端视角)
|
|
79
|
-
|
|
131
|
+
<诊断摘要>
|
|
80
132
|
|
|
81
133
|
### 综合诊断
|
|
82
134
|
**最可能原因**:<具体诊断>
|
|
83
|
-
**证据**:<支持证据>
|
|
84
135
|
**验证方案**:<如何确认>
|
|
85
136
|
|
|
86
137
|
---
|
|
87
138
|
**确认后我将执行修复。是否继续?(Y/N)**
|
|
88
139
|
```
|
|
89
140
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
### Phase 5: 修复与验证
|
|
93
|
-
|
|
94
|
-
1. 根据确认的诊断实施修复
|
|
95
|
-
2. 修复完成后,**并行调用** Codex + Gemini + `reviewer` 角色审查修复
|
|
96
|
-
3. 综合审查意见,确认问题解决
|
|
97
|
-
|
|
98
|
-
## 输出格式
|
|
99
|
-
|
|
100
|
-
```
|
|
101
|
-
## Phase 1: 上下文检索
|
|
102
|
-
- 检索到 X 个相关文件
|
|
103
|
-
- 问题类型: [前端/后端/全栈]
|
|
104
|
-
|
|
105
|
-
## Phase 2: 并行诊断
|
|
106
|
-
### Codex 诊断
|
|
107
|
-
<诊断内容>
|
|
108
|
-
|
|
109
|
-
### Gemini 诊断
|
|
110
|
-
<诊断内容>
|
|
141
|
+
**⚠️ 必须等待用户确认后才能进入阶段 5**
|
|
111
142
|
|
|
112
|
-
|
|
113
|
-
### Top 假设
|
|
114
|
-
1. [最可能原因] - 可能性: High
|
|
115
|
-
2. [次可能原因] - 可能性: Medium
|
|
143
|
+
### 🔧 阶段 5:修复与验证
|
|
116
144
|
|
|
117
|
-
|
|
118
|
-
- [具体验证步骤]
|
|
145
|
+
`[模式:执行]`
|
|
119
146
|
|
|
120
|
-
|
|
121
|
-
|
|
147
|
+
用户确认后:
|
|
148
|
+
1. 根据诊断实施修复
|
|
149
|
+
2. 运行测试验证修复
|
|
150
|
+
3. **可选**:并行调用 Codex + Gemini 审查修复
|
|
122
151
|
|
|
123
|
-
|
|
124
|
-
- 修复内容: <具体修改>
|
|
125
|
-
- 双模型审查: <审查结果>
|
|
126
|
-
```
|
|
152
|
+
---
|
|
127
153
|
|
|
128
|
-
##
|
|
154
|
+
## 关键规则
|
|
129
155
|
|
|
130
|
-
1.
|
|
131
|
-
2.
|
|
132
|
-
3.
|
|
133
|
-
4.
|
|
156
|
+
1. **heredoc 语法** – 外部模型调用必须使用 heredoc
|
|
157
|
+
2. **使用 Bash 工具的 `run_in_background: true` 参数 + `TaskOutput` 获取结果**
|
|
158
|
+
3. **必须等待所有模型返回完整结果后才能进入下一阶段**,禁止跳过或提前继续
|
|
159
|
+
4. **用户确认** – 修复前必须获得确认
|
|
160
|
+
5. **信任规则** – 后端问题以 Codex 为准,前端问题以 Gemini 为准
|