Skip to content

feat: Add Fish shell support in installer#398

Merged
svarlamov merged 2 commits intogit-ai-project:mainfrom
Krishnachaitanyakc:fish-shell-support
Jan 26, 2026
Merged

feat: Add Fish shell support in installer#398
svarlamov merged 2 commits intogit-ai-project:mainfrom
Krishnachaitanyakc:fish-shell-support

Conversation

@Krishnachaitanyakc
Copy link
Copy Markdown
Contributor

Fixes #386

  • Enhanced detect_shell() to detect Fish shell via $SHELL env var, ~/.config/fish/config.fish existence, and $FISH_VERSION variable
  • Use fish_add_path -g for PATH modification (idiomatic Fish syntax)
  • Create ~/.config/fish/ directory if it doesn't exist before writing config
  • Maintains backward compatibility with bash and zsh users

@svarlamov
Copy link
Copy Markdown
Member

Thank you for your contribution @Krishnachaitanyakc! I just realized that we only install in one shell, but for example, I now have both zsh and fish installed on my laptop. Do you think there's a sane way to make sure that we end up in the PATH on all the user's shells? Curious what your thoughts are on this

@Krishnachaitanyakc
Copy link
Copy Markdown
Contributor Author

@svarlamov One option I can think of is, instead of detecting which shell is primary and modifying only that one, we can detect all shells that have config files present and modify each of them. What do you think?

@svarlamov
Copy link
Copy Markdown
Member

@Krishnachaitanyakc I think that's a great idea -- can you update the PR? Excited to get this merged :)

Previously the installer only configured PATH for a single detected shell.
Now it detects and configures all shells that have existing config files:
- Bash: ~/.bashrc (preferred) or ~/.bash_profile
- Zsh: ~/.zshrc
- Fish: ~/.config/fish/config.fish

Key changes:
- Replace detect_shell() with detect_all_shells() that returns all shells
- Loop through all detected shells and configure PATH in each
- Use shell-appropriate PATH syntax (fish_add_path for Fish, export for others)
- Improved user feedback showing which configs were updated
- Provide reload instructions for each configured shell
- Falls back to $SHELL detection only when no config files exist
- Idempotent: won't duplicate PATH entries on re-run
Add comprehensive tests for the detect_all_shells() function:
- Detects individual shells (bash, zsh, fish) when only one config exists
- Detects multiple shells when multiple configs exist
- Prefers .bashrc over .bash_profile for bash
- Falls back to $SHELL when no config files exist
- Falls back to bash as default when $SHELL is unknown/empty

Also tests PATH configuration behavior:
- Idempotency: doesn't duplicate PATH entries on re-run
- Correct syntax for fish (fish_add_path) vs bash/zsh (export PATH)
- Integration: configures all detected shells
- Only modifies existing config files, doesn't create new ones
@Krishnachaitanyakc
Copy link
Copy Markdown
Contributor Author

@svarlamov done, can you review it?

@svarlamov
Copy link
Copy Markdown
Member

Just reviewed and tested a bunch -- looks great! I'll merge as soon as the CI finishes

@svarlamov svarlamov merged commit 40704e5 into git-ai-project:main Jan 26, 2026
5 checks passed
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.

Add support for Fish shell

2 participants