diff --git a/CHANGELOG.md b/CHANGELOG.md index 57f6d3e..77eae75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed +- **Qoder install/upgrade commands** + - Fixed exit status 127 error when running `agentpipe agents install qoder` or `agentpipe agents upgrade qoder` + - Changed from `bash --` to `bash -s --` in install/upgrade commands for proper stdin handling + - Updated commands: `curl -fsSL https://qoder.com/install | bash -s -- --force` + - Added test to verify bash command format in agent registry + - Fixes #26 + ## [0.5.5] - 2025-10-26 ### Fixed diff --git a/internal/registry/agents.json b/internal/registry/agents.json index d7c0c64..c730e25 100644 --- a/internal/registry/agents.json +++ b/internal/registry/agents.json @@ -248,8 +248,8 @@ "package_manager": "manifest", "package_name": "https://qoder-ide.oss-ap-southeast-1.aliyuncs.com/qodercli/channels/manifest.json", "install": { - "darwin": "curl -fsSL https://qoder.com/install | bash -- --force", - "linux": "curl -fsSL https://qoder.com/install | bash -- --force", + "darwin": "curl -fsSL https://qoder.com/install | bash -s -- --force", + "linux": "curl -fsSL https://qoder.com/install | bash -s -- --force", "windows": "See https://qoder.com/cli" }, "uninstall": { @@ -258,8 +258,8 @@ "windows": "See https://qoder.com/cli for uninstall instructions" }, "upgrade": { - "darwin": "curl -fsSL https://qoder.com/install | bash -- --force", - "linux": "curl -fsSL https://qoder.com/install | bash -- --force", + "darwin": "curl -fsSL https://qoder.com/install | bash -s -- --force", + "linux": "curl -fsSL https://qoder.com/install | bash -s -- --force", "windows": "See https://qoder.com/cli for upgrade instructions" }, "requires_auth": true diff --git a/internal/registry/registry_test.go b/internal/registry/registry_test.go index a4bc7d1..28eed53 100644 --- a/internal/registry/registry_test.go +++ b/internal/registry/registry_test.go @@ -245,3 +245,43 @@ func verifyCommandMap(t *testing.T, commands map[string]string, cmdType, expecte func shouldSkipCommand(cmd string) bool { return cmd == "" || (len(cmd) >= 3 && cmd[:3] == "See") } + +func TestQoderBashCommandFormat(t *testing.T) { + agent, err := GetByName("Qoder") + if err != nil { + t.Fatalf("Failed to get Qoder agent: %v", err) + } + + // Test install commands + for os, cmd := range agent.Install { + verifyBashCommandFormat(t, "Install", os, cmd) + } + + // Test upgrade commands + for os, cmd := range agent.Upgrade { + verifyBashCommandFormat(t, "Upgrade", os, cmd) + } +} + +func verifyBashCommandFormat(t *testing.T, cmdType, os, cmd string) { + t.Helper() + if shouldSkipCommand(cmd) { + return + } + // Only check piped bash commands + if !strings.Contains(cmd, "|") || !strings.Contains(cmd, "bash") { + return + } + + // Extract what comes after "bash" in the command + bashIndex := strings.Index(cmd, "bash") + afterBash := cmd[bashIndex+4:] // Everything after "bash" + afterBash = strings.TrimSpace(afterBash) + + // If there are arguments after bash (starts with -- or -), require -s flag + if len(afterBash) > 0 && (strings.HasPrefix(afterBash, "--") || strings.HasPrefix(afterBash, "-")) { + if !strings.Contains(cmd, "bash -s") { + t.Errorf("%s command for %s passes arguments to bash without '-s' flag: %s\nWhen passing arguments to a piped script, use 'bash -s -- ' instead of 'bash -- '", cmdType, os, cmd) + } + } +}