@hunyed15/codecgc 0.1.7 → 0.1.9

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 (71) hide show
  1. package/.claude/hooks/route-edit.ps1 +58 -57
  2. package/INSTALLATION.md +122 -484
  3. package/README.md +124 -149
  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/execution-model.md +3 -1
  10. package/codecgc/reference/maintainer-guide.md +93 -0
  11. package/codecgc/reference/mcp-tool-surface.md +112 -0
  12. package/codecgc/reference/onboarding.md +69 -0
  13. package/codecgc/reference/operation-guide.md +29 -23
  14. package/codecgc/reference/path-contract.md +53 -0
  15. package/codecgc/reference/policy-routing.md +58 -0
  16. package/codecgc/reference/project-structure.md +87 -0
  17. package/codecgc/reference/quickstart.md +110 -0
  18. package/codecgc/reference/real-workflow-loop.md +123 -0
  19. package/codecgc/reference/recovery-loop.md +109 -0
  20. package/codecgc/reference/release-maintenance-playbook.md +4 -1
  21. package/codecgc/reference/troubleshooting.md +114 -0
  22. package/codecgc/roadmap/codecgc-release-maintenance/delivery-plan.md +49 -0
  23. package/codecgc/roadmap/codecgc-release-maintenance/overview.md +41 -0
  24. package/codecgc/roadmap/codecgc-release-maintenance/phases.md +84 -0
  25. package/codecgc/templates/claude/settings.local.json +27 -0
  26. package/codecgc/templates/codex/codecgcrc.json +22 -0
  27. package/codecgc/templates/gemini/codecgc-policy.toml +47 -0
  28. package/codecgcmcp/README.md +57 -11
  29. package/codecgcmcp/src/codecgcmcp/server.py +164 -26
  30. package/codexmcp/src/codexmcp/server.py +45 -0
  31. package/geminimcp/src/geminimcp/server.py +106 -24
  32. package/model-routing.yaml +31 -6
  33. package/package.json +12 -4
  34. package/scripts/audit_codecgc_external_capabilities.py +83 -4
  35. package/scripts/audit_codecgc_historical_audits.py +42 -2
  36. package/scripts/audit_codecgc_package_runtime.py +76 -4
  37. package/scripts/audit_codecgc_release_readiness.py +55 -3
  38. package/scripts/audit_codecgc_workflow_history.py +8 -5
  39. package/scripts/build_codecgc_task.py +69 -45
  40. package/scripts/codecgc_artifact_roots.py +8 -40
  41. package/scripts/codecgc_console_io.py +3 -45
  42. package/scripts/codecgc_executor_registry.py +4 -54
  43. package/scripts/codecgc_path_contract.py +7 -0
  44. package/scripts/codecgc_policy.py +447 -0
  45. package/scripts/codecgc_routing_paths.py +3 -16
  46. package/scripts/codecgc_routing_template.py +11 -135
  47. package/scripts/codecgc_runtime/__init__.py +1 -0
  48. package/scripts/codecgc_runtime/artifacts.py +42 -0
  49. package/scripts/codecgc_runtime/console.py +45 -0
  50. package/scripts/codecgc_runtime/executor_registry.py +55 -0
  51. package/scripts/codecgc_runtime/mcp_config.py +72 -0
  52. package/scripts/codecgc_runtime/path_contract.py +123 -0
  53. package/scripts/codecgc_runtime/paths.py +22 -0
  54. package/scripts/codecgc_runtime/routing_paths.py +16 -0
  55. package/scripts/codecgc_runtime/routing_template.py +171 -0
  56. package/scripts/codecgc_runtime/workflow_runtime.py +72 -0
  57. package/scripts/codecgc_runtime_paths.py +3 -22
  58. package/scripts/codecgc_step_control.py +3 -2
  59. package/scripts/codecgc_workflow_runtime.py +3 -71
  60. package/scripts/entry_codecgc_workflow.py +4 -0
  61. package/scripts/install_codecgc.py +560 -32
  62. package/scripts/normalize_codecgc_audits.py +5 -3
  63. package/scripts/postinstall_codecgc.js +6 -56
  64. package/scripts/review_codecgc_workflow.py +6 -3
  65. package/scripts/route_codecgc_workflow.py +67 -36
  66. package/scripts/run_codecgc_build.py +28 -0
  67. package/scripts/run_codecgc_fix.py +28 -0
  68. package/scripts/run_codecgc_task.py +5 -2
  69. package/scripts/run_codecgc_test.py +28 -0
  70. package/scripts/sync_codecgc_mcp_config.py +4 -54
  71. package/scripts/write_codecgc_review.py +7 -3
@@ -1,15 +1,19 @@
1
1
  $ErrorActionPreference = "Stop"
2
2
 
3
- function Write-Deny($reason) {
3
+ function Write-Approve {
4
4
  $payload = @{
5
- decision = "deny"
6
- reason = $reason
5
+ decision = "approve"
7
6
  } | ConvertTo-Json -Compress
8
7
  [Console]::Out.Write($payload)
9
8
  exit 0
10
9
  }
11
10
 
12
- function Write-Approve() {
11
+ function Write-Deny($reason) {
12
+ $payload = @{
13
+ decision = "deny"
14
+ reason = $reason
15
+ } | ConvertTo-Json -Compress
16
+ [Console]::Out.Write($payload)
13
17
  exit 0
14
18
  }
15
19
 
@@ -18,69 +22,66 @@ if ([string]::IsNullOrWhiteSpace($inputJson)) {
18
22
  Write-Approve
19
23
  }
20
24
 
21
- $hookData = $inputJson | ConvertFrom-Json
22
- $toolName = [string]$hookData.tool_name
23
- if ($toolName -notin @("Edit", "Write")) {
24
- Write-Approve
25
+ $configuredPackageRoot = [Environment]::GetEnvironmentVariable("CODECGC_PACKAGE_ROOT")
26
+ if (-not [string]::IsNullOrWhiteSpace($configuredPackageRoot)) {
27
+ $packageRoot = Resolve-Path $configuredPackageRoot
28
+ } else {
29
+ $packageRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..")
25
30
  }
26
31
 
27
- $toolInput = $hookData.tool_input
28
- $filePath = ""
29
-
30
- if ($toolInput.PSObject.Properties.Name -contains "file_path") {
31
- $filePath = [string]$toolInput.file_path
32
- } elseif ($toolInput.PSObject.Properties.Name -contains "path") {
33
- $filePath = [string]$toolInput.path
32
+ $configuredWorkspaceRoot = [Environment]::GetEnvironmentVariable("CODECGC_WORKSPACE_ROOT")
33
+ if (-not [string]::IsNullOrWhiteSpace($configuredWorkspaceRoot)) {
34
+ $workspaceRoot = Resolve-Path $configuredWorkspaceRoot
35
+ } else {
36
+ $workspaceRoot = Resolve-Path (Get-Location)
34
37
  }
35
38
 
36
- if ([string]::IsNullOrWhiteSpace($filePath)) {
37
- Write-Approve
38
- }
39
-
40
- $normalized = $filePath.Replace("\", "/").ToLower()
41
-
42
- $backendHints = @(
43
- "/apps/api/",
44
- "/server/",
45
- "/src/server/",
46
- "/src/services/",
47
- "/src/repositories/",
48
- "/backend/"
49
- )
39
+ $policyScript = Join-Path $packageRoot "scripts\codecgc_policy.py"
40
+ $routingFile = Join-Path $workspaceRoot "model-routing.yaml"
41
+ $mcpConfigFile = Join-Path $workspaceRoot ".mcp.json"
50
42
 
51
- $frontendHints = @(
52
- "/apps/web/",
53
- "/src/components/",
54
- "/src/pages/",
55
- "/src/app/",
56
- "/src/styles/",
57
- "/web/",
58
- "/frontend/"
59
- )
60
-
61
- $sharedHints = @(
62
- "/packages/shared/",
63
- "/src/shared/",
64
- "/src/lib/",
65
- "/src/types/"
66
- )
43
+ if (-not (Test-Path $policyScript)) {
44
+ Write-Deny "CodeCGC: policy checker is missing: $policyScript"
45
+ }
67
46
 
68
- foreach ($hint in $backendHints) {
69
- if ($normalized.Contains($hint)) {
70
- Write-Deny "CodeCGC: backend path is blocked for direct Claude editing; use Codex MCP."
47
+ $pythonCommand = [Environment]::GetEnvironmentVariable("CODECGC_PYTHON_COMMAND")
48
+ if ([string]::IsNullOrWhiteSpace($pythonCommand) -and (Test-Path $mcpConfigFile)) {
49
+ try {
50
+ $mcpConfig = Get-Content -Raw $mcpConfigFile | ConvertFrom-Json
51
+ $pythonCommand = [string]$mcpConfig.mcpServers.codecgc.command
52
+ } catch {
53
+ $pythonCommand = ""
71
54
  }
72
55
  }
56
+ if ([string]::IsNullOrWhiteSpace($pythonCommand)) {
57
+ $pythonCommand = "python"
58
+ }
73
59
 
74
- foreach ($hint in $frontendHints) {
75
- if ($normalized.Contains($hint)) {
76
- Write-Deny "CodeCGC: frontend path is blocked for direct Claude editing; use Gemini MCP."
77
- }
60
+ $psi = New-Object System.Diagnostics.ProcessStartInfo
61
+ $psi.FileName = $pythonCommand
62
+ $escapedPolicyScript = $policyScript.Replace('"', '\"')
63
+ $escapedRoutingFile = $routingFile.Replace('"', '\"')
64
+ $psi.Arguments = "`"$escapedPolicyScript`" --hook-check --actor claude --operation write --routing-file `"$escapedRoutingFile`""
65
+ $psi.RedirectStandardInput = $true
66
+ $psi.RedirectStandardOutput = $true
67
+ $psi.RedirectStandardError = $true
68
+ $psi.UseShellExecute = $false
69
+ $psi.CreateNoWindow = $true
70
+
71
+ $process = [System.Diagnostics.Process]::Start($psi)
72
+ $process.StandardInput.Write($inputJson)
73
+ $process.StandardInput.Close()
74
+ $stdout = $process.StandardOutput.ReadToEnd()
75
+ $stderr = $process.StandardError.ReadToEnd()
76
+ $process.WaitForExit()
77
+
78
+ if ($process.ExitCode -ne 0) {
79
+ $detail = if ([string]::IsNullOrWhiteSpace($stderr)) { $stdout } else { $stderr }
80
+ Write-Deny "CodeCGC: policy checker failed. $detail"
78
81
  }
79
82
 
80
- foreach ($hint in $sharedHints) {
81
- if ($normalized.Contains($hint)) {
82
- Write-Deny "CodeCGC: shared path is blocked for direct editing; split the task first."
83
- }
83
+ if ([string]::IsNullOrWhiteSpace($stdout)) {
84
+ Write-Approve
84
85
  }
85
86
 
86
- Write-Approve
87
+ [Console]::Out.Write($stdout)