codebase-snapshot 0.22.0 → 0.22.1

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.
package/CHANGELOG.md CHANGED
@@ -30,6 +30,19 @@ deprecated with an explanatory message instead. `latest` has pointed at 0.9.0 si
30
30
 
31
31
  ---
32
32
 
33
+ ## 0.22.1
34
+
35
+ **Security and trust hardening after three adversarial audit passes.**
36
+
37
+ - Change Guard hooks now refuse executable repository configs, apply the server-safe config rules, and stay fail-open when a config is malformed or being edited. `health` accepts `--no-config`.
38
+ - Dockerfile redaction masks values that merely start with `$` and every physical line of `ENV \` continuations. YAML comments, `|2-`/`>2+` headers, quoted-key scalars, YAML lists and JSON arrays are masked. Unified diffs are redacted against both the old and new full files, prefer the new path on a rename, and use `--relative`.
39
+ - MCP part reads verify the recorded digest and byte size, fall back to live bytes when a part is missing or tampered, and parse each part once per call. `snapshot_context` emits numbered, truncation-aware windows. Analysis workers stop on cancellation, and stateless HTTP cancellation still matches when `clientInfo` is omitted from the notification.
40
+ - `explain` reports directories honestly and applies the same 2 MB parser cap as `generate`. `health` skips deep fidelity when nothing could be replayed, scans packs and diff reports under their source paths, keeps root workspace rules for members without a config, and accepts `export =` summaries.
41
+ - `impact` traverses type-only pure barrels, recognises Python, Go, Rust and Ruby test names, and keeps deletions in the guard's change set. Non-git live caches notice files created in previously empty directories; IPv4-embedded and local-use NAT64 IPv6 addresses are private.
42
+ - The Docker entrypoint honours `SNAPSHOT_CWD`, and the CLI output, option-scope, `--root`, `pr-comment` and guard USAGE documentation match the code.
43
+
44
+ ---
45
+
33
46
  ## 0.22.0
34
47
 
35
48
  **Change Guard: a silent-by-default check for the consumers, tests and routes an agent's edit did not touch.**
@@ -39,6 +52,7 @@ deprecated with an explanatory message instead. `latest` has pointed at 0.9.0 si
39
52
  - New portable Agent Plugins 1.0 package under `agent-plugin/`: a `change-guard` skill, Claude and Copilot hook configs, and a pinned command. It calls the CLI instead of adding MCP tools, so it adds no tool-schema context until it has a gap to report.
40
53
  - New `docs/guard.md` and CLI reference entries. The command is in `describe`; the parser rejects `--hook` with `--paths`; `--max-chars` is bounded to 200-10000.
41
54
  - The hook text is capped at 1,200 characters by default. A clean check is one line in text mode and an empty object in hook mode. Tests cover consumers and tests, the Claude and Copilot response shapes, silence, and the character cap.
55
+ - The plugin is listed in native marketplaces. `.claude-plugin`, `.qoder-plugin`, `.github/plugin` and `.agents/plugins` catalogs install it with native commands in Claude Code, Codex, Copilot, Qoder and Devin, with no file copying or JSON merging.
42
56
 
43
57
  ---
44
58
 
package/README.md CHANGED
@@ -33,6 +33,20 @@ tree in memory, overlay uncommitted edits, and never write into the repository.
33
33
  review. TypeScript and JavaScript first, but also Python, Go, Rust, Java/Kotlin, C#/.NET, PHP,
34
34
  Ruby, C/C++, Vue, Svelte and Astro, without configuration.
35
35
 
36
+ **Using an agent?** Install the plugin instead of wiring hooks by hand:
37
+
38
+ ```text
39
+ /plugin marketplace add ankurhalder/codebase-snapshot
40
+ /plugin install codebase-snapshot-change-guard@codebase-snapshot
41
+ ```
42
+
43
+ Codex: `codex plugin marketplace add ankurhalder/codebase-snapshot`, then
44
+ `codex plugin add codebase-snapshot-change-guard@codebase-snapshot`. Copilot CLI and Devin use
45
+ `copilot plugin install ankurhalder/codebase-snapshot:agent-plugin` and
46
+ `devin plugins install ankurhalder/codebase-snapshot#agent-plugin`. The plugin installs the
47
+ [Change Guard](https://ankurhalder.github.io/codebase-snapshot/guard.html) skill; in Claude Code it
48
+ also wires the post-edit hook, and Codex calls the guard when the change warrants it.
49
+
36
50
  A **codebase snapshot** is not a copy of the repository: it is a bounded, indexed artefact — parts
37
51
  under a byte ceiling, a manifest that names every include and every skip, and a validator that can
38
52
  prove the bytes still match the tree. The [glossary](https://github.com/ankurhalder/codebase-snapshot/blob/main/docs/glossary.md)
@@ -59,11 +73,10 @@ Feeding a real repository to a model is awkward: files are too big, context wind
59
73
  and choosing what matters by hand neither scales nor repeats. This does it deterministically.
60
74
 
61
75
  - **A hard ceiling, not a target.** `maxPartBytes` is a limit, and nothing overflows it silently:
62
- a file too big for a part becomes a head/tail excerpt with an omission marker, and `manifest.json`
63
- records it in `incomplete[]` with the line ranges it lost.
76
+ a file too big for a part becomes a head/tail excerpt, and `incomplete[]` records the line ranges
77
+ it lost.
64
78
  - **An index, not just text.** `manifest.json` lists every included file with its layer, kind,
65
- language, part, hash and a structural summary, every *excluded* file with the reason, and an
66
- `incomplete[]` list of every file it could only emit in part, with the line ranges it lost.
79
+ language, part, hash and structural summary, and every *excluded* path with its reason.
67
80
  - **Provably current.** `validate` re-hashes the repository against the snapshot and exits non-zero
68
81
  on any drift, so a pipeline can gate on the context being fresh.
69
82
  - **Repeatable.** Two runs over unchanged input give byte-identical parts and the same
@@ -78,8 +91,7 @@ npm install -D codebase-snapshot # or add it to a project
78
91
  ```
79
92
 
80
93
  `codebase-snapshot` is the canonical name to script against; `snapshot` is the short command a
81
- global install provides, and from a project dependency the same binary is `npx snapshot` or the
82
- `npm run snapshot` script `init` writes.
94
+ global install provides.
83
95
 
84
96
  Requires **Node.js 18+**. Any npm client works — npm, yarn (classic and Berry with strict PnP), pnpm
85
97
  and bun. Published from GitHub Actions with [build
@@ -160,14 +172,11 @@ contain.
160
172
  - **The output directory is the tool's.** Each run is written to a scratch directory and swapped in
161
173
  atomically, and it refuses to replace a directory it did not create — `--out-dir src` cannot
162
174
  destroy source code.
163
- - **The brief travels with the payload.** `PROMPT.md` is a brief, not a packing slip: the job,
164
- the system map the manifest can prove (layers, load-bearing modules, entry points, indexed
165
- surfaces), the recent commit history as claims to verify rather than rediscover, the evidence bar,
166
- the coverage owed, and calibration examples. Then the apparatus — this run's parts, partial files
167
- with their missing line ranges, fingerprint, and the attachment arithmetic. The judgement half
168
- can come from your own file (`brief`) and the job from `promptTask`. A prompt that names
169
- the wrong snapshot is a lie that reads as current, so it is an artifact with a recorded digest and
170
- `validate` fails when it is edited.
175
+ - **The brief travels with the payload.** `PROMPT.md` carries the job, the system map the
176
+ manifest can prove, recent commits as claims to verify, the evidence bar, the coverage owed and
177
+ calibration examples, then this run's parts, partial files, fingerprint and attachment arithmetic.
178
+ The judgement half can come from your own `brief`, the job from `promptTask`; its digest is
179
+ validated, so an edited prompt is drift.
171
180
  - **Credential files are excluded by default** — `.env`, `*.pem`, `.npmrc`, `id_rsa`, `*.tfstate`
172
181
  and more — and secret-shaped strings inside ordinary files are redacted by masking only the
173
182
  matched span, never the whole line.
@@ -187,9 +196,8 @@ patterns and a recommended part budget.
187
196
  | Laravel (PHP) | Rails (Ruby) | Terraform / Docker infra | Docs-only |
188
197
  | generic fallback | | | |
189
198
 
190
- Non-TypeScript languages get import/export/class/function summaries rather than being treated as
191
- opaque text, and every summary is labelled `ast`, `structural` or `heuristic` so you know how much
192
- to trust it.
199
+ Non-TypeScript languages get import/export/class/function summaries rather than opaque text, each
200
+ labelled `ast`, `structural` or `heuristic`.
193
201
 
194
202
  → [Preset table and detection rules](https://github.com/ankurhalder/codebase-snapshot/blob/main/docs/configuration.md#project-presets)
195
203
 
@@ -205,6 +213,7 @@ to trust it.
205
213
  | `health` | Audit a snapshot's integrity and secrets; `--deep` replays every body. |
206
214
  | `serve` | Browser UI and the MCP endpoint on loopback. |
207
215
  | `impact --diff <ref>` | Changed files, symbol-pruned callers, routes and candidate tests from the live index. |
216
+ | `guard` | What the change reaches that the diff does not; `--hook` stays fail-open. |
208
217
  | `brief` | One redacted review pack for a question, a diff or changed paths. |
209
218
  | `init` | Interactive (or `--yes`) setup that writes a self-documenting config. |
210
219
  | `explain <path>` | Why one path is included, which part it lands in, or why it was skipped. |
@@ -229,7 +238,7 @@ Everything an agent needs is available as data, and the tool can install its own
229
238
  ```bash
230
239
  npx codebase-snapshot describe --format json # contract: workflow, options, exit codes
231
240
  npx codebase-snapshot skill --install # into .agents, .claude and .cursor
232
- npx -y codebase-snapshot@0.22.0 mcp # or serve it over MCP
241
+ npx -y codebase-snapshot@0.22.1 mcp # or serve it over MCP
233
242
  ```
234
243
 
235
244
  An agent told only "use `npx codebase-snapshot`" can read the contract, follow its ordered