# codepilot

Lightweight codebase index for AI agent navigation. Uses tree-sitter for AST parsing and SQLite for fast queries.

## Install

```bash
npm install codepilot
```

## Usage

```bash
# Index a project
codepilot index [path]

# Project overview (languages, structure, key exports)
codepilot map [path]

# Find a symbol by name (FTS5 prefix search)
codepilot find-symbol <name> [--kind function|class|variable|...]

# Find all files importing a symbol
codepilot find-usages <name>

# List symbols in a file with signatures
codepilot file-overview <path>

# Two-way import graph for a file
codepilot related-files <path>

# Multi-channel search (symbols, paths, imports)
codepilot navigate <query>

# Find exported symbols never imported
codepilot dead-code

# Show what breaks if a symbol changes
codepilot change-impact <symbol>

# Rank files by import frequency
codepilot context-budget

# List all exported symbols by file
codepilot api-surface

# Find circular import chains
codepilot circular-deps

# Health check (SQLite, grammars, index freshness)
codepilot doctor

# Incremental single-file reindex
codepilot index-file <path>
```

## Supported Languages

**Native (fast):** TypeScript, TSX, JavaScript, JSX, Python

**WASM fallback:** Go, Rust, Java, Kotlin, Ruby, C#, PHP, Swift, C, C++, Bash

## Database

Index is stored at `$PROJECT_ROOT/.codeindex/db.sqlite` using SQLite with WAL mode and FTS5 for fast symbol search.

## Environment Variables

- `CODEBASE_PILOT_PROJECT_ROOT` - Override project root detection (defaults to git root or cwd)

## License

MIT
