fix(bootstrap): detect installed AI assistant before non-interactive skip check - #342
fix(bootstrap): detect installed AI assistant before non-interactive skip check#342evansenter wants to merge 1 commit into
Conversation
| return 0 | ||
| fi | ||
|
|
||
| # Non-interactive: default to skip |
There was a problem hiding this comment.
[Suggestion] Worth noting the blast radius this reorder opens up on the --pull/-p path, since it goes beyond the symlink/MCP configuration the PR description motivates.
With the installed-assistant check now ahead of the tty check, a non-interactive ./bootstrap.sh -f -p on a machine that has claude or agy also takes the INSTALL_AI == true branches at bootstrap.sh:573 (SteamOS Tailscale binary download), bootstrap.sh:658 (curl -fsSL https://tailscale.com/install.sh | sh on Debian/Ubuntu), bootstrap.sh:888 (pip3 install --upgrade piper-tts), and the Brewfile.ai bundle at bootstrap.sh:1026. Those are network-and-sudo side effects that previously could not happen without a human at the terminal.
This is not a defect — the Debian branch already runs sudo apt-get unconditionally a few lines earlier, so sudo-in-non-interactive is a pre-existing property of -p, and sudo without a tty errors rather than hanging. But if the intent was narrower ("configure AI dirs and MCP servers non-interactively") and not "install AI packages non-interactively", a tighter shape would be to keep INSTALL_AI=false for the package phase and gate only sync_dotfiles on assistant presence. Purely your call on which semantics you want.
| local ok=0 | ||
| local result | ||
| result=$( | ||
| PATH="$stub:$PATH" |
There was a problem hiding this comment.
[Suggestion] Two small robustness gaps in the new test:
-
PATH="$stub:$PATH"prepends the stub rather than replacing PATH. On any machine where a realclaudeoragyis already on PATH — i.e. the maintainer machine, which is wheremake checkusually runs — thecommand -vinsideprompt_ai_installsucceeds regardless of the stub, so the test would pass even if stub creation silently broke. UsingPATH="$stub:/usr/bin:/bin"(or asserting the stub is what gets resolved) makes the test prove what it claims. -
Only the positive branch is covered. The reorder must also preserve "nothing installed + non-interactive → INSTALL_AI=false", which is the behavior the original ordering existed to provide. A sibling case with an empty stub dir and a scrubbed PATH asserting
falsewould pin both halves, and would catch a future change that drops the tty check entirely.
Minor style note: the neighboring tests extract functions through _load_<fn> helpers (e.g. _load_symlink_agy_configs immediately below). Inlining the sed/eval here works fine, but a helper would match the local idiom.
There was a problem hiding this comment.
Code Review — Round 1
Summary
The reorder in prompt_ai_install is correct and minimal: the "already an AI machine" fast path now runs before the non-interactive skip, so ./bootstrap.sh -f under an agent runner or subshell no longer drops Claude/agy directory symlinking and MCP registration on machines that clearly want it. The caching guard stays first, so repeat calls across the ~6 call sites still short-circuit, and the interactive prompt path is untouched. The new test is a genuine regression test — under the old ordering with stdin redirected from /dev/null it would observe false and fail.
Previously Addressed (Filtered)
None — no prior automated review rounds on this PR.
Verdict
APPROVE - No blocking findings. Two non-blocking suggestions posted inline: the widened scope of the non-interactive -p package path, and test isolation plus negative-branch coverage.
Automated review by Claude Code
Summary
Fixes ordering in
prompt_ai_installinbootstrap.sh. Previously, the non-interactive check ([[ ! -t 0 ]]) was evaluated before checking whetherclaudeoragywas already installed (command -v). As a result, running./bootstrap.sh -fin non-interactive environments (such as agent runners, CI, or subshells) defaultedINSTALL_AItofalseand skipped AI directory and MCP server configuration even on machines where Claude or Antigravity was installed.Changes
prompt_ai_install, checkcommand -v claude || command -v agybefore checking[[ ! -t 0 ]].test_prompt_ai_install_detects_installed_assistantintests/test-bootstrap.shverifying that an installed assistant is detected even when stdin is not a tty.Verification
make checkpasses (129/129 hook tests, 54/54 bootstrap tests, shellcheck, syntax checks)../bootstrap.sh -fin non-interactive subshell now configures AI setup.