# collet
A collection of developer tools for code analysis and agent workflows.
This crate provides a stable, unified API for working with code analysis tools. Currently it provides repository code structure mapping via tree-sitter.
## Features
- 🛠️ Unified API for developer tools
- 📊 Repository code structure analysis (treemap)
- 🔒 Stable, versioned interfaces
- 🚀 Production-ready quality
## Installation
```bash
cargo add collet
```
## Usage
### Repository Analysis
```rust
use collet::{generate_map, Config, Language};
use std::path::Path;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Generate a code map for the current directory
let config = Config::default();
let map = generate_map(Path::new("."), config)?;
// Print information about found files
for file in &map.files {
println!(
"{}: {} lines ({})",
file.path.display(),
file.lines,
file.language.as_deref().unwrap_or("unknown")
);
}
Ok(())
}
```
### Filter by Language
```rust
use collet::{generate_map, Config, Language, OutputFormat};
let config = Config {
format: OutputFormat::Json,
language: Some(Language::Rust),
max_depth: 10,
};
let map = generate_map(Path::new("."), config)?;
```
## Re-exported Types
All common types from submodules are re-exported at the crate root:
- `Config` - Configuration for map generation
- `Language` - Supported programming languages
- `OutputFormat` - Output format options
- `RepoMap` - Generated repository map
- `Symbol` - Code symbols (functions, classes, etc.)
- `SymbolKind` - Categories of code symbols
- `MapError` - Error types
Access submodules directly for more specialized types:
```rust
use collet::treemap;
// Direct access to the treemap module
let map = treemap::generate_map(path, config)?;
```
## Supported Languages
- Rust (`.rs`)
- Python (`.py`)
- JavaScript (`.js`, `.jsx`, `.ts`, `.tsx`)
## License
Apache-2.0