Intelligently package your codebase for AI tools
Project description
contextzip
Stop copy-pasting files manually. Package exactly the right parts of your codebase and paste it straight into Claude, ChatGPT, or any AI tool in one command.
contextzip
The problem
Every time you want help from an AI tool, you go through the same ritual:
- Find the relevant files in your project
- Skip
node_modules,.next,__pycache__, build artifacts, lock files... - Select the right ones, zip them, find the zip, upload it
- Repeat every single session
contextzip eliminates that entirely. Run it from your project root, it detects your stack, applies smart exclusions, produces a lean ZIP, and opens your file manager with the archive already selected. One Ctrl+C and you're done.
Features
- Smart framework detection : automatically identifies Node.js, Next.js, Python, Django, FastAPI, Rust, Go, Ruby and applies the right exclusion rules for each
- Respects your
.gitignore: patterns from your existing gitignore are honoured automatically - Git-aware packaging : package only modified, staged, unstaged, and untracked files with
--git-changes— perfect for AI review sessions, incremental debugging, and PR workflows - Warns before it's a problem : flags large files (≥ 1 MB) and binary files that AI tools can't read, before you waste an upload
- Handles the messy stuff : dangling symlinks, unreadable files, and files outside the project tree are all caught and reported, never silently dropped
- Full CLI control :
--include,--exclude,--dry-run,--verbose,--output, all composable - Cross-platform clipboard integration : copies the file to clipboard on macOS/Linux; opens Explorer with the ZIP selected on Windows
Installation
Requires Python 3.9+
pip install contextzip
Or with pipx (recommended for CLI tools, keeps it isolated):
pipx install contextzip
Verify the install:
contextzip --version
Quick start
Navigate to any project and run:
cd ~/projects/my-app
contextzip
That's it. contextzip will:
- Detect your framework (e.g.
Next.js + Node.js) - Apply the appropriate exclusion rules
- Scan and summarise what will be included
- Create a compressed ZIP in your system temp directory
- Open your file manager with the ZIP selected and ready to copy
Usage
contextzip [OPTIONS]
| Option | Description |
|---|---|
-i, --include PATH |
Only include files under this path. Repeatable. |
-e, --exclude PATTERN |
Extra exclusion patterns (gitignore syntax). Space-separated or repeatable: -e '*.log' file1 file2 or -e '*.log' -e file1 |
--git-changes |
Only include files reported by git as modified, staged, or untracked. |
-n, --dry-run |
Preview what would be included, no ZIP created. |
-o, --output FILE |
Custom output path for the ZIP file. |
--no-clipboard |
Skip the clipboard / folder-open step. |
--no-gitignore |
Ignore the project's .gitignore file. |
-v, --verbose |
Show every included and excluded file with sizes. |
-h, --help |
Show help and exit. |
--version |
Show version and exit. |
Examples
Preview what would be packaged (no ZIP created):
contextzip --dry-run
Only package specific directories:
contextzip --include src --include app
Exclude additional patterns beyond the auto-rules:
contextzip -e "*.log" "*.sqlite" "tests/"
Only package files changed in git:
contextzip --git-changes
Save ZIP to a specific path:
contextzip --output ~/Desktop/my-project-context.zip
Full verbose audit, see every file decision:
contextzip --dry-run --verbose
Combine include + extra excludes:
contextzip --include src --exclude "**/*.test.ts"
Framework detection & auto-exclusions
contextzip detects your stack from config files in the project root and stacks the appropriate rules.
Detection signals
| File found | Detected as |
|---|---|
next.config.js / .ts / .mjs or "next" in package.json |
Next.js |
package.json |
Node.js |
manage.py or "django" in requirements |
Django |
"fastapi" in requirements |
FastAPI |
requirements.txt / pyproject.toml / setup.py |
Python |
Cargo.toml |
Rust |
go.mod |
Go |
Gemfile |
Ruby |
Detection is additive. A monorepo with both package.json and pyproject.toml will have both rule sets applied.
What gets excluded
Always (every project):
.git/, .env, .env.*, *.log, logs/, .cache/, tmp/, editor files (.vscode/, .idea/), OS files (.DS_Store, Thumbs.db), common binary formats (images, audio, video, archives)
Node.js / Next.js:
node_modules/, .next/, .nuxt/, dist/, build/, out/, .turbo/, package-lock.json, yarn.lock, pnpm-lock.yaml, *.min.js, *.d.ts, tsconfig.tsbuildinfo
Python:
__pycache__/, *.pyc, .venv/, venv/, *.egg-info/, .pytest_cache/, .mypy_cache/, .ruff_cache/, htmlcov/, *.sqlite3, migrations/, poetry.lock, uv.lock
Rust:
target/, Cargo.lock, *.rlib, *.rmeta
Go:
vendor/, go.sum, bin/
Plus any patterns from your project's own .gitignore.
Clipboard behaviour
contextzip uses a tiered strategy so it never just fails silently:
| Platform | Tier 1 (auto) | Tier 2 (fallback) | Tier 3 (last resort) |
|---|---|---|---|
| macOS | File copied to clipboard via Finder, paste directly into browser | open -R reveals ZIP in Finder |
Path printed to terminal |
| Linux | xclip copies file bytes with application/zip MIME type |
xdg-open opens containing folder |
Path printed to terminal |
| Windows | - | explorer /select,"..." opens Explorer with ZIP highlighted → Ctrl+C |
Path printed to terminal |
On macOS and Linux with xclip, you can paste the ZIP directly into an upload zone (Claude, ChatGPT, etc.), no file picker needed. On Windows, Explorer opens with the file already selected so one Ctrl+C is all it takes.
Warnings
contextzip surfaces issues before they waste your time:
Large files (≥ 1 MB) : listed with sizes and a suggestion to exclude if unneeded. AI context windows have limits; a 5 MB log file helps no one.
Binary files : files detected as binary (null bytes in the first 512 bytes) are flagged. Most AI tools can't read binary content; you may want to exclude them.
Skipped files : dangling symlinks, permission-denied files, and paths outside the project tree are listed with their specific reason rather than silently dropped.
Project structure
contextzip/
├── contextzip/
│ ├── __init__.py # version string
│ ├── cli.py # Click entry point, all flags, rich output
│ ├── detector.py # framework/language detection engine
│ ├── filters.py # pathspec-based file filtering + ResolveResult
│ ├── git.py # git status parsing + changed-file detection
│ ├── packager.py # ZIP creation, compression stats, PackageResult
│ ├── clipboard.py # tiered clipboard strategy (all platforms)
│ └── rules/
│ ├── base.py # universal exclusions
│ ├── node.py # Node.js / Next.js / Vite
│ ├── python.py # Python / Django / FastAPI
│ ├── rust.py # Rust / Cargo
│ └── go.py # Go modules
└── pyproject.toml
Adding a new language / framework
- Create
contextzip/rules/yourlang.pywith aPATTERNSlist using gitignore syntax:
PATTERNS = [
"build/",
"*.compiled",
".cache/",
]
- Register it in
filters.py:
_RULE_REGISTRY: dict[str, str] = {
...
"yourlang": "contextzip.rules.yourlang",
}
- Add a detection rule in
detector.py:
_Rule(
name="YourLang",
module="yourlang",
check=lambda p: _file_exists(p, "yourlang.config"),
weight=3,
),
That's it. Detection, filtering, and CLI output all pick it up automatically.
Dependencies
| Package | Purpose |
|---|---|
click |
CLI framework |
rich |
Terminal output, panels, progress bars |
pathspec |
Gitignore-style pattern matching |
No other runtime dependencies. Clipboard and folder-open use only stdlib (subprocess, shutil, platform).
Contributing
Contributions are welcome, especially new framework rule sets, edge case fixes, and platform-specific clipboard improvements.
git clone https://github.com/akadeepesh/contextzip
cd contextzip
pip install -e .
Please open an issue before submitting a large PR so we can discuss the approach first.
License
MIT - see LICENSE for details.
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 contextzip-0.2.1.tar.gz.
File metadata
- Download URL: contextzip-0.2.1.tar.gz
- Upload date:
- Size: 24.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d25eaf95afc9b2311d5ed527f209ab4160379cd8cd0049d6221c018ff068deae
|
|
| MD5 |
b3a1834610ba2b0c51610569bf0e29a9
|
|
| BLAKE2b-256 |
ee8dffe60b1ae3b02a440a86b6ab9ca24aa8e7e9929f35ea7a27003e6e81cf16
|
Provenance
The following attestation bundles were made for contextzip-0.2.1.tar.gz:
Publisher:
python-publish.yml on akadeepesh/smart-context-packager
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
contextzip-0.2.1.tar.gz -
Subject digest:
d25eaf95afc9b2311d5ed527f209ab4160379cd8cd0049d6221c018ff068deae - Sigstore transparency entry: 1550006385
- Sigstore integration time:
-
Permalink:
akadeepesh/smart-context-packager@c3c5166ab083ea98fc94d0542c088ed57cb05936 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/akadeepesh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@c3c5166ab083ea98fc94d0542c088ed57cb05936 -
Trigger Event:
release
-
Statement type:
File details
Details for the file contextzip-0.2.1-py3-none-any.whl.
File metadata
- Download URL: contextzip-0.2.1-py3-none-any.whl
- Upload date:
- Size: 25.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17e5ef8aac987c6f8ffc70aab2479258a7f65fb419cc73b0aeb6274cb9fe906c
|
|
| MD5 |
f703bebb3215345acf2d8e24fce1359e
|
|
| BLAKE2b-256 |
df038c672d0f5fedf8908afa0ecb229fe6a530e106490ebe606fbe1cfcdee2cc
|
Provenance
The following attestation bundles were made for contextzip-0.2.1-py3-none-any.whl:
Publisher:
python-publish.yml on akadeepesh/smart-context-packager
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
contextzip-0.2.1-py3-none-any.whl -
Subject digest:
17e5ef8aac987c6f8ffc70aab2479258a7f65fb419cc73b0aeb6274cb9fe906c - Sigstore transparency entry: 1550006452
- Sigstore integration time:
-
Permalink:
akadeepesh/smart-context-packager@c3c5166ab083ea98fc94d0542c088ed57cb05936 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/akadeepesh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@c3c5166ab083ea98fc94d0542c088ed57cb05936 -
Trigger Event:
release
-
Statement type: