codebase-snapshot 0.22.0 → 0.22.2
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 +27 -0
- package/README.md +28 -19
- package/dist/bin.js +2211 -1061
- package/dist/{chunk-NPCDJBE4.js → chunk-OVH6B3GV.js} +1738 -747
- package/dist/cli.cjs +2328 -1188
- package/dist/cli.js +333 -184
- package/dist/index.cjs +1717 -732
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +1118 -368
- package/dist/mcp.d.cts +5 -2
- package/dist/mcp.d.ts +5 -2
- package/dist/mcp.js +1 -1
- package/docs/about.md +3 -2
- package/docs/agent.md +5 -1
- package/docs/answer.md +40 -11
- package/docs/cli.md +17 -16
- package/docs/deploy.md +10 -4
- package/docs/guard.md +55 -8
- package/docs/impact.md +3 -2
- package/docs/mcp-server-for-codebase.md +2 -2
- package/docs/mcp.md +5 -5
- package/docs/security-review.md +8 -2
- package/docs/tools.md +18 -3
- package/docs/troubleshooting.md +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -30,6 +30,32 @@ deprecated with an explanatory message instead. `latest` has pointed at 0.9.0 si
|
|
|
30
30
|
|
|
31
31
|
---
|
|
32
32
|
|
|
33
|
+
## 0.22.2
|
|
34
|
+
|
|
35
|
+
**Line-targeted context, hidden-instruction filtering and verifiable receipts.**
|
|
36
|
+
|
|
37
|
+
- `snapshot_context` now accepts explicit `ranges`, starts an explicit `symbols` target at its parsed declaration span instead of the file head, and selects a question-relevant declaration when the question names a multi-word symbol. Returned line numbers are the real source lines, including range starts.
|
|
38
|
+
- Context and read responses remove HTML comments that look like AI instructions, zero-width characters and bidi controls before returning a body. Removals are reported in `security` and the trust envelope without echoing the payload.
|
|
39
|
+
- Context responses carry a deterministic `receipt`: per-chunk SHA-256 hashes plus a canonical digest over chunks, omissions, security findings and trust. `signReceipt: true` adds an Ed25519 signature when `SNAPSHOT_SIGNING_KEY` is configured; without a key the request fails rather than returning an unsigned object labelled signed.
|
|
40
|
+
- `guard` now reports documentation gaps: exported/component/route symbols of at least three characters that no Markdown, reStructuredText or AsciiDoc file mentions. The report adds `kind: "documentation"`, `symbols`, and `omitted.documentation`; docs gaps are conservative and only appear when the repository has a documentation surface.
|
|
41
|
+
- `snapshot_locate` sanitizes text excerpts before returning them and reports hidden-text removals.
|
|
42
|
+
- Documentation, the bundled skill and the MCP guides describe ranges, symbol spans, receipts and the docs-gap guard. Tests cover explicit symbols, explicit ranges, receipt stability and signing, hidden instructions in context and read, documentation gaps, and the failure when signing is requested without a key.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 0.22.1
|
|
47
|
+
|
|
48
|
+
**Security and trust hardening after three adversarial audit passes.**
|
|
49
|
+
|
|
50
|
+
- 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`.
|
|
51
|
+
- 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`.
|
|
52
|
+
- 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.
|
|
53
|
+
- `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.
|
|
54
|
+
- `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.
|
|
55
|
+
- The Docker entrypoint honours `SNAPSHOT_CWD`, and the CLI output, option-scope, `--root`, `pr-comment` and guard USAGE documentation match the code.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
33
59
|
## 0.22.0
|
|
34
60
|
|
|
35
61
|
**Change Guard: a silent-by-default check for the consumers, tests and routes an agent's edit did not touch.**
|
|
@@ -39,6 +65,7 @@ deprecated with an explanatory message instead. `latest` has pointed at 0.9.0 si
|
|
|
39
65
|
- 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
66
|
- 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
67
|
- 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.
|
|
68
|
+
- 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
69
|
|
|
43
70
|
---
|
|
44
71
|
|
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
|
|
63
|
-
|
|
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
|
|
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
|
|
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`
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
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
|
|
191
|
-
|
|
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: consumers, tests, routes and undocumented public symbols; `--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.
|
|
241
|
+
npx -y codebase-snapshot@0.22.2 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
|
|
@@ -312,7 +321,7 @@ others.
|
|
|
312
321
|
| [AI agents](https://github.com/ankurhalder/codebase-snapshot/blob/main/docs/agent.md) | The contract, the skill, what an agent should avoid |
|
|
313
322
|
| [MCP server](https://github.com/ankurhalder/codebase-snapshot/blob/main/docs/mcp.md) | 7 tools, resources, both protocol eras, modern HTTP conformance |
|
|
314
323
|
| [MCP tools](https://github.com/ankurhalder/codebase-snapshot/blob/main/docs/tools.md) | Every tool schema and an example call |
|
|
315
|
-
| [snapshot_context](https://github.com/ankurhalder/codebase-snapshot/blob/main/docs/answer.md) | One question,
|
|
324
|
+
| [snapshot_context](https://github.com/ankurhalder/codebase-snapshot/blob/main/docs/answer.md) | One question, declaration spans or ranges, a hard token budget, hidden-text filtering and a verifiable receipt |
|
|
316
325
|
| [Glossary](https://github.com/ankurhalder/codebase-snapshot/blob/main/docs/glossary.md) | Codebase snapshot, token budget, manifest, drift, MCP and agent experience |
|
|
317
326
|
| [FAQ](https://github.com/ankurhalder/codebase-snapshot/blob/main/docs/faq.md) | Direct answers about MCP, tokens, secrets, CI and comparisons |
|
|
318
327
|
| [All documentation](https://github.com/ankurhalder/codebase-snapshot/blob/main/docs/contents.md) | Every page, grouped by the job you are doing |
|