install-codegraph-osx.shโข5.95 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, REVOLUTIONARY AI pattern learning, 85%+ resolution, 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 ""
FEATURE_FLAGS="ai-enhanced,qwen-integration,embeddings,faiss,embeddings-ollama,codegraph-vector/onnx"
INSTALL_DIR="${CODEGRAPH_INSTALL_DIR:-$HOME/.local/bin}"
echo -e "${BLUE}๐ Building CodeGraph Universal AI Development Platform...${NC}"
echo "โฑ๏ธ This may take a few minutes depending on your system..."
echo " Features: ${FEATURE_FLAGS}"
echo ""
cargo build --release \
--package codegraph-mcp \
--bin codegraph \
--features "${FEATURE_FLAGS}" || {
echo ""
echo -e "${RED}โ Build failed. Please review the error log above.${NC}"
exit 1
}
echo -e "${BLUE}๐ฆ Installing binary to ${INSTALL_DIR}${NC}"
mkdir -p "${INSTALL_DIR}"
cp -f "$(pwd)/target/release/codegraph" "${INSTALL_DIR}/codegraph"
chmod +x "${INSTALL_DIR}/codegraph"
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 " ๐ค REVOLUTIONARY AI: Pattern learning, semantic caching, parallel processing with 85%+ resolution rates"
echo " ๐ฏ Total: 8 essential tools + COMPLETE next-generation AI intelligence system"
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 .${NC} (auto-detects all 11 languages)"
echo " 4. Ensure ${INSTALL_DIR} is on your PATH (e.g. export PATH=\"${INSTALL_DIR}:4PATH\")"
echo " 5. Use CodeGraph tools in Claude Code!"
echo ""
echo -e "${BLUE}๐ MCP Configuration:${NC}"
echo " Global config works from any directory - no manual setup needed!"
echo ""
echo -e "${BLUE}๐ค AI Embedding Providers:${NC}"
echo " โข ONNX (default): Fast, local embeddings for quick indexing"
echo " โข Ollama: Advanced code-specialized embeddings for maximum quality"
echo " Set CODEGRAPH_EMBEDDING_PROVIDER=onnx or =ollama"
echo ""
echo -e "${BLUE}โก Performance Configuration:${NC}"
echo " โข High-memory systems: Auto-detected and optimized"
echo " โข Workers: Auto-scaled to CPU cores (customize with --workers N)"
echo " โข Batch size: Auto-optimized for system memory"
echo " โข REVOLUTIONARY AI: Pattern learning, semantic caching, 1000ร re-indexing speed"
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 development with COMPLETE next-generation AI intelligence!${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