Skip to content

fix: run iii console installer with bash#801

Open
mturac wants to merge 1 commit into
rohitg00:mainfrom
mturac:fix/issue-712-console-install-posix-sh
Open

fix: run iii console installer with bash#801
mturac wants to merge 1 commit into
rohitg00:mainfrom
mturac:fix/issue-712-console-install-posix-sh

Conversation

@mturac
Copy link
Copy Markdown

@mturac mturac commented Jun 3, 2026

Summary

  • run the iii console installer through bash instead of POSIX sh
  • update the missing-shell hint to mention bash
  • add a regression test so the installer command does not drift back to install.sh | sh

Tests

  • git diff --check
  • npm test -- test/iii-console-install.test.ts
  • npm run build

Closes #712

Summary by CodeRabbit

  • Bug Fixes

    • Updated the iii-console installation command to use bash instead of sh for improved compatibility and feature support.
    • Installer now verifies bash and curl availability before attempting installation and warns if either tool is missing.
  • Tests

    • Added test coverage to verify the correct shell is used during installation.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 3, 2026

@mturac is attempting to deploy a commit to the rohitg00's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 3, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

The PR updates the iii-console installer to require and use bash instead of sh. The install command constant and ensureIiiConsole() function are modified to detect bash and curl, warn if either is missing, and run the install script via bash. A test validates the new bash-based behavior.

Changes

Shell switch to bash

Layer / File(s) Summary
Shell switch to bash
src/cli.ts, test/iii-console-install.test.ts
The III_CONSOLE_INSTALL_CMD constant now pipes to bash instead of sh. The ensureIiiConsole() function probes for both bash and curl, warns with manual-install instructions if either is unavailable, and executes the install via runCommand(bashBin, ["-lc", ...]). A new Vitest spec validates the installer uses the bash pipeline and excludes the sh variant.

Possibly related PRs

  • rohitg00/agentmemory#681: Modifies the same III_CONSOLE_INSTALL_CMD in src/cli.ts—one changes the install URL, the other changes the shell used for execution.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A bash for the console, at last we agreed,
No POSIX shell quirks to slow down our speed!
With pipefail in place, our installs stay strong—
The rabbit hops happily, all along! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: run iii console installer with bash' directly and concisely describes the main change: switching the installer from sh to bash.
Linked Issues check ✅ Passed The PR addresses issue #712 by changing the installer to use bash instead of sh, which resolves the 'set: Illegal option -o pipefail' error and enables successful installation.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the iii console installer to use bash and adding a regression test; no unrelated modifications are present.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
src/cli.ts (1)

662-662: 💤 Low value

Login shell flag (-lc) for install script.

The -lc flag runs bash as a login shell, which loads user profiles and environment. This differs from the engine installer at line 737 which uses sh -c. The choice is likely intentional to ensure the console install script runs with a fully-configured bash environment, though -c might suffice if the script doesn't depend on login-shell setup.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cli.ts` at line 662, The call to runCommand using bashBin with flags
["-lc", III_CONSOLE_INSTALL_CMD] is inconsistent with the engine installer
(which uses "sh -c") and may unnecessarily invoke a login shell; change the
flags to ["-c", III_CONSOLE_INSTALL_CMD] in the runCommand invocation
(referencing bashBin and III_CONSOLE_INSTALL_CMD) unless the console installer
actually requires login-shell profile loading—if it does, add a brief comment
above the runCommand explaining why "-lc" is required.
test/iii-console-install.test.ts (1)

4-15: 💤 Low value

Regression test uses source string matching.

This test validates the bash switch by reading src/cli.ts and checking for literal strings. While brittle (formatting changes or comments mentioning "install.sh | sh" would break it), this approach is acceptable for a focused regression test guarding against issue #712. The negative assertion on line 13 ensures the problematic sh variant doesn't reappear.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/iii-console-install.test.ts` around lines 4 - 15, The test is brittle
because it matches exact source strings in src/cli.ts; change the assertions to
be resilient to minor formatting changes by using regex matches instead of exact
string comparisons: replace expect(cli).toContain("curl -fsSL
https://install.iii.dev/iii/main/install.sh | bash") with a toMatch(/curl
-fsSL\s+https:\/\/install\.iii\.dev\/iii\/main\/install\.sh\s*\|\s*bash/),
replace expect(cli).toContain('const bashBin = whichBinary("bash");') and the
runCommand check with regexes like
toMatch(/const\s+bashBin\s*=.*whichBinary\(["']bash["']\)/) and
toMatch(/runCommand\(\s*bashBin\s*,\s*\[.*"-lc".*\]/), and keep the negative
assertion using a regex for /install\.sh\s*\|\s*sh/ to ensure the "sh" variant
is not present while allowing harmless formatting differences.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/cli.ts`:
- Line 662: The call to runCommand using bashBin with flags ["-lc",
III_CONSOLE_INSTALL_CMD] is inconsistent with the engine installer (which uses
"sh -c") and may unnecessarily invoke a login shell; change the flags to ["-c",
III_CONSOLE_INSTALL_CMD] in the runCommand invocation (referencing bashBin and
III_CONSOLE_INSTALL_CMD) unless the console installer actually requires
login-shell profile loading—if it does, add a brief comment above the runCommand
explaining why "-lc" is required.

In `@test/iii-console-install.test.ts`:
- Around line 4-15: The test is brittle because it matches exact source strings
in src/cli.ts; change the assertions to be resilient to minor formatting changes
by using regex matches instead of exact string comparisons: replace
expect(cli).toContain("curl -fsSL https://install.iii.dev/iii/main/install.sh |
bash") with a toMatch(/curl
-fsSL\s+https:\/\/install\.iii\.dev\/iii\/main\/install\.sh\s*\|\s*bash/),
replace expect(cli).toContain('const bashBin = whichBinary("bash");') and the
runCommand check with regexes like
toMatch(/const\s+bashBin\s*=.*whichBinary\(["']bash["']\)/) and
toMatch(/runCommand\(\s*bashBin\s*,\s*\[.*"-lc".*\]/), and keep the negative
assertion using a regex for /install\.sh\s*\|\s*sh/ to ensure the "sh" variant
is not present while allowing harmless formatting differences.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 90eb052c-c16f-47fd-ad59-8130ea2b6572

📥 Commits

Reviewing files that changed from the base of the PR and between d442fee and 15f0f30.

📒 Files selected for processing (2)
  • src/cli.ts
  • test/iii-console-install.test.ts

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.

iii-console install - Illegal option -o pipefail

1 participant