@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.
Files changed (67) hide show
  1. package/.claude/hooks/route-edit.ps1 +58 -57
  2. package/INSTALLATION.md +117 -484
  3. package/README.md +118 -150
  4. package/bin/cgc-external-status.js +4 -0
  5. package/bin/cgc-start.js +4 -0
  6. package/bin/codecgc.js +141 -20
  7. package/codecgc/compound/codecgc-capability-matrix.md +37 -0
  8. package/codecgc/reference/README.md +69 -0
  9. package/codecgc/reference/maintainer-guide.md +93 -0
  10. package/codecgc/reference/mcp-tool-surface.md +112 -0
  11. package/codecgc/reference/onboarding.md +69 -0
  12. package/codecgc/reference/operation-guide.md +29 -23
  13. package/codecgc/reference/path-contract.md +53 -0
  14. package/codecgc/reference/policy-routing.md +57 -0
  15. package/codecgc/reference/project-structure.md +80 -0
  16. package/codecgc/reference/quickstart.md +108 -0
  17. package/codecgc/reference/real-workflow-loop.md +123 -0
  18. package/codecgc/reference/recovery-loop.md +109 -0
  19. package/codecgc/reference/release-maintenance-playbook.md +4 -1
  20. package/codecgc/reference/troubleshooting.md +112 -0
  21. package/codecgc/roadmap/codecgc-release-maintenance/delivery-plan.md +49 -0
  22. package/codecgc/roadmap/codecgc-release-maintenance/overview.md +41 -0
  23. package/codecgc/roadmap/codecgc-release-maintenance/phases.md +84 -0
  24. package/codecgcmcp/README.md +57 -11
  25. package/codecgcmcp/src/codecgcmcp/server.py +164 -26
  26. package/codexmcp/src/codexmcp/server.py +32 -26
  27. package/geminimcp/src/geminimcp/server.py +22 -14
  28. package/model-routing.yaml +31 -6
  29. package/package.json +11 -4
  30. package/scripts/audit_codecgc_external_capabilities.py +83 -4
  31. package/scripts/audit_codecgc_historical_audits.py +42 -2
  32. package/scripts/audit_codecgc_package_runtime.py +73 -4
  33. package/scripts/audit_codecgc_release_readiness.py +55 -3
  34. package/scripts/audit_codecgc_workflow_history.py +8 -5
  35. package/scripts/build_codecgc_task.py +62 -45
  36. package/scripts/codecgc_artifact_roots.py +8 -40
  37. package/scripts/codecgc_console_io.py +3 -45
  38. package/scripts/codecgc_executor_registry.py +4 -54
  39. package/scripts/codecgc_path_contract.py +7 -0
  40. package/scripts/codecgc_policy.py +275 -0
  41. package/scripts/codecgc_routing_paths.py +3 -16
  42. package/scripts/codecgc_routing_template.py +11 -135
  43. package/scripts/codecgc_runtime/__init__.py +1 -0
  44. package/scripts/codecgc_runtime/artifacts.py +42 -0
  45. package/scripts/codecgc_runtime/console.py +45 -0
  46. package/scripts/codecgc_runtime/executor_registry.py +55 -0
  47. package/scripts/codecgc_runtime/mcp_config.py +72 -0
  48. package/scripts/codecgc_runtime/path_contract.py +123 -0
  49. package/scripts/codecgc_runtime/paths.py +22 -0
  50. package/scripts/codecgc_runtime/routing_paths.py +16 -0
  51. package/scripts/codecgc_runtime/routing_template.py +169 -0
  52. package/scripts/codecgc_runtime/workflow_runtime.py +72 -0
  53. package/scripts/codecgc_runtime_paths.py +3 -22
  54. package/scripts/codecgc_step_control.py +3 -2
  55. package/scripts/codecgc_workflow_runtime.py +3 -71
  56. package/scripts/entry_codecgc_workflow.py +4 -0
  57. package/scripts/install_codecgc.py +490 -21
  58. package/scripts/normalize_codecgc_audits.py +5 -3
  59. package/scripts/postinstall_codecgc.js +6 -56
  60. package/scripts/review_codecgc_workflow.py +6 -3
  61. package/scripts/route_codecgc_workflow.py +67 -36
  62. package/scripts/run_codecgc_build.py +28 -0
  63. package/scripts/run_codecgc_fix.py +28 -0
  64. package/scripts/run_codecgc_task.py +5 -2
  65. package/scripts/run_codecgc_test.py +28 -0
  66. package/scripts/sync_codecgc_mcp_config.py +4 -54
  67. package/scripts/write_codecgc_review.py +7 -3
@@ -1,17 +1,63 @@
1
1
  # CodeCGC MCP Server
2
2
 
3
- This package contains the first minimal CodeCGC orchestrator MCP server.
3
+ This package contains the CodeCGC orchestrator MCP server.
4
4
 
5
- Current scope:
5
+ The server is the preferred Claude-facing capability layer. The CLI remains available for fallback, CI, and local debugging.
6
6
 
7
- - install
8
- - status
9
- - doctor
10
- - entry
11
- - continue
12
- - explain
13
- - review
14
- - history
15
- - route
7
+ ## Current Tool Surface
8
+
9
+ - `codecgc.install`
10
+ - `codecgc.start`
11
+ - `codecgc.status`
12
+ - `codecgc.doctor`
13
+ - `codecgc.entry`
14
+ - `codecgc.continue`
15
+ - `codecgc.explain`
16
+ - `codecgc.review`
17
+ - `codecgc.history`
18
+ - `codecgc.route`
19
+ - `codecgc.plan`
20
+ - `codecgc.build`
21
+ - `codecgc.fix`
22
+ - `codecgc.test`
23
+ - `codecgc.package_audit`
24
+ - `codecgc.external_audit`
25
+ - `codecgc.external_status`
26
+ - `codecgc.release_readiness`
27
+ - `codecgc.lifecycle`
28
+
29
+ ## Runtime Boundary
16
30
 
17
31
  This server currently reuses the existing CodeCGC runtime scripts rather than replacing them.
32
+
33
+ The contract is:
34
+
35
+ - MCP tools expose product capabilities to Claude.
36
+ - Runtime scripts own workflow behavior.
37
+ - CLI commands stay as compatibility and maintainer surfaces.
38
+ - MCP responses should be machine-readable JSON payloads.
39
+ - `codecgc.external_status` is the concise panel view; `codecgc.external_audit` is the deeper consistency check.
40
+
41
+ ## Response Contract
42
+
43
+ Every tool returns a stable envelope:
44
+
45
+ ```json
46
+ {
47
+ "success": true,
48
+ "tool": "codecgc.status",
49
+ "payload": {},
50
+ "error": null,
51
+ "meta": {
52
+ "contract_version": "1.0",
53
+ "payload_success": true,
54
+ "response_shape": "codecgc.mcp.tool_result"
55
+ }
56
+ }
57
+ ```
58
+
59
+ The raw runtime response remains available under `payload`.
60
+
61
+ See `codecgc/reference/mcp-tool-surface.md` for the full contract.
62
+
63
+ Errors include a stable `error.category` field so Claude can distinguish runtime failures, invalid JSON, permission issues, missing scripts, and MCP wrapper exceptions without parsing text.
@@ -15,6 +15,16 @@ from codecgc_workflow_runtime import run_json_script
15
15
 
16
16
  mcp = FastMCP("CodeCGC MCP Server")
17
17
 
18
+ MCP_CONTRACT_VERSION = "1.0"
19
+
20
+ EXCEPTION_ERROR_CATEGORIES = {
21
+ "JSONDecodeError": "runtime-json-invalid",
22
+ "ValueError": "runtime-json-invalid",
23
+ "TimeoutExpired": "runtime-timeout",
24
+ "FileNotFoundError": "runtime-script-missing",
25
+ "PermissionError": "runtime-permission-denied",
26
+ }
27
+
18
28
 
19
29
  def _append_repeated_flag(args: list[str], flag: str, values: list[str]) -> None:
20
30
  for value in values:
@@ -27,18 +37,106 @@ def _normalize_workspace(workspace: str) -> str:
27
37
  return str(Path(workspace).expanduser().resolve()) if str(workspace).strip() else ""
28
38
 
29
39
 
30
- def _as_tool_result(payload: dict[str, Any]) -> CallToolResult:
40
+ def _payload_success(payload: dict[str, Any]) -> bool:
41
+ return bool(payload.get("success", True))
42
+
43
+
44
+ def _runtime_error_category(payload: dict[str, Any]) -> str:
45
+ raw_category = str(payload.get("error_category") or payload.get("failure_category") or "").strip()
46
+ if raw_category:
47
+ return raw_category
48
+ returncode = payload.get("returncode")
49
+ if returncode is not None:
50
+ return "runtime-script-failed"
51
+ return "runtime-payload-failed"
52
+
53
+
54
+ def _payload_error(tool_name: str, script_name: str, args: tuple[str, ...], payload: dict[str, Any]) -> dict[str, Any] | None:
55
+ if _payload_success(payload):
56
+ return None
57
+ summary = payload.get("summary", {}) if isinstance(payload.get("summary"), dict) else {}
58
+ message = str(
59
+ payload.get("error")
60
+ or summary.get("human_summary")
61
+ or summary.get("recommended_next_action")
62
+ or "Runtime script reported failure."
63
+ )
64
+ return {
65
+ "type": str(payload.get("error_type") or "RuntimeScriptError"),
66
+ "category": _runtime_error_category(payload),
67
+ "message": message,
68
+ "tool": tool_name,
69
+ "script": script_name,
70
+ "args": list(args),
71
+ "returncode": payload.get("returncode"),
72
+ }
73
+
74
+
75
+ def _exception_category(error: Exception) -> str:
76
+ return EXCEPTION_ERROR_CATEGORIES.get(error.__class__.__name__, "mcp-wrapper-exception")
77
+
78
+
79
+ def _exception_payload(tool_name: str, script_name: str, args: tuple[str, ...], error: Exception) -> tuple[dict[str, Any], dict[str, Any]]:
80
+ normalized_error = {
81
+ "type": error.__class__.__name__,
82
+ "category": _exception_category(error),
83
+ "message": str(error),
84
+ "tool": tool_name,
85
+ "script": script_name,
86
+ "args": list(args),
87
+ "returncode": None,
88
+ }
89
+ payload = {
90
+ "success": False,
91
+ "mode": "mcp-runtime-call",
92
+ "summary": {
93
+ "ready": False,
94
+ "human_summary": "CodeCGC MCP tool failed before a runtime JSON payload was produced.",
95
+ "recommended_next_action": "Check the runtime script output and MCP server logs.",
96
+ },
97
+ }
98
+ return payload, normalized_error
99
+
100
+
101
+ def _build_tool_envelope(tool_name: str, payload: dict[str, Any], error: dict[str, Any] | None = None) -> dict[str, Any]:
102
+ success = _payload_success(payload) and error is None
103
+ return {
104
+ "success": success,
105
+ "tool": tool_name,
106
+ "payload": payload,
107
+ "error": error,
108
+ "meta": {
109
+ "contract_version": MCP_CONTRACT_VERSION,
110
+ "payload_success": _payload_success(payload),
111
+ "response_shape": "codecgc.mcp.tool_result",
112
+ },
113
+ }
114
+
115
+
116
+ def _as_tool_result(tool_name: str, payload: dict[str, Any], error: dict[str, Any] | None = None) -> CallToolResult:
117
+ envelope = _build_tool_envelope(tool_name, payload, error)
31
118
  return CallToolResult(
32
119
  content=[
33
120
  TextContent(
34
121
  type="text",
35
- text=json.dumps(payload, ensure_ascii=True, indent=2),
122
+ text=json.dumps(envelope, ensure_ascii=False, indent=2),
36
123
  )
37
124
  ],
38
- isError=not bool(payload.get("success", True)),
125
+ isError=not bool(envelope.get("success", True)),
39
126
  )
40
127
 
41
128
 
129
+ def _call_runtime_tool(tool_name: str, script_name: str, *args: str, requested_format: str = "") -> CallToolResult:
130
+ try:
131
+ payload = run_json_script(script_name, *args)
132
+ if requested_format:
133
+ payload.setdefault("requested_format", requested_format)
134
+ return _as_tool_result(tool_name, payload, _payload_error(tool_name, script_name, args, payload))
135
+ except Exception as error:
136
+ payload, normalized_error = _exception_payload(tool_name, script_name, args, error)
137
+ return _as_tool_result(tool_name, payload, normalized_error)
138
+
139
+
42
140
  @mcp.tool(
43
141
  name="codecgc.install",
44
142
  description="Install or sync CodeCGC integration for the current project or Claude user profile.",
@@ -51,7 +149,7 @@ async def codecgc_install(
51
149
  ] = "local",
52
150
  format: Annotated[
53
151
  Literal["summary", "json"],
54
- Field(description="Output format. Use summary for normal product-facing replies."),
152
+ Field(description="Presentation hint. MCP responses are always returned as JSON payloads."),
55
153
  ] = "summary",
56
154
  workspace: Annotated[
57
155
  str,
@@ -62,13 +160,14 @@ async def codecgc_install(
62
160
  Field(description="Optional explicit Claude user root for user/user-dry-run modes."),
63
161
  ] = "",
64
162
  ) -> CallToolResult:
65
- args = ["--mode", mode, "--format", format]
163
+ # The MCP surface must always receive machine-readable JSON from the script.
164
+ args = ["--mode", mode, "--format", "json"]
66
165
  normalized_workspace = _normalize_workspace(workspace)
67
166
  if normalized_workspace:
68
167
  args.extend(["--workspace", normalized_workspace])
69
168
  if str(user_root).strip():
70
169
  args.extend(["--user-root", str(user_root).strip()])
71
- return _as_tool_result(run_json_script("install_codecgc.py", *args))
170
+ return _call_runtime_tool("codecgc.install", "install_codecgc.py", *args, requested_format=format)
72
171
 
73
172
 
74
173
  @mcp.tool(
@@ -86,7 +185,25 @@ async def codecgc_status(
86
185
  normalized_workspace = _normalize_workspace(workspace)
87
186
  if normalized_workspace:
88
187
  args.extend(["--workspace", normalized_workspace])
89
- return _as_tool_result(run_json_script("install_codecgc.py", *args))
188
+ return _call_runtime_tool("codecgc.status", "install_codecgc.py", *args)
189
+
190
+
191
+ @mcp.tool(
192
+ name="codecgc.start",
193
+ description="Show the project-local CodeCGC first-run guide and recommended next actions.",
194
+ meta={"version": "0.1.0", "author": "CodeCGC"},
195
+ )
196
+ async def codecgc_start(
197
+ workspace: Annotated[
198
+ str,
199
+ Field(description="Optional target workspace root."),
200
+ ] = "",
201
+ ) -> CallToolResult:
202
+ args = ["--mode", "start", "--format", "json"]
203
+ normalized_workspace = _normalize_workspace(workspace)
204
+ if normalized_workspace:
205
+ args.extend(["--workspace", normalized_workspace])
206
+ return _call_runtime_tool("codecgc.start", "install_codecgc.py", *args)
90
207
 
91
208
 
92
209
  @mcp.tool(
@@ -104,7 +221,7 @@ async def codecgc_doctor(
104
221
  normalized_workspace = _normalize_workspace(workspace)
105
222
  if normalized_workspace:
106
223
  args.extend(["--workspace", normalized_workspace])
107
- return _as_tool_result(run_json_script("install_codecgc.py", *args))
224
+ return _call_runtime_tool("codecgc.doctor", "install_codecgc.py", *args)
108
225
 
109
226
 
110
227
  @mcp.tool(
@@ -152,7 +269,7 @@ async def codecgc_entry(
152
269
  args.extend(["--audit-file", str(audit_file).strip()])
153
270
  if decision:
154
271
  args.extend(["--decision", decision])
155
- return _as_tool_result(run_json_script("entry_codecgc_workflow.py", *args))
272
+ return _call_runtime_tool("codecgc.entry", "entry_codecgc_workflow.py", *args)
156
273
 
157
274
 
158
275
  @mcp.tool(
@@ -185,7 +302,7 @@ async def codecgc_continue(
185
302
  args.append("--auto-dispatch")
186
303
  if dry_run:
187
304
  args.append("--dry-run")
188
- return _as_tool_result(run_json_script("entry_codecgc_workflow.py", *args))
305
+ return _call_runtime_tool("codecgc.continue", "entry_codecgc_workflow.py", *args)
189
306
 
190
307
 
191
308
  @mcp.tool(
@@ -212,7 +329,7 @@ async def codecgc_explain(
212
329
  args.append("--latest")
213
330
  if include_fixtures:
214
331
  args.append("--include-fixtures")
215
- return _as_tool_result(run_json_script("entry_codecgc_workflow.py", *args))
332
+ return _call_runtime_tool("codecgc.explain", "entry_codecgc_workflow.py", *args)
216
333
 
217
334
 
218
335
  @mcp.tool(
@@ -236,7 +353,7 @@ async def codecgc_review(
236
353
  args.extend(["--next-step", str(next_step).strip()])
237
354
  if force:
238
355
  args.append("--force")
239
- return _as_tool_result(run_json_script("review_codecgc_workflow.py", *args))
356
+ return _call_runtime_tool("codecgc.review", "review_codecgc_workflow.py", *args)
240
357
 
241
358
 
242
359
  @mcp.tool(
@@ -256,7 +373,7 @@ async def codecgc_history(
256
373
  args = ["--flow", flow, "--status", str(status).strip() or "all", "--last", str(int(last)), "--format", "json"]
257
374
  if include_fixtures:
258
375
  args.append("--include-fixtures")
259
- return _as_tool_result(run_json_script("audit_codecgc_workflow_history.py", *args))
376
+ return _call_runtime_tool("codecgc.history", "audit_codecgc_workflow_history.py", *args)
260
377
 
261
378
 
262
379
  @mcp.tool(
@@ -271,7 +388,7 @@ async def codecgc_route(
271
388
  ],
272
389
  slug: Annotated[str, "Workflow slug."],
273
390
  ) -> CallToolResult:
274
- return _as_tool_result(run_json_script("route_codecgc_workflow.py", "--flow", flow, "--slug", str(slug).strip()))
391
+ return _call_runtime_tool("codecgc.route", "route_codecgc_workflow.py", "--flow", flow, "--slug", str(slug).strip())
275
392
 
276
393
 
277
394
  @mcp.tool(
@@ -354,7 +471,7 @@ async def codecgc_plan(
354
471
  args.extend(["--artifact-class", artifact_class])
355
472
  if force:
356
473
  args.append("--force")
357
- return _as_tool_result(run_json_script("plan_codecgc_workflow.py", *args))
474
+ return _call_runtime_tool("codecgc.plan", "plan_codecgc_workflow.py", *args)
358
475
 
359
476
 
360
477
  @mcp.tool(
@@ -385,7 +502,7 @@ async def codecgc_build(
385
502
  args.append("--dry-run")
386
503
  if return_all_messages:
387
504
  args.append("--return-all-messages")
388
- return _as_tool_result(run_json_script("run_codecgc_build.py", *args))
505
+ return _call_runtime_tool("codecgc.build", "run_codecgc_build.py", *args)
389
506
 
390
507
 
391
508
  @mcp.tool(
@@ -416,7 +533,7 @@ async def codecgc_fix(
416
533
  args.append("--dry-run")
417
534
  if return_all_messages:
418
535
  args.append("--return-all-messages")
419
- return _as_tool_result(run_json_script("run_codecgc_fix.py", *args))
536
+ return _call_runtime_tool("codecgc.fix", "run_codecgc_fix.py", *args)
420
537
 
421
538
 
422
539
  @mcp.tool(
@@ -451,7 +568,7 @@ async def codecgc_test(
451
568
  args.append("--dry-run")
452
569
  if return_all_messages:
453
570
  args.append("--return-all-messages")
454
- return _as_tool_result(run_json_script("run_codecgc_test.py", *args))
571
+ return _call_runtime_tool("codecgc.test", "run_codecgc_test.py", *args)
455
572
 
456
573
 
457
574
  @mcp.tool(
@@ -465,7 +582,15 @@ async def codecgc_package_audit(
465
582
  Field(description="Output format."),
466
583
  ] = "json",
467
584
  ) -> CallToolResult:
468
- return _as_tool_result(run_json_script("audit_codecgc_package_runtime.py", "--format", format))
585
+ return _call_runtime_tool("codecgc.package_audit", "audit_codecgc_package_runtime.py", "--format", format)
586
+
587
+
588
+ def _external_capability_runtime_args(view: str, workspace: str, format: str) -> list[str]:
589
+ args = ["--view", view, "--format", format]
590
+ normalized_workspace = _normalize_workspace(workspace)
591
+ if normalized_workspace:
592
+ args.extend(["--workspace", normalized_workspace])
593
+ return args
469
594
 
470
595
 
471
596
  @mcp.tool(
@@ -480,11 +605,24 @@ async def codecgc_external_audit(
480
605
  Field(description="Output format."),
481
606
  ] = "json",
482
607
  ) -> CallToolResult:
483
- args = ["--format", format]
484
- normalized_workspace = _normalize_workspace(workspace)
485
- if normalized_workspace:
486
- args.extend(["--workspace", normalized_workspace])
487
- return _as_tool_result(run_json_script("audit_codecgc_external_capabilities.py", *args))
608
+ args = _external_capability_runtime_args("audit", workspace, format)
609
+ return _call_runtime_tool("codecgc.external_audit", "audit_codecgc_external_capabilities.py", *args)
610
+
611
+
612
+ @mcp.tool(
613
+ name="codecgc.external_status",
614
+ description="Render the concise external capability status panel for day-to-day checks.",
615
+ meta={"version": "0.1.0", "author": "CodeCGC"},
616
+ )
617
+ async def codecgc_external_status(
618
+ workspace: Annotated[str, "Optional target workspace root."] = "",
619
+ format: Annotated[
620
+ Literal["summary", "json"],
621
+ Field(description="Output format."),
622
+ ] = "summary",
623
+ ) -> CallToolResult:
624
+ args = _external_capability_runtime_args("status", workspace, format)
625
+ return _call_runtime_tool("codecgc.external_status", "audit_codecgc_external_capabilities.py", *args)
488
626
 
489
627
 
490
628
  @mcp.tool(
@@ -503,7 +641,7 @@ async def codecgc_release_readiness(
503
641
  normalized_workspace = _normalize_workspace(workspace)
504
642
  if normalized_workspace:
505
643
  args.extend(["--workspace", normalized_workspace])
506
- return _as_tool_result(run_json_script("audit_codecgc_release_readiness.py", *args))
644
+ return _call_runtime_tool("codecgc.release_readiness", "audit_codecgc_release_readiness.py", *args)
507
645
 
508
646
 
509
647
  @mcp.tool(
@@ -517,7 +655,7 @@ async def codecgc_lifecycle(
517
655
  Field(description="Output format."),
518
656
  ] = "json",
519
657
  ) -> CallToolResult:
520
- return _as_tool_result(run_json_script("audit_codecgc_lifecycle.py", "--format", format))
658
+ return _call_runtime_tool("codecgc.lifecycle", "audit_codecgc_lifecycle.py", "--format", format)
521
659
 
522
660
 
523
661
  def run() -> None:
@@ -2,6 +2,8 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import asyncio
6
+ import functools
5
7
  import json
6
8
  import os
7
9
  import queue
@@ -134,12 +136,11 @@ def _validate_backend_target_paths(target_paths: List[Path]) -> tuple[bool, List
134
136
  return True, policy_checks, ""
135
137
 
136
138
 
137
- def run_shell_command(cmd: list[str], cwd: Optional[Path] = None) -> Generator[str, None, None]:
139
+ def run_shell_command(cmd: list[str]) -> Generator[str, None, None]:
138
140
  """Execute a command and stream its output line-by-line.
139
141
 
140
142
  Args:
141
143
  cmd: Command and arguments as a list (e.g., ["codex", "exec", "prompt"])
142
- cwd: Optional working directory for the command
143
144
 
144
145
  Yields:
145
146
  Output lines from the command
@@ -158,7 +159,6 @@ def run_shell_command(cmd: list[str], cwd: Optional[Path] = None) -> Generator[s
158
159
  stderr=subprocess.STDOUT,
159
160
  universal_newlines=True,
160
161
  encoding='utf-8',
161
- cwd=str(cwd) if cwd else None, # 添加 cwd 参数,确保在正确的工作目录中运行
162
162
  )
163
163
 
164
164
  output_queue: queue.Queue[str | None] = queue.Queue()
@@ -265,7 +265,7 @@ def _execute_codex_session(
265
265
  err_message = ""
266
266
  thread_id: Optional[str] = None
267
267
 
268
- for line in run_shell_command(cmd, cwd=cd):
268
+ for line in run_shell_command(cmd):
269
269
  try:
270
270
  line_dict = json.loads(line.strip())
271
271
  all_messages.append(line_dict)
@@ -409,17 +409,20 @@ async def codex(
409
409
  ] = "",
410
410
  ) -> Dict[str, Any]:
411
411
  """Execute a Codex CLI session and return the results."""
412
- return _execute_codex_session(
413
- prompt=PROMPT,
414
- cd=cd,
415
- sandbox=sandbox,
416
- session_id=SESSION_ID,
417
- skip_git_repo_check=skip_git_repo_check,
418
- return_all_messages=return_all_messages,
419
- image=image,
420
- model=model,
421
- yolo=yolo,
422
- profile=profile,
412
+ return await asyncio.to_thread(
413
+ functools.partial(
414
+ _execute_codex_session,
415
+ prompt=PROMPT,
416
+ cd=cd,
417
+ sandbox=sandbox,
418
+ session_id=SESSION_ID,
419
+ skip_git_repo_check=skip_git_repo_check,
420
+ return_all_messages=return_all_messages,
421
+ image=image,
422
+ model=model,
423
+ yolo=yolo,
424
+ profile=profile,
425
+ )
423
426
  )
424
427
 
425
428
 
@@ -495,17 +498,20 @@ async def implement_backend_task(
495
498
  constraints=constraints,
496
499
  acceptance_criteria=acceptance_criteria,
497
500
  )
498
- result = _execute_codex_session(
499
- prompt=prompt,
500
- cd=cd,
501
- sandbox=sandbox,
502
- session_id=SESSION_ID,
503
- skip_git_repo_check=True,
504
- return_all_messages=return_all_messages,
505
- image=[],
506
- model=model,
507
- yolo=False,
508
- profile=profile,
501
+ result = await asyncio.to_thread(
502
+ functools.partial(
503
+ _execute_codex_session,
504
+ prompt=prompt,
505
+ cd=cd,
506
+ sandbox=sandbox,
507
+ session_id=SESSION_ID,
508
+ skip_git_repo_check=True,
509
+ return_all_messages=return_all_messages,
510
+ image=[],
511
+ model=model,
512
+ yolo=False,
513
+ profile=profile,
514
+ )
509
515
  )
510
516
 
511
517
  if not result.get("success"):
@@ -2,6 +2,8 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import asyncio
6
+ import functools
5
7
  import json
6
8
  import os
7
9
  import queue
@@ -359,13 +361,16 @@ async def gemini(
359
361
  ] = "",
360
362
  ) -> Dict[str, Any]:
361
363
  """Execute a gemini CLI session and return the results."""
362
- return _execute_gemini_session(
363
- prompt=PROMPT,
364
- cd=cd,
365
- sandbox=sandbox,
366
- session_id=SESSION_ID,
367
- return_all_messages=return_all_messages,
368
- model=model,
364
+ return await asyncio.to_thread(
365
+ functools.partial(
366
+ _execute_gemini_session,
367
+ prompt=PROMPT,
368
+ cd=cd,
369
+ sandbox=sandbox,
370
+ session_id=SESSION_ID,
371
+ return_all_messages=return_all_messages,
372
+ model=model,
373
+ )
369
374
  )
370
375
 
371
376
 
@@ -433,13 +438,16 @@ async def implement_frontend_task(
433
438
  constraints=constraints,
434
439
  acceptance_criteria=acceptance_criteria,
435
440
  )
436
- result = _execute_gemini_session(
437
- prompt=prompt,
438
- cd=cd,
439
- sandbox=sandbox,
440
- session_id=SESSION_ID,
441
- return_all_messages=return_all_messages,
442
- model=model,
441
+ result = await asyncio.to_thread(
442
+ functools.partial(
443
+ _execute_gemini_session,
444
+ prompt=prompt,
445
+ cd=cd,
446
+ sandbox=sandbox,
447
+ session_id=SESSION_ID,
448
+ return_all_messages=return_all_messages,
449
+ model=model,
450
+ )
443
451
  )
444
452
 
445
453
  if not result.get("success"):
@@ -1,4 +1,17 @@
1
- version: 1
1
+ version: 2
2
+
3
+ orchestration_paths:
4
+ - "codecgc/**"
5
+ - ".claude/commands/**"
6
+ - ".claude/settings.json"
7
+ - ".mcp.json"
8
+ - "model-routing.yaml"
9
+
10
+ docs_paths:
11
+ - "README.md"
12
+ - "INSTALLATION.md"
13
+ - "docs/**"
14
+ - "CHANGELOG.md"
2
15
 
3
16
  frontend_paths:
4
17
  - "apps/web/**"
@@ -9,8 +22,6 @@ frontend_paths:
9
22
  - "web/**"
10
23
  - "frontend/**"
11
24
 
12
- custom_frontend_paths:
13
-
14
25
  backend_paths:
15
26
  - "apps/api/**"
16
27
  - "server/**"
@@ -19,7 +30,19 @@ backend_paths:
19
30
  - "src/repositories/**"
20
31
  - "backend/**"
21
32
 
22
- custom_backend_paths:
33
+ test_paths:
34
+ frontend:
35
+ - "apps/web/*.test.*"
36
+ - "apps/web/*.spec.*"
37
+ - "apps/web/**/*.test.*"
38
+ - "apps/web/**/*.spec.*"
39
+ - "tests/frontend/**"
40
+ backend:
41
+ - "apps/api/*.test.*"
42
+ - "apps/api/*.spec.*"
43
+ - "apps/api/**/*.test.*"
44
+ - "apps/api/**/*.spec.*"
45
+ - "tests/backend/**"
23
46
 
24
47
  shared_paths:
25
48
  - "packages/shared/**"
@@ -28,7 +51,9 @@ shared_paths:
28
51
  - "src/types/**"
29
52
 
30
53
  rules:
31
- frontend_executor: "geminimcp"
54
+ claude_allowed_owners:
55
+ - "orchestration"
56
+ - "docs"
32
57
  backend_executor: "codexmcp"
58
+ frontend_executor: "geminimcp"
33
59
  shared_policy: "split-first"
34
- claude_role: "plan-review-accept-only"