@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,128 @@
1
+ # CodeCGC 角色模型
2
+
3
+ ## 1. 目的
4
+
5
+ CodeCGC 故意把三个模型放在不同角色上。
6
+
7
+ 它们不是三个平级程序员,也不是谁都可以随意接管谁的工作。
8
+ 它们是在同一条交付系统里承担不同责任的 owner。
9
+
10
+ ## 2. 核心定位
11
+
12
+ ### Claude
13
+
14
+ Claude 是工作流总控。
15
+
16
+ Claude 负责:
17
+
18
+ - 需求澄清
19
+ - 范围定义
20
+ - roadmap 拆解
21
+ - 架构设计
22
+ - 接口约束
23
+ - 任务拆分
24
+ - 执行器选择
25
+ - 审核判断
26
+ - 验收判断
27
+ - 产物回写
28
+ - 发布就绪判断
29
+
30
+ Claude 不负责直接编写前端或后端业务代码。
31
+
32
+ ### Gemini
33
+
34
+ Gemini 是前端实现 owner。
35
+
36
+ Gemini 负责:
37
+
38
+ - 页面与组件实现
39
+ - 样式与交互改动
40
+ - 前端状态管理变更
41
+ - 前端 bug 修复
42
+ - 前端测试
43
+ - 浏览器可见行为修正
44
+ - 可访问性与 UI 正确性检查
45
+
46
+ Gemini 不负责后端业务逻辑。
47
+
48
+ ### Codex
49
+
50
+ Codex 是后端实现 owner。
51
+
52
+ Codex 负责:
53
+
54
+ - 服务与 API 实现
55
+ - 仓储与持久化改动
56
+ - 后端业务逻辑
57
+ - 后端 bug 修复
58
+ - 后端测试
59
+ - 脚本与自动化
60
+ - 后端执行链路调试
61
+ - 偏工程化的 CI 或基础设施代码任务
62
+
63
+ Codex 不负责前端 UI 行为。
64
+
65
+ ## 3. Claude 不只是“规划器”
66
+
67
+ Claude 不能被缩减成只会写 plan 的角色。
68
+
69
+ 更准确地说,Claude 同时接近下面几类职责:
70
+
71
+ - 产品经理
72
+ - 架构师
73
+ - 技术负责人
74
+ - 项目经理
75
+ - reviewer
76
+ - acceptance owner
77
+
78
+ 一句话概括:
79
+
80
+ Claude 是整个系统的工作流操盘手。
81
+
82
+ ## 4. 归属规则
83
+
84
+ 每一个会改代码的步骤,都必须且只能有一个实现 owner:
85
+
86
+ - 前端步骤 -> Gemini
87
+ - 后端步骤 -> Codex
88
+
89
+ 如果一个步骤没有明确 owner,这个步骤就还没 ready,Claude 必须先拆分或重设计。
90
+
91
+ ## 5. Shared Scope 规则
92
+
93
+ shared scope 不是第三个写代码的人。
94
+
95
+ 它通常意味着三种情况之一:
96
+
97
+ 1. 前端共享工作
98
+ 2. 后端共享工作
99
+ 3. 真正跨边界的工作
100
+
101
+ 其中:
102
+
103
+ - 前端共享工作仍然归 Gemini
104
+ - 后端共享工作仍然归 Codex
105
+ - 真正跨边界的工作先归 Claude 做拆分与契约控制,再拆成可执行子步骤
106
+
107
+ ## 6. 升级判断规则
108
+
109
+ 当执行结果存在不确定性时,下一步由 Claude 决定:
110
+
111
+ - 通过
112
+ - 追加一个更小的修复步骤
113
+ - 拆出新的跟进工作
114
+ - 回到设计
115
+ - 回到 roadmap
116
+
117
+ Gemini 和 Codex 的责任是执行 scoped work。
118
+ Claude 的责任是决定这些工作是否已经足够。
119
+
120
+ ## 7. 产品原则
121
+
122
+ CodeCGC 不是“三个模型自由协作”。
123
+
124
+ 它是一套受控工作流:
125
+
126
+ - Claude 是控制器
127
+ - Gemini 是前端执行器
128
+ - Codex 是后端执行器
@@ -0,0 +1,72 @@
1
+ # CodeCGC 运行时边界
2
+
3
+ ## 1. 目的
4
+
5
+ 这份文档用来区分“真实运行时产物”和“示例 / 校验用 fixture”。
6
+
7
+ 这个边界很重要,因为 `route / build / fix / review` 会把 `codecgc/` 下的文件当成真实工作流状态来消费。
8
+
9
+ ## 2. 真实运行时目录
10
+
11
+ 下面这些目录属于当前活跃产品状态:
12
+
13
+ - `codecgc/features/`
14
+ - `codecgc/issues/`
15
+ - `codecgc/execution/`
16
+
17
+ 下面这些目录属于 fixture 校验根:
18
+
19
+ - `codecgc/fixtures/features/`
20
+ - `codecgc/fixtures/issues/`
21
+ - `codecgc/fixtures/execution/`
22
+
23
+ fixture 不只是“示例文本”,它们同样会参与本地回归与行为验证,因此不能随便混放。
24
+
25
+ ## 3. fixture 风险
26
+
27
+ 在本地开发阶段,一些 demo 或校验文件可能长期存在。
28
+
29
+ 这可以接受,但必须遵守一条规则:
30
+
31
+ - 校验必须是串行且显式的
32
+
33
+ 不要假设 `codecgc/execution/` 里最新的 audit 一定对应当前工作流。
34
+ 所有控制逻辑都必须按精确步骤身份匹配。
35
+
36
+ ## 4. 当前控制规则
37
+
38
+ 当前运行时遵守下面这些规则:
39
+
40
+ - `route` 只检查当前 `pending` 的可执行步骤
41
+ - audit 必须按精确 `task_id` 匹配
42
+ - review 必须按精确 `task_id` 与 `step_number` 匹配
43
+ - `artifact_class` 会从工作流产物继续传递到 audit 元数据
44
+ - `dry-run` audit 只是预演证据
45
+ - 只有非 `dry-run` 且成功 `done` 的执行结果,才算 review-ready
46
+
47
+ ## 5. 操作建议
48
+
49
+ 当你在校验一个 fixture 工作流时,建议顺序是:
50
+
51
+ 1. 先看 checklist 或 fix 文件
52
+ 2. 确认当前哪一步是 `pending`
53
+ 3. 只检查与该步骤匹配的 audit
54
+ 4. 再运行 `route`
55
+ 5. 然后运行 `build` 或 `fix`
56
+ 6. 真实执行完成后再写 review
57
+
58
+ ## 6. 持续清理方向
59
+
60
+ 当前 fixtures 已经有目录级隔离,但后续仍应继续收口:
61
+
62
+ - 让长期产品示例与临时校验文件分得更清楚
63
+ - 保持 `artifact_class` 作为机器意图标记
64
+ - 继续规范历史 audit 路径
65
+
66
+ 如果历史 audit 里还保留旧仓库名或旧执行根,可使用:
67
+
68
+ - `python scripts/normalize_codecgc_audits.py`
69
+
70
+ 如果历史 demo 工作流还混在活跃目录里,可使用:
71
+
72
+ - `python scripts/migrate_demo_workflows_to_fixtures.py`
@@ -0,0 +1,93 @@
1
+ # CodeCGC 共享约定
2
+
3
+ ## 1. 适用范围
4
+
5
+ 这份文档定义 CodeCGC 的产品层通用约定。
6
+
7
+ 当前固定角色分工是:
8
+
9
+ - Claude:规划、拆分、路由、审核、验收
10
+ - Gemini:前端实现
11
+ - Codex:后端实现
12
+
13
+ 如果某项设计或实现与这套分工冲突,应优先怀疑该设计是否偏离了 CodeCGC 蓝图。
14
+
15
+ ## 2. 目录模型
16
+
17
+ 当前活跃运行时根目录是 `codecgc/`。
18
+
19
+ 主要目录职责如下:
20
+
21
+ - `codecgc/reference/`:参考说明与契约
22
+ - `codecgc/cgc*`:技能定义
23
+ - `codecgc/features/`:功能开发工作流产物
24
+ - `codecgc/issues/`:问题修复工作流产物
25
+ - `codecgc/execution/`:执行审计产物
26
+ - `codecgc/requirements/`、`architecture/`、`roadmap/`、`compound/`:长期项目记忆
27
+ - `scripts/`:任务打包、运行时控制与 MCP 桥接
28
+
29
+ ## 3. 产品级硬规则
30
+
31
+ 所有代码改动步骤都必须遵守下面这些规则:
32
+
33
+ - 前端范围必须交给 Gemini
34
+ - 后端范围必须交给 Codex
35
+ - shared 范围必须先拆分
36
+ - Claude 不直接写受路由保护的业务代码
37
+
38
+ 这套规则通过两层落地:
39
+
40
+ 1. 工作流层:`cgc-build` 与 `cgc-fix`
41
+ 2. guardrail 层:`.claude/hooks/route-edit.ps1`
42
+
43
+ ## 4. 当前公开命令面
44
+
45
+ 当前对外公开命令面是:
46
+
47
+ - `cgc`
48
+ - `cgc-install`
49
+ - `cgc-entry`
50
+ - `cgc-plan`
51
+ - `cgc-build`
52
+ - `cgc-fix`
53
+ - `cgc-review`
54
+ - `cgc-route`
55
+ - `cgc-status`
56
+ - `cgc-doctor`
57
+ - `cgc-package-audit`
58
+
59
+ 其中:
60
+
61
+ - `cgc` 是产品总入口
62
+ - 其他命令是在阶段已明确时使用
63
+
64
+ 旧 `cs-*` 命令已经不属于 CodeCGC。
65
+
66
+ ## 5. 产物归档规则
67
+
68
+ 所有新的工作流产物都应归档到 `codecgc/` 下的正确目录。
69
+
70
+ 推荐的长期归档家族包括:
71
+
72
+ - `codecgc/requirements/`
73
+ - `codecgc/architecture/`
74
+ - `codecgc/roadmap/`
75
+ - `codecgc/features/`
76
+ - `codecgc/issues/`
77
+ - `codecgc/compound/`
78
+
79
+ 不要再把长期事实散落在旧命令体系或临时顶层文档中。
80
+
81
+ ## 6. 实现步骤最低要求
82
+
83
+ 任何会改代码的实现或修复步骤,都必须带有机器可执行的范围元数据。
84
+
85
+ 至少应定义:
86
+
87
+ - 目标类型:frontend 或 backend
88
+ - `target_paths`
89
+ - `task_summary`
90
+ - 硬约束
91
+ - 当前步骤的验收标准
92
+
93
+ 如果这些内容写不清楚,就说明步骤还没 ready,应该回到拆分或设计,而不是强行执行。
@@ -0,0 +1,57 @@
1
+ # CodeCGC 工作流骨架
2
+
3
+ ## 1. 目的
4
+
5
+ 这份文档定义 CodeCGC 在新工作开始时的最小产物骨架。
6
+
7
+ 当前创建入口:
8
+
9
+ - `scripts/init_codecgc_workflow.py`
10
+
11
+ ## 2. Feature 骨架
12
+
13
+ 初始化 feature 时会创建:
14
+
15
+ - `codecgc/features/YYYY-MM-DD-{slug}/{slug}-design.md`
16
+ - `codecgc/features/YYYY-MM-DD-{slug}/{slug}-checklist.yaml`
17
+ - `codecgc/features/YYYY-MM-DD-{slug}/{slug}-acceptance.md`
18
+
19
+ 默认情况下,checklist 会包含第一个 `codecgc` 步骤契约占位。
20
+
21
+ 如果规划阶段识别到前后端混合目标路径,checklist 可以扩展成多个可执行步骤,而不只保留单一占位步骤。
22
+
23
+ 如果规划阶段识别到共享路径或未知路径,也可以加入只用于规划澄清的步骤,这些步骤必须先被解决,后续才能执行。
24
+
25
+ 每个拆分后的可执行步骤,也可以拥有自己的:
26
+
27
+ - action label
28
+ - task summary
29
+ - acceptance lines
30
+
31
+ 这样执行器契约始终保持局部化,而不是依赖上层自由解释。
32
+
33
+ ## 3. Issue 骨架
34
+
35
+ 初始化 issue 时会创建:
36
+
37
+ - `codecgc/issues/YYYY-MM-DD-{slug}/{slug}-report.md`
38
+ - `codecgc/issues/YYYY-MM-DD-{slug}/{slug}-analysis.md`
39
+ - `codecgc/issues/YYYY-MM-DD-{slug}/{slug}-fix.yaml`
40
+ - `codecgc/issues/YYYY-MM-DD-{slug}/{slug}-fix-note.md`
41
+
42
+ 默认情况下,fix YAML 会包含第一个 `codecgc` 修复步骤契约占位。
43
+
44
+ 如果问题范围是混合的,也可以扩展成多个可执行修复步骤,并在必要时插入只用于规划澄清的步骤。
45
+
46
+ ## 4. 产品规则
47
+
48
+ feature 与 issue 产物都直接落在 `codecgc/` 运行时根目录下:
49
+
50
+ - feature 产物在 `codecgc/features/`
51
+ - issue 产物在 `codecgc/issues/`
52
+
53
+ ## 5. 规划规则
54
+
55
+ `cgc-plan` 应先创建工作流骨架,再由 `cgc-build` 或 `cgc-fix` 执行。
56
+
57
+ 执行层默认假设目录、步骤契约和基本骨架已经存在。
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 guda.studio
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.
@@ -0,0 +1,294 @@
1
+ ![这是图片](./images/title.png)
2
+
3
+ <div align="center">
4
+
5
+
6
+ **让 Claude Code 与 Codex 无缝协作**
7
+
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![Python Version](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/) [![MCP Compatible](https://img.shields.io/badge/MCP-Compatible-green.svg)](https://modelcontextprotocol.io)[![Share](https://img.shields.io/badge/share-000000?logo=x&logoColor=white)](https://x.com/intent/tweet?text=CodexMCP:让%20Claude%20Code%20与%20Codex%20无缝协作%20https://github.com/GuDaStudio/codexmcp%20%23AI%20%23Coding%20%23MCP) [![Share](https://img.shields.io/badge/share-1877F2?logo=facebook&logoColor=white)](https://www.facebook.com/sharer/sharer.php?u=https://github.com/GuDaStudio/codexmcp) [![Share](https://img.shields.io/badge/share-FF4500?logo=reddit&logoColor=white)](https://www.reddit.com/submit?title=CodexMCP:让%20Claude%20Code%20与%20Codex%20无缝协作&url=https://github.com/GuDaStudio/codexmcp) [![Share](https://img.shields.io/badge/share-0088CC?logo=telegram&logoColor=white)](https://t.me/share/url?url=https://github.com/GuDaStudio/codexmcp&text=CodexMCP:让%20Claude%20Code%20与%20Codex%20无缝协作)
9
+
10
+
11
+ ⭐ 在GitHub上给我们点星~您的支持对我们意义重大! 🙏😊
12
+
13
+ [English](./docs/README_EN.md) | 简体中文
14
+
15
+ </div>
16
+
17
+ ---
18
+
19
+ ## 一、项目简介
20
+
21
+ 在当前 AI 辅助编程生态中,**Claude Code** 擅长架构设计与全局思考,而 **Codex** 在代码生成与细节优化上表现卓越。**CodexMCP** 作为两者之间的桥梁,通过 MCP 协议让它们优势互补:
22
+
23
+ - **Claude Code**:负责需求分析、架构规划、代码重构
24
+ - **Codex**:负责算法实现、bug 定位、代码审查
25
+ - **CodexMCP**:管理会话上下文,支持多轮对话与并行任务
26
+
27
+ 相比官方 Codex MCP 实现,CodexMCP 引入了**会话持久化**、**并行执行**和**推理追踪**等企业级特性,让 AI 编程助手之间的协作更加智能高效。CodexMCP 与官方 Codex MCP 区别一览:
28
+
29
+
30
+ | 特性 | 官方版 | CodexMCP |
31
+ |------|--------|----------|
32
+ | 基本 Codex 调用 | √ | √ |
33
+ | 多轮对话 | × | √ |
34
+ | 推理详情追踪 | × | √ |
35
+ | 并行任务支持 | × | √ |
36
+ | 错误处理 | × | √ |
37
+
38
+
39
+ ---
40
+
41
+ ## 二、快速开始
42
+
43
+ ### 0. 前置要求
44
+
45
+ 请确保您已成功**安装**和**配置**claude code与codex两个编程工具。
46
+ - [Claude Code 安装指南](https://docs.claude.com/docs/claude-code)
47
+ - [Codex CLI 安装指南](https://developers.openai.com/codex/quickstart)
48
+
49
+ > [!IMPORTANT]
50
+ > 请确保您的claude code版本在v2.0.56以上;codex cli版本在v0.61.0以上!
51
+
52
+ 请确保您已成功安装[uv工具](https://docs.astral.sh/uv/getting-started/installation/):
53
+
54
+ - Windows
55
+ 在Powershell中运行以下命令:
56
+ ```
57
+ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
58
+ ```
59
+
60
+ - Linux/macOS
61
+ 使用curl/wget下载并安装:
62
+ ```
63
+ curl -LsSf https://astral.sh/uv/install.sh | sh #使用curl
64
+
65
+ wget -qO- https://astral.sh/uv/install.sh | sh #使用wget
66
+ ```
67
+
68
+ **注意,我们极力推荐Windows用户在WSL中运行本项目!**
69
+
70
+ <!-- 如果您正在为订阅和配置而忧愁,我们非常欢迎您[积极联系我们](https://cc.guda.studio)。 -->
71
+
72
+ ### 1. 安装步骤
73
+
74
+ **1.1** 移除官方 Codex MCP(如果已安装)。
75
+
76
+ ```bash
77
+ claude mcp remove codex
78
+ ```
79
+
80
+ **1.2** 安装 CodexMCP。
81
+
82
+ ```bash
83
+ claude mcp add codex -s user --transport stdio -- uvx --from git+https://github.com/GuDaStudio/codexmcp.git codexmcp
84
+ ```
85
+
86
+ **1.3** 验证安装。在 **终端** 中运行:
87
+
88
+ ```
89
+ claude mcp list
90
+ ```
91
+
92
+ > [!IMPORTANT]
93
+ > 如果看到如下描述,说明安装成功!
94
+ > `codex: uvx --from git+https://github.com/GuDaStudio/codexmcp.git codexmcp - ✓ Connected`
95
+
96
+ **1.4** 可选择默认允许claude code自动与codex交互,在`~/.claude/settings.json`添加 `mcp__codex__codex` allow项
97
+ ![](images/image.png)
98
+
99
+ ### 2. 配置claude code提示词(可选)
100
+
101
+ 为使claude code更好完成与codex的协同工作,我们**极力推荐您在 `~/.claude/CLAUDE.md`中添加以下内容**
102
+
103
+ <details>
104
+ <summary>展开查看prompt</summary>
105
+
106
+
107
+ ```
108
+ ## Core Instruction for CodeX MCP
109
+
110
+ 在任何时刻,你必须思考当前过程可以如何与codex进行协作,如何调用Codex 为你提供的MCP工具作为你客观全面分析的保障。
111
+ 其中你**务必执行**以下几个步骤:
112
+ **1** 在你对用户需求形成初步分析后,将用户需求、初始思路告知codex,并要求其完善需求分析和实施计划。
113
+ **2** 在实施具体编码任务前,**必须向codex索要代码实现原型(要求codex仅给出unified diff patch,严禁对代码做任何真实修改)**。在获取代码原型后,你**只能以此为逻辑参考,再次对代码修改进行重写**,形成企业生产级别、可读性极高、可维护性极高的代码后,才能实施具体编程修改任务。
114
+ **3** 无论何时,只要完成切实编码行为后,**必须立即使用codex review代码改动和对应需求完成程度**。
115
+ **4** codex只能给出参考,你**必须有自己的思考,甚至需要对codex的回答提出置疑**。尽信书则不如无书,你与codex的最终使命都是达成统一、全面、精准的意见,所以你们必须不断争辩已找到通向真理的唯一途径。
116
+
117
+
118
+ ## Codex Tool Invocation Specification
119
+
120
+ 1. 工具概述
121
+
122
+ codex MCP 提供了一个工具 `codex`,用于执行 AI 辅助的编码任务。该工具**通过 MCP 协议调用**,无需使用命令行。
123
+
124
+ 2. 工具参数
125
+
126
+ **必选**参数:
127
+ - PROMPT (string): 发送给 codex 的任务指令
128
+ - cd (Path): codex 执行任务的工作目录根路径
129
+
130
+ 可选参数:
131
+ - sandbox (string): 沙箱策略,可选值:
132
+ - "read-only" (默认): 只读模式,最安全
133
+ - "workspace-write": 允许在工作区写入
134
+ - "danger-full-access": 完全访问权限
135
+ - SESSION_ID (UUID | null): 用于继续之前的会话以与codex进行多轮交互,默认为 None(开启新会话)
136
+ - skip_git_repo_check (boolean): 是否允许在非 Git 仓库中运行,默认 False
137
+ - return_all_messages (boolean): 是否返回所有消息(包括推理、工具调用等),默认 False
138
+ - image (List[Path] | null): 附加一个或多个图片文件到初始提示词,默认为 None
139
+ - model (string | null): 指定使用的模型,默认为 None(使用用户默认配置)
140
+ - yolo (boolean | null): 无需审批运行所有命令(跳过沙箱),默认 False
141
+ - profile (string | null): 从 `~/.codex/config.toml` 加载的配置文件名称,默认为 None(使用用户默认配置)
142
+
143
+ 返回值:
144
+ {
145
+ "success": true,
146
+ "SESSION_ID": "uuid-string",
147
+ "agent_messages": "agent回复的文本内容",
148
+ "all_messages": [] // 仅当 return_all_messages=True 时包含
149
+ }
150
+ 或失败时:
151
+ {
152
+ "success": false,
153
+ "error": "错误信息"
154
+ }
155
+
156
+ 3. 使用方式
157
+
158
+ 开启新对话:
159
+ - 不传 SESSION_ID 参数(或传 None)
160
+ - 工具会返回新的 SESSION_ID 用于后续对话
161
+
162
+ 继续之前的对话:
163
+ - 将之前返回的 SESSION_ID 作为参数传入
164
+ - 同一会话的上下文会被保留
165
+
166
+ 4. 调用规范
167
+
168
+ **必须遵守**:
169
+ - 每次调用 codex 工具时,必须保存返回的 SESSION_ID,以便后续继续对话
170
+ - cd 参数必须指向存在的目录,否则工具会静默失败
171
+ - 严禁codex对代码进行实际修改,使用 sandbox="read-only" 以避免意外,并要求codex仅给出unified diff patch即可
172
+
173
+ 推荐用法:
174
+ - 如需详细追踪 codex 的推理过程和工具调用,设置 return_all_messages=True
175
+ - 对于精准定位、debug、代码原型快速编写等任务,优先使用 codex 工具
176
+
177
+ 5. 注意事项
178
+
179
+ - 会话管理:始终追踪 SESSION_ID,避免会话混乱
180
+ - 工作目录:确保 cd 参数指向正确且存在的目录
181
+ - 错误处理:检查返回值的 success 字段,处理可能的错误
182
+
183
+ ```
184
+
185
+ </details>
186
+
187
+
188
+
189
+ ---
190
+
191
+ ## 三、工具说明
192
+
193
+ <details>
194
+ <summary>点击查看codex工具参数说明</summary>
195
+
196
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
197
+ |------|------|------|--------|------|
198
+ | `PROMPT` | `str` | ✅ | - | 发送给 Codex 的任务指令 |
199
+ | `cd` | `Path` | ✅ | - | Codex 工作目录根路径 |
200
+ | `sandbox` | `Literal` | ❌ | `"read-only"` | 沙箱策略:`read-only` / `workspace-write` / `danger-full-access` |
201
+ | `SESSION_ID` | `UUID \| None` | ❌ | `None` | 会话 ID(None 则开启新会话) |
202
+ | `skip_git_repo_check` | `bool` | ❌ | `False` | 是否允许在非 Git 仓库运行 |
203
+ | `return_all_messages` | `bool` | ❌ | `False` | 是否返回完整推理信息 |
204
+ | `image` | `List[Path] \| None` | ❌ | `None` | 附加图片文件到初始提示词 |
205
+ | `model` | `str \| None` | ❌ | `None` | 指定使用的模型(默认使用用户配置) |
206
+ | `yolo` | `bool \| None` | ❌ | `False` | 无需审批运行所有命令(跳过沙箱) |
207
+ | `profile` | `str \| None` | ❌ | `None` | 从 `~/.codex/config.toml` 加载的配置文件名称 |
208
+
209
+ </details>
210
+
211
+ <details>
212
+ <summary>点击查看codex工具返回值结构</summary>
213
+
214
+ **成功时:**
215
+ ```json
216
+ {
217
+ "success": true,
218
+ "SESSION_ID": "550e8400-e29b-41d4-a716-446655440000",
219
+ "agent_messages": "Codex 的回复内容...",
220
+ "all_messages": [...] // 仅当 return_all_messages=True 时包含
221
+ }
222
+ ```
223
+
224
+ **失败时:**
225
+ ```json
226
+ {
227
+ "success": false,
228
+ "error": "错误信息描述"
229
+ }
230
+ ```
231
+
232
+ </details>
233
+
234
+ ---
235
+
236
+ ## 四、FAQ
237
+
238
+ <details>
239
+ <summary>Q1: 是否需要额外付费?</summary>
240
+
241
+ **CodexMCP 本身完全免费开源,无需任何额外付费!**
242
+
243
+ </details>
244
+
245
+ <details>
246
+ <summary>Q2: 并行调用会冲突吗?</summary>
247
+
248
+ 不会。每个调用使用独立的 `SESSION_ID`,完全隔离。
249
+
250
+ </details>
251
+
252
+
253
+ ---
254
+
255
+ ## 🤝 贡献指南
256
+
257
+ <details>
258
+ <summary>我们欢迎所有形式的贡献!</summary>
259
+
260
+ ### 开发环境配置
261
+
262
+ ```bash
263
+ # 克隆仓库
264
+ git clone https://github.com/GuDaStudio/codexmcp.git
265
+ cd codexmcp
266
+
267
+ # 安装依赖
268
+ uv sync
269
+ ```
270
+
271
+ ### 提交规范
272
+
273
+ - 遵循 [Conventional Commits](https://www.conventionalcommits.org/)
274
+ - 提交测试用例
275
+ - 更新文档
276
+
277
+ </details>
278
+
279
+
280
+
281
+ ---
282
+
283
+ ## 📄 许可证
284
+
285
+ 本项目采用 [MIT License](LICENSE) 开源协议。
286
+ Copyright (c) 2025 [guda.studio](mailto:gudaclaude@gmail.com)
287
+
288
+ ---
289
+ <div align="center">
290
+
291
+ ## 用 🌟 为本项目助力~
292
+ [![Star History Chart](https://api.star-history.com/svg?repos=GuDaStudio/codexmcp&type=date&legend=top-left)](https://www.star-history.com/#GuDaStudio/codexmcp&type=date&legend=top-left)
293
+
294
+ </div>
@@ -0,0 +1,37 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.25"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "codexmcp"
7
+ version = "0.7.4"
8
+ description = "FastMCP server wrapping the Codex CLI."
9
+ readme = "README.md"
10
+ requires-python = ">=3.12"
11
+ dependencies = [
12
+ "mcp[cli]>=1.20.0",
13
+ "pydantic>=2.0",
14
+ ]
15
+ authors = [
16
+ { name = "guda.studio", email = "gudaclaude@gmail.com" },
17
+ ]
18
+ license = { text = "MIT" }
19
+ keywords = ["mcp", "fastmcp", "codex"]
20
+ classifiers = [
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.12",
23
+ "License :: OSI Approved :: MIT License",
24
+ "Operating System :: OS Independent",
25
+ ]
26
+
27
+ [project.urls]
28
+ Homepage = "https://github.com/GuDaStudio/codexmcp"
29
+
30
+ [project.scripts]
31
+ codexmcp = "codexmcp.cli:main"
32
+
33
+ [tool.hatch.build.targets.wheel]
34
+ packages = ["src/codexmcp"]
35
+
36
+ [tool.hatch.build.targets.sdist]
37
+ include = ["src/codexmcp", "README.md", "LICENSE"]