Skip to main content

A tool to concatenate folders into a single text file, respecting .gitignore and using optional config.

Project description

CI/CD PyPI Python Version License Code style: ruff

CodeConcat v3.0

Logo

The State-of-the-Art tool for preparing codebases for LLM usage.

CodeConcat turns your messy project folders into a single, clean, markdown-formatted file optimized for Large Language Models (LLMs) like Claude, GPT-4, and Gemini. It handles parsing, ignoring, and formatting so you don't have to.

🚀 Key Features

  • 🧙‍♂️ Interactive Wizard: New in v3.0! Just run codeconcat and let the step-by-step wizard guide you.
  • 🌲 ASCII File Tree: Every output starts with a beautiful ASCII representation of your directory structure to give the LLM context.
  • 🧠 Smart Context: Automatically respects .gitignore, skipping node_modules, .git, and binary files.
  • 💎 Granular Control:
    • Force Include: Bypass .gitignore for specific files (like .env or specific build artifacts) using the new "Force Include" logic.
    • Whitelist/Exclude: Powerful glob patterns for fine-tuning.
  • 🛡️ Safe Fencing: Intelligent code block detection prevents nested backticks from breaking your markdown structure.
  • ✨ Beautiful UI: Powered by rich and questionary for a modern, clean terminal experience.

📦 Installation

Ensure you have Python 3.8+ installed.

pip install codeconcat

🛠️ Usage

1. Interactive Wizard (Recommended)

Simply run the command without arguments to start the configuration wizard.

codeconcat

You will be asked:

  1. Source directory?
  2. Output filename?
  3. Respect .gitignore?
  4. Force include specific files? (Grab those .env files or dist/ builds easily!)
  5. Verification & Summary.

2. Command Line Interface (CLI)

For power users or scripts, use the widely compatible CLI.

Concatenate current directory:

codeconcat .

Force Include specific ignored files (New in v3.0): Grab your .env.local even though it's gitignored:

codeconcat --force-include ".env.local"

Exclude logs and include only Python files:

codeconcat . codebase.md -e "*.log" -w "*.py"

Options

Flag Description
-i, --interactive Force the interactive wizard mode.
--force-include Additive: Include these files even if they are in .gitignore.
-e, --exclude subtractive: Exclude files matching this glob pattern.
-w, --whitelist Exclusive: ONLY include files matching this glob pattern.
--no-gitignore Disable .gitignore processing entirely.
--stdout Output to console instead of a file.

📄 Output Format

The output is a single Markdown file structured for maximum LLM comprehension:

  1. Header: Project Name.
  2. File Tree:
    src/
    ├── main.py
    ├── utils.py
    └── config.py
    
  3. Content:
    ### File: `src/main.py`
    
    ```python
    print("Hello World")
    
    
    

🤝 Contributing

Contributions are welcome!

  1. Clone repo: git clone https://github.com/lguibr/codeconcat.git
  2. Install dev setup: pip install -e .
  3. Run tests: pytest

License

MIT License.

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

codeconcat-3.0.0.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codeconcat-3.0.0-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file codeconcat-3.0.0.tar.gz.

File metadata

  • Download URL: codeconcat-3.0.0.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for codeconcat-3.0.0.tar.gz
Algorithm Hash digest
SHA256 b58eb180cffdf4c07f189048c0cfff7db1202363062f640230734e35df04e7c5
MD5 fc5f1f56a2c5f3b0a6e8ccebc907c117
BLAKE2b-256 4ae04567b4263c40d033423a08b43b821f466f8151d0f1ad0026bdf4676a7f76

See more details on using hashes here.

File details

Details for the file codeconcat-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: codeconcat-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 21.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for codeconcat-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bbc53393758613072cdd500b4ef54bc1cf6fc102e4a4729400f2fd5b5b3cff23
MD5 600b545a86d75dcdc715b412103cf147
BLAKE2b-256 ac87291d877ec63111a84fec10cd63013a9fdf023dea58ad4798955e14ce1311

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page