Files
Elydora-Go-SDK/cmd/elydora/plugins/kirocli_io.go
T
雷电芽衣 a7fc75bf6b 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
2026-09-03 01:42:27 -04:00

53 lines
1.3 KiB
Go

package plugins
import (
"fmt"
"os"
"path/filepath"
"runtime"
"strings"
)
func kiroConfigPaths() (string, string, error) {
home, err := os.UserHomeDir()
if err != nil {
return "", "", fmt.Errorf("resolve home directory: %w", err)
}
return filepath.Join(home, ".kiro", "agents", kiroV2AgentName+".json"),
filepath.Join(home, ".kiro", "hooks", "elydora-audit.json"), nil
}
func buildKiroCommand(runtimePath, scriptPath string) string {
if runtime.GOOS == "windows" {
return quoteWindowsArgument(runtimePath) + " " + quoteWindowsArgument(scriptPath)
}
return quotePOSIXArgument(runtimePath) + " " + quotePOSIXArgument(scriptPath)
}
func quoteWindowsArgument(value string) string {
if value != "" && !strings.ContainsAny(value, " \t\n\v\"") {
return value
}
var result strings.Builder
result.WriteByte('"')
backslashes := 0
for _, character := range value {
if character == '\\' {
backslashes++
continue
}
if character == '"' {
result.WriteString(strings.Repeat("\\", backslashes*2+1))
result.WriteRune(character)
backslashes = 0
continue
}
result.WriteString(strings.Repeat("\\", backslashes))
backslashes = 0
result.WriteRune(character)
}
result.WriteString(strings.Repeat("\\", backslashes*2))
result.WriteByte('"')
return result.String()
}