Fixing AI CLI Path Issues
Calliope Integration: This component is integrated into the Calliope AI platform. Some features and configurations may differ from the upstream project.
Problem
AI CLI tools (Claude, Gemini, Codex) are installed but not found in PATH:
❌ claude-WAIIDE not in PATH
❌ gemini-cli not in PATHRoot Cause
The npm global packages are installed in a non-standard location and the symlinks are not created properly.
Solution
Permanent Fix (Rebuild Docker Image)
The Dockerfile has been updated to:
- Dynamically detect the npm global bin directory
- Create proper symlinks for all AI CLI executables
- Set up PATH configuration in
/etc/profile.d/npm-path.sh
Rebuild the image:
docker compose build
docker compose up -dQuick Fix (Running Container)
Two scripts are available to fix the issue in a running container:
1. Fix AI CLI Paths Script
# Copy and run the fix script
docker cp scripts/fix-ai-cli-paths.sh calliope-web-ai-ide:/tmp/
docker exec -it calliope-web-ai-ide sudo bash /tmp/fix-ai-cli-paths.shThis script will:
- Find the npm global bin directory
- Create symlinks in
/usr/local/binfor all AI CLI tools - Update PATH configuration
- Verify the installation
2. Configure AI CLIs Script
# This runs automatically on container start
docker exec -it calliope-web-ai-ide bash /opt/calliope/scripts/configure-ai-clis.shThis script will:
- Configure API keys for each CLI
- Test authentication
- Show installation paths
Manual Fix
If you need to fix it manually:
# Inside the container as root
NPM_GLOBAL_BIN=$(npm bin -g)
ln -sf $NPM_GLOBAL_BIN/claude /usr/local/bin/claude
ln -sf $NPM_GLOBAL_BIN/claude /usr/local/bin/claude-WAIIDE
ln -sf $NPM_GLOBAL_BIN/gemini /usr/local/bin/gemini
ln -sf $NPM_GLOBAL_BIN/gemini /usr/local/bin/gemini-cli
ln -sf $NPM_GLOBAL_BIN/codex /usr/local/bin/codex
# Update PATH
echo "export PATH=\"$NPM_GLOBAL_BIN:/usr/local/bin:\$PATH\"" >> /etc/profile.d/npm-path.sh
chmod +x /etc/profile.d/npm-path.sh
source /etc/profile.d/npm-path.shVerification
After applying the fix, verify the CLIs are available:
which claude-WAIIDE
which gemini-cli
which codex
# Or use the verification in the fix script
docker exec -it calliope-web-ai-ide bash -c "which claude && which gemini && which codex"Environment Variables
Make sure these are set in your Docker Compose or environment:
ANTHROPIC_API_KEY- For Claude CLIGOOGLE_API_KEY- For Gemini CLIOPENAI_API_KEY- For Codex CLI
Updated Files
Dockerfile- Improved AI CLI installation with dynamic path detectionscripts/entrypoint-jupyterhub.sh- Updated PATH handlingscripts/configure-ai-clis.sh- Enhanced command detectionscripts/fix-ai-cli-paths.sh- New fix script for running containers