Enhancements for Claude Code CLI that fix common pain points and add quality-of-life improvements.
npx claude-code-plus -yOr run interactively to customize what gets installed:
npx claude-code-plusThe problem: Claude Code's permission system uses prefix matching. If you allow Bash(ls:*) and Bash(grep:*), running ls | grep foo still prompts for permission because the full string doesn't match any single prefix.
The solution: A PreToolUse hook that parses piped commands using shfmt, checks each component individually against your allowed permissions, and auto-approves if all parts match.
Related: anthropics/claude-code#13340
The problem: Claude Code ignores the $SHELL environment variable and always uses the system default shell (/bin/zsh on macOS). This means you lose access to your PATH, aliases, and shell-specific configuration.
The solution: A shell alias that wraps the claude command to set SHELL correctly, plus env.SHELL configuration in settings.json.
Related: anthropics/claude-code#7490
Pre-configured auto-approval for common read-only commands:
- File & text:
ls,cat,head,tail,grep,rg,fd,jq,yq - Git:
git status,git diff,git log,git branch,git show(read-only) - GitHub CLI:
gh pr list,gh issue view,gh repo view(read-only) - Package managers:
npm,yarn,pnpm,pip,cargo,gem,brew(info commands) - Cloud CLIs:
aws,az,gcloud(list/describe/show) - DevOps:
docker,kubectl,helm,terraform(read-only)
See src/permissions.ts for the complete list.
| Platform | Status |
|---|---|
| macOS | Fully supported |
| Linux | Fully supported |
| Windows | Use WSL2 |
- Node.js 18+ (for npx)
The installer will automatically detect and offer to install missing dependencies:
- bash 4.4+ (macOS ships with 3.2)
- jq (JSON processor)
- shfmt (shell parser)
Manual installation
macOS:
brew install bash jq shfmtLinux (Debian/Ubuntu):
apt install bash jq shfmtLinux (Fedora/RHEL):
dnf install bash jq shfmtLinux (Arch):
pacman -S bash jq shfmtnpx claude-code-plusChoose between:
- Recommended - Installs everything with sensible defaults
- Custom - Pick which features to install
npx claude-code-plus -yIn Custom mode, you can specify a different shell:
- A shell name (e.g.,
zsh) - resolved viawhich - A full path (e.g.,
/opt/homebrew/bin/zsh)
Note: Claude Code currently works reliably with bash and zsh only. Other shells may have limited compatibility.
| File | Purpose |
|---|---|
~/.claude/settings.json |
Shell config, hook config, and permissions |
~/.claude/hooks/auto-approve-allowed-commands.sh |
Hook for piped command auto-approval |
Shell configs (.bashrc, .zshrc, etc.) |
Shell alias (workaround for shell bug) |
The installer automatically detects if chezmoi manages your ~/.claude directory:
- Writes to chezmoi's source directory
- Uses
executable_prefix for hook files - Prompts to run
chezmoi applyat the end
No configuration needed.
- Claude Code invokes a Bash command
- The PreToolUse hook intercepts it
shfmtparses the command into components- Each component is checked against allowed permissions
- If ALL match, the command is auto-approved
- Otherwise, normal permission prompting applies
- Pipes:
cmd1 | cmd2 | cmd3 - And/Or:
cmd1 && cmd2 || cmd3 - Semicolons:
cmd1; cmd2 - Subshells:
(cmd1; cmd2) | cmd3 - Command substitution:
echo $(cmd1 | cmd2) bash -c/sh -c: recursively expanded- Loops: extracts inner commands
The following are not included in default permissions because they can execute arbitrary code:
xargs- runs commands from inputpython -c,node -e,ruby -e- inline code executioneval,source- execute arbitrary strings/filesfind -exec- runs commands on matched files
# Remove the hook
rm ~/.claude/hooks/auto-approve-allowed-commands.sh
# Remove shell alias (look for "# Added by claude-code-plus" in your shell configs)
# Edit ~/.claude/settings.json to remove:
# - The hook config from .hooks.PreToolUse
# - Any unwanted permissions from .permissions.allowIssues and PRs welcome!