@hunyed15/codecgc 0.1.11 → 0.2.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 (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/{geminimcp → mcp/geminimcp}/src/geminimcp/server.py +24 -8
  26. package/model-routing.yaml +0 -1
  27. package/package.json +12 -13
  28. package/scripts/audit_codecgc_external_capabilities.py +1 -1
  29. package/scripts/audit_codecgc_package_runtime.py +18 -16
  30. package/scripts/audit_codecgc_release_readiness.py +1 -1
  31. package/scripts/codecgc_runtime/executor_registry.py +2 -2
  32. package/scripts/codecgc_runtime/mcp_config.py +2 -2
  33. package/scripts/codecgc_runtime/routing_template.py +0 -1
  34. package/scripts/exercise_mcp_tools.py +2 -2
  35. package/scripts/install_codecgc.py +37 -292
  36. package/scripts/postinstall_codecgc.js +1 -1
  37. package/INSTALLATION.md +0 -211
  38. package/codexmcp/LICENSE +0 -21
  39. package/codexmcp/README.md +0 -294
  40. package/codexmcp/pyproject.toml +0 -37
  41. package/geminimcp/README.md +0 -258
  42. package/geminimcp/pyproject.toml +0 -15
  43. /package/codecgc/templates/{codex → project/codex}/codecgcrc.json +0 -0
  44. /package/codecgc/templates/{gemini → project/gemini/policies}/codecgc-policy.toml +0 -0
  45. /package/{codecgcmcp → mcp/codecgcmcp}/README.md +0 -0
  46. /package/{codecgcmcp → mcp/codecgcmcp}/pyproject.toml +0 -0
  47. /package/{codecgcmcp → mcp/codecgcmcp}/src/codecgcmcp/__init__.py +0 -0
  48. /package/{codecgcmcp → mcp/codecgcmcp}/src/codecgcmcp/cli.py +0 -0
  49. /package/{codexmcp → mcp/codexmcp}/src/codexmcp/__init__.py +0 -0
  50. /package/{codexmcp → mcp/codexmcp}/src/codexmcp/cli.py +0 -0
  51. /package/{codexmcp → mcp/codexmcp}/src/codexmcp/server.py +0 -0
  52. /package/{geminimcp → mcp/geminimcp}/src/geminimcp/__init__.py +0 -0
  53. /package/{geminimcp → mcp/geminimcp}/src/geminimcp/cli.py +0 -0
@@ -7,15 +7,8 @@
7
7
  "Update(**)",
8
8
  "Write(**)",
9
9
  "mcp__*",
10
- "mcp__codecgc__*",
11
- "mcp__codex__*",
12
- "mcp__gemini__*",
13
10
  "Bash(*)",
14
- "PowerShell(*)",
15
- "Edit *",
16
- "Reading *",
17
- "Added *",
18
- "mcp__memos-mcp__add_message"
11
+ "PowerShell(*)"
19
12
  ]
20
13
  },
21
14
  "enabledMcpjsonServers": [
@@ -0,0 +1,60 @@
1
+ version: 2
2
+
3
+ orchestration_paths:
4
+ - "codecgc/**"
5
+ - ".claude/commands/**"
6
+ - ".claude/settings.local.json"
7
+ - ".codex/codecgcrc.json"
8
+ - ".gemini/policies/**"
9
+ - ".mcp.json"
10
+ - "model-routing.yaml"
11
+
12
+ docs_paths:
13
+ - "README.md"
14
+ - "docs/**"
15
+ - "CHANGELOG.md"
16
+
17
+ frontend_paths:
18
+ - "apps/web/**"
19
+ - "src/components/**"
20
+ - "src/pages/**"
21
+ - "src/app/**"
22
+ - "src/styles/**"
23
+ - "web/**"
24
+ - "frontend/**"
25
+
26
+ backend_paths:
27
+ - "apps/api/**"
28
+ - "server/**"
29
+ - "src/server/**"
30
+ - "src/services/**"
31
+ - "src/repositories/**"
32
+ - "backend/**"
33
+
34
+ test_paths:
35
+ frontend:
36
+ - "apps/web/*.test.*"
37
+ - "apps/web/*.spec.*"
38
+ - "apps/web/**/*.test.*"
39
+ - "apps/web/**/*.spec.*"
40
+ - "tests/frontend/**"
41
+ backend:
42
+ - "apps/api/*.test.*"
43
+ - "apps/api/*.spec.*"
44
+ - "apps/api/**/*.test.*"
45
+ - "apps/api/**/*.spec.*"
46
+ - "tests/backend/**"
47
+
48
+ shared_paths:
49
+ - "packages/shared/**"
50
+ - "src/shared/**"
51
+ - "src/lib/**"
52
+ - "src/types/**"
53
+
54
+ rules:
55
+ claude_allowed_owners:
56
+ - "orchestration"
57
+ - "docs"
58
+ backend_executor: "codexmcp"
59
+ frontend_executor: "geminimcp"
60
+ shared_policy: "split-first"
@@ -139,12 +139,12 @@ def _call_runtime_tool(tool_name: str, script_name: str, *args: str, requested_f
139
139
 
140
140
  @mcp.tool(
141
141
  name="codecgc.install",
142
- description="Install or sync CodeCGC integration for the current project or Claude user profile.",
142
+ description="Install or sync CodeCGC integration for the current project.",
143
143
  meta={"version": "0.1.0", "author": "CodeCGC"},
144
144
  )
145
145
  async def codecgc_install(
146
146
  mode: Annotated[
147
- Literal["local", "user-dry-run", "user", "status", "doctor"],
147
+ Literal["local", "status", "doctor"],
148
148
  Field(description="Install mode for CodeCGC integration."),
149
149
  ] = "local",
150
150
  format: Annotated[
@@ -155,18 +155,11 @@ async def codecgc_install(
155
155
  str,
156
156
  Field(description="Optional target workspace root for local/status/doctor modes."),
157
157
  ] = "",
158
- user_root: Annotated[
159
- str,
160
- Field(description="Optional explicit Claude user root for user/user-dry-run modes."),
161
- ] = "",
162
158
  ) -> CallToolResult:
163
- # The MCP surface must always receive machine-readable JSON from the script.
164
159
  args = ["--mode", mode, "--format", "json"]
165
160
  normalized_workspace = _normalize_workspace(workspace)
166
161
  if normalized_workspace:
167
162
  args.extend(["--workspace", normalized_workspace])
168
- if str(user_root).strip():
169
- args.extend(["--user-root", str(user_root).strip()])
170
163
  return _call_runtime_tool("codecgc.install", "install_codecgc.py", *args, requested_format=format)
171
164
 
172
165
 
@@ -156,6 +156,29 @@ def _terminate_process_tree(process: subprocess.Popen[str]) -> None:
156
156
  process.kill()
157
157
 
158
158
 
159
+ GEMINI_JS_RELATIVE = Path("node_modules") / "@google" / "gemini-cli" / "bundle" / "gemini.js"
160
+
161
+
162
+ def _resolve_gemini_command(cmd: list[str]) -> list[str]:
163
+ """Resolve the gemini CLI command, preferring direct node invocation on Windows."""
164
+ gemini_shim = shutil.which("gemini") or cmd[0]
165
+
166
+ if os.name == "nt":
167
+ shim_dir = Path(gemini_shim).parent
168
+ gemini_js = shim_dir / GEMINI_JS_RELATIVE
169
+ if gemini_js.is_file():
170
+ node_path = shutil.which("node") or "node"
171
+ return [node_path, str(gemini_js)] + cmd[1:]
172
+
173
+ if gemini_shim.lower().endswith((".cmd", ".bat")):
174
+ from subprocess import list2cmdline
175
+ cmd[0] = gemini_shim
176
+ return ["cmd.exe", "/s", "/c", list2cmdline(cmd)]
177
+
178
+ cmd[0] = gemini_shim
179
+ return cmd
180
+
181
+
159
182
  def run_shell_command(
160
183
  cmd: list[str],
161
184
  cwd: str | None = None,
@@ -171,14 +194,7 @@ def run_shell_command(
171
194
  Yields:
172
195
  Output lines from the command
173
196
  """
174
- popen_cmd = cmd
175
-
176
- gemini_path = shutil.which("gemini") or cmd[0]
177
- popen_cmd[0] = gemini_path
178
-
179
- if os.name == "nt" and gemini_path.lower().endswith((".cmd", ".bat")):
180
- from subprocess import list2cmdline
181
- popen_cmd = ["cmd.exe", "/s", "/c", list2cmdline(cmd)]
197
+ popen_cmd = _resolve_gemini_command(cmd)
182
198
 
183
199
  process = subprocess.Popen(
184
200
  popen_cmd,
@@ -9,7 +9,6 @@ orchestration_paths:
9
9
 
10
10
  docs_paths:
11
11
  - "README.md"
12
- - "INSTALLATION.md"
13
12
  - "docs/**"
14
13
  - "CHANGELOG.md"
15
14
 
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@hunyed15/codecgc",
3
- "version": "0.1.11",
3
+ "version": "0.2.0",
4
4
  "description": "Claude-hosted multi-model workflow product shell for CodeCGC.",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
7
7
  "bin": {
8
8
  "cgc": "bin/cgc.js",
9
9
  "cgc-start": "bin/cgc-start.js",
10
- "cgc-install": "bin/cgc-install.js",
10
+ "cgc-init": "bin/cgc-init.js",
11
11
  "cgc-status": "bin/cgc-status.js",
12
12
  "cgc-doctor": "bin/cgc-doctor.js",
13
13
  "cgc-package-audit": "bin/cgc-package-audit.js",
@@ -65,18 +65,17 @@
65
65
  "codecgc/reference/",
66
66
  "codecgc/roadmap/",
67
67
  "codecgc/templates/",
68
- "codecgcmcp/pyproject.toml",
69
- "codecgcmcp/README.md",
70
- "codecgcmcp/src/codecgcmcp/*.py",
71
- "codexmcp/pyproject.toml",
72
- "codexmcp/README.md",
73
- "codexmcp/LICENSE",
74
- "codexmcp/src/codexmcp/*.py",
75
- "geminimcp/pyproject.toml",
76
- "geminimcp/README.md",
77
- "geminimcp/src/geminimcp/*.py",
68
+ "mcp/codecgcmcp/pyproject.toml",
69
+ "mcp/codecgcmcp/README.md",
70
+ "mcp/codecgcmcp/src/codecgcmcp/*.py",
71
+ "mcp/codexmcp/pyproject.toml",
72
+ "mcp/codexmcp/README.md",
73
+ "mcp/codexmcp/LICENSE",
74
+ "mcp/codexmcp/src/codexmcp/*.py",
75
+ "mcp/geminimcp/pyproject.toml",
76
+ "mcp/geminimcp/README.md",
77
+ "mcp/geminimcp/src/geminimcp/*.py",
78
78
  "requirements.txt",
79
- "INSTALLATION.md",
80
79
  "model-routing.yaml",
81
80
  "README.md",
82
81
  "LICENSE"
@@ -159,7 +159,7 @@ def audit_external_capabilities(workspace_override: str = "", view: str = "audit
159
159
  if blocking_items:
160
160
  blocking_ids = {str(item["id"]) for item in blocking_items}
161
161
  if "codexmcp" in blocking_ids or "geminimcp" in blocking_ids:
162
- recommended_next_action = "先运行 cgc-install 或 cgc-doctor,修复必需执行器的项目级集成与运行前置。"
162
+ recommended_next_action = "先运行 cgc-init 或 cgc-doctor,修复必需执行器的项目级集成与运行前置。"
163
163
  else:
164
164
  recommended_next_action = "先补齐缺失的必需外部能力注册,再继续后续流程。"
165
165
  elif malformed_count > 0:
@@ -2,6 +2,7 @@ import argparse
2
2
  import ast
3
3
  import json
4
4
  import subprocess
5
+ import sys
5
6
  from fnmatch import fnmatch
6
7
  from pathlib import Path
7
8
  from typing import Any
@@ -10,11 +11,12 @@ from codecgc_console_io import render_summary_block
10
11
 
11
12
  WORKSPACE = Path(__file__).resolve().parents[1]
12
13
  PACKAGE_JSON_PATH = WORKSPACE / "package.json"
14
+ _PYTHON_CMD = sys.executable
13
15
 
14
16
  RUNTIME_ENTRYPOINTS = [
15
17
  "bin/codecgc.js",
16
18
  "bin/cgc-start.js",
17
- "codecgcmcp/src/codecgcmcp/cli.py",
19
+ "mcp/codecgcmcp/src/codecgcmcp/cli.py",
18
20
  "scripts/install_codecgc.py",
19
21
  "scripts/codecgc_cli.py",
20
22
  "scripts/codecgc_policy.py",
@@ -22,22 +24,22 @@ RUNTIME_ENTRYPOINTS = [
22
24
 
23
25
  RUNTIME_STATIC_REQUIREMENTS = [
24
26
  ".claude/hooks/route-edit.ps1",
25
- "codecgc/templates/claude/settings.local.json",
26
- "codecgc/templates/codex/codecgcrc.json",
27
- "codecgc/templates/gemini/codecgc-policy.toml",
27
+ "codecgc/templates/project/claude/settings.local.json",
28
+ "codecgc/templates/project/codex/codecgcrc.json",
29
+ "codecgc/templates/project/gemini/policies/codecgc-policy.toml",
28
30
  "model-routing.yaml",
29
31
  "requirements.txt",
30
32
  "scripts/codecgc_runtime/__init__.py",
31
33
  "scripts/audit_codecgc_external_capabilities.py",
32
34
  "scripts/audit_codecgc_lifecycle.py",
33
- "codexmcp/pyproject.toml",
34
- "codexmcp/src/codexmcp/__init__.py",
35
- "codexmcp/src/codexmcp/cli.py",
36
- "codexmcp/src/codexmcp/server.py",
37
- "geminimcp/pyproject.toml",
38
- "geminimcp/src/geminimcp/__init__.py",
39
- "geminimcp/src/geminimcp/cli.py",
40
- "geminimcp/src/geminimcp/server.py",
35
+ "mcp/codexmcp/pyproject.toml",
36
+ "mcp/codexmcp/src/codexmcp/__init__.py",
37
+ "mcp/codexmcp/src/codexmcp/cli.py",
38
+ "mcp/codexmcp/src/codexmcp/server.py",
39
+ "mcp/geminimcp/pyproject.toml",
40
+ "mcp/geminimcp/src/geminimcp/__init__.py",
41
+ "mcp/geminimcp/src/geminimcp/cli.py",
42
+ "mcp/geminimcp/src/geminimcp/server.py",
41
43
  "scripts/audit_codecgc_release_readiness.py",
42
44
  "scripts/write_codecgc_guide.py",
43
45
  "scripts/write_codecgc_libdoc.py",
@@ -178,7 +180,7 @@ def path_matches_package_files(path_text: str, file_rules: list[str]) -> bool:
178
180
  def resolve_local_python_module(module_name: str) -> str:
179
181
  relative = normalize_path_text(module_name.replace(".", "/") + ".py")
180
182
  package_candidates = [
181
- f"{package}/src/{relative}"
183
+ f"mcp/{package}/src/{relative}"
182
184
  for package in ("codecgcmcp", "codexmcp", "geminimcp")
183
185
  if module_name == package or module_name.startswith(f"{package}.")
184
186
  ]
@@ -196,7 +198,7 @@ def resolve_local_python_module(module_name: str) -> str:
196
198
  return package_init
197
199
  for package in ("codecgcmcp", "codexmcp", "geminimcp"):
198
200
  if module_name == package or module_name.startswith(f"{package}."):
199
- package_init = f"{package}/src/{normalize_path_text(module_name.replace('.', '/'))}/__init__.py"
201
+ package_init = f"mcp/{package}/src/{normalize_path_text(module_name.replace('.', '/'))}/__init__.py"
200
202
  if (WORKSPACE / package_init).exists():
201
203
  return package_init
202
204
  root_package_init = f"{normalize_path_text(module_name.replace('.', '/'))}/__init__.py"
@@ -394,7 +396,7 @@ def audit_package_runtime() -> dict[str, Any]:
394
396
 
395
397
  def run_review_policy_refresh_audit() -> dict[str, Any]:
396
398
  command = [
397
- "python",
399
+ _PYTHON_CMD,
398
400
  str(WORKSPACE / "scripts" / "audit_codecgc_review_policy.py"),
399
401
  "--artifact-class",
400
402
  "all",
@@ -426,7 +428,7 @@ def run_review_policy_refresh_audit() -> dict[str, Any]:
426
428
 
427
429
  def run_historical_audit() -> dict[str, Any]:
428
430
  command = [
429
- "python",
431
+ _PYTHON_CMD,
430
432
  str(WORKSPACE / "scripts" / "audit_codecgc_historical_audits.py"),
431
433
  "--format",
432
434
  "json",
@@ -154,7 +154,7 @@ def audit_release_readiness(workspace_override: str = "") -> dict[str, Any]:
154
154
 
155
155
  recommended_next_action = ""
156
156
  if not install_ready:
157
- recommended_next_action = str(install_status.get("summary", {}).get("recommended_project_command", "")).strip() or "cgc-install"
157
+ recommended_next_action = str(install_status.get("summary", {}).get("recommended_project_command", "")).strip() or "cgc-init"
158
158
  elif not doctor_ready:
159
159
  recommended_next_action = "cgc-doctor"
160
160
  elif not external_ready:
@@ -26,7 +26,7 @@ def build_executor_registry() -> dict[str, dict[str, Any]]:
26
26
  "routing_executor": "codexmcp",
27
27
  "tool_name": "implement_backend_task",
28
28
  "python_module": "codexmcp.cli",
29
- "pythonpath": str(WORKSPACE / "codexmcp" / "src"),
29
+ "pythonpath": str(WORKSPACE / "mcp" / "codexmcp" / "src"),
30
30
  "python_command": python_command,
31
31
  },
32
32
  "frontend": {
@@ -35,7 +35,7 @@ def build_executor_registry() -> dict[str, dict[str, Any]]:
35
35
  "routing_executor": "geminimcp",
36
36
  "tool_name": "implement_frontend_task",
37
37
  "python_module": "geminimcp.cli",
38
- "pythonpath": str(WORKSPACE / "geminimcp" / "src"),
38
+ "pythonpath": str(WORKSPACE / "mcp" / "geminimcp" / "src"),
39
39
  "python_command": python_command,
40
40
  },
41
41
  }
@@ -35,7 +35,7 @@ def build_mcp_config(workspace_root: Path | None = None) -> dict[str, Any]:
35
35
  "args": ["-m", "codecgcmcp.cli"],
36
36
  "env": _with_workspace_env(
37
37
  {
38
- "PYTHONPATH": build_runtime_pythonpath(WORKSPACE / "codecgcmcp" / "src"),
38
+ "PYTHONPATH": build_runtime_pythonpath(WORKSPACE / "mcp" / "codecgcmcp" / "src"),
39
39
  },
40
40
  workspace_root,
41
41
  ),
@@ -48,7 +48,7 @@ def build_mcp_config(workspace_root: Path | None = None) -> dict[str, Any]:
48
48
  "env": _with_workspace_env(
49
49
  {
50
50
  "PYTHONPATH": build_runtime_pythonpath(
51
- WORKSPACE / "codecgcmcp" / "src",
51
+ WORKSPACE / "mcp" / "codecgcmcp" / "src",
52
52
  Path(str(config["pythonpath"])),
53
53
  ),
54
54
  },
@@ -43,7 +43,6 @@ DEFAULT_ORCHESTRATION_PATHS = [
43
43
 
44
44
  DEFAULT_DOCS_PATHS = [
45
45
  "README.md",
46
- "INSTALLATION.md",
47
46
  "docs/**",
48
47
  "CHANGELOG.md",
49
48
  ]
@@ -38,7 +38,7 @@ def build_tool_call(target: str) -> tuple[str, dict]:
38
38
  "Return a structured summary payload.",
39
39
  "Do not touch frontend paths.",
40
40
  ],
41
- "cd": str(WORKSPACE / "codexmcp"),
41
+ "cd": str(WORKSPACE / "mcp" / "codexmcp"),
42
42
  "sandbox": "read-only",
43
43
  },
44
44
  )
@@ -58,7 +58,7 @@ def build_tool_call(target: str) -> tuple[str, dict]:
58
58
  "Return a structured summary payload.",
59
59
  "Do not touch backend paths.",
60
60
  ],
61
- "cd": str(WORKSPACE / "geminimcp"),
61
+ "cd": str(WORKSPACE / "mcp" / "geminimcp"),
62
62
  "sandbox": False,
63
63
  },
64
64
  )