@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,57 +1,7 @@
1
- import os
2
- import json
3
- from pathlib import Path
4
-
5
- from codecgc_executor_registry import build_executor_registry
6
-
7
-
8
- WORKSPACE = Path(__file__).resolve().parents[1]
9
- MCP_CONFIG_PATH = WORKSPACE / ".mcp.json"
10
-
11
-
12
- def build_runtime_pythonpath(*extra_paths: Path) -> str:
13
- paths = [str(WORKSPACE / "scripts"), *(str(path) for path in extra_paths)]
14
- return os.pathsep.join(paths)
15
-
16
-
17
- def build_mcp_config() -> dict:
18
- registry = build_executor_registry()
19
- servers: dict[str, dict] = {}
20
-
21
- servers["codecgc"] = {
22
- "command": str(next(iter(registry.values()))["python_command"]),
23
- "args": ["-m", "codecgcmcp.cli"],
24
- "env": {
25
- "PYTHONPATH": build_runtime_pythonpath(WORKSPACE / "codecgcmcp" / "src"),
26
- },
27
- }
28
-
29
- for config in registry.values():
30
- servers[str(config["mcp_server_name"])] = {
31
- "command": str(config["python_command"]),
32
- "args": ["-m", str(config["python_module"])],
33
- "env": {
34
- "PYTHONPATH": build_runtime_pythonpath(
35
- WORKSPACE / "codecgcmcp" / "src",
36
- Path(str(config["pythonpath"])),
37
- ),
38
- },
39
- }
40
-
41
- return {"mcpServers": servers}
42
-
43
-
44
- def write_mcp_config(target_path: Path) -> Path:
45
- config = build_mcp_config()
46
- target_path.parent.mkdir(parents=True, exist_ok=True)
47
- target_path.write_text(json.dumps(config, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
48
- return target_path
49
-
50
-
51
- def main() -> int:
52
- write_mcp_config(MCP_CONFIG_PATH)
53
- print(json.dumps({"success": True, "path": str(MCP_CONFIG_PATH)}, ensure_ascii=False, indent=2))
54
- return 0
1
+ from codecgc_runtime.mcp_config import build_mcp_config
2
+ from codecgc_runtime.mcp_config import build_runtime_pythonpath
3
+ from codecgc_runtime.mcp_config import main
4
+ from codecgc_runtime.mcp_config import write_mcp_config
55
5
 
56
6
 
57
7
  if __name__ == "__main__":
@@ -8,6 +8,8 @@ from codecgc_artifact_roots import flow_root
8
8
  from codecgc_artifact_roots import normalize_artifact_class
9
9
  from codecgc_console_io import configure_utf8_stdio
10
10
  from codecgc_console_io import print_json
11
+ from codecgc_path_contract import normalize_persisted_project_path
12
+ from codecgc_path_contract import resolve_project_path
11
13
  from codecgc_review_control import ACTION_KIND_LABELS
12
14
  from codecgc_review_control import FALLBACK_STAGE_LABELS
13
15
  from codecgc_review_control import display_policy_reason
@@ -50,6 +52,7 @@ def build_parser() -> argparse.ArgumentParser:
50
52
 
51
53
 
52
54
  def load_json(path: Path) -> dict[str, Any]:
55
+ path = resolve_project_path(path)
53
56
  if not path.exists():
54
57
  raise FileNotFoundError(f"未找到审计文件:{path}")
55
58
  data = json.loads(path.read_text(encoding="utf-8"))
@@ -87,7 +90,7 @@ def resolve_checklist_path_from_audit(audit: dict[str, Any]) -> Path:
87
90
  artifact_file = str(source.get("artifact_file", ""))
88
91
  if not artifact_file:
89
92
  raise ValueError("审计 source 缺少 artifact_file。")
90
- return Path(artifact_file)
93
+ return resolve_project_path(artifact_file)
91
94
 
92
95
 
93
96
  def resolve_step_number_from_audit(audit: dict[str, Any]) -> int:
@@ -223,6 +226,7 @@ def extract_title(body: str) -> str:
223
226
 
224
227
 
225
228
  def write_review(audit_path: Path, decision: str, risks: list[str], next_step: str, force: bool) -> dict[str, str]:
229
+ audit_path = resolve_project_path(audit_path)
226
230
  audit = load_json(audit_path)
227
231
  artifact_type, artifact_path = resolve_artifact_path(audit)
228
232
  checklist_path = resolve_checklist_path_from_audit(audit)
@@ -248,8 +252,8 @@ def write_review(audit_path: Path, decision: str, risks: list[str], next_step: s
248
252
  )
249
253
  return {
250
254
  "artifact_type": artifact_type,
251
- "artifact_path": str(artifact_path),
252
- "checklist_path": str(checklist_path),
255
+ "artifact_path": normalize_persisted_project_path(artifact_path),
256
+ "checklist_path": normalize_persisted_project_path(checklist_path),
253
257
  "step_number": str(step_number),
254
258
  "step_status": "done" if values["final_decision"] == "accepted" else "pending",
255
259
  }