Skip to content

Make automation scripts non-interactive and CI-friendly#7

Open
Copilot wants to merge 4 commits intomainfrom
copilot/update-automation-scripts-ci-friendly
Open

Make automation scripts non-interactive and CI-friendly#7
Copilot wants to merge 4 commits intomainfrom
copilot/update-automation-scripts-ci-friendly

Conversation

Copy link
Copy Markdown

Copilot AI commented Jan 17, 2026

CI environments hang on interactive prompts and fail when Homebrew is unavailable. These changes make automation scripts work in both interactive local use and non-interactive CI (Ubuntu runners).

Changes

Non-interactive mode support

  • Auto-detect CI environments via CI=true or NONINTERACTIVE=1
  • Accept -y/--yes flag to skip all prompts
  • Default to 'yes' and proceed without user input when non-interactive

Cross-platform package installation

  • New install_pkg() helper: uses Homebrew on macOS, apt-get on Linux
  • Best-effort approach: logs warnings on failure, continues execution
  • Checks sudo availability before use, falls back to direct apt-get in containers
  • Handles Debian package name differences (e.g., fdfd-find)

Safe external installer execution

  • Download installers to /tmp before execution (no direct curl | bash)
  • Continue to verification on download failure to prevent CI hangs
  • Added security notes about installer trust assumptions

CLI improvements

  • start-ralph.sh: Add --promise PROMISE and --max-iterations N flags with defaults
  • All scripts: Consistent -y/--yes support
  • Better error messages and usage examples

Usage

# Interactive (unchanged)
./automation/scripts/setup-claude-code.sh

# Non-interactive
NONINTERACTIVE=1 ./automation/scripts/setup-claude-code.sh
./automation/scripts/setup-ralph-project.sh myproj python -y
CI=true ./automation/start-ralph.sh nodejs --promise "SETUP COMPLETE" --max-iterations 20 -y

Files Changed

  • automation/scripts/setup-claude-code.sh (186 lines)
  • automation/scripts/setup-ralph-project.sh (62 lines)
  • automation/start-ralph.sh (85 lines)

Executable permissions preserved. All scripts tested in both interactive and non-interactive modes on Linux.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Update automation scripts to be non-interactive, CI-friendly, and Linux-compatible.

Summary

The automation scripts in automation/ previously assumed interactive use and macOS/Homebrew availability. In CI (Ubuntu runners) these scripts can hang on prompts or fail when brew isn't present. This change makes the scripts robust for both interactive local use and non-interactive CI environments.

Files changed (high level)

  • automation/scripts/setup-claude-code.sh
  • automation/scripts/setup-ralph-project.sh
  • automation/start-ralph.sh

Key changes

  1. Non-interactive mode and CI autodetection
  • Scripts now detect CI environments (CI=true) and support NONINTERACTIVE=1, and accept -y/--yes to skip prompts.
  • When non-interactive, prompts default to 'yes' and the scripts proceed without waiting for user input.
  1. Best-effort package installation
  • Added an install_pkg helper that uses Homebrew when available on macOS, and apt-get on Debian/Ubuntu when brew is not available. It attempts installs in a best-effort manner and logs warnings instead of hard failing for optional packages.
  • Special-cases Debian package name differences (e.g., fd -> fd-find).
  1. Safe installer execution
  • For external installers (e.g., claude installer), scripts download the installer to /tmp and run it if available, avoiding silent curl|bash piping in CI.
  • Missing installer downloads are reported with a warn message and the script continues to final verification so CI doesn't hang.
  1. Add new flags and options
  • setup-claude-code.sh: supports -y/--yes and detects NONINTERACTIVE/CI envs.
  • setup-ralph-project.sh: supports -y/--yes and auto-accepts prompts in non-interactive mode when creating projects.
  • start-ralph.sh: supports --promise, --max-iterations and -y flags. Provides defaults for promise and iterations and is safe for non-interactive usage.
  1. Verification and clear failure conditions
  • Scripts perform final verification of critical components (e.g., claude command and settings.json) and exit with non-zero if critical pieces are missing. Optional tools warn but don't abort early.

Why this is needed

  • CI environments (Ubuntu runners) often are non-interactive and don't have Homebrew installed. The original scripts assume interactivity and macOS-specific tools; that causes GitHub Actions runs to fail or hang.
  • These changes make the automation usable both locally and in CI so the repo's workflow runs are reliable.

Testing / How to validate

Local interactive test (macOS or Linux):

  • ./automation/scripts/setup-claude-code.sh
  • ./automation/scripts/setup-ralph-project.sh myproj python -y
  • ./automation/start-ralph.sh nodejs --promise "NODE.JS ENVIRONMENT READY" --max-iterations 5

Non-interactive test (simulate CI):

  • NONINTERACTIVE=1 ./automation/scripts/setup-claude-code.sh
  • CI=true ./automation/start-ralph.sh nodejs -y --max-iterations 3 --promise "NODE.JS ENVIRONMENT READY"

Notes for reviewers

  • The implementation is intended to be conservative: it attempts to install packages where possible but will not force a package manager on the runner. Where sudo is required on Linux, apt-get calls use sudo; CI runners generally allow that or the commands will be best-effort.
  • Please verify on GitHub Actions Ubuntu runners by adding a temporary workflow job that runs NONINTERACTIVE=1 ./automation/scripts/setup-claude-code.sh.

Images

The user included screenshots showing the confirmation dialog for creating a PR. Include them here for context:

image1
image2

Please create a branch named fix/automation-noninteractive-ci-support, commit the three updated scripts with executable permissions, and open a pull request against the repository default branch titled: "Make automation scripts non-interactive and CI-friendly". The PR body should contain the summary above, list of files changed, testing instructions, and a checklist for reviewers.

If you need me to modify any of the changed behaviors (e.g., remove sudo usage or change default permission modes), list the requested adjustments in the PR description so I can iterate in follow-up commits.

This pull request was created from Copilot chat.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 17, 2026 20:00
…tible

- Add CI/non-interactive mode detection (CI=true, NONINTERACTIVE=1)
- Add -y/--yes flag support to all three scripts
- Add cross-platform install_pkg helper using brew/apt-get
- Make claude installer download safe (no curl|bash in CI)
- Add --promise and --max-iterations flags to start-ralph.sh
- Provide sensible defaults for non-interactive usage
- Add final verification with proper exit codes
- Best-effort package installation with warnings instead of failures

Files updated:
- automation/scripts/setup-claude-code.sh
- automation/scripts/setup-ralph-project.sh
- automation/start-ralph.sh

All scripts tested for syntax and functionality.

Co-authored-by: flatfinderai-cyber <252397696+flatfinderai-cyber@users.noreply.github.com>
- Add documentation to install_pkg explaining best-effort design
- Fix misleading "Essential tools installed" message
- Fix sed command in start-ralph.sh to use single expression
- All changes maintain non-interactive CI compatibility

Co-authored-by: flatfinderai-cyber <252397696+flatfinderai-cyber@users.noreply.github.com>
- Check for sudo availability before using it in apt-get
- Fall back to non-sudo installation in containers
- Add security notes about external installer trust
- Document that users should verify trust in installer sources
- Recommend version pinning for security-critical deployments

Co-authored-by: flatfinderai-cyber <252397696+flatfinderai-cyber@users.noreply.github.com>
Copilot AI changed the title [WIP] Update automation scripts for non-interactive CI use Make automation scripts non-interactive and CI-friendly Jan 17, 2026
@flatfinderai-cyber flatfinderai-cyber marked this pull request as ready for review January 18, 2026 02:41
Copy link
Copy Markdown
Owner

@flatfinderai-cyber flatfinderai-cyber left a comment

Choose a reason for hiding this comment

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

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.

2 participants