🏎️ 🏠 - Extracts essential code structure from large codebases into an AI-digestible format so agents write…
AI Distiller (aid)
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
> **Note:** This is the very first version of this tool. We would be very grateful for any feedback in the form of a discussion or by creating an issue on GitHub. Thank you\!
🚀 **MCP Server Available**: Install the Model Context Protocol server for AI Distiller from NPM: @janreges/ai-distiller-mcp - seamlessly integrate with Claude, Cursor, and other MCP-compatible AI tools!
/.aid/ regardless of where you run aid
- **Cache management**: MCP cache stored in .aid/cache/ for better organization
- **Easy cleanup**: Add .aid/ to .gitignore to keep outputs out of version control
**Detection priority:**
1. **.aidrc file** - Create this empty file to explicitly mark your project root
2. **Language markers** - go.mod, package.json, pyproject.toml, etc.
3. **Version control** - .git directory
4. **Environment variable** - AID_PROJECT_ROOT (fallback if no markers found)
5. **Current directory** - Final fallback with warning
🌍 Language Support
Currently supports 12 languages via tree-sitter:
- **Full Support**: Python, Go, JavaScript, PHP, Ruby
- **Beta**: TypeScript, Java, C#, Rust, Kotlin, Swift, C++
- **Coming Soon**: Zig, Scala, Clojure
Language-Specific Documentation:
- C++ - C++11/14/17/20 support with templates, namespaces, modern features
- C# - Complete C# 12 support with records, nullable reference types, pattern matching
- Go - Full Go support with interfaces, goroutines, generics (1.18+)
- Java - Java 8-21 support with records, sealed classes, pattern matching
- JavaScript - ES6+ support with classes, modules, async/await
- Kotlin - Kotlin 1.x support with coroutines, data classes, sealed classes
- PHP - PHP 7.4+ with PHP 8.x features (attributes, union types, enums)
- Python - Full Python 3.x support with type hints, async/await, decorators
- Ruby - Ruby 2.x/3.x support with blocks, modules, metaprogramming
- Rust - Rust 2018/2021 editions with traits, lifetimes, async
- Swift - Swift 5.x support with protocols, extensions, property wrappers
- TypeScript - TypeScript 4.x/5.x with generics, decorators, type system
🎯 How It Works
1. **Scans** your codebase recursively for supported file types (10+ languages)
2. **Parses** each file using language-specific tree-sitter parsers (all bundled, no dependencies)
3. **Extracts** only what you need: public APIs, type signatures, class hierarchies
4. **Outputs** in your preferred format: compact text, markdown, or structured JSON
All tree-sitter grammars are compiled into the aid binary - zero external dependencies!
🔗 Dependency-Aware Distillation
**Advanced Feature**: AI Distiller includes dependency-aware distillation that analyzes call graphs across files and includes only the code that is actually used from your codebase. This creates focused distillations for deep code analysis by following function/method calls across multiple files.
> 💡 **New to dependency analysis?** This feature traces which functions actually call each other in your code, creating a minimal context that includes only the relevant parts. Perfect for AI tools that need to understand code relationships without processing entire files.
🎯 How Dependency-Aware Analysis Works
Instead of including entire files, dependency-aware distillation:
1. **Identifies entry points** (main functions, exported APIs)
2. **Traces function calls** across file boundaries
3. **Builds call graphs** to understand dependencies
4. **Includes only used code** - functions that are actually called
5. **Filters out unused code** - dead code elimination for AI context
📊 Language Support Quality
We've worked extensively to make dependency-aware distillation as reliable as possible across different programming languages. However, the complexity varies significantly between languages, and we want to be transparent about the current state:
| Language | Support Level | Cross-File Analysis | Intra-File Calls | Performance | Notes |
|----------|---------------|--------------------|--------------------|-------------|-------|
| **Python** | 🟢 **Very Good** | ✅ Full | ✅ Complete | ~37ms | Package imports, all call patterns |
| **JavaScript** | 🟢 **Very Good** | ✅ Full | ✅ Complete | ~38ms | CommonJS & ES6 modules |
| **Go** | 🟢 **Very Good** | ✅ Full | ✅ Complete | ~37ms | Package system integration |
| **Rust** | 🟢 **Very Good** | ✅ Full | ✅ Complete | ~36ms | Crate system, proper filtering |
| **Java** | 🟢 **Very Good** | ✅ Full | ✅ Complete | ~41ms | Package imports, static methods |
| **Swift** | 🟢 **Very Good** | ✅ Full | ✅ Complete | ~37ms | Class and static method detection |