Fold your codebase into a single Markdown file for passing to an LLM.
Project description
foldup
A command-line tool that "folds" your codebase into a single Markdown file that can be easily passed to LLMs.
The output codebase.md file includes:
- Your project tree
- The filepath and contents of each file in the codebase
Here's an example of what the output looks like for a very simple project:
# PROJECT TREE
myproject
├─ .gitignore
├─ README.md
└─ src
├─ main.py
└─ utils.py
# .gitignore
```
node_modules
*.log
```
# README.md
```md
# My Project
Lorem ipsum
```
# src/main.py
```python
def main():
print("Hello, World!")
```
# src/utils.py
```python
def multiply(a, b):
return a * b
```
Installation
- Clone the repository:
git clone https://github.com/nathanclairmonte/foldup.git
cd foldup
- Install as a CLI tool:
pip install .
Now you should be able to run foldup from anywhere in your system! Please let me know if anything doesn't work though.
Usage
# Process current directory
foldup .
# Process specific directory
foldup /path/to/project
Configuration
You can configure Foldup with command-line flags, a config file, or a .foldignore file.
Command-line Flags
| Flag | Description | Default |
|---|---|---|
-v, --version |
Print version | |
-o, --output |
Custom output filename | codebase.md |
-c, --config |
Custom config filename | foldup.yaml |
-sf, --show-files |
Include list of processed files in output | False |
-et, --estimate-tokens |
Estimate token count | False |
-t, --tree-only |
Only generate the project tree | False |
-ms, --max-size |
Maximum file size in MB to process | 2.0 |
Config File (default: foldup.yaml)
Create a foldup.yaml config file in your project root to customize the behavior of Foldup. This example config file shows all the default settings. You can specify a custom config file with the -c flag.
# Default config
exclude:
# common files to exclude
- __pycache__
- node_modules
- .git
- venv
- .venv
- .env
- .env.*
- .idea
- .vscode
- dist
- build
- .next
- coverage
# foldup-related
- codebase.md
max_file_size_mb: 2.0
show_processed_files: false
estimate_tokens: false
tree_only: false
.foldignore File
You can also configure foldup to ignore certain directories or files by creating a .foldignore file in your project root. The syntax is the same as .gitignore.
# Example .foldignore
*.log
temp/
*.pyc
.DS_Store
Estimated Token Count
The estimated token count can be optionally displayed by passing the --estimate-tokens flag. Foldup uses the tiktoken library to estimate token count. Remember that this is just an estimate, the actual token count may vary (but probably not by an insane amount).
N.B. Tiktoken uses the GPT-4 tokenizer. For ChatGPT, it should be relatively close. For Claude, it could be off by ±20%.
Development
These steps require that you have the UV project manager installed.
- Clone the repository:
git clone https://github.com/nathanclairmonte/foldup.git
cd foldup
- Install dependencies:
uv sync
-
Make any changes you want to the code!
-
Run the CLI tool locally:
uv run python -m src.foldup.cli
Project details
Release history Release notifications | RSS feed
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 foldup-0.1.1.tar.gz.
File metadata
- Download URL: foldup-0.1.1.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb3473233a5bca8080fda7aa63c75e96497457b116519e4d1a62bcccf9f22118
|
|
| MD5 |
391bf8dab3fbf55da2914af2453af646
|
|
| BLAKE2b-256 |
eee8c810e5990086df09c17e8d0348fb47667baa6aeed0fbee1266de9c8a791d
|
Provenance
The following attestation bundles were made for foldup-0.1.1.tar.gz:
Publisher:
release.yml on nathanclairmonte/foldup
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
foldup-0.1.1.tar.gz -
Subject digest:
cb3473233a5bca8080fda7aa63c75e96497457b116519e4d1a62bcccf9f22118 - Sigstore transparency entry: 163557521
- Sigstore integration time:
-
Permalink:
nathanclairmonte/foldup@d89dbf59eb9e70134a264e9846a161161784f264 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/nathanclairmonte
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d89dbf59eb9e70134a264e9846a161161784f264 -
Trigger Event:
push
-
Statement type:
File details
Details for the file foldup-0.1.1-py3-none-any.whl.
File metadata
- Download URL: foldup-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d10ebed53eb0f4e07074d66fab57f0cc16c18a1824bbf316476b4f71cf45a06c
|
|
| MD5 |
2150ee94db378baf4f19e1d60c650d44
|
|
| BLAKE2b-256 |
0c00ea5f5ed821d4594cffd3fe255fc877a6b38b4606aa936eb5f07c5c5c0279
|
Provenance
The following attestation bundles were made for foldup-0.1.1-py3-none-any.whl:
Publisher:
release.yml on nathanclairmonte/foldup
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
foldup-0.1.1-py3-none-any.whl -
Subject digest:
d10ebed53eb0f4e07074d66fab57f0cc16c18a1824bbf316476b4f71cf45a06c - Sigstore transparency entry: 163557522
- Sigstore integration time:
-
Permalink:
nathanclairmonte/foldup@d89dbf59eb9e70134a264e9846a161161784f264 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/nathanclairmonte
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d89dbf59eb9e70134a264e9846a161161784f264 -
Trigger Event:
push
-
Statement type: