#!/bin/bash
# Install nlsh — natural language shell
set -e

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"

echo "Setting up virtual environment..."
python3 -m venv "$SCRIPT_DIR/.venv"
"$SCRIPT_DIR/.venv/bin/pip" install anthropic pyperclip -q

WRAPPER="$SCRIPT_DIR/nlsh"
cat > "$WRAPPER" <<EOF
#!/bin/bash
exec "$SCRIPT_DIR/.venv/bin/python3" "$SCRIPT_DIR/nlsh.py" "\$@"
EOF
chmod +x "$WRAPPER"

echo ""
echo "Done! Add this to your ~/.zshrc or ~/.bashrc:"
echo ""
echo "  export PATH=\"$SCRIPT_DIR:\$PATH\""
echo "  export ANTHROPIC_API_KEY=\"your-key-here\""
echo ""
echo "Then: source ~/.zshrc && nlsh \"list large files\""
