ccgx-workflow 2.2.0 → 2.3.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/dist/cli.mjs +1 -1
- package/dist/index.mjs +2 -2
- package/dist/shared/{ccgx-workflow.k6gRMX3r.mjs → ccgx-workflow.DDYfdCuM.mjs} +9 -1
- package/package.json +1 -1
- package/templates/commands/analyze.md +1 -1
- package/templates/commands/codex-exec.md +114 -68
- package/templates/commands/debate.md +3 -4
- package/templates/commands/execute.md +1 -3
- package/templates/commands/optimize.md +1 -1
- package/templates/commands/plan.md +1 -3
- package/templates/commands/review.md +1 -1
- package/templates/commands/spec-impl.md +114 -23
- package/templates/commands/spec-plan.md +53 -15
- package/templates/commands/spec-research.md +62 -15
- package/templates/commands/spec-review.md +73 -37
- package/templates/commands/team.md +117 -32
- package/templates/commands/test.md +1 -1
- package/templates/commands/workflow.md +56 -21
- package/templates/scripts/check-plugins.cjs +49 -0
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 { d as diagnoseMcpConfig, i as isWindows, r as readClaudeCodeConfig, f as fixWindowsMcpConfig, w as writeClaudeCodeConfig, a as readCcgConfig, b as initI18n, c as i18n, s as showMainMenu, e as init, g as configMcp, v as version } from './shared/ccgx-workflow.
|
|
4
|
+
import { d as diagnoseMcpConfig, i as isWindows, r as readClaudeCodeConfig, f as fixWindowsMcpConfig, w as writeClaudeCodeConfig, a as readCcgConfig, b as initI18n, c as i18n, s as showMainMenu, e as init, g as configMcp, v as version } from './shared/ccgx-workflow.DDYfdCuM.mjs';
|
|
5
5
|
import { execSync } from 'node:child_process';
|
|
6
6
|
import 'inquirer';
|
|
7
7
|
import 'ora';
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { h as collectSkills, j as resolvePluginBashCommand } from './shared/ccgx-workflow.
|
|
2
|
-
export { k as changeLanguage, G as checkForUpdates, I as collectInvocableSkills, H as compareVersions, m as createDefaultConfig, n as createDefaultRouting, J as generateCommandContent, o as getCcgDir, p as getConfigPath, E as getCurrentVersion, F as getLatestVersion, t as getWorkflowById, q as getWorkflowConfigs, c as i18n, e as init, b as initI18n, y as installAceTool, z as installAceToolRs, K as installSkillCommands, x as installWorkflows, C as migrateToV1_4_0, D as needsMigration, L as parseFrontmatter, a as readCcgConfig, s as showMainMenu, B as uninstallAceTool, A as uninstallWorkflows, u as update, l as writeCcgConfig } from './shared/ccgx-workflow.
|
|
1
|
+
import { h as collectSkills, j as resolvePluginBashCommand } from './shared/ccgx-workflow.DDYfdCuM.mjs';
|
|
2
|
+
export { k as changeLanguage, G as checkForUpdates, I as collectInvocableSkills, H as compareVersions, m as createDefaultConfig, n as createDefaultRouting, J as generateCommandContent, o as getCcgDir, p as getConfigPath, E as getCurrentVersion, F as getLatestVersion, t as getWorkflowById, q as getWorkflowConfigs, c as i18n, e as init, b as initI18n, y as installAceTool, z as installAceToolRs, K as installSkillCommands, x as installWorkflows, C as migrateToV1_4_0, D as needsMigration, L as parseFrontmatter, a as readCcgConfig, s as showMainMenu, B as uninstallAceTool, A as uninstallWorkflows, u as update, l as writeCcgConfig } from './shared/ccgx-workflow.DDYfdCuM.mjs';
|
|
3
3
|
import { existsSync, readFileSync, mkdirSync, writeFileSync, statSync, readdirSync } from 'node:fs';
|
|
4
4
|
import { join, dirname } from 'node:path';
|
|
5
5
|
import { homedir } from 'node:os';
|
|
@@ -13,7 +13,7 @@ import { join as join$2 } from 'node:path/posix';
|
|
|
13
13
|
import { join as join$1 } from 'node:path';
|
|
14
14
|
import i18next from 'i18next';
|
|
15
15
|
|
|
16
|
-
const version = "2.
|
|
16
|
+
const version = "2.3.1";
|
|
17
17
|
|
|
18
18
|
function cmd(id, order, category, name, nameEn, description, descriptionEn, cmdOverride) {
|
|
19
19
|
return {
|
|
@@ -1378,6 +1378,14 @@ async function installShim(ctx) {
|
|
|
1378
1378
|
await fs.chmod(destCallPlugin, 493);
|
|
1379
1379
|
}
|
|
1380
1380
|
}
|
|
1381
|
+
const srcCheckPlugins = join(ctx.templateDir, "scripts", "check-plugins.cjs");
|
|
1382
|
+
if (await fs.pathExists(srcCheckPlugins)) {
|
|
1383
|
+
const destCheckPlugins = join(scriptDir, "check-plugins.cjs");
|
|
1384
|
+
await fs.copy(srcCheckPlugins, destCheckPlugins, { overwrite: true });
|
|
1385
|
+
if (process.platform !== "win32") {
|
|
1386
|
+
await fs.chmod(destCheckPlugins, 493);
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1381
1389
|
if (process.platform === "win32") {
|
|
1382
1390
|
const cmdMjs = destMjs.replace(/\//g, "\\");
|
|
1383
1391
|
const cmdPath = join(binDir, "codeagent-wrapper.cmd");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccgx-workflow",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Multi-model orchestration for Claude Code. Codex + Gemini parallel collaboration with fresh-context subagent protocols, OS-level process isolation, and Plan-Critic-Verify quality tiers. Successor to ccg-workflow.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@10.17.1",
|
|
@@ -42,7 +42,7 @@ CCG 把双模型并行通道从 `Bash(codeagent-wrapper)` **默认切换**为 pl
|
|
|
42
42
|
1. **优先 plugin spawn**(默认):装了 `codex@openai-codex` + gemini plugin(推荐 `gemini@gemini-ccgx` fork,含 P-1..P-21 + W1/W2/I1 patch;或上游 `gemini@google-gemini` 配 repatch 脚本)→ 用 `Agent(subagent_type="codex:codex-rescue")` + `Agent(subagent_type="gemini:gemini-rescue")` 并行,主线接 ≤200 token 摘要。
|
|
43
43
|
2. **降级 codeagent-wrapper**(BC fallback):plugin 未装 → fallback 到 Bash 调用,行为与 plugin 路径等价。
|
|
44
44
|
|
|
45
|
-
**判定**:preflight `Bash` 跑 `
|
|
45
|
+
**判定**:preflight `Bash` 跑 `node ~/.claude/.ccg/scripts/check-plugins.cjs`(解析 Claude Code 权威 `installed_plugins.json`)。exit `0` + stdout `{"codex":"<ver>","gemini":"<ver>"}` → 通道 A(plugin 默认);非 `0` → 通道 B(wrapper BC fallback)。
|
|
46
46
|
|
|
47
47
|
⚠️ Analyze 命令在主线 context 内,**允许** `Agent(...)`——与 subagent "禁止嵌套 spawn" 约束不冲突。
|
|
48
48
|
|
|
@@ -46,60 +46,80 @@ $ARGUMENTS
|
|
|
46
46
|
- 如果用户通过 `/add-dir` 添加了多个工作区,先用 Glob/Grep 确定任务相关的工作区
|
|
47
47
|
- 如果无法确定,用 `AskUserQuestion` 询问用户选择目标工作区
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
**调用通道路由(CCG codeagent 退役,v2.2.0+)**
|
|
50
|
+
|
|
51
|
+
1. **优先 plugin spawn**(默认):plugin 已装 → `Agent(subagent_type="codex:codex-rescue")`,session 复用通过 prompt 内 `--resume` flag 表达(subagent 映射为 codex `--resume-last`)。
|
|
52
|
+
2. **降级 codeagent-wrapper**(BC fallback):plugin 未装 → Bash 调用,保留 `resume <SESSION_ID>` 显式会话管理。
|
|
53
|
+
|
|
54
|
+
**判定**:preflight `Bash` 跑 `node ~/.claude/.ccg/scripts/check-plugins.cjs`(解析 Claude Code 权威 `installed_plugins.json`)。exit `0` + stdout `{"codex":"<ver>","gemini":"<ver>"}` → 通道 A(plugin 默认);非 `0` → 通道 B(wrapper BC fallback)。
|
|
55
|
+
|
|
56
|
+
**会话模型差异**:
|
|
57
|
+
- **通道 A(plugin)**:session 是同一 Claude session 内的最近 codex/gemini thread(`--resume-last`)。同任务多 phase 顺序执行 OK;不支持跨任务跳点 resume by ID。
|
|
58
|
+
- **通道 B(wrapper)**:显式 `SESSION_ID`,可跨流程任意复用历史 thread。
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
**{{BACKEND_PRIMARY}} 执行调用语法(通道 A 默认)**:
|
|
63
|
+
|
|
64
|
+
**预备动作**:spawn 前主线先 Read 角色提示词(如 `~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/architect.md`)拼入 `<role>` 块。
|
|
50
65
|
|
|
51
66
|
```
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
67
|
+
Agent({
|
|
68
|
+
subagent_type: "codex:codex-rescue",
|
|
69
|
+
description: "简短描述",
|
|
70
|
+
prompt: `<role>
|
|
71
|
+
${implementerRole}
|
|
72
|
+
</role>
|
|
73
|
+
|
|
74
|
+
<workdir>{{WORKDIR}}</workdir>
|
|
75
|
+
|
|
76
|
+
<task>
|
|
55
77
|
<指令内容>
|
|
56
|
-
</
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
78
|
+
</task>
|
|
79
|
+
|
|
80
|
+
<action_safety>
|
|
81
|
+
- Stay strictly within the plan scope
|
|
82
|
+
- Run lint/typecheck if available before reporting completion
|
|
83
|
+
</action_safety>`
|
|
61
84
|
})
|
|
62
85
|
```
|
|
63
86
|
|
|
64
|
-
**{{BACKEND_PRIMARY}}
|
|
87
|
+
**{{BACKEND_PRIMARY}} 复用会话调用(通道 A,--resume)**:在 prompt 第一行加 `--resume`(subagent 提取为 routing flag 映射 codex `--resume-last`,不写入 task text):
|
|
65
88
|
|
|
66
89
|
```
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
description: "简短描述"
|
|
90
|
+
Agent({
|
|
91
|
+
subagent_type: "codex:codex-rescue",
|
|
92
|
+
description: "简短描述",
|
|
93
|
+
prompt: `--resume
|
|
94
|
+
|
|
95
|
+
<task>
|
|
96
|
+
<指令内容(仅 delta,不重述完整 plan)>
|
|
97
|
+
</task>`
|
|
76
98
|
})
|
|
77
99
|
```
|
|
78
100
|
|
|
79
|
-
|
|
101
|
+
**通道 B — wrapper BC fallback**(plugin 未装时):
|
|
80
102
|
|
|
81
103
|
```
|
|
104
|
+
# 新会话(保留 SESSION_ID)
|
|
82
105
|
Bash({
|
|
83
|
-
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--progress --backend
|
|
84
|
-
ROLE_FILE: <角色提示词路径>
|
|
85
|
-
<TASK>
|
|
86
|
-
Scope: Audit the code changes made by Codex.
|
|
87
|
-
Inputs:
|
|
88
|
-
- The git diff (applied changes)
|
|
89
|
-
- The implementation plan
|
|
90
|
-
Constraints:
|
|
91
|
-
- Do NOT modify any files.
|
|
92
|
-
</TASK>
|
|
93
|
-
OUTPUT:
|
|
94
|
-
1) A prioritized list of issues (severity, file, rationale)
|
|
95
|
-
2) If code changes are needed, include a Unified Diff Patch in a fenced code block.
|
|
96
|
-
REVIEW_EOF",
|
|
106
|
+
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--progress --backend {{BACKEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EXEC_EOF'\n<TASK>\n<指令内容>\n</TASK>\nEXEC_EOF",
|
|
97
107
|
run_in_background: true,
|
|
98
108
|
timeout: 3600000,
|
|
99
|
-
description: "简短描述"
|
|
109
|
+
description: "简短描述 (BC)"
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
# 复用会话
|
|
113
|
+
Bash({
|
|
114
|
+
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--progress --backend {{BACKEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}resume <SESSION_ID> - \"{{WORKDIR}}\" <<'EXEC_EOF'\n<TASK>\n<指令内容>\n</TASK>\nEXEC_EOF",
|
|
115
|
+
run_in_background: true,
|
|
116
|
+
timeout: 3600000,
|
|
117
|
+
description: "简短描述 (BC, resume)"
|
|
100
118
|
})
|
|
101
119
|
```
|
|
102
120
|
|
|
121
|
+
**审核调用(通道 A,双模型并行)**:参照 `/ccg:spec-review` 的 Step 3.1 pattern——`Agent(codex:codex-rescue)` + `Agent(gemini:gemini-rescue)` 同 message 并行,预读 `reviewer.md` 拼入 `<role>` 块。通道 B 同 `<<'REVIEW_EOF'... wrapper` 模式(已 deprecated)。
|
|
122
|
+
|
|
103
123
|
**角色提示词**:
|
|
104
124
|
|
|
105
125
|
| 阶段 | 后端 | 前端 |
|
|
@@ -156,12 +176,21 @@ REVIEW_EOF",
|
|
|
156
176
|
|
|
157
177
|
`[模式:执行]`
|
|
158
178
|
|
|
159
|
-
**将计划转化为 Codex
|
|
179
|
+
**将计划转化为 Codex 结构化指令,一次性下发**。按顶部「调用通道路由」选 A 或 B:
|
|
180
|
+
|
|
181
|
+
**通道 A — plugin spawn(默认)**:
|
|
160
182
|
|
|
161
183
|
```
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
184
|
+
Agent({
|
|
185
|
+
subagent_type: "codex:codex-rescue",
|
|
186
|
+
description: "Codex 全权执行:<计划标题>",
|
|
187
|
+
prompt: `${codexSessionExists ? '--resume\n' : ''}<role>
|
|
188
|
+
${implementerRole} // 主线预读 ~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/architect.md
|
|
189
|
+
</role>
|
|
190
|
+
|
|
191
|
+
<workdir>{{WORKDIR}}</workdir>
|
|
192
|
+
|
|
193
|
+
<task>
|
|
165
194
|
You are a full-stack execution agent. Implement the following plan end-to-end.
|
|
166
195
|
|
|
167
196
|
## Implementation Plan
|
|
@@ -180,48 +209,53 @@ Before coding, verify you have sufficient context:
|
|
|
180
209
|
Implement each step from the plan in order:
|
|
181
210
|
<将计划的实施步骤逐条列出>
|
|
182
211
|
|
|
183
|
-
Constraints:
|
|
184
|
-
- Follow existing code conventions in this project
|
|
185
|
-
- Handle edge cases and errors properly
|
|
186
|
-
- Keep changes minimal and focused on the plan
|
|
187
|
-
- Do NOT modify files outside the plan's scope
|
|
188
|
-
|
|
189
212
|
### Step 3: Self-Verification
|
|
190
213
|
After implementation:
|
|
191
214
|
- Run lint/typecheck if available
|
|
192
|
-
- Run existing tests:
|
|
215
|
+
- Run existing tests: <从计划中提取测试命令>
|
|
193
216
|
- Verify no regressions in touched modules
|
|
217
|
+
</task>
|
|
218
|
+
|
|
219
|
+
<action_safety>
|
|
220
|
+
- Follow existing code conventions in this project
|
|
221
|
+
- Handle edge cases and errors properly
|
|
222
|
+
- Keep changes minimal and focused on the plan
|
|
223
|
+
- Do NOT modify files outside the plan's scope
|
|
224
|
+
</action_safety>
|
|
194
225
|
|
|
195
|
-
|
|
196
|
-
Respond with
|
|
226
|
+
<structured_output_contract>
|
|
227
|
+
Respond with this structured report:
|
|
197
228
|
|
|
198
229
|
### CONTEXT_GATHERED
|
|
199
230
|
<What information was searched/found, key findings from MCP tools>
|
|
200
231
|
|
|
201
232
|
### CHANGES_MADE
|
|
202
|
-
For each file changed:
|
|
203
|
-
- File path
|
|
204
|
-
- What was changed and why
|
|
205
|
-
- Lines added/removed
|
|
233
|
+
For each file changed: file path / what changed / why / lines added-removed
|
|
206
234
|
|
|
207
235
|
### VERIFICATION_RESULTS
|
|
208
236
|
- Lint/typecheck: pass/fail
|
|
209
237
|
- Tests: pass/fail (details if fail)
|
|
210
|
-
- Manual checks performed
|
|
211
238
|
|
|
212
239
|
### REMAINING_ISSUES
|
|
213
|
-
<Any unresolved issues
|
|
214
|
-
</
|
|
215
|
-
|
|
240
|
+
<Any unresolved issues>
|
|
241
|
+
</structured_output_contract>`
|
|
242
|
+
})
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**📌 同 Claude session 内后续 Phase 2.5(修正)会自动通过 `--resume` 接到 codex 的 last thread**(plugin 路径无显式 SESSION_ID)。
|
|
246
|
+
|
|
247
|
+
**通道 B — wrapper BC fallback**:
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
Bash({
|
|
251
|
+
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--progress --backend {{BACKEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}resume <CODEX_SESSION> - \"{{WORKDIR}}\" <<'EXEC_EOF'\n<TASK>\nYou are a full-stack execution agent. Implement the following plan end-to-end.\n\n## Implementation Plan\n<完整计划>\n\n## Output Format\n<同上结构化报告>\n</TASK>\nEXEC_EOF",
|
|
216
252
|
run_in_background: true,
|
|
217
253
|
timeout: 3600000,
|
|
218
|
-
description: "Codex 全权执行:<计划标题>"
|
|
254
|
+
description: "Codex 全权执行:<计划标题> (BC)"
|
|
219
255
|
})
|
|
220
256
|
```
|
|
221
257
|
|
|
222
|
-
**📌 记录 SESSION_ID**(`CODEX_EXEC_SESSION
|
|
223
|
-
|
|
224
|
-
如果计划中无 `CODEX_SESSION`(用户跳过了 `/ccg:plan` 的多模型分析),则使用新会话。
|
|
258
|
+
**📌 记录 SESSION_ID**(`CODEX_EXEC_SESSION`)供 Phase 2.5 显式 resume。
|
|
225
259
|
|
|
226
260
|
事件驱动等待:spawn 完后主线 turn end,等 task-notification 自动唤醒。
|
|
227
261
|
|
|
@@ -256,12 +290,17 @@ EXEC_EOF",
|
|
|
256
290
|
|
|
257
291
|
`[模式:追加]`
|
|
258
292
|
|
|
259
|
-
**复用 Codex
|
|
293
|
+
**复用 Codex 会话,下发修正指令**。按顶部「调用通道路由」选 A 或 B:
|
|
294
|
+
|
|
295
|
+
**通道 A — plugin spawn(默认,--resume)**:
|
|
260
296
|
|
|
261
297
|
```
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
298
|
+
Agent({
|
|
299
|
+
subagent_type: "codex:codex-rescue",
|
|
300
|
+
description: "Codex 修正:<问题简述>",
|
|
301
|
+
prompt: `--resume
|
|
302
|
+
|
|
303
|
+
<task>
|
|
265
304
|
The implementation needs corrections:
|
|
266
305
|
|
|
267
306
|
## Issues Found
|
|
@@ -272,12 +311,19 @@ The implementation needs corrections:
|
|
|
272
311
|
1. <具体修正要求>
|
|
273
312
|
2. <具体修正要求>
|
|
274
313
|
|
|
275
|
-
Apply fixes and re-run tests. Report results in the same format.
|
|
276
|
-
</
|
|
277
|
-
|
|
314
|
+
Apply fixes and re-run tests. Report results in the same format as Phase 1.
|
|
315
|
+
</task>`
|
|
316
|
+
})
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
**通道 B — wrapper BC fallback**:
|
|
320
|
+
|
|
321
|
+
```
|
|
322
|
+
Bash({
|
|
323
|
+
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--progress --backend {{BACKEND_PRIMARY}} {{GEMINI_MODEL_FLAG}}resume <CODEX_EXEC_SESSION> - \"{{WORKDIR}}\" <<'FIXEOF'\n<TASK>\nThe implementation needs corrections:\n\n## Issues Found\n1. ...\n\n## Required Fixes\n1. ...\n\nApply fixes and re-run tests. Report results in the same format.\n</TASK>\nFIXEOF",
|
|
278
324
|
run_in_background: true,
|
|
279
325
|
timeout: 3600000,
|
|
280
|
-
description: "Codex 修正:<问题简述>"
|
|
326
|
+
description: "Codex 修正:<问题简述> (BC)"
|
|
281
327
|
})
|
|
282
328
|
```
|
|
283
329
|
|
|
@@ -47,11 +47,10 @@ argument-hint: "<topic> [--max-rounds N] [--layer backend|frontend|fullstack]"
|
|
|
47
47
|
|
|
48
48
|
1. 读 `$ARGUMENTS`,第一个非 flag token 即 topic(用引号包裹整段任务描述)
|
|
49
49
|
2. 解析 `--max-rounds N` / `--layer X`
|
|
50
|
-
3. **检测 plugin
|
|
51
|
-
- 用 `Bash` 跑 `
|
|
52
|
-
-
|
|
50
|
+
3. **检测 plugin 可用性(解析 installed_plugins.json,禁止运行时探活)**:
|
|
51
|
+
- 用 `Bash` 跑 `node ~/.claude/.ccg/scripts/check-plugins.cjs`(解析 Claude Code 权威 `~/.claude/plugins/installed_plugins.json` 注册表)
|
|
52
|
+
- 返回 JSON `{"codex":"<ver>"|null,"gemini":"<ver>"|null}` + exit code(`0` = 两 plugin 都在;非 `0` = 至少一个缺)→ 各自标 `installed: true/false`
|
|
53
53
|
- ⛔ **严禁**调用 `/gemini:status` / `/codex:status` / 任何 broker / runtime / health 探活——broker 是**懒启动**的,启动后才有;当前 `brokerRunning: false` 不代表 plugin 不可用
|
|
54
|
-
- 等价 helper:`detectPluginAvailability()`(`src/utils/plugin-detection.ts:156`)
|
|
55
54
|
- 任一 plugin 真未装 → 该模型走 general-purpose 降级路径
|
|
56
55
|
4. 调用 helper:`debateStateMachine(topic, { maxRounds, layer, pluginsAvailable })` 得到 `DebateRoundPlan[]`
|
|
57
56
|
|
|
@@ -27,9 +27,7 @@ CCG 把 6 核心命令的"双模型并行"通道从 `Bash(codeagent-wrapper)` **
|
|
|
27
27
|
1. **优先 plugin spawn 路径**(默认):用户已装 `codex@openai-codex` 和 gemini plugin(推荐 `gemini@gemini-ccgx` fork,已含全部 patch;或上游 `gemini@google-gemini` 配 repatch)→ 用 `Agent(subagent_type="codex:codex-rescue")` + `Agent(subagent_type="gemini:gemini-rescue")` 并行 spawn,主线只接 plugin 自家 ≤200 token 摘要。
|
|
28
28
|
2. **降级 codeagent-wrapper 路径**(BC fallback):plugin 未装 → fallback 到 `Bash(~/.claude/bin/codeagent-wrapper ...)`,行为与 plugin 路径等价。
|
|
29
29
|
|
|
30
|
-
**判断方法**:preflight
|
|
31
|
-
|
|
32
|
-
**单一真相源**:`src/utils/plugin-detection.ts`(导出 `detectPlugin` / `detectPluginAvailability` / `bothPluginsInstalled`)。
|
|
30
|
+
**判断方法**:preflight `Bash` 跑 `node ~/.claude/.ccg/scripts/check-plugins.cjs`(解析 Claude Code 权威 `installed_plugins.json`)。返回 JSON `{"codex":"<ver>"|null,"gemini":"<ver>"|null}`,两个 plugin 独立判定,可 mix-and-match(仅 codex 装了 → backend 走 plugin、frontend 走 codeagent)。exit `0` = 两 plugin 都在;非 `0` = 至少一个缺。
|
|
33
31
|
|
|
34
32
|
⚠️ Execute 命令在主线 context 内,**允许**调 `Agent(...)`——与 subagent "引擎层禁止嵌套 spawn" 约束不冲突。
|
|
35
33
|
|
|
@@ -47,7 +47,7 @@ CCG 把双模型并行通道从 `Bash(codeagent-wrapper)` **默认切换**为 pl
|
|
|
47
47
|
1. **优先 plugin spawn**(默认):装了 `codex@openai-codex` + gemini plugin(推荐 `gemini@gemini-ccgx` fork,含 P-1..P-21 + W1/W2/I1 patch;或上游 `gemini@google-gemini` 配 repatch 脚本)→ 用 `Agent(subagent_type="codex:codex-rescue")` + `Agent(subagent_type="gemini:gemini-rescue")` 并行,主线接 ≤200 token 摘要。
|
|
48
48
|
2. **降级 codeagent-wrapper**(BC fallback):plugin 未装 → fallback 到 Bash 调用,行为与 plugin 路径等价。
|
|
49
49
|
|
|
50
|
-
**判定**:preflight `Bash` 跑 `
|
|
50
|
+
**判定**:preflight `Bash` 跑 `node ~/.claude/.ccg/scripts/check-plugins.cjs`(解析 Claude Code 权威 `installed_plugins.json`)。exit `0` + stdout `{"codex":"<ver>","gemini":"<ver>"}` → 通道 A(plugin 默认);非 `0` → 通道 B(wrapper BC fallback)。
|
|
51
51
|
|
|
52
52
|
⚠️ Optimize 命令在主线 context 内,**允许** `Agent(...)`——与 subagent "禁止嵌套 spawn" 约束不冲突。
|
|
53
53
|
|
|
@@ -57,9 +57,7 @@ CCG 把 6 核心命令的"双模型并行"通道从 `Bash(codeagent-wrapper)` **
|
|
|
57
57
|
1. **优先 plugin spawn 路径**(默认):用户已装 `codex@openai-codex` 和 gemini plugin(推荐 `gemini@gemini-ccgx` fork,已含全部 patch;或上游 `gemini@google-gemini` 配 repatch)→ 用 `Agent(subagent_type="codex:codex-rescue")` + `Agent(subagent_type="gemini:gemini-rescue")` 并行 spawn,主线只接 plugin 自家 ≤200 token 摘要协议(`STATUS: ... / FINDINGS: ... / NOTES: ...`)。
|
|
58
58
|
2. **降级 codeagent-wrapper 路径**(BC fallback):plugin 未装 → fallback 到 `Bash(~/.claude/bin/codeagent-wrapper --backend ... resume ... <<'EOF' ... EOF)`,与 plugin 路径行为等价。
|
|
59
59
|
|
|
60
|
-
**判断方法**:preflight
|
|
61
|
-
|
|
62
|
-
**单一真相源**:plugin 检测逻辑 helper 见 `src/utils/plugin-detection.ts`(导出 `detectPlugin` / `detectPluginAvailability` / `bothPluginsInstalled`)。命令模板把判定结果渲染到执行计划,`Agent(...)` 调用与 `Bash(...)` 调用的具体语法见下面"多模型调用规范"段。
|
|
60
|
+
**判断方法**:preflight `Bash` 跑 `node ~/.claude/.ccg/scripts/check-plugins.cjs`(解析 Claude Code 权威 `installed_plugins.json`)。返回 JSON `{"codex":"<ver>"|null,"gemini":"<ver>"|null}`,两个 plugin 独立判定,可分别 mix-and-match(仅 codex plugin 装了 → backend 走 plugin、frontend 走 codeagent)。exit `0` = 两 plugin 都在;非 `0` = 至少一个缺。`Agent(...)` 调用与 `Bash(...)` 调用的具体语法见下面"多模型调用规范"段。
|
|
63
61
|
|
|
64
62
|
**为什么默认 plugin**:nested-spawn 测试证明 plugin advisor 摘要协议(≤200 token)压制了 codeagent stdout 全文回灌主线的痛点,主线 context 增量从 +5%/调用 降到 +1.5%/调用。详见 `.ccg-research/07-multimodel-collaboration-rethink.md`。
|
|
65
63
|
|
|
@@ -21,7 +21,7 @@ argument-hint: "[代码或描述] [--adversarial] [--fix [--all] [--auto]] [--ro
|
|
|
21
21
|
|
|
22
22
|
双模型并行审查,交叉验证综合反馈。无参数时自动审查当前 git 变更。
|
|
23
23
|
|
|
24
|
-
**双模型并行通道**:默认走 plugin spawn —— 装了 `codex@openai-codex` + gemini plugin(推荐 `gemini@gemini-ccgx` fork,含 P-1..P-21 + W1/W2/I1 patch;或上游 `gemini@google-gemini` 配 repatch 脚本)→ 用 `Agent(subagent_type="codex:codex-rescue")` + `Agent(subagent_type="gemini:gemini-rescue")` 并行,主线只接 ≤200 token 摘要;plugin 未装 → fallback 到 codeagent-wrapper 路径(BC fallback)。preflight
|
|
24
|
+
**双模型并行通道**:默认走 plugin spawn —— 装了 `codex@openai-codex` + gemini plugin(推荐 `gemini@gemini-ccgx` fork,含 P-1..P-21 + W1/W2/I1 patch;或上游 `gemini@google-gemini` 配 repatch 脚本)→ 用 `Agent(subagent_type="codex:codex-rescue")` + `Agent(subagent_type="gemini:gemini-rescue")` 并行,主线只接 ≤200 token 摘要;plugin 未装 → fallback 到 codeagent-wrapper 路径(BC fallback)。preflight `Bash` 跑 `node ~/.claude/.ccg/scripts/check-plugins.cjs`(解析 Claude Code 权威 `installed_plugins.json`,exit `0` + stdout `{"codex":"<ver>","gemini":"<ver>"}` = 两 plugin 都在)。
|
|
25
25
|
|
|
26
26
|
`--adversarial` 模式下额外触发第三层"敌对视角"审查,由官方 codex plugin 的 `Agent(codex:codex-rescue)` 在 fresh context 中专门挑前两轮意见的漏洞,适合极重要 PR / 安全敏感变更。需用户已装 `codex@openai-codex` plugin,否则降级为双模型审查。
|
|
27
27
|
|
|
@@ -45,17 +45,58 @@ description: '按规范执行 + 多模型协作 + 归档'
|
|
|
45
45
|
|
|
46
46
|
**工作目录**:`{{WORKDIR}}` **必须通过 Bash 执行 `pwd`(Unix)或 `cd`(Windows CMD)获取当前工作目录的绝对路径**,禁止从 `$HOME` 或环境变量推断。如果用户通过 `/add-dir` 添加了多个工作区,先确定任务相关的工作区。
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
**调用通道路由(CCG codeagent 退役,v2.2.0+)**
|
|
49
|
+
|
|
50
|
+
1. **优先 plugin spawn**(默认):plugin 已装 → `Agent(subagent_type="<codex:codex-rescue|gemini:gemini-rescue>")`,主线接 ≤200 token 摘要。
|
|
51
|
+
2. **降级 codeagent-wrapper**(BC fallback):plugin 未装 → Bash 调用,保留 SESSION_ID 供 Step 7 review 复用。
|
|
52
|
+
|
|
53
|
+
**预备动作**:主线先 Read 角色提示词(这里用 `architect.md` 或对应实施角色),把内容拼入 `<role>` 块。
|
|
54
|
+
|
|
55
|
+
**通道 A — plugin spawn(默认,每 task 独立 fresh-context)**:
|
|
56
|
+
|
|
49
57
|
```
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
Agent({
|
|
59
|
+
subagent_type: "<codex:codex-rescue|gemini:gemini-rescue>",
|
|
60
|
+
description: "spec-impl: <task name>",
|
|
61
|
+
prompt: `<role>
|
|
62
|
+
${implementerRole}
|
|
63
|
+
</role>
|
|
64
|
+
|
|
65
|
+
<workdir>{{WORKDIR}}</workdir>
|
|
66
|
+
|
|
67
|
+
<task>
|
|
68
|
+
TASK: <task description from tasks.md>
|
|
69
|
+
CONTEXT: <relevant code context>
|
|
70
|
+
CONSTRAINTS: <constraints from spec>
|
|
71
|
+
</task>
|
|
72
|
+
|
|
73
|
+
<action_safety>
|
|
74
|
+
- Stay strictly within tasks.md scope
|
|
75
|
+
- Do NOT introduce dependencies not in the plan
|
|
76
|
+
- Prefer minimal targeted changes
|
|
77
|
+
</action_safety>
|
|
78
|
+
|
|
79
|
+
<structured_output_contract>
|
|
80
|
+
Return Unified Diff Patch format ONLY (no preamble, no commentary).
|
|
81
|
+
The diff will be reviewed before apply; do not assume it's been applied.
|
|
82
|
+
</structured_output_contract>`
|
|
83
|
+
})
|
|
56
84
|
```
|
|
57
85
|
|
|
58
|
-
|
|
86
|
+
**通道 B — codeagent-wrapper fallback**(plugin 未装时;保留 SESSION_ID 供 Step 7 复用):
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
Bash({
|
|
90
|
+
command: "~/.claude/bin/codeagent-wrapper --progress --backend <{{BACKEND_PRIMARY}}|{{FRONTEND_PRIMARY}}> {{GEMINI_MODEL_FLAG}}- \"{{WORKDIR}}\" <<'EOF'\nTASK: <task description from tasks.md>\nCONTEXT: <relevant code context>\nCONSTRAINTS: <constraints from spec>\nOUTPUT: Unified Diff Patch format ONLY\nEOF",
|
|
91
|
+
run_in_background: true,
|
|
92
|
+
timeout: 3600000,
|
|
93
|
+
description: "spec-impl: <task name> (BC)"
|
|
94
|
+
})
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**会话模型差异**:
|
|
98
|
+
- **通道 A(plugin)**:每个 task 独立 fresh-context spawn,**无显式 SESSION_ID**。Step 7 review 时由主线把 Step 4-6 的变更摘要(diff + spec 引用)显式拼入 reviewer prompt。
|
|
99
|
+
- **通道 B(wrapper BC)**:保存返回的 `SESSION_ID:`({{BACKEND_PRIMARY}} → `CODEX_PROTO_SESSION`,{{FRONTEND_PRIMARY}} → `GEMINI_PROTO_SESSION`),Step 7 审查 `resume <SESSION_ID>` 复用上下文。
|
|
59
100
|
|
|
60
101
|
5. **Rewrite Prototype to Production Code**
|
|
61
102
|
Upon receiving diff patch, **NEVER apply directly**. Rewrite by:
|
|
@@ -83,7 +124,7 @@ description: '按规范执行 + 多模型协作 + 归档'
|
|
|
83
124
|
1. **优先 plugin spawn**(默认):装了 `codex@openai-codex` + gemini plugin(推荐 `gemini@gemini-ccgx` fork;或上游 `gemini@google-gemini` 配 repatch 脚本)→ 用 `Agent(subagent_type="codex:codex-rescue")` + `Agent(subagent_type="gemini:gemini-rescue")` 并行,主线接 ≤200 token 摘要。
|
|
84
125
|
2. **降级 codeagent-wrapper**(BC fallback):plugin 未装 → fallback Bash 调用,**保留 Step 4 session resume** 以维持会话上下文。
|
|
85
126
|
|
|
86
|
-
**判定**:preflight `Bash` 跑 `
|
|
127
|
+
**判定**:preflight `Bash` 跑 `node ~/.claude/.ccg/scripts/check-plugins.cjs`(解析 Claude Code 权威 `installed_plugins.json`)。exit `0` + stdout `{"codex":"<ver>","gemini":"<ver>"}` → 通道 A(plugin 默认);非 `0` → 通道 B(wrapper BC fallback)。
|
|
87
128
|
|
|
88
129
|
⚠️ spec-impl 命令在主线 context 内,**允许** `Agent(...)`——与 subagent "禁止嵌套 spawn" 约束不冲突。
|
|
89
130
|
⚠️ **plugin 路径无 session resume 能力**:通道 A 不接 Step 4 的 SESSION_ID,review 任务作为独立无状态分析跑(review 是 read-only 审查,无需会话连续性)。
|
|
@@ -93,6 +134,13 @@ description: '按规范执行 + 多模型协作 + 归档'
|
|
|
93
134
|
|
|
94
135
|
**Step 7.1**: In ONE message, spawn TWO models in parallel.
|
|
95
136
|
|
|
137
|
+
**⚠ 预备动作(spawn 前必须执行)**:`codex:codex-rescue` / `gemini:gemini-rescue` 是 thin forwarder,不会主动 Read 路径文件。主线必须在 spawn 前先 Read 两个角色提示词文件,把**内容**直接拼入下方 Agent prompt 的 `<role>` 块。
|
|
138
|
+
|
|
139
|
+
- backend role: `Read("~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/reviewer.md")` → `${backendRole}`
|
|
140
|
+
- frontend role: `Read("~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/reviewer.md")` → `${frontendRole}`
|
|
141
|
+
|
|
142
|
+
Prompt 结构按 `gpt-5-4-prompting` skill 推荐:`<role>` + `<task>` + `<grounding_rules>` + `<dig_deeper_nudge>` + `<structured_output_contract>`。
|
|
143
|
+
|
|
96
144
|
**通道 A — plugin spawn(默认,无 session)**:
|
|
97
145
|
|
|
98
146
|
**FIRST Agent call ({{BACKEND_PRIMARY}})**:
|
|
@@ -100,21 +148,43 @@ description: '按规范执行 + 多模型协作 + 归档'
|
|
|
100
148
|
Agent({
|
|
101
149
|
subagent_type: "codex:codex-rescue",
|
|
102
150
|
description: "spec-impl: correctness/security review",
|
|
103
|
-
prompt:
|
|
151
|
+
prompt: `<role>
|
|
152
|
+
${backendRole}
|
|
153
|
+
</role>
|
|
104
154
|
|
|
105
|
-
|
|
155
|
+
<workdir>{{WORKDIR}}</workdir>
|
|
106
156
|
|
|
107
|
-
<
|
|
108
|
-
Review the implementation changes:
|
|
157
|
+
<task>
|
|
158
|
+
Review the implementation changes along backend dimensions:
|
|
109
159
|
- Correctness: logic errors, edge cases
|
|
110
160
|
- Security: injection, auth issues
|
|
111
161
|
- Spec compliance: constraints satisfied
|
|
112
162
|
|
|
113
163
|
变更摘要:<列出 Step 5/6 涉及的文件 + 关键 diff>
|
|
114
|
-
</TASK>
|
|
115
164
|
|
|
116
|
-
|
|
117
|
-
|
|
165
|
+
Read-only review. Do NOT modify any file.
|
|
166
|
+
</task>
|
|
167
|
+
|
|
168
|
+
<grounding_rules>
|
|
169
|
+
- Every finding must cite file:line in the listed diff
|
|
170
|
+
- If a constraint was satisfied, list it in passed_checks
|
|
171
|
+
- "I couldn't verify X" is acceptable; fabricating X is not
|
|
172
|
+
</grounding_rules>
|
|
173
|
+
|
|
174
|
+
<dig_deeper_nudge>
|
|
175
|
+
- For each Critical finding, check whether the same root cause appears elsewhere in the diff
|
|
176
|
+
- Prefer one well-cited Critical over five vague Warnings
|
|
177
|
+
</dig_deeper_nudge>
|
|
178
|
+
|
|
179
|
+
<structured_output_contract>
|
|
180
|
+
Return JSON ONLY (no preamble):
|
|
181
|
+
{
|
|
182
|
+
"findings": [{"severity": "Critical|Warning|Info", "dimension": "logic|security|spec_compliance", "file": "path", "line": N, "description": "...", "fix_suggestion": "..."}],
|
|
183
|
+
"passed_checks": ["..."],
|
|
184
|
+
"summary": "Overall assessment"
|
|
185
|
+
}
|
|
186
|
+
Return ≤200 token structured summary.
|
|
187
|
+
</structured_output_contract>`
|
|
118
188
|
})
|
|
119
189
|
```
|
|
120
190
|
|
|
@@ -123,21 +193,42 @@ Return ≤200 token structured summary (plugin-native protocol).`
|
|
|
123
193
|
Agent({
|
|
124
194
|
subagent_type: "gemini:gemini-rescue",
|
|
125
195
|
description: "spec-impl: maintainability/patterns review",
|
|
126
|
-
prompt:
|
|
196
|
+
prompt: `<role>
|
|
197
|
+
${frontendRole}
|
|
198
|
+
</role>
|
|
127
199
|
|
|
128
|
-
|
|
200
|
+
<workdir>{{WORKDIR}}</workdir>
|
|
129
201
|
|
|
130
|
-
<
|
|
131
|
-
Review the implementation changes:
|
|
202
|
+
<task>
|
|
203
|
+
Review the implementation changes along maintainability/integration dimensions:
|
|
132
204
|
- Maintainability: readability, complexity
|
|
133
205
|
- Patterns: consistency with project style
|
|
134
206
|
- Integration: cross-module impacts
|
|
135
207
|
|
|
136
208
|
变更摘要:<列出 Step 5/6 涉及的文件 + 关键 diff>
|
|
137
|
-
</TASK>
|
|
138
209
|
|
|
139
|
-
|
|
140
|
-
|
|
210
|
+
Read-only review. Do NOT modify any file.
|
|
211
|
+
</task>
|
|
212
|
+
|
|
213
|
+
<grounding_rules>
|
|
214
|
+
- Every finding must cite file:line in the listed diff
|
|
215
|
+
- If an aspect was clean, list it in passed_checks
|
|
216
|
+
</grounding_rules>
|
|
217
|
+
|
|
218
|
+
<dig_deeper_nudge>
|
|
219
|
+
- Check if the same pattern issue appears in adjacent files
|
|
220
|
+
- Prefer one well-cited Critical over five vague Warnings
|
|
221
|
+
</dig_deeper_nudge>
|
|
222
|
+
|
|
223
|
+
<structured_output_contract>
|
|
224
|
+
Return JSON ONLY (no preamble):
|
|
225
|
+
{
|
|
226
|
+
"findings": [{"severity": "Critical|Warning|Info", "dimension": "maintainability|patterns|integration", "file": "path", "line": N, "description": "...", "fix_suggestion": "..."}],
|
|
227
|
+
"passed_checks": ["..."],
|
|
228
|
+
"summary": "Overall assessment"
|
|
229
|
+
}
|
|
230
|
+
Return ≤200 token structured summary.
|
|
231
|
+
</structured_output_contract>`
|
|
141
232
|
})
|
|
142
233
|
```
|
|
143
234
|
|