-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathbugtraceai-cli
More file actions
executable file
·64 lines (57 loc) · 2.11 KB
/
bugtraceai-cli
File metadata and controls
executable file
·64 lines (57 loc) · 2.11 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
#!/bin/bash
# BugtraceAI-CLI Quick Launch Script
# Activates venv and runs the framework with a clean state
# Check if --resume is present in arguments
# Parse arguments to detect flags and filter out bash-only flags
RESUME=false
CLEAN=false
PYTHON_ARGS=()
for arg in "$@"; do
if [ "$arg" == "--resume" ]; then
RESUME=true
PYTHON_ARGS+=("$arg")
elif [ "$arg" == "--clean" ]; then
CLEAN=true
# Do NOT add to PYTHON_ARGS, consume it here
else
PYTHON_ARGS+=("$arg")
fi
done
if [ "$CLEAN" = true ]; then
echo "🔥 EXPLICIT CLEANUP REQUESTED (--clean) 🔥"
echo " - Removing reports..."
if [ -d "reports" ]; then rm -rf reports/*; fi
echo " - Removing logs..."
if [ -d "logs" ]; then rm -rf logs/*; fi
if [ -d "bugtrace/logs" ]; then rm -rf bugtrace/logs/*; fi
echo " - Removing database..."
rm -f bugtrace.db bugtrace.db-shm bugtrace.db-wal 2>/dev/null
echo "✅ Environment completely reset."
elif [ "$RESUME" = false ]; then
# No automatic cleanup — data is preserved between runs.
# Use --clean to explicitly reset reports/logs/db.
echo "🔄 Launching (data preserved). Use --clean to reset."
else
echo "🔄 Resume mode detected. Skipping cleanup to preserve state."
fi
# Determine which venv to use
if [ -d ".venv_fresh" ]; then
VENV_PATH=".venv_fresh"
elif [ -d ".venv" ]; then
VENV_PATH=".venv"
elif [ -d "venv" ]; then
VENV_PATH="venv"
else
echo "Error: Virtual environment (.venv_fresh, .venv or venv) not found."
exit 1
fi
source "$VENV_PATH/bin/activate"
# Use filtered arguments for Python
# Check if the first argument is a URL (implicitly "full" command)
FIRST_ARG="${PYTHON_ARGS[0]}"
if [[ "$FIRST_ARG" != "scan" && "$FIRST_ARG" != "full" && "$FIRST_ARG" != "audit" && "$FIRST_ARG" != "tui" && "$FIRST_ARG" != "agents" && "$FIRST_ARG" != "summary" && "$FIRST_ARG" != "serve" && "$FIRST_ARG" != "mcp" && "$FIRST_ARG" != -* && -n "$FIRST_ARG" ]]; then
# Default to FULL scan if just a target is provided
python3 -m bugtrace full "${PYTHON_ARGS[@]}"
else
python3 -m bugtrace "${PYTHON_ARGS[@]}"
fi