feat: add experimental zsh shell option to setup.sh#70
Merged
Conversation
Closes the biggest UX gap vs. competing dev environments by offering Zsh + Oh My Zsh + zsh-autosuggestions + zsh-syntax-highlighting as a selectable shell during first-run setup, alongside the Bash default. The new `shell` section installs zsh via apt, runs the Oh My Zsh unattended installer (RUNZSH=no/CHSH=no/KEEP_ZSHRC=yes), clones the two plugin repos, and writes a `~/.zshrc` that mirrors the default bashrc — same aliases, starship, zoxide, and AI/editor/SDK sourcing. A `~/.squarebox-use-zsh` marker tells `~/.bashrc` to `exec zsh -l` on the next interactive login. SQUAREBOX_NO_ZSH=1 forces bash for one session; re-run `sqrbx-setup shell` to switch back permanently.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an experimental “shell” setup section to let users opt into Zsh + Oh My Zsh (and common plugins) during first-run setup, while keeping Bash as the default and enabling an automatic handoff via a marker file.
Changes:
- Add a new
shellsetup section insetup.shthat persists the choice and (optionally) installs/configures Zsh + Oh My Zsh + plugins. - Update the
sqrbx-setupwrapper to recognize and document the newshellsection. - Add
.bashrchandoff logic (via Dockerfile bashrc heredoc) and update docs/roadmap to reflect completion.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| setup.sh | Introduces shell section: selection persistence, Zsh installation, .zshrc generation, and marker toggle. |
| scripts/squarebox-setup.sh | Adds shell to valid sections, help text, and --list output. |
| Dockerfile | Adds bashrc logic to exec zsh -l when the opt-in marker is present. |
| README.md | Documents the experimental Zsh option and switching behavior. |
| ROADMAP.md | Marks the “Zsh option” item as completed. |
| CLAUDE.md | Updates documented setup step list and valid sections to include shell. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1354
to
+1373
| sudo apt-get update -qq && sudo apt-get install -y -qq zsh >/dev/null 2>&1 | ||
| # Trust boundary: the Oh My Zsh installer manages its own files via HTTPS. | ||
| # RUNZSH=no prevents launching a subshell, CHSH=no skips the chsh prompt | ||
| # (we handle shell switching via the .squarebox-use-zsh marker), and | ||
| # KEEP_ZSHRC=yes prevents it from writing a .zshrc we'd immediately overwrite. | ||
| if [ ! -d "$HOME/.oh-my-zsh" ]; then | ||
| RUNZSH=no CHSH=no KEEP_ZSHRC=yes \ | ||
| sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended >/dev/null 2>&1 | ||
| fi | ||
| local custom="$HOME/.oh-my-zsh/custom" | ||
| if [ ! -d "$custom/plugins/zsh-autosuggestions" ]; then | ||
| git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions \ | ||
| "$custom/plugins/zsh-autosuggestions" >/dev/null 2>&1 | ||
| fi | ||
| if [ ! -d "$custom/plugins/zsh-syntax-highlighting" ]; then | ||
| git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting \ | ||
| "$custom/plugins/zsh-syntax-highlighting" >/dev/null 2>&1 | ||
| fi | ||
| # Generate ~/.zshrc that mirrors ~/.bashrc, layered on Oh My Zsh. | ||
| cat > "$HOME/.zshrc" <<-'ZSHRC' |
| } | ||
|
|
||
| install_zsh() { | ||
| if command -v zsh &>/dev/null && [ -d "$HOME/.oh-my-zsh" ] && [ -f "$HOME/.zshrc" ]; then |
Comment on lines
+1355
to
+1361
| # Trust boundary: the Oh My Zsh installer manages its own files via HTTPS. | ||
| # RUNZSH=no prevents launching a subshell, CHSH=no skips the chsh prompt | ||
| # (we handle shell switching via the .squarebox-use-zsh marker), and | ||
| # KEEP_ZSHRC=yes prevents it from writing a .zshrc we'd immediately overwrite. | ||
| if [ ! -d "$HOME/.oh-my-zsh" ]; then | ||
| RUNZSH=no CHSH=no KEEP_ZSHRC=yes \ | ||
| sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended >/dev/null 2>&1 |
| zsh) | ||
| if install_zsh; then | ||
| touch ~/.squarebox-use-zsh | ||
| echo "Zsh will be used on the next shell start." |
Comment on lines
+1296
to
+1304
| # Shell (experimental) — offer Zsh + Oh My Zsh as an alternative to Bash | ||
| if should_run shell; then | ||
| SHELL_CONFIG="/workspace/.squarebox/shell" | ||
|
|
||
| shell_prev="" | ||
| if [ -f "$SHELL_CONFIG" ]; then | ||
| shell_prev=$(cat "$SHELL_CONFIG") | ||
| fi | ||
|
|
- Propagate failures from _install_zsh_inner via `|| return 1` on every apt/curl/git step, plus end-of-function verification that zsh, oh-my-zsh.sh, both plugin dirs, and ~/.zshrc actually exist. Prevents the zsh handoff marker from being written on a partial install. - Drop the install_zsh fast-path that only checked zsh + ~/.oh-my-zsh + ~/.zshrc. It missed the plugin directories, so a half-finished run could skip and launch zsh without autosuggestions or syntax highlighting. The inner function is fully idempotent (every step guards on `-d`/`-f`), so running it unconditionally is cheap and self-healing. - Pin the Oh My Zsh installer fetch to the latest release tag (via sb_gh_latest_tag ohmyzsh/ohmyzsh) instead of tracking master, falling back to master if the tag lookup fails. Matches the trust model used by the rest of setup.sh for optional tools. - Reword the handoff message: bashrc exec's zsh right after setup.sh returns, so 'next shell start' was misleading — now it says zsh will take over at the end of setup. - Extend the e2e suite: assert that the new shell config file is written, that the bash path leaves no leftover ~/.squarebox-use-zsh marker, and that sqrbx-setup --help advertises the shell section.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the biggest UX gap vs. competing dev environments by offering
Zsh + Oh My Zsh + zsh-autosuggestions + zsh-syntax-highlighting as a
selectable shell during first-run setup, alongside the Bash default.
The new
shellsection installs zsh via apt, runs the Oh My Zshunattended installer (RUNZSH=no/CHSH=no/KEEP_ZSHRC=yes), clones the
two plugin repos, and writes a
~/.zshrcthat mirrors the defaultbashrc — same aliases, starship, zoxide, and AI/editor/SDK sourcing.
A
~/.squarebox-use-zshmarker tells~/.bashrctoexec zsh -lonthe next interactive login. SQUAREBOX_NO_ZSH=1 forces bash for one
session; re-run
sqrbx-setup shellto switch back permanently.