Overview
When shell integration is active, the following commands are automatically wrapped:npm, npx, yarn, pnpm, pnpx, bun, bunx, pip, pip3, uv, poetry, pipx, python, python3
Each command is replaced by a shell function that delegates to the corresponding aikido-* binary (e.g., npm calls aikido-npm). Safe Chain also intercepts Python module invocations for pip: python -m pip, python -m pip3, python3 -m pip, and python3 -m pip3.
Supported shells
| Shell | Startup file |
|---|---|
| Bash | ~/.bashrc |
| Zsh | ~/.zshrc |
| Fish | ~/.config/fish/config.fish |
| PowerShell Core | $PROFILE |
| Windows PowerShell | $PROFILE |
Setup commands
Run the following commands to manage shell integration:Set up shell integration
- Copies startup scripts to
~/.safe-chain/scripts/ - Detects all supported shells on your system
- Modifies each shell’s startup file to source the Safe Chain scripts
- Adds interceptors so
python -m pip[...]andpython3 -m pip[...]route through Safe Chain
File locations modified
- Unix / Linux / macOS
- Windows
| Shell | File modified |
|---|---|
| Bash | ~/.bashrc |
| Zsh | ~/.zshrc |
| Fish | ~/.config/fish/config.fish |
| PowerShell Core | ~/.config/powershell/profile.ps1 (resolved via $PROFILE) |
Manual setup
For advanced users who prefer not to usesafe-chain setup, you can add wrapper functions directly to your shell’s startup file. Shell functions take precedence over binaries in PATH, so defining an npm function intercepts all npm calls.
Package manager wrappers
Add the following pattern for each package manager. Repeat fornpx, yarn, pnpm, pnpx, bun, bunx, pip, pip3, uv, poetry, and pipx using their respective aikido-* commands.
Python module interception
To interceptpython -m pip and python3 -m pip invocations without altering the Python binary itself, add these forwarding functions:
These shell functions only intercept invocations of
python and python3 by name. Calls using absolute paths (e.g., /usr/bin/python -m pip) bypass shell functions entirely and will not be protected by Safe Chain.