@hunyed15/codecgc 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/hooks/route-edit.ps1 +58 -57
- package/INSTALLATION.md +117 -484
- package/README.md +118 -150
- package/bin/cgc-external-status.js +4 -0
- package/bin/cgc-start.js +4 -0
- package/bin/codecgc.js +141 -20
- package/codecgc/compound/codecgc-capability-matrix.md +37 -0
- package/codecgc/reference/README.md +69 -0
- package/codecgc/reference/maintainer-guide.md +93 -0
- package/codecgc/reference/mcp-tool-surface.md +112 -0
- package/codecgc/reference/onboarding.md +69 -0
- package/codecgc/reference/operation-guide.md +29 -23
- package/codecgc/reference/path-contract.md +53 -0
- package/codecgc/reference/policy-routing.md +57 -0
- package/codecgc/reference/project-structure.md +80 -0
- package/codecgc/reference/quickstart.md +108 -0
- package/codecgc/reference/real-workflow-loop.md +123 -0
- package/codecgc/reference/recovery-loop.md +109 -0
- package/codecgc/reference/release-maintenance-playbook.md +4 -1
- package/codecgc/reference/troubleshooting.md +112 -0
- package/codecgc/roadmap/codecgc-release-maintenance/delivery-plan.md +49 -0
- package/codecgc/roadmap/codecgc-release-maintenance/overview.md +41 -0
- package/codecgc/roadmap/codecgc-release-maintenance/phases.md +84 -0
- package/codecgcmcp/README.md +57 -11
- package/codecgcmcp/src/codecgcmcp/server.py +164 -26
- package/codexmcp/src/codexmcp/server.py +32 -26
- package/geminimcp/src/geminimcp/server.py +22 -14
- package/model-routing.yaml +31 -6
- package/package.json +11 -4
- package/scripts/audit_codecgc_external_capabilities.py +83 -4
- package/scripts/audit_codecgc_historical_audits.py +42 -2
- package/scripts/audit_codecgc_package_runtime.py +73 -4
- package/scripts/audit_codecgc_release_readiness.py +55 -3
- package/scripts/audit_codecgc_workflow_history.py +8 -5
- package/scripts/build_codecgc_task.py +62 -45
- package/scripts/codecgc_artifact_roots.py +8 -40
- package/scripts/codecgc_console_io.py +3 -45
- package/scripts/codecgc_executor_registry.py +4 -54
- package/scripts/codecgc_path_contract.py +7 -0
- package/scripts/codecgc_policy.py +275 -0
- package/scripts/codecgc_routing_paths.py +3 -16
- package/scripts/codecgc_routing_template.py +11 -135
- package/scripts/codecgc_runtime/__init__.py +1 -0
- package/scripts/codecgc_runtime/artifacts.py +42 -0
- package/scripts/codecgc_runtime/console.py +45 -0
- package/scripts/codecgc_runtime/executor_registry.py +55 -0
- package/scripts/codecgc_runtime/mcp_config.py +72 -0
- package/scripts/codecgc_runtime/path_contract.py +123 -0
- package/scripts/codecgc_runtime/paths.py +22 -0
- package/scripts/codecgc_runtime/routing_paths.py +16 -0
- package/scripts/codecgc_runtime/routing_template.py +169 -0
- package/scripts/codecgc_runtime/workflow_runtime.py +72 -0
- package/scripts/codecgc_runtime_paths.py +3 -22
- package/scripts/codecgc_step_control.py +3 -2
- package/scripts/codecgc_workflow_runtime.py +3 -71
- package/scripts/entry_codecgc_workflow.py +4 -0
- package/scripts/install_codecgc.py +490 -21
- package/scripts/normalize_codecgc_audits.py +5 -3
- package/scripts/postinstall_codecgc.js +6 -56
- package/scripts/review_codecgc_workflow.py +6 -3
- package/scripts/route_codecgc_workflow.py +67 -36
- package/scripts/run_codecgc_build.py +28 -0
- package/scripts/run_codecgc_fix.py +28 -0
- package/scripts/run_codecgc_task.py +5 -2
- package/scripts/run_codecgc_test.py +28 -0
- package/scripts/sync_codecgc_mcp_config.py +4 -54
- package/scripts/write_codecgc_review.py +7 -3
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# CodeCGC Capability Matrix
|
|
2
|
+
|
|
3
|
+
This matrix defines which layer owns each product capability.
|
|
4
|
+
|
|
5
|
+
## Product Layers
|
|
6
|
+
|
|
7
|
+
| Capability | Claude | CodeCGC MCP | Runtime | Codex | Gemini | CLI |
|
|
8
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
9
|
+
| User request intake | Owner | Tool surface | Support | No | No | Fallback |
|
|
10
|
+
| Project install | Initiates | Owner | Executes | No | No | Fallback |
|
|
11
|
+
| Status and doctor | Reads | Owner | Executes | No | No | Fallback |
|
|
12
|
+
| Requirement clarification | Owner | Optional state write | Stores artifacts | No | No | Debug |
|
|
13
|
+
| Planning | Owner | Entry or plan tool | Builds workflow state | No | No | Fallback |
|
|
14
|
+
| Backend implementation | Controller | Routes | Dispatches | Owner | No | Debug |
|
|
15
|
+
| Frontend implementation | Controller | Routes | Dispatches | No | Owner | Debug |
|
|
16
|
+
| Test execution | Controller | Routes | Dispatches | Backend tests | Frontend tests | Debug |
|
|
17
|
+
| Review | Owner | Review tool | Evidence and writeback | Responds to backend fixes | Responds to frontend fixes | Fallback |
|
|
18
|
+
| History | Reads | Owner | Scans artifacts | No | No | Fallback |
|
|
19
|
+
| Route explanation | Reads | Owner | Evaluates state | No | No | Fallback |
|
|
20
|
+
| Release readiness | Reads | Optional tool | Audits repository | No | No | Owner |
|
|
21
|
+
| External capability audit | Reads | Optional tool | Audits registry | No | No | Owner |
|
|
22
|
+
| Documentation updates | Owner | Optional governance tools | Stores artifacts | No by default | No by default | Debug |
|
|
23
|
+
|
|
24
|
+
## Boundary Rules
|
|
25
|
+
|
|
26
|
+
- Claude controls the workflow, but does not directly implement routed product source changes.
|
|
27
|
+
- CodeCGC MCP is the preferred product capability surface for Claude.
|
|
28
|
+
- Runtime modules own workflow state, routing, audit, and evidence behavior.
|
|
29
|
+
- Codex owns backend code and backend tests.
|
|
30
|
+
- Gemini owns frontend code and frontend tests.
|
|
31
|
+
- CLI remains a compatibility, CI, and maintainer debugging surface.
|
|
32
|
+
|
|
33
|
+
## Design Direction
|
|
34
|
+
|
|
35
|
+
Do not add a new slash command for every runtime action.
|
|
36
|
+
|
|
37
|
+
When a capability becomes stable, expose it through the orchestrator MCP first. Keep CLI access for fallback and automation.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# CodeCGC Reference Index
|
|
2
|
+
|
|
3
|
+
This directory contains the stable user and maintainer references shipped with CodeCGC.
|
|
4
|
+
|
|
5
|
+
## Recommended Reading Order
|
|
6
|
+
|
|
7
|
+
1. [Quickstart](quickstart.md)
|
|
8
|
+
2. [Onboarding](onboarding.md)
|
|
9
|
+
3. [Operation Guide](operation-guide.md)
|
|
10
|
+
4. [Real Workflow Loop](real-workflow-loop.md)
|
|
11
|
+
5. [Recovery Loop](recovery-loop.md)
|
|
12
|
+
6. [Troubleshooting](troubleshooting.md)
|
|
13
|
+
7. [Path Contract](path-contract.md)
|
|
14
|
+
8. [MCP Tool Surface](mcp-tool-surface.md)
|
|
15
|
+
9. [Maintainer Guide](maintainer-guide.md)
|
|
16
|
+
|
|
17
|
+
## Core Product Contract
|
|
18
|
+
|
|
19
|
+
CodeCGC is a Claude-native development orchestration layer.
|
|
20
|
+
|
|
21
|
+
- Claude owns orchestration, requirements, design, review, acceptance, docs, and workflow state.
|
|
22
|
+
- Codex owns backend implementation and backend tests.
|
|
23
|
+
- Gemini owns frontend implementation and frontend tests.
|
|
24
|
+
- CodeCGC orchestrator MCP owns the user-facing capability surface.
|
|
25
|
+
- The CLI remains available for local debugging, CI checks, and fallback execution.
|
|
26
|
+
|
|
27
|
+
The normal user path is:
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
Claude /cgc -> CodeCGC MCP tool -> CodeCGC runtime -> Codex or Gemini executor
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The normal install path is:
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
npm global install -> project-local cgc-install -> cgc-start -> project .mcp.json / .claude / model-routing.yaml
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
User-level Claude installation is optional and must be explicit.
|
|
40
|
+
|
|
41
|
+
## Public User Surface
|
|
42
|
+
|
|
43
|
+
The preferred Claude-facing commands are intentionally small:
|
|
44
|
+
|
|
45
|
+
- `/cgc`
|
|
46
|
+
- `/cgc-install`
|
|
47
|
+
- `/cgc-status`
|
|
48
|
+
- `/cgc-doctor`
|
|
49
|
+
- `/cgc-review`
|
|
50
|
+
- `/cgc-history`
|
|
51
|
+
|
|
52
|
+
Other `cgc-*` commands may remain available as CLI commands, but ordinary users should not need to memorize all of them.
|
|
53
|
+
|
|
54
|
+
## Maintainer Surface
|
|
55
|
+
|
|
56
|
+
Maintainers may use lower-level commands directly:
|
|
57
|
+
|
|
58
|
+
- `cgc-plan`
|
|
59
|
+
- `cgc-build`
|
|
60
|
+
- `cgc-fix`
|
|
61
|
+
- `cgc-test`
|
|
62
|
+
- `cgc-route`
|
|
63
|
+
- `cgc-package-audit`
|
|
64
|
+
- `cgc-external-status`
|
|
65
|
+
- `cgc-external-audit`
|
|
66
|
+
- `cgc-release-readiness`
|
|
67
|
+
- `cgc-lifecycle`
|
|
68
|
+
|
|
69
|
+
These commands are useful for debugging, CI, release checks, and validating runtime behavior.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# CodeCGC Maintainer Guide
|
|
2
|
+
|
|
3
|
+
This guide is for people changing CodeCGC itself.
|
|
4
|
+
|
|
5
|
+
## Development Setup
|
|
6
|
+
|
|
7
|
+
Install Node.js and Python dependencies:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install
|
|
11
|
+
pip install -r requirements-dev.txt
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
If `npm install` is not needed for the current change, you can still run the package scripts directly with the checked-in files.
|
|
15
|
+
|
|
16
|
+
## Focused Verification
|
|
17
|
+
|
|
18
|
+
Run these checks before publishing or tagging:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
python scripts\install_codecgc.py --mode status --format json
|
|
22
|
+
python scripts\install_codecgc.py --mode doctor --format json
|
|
23
|
+
python scripts\audit_codecgc_package_runtime.py --format json
|
|
24
|
+
node --check bin\codecgc.js
|
|
25
|
+
python -m pytest tests\test_codecgc_policy.py tests\test_install_codecgc.py --basetemp D:\tmp\codecgc-pytest
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Add broader tests when changing workflow routing, step execution, review policy, or installer behavior.
|
|
29
|
+
|
|
30
|
+
## Release Readiness Chain
|
|
31
|
+
|
|
32
|
+
Use:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
cgc-status
|
|
36
|
+
cgc-doctor
|
|
37
|
+
cgc-package-audit
|
|
38
|
+
cgc-external-status
|
|
39
|
+
cgc-external-audit
|
|
40
|
+
cgc-release-readiness
|
|
41
|
+
cgc-lifecycle
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
This checks installation readiness, package contents, external capability registration, release signals, and lifecycle coverage.
|
|
45
|
+
|
|
46
|
+
## Command Surface Rule
|
|
47
|
+
|
|
48
|
+
Do not add a new slash command for every runtime action.
|
|
49
|
+
|
|
50
|
+
Preferred layering:
|
|
51
|
+
|
|
52
|
+
- Claude slash commands are a small user entry surface.
|
|
53
|
+
- CodeCGC MCP tools are the product capability surface.
|
|
54
|
+
- CLI commands are fallback, CI, and maintainer debugging surface.
|
|
55
|
+
- Python scripts are internal runtime implementation.
|
|
56
|
+
|
|
57
|
+
## Runtime Change Rule
|
|
58
|
+
|
|
59
|
+
When adding runtime behavior, prefer a stable callable function first, then attach CLI and MCP wrappers to it.
|
|
60
|
+
|
|
61
|
+
Shared runtime logic belongs in `scripts/codecgc_runtime/`. Keep top-level `scripts/*.py` files as command entry points or compatibility shims when an existing import path is already public inside this repository.
|
|
62
|
+
|
|
63
|
+
Avoid duplicating business logic separately in:
|
|
64
|
+
|
|
65
|
+
- Claude command markdown
|
|
66
|
+
- Node CLI wrappers
|
|
67
|
+
- Python scripts
|
|
68
|
+
- MCP tool functions
|
|
69
|
+
|
|
70
|
+
## Review Policy Rule
|
|
71
|
+
|
|
72
|
+
Review output must be evidence-based. Do not mark an execution accepted only because the executor said it completed.
|
|
73
|
+
|
|
74
|
+
At minimum, review should consider:
|
|
75
|
+
|
|
76
|
+
- executor ownership
|
|
77
|
+
- target scope
|
|
78
|
+
- local diff evidence
|
|
79
|
+
- reported files versus observed files
|
|
80
|
+
- test or validation evidence when available
|
|
81
|
+
- review writeback consistency
|
|
82
|
+
|
|
83
|
+
## Dirty Worktree Rule
|
|
84
|
+
|
|
85
|
+
The repository may contain local project files such as `.claude/settings.local.json`.
|
|
86
|
+
|
|
87
|
+
Do not commit user-local settings. Do not delete unrelated user changes while preparing a release.
|
|
88
|
+
|
|
89
|
+
## Documentation Rule
|
|
90
|
+
|
|
91
|
+
Published docs should be stable references, not raw progress logs.
|
|
92
|
+
|
|
93
|
+
Use the parent design documents as source material, then publish only the user-facing or maintainer-facing contract needed for the release.
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# CodeCGC MCP Tool Surface
|
|
2
|
+
|
|
3
|
+
This document defines the stable response contract for CodeCGC orchestrator MCP tools.
|
|
4
|
+
|
|
5
|
+
## Role
|
|
6
|
+
|
|
7
|
+
CodeCGC MCP is the preferred Claude-facing capability layer.
|
|
8
|
+
|
|
9
|
+
The CLI is still available for:
|
|
10
|
+
|
|
11
|
+
- local debugging
|
|
12
|
+
- CI checks
|
|
13
|
+
- release checks
|
|
14
|
+
- fallback execution when MCP is unavailable
|
|
15
|
+
|
|
16
|
+
## Response Envelope
|
|
17
|
+
|
|
18
|
+
Every CodeCGC MCP tool returns a JSON object with this shape:
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"success": true,
|
|
23
|
+
"tool": "codecgc.status",
|
|
24
|
+
"payload": {},
|
|
25
|
+
"error": null,
|
|
26
|
+
"meta": {
|
|
27
|
+
"contract_version": "1.0",
|
|
28
|
+
"payload_success": true,
|
|
29
|
+
"response_shape": "codecgc.mcp.tool_result"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Fields
|
|
35
|
+
|
|
36
|
+
- `success`: Overall MCP tool success. This is false if the runtime payload failed or if the MCP wrapper failed before getting a runtime payload.
|
|
37
|
+
- `tool`: Fully qualified CodeCGC tool name.
|
|
38
|
+
- `payload`: Raw runtime payload returned by the underlying CodeCGC runtime script.
|
|
39
|
+
- `error`: Normalized error object, or null.
|
|
40
|
+
- `meta.contract_version`: MCP response contract version.
|
|
41
|
+
- `meta.payload_success`: Raw runtime payload success flag.
|
|
42
|
+
- `meta.response_shape`: Constant response shape identifier.
|
|
43
|
+
|
|
44
|
+
## Error Object
|
|
45
|
+
|
|
46
|
+
When `success` is false, `error` uses this shape:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"type": "RuntimeScriptError",
|
|
51
|
+
"category": "runtime-script-failed",
|
|
52
|
+
"message": "Runtime script reported failure.",
|
|
53
|
+
"tool": "codecgc.status",
|
|
54
|
+
"script": "install_codecgc.py",
|
|
55
|
+
"args": ["--mode", "status", "--format", "json"],
|
|
56
|
+
"returncode": 1
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
If the runtime script raises or produces invalid JSON before returning a payload, `type` is the exception class name and `payload` contains a minimal failure summary.
|
|
61
|
+
|
|
62
|
+
## Error Categories
|
|
63
|
+
|
|
64
|
+
Stable categories currently include:
|
|
65
|
+
|
|
66
|
+
- `runtime-script-failed`: the runtime script returned a non-zero exit code.
|
|
67
|
+
- `runtime-payload-failed`: the runtime script returned JSON with `success: false` but no process return code.
|
|
68
|
+
- `runtime-json-invalid`: the MCP wrapper could not parse runtime JSON, or runtime parsing raised a `ValueError`.
|
|
69
|
+
- `runtime-timeout`: the runtime process timed out.
|
|
70
|
+
- `runtime-script-missing`: the expected runtime script or file was not found.
|
|
71
|
+
- `runtime-permission-denied`: the runtime wrapper hit a filesystem permission error.
|
|
72
|
+
- `mcp-wrapper-exception`: the MCP wrapper failed for another reason before producing a normal payload.
|
|
73
|
+
|
|
74
|
+
Runtime payloads may provide a more specific `error_category` or `failure_category`; when present, the MCP wrapper preserves that category.
|
|
75
|
+
|
|
76
|
+
## Current Tools
|
|
77
|
+
|
|
78
|
+
- `codecgc.install`
|
|
79
|
+
- `codecgc.start`
|
|
80
|
+
- `codecgc.status`
|
|
81
|
+
- `codecgc.doctor`
|
|
82
|
+
- `codecgc.entry`
|
|
83
|
+
- `codecgc.continue`
|
|
84
|
+
- `codecgc.explain`
|
|
85
|
+
- `codecgc.review`
|
|
86
|
+
- `codecgc.history`
|
|
87
|
+
- `codecgc.route`
|
|
88
|
+
- `codecgc.plan`
|
|
89
|
+
- `codecgc.build`
|
|
90
|
+
- `codecgc.fix`
|
|
91
|
+
- `codecgc.test`
|
|
92
|
+
- `codecgc.package_audit`
|
|
93
|
+
- `codecgc.external_audit`
|
|
94
|
+
- `codecgc.release_readiness`
|
|
95
|
+
- `codecgc.lifecycle`
|
|
96
|
+
|
|
97
|
+
## Compatibility Rule
|
|
98
|
+
|
|
99
|
+
The raw runtime result remains available under `payload`.
|
|
100
|
+
|
|
101
|
+
Claude-facing behavior should consume the envelope first, then inspect `payload` for domain-specific details.
|
|
102
|
+
|
|
103
|
+
## Argument Mapping Rule
|
|
104
|
+
|
|
105
|
+
MCP tools must keep argument mapping deterministic.
|
|
106
|
+
|
|
107
|
+
- User-facing `format` hints do not change the envelope shape.
|
|
108
|
+
- `codecgc.install` always calls `install_codecgc.py` with `--format json` internally and records the requested format in `payload.requested_format`.
|
|
109
|
+
- `codecgc.start` calls `install_codecgc.py --mode start --format json` and is read-only.
|
|
110
|
+
- `workspace` values are normalized before being passed to runtime scripts.
|
|
111
|
+
- Repeated list values are emitted as repeated flags, not comma-joined strings.
|
|
112
|
+
- Boolean switches are omitted when false and emitted as bare flags when true.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# CodeCGC Onboarding
|
|
2
|
+
|
|
3
|
+
This document defines the real-project entry experience after `cgc-install`.
|
|
4
|
+
|
|
5
|
+
## Contract
|
|
6
|
+
|
|
7
|
+
`cgc-install` is project-local by default. After a successful install, a target project should contain:
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
codecgc/START_HERE.md
|
|
11
|
+
.claude/commands/cgc-start.md
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`codecgc/START_HERE.md` is generated for the target project and is safe to keep in the project because it uses project-relative paths only. It must not contain the package installation directory or a developer machine path.
|
|
15
|
+
|
|
16
|
+
## First User Path
|
|
17
|
+
|
|
18
|
+
Inside Claude:
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
/cgc-install
|
|
22
|
+
/cgc-start
|
|
23
|
+
/cgc-status
|
|
24
|
+
/cgc-doctor
|
|
25
|
+
/cgc 新增一个登录页面,放在 src/components/LoginForm.tsx
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Outside Claude:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
cgc-install
|
|
32
|
+
cgc-start
|
|
33
|
+
cgc-status
|
|
34
|
+
cgc-doctor
|
|
35
|
+
cgc "新增一个登录页面,放在 src/components/LoginForm.tsx"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## `/cgc-start`
|
|
39
|
+
|
|
40
|
+
`/cgc-start` is a read-only entry command. It should call `codecgc.start` and summarize:
|
|
41
|
+
|
|
42
|
+
- whether `codecgc/START_HERE.md` exists and matches the current onboarding contract
|
|
43
|
+
- the project-local onboarding file path
|
|
44
|
+
- the shortest next actions for Claude and CLI users
|
|
45
|
+
- the fallback action when onboarding is missing, normally `/cgc-install` or `cgc-install`
|
|
46
|
+
|
|
47
|
+
The CLI equivalent is `cgc-start`.
|
|
48
|
+
|
|
49
|
+
## Why This Exists
|
|
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:
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
install -> start -> status/doctor -> /cgc natural-language request
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Maintainer commands remain available, but they should not be required for the first successful workflow.
|
|
58
|
+
|
|
59
|
+
## Failure Handling
|
|
60
|
+
|
|
61
|
+
If `cgc-start` reports missing onboarding, run:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
cgc-install
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
If `cgc-status` reports `onboarding_file` as missing or outdated, the same repair action applies.
|
|
68
|
+
|
|
69
|
+
If `cgc-doctor` reports `onboarding_file_ready` as failed, reinstall project-local integration before debugging executor availability.
|
|
@@ -4,28 +4,26 @@
|
|
|
4
4
|
|
|
5
5
|
这份文档是 CodeCGC 的本地使用实操指南。
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- `cgc-external-audit`
|
|
21
|
-
- `cgc-release-readiness`
|
|
22
|
-
- `cgc-lifecycle`
|
|
7
|
+
CodeCGC 的推荐用户入口是 Claude 内的 `/cgc`,背后优先调用 CodeCGC orchestrator MCP 工具。
|
|
8
|
+
|
|
9
|
+
最小公开入口是:
|
|
10
|
+
|
|
11
|
+
- `/cgc`
|
|
12
|
+
- `/cgc-start`
|
|
13
|
+
- `/cgc-install`
|
|
14
|
+
- `/cgc-status`
|
|
15
|
+
- `/cgc-doctor`
|
|
16
|
+
- `/cgc-review`
|
|
17
|
+
- `/cgc-history`
|
|
18
|
+
|
|
19
|
+
CLI 命令继续保留,但主要用于本地调试、CI、维护和 MCP 不可用时的回退。
|
|
23
20
|
|
|
24
21
|
底层实现入口如 `scripts/codecgc_cli.py`、`scripts/route_codecgc_workflow.py` 只属于维护者调试层。
|
|
25
22
|
|
|
26
23
|
默认原则:
|
|
27
24
|
|
|
28
|
-
- 日常使用优先走 `
|
|
25
|
+
- 日常使用优先走 `/cgc` 或 `codecgc.entry`
|
|
26
|
+
- 已明确 workflow 阶段时,才显式调用 `cgc-plan` / `cgc-build` / `cgc-fix` / `cgc-test` / `cgc-review`
|
|
29
27
|
- 调试运行时本身时再看 Python 脚本入口
|
|
30
28
|
|
|
31
29
|
## 2. 首次接入顺序
|
|
@@ -33,13 +31,16 @@
|
|
|
33
31
|
如果你是第一次把 CodeCGC 接入某个项目,建议顺序是:
|
|
34
32
|
|
|
35
33
|
1. 在目标项目根目录运行 `cgc-install`
|
|
36
|
-
2. 运行 `cgc-
|
|
37
|
-
3.
|
|
34
|
+
2. 运行 `cgc-start` 查看项目本地首次使用入口
|
|
35
|
+
3. 运行 `cgc-status`,必要时再运行 `cgc-doctor`
|
|
36
|
+
4. 在 Claude 中用 `/cgc <自然语言需求>` 开始
|
|
37
|
+
5. 如果不在 Claude 中,再用 `cgc "<自然语言需求>"` 作为 CLI 回退
|
|
38
38
|
|
|
39
39
|
最小示例:
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
42
|
cgc-install
|
|
43
|
+
cgc-start
|
|
43
44
|
cgc-status
|
|
44
45
|
cgc "新增一个登录页面,放在 src/components/LoginForm.tsx"
|
|
45
46
|
```
|
|
@@ -58,8 +59,9 @@ cgc-status --workspace D:\Projects\MyApp
|
|
|
58
59
|
- `cgc-plan`:还需要规划或澄清
|
|
59
60
|
- `cgc-build` / `cgc-fix`:当前步骤已具备执行条件
|
|
60
61
|
- `cgc-review`:已经存在 audit,等待审核决策
|
|
61
|
-
- `cgc-route
|
|
62
|
-
- `cgc-external-
|
|
62
|
+
- `cgc-route`:维护者只想知道下一步推荐命令
|
|
63
|
+
- `cgc-external-status`:只想看外部能力状态面板
|
|
64
|
+
- `cgc-external-audit`:只想看外部能力登记一致性与声明
|
|
63
65
|
- `cgc-release-readiness`:发布或长期维护前做总检查
|
|
64
66
|
- `cgc-lifecycle`:快速判断仓库现在处于哪个生命周期阶段
|
|
65
67
|
|
|
@@ -74,7 +76,9 @@ cgc --request "现在下一步该做什么"
|
|
|
74
76
|
cgc --latest
|
|
75
77
|
```
|
|
76
78
|
|
|
77
|
-
`cgc`
|
|
79
|
+
`cgc` 是 CLI 意图优先入口,默认输出更适合人直接阅读的摘要。
|
|
80
|
+
|
|
81
|
+
在 Claude 中,优先使用 `/cgc`,让命令模板调用 `codecgc.entry` MCP 工具。
|
|
78
82
|
|
|
79
83
|
如果需要完整结构化结果,使用:
|
|
80
84
|
|
|
@@ -182,12 +186,14 @@ cgc-route --flow feature --slug 2026-05-01-demo-login-ui
|
|
|
182
186
|
1. `cgc-status`
|
|
183
187
|
2. `cgc-doctor`
|
|
184
188
|
3. `cgc-package-audit`
|
|
185
|
-
4. `cgc-external-
|
|
189
|
+
4. `cgc-external-status`
|
|
190
|
+
5. `cgc-external-audit`
|
|
186
191
|
5. `cgc-release-readiness`
|
|
187
192
|
6. `cgc-lifecycle`
|
|
188
193
|
|
|
189
194
|
其中:
|
|
190
195
|
|
|
196
|
+
- `cgc-external-status` 用来快速查看第三方能力状态面板
|
|
191
197
|
- `cgc-external-audit` 用来判断第三方能力是否处于“正式接入 / 规划中 / 本地漂移”哪一种状态
|
|
192
198
|
- `cgc-release-readiness` 用来把安装、运行时、发布包、外部接入与生命周期资产汇总成一个结论
|
|
193
199
|
- `cgc-lifecycle` 用来把 roadmap、workflow 与 execution 当前分布汇总成生命周期阶段
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# CodeCGC Path Contract
|
|
2
|
+
|
|
3
|
+
CodeCGC uses two different path classes. They must not be mixed.
|
|
4
|
+
|
|
5
|
+
## Install-Time Runtime Paths
|
|
6
|
+
|
|
7
|
+
Runtime configuration may use absolute paths because every machine installs packages in a different location.
|
|
8
|
+
|
|
9
|
+
Examples:
|
|
10
|
+
|
|
11
|
+
- MCP server command paths
|
|
12
|
+
- package script paths
|
|
13
|
+
- hook script command targets
|
|
14
|
+
- local Python script entry points
|
|
15
|
+
|
|
16
|
+
These paths are generated during install and are allowed to be machine-specific.
|
|
17
|
+
|
|
18
|
+
## Persisted Project Artifact Paths
|
|
19
|
+
|
|
20
|
+
Workflow artifacts should use project-relative paths whenever they describe project files or execution evidence.
|
|
21
|
+
|
|
22
|
+
Examples:
|
|
23
|
+
|
|
24
|
+
- `codecgc/features/...`
|
|
25
|
+
- `codecgc/issues/...`
|
|
26
|
+
- `codecgc/execution/...`
|
|
27
|
+
- `src/components/LoginForm.tsx`
|
|
28
|
+
- `backend/src/sync.py`
|
|
29
|
+
|
|
30
|
+
These files should remain portable across machines and repositories.
|
|
31
|
+
|
|
32
|
+
## Rule
|
|
33
|
+
|
|
34
|
+
Use absolute paths for runtime launch configuration.
|
|
35
|
+
|
|
36
|
+
Use project-relative paths for persisted product state, audits, fixtures, review evidence, and workflow documents.
|
|
37
|
+
|
|
38
|
+
## Installer Responsibility
|
|
39
|
+
|
|
40
|
+
`cgc-install` is responsible for writing machine-specific runtime paths into the target project integration files.
|
|
41
|
+
|
|
42
|
+
It should not hard-code paths from the development machine into reusable templates or persisted workflow artifacts.
|
|
43
|
+
|
|
44
|
+
## Maintainer Check
|
|
45
|
+
|
|
46
|
+
Before release, run:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
cgc-package-audit
|
|
50
|
+
cgc-release-readiness
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
If a fixture or product artifact contains a stale local path, normalize it before publishing.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# CodeCGC Policy Routing
|
|
2
|
+
|
|
3
|
+
CodeCGC uses a single routing policy file as the source of truth:
|
|
4
|
+
|
|
5
|
+
- `model-routing.yaml`
|
|
6
|
+
|
|
7
|
+
The policy separates files by owner:
|
|
8
|
+
|
|
9
|
+
- `orchestration`: CodeCGC workflow state, command surfaces, audits, plans, and routing config.
|
|
10
|
+
- `docs`: human-facing documentation.
|
|
11
|
+
- `backend`: backend product code owned by Codex.
|
|
12
|
+
- `frontend`: frontend product code owned by Gemini.
|
|
13
|
+
- `backend-test`: backend tests owned by Codex.
|
|
14
|
+
- `frontend-test`: frontend tests owned by Gemini.
|
|
15
|
+
- `shared`: shared contracts that must be split before execution.
|
|
16
|
+
|
|
17
|
+
## Control Flow
|
|
18
|
+
|
|
19
|
+
Normal writes should go through CodeCGC:
|
|
20
|
+
|
|
21
|
+
1. Claude receives the user request.
|
|
22
|
+
2. CodeCGC plans and routes the task.
|
|
23
|
+
3. Codex or Gemini executes the owned implementation step.
|
|
24
|
+
4. CodeCGC writes an execution audit.
|
|
25
|
+
5. Claude reviews the audit and chooses the next action.
|
|
26
|
+
|
|
27
|
+
Claude may write orchestration and docs files. Claude must not directly write product source paths.
|
|
28
|
+
|
|
29
|
+
## Install Boundary
|
|
30
|
+
|
|
31
|
+
Global npm install only provides the `cgc*` CLI commands. It must not write `~/.claude`, user-level hooks, or user-level slash commands.
|
|
32
|
+
|
|
33
|
+
Project install is the default integration path:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
cd your-project
|
|
37
|
+
cgc-install
|
|
38
|
+
```
|
|
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.
|
|
41
|
+
|
|
42
|
+
## Policy Checker
|
|
43
|
+
|
|
44
|
+
`scripts/codecgc_policy.py` evaluates the policy for every entry point that needs write ownership:
|
|
45
|
+
|
|
46
|
+
- Claude hook guardrail via `.claude/hooks/route-edit.ps1` for `Edit`, `Write`, and `MultiEdit`
|
|
47
|
+
- task payload construction via `scripts/build_codecgc_task.py`
|
|
48
|
+
- build/fix/test wrappers before executor dispatch
|
|
49
|
+
- status and doctor checks through `model-routing.yaml` validation
|
|
50
|
+
|
|
51
|
+
The hook is intentionally thin. It only forwards Claude edit requests to the shared policy checker.
|
|
52
|
+
|
|
53
|
+
## Shared Paths
|
|
54
|
+
|
|
55
|
+
`shared` paths use `split-first`.
|
|
56
|
+
|
|
57
|
+
Shared changes must be split into backend and frontend owned tasks, or explicitly redesigned as a compound workflow before implementation. A single executor should not directly own a shared change by default.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# CodeCGC Project Structure
|
|
2
|
+
|
|
3
|
+
CodeCGC separates package runtime files from target project workflow files.
|
|
4
|
+
|
|
5
|
+
## Package Runtime
|
|
6
|
+
|
|
7
|
+
These files are source-controlled and ship with the npm package:
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
bin/
|
|
11
|
+
scripts/
|
|
12
|
+
codecgc_runtime/
|
|
13
|
+
codecgcmcp/
|
|
14
|
+
codexmcp/
|
|
15
|
+
geminimcp/
|
|
16
|
+
codecgc/reference/
|
|
17
|
+
codecgc/cgc*/
|
|
18
|
+
.claude/hooks/route-edit.ps1
|
|
19
|
+
model-routing.yaml
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Package runtime files define commands, MCP servers, policy checking, and reference docs.
|
|
23
|
+
|
|
24
|
+
`scripts/codecgc_runtime/` is the shared Python runtime package for reusable internals such as path resolution, console rendering, executor registry, routing templates, MCP config generation, and runtime script execution. Top-level `scripts/codecgc_*.py` modules remain as compatibility shims or CLI entry files so existing Node wrappers, MCP tools, tests, and user commands keep their stable contract.
|
|
25
|
+
|
|
26
|
+
## Source Repository Hygiene
|
|
27
|
+
|
|
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
|
+
|
|
30
|
+
```text
|
|
31
|
+
.mcp.json
|
|
32
|
+
.claude/settings.json
|
|
33
|
+
.claude/commands/
|
|
34
|
+
codecgc/START_HERE.md
|
|
35
|
+
codecgc/features/
|
|
36
|
+
codecgc/issues/
|
|
37
|
+
codecgc/execution/
|
|
38
|
+
codecgc/requirements/
|
|
39
|
+
codecgc/architecture/
|
|
40
|
+
codecgc/docs/
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Keep `.claude/hooks/route-edit.ps1` in source control because it is the packaged hook template copied into target projects.
|
|
44
|
+
|
|
45
|
+
Keep `codecgc/fixtures/`, `codecgc/reference/`, `codecgc/roadmap/`, and `codecgc/compound/` when they are used as packaged examples, release-maintenance assets, or regression fixtures.
|
|
46
|
+
|
|
47
|
+
## Target Project Surface
|
|
48
|
+
|
|
49
|
+
`cgc-install` creates or syncs these files in the target project:
|
|
50
|
+
|
|
51
|
+
```text
|
|
52
|
+
.mcp.json
|
|
53
|
+
model-routing.yaml
|
|
54
|
+
.claude/
|
|
55
|
+
settings.json
|
|
56
|
+
hooks/
|
|
57
|
+
route-edit.ps1
|
|
58
|
+
commands/
|
|
59
|
+
cgc*.md
|
|
60
|
+
codecgc/
|
|
61
|
+
features/
|
|
62
|
+
issues/
|
|
63
|
+
execution/
|
|
64
|
+
requirements/
|
|
65
|
+
architecture/
|
|
66
|
+
roadmap/
|
|
67
|
+
compound/
|
|
68
|
+
docs/
|
|
69
|
+
reference/
|
|
70
|
+
fixtures/
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Ownership
|
|
74
|
+
|
|
75
|
+
- `.mcp.json`, `.claude/**`, `model-routing.yaml`, and `codecgc/**` are orchestration paths.
|
|
76
|
+
- Documentation paths are docs paths.
|
|
77
|
+
- Product source paths are owned by Codex or Gemini according to `model-routing.yaml`.
|
|
78
|
+
- Shared source paths require split-first routing.
|
|
79
|
+
|
|
80
|
+
The project hook enforces the same policy checker used by task dispatch.
|