AST-powered code documentation tool for generating optimized llms.txt files from codebases.
ast-doc is a Rust CLI that combines broad file traversal with deep AST-based semantic parsing to create optimized documentation. It uses a four-stage pipeline:
- Ingestion — File discovery, git metadata capture, directory tree generation
- Parser — tree-sitter AST extraction with pre-computed strategy variants
- Scheduler — Token budget optimization with intelligent degradation
- Renderer — Markdown assembly with anti-bloat rules
| Language | Extensions |
|---|---|
| Rust | .rs |
| Python | .py |
| TypeScript/JavaScript | .ts, .tsx, .js, .jsx |
| Go | .go |
| C | .c, .h |
With the lang-pack feature, 50+ additional languages are supported via tree-sitter-language-pack (Java, Ruby, Kotlin, Swift, etc.).
Install this skill for use with AI coding agents:
npx skills add longcipher/ast-doccargo install ast-doccargo install --path bin/ast-doc# Generate llms.txt to stdout
ast-doc .
# Write to a file
ast-doc . --output llms.txt
# Set token budget (default: 128,000)
ast-doc . --max-tokens 64000
# Use summary mode (signatures only)
ast-doc . --strategy summary
# Strip tests
ast-doc . --strategy no-tests
# Protect core files from degradation
ast-doc . --core "src/main.rs" --core "src/lib.rs" --strategy summary
# Filter files
ast-doc . --include "*.rs" --exclude "target/**"
# Skip git context and directory tree
ast-doc . --no-git --no-tree# Install tools
just setup
# Run full CI
just ci
# Individual steps
just lint
just test
just bdd
just build| Feature | Description | Default |
|---|---|---|
lang-rust |
Rust parser | ✓ |
lang-pack |
50+ languages via tree-sitter-language-pack | ✓ |
lang-python |
Python parser | ✗ |
lang-typescript |
TypeScript/JavaScript parser | ✗ |
lang-go |
Go parser | ✗ |
lang-c |
C parser | ✗ |
all-languages |
Enable all language parsers | ✗ |
hotpath |
Profiling instrumentation | ✗ |
- BDD: Gherkin scenarios in
features/*.feature, run withjust bdd - Unit tests: Colocated
#[cfg(test)]modules, run withjust test - Property tests:
proptestin standardcargo testflow
bin/ CLI binary crates
crates/ Reusable library crates
features/ BDD Gherkin scenarios
Apache-2.0