-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
96 lines (84 loc) · 2.81 KB
/
install.sh
File metadata and controls
96 lines (84 loc) · 2.81 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/usr/bin/env bash
# code-indexer installer — works on Windows (Git Bash), macOS, Linux
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
info() { echo -e "${GREEN}[+]${NC} $*"; }
warn() { echo -e "${YELLOW}[!]${NC} $*"; }
error() { echo -e "${RED}[-]${NC} $*"; exit 1; }
# --- Detect OS ---
OS="$(uname -s 2>/dev/null || echo Unknown)"
case "$OS" in
Linux*) PLATFORM="linux";;
Darwin*) PLATFORM="macos";;
MINGW*|MSYS*|CYGWIN*) PLATFORM="windows";;
*) PLATFORM="unknown";;
esac
info "Platform: $PLATFORM"
# --- Check Python ---
PYTHON=""
for cmd in python3 python; do
if command -v "$cmd" &>/dev/null; then
PYVER=$("$cmd" --version 2>&1 | grep -oP '\d+\.\d+')
MAJOR=$(echo "$PYVER" | cut -d. -f1)
MINOR=$(echo "$PYVER" | cut -d. -f2)
if [ "$MAJOR" -ge 3 ] && [ "$MINOR" -ge 10 ]; then
PYTHON="$cmd"
break
fi
fi
done
if [ -z "$PYTHON" ]; then
error "Python 3.10+ required. Install from https://python.org"
fi
info "Python: $($PYTHON --version 2>&1)"
# --- Project directory ---
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"
# --- Install Python dependencies ---
info "Installing Python packages..."
$PYTHON -m pip install --upgrade pip -q
$PYTHON -m pip install -r requirements.txt -q
info "Python packages installed"
# --- Install Claude Code skill ---
SKILL_NAME="code-indexer"
if [ "$PLATFORM" = "windows" ]; then
SKILL_DIR="$(cmd.exe /c "echo %USERPROFILE%\\.claude\\skills\\$SKILL_NAME" 2>/dev/null | tr -d '\r')"
else
SKILL_DIR="$HOME/.claude/skills/$SKILL_NAME"
fi
info "Installing Claude Code skill to: $SKILL_DIR"
mkdir -p "$SKILL_DIR"
cp -f ".claude/skills/$SKILL_NAME/SKILL.md" "$SKILL_DIR/SKILL.md" 2>/dev/null || true
cp -f ".claude/skills/$SKILL_NAME/INP.py" "$SKILL_DIR/INP.py" 2>/dev/null || true
info "Skill installed"
# --- IDA Pro check (optional) ---
info "Checking IDA Pro idalib (optional)..."
if $PYTHON -c "import idapro; idapro.get_library_version(); print('idalib available')" 2>/dev/null; then
info "idalib: available"
else
warn "idalib: not found — IDA deep analysis disabled"
warn " To enable: install IDA Pro 9 and set IDA_HOME or install idapro package"
fi
# --- Verify ---
info "Verifying installation..."
if $PYTHON -c "from indexer.models import Symbol; print('OK')" 2>/dev/null; then
info "Core modules: OK"
else
error "Core modules failed to import"
fi
echo ""
info "========================================="
info " code-indexer installed successfully!"
info "========================================="
echo ""
info "Usage:"
info " CLI: python -m indexer.cli <path>"
info " Skill: /code-indexer <path>"
echo ""
info "Tested environments:"
info " Windows 11 + Python 3.13.5"
info " macOS 14 + Python 3.12"
info " Ubuntu 22 + Python 3.10"