@hunyed15/codecgc 0.1.7 → 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.
- package/.claude/hooks/route-edit.ps1 +58 -57
- package/INSTALLATION.md +117 -484
- package/README.md +118 -150
- package/bin/cgc-external-status.js +4 -0
- package/bin/cgc-start.js +4 -0
- package/bin/codecgc.js +141 -20
- package/codecgc/compound/codecgc-capability-matrix.md +37 -0
- package/codecgc/reference/README.md +69 -0
- package/codecgc/reference/maintainer-guide.md +93 -0
- package/codecgc/reference/mcp-tool-surface.md +112 -0
- package/codecgc/reference/onboarding.md +69 -0
- package/codecgc/reference/operation-guide.md +29 -23
- package/codecgc/reference/path-contract.md +53 -0
- package/codecgc/reference/policy-routing.md +57 -0
- package/codecgc/reference/project-structure.md +80 -0
- package/codecgc/reference/quickstart.md +108 -0
- package/codecgc/reference/real-workflow-loop.md +123 -0
- package/codecgc/reference/recovery-loop.md +109 -0
- package/codecgc/reference/release-maintenance-playbook.md +4 -1
- package/codecgc/reference/troubleshooting.md +112 -0
- package/codecgc/roadmap/codecgc-release-maintenance/delivery-plan.md +49 -0
- package/codecgc/roadmap/codecgc-release-maintenance/overview.md +41 -0
- package/codecgc/roadmap/codecgc-release-maintenance/phases.md +84 -0
- package/codecgcmcp/README.md +57 -11
- package/codecgcmcp/src/codecgcmcp/server.py +164 -26
- package/model-routing.yaml +31 -6
- package/package.json +11 -4
- package/scripts/audit_codecgc_external_capabilities.py +83 -4
- package/scripts/audit_codecgc_historical_audits.py +42 -2
- package/scripts/audit_codecgc_package_runtime.py +73 -4
- package/scripts/audit_codecgc_release_readiness.py +55 -3
- package/scripts/audit_codecgc_workflow_history.py +8 -5
- package/scripts/build_codecgc_task.py +62 -45
- package/scripts/codecgc_artifact_roots.py +8 -40
- package/scripts/codecgc_console_io.py +3 -45
- package/scripts/codecgc_executor_registry.py +4 -54
- package/scripts/codecgc_path_contract.py +7 -0
- package/scripts/codecgc_policy.py +275 -0
- package/scripts/codecgc_routing_paths.py +3 -16
- package/scripts/codecgc_routing_template.py +11 -135
- package/scripts/codecgc_runtime/__init__.py +1 -0
- package/scripts/codecgc_runtime/artifacts.py +42 -0
- package/scripts/codecgc_runtime/console.py +45 -0
- package/scripts/codecgc_runtime/executor_registry.py +55 -0
- package/scripts/codecgc_runtime/mcp_config.py +72 -0
- package/scripts/codecgc_runtime/path_contract.py +123 -0
- package/scripts/codecgc_runtime/paths.py +22 -0
- package/scripts/codecgc_runtime/routing_paths.py +16 -0
- package/scripts/codecgc_runtime/routing_template.py +169 -0
- package/scripts/codecgc_runtime/workflow_runtime.py +72 -0
- package/scripts/codecgc_runtime_paths.py +3 -22
- package/scripts/codecgc_step_control.py +3 -2
- package/scripts/codecgc_workflow_runtime.py +3 -71
- package/scripts/entry_codecgc_workflow.py +4 -0
- package/scripts/install_codecgc.py +490 -21
- package/scripts/normalize_codecgc_audits.py +5 -3
- package/scripts/postinstall_codecgc.js +6 -56
- package/scripts/review_codecgc_workflow.py +6 -3
- package/scripts/route_codecgc_workflow.py +67 -36
- package/scripts/run_codecgc_build.py +28 -0
- package/scripts/run_codecgc_fix.py +28 -0
- package/scripts/run_codecgc_task.py +5 -2
- package/scripts/run_codecgc_test.py +28 -0
- package/scripts/sync_codecgc_mcp_config.py +4 -54
- package/scripts/write_codecgc_review.py +7 -3
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
$ErrorActionPreference = "Stop"
|
|
2
2
|
|
|
3
|
-
function Write-
|
|
3
|
+
function Write-Approve {
|
|
4
4
|
$payload = @{
|
|
5
|
-
decision = "
|
|
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-
|
|
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
|
-
$
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
$
|
|
28
|
-
$
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
$
|
|
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
|
-
|
|
37
|
-
|
|
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
|
-
|
|
52
|
-
"
|
|
53
|
-
|
|
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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
|
|
81
|
-
|
|
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
|
|
87
|
+
[Console]::Out.Write($stdout)
|