ccg-workflow 1.7.2 → 1.7.4
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 +9 -7
- package/bin/codeagent-wrapper-darwin-amd64 +0 -0
- package/bin/codeagent-wrapper-darwin-arm64 +0 -0
- package/bin/codeagent-wrapper-linux-amd64 +0 -0
- package/bin/codeagent-wrapper-linux-arm64 +0 -0
- package/bin/codeagent-wrapper-windows-amd64.exe +0 -0
- package/bin/codeagent-wrapper-windows-arm64.exe +0 -0
- package/dist/cli.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/shared/{ccg-workflow.BO24M85O.mjs → ccg-workflow.B1tr28ka.mjs} +32 -31
- package/package.json +1 -1
- package/templates/commands/analyze.md +40 -57
- package/templates/commands/backend.md +37 -89
- package/templates/commands/debug.md +31 -73
- package/templates/commands/enhance.md +36 -0
- package/templates/commands/feat.md +43 -20
- package/templates/commands/frontend.md +37 -89
- package/templates/commands/optimize.md +28 -69
- package/templates/commands/review.md +29 -77
- package/templates/commands/test.md +42 -71
- package/templates/commands/workflow.md +48 -144
package/README.md
CHANGED
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
- ✅ **多模型并行** - Codex ∥ Gemini 同时分析,交叉验证减少错误
|
|
31
31
|
- ✅ **零写入权限** - 外部模型只返回 Patch,Claude 保持代码主权
|
|
32
32
|
- ✅ **Token 优化** - ROLE_FILE 动态注入,专家提示词零消耗
|
|
33
|
-
- ✅
|
|
33
|
+
- ✅ **Web UI 实时输出** - 自动打开浏览器,流式显示思考过程、命令执行、生成结果
|
|
34
|
+
- ✅ **一键安装** - npx 运行,自动安装全部 15 个命令
|
|
34
35
|
|
|
35
36
|
---
|
|
36
37
|
|
|
@@ -57,7 +58,7 @@ npx ccg-workflow
|
|
|
57
58
|
**安装流程**:
|
|
58
59
|
1. 选择是否配置 ace-tool MCP(可跳过)
|
|
59
60
|
2. 确认安装
|
|
60
|
-
3. 自动安装全部
|
|
61
|
+
3. 自动安装全部 15 个命令
|
|
61
62
|
4. 配置 PATH(如需要)
|
|
62
63
|
|
|
63
64
|
就这么简单!无需选择语言、模型、命令预设。
|
|
@@ -69,7 +70,7 @@ npx ccg-workflow
|
|
|
69
70
|
| 前端模型 | **Gemini** |
|
|
70
71
|
| 后端模型 | **Codex** |
|
|
71
72
|
| 协作模式 | **smart** |
|
|
72
|
-
| 命令数量 | **
|
|
73
|
+
| 命令数量 | **15 个**(全部安装) |
|
|
73
74
|
|
|
74
75
|
### 第一个命令
|
|
75
76
|
|
|
@@ -99,7 +100,7 @@ npx ccg-workflow
|
|
|
99
100
|
/ccg:backend # 纯后端任务(Codex 主导,更快)
|
|
100
101
|
```
|
|
101
102
|
|
|
102
|
-
### 完整命令列表(
|
|
103
|
+
### 完整命令列表(15 个)
|
|
103
104
|
|
|
104
105
|
#### 开发工作流
|
|
105
106
|
|
|
@@ -109,6 +110,7 @@ npx ccg-workflow
|
|
|
109
110
|
| `/ccg:frontend` | 前端专项(快速模式) | Gemini |
|
|
110
111
|
| `/ccg:backend` | 后端专项(快速模式) | Codex |
|
|
111
112
|
| `/ccg:feat` | 智能功能开发 | 规划 → 实施 |
|
|
113
|
+
| `/ccg:enhance` | Prompt 增强(ace-tool) | MCP |
|
|
112
114
|
| `/ccg:analyze` | 技术分析(仅分析不改代码) | Codex ∥ Gemini |
|
|
113
115
|
| `/ccg:debug` | 问题诊断 + 修复 | Codex ∥ Gemini |
|
|
114
116
|
| `/ccg:optimize` | 性能优化 | Codex ∥ Gemini |
|
|
@@ -166,9 +168,9 @@ npx ccg-workflow
|
|
|
166
168
|
|
|
167
169
|
```
|
|
168
170
|
~/.claude/
|
|
169
|
-
├── commands/ccg/ #
|
|
171
|
+
├── commands/ccg/ # 15 个斜杠命令
|
|
170
172
|
├── agents/ccg/ # 4 个子智能体
|
|
171
|
-
├── skills/ #
|
|
173
|
+
├── skills/ # 暂无
|
|
172
174
|
├── bin/
|
|
173
175
|
│ └── codeagent-wrapper # Go 多后端调用工具
|
|
174
176
|
└── .ccg/
|
|
@@ -350,7 +352,7 @@ Copyright (c) 2025 fengshao1227
|
|
|
350
352
|
|
|
351
353
|
<div align="center">
|
|
352
354
|
|
|
353
|
-
**版本**: v1.7.
|
|
355
|
+
**版本**: v1.7.3 | **最后更新**: 2026-01-09
|
|
354
356
|
|
|
355
357
|
Made with ❤️ by the CCG Community
|
|
356
358
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import cac from 'cac';
|
|
3
3
|
import ansis from 'ansis';
|
|
4
|
-
import { y as diagnoseMcpConfig, z as isWindows, A as readClaudeCodeConfig, B as fixWindowsMcpConfig, C as writeClaudeCodeConfig, r as readCcgConfig, b as initI18n, s as showMainMenu, i as init, D as configMcp, E as version, a as i18n } from './shared/ccg-workflow.
|
|
4
|
+
import { y as diagnoseMcpConfig, z as isWindows, A as readClaudeCodeConfig, B as fixWindowsMcpConfig, C as writeClaudeCodeConfig, r as readCcgConfig, b as initI18n, s as showMainMenu, i as init, D as configMcp, E as version, a as i18n } from './shared/ccg-workflow.B1tr28ka.mjs';
|
|
5
5
|
import 'inquirer';
|
|
6
6
|
import 'node:os';
|
|
7
7
|
import 'pathe';
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { c as changeLanguage, v as checkForUpdates, x as compareVersions, d as createDefaultConfig, e as createDefaultRouting, g as getCcgDir, f as getConfigPath, q as getCurrentVersion, t as getLatestVersion, j as getWorkflowById, h as getWorkflowConfigs, a as i18n, i as init, b as initI18n, l as installAceTool, k as installWorkflows, o as migrateToV1_4_0, p as needsMigration, r as readCcgConfig, s as showMainMenu, n as uninstallAceTool, m as uninstallWorkflows, u as update, w as writeCcgConfig } from './shared/ccg-workflow.
|
|
1
|
+
export { c as changeLanguage, v as checkForUpdates, x as compareVersions, d as createDefaultConfig, e as createDefaultRouting, g as getCcgDir, f as getConfigPath, q as getCurrentVersion, t as getLatestVersion, j as getWorkflowById, h as getWorkflowConfigs, a as i18n, i as init, b as initI18n, l as installAceTool, k as installWorkflows, o as migrateToV1_4_0, p as needsMigration, r as readCcgConfig, s as showMainMenu, n as uninstallAceTool, m as uninstallWorkflows, u as update, w as writeCcgConfig } from './shared/ccg-workflow.B1tr28ka.mjs';
|
|
2
2
|
import 'ansis';
|
|
3
3
|
import 'inquirer';
|
|
4
4
|
import 'node:os';
|
|
@@ -10,7 +10,7 @@ import { parse, stringify } from 'smol-toml';
|
|
|
10
10
|
import { exec } from 'node:child_process';
|
|
11
11
|
import { promisify } from 'node:util';
|
|
12
12
|
|
|
13
|
-
const version = "1.7.
|
|
13
|
+
const version = "1.7.4";
|
|
14
14
|
|
|
15
15
|
function isWindows() {
|
|
16
16
|
return process.platform === "win32";
|
|
@@ -1580,7 +1580,7 @@ ${exportCommand}
|
|
|
1580
1580
|
}
|
|
1581
1581
|
}
|
|
1582
1582
|
|
|
1583
|
-
const execAsync = promisify(exec);
|
|
1583
|
+
const execAsync$1 = promisify(exec);
|
|
1584
1584
|
const __filename$1 = fileURLToPath(import.meta.url);
|
|
1585
1585
|
const __dirname$1 = dirname(__filename$1);
|
|
1586
1586
|
function findPackageRoot(startDir) {
|
|
@@ -1605,7 +1605,7 @@ async function getCurrentVersion() {
|
|
|
1605
1605
|
}
|
|
1606
1606
|
async function getLatestVersion(packageName = "ccg-workflow") {
|
|
1607
1607
|
try {
|
|
1608
|
-
const { stdout } = await execAsync(`npm view ${packageName} version`);
|
|
1608
|
+
const { stdout } = await execAsync$1(`npm view ${packageName} version`);
|
|
1609
1609
|
return stdout.trim();
|
|
1610
1610
|
} catch {
|
|
1611
1611
|
return null;
|
|
@@ -1642,7 +1642,7 @@ async function checkForUpdates() {
|
|
|
1642
1642
|
};
|
|
1643
1643
|
}
|
|
1644
1644
|
|
|
1645
|
-
promisify(exec);
|
|
1645
|
+
const execAsync = promisify(exec);
|
|
1646
1646
|
async function update() {
|
|
1647
1647
|
console.log();
|
|
1648
1648
|
console.log(ansis.cyan.bold("\u{1F504} \u68C0\u67E5\u66F4\u65B0..."));
|
|
@@ -1658,30 +1658,18 @@ async function update() {
|
|
|
1658
1658
|
console.log(`\u5F53\u524D\u7248\u672C: ${ansis.yellow(`v${currentVersion}`)}`);
|
|
1659
1659
|
console.log(`\u6700\u65B0\u7248\u672C: ${ansis.green(`v${latestVersion}`)}`);
|
|
1660
1660
|
console.log();
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
}
|
|
1672
|
-
} else {
|
|
1673
|
-
const { confirmUpdate } = await inquirer.prompt([{
|
|
1674
|
-
type: "confirm",
|
|
1675
|
-
name: "confirmUpdate",
|
|
1676
|
-
message: `\u786E\u8BA4\u8981\u66F4\u65B0\u5230 v${latestVersion} \u5417\uFF1F`,
|
|
1677
|
-
default: true
|
|
1678
|
-
}]);
|
|
1679
|
-
if (!confirmUpdate) {
|
|
1680
|
-
console.log(ansis.gray("\u5DF2\u53D6\u6D88\u66F4\u65B0"));
|
|
1681
|
-
return;
|
|
1682
|
-
}
|
|
1661
|
+
const message = hasUpdate ? `\u786E\u8BA4\u8981\u66F4\u65B0\u5230 v${latestVersion} \u5417\uFF1F\uFF08\u5148\u4E0B\u8F7D\u6700\u65B0\u5305 \u2192 \u5220\u9664\u65E7\u5DE5\u4F5C\u6D41 \u2192 \u5B89\u88C5\u65B0\u5DE5\u4F5C\u6D41\uFF09` : "\u5F53\u524D\u5DF2\u662F\u6700\u65B0\u7248\u672C\u3002\u8981\u91CD\u65B0\u5B89\u88C5\u5417\uFF1F\uFF08\u5148\u4E0B\u8F7D\u6700\u65B0\u5305 \u2192 \u5220\u9664\u65E7\u5DE5\u4F5C\u6D41 \u2192 \u5B89\u88C5\u65B0\u5DE5\u4F5C\u6D41\uFF09";
|
|
1662
|
+
const { confirmUpdate } = await inquirer.prompt([{
|
|
1663
|
+
type: "confirm",
|
|
1664
|
+
name: "confirmUpdate",
|
|
1665
|
+
message,
|
|
1666
|
+
default: hasUpdate
|
|
1667
|
+
}]);
|
|
1668
|
+
if (!confirmUpdate) {
|
|
1669
|
+
console.log(ansis.gray("\u5DF2\u53D6\u6D88\u66F4\u65B0"));
|
|
1670
|
+
return;
|
|
1683
1671
|
}
|
|
1684
|
-
await performUpdate(currentVersion, latestVersion || currentVersion);
|
|
1672
|
+
await performUpdate(currentVersion, latestVersion || currentVersion, hasUpdate);
|
|
1685
1673
|
} catch (error) {
|
|
1686
1674
|
spinner.stop();
|
|
1687
1675
|
console.log(ansis.red(`\u274C \u66F4\u65B0\u5931\u8D25: ${error}`));
|
|
@@ -1755,13 +1743,22 @@ async function askReconfigureRouting(currentRouting) {
|
|
|
1755
1743
|
console.log();
|
|
1756
1744
|
return newRouting;
|
|
1757
1745
|
}
|
|
1758
|
-
async function performUpdate(fromVersion, toVersion) {
|
|
1746
|
+
async function performUpdate(fromVersion, toVersion, isNewVersion) {
|
|
1759
1747
|
console.log();
|
|
1760
1748
|
console.log(ansis.yellow.bold("\u2699\uFE0F \u5F00\u59CB\u66F4\u65B0..."));
|
|
1761
1749
|
console.log();
|
|
1750
|
+
let spinner = ora("\u6B63\u5728\u4E0B\u8F7D\u6700\u65B0\u7248\u672C...").start();
|
|
1751
|
+
try {
|
|
1752
|
+
await execAsync(`npx --yes ccg-workflow@latest --version`, { timeout: 6e4 });
|
|
1753
|
+
spinner.succeed("\u6700\u65B0\u7248\u672C\u4E0B\u8F7D\u5B8C\u6210");
|
|
1754
|
+
} catch (error) {
|
|
1755
|
+
spinner.fail("\u4E0B\u8F7D\u6700\u65B0\u7248\u672C\u5931\u8D25");
|
|
1756
|
+
console.log(ansis.red(`\u9519\u8BEF: ${error}`));
|
|
1757
|
+
return;
|
|
1758
|
+
}
|
|
1762
1759
|
const config = await readCcgConfig();
|
|
1763
1760
|
const newRouting = await askReconfigureRouting(config?.routing);
|
|
1764
|
-
|
|
1761
|
+
spinner = ora("\u6B63\u5728\u5220\u9664\u65E7\u5DE5\u4F5C\u6D41\u5E76\u5B89\u88C5\u65B0\u5DE5\u4F5C\u6D41...").start();
|
|
1765
1762
|
try {
|
|
1766
1763
|
const workflows = config?.workflows?.installed || [];
|
|
1767
1764
|
const installDir = join(homedir(), ".claude");
|
|
@@ -1769,7 +1766,7 @@ async function performUpdate(fromVersion, toVersion) {
|
|
|
1769
1766
|
routing: newRouting || config?.routing
|
|
1770
1767
|
});
|
|
1771
1768
|
if (result.success) {
|
|
1772
|
-
spinner.succeed("\
|
|
1769
|
+
spinner.succeed("\u5DE5\u4F5C\u6D41\u66F4\u65B0\u6210\u529F");
|
|
1773
1770
|
console.log();
|
|
1774
1771
|
console.log(ansis.cyan(`\u5DF2\u66F4\u65B0 ${result.installedCommands.length} \u4E2A\u547D\u4EE4:`));
|
|
1775
1772
|
for (const cmd of result.installedCommands) {
|
|
@@ -1802,7 +1799,11 @@ async function performUpdate(fromVersion, toVersion) {
|
|
|
1802
1799
|
console.log();
|
|
1803
1800
|
console.log(ansis.green.bold("\u2705 \u66F4\u65B0\u5B8C\u6210\uFF01"));
|
|
1804
1801
|
console.log();
|
|
1805
|
-
|
|
1802
|
+
if (isNewVersion) {
|
|
1803
|
+
console.log(ansis.gray(`\u4ECE v${fromVersion} \u5347\u7EA7\u5230 v${toVersion}`));
|
|
1804
|
+
} else {
|
|
1805
|
+
console.log(ansis.gray(`\u91CD\u65B0\u5B89\u88C5\u4E86 v${toVersion}`));
|
|
1806
|
+
}
|
|
1806
1807
|
console.log();
|
|
1807
1808
|
}
|
|
1808
1809
|
|
package/package.json
CHANGED
|
@@ -12,27 +12,44 @@ description: '多模型技术分析(并行执行):Codex 后端视角 + Gem
|
|
|
12
12
|
/analyze <分析问题或任务>
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## 你的角色
|
|
16
|
+
|
|
17
|
+
你是**分析协调者**,编排多模型分析流程:
|
|
18
|
+
- **ace-tool** – 代码上下文检索
|
|
19
|
+
- **Codex** – 后端/系统视角(**后端权威**)
|
|
20
|
+
- **Gemini** – 前端/用户视角(**前端权威**)
|
|
21
|
+
- **Claude (自己)** – 综合见解
|
|
16
22
|
|
|
17
|
-
|
|
23
|
+
---
|
|
18
24
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
25
|
+
## 多模型调用规范
|
|
26
|
+
|
|
27
|
+
**调用语法**(并行用 `run_in_background: true`):
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
Bash({
|
|
31
|
+
command: "~/.claude/bin/codeagent-wrapper --backend <codex|gemini> - \"$PWD\" <<'EOF'
|
|
32
|
+
ROLE_FILE: <角色提示词路径>
|
|
22
33
|
<TASK>
|
|
23
|
-
|
|
34
|
+
需求:<增强后的需求(如未增强则用 $ARGUMENTS)>
|
|
35
|
+
上下文:<前序阶段检索到的代码上下文>
|
|
24
36
|
</TASK>
|
|
25
37
|
OUTPUT: 期望输出格式
|
|
26
|
-
EOF
|
|
38
|
+
EOF",
|
|
39
|
+
run_in_background: true,
|
|
40
|
+
timeout: 3600000,
|
|
41
|
+
description: "简短描述"
|
|
42
|
+
})
|
|
27
43
|
```
|
|
28
44
|
|
|
29
|
-
|
|
45
|
+
**角色提示词**:
|
|
30
46
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
47
|
+
| 模型 | 提示词 |
|
|
48
|
+
|------|--------|
|
|
49
|
+
| Codex | `~/.claude/.ccg/prompts/codex/analyzer.md` |
|
|
50
|
+
| Gemini | `~/.claude/.ccg/prompts/gemini/analyzer.md` |
|
|
51
|
+
|
|
52
|
+
**并行调用**:使用 `run_in_background: true` 启动,用 `TaskOutput` 等待结果。**必须等所有模型返回后才能进入下一阶段**。
|
|
36
53
|
|
|
37
54
|
---
|
|
38
55
|
|
|
@@ -40,6 +57,10 @@ EOF
|
|
|
40
57
|
|
|
41
58
|
**分析任务**:$ARGUMENTS
|
|
42
59
|
|
|
60
|
+
### 🔍 阶段 0:Prompt 增强(可选)
|
|
61
|
+
|
|
62
|
+
`[模式:准备]` - 如 ace-tool MCP 可用,调用 `mcp__ace-tool__enhance_prompt`,**用增强结果替代原始 $ARGUMENTS,后续调用 Codex/Gemini 时传入增强后的需求**
|
|
63
|
+
|
|
43
64
|
### 🔍 阶段 1:上下文检索
|
|
44
65
|
|
|
45
66
|
`[模式:研究]`
|
|
@@ -52,48 +73,11 @@ EOF
|
|
|
52
73
|
|
|
53
74
|
`[模式:分析]`
|
|
54
75
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
1. 使用 **Bash 工具的 `run_in_background: true` 参数**启动两个后台进程:
|
|
59
|
-
|
|
60
|
-
**Codex 分析进程**:
|
|
61
|
-
```
|
|
62
|
-
Bash({
|
|
63
|
-
command: "~/.claude/bin/codeagent-wrapper --backend codex - \"$PWD\" <<'EOF_CODEX'
|
|
64
|
-
ROLE_FILE: ~/.claude/.ccg/prompts/codex/analyzer.md
|
|
65
|
-
<TASK>
|
|
66
|
-
分析需求: $ARGUMENTS
|
|
67
|
-
Context: <阶段1检索到的上下文>
|
|
68
|
-
</TASK>
|
|
69
|
-
OUTPUT: 技术可行性、架构影响、性能考量
|
|
70
|
-
EOF_CODEX",
|
|
71
|
-
run_in_background: true,
|
|
72
|
-
timeout: 3600000,
|
|
73
|
-
description: "Codex 技术分析"
|
|
74
|
-
})
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
**Gemini 分析进程**:
|
|
78
|
-
```
|
|
79
|
-
Bash({
|
|
80
|
-
command: "~/.claude/bin/codeagent-wrapper --backend gemini - \"$PWD\" <<'EOF_GEMINI'
|
|
81
|
-
ROLE_FILE: ~/.claude/.ccg/prompts/gemini/analyzer.md
|
|
82
|
-
<TASK>
|
|
83
|
-
分析需求: $ARGUMENTS
|
|
84
|
-
Context: <阶段1检索到的上下文>
|
|
85
|
-
</TASK>
|
|
86
|
-
OUTPUT: UI/UX 影响、用户体验、视觉设计考量
|
|
87
|
-
EOF_GEMINI",
|
|
88
|
-
run_in_background: true,
|
|
89
|
-
timeout: 3600000,
|
|
90
|
-
description: "Gemini UI 分析"
|
|
91
|
-
})
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
2. 使用 `TaskOutput` 监控并获取 2 个模型的分析结果。
|
|
76
|
+
**并行调用**(`run_in_background: true`):
|
|
77
|
+
- Codex:使用分析提示词,输出技术可行性、架构影响、性能考量
|
|
78
|
+
- Gemini:使用分析提示词,输出 UI/UX 影响、用户体验、视觉设计考量
|
|
95
79
|
|
|
96
|
-
|
|
80
|
+
用 `TaskOutput` 等待两个模型的完整结果。
|
|
97
81
|
|
|
98
82
|
### 🔀 阶段 3:交叉验证
|
|
99
83
|
|
|
@@ -145,6 +129,5 @@ EOF_GEMINI",
|
|
|
145
129
|
## 关键规则
|
|
146
130
|
|
|
147
131
|
1. **仅分析不修改** – 本命令不执行任何代码变更
|
|
148
|
-
2.
|
|
149
|
-
3.
|
|
150
|
-
4. **信任规则** – 后端以 Codex 为准,前端以 Gemini 为准
|
|
132
|
+
2. **信任规则** – 后端以 Codex 为准,前端以 Gemini 为准
|
|
133
|
+
3. 外部模型对文件系统**零写入权限**
|
|
@@ -25,28 +25,44 @@ description: '后端专项工作流(研究→构思→计划→执行→优化
|
|
|
25
25
|
- **Gemini** – 前端视角(**后端意见仅供参考**)
|
|
26
26
|
- **Claude (自己)** – 编排、计划、执行、交付
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
---
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
2. 严格按 `研究 → 构思 → 计划 → 执行 → 优化 → 评审` 顺序流转
|
|
30
|
+
## 多模型调用规范
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
**调用语法**:
|
|
34
33
|
|
|
35
|
-
|
|
34
|
+
```
|
|
35
|
+
Bash({
|
|
36
|
+
command: "~/.claude/bin/codeagent-wrapper --backend codex [--resume <SESSION_ID>] - \"$PWD\" <<'EOF'
|
|
37
|
+
ROLE_FILE: <角色提示词路径>
|
|
38
|
+
<TASK>
|
|
39
|
+
需求:<增强后的需求(如未增强则用 $ARGUMENTS)>
|
|
40
|
+
上下文:<前序阶段收集的项目上下文、分析结果等>
|
|
41
|
+
</TASK>
|
|
42
|
+
OUTPUT: 期望输出格式
|
|
43
|
+
EOF",
|
|
44
|
+
run_in_background: false,
|
|
45
|
+
timeout: 3600000,
|
|
46
|
+
description: "简短描述"
|
|
47
|
+
})
|
|
48
|
+
```
|
|
36
49
|
|
|
37
|
-
|
|
38
|
-
# Codex 调用(后端主力)
|
|
39
|
-
~/.claude/bin/codeagent-wrapper --backend codex - "$PWD" <<'EOF'
|
|
40
|
-
[角色提示词内容]
|
|
50
|
+
**角色提示词**:
|
|
41
51
|
|
|
42
|
-
|
|
43
|
-
|
|
52
|
+
| 阶段 | Codex |
|
|
53
|
+
|------|-------|
|
|
54
|
+
| 分析 | `~/.claude/.ccg/prompts/codex/analyzer.md` |
|
|
55
|
+
| 规划 | `~/.claude/.ccg/prompts/codex/architect.md` |
|
|
56
|
+
| 审查 | `~/.claude/.ccg/prompts/codex/reviewer.md` |
|
|
44
57
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
58
|
+
**会话复用**:每次调用返回 `SESSION_ID: xxx`,后续阶段用 `--resume xxx` 复用上下文。阶段 2 保存 `CODEX_SESSION`,阶段 3 和 5 使用 `--resume` 复用。
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 沟通守则
|
|
63
|
+
|
|
64
|
+
1. 响应以模式标签 `[模式:X]` 开始,初始为 `[模式:研究]`
|
|
65
|
+
2. 严格按 `研究 → 构思 → 计划 → 执行 → 优化 → 评审` 顺序流转
|
|
50
66
|
|
|
51
67
|
---
|
|
52
68
|
|
|
@@ -54,12 +70,7 @@ EOF
|
|
|
54
70
|
|
|
55
71
|
### 🔍 阶段 0:Prompt 增强(可选)
|
|
56
72
|
|
|
57
|
-
`[模式:准备]` -
|
|
58
|
-
|
|
59
|
-
**如果 ace-tool MCP 可用**,调用 `mcp__ace-tool__enhance_prompt`:
|
|
60
|
-
- 输入原始任务描述
|
|
61
|
-
- 获取增强后的详细需求
|
|
62
|
-
- 用增强后的需求替代原始 $ARGUMENTS
|
|
73
|
+
`[模式:准备]` - 如 ace-tool MCP 可用,调用 `mcp__ace-tool__enhance_prompt`,**用增强结果替代原始 $ARGUMENTS,后续调用 Codex 时传入增强后的需求**
|
|
63
74
|
|
|
64
75
|
### 🔍 阶段 1:研究
|
|
65
76
|
|
|
@@ -72,32 +83,9 @@ EOF
|
|
|
72
83
|
|
|
73
84
|
`[模式:构思]` - Codex 主导分析
|
|
74
85
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
```
|
|
78
|
-
Bash({
|
|
79
|
-
command: "~/.claude/bin/codeagent-wrapper --backend codex - \"$PWD\" <<'EOF_CODEX'
|
|
80
|
-
ROLE_FILE: ~/.claude/.ccg/prompts/codex/analyzer.md
|
|
86
|
+
调用 Codex,使用分析提示词,输出技术可行性、推荐方案、风险点。
|
|
81
87
|
|
|
82
|
-
|
|
83
|
-
分析以下后端需求,提供设计方案:
|
|
84
|
-
- API 接口设计
|
|
85
|
-
- 数据模型结构
|
|
86
|
-
- 性能与安全考虑
|
|
87
|
-
- 错误处理策略
|
|
88
|
-
|
|
89
|
-
需求:[具体任务描述]
|
|
90
|
-
</TASK>
|
|
91
|
-
|
|
92
|
-
OUTPUT: 技术可行性、推荐方案、风险点
|
|
93
|
-
EOF_CODEX",
|
|
94
|
-
run_in_background: false,
|
|
95
|
-
timeout: 3600000,
|
|
96
|
-
description: "Codex 后端分析"
|
|
97
|
-
})
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
**⚠️ 等待 Codex 返回后继续**
|
|
88
|
+
**📌 保存 SESSION_ID**(`CODEX_SESSION`)。
|
|
101
89
|
|
|
102
90
|
输出方案(至少 2 个),等待用户选择。
|
|
103
91
|
|
|
@@ -105,27 +93,7 @@ EOF_CODEX",
|
|
|
105
93
|
|
|
106
94
|
`[模式:计划]` - Codex 主导规划
|
|
107
95
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
```
|
|
111
|
-
Bash({
|
|
112
|
-
command: "~/.claude/bin/codeagent-wrapper --backend codex - \"$PWD\" <<'EOF_CODEX'
|
|
113
|
-
ROLE_FILE: ~/.claude/.ccg/prompts/codex/architect.md
|
|
114
|
-
|
|
115
|
-
<TASK>
|
|
116
|
-
规划需求: [具体任务描述]
|
|
117
|
-
Context: [项目上下文]
|
|
118
|
-
</TASK>
|
|
119
|
-
|
|
120
|
-
OUTPUT: 文件结构、函数/类设计、依赖
|
|
121
|
-
EOF_CODEX",
|
|
122
|
-
run_in_background: false,
|
|
123
|
-
timeout: 3600000,
|
|
124
|
-
description: "Codex 后端架构规划"
|
|
125
|
-
})
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
**⚠️ 等待 Codex 返回后继续**
|
|
96
|
+
调用 Codex(`--resume $CODEX_SESSION`),使用规划提示词,输出文件结构、函数/类设计、依赖。
|
|
129
97
|
|
|
130
98
|
Claude 综合规划,请求用户批准后存入 `.claude/plan/任务名.md`
|
|
131
99
|
|
|
@@ -141,27 +109,7 @@ Claude 综合规划,请求用户批准后存入 `.claude/plan/任务名.md`
|
|
|
141
109
|
|
|
142
110
|
`[模式:优化]` - Codex 主导审查
|
|
143
111
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
```
|
|
147
|
-
Bash({
|
|
148
|
-
command: "~/.claude/bin/codeagent-wrapper --backend codex - \"$PWD\" <<'EOF_CODEX'
|
|
149
|
-
ROLE_FILE: ~/.claude/.ccg/prompts/codex/reviewer.md
|
|
150
|
-
|
|
151
|
-
<TASK>
|
|
152
|
-
审查代码: [实施的代码变更]
|
|
153
|
-
关注点: 安全性、性能、错误处理、API规范
|
|
154
|
-
</TASK>
|
|
155
|
-
|
|
156
|
-
OUTPUT: 审查意见
|
|
157
|
-
EOF_CODEX",
|
|
158
|
-
run_in_background: false,
|
|
159
|
-
timeout: 3600000,
|
|
160
|
-
description: "Codex 后端代码审查"
|
|
161
|
-
})
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
**⚠️ 等待 Codex 返回后继续**
|
|
112
|
+
调用 Codex,使用审查提示词,关注安全性、性能、错误处理、API规范。
|
|
165
113
|
|
|
166
114
|
整合审查意见,用户确认后执行优化。
|
|
167
115
|
|
|
@@ -6,22 +6,6 @@ description: '多模型调试:Codex 后端诊断 + Gemini 前端诊断,交
|
|
|
6
6
|
|
|
7
7
|
双模型并行诊断,交叉验证快速定位问题根因。
|
|
8
8
|
|
|
9
|
-
## 多模型调用语法
|
|
10
|
-
|
|
11
|
-
**⚠️ 必须使用 heredoc 语法调用外部模型**:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
~/.claude/bin/codeagent-wrapper --backend <codex|gemini> - "$PWD" <<'EOF'
|
|
15
|
-
<任务内容>
|
|
16
|
-
EOF
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
- `--backend codex` – 后端/逻辑问题诊断
|
|
20
|
-
- `--backend gemini` – 前端/UI 问题诊断
|
|
21
|
-
- `$PWD` – 当前工作目录
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
9
|
## 使用方法
|
|
26
10
|
|
|
27
11
|
```bash
|
|
@@ -37,18 +21,36 @@ EOF
|
|
|
37
21
|
|
|
38
22
|
---
|
|
39
23
|
|
|
24
|
+
## 多模型调用规范
|
|
25
|
+
|
|
26
|
+
**调用语法**(并行用 `run_in_background: true`):
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
Bash({
|
|
30
|
+
command: "~/.claude/bin/codeagent-wrapper --backend <codex|gemini> - \"$PWD\" <<'EOF'
|
|
31
|
+
<TASK>
|
|
32
|
+
需求:<增强后的需求(如未增强则用 $ARGUMENTS)>
|
|
33
|
+
上下文:<错误日志、堆栈信息、复现步骤等>
|
|
34
|
+
</TASK>
|
|
35
|
+
OUTPUT: 诊断假设(按可能性排序)
|
|
36
|
+
EOF",
|
|
37
|
+
run_in_background: true,
|
|
38
|
+
timeout: 3600000,
|
|
39
|
+
description: "简短描述"
|
|
40
|
+
})
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**并行调用**:使用 `run_in_background: true` 启动,用 `TaskOutput` 等待结果。**必须等所有模型返回后才能进入下一阶段**。
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
40
47
|
## 执行工作流
|
|
41
48
|
|
|
42
49
|
**问题描述**:$ARGUMENTS
|
|
43
50
|
|
|
44
51
|
### 🔍 阶段 0:Prompt 增强(可选)
|
|
45
52
|
|
|
46
|
-
`[模式:准备]` -
|
|
47
|
-
|
|
48
|
-
**如果 ace-tool MCP 可用**,调用 `mcp__ace-tool__enhance_prompt`:
|
|
49
|
-
- 输入原始问题描述
|
|
50
|
-
- 获取增强后的详细问题分析
|
|
51
|
-
- 用增强后的描述替代原始 $ARGUMENTS
|
|
53
|
+
`[模式:准备]` - 如 ace-tool MCP 可用,调用 `mcp__ace-tool__enhance_prompt`,**用增强结果替代原始 $ARGUMENTS,后续调用 Codex/Gemini 时传入增强后的需求**
|
|
52
54
|
|
|
53
55
|
### 🔍 阶段 1:上下文收集
|
|
54
56
|
|
|
@@ -62,52 +64,11 @@ EOF
|
|
|
62
64
|
|
|
63
65
|
`[模式:诊断]`
|
|
64
66
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
1. 使用 **Bash 工具的 `run_in_background: true` 参数**启动两个后台进程:
|
|
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
|
-
```
|
|
88
|
-
|
|
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
|
-
})
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
2. 使用 `TaskOutput` 监控并获取 2 个模型的诊断结果。
|
|
67
|
+
**并行调用**(`run_in_background: true`):
|
|
68
|
+
- Codex:分析逻辑错误、数据流、异常处理、API、数据库
|
|
69
|
+
- Gemini:分析 UI 渲染、状态管理、事件绑定、组件生命周期
|
|
109
70
|
|
|
110
|
-
|
|
71
|
+
用 `TaskOutput` 等待两个模型的诊断结果。
|
|
111
72
|
|
|
112
73
|
### 🔀 阶段 3:假设整合
|
|
113
74
|
|
|
@@ -147,14 +108,11 @@ EOF_GEMINI",
|
|
|
147
108
|
用户确认后:
|
|
148
109
|
1. 根据诊断实施修复
|
|
149
110
|
2. 运行测试验证修复
|
|
150
|
-
3. **可选**:并行调用 Codex + Gemini 审查修复
|
|
151
111
|
|
|
152
112
|
---
|
|
153
113
|
|
|
154
114
|
## 关键规则
|
|
155
115
|
|
|
156
|
-
1.
|
|
157
|
-
2.
|
|
158
|
-
3.
|
|
159
|
-
4. **用户确认** – 修复前必须获得确认
|
|
160
|
-
5. **信任规则** – 后端问题以 Codex 为准,前端问题以 Gemini 为准
|
|
116
|
+
1. **用户确认** – 修复前必须获得确认
|
|
117
|
+
2. **信任规则** – 后端问题以 Codex 为准,前端问题以 Gemini 为准
|
|
118
|
+
3. 外部模型对文件系统**零写入权限**
|