5.2 KiB
One-Liner Install Script — Design Spec
Overview
Add one-liner install scripts (install.sh for macOS/Linux, install.ps1 for Windows) that automatically detect the environment, install Node.js if missing, install @openacp/cli via npm, and launch the setup wizard. This removes the npm knowledge barrier for non-developer users.
Motivation: Current installation requires users to know npm (npm install -g @openacp/cli). Non-dev users don't know what npm is. Industry standard for CLI tools provides one-liner curl/PowerShell commands that handle everything automatically.
One-Liner Commands
# macOS/Linux
curl -fsSL https://raw.githubusercontent.com/Open-ACP/OpenACP/main/scripts/install.sh | bash
# Windows
powershell -c "irm https://raw.githubusercontent.com/Open-ACP/OpenACP/main/scripts/install.ps1 | iex"
Future: redirect via custom domain (e.g., openacp.dev/install.sh) when available.
install.sh (macOS/Linux) — ~800-1000 lines
Flow
- Banner + branding — ANSI colors, OpenACP tagline
- Detect environment — OS (Darwin/Linux), arch (x86_64/arm64), downloader (curl/wget)
- Bootstrap gum — Download charmbracelet/gum to temp dir for fancy terminal UI (spinners, confirm dialogs, select menus). Verify SHA256. Fallback to plain text if download fails. Cleaned up on exit.
- Parse CLI flags:
--version <tag>— npm install target (default:latest; usemainfor GitHub main branch)--install-method npm|git— npm (default) or clone+build--no-onboard— skip runningopenacpafter install--dry-run— print actions without executing--verify— verify installation after completion
- Choose install method — Interactive (gum choose) if TTY, default to npm otherwise
- Check/install Node.js ≥22:
- Detect existing:
nodeon PATH, nvm, nodenv, Homebrew, system package - If version too old: guide user to upgrade (nvm instructions if nvm detected)
- If missing: download NodeSource official binary (tar.gz from nodejs.org), verify SHA256, install to user-local path
- Handle npm prefix/PATH issues (EACCES → setup
~/.npm-global)
- Detect existing:
- Install @openacp/cli:
- npm method:
npm install -g @openacp/cli@<version>with retry logic, log capture on failure - git method: clone repo, install pnpm,
pnpm install,pnpm build, create wrapper script in~/.local/bin
- npm method:
- Verify install — Run
openacp --versionto confirm - Post-install:
- If TTY available →
exec openacp(launches setup wizard directly) - If no TTY → print instruction:
Run 'openacp' to complete setup
- If TTY available →
Key Features
- gum UI: Spinner animations, colored output, interactive menus via charmbracelet/gum (temp binary, auto-cleaned)
- SHA256 verification: Both gum binary and Node.js binary verified via checksums
- Retry logic: npm install retries on transient failures
- sudo detection: Avoid running as root when not needed, handle EACCES gracefully
- nvm/nodenv awareness: Detect managed Node.js, provide upgrade instructions instead of conflicting install
- Temp file cleanup: Trap EXIT to clean up all temp files/dirs
- Non-interactive mode: Detect piped input, skip interactive prompts, use defaults
install.ps1 (Windows) — ~300 lines
Flow
- Banner — ANSI colors (PowerShell escape sequences)
- Check/fix execution policy — Set RemoteSigned for current process if Restricted
- Check/install Node.js ≥22: Try
winget→choco→scoop→ fail with manual instructions (nodejs.org link) - Check/install Git — Required for npm; try winget, fail with manual link
- Install @openacp/cli —
npm install -g @openacp/cliwith error handling - PATH setup — Add npm global bin to user PATH
- Post-install — Run
openacpif TTY, else print instructions
Parameters
param(
[string]$InstallMethod = "npm",
[string]$Tag = "latest",
[string]$GitDir = "$env:USERPROFILE\openacp",
[switch]$NoOnboard,
[switch]$NoGitUpdate,
[switch]$DryRun
)
No gum on Windows. Plain text with ANSI colors only.
Config
No config changes required. The install scripts install the existing @openacp/cli package which has its own setup wizard.
Node.js Requirements
- Minimum: Node.js ≥22
- Default install target: Node.js 24 (LTS)
- Version detection parses
node --versionoutput
Files
| File | Action |
|---|---|
scripts/install.sh |
New — macOS/Linux one-liner installer |
scripts/install.ps1 |
New — Windows PowerShell installer |
README.md |
Modified — add one-liner Quick Start section above existing npm instructions |
docs/ |
Modified — add installation guide with all methods |
Testing
--dry-runflag for testing logic without side effects--verifyflag for post-install verification- Docker-based testing for install.sh (Ubuntu, Debian, Alpine)
- Manual testing on macOS and Windows PowerShell
Backward Compatibility
No breaking changes. Existing npm install -g @openacp/cli method continues to work. One-liner scripts are an additional installation path that ultimately runs the same npm install.