ccgx-workflow 1.0.5 → 1.0.6
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
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.BrRMgXjP.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 } from './shared/ccgx-workflow.
|
|
2
|
-
export { j as changeLanguage, F as checkForUpdates, H as collectInvocableSkills, G as compareVersions, l as createDefaultConfig, m as createDefaultRouting, I as generateCommandContent, n as getCcgDir, o as getConfigPath, D as getCurrentVersion, E as getLatestVersion, q as getWorkflowById, p as getWorkflowConfigs, c as i18n, e as init, b as initI18n, x as installAceTool, y as installAceToolRs, J as installSkillCommands, t as installWorkflows, B as migrateToV1_4_0, C as needsMigration, K as parseFrontmatter, a as readCcgConfig, s as showMainMenu, A as uninstallAceTool, z as uninstallWorkflows, u as update, k as writeCcgConfig } from './shared/ccgx-workflow.
|
|
1
|
+
import { h as collectSkills } from './shared/ccgx-workflow.BrRMgXjP.mjs';
|
|
2
|
+
export { j as changeLanguage, F as checkForUpdates, H as collectInvocableSkills, G as compareVersions, l as createDefaultConfig, m as createDefaultRouting, I as generateCommandContent, n as getCcgDir, o as getConfigPath, D as getCurrentVersion, E as getLatestVersion, q as getWorkflowById, p as getWorkflowConfigs, c as i18n, e as init, b as initI18n, x as installAceTool, y as installAceToolRs, J as installSkillCommands, t as installWorkflows, B as migrateToV1_4_0, C as needsMigration, K as parseFrontmatter, a as readCcgConfig, s as showMainMenu, A as uninstallAceTool, z as uninstallWorkflows, u as update, k as writeCcgConfig } from './shared/ccgx-workflow.BrRMgXjP.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 = "1.0.
|
|
16
|
+
const version = "1.0.6";
|
|
17
17
|
|
|
18
18
|
function cmd(id, order, category, name, nameEn, description, descriptionEn, cmdOverride) {
|
|
19
19
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccgx-workflow",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
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",
|
|
@@ -124,7 +124,34 @@ phase_files: [<本 phase 修改/新增的相对路径>]
|
|
|
124
124
|
[{severity: critical, category: inline-plugin-bash, message: "review.md line N: inline plugin companion 命令拼接 — 应改用 {{CODEX_BASH_TASK}} install-time codegen 占位符"}]
|
|
125
125
|
```
|
|
126
126
|
|
|
127
|
-
### 6.
|
|
127
|
+
### 6. 主线塞 diff/源代码 给 plugin(critical,1.0.6 新增)
|
|
128
|
+
|
|
129
|
+
**目的**:检测模板里有没有把 `git diff` 输出 / 源文件内容 inline 进 prompt body——这会撞 OS argv ~32KB 上限(Windows `CreateProcess` / POSIX `execve`),导致大 PR 直接 spawn 失败。
|
|
130
|
+
|
|
131
|
+
**为什么这是 critical**:
|
|
132
|
+
|
|
133
|
+
- ARG_MAX 是 OS 级 hard ceiling,不是 99% 边缘 case
|
|
134
|
+
- codex / gemini 的 task mode 都有完整 Bash + Read 工具权限,可以**自己**跑 `git diff` 读源文件
|
|
135
|
+
- 主线给它们任务描述(≤ 2KB)就够了,不需要把数据塞进 prompt
|
|
136
|
+
- 历史教训:1.0.4/1.0.5 dogfood 撞这个 bug,30KB diff 导致 review 命令完全瘫痪
|
|
137
|
+
|
|
138
|
+
**怎么做**:
|
|
139
|
+
1. 本 phase commit 影响的 `.md` 文件中 grep:
|
|
140
|
+
- `<git diff (?:内容|输出|HEAD)>` — 占位符指代 diff 内容
|
|
141
|
+
- `\$\(git diff` — shell 替换 git diff 输出
|
|
142
|
+
- `cat .*\.diff\.patch` — 读 diff patch 文件
|
|
143
|
+
- 任何"在 prompt body 里嵌入 diff/源码"的模式
|
|
144
|
+
2. 命中即 critical,除非位置是:
|
|
145
|
+
- CHANGELOG / migration doc 反例对照段
|
|
146
|
+
- `agents/interface-auditor.md` 自身(本 rule 说明)
|
|
147
|
+
- 测试 fixture
|
|
148
|
+
|
|
149
|
+
**critical 例子**:
|
|
150
|
+
```
|
|
151
|
+
[{severity: critical, category: inline-diff-prompt, message: "review.md line N: prompt body 含 <git diff 内容>——撞 ARG_MAX,应改为任务描述 + codex 自己跑 git diff"}]
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### 7. Mock 与 ground truth schema 偏差(info/major)
|
|
128
155
|
|
|
129
156
|
**目的**:测试 mock 数据跟真实 schema 不一致(与 P28 fixtures 协作;本 agent 仅做轻量提示)。
|
|
130
157
|
|
|
@@ -148,8 +175,8 @@ phase_files: [<本 phase 修改/新增的相对路径>]
|
|
|
148
175
|
2. `git show <commit_hash> --name-only` → phase_files 验证;若 prompt 给的列表跟 git 不一致以 git 为准
|
|
149
176
|
3. 过滤掉非 `.ts` / `.md` / `package.json` 的文件(图片、bin 等不审)
|
|
150
177
|
|
|
151
|
-
### Step 2:
|
|
152
|
-
对每个 phase 修改文件分别跑
|
|
178
|
+
### Step 2: 七项检查并行思考
|
|
179
|
+
对每个 phase 修改文件分别跑 7 项检查的 grep。每条命中产出一个 Finding 候选。
|
|
153
180
|
|
|
154
181
|
### Step 3: 假阳性过滤
|
|
155
182
|
- SSoT 违反:排除测试文件、type union 同名、re-export
|
|
@@ -157,6 +184,7 @@ phase_files: [<本 phase 修改/新增的相对路径>]
|
|
|
157
184
|
- magic string:排除 CCG 自家 agent 名(白名单)
|
|
158
185
|
- commit drift:用模糊匹配,命中率不高时降级 info
|
|
159
186
|
- inline-plugin-bash:排除 CHANGELOG/migration 反例段、interface-auditor.md 自身说明、测试 fixture
|
|
187
|
+
- inline-diff-prompt:同上排除规则
|
|
160
188
|
- mock drift:纯 best-effort,全部标 info severity
|
|
161
189
|
|
|
162
190
|
### Step 4: 输出 ≤200 token 摘要
|
|
@@ -165,7 +193,7 @@ phase_files: [<本 phase 修改/新增的相对路径>]
|
|
|
165
193
|
|
|
166
194
|
```
|
|
167
195
|
STATUS: complete | error
|
|
168
|
-
FINDINGS: [{severity: critical|major|info, category: ssot-violation|leftover|magic-string-mismatch|commit-diff-drift|inline-plugin-bash|mock-drift, message: "<具体证据 + 文件路径 + 行号>"}, ...]
|
|
196
|
+
FINDINGS: [{severity: critical|major|info, category: ssot-violation|leftover|magic-string-mismatch|commit-diff-drift|inline-plugin-bash|inline-diff-prompt|mock-drift, message: "<具体证据 + 文件路径 + 行号>"}, ...]
|
|
169
197
|
NOTES: <≤80 字一行总结>
|
|
170
198
|
```
|
|
171
199
|
|
|
@@ -58,12 +58,18 @@ argument-hint: "[代码或描述] [--adversarial] [--fix [--all] [--auto]] [--ro
|
|
|
58
58
|
> 写入 tmpfile、追加 `--prompt-file <tmpfile>`、运行**。helper 内部处理路径解析、
|
|
59
59
|
> spawn array args、shell escape 全部规避——LLM 不参与任何命令构造。
|
|
60
60
|
|
|
61
|
+
**核心原则(1.0.6 起)**:**主线不传输 diff 内容给 codex/gemini**。把 diff 作为 prompt body 内嵌会撞 OS argv ~32KB 上限(Windows `CreateProcess` / POSIX `execve`);30KB+ diff 直接 spawn 失败。**正确做法是给 codex/gemini 一个小任务描述**,让它们用自己的 Bash + Read 工具**自己跑 `git diff` 读源文件**——它们在 task mode 下有完整工具权限。
|
|
62
|
+
|
|
61
63
|
**LLM 工作流(严格 3 步)**:
|
|
62
64
|
|
|
63
65
|
```
|
|
64
|
-
Step 1. 用 Write
|
|
65
|
-
|
|
66
|
-
Write({
|
|
66
|
+
Step 1. 用 Write 工具把【小任务描述】写到 tmpfile
|
|
67
|
+
⚠️ 内容必须是任务说明(≤ 2KB),不要塞 git diff / 文件内容
|
|
68
|
+
Write({
|
|
69
|
+
file_path: "/tmp/ccg-review-codex-$JOB.txt",
|
|
70
|
+
content: <下方"任务描述模板">
|
|
71
|
+
})
|
|
72
|
+
Write({ 同上,gemini 版本 })
|
|
67
73
|
|
|
68
74
|
Step 2. 用 Bash 调 helper(占位符已渲染):
|
|
69
75
|
Bash({
|
|
@@ -79,15 +85,46 @@ Step 2. 用 Bash 调 helper(占位符已渲染):
|
|
|
79
85
|
timeout: 3600000
|
|
80
86
|
})
|
|
81
87
|
|
|
82
|
-
Step 3. 等 task-notification 通知后 Read 各自 stdout
|
|
83
|
-
`result.stdout`
|
|
88
|
+
Step 3. 等 task-notification 通知后 Read 各自 stdout(helper 输出 JSON),
|
|
89
|
+
parse `result.stdout` 拿 plugin 真实输出。
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**任务描述模板**(写到 tmpfile 的内容;保持 ≤ 2KB):
|
|
93
|
+
|
|
84
94
|
```
|
|
95
|
+
# 任务:代码审查
|
|
96
|
+
|
|
97
|
+
工作目录:<工作目录绝对路径>(你已经在这里,可直接用 Bash/Read)
|
|
98
|
+
角色:参考 <角色提示词文件路径>(主线写入:codex 用 ~/.claude/.ccg/prompts/codex/reviewer.md,gemini 用 gemini/reviewer.md)
|
|
99
|
+
|
|
100
|
+
## 你要做的事(用你自己的工具)
|
|
101
|
+
|
|
102
|
+
1. 跑 `git diff HEAD --stat` 看变更规模
|
|
103
|
+
2. 跑 `git diff HEAD` 看完整 diff 内容(如太大,逐文件 `git diff HEAD <file>`)
|
|
104
|
+
3. 涉及具体逻辑判断时 Read 相关源文件(看 import / 类型签名 / 调用上下文)
|
|
105
|
+
4. 按角色视角审查:
|
|
106
|
+
- codex (backend):算法 / 数据流 / 错误处理 / 安全 / 测试覆盖
|
|
107
|
+
- gemini (frontend):组件结构 / 视觉一致性 / 响应式 / 可访问性
|
|
108
|
+
5. **额外硬规则**(如有,主线在此追加,每条 ≤ 200 字)
|
|
109
|
+
|
|
110
|
+
## 输出 JSON 格式(严格)
|
|
111
|
+
|
|
112
|
+
{
|
|
113
|
+
"critical": [{file, line, issue, why, fix?}, ...],
|
|
114
|
+
"major": [...],
|
|
115
|
+
"minor": [...],
|
|
116
|
+
"suggestions": [...]
|
|
117
|
+
}
|
|
85
118
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
119
|
+
只输出 JSON,无其他文本。空类别输出 []。
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
⛔ **严禁**:
|
|
123
|
+
- 不要在 prompt 里塞 git diff 内容(撞 ARG_MAX)
|
|
124
|
+
- 不要塞文件源代码(同上)
|
|
125
|
+
- 不要写 `node "$(ls ...)/codex-companion.mjs"`、不要 heredoc、不要 `-p "..."` 内联
|
|
89
126
|
- 不要硬编码 plugin 路径——helper 内部解析 SSoT
|
|
90
|
-
- **唯一允许**:copy 占位符内容 + 追加 `--prompt-file <tmpfile
|
|
127
|
+
- **唯一允许**:copy 占位符内容 + 追加 `--prompt-file <tmpfile>`,tmpfile 只放任务描述
|
|
91
128
|
|
|
92
129
|
⛔ **不要**用 `Agent(subagent_type="codex:codex-rescue"|"gemini:gemini-rescue")`:
|
|
93
130
|
|
|
@@ -105,25 +142,22 @@ CLI 空答 / auth 过期时 wrapper 受 instruction-tuning 驱动**自答 fabric
|
|
|
105
142
|
|
|
106
143
|
并行**两个 Bash 在同一 message 内 `run_in_background: true` 同时 spawn**。
|
|
107
144
|
|
|
108
|
-
**通道 B — codeagent-wrapper fallback**(plugin
|
|
145
|
+
**通道 B — codeagent-wrapper fallback**(plugin 未装时降级;wrapper 走 stdin pipe,无 ARG_MAX 限制):
|
|
146
|
+
|
|
147
|
+
通道 B 同样**遵循"不塞 diff"原则**——给 wrapper 传任务描述,让 backend codex/gemini CLI 自己跑 git diff 读源文件。wrapper 经 stdin 传 prompt(无 32KB 限制),但 prompt 内容应当还是任务描述而非 diff dump。
|
|
109
148
|
|
|
110
149
|
```
|
|
111
150
|
Bash({
|
|
112
|
-
command: "~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--progress --backend
|
|
113
|
-
ROLE_FILE: <角色提示词路径>
|
|
114
|
-
<TASK>
|
|
115
|
-
审查以下代码变更:
|
|
116
|
-
<git diff 内容>
|
|
117
|
-
</TASK>
|
|
118
|
-
OUTPUT: 按 Critical/Major/Minor/Suggestion 分类列出问题
|
|
119
|
-
EOF",
|
|
151
|
+
command: "cat /tmp/ccg-review-codex-$JOB.txt | ~/.claude/bin/codeagent-wrapper {{LITE_MODE_FLAG}}--progress --backend codex - \"{{WORKDIR}}\"",
|
|
120
152
|
run_in_background: true,
|
|
121
153
|
timeout: 3600000,
|
|
122
|
-
description: "
|
|
154
|
+
description: "Review: backend (wrapper fallback)"
|
|
123
155
|
})
|
|
124
156
|
```
|
|
125
157
|
|
|
126
|
-
|
|
158
|
+
`/tmp/ccg-review-codex-$JOB.txt` 同 通道 A 的"任务描述模板"——不变。
|
|
159
|
+
|
|
160
|
+
> ⚠️ 通道 B `codeagent-wrapper` 已标 **deprecated**,仅 plugin 未装时使用。
|
|
127
161
|
|
|
128
162
|
**角色提示词**:
|
|
129
163
|
|
|
@@ -173,19 +207,15 @@ EOF",
|
|
|
173
207
|
|
|
174
208
|
**⚠️ 必须发起两个并行 Bash 调用**(参照上方调用规范):
|
|
175
209
|
|
|
176
|
-
1.
|
|
177
|
-
|
|
178
|
-
-
|
|
179
|
-
-
|
|
180
|
-
|
|
181
|
-
2. **{{FRONTEND_PRIMARY}} 前端审查**:`Bash({ command: "...--backend {{FRONTEND_PRIMARY}}...", run_in_background: true })`
|
|
182
|
-
- ROLE_FILE: `~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/reviewer.md`
|
|
183
|
-
- 需求:审查代码变更(git diff 内容)
|
|
184
|
-
- OUTPUT:按 Critical/Major/Minor/Suggestion 分类列出可访问性、响应式、设计一致性问题
|
|
210
|
+
1. 用 Write 把任务描述写到两个 tmpfile(**仅任务说明 + 角色提示词路径,不塞 diff**)
|
|
211
|
+
2. 用 `{{CODEX_BASH_TASK}}` + `{{GEMINI_BASH_TASK}}` 占位符并行 spawn:
|
|
212
|
+
- **{{BACKEND_PRIMARY}} 后端审查**:role 用 `~/.claude/.ccg/prompts/{{BACKEND_PRIMARY}}/reviewer.md`
|
|
213
|
+
- **{{FRONTEND_PRIMARY}} 前端审查**:role 用 `~/.claude/.ccg/prompts/{{FRONTEND_PRIMARY}}/reviewer.md`
|
|
214
|
+
3. 任务描述里要求 codex/gemini 自己跑 `git diff HEAD` 读 diff,按角色视角输出 JSON
|
|
185
215
|
|
|
186
216
|
**事件驱动等待**:spawn 完两个 Bash bg 后主线 turn end,等 task-notification 自动唤醒。两个 task 都收到通知后进阶段 3。
|
|
187
217
|
|
|
188
|
-
**务必遵循上方 `多模型调用规范` 的 `重要`
|
|
218
|
+
**务必遵循上方 `多模型调用规范` 的 `重要` 指示**——尤其是"不塞 diff"原则。
|
|
189
219
|
|
|
190
220
|
### 🛡 阶段 2.5:敌对审查(仅 `--adversarial`)
|
|
191
221
|
|
|
@@ -196,8 +226,8 @@ EOF",
|
|
|
196
226
|
调用方式(Bash 直调,绕开 sonnet wrapper):
|
|
197
227
|
|
|
198
228
|
```
|
|
199
|
-
Step 1. 用 Write
|
|
200
|
-
Write({ file_path: "/tmp/ccg-review-adv-$JOB.txt", content:
|
|
229
|
+
Step 1. 用 Write 把任务描述写入 tmpfile(同样不塞 diff,让 codex 自己读):
|
|
230
|
+
Write({ file_path: "/tmp/ccg-review-adv-$JOB.txt", content: <下方任务描述> })
|
|
201
231
|
|
|
202
232
|
Step 2. 调 helper:
|
|
203
233
|
Bash({
|
|
@@ -208,27 +238,39 @@ Step 2. 调 helper:
|
|
|
208
238
|
})
|
|
209
239
|
```
|
|
210
240
|
|
|
211
|
-
**Adversarial
|
|
241
|
+
**Adversarial 任务描述**(写入 tmpfile 的内容;只放摘要 + 指引,不塞 diff):
|
|
212
242
|
|
|
213
243
|
```
|
|
214
|
-
|
|
244
|
+
# 任务:敌对视角代码审查
|
|
215
245
|
|
|
216
|
-
|
|
246
|
+
工作目录:{{WORKDIR}}
|
|
217
247
|
|
|
218
|
-
|
|
248
|
+
## 你要做的事
|
|
219
249
|
|
|
220
|
-
|
|
250
|
+
1. 跑 `git diff HEAD` 看变更(你自己读,主线不传)
|
|
251
|
+
2. 涉及逻辑判断时 Read 相关源文件
|
|
252
|
+
3. 假设代码作者刻意误导,**只挑前两轮没发现 / 低估的**漏洞
|
|
221
253
|
|
|
222
|
-
|
|
254
|
+
## 前两轮审查意见摘要(避免重复结论)
|
|
223
255
|
|
|
224
|
-
|
|
256
|
+
后端审查 critical 项:
|
|
257
|
+
- <主线在此填写阶段 2 后端摘要 ≤ 500 字>
|
|
225
258
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
259
|
+
前端审查 critical 项:
|
|
260
|
+
- <主线在此填写阶段 2 前端摘要 ≤ 500 字>
|
|
261
|
+
|
|
262
|
+
## 输出 JSON 格式
|
|
263
|
+
|
|
264
|
+
{
|
|
265
|
+
"critical_adversarial": [{file, line, issue, why_missed_before}, ...],
|
|
266
|
+
"major_adversarial": [...]
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
每条必须标"为什么前两轮没发现"。只输出 JSON。
|
|
230
270
|
```
|
|
231
271
|
|
|
272
|
+
主线把前两轮摘要(critical 项 ≤ 500 字)注入 tmpfile,**不要塞完整 review 输出**——主线已经看完了,传摘要即可。
|
|
273
|
+
|
|
232
274
|
⛔ 不用 `Agent(subagent_type="codex:codex-rescue")`:review/verify 路径输出直接落地,silent fallback
|
|
233
275
|
风险(sonnet wrapper 受 instruction-tuning 自答冒充 adversarial 视角)不可接受。详见前文「通道 A」段。
|
|
234
276
|
|