@hunyed15/codecgc 0.1.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 (128) hide show
  1. package/.claude/hooks/route-edit.ps1 +86 -0
  2. package/INSTALLATION.md +550 -0
  3. package/LICENSE +21 -0
  4. package/README.md +171 -0
  5. package/bin/cgc-build.js +4 -0
  6. package/bin/cgc-doctor.js +4 -0
  7. package/bin/cgc-entry.js +4 -0
  8. package/bin/cgc-external-audit.js +4 -0
  9. package/bin/cgc-fix.js +4 -0
  10. package/bin/cgc-history.js +4 -0
  11. package/bin/cgc-install.js +4 -0
  12. package/bin/cgc-lifecycle.js +4 -0
  13. package/bin/cgc-package-audit.js +4 -0
  14. package/bin/cgc-plan.js +4 -0
  15. package/bin/cgc-release-readiness.js +4 -0
  16. package/bin/cgc-review.js +4 -0
  17. package/bin/cgc-route.js +4 -0
  18. package/bin/cgc-status.js +4 -0
  19. package/bin/cgc-test.js +4 -0
  20. package/bin/cgc.js +4 -0
  21. package/bin/codecgc.js +1284 -0
  22. package/codecgc/cgc/SKILL.md +46 -0
  23. package/codecgc/cgc-arch/SKILL.md +61 -0
  24. package/codecgc/cgc-build/SKILL.md +53 -0
  25. package/codecgc/cgc-decide/SKILL.md +55 -0
  26. package/codecgc/cgc-fix/SKILL.md +47 -0
  27. package/codecgc/cgc-learn/SKILL.md +46 -0
  28. package/codecgc/cgc-onboard/SKILL.md +52 -0
  29. package/codecgc/cgc-plan/SKILL.md +48 -0
  30. package/codecgc/cgc-refactor/SKILL.md +46 -0
  31. package/codecgc/cgc-req/SKILL.md +61 -0
  32. package/codecgc/cgc-review/SKILL.md +57 -0
  33. package/codecgc/cgc-roadmap/SKILL.md +55 -0
  34. package/codecgc/cgc-test/SKILL.md +21 -0
  35. package/codecgc/reference/api-cgc-review-libdoc.md +13 -0
  36. package/codecgc/reference/artifact-class-policy.md +81 -0
  37. package/codecgc/reference/build-flow.md +95 -0
  38. package/codecgc/reference/checklist-contract.md +103 -0
  39. package/codecgc/reference/execution-audit.md +121 -0
  40. package/codecgc/reference/execution-model.md +118 -0
  41. package/codecgc/reference/execution-routing.md +130 -0
  42. package/codecgc/reference/executor-contract.md +87 -0
  43. package/codecgc/reference/external-capability-registry.json +104 -0
  44. package/codecgc/reference/fix-flow.md +94 -0
  45. package/codecgc/reference/fixture-governance.md +60 -0
  46. package/codecgc/reference/flow-execution.md +65 -0
  47. package/codecgc/reference/lifecycle-map.md +172 -0
  48. package/codecgc/reference/lifecycle-playbook.md +104 -0
  49. package/codecgc/reference/long-lived-artifacts.md +98 -0
  50. package/codecgc/reference/operation-guide.md +242 -0
  51. package/codecgc/reference/release-maintenance-playbook.md +150 -0
  52. package/codecgc/reference/review-writeback.md +141 -0
  53. package/codecgc/reference/role-model.md +128 -0
  54. package/codecgc/reference/runtime-boundary.md +72 -0
  55. package/codecgc/reference/shared-conventions.md +93 -0
  56. package/codecgc/reference/workflow-scaffold.md +57 -0
  57. package/codexmcp/LICENSE +21 -0
  58. package/codexmcp/README.md +294 -0
  59. package/codexmcp/pyproject.toml +37 -0
  60. package/codexmcp/src/codexmcp/__init__.py +4 -0
  61. package/codexmcp/src/codexmcp/cli.py +12 -0
  62. package/codexmcp/src/codexmcp/server.py +529 -0
  63. package/geminimcp/README.md +258 -0
  64. package/geminimcp/pyproject.toml +15 -0
  65. package/geminimcp/src/geminimcp/__init__.py +4 -0
  66. package/geminimcp/src/geminimcp/cli.py +12 -0
  67. package/geminimcp/src/geminimcp/server.py +465 -0
  68. package/model-routing.yaml +30 -0
  69. package/package.json +90 -0
  70. package/requirements.txt +1 -0
  71. package/scripts/README-codecgc-cli.md +89 -0
  72. package/scripts/audit_codecgc_external_capabilities.py +276 -0
  73. package/scripts/audit_codecgc_historical_audits.py +242 -0
  74. package/scripts/audit_codecgc_lifecycle.py +241 -0
  75. package/scripts/audit_codecgc_package_runtime.py +445 -0
  76. package/scripts/audit_codecgc_release_readiness.py +202 -0
  77. package/scripts/audit_codecgc_review_policy.py +82 -0
  78. package/scripts/audit_codecgc_workflow_history.py +317 -0
  79. package/scripts/build_codecgc_task.py +487 -0
  80. package/scripts/codecgc_artifact_roots.py +40 -0
  81. package/scripts/codecgc_cli.py +843 -0
  82. package/scripts/codecgc_command_surface.py +28 -0
  83. package/scripts/codecgc_console_io.py +45 -0
  84. package/scripts/codecgc_executor_registry.py +54 -0
  85. package/scripts/codecgc_file_evidence.py +349 -0
  86. package/scripts/codecgc_flow_control.py +233 -0
  87. package/scripts/codecgc_governance_dedupe.py +161 -0
  88. package/scripts/codecgc_plan_decision.py +103 -0
  89. package/scripts/codecgc_review_control.py +588 -0
  90. package/scripts/codecgc_roadmap_templates.py +149 -0
  91. package/scripts/codecgc_routing_paths.py +16 -0
  92. package/scripts/codecgc_routing_template.py +135 -0
  93. package/scripts/codecgc_runtime_paths.py +22 -0
  94. package/scripts/codecgc_session_recovery.py +44 -0
  95. package/scripts/codecgc_step_control.py +154 -0
  96. package/scripts/codecgc_workflow_runtime.py +63 -0
  97. package/scripts/codecgc_workflow_templates.py +437 -0
  98. package/scripts/entry_codecgc_workflow.py +3419 -0
  99. package/scripts/exercise_mcp_tools.py +109 -0
  100. package/scripts/expand_codecgc_roadmap.py +664 -0
  101. package/scripts/init_codecgc_roadmap.py +134 -0
  102. package/scripts/init_codecgc_workflow.py +207 -0
  103. package/scripts/install_codecgc.py +938 -0
  104. package/scripts/migrate_demo_workflows_to_fixtures.py +128 -0
  105. package/scripts/normalize_codecgc_audits.py +114 -0
  106. package/scripts/normalize_codecgc_governance_docs.py +79 -0
  107. package/scripts/normalize_codecgc_workflow_docs.py +269 -0
  108. package/scripts/plan_codecgc_workflow.py +970 -0
  109. package/scripts/refresh_codecgc_review_policy.py +223 -0
  110. package/scripts/review_codecgc_workflow.py +88 -0
  111. package/scripts/route_codecgc_workflow.py +671 -0
  112. package/scripts/run_codecgc_build.py +104 -0
  113. package/scripts/run_codecgc_fix.py +104 -0
  114. package/scripts/run_codecgc_flow_step.py +165 -0
  115. package/scripts/run_codecgc_task.py +410 -0
  116. package/scripts/run_codecgc_test.py +105 -0
  117. package/scripts/sync_codecgc_mcp_config.py +41 -0
  118. package/scripts/write_codecgc_architecture.py +78 -0
  119. package/scripts/write_codecgc_decision.py +83 -0
  120. package/scripts/write_codecgc_explore.py +118 -0
  121. package/scripts/write_codecgc_guide.py +141 -0
  122. package/scripts/write_codecgc_learning.py +87 -0
  123. package/scripts/write_codecgc_libdoc.py +140 -0
  124. package/scripts/write_codecgc_refactor.py +78 -0
  125. package/scripts/write_codecgc_requirement.py +78 -0
  126. package/scripts/write_codecgc_review.py +291 -0
  127. package/scripts/write_codecgc_roadmap.py +122 -0
  128. package/scripts/write_codecgc_trick.py +123 -0
@@ -0,0 +1,104 @@
1
+ import argparse
2
+ import sys
3
+
4
+ from codecgc_command_surface import matches_command
5
+ from codecgc_command_surface import to_public_command
6
+ from codecgc_console_io import configure_utf8_stdio
7
+ from codecgc_console_io import print_json
8
+ from codecgc_flow_control import build_execution_result
9
+ from codecgc_flow_control import build_not_ready_result
10
+ from codecgc_session_recovery import resolve_session_id_from_task
11
+ from codecgc_step_control import get_step_metadata
12
+ from codecgc_step_control import select_next_executable_step
13
+ from run_codecgc_flow_step import resolve_checklist_path
14
+ from codecgc_workflow_runtime import run_json_script
15
+
16
+
17
+ def build_parser() -> argparse.ArgumentParser:
18
+ parser = argparse.ArgumentParser(
19
+ description="CodeCGC 的高层功能开发入口:校验路由与步骤状态,并执行一个功能开发步骤。"
20
+ )
21
+ parser.add_argument("--slug", required=True)
22
+ parser.add_argument("--step-number", type=int)
23
+ parser.add_argument("--checklist-file", default="")
24
+ parser.add_argument("--audit-root", default="")
25
+ parser.add_argument("--timeout-seconds", type=int, default=120)
26
+ parser.add_argument("--session-id", default="")
27
+ parser.add_argument("--dry-run", action="store_true")
28
+ parser.add_argument("--return-all-messages", action="store_true")
29
+ return parser
30
+
31
+
32
+ def main() -> int:
33
+ configure_utf8_stdio()
34
+ parser = build_parser()
35
+ args = parser.parse_args()
36
+
37
+ route = run_json_script("route_codecgc_workflow.py", "--flow", "feature", "--slug", args.slug)
38
+ if not matches_command(str(route.get("recommended_command", "")).strip(), "cgc-build"):
39
+ result = build_not_ready_result("feature", args.slug, route, "cgc-build")
40
+ print_json(result)
41
+ return 1
42
+
43
+ try:
44
+ checklist_path = resolve_checklist_path("feature", args.slug, args.checklist_file)
45
+ selected = (
46
+ get_step_metadata(checklist_path, args.step_number)
47
+ if args.step_number
48
+ else select_next_executable_step(checklist_path)
49
+ )
50
+ except Exception as error:
51
+ result = {
52
+ "success": False,
53
+ "flow": "feature",
54
+ "slug": args.slug,
55
+ "state": "not-ready",
56
+ "failure_type": "workflow-state",
57
+ "route": route,
58
+ "error": str(error),
59
+ "recommended_command": to_public_command("cgc-plan"),
60
+ "next": "先处理仅规划步骤,或补齐缺失的可执行步骤,再进入 build 执行。",
61
+ }
62
+ print_json(result)
63
+ return 1
64
+
65
+ effective_session_id = args.session_id.strip()
66
+ if not effective_session_id:
67
+ effective_session_id = resolve_session_id_from_task(
68
+ str(selected.get("task_id", "")).strip(),
69
+ str(route.get("artifact_class", "")).strip() or "product",
70
+ )
71
+
72
+ command_args = [
73
+ "--flow",
74
+ "feature",
75
+ "--slug",
76
+ args.slug,
77
+ "--step-number",
78
+ str(selected["step_number"]),
79
+ "--timeout-seconds",
80
+ str(args.timeout_seconds),
81
+ ]
82
+ if args.checklist_file:
83
+ command_args.extend(["--checklist-file", args.checklist_file])
84
+ if args.audit_root:
85
+ command_args.extend(["--audit-root", args.audit_root])
86
+ if effective_session_id:
87
+ command_args.extend(["--session-id", effective_session_id])
88
+ if args.dry_run:
89
+ command_args.append("--dry-run")
90
+ if args.return_all_messages:
91
+ command_args.append("--return-all-messages")
92
+
93
+ execution = run_json_script("run_codecgc_flow_step.py", *command_args)
94
+ result = build_execution_result(flow="feature", slug=args.slug, route=route, execution=execution)
95
+ result["selected_step"] = selected
96
+ result["reused_session_id"] = effective_session_id
97
+ print_json(result)
98
+ if result.get("success") or str(result.get("state", "")).strip() == "executed-dry-run":
99
+ return 0
100
+ return 1
101
+
102
+
103
+ if __name__ == "__main__":
104
+ raise SystemExit(main())
@@ -0,0 +1,104 @@
1
+ import argparse
2
+ import sys
3
+
4
+ from codecgc_command_surface import matches_command
5
+ from codecgc_command_surface import to_public_command
6
+ from codecgc_console_io import configure_utf8_stdio
7
+ from codecgc_console_io import print_json
8
+ from codecgc_flow_control import build_execution_result
9
+ from codecgc_flow_control import build_not_ready_result
10
+ from codecgc_session_recovery import resolve_session_id_from_task
11
+ from codecgc_step_control import get_step_metadata
12
+ from codecgc_step_control import select_next_executable_step
13
+ from run_codecgc_flow_step import resolve_checklist_path
14
+ from codecgc_workflow_runtime import run_json_script
15
+
16
+
17
+ def build_parser() -> argparse.ArgumentParser:
18
+ parser = argparse.ArgumentParser(
19
+ description="CodeCGC 的高层问题修复入口:校验路由与步骤状态,并执行一个问题修复步骤。"
20
+ )
21
+ parser.add_argument("--slug", required=True)
22
+ parser.add_argument("--step-number", type=int)
23
+ parser.add_argument("--checklist-file", default="")
24
+ parser.add_argument("--audit-root", default="")
25
+ parser.add_argument("--timeout-seconds", type=int, default=120)
26
+ parser.add_argument("--session-id", default="")
27
+ parser.add_argument("--dry-run", action="store_true")
28
+ parser.add_argument("--return-all-messages", action="store_true")
29
+ return parser
30
+
31
+
32
+ def main() -> int:
33
+ configure_utf8_stdio()
34
+ parser = build_parser()
35
+ args = parser.parse_args()
36
+
37
+ route = run_json_script("route_codecgc_workflow.py", "--flow", "issue", "--slug", args.slug)
38
+ if not matches_command(str(route.get("recommended_command", "")).strip(), "cgc-fix"):
39
+ result = build_not_ready_result("issue", args.slug, route, "cgc-fix")
40
+ print_json(result)
41
+ return 1
42
+
43
+ try:
44
+ checklist_path = resolve_checklist_path("issue", args.slug, args.checklist_file)
45
+ selected = (
46
+ get_step_metadata(checklist_path, args.step_number)
47
+ if args.step_number
48
+ else select_next_executable_step(checklist_path)
49
+ )
50
+ except Exception as error:
51
+ result = {
52
+ "success": False,
53
+ "flow": "issue",
54
+ "slug": args.slug,
55
+ "state": "not-ready",
56
+ "failure_type": "workflow-state",
57
+ "route": route,
58
+ "error": str(error),
59
+ "recommended_command": to_public_command("cgc-plan"),
60
+ "next": "先处理仅规划步骤,或补齐缺失的可执行步骤,再进入 fix 执行。",
61
+ }
62
+ print_json(result)
63
+ return 1
64
+
65
+ effective_session_id = args.session_id.strip()
66
+ if not effective_session_id:
67
+ effective_session_id = resolve_session_id_from_task(
68
+ str(selected.get("task_id", "")).strip(),
69
+ str(route.get("artifact_class", "")).strip() or "product",
70
+ )
71
+
72
+ command_args = [
73
+ "--flow",
74
+ "issue",
75
+ "--slug",
76
+ args.slug,
77
+ "--step-number",
78
+ str(selected["step_number"]),
79
+ "--timeout-seconds",
80
+ str(args.timeout_seconds),
81
+ ]
82
+ if args.checklist_file:
83
+ command_args.extend(["--checklist-file", args.checklist_file])
84
+ if args.audit_root:
85
+ command_args.extend(["--audit-root", args.audit_root])
86
+ if effective_session_id:
87
+ command_args.extend(["--session-id", effective_session_id])
88
+ if args.dry_run:
89
+ command_args.append("--dry-run")
90
+ if args.return_all_messages:
91
+ command_args.append("--return-all-messages")
92
+
93
+ execution = run_json_script("run_codecgc_flow_step.py", *command_args)
94
+ result = build_execution_result(flow="issue", slug=args.slug, route=route, execution=execution)
95
+ result["selected_step"] = selected
96
+ result["reused_session_id"] = effective_session_id
97
+ print_json(result)
98
+ if result.get("success") or str(result.get("state", "")).strip() == "executed-dry-run":
99
+ return 0
100
+ return 1
101
+
102
+
103
+ if __name__ == "__main__":
104
+ raise SystemExit(main())
@@ -0,0 +1,165 @@
1
+ import argparse
2
+ import json
3
+ import re
4
+ import subprocess
5
+ import sys
6
+ from pathlib import Path
7
+
8
+ from codecgc_artifact_roots import discover_flow_directory
9
+ from codecgc_console_io import configure_utf8_stdio
10
+ from codecgc_console_io import print_json
11
+ from codecgc_runtime_paths import PACKAGE_ROOT
12
+ from codecgc_runtime_paths import PROJECT_ROOT
13
+
14
+ WORKSPACE = PACKAGE_ROOT
15
+ PROJECT_WORKSPACE = PROJECT_ROOT
16
+
17
+
18
+ def resolve_checklist_path(flow: str, slug: str, checklist_file: str) -> Path:
19
+ if checklist_file:
20
+ path = Path(checklist_file)
21
+ if not path.is_absolute():
22
+ path = (PROJECT_WORKSPACE / path).resolve()
23
+ return path
24
+
25
+ discovered = discover_flow_directory(flow, slug, "auto")
26
+ if not discovered:
27
+ raise FileNotFoundError(f"Workflow directory not found for {flow}:{slug}. Create the artifacts first.")
28
+ _, flow_root = discovered
29
+
30
+ artifact_slug = slug
31
+ if re.match(r"^\d{4}-\d{2}-\d{2}-", slug):
32
+ artifact_slug = slug[11:]
33
+
34
+ candidate_names = [
35
+ f"{slug}-checklist.yaml",
36
+ f"{artifact_slug}-checklist.yaml",
37
+ "checklist.yaml",
38
+ f"{slug}-fix.yaml",
39
+ f"{artifact_slug}-fix.yaml",
40
+ "fix-checklist.yaml",
41
+ ]
42
+
43
+ artifact_dir = flow_root
44
+ for name in candidate_names:
45
+ candidate = artifact_dir / name
46
+ if candidate.exists():
47
+ return candidate
48
+
49
+ found = sorted(str(path.relative_to(PROJECT_WORKSPACE)) for path in artifact_dir.glob("*.yaml")) if artifact_dir.exists() else []
50
+ raise FileNotFoundError(
51
+ "No checklist-like YAML file found for "
52
+ f"{flow}:{slug}. Looked for {candidate_names}. Found: {found or 'none'}."
53
+ )
54
+
55
+
56
+ def build_parser() -> argparse.ArgumentParser:
57
+ parser = argparse.ArgumentParser(
58
+ description="Run one CodeCGC feature or issue step via the standard execution wrapper."
59
+ )
60
+ parser.add_argument(
61
+ "--flow",
62
+ required=True,
63
+ choices=["feature", "issue"],
64
+ help="Workflow type.",
65
+ )
66
+ parser.add_argument(
67
+ "--slug",
68
+ required=True,
69
+ help="Feature or issue slug directory name.",
70
+ )
71
+ parser.add_argument(
72
+ "--step-number",
73
+ type=int,
74
+ required=True,
75
+ help="1-based step number inside the checklist-like YAML file.",
76
+ )
77
+ parser.add_argument(
78
+ "--checklist-file",
79
+ default="",
80
+ help="Optional explicit checklist or fix YAML path.",
81
+ )
82
+ parser.add_argument(
83
+ "--audit-root",
84
+ default="",
85
+ help="Optional explicit audit output directory.",
86
+ )
87
+ parser.add_argument(
88
+ "--timeout-seconds",
89
+ type=int,
90
+ default=120,
91
+ help="Execution timeout in seconds.",
92
+ )
93
+ parser.add_argument(
94
+ "--dry-run",
95
+ action="store_true",
96
+ help="Build the step payload and audit only.",
97
+ )
98
+ parser.add_argument(
99
+ "--return-all-messages",
100
+ action="store_true",
101
+ help="Request full executor event logs.",
102
+ )
103
+ parser.add_argument(
104
+ "--session-id",
105
+ default="",
106
+ help="Optional MCP session id used to resume a previous executor conversation.",
107
+ )
108
+ return parser
109
+
110
+
111
+ def main() -> int:
112
+ configure_utf8_stdio()
113
+ parser = build_parser()
114
+ args = parser.parse_args()
115
+
116
+ try:
117
+ checklist_path = resolve_checklist_path(args.flow, args.slug, args.checklist_file)
118
+ except Exception as error:
119
+ print_json(
120
+ {
121
+ "success": False,
122
+ "error": str(error),
123
+ },
124
+ file=sys.stderr,
125
+ )
126
+ return 1
127
+
128
+ command = [
129
+ sys.executable,
130
+ str(WORKSPACE / "scripts" / "run_codecgc_task.py"),
131
+ "--checklist-file",
132
+ str(checklist_path),
133
+ "--step-number",
134
+ str(args.step_number),
135
+ "--timeout-seconds",
136
+ str(args.timeout_seconds),
137
+ ]
138
+
139
+ if args.audit_root:
140
+ command.extend(["--audit-root", args.audit_root])
141
+ if args.dry_run:
142
+ command.append("--dry-run")
143
+ if args.return_all_messages:
144
+ command.append("--return-all-messages")
145
+ if args.session_id.strip():
146
+ command.extend(["--session-id", args.session_id.strip()])
147
+
148
+ completed = subprocess.run(
149
+ command,
150
+ cwd=PROJECT_WORKSPACE,
151
+ capture_output=True,
152
+ text=True,
153
+ encoding="utf-8",
154
+ errors="replace",
155
+ )
156
+
157
+ if completed.stdout:
158
+ sys.stdout.write(completed.stdout)
159
+ if completed.stderr:
160
+ sys.stderr.write(completed.stderr)
161
+ return completed.returncode
162
+
163
+
164
+ if __name__ == "__main__":
165
+ raise SystemExit(main())