A CLI tool to bundle entire projects into a single AI-friendly context file.
Project description
codefile
Pack an entire project directory into one structured text file, ready to paste into any LLM context window. Rebuild the original files back from that same file when you need to.
Installation
Requires Python 3.10 or later.
pip install codefile
What it does
When you run codefile on a project directory, it produces a single .txt file that contains:
- A metadata header (project name, timestamp, file count)
- An ASCII directory tree
- Every text file's content, each wrapped between
FILE_STARTandFILE_ENDmarkers with a SHA-256 fingerprint - Inline markers for binary files, empty files, and symlinks instead of garbage content
Your .gitignore rules are respected. The .git folder is always excluded.
Usage
Pack the current directory:
codefile
Pack a specific directory:
codefile /path/to/project
Write to a custom output path:
codefile /path/to/project -o context.txt
Rebuild a project from a pack file:
codefile --build
Rebuild from a custom-named pack file:
codefile --build -o context.txt
Options
| Argument | Description |
|---|---|
directory |
Directory to pack. Defaults to the current directory. Ignored when using --build. |
-o, --output |
Pack mode: where to write the output file. Build mode: which pack file to read from. |
-b, --build |
Rebuild project files from a pack file instead of creating one. |
-h, --help |
Show help and exit. |
Output format
ROOT_NAME myproject
CREATED_UTC 2026-03-21T12:00:00Z
TOTAL_SOURCE_MB 0.42
FILE_COUNT 18
START_STRUCTURE
myproject/
|-- src/
| |-- main.py
| \-- utils.py
\-- README.md
END_STRUCTURE
FILE_START src/main.py a3f9c12b8e01
def main():
print("hello")
FILE_END src/main.py a3f9c12b8e01
Binary files, empty files, and symlinks appear as:
FILE_START assets/logo.png d7e2b45f9c33
BINARY_CONTENT
FILE_END assets/logo.png d7e2b45f9c33
.gitignore support
codefile parses your .gitignore properly. The following pattern types all work:
- Glob patterns:
*.log,*.pyc - Directory rules:
build/,dist/ - Root-anchored rules:
/.env - Deep globs:
**/*.min.js - Negation:
!important.log
Ignored directories are pruned immediately during the walk, so large folders like node_modules/ are never descended into.
License
Apache-2.0
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 codefile-26.0.2.tar.gz.
File metadata
- Download URL: codefile-26.0.2.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a85e9ec9b76a1059d7eed1007b0247768344687a1ec549a40c17a9c2ae244af3
|
|
| MD5 |
e2ebe77325e23eed0f48d89767d79741
|
|
| BLAKE2b-256 |
7fefc57db321228a78599678ed3b5472ca059b47e2fafee1a6b823a3e2533168
|
Provenance
The following attestation bundles were made for codefile-26.0.2.tar.gz:
Publisher:
python-publish.yml on sapirrior/codefile
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codefile-26.0.2.tar.gz -
Subject digest:
a85e9ec9b76a1059d7eed1007b0247768344687a1ec549a40c17a9c2ae244af3 - Sigstore transparency entry: 1154472552
- Sigstore integration time:
-
Permalink:
sapirrior/codefile@900613edcce9340ccf345401ed48b140b789283b -
Branch / Tag:
refs/tags/v26.0.2 - Owner: https://github.com/sapirrior
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@900613edcce9340ccf345401ed48b140b789283b -
Trigger Event:
release
-
Statement type:
File details
Details for the file codefile-26.0.2-py3-none-any.whl.
File metadata
- Download URL: codefile-26.0.2-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62d86f8bc624c36cf62f6a9d2c0116e5c1c1252cc45524eee3ea6ca1670dac93
|
|
| MD5 |
602087ae34e553a18ac0153e562b3453
|
|
| BLAKE2b-256 |
b869029c58c33ec25db493748038834bde1934b6962bf62b6a87d3ab2e6b20cc
|
Provenance
The following attestation bundles were made for codefile-26.0.2-py3-none-any.whl:
Publisher:
python-publish.yml on sapirrior/codefile
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codefile-26.0.2-py3-none-any.whl -
Subject digest:
62d86f8bc624c36cf62f6a9d2c0116e5c1c1252cc45524eee3ea6ca1670dac93 - Sigstore transparency entry: 1154472553
- Sigstore integration time:
-
Permalink:
sapirrior/codefile@900613edcce9340ccf345401ed48b140b789283b -
Branch / Tag:
refs/tags/v26.0.2 - Owner: https://github.com/sapirrior
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@900613edcce9340ccf345401ed48b140b789283b -
Trigger Event:
release
-
Statement type: