contextzip 0.4.6__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. contextzip-0.5.0/PKG-INFO +420 -0
  2. contextzip-0.5.0/README.md +391 -0
  3. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/__init__.py +1 -1
  4. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/api.py +39 -20
  5. contextzip-0.5.0/contextzip/applier.py +1357 -0
  6. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/cleanup.py +16 -1
  7. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/cli.py +388 -44
  8. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/cli_ai.py +2 -2
  9. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/cli_display.py +157 -50
  10. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/config.py +28 -0
  11. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/detector.py +12 -1
  12. contextzip-0.5.0/contextzip/editor.py +124 -0
  13. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/error_parser.py +54 -12
  14. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/filters.py +89 -13
  15. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/git.py +102 -36
  16. contextzip-0.5.0/contextzip/guide.py +134 -0
  17. contextzip-0.5.0/contextzip/merge3.py +149 -0
  18. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/packager.py +120 -37
  19. contextzip-0.5.0/contextzip/pathmatch.py +265 -0
  20. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/project_config.py +57 -5
  21. contextzip-0.5.0/contextzip/redact.py +336 -0
  22. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/report.py +68 -5
  23. contextzip-0.5.0/contextzip/root.py +331 -0
  24. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/rules/base.py +37 -27
  25. contextzip-0.5.0/contextzip/snapshots.py +259 -0
  26. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/watcher.py +19 -3
  27. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/webui/assets.py +17 -2
  28. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/webui/persist.py +3 -0
  29. contextzip-0.5.0/contextzip/webui/review.py +360 -0
  30. contextzip-0.5.0/contextzip/webui/review_assets.py +407 -0
  31. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/webui/server.py +7 -0
  32. contextzip-0.5.0/contextzip/workspaces.py +138 -0
  33. contextzip-0.5.0/contextzip.egg-info/PKG-INFO +420 -0
  34. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip.egg-info/SOURCES.txt +9 -0
  35. {contextzip-0.4.6 → contextzip-0.5.0}/pyproject.toml +1 -1
  36. contextzip-0.4.6/PKG-INFO +0 -104
  37. contextzip-0.4.6/README.md +0 -75
  38. contextzip-0.4.6/contextzip/applier.py +0 -808
  39. contextzip-0.4.6/contextzip/redact.py +0 -175
  40. contextzip-0.4.6/contextzip.egg-info/PKG-INFO +0 -104
  41. {contextzip-0.4.6 → contextzip-0.5.0}/LICENSE +0 -0
  42. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/_x11_clip.py +0 -0
  43. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/ai/__init__.py +0 -0
  44. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/ai/gemini.py +0 -0
  45. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/ai/heuristic.py +0 -0
  46. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/ai/selector.py +0 -0
  47. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/cli_onboard.py +0 -0
  48. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/clipboard.py +0 -0
  49. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/rules/__init__.py +0 -0
  50. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/rules/errors/__init__.py +0 -0
  51. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/rules/errors/node.py +0 -0
  52. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/rules/errors/python.py +0 -0
  53. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/rules/go.py +0 -0
  54. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/rules/node.py +0 -0
  55. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/rules/python.py +0 -0
  56. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/rules/ruby.py +0 -0
  57. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/rules/rust.py +0 -0
  58. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/updater.py +0 -0
  59. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/webui/__init__.py +0 -0
  60. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip/webui/suggestions.py +0 -0
  61. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip.egg-info/dependency_links.txt +0 -0
  62. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip.egg-info/entry_points.txt +0 -0
  63. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip.egg-info/requires.txt +0 -0
  64. {contextzip-0.4.6 → contextzip-0.5.0}/contextzip.egg-info/top_level.txt +0 -0
  65. {contextzip-0.4.6 → contextzip-0.5.0}/setup.cfg +0 -0
@@ -0,0 +1,420 @@
1
+ Metadata-Version: 2.4
2
+ Name: contextzip
3
+ Version: 0.5.0
4
+ Summary: Intelligently package your codebase for AI tools
5
+ Author-email: Deepesh <akadeepesh@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/akadeepesh/contextzip
8
+ Project-URL: Repository, https://github.com/akadeepesh/contextzip
9
+ Project-URL: Issues, https://github.com/akadeepesh/contextzip/issues
10
+ Keywords: ai,cli,developer-tools,context,zip,llm,claude,chatgpt,code-packaging
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Software Development :: Build Tools
20
+ Classifier: Topic :: Utilities
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: click>=8.1
25
+ Requires-Dist: rich>=13.0
26
+ Requires-Dist: pathspec>=0.12
27
+ Requires-Dist: httpx>=0.27
28
+ Dynamic: license-file
29
+
30
+ <div align="center">
31
+
32
+ # contextzip
33
+
34
+ **Package exactly the right parts of your codebase for any AI tool, in one command.**
35
+
36
+ [![PyPI](https://img.shields.io/pypi/v/contextzip?color=blue)](https://pypi.org/project/contextzip/)
37
+ [![Python](https://img.shields.io/pypi/pyversions/contextzip)](https://pypi.org/project/contextzip/)
38
+ [![Downloads](https://static.pepy.tech/badge/contextzip/month)](https://pepy.tech/project/contextzip)
39
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/akadeepesh/contextzip/blob/main/LICENSE)
40
+
41
+ [Documentation](https://contextzip.vercel.app) ·
42
+ [CLI reference](https://github.com/akadeepesh/contextzip/blob/main/CLI.md) ·
43
+ [Changelog](https://github.com/akadeepesh/contextzip/blob/main/CHANGELOG.md) ·
44
+ [Report a bug](https://github.com/akadeepesh/contextzip/issues/new/choose)
45
+
46
+ </div>
47
+
48
+ https://github.com/user-attachments/assets/91913ad6-6161-430d-9075-b0fa76498021
49
+
50
+ ---
51
+
52
+ ## Why contextzip?
53
+
54
+ Every AI coding session starts the same way. You hunt down the relevant files, skip `node_modules` and build output by hand, zip it all, find the zip and upload it. Next session, you do it again.
55
+
56
+ contextzip does all of that for you. Run it from your project root and it:
57
+
58
+ 1. **Detects your stack** (Node.js, Next.js, Python, Django, FastAPI, Rust, Go, Ruby, monorepos included).
59
+ 2. **Excludes the noise**: dependencies, build output, caches, binaries, logs, and anything in your `.gitignore`.
60
+ 3. **Keeps secrets out**: `.env` files, private keys, cloud credentials and Terraform state are left out by default. If you include your `.env` on purpose, its values are redacted.
61
+ 4. **Puts the ZIP on your clipboard** as a real file, so you can paste it straight into Claude, ChatGPT, Gemini or any other upload box.
62
+
63
+ When the AI sends changed files back, `contextzip apply-zip` writes them into your project safely, and warns you before touching anything you've edited since.
64
+
65
+ ## Table of contents
66
+
67
+ - [Installation](#installation)
68
+ - [Quick start](#quick-start)
69
+ - [Features](#features)
70
+ - [Smart packaging](#smart-packaging)
71
+ - [Package only what changed](#package-only-what-changed)
72
+ - [AI-powered file selection](#ai-powered-file-selection)
73
+ - [Applying AI changes back](#applying-ai-changes-back)
74
+ - [Terminal error watcher](#terminal-error-watcher)
75
+ - [Visual config UI](#visual-config-ui)
76
+ - [Command reference](#command-reference)
77
+ - [Configuration](#configuration)
78
+ - [What is always excluded](#what-is-always-excluded)
79
+ - [Where files go](#where-files-go)
80
+ - [Python API](#python-api)
81
+ - [Privacy & security](#privacy--security)
82
+ - [Platform support](#platform-support)
83
+ - [Contributing](#contributing)
84
+ - [License](#license)
85
+
86
+ ## Installation
87
+
88
+ contextzip needs **Python 3.9 or newer**.
89
+
90
+ ```bash
91
+ pip install contextzip
92
+ ```
93
+
94
+ Installing with [pipx](https://pipx.pypa.io/) or [uv](https://docs.astral.sh/uv/) keeps it isolated from your projects:
95
+
96
+ ```bash
97
+ pipx install contextzip
98
+ # or
99
+ uv tool install contextzip
100
+ ```
101
+
102
+ This installs two commands that do the same thing: `contextzip` and the shorter `cz`.
103
+
104
+ To update later, run `contextzip update`. It works out whether you installed with pip, pipx or uv and upgrades the right one.
105
+
106
+ ## Quick start
107
+
108
+ ```bash
109
+ cd ~/projects/my-app
110
+ contextzip
111
+ ```
112
+
113
+ You don't need any flags. contextzip detects your framework, excludes the noise, writes `codebase.zip` into `.contextzip/output/codebase/` and copies it to your clipboard. Paste it into your AI tool.
114
+
115
+ Some other common runs:
116
+
117
+ ```bash
118
+ contextzip --dry-run --verbose # preview every included/excluded file, write nothing
119
+ contextzip --git-changes # only what you've changed
120
+ contextzip --prompt "fix the login redirect bug" # let AI pick the relevant files
121
+ contextzip include src/ app/ # only these folders
122
+ contextzip include src/ .env # .env too, values redacted
123
+ contextzip --here # only the folder you're in (monorepos)
124
+ contextzip exclude tests/ '*.snap' # everything except these
125
+ contextzip apply-zip # write the AI's changes back
126
+ ```
127
+
128
+ ## Features
129
+
130
+ ### Smart packaging
131
+
132
+ contextzip scans your project and recognises its stack from marker files such as `package.json`, `next.config.*`, `pyproject.toml`, `manage.py`, `Cargo.toml`, `go.mod` and `Gemfile`. It looks a couple of levels deep, so a monorepo with a Next.js frontend and a FastAPI backend gets **both** rule sets applied.
133
+
134
+ | Ecosystem | Examples of what's excluded |
135
+ |---|---|
136
+ | **Node.js / Next.js** | `node_modules/`, `.next/`, `dist/`, `build/`, `coverage/`, lockfiles, `*.min.js` |
137
+ | **Python / Django / FastAPI** | `__pycache__/`, `.venv/`, `*.pyc`, `.pytest_cache/`, `*.egg-info/` |
138
+ | **Rust** | `target/`, `Cargo.lock`, `*.rlib` |
139
+ | **Go** | `vendor/`, `bin/`, `go.sum` |
140
+ | **Ruby / Rails** | `vendor/bundle/`, `tmp/`, `log/`, `storage/`, built gems |
141
+
142
+ On top of the stack rules, contextzip also:
143
+
144
+ - respects your `.gitignore` (turn this off with `--no-gitignore`),
145
+ - flags large files (1 MB or more by default) and binary files before packaging,
146
+ - skips dangling symlinks and unreadable files, and tells you why,
147
+ - writes a plain-text report next to every ZIP listing what went in and what was left out.
148
+
149
+ ### Package only what changed
150
+
151
+ ```bash
152
+ contextzip --git-changes
153
+ ```
154
+
155
+ This packages only the files git reports as **staged, modified or untracked**. It's ideal for code review or "here's what I changed, what's wrong?" prompts. Deleted files, submodules and monorepo roots are handled for you, and the secret-exclusion rules still apply to files git tracks.
156
+
157
+ ### AI-powered file selection
158
+
159
+ ```bash
160
+ contextzip --prompt "add rate limiting to the login endpoint"
161
+ ```
162
+
163
+ Describe your task in plain language and [Gemini](https://ai.google.dev/) picks only the files that matter. The ZIP also includes a `prompt.txt` describing the task, so the AI tool you paste it into knows what you want.
164
+
165
+ - **Setup:** you need a free Gemini API key. contextzip walks you through it the first time you use `--prompt`, or you can set the `GEMINI_API_KEY` environment variable.
166
+ - **What is sent:** only the list of file **paths and sizes** that already passed the exclusion rules, plus your prompt. File contents never leave your machine.
167
+ - **Fallback:** if Gemini is rate-limited, a local keyword-based selector takes over, so `--prompt` keeps working. Other errors (a bad key, no network) stop with a clear message.
168
+ - **Model:** `gemini-2.5-flash-lite` by default.
169
+
170
+ ### Applying AI changes back
171
+
172
+ ```bash
173
+ contextzip apply-zip # picks up a ZIP from .contextzip/inbox/
174
+ contextzip apply-zip fix.zip # or point at one directly
175
+ contextzip apply-zip --dry-run # preview without writing anything
176
+ ```
177
+
178
+ AI tools return ZIPs in every shape: wrapped in an extra folder, relative to a subfolder, flattened, with Windows separators. `apply-zip` matches each file to its real place in your project anyway, and new files follow their siblings.
179
+
180
+ Every ZIP contextzip makes gets a **local snapshot** (a hash of each file, never uploaded). `apply-zip` picks the snapshot that best matches the returned ZIP and compares three versions of each file: what you sent, what's on disk now, and what came back.
181
+
182
+ | Status | Meaning | Default |
183
+ |---|---|---|
184
+ | **New** / **Modified** | New file, or only the AI changed it | Written |
185
+ | **Merged** | You both changed it, in different places | Written (three-way merge) |
186
+ | **Unchanged** | Already matches — including changes you already applied | Skipped |
187
+ | **Conflict** | You both changed the same lines | Needs your call |
188
+ | **Partial** | The AI returned a cut-down file (`// ... rest unchanged`) | Needs your call |
189
+ | **Moved** | The AI moved or renamed it | Written at the new path; the old file is kept unless you say otherwise |
190
+ | **Drifted** / **Deleted** / **Untracked** / **Ambiguous** / **Delete requested** | Can't be applied safely without you | Needs your call |
191
+
192
+ When something needs a decision you choose: apply the safe changes now, **review side by side in your browser** (`--review`), **resolve in VS Code's merge editor** (`--editor`), or apply everything. Line endings never count as a change, redacted secrets are never overwritten with placeholders, and **files are only removed with your explicit OK** — never one you've changed since.
193
+
194
+ ### Snapshots and CONTEXTZIP.md
195
+
196
+ Every package is kept locally as a numbered **snapshot** (`#14`), so a reply can be merged against exactly what you sent, even after you've packaged again. Each ZIP also carries a short **`CONTEXTZIP.md`** for the AI: the snapshot ID, and how to reply so the answer applies cleanly (complete files, same paths, secrets left as `[REDACTED]`, moves and deletions listed). When the reply echoes it back, `apply-zip` knows the exact snapshot. `contextzip snapshots` lists them; turn the file off with `"zip_guide": false`.
197
+
198
+ ### Terminal error watcher
199
+
200
+ ```bash
201
+ contextzip watch -- npm run dev
202
+ contextzip watch -- python manage.py runserver
203
+ contextzip watch -- python -m pytest --tb=short
204
+ ```
205
+
206
+ contextzip runs your command and watches its output. When a stack trace appears (Python, Django and Node.js/Next.js errors are recognised), it asks whether to package debug context. Press `D` and you get `debug-context.zip` containing:
207
+
208
+ - `prompt.txt`: an auto-generated description of the problem
209
+ - `terminal-error.txt`: the error output with ANSI codes and noise stripped out
210
+ - `source-files.zip`: the source files named in the stack trace
211
+
212
+ If you press Ctrl+C before packaging anything, you get one last chance to capture the whole session.
213
+
214
+ ### Visual config UI
215
+
216
+ ```bash
217
+ contextzip config --ui
218
+ ```
219
+
220
+ This opens a local browser tab where you can tick files and folders to always include or exclude, with a live preview of what the ZIP will contain. It saves to `.contextzip/config.json`. The server binds to `127.0.0.1` only, needs a random one-time session token and shuts itself down when you're done.
221
+
222
+ ## Command reference
223
+
224
+ | Command | What it does |
225
+ |---|---|
226
+ | `contextzip` | Detect the stack, exclude noise and package the project |
227
+ | `contextzip include PATH…` | Package **only** these paths |
228
+ | `contextzip exclude PATTERN…` | Package everything **except** these patterns |
229
+ | `contextzip --prompt "task"` | Let Gemini pick only the files relevant to a task |
230
+ | `contextzip --git-changes` | Package only modified, staged and untracked files |
231
+ | `contextzip apply-zip [ZIP]` | Write an AI-returned ZIP back into your project, safely |
232
+ | `contextzip watch -- COMMAND` | Run a command and package debug context when an error appears |
233
+ | `contextzip config …` | Gemini key, workspace location and the visual config UI |
234
+ | `contextzip update` | Check PyPI for a newer release and update in place |
235
+
236
+ **Run flags** work on `contextzip`, `include` and `exclude`:
237
+
238
+ | Flag | Short | Description |
239
+ |---|---|---|
240
+ | `--include PATH` | `-i` | Only include files under these paths. Naming an excluded path (like `.env`) brings it back. Repeatable. |
241
+ | `--exclude PATTERN` | `-e` | Extra exclusion patterns (gitignore syntax). Repeatable. |
242
+ | `--prompt TEXT` | `-p` | Let Gemini select files relevant to this task. |
243
+ | `--git-changes` | | Only include files git reports as changed. |
244
+ | `--dry-run` | `-n` | Show what would be included without creating the ZIP. |
245
+ | `--output FILE` | `-o` | Write the ZIP to this exact path. |
246
+ | `--no-clipboard` | | Don't copy the ZIP to the clipboard. |
247
+ | `--no-gitignore` | | Ignore `.gitignore` and use only the built-in rules. |
248
+ | `--verbose` | `-v` | List every included and excluded file. |
249
+
250
+ Every command supports `-h` / `--help`, and `contextzip --version` prints the installed version.
251
+
252
+ For every flag of every subcommand (`apply-zip`, `watch`, `config`, `update`), see **[CLI.md](https://github.com/akadeepesh/contextzip/blob/main/CLI.md)** or the [online CLI reference](https://contextzip.vercel.app/cli).
253
+
254
+ ## Configuration
255
+
256
+ contextzip has two config files, and both are optional.
257
+
258
+ ### Project config: `.contextzip/config.json`
259
+
260
+ This holds per-project settings. Edit it by hand or with `contextzip config --ui`. Every key is optional:
261
+
262
+ ```jsonc
263
+ {
264
+ "always_include": ["docs/architecture.md"], // force-include, even if a rule or .gitignore excludes it
265
+ "always_exclude": ["*.snap", "fixtures/"], // a standing --exclude on every run
266
+ "workspace_location": "git-root", // "git-root" | "cwd" | "/some/path"
267
+ "ai": {
268
+ "enabled": true,
269
+ "max_files": 10, // cap on files the AI may select
270
+ "prompt_template": "We use pytest, not unittest." // prepended to every prompt.txt
271
+ },
272
+ "limits": {
273
+ "max_file_size_mb": 1, // threshold for "large file" warnings
274
+ "redact_secrets": false // scan included files and mask secret-looking values
275
+ },
276
+ "applied_zip_retention": 1, // past apply-zip archives to keep
277
+ "cleanup": { "enabled": true, "keep_recent": 1 },
278
+ "snapshots": { "keep": 10, "max_age_days": 14 }, // history apply-zip merges against
279
+ "zip_guide": true, // add CONTEXTZIP.md to every ZIP
280
+ "webui": { "auto_open": true, "port": null }
281
+ }
282
+ ```
283
+
284
+ `.contextzip/` is fully gitignored by default. If your team wants to share these settings, commit the file explicitly with `git add -f .contextzip/config.json`.
285
+
286
+ ### Personal config
287
+
288
+ Your Gemini API key and personal defaults live outside the project, so they're never committed:
289
+
290
+ | OS | Location |
291
+ |---|---|
292
+ | Linux / macOS | `~/.config/contextzip/config.json` (or `$XDG_CONFIG_HOME/contextzip/`) |
293
+ | Windows | `%APPDATA%\contextzip\config.json` |
294
+
295
+ ```bash
296
+ contextzip config # show the current configuration
297
+ contextzip config --reset-key # clear the Gemini key and set it up again
298
+ contextzip config --set-workspace cwd # put .contextzip/ in the current directory
299
+ contextzip config --show-key-path # print the config file location
300
+ ```
301
+
302
+ The full option-by-option guide is at [contextzip.vercel.app/configuration](https://contextzip.vercel.app/configuration).
303
+
304
+ ## What is always excluded
305
+
306
+ These patterns apply to **every** project, whatever its stack or `.gitignore` says, and in `--git-changes` mode too:
307
+
308
+ - **Secrets & credentials:** `.env`, `.env.*`, `*.pem`, `*.key`, `*.p12`, `*.pfx`, `*.jks`, `*.keystore`, `*.ppk`, SSH private keys (`id_rsa`, `id_ed25519`, …), `.npmrc`, `.netrc`, `.pypirc`, `.pgpass`, Docker auth config, `.aws/credentials`, service-account and `*credentials*.json` files, kubeconfigs
309
+ - **Infrastructure state:** `*.tfstate`, `.terraform/`
310
+ - **Version control & editors:** `.git/`, `.svn/`, `.hg/`, `.vscode/`, `.idea/`, swap files, `.DS_Store`
311
+ - **Logs, caches & temp files:** `*.log`, `logs/`, `.cache/`, `tmp/`, `*.tmp`, `*.bak`
312
+ - **Binaries & media:** executables, shared libraries, images, video, audio and archives
313
+ - **Project boilerplate:** `CHANGELOG`, `LICENSE`, `CONTRIBUTING`, `SECURITY.md`, `CODE_OF_CONDUCT.md`, GitHub issue/PR templates
314
+
315
+ To bring one back, name it explicitly with `contextzip include .env`, list it under `always_include` in the project config, or tick it in `contextzip config --ui`. `--exclude` and `.gitignore` can't bring them back, and naming a folder like `src/` doesn't pull in the secret files inside it.
316
+
317
+ **Secret files you include on purpose are always redacted.** If you include your `.env` so the AI can see which variables your app expects, every key and comment is kept but every value becomes `[REDACTED]`:
318
+
319
+ ```bash
320
+ # .env on disk # .env in the ZIP
321
+ DATABASE_URL=postgres://u:pw@db/app DATABASE_URL=[REDACTED]
322
+ export API_KEY="sk-live-…" # prod export API_KEY="[REDACTED]" # prod
323
+ ```
324
+
325
+ Other secret files (private keys, credential files) get a secret-pattern scan. Binary ones like `.p12` can't be redacted, so they're left out. All of this happens whatever your other settings say.
326
+
327
+ For extra safety, set `limits.redact_secrets: true` to also mask API keys, tokens, JWTs and private-key blocks hardcoded inside ordinary files that get included. Every run's report lists what was redacted.
328
+
329
+ > **Tip:** before sharing a sensitive project, run `contextzip --dry-run --verbose` to see exactly what will go into the ZIP.
330
+
331
+ ## Where files go
332
+
333
+ contextzip keeps everything in a `.contextzip/` folder at your git root (change this with `contextzip config --set-workspace`):
334
+
335
+ ```text
336
+ .contextzip/
337
+ ├── output/
338
+ │ ├── codebase/ codebase.zip + manifest + report (contextzip)
339
+ │ ├── git-changes/ changes.zip + manifest + report (--git-changes)
340
+ │ ├── prompt/ vibe.zip + manifest + report (--prompt)
341
+ │ └── watch/ debug-context.zip (contextzip watch)
342
+ ├── snapshots/ numbered copies of what you sent (contextzip snapshots)
343
+ ├── inbox/ drop AI-returned ZIPs here for apply-zip
344
+ └── config.json project config (optional)
345
+ ```
346
+
347
+ Old outputs are cleaned up automatically: `output/` keeps the latest ZIP per mode (`cleanup`), and `snapshots/` keeps the newest 10 or anything under 14 days old (`snapshots`) — never one a reply in the inbox is waiting on.
348
+
349
+ ## Python API
350
+
351
+ contextzip is also a library. The functions behave like the CLI but return plain Python objects and raise exceptions instead of printing.
352
+
353
+ ```python
354
+ from contextzip import get_files, get_git_changes, create_zip, apply_zip, detect_ecosystem
355
+
356
+ # All project files, filtered by .gitignore and the built-in rules
357
+ collection = get_files(include=["src/"], exclude=["*.log"])
358
+ for path in collection.files: # plain pathlib.Path objects
359
+ print(path)
360
+
361
+ # Only git-changed files, zipped
362
+ changes = get_git_changes()
363
+ pkg = create_zip(changes, output="/tmp/changes.zip")
364
+ print(f"Packed {pkg.file_count} files → {pkg.zip_path}")
365
+
366
+ # What stack is this?
367
+ print(detect_ecosystem("."))
368
+ ```
369
+
370
+ | Function | Returns |
371
+ |---|---|
372
+ | `get_files(path=None, *, include=None, exclude=None, …)` | `FileCollection` of all project files after filtering |
373
+ | `get_git_changes(path=None, *, use_project_config=True)` | `FileCollection` of staged, modified and untracked files |
374
+ | `create_zip(collection, output=…)` | `PackageResult` with the ZIP path, file count and sizes |
375
+ | `apply_zip(zip_path=None, …)` | `ApplyResult` describing what was written |
376
+ | `detect_ecosystem(path=None)` | Detected ecosystem information |
377
+
378
+ All exceptions inherit from `ContextzipError`: `NotARepositoryError`, `GitNotFoundError`, `GitCommandError`, `NoFilesError` and `ZipNotFoundError`.
379
+
380
+ For full signatures, see [contextzip.vercel.app/cli#python-api](https://contextzip.vercel.app/cli#python-api).
381
+
382
+ ## Privacy & security
383
+
384
+ - **Local by default.** Packaging, `apply-zip`, `watch` and the config UI never make network requests.
385
+ - **Network use is opt-in and limited to two features:**
386
+ - `--prompt` sends file paths, sizes and your prompt to the Gemini API. File contents are never sent.
387
+ - `contextzip update` asks PyPI for the latest version number.
388
+ - **No telemetry.** Nothing is collected or phoned home.
389
+ - **Manifests stay local.** `apply-zip` manifests are written next to the ZIP and never inside it.
390
+ - **Secrets are excluded or redacted.** See [What is always excluded](#what-is-always-excluded).
391
+
392
+ Found a vulnerability? Please follow [SECURITY.md](https://github.com/akadeepesh/contextzip/blob/main/SECURITY.md) and report it privately rather than in a public issue.
393
+
394
+ ## Platform support
395
+
396
+ | | Windows | macOS | Linux |
397
+ |---|---|---|---|
398
+ | Packaging, `apply-zip`, config | ✅ | ✅ | ✅ |
399
+ | ZIP copied to clipboard as a file | ✅ native (`CF_HDROP`) | ✅ via Finder | ✅ built-in X11 owner (works under XWayland), or `wl-copy` / `xclip` |
400
+ | `contextzip watch` | ✅ (best in Windows Terminal / VS Code) | ✅ | ✅ |
401
+
402
+ If the clipboard can't be used, contextzip opens the output folder with the ZIP selected and tells you why. Use `--no-clipboard` to skip this step entirely.
403
+
404
+ ## Contributing
405
+
406
+ Contributions are welcome, especially **new framework rule sets** and edge-case fixes. Not up for writing code? [Request a feature](https://contextzip.vercel.app/request-feature) or [request your language](https://contextzip.vercel.app/request-language). Both turn into GitHub issues ranked by 👍. To set up a local copy:
407
+
408
+ ```bash
409
+ git clone https://github.com/akadeepesh/contextzip
410
+ cd contextzip
411
+ python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
412
+ pip install -e .
413
+ contextzip --version
414
+ ```
415
+
416
+ Adding a new language takes three small steps: a `PATTERNS` list in `contextzip/rules/`, one registry entry and one detection rule. [CONTRIBUTING.md](https://github.com/akadeepesh/contextzip/blob/main/CONTRIBUTING.md) walks through it, along with PR conventions. Please open an issue before starting a large PR.
417
+
418
+ ## License
419
+
420
+ [MIT](https://github.com/akadeepesh/contextzip/blob/main/LICENSE) © Deepesh