-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathai.sh
More file actions
executable file
·72 lines (65 loc) · 2.4 KB
/
Copy pathai.sh
File metadata and controls
executable file
·72 lines (65 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# ==============================================================================
# Code Analysis Agent Runner
# Made by Macowen Keru
# Contact: macowenkeru@gmail.com
# ==============================================================================
# Script Directory
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TARGET_DIR="$1"
show_help() {
echo "=============================================================================="
echo " Code Analysis Agent "
echo "=============================================================================="
echo "Made by: Macowen Keru"
echo "Contact: macowenkeru@gmail.com"
echo ""
echo "Description:"
echo " A LangGraph-based cybersecurity agent that analyzes source code files for"
echo " vulnerabilities, logic flows, and potential threats."
echo ""
echo "System Requirements:"
echo " - Python 3.10+"
echo " - uv (Fast Python Package Installer & Resolver)"
echo " - Ollama (running locally)"
echo " - Model: 'deepseek-v3.2:cloud' pulled via Ollama"
echo " (Note: The model can be changed in agent.py -> llm configuration)"
echo ""
echo "Usage:"
echo " ./ai.sh [path/to/analyze]"
echo " If no path is provided, you will be prompted to enter one interactively."
echo ""
echo "Options:"
echo " --help, -h Show this help message and exit"
echo "=============================================================================="
}
if [[ "$1" == "--help" ]] || [[ "$1" == "-h" ]]; then
show_help
exit 0
fi
# Check for uv
if ! command -v uv &> /dev/null; then
echo "[!] Error: 'uv' is not installed or not in PATH."
echo " Please install: curl -LsSf https://astral.sh/uv/install.sh | sh"
exit 1
fi
# Setup Virtual Environment if neither .venv nor venv exists
if [ ! -d "$DIR/.venv" ] && [ ! -d "$DIR/venv" ]; then
echo "[*] No virtual environment found. Creating one with 'uv'..."
cd "$DIR" || exit 1
uv venv
echo "[*] Syncing dependencies..."
uv sync
else
# Always sync to ensure dependencies are up to date
echo "[*] Virtual environment found. Ensuring dependencies are synced..."
cd "$DIR" || exit 1
uv sync
fi
# Run the agent using uv run
echo "[*] Starting Code Analysis Agent..."
if [ -n "$TARGET_DIR" ]; then
uv run agent.py "$TARGET_DIR"
else
uv run agent.py
fi