mirror of
https://github.com/akadeepesh/contextzip.git
synced 2026-10-20 08:36:20 +02:00
docs: document bringing back excluded paths with contextzip include
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
4c727633c6
commit
d75406086f
+15
-2
@@ -930,8 +930,8 @@ This project uses [Semantic Versioning](https://semver.org/).
|
||||
- **A `.env` you deliberately include now has every value redacted.**
|
||||
Secret files (`.env`, private keys, credential files, Terraform state and
|
||||
so on) are still left out by default. You can still bring one back with
|
||||
`always_include` in `.contextzip/config.json` or with
|
||||
`contextzip config --ui`, so the AI can see which variables your app
|
||||
`contextzip include .env`, `always_include` in `.contextzip/config.json`
|
||||
or `contextzip config --ui`, so the AI can see which variables your app
|
||||
expects. It is now never zipped as-is:
|
||||
- `.env` / `.env.*` files keep every key, comment and blank line, but
|
||||
every value becomes `[REDACTED]`. Multi-line quoted values collapse to
|
||||
@@ -945,9 +945,22 @@ This project uses [Semantic Versioning](https://semver.org/).
|
||||
file's size. It applies to normal runs, `--git-changes`, `--prompt`,
|
||||
the `source-files.zip` inside `contextzip watch`'s debug package, and
|
||||
the Python API.
|
||||
- **`contextzip include` / `--include` now brings back paths you name
|
||||
explicitly**, even when the rules exclude them. `contextzip include .env`,
|
||||
`include dist/` and `include some-gitignored-file.txt` all work now.
|
||||
Previously they quietly matched nothing. Excluded folders nested inside a
|
||||
named folder are still skipped (`include dist/` leaves out
|
||||
`dist/node_modules/`). Naming an ordinary folder still only narrows the
|
||||
run, so `include src/` doesn't pull in `src/.env`. The CLI prints a line
|
||||
when this happens, and secret files are redacted as described above.
|
||||
This also works with `--git-changes` and the Python API's `get_files()`.
|
||||
- Include paths now accept a leading `./` or `.\` (`contextzip include ./src`).
|
||||
- The scan report now groups repeated redactions (`.env value x3`).
|
||||
|
||||
### Fixed
|
||||
- The "Don't see your language?" hint shown for undetected projects linked
|
||||
to a placeholder (`https://example.com`). It now points to
|
||||
<https://contextzip.vercel.app/request-language>.
|
||||
- **The report didn't list files that couldn't be written to the ZIP**,
|
||||
even though the CLI said "see report". They now appear under "Left out
|
||||
of the ZIP" with the reason.
|
||||
|
||||
@@ -37,7 +37,7 @@ These flags work on the main command **and** on `include` and `exclude`. Flags g
|
||||
|
||||
| Flag | Short | Description |
|
||||
|---|---|---|
|
||||
| `--include PATH` | `-i` | Only include files under these paths (relative to the project root). Repeatable. Same as `contextzip include`. |
|
||||
| `--include PATH` | `-i` | Only include files under these paths (relative to the project root). Naming a path the rules exclude, like `.env`, brings it back. Repeatable. Same as `contextzip include`. |
|
||||
| `--exclude PATTERN` | `-e` | Extra exclusion patterns on top of the automatic rules (gitignore syntax). Repeatable. Same as `contextzip exclude`. |
|
||||
| `--prompt TEXT` | `-p` | Describe your task in plain language; Gemini selects only the relevant files. Needs a free Gemini API key (you're guided through setup on first use). |
|
||||
| `--dry-run` | `-n` | Show what would be included without creating the ZIP. |
|
||||
@@ -71,8 +71,14 @@ contextzip include PATH… [run flags]
|
||||
|
||||
contextzip include src/ app/
|
||||
contextzip include src/ app/ --dry-run
|
||||
contextzip include src/ .env # bring back a file the rules exclude
|
||||
contextzip include dist/ # or a whole excluded folder
|
||||
```
|
||||
|
||||
Paths match at folder boundaries: `src` matches `src/index.ts` but not `src2/index.ts`. Leading `./` or `.\` is ignored.
|
||||
|
||||
**Naming an excluded path brings it back.** If a path you name is itself excluded (by the built-in rules, `.gitignore` or `always_exclude`), it is included anyway, because you asked for it explicitly. Inside a named folder, excluded folders nested deeper are still skipped (`include dist/` leaves out `dist/node_modules/`). Naming an ordinary folder only narrows the run: `include src/` does **not** pull in `src/.env`. Secret files brought back this way, such as `.env`, keep their keys but have every value replaced with `[REDACTED]`. The same applies to `--include` / `-i`.
|
||||
|
||||
## `contextzip exclude`
|
||||
|
||||
Exclude specific files or patterns and package everything else. Patterns use gitignore syntax; a folder matches with or without a trailing slash (`.github` and `.github/` both work).
|
||||
|
||||
@@ -90,6 +90,7 @@ contextzip --dry-run --verbose # preview every included/excluded fi
|
||||
contextzip --git-changes # only what you've changed
|
||||
contextzip --prompt "fix the login redirect bug" # let AI pick the relevant files
|
||||
contextzip include src/ app/ # only these folders
|
||||
contextzip include src/ .env # .env too, values redacted
|
||||
contextzip exclude tests/ '*.snap' # everything except these
|
||||
contextzip apply-zip # write the AI's changes back
|
||||
```
|
||||
@@ -198,7 +199,7 @@ This opens a local browser tab where you can tick files and folders to always in
|
||||
|
||||
| Flag | Short | Description |
|
||||
|---|---|---|
|
||||
| `--include PATH` | `-i` | Only include files under these paths. Repeatable. |
|
||||
| `--include PATH` | `-i` | Only include files under these paths. Naming an excluded path (like `.env`) brings it back. Repeatable. |
|
||||
| `--exclude PATTERN` | `-e` | Extra exclusion patterns (gitignore syntax). Repeatable. |
|
||||
| `--prompt TEXT` | `-p` | Let Gemini select files relevant to this task. |
|
||||
| `--git-changes` | | Only include files git reports as changed. |
|
||||
@@ -271,7 +272,7 @@ These patterns apply to **every** project, whatever its stack or `.gitignore` sa
|
||||
- **Binaries & media:** executables, shared libraries, images, video, audio and archives
|
||||
- **Project boilerplate:** `CHANGELOG`, `LICENSE`, `CONTRIBUTING`, `SECURITY.md`, `CODE_OF_CONDUCT.md`, GitHub issue/PR templates
|
||||
|
||||
CLI flags and `.gitignore` can't override these. To bring one back, list it under `always_include` in the project config or tick it in `contextzip config --ui`.
|
||||
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.
|
||||
|
||||
**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]`:
|
||||
|
||||
@@ -361,7 +362,7 @@ If the clipboard can't be used, contextzip opens the output folder with the ZIP
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions are welcome, especially **new framework rule sets** and edge-case fixes. To set up a local copy:
|
||||
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:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/akadeepesh/contextzip
|
||||
|
||||
+2
-2
@@ -41,9 +41,9 @@ There is no telemetry, analytics or background "phone home".
|
||||
|
||||
contextzip protects secrets in three layers:
|
||||
|
||||
1. **Secret files are excluded by default.** `.env` and `.env.*`, private keys (`*.pem`, `*.key`, `id_rsa`, `id_ed25519`, …), keystores, `.npmrc` / `.netrc` / `.pypirc` / `.pgpass`, Docker auth config, AWS credentials, service-account and `*credentials*.json` files, kubeconfigs and Terraform state are left out of every run, including `--git-changes`. CLI flags and `.gitignore` can't bring them back.
|
||||
1. **Secret files are excluded by default.** `.env` and `.env.*`, private keys (`*.pem`, `*.key`, `id_rsa`, `id_ed25519`, …), keystores, `.npmrc` / `.netrc` / `.pypirc` / `.pgpass`, Docker auth config, AWS credentials, service-account and `*credentials*.json` files, kubeconfigs and Terraform state are left out of every run, including `--git-changes`. Including a folder (`contextzip include src/`) doesn't bring back the secret files inside it.
|
||||
|
||||
2. **Secret files you include on purpose are always redacted.** You can bring one of these files back by listing it under `always_include` in `.contextzip/config.json` (or ticking it in `contextzip config --ui`). This is useful when you want the AI to see which environment variables your app expects. Such a file is never zipped as-is, whatever your other settings say:
|
||||
2. **Secret files you include on purpose are always redacted.** You can bring one of these files back by naming it explicitly (`contextzip include .env`), listing it under `always_include` in `.contextzip/config.json`, or ticking it in `contextzip config --ui`. This is useful when you want the AI to see which environment variables your app expects. Such a file is never zipped as-is, whatever your other settings say:
|
||||
- In `.env` files every key, comment and blank line is kept, and **every value is replaced with `[REDACTED]`**.
|
||||
- Other secret files are scanned for private-key blocks, API keys, tokens and similar values, and the matches are replaced with `[REDACTED]`.
|
||||
- A secret file that isn't text (for example `.p12` or `.jks`) can't be redacted, so it is left out and listed in the report.
|
||||
|
||||
Reference in New Issue
Block a user