Codebase Batcher (cbatch) - CLI tool to output codebase to structured file for AI context.
Project description
Codebatcher (cbatch)
A CLI tool that formats your codebase into a structured markdown file, making it easier to provide context to AI tools like ChatGPT or Claude.
Features
- 📝 Converts your entire codebase into a single, well-structured markdown file
- 🎯 Intelligent file filtering with
.cbatchignoresupport - ⚙️ Configurable project metadata through
cbatch.ini - 📊 Token estimation for AI context windows
- 🚀 Simple and intuitive CLI interface
Installation
Install codebatcher using pip:
pip install codebatcher
Quick Start
- Navigate to your project directory:
cd your-project
- Initialize cbatch configuration:
cbatch init
- Generate the structured codebase file:
cbatch update
Commands
cbatch init- Initialize configuration and create default ignore patternscbatch update [path] [output-file]- Update/create the structured codebase filecbatch tokens- Display estimated token count for the generated file
Configuration
cbatch.ini
During initialization (cbatch init), you can configure:
- Codebase Type (e.g., FastAPI backend, React frontend)
- Deployment Location
- General Description
- Execution Command
Example cbatch.ini:
[General]
codebase_type = FastAPI backend
deployment_location = AWS
general_description = REST API for user management
execution_command = uvicorn main:app --reload
[Summary]
input_token_estimate = 12345
.cbatchignore
Similar to .gitignore, specify patterns for files and directories to exclude. Default patterns include:
- Common version control files (
.git/,.gitignore) - Build artifacts (
*.pyc,build/,dist/) - Environment files (
.env,venv/) - Dependencies (
node_modules/) - System files (
.DS_Store) - Temporary files (
*.swp,temp/,tmp/) - Log files (
*.log)
Add custom patterns by editing .cbatchignore:
# Custom ignore patterns
secrets/
*.config.js
private/*
Output Format
The generated markdown file (codebatch.md by default) includes:
- Instructions section
- General project information
- Structured listing of all codebase files with their contents
Example structure:
# Instructions #
This file represents the entire codebase...
## General Info ##
**Codebase Type**: FastAPI backend
**Deployment Location**: AWS
...
## Files ##
### `src/main.py` ###
```python
# File contents here
## Use Cases
- Providing context to AI tools about your entire codebase
- Generating documentation overviews
- Sharing code context with team members
- Creating structured backups of your source code
## Token Estimation
The tool provides a simple word-count based token estimation to help you stay within AI context windows. Check the current estimate using:
```bash
cbatch tokens
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
Author
Zach (zh93@nau.edu)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file codebatcher-0.1.4.tar.gz.
File metadata
- Download URL: codebatcher-0.1.4.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.13.1 Linux/6.12.10-200.fc41.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec8cb9b101ad25a781932fbd9ac6b6e0c9580e53e621080355049a5c89227e14
|
|
| MD5 |
80797200b52809539e664482cec92703
|
|
| BLAKE2b-256 |
11164253d063c12ab5a07521da11d8a378083150a3ec7ee24616906b6fdbe9e4
|
File details
Details for the file codebatcher-0.1.4-py3-none-any.whl.
File metadata
- Download URL: codebatcher-0.1.4-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.13.1 Linux/6.12.10-200.fc41.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb5616d742c07734530937a08f935a0521779e63ac9d34ed22b8bff8b826bb0b
|
|
| MD5 |
e56e79727868b490fc078a94ae5034c2
|
|
| BLAKE2b-256 |
49c2c4246a675dfbb8adc849d37958623b65020ec6f79fd6c9c091a5022d7d2d
|