ccg-workflow 1.7.47 → 1.7.49

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 CHANGED
@@ -16,7 +16,9 @@ Claude Code 编排 Codex + Gemini 的多模型协作开发系统。前端任务
16
16
  npx ccg-workflow
17
17
  ```
18
18
 
19
- **要求**:Claude Code CLI、Node.js 18+
19
+ **要求**:Claude Code CLI、Node.js 20+
20
+
21
+ > **重要**:本项目依赖 `ora@9.x` 和 `string-width@8.x`,这些包要求 Node.js >= 20。使用 Node.js 18 会导致 `SyntaxError: Invalid regular expression flags` 错误。请确保升级到 Node.js 20 或更高版本。
20
22
 
21
23
  **可选**:Codex CLI(后端)、Gemini CLI(前端)
22
24
 
@@ -41,6 +43,34 @@ npx ccg-workflow
41
43
  | `/ccg:worktree` | Worktree 管理 |
42
44
  | `/ccg:init` | 初始化 CLAUDE.md |
43
45
  | `/ccg:enhance` | Prompt 增强 |
46
+ | `/ccg:spec-init` | 初始化 OpenSpec 环境 |
47
+ | `/ccg:spec-research` | 需求 → 约束集 |
48
+ | `/ccg:spec-plan` | 约束 → 零决策计划 |
49
+ | `/ccg:spec-impl` | 按计划执行 + 归档 |
50
+ | `/ccg:spec-review` | 双模型交叉审查 |
51
+
52
+ ### OpenSpec 规范驱动(v1.7.48)
53
+
54
+ 集成 [OpenSpec](https://github.com/fission-ai/openspec),把需求变成约束,让 AI 没法自由发挥:
55
+
56
+ ```bash
57
+ # 初始化
58
+ /ccg:spec-init
59
+
60
+ # 研究需求 → 输出约束集
61
+ /ccg:spec-research 实现用户认证
62
+
63
+ # 并行分析 → 零决策计划
64
+ /ccg:spec-plan
65
+
66
+ # 按计划执行
67
+ /ccg:spec-impl
68
+
69
+ # 独立审查(随时可用)
70
+ /ccg:spec-review
71
+ ```
72
+
73
+ 每阶段之间可 `/clear`,状态存在 `openspec/` 目录,不怕上下文爆。
44
74
 
45
75
  ### 规划与执行分离
46
76
 
@@ -157,4 +187,4 @@ MIT
157
187
 
158
188
  ---
159
189
 
160
- v1.7.47 | [Issues](https://github.com/fengshao1227/ccg-workflow/issues)
190
+ v1.7.48 | [Issues](https://github.com/fengshao1227/ccg-workflow/issues)
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 { z as diagnoseMcpConfig, A as isWindows, B as readClaudeCodeConfig, C as fixWindowsMcpConfig, D as writeClaudeCodeConfig, r as readCcgConfig, b as initI18n, s as showMainMenu, i as init, E as configMcp, F as version, a as i18n } from './shared/ccg-workflow.DrIczHh4.mjs';
4
+ import { z as diagnoseMcpConfig, A as isWindows, B as readClaudeCodeConfig, C as fixWindowsMcpConfig, D as writeClaudeCodeConfig, r as readCcgConfig, b as initI18n, s as showMainMenu, i as init, E as configMcp, F as version, a as i18n } from './shared/ccg-workflow.zPy2yt7f.mjs';
5
5
  import 'inquirer';
6
6
  import 'node:child_process';
7
7
  import 'node:util';
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { c as changeLanguage, x as checkForUpdates, y as compareVersions, d as createDefaultConfig, e as createDefaultRouting, g as getCcgDir, f as getConfigPath, t as getCurrentVersion, v as getLatestVersion, j as getWorkflowById, h as getWorkflowConfigs, a as i18n, i as init, b as initI18n, l as installAceTool, m as installAceToolRs, k as installWorkflows, p as migrateToV1_4_0, q as needsMigration, r as readCcgConfig, s as showMainMenu, o as uninstallAceTool, n as uninstallWorkflows, u as update, w as writeCcgConfig } from './shared/ccg-workflow.DrIczHh4.mjs';
1
+ export { c as changeLanguage, x as checkForUpdates, y as compareVersions, d as createDefaultConfig, e as createDefaultRouting, g as getCcgDir, f as getConfigPath, t as getCurrentVersion, v as getLatestVersion, j as getWorkflowById, h as getWorkflowConfigs, a as i18n, i as init, b as initI18n, l as installAceTool, m as installAceToolRs, k as installWorkflows, p as migrateToV1_4_0, q as needsMigration, r as readCcgConfig, s as showMainMenu, o as uninstallAceTool, n as uninstallWorkflows, u as update, w as writeCcgConfig } from './shared/ccg-workflow.zPy2yt7f.mjs';
2
2
  import 'ansis';
3
3
  import 'inquirer';
4
4
  import 'node:child_process';
@@ -10,7 +10,7 @@ import i18next from 'i18next';
10
10
  import ora from 'ora';
11
11
  import { parse, stringify } from 'smol-toml';
12
12
 
13
- const version = "1.7.47";
13
+ const version = "1.7.49";
14
14
 
15
15
  function isWindows() {
16
16
  return process.platform === "win32";
@@ -356,6 +356,61 @@ const WORKFLOW_CONFIGS = [
356
356
  order: 23,
357
357
  description: "\u7BA1\u7406 Git worktree",
358
358
  descriptionEn: "Manage Git worktree"
359
+ },
360
+ {
361
+ id: "spec-init",
362
+ name: "OpenSpec \u521D\u59CB\u5316",
363
+ nameEn: "OpenSpec Init",
364
+ category: "spec",
365
+ commands: ["spec-init"],
366
+ defaultSelected: true,
367
+ order: 30,
368
+ description: "\u521D\u59CB\u5316 OpenSpec \u73AF\u5883 + \u9A8C\u8BC1\u591A\u6A21\u578B MCP \u5DE5\u5177",
369
+ descriptionEn: "Initialize OpenSpec environment with multi-model MCP validation"
370
+ },
371
+ {
372
+ id: "spec-research",
373
+ name: "\u9700\u6C42\u7814\u7A76",
374
+ nameEn: "Spec Research",
375
+ category: "spec",
376
+ commands: ["spec-research"],
377
+ defaultSelected: true,
378
+ order: 31,
379
+ description: "\u9700\u6C42 \u2192 \u7EA6\u675F\u96C6\uFF08\u5E76\u884C\u63A2\u7D22 + OpenSpec \u63D0\u6848\uFF09",
380
+ descriptionEn: "Transform requirements into constraint sets via parallel exploration"
381
+ },
382
+ {
383
+ id: "spec-plan",
384
+ name: "\u96F6\u51B3\u7B56\u89C4\u5212",
385
+ nameEn: "Spec Plan",
386
+ category: "spec",
387
+ commands: ["spec-plan"],
388
+ defaultSelected: true,
389
+ order: 32,
390
+ description: "\u591A\u6A21\u578B\u5206\u6790 \u2192 \u6D88\u9664\u6B67\u4E49 \u2192 \u96F6\u51B3\u7B56\u53EF\u6267\u884C\u8BA1\u5212",
391
+ descriptionEn: "Refine proposals into zero-decision executable plans"
392
+ },
393
+ {
394
+ id: "spec-impl",
395
+ name: "\u89C4\u8303\u9A71\u52A8\u5B9E\u73B0",
396
+ nameEn: "Spec Implementation",
397
+ category: "spec",
398
+ commands: ["spec-impl"],
399
+ defaultSelected: true,
400
+ order: 33,
401
+ description: "\u6309\u89C4\u8303\u6267\u884C + \u591A\u6A21\u578B\u534F\u4F5C + \u5F52\u6863",
402
+ descriptionEn: "Execute changes via multi-model collaboration with spec compliance"
403
+ },
404
+ {
405
+ id: "spec-review",
406
+ name: "\u5F52\u6863\u524D\u5BA1\u67E5",
407
+ nameEn: "Spec Review",
408
+ category: "spec",
409
+ commands: ["spec-review"],
410
+ defaultSelected: true,
411
+ order: 34,
412
+ description: "\u53CC\u6A21\u578B\u4EA4\u53C9\u5BA1\u67E5 \u2192 Critical \u5FC5\u987B\u4FEE\u590D \u2192 \u5141\u8BB8\u5F52\u6863",
413
+ descriptionEn: "Multi-model compliance review before archiving"
359
414
  }
360
415
  ];
361
416
  function getWorkflowConfigs() {
@@ -1987,56 +2042,85 @@ async function performUpdate(fromVersion, toVersion, isNewVersion) {
1987
2042
 
1988
2043
  const execAsync = promisify(exec);
1989
2044
  async function showMainMenu() {
1990
- console.log();
1991
- console.log(ansis.cyan.bold(` CCG - Claude + Codex + Gemini`));
1992
- console.log(ansis.gray(" Multi-Model Collaboration System"));
1993
- console.log();
1994
- const { action } = await inquirer.prompt([{
1995
- type: "list",
1996
- name: "action",
1997
- message: i18n.t("menu:title"),
1998
- choices: [
1999
- { name: `${ansis.green("\u279C")} ${i18n.t("menu:options.init")}`, value: "init" },
2000
- { name: `${ansis.blue("\u279C")} ${i18n.t("menu:options.update")}`, value: "update" },
2001
- { name: `${ansis.cyan("\u2699")} \u914D\u7F6E MCP`, value: "config-mcp" },
2002
- { name: `${ansis.magenta("\u279C")} ${i18n.t("menu:options.uninstall")}`, value: "uninstall" },
2003
- { name: `${ansis.yellow("?")} ${i18n.t("menu:options.help")}`, value: "help" },
2004
- new inquirer.Separator(),
2005
- { name: `${ansis.red("\u2715")} ${i18n.t("menu:options.exit")}`, value: "exit" }
2006
- ]
2007
- }]);
2008
- switch (action) {
2009
- case "init":
2010
- await init();
2011
- break;
2012
- case "update":
2013
- await update();
2014
- break;
2015
- case "config-mcp":
2016
- await configMcp();
2017
- break;
2018
- case "uninstall":
2019
- await uninstall();
2020
- break;
2021
- case "help":
2022
- showHelp();
2023
- break;
2024
- case "exit":
2025
- console.log(ansis.gray("Goodbye!"));
2026
- break;
2045
+ while (true) {
2046
+ console.log();
2047
+ console.log(ansis.cyan.bold(` CCG - Claude + Codex + Gemini`));
2048
+ console.log(ansis.gray(" Multi-Model Collaboration System"));
2049
+ console.log();
2050
+ const { action } = await inquirer.prompt([{
2051
+ type: "list",
2052
+ name: "action",
2053
+ message: i18n.t("menu:title"),
2054
+ choices: [
2055
+ { name: `${ansis.green("\u279C")} ${i18n.t("menu:options.init")}`, value: "init" },
2056
+ { name: `${ansis.blue("\u279C")} ${i18n.t("menu:options.update")}`, value: "update" },
2057
+ { name: `${ansis.cyan("\u2699")} \u914D\u7F6E MCP`, value: "config-mcp" },
2058
+ { name: `${ansis.magenta("\u279C")} ${i18n.t("menu:options.uninstall")}`, value: "uninstall" },
2059
+ { name: `${ansis.yellow("?")} ${i18n.t("menu:options.help")}`, value: "help" },
2060
+ new inquirer.Separator(),
2061
+ { name: `${ansis.red("\u2715")} ${i18n.t("menu:options.exit")}`, value: "exit" }
2062
+ ]
2063
+ }]);
2064
+ switch (action) {
2065
+ case "init":
2066
+ await init();
2067
+ break;
2068
+ case "update":
2069
+ await update();
2070
+ break;
2071
+ case "config-mcp":
2072
+ await configMcp();
2073
+ break;
2074
+ case "uninstall":
2075
+ await uninstall();
2076
+ break;
2077
+ case "help":
2078
+ showHelp();
2079
+ break;
2080
+ case "exit":
2081
+ console.log(ansis.gray("Goodbye!"));
2082
+ return;
2083
+ }
2084
+ console.log();
2085
+ await inquirer.prompt([{
2086
+ type: "input",
2087
+ name: "continue",
2088
+ message: ansis.gray("\u6309 Enter \u8FD4\u56DE\u4E3B\u83DC\u5355...")
2089
+ }]);
2027
2090
  }
2028
2091
  }
2029
2092
  function showHelp() {
2030
2093
  console.log();
2031
2094
  console.log(ansis.cyan.bold(i18n.t("menu:help.title")));
2032
2095
  console.log();
2033
- console.log(` ${ansis.green("/ccg:dev")} ${i18n.t("menu:help.descriptions.dev")}`);
2096
+ console.log(ansis.yellow.bold(" \u5F00\u53D1\u5DE5\u4F5C\u6D41:"));
2097
+ console.log(` ${ansis.green("/ccg:workflow")} \u5B8C\u65746\u9636\u6BB5\u5F00\u53D1\u5DE5\u4F5C\u6D41`);
2098
+ console.log(` ${ansis.green("/ccg:plan")} \u591A\u6A21\u578B\u534F\u4F5C\u89C4\u5212\uFF08Phase 1-2\uFF09`);
2099
+ console.log(` ${ansis.green("/ccg:execute")} \u591A\u6A21\u578B\u534F\u4F5C\u6267\u884C\uFF08Phase 3-5\uFF09`);
2034
2100
  console.log(` ${ansis.green("/ccg:frontend")} ${i18n.t("menu:help.descriptions.frontend")}`);
2035
2101
  console.log(` ${ansis.green("/ccg:backend")} ${i18n.t("menu:help.descriptions.backend")}`);
2036
- console.log(` ${ansis.green("/ccg:review")} ${i18n.t("menu:help.descriptions.review")}`);
2102
+ console.log(` ${ansis.green("/ccg:feat")} \u667A\u80FD\u529F\u80FD\u5F00\u53D1`);
2037
2103
  console.log(` ${ansis.green("/ccg:analyze")} ${i18n.t("menu:help.descriptions.analyze")}`);
2104
+ console.log(` ${ansis.green("/ccg:debug")} \u95EE\u9898\u8BCA\u65AD + \u4FEE\u590D`);
2105
+ console.log(` ${ansis.green("/ccg:optimize")} \u6027\u80FD\u4F18\u5316`);
2106
+ console.log(` ${ansis.green("/ccg:test")} \u6D4B\u8BD5\u751F\u6210`);
2107
+ console.log(` ${ansis.green("/ccg:review")} ${i18n.t("menu:help.descriptions.review")}`);
2108
+ console.log();
2109
+ console.log(ansis.yellow.bold(" OpenSpec \u89C4\u8303\u9A71\u52A8:"));
2110
+ console.log(` ${ansis.green("/ccg:spec-init")} \u521D\u59CB\u5316 OpenSpec \u73AF\u5883`);
2111
+ console.log(` ${ansis.green("/ccg:spec-research")} \u9700\u6C42\u7814\u7A76 \u2192 \u7EA6\u675F\u96C6`);
2112
+ console.log(` ${ansis.green("/ccg:spec-plan")} \u591A\u6A21\u578B\u5206\u6790 \u2192 \u96F6\u51B3\u7B56\u8BA1\u5212`);
2113
+ console.log(` ${ansis.green("/ccg:spec-impl")} \u89C4\u8303\u9A71\u52A8\u5B9E\u73B0`);
2114
+ console.log(` ${ansis.green("/ccg:spec-review")} \u5F52\u6863\u524D\u53CC\u6A21\u578B\u5BA1\u67E5`);
2115
+ console.log();
2116
+ console.log(ansis.yellow.bold(" Git \u5DE5\u5177:"));
2038
2117
  console.log(` ${ansis.green("/ccg:commit")} ${i18n.t("menu:help.descriptions.commit")}`);
2039
2118
  console.log(` ${ansis.green("/ccg:rollback")} ${i18n.t("menu:help.descriptions.rollback")}`);
2119
+ console.log(` ${ansis.green("/ccg:clean-branches")} \u6E05\u7406\u5DF2\u5408\u5E76\u5206\u652F`);
2120
+ console.log(` ${ansis.green("/ccg:worktree")} Git Worktree \u7BA1\u7406`);
2121
+ console.log();
2122
+ console.log(ansis.yellow.bold(" \u9879\u76EE\u7BA1\u7406:"));
2123
+ console.log(` ${ansis.green("/ccg:init")} \u521D\u59CB\u5316\u9879\u76EE CLAUDE.md`);
2040
2124
  console.log();
2041
2125
  console.log(ansis.gray(i18n.t("menu:help.hint")));
2042
2126
  console.log();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccg-workflow",
3
- "version": "1.7.47",
3
+ "version": "1.7.49",
4
4
  "description": "Claude-Codex-Gemini 多模型协作系统 - 智能路由多模型开发工作流",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@10.17.1",
@@ -44,6 +44,11 @@
44
44
  "templates/commands/test.md",
45
45
  "templates/commands/workflow.md",
46
46
  "templates/commands/worktree.md",
47
+ "templates/commands/spec-init.md",
48
+ "templates/commands/spec-research.md",
49
+ "templates/commands/spec-plan.md",
50
+ "templates/commands/spec-impl.md",
51
+ "templates/commands/spec-review.md",
47
52
  "templates/commands/agents/",
48
53
  "templates/prompts/codex/",
49
54
  "templates/prompts/gemini/analyzer.md",
@@ -0,0 +1,123 @@
1
+ ---
2
+ description: '按规范执行 + 多模型协作 + 归档'
3
+ ---
4
+ <!-- CCG:SPEC:IMPL:START -->
5
+ **Core Philosophy**
6
+ - Implementation is pure mechanical execution—all decisions were made in Plan phase.
7
+ - External model outputs are prototypes only; must be rewritten to production-grade code.
8
+ - Keep changes tightly scoped; enforce side-effect review before any modification.
9
+ - Minimize documentation—prefer self-explanatory code over comments.
10
+
11
+ **Guardrails**
12
+ - **NEVER** apply Codex/Gemini prototypes directly—all outputs are reference only.
13
+ - **MANDATORY**: Request `unified diff patch` format from external models; they have zero write permission.
14
+ - Keep implementation strictly within `tasks.md` scope—no scope creep.
15
+ - Refer to `openspec/AGENTS.md` for conventions.
16
+
17
+ **Steps**
18
+ 1. **Select Proposal**
19
+ - Run `openspec list` to inspect Active Changes.
20
+ - Confirm with user which proposal ID to implement.
21
+ - Run `openspec show <proposal_id>` to review tasks.
22
+
23
+ 2. **Apply OpenSpec Change**
24
+ - Run `/openspec:apply <proposal_id>` to enter implementation mode.
25
+
26
+ 3. **Identify Minimal Verifiable Phase**
27
+ - Review `tasks.md` and identify the **smallest verifiable phase**.
28
+ - Do NOT complete all tasks at once—control context window.
29
+ - Announce: "Implementing Phase X: [task group name]"
30
+
31
+ 4. **Route Tasks to Appropriate Model**
32
+ - **Route A: Gemini** — Frontend/UI/styling (CSS, React, Vue, HTML, components)
33
+ - **Route B: Codex** — Backend/logic/algorithm (API, data processing, business logic)
34
+
35
+ For each task:
36
+ ```
37
+ codeagent-wrapper --backend <codex|gemini> - "$PWD" <<'EOF'
38
+ TASK: <task description from tasks.md>
39
+ CONTEXT: <relevant code context>
40
+ CONSTRAINTS: <constraints from spec>
41
+ OUTPUT: Unified Diff Patch format ONLY
42
+ EOF
43
+ ```
44
+
45
+ 5. **Rewrite Prototype to Production Code**
46
+ Upon receiving diff patch, **NEVER apply directly**. Rewrite by:
47
+ - Removing redundancy
48
+ - Ensuring clear naming and simple structure
49
+ - Aligning with project style
50
+ - Eliminating unnecessary comments
51
+ - Verifying no new dependencies introduced
52
+
53
+ 6. **Side-Effect Review** (Mandatory before apply)
54
+ Verify the change:
55
+ - [ ] Does not exceed `tasks.md` scope
56
+ - [ ] Does not affect unrelated modules
57
+ - [ ] Does not introduce new dependencies
58
+ - [ ] Does not break existing interfaces
59
+
60
+ If issues found, make targeted corrections.
61
+
62
+ 7. **Multi-Model Review (PARALLEL)**
63
+ - **CRITICAL**: You MUST launch BOTH Codex AND Gemini in a SINGLE message with TWO Bash tool calls.
64
+ - **DO NOT** call one model first and wait. Launch BOTH simultaneously with `run_in_background: true`.
65
+
66
+ **Step 7.1**: In ONE message, make TWO parallel Bash calls:
67
+
68
+ **FIRST Bash call (Codex)**:
69
+ ```
70
+ Bash({
71
+ command: "~/.claude/bin/codeagent-wrapper --backend codex - \"$PWD\" <<'EOF'\nReview the implementation changes:\n- Correctness: logic errors, edge cases\n- Security: injection, auth issues\n- Spec compliance: constraints satisfied\nOUTPUT: JSON with findings\nEOF",
72
+ run_in_background: true,
73
+ timeout: 300000,
74
+ description: "Codex: correctness/security review"
75
+ })
76
+ ```
77
+
78
+ **SECOND Bash call (Gemini) - IN THE SAME MESSAGE**:
79
+ ```
80
+ Bash({
81
+ command: "~/.claude/bin/codeagent-wrapper --backend gemini - \"$PWD\" <<'EOF'\nReview the implementation changes:\n- Maintainability: readability, complexity\n- Patterns: consistency with project style\n- Integration: cross-module impacts\nOUTPUT: JSON with findings\nEOF",
82
+ run_in_background: true,
83
+ timeout: 300000,
84
+ description: "Gemini: maintainability/patterns review"
85
+ })
86
+ ```
87
+
88
+ **Step 7.2**: After BOTH Bash calls return task IDs, wait for results with TWO TaskOutput calls:
89
+ ```
90
+ TaskOutput({ task_id: "<codex_task_id>", block: true, timeout: 600000 })
91
+ TaskOutput({ task_id: "<gemini_task_id>", block: true, timeout: 600000 })
92
+ ```
93
+
94
+ Address any critical findings before proceeding.
95
+
96
+ 8. **Update Task Status**
97
+ - Mark completed task in `tasks.md`: `- [x] Task description`
98
+ - Commit changes if appropriate.
99
+
100
+ 9. **Context Checkpoint**
101
+ - After completing a phase, report context usage.
102
+ - If below 80K: Ask user "Continue to next phase?"
103
+ - If approaching 80K: Suggest "Run `/clear` and resume with `/ccg:spec:impl`"
104
+
105
+ 10. **Archive on Completion**
106
+ - When ALL tasks in `tasks.md` are marked `[x]`:
107
+ - Run `/openspec:archive <proposal_id>`
108
+ - This merges spec deltas to `openspec/specs/` and moves change to archive.
109
+
110
+ **Reference**
111
+ - Check task status: `openspec show <id>`
112
+ - Validate before archive: `openspec validate <id>`
113
+ - View active changes: `openspec list`
114
+ - Search existing patterns: `rg -n "function|class" <file>`
115
+
116
+ **Exit Criteria**
117
+ Implementation is complete when:
118
+ - [ ] All tasks in `tasks.md` marked `[x]`
119
+ - [ ] All multi-model reviews passed
120
+ - [ ] Side-effect review confirmed no regressions
121
+ - [ ] `openspec validate <id>` returns zero issues
122
+ - [ ] Change archived successfully
123
+ <!-- CCG:SPEC:IMPL:END -->
@@ -0,0 +1,72 @@
1
+ ---
2
+ description: '初始化 OpenSpec 环境 + 验证多模型 MCP 工具'
3
+ ---
4
+ <!-- CCG:SPEC:INIT:START -->
5
+ **Core Philosophy**
6
+ - OpenSpec provides the specification framework; CCG adds multi-model collaboration.
7
+ - This phase ensures all tools are ready before any development work begins.
8
+ - Fail fast: detect missing dependencies early rather than mid-workflow.
9
+
10
+ **Guardrails**
11
+ - Detect OS (Linux/macOS/Windows) and adapt commands accordingly.
12
+ - Do not proceed to next step until current step completes successfully.
13
+ - Provide clear, actionable error messages when a step fails.
14
+ - Respect user's existing configurations; avoid overwriting without confirmation.
15
+
16
+ **Steps**
17
+ 1. **Detect Operating System**
18
+ - Identify OS using `uname -s` (Unix) or environment variables (Windows).
19
+ - Inform user which OS was detected.
20
+
21
+ 2. **Check and Install OpenSpec**
22
+ - Verify if `openspec` CLI is installed: `openspec --version`
23
+ - If not installed:
24
+ ```bash
25
+ npm install -g @fission-ai/openspec@latest
26
+ ```
27
+ - Confirm installation success.
28
+
29
+ 3. **Initialize OpenSpec for Current Project**
30
+ - Run:
31
+ ```bash
32
+ openspec init --tools claude
33
+ ```
34
+ - Verify `openspec/` directory structure is created.
35
+ - Report any errors with remediation steps.
36
+
37
+ 4. **Validate Multi-Model MCP Tools**
38
+ - Check `codeagent-wrapper` availability: `~/.claude/bin/codeagent-wrapper --version`
39
+ - Test Codex backend:
40
+ ```bash
41
+ ~/.claude/bin/codeagent-wrapper --backend codex - "$PWD" <<< "echo test"
42
+ ```
43
+ - Test Gemini backend:
44
+ ```bash
45
+ ~/.claude/bin/codeagent-wrapper --backend gemini - "$PWD" <<< "echo test"
46
+ ```
47
+ - For each unavailable tool, display warning with installation instructions.
48
+
49
+ 5. **Validate Context Retrieval MCP** (Optional)
50
+ - Check if `mcp__ace-tool__search_context` is available.
51
+ - If not, suggest: "Run `npx ccg-workflow` and select ace-tool MCP option."
52
+
53
+ 6. **Summary Report**
54
+ Display status table:
55
+ ```
56
+ Component Status
57
+ ─────────────────────────────────
58
+ OpenSpec CLI ✓/✗
59
+ Project initialized ✓/✗
60
+ codeagent-wrapper ✓/✗
61
+ Codex backend ✓/✗
62
+ Gemini backend ✓/✗
63
+ ace-tool MCP ✓/✗ (optional)
64
+ ```
65
+ If any required components missing, list actions before proceeding.
66
+
67
+ **Reference**
68
+ - OpenSpec CLI: `openspec --help`
69
+ - CCG Workflow: `npx ccg-workflow`
70
+ - Codex/Gemini MCP: Bundled with codeagent-wrapper
71
+ - Node.js >= 18.x required for OpenSpec
72
+ <!-- CCG:SPEC:INIT:END -->
@@ -0,0 +1,109 @@
1
+ ---
2
+ description: '多模型分析 → 消除歧义 → 零决策可执行计划'
3
+ ---
4
+ <!-- CCG:SPEC:PLAN:START -->
5
+ **Core Philosophy**
6
+ - The goal is to eliminate ALL decision points—implementation should be pure mechanical execution.
7
+ - Every ambiguity must be resolved into explicit constraints before proceeding.
8
+ - Multi-model collaboration surfaces blind spots and conflicting assumptions.
9
+ - Every requirement must have Property-Based Testing (PBT) properties—focus on invariants.
10
+
11
+ **Guardrails**
12
+ - Do not proceed to implementation until every ambiguity is resolved.
13
+ - Multi-model collaboration is **mandatory**: use both Codex and Gemini.
14
+ - If constraints cannot be fully specified, escalate to user or return to research phase.
15
+ - Refer to `openspec/AGENTS.md` for conventions; run `openspec update` if missing.
16
+
17
+ **Steps**
18
+ 1. **Select Proposal**
19
+ - Run `openspec list` to display Active Changes.
20
+ - Confirm with user which proposal ID to refine.
21
+ - Run `openspec show <proposal_id>` to review current state.
22
+
23
+ 2. **Multi-Model Implementation Analysis (PARALLEL)**
24
+ - **CRITICAL**: You MUST launch BOTH Codex AND Gemini in a SINGLE message with TWO Bash tool calls.
25
+ - **DO NOT** call one model first and wait. Launch BOTH simultaneously with `run_in_background: true`.
26
+
27
+ **Step 2.1**: In ONE message, make TWO parallel Bash calls:
28
+
29
+ **FIRST Bash call (Codex)**:
30
+ ```
31
+ Bash({
32
+ command: "~/.claude/bin/codeagent-wrapper --backend codex - \"$PWD\" <<'EOF'\nAnalyze proposal <proposal_id> from backend perspective:\n- Implementation approach\n- Technical risks\n- Alternative architectures\n- Edge cases and failure modes\nOUTPUT: JSON with analysis\nEOF",
33
+ run_in_background: true,
34
+ timeout: 300000,
35
+ description: "Codex: backend analysis"
36
+ })
37
+ ```
38
+
39
+ **SECOND Bash call (Gemini) - IN THE SAME MESSAGE**:
40
+ ```
41
+ Bash({
42
+ command: "~/.claude/bin/codeagent-wrapper --backend gemini - \"$PWD\" <<'EOF'\nAnalyze proposal <proposal_id> from frontend/integration perspective:\n- Maintainability assessment\n- Scalability considerations\n- Integration conflicts\nOUTPUT: JSON with analysis\nEOF",
43
+ run_in_background: true,
44
+ timeout: 300000,
45
+ description: "Gemini: frontend analysis"
46
+ })
47
+ ```
48
+
49
+ **Step 2.2**: After BOTH Bash calls return task IDs, wait for results with TWO TaskOutput calls:
50
+ ```
51
+ TaskOutput({ task_id: "<codex_task_id>", block: true, timeout: 600000 })
52
+ TaskOutput({ task_id: "<gemini_task_id>", block: true, timeout: 600000 })
53
+ ```
54
+
55
+ - Synthesize responses and present consolidated options to user.
56
+
57
+ 3. **Uncertainty Elimination Audit**
58
+ - **Codex**: "Review proposal for unspecified decision points. List each as: [AMBIGUITY] → [REQUIRED CONSTRAINT]"
59
+ - **Gemini**: "Identify implicit assumptions. Specify: [ASSUMPTION] → [EXPLICIT CONSTRAINT NEEDED]"
60
+
61
+ **Anti-Pattern Detection** (flag and reject):
62
+ - Information collection without decision boundaries
63
+ - Technical comparisons without selection criteria
64
+ - Deferred decisions marked "to be determined during implementation"
65
+
66
+ **Target Pattern** (required for approval):
67
+ - Explicit technology choices with parameters (e.g., "JWT with TTL=15min")
68
+ - Concrete algorithm selections with configs (e.g., "bcrypt cost=12")
69
+ - Precise behavioral rules (e.g., "Lock account 30min after 5 failed attempts")
70
+
71
+ Iterate with user until ALL ambiguities resolved.
72
+
73
+ 4. **PBT Property Extraction**
74
+ - **Codex**: "Extract PBT properties. For each requirement: [INVARIANT] → [FALSIFICATION STRATEGY]"
75
+ - **Gemini**: "Define system properties: [PROPERTY] | [DEFINITION] | [BOUNDARY CONDITIONS] | [COUNTEREXAMPLE GENERATION]"
76
+
77
+ **Property Categories**:
78
+ - **Commutativity/Associativity**: Order-independent operations
79
+ - **Idempotency**: Repeated operations yield same result
80
+ - **Round-trip**: Encode→Decode returns original
81
+ - **Invariant Preservation**: State constraints maintained
82
+ - **Monotonicity**: Ordering guarantees (e.g., timestamps increase)
83
+ - **Bounds**: Value ranges, size limits, rate constraints
84
+
85
+ 5. **Update OpenSpec Documents**
86
+ - Run `/openspec:proposal <proposal_id>` to update specs with:
87
+ * All resolved constraints
88
+ * PBT properties in spec format
89
+ * Zero-decision task sequence
90
+ - Run `openspec validate <proposal_id>` to verify format.
91
+
92
+ 6. **Context Checkpoint**
93
+ - Report current context usage.
94
+ - If approaching 80K tokens, suggest: "Run `/clear` and continue with `/ccg:spec:impl`"
95
+
96
+ **Exit Criteria**
97
+ A proposal is ready for implementation only when:
98
+ - [ ] All multi-model analyses completed and synthesized
99
+ - [ ] Zero ambiguities remain (verified by step 3 audit)
100
+ - [ ] All PBT properties documented with falsification strategies
101
+ - [ ] `openspec validate <id>` returns zero issues
102
+ - [ ] User has explicitly approved all constraint decisions
103
+
104
+ **Reference**
105
+ - Inspect proposal: `openspec show <id> --json`
106
+ - Check conflicts: `openspec list --specs`
107
+ - Search patterns: `rg -n "INVARIANT:|PROPERTY:" openspec/`
108
+ - Use `AskUserQuestion` for ANY ambiguity—never assume
109
+ <!-- CCG:SPEC:PLAN:END -->
@@ -0,0 +1,101 @@
1
+ ---
2
+ description: '需求 → 约束集(并行探索 + OpenSpec 提案)'
3
+ ---
4
+ <!-- CCG:SPEC:RESEARCH:START -->
5
+ **Core Philosophy**
6
+ - Research produces **constraint sets**, not information dumps. Each constraint narrows the solution space.
7
+ - Constraints tell subsequent stages "don't consider this direction," enabling mechanical execution without decisions.
8
+ - Output: 约束集合 + 可验证的成功判据 (constraint sets + verifiable success criteria).
9
+ - Strictly adhere to OpenSpec rules when writing spec-structured documents.
10
+
11
+ **Guardrails**
12
+ - **STOP! BEFORE ANY OTHER ACTION**: You MUST call `mcp__ace-tool__enhance_prompt` FIRST. This is NON-NEGOTIABLE.
13
+ - **NEVER** divide subagent tasks by roles (e.g., "架构师agent", "安全专家agent").
14
+ - **ALWAYS** divide by context boundaries (e.g., "user-related code", "authentication logic").
15
+ - Each subagent context must be self-contained with independent output.
16
+ - Use `mcp__ace-tool__search_context` to minimize grep/find operations.
17
+ - Do not make architectural decisions—surface constraints that guide decisions.
18
+
19
+ **Steps**
20
+ 0. **MANDATORY: Enhance Requirement FIRST**
21
+ - **DO THIS IMMEDIATELY. DO NOT SKIP. DO NOT CALL ANY OTHER TOOL FIRST.**
22
+ - Call:
23
+ ```
24
+ mcp__ace-tool__enhance_prompt({
25
+ prompt: "$ARGUMENTS",
26
+ conversation_history: "<recent conversation>",
27
+ project_root_path: "$PWD"
28
+ })
29
+ ```
30
+ - Wait for enhanced prompt result.
31
+ - Use enhanced prompt for ALL subsequent steps.
32
+
33
+ 1. **Generate OpenSpec Proposal**
34
+ - Run: `/openspec:proposal $ARGUMENTS`
35
+ - This scaffolds `openspec/changes/<name>/` with proposal.md, tasks.md, specs/.
36
+
37
+ 2. **Initial Codebase Assessment**
38
+ - Use `mcp__ace-tool__search_context` to scan codebase.
39
+ - Determine project scale: single vs multi-directory structure.
40
+ - **Decision**: If multi-directory → enable parallel Explore subagents.
41
+
42
+ 3. **Define Exploration Boundaries (Context-Based)**
43
+ - Identify natural context boundaries (NOT functional roles):
44
+ * Subagent 1: User domain code (models, services, UI)
45
+ * Subagent 2: Auth & authorization (middleware, session, tokens)
46
+ * Subagent 3: Infrastructure (configs, deployments, builds)
47
+ - Each boundary should be self-contained: no cross-communication needed.
48
+
49
+ 4. **Parallel Multi-Model Exploration**
50
+ - Dispatch Explore subagents with unified output template:
51
+ ```json
52
+ {
53
+ "module_name": "context boundary explored",
54
+ "existing_structures": ["key patterns found"],
55
+ "existing_conventions": ["standards in use"],
56
+ "constraints_discovered": ["hard constraints limiting solution space"],
57
+ "open_questions": ["ambiguities requiring user input"],
58
+ "dependencies": ["cross-module dependencies"],
59
+ "risks": ["potential blockers"],
60
+ "success_criteria_hints": ["observable success behaviors"]
61
+ }
62
+ ```
63
+ - Run Codex for backend boundaries, Gemini for frontend boundaries.
64
+
65
+ 5. **Aggregate and Synthesize**
66
+ - Collect all subagent outputs.
67
+ - Merge into unified constraint sets:
68
+ * **Hard constraints**: Technical limitations, patterns that cannot be violated
69
+ * **Soft constraints**: Conventions, preferences, style guides
70
+ * **Dependencies**: Cross-module relationships affecting implementation order
71
+ * **Risks**: Blockers needing mitigation
72
+
73
+ 6. **User Interaction for Ambiguity Resolution**
74
+ - Compile prioritized list of open questions.
75
+ - Use `AskUserQuestion` tool to present systematically:
76
+ * Group related questions
77
+ * Provide context for each
78
+ * Suggest defaults when applicable
79
+ - Capture responses as additional constraints.
80
+
81
+ 7. **Finalize OpenSpec Proposal**
82
+ - Transform constraint sets into OpenSpec format:
83
+ * **Context**: User need + discovered constraints
84
+ * **Requirements**: Each constraint becomes requirement with scenario
85
+ * **Success Criteria**: Derived from hints and user confirmations
86
+ - Ensure proposal includes:
87
+ * All discovered constraints as requirements
88
+ * Verifiable scenarios for each requirement
89
+ * Clear dependencies and sequencing
90
+ * Risk mitigation strategies
91
+
92
+ 8. **Context Checkpoint**
93
+ - Report current context usage.
94
+ - If approaching 80K tokens, suggest: "Run `/clear` and continue with `/ccg:spec:plan`"
95
+
96
+ **Reference**
97
+ - Review constraints: `rg -n "Constraint:|MUST|MUST NOT" openspec/specs`
98
+ - Check prior research: `ls openspec/changes/*/`
99
+ - Use `openspec show <name>` to inspect proposal structure
100
+ - Use `AskUserQuestion` for ANY ambiguity—never assume or guess
101
+ <!-- CCG:SPEC:RESEARCH:END -->
@@ -0,0 +1,120 @@
1
+ ---
2
+ description: '双模型交叉审查(独立工具,随时可用)'
3
+ ---
4
+ <!-- CCG:SPEC:REVIEW:START -->
5
+ **Core Philosophy**
6
+ - Dual-model cross-validation catches blind spots single-model review would miss.
7
+ - Critical findings SHOULD be addressed before proceeding.
8
+ - Review validates implementation against spec constraints and code quality.
9
+ - This is an independent review tool—can be used anytime, not tied to archive workflow.
10
+
11
+ **Guardrails**
12
+ - **MANDATORY**: Both Codex AND Gemini must complete review before synthesis.
13
+ - Review scope is strictly limited to the proposal's changes—no scope creep.
14
+ - Refer to `openspec/AGENTS.md` for spec conventions if reviewing OpenSpec proposals.
15
+
16
+ **Steps**
17
+ 1. **Select Proposal**
18
+ - Run `openspec list` to display Active Changes.
19
+ - Confirm with user which proposal ID to review.
20
+ - Run `openspec show <proposal_id>` to load spec and tasks.
21
+
22
+ 2. **Collect Implementation Artifacts**
23
+ - Identify all files modified by this proposal.
24
+ - Use `git diff` or `openspec diff <proposal_id>` to get change summary.
25
+ - Load relevant spec constraints and PBT properties from `openspec/changes/<id>/specs/`.
26
+
27
+ 3. **Multi-Model Review (PARALLEL)**
28
+ - **CRITICAL**: You MUST launch BOTH Codex AND Gemini in a SINGLE message with TWO Bash tool calls.
29
+ - **DO NOT** call one model first and wait. Launch BOTH simultaneously with `run_in_background: true`.
30
+
31
+ **Step 3.1**: In ONE message, make TWO parallel Bash calls:
32
+
33
+ **FIRST Bash call (Codex)**:
34
+ ```
35
+ Bash({
36
+ command: "~/.claude/bin/codeagent-wrapper --backend codex - \"$PWD\" <<'EOF'\nReview proposal <proposal_id> implementation:\n\n## Codex Review Dimensions\n1. **Spec Compliance**: Verify ALL constraints from spec are satisfied\n2. **PBT Properties**: Check invariants, idempotency, bounds are correctly implemented\n3. **Logic Correctness**: Edge cases, error handling, algorithm correctness\n4. **Backend Security**: Injection vulnerabilities, auth checks, input validation\n5. **Regression Risk**: Interface compatibility, type safety, breaking changes\n\n## Output Format (JSON)\n{\n \"findings\": [\n {\n \"severity\": \"Critical|Warning|Info\",\n \"dimension\": \"spec_compliance|pbt|logic|security|regression\",\n \"file\": \"path/to/file.ts\",\n \"line\": 42,\n \"description\": \"What is wrong\",\n \"constraint_violated\": \"Constraint ID from spec (if applicable)\",\n \"fix_suggestion\": \"How to fix\"\n }\n ],\n \"passed_checks\": [\"List of verified constraints/properties\"],\n \"summary\": \"Overall assessment\"\n}\nEOF",
37
+ run_in_background: true,
38
+ timeout: 300000,
39
+ description: "Codex: backend/logic review"
40
+ })
41
+ ```
42
+
43
+ **SECOND Bash call (Gemini) - IN THE SAME MESSAGE**:
44
+ ```
45
+ Bash({
46
+ command: "~/.claude/bin/codeagent-wrapper --backend gemini - \"$PWD\" <<'EOF'\nReview proposal <proposal_id> implementation:\n\n## Gemini Review Dimensions\n1. **Pattern Consistency**: Naming conventions, code style, project patterns\n2. **Maintainability**: Readability, complexity, documentation adequacy\n3. **Integration Risk**: Dependency changes, cross-module impacts\n4. **Frontend Security**: XSS, CSRF, sensitive data exposure\n5. **Spec Alignment**: Implementation matches spec intent (not just letter)\n\n## Output Format (JSON)\n{\n \"findings\": [\n {\n \"severity\": \"Critical|Warning|Info\",\n \"dimension\": \"patterns|maintainability|integration|security|alignment\",\n \"file\": \"path/to/file.ts\",\n \"line\": 42,\n \"description\": \"What is wrong\",\n \"spec_reference\": \"Spec section (if applicable)\",\n \"fix_suggestion\": \"How to fix\"\n }\n ],\n \"passed_checks\": [\"List of verified aspects\"],\n \"summary\": \"Overall assessment\"\n}\nEOF",
47
+ run_in_background: true,
48
+ timeout: 300000,
49
+ description: "Gemini: patterns/integration review"
50
+ })
51
+ ```
52
+
53
+ **Step 3.2**: After BOTH Bash calls return task IDs, wait for results with TWO TaskOutput calls:
54
+ ```
55
+ TaskOutput({ task_id: "<codex_task_id>", block: true, timeout: 600000 })
56
+ TaskOutput({ task_id: "<gemini_task_id>", block: true, timeout: 600000 })
57
+ ```
58
+
59
+ 4. **Synthesize Findings**
60
+ - Merge findings from both models.
61
+ - Deduplicate overlapping issues.
62
+ - Classify by severity:
63
+ * **Critical**: Spec violation, security vulnerability, breaking change → MUST fix
64
+ * **Warning**: Pattern deviation, maintainability concern → SHOULD fix
65
+ * **Info**: Minor improvement suggestion → MAY fix
66
+
67
+ 5. **Present Review Report**
68
+ - Display findings grouped by severity:
69
+ ```
70
+ ## Review Report: <proposal_id>
71
+
72
+ ### Critical (X issues) - MUST FIX
73
+ - [ ] [SPEC] file.ts:42 - Constraint X violated: description
74
+ - [ ] [SEC] api.ts:15 - SQL injection vulnerability
75
+
76
+ ### Warning (Y issues) - SHOULD FIX
77
+ - [ ] [PATTERN] utils.ts:88 - Inconsistent naming convention
78
+
79
+ ### Info (Z issues) - MAY FIX
80
+ - [ ] [MAINT] helper.ts:20 - Consider extracting to separate function
81
+
82
+ ### Passed Checks
83
+ - ✅ PBT: Idempotency property verified
84
+ - ✅ Security: No XSS vulnerabilities found
85
+ ```
86
+
87
+ 6. **Decision Gate**
88
+ - **If Critical > 0**:
89
+ * Present findings to user.
90
+ * Ask: "Fix now or return to `/ccg:spec-impl` to address?"
91
+ * Do NOT allow archiving.
92
+
93
+ - **If Critical = 0**:
94
+ * Ask user: "All critical checks passed. Proceed to archive?"
95
+ * If Warning > 0, recommend addressing before archive.
96
+
97
+ 7. **Optional: Inline Fix Mode**
98
+ - If user chooses "Fix now" for Critical issues:
99
+ * Route each fix to appropriate model (backend→Codex, frontend→Gemini).
100
+ * Apply fix using unified diff patch pattern.
101
+ * Re-run affected review dimension.
102
+ * Repeat until Critical = 0.
103
+
104
+ 8. **Context Checkpoint**
105
+ - Report current context usage.
106
+ - If approaching 80K tokens, suggest: "Run `/clear` and continue with `/ccg:spec-review` or `/ccg:spec-impl`"
107
+
108
+ **Exit Criteria**
109
+ Review is complete when:
110
+ - [ ] Both Codex and Gemini reviews completed
111
+ - [ ] All findings synthesized and classified
112
+ - [ ] Zero Critical issues remain (fixed or user-acknowledged)
113
+ - [ ] User decision captured (archive / return to impl / defer)
114
+
115
+ **Reference**
116
+ - View proposal: `openspec show <id>`
117
+ - Check spec constraints: `rg -n "CONSTRAINT:|MUST|INVARIANT:" openspec/changes/<id>/specs/`
118
+ - View implementation diff: `openspec diff <id>` or `git diff`
119
+ - Archive (after passing): `/ccg:spec-impl` → Step 10
120
+ <!-- CCG:SPEC:REVIEW:END -->