Skip to content

feat: add experimental zsh shell option to setup.sh#70

Merged
BrettKinny merged 2 commits into
mainfrom
claude/add-zsh-feature-aTeQe
Apr 13, 2026
Merged

feat: add experimental zsh shell option to setup.sh#70
BrettKinny merged 2 commits into
mainfrom
claude/add-zsh-feature-aTeQe

Conversation

@BrettKinny
Copy link
Copy Markdown
Collaborator

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.

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.
Copilot AI review requested due to automatic review settings April 12, 2026 23:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 shell setup section in setup.sh that persists the choice and (optionally) installs/configures Zsh + Oh My Zsh + plugins.
  • Update the sqrbx-setup wrapper to recognize and document the new shell section.
  • Add .bashrc handoff 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 thread setup.sh Outdated
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'
Comment thread setup.sh Outdated
}

install_zsh() {
if command -v zsh &>/dev/null && [ -d "$HOME/.oh-my-zsh" ] && [ -f "$HOME/.zshrc" ]; then
Comment thread setup.sh Outdated
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
Comment thread setup.sh Outdated
zsh)
if install_zsh; then
touch ~/.squarebox-use-zsh
echo "Zsh will be used on the next shell start."
Comment thread setup.sh
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.
@BrettKinny BrettKinny merged commit 0bad744 into main Apr 13, 2026
1 check passed
@BrettKinny BrettKinny deleted the claude/add-zsh-feature-aTeQe branch April 13, 2026 00:54
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.

3 participants