copyfiles-cli is a small but mighty CLI that scans a project directory, filters out junk via .gitignore
-style rules, and spits out a single copyfiles.txt
containing:
- Project tree – an indented outline of kept files and folders.
- File contents – each retained file wrapped in a language-tagged code fence.
It’s perfect for piping an entire repo into an LLM prompt or sharing a compact “snapshot” of code with teammates.
Feature | What it does |
---|---|
Smart filtering | Honors your project’s .gitignore , plus optional extra ignore file (--config ). |
Size guards & truncation | Skip very large files (--skip-large ) or keep only the first N bytes (--max-bytes ). |
Colorful, pretty CLI | Rich / Colorama styling with automatic NO_COLOR detection. |
Zero-config defaults | Run copyfiles in any repo and get a sane copyfiles.txt instantly. |
# Recommended: inside a virtualenv
pip install copyfiles-cli # from PyPI
# or, for local development
git clone https://github.com/yourname/copyfiles
cd copyfiles
pip install -e '.[dev]' # installs package + test/QA deps
Requires Python 3.8+
# From your project root
copyfiles
# Generates ./copyfiles.txt:
# ├── app.py
# ├── module/
# │ └── __init__.py
# └── README.md
Open copyfiles.txt
in any editor or paste it directly into ChatGPT / Gemini – you’ll see an ASCII tree followed by each file’s contents inside code fences.
Flag | Default | Purpose |
---|---|---|
--root PATH |
. |
Directory to scan. |
--out FILE |
copyfiles.txt |
Output file name/path. |
--config FILE |
none | Extra ignore patterns (one per line, same syntax as .gitignore ). |
--max-bytes N |
100 000 |
Truncate individual files to the first N bytes. |
--skip-large KB |
off | Skip files larger than KB kilobytes entirely. |
-v / --verbose |
off | Show scanning / filtering progress. |
--no-color |
off | Force plain-text output (useful in CI). |
-V / --version |
– | Print version and exit. |
--help |
– | Full help text with examples. |
-
Fork & clone the repo.
-
Create a virtualenv and install dev deps:
python -m venv .venv && source .venv/bin/activate pip install -e '.[dev]'
-
Run the entire QA suite before submitting a PR:
pytest # unit + CLI tests tox -p auto # multi-python matrix + lint ruff check src tests # additional lint if you like
-
Commit using conventional commits (
feat: …
,fix: …
, etc.) and open a pull request – GitHub Actions will run the same tox matrix.
src/copyfiles/ # library & CLI
tests/ # unit and CLI tests + fixtures
README.md
pyproject.toml
tox.ini
MIT – see LICENSE
file for full text.
Made with ☕, 🐍, and a sprinkle of Rich ANSI sparkle.