Skip to content
This repository was archived by the owner on Apr 19, 2026. It is now read-only.

Commit fbbd0b6

Browse files
jpleva91claude
andcommitted
fix: wizard installs Crush to /usr/local/bin (always in PATH)
Was installing to ~/go/bin which users don't have in PATH. Now installs to /usr/local/bin with sudo if needed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f6636e4 commit fbbd0b6

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

cmd/shellforge/main.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"github.com/AgentGuardHQ/shellforge/internal/scheduler"
2020
)
2121

22-
var version = "0.4.5"
22+
var version = "0.4.6"
2323

2424
func main() {
2525
if len(os.Args) < 2 {
@@ -287,22 +287,22 @@ if err := buildCmd.Run(); err != nil {
287287
fmt.Printf(" ⚠ Build failed: %s\n", err)
288288
fmt.Println(" Requires Go 1.22+. Check: go version")
289289
} else {
290-
// Move binary to a location in PATH
290+
// Move binary to /usr/local/bin (always in PATH)
291291
crushBin := filepath.Join(crushDir, "crush")
292-
gobin := os.Getenv("GOBIN")
293-
if gobin == "" {
294-
gobin = filepath.Join(os.Getenv("HOME"), "go", "bin")
295-
}
296-
os.MkdirAll(gobin, 0o755)
297-
dest := filepath.Join(gobin, "crush")
298-
if data, err := os.ReadFile(crushBin); err == nil {
299-
if err := os.WriteFile(dest, data, 0o755); err == nil {
300-
fmt.Printf(" ✓ Crush installed to %s\n", dest)
292+
dest := "/usr/local/bin/crush"
293+
cpCmd := exec.Command("cp", crushBin, dest)
294+
if err := cpCmd.Run(); err != nil {
295+
// Try with sudo
296+
fmt.Println(" → Need permissions to install to /usr/local/bin...")
297+
run("sudo", "cp", crushBin, dest)
298+
run("sudo", "chmod", "+x", dest)
299+
}
300+
if _, err := exec.LookPath("crush"); err == nil {
301+
fmt.Println(" ✓ Crush installed to /usr/local/bin/crush")
301302
fmt.Println(" ✓ AgentGuard governance built in")
302303
} else {
303-
fmt.Printf(" ⚠ Could not install to %s: %s\n", dest, err)
304-
fmt.Printf(" Try: sudo cp %s /usr/local/bin/crush\n", crushBin)
305-
}
304+
fmt.Println(" ⚠ Install failed. Try manually:")
305+
fmt.Printf(" sudo cp %s /usr/local/bin/crush\n", crushBin)
306306
}
307307
}
308308
os.RemoveAll(crushDir)

0 commit comments

Comments
 (0)