()
| 108 | ) |
| 109 | |
| 110 | func main() { |
| 111 | mutation := runtimeMutationAction(os.Args[1:]) |
| 112 | if mutation == "update" { |
| 113 | fmt.Fprintln( |
| 114 | os.Stderr, |
| 115 | "This Go wrapper is maintained by Go. Update it with \"go install github.com/DeusData/codebase-memory-mcp/pkg/go/cmd/codebase-memory-mcp@latest\".", |
| 116 | ) |
| 117 | os.Exit(2) |
| 118 | } |
| 119 | executable, err := ensureBinary() |
| 120 | if err != nil { |
| 121 | fmt.Fprintf(os.Stderr, "codebase-memory-mcp: %v\n", err) |
| 122 | os.Exit(1) |
| 123 | } |
| 124 | args := nativeArgs(os.Args[1:]) |
| 125 | if mutation == "install" || mutation == "uninstall" { |
| 126 | err = execBinaryWithRuntimeLock(executable, args) |
| 127 | } else { |
| 128 | err = execBinary(executable, args) |
| 129 | } |
| 130 | if err != nil { |
| 131 | if runtime.GOOS == "windows" { |
| 132 | var exitErr *exec.ExitError |
| 133 | if errors.As(err, &exitErr) { |
| 134 | printPortableMutationGuidance(args) |
| 135 | os.Exit(exitErr.ExitCode()) |
| 136 | } |
| 137 | } |
| 138 | fmt.Fprintf(os.Stderr, "codebase-memory-mcp: %v\n", err) |
| 139 | os.Exit(1) |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | func ensureBinary() (string, error) { |
| 144 | binary := binPath() |
no test coverage detected