ccg-ros2-workflow 1.4.0 → 2.1.0

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.
Files changed (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +128 -241
  3. package/bin/ccg.mjs +2 -0
  4. package/bin/codeagent-wrapper-darwin-amd64 +0 -0
  5. package/bin/codeagent-wrapper-darwin-arm64 +0 -0
  6. package/bin/codeagent-wrapper-linux-amd64 +0 -0
  7. package/bin/codeagent-wrapper-linux-arm64 +0 -0
  8. package/bin/codeagent-wrapper-windows-amd64.exe +0 -0
  9. package/bin/codeagent-wrapper-windows-arm64.exe +0 -0
  10. package/dist/cli.d.mts +1 -0
  11. package/dist/cli.d.ts +1 -0
  12. package/dist/cli.mjs +173 -0
  13. package/dist/index.d.mts +229 -0
  14. package/dist/index.d.ts +229 -0
  15. package/dist/index.mjs +12 -0
  16. package/dist/shared/ccg-ros2-workflow.CpLJvcLP.mjs +2274 -0
  17. package/package.json +85 -22
  18. package/templates/commands/agents/planner.md +345 -0
  19. package/templates/commands/agents/system-integrator.md +397 -0
  20. package/{src/commands/ccg → templates/commands}/analyze.md +17 -17
  21. package/{src/commands/ccg → templates/commands}/backend.md +25 -25
  22. package/{src/commands/ccg → templates/commands}/debug.md +12 -12
  23. package/{src/commands/ccg → templates/commands}/execute.md +24 -23
  24. package/{src/commands/ccg → templates/commands}/feat.md +21 -21
  25. package/{src/commands/ccg → templates/commands}/frontend.md +26 -26
  26. package/{src/commands/ccg → templates/commands}/optimize.md +24 -24
  27. package/{src/commands/ccg → templates/commands}/plan.md +20 -19
  28. package/{src/commands/ccg → templates/commands}/review.md +9 -9
  29. package/templates/commands/spec-impl.md +123 -0
  30. package/templates/commands/spec-init.md +91 -0
  31. package/templates/commands/spec-plan.md +109 -0
  32. package/templates/commands/spec-research.md +104 -0
  33. package/templates/commands/spec-review.md +120 -0
  34. package/{src/commands/ccg → templates/commands}/test.md +23 -23
  35. package/templates/commands/workflow.md +193 -0
  36. package/{src/commands/ccg → templates/commands}/worktree.md +8 -8
  37. package/templates/prompts/claude/analyzer.md +59 -0
  38. package/templates/prompts/claude/architect.md +54 -0
  39. package/templates/prompts/claude/debugger.md +71 -0
  40. package/templates/prompts/claude/optimizer.md +73 -0
  41. package/templates/prompts/claude/reviewer.md +63 -0
  42. package/templates/prompts/claude/tester.md +69 -0
  43. package/templates/prompts/codex/analyzer.md +50 -0
  44. package/templates/prompts/codex/architect.md +46 -0
  45. package/templates/prompts/codex/debugger.md +66 -0
  46. package/templates/prompts/codex/optimizer.md +74 -0
  47. package/templates/prompts/codex/reviewer.md +66 -0
  48. package/templates/prompts/codex/tester.md +55 -0
  49. package/templates/prompts/gemini/analyzer.md +53 -0
  50. package/templates/prompts/gemini/architect.md +47 -0
  51. package/templates/prompts/gemini/debugger.md +70 -0
  52. package/templates/prompts/gemini/frontend.md +56 -0
  53. package/templates/prompts/gemini/optimizer.md +77 -0
  54. package/templates/prompts/gemini/reviewer.md +73 -0
  55. package/templates/prompts/gemini/tester.md +61 -0
  56. package/bin/cli.js +0 -903
  57. package/src/agents/ccg/planner.md +0 -358
  58. package/src/agents/ccg/system-integrator.md +0 -627
  59. package/src/codeagent-wrapper.sh +0 -86
  60. package/src/commands/ccg/workflow.md +0 -212
  61. package/src/config.toml +0 -36
  62. package/src/prompts/claude/analyzer.md +0 -25
  63. package/src/prompts/claude/architect.md +0 -25
  64. package/src/prompts/claude/debugger.md +0 -24
  65. package/src/prompts/claude/optimizer.md +0 -25
  66. package/src/prompts/claude/reviewer.md +0 -26
  67. package/src/prompts/claude/tester.md +0 -24
  68. package/src/prompts/codex/analyzer.md +0 -32
  69. package/src/prompts/codex/architect.md +0 -42
  70. package/src/prompts/codex/debugger.md +0 -24
  71. package/src/prompts/codex/optimizer.md +0 -25
  72. package/src/prompts/codex/reviewer.md +0 -32
  73. package/src/prompts/codex/tester.md +0 -24
  74. package/src/prompts/gemini/analyzer.md +0 -32
  75. package/src/prompts/gemini/architect.md +0 -34
  76. package/src/prompts/gemini/debugger.md +0 -24
  77. package/src/prompts/gemini/frontend.md +0 -25
  78. package/src/prompts/gemini/optimizer.md +0 -25
  79. package/src/prompts/gemini/reviewer.md +0 -32
  80. package/src/prompts/gemini/tester.md +0 -24
  81. /package/{src/agents/ccg → templates/commands/agents}/get-current-datetime.md +0 -0
  82. /package/{src/agents/ccg → templates/commands/agents}/init-architect.md +0 -0
  83. /package/{src/commands/ccg → templates/commands}/clean-branches.md +0 -0
  84. /package/{src/commands/ccg → templates/commands}/commit.md +0 -0
  85. /package/{src/commands/ccg → templates/commands}/enhance.md +0 -0
  86. /package/{src/commands/ccg → templates/commands}/init.md +0 -0
  87. /package/{src/commands/ccg → templates/commands}/rollback.md +0 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 fengshao1227
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,303 +1,190 @@
1
- # CCG-ROS2-Workflow
1
+ # CCG - Claude + Codex + Gemini Multi-Model Collaboration
2
2
 
3
- [![npm version](https://badge.fury.io/js/ccg-ros2-workflow.svg)](https://www.npmjs.com/package/ccg-ros2-workflow)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
3
+ <div align="center">
5
4
 
6
- ROS2 多模型协作开发工具 - 基于 Claude Code CLI
5
+ [![npm version](https://img.shields.io/npm/v/ccg-workflow.svg)](https://www.npmjs.com/package/ccg-workflow)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
7
+ [![Claude Code](https://img.shields.io/badge/Claude%20Code-Compatible-green.svg)](https://claude.ai/code)
7
8
 
8
- > **v1.4.0** - Agents 独立文件化,ROS2 完整版实现
9
+ </div>
9
10
 
10
- ## 特性
11
-
12
- - **多模型协作**: Codex (底层控制) + Gemini (上层集成) + Claude (编排)
13
- - **ROS2 Humble**: 专为物理机器人开发优化
14
- - **简洁原则**: 信任模型能力,上下文由 MCP 检索
15
- - **ace-tool MCP**: 自动理解项目结构和代码上下文
16
- - **跨平台**: macOS / Ubuntu 支持
11
+ Claude Code 编排 Codex + Gemini 的多模型协作开发系统。前端任务路由至 Gemini,后端任务路由至 Codex,Claude 负责编排决策和代码审核。
17
12
 
18
13
  ## 安装
19
14
 
20
15
  ```bash
21
- npx ccg-ros2-workflow
16
+ npx ccg-workflow
22
17
  ```
23
18
 
24
- 或全局安装:
25
-
26
- ```bash
27
- npm install -g ccg-ros2-workflow
28
- ccg-ros2-workflow
29
- ```
19
+ **要求**:Claude Code CLI、Node.js 20+
30
20
 
31
- 安装程序提供以下选项:
32
- 1. 安装/重装工作流
33
- 2. 更新工作流
34
- 3. 配置 ace-tool MCP
35
- 4. 配置 API 密钥
36
- 5. 帮助
37
- 6. 卸载工作流
38
- 7. 退出
21
+ > **重要**:本项目依赖 `ora@9.x` 和 `string-width@8.x`,这些包要求 Node.js >= 20。使用 Node.js 18 会导致 `SyntaxError: Invalid regular expression flags` 错误。请确保升级到 Node.js 20 或更高版本。
39
22
 
40
- ## 前置依赖
23
+ **可选**:Codex CLI(后端)、Gemini CLI(前端)
41
24
 
42
- **必须安装**:
25
+ ## 命令
43
26
 
44
- - [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) - 核心运行环境
27
+ | 命令 | 说明 |
28
+ |------|------|
29
+ | `/ccg:workflow` | 6 阶段完整工作流 |
30
+ | `/ccg:plan` | 多模型协作规划 (Phase 1-2) |
31
+ | `/ccg:execute` | 多模型协作执行 (Phase 3-5) |
32
+ | `/ccg:feat` | 新功能开发 |
33
+ | `/ccg:frontend` | 前端任务 (Gemini) |
34
+ | `/ccg:backend` | 后端任务 (Codex) |
35
+ | `/ccg:analyze` | 技术分析 |
36
+ | `/ccg:debug` | 问题诊断 |
37
+ | `/ccg:optimize` | 性能优化 |
38
+ | `/ccg:test` | 测试生成 |
39
+ | `/ccg:review` | 代码审查 |
40
+ | `/ccg:commit` | Git 提交 |
41
+ | `/ccg:rollback` | Git 回滚 |
42
+ | `/ccg:clean-branches` | 清理分支 |
43
+ | `/ccg:worktree` | Worktree 管理 |
44
+ | `/ccg:init` | 初始化 CLAUDE.md |
45
+ | `/ccg:enhance` | Prompt 增强 |
46
+ | `/ccg:spec-init` | 初始化 OPSX 环境 |
47
+ | `/ccg:spec-research` | 需求 → 约束集 |
48
+ | `/ccg:spec-plan` | 约束 → 零决策计划 |
49
+ | `/ccg:spec-impl` | 按计划执行 + 归档 |
50
+ | `/ccg:spec-review` | 双模型交叉审查 |
51
+
52
+ ### OPSX 规范驱动(v1.7.52+)
53
+
54
+ 集成 [OPSX 架构](https://github.com/fission-ai/opsx),把需求变成约束,让 AI 没法自由发挥:
45
55
 
46
56
  ```bash
47
- # Claude Code CLI (必须)
48
- npm install -g @anthropic-ai/claude-code
49
- ```
57
+ # 初始化 OPSX 环境
58
+ /ccg:spec-init
50
59
 
51
- **可选安装**(启用多模型协作):
60
+ # 研究需求 → 输出约束集
61
+ /ccg:spec-research 实现用户认证
52
62
 
53
- - [Codex CLI](https://github.com/openai/codex) - 底层控制专家
54
- - [Gemini CLI](https://github.com/google/gemini-cli) - 上层集成专家
55
- - [ace-tool](https://augmentcode.com/) - 代码上下文引擎(推荐)
63
+ # 并行分析 零决策计划
64
+ /ccg:spec-plan
56
65
 
57
- ```bash
58
- # Codex CLI (可选)
59
- npm install -g @openai/codex
66
+ # 按计划执行
67
+ /ccg:spec-impl
60
68
 
61
- # Gemini CLI (可选)
62
- npm install -g @google/gemini-cli
69
+ # 独立审查(随时可用)
70
+ /ccg:spec-review
63
71
  ```
64
72
 
65
- ## 使用方法
66
-
67
- 在 Claude Code 中:
73
+ **说明**:`/ccg:spec-*` 命令是 CCG 对 OPSX 的封装,内部调用 `/opsx:*` 命令。每阶段之间可 `/clear`,状态存在 `openspec/` 目录,不怕上下文爆。
68
74
 
69
- ```bash
70
- # 完整工作流
71
- /ccg:workflow 为移动机器人添加速度限制器
75
+ ### 规划与执行分离
72
76
 
73
- # 智能功能开发
74
- /ccg:feat 实现 PID 控制器
77
+ v1.7.39 新增 `/ccg:plan` 和 `/ccg:execute` 命令,将规划与执行解耦:
75
78
 
76
- # 分析任务
77
- /ccg:analyze 分析控制器实现
79
+ ```bash
80
+ # 1. 生成实施计划
81
+ /ccg:plan 实现用户认证功能
78
82
 
79
- # 代码审查
80
- /ccg:review
83
+ # 2. 审查计划(可修改)
84
+ # 计划保存至 .claude/plan/user-auth.md
81
85
 
82
- # 查看所有命令
83
- /ccg:<Tab>
86
+ # 3. 执行计划(新会话也可执行)
87
+ /ccg:execute .claude/plan/user-auth.md
84
88
  ```
85
89
 
86
- ## 命令列表
87
-
88
- ### 核心工作流
89
-
90
- | 命令 | 说明 |
91
- |------|------|
92
- | `/ccg:workflow` | 🚀 ROS2 多模型协作开发 (研究→构思→计划→执行→优化→评审),智能路由 Codex/Gemini |
93
- | `/ccg:plan` | 📋 多模型协作规划 - 上下文检索 + 双模型分析 → 生成 Step-by-step 实施计划 |
94
- | `/ccg:execute` | ⚡ 多模型协作执行 - 根据计划获取原型 → Claude 重构实施 → 多模型审计交付 |
95
- | `/ccg:feat` | ✨ 智能功能开发 - 自动识别输入类型,规划/讨论/实施全流程 |
96
-
97
- ### 专项开发
98
-
99
- | 命令 | 说明 |
100
- |------|------|
101
- | `/ccg:frontend` | 🎨 上层应用专项工作流 - Gemini 主导集成、可视化、Launch、Python节点 |
102
- | `/ccg:backend` | 🔧 底层控制专项工作流 - Codex 主导控制算法、C++节点、驱动 |
103
-
104
- ### 分析与优化
105
-
106
- | 命令 | 说明 |
107
- |------|------|
108
- | `/ccg:analyze` | 🔍 多模型技术分析 - Codex 底层控制分析 + Gemini 上层集成分析,交叉验证后综合见解 |
109
- | `/ccg:review` | 👀 多模型代码审查 - 无参数时自动审查 git diff,双模型交叉验证 |
110
- | `/ccg:test` | 🧪 多模型测试生成 - 智能路由 Codex 底层单元测试 / Gemini 上层集成测试 |
111
- | `/ccg:debug` | 🐛 多模型调试 - Codex 底层控制诊断 + Gemini 上层应用诊断,交叉验证定位问题 |
112
- | `/ccg:optimize` | ⚡ 多模型性能优化 - Codex 底层实时性优化 + Gemini 上层集成优化 |
90
+ ## 配置
113
91
 
114
- ### 辅助工具
115
-
116
- | 命令 | 说明 |
117
- |------|------|
118
- | `/ccg:init` | 🏗️ 初始化项目 AI 上下文 - 生成根级与模块级 CLAUDE.md 索引 |
119
- | `/ccg:enhance` | 📝 Prompt 优化 - 使用 ace-tool enhance_prompt 优化提示词,展示原始与增强版本供确认 |
120
- | `/ccg:commit` | 💾 智能 Git 提交 - 分析改动生成 Conventional Commit 信息,支持拆分建议 |
121
- | `/ccg:rollback` | ⏪ 交互式 Git 回滚 - 安全回滚分支到历史版本,支持 reset/revert 模式 |
122
- | `/ccg:clean-branches` | 🧹 清理 Git 分支 - 安全清理已合并或过期分支,默认 dry-run 模式 |
123
- | `/ccg:worktree` | 🌲 Git Worktree 管理 - 在 ../.ccg/项目名/ 目录创建,支持 IDE 集成和内容迁移 |
124
-
125
- ## 架构
92
+ ### 目录结构
126
93
 
127
94
  ```
128
- ┌─────────────────────────────────────────┐
129
- │ Claude (编排) │
130
- 执行代码修改、协调工作流 │
131
- └─────────────────┬───────────────────────┘
132
-
133
- ┌─────────┴─────────┐
134
- ▼ ▼
135
- ┌───────────────┐ ┌───────────────┐
136
- │ Codex (底层) │ │ Gemini (上层) │
137
- │ 控制、C++ │ │ 集成、Python │
138
- │ 硬件、实时 │ │ 配置、诊断 │
139
- └───────────────┘ └───────────────┘
95
+ ~/.claude/
96
+ ├── commands/ccg/ # 斜杠命令
97
+ ├── agents/ccg/ # 子智能体
98
+ ├── bin/codeagent-wrapper
99
+ └── .ccg/
100
+ ├── config.toml
101
+ └── prompts/{codex,gemini}/
140
102
  ```
141
103
 
142
- ### 模型分工
104
+ ### 环境变量
143
105
 
144
- | 模型 | 职责 | 关键词 |
106
+ | 变量 | 说明 | 默认值 |
145
107
  |------|------|--------|
146
- | **Codex** | 底层系统 | 控制算法、运动学/动力学、实时性能、硬件驱动、C++ 节点、安全系统 |
147
- | **Gemini** | 上层集成 | Launch 文件、YAML 配置、Python 节点、系统诊断、参数管理 |
148
- | **Claude** | 编排执行 | 综合两个模型输出、执行代码修改、协调工作流 |
149
-
150
- ### 智能路由
151
-
152
- 系统根据任务类型自动分配到合适的模型:
153
-
154
- | 任务类型 | 路由目标 |
155
- |----------|----------|
156
- | 控制算法、C++、硬件驱动、实时性 | → Codex |
157
- | Launch、YAML、Python、诊断、集成 | → Gemini |
158
- | 代码审查、测试 | → 双模型并行 |
159
-
160
- ## 配置
108
+ | `CODEAGENT_POST_MESSAGE_DELAY` | Codex 完成后等待时间(秒) | 5 |
109
+ | `CODEX_TIMEOUT` | codeagent-wrapper 执行超时(秒) | 7200 |
110
+ | `BASH_DEFAULT_TIMEOUT_MS` | Claude Code Bash 默认超时(毫秒) | 120000 |
111
+ | `BASH_MAX_TIMEOUT_MS` | Claude Code Bash 最大超时(毫秒) | 600000 |
161
112
 
162
- 安装后配置文件位于:
113
+ 配置方式(`~/.claude/settings.json`):
163
114
 
115
+ ```json
116
+ {
117
+ "env": {
118
+ "CODEAGENT_POST_MESSAGE_DELAY": "1",
119
+ "CODEX_TIMEOUT": "7200",
120
+ "BASH_DEFAULT_TIMEOUT_MS": "600000",
121
+ "BASH_MAX_TIMEOUT_MS": "3600000",
122
+ "GEMINI_API_KEY": "your-gemini-api-key",
123
+ "GOOGLE_API_KEY": "your-google-api-key"
124
+ }
125
+ }
164
126
  ```
165
- ~/.claude/
166
- ├── .ccg/
167
- │ ├── config.toml # 主配置
168
- │ └── prompts/ # 提示词 (19个)
169
- │ ├── codex/ # analyzer, architect, reviewer, debugger, optimizer, tester
170
- │ ├── gemini/ # analyzer, architect, reviewer, debugger, optimizer, tester, frontend
171
- │ └── claude/ # analyzer, architect, reviewer, debugger, optimizer, tester
172
- ├── commands/ccg/ # 17 个命令文件
173
- ├── agents/ccg/ # 4 个 agent 文件
174
- │ ├── planner.md # ROS2 任务规划师 (WBS 方法论)
175
- │ ├── system-integrator.md # ROS2 系统集成设计师
176
- │ ├── init-architect.md # 项目初始化架构师
177
- │ └── get-current-datetime.md # 时间工具
178
- ├── mcp_servers.json # MCP 配置 (ace-tool)
179
- └── bin/
180
- └── codeagent-wrapper # 模型调用脚本
181
- ```
182
127
 
183
- ## MCP 配置 (ace-tool)
128
+ > **VSCode 插件用户注意**:VSCode 启动的子进程不会继承终端环境变量,必须在 `settings.json` 中配置 API 密钥,否则 Gemini 会报退出码 41(授权失败)。
129
+
130
+ ### MCP 配置
184
131
 
185
- ace-tool Augment Code 的代码上下文引擎,让 AI 自动理解项目结构。
132
+ ace-tool 用于代码检索和 Prompt 增强,安装时可选配置。
186
133
 
187
- ### 安装方式
134
+ Token 获取:https://augmentcode.com/
188
135
 
189
- 运行安装程序,选择「配置 ace-tool MCP」:
136
+ ## 更新 / 卸载
190
137
 
191
138
  ```bash
192
- npx ccg-ros2-workflow
193
- # 选择 3. 配置 ace-tool MCP
194
- # 选择版本:ace-tool (Node.js) ace-tool-rs (Rust,推荐)
195
- # 输入 Token(从 augmentcode.com 或中转服务获取)
139
+ # 更新
140
+ npx ccg-workflow@latest # npx 用户
141
+ npm install -g ccg-workflow@latest # npm 全局用户
142
+
143
+ # 卸载
144
+ npx ccg-workflow # 选择 "卸载工作流"
145
+ npm uninstall -g ccg-workflow # npm 全局用户需额外执行
196
146
  ```
197
147
 
198
- ### 配置示例
148
+ ## 已知问题
199
149
 
200
- ```json
201
- {
202
- "ace-tool": {
203
- "command": "npx",
204
- "args": ["ace-tool-rs", "mcp", "--token", "your-token"],
205
- "env": { "RUST_LOG": "info" }
206
- }
207
- }
208
- ```
150
+ **Codex CLI 0.80.0 进程不退出**
209
151
 
210
- ### Token 获取
152
+ `--json` 模式下 Codex 完成输出后进程不会自动退出。
211
153
 
212
- - **官方服务**: https://augmentcode.com/ 注册获取
213
- - **中转服务**: 使用第三方中转(需要配置 Base URL)
154
+ 解决:设置 `CODEAGENT_POST_MESSAGE_DELAY=1`
214
155
 
215
- 配置完成后重启 Claude Code 即可使用。
156
+ ## 架构
216
157
 
217
- ## 语言配置
158
+ ```
159
+ Claude Code (编排)
160
+
161
+ ┌───┴───┐
162
+ ↓ ↓
163
+ Codex Gemini
164
+ (后端) (前端)
165
+ │ │
166
+ └───┬───┘
167
+
168
+ Unified Patch
169
+ ```
218
170
 
219
- | 场景 | 语言 |
220
- |------|------|
221
- | 提示词 | English |
222
- | 交互 | 中文 |
223
- | 代码注释 | 中文 |
171
+ 外部模型无写入权限,仅返回 Patch,由 Claude 审核后应用。
224
172
 
225
- ## ROS2 配置
173
+ ## 致谢
226
174
 
227
- | 项目 | 值 |
228
- |------|-----|
229
- | 发行版 | Humble |
230
- | 目标 | 物理机器人 |
231
- | 路由模式 | 智能路由 |
175
+ - [cexll/myclaude](https://github.com/cexll/myclaude) - codeagent-wrapper
176
+ - [UfoMiao/zcf](https://github.com/UfoMiao/zcf) - Git 工具
177
+ - [GudaStudio/skills](https://github.com/GuDaStudio/skills) - 路由设计
178
+ - [ace-tool](https://linux.do/t/topic/1344562) - MCP 工具
232
179
 
233
- ## 卸载
180
+ ## Star History
234
181
 
235
- ```bash
236
- npx ccg-ros2-workflow
237
- # 选择 "卸载工作流"
238
- ```
182
+ [![Star History Chart](https://api.star-history.com/svg?repos=fengshao1227/ccg-workflow&type=timeline&legend=top-left)](https://www.star-history.com/#fengshao1227/ccg-workflow&type=timeline&legend=top-left)
239
183
 
240
184
  ## License
241
185
 
242
186
  MIT
243
187
 
244
- ## 更新日志
245
-
246
- ### v1.4.0
247
- - **Agents 目录改造**:agents 从 cli.js 内联生成改为独立文件
248
- - 新增 `src/agents/ccg/` 目录,包含 4 个 ROS2 专用 agent:
249
- - `planner.md`:基于 WBS 方法论的 ROS2 任务规划师,支持 ace-tool 检索、Mermaid 依赖图
250
- - `system-integrator.md`:ROS2 系统集成设计师(替代 ui-ux-designer),负责节点架构、Launch 配置、参数管理、QoS 策略
251
- - `init-architect.md`:项目初始化架构师(通用版本)
252
- - `get-current-datetime.md`:时间工具(通用版本)
253
- - 所有 agent 添加 frontmatter(name, tools, color 字段)
254
- - cli.js 改为使用 `copyRecursive` 安装 agents,与 commands/prompts 保持一致
255
- - 完整 ROS2 示例(PID 控制器、底盘驱动集成)
256
-
257
- ### v1.3.0
258
- - 参考 ccg-workflow 官方实现重写 CLI
259
- - 全新交互式安装流程,支持 MCP 工具选择
260
- - 配置摘要显示(模型路由、命令数量、MCP 工具、目标平台)
261
- - 安装成功后显示已安装命令列表(逐个显示 ✓)
262
- - 显示已安装提示词(按模型分组)
263
- - 显示已安装二进制文件和 PATH 配置
264
- - 改进卸载流程,检测全局安装并提供完整卸载指引
265
- - 添加 ora 加载动画 spinner
266
-
267
- ### v1.2.0
268
- - 全新交互式菜单 (inquirer + chalk)
269
- - 添加更新检查功能,支持 npm 版本对比
270
- - 新增 agents 目录,包含 3 个 agent 文件
271
- - 改进卸载流程,显示详细文件统计
272
- - 新增帮助命令,展示所有可用 /ccg: 命令
273
- - 优化安装流程,显示安装摘要
274
-
275
- ### v1.1.0
276
- - 支持直接安装 ace-tool,无需手动安装 CLI
277
- - 支持 ace-tool (Node.js) 和 ace-tool-rs (Rust) 两种版本
278
- - 支持配置 Token 和 Base URL(中转服务)
279
- - 使用 npx 自动下载运行,首次使用自动安装
280
-
281
- ### v1.0.9
282
- - 提示词文件统一使用英文
283
- - 保留 "Code comments in Chinese" 指令
284
- - 语言规范:提示词(英文) / 交互(中文) / 注释(中文)
285
-
286
- ### v1.0.8
287
- - 基于 Codex+Gemini 双模型交叉验证分析优化
288
- - `gemini/architect.md`: 增加 QoS 策略设计 + Node Composition
289
- - `codex/architect.md`: 增加 RT Checklist (executor/ros2_control/E-stop)
290
- - `workflow.md`: 新增 Stage 7 硬件验证 gate
291
- - 术语规范化:`ui-ux-designer` → `system-integrator`
292
-
293
- ### v1.0.7
294
- - 完成所有 17 个命令文件的 ROS2 术语适配
295
- - 术语映射:前端/后端 → 上层应用/底层控制
296
- - 任务路由:Launch/Python → Gemini,C++/控制 → Codex
297
-
298
- ### v1.0.6
299
- - 更新 README 文档,添加完整命令列表
300
- - 修复 "仿真" → "集成" 术语
301
-
302
- ### v1.0.5
303
- - 初始 ROS2 Humble 物理机器人版本
188
+ ---
189
+
190
+ v1.7.52 | [Issues](https://github.com/fengshao1227/ccg-workflow/issues)
package/bin/ccg.mjs ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import '../dist/cli.mjs'
package/dist/cli.d.mts ADDED
@@ -0,0 +1 @@
1
+
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+
package/dist/cli.mjs ADDED
@@ -0,0 +1,173 @@
1
+ #!/usr/bin/env node
2
+ import cac from 'cac';
3
+ import ansis from 'ansis';
4
+ import { z as diagnoseMcpConfig, A as isWindows, B as readClaudeCodeConfig, C as fixWindowsMcpConfig, D as writeClaudeCodeConfig, t as readCcgConfig, n as initI18n, u as showMainMenu, m as init, E as configMcp, F as version, l as i18n } from './shared/ccg-ros2-workflow.CpLJvcLP.mjs';
5
+ import 'inquirer';
6
+ import 'node:child_process';
7
+ import 'node:util';
8
+ import 'node:os';
9
+ import 'pathe';
10
+ import 'fs-extra';
11
+ import 'node:url';
12
+ import 'i18next';
13
+ import 'ora';
14
+ import 'smol-toml';
15
+
16
+ async function diagnoseMcp() {
17
+ console.log();
18
+ console.log(ansis.cyan.bold(" \u{1F50D} MCP Configuration Diagnostics"));
19
+ console.log();
20
+ const issues = await diagnoseMcpConfig();
21
+ console.log(ansis.bold(" Diagnostic Results:"));
22
+ console.log();
23
+ for (const issue of issues) {
24
+ if (issue.startsWith("\u2705")) {
25
+ console.log(ansis.green(` ${issue}`));
26
+ } else if (issue.startsWith("\u26A0\uFE0F")) {
27
+ console.log(ansis.yellow(` ${issue}`));
28
+ } else if (issue.startsWith("\u274C")) {
29
+ console.log(ansis.red(` ${issue}`));
30
+ } else {
31
+ console.log(` ${issue}`);
32
+ }
33
+ }
34
+ if (isWindows() && issues.some((i) => i.includes("not properly wrapped"))) {
35
+ console.log();
36
+ console.log(ansis.yellow(" \u{1F4A1} Tip: Run the following command to fix Windows MCP configuration:"));
37
+ console.log(ansis.gray(" npx ccg fix-mcp"));
38
+ }
39
+ console.log();
40
+ }
41
+ async function fixMcp() {
42
+ console.log();
43
+ console.log(ansis.cyan.bold(" \u{1F527} Fixing MCP Configuration"));
44
+ console.log();
45
+ if (!isWindows()) {
46
+ console.log(ansis.yellow(" \u26A0\uFE0F This command is only needed on Windows"));
47
+ console.log();
48
+ return;
49
+ }
50
+ try {
51
+ const config = await readClaudeCodeConfig();
52
+ if (!config) {
53
+ console.log(ansis.red(" \u274C No ~/.claude.json found"));
54
+ console.log();
55
+ return;
56
+ }
57
+ if (!config.mcpServers || Object.keys(config.mcpServers).length === 0) {
58
+ console.log(ansis.yellow(" \u26A0\uFE0F No MCP servers configured"));
59
+ console.log();
60
+ return;
61
+ }
62
+ const fixedConfig = fixWindowsMcpConfig(config);
63
+ await writeClaudeCodeConfig(fixedConfig);
64
+ console.log(ansis.green(" \u2705 Windows MCP configuration fixed"));
65
+ console.log();
66
+ console.log(ansis.gray(" Run diagnostics again to verify:"));
67
+ console.log(ansis.gray(" npx ccg diagnose-mcp"));
68
+ console.log();
69
+ } catch (error) {
70
+ console.log(ansis.red(` \u274C Failed to fix MCP configuration: ${error}`));
71
+ console.log();
72
+ }
73
+ }
74
+
75
+ function customizeHelp(sections) {
76
+ sections.unshift({
77
+ title: "",
78
+ body: ansis.cyan.bold(`CCG-ROS2 - Claude + Codex + Gemini v${version}`)
79
+ });
80
+ sections.push({
81
+ title: ansis.yellow(i18n.t("cli:help.commands")),
82
+ body: [
83
+ ` ${ansis.cyan("ccg")} ${i18n.t("cli:help.commandDescriptions.showMenu")}`,
84
+ ` ${ansis.cyan("ccg init")} | ${ansis.cyan("i")} ${i18n.t("cli:help.commandDescriptions.initConfig")}`,
85
+ ` ${ansis.cyan("ccg config mcp")} \u914D\u7F6E ace-tool MCP Token`,
86
+ ` ${ansis.cyan("ccg diagnose-mcp")} \u8BCA\u65AD MCP \u914D\u7F6E\u95EE\u9898`,
87
+ ` ${ansis.cyan("ccg fix-mcp")} \u4FEE\u590D Windows MCP \u914D\u7F6E`,
88
+ "",
89
+ ansis.gray(` ${i18n.t("cli:help.shortcuts")}`),
90
+ ` ${ansis.cyan("ccg i")} ${i18n.t("cli:help.shortcutDescriptions.quickInit")}`
91
+ ].join("\n")
92
+ });
93
+ sections.push({
94
+ title: ansis.yellow(i18n.t("cli:help.options")),
95
+ body: [
96
+ ` ${ansis.green("--lang, -l")} <lang> ${i18n.t("cli:help.optionDescriptions.displayLanguage")} (zh-CN, en)`,
97
+ ` ${ansis.green("--force, -f")} ${i18n.t("cli:help.optionDescriptions.forceOverwrite")}`,
98
+ ` ${ansis.green("--help, -h")} ${i18n.t("cli:help.optionDescriptions.displayHelp")}`,
99
+ ` ${ansis.green("--version, -v")} ${i18n.t("cli:help.optionDescriptions.displayVersion")}`,
100
+ "",
101
+ ansis.gray(` ${i18n.t("cli:help.nonInteractiveMode")}`),
102
+ ` ${ansis.green("--skip-prompt, -s")} ${i18n.t("cli:help.optionDescriptions.skipAllPrompts")}`,
103
+ ` ${ansis.green("--frontend, -F")} <models> ${i18n.t("cli:help.optionDescriptions.frontendModels")}`,
104
+ ` ${ansis.green("--backend, -B")} <models> ${i18n.t("cli:help.optionDescriptions.backendModels")}`,
105
+ ` ${ansis.green("--mode, -m")} <mode> ${i18n.t("cli:help.optionDescriptions.collaborationMode")}`,
106
+ ` ${ansis.green("--workflows, -w")} <list> ${i18n.t("cli:help.optionDescriptions.workflows")}`,
107
+ ` ${ansis.green("--install-dir, -d")} <path> ${i18n.t("cli:help.optionDescriptions.installDir")}`
108
+ ].join("\n")
109
+ });
110
+ sections.push({
111
+ title: ansis.yellow(i18n.t("cli:help.examples")),
112
+ body: [
113
+ ansis.gray(` # ${i18n.t("cli:help.exampleDescriptions.showInteractiveMenu")}`),
114
+ ` ${ansis.cyan("npx ccg")}`,
115
+ "",
116
+ ansis.gray(` # ${i18n.t("cli:help.exampleDescriptions.runFullInitialization")}`),
117
+ ` ${ansis.cyan("npx ccg init")}`,
118
+ ` ${ansis.cyan("npx ccg i")}`,
119
+ "",
120
+ ansis.gray(` # ${i18n.t("cli:help.exampleDescriptions.customModels")}`),
121
+ ` ${ansis.cyan("npx ccg i --frontend gemini,codex --backend codex,gemini")}`,
122
+ "",
123
+ ansis.gray(` # ${i18n.t("cli:help.exampleDescriptions.parallelMode")}`),
124
+ ` ${ansis.cyan("npx ccg i --mode parallel")}`,
125
+ ""
126
+ ].join("\n")
127
+ });
128
+ return sections;
129
+ }
130
+ async function setupCommands(cli) {
131
+ try {
132
+ const config = await readCcgConfig();
133
+ const defaultLang = config?.general?.language || "zh-CN";
134
+ await initI18n(defaultLang);
135
+ } catch {
136
+ await initI18n("zh-CN");
137
+ }
138
+ cli.command("", "\u663E\u793A\u4EA4\u4E92\u5F0F\u83DC\u5355\uFF08\u9ED8\u8BA4\uFF09").option("--lang, -l <lang>", "\u663E\u793A\u8BED\u8A00 (zh-CN, en)").action(async (options) => {
139
+ if (options.lang) {
140
+ await initI18n(options.lang);
141
+ }
142
+ await showMainMenu();
143
+ });
144
+ cli.command("init", "\u521D\u59CB\u5316 CCG-ROS2 \u591A\u6A21\u578B\u534F\u4F5C\u7CFB\u7EDF").alias("i").option("--lang, -l <lang>", "\u663E\u793A\u8BED\u8A00 (zh-CN, en)").option("--force, -f", "\u5F3A\u5236\u8986\u76D6\u73B0\u6709\u914D\u7F6E").option("--skip-prompt, -s", "\u8DF3\u8FC7\u6240\u6709\u4EA4\u4E92\u5F0F\u63D0\u793A\uFF08\u975E\u4EA4\u4E92\u6A21\u5F0F\uFF09").option("--skip-mcp", "\u8DF3\u8FC7 MCP \u914D\u7F6E\uFF08\u66F4\u65B0\u65F6\u4F7F\u7528\uFF09").option("--frontend, -F <models>", "\u4E0A\u5C42\u5E94\u7528\u6A21\u578B\uFF08\u9017\u53F7\u5206\u9694: gemini,codex,claude\uFF09").option("--backend, -B <models>", "\u5E95\u5C42\u63A7\u5236\u6A21\u578B\uFF08\u9017\u53F7\u5206\u9694: codex,gemini,claude\uFF09").option("--mode, -m <mode>", "\u534F\u4F5C\u6A21\u5F0F (parallel, smart, sequential)").option("--workflows, -w <workflows>", '\u8981\u5B89\u88C5\u7684\u5DE5\u4F5C\u6D41\uFF08\u9017\u53F7\u5206\u9694\u6216 "all"\uFF09').option("--install-dir, -d <path>", "\u5B89\u88C5\u76EE\u5F55\uFF08\u9ED8\u8BA4: ~/.claude\uFF09").action(async (options) => {
145
+ if (options.lang) {
146
+ await initI18n(options.lang);
147
+ }
148
+ await init(options);
149
+ });
150
+ cli.command("diagnose-mcp", "\u8BCA\u65AD MCP \u914D\u7F6E\u95EE\u9898").action(async () => {
151
+ await diagnoseMcp();
152
+ });
153
+ cli.command("fix-mcp", "\u4FEE\u590D Windows MCP \u914D\u7F6E\u95EE\u9898").action(async () => {
154
+ await fixMcp();
155
+ });
156
+ cli.command("config <subcommand>", "\u914D\u7F6E CCG \u8BBE\u7F6E").action(async (subcommand) => {
157
+ if (subcommand === "mcp") {
158
+ await configMcp();
159
+ } else {
160
+ console.log(ansis.red(`\u672A\u77E5\u5B50\u547D\u4EE4: ${subcommand}`));
161
+ console.log(ansis.gray("\u53EF\u7528\u5B50\u547D\u4EE4: mcp"));
162
+ }
163
+ });
164
+ cli.help((sections) => customizeHelp(sections));
165
+ cli.version(version);
166
+ }
167
+
168
+ async function main() {
169
+ const cli = cac("ccg");
170
+ await setupCommands(cli);
171
+ cli.parse();
172
+ }
173
+ main().catch(console.error);