0.1.1 • Published 5 months ago

sagasu v0.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

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

  1. Start the vector database (ChromaDB):
docker-compose up -d
  1. 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 for sagasu .)
  • -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 key
  • OPENAI_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 URL
  • SAGASU_VECTOR_STORE_COLLECTION: Collection name for vectors
  • SAGASU_OPENAI_MODEL: OpenAI model to use
  • SAGASU_EMBEDDING_MODEL: Embedding model
  • SAGASU_PORT: API server port
  • SAGASU_HOST: API server host
  • SAGASU_EXCLUDE: Comma-separated patterns to exclude from analysis

Development

The project consists of three main components:

  1. CLI Tool: Handles codebase analysis and server management
  2. API Server: Provides endpoints for code search and chat
  3. Web Interface: User-friendly interface for interacting with the codebase

License

MIT