@hunyed15/codecgc 0.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 (128) hide show
  1. package/.claude/hooks/route-edit.ps1 +86 -0
  2. package/INSTALLATION.md +550 -0
  3. package/LICENSE +21 -0
  4. package/README.md +171 -0
  5. package/bin/cgc-build.js +4 -0
  6. package/bin/cgc-doctor.js +4 -0
  7. package/bin/cgc-entry.js +4 -0
  8. package/bin/cgc-external-audit.js +4 -0
  9. package/bin/cgc-fix.js +4 -0
  10. package/bin/cgc-history.js +4 -0
  11. package/bin/cgc-install.js +4 -0
  12. package/bin/cgc-lifecycle.js +4 -0
  13. package/bin/cgc-package-audit.js +4 -0
  14. package/bin/cgc-plan.js +4 -0
  15. package/bin/cgc-release-readiness.js +4 -0
  16. package/bin/cgc-review.js +4 -0
  17. package/bin/cgc-route.js +4 -0
  18. package/bin/cgc-status.js +4 -0
  19. package/bin/cgc-test.js +4 -0
  20. package/bin/cgc.js +4 -0
  21. package/bin/codecgc.js +1284 -0
  22. package/codecgc/cgc/SKILL.md +46 -0
  23. package/codecgc/cgc-arch/SKILL.md +61 -0
  24. package/codecgc/cgc-build/SKILL.md +53 -0
  25. package/codecgc/cgc-decide/SKILL.md +55 -0
  26. package/codecgc/cgc-fix/SKILL.md +47 -0
  27. package/codecgc/cgc-learn/SKILL.md +46 -0
  28. package/codecgc/cgc-onboard/SKILL.md +52 -0
  29. package/codecgc/cgc-plan/SKILL.md +48 -0
  30. package/codecgc/cgc-refactor/SKILL.md +46 -0
  31. package/codecgc/cgc-req/SKILL.md +61 -0
  32. package/codecgc/cgc-review/SKILL.md +57 -0
  33. package/codecgc/cgc-roadmap/SKILL.md +55 -0
  34. package/codecgc/cgc-test/SKILL.md +21 -0
  35. package/codecgc/reference/api-cgc-review-libdoc.md +13 -0
  36. package/codecgc/reference/artifact-class-policy.md +81 -0
  37. package/codecgc/reference/build-flow.md +95 -0
  38. package/codecgc/reference/checklist-contract.md +103 -0
  39. package/codecgc/reference/execution-audit.md +121 -0
  40. package/codecgc/reference/execution-model.md +118 -0
  41. package/codecgc/reference/execution-routing.md +130 -0
  42. package/codecgc/reference/executor-contract.md +87 -0
  43. package/codecgc/reference/external-capability-registry.json +104 -0
  44. package/codecgc/reference/fix-flow.md +94 -0
  45. package/codecgc/reference/fixture-governance.md +60 -0
  46. package/codecgc/reference/flow-execution.md +65 -0
  47. package/codecgc/reference/lifecycle-map.md +172 -0
  48. package/codecgc/reference/lifecycle-playbook.md +104 -0
  49. package/codecgc/reference/long-lived-artifacts.md +98 -0
  50. package/codecgc/reference/operation-guide.md +242 -0
  51. package/codecgc/reference/release-maintenance-playbook.md +150 -0
  52. package/codecgc/reference/review-writeback.md +141 -0
  53. package/codecgc/reference/role-model.md +128 -0
  54. package/codecgc/reference/runtime-boundary.md +72 -0
  55. package/codecgc/reference/shared-conventions.md +93 -0
  56. package/codecgc/reference/workflow-scaffold.md +57 -0
  57. package/codexmcp/LICENSE +21 -0
  58. package/codexmcp/README.md +294 -0
  59. package/codexmcp/pyproject.toml +37 -0
  60. package/codexmcp/src/codexmcp/__init__.py +4 -0
  61. package/codexmcp/src/codexmcp/cli.py +12 -0
  62. package/codexmcp/src/codexmcp/server.py +529 -0
  63. package/geminimcp/README.md +258 -0
  64. package/geminimcp/pyproject.toml +15 -0
  65. package/geminimcp/src/geminimcp/__init__.py +4 -0
  66. package/geminimcp/src/geminimcp/cli.py +12 -0
  67. package/geminimcp/src/geminimcp/server.py +465 -0
  68. package/model-routing.yaml +30 -0
  69. package/package.json +90 -0
  70. package/requirements.txt +1 -0
  71. package/scripts/README-codecgc-cli.md +89 -0
  72. package/scripts/audit_codecgc_external_capabilities.py +276 -0
  73. package/scripts/audit_codecgc_historical_audits.py +242 -0
  74. package/scripts/audit_codecgc_lifecycle.py +241 -0
  75. package/scripts/audit_codecgc_package_runtime.py +445 -0
  76. package/scripts/audit_codecgc_release_readiness.py +202 -0
  77. package/scripts/audit_codecgc_review_policy.py +82 -0
  78. package/scripts/audit_codecgc_workflow_history.py +317 -0
  79. package/scripts/build_codecgc_task.py +487 -0
  80. package/scripts/codecgc_artifact_roots.py +40 -0
  81. package/scripts/codecgc_cli.py +843 -0
  82. package/scripts/codecgc_command_surface.py +28 -0
  83. package/scripts/codecgc_console_io.py +45 -0
  84. package/scripts/codecgc_executor_registry.py +54 -0
  85. package/scripts/codecgc_file_evidence.py +349 -0
  86. package/scripts/codecgc_flow_control.py +233 -0
  87. package/scripts/codecgc_governance_dedupe.py +161 -0
  88. package/scripts/codecgc_plan_decision.py +103 -0
  89. package/scripts/codecgc_review_control.py +588 -0
  90. package/scripts/codecgc_roadmap_templates.py +149 -0
  91. package/scripts/codecgc_routing_paths.py +16 -0
  92. package/scripts/codecgc_routing_template.py +135 -0
  93. package/scripts/codecgc_runtime_paths.py +22 -0
  94. package/scripts/codecgc_session_recovery.py +44 -0
  95. package/scripts/codecgc_step_control.py +154 -0
  96. package/scripts/codecgc_workflow_runtime.py +63 -0
  97. package/scripts/codecgc_workflow_templates.py +437 -0
  98. package/scripts/entry_codecgc_workflow.py +3419 -0
  99. package/scripts/exercise_mcp_tools.py +109 -0
  100. package/scripts/expand_codecgc_roadmap.py +664 -0
  101. package/scripts/init_codecgc_roadmap.py +134 -0
  102. package/scripts/init_codecgc_workflow.py +207 -0
  103. package/scripts/install_codecgc.py +938 -0
  104. package/scripts/migrate_demo_workflows_to_fixtures.py +128 -0
  105. package/scripts/normalize_codecgc_audits.py +114 -0
  106. package/scripts/normalize_codecgc_governance_docs.py +79 -0
  107. package/scripts/normalize_codecgc_workflow_docs.py +269 -0
  108. package/scripts/plan_codecgc_workflow.py +970 -0
  109. package/scripts/refresh_codecgc_review_policy.py +223 -0
  110. package/scripts/review_codecgc_workflow.py +88 -0
  111. package/scripts/route_codecgc_workflow.py +671 -0
  112. package/scripts/run_codecgc_build.py +104 -0
  113. package/scripts/run_codecgc_fix.py +104 -0
  114. package/scripts/run_codecgc_flow_step.py +165 -0
  115. package/scripts/run_codecgc_task.py +410 -0
  116. package/scripts/run_codecgc_test.py +105 -0
  117. package/scripts/sync_codecgc_mcp_config.py +41 -0
  118. package/scripts/write_codecgc_architecture.py +78 -0
  119. package/scripts/write_codecgc_decision.py +83 -0
  120. package/scripts/write_codecgc_explore.py +118 -0
  121. package/scripts/write_codecgc_guide.py +141 -0
  122. package/scripts/write_codecgc_learning.py +87 -0
  123. package/scripts/write_codecgc_libdoc.py +140 -0
  124. package/scripts/write_codecgc_refactor.py +78 -0
  125. package/scripts/write_codecgc_requirement.py +78 -0
  126. package/scripts/write_codecgc_review.py +291 -0
  127. package/scripts/write_codecgc_roadmap.py +122 -0
  128. package/scripts/write_codecgc_trick.py +123 -0
@@ -0,0 +1,86 @@
1
+ $ErrorActionPreference = "Stop"
2
+
3
+ function Write-Deny($reason) {
4
+ $payload = @{
5
+ decision = "deny"
6
+ reason = $reason
7
+ } | ConvertTo-Json -Compress
8
+ [Console]::Out.Write($payload)
9
+ exit 0
10
+ }
11
+
12
+ function Write-Approve() {
13
+ exit 0
14
+ }
15
+
16
+ $inputJson = [Console]::In.ReadToEnd()
17
+ if ([string]::IsNullOrWhiteSpace($inputJson)) {
18
+ Write-Approve
19
+ }
20
+
21
+ $hookData = $inputJson | ConvertFrom-Json
22
+ $toolName = [string]$hookData.tool_name
23
+ if ($toolName -notin @("Edit", "Write")) {
24
+ Write-Approve
25
+ }
26
+
27
+ $toolInput = $hookData.tool_input
28
+ $filePath = ""
29
+
30
+ if ($toolInput.PSObject.Properties.Name -contains "file_path") {
31
+ $filePath = [string]$toolInput.file_path
32
+ } elseif ($toolInput.PSObject.Properties.Name -contains "path") {
33
+ $filePath = [string]$toolInput.path
34
+ }
35
+
36
+ if ([string]::IsNullOrWhiteSpace($filePath)) {
37
+ Write-Approve
38
+ }
39
+
40
+ $normalized = $filePath.Replace("\", "/").ToLower()
41
+
42
+ $backendHints = @(
43
+ "/apps/api/",
44
+ "/server/",
45
+ "/src/server/",
46
+ "/src/services/",
47
+ "/src/repositories/",
48
+ "/backend/"
49
+ )
50
+
51
+ $frontendHints = @(
52
+ "/apps/web/",
53
+ "/src/components/",
54
+ "/src/pages/",
55
+ "/src/app/",
56
+ "/src/styles/",
57
+ "/web/",
58
+ "/frontend/"
59
+ )
60
+
61
+ $sharedHints = @(
62
+ "/packages/shared/",
63
+ "/src/shared/",
64
+ "/src/lib/",
65
+ "/src/types/"
66
+ )
67
+
68
+ foreach ($hint in $backendHints) {
69
+ if ($normalized.Contains($hint)) {
70
+ Write-Deny "CodeCGC: backend path is blocked for direct Claude editing; use Codex MCP."
71
+ }
72
+ }
73
+
74
+ foreach ($hint in $frontendHints) {
75
+ if ($normalized.Contains($hint)) {
76
+ Write-Deny "CodeCGC: frontend path is blocked for direct Claude editing; use Gemini MCP."
77
+ }
78
+ }
79
+
80
+ foreach ($hint in $sharedHints) {
81
+ if ($normalized.Contains($hint)) {
82
+ Write-Deny "CodeCGC: shared path is blocked for direct editing; split the task first."
83
+ }
84
+ }
85
+
86
+ Write-Approve
@@ -0,0 +1,550 @@
1
+ # CodeCGC 安装与使用指南
2
+
3
+ ## 目录
4
+
5
+ 1. [系统要求](#系统要求)
6
+ 2. [安装 CodeCGC](#安装-codecgc)
7
+ 3. [安装 Python 依赖](#安装-python-依赖)
8
+ 4. [安装 MCP 服务器](#安装-mcp-服务器)
9
+ 5. [初始化项目](#初始化项目)
10
+ 6. [验证安装](#验证安装)
11
+ 7. [快速开始](#快速开始)
12
+ 8. [常见问题](#常见问题)
13
+
14
+ ---
15
+
16
+ ## 系统要求
17
+
18
+ ### 必需环境
19
+
20
+ - **Node.js**: >= 20.0.0
21
+ - **Python**: >= 3.10
22
+ - **npm**: >= 9.0.0 (随 Node.js 安装)
23
+ - **操作系统**: Windows 10+, macOS 10.15+, Linux (Ubuntu 20.04+)
24
+
25
+ ### 检查当前环境
26
+
27
+ ```bash
28
+ node --version # 应显示 v20.x.x 或更高
29
+ python --version # 应显示 Python 3.10.x 或更高
30
+ npm --version # 应显示 9.x.x 或更高
31
+ ```
32
+
33
+ ---
34
+
35
+ ## 安装 CodeCGC
36
+
37
+ ### 方式 1:从源码全局安装(推荐)
38
+
39
+ ```bash
40
+ # 1. 解压 release 包到本地目录
41
+ cd /path/to/codecgc/release
42
+
43
+ # 2. 全局安装
44
+ npm install -g .
45
+ ```
46
+
47
+ 安装后,以下命令将全局可用:
48
+ - `cgc`
49
+ - `cgc-install`
50
+ - `cgc-status`
51
+ - `cgc-doctor`
52
+ - `cgc-plan`
53
+ - `cgc-build`
54
+ - `cgc-fix`
55
+ - `cgc-test`
56
+ - `cgc-review`
57
+ - `cgc-route`
58
+ - 等等...
59
+
60
+ ### 方式 2:从源码本地安装
61
+
62
+ ```bash
63
+ # 1. 进入您的项目目录
64
+ cd your-project
65
+
66
+ # 2. 安装 CodeCGC(指向 release 目录)
67
+ npm install /path/to/codecgc/release
68
+ ```
69
+
70
+ 使用时需要通过 `npx` 调用:
71
+ ```bash
72
+ npx cgc --help
73
+ npx cgc-install
74
+ ```
75
+
76
+ ### 方式 3:直接使用(无需安装)
77
+
78
+ ```bash
79
+ # 进入 release 目录
80
+ cd /path/to/codecgc/release
81
+
82
+ # 直接运行命令
83
+ node bin/cgc.js --help
84
+ node bin/cgc-install.js
85
+ ```
86
+
87
+ ### 验证安装
88
+
89
+ ```bash
90
+ cgc --version
91
+ cgc --help
92
+ ```
93
+
94
+ **注意**: 如果使用方式 2 或方式 3,需要将 `/path/to/codecgc/release` 替换为实际的 release 目录路径。
95
+
96
+ ---
97
+
98
+ ## 安装 Python 依赖
99
+
100
+ CodeCGC 的 Python 脚本需要以下依赖:
101
+
102
+ ### 核心依赖
103
+
104
+ ```bash
105
+ pip install pyyaml>=6.0
106
+ ```
107
+
108
+ ### 开发依赖(可选,用于运行测试)
109
+
110
+ ```bash
111
+ pip install -r requirements-dev.txt
112
+ ```
113
+
114
+ `requirements-dev.txt` 内容:
115
+ ```
116
+ pytest>=8.0.0
117
+ pytest-cov>=4.1.0
118
+ pyyaml>=6.0
119
+ ```
120
+
121
+ ### 一键安装所有依赖
122
+
123
+ 在 CodeCGC 项目根目录执行:
124
+
125
+ ```bash
126
+ pip install -r requirements.txt
127
+ ```
128
+
129
+ ---
130
+
131
+ ## 安装 MCP 服务器
132
+
133
+ CodeCGC 依赖两个 MCP 服务器来执行代码:
134
+
135
+ ### 1. Codex MCP(后端执行器)
136
+
137
+ **位置**: `codexmcp/` 目录
138
+
139
+ **安装步骤**:
140
+
141
+ ```bash
142
+ cd codexmcp
143
+ pip install -e .
144
+ ```
145
+
146
+ **验证安装**:
147
+
148
+ ```bash
149
+ python -m codexmcp.server --help
150
+ ```
151
+
152
+ **功能**: 执行后端代码任务(Python, Go, Rust, Java 等)
153
+
154
+ ---
155
+
156
+ ### 2. Gemini MCP(前端执行器)
157
+
158
+ **位置**: `geminimcp/` 目录
159
+
160
+ **安装步骤**:
161
+
162
+ ```bash
163
+ cd geminimcp
164
+ pip install -e .
165
+ ```
166
+
167
+ **验证安装**:
168
+
169
+ ```bash
170
+ python -m geminimcp.server --help
171
+ ```
172
+
173
+ **功能**: 执行前端代码任务(TypeScript, React, Vue 等)
174
+
175
+ ---
176
+
177
+ ### MCP 服务器配置
178
+
179
+ CodeCGC 会自动在项目中生成 `.mcp.json` 配置文件:
180
+
181
+ ```json
182
+ {
183
+ "mcpServers": {
184
+ "codexmcp": {
185
+ "command": "python",
186
+ "args": ["-m", "codexmcp.server"],
187
+ "env": {}
188
+ },
189
+ "geminimcp": {
190
+ "command": "python",
191
+ "args": ["-m", "geminimcp.server"],
192
+ "env": {}
193
+ }
194
+ }
195
+ }
196
+ ```
197
+
198
+ **注意**: 如果 Python 命令在您的系统上是 `python3`,请手动修改 `command` 字段。
199
+
200
+ ---
201
+
202
+ ## 初始化项目
203
+
204
+ ### 1. 进入您的项目目录
205
+
206
+ ```bash
207
+ cd /path/to/your/project
208
+ ```
209
+
210
+ ### 2. 运行安装命令
211
+
212
+ ```bash
213
+ cgc-install
214
+ ```
215
+
216
+ 这会创建以下文件和目录:
217
+
218
+ ```
219
+ your-project/
220
+ ├── .claude/
221
+ │ ├── hooks/
222
+ │ │ └── route-edit.ps1 # 路由钩子(阻止 Claude 直接编辑代码)
223
+ │ └── settings.json # Claude 配置
224
+ ├── .mcp.json # MCP 服务器注册
225
+ ├── model-routing.yaml # 路由规则配置
226
+ └── codecgc/ # 工作流产物存储
227
+ ├── product/
228
+ │ ├── feature/ # 功能开发工作流
229
+ │ ├── issue/ # Bug 修复工作流
230
+ │ └── execution/ # 执行审计记录
231
+ ├── architecture/ # 架构文档
232
+ ├── requirements/ # 需求文档
233
+ ├── decisions/ # 技术决策
234
+ ├── learnings/ # 经验总结
235
+ └── roadmap/ # 路线图
236
+ ```
237
+
238
+ ### 3. 配置路由规则
239
+
240
+ 编辑 `model-routing.yaml`,定义前端和后端的文件路径模式:
241
+
242
+ ```yaml
243
+ # 前端文件路径模式
244
+ frontend_paths:
245
+ - "src/components/**"
246
+ - "src/pages/**"
247
+ - "src/ui/**"
248
+ - "*.tsx"
249
+ - "*.jsx"
250
+ - "*.vue"
251
+
252
+ # 后端文件路径模式
253
+ backend_paths:
254
+ - "src/api/**"
255
+ - "src/server/**"
256
+ - "src/db/**"
257
+ - "*.py"
258
+ - "*.go"
259
+ - "*.java"
260
+
261
+ # 共享路径(需要特殊处理)
262
+ shared_paths:
263
+ - "src/types/**"
264
+ - "src/utils/**"
265
+
266
+ # 路由规则
267
+ rules:
268
+ frontend_executor: geminimcp # 前端使用 Gemini
269
+ backend_executor: codexmcp # 后端使用 Codex
270
+ shared_policy: split-first # 共享文件优先拆分
271
+ claude_role: plan-review-accept-only # Claude 只规划和审查
272
+ ```
273
+
274
+ ---
275
+
276
+ ## 验证安装
277
+
278
+ ### 1. 检查环境
279
+
280
+ ```bash
281
+ cgc-doctor
282
+ ```
283
+
284
+ **预期输出**:
285
+ ```
286
+ ✓ Python 可用: python 3.10.x
287
+ ✓ Codex MCP 可导入
288
+ ✓ Gemini MCP 可导入
289
+ ✓ 项目集成就绪
290
+ ✓ .mcp.json 存在
291
+ ✓ model-routing.yaml 存在
292
+ ```
293
+
294
+ ### 2. 检查项目状态
295
+
296
+ ```bash
297
+ cgc-status
298
+ ```
299
+
300
+ **预期输出**:
301
+ ```
302
+ 项目集成状态: 就绪
303
+ 工作流目录: codecgc/
304
+ MCP 配置: .mcp.json
305
+ 路由配置: model-routing.yaml
306
+ ```
307
+
308
+ ### 3. 运行测试(可选)
309
+
310
+ ```bash
311
+ cd /path/to/codecgc
312
+ pytest tests/ -v
313
+ ```
314
+
315
+ ---
316
+
317
+ ## 快速开始
318
+
319
+ ### 示例 1:新增功能
320
+
321
+ ```bash
322
+ # 1. 提交需求
323
+ cgc "新增用户登录页面,包含用户名密码输入框和登录按钮"
324
+
325
+ # 2. 系统自动生成规划
326
+ # 输出: 已创建 feature 工作流 2026-05-04-user-login-page
327
+
328
+ # 3. 查看生成的文件
329
+ ls codecgc/product/feature/2026-05-04-user-login-page/
330
+ # - 2026-05-04-user-login-page-design.md
331
+ # - 2026-05-04-user-login-page-checklist.yaml
332
+
333
+ # 4. 执行第一个步骤
334
+ cgc-build --slug 2026-05-04-user-login-page
335
+
336
+ # 5. 审查执行结果
337
+ cgc-review --audit-file codecgc/product/execution/.../xxx.json --decision accepted
338
+
339
+ # 6. 继续执行后续步骤
340
+ cgc-build --slug 2026-05-04-user-login-page
341
+
342
+ # 7. 查询下一步
343
+ cgc-route --slug 2026-05-04-user-login-page
344
+ ```
345
+
346
+ ### 示例 2:修复 Bug
347
+
348
+ ```bash
349
+ # 1. 提交问题
350
+ cgc "用户列表页面加载很慢,需要优化"
351
+
352
+ # 2. 系统自动生成 issue 工作流
353
+ # 输出: 已创建 issue 工作流 2026-05-04-slow-user-list
354
+
355
+ # 3. 执行修复
356
+ cgc-fix --slug 2026-05-04-slow-user-list
357
+
358
+ # 4. 审查修复结果
359
+ cgc-review --audit-file ... --decision accepted
360
+ ```
361
+
362
+ ### 示例 3:查看历史
363
+
364
+ ```bash
365
+ # 查看所有开放的功能工作流
366
+ cgc-history --flow feature --status open
367
+
368
+ # 查看最近 10 个工作流
369
+ cgc-history --last 10
370
+
371
+ # 查看项目生命周期
372
+ cgc-lifecycle
373
+ ```
374
+
375
+ ---
376
+
377
+ ## 常见问题
378
+
379
+ ### Q1: `cgc` 命令找不到
380
+
381
+ **原因**: 全局安装失败或 npm 全局路径未加入 PATH
382
+
383
+ **解决**:
384
+ ```bash
385
+ # 检查全局安装路径
386
+ npm config get prefix
387
+
388
+ # 将该路径添加到系统 PATH
389
+ # Windows: 添加到环境变量
390
+ # macOS/Linux: 添加到 ~/.bashrc 或 ~/.zshrc
391
+ export PATH="$PATH:$(npm config get prefix)/bin"
392
+ ```
393
+
394
+ ### Q2: `ModuleNotFoundError: No module named 'yaml'`
395
+
396
+ **原因**: PyYAML 未安装
397
+
398
+ **解决**:
399
+ ```bash
400
+ pip install pyyaml
401
+ ```
402
+
403
+ ### Q3: MCP 服务器无法启动
404
+
405
+ **原因**: MCP 服务器未正确安装
406
+
407
+ **解决**:
408
+ ```bash
409
+ # 重新安装 Codex MCP
410
+ cd codexmcp
411
+ pip uninstall codexmcp -y
412
+ pip install -e .
413
+
414
+ # 重新安装 Gemini MCP
415
+ cd geminimcp
416
+ pip uninstall geminimcp -y
417
+ pip install -e .
418
+
419
+ # 验证
420
+ python -m codexmcp.server --help
421
+ python -m geminimcp.server --help
422
+ ```
423
+
424
+ ### Q4: `cgc-doctor` 报告 Python 不可用
425
+
426
+ **原因**: Python 命令名称不匹配
427
+
428
+ **解决**:
429
+ ```bash
430
+ # 如果您的系统使用 python3
431
+ which python3
432
+
433
+ # 创建软链接或别名
434
+ # Linux/macOS:
435
+ sudo ln -s $(which python3) /usr/local/bin/python
436
+
437
+ # Windows: 在 .mcp.json 中修改 command 为 "python3"
438
+ ```
439
+
440
+ ### Q5: 执行步骤时超时
441
+
442
+ **原因**: 默认 120 秒超时不够
443
+
444
+ **解决**: 在 checklist.yaml 中为该步骤指定更长的超时
445
+ ```yaml
446
+ steps:
447
+ - action: "复杂重构任务"
448
+ status: pending
449
+ codecgc:
450
+ kind: backend
451
+ task_summary: "重构认证模块"
452
+ target_paths: ["src/auth/"]
453
+ timeout_seconds: 600 # 10 分钟
454
+ ```
455
+
456
+ ### Q6: 路由规则不生效
457
+
458
+ **原因**: `model-routing.yaml` 格式错误或路径模式不匹配
459
+
460
+ **解决**:
461
+ ```bash
462
+ # 检查 YAML 语法
463
+ python -c "import yaml; yaml.safe_load(open('model-routing.yaml'))"
464
+
465
+ # 测试路径匹配
466
+ cgc-route --slug your-workflow-slug
467
+ ```
468
+
469
+ ### Q7: 如何卸载 CodeCGC
470
+
471
+ ```bash
472
+ # 卸载全局包
473
+ npm uninstall -g codecgc
474
+
475
+ # 卸载 MCP 服务器
476
+ pip uninstall codexmcp geminimcp -y
477
+
478
+ # 删除项目集成文件(可选)
479
+ rm -rf .claude .mcp.json model-routing.yaml codecgc/
480
+ ```
481
+
482
+ ---
483
+
484
+ ## 进阶配置
485
+
486
+ ### 自定义执行器沙箱模式
487
+
488
+ 在 checklist.yaml 中为每个步骤指定沙箱策略:
489
+
490
+ ```yaml
491
+ steps:
492
+ - action: "只读分析"
493
+ codecgc:
494
+ kind: backend
495
+ codex_sandbox: read-only # 只读模式
496
+
497
+ - action: "工作区写入"
498
+ codecgc:
499
+ kind: backend
500
+ codex_sandbox: workspace-write # 可写工作区
501
+
502
+ - action: "完全访问"
503
+ codecgc:
504
+ kind: backend
505
+ codex_sandbox: danger-full-access # 完全访问(危险)
506
+ ```
507
+
508
+ ### 保持执行器会话
509
+
510
+ 通过 `session_id` 在多个步骤间保持上下文:
511
+
512
+ ```yaml
513
+ steps:
514
+ - action: "步骤 1"
515
+ codecgc:
516
+ kind: backend
517
+ session_id: my-session-123
518
+
519
+ - action: "步骤 2"
520
+ codecgc:
521
+ kind: backend
522
+ session_id: my-session-123 # 复用同一会话
523
+ ```
524
+
525
+ ### 获取完整执行日志
526
+
527
+ ```yaml
528
+ steps:
529
+ - action: "调试任务"
530
+ codecgc:
531
+ kind: backend
532
+ return_all_messages: true # 返回完整消息历史
533
+ ```
534
+
535
+ ---
536
+
537
+ ## 技术支持
538
+
539
+ - **GitHub Issues**: https://github.com/hunyed15/CodeCGC/issues
540
+ - **文档**: 查看 `codecgc/` 目录下的参考文档
541
+ - **审计报告**: `codecgc/architecture/code-audit-2026-05-04.md`
542
+
543
+ ---
544
+
545
+ ## 版本信息
546
+
547
+ - **CodeCGC 版本**: 0.1.0
548
+ - **最后更新**: 2026-05-04
549
+ - **Python 要求**: >= 3.10
550
+ - **Node.js 要求**: >= 20.0.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CodeCGC
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.