0.1.1 • Published 5 months ago
sagasu v0.1.1
Sagasu
An AI-powered codebase interaction tool that allows you to chat with your codebase using RAG (Retrieval-Augmented Generation) technology.
Prerequisites
- Node.js >= 18.0.0
- Docker and Docker Compose
- OpenAI API Key
Installation
npm install -g sagasu
Setup
- Start the vector database (ChromaDB):
docker-compose up -d
- Set up environment variables:
# Required
export OPENAI_API_KEY="your-openai-api-key"
# Optional
export OPENAI_BASE_URL="your-openai-base-url" # For Azure OpenAI or other OpenAI-compatible APIs
export SAGASU_VECTOR_STORE_TYPE="chroma" # or "qdrant"
export SAGASU_VECTOR_STORE_URL="http://localhost:8000" # ChromaDB server URL
export SAGASU_OPENAI_MODEL="gpt-3.5-turbo"
export SAGASU_PORT="3000" # API server port
export SAGASU_HOST="localhost"
export SAGASU_EXCLUDE="node_modules/**,dist/**,.git/**,**/*.log"
Usage
Quick Start
The fastest way to get started is to run:
cd your-project
sagasu .
This will: 1. Analyze your codebase (scan files, generate embeddings, store vectors) 2. Start the API server 3. Launch the web interface
The web interface will be available at http://localhost:3030
Advanced Usage
Analyze Only
To only analyze the codebase without starting any servers:
sagasu . --no-server
Start Servers Later
To start the servers after analysis:
sagasu serve
Server Options
Both sagasu .
and sagasu serve
support these options:
-p, --port <number>
- Set API server port (default: 3000)-h, --host <string>
- Set API server host (default: localhost)-nw, --no-web
- Don't start the web interface-ns, --no-server
- Don't start any servers (only forsagasu .
)-e, --exclude <patterns>
- Patterns to exclude (comma-separated)
Examples:
# Start with custom API port
sagasu serve -p 3030
# Start API server only
sagasu serve --no-web
# Analyze with custom excludes
sagasu . -e "tests/**,docs/**"
Supported Languages
- JavaScript/TypeScript (.js, .jsx, .ts, .tsx)
- Python (*.py)
- Java (*.java)
- Go (*.go)
- Rust (*.rs)
- C/C++ (.c, .cpp, .h, .hpp)
- C# (*.cs)
- Ruby (*.rb)
- PHP (*.php)
- Swift (*.swift)
- Kotlin (*.kt)
Configuration
You can customize the behavior using environment variables:
OPENAI_API_KEY
: Your OpenAI API keyOPENAI_BASE_URL
: Custom OpenAI API base URL (optional)SAGASU_VECTOR_STORE_TYPE
: Vector store type ("chroma" or "qdrant")SAGASU_VECTOR_STORE_URL
: Vector store server URLSAGASU_VECTOR_STORE_COLLECTION
: Collection name for vectorsSAGASU_OPENAI_MODEL
: OpenAI model to useSAGASU_EMBEDDING_MODEL
: Embedding modelSAGASU_PORT
: API server portSAGASU_HOST
: API server hostSAGASU_EXCLUDE
: Comma-separated patterns to exclude from analysis
Development
The project consists of three main components:
- CLI Tool: Handles codebase analysis and server management
- API Server: Provides endpoints for code search and chat
- Web Interface: User-friendly interface for interacting with the codebase
License
MIT