Skip to content

feat: add experimental fish shell option#74

Merged
BrettKinny merged 3 commits intomainfrom
claude/great-archimedes
Apr 17, 2026
Merged

feat: add experimental fish shell option#74
BrettKinny merged 3 commits intomainfrom
claude/great-archimedes

Conversation

@BrettKinny
Copy link
Copy Markdown
Collaborator

Summary

  • Adds fish as a third shell option alongside bash and zsh in setup.sh, flagged as experimental.
  • Drops (experimental) from the Shell section header since the tag now lives on the individual options.
  • Generates a fish-native ~/.config/fish/config.fish mirroring the default bashrc (starship, zoxide, aliases, EDITOR, PATH), plus a translated conf.d/squarebox-selections.fish built from the user's existing ~/.squarebox-ai-aliases, -editor-aliases, -tui-aliases, and -sdk-paths bash files.
  • Mirrors the zsh handoff: ~/.squarebox-use-fish marker causes ~/.bashrc to exec fish -l; SQUAREBOX_IN_FISH guards re-exec loops, SQUAREBOX_NO_FISH forces bash for one session.

Why

Fish is the most-requested alternative after zsh — built-in autosuggestions and syntax highlighting with no plugins required. Existing users who prefer fish had to configure it manually.

Notes for reviewers

  • Bash→fish translation (_squarebox_bash_line_to_fish in setup.sh): handles export PATH="A:B:\$PATH"set -x PATH A B \$PATH, other export NAME=…set -x NAME …, and passes alias … lines through (fish 3+ accepts alias foo='bar'). Lines it can't translate (the nvm [ -s … ] && . … sourcing, etc.) are dropped on purpose — see the known limitation below.
  • Known limitation: nvm isn't wired into fish. The README flags this and points at nvm.fish. All other SDKs (uv, Go, .NET) translate cleanly since they use plain export.
  • Dockerfile gets a parallel handoff stanza after the existing zsh one; selection logic clears whichever marker the user isn't using.
  • e2e test now clears both markers before asserting bash selection state — fish path isn't exercised in CI (same rationale as zsh: network-heavy apt install).

Test plan

  • Fresh container → sqrbx-setup shell → pick fish → exit/re-enter → lands in fish with prompt, aliases, and selected EDITOR working
  • Re-run sqrbx-setup shell → switch back to bash → marker removed, next shell is bash
  • SQUAREBOX_NO_FISH=1 bash -l (with marker present) → stays in bash
  • cat ~/.config/fish/conf.d/squarebox-selections.fish → contains the expected translated entries for the current selections
  • Existing bash and zsh flows still work (regression check)

🤖 Generated with Claude Code

Extends the shell picker in setup.sh with a third choice (fish), alongside
the existing bash and zsh options. Also drops "(experimental)" from the
Shell section header since the tag now lives on the individual options.

Fish install:
- apt-get install fish
- Writes ~/.config/fish/config.fish mirroring the default bashrc in
  fish-native syntax (starship, zoxide, aliases, EDITOR, PATH).
- Translates the user's ~/.squarebox-ai-aliases, -editor-aliases,
  -tui-aliases, and -sdk-paths bash files into a single
  ~/.config/fish/conf.d/squarebox-selections.fish at install time via a
  small bash→fish line translator (export PATH=… → set -x PATH …, other
  exports → set -x, aliases pass through, unsupported constructs like
  nvm sourcing are dropped).

Handoff:
- New ~/.squarebox-use-fish marker (parallel to the zsh one) triggers
  `exec fish -l` from bashrc. SQUAREBOX_IN_FISH guards re-exec loops;
  SQUAREBOX_NO_FISH forces bash for a single session.

Docs + test:
- README Shell section documents fish and flags the known nvm-in-fish
  limitation (nvm.fish plugin required).
- squarebox-setup.sh help text mentions fish.
- e2e-test.sh clears both markers before asserting selection state.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 17, 2026 08:15
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 fish as an additional (experimental) default shell option in squarebox, alongside bash and zsh, including install/hand-off behavior and documentation updates.

Changes:

  • Extend setup.sh shell selection to include fish, install it via apt, and generate ~/.config/fish/config.fish plus a translated conf.d/squarebox-selections.fish.
  • Add a fish hand-off stanza to .bashrc generation in the Dockerfile (marker-based exec fish -l).
  • Update CLI help text, README docs, and e2e setup marker cleanup to account for the new fish option.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
setup.sh Adds fish to shell selection, installs fish, generates fish config, and translates ~/.squarebox-* bash snippets to fish.
scripts/squarebox-setup.sh Updates help text to mention fish as an experimental shell option.
scripts/e2e-test.sh Clears fish marker in suite setup to avoid stale state impacting assertions.
README.md Documents fish option, generated config paths, and fish-specific limitation (nvm).
Dockerfile Adds .bashrc hand-off to fish via ~/.squarebox-use-fish marker, mirroring the zsh flow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread setup.sh Outdated
# highlighting, so no plugins are needed.
cat > "$HOME/.config/fish/config.fish" <<-'FISHRC' || return 1
# squarebox fish config (experimental) — mirrors ~/.bashrc
status is-interactive; or exit 0
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

In fish, config.fish is sourced during startup; using exit 0 here can terminate the shell entirely for non-interactive invocations (e.g., fish -c ...) rather than just skipping interactive-only setup. Prefer status is-interactive; or return (or wrap the interactive config in if status is-interactive ... end) so non-interactive fish commands keep working.

Suggested change
status is-interactive; or exit 0
status is-interactive; or return

Copilot uses AI. Check for mistakes.
Comment thread scripts/e2e-test.sh
Comment on lines +173 to +175
# Ensure stale markers from a previous run are cleared so the assertion
# below reflects the current selection, not leftover state.
rm -f ~/.squarebox-use-zsh
rm -f ~/.squarebox-use-zsh ~/.squarebox-use-fish
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

The suite now clears both ~/.squarebox-use-zsh and ~/.squarebox-use-fish, but the assertion later in this suite still only checks that the zsh marker is absent for a bash selection. Please also assert that the fish marker is not present, so the test actually catches regressions where bash selection accidentally leaves/creates the fish handoff marker.

Copilot uses AI. Check for mistakes.
BrettKinny and others added 2 commits April 17, 2026 18:19
- setup.sh: use `status is-interactive; or return` instead of `exit 0` in
  the generated config.fish. `exit` terminates the whole shell for
  non-interactive invocations like `fish -c '…'`; `return` only exits the
  current sourced config context.
- scripts/e2e-test.sh: add a 3.12c assertion that the bash selection
  leaves no fish handoff marker, matching the existing zsh marker check.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@BrettKinny BrettKinny merged commit 63d4a3c into main Apr 17, 2026
1 check passed
@BrettKinny BrettKinny deleted the claude/great-archimedes branch April 17, 2026 09:36
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