From 515a83dce27c7771440c95a45c1244fd396b60d8 Mon Sep 17 00:00:00 2001
From: darrenhinde <107584450+darrenhinde@users.noreply.github.com>
Date: Tue, 18 Nov 2025 14:04:07 +0000
Subject: [PATCH] fix: detect piped execution and provide clear guidance
Problem:
- Running 'curl ... | bash' without arguments showed interactive menu
- But stdin was the curl stream, not terminal
- Script couldn't read user input and would exit silently
- Confusing user experience
Solution:
- Add check_interactive_mode() to detect if stdin is a terminal
- If running in pipe without arguments, show helpful error message
- Provide clear instructions for both interactive and profile-based install
- Update README to clarify installation methods
Changes:
- Add [ ! -t 0 ] check to detect non-terminal stdin
- Show helpful error with examples when piped without profile
- Update README to recommend profile-based install (fastest)
- Clarify that interactive mode requires downloading first
User Experience:
Before: Silent exit or confusing behavior
After: Clear error message with exact commands to run
Examples shown to user:
- Download first: curl ... -o install.sh && bash install.sh
- Or use profile: curl ... | bash -s core
This fixes the issue reported when running on another computer.
---
README.md | 39 ++++++++++++++++++++++++---------------
install.sh | 28 ++++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 15 deletions(-)
diff --git a/README.md b/README.md
index 8aefc1b..fcee942 100644
--- a/README.md
+++ b/README.md
@@ -40,25 +40,37 @@ https://opencode.ai/docs#
```
### Step 2: Install Agents & Commands
-**Option A: Interactive Installer (Recommended)**
+**Option A: Interactive Installer**
+
+> **Note:** Interactive mode requires downloading the script first (can't run through pipe)
macOS / Linux
```bash
-curl -fsSL https://raw.githubusercontent.com/darrenhinde/opencode-agents/main/install.sh | bash
+# Download the installer
+curl -fsSL https://raw.githubusercontent.com/darrenhinde/opencode-agents/main/install.sh -o install.sh
+
+# Run interactively
+bash install.sh
```
-Windows
+Windows (Git Bash)
-**Using Git Bash (Recommended):**
```bash
-curl -fsSL https://raw.githubusercontent.com/darrenhinde/opencode-agents/main/install.sh | bash
-```
+# Download the installer
+curl -fsSL https://raw.githubusercontent.com/darrenhinde/opencode-agents/main/install.sh -o install.sh
+
+# Run interactively
+bash install.sh
+```
+
+
+
+Windows (PowerShell)
-**Using PowerShell:**
```powershell
# Download the script
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/darrenhinde/opencode-agents/main/install.sh" -OutFile "install.sh"
@@ -70,11 +82,6 @@ Invoke-WebRequest -Uri "https://raw.githubusercontent.com/darrenhinde/opencode-a
wsl bash install.sh
```
-**Using WSL:**
-```bash
-curl -fsSL https://raw.githubusercontent.com/darrenhinde/opencode-agents/main/install.sh | bash
-```
-
> **Note:** Git Bash comes with Git for Windows. [Download here](https://git-scm.com/download/win)
@@ -88,7 +95,9 @@ The installer offers:
> **Updating?** The installer detects existing files and lets you choose: skip existing (keep your changes), overwrite all (get latest), or backup & overwrite (safe update). [Learn more](docs/getting-started/collision-handling.md)
-**Option B: Profile-Based Install**
+**Option B: Profile-Based Install (Recommended)**
+
+> **Fastest method:** One command, no interaction needed
macOS / Linux / Git Bash / WSL
@@ -100,10 +109,10 @@ curl -fsSL https://raw.githubusercontent.com/darrenhinde/opencode-agents/main/in
# Balanced for daily development (22 components)
curl -fsSL https://raw.githubusercontent.com/darrenhinde/opencode-agents/main/install.sh | bash -s developer
-# Everything included (24 components)
+# Everything included (25 components)
curl -fsSL https://raw.githubusercontent.com/darrenhinde/opencode-agents/main/install.sh | bash -s full
-# Advanced + System Builder (29 components)
+# Advanced + System Builder (23 components)
curl -fsSL https://raw.githubusercontent.com/darrenhinde/opencode-agents/main/install.sh | bash -s advanced
```
diff --git a/install.sh b/install.sh
index 634a5d7..bb0a7f5 100755
--- a/install.sh
+++ b/install.sh
@@ -203,7 +203,35 @@ resolve_dependencies() {
# Installation Mode Selection
#############################################################################
+check_interactive_mode() {
+ # Check if stdin is a terminal (not piped from curl)
+ if [ ! -t 0 ]; then
+ print_header
+ print_error "Interactive mode requires a terminal"
+ echo ""
+ echo "You're running this script in a pipe (e.g., curl | bash)"
+ echo "For interactive mode, download the script first:"
+ echo ""
+ echo -e "${CYAN}# Download the script${NC}"
+ echo "curl -fsSL https://raw.githubusercontent.com/darrenhinde/opencode-agents/main/install.sh -o install.sh"
+ echo ""
+ echo -e "${CYAN}# Run interactively${NC}"
+ echo "bash install.sh"
+ echo ""
+ echo "Or use a profile directly:"
+ echo ""
+ echo -e "${CYAN}# Quick install with profile${NC}"
+ echo "curl -fsSL https://raw.githubusercontent.com/darrenhinde/opencode-agents/main/install.sh | bash -s core"
+ echo ""
+ echo "Available profiles: core, developer, full, advanced"
+ echo ""
+ cleanup_and_exit 1
+ fi
+}
+
show_main_menu() {
+ check_interactive_mode
+
clear
print_header