fix: setup.sh set-e resilience, template path, npm/sudo, and venv recovery#693
fix: setup.sh set-e resilience, template path, npm/sudo, and venv recovery#693marcusquinn merged 1 commit intomainfrom
Conversation
…overy - Rename templates/home/.agent/ to .agents/ (matches deploy-templates.sh reference) - Fix deploy_ai_templates dead-code $? pattern (set -e kills before check) - Fix git pull/clone dead-code $? patterns in bootstrap_repo - Fix deploy_aidevops_agents rsync/tar dead-code $? pattern - Add npm install when Node.js exists without npm (distro packages) - Fix DSPy venv: detect corrupted venv, recreate if activate missing - Guard OpenCode CLI read prompt for non-interactive mode - Use sudo for npm global install on Linux when prefix not writable
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
WalkthroughThe setup.sh script refactors control flow across multiple functions to replace exit-status checks with direct negated command invocations. Enhanced error handling strengthens activation checks for Python venv, Node.js, and CLI tools. Non-interactive mode support expanded with safe defaults, deploy-status flags introduced, and package-manager-aware installation logic reinforced. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Mon Feb 9 00:06:04 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
|
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
setup.sh (1)
3106-3131:⚠️ Potential issue | 🟡 MinorSolid venv recovery logic — minor inconsistency with python binary.
The corrupted-venv detection (directory exists, activate missing → remove and recreate) is a good fix. The
sourceguard on line 3126 prevents theset -ecrash that the PR objectives describe.One minor inconsistency: line 3113 uses bare
python3for venv creation, butfind_python3()was already called on line 3089 and resolved to$python3_bin(which may point to/opt/homebrew/bin/python3or a pyenv shim). On systems wherepython3in$PATHdiffers from the resolved$python3_bin, the venv could be created with the wrong interpreter.Suggested fix
- if python3 -m venv python-env/dspy-env; then + if "$python3_bin" -m venv python-env/dspy-env; then



Summary
Fixes multiple
set -ecrashes insetup.shthat prevent the installer from completing on fresh Linux systems (tested on OrbStack Ubuntu ARM64).Changes
Template path mismatch (Fix A)
templates/home/.agent/totemplates/home/.agents/to match the path referenced indeploy-templates.shline 171Dead-code
$?patterns (Fixes B, +3 more)With
set -euo pipefail, any non-zero command exit kills the script beforeif [[ $? -eq 0 ]]is reached. Converted all instances toif command; thenpattern:deploy_ai_templates()—bash templates/deploy-templates.shbootstrap_repo()—git pull --ff-onlyandgit clonedeploy_aidevops_agents()—rsync/tarfallbackMissing npm when Node.js exists (Fix C)
nodejspackage (e.g., Ubuntu apt) may not includenpmsetup_nodejs()now checks for npm when Node.js is already installed and installs it if missingDSPy venv resilience (Fix D)
activatescript missing)source .../activatesourcewith file existence checkOpenCode CLI non-interactive mode (Fix E)
read -r -pprompt withNON_INTERACTIVEchecknpm global install sudo on Linux (Fix F)
sudoon Linux when prefix directory isn't writablesudoautomatically~/.bun/bin)Testing
./setup.sh --non-interactivecompletes with exit code 0 on OrbStack Ubuntu ARM64bash -n setup.shsyntax check passesSummary by CodeRabbit