updated cli installator

This commit is contained in:
rarebuffalo
2026-05-22 21:43:25 +05:30
parent 542f607f25
commit 99261c23bf

54
cli/install.sh Normal file → Executable file
View File

@@ -1,36 +1,64 @@
#!/usr/bin/env bash
# install.sh — Install SecureLens AI CLI into the project venv
# Run from the repo root: ./cli/install.sh
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BACKEND_ROOT="$(dirname "$SCRIPT_DIR")"
echo "🔍 SecureLens AI CLI — Installer"
echo "================================="
echo ""
echo " ╔══════════════════════════════════════╗"
echo " ║ SecureLens AI CLI — Installer ║"
echo " ╚══════════════════════════════════════╝"
echo ""
# Detect venv
# ── Detect pip ────────────────────────────────────────────────────────────────
VENV_PIP=""
if [ -f "$BACKEND_ROOT/venv/bin/pip" ]; then
VENV_PIP="$BACKEND_ROOT/venv/bin/pip"
echo " Using backend venv: $BACKEND_ROOT/venv"
VENV_PYTHON="$BACKEND_ROOT/venv/bin/python"
echo " ✓ Using backend venv: $BACKEND_ROOT/venv"
elif command -v pip3 &>/dev/null; then
VENV_PIP="pip3"
echo " Using system pip3"
VENV_PYTHON="python3"
echo " ✓ Using system pip3"
else
VENV_PIP="pip"
echo " Using system pip"
VENV_PYTHON="python"
echo " ✓ Using system pip"
fi
echo ""
echo " Installing dependencies..."
$VENV_PIP install click rich litellm httpx pyyaml pathspec questionary --quiet
echo " Installing securelens-ai CLI..."
# ── Install build tools + CLI dependencies ────────────────────────────────────
echo " [1/2] Installing CLI dependencies..."
$VENV_PIP install setuptools wheel \
"click>=8.1" \
"rich>=13.0" \
"pyyaml>=6.0" \
"pathspec>=0.12" \
"questionary>=2.0" \
"litellm>=1.0" \
"httpx>=0.27" \
--quiet
echo " ✓ Dependencies installed"
# ── Install the securelens package ────────────────────────────────────────────
echo " [2/2] Installing securelens CLI..."
$VENV_PIP install setuptools --quiet # ensure build backend is available
$VENV_PIP install -e "$SCRIPT_DIR" --no-build-isolation --quiet
echo " ✓ securelens command registered"
echo ""
echo "✓ Done! Run: securelens --help"
echo " ════════════════════════════════════════"
echo " ✓ Installation complete!"
echo ""
echo " Next steps:"
if [ -f "$BACKEND_ROOT/venv/bin/activate" ]; then
echo " source $BACKEND_ROOT/venv/bin/activate"
fi
echo " securelens configure # set your API key"
echo " securelens scan . # scan this repo"
echo " securelens --help # see all commands"
echo ""
echo " Or if using venv directly:"
echo " source $BACKEND_ROOT/venv/bin/activate"
echo " securelens configure"