code-digest 0.5.0

High-performance CLI tool to convert codebases to Markdown for LLM context
Documentation

code-digest ๐Ÿ˜‹

CI License: MIT Rust

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 .gitignore and custom .digestignore patterns

๐Ÿ“ฆ 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-tokens to 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