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.
This commit is contained in:
parent
aef73202a6
commit
515a83dce2
2 changed files with 52 additions and 15 deletions
39
README.md
39
README.md
|
|
@ -40,25 +40,37 @@ https://opencode.ai/docs#
|
||||||
```
|
```
|
||||||
### Step 2: Install Agents & Commands
|
### 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)
|
||||||
|
|
||||||
<details open>
|
<details open>
|
||||||
<summary><b>macOS / Linux</b></summary>
|
<summary><b>macOS / Linux</b></summary>
|
||||||
|
|
||||||
```bash
|
```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
|
||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><b>Windows</b></summary>
|
<summary><b>Windows (Git Bash)</b></summary>
|
||||||
|
|
||||||
**Using Git Bash (Recommended):**
|
|
||||||
```bash
|
```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
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>Windows (PowerShell)</b></summary>
|
||||||
|
|
||||||
**Using PowerShell:**
|
|
||||||
```powershell
|
```powershell
|
||||||
# Download the script
|
# Download the script
|
||||||
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/darrenhinde/opencode-agents/main/install.sh" -OutFile "install.sh"
|
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
|
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)
|
> **Note:** Git Bash comes with Git for Windows. [Download here](https://git-scm.com/download/win)
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
|
@ -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)
|
> **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
|
||||||
|
|
||||||
<details open>
|
<details open>
|
||||||
<summary><b>macOS / Linux / Git Bash / WSL</b></summary>
|
<summary><b>macOS / Linux / Git Bash / WSL</b></summary>
|
||||||
|
|
@ -100,10 +109,10 @@ curl -fsSL https://raw.githubusercontent.com/darrenhinde/opencode-agents/main/in
|
||||||
# Balanced for daily development (22 components)
|
# Balanced for daily development (22 components)
|
||||||
curl -fsSL https://raw.githubusercontent.com/darrenhinde/opencode-agents/main/install.sh | bash -s developer
|
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
|
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
|
curl -fsSL https://raw.githubusercontent.com/darrenhinde/opencode-agents/main/install.sh | bash -s advanced
|
||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
|
|
|
||||||
28
install.sh
28
install.sh
|
|
@ -203,7 +203,35 @@ resolve_dependencies() {
|
||||||
# Installation Mode Selection
|
# 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() {
|
show_main_menu() {
|
||||||
|
check_interactive_mode
|
||||||
|
|
||||||
clear
|
clear
|
||||||
print_header
|
print_header
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue