6 releases (breaking)
| 0.5.0 | Jul 13, 2025 |
|---|---|
| 0.4.0 | Jul 13, 2025 |
| 0.3.0 | Jul 12, 2025 |
| 0.2.0 | Jul 11, 2025 |
| 0.1.1 | Jul 11, 2025 |
#687 in Development tools
182 downloads per month
150KB
3.5K
SLoC
code-digest ๐
Transform your entire codebase into a single, well-formatted Markdown file optimized for LLM context windows. Similar to gitingest, but faster and with built-in Gemini CLI integration.
Why code-digest?
Leverage Gemini's massive context window to understand your entire codebase at once. This tool gives AI assistants like Claude Code superpowers by enabling them to:
- ๐๏ธ Plan architectural changes with full visibility of your codebase
- ๐ Answer complex questions about how different parts interact
- ๐ Analyze patterns and suggest improvements across your entire project
- ๐ Make informed decisions when they need the big picture
Simply put: feed your entire repo to Gemini and let Claude Code have intelligent conversations about your code architecture.
๐ Quick Start
Ask Questions About Your Codebase
# Analyze local architecture
code-digest "What are the main architectural patterns used in this codebase?"
# Analyze remote GitHub repository
code-digest --repo https://github.com/owner/repo "How is this project structured?"
# Understand dependencies
code-digest "How does the authentication system interact with the database?"
# Find improvement opportunities
code-digest "How can I implement the new feature X?"
๐ฏ Key Features
- ๐ Blazing Fast: Built in Rust with parallel processing
- ๐ค Gemini Integration: Direct piping to Gemini CLI for instant AI analysis
- ๐ Remote Repository Support: Analyze any GitHub repository directly without cloning
- ๐ Smart Token Management: Accurate token counting using tiktoken
- ๐ฏ Intelligent Prioritization: Automatically prioritizes important files when hitting token limits
- ๐ Git-Aware: Respects
.gitignoreand custom.digestignorepatterns
๐ฆ Installation
Prerequisites
Install code-digest
# Using Cargo
cargo install code-digest
# Or from source
git clone https://github.com/matiasvillaverde/code-digest.git
cd code-digest
cargo install --path .
Install Gemini CLI (optional):
npm install -g @google/gemini-cli
Generate Context Files
# Process current directory
code-digest
# Save to file for later use
code-digest -o context.md
# Process specific directory with token limit
code-digest -d /path/to/project --max-tokens 100000
๐ Configuration
.digestignore
Exclude files from processing:
# Dependencies
node_modules/
target/
vendor/
# Build artifacts
dist/
build/
*.pyc
# Sensitive files
.env
secrets/
.digestkeep
Prioritize important files:
# Core functionality
src/main.*
src/core/**/*.rs
# Important configs
Cargo.toml
package.json
Configuration File (.code-digest.toml)
[defaults]
max_tokens = 150000
progress = true
[[priorities]]
pattern = "src/**/*.rs"
weight = 100
[[priorities]]
pattern = "tests/**/*.rs"
weight = 50
๐ง CLI Reference
code-digest [OPTIONS] [PROMPT]
Arguments:
[PROMPT] The prompt to send to Gemini
Options:
-d, --directory <PATH> Directory to process [default: .]
--repo <URL> GitHub repository URL (e.g., https://github.com/owner/repo)
-o, --output <FILE> Output to file instead of stdout
--max-tokens <N> Maximum tokens for output
-q, --quiet Suppress output except errors
-v, --verbose Enable verbose logging
-c, --config <FILE> Path to config file
--progress Show progress indicators
-h, --help Print help
-V, --version Print version
๐งช Common Use Cases
Architecture Review
code-digest "Create a high-level architecture diagram of this codebase"
Security Audit
code-digest "Identify potential security vulnerabilities in this codebase"
Analyze Remote Projects
# Analyze any public GitHub repository
code-digest --repo https://github.com/rust-lang/rust "How is the compiler structured?"
# Compare architectures
code-digest --repo https://github.com/owner/project "Compare this architecture to best practices"
Documentation Generation
code-digest "Generate comprehensive API documentation for all public functions"
Code Quality Analysis
code-digest "What code smells or anti-patterns exist in this project?"
๐ค Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
Development
# Run tests
make test
# Run all checks
make validate
๐ Troubleshooting
gemini not found
- Ensure Gemini CLI is installed:
pip install gemini-cli - Verify it's in your PATH:
which gemini
Token count exceeded
- Use
--max-tokensto set a limit - Configure file priorities in
.digestkeep - Exclude unnecessary files in
.digestignore
๐ง Roadmap
- Support for more tokenizers (GPT-4, Claude, etc.)
- Custom output templates
- Integration with more LLM CLIs
Made with โค๏ธ and Rust
Dependencies
~19โ38MB
~422K SLoC