Shell Integration
aisw provides an optional shell hook for manual or advanced shell workflows.
How it works
Section titled “How it works”The hook intercepts aisw use <tool> <profile>, runs the real binary with --emit-env,
and applies the emitted export KEY=VALUE lines to the shell environment. All other
subcommands are passed through unchanged.
Normal aisw use behavior no longer depends on this hook. aisw init and aisw use apply the selected profile directly to the live Claude/Codex/Gemini config locations, so standalone tool invocations pick up the active profile without extra shell steps. The hook is optional.
Add to ~/.bashrc (or ~/.bash_profile):
eval "$(aisw shell-hook bash)"Add to ~/.zshrc:
eval "$(aisw shell-hook zsh)"Add to ~/.config/fish/config.fish:
aisw shell-hook fish | sourceFish cannot eval POSIX export KEY=VALUE syntax, so the fish hook parses each
line with string replace / string split and applies the values via set -gx.
Tab completion
Section titled “Tab completion”aisw ships completion files for bash, zsh, and fish.
When installed via install.sh, completions are installed to these locations:
- Bash:
~/.local/share/bash-completion/completions/aisw - Zsh: the first writable directory in
fpathwhen detectable, otherwise~/.zsh/completions/_aisw - Fish:
~/.config/fish/completions/aisw.fish
Manual installation from source:
cargo build --release
# Bashinstall -Dm644 completions/aisw.bash ~/.local/share/bash-completion/completions/aisw
# Zshinstall -Dm644 completions/_aisw ~/.zsh/completions/_aisw
# Fishinstall -Dm644 completions/aisw.fish ~/.config/fish/completions/aisw.fishIf you use zsh and ~/.zsh/completions is not already in fpath, add this to ~/.zshrc before compinit:
fpath=(~/.zsh/completions $fpath)autoload -Uz compinit && compinitTo regenerate completion files from source:
cargo build --releaseThe build writes fresh completion files to completions/.
Verifying the hook is active
Section titled “Verifying the hook is active”After sourcing, run:
echo $AISW_SHELL_HOOK # should print 1Disabling the hook
Section titled “Disabling the hook”Remove or comment out the eval / source line from your shell config, then start a
new shell session.