Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions openhands/wrapper/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,28 @@ func main() {
// ---------------------------------------------------------------------------

func cmdSetup() {
// 1. Check if openhands CLI exists; if not, try to install it.
openhandsPath, err := exec.LookPath("openhands")
if err != nil {
fmt.Fprintln(os.Stderr, "Error: openhands CLI not found on PATH.")
fmt.Fprintln(os.Stderr, "Install it with: pip install openhands-ai")
os.Exit(1)
fmt.Fprintln(os.Stderr, "OpenHands CLI not found. Installing...")
install := exec.Command("sh", "-c", "curl -fsSL https://install.openhands.dev/install.sh | sh")
install.Stdin = os.Stdin
install.Stdout = os.Stdout
install.Stderr = os.Stderr
install.Env = os.Environ()
if installErr := install.Run(); installErr != nil {
fmt.Fprintln(os.Stderr, "Failed to install OpenHands CLI.")
fmt.Fprintln(os.Stderr, "Install it manually: curl -fsSL https://install.openhands.dev/install.sh | sh")
os.Exit(1)
}
openhandsPath, err = exec.LookPath("openhands")
if err != nil {
fmt.Fprintln(os.Stderr, "OpenHands CLI still not found after install.")
os.Exit(1)
}
}

// 2. Run openhands login.
fmt.Fprintln(os.Stderr, "Starting OpenHands CLI login...")
fmt.Fprintln(os.Stderr, "If a browser window does not open, copy the URL from the output below.")
fmt.Fprintln(os.Stderr)
Expand All @@ -54,8 +69,6 @@ func cmdSetup() {
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
// Inherit full environment so DISPLAY/WAYLAND_DISPLAY are available
// for browser opening on Linux.
cmd.Env = os.Environ()

if err := cmd.Run(); err != nil {
Expand Down
8 changes: 3 additions & 5 deletions strawpot_openhands/AGENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ metadata:
macos: curl -fsSL https://raw.githubusercontent.com/strawpot/strawpot_openhands_cli/main/strawpot_openhands/install.sh | sh
linux: curl -fsSL https://raw.githubusercontent.com/strawpot/strawpot_openhands_cli/main/strawpot_openhands/install.sh | sh
tools:
pip:
description: Python package manager (https://python.org)
openhands:
description: OpenHands CLI
description: OpenHands CLI (https://github.com/OpenHands/OpenHands-CLI)
install:
macos: pip install openhands-ai
linux: pip install openhands-ai
macos: "curl -fsSL https://install.openhands.dev/install.sh | sh"
linux: "curl -fsSL https://install.openhands.dev/install.sh | sh"
params:
model:
type: string
Expand Down
Loading