Skip to content

fix: improve setup.sh bootstrap detection and error handling#316

Merged
marcusquinn merged 2 commits intomainfrom
fix/setup-bootstrap-detection
Feb 5, 2026
Merged

fix: improve setup.sh bootstrap detection and error handling#316
marcusquinn merged 2 commits intomainfrom
fix/setup-bootstrap-detection

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Feb 5, 2026

Summary

Fixes issues observed when running bash <(curl -fsSL https://aidevops.sh/install) on a fresh Mac:

  • Bootstrap detection: The script wasn't detecting bash <(curl ...) because it produces paths like /dev/fd/63. Added pattern matching for /dev/fd/*
  • chmod errors: Suppressed errors when paths don't exist in curl context (before bootstrap re-executes)
  • beads_viewer install: Added pipx support for Python package installation (required on modern macOS with externally-managed Python)
  • Worktrunk shell integration: Improved error reporting to show actual error message instead of silent failure
  • Playwright warning: Suppressed the confusing "install without dependencies" warning from npx

Test Plan

  1. Run bash <(curl -fsSL https://aidevops.sh/install) on a fresh Mac
  2. Verify bootstrap properly clones repo and re-executes
  3. Verify no chmod errors appear
  4. Verify beads_viewer install offers pipx option

Related Issues

Reported by user during fresh Mac setup - see conversation for full output.

Summary by CodeRabbit

  • Bug Fixes

    • Improved script detection during installation procedures
    • Enhanced error reporting for worktrunk configuration
    • Made permission updates more tolerant of missing paths
  • Improvements

    • Installation tool selection now prioritizes availability and compatibility
    • Playwright browser installation now auto-accepts prompts with fewer interruptions

- Fix bootstrap detection for bash <(curl ...) by matching /dev/fd/* paths
- Suppress chmod errors when paths don't exist in curl context
- Add pipx support for beads_viewer install (handles externally-managed Python)
- Improve Worktrunk shell integration error reporting
- Suppress Playwright npx warning during browser install

These fixes resolve issues seen when running setup via curl on a fresh Mac.
@gemini-code-assist
Copy link

Summary of Changes

Hello @marcusquinn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves the setup.sh script's reliability and user experience, particularly for fresh macOS installations. It addresses several common issues encountered during the initial setup process, making the script more robust in detecting its execution context, handling file permissions, installing Python packages, and providing clearer feedback for shell integration and browser tool installations.

Highlights

  • Bootstrap Detection: Enhanced the setup.sh script's bootstrap detection to correctly identify installations initiated via bash <(curl ...) by recognizing /dev/fd/* paths, which are common with process substitution.
  • chmod Error Handling: Suppressed chmod errors that previously occurred when target paths did not exist during the initial curl context, preventing misleading error messages and improving script robustness.
  • beads_viewer Installation: Integrated pipx support for beads_viewer installation, providing a more robust and isolated Python package management solution, especially for modern macOS with externally-managed Python environments. It also includes fallback to pip and improved error messages.
  • Worktrunk Shell Integration: Improved error reporting for Worktrunk shell integration failures, now capturing and displaying the actual error message from the wt config shell install command instead of a generic warning.
  • Playwright Warning Suppression: Modified the Playwright installation command to automatically confirm the installation (-y) and suppress the potentially confusing 'install without dependencies' warning.
Changelog
  • setup.sh
    • Updated the bootstrap_repo function to include /dev/fd/* in the script_path check, improving detection of remote installs via process substitution.
    • Modified setup_worktrunk to capture and display the actual error output from wt config shell install when it fails, replacing a silent failure with informative messages.
    • Added 2>/dev/null || true to chmod +x commands in set_permissions to suppress errors when target files or directories might not exist during early script execution.
    • Refactored setup_beads_ui to prioritize pipx for beads_viewer installation, falling back to pip3 --user or pip --user, and added specific guidance for macOS users regarding pipx installation.
    • Adjusted setup_browser_tools to use npx -y playwright@latest install and filter out the 'install without dependencies' warning, streamlining Playwright setup.
Activity
  • No human activity (comments, reviews, or progress updates) has been recorded for this pull request since its creation.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 5, 2026

Warning

Rate limit exceeded

@marcusquinn has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 25 minutes and 10 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Walkthrough

Updates to setup.sh enhance installation robustness and error diagnostics across multiple setup functions. Changes include broader curl-detection logic for process substitution, improved error capture for configuration commands, tolerant file permission operations, and preference shifts toward pipx and npx for dependency installation.

Changes

Cohort / File(s) Summary
Environment Detection
setup.sh (bootstrap_repo function)
Expanded curl-detection condition to recognize /dev/fd/* process substitution patterns alongside existing checks for empty script_path, /dev/stdin, and bash invocation.
Error Handling & Diagnostics
setup.sh (setup_worktrunk, set_permissions functions)
Captured output from wt config shell install into variable for explicit error reporting; added 2>/dev/null && || true to chmod invocations to tolerate missing paths gracefully.
Installation Tool Preferences
setup.sh (setup_beads_ui, setup_beads functions)
Migrated beads_viewer installation logic to prefer pipx when available with interactive prompt; retained fallback to pip/pip3 if pipx unavailable.
Build Tool Updates
setup.sh (setup_browser_tools function)
Updated Playwright browsers installation to use npx -y for auto-accepting install prompts; refreshed subsequent guidance to reference new command syntax.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🔧 Setup scripts refined with care,
/dev/fd/* caught mid-air,
Pipx takes the lead with grace,
Error messages in their place,
Automation's robustness declares—
Zero debt, A-grade affairs!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: improved bootstrap detection for curl execution patterns and enhanced error handling in setup.sh.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/setup-bootstrap-detection

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Feb 5, 2026

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 2 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Thu Feb 5 00:02:51 UTC 2026: Code review monitoring started
Thu Feb 5 00:02:52 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 2
Thu Feb 5 00:02:52 UTC 2026: Qlty - 0 issues found, auto-formatting applied
Thu Feb 5 00:02:54 UTC 2026: Codacy analysis completed with auto-fixes

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 2
  • VULNERABILITIES: 0

Generated on: Thu Feb 5 00:04:30 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces several improvements to the setup.sh script, focusing on bootstrap detection, error handling, and installation logic for dependencies. The changes enhance robustness, especially for fresh installations on macOS.

My review identifies two areas for improvement:

  1. The logic for installing beads_viewer contains duplicated code and a redundant command that could be refactored for clarity and correctness.
  2. The method used to suppress a warning during Playwright installation introduces a bug where a successful installation could be reported as a failure.

I've provided detailed comments and code suggestions for both points. Overall, these are valuable fixes, and with these adjustments, the script will be even more reliable.

Comment on lines 2783 to 2789
# Use -y to auto-confirm npx install, suppress the "install without dependencies" warning
if npx -y playwright@latest install 2>&1 | grep -v "WARNING: It looks like you are running"; then
print_success "Playwright browsers installed"
else
print_warning "Playwright browser installation failed"
print_info "Run manually: npx playwright install"
print_info "Run manually: npx -y playwright@latest install"
fi

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The use of grep -v in the if condition is problematic. grep -v exits with status 1 if it doesn't find any matching lines to filter. In this case, if the npx command is successful and does not produce the 'WARNING...' message, grep -v will exit with 1, causing the if condition to fail and incorrectly report that the installation failed.

To fix this, you should check the exit status of the npx command directly using the PIPESTATUS array after the command has run. The suggested change implements this fix.

Suggested change
# Use -y to auto-confirm npx install, suppress the "install without dependencies" warning
if npx -y playwright@latest install 2>&1 | grep -v "WARNING: It looks like you are running"; then
print_success "Playwright browsers installed"
else
print_warning "Playwright browser installation failed"
print_info "Run manually: npx playwright install"
print_info "Run manually: npx -y playwright@latest install"
fi
# Use -y to auto-confirm npx install, suppress the "install without dependencies" warning
npx -y playwright@latest install 2>&1 | grep -v "WARNING: It looks like you are running"
if [[ ${PIPESTATUS[0]} -eq 0 ]]; then
print_success "Playwright browsers installed"
else
print_warning "Playwright browser installation failed"
print_info "Run manually: npx -y playwright@latest install"
fi

setup.sh Outdated
Comment on lines 2627 to 2652
if command -v pipx &> /dev/null; then
read -r -p " Install beads_viewer (Python TUI with graph analytics)? (y/n): " install_viewer
if [[ "$install_viewer" == "y" ]]; then
print_info "Installing beads_viewer via pipx..."
if pipx install beads-viewer 2>/dev/null; then
print_success "beads_viewer installed (run: beads-viewer)"
((installed_count++))
else
print_warning "Failed to install beads_viewer"
print_info "Try manually: pipx install beads-viewer"
fi
fi
elif command -v pip3 &> /dev/null || command -v pip &> /dev/null; then
read -r -p " Install beads_viewer (Python TUI with graph analytics)? (y/n): " install_viewer
if [[ "$install_viewer" == "y" ]]; then
print_info "Installing beads_viewer..."
if pip3 install beads-viewer 2>/dev/null || pip install beads-viewer 2>/dev/null; then
# Try pipx first (handles externally-managed-environment), fall back to pip
if pipx install beads-viewer 2>/dev/null || pip3 install --user beads-viewer 2>/dev/null || pip install --user beads-viewer 2>/dev/null; then
print_success "beads_viewer installed"
((installed_count++))
else
print_warning "Failed to install beads_viewer"
print_info "On macOS, install pipx first: brew install pipx && pipx ensurepath"
fi
fi
fi

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This block has some code duplication and a small logical flaw. The read prompt and the if [[ "$install_viewer" == "y" ]] block are repeated. More importantly, the elif branch at line 2639 is taken when pipx is not found, but the if condition at line 2644 still tries to use pipx, which is guaranteed to fail.

Consider refactoring to ask the user once, then decide which installation method to use. This will make the code cleaner and avoid the redundant pipx call.

    # beads_viewer (Python) - use pipx for isolated install
    if command -v pipx &> /dev/null || command -v pip3 &> /dev/null || command -v pip &> /dev/null; then
        read -r -p "  Install beads_viewer (Python TUI with graph analytics)? (y/n): " install_viewer
        if [[ "$install_viewer" == "y" ]]; then
            if command -v pipx &> /dev/null; then
                print_info "Installing beads_viewer via pipx..."
                if pipx install beads-viewer 2>/dev/null; then
                    print_success "beads_viewer installed (run: beads-viewer)"
                    ((installed_count++))
                else
                    print_warning "Failed to install beads_viewer"
                    print_info "Try manually: pipx install beads-viewer"
                fi
            else
                print_info "Installing beads_viewer..."
                if pip3 install --user beads-viewer 2>/dev/null || pip install --user beads-viewer 2>/dev/null; then
                    print_success "beads_viewer installed"
                    ((installed_count++))
                else
                    print_warning "Failed to install beads_viewer"
                    print_info "On macOS, install pipx first: brew install pipx && pipx ensurepath"
                fi
            fi
        fi
    fi

- Refactor beads_viewer install to avoid duplicate prompts and redundant pipx call
- Fix Playwright install check to use PIPESTATUS instead of grep exit code

Co-authored-by: gemini-code-assist <gemini-code-assist@google.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 5, 2026

@github-actions
Copy link

github-actions bot commented Feb 5, 2026

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 2 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Thu Feb 5 00:07:00 UTC 2026: Code review monitoring started
Thu Feb 5 00:07:01 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 2
Thu Feb 5 00:07:01 UTC 2026: Qlty - 0 issues found, auto-formatting applied
Thu Feb 5 00:07:03 UTC 2026: Codacy analysis completed with auto-fixes

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 2
  • VULNERABILITIES: 0

Generated on: Thu Feb 5 00:08:39 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@marcusquinn marcusquinn merged commit 3195e7b into main Feb 5, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant