️ Codebase-digest is your AI-friendly codebase packer and analyzer. Features 60+ coding prompts and generates structured overviews with metrics. Ideal for fee
️ Codebase-digest is your AI-friendly codebase packer and analyzer. Features 60+ coding prompts and generates structured overviews with metrics. Ideal for fee
Codebase Digest is a command-line tool written in Python that helps you analyze and understand your codebase. It provides a structured overview of your project's directory structure, file sizes, token counts, and even consolidates the content of all text-based files into a single output for easy analysis with Large Language Models (LLMs).
.gitignore filespip install codebase-digestgit clone https://github.com/kamilstanuch/codebase-digest.git
cd codebase-digest
pip install -r requirements.txtBasic usage:
cdigest [path_to_directory] [options]Examples:
Analyze a project with default settings:
cdigest /path/to/my_projectAnalyze with custom depth and output format:
cdigest /path/to/my_project -d 3 -o markdownIgnore specific files and folders:
cdigest /path/to/my_project --ignore "*.log" "temp_folder" "config.ini"Show file sizes and include git directory:
cdigest /path/to/my_project --show-size --include-gitAnalyze and copy output to clipboard:
cdigest /path/to/my_project --copy-to-clipboard| Option | Description |
|---|---|
path_to_directory |
Path to the directory you want to analyze |
-d, --max-depth |
Maximum depth for directory traversal |
-o, --output-format |
Output format (text, json, markdown, xml, or html). Default: text |
-f, --file |
Output file name |
--show-size |
Show file sizes in directory tree |
--show-ignored |
Show ignored files and directories in tree |
--ignore |
Patterns to ignore (e.g., '*.pyc' '.venv' 'node_modules') |
--keep-defaults |
Keep default ignore patterns when using --ignore |
--no-content |
Exclude file contents from the output |
--include-git |
Include .git directory in the analysis |
--max-size |
Maximum allowed text content size in KB (default: 10240 KB) |
--copy-to-clipboard |
Copy the output to clipboard |
The following patterns are ignored by default:
DEFAULT_IGNORE_PATTERNS = [
'.pyc', '.pyo', '.pyd', 'pycache', # Python
'node_modules', 'bower_components', # JavaScript
'.git', '.svn', '.hg', '.gitignore', # Version control
'venv', '.venv', 'env', # Virtual environments
'.idea', '.vscode', # IDEs
'.log', '.bak', '.swp', '.tmp', # Temporary and log files
'.DS_Store', # macOS
'Thumbs.db', # Windows
'build', 'dist', # Build directories
'.egg-info', # Python egg info
'.so', '.dylib', '.dll' # Compiled libraries
]You can specify additional patterns to ignore using the --ignore option. These patterns will be added to the default ignore patterns unless --no-default-ignores is used.
Patterns can use wildcards (* and ?) and can be:
Example:
cdigest /path/to/my_project --ignore ".txt" "temp" "/path/to/specific/file.py"You can create a .cdigestignore file in your project root to specify project-specific ignore patterns. Each line in this file will be treated as an ignore pattern.
To use only your custom ignore patterns without the default ones, use the --no-default-ignores option:
cdigest /path/to/my_project --no-default-ignores --ignore "custom_pattern" "another_pattern"Codebase Digest includes a comprehensive set of prompts in the prompt_library directory to help you analyze your codebase using Large Language Models. These prompts cover various aspects of code analysis and business alignment:
No open issues yet, or sync has not completed.