chore(go): audit providers claudecode codex cursor gemini

Add managed_runtime.go (paths, config validation, identity, runtime file
changes, status checks) and shell_command.go (quoting, PowerShell
encoding, command parsing) and move the four providers onto them.

Claude-Session: https://claude.ai/code/session_01Agoc9bRVE9KL7mmWtey9Vq
This commit is contained in:
雷电芽衣 committed 2026-09-03 01:42:27 -04:00
1 parent c1caed3d42
commit a7fc75bf6b
39 files changed
+914 -2018

No files matched your search

+3 -25
View File
@@ -1,10 +1,7 @@
package plugins
import (
"path/filepath"
"runtime"
"sort"
"strings"
)
const (
@@ -27,11 +24,7 @@ type geminiManagedRemoval struct {
removeGroup bool
}
type geminiRuntimeContract struct {
agentID string
guardPath string
auditPath string
}
type geminiRuntimeContract = managedRuntimeContract
func buildGeminiGroup(runtimePath, scriptPath, name string) (map[string]any, error) {
command, err := buildGeminiCommand(runtimePath, scriptPath)
@@ -151,7 +144,7 @@ func managedGeminiRemovals(
return nil, err
}
if reference != nil &&
(agentID == "" || sameGeminiAgentID(reference.agentID, agentID)) {
(agentID == "" || sameManagedAgentID(reference.agentID, agentID)) {
indexes = append(indexes, handlerIndex)
}
}
@@ -168,13 +161,6 @@ func managedGeminiRemovals(
return removals, nil
}
func geminiReferenceKey(agentID string) string {
if runtime.GOOS == "windows" {
return strings.ToLower(agentID)
}
return agentID
}
func geminiReferencesForEvent(
groups []any,
scriptName string,
@@ -196,7 +182,7 @@ func geminiReferencesForEvent(
return nil, err
}
if reference != nil {
key := geminiReferenceKey(reference.agentID)
key := managedReferenceKey(reference.agentID)
result[key] = append(result[key], *reference)
}
}
@@ -243,11 +229,3 @@ func geminiRuntimeContracts(
}
return contracts, nil
}
func geminiRuntimeRoot() (string, error) {
root, err := AgentRuntimeRoot()
if err != nil {
return "", err
}
return filepath.Clean(root), nil
}