@hunyed15/codecgc 0.1.12 → 0.2.1

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 (53) hide show
  1. package/README.md +53 -5
  2. package/bin/{cgc-install.js → cgc-init.js} +1 -1
  3. package/bin/codecgc.js +22 -27
  4. package/codecgc/cgc/SKILL.md +1 -1
  5. package/codecgc/cgc-arch/SKILL.md +1 -1
  6. package/codecgc/cgc-onboard/SKILL.md +1 -1
  7. package/codecgc/reference/README.md +2 -2
  8. package/codecgc/reference/mcp-tool-surface.md +1 -0
  9. package/codecgc/reference/onboarding.md +7 -7
  10. package/codecgc/reference/operation-guide.md +4 -4
  11. package/codecgc/reference/path-contract.md +1 -1
  12. package/codecgc/reference/policy-routing.md +2 -2
  13. package/codecgc/reference/project-structure.md +6 -5
  14. package/codecgc/reference/quickstart.md +3 -3
  15. package/codecgc/reference/real-workflow-loop.md +1 -1
  16. package/codecgc/reference/shared-conventions.md +8 -1
  17. package/codecgc/reference/troubleshooting.md +2 -10
  18. package/codecgc/roadmap/codecgc-release-maintenance/delivery-plan.md +2 -3
  19. package/codecgc/roadmap/codecgc-release-maintenance/overview.md +1 -1
  20. package/codecgc/roadmap/codecgc-release-maintenance/phases.md +1 -1
  21. package/codecgc/templates/project/claude/hooks/route-edit.ps1 +87 -0
  22. package/codecgc/templates/{claude → project/claude}/settings.local.json +1 -8
  23. package/codecgc/templates/project/model-routing.yaml +60 -0
  24. package/{codecgcmcp → mcp/codecgcmcp}/src/codecgcmcp/server.py +2 -9
  25. package/model-routing.yaml +0 -1
  26. package/package.json +12 -13
  27. package/scripts/audit_codecgc_external_capabilities.py +1 -1
  28. package/scripts/audit_codecgc_package_runtime.py +18 -16
  29. package/scripts/audit_codecgc_release_readiness.py +1 -1
  30. package/scripts/codecgc_runtime/executor_registry.py +2 -2
  31. package/scripts/codecgc_runtime/mcp_config.py +2 -2
  32. package/scripts/codecgc_runtime/routing_template.py +0 -1
  33. package/scripts/exercise_mcp_tools.py +2 -2
  34. package/scripts/install_codecgc.py +37 -292
  35. package/scripts/postinstall_codecgc.js +1 -1
  36. package/INSTALLATION.md +0 -211
  37. package/codexmcp/LICENSE +0 -21
  38. package/codexmcp/README.md +0 -294
  39. package/codexmcp/pyproject.toml +0 -37
  40. package/geminimcp/README.md +0 -258
  41. package/geminimcp/pyproject.toml +0 -15
  42. /package/codecgc/templates/{codex → project/codex}/codecgcrc.json +0 -0
  43. /package/codecgc/templates/{gemini → project/gemini/policies}/codecgc-policy.toml +0 -0
  44. /package/{codecgcmcp → mcp/codecgcmcp}/README.md +0 -0
  45. /package/{codecgcmcp → mcp/codecgcmcp}/pyproject.toml +0 -0
  46. /package/{codecgcmcp → mcp/codecgcmcp}/src/codecgcmcp/__init__.py +0 -0
  47. /package/{codecgcmcp → mcp/codecgcmcp}/src/codecgcmcp/cli.py +0 -0
  48. /package/{codexmcp → mcp/codexmcp}/src/codexmcp/__init__.py +0 -0
  49. /package/{codexmcp → mcp/codexmcp}/src/codexmcp/cli.py +0 -0
  50. /package/{codexmcp → mcp/codexmcp}/src/codexmcp/server.py +0 -0
  51. /package/{geminimcp → mcp/geminimcp}/src/geminimcp/__init__.py +0 -0
  52. /package/{geminimcp → mcp/geminimcp}/src/geminimcp/cli.py +0 -0
  53. /package/{geminimcp → mcp/geminimcp}/src/geminimcp/server.py +0 -0
package/README.md CHANGED
@@ -16,6 +16,13 @@ CLI 仍然保留,用于本地调试、CI 检查和 MCP 不可用时的回退
16
16
 
17
17
  安全边界:Claude 可以维护需求、规划、文档、审查和工作流状态;产品代码实现必须经由 CodeCGC 路由到 Codex 或 Gemini。项目 hook 会拦截 `Edit`、`Write`、`MultiEdit`、`Bash` 和 `PowerShell`,防止 Claude 用直接编辑或 shell 写入绕过路由。
18
18
 
19
+ ## 环境要求
20
+
21
+ - Node.js >= 20
22
+ - npm >= 9
23
+ - Python >= 3.10
24
+ - 可选:Claude Code、Codex CLI、Gemini CLI
25
+
19
26
  ## 安装
20
27
 
21
28
  全局安装 CLI:
@@ -30,7 +37,7 @@ npm install -g @hunyed15/codecgc --registry=https://registry.npmjs.org/
30
37
 
31
38
  ```bash
32
39
  cd your-project
33
- cgc-install
40
+ cgc-init
34
41
  cgc-start
35
42
  cgc-status
36
43
  cgc-doctor
@@ -39,17 +46,17 @@ cgc-doctor
39
46
  在 Claude 中可以使用对应 slash command:
40
47
 
41
48
  ```text
42
- /cgc-install
49
+ /cgc-init
43
50
  /cgc-start
44
51
  /cgc-status
45
52
  /cgc-doctor
46
53
  ```
47
54
 
48
- `/cgc-install` 和 `cgc-install` 默认都是项目级安装。它们会把集成文件写入当前项目,而不是写入 `~/.claude`。只有用户显式请求 user 模式时,才会处理用户级 Claude 集成。
55
+ `/cgc-init` 和 `cgc-init` 默认都是项目级安装。它们会把集成文件写入当前项目,不会写入 `~/.claude` 等全局目录。
49
56
 
50
57
  ## 安装后生成的项目文件
51
58
 
52
- `cgc-install` 会在目标项目中创建或同步:
59
+ `cgc-init` 会在目标项目中创建或同步:
53
60
 
54
61
  ```text
55
62
  .mcp.json
@@ -150,7 +157,7 @@ cgc-external-audit
150
157
 
151
158
  ```bash
152
159
  python -m pytest tests --basetemp D:\tmp\codecgc-pytest
153
- python -m compileall -q scripts codecgcmcp\src codexmcp\src geminimcp\src
160
+ python -m compileall -q scripts mcp\codecgcmcp\src mcp\codexmcp\src mcp\geminimcp\src
154
161
  python scripts\audit_codecgc_package_runtime.py --format json
155
162
  python scripts\audit_codecgc_release_readiness.py --format json
156
163
  npm pack --dry-run --json
@@ -165,6 +172,47 @@ set CODECGC_RELEASE_PROBE_ROOT=D:\tmp
165
172
  python scripts\audit_codecgc_release_readiness.py --format json
166
173
  ```
167
174
 
175
+ ## 常见问题
176
+
177
+ ### `cgc` 命令找不到
178
+
179
+ 确认 npm 全局 bin 目录已加入 `PATH`:
180
+
181
+ ```bash
182
+ npm config get prefix
183
+ ```
184
+
185
+ 然后检查对应系统的全局 bin 路径是否在环境变量中。
186
+
187
+ ### `cgc-doctor` 提示 Python 或 MCP 依赖缺失
188
+
189
+ 先确认 Python 可用:
190
+
191
+ ```bash
192
+ python --version
193
+ ```
194
+
195
+ 再安装核心依赖:
196
+
197
+ ```bash
198
+ python -m pip install -r requirements.txt
199
+ ```
200
+
201
+ 如果是在源码开发环境中,可以按 `cgc-doctor` 输出的建议执行 editable install。
202
+
203
+ ### 项目级集成缺失或过期
204
+
205
+ 在目标项目根目录重新执行:
206
+
207
+ ```bash
208
+ cgc-init
209
+ cgc-status
210
+ ```
211
+
212
+ ### 写入被 hook 拦截
213
+
214
+ 检查 `model-routing.yaml`。如果目标路径属于 unknown 或 shared,应该先明确文件归属或拆分任务,而不是绕过 hook。
215
+
168
216
  ## 参考文档
169
217
 
170
218
  - [快速开始](codecgc/reference/quickstart.md)
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- process.env.CODECGC_BIN_NAME = "cgc-install";
3
+ process.env.CODECGC_BIN_NAME = "cgc-init";
4
4
  require("./codecgc.js");
package/bin/codecgc.js CHANGED
@@ -42,7 +42,7 @@ const helpText = `CodeCGC 命令入口
42
42
  cgc --latest
43
43
  cgc --slug <workflow-slug>
44
44
  cgc-start [--format json|summary] [--workspace <dir>]
45
- cgc-install [--mode local|user-dry-run|user|status|doctor|start] [--workspace <dir>] [--user-root <dir>]
45
+ cgc-init [--mode local|status|doctor|start] [--workspace <dir>]
46
46
  cgc-status [--format json|summary]
47
47
  cgc-doctor [--format json|summary]
48
48
  cgc-package-audit [--format json|summary]
@@ -81,7 +81,7 @@ const helpText = `CodeCGC 命令入口
81
81
  我只想让 CodeCGC 告诉我下一步该跑哪个命令
82
82
  cgc-route ...
83
83
  我想把 CodeCGC 安装或重新同步到当前项目
84
- cgc-install
84
+ cgc-init
85
85
  我刚装完,想看当前项目下一步怎么开始
86
86
  cgc-start
87
87
  我想知道集成面现在是否就绪
@@ -107,7 +107,7 @@ const helpText = `CodeCGC 命令入口
107
107
 
108
108
  命令职责:
109
109
  cgc-start 显示当前项目的首次使用入口和下一步动作
110
- cgc-install 同步项目级或用户级集成面
110
+ cgc-init 同步项目级集成面
111
111
  cgc-status 检查集成是否就绪,并给出下一步
112
112
  cgc-doctor 检查运行前置、执行器导入与项目集成状态
113
113
  cgc-package-audit 检查发布包是否覆盖运行时依赖
@@ -126,7 +126,7 @@ const helpText = `CodeCGC 命令入口
126
126
  version 输出当前产品壳版本
127
127
 
128
128
  首次使用:
129
- 1. 先在目标项目根目录执行 cgc-install
129
+ 1. 先在目标项目根目录执行 cgc-init
130
130
  2. 执行 cgc-start 查看项目本地入口说明
131
131
  3. 再执行 cgc-status,必要时补 cgc-doctor
132
132
  4. 然后直接使用 cgc "<自然语言需求>" 或 cgc-entry
@@ -147,7 +147,7 @@ const helpText = `CodeCGC 命令入口
147
147
  cgc-test --flow feature --slug 2026-05-01-demo-login-ui --step-number 2 --dry-run
148
148
  cgc-review --audit-file codecgc/execution/demo-login-ui-step-1.json --decision accepted
149
149
  cgc-route --flow feature --slug 2026-05-01-demo-login-ui
150
- cgc-install
150
+ cgc-init
151
151
  cgc-status
152
152
  cgc-status --format summary
153
153
  cgc-doctor --format summary
@@ -157,8 +157,7 @@ const helpText = `CodeCGC 命令入口
157
157
  cgc-release-readiness --format summary
158
158
  cgc-lifecycle --format summary
159
159
  cgc-history --status open --last 10
160
- cgc-install --mode user-dry-run --user-root C:\\Users\\Admin\\.claude
161
- cgc-install --workspace D:\\Projects\\MyApp
160
+ cgc-init --workspace D:\\Projects\\MyApp
162
161
  cgc-entry --request "新增一个登录页面,放在 src/components/LoginForm.tsx"
163
162
 
164
163
  环境变量:
@@ -185,7 +184,7 @@ const startHelpText = `CodeCGC Start
185
184
  summary 用于新手入口摘要,json 用于调试或自动化消费。
186
185
 
187
186
  推荐用法:
188
- cgc-install
187
+ cgc-init
189
188
  cgc-start
190
189
  cgc-status
191
190
  cgc-doctor
@@ -195,7 +194,7 @@ const startHelpText = `CodeCGC Start
195
194
  const installHelpText = `CodeCGC 安装与自检
196
195
 
197
196
  用法:
198
- cgc-install [--mode <local|user-dry-run|user|status|doctor|start>] [--workspace <dir>] [--user-root <dir>] [--format <json|summary>]
197
+ cgc-init [--mode <local|status|doctor|start>] [--workspace <dir>] [--format <json|summary>]
199
198
 
200
199
  用途:
201
200
  准备、检查或修复 CodeCGC 在 Claude 与 MCP 启动链路上的集成面。
@@ -203,12 +202,8 @@ const installHelpText = `CodeCGC 安装与自检
203
202
  模式:
204
203
  local
205
204
  把项目级 .mcp.json、.claude/settings.json 与 route-edit.ps1 hook 同步到目标工作区。
206
- user-dry-run
207
- 只预演用户级 Claude 集成,不写入文件。
208
- user
209
- 把用户级 Claude 集成写入指定的 Claude 根目录。
210
205
  status
211
- 检查项目级集成是否就绪,并附带用户级集成预览状态。
206
+ 检查项目级集成是否就绪。
212
207
  doctor
213
208
  检查运行前置、执行器可导入性,以及项目级集成是否就绪。
214
209
  start
@@ -217,19 +212,16 @@ const installHelpText = `CodeCGC 安装与自检
217
212
  主要参数:
218
213
  --workspace <dir>
219
214
  local/status/doctor 模式下的目标项目根目录。默认使用当前 shell 所在目录。
220
- --user-root <dir>
221
- user 与 user-dry-run 模式下显式指定 Claude 用户目录。
222
215
  --format <json|summary>
223
216
  面向 Claude 或人工阅读时建议使用 summary;排查底层细节时用 json。
224
217
 
225
218
  推荐用法:
226
- cgc-install
219
+ cgc-init
227
220
  cgc-start
228
- cgc-install --workspace D:\\Projects\\MyApp
229
- cgc-install --mode start --format summary
230
- cgc-install --mode status --format summary
231
- cgc-install --mode doctor --format summary
232
- cgc-install --mode user-dry-run --user-root C:\\Users\\Admin\\.claude
221
+ cgc-init --workspace D:\\Projects\\MyApp
222
+ cgc-init --mode start --format summary
223
+ cgc-init --mode status --format summary
224
+ cgc-init --mode doctor --format summary
233
225
 
234
226
  相关命令:
235
227
  cgc-start
@@ -274,7 +266,7 @@ const statusHelpText = `CodeCGC 安装状态
274
266
  相关命令:
275
267
  cgc-start
276
268
  查看当前项目首次使用入口。
277
- cgc-install
269
+ cgc-init
278
270
  同步或修复当前项目集成面。
279
271
  cgc-doctor
280
272
  检查运行前置、执行器导入和项目集成状态。
@@ -306,7 +298,7 @@ const doctorHelpText = `CodeCGC Doctor
306
298
  相关命令:
307
299
  cgc-status
308
300
  快速查看项目集成是否就绪。
309
- cgc-install
301
+ cgc-init
310
302
  同步或修复集成文件。
311
303
  cgc-package-audit
312
304
  检查发布包运行面与发布就绪状态。
@@ -333,7 +325,7 @@ const packageAuditHelpText = `CodeCGC 发布包审计
333
325
  cgc-package-audit --format json
334
326
 
335
327
  相关命令:
336
- cgc-install
328
+ cgc-init
337
329
  检查并同步当前项目的 Claude/MCP 集成面。
338
330
  cgc-status
339
331
  查看当前项目集成状态。
@@ -1109,10 +1101,13 @@ function normalizeWorkflowHelpText(rawText, subcommand) {
1109
1101
  .replaceAll("python scripts/codecgc_cli.py", "cgc");
1110
1102
  }
1111
1103
 
1104
+ const BINARY_ALIASES = { "cgc-init": "cgc-install" };
1105
+
1112
1106
  function resolveCommandInvocation(invokedName, rawArgs) {
1113
- if (DASH_COMMANDS.has(invokedName)) {
1107
+ const resolvedName = BINARY_ALIASES[invokedName] || invokedName;
1108
+ if (DASH_COMMANDS.has(resolvedName)) {
1114
1109
  return {
1115
- subcommand: invokedName.slice(4),
1110
+ subcommand: resolvedName.slice(4),
1116
1111
  rest: rawArgs,
1117
1112
  invokedAsRoot: false,
1118
1113
  };
@@ -20,7 +20,7 @@ Before answering:
20
20
 
21
21
  ## Route Table
22
22
 
23
- - installing or repairing CodeCGC in a repo: `cgc-install` and `cgc-onboard`
23
+ - installing or repairing CodeCGC in a repo: `cgc-init` and `cgc-onboard`
24
24
  - shaping or clarifying a request: `cgc-plan`
25
25
  - starting or continuing feature delivery: `cgc-build`
26
26
  - starting or continuing issue fixing: `cgc-fix`
@@ -26,7 +26,7 @@ Read:
26
26
  Then inspect:
27
27
 
28
28
  - accepted feature or issue artifacts related to the change
29
- - relevant files under `scripts/`, `bin/`, `.claude/`, `codexmcp/`, `geminimcp/`
29
+ - relevant files under `scripts/`, `bin/`, `.claude/`, `mcp/codexmcp/`, `mcp/geminimcp/`
30
30
  - existing docs under `codecgc/architecture/`
31
31
 
32
32
  ## What Belongs Here
@@ -42,7 +42,7 @@ Also inspect:
42
42
  After onboarding, the repo should be ready to use:
43
43
 
44
44
  - `cgc`
45
- - `cgc-install`
45
+ - `cgc-init`
46
46
  - `cgc-status`
47
47
  - `cgc-doctor`
48
48
  - `cgc-plan`
@@ -33,7 +33,7 @@ Claude /cgc -> CodeCGC MCP tool -> CodeCGC runtime -> Codex or Gemini executor
33
33
  The normal install path is:
34
34
 
35
35
  ```text
36
- npm global install -> project-local cgc-install -> cgc-start -> project .mcp.json / .claude / model-routing.yaml
36
+ npm global install -> project-local cgc-init -> cgc-start -> project .mcp.json / .claude / model-routing.yaml
37
37
  ```
38
38
 
39
39
  User-level Claude installation is optional and must be explicit.
@@ -43,7 +43,7 @@ User-level Claude installation is optional and must be explicit.
43
43
  The preferred Claude-facing commands are intentionally small:
44
44
 
45
45
  - `/cgc`
46
- - `/cgc-install`
46
+ - `/cgc-init`
47
47
  - `/cgc-status`
48
48
  - `/cgc-doctor`
49
49
  - `/cgc-review`
@@ -91,6 +91,7 @@ Runtime payloads may provide a more specific `error_category` or `failure_catego
91
91
  - `codecgc.test`
92
92
  - `codecgc.package_audit`
93
93
  - `codecgc.external_audit`
94
+ - `codecgc.external_status`
94
95
  - `codecgc.release_readiness`
95
96
  - `codecgc.lifecycle`
96
97
 
@@ -1,10 +1,10 @@
1
1
  # CodeCGC Onboarding
2
2
 
3
- This document defines the real-project entry experience after `cgc-install`.
3
+ This document defines the real-project entry experience after `cgc-init`.
4
4
 
5
5
  ## Contract
6
6
 
7
- `cgc-install` is project-local by default. After a successful install, a target project should contain:
7
+ `cgc-init` is project-local by default. After a successful install, a target project should contain:
8
8
 
9
9
  ```text
10
10
  codecgc/START_HERE.md
@@ -18,7 +18,7 @@ codecgc/START_HERE.md
18
18
  Inside Claude:
19
19
 
20
20
  ```text
21
- /cgc-install
21
+ /cgc-init
22
22
  /cgc-start
23
23
  /cgc-status
24
24
  /cgc-doctor
@@ -28,7 +28,7 @@ Inside Claude:
28
28
  Outside Claude:
29
29
 
30
30
  ```bash
31
- cgc-install
31
+ cgc-init
32
32
  cgc-start
33
33
  cgc-status
34
34
  cgc-doctor
@@ -42,13 +42,13 @@ cgc "新增一个登录页面,放在 src/components/LoginForm.tsx"
42
42
  - whether `codecgc/START_HERE.md` exists and matches the current onboarding contract
43
43
  - the project-local onboarding file path
44
44
  - the shortest next actions for Claude and CLI users
45
- - the fallback action when onboarding is missing, normally `/cgc-install` or `cgc-install`
45
+ - the fallback action when onboarding is missing, normally `/cgc-init` or `cgc-init`
46
46
 
47
47
  The CLI equivalent is `cgc-start`.
48
48
 
49
49
  ## Why This Exists
50
50
 
51
- Without an explicit first-run entry, new users can install successfully but still be unsure whether to use `/cgc`, `/cgc-install`, `cgc-plan`, `cgc-build`, or another lower-level command. The onboarding surface keeps ordinary users on the product path:
51
+ Without an explicit first-run entry, new users can install successfully but still be unsure whether to use `/cgc`, `/cgc-init`, `cgc-plan`, `cgc-build`, or another lower-level command. The onboarding surface keeps ordinary users on the product path:
52
52
 
53
53
  ```text
54
54
  install -> start -> status/doctor -> /cgc natural-language request
@@ -61,7 +61,7 @@ Maintainer commands remain available, but they should not be required for the fi
61
61
  If `cgc-start` reports missing onboarding, run:
62
62
 
63
63
  ```bash
64
- cgc-install
64
+ cgc-init
65
65
  ```
66
66
 
67
67
  If `cgc-status` reports `onboarding_file` as missing or outdated, the same repair action applies.
@@ -10,7 +10,7 @@ CodeCGC 的推荐用户入口是 Claude 内的 `/cgc`,背后优先调用 CodeC
10
10
 
11
11
  - `/cgc`
12
12
  - `/cgc-start`
13
- - `/cgc-install`
13
+ - `/cgc-init`
14
14
  - `/cgc-status`
15
15
  - `/cgc-doctor`
16
16
  - `/cgc-review`
@@ -30,7 +30,7 @@ CLI 命令继续保留,但主要用于本地调试、CI、维护和 MCP 不可
30
30
 
31
31
  如果你是第一次把 CodeCGC 接入某个项目,建议顺序是:
32
32
 
33
- 1. 在目标项目根目录运行 `cgc-install`
33
+ 1. 在目标项目根目录运行 `cgc-init`
34
34
  2. 运行 `cgc-start` 查看项目本地首次使用入口
35
35
  3. 运行 `cgc-status`,必要时再运行 `cgc-doctor`
36
36
  4. 在 Claude 中用 `/cgc <自然语言需求>` 开始
@@ -39,7 +39,7 @@ CLI 命令继续保留,但主要用于本地调试、CI、维护和 MCP 不可
39
39
  最小示例:
40
40
 
41
41
  ```bash
42
- cgc-install
42
+ cgc-init
43
43
  cgc-start
44
44
  cgc-status
45
45
  cgc "新增一个登录页面,放在 src/components/LoginForm.tsx"
@@ -48,7 +48,7 @@ cgc "新增一个登录页面,放在 src/components/LoginForm.tsx"
48
48
  如果当前 shell 目录不是目标项目根目录:
49
49
 
50
50
  ```bash
51
- cgc-install --workspace D:\Projects\MyApp
51
+ cgc-init --workspace D:\Projects\MyApp
52
52
  cgc-status --workspace D:\Projects\MyApp
53
53
  ```
54
54
 
@@ -37,7 +37,7 @@ Use project-relative paths for persisted product state, audits, fixtures, review
37
37
 
38
38
  ## Installer Responsibility
39
39
 
40
- `cgc-install` is responsible for writing machine-specific runtime paths into the target project integration files.
40
+ `cgc-init` is responsible for writing machine-specific runtime paths into the target project integration files.
41
41
 
42
42
  It should not hard-code paths from the development machine into reusable templates or persisted workflow artifacts.
43
43
 
@@ -34,10 +34,10 @@ Project install is the default integration path:
34
34
 
35
35
  ```bash
36
36
  cd your-project
37
- cgc-install
37
+ cgc-init
38
38
  ```
39
39
 
40
- This creates project-local `.mcp.json`, `.claude/`, `model-routing.yaml`, and the `codecgc/` workflow directories. User-level install modes are explicit escape hatches only.
40
+ This creates project-local `.mcp.json`, `.claude/`, `model-routing.yaml`, and the `codecgc/` workflow directories.
41
41
 
42
42
  ## Policy Checker
43
43
 
@@ -10,9 +10,10 @@ These files are source-controlled and ship with the npm package:
10
10
  bin/
11
11
  scripts/
12
12
  codecgc_runtime/
13
- codecgcmcp/
14
- codexmcp/
15
- geminimcp/
13
+ mcp/
14
+ codecgcmcp/
15
+ codexmcp/
16
+ geminimcp/
16
17
  codecgc/reference/
17
18
  codecgc/cgc*/
18
19
  .claude/hooks/route-edit.ps1
@@ -25,7 +26,7 @@ Package runtime files define commands, MCP servers, policy checking, and referen
25
26
 
26
27
  ## Source Repository Hygiene
27
28
 
28
- The source repository should not commit project-local install output. These files are generated by `cgc-install` and may contain machine-specific paths:
29
+ The source repository should not commit project-local install output. These files are generated by `cgc-init` and may contain machine-specific paths:
29
30
 
30
31
  ```text
31
32
  .mcp.json
@@ -48,7 +49,7 @@ Keep `codecgc/fixtures/`, `codecgc/reference/`, `codecgc/roadmap/`, and `codecgc
48
49
 
49
50
  ## Target Project Surface
50
51
 
51
- `cgc-install` creates or syncs these files in the target project:
52
+ `cgc-init` creates or syncs these files in the target project:
52
53
 
53
54
  ```text
54
55
  .mcp.json
@@ -18,13 +18,13 @@ Run project-local install from the target project root:
18
18
 
19
19
  ```bash
20
20
  cd your-project
21
- cgc-install
21
+ cgc-init
22
22
  cgc-start
23
23
  cgc-status
24
24
  cgc-doctor
25
25
  ```
26
26
 
27
- Inside Claude, use `/cgc-install` and then `/cgc-start` for the same project-local path.
27
+ Inside Claude, use `/cgc-init` and then `/cgc-start` for the same project-local path.
28
28
 
29
29
  The project install syncs:
30
30
 
@@ -48,7 +48,7 @@ Run:
48
48
  cgc-start
49
49
  ```
50
50
 
51
- This is a read-only first-run guide for the current project. If it reports missing onboarding, run `cgc-install` again from the target project root.
51
+ This is a read-only first-run guide for the current project. If it reports missing onboarding, run `cgc-init` again from the target project root.
52
52
 
53
53
  ## 4. Start Work From The Single Entry
54
54
 
@@ -1,6 +1,6 @@
1
1
  # CodeCGC Real Workflow Loop
2
2
 
3
- This page describes the repeatable CodeCGC loop after a project has already run `cgc-install`.
3
+ This page describes the repeatable CodeCGC loop after a project has already run `cgc-init`.
4
4
 
5
5
  The goal is not to make users memorize every command. The goal is to keep one stable control loop where Claude orchestrates state, Codex or Gemini executes scoped code work, and review closes the loop only when there is enough evidence.
6
6
 
@@ -45,16 +45,23 @@
45
45
  当前对外公开命令面是:
46
46
 
47
47
  - `cgc`
48
- - `cgc-install`
48
+ - `cgc-init`
49
+ - `cgc-start`
49
50
  - `cgc-entry`
50
51
  - `cgc-plan`
51
52
  - `cgc-build`
52
53
  - `cgc-fix`
54
+ - `cgc-test`
53
55
  - `cgc-review`
54
56
  - `cgc-route`
55
57
  - `cgc-status`
56
58
  - `cgc-doctor`
57
59
  - `cgc-package-audit`
60
+ - `cgc-external-audit`
61
+ - `cgc-external-status`
62
+ - `cgc-release-readiness`
63
+ - `cgc-lifecycle`
64
+ - `cgc-history`
58
65
 
59
66
  其中:
60
67
 
@@ -7,20 +7,12 @@
7
7
  It does not install CodeCGC into every project. Run this per project:
8
8
 
9
9
  ```bash
10
- cgc-install
10
+ cgc-init
11
11
  cgc-start
12
12
  cgc-status
13
13
  cgc-doctor
14
14
  ```
15
15
 
16
- Use `--mode user-dry-run` only to preview user-level Claude integration:
17
-
18
- ```bash
19
- cgc-install --mode user-dry-run
20
- ```
21
-
22
- Do not use `--mode user` unless you intentionally want to write user-level Claude files.
23
-
24
16
  ## MCP JSON Parse Errors
25
17
 
26
18
  If an MCP install tool reports a JSON parse failure, first check whether the files were still written correctly:
@@ -37,7 +29,7 @@ The MCP tool surface should request JSON internally, even when the user asked fo
37
29
  If `cgc-start`, `cgc-status`, or `cgc-doctor` reports `onboarding_file` or `onboarding_file_ready`, rerun project-local install:
38
30
 
39
31
  ```bash
40
- cgc-install
32
+ cgc-init
41
33
  cgc-start
42
34
  ```
43
35
 
@@ -4,9 +4,8 @@ This delivery plan turns the release maintenance roadmap into concrete work item
4
4
 
5
5
  ## Immediate Work
6
6
 
7
- 1. Keep project-local install as the default product path.
8
- 2. Keep user-level install behind explicit `--mode user` or `--mode user-dry-run`.
9
- 3. Keep `/cgc` and `codecgc.entry` as the primary user path.
7
+ 1. Keep project-local install as the only install path (no user-level global writes).
8
+ 2. Keep `/cgc` and `codecgc.entry` as the primary user path.
10
9
  4. Keep the hook as a write guardrail, not as the orchestration engine.
11
10
  5. Keep release docs stable and user-facing.
12
11
 
@@ -35,7 +35,7 @@ The current baseline is:
35
35
 
36
36
  ## Success Criteria
37
37
 
38
- - A new user can install and start from `/cgc-install` and `/cgc`.
38
+ - A new user can install and start from `/cgc-init` and `/cgc`.
39
39
  - A maintainer can verify release readiness with one documented command chain.
40
40
  - Published docs explain install modes, path rules, troubleshooting, and maintainer checks.
41
41
  - Package audits catch missing runtime and reference files before publication.
@@ -9,7 +9,7 @@ Objective:
9
9
  Deliverables:
10
10
 
11
11
  - `/cgc` as the primary user entry.
12
- - `/cgc-install`, `/cgc-status`, and `/cgc-doctor` for setup and health checks.
12
+ - `/cgc-init`, `/cgc-status`, and `/cgc-doctor` for setup and health checks.
13
13
  - `/cgc-review` and `/cgc-history` for common control points.
14
14
  - Documentation that explains when to use CLI fallback.
15
15
 
@@ -0,0 +1,87 @@
1
+ $ErrorActionPreference = "Stop"
2
+
3
+ function Write-Approve {
4
+ $payload = @{
5
+ decision = "approve"
6
+ } | ConvertTo-Json -Compress
7
+ [Console]::Out.Write($payload)
8
+ exit 0
9
+ }
10
+
11
+ function Write-Deny($reason) {
12
+ $payload = @{
13
+ decision = "deny"
14
+ reason = $reason
15
+ } | ConvertTo-Json -Compress
16
+ [Console]::Out.Write($payload)
17
+ exit 0
18
+ }
19
+
20
+ $inputJson = [Console]::In.ReadToEnd()
21
+ if ([string]::IsNullOrWhiteSpace($inputJson)) {
22
+ Write-Approve
23
+ }
24
+
25
+ $configuredPackageRoot = [Environment]::GetEnvironmentVariable("CODECGC_PACKAGE_ROOT")
26
+ if (-not [string]::IsNullOrWhiteSpace($configuredPackageRoot)) {
27
+ $packageRoot = Resolve-Path $configuredPackageRoot
28
+ } else {
29
+ $packageRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..")
30
+ }
31
+
32
+ $configuredWorkspaceRoot = [Environment]::GetEnvironmentVariable("CODECGC_WORKSPACE_ROOT")
33
+ if (-not [string]::IsNullOrWhiteSpace($configuredWorkspaceRoot)) {
34
+ $workspaceRoot = Resolve-Path $configuredWorkspaceRoot
35
+ } else {
36
+ $workspaceRoot = Resolve-Path (Get-Location)
37
+ }
38
+
39
+ $policyScript = Join-Path $packageRoot "scripts\codecgc_policy.py"
40
+ $routingFile = Join-Path $workspaceRoot "model-routing.yaml"
41
+ $mcpConfigFile = Join-Path $workspaceRoot ".mcp.json"
42
+
43
+ if (-not (Test-Path $policyScript)) {
44
+ Write-Deny "CodeCGC: policy checker is missing: $policyScript"
45
+ }
46
+
47
+ $pythonCommand = [Environment]::GetEnvironmentVariable("CODECGC_PYTHON_COMMAND")
48
+ if ([string]::IsNullOrWhiteSpace($pythonCommand) -and (Test-Path $mcpConfigFile)) {
49
+ try {
50
+ $mcpConfig = Get-Content -Raw $mcpConfigFile | ConvertFrom-Json
51
+ $pythonCommand = [string]$mcpConfig.mcpServers.codecgc.command
52
+ } catch {
53
+ $pythonCommand = ""
54
+ }
55
+ }
56
+ if ([string]::IsNullOrWhiteSpace($pythonCommand)) {
57
+ $pythonCommand = "python"
58
+ }
59
+
60
+ $psi = New-Object System.Diagnostics.ProcessStartInfo
61
+ $psi.FileName = $pythonCommand
62
+ $escapedPolicyScript = $policyScript.Replace('"', '\"')
63
+ $escapedRoutingFile = $routingFile.Replace('"', '\"')
64
+ $psi.Arguments = "`"$escapedPolicyScript`" --hook-check --actor claude --operation write --routing-file `"$escapedRoutingFile`""
65
+ $psi.RedirectStandardInput = $true
66
+ $psi.RedirectStandardOutput = $true
67
+ $psi.RedirectStandardError = $true
68
+ $psi.UseShellExecute = $false
69
+ $psi.CreateNoWindow = $true
70
+
71
+ $process = [System.Diagnostics.Process]::Start($psi)
72
+ $process.StandardInput.Write($inputJson)
73
+ $process.StandardInput.Close()
74
+ $stdout = $process.StandardOutput.ReadToEnd()
75
+ $stderr = $process.StandardError.ReadToEnd()
76
+ $process.WaitForExit()
77
+
78
+ if ($process.ExitCode -ne 0) {
79
+ $detail = if ([string]::IsNullOrWhiteSpace($stderr)) { $stdout } else { $stderr }
80
+ Write-Deny "CodeCGC: policy checker failed. $detail"
81
+ }
82
+
83
+ if ([string]::IsNullOrWhiteSpace($stdout)) {
84
+ Write-Approve
85
+ }
86
+
87
+ [Console]::Out.Write($stdout)