install-codegraph.sh•5.01 kB
#!/bin/bash
# CodeGraph Universal AI Development Platform - Installation Script
# Revolutionary 11-language semantic analysis with optimized tool descriptions
set -e # Exit on any error
echo "🚀 Installing CodeGraph Universal AI Development Platform..."
echo "📋 Features: 11 languages, 8 essential MCP tools, zero overlap with Claude Code"
echo ""
# Color codes for output
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check if we're on macOS
if [[ "$OSTYPE" != "darwin"* ]]; then
echo -e "${RED}❌ This script is optimized for macOS. For other platforms, adjust the FAISS paths accordingly.${NC}"
exit 1
fi
# Check if Homebrew is installed
if ! command -v brew &> /dev/null; then
echo -e "${RED}❌ Homebrew not found. Please install Homebrew first: https://brew.sh${NC}"
exit 1
fi
# Check if FAISS is installed
if ! brew list faiss &> /dev/null; then
echo -e "${YELLOW}⚠️ FAISS not found. Installing FAISS via Homebrew...${NC}"
brew install faiss
echo -e "${GREEN}✅ FAISS installed successfully${NC}"
else
echo -e "${GREEN}✅ FAISS found${NC}"
fi
# Check if Cargo is available
if ! command -v cargo &> /dev/null; then
echo -e "${RED}❌ Cargo (Rust) not found. Please install Rust: https://rustup.rs${NC}"
exit 1
fi
echo -e "${BLUE}🔧 Building CodeGraph with universal language support...${NC}"
echo "📊 Languages: Rust, Python, JavaScript, TypeScript, Swift, C#, Ruby, PHP, Go, Java, C++"
echo "🛠️ Tools: enhanced_search, semantic_intelligence, impact_analysis, pattern_detection, vector_search, graph_neighbors, graph_traverse, performance_metrics"
echo ""
# Set up environment variables for FAISS linking
export LIBRARY_PATH="/opt/homebrew/opt/faiss/lib:$LIBRARY_PATH"
export LD_LIBRARY_PATH="/opt/homebrew/opt/faiss/lib:$LD_LIBRARY_PATH"
export DYLD_LIBRARY_PATH="/opt/homebrew/opt/faiss/lib:$DYLD_LIBRARY_PATH"
export MACOSX_DEPLOYMENT_TARGET=11.0
echo -e "${BLUE}🔗 Environment configured:${NC}"
echo " LIBRARY_PATH: /opt/homebrew/opt/faiss/lib"
echo " LD_LIBRARY_PATH: /opt/homebrew/opt/faiss/lib"
echo " DYLD_LIBRARY_PATH: /opt/homebrew/opt/faiss/lib"
echo " MACOSX_DEPLOYMENT_TARGET: 11.0"
echo ""
# Install CodeGraph with all revolutionary features
echo -e "${BLUE}🚀 Installing CodeGraph Universal AI Development Platform...${NC}"
echo "⏱️ This may take 5-10 minutes depending on your system..."
echo ""
cargo install --path crates/codegraph-mcp \
--features "embeddings,codegraph-vector/onnx,faiss,embeddings-ollama,qwen-integration" \
--force
if [ $? -eq 0 ]; then
echo ""
echo -e "${GREEN}🎉 SUCCESS! CodeGraph Universal AI Development Platform installed!${NC}"
echo ""
echo -e "${BLUE}📋 What you now have:${NC}"
echo " 🌍 Universal Language Support: 11 programming languages"
echo " 🧠 AI Intelligence Tools: 4 revolutionary analysis tools"
echo " 🔍 Graph Navigation Tools: 3 dependency analysis tools"
echo " 📊 Performance Tools: 1 system monitoring tool"
echo " 🎯 Total: 8 essential tools optimized for coding agents"
echo ""
echo -e "${BLUE}🚀 Quick Start:${NC}"
echo " 1. Navigate to any project directory"
echo " 2. Run: ${GREEN}codegraph init .${NC}"
echo " 3. Run: ${GREEN}codegraph index . --force${NC} (auto-detects all 11 languages)"
echo " ${YELLOW}Note: Use --force to reindex, or specify --languages swift,rust,python,etc${NC}"
echo " 4. Use CodeGraph tools in Claude Code!"
echo ""
echo -e "${YELLOW}💡 Important Indexing Notes:${NC}"
echo " • First time: ${GREEN}codegraph index .${NC} works fine"
echo " • Reindexing: Use ${GREEN}--force${NC} flag to reprocess files"
echo " • Specific languages: ${GREEN}--languages swift,typescript,rust${NC}"
echo " • Auto-detection: Works for all 11 languages when no --languages specified"
echo ""
echo -e "${BLUE}🔗 MCP Configuration:${NC}"
echo " Global config works from any directory - no manual setup needed!"
echo ""
echo -e "${BLUE}📖 Documentation:${NC}"
echo " • CODEGRAPH-MCP-TOOLS-GUIDE.md - Copy to other projects"
echo " • CHANGELOG.md - Complete v1.0.0 release notes"
echo " • README.md - Full platform documentation"
echo ""
echo -e "${GREEN}🌟 Ready to revolutionize AI-assisted development!${NC}"
else
echo ""
echo -e "${RED}❌ Installation failed. Common issues and solutions:${NC}"
echo ""
echo -e "${YELLOW}🔧 If FAISS linking fails:${NC}"
echo " brew reinstall faiss"
echo " brew link faiss"
echo ""
echo -e "${YELLOW}🔧 If Rust compilation fails:${NC}"
echo " rustup update"
echo " cargo clean"
echo ""
echo -e "${YELLOW}🔧 If dependency issues:${NC}"
echo " brew update"
echo " brew upgrade"
echo ""
echo "Please resolve the issue and run this script again."
exit 1
fi