codebase-snapshot 0.16.0 → 0.17.0
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 +77 -0
- package/README.md +1 -1
- package/SECURITY.md +2 -2
- package/dist/bin.js +1 -1
- package/dist/{chunk-AEGJYOCF.js → chunk-PDLN24ZZ.js} +1 -1
- package/dist/{chunk-ZDTAWUD4.js → chunk-VI3JLKPX.js} +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +1 -1
- package/dist/mcp.js +2 -2
- package/docs/answer.md +51 -0
- package/docs/cli.md +3 -3
- package/docs/deploy.md +2 -2
- package/docs/mcp.md +4 -4
- package/docs/migration.md +19 -0
- package/docs/security-review.md +20 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -30,6 +30,83 @@ deprecated with an explanatory message instead. `latest` has pointed at 0.9.0 si
|
|
|
30
30
|
|
|
31
31
|
---
|
|
32
32
|
|
|
33
|
+
## 0.17.0
|
|
34
|
+
|
|
35
|
+
**The endgame: what this is, and how it is proven.**
|
|
36
|
+
|
|
37
|
+
`codebase-snapshot` reads a repository and writes a text representation of it that an AI reader can
|
|
38
|
+
use: budgeted parts, a manifest that accounts for every path, and — since 0.12.15 — a server that
|
|
39
|
+
answers questions about the repository instead of making the reader open all of it.
|
|
40
|
+
|
|
41
|
+
### What a reader gets
|
|
42
|
+
|
|
43
|
+
- **A dump that fits.** Byte-budgeted parts, a per-file accounting of what was written, previewed,
|
|
44
|
+
stripped or skipped, and an audit that recomputes those claims from the parts.
|
|
45
|
+
- **A selection, when the question is narrower than the repository**: `--slice` for a question,
|
|
46
|
+
`--budget-tokens` for a ceiling, `--delta` for a change set. Each explains itself in
|
|
47
|
+
`reports/selection.md`, and each records what it left out.
|
|
48
|
+
- **A server that answers questions.** 26 MCP tools over stdio or Streamable HTTP with bearer tokens,
|
|
49
|
+
from `snapshot_answer` (question to cited windows) to `snapshot_health` (an audit of the snapshot
|
|
50
|
+
itself), plus prompts and resources. Reads come from the snapshot, so redaction and exclusions
|
|
51
|
+
still apply.
|
|
52
|
+
- **Proof of its own output.** Ed25519 signatures, artifact digests, a workspace index that must
|
|
53
|
+
agree with its members, and `snapshot health` with a score and a strict exit code.
|
|
54
|
+
|
|
55
|
+
### The program, by milestone
|
|
56
|
+
|
|
57
|
+
| Version | Theme | Published |
|
|
58
|
+
| :--- | :--- | :--- |
|
|
59
|
+
| 0.13.0 | The MCP server, remote ingestion, signing, slicing, delta packs, multi-repo | 2026-11-18 |
|
|
60
|
+
| 0.14.0 | The audit proves the manifest: bodies, counts, packs, workspace index, metrics | 2026-11-18 |
|
|
61
|
+
| 0.15.0 | Parity measured on ten public repositories; per-run `--only`/`--ignore` | 2026-11-18 |
|
|
62
|
+
| 0.16.0 | Beyond parity: self-explaining selections, what-if budgets, `snapshot_answer` | 2026-11-18 |
|
|
63
|
+
| 0.17.0 | This milestone: the site, the security review, the migration guide, the final number | 2026-11-18 |
|
|
64
|
+
|
|
65
|
+
Every version in between was committed, tagged and pushed; `x.y.0` is what the registry carries, and
|
|
66
|
+
`latest` never points at a patch. The number is not the promise — the changelog entry is.
|
|
67
|
+
|
|
68
|
+
### How it is proven
|
|
69
|
+
|
|
70
|
+
- **Tests**: 1333 in the suite, 1325 passing, 0 failing, 8 skipped because they need a host this
|
|
71
|
+
runner is not. The suite treats the tool as a black box where it can: generate, validate, serve,
|
|
72
|
+
ask, and check the answer.
|
|
73
|
+
- **The audit**: every generated snapshot in the suite is audited, and the audit is itself probed by
|
|
74
|
+
breaking what it claims to check — a truncated part, an edited count, a pack minus one entry, an
|
|
75
|
+
index with a wrong fingerprint, an edited selection report.
|
|
76
|
+
- **Measurement**: ten public repositories through this tool, repomix and gitingest in one command
|
|
77
|
+
(`scripts/benchmark-suite.mjs`), with the page saying where the numbers are comparable and where
|
|
78
|
+
they are a policy difference.
|
|
79
|
+
- **The artifact**: a 53-file tarball whose lockfile agrees with `package.json`, checked before every
|
|
80
|
+
publish by the same `verify` a reader can run.
|
|
81
|
+
- **The site**: 30 pages, every one with a description, a canonical URL and no broken link
|
|
82
|
+
(`audit-site`), generated from the same documents the repository ships.
|
|
83
|
+
|
|
84
|
+
### What is deliberately not here
|
|
85
|
+
|
|
86
|
+
- **No 1.0.0.** The line ends at 0.17.0 because a version number is a promise about stability, and
|
|
87
|
+
this project would rather make the next promise in a changelog than in a semver jump.
|
|
88
|
+
- **No runtime dependencies.** Node built-ins and the TypeScript compiler (a dev dependency) only.
|
|
89
|
+
- **No silent fallback.** An unknown flag, preset, budget or config key is an error, and a path that
|
|
90
|
+
leaves the snapshot is recorded with the reason it left.
|
|
91
|
+
## 0.16.2
|
|
92
|
+
|
|
93
|
+
**The endgame pages.**
|
|
94
|
+
|
|
95
|
+
- `docs/answer.md` is a site page of its own: one call from question to cited, line-numbered
|
|
96
|
+
context, the four-way comparison with `plan_for`/`read`/`budget`, and what the tool deliberately
|
|
97
|
+
will not do (invent a path, truncate silently, read the working tree, exceed the budget without
|
|
98
|
+
saying so). 30 pages, audit-site clean.
|
|
99
|
+
- The site builder still described the tool reference as "All 22 MCP tools"; it is 26, and the
|
|
100
|
+
number now matches `tools/list`.
|
|
101
|
+
- `docs/security-review.md` gains "What changed since this review was written": metrics labels, the
|
|
102
|
+
web server's allowed roots, the audit that stopped trusting the manifest, `snapshot_answer`, and
|
|
103
|
+
`--only`/`--ignore` — each reviewed for what new input arrives and what it can reach.
|
|
104
|
+
- `docs/migration.md` gains the 0.13.0-0.17.0 table: what a reader upgrading across those milestones
|
|
105
|
+
will notice, and why nothing was removed.
|
|
106
|
+
## 0.16.1
|
|
107
|
+
|
|
108
|
+
- The goal log records the fourth published milestone: 0.16.0 tagged, released on GitHub and
|
|
109
|
+
published to npm (`latest` at 01:52Z). `ROADMAP.md` marks it published.
|
|
33
110
|
## 0.16.0
|
|
34
111
|
|
|
35
112
|
**Things neither competitor has.**
|
package/README.md
CHANGED
|
@@ -210,7 +210,7 @@ Everything an agent needs is available as data, and the tool can install its own
|
|
|
210
210
|
```bash
|
|
211
211
|
npx codebase-snapshot describe --format json # contract: workflow, options, exit codes
|
|
212
212
|
npx codebase-snapshot skill --install # into .claude/skills + .cursor/rules
|
|
213
|
-
npx -y codebase-snapshot@0.
|
|
213
|
+
npx -y codebase-snapshot@0.17.0 mcp # or serve it over MCP
|
|
214
214
|
```
|
|
215
215
|
|
|
216
216
|
An agent told only "use `npx codebase-snapshot`" can read the contract, follow its ordered
|
package/SECURITY.md
CHANGED
|
@@ -6,11 +6,11 @@ Only the latest published release receives security fixes.
|
|
|
6
6
|
|
|
7
7
|
| Version | Supported |
|
|
8
8
|
| :--- | :--- |
|
|
9
|
-
| <!--@majorMinor-->0.
|
|
9
|
+
| <!--@majorMinor-->0.17<!--/@majorMinor-->.x | ✅ |
|
|
10
10
|
| anything older | ❌ |
|
|
11
11
|
|
|
12
12
|
The number line restarted at 0.9.0 when the package moved to the unscoped `codebase-snapshot` name,
|
|
13
|
-
so <!--@majorMinor-->0.
|
|
13
|
+
so <!--@majorMinor-->0.17<!--/@majorMinor-->.x is newer than 4.4.1, not older. That is explained in full in the
|
|
14
14
|
[changelog](CHANGELOG.md#a-note-on-version-numbers).
|
|
15
15
|
|
|
16
16
|
## Reporting a vulnerability
|
package/dist/bin.js
CHANGED
|
@@ -2191,7 +2191,7 @@ function applySpansKeepingQuotes(line, spans) {
|
|
|
2191
2191
|
|
|
2192
2192
|
// src/version.ts
|
|
2193
2193
|
var GENERATOR_NAME = "codebase-snapshot";
|
|
2194
|
-
var GENERATOR_VERSION = "0.
|
|
2194
|
+
var GENERATOR_VERSION = "0.17.0";
|
|
2195
2195
|
var SCHEMA_VERSION = "3.0.0";
|
|
2196
2196
|
var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
|
|
2197
2197
|
function isOurGeneratorName(name) {
|
|
@@ -3994,7 +3994,7 @@ function applySpansKeepingQuotes(line, spans) {
|
|
|
3994
3994
|
|
|
3995
3995
|
// src/version.ts
|
|
3996
3996
|
var GENERATOR_NAME = "codebase-snapshot";
|
|
3997
|
-
var GENERATOR_VERSION = "0.
|
|
3997
|
+
var GENERATOR_VERSION = "0.17.0";
|
|
3998
3998
|
var SCHEMA_VERSION = "3.0.0";
|
|
3999
3999
|
var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
|
|
4000
4000
|
function isOurGeneratorName(name) {
|
package/dist/cli.cjs
CHANGED
|
@@ -2221,7 +2221,7 @@ function applySpansKeepingQuotes(line, spans) {
|
|
|
2221
2221
|
|
|
2222
2222
|
// src/version.ts
|
|
2223
2223
|
var GENERATOR_NAME = "codebase-snapshot";
|
|
2224
|
-
var GENERATOR_VERSION = "0.
|
|
2224
|
+
var GENERATOR_VERSION = "0.17.0";
|
|
2225
2225
|
var SCHEMA_VERSION = "3.0.0";
|
|
2226
2226
|
var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
|
|
2227
2227
|
function isOurGeneratorName(name) {
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { startHttpTransport } from './chunk-
|
|
2
|
-
import { shouldCheck, checkForUpdate, GENERATOR_VERSION, cacheFilePath, formatUpdateNotice, installKind, buildAgentContract, startWebServer, runStdioServer, parseRemoteSource, assertPublicHost, cloneRepository, makeCloneDirectory, loadConfigFileDetailed, resolveConfig, validateSnapshot, auditSnapshot, describeManifestShapeProblem, explainPath, compareManifests, loadManifest, renderDiffText, generateSnapshot, signManifest, loadSigningKey, writeSignature, formatNumber, isDiscoveryMode, ARTIFACT_NAMES, COMMAND_OPTION_SCOPE, commandsForOption, getPreset, unknownPresetMessage, GENERATOR_NAME, runInit, installPreCommitHook, PromptCancelled, SKILL_NAME, renderSkill, findConfigFile, planFirstRun, isEffectivelyEmpty, isInteractive, defaultIO, hasPriorSnapshot, DEFAULT_ANSWERS, firstRunMessage, stripJsonComments, parseByteSize, gitignorePath, appendGitignoreEntries, escapeControls, runWithStdoutCapture, MIN_MAX_PART_TOKENS, MIN_MAX_PART_BYTES, renderContractText, renderExplainText } from './chunk-
|
|
3
|
-
export { buildAgentContract } from './chunk-
|
|
1
|
+
import { startHttpTransport } from './chunk-VI3JLKPX.js';
|
|
2
|
+
import { shouldCheck, checkForUpdate, GENERATOR_VERSION, cacheFilePath, formatUpdateNotice, installKind, buildAgentContract, startWebServer, runStdioServer, parseRemoteSource, assertPublicHost, cloneRepository, makeCloneDirectory, loadConfigFileDetailed, resolveConfig, validateSnapshot, auditSnapshot, describeManifestShapeProblem, explainPath, compareManifests, loadManifest, renderDiffText, generateSnapshot, signManifest, loadSigningKey, writeSignature, formatNumber, isDiscoveryMode, ARTIFACT_NAMES, COMMAND_OPTION_SCOPE, commandsForOption, getPreset, unknownPresetMessage, GENERATOR_NAME, runInit, installPreCommitHook, PromptCancelled, SKILL_NAME, renderSkill, findConfigFile, planFirstRun, isEffectivelyEmpty, isInteractive, defaultIO, hasPriorSnapshot, DEFAULT_ANSWERS, firstRunMessage, stripJsonComments, parseByteSize, gitignorePath, appendGitignoreEntries, escapeControls, runWithStdoutCapture, MIN_MAX_PART_TOKENS, MIN_MAX_PART_BYTES, renderContractText, renderExplainText } from './chunk-PDLN24ZZ.js';
|
|
3
|
+
export { buildAgentContract } from './chunk-PDLN24ZZ.js';
|
|
4
4
|
import { spawnSync } from 'child_process';
|
|
5
5
|
import * as fs2 from 'fs';
|
|
6
6
|
import * as path2 from 'path';
|
package/dist/index.cjs
CHANGED
|
@@ -4012,7 +4012,7 @@ function applySpansKeepingQuotes(line, spans) {
|
|
|
4012
4012
|
|
|
4013
4013
|
// src/version.ts
|
|
4014
4014
|
var GENERATOR_NAME = "codebase-snapshot";
|
|
4015
|
-
var GENERATOR_VERSION = "0.
|
|
4015
|
+
var GENERATOR_VERSION = "0.17.0";
|
|
4016
4016
|
var SCHEMA_VERSION = "3.0.0";
|
|
4017
4017
|
var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
|
|
4018
4018
|
function isOurGeneratorName(name) {
|
package/dist/index.d.cts
CHANGED
|
@@ -548,7 +548,7 @@ declare function validateSnapshot(configInput: ResolvedSnapshotConfig | Snapshot
|
|
|
548
548
|
* `package.json` carries the same version; `npm run verify` compares the two.
|
|
549
549
|
*/
|
|
550
550
|
declare const GENERATOR_NAME = "codebase-snapshot";
|
|
551
|
-
declare const GENERATOR_VERSION = "0.
|
|
551
|
+
declare const GENERATOR_VERSION = "0.17.0";
|
|
552
552
|
/**
|
|
553
553
|
* The manifest and ownership-marker schema this build writes and understands.
|
|
554
554
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -548,7 +548,7 @@ declare function validateSnapshot(configInput: ResolvedSnapshotConfig | Snapshot
|
|
|
548
548
|
* `package.json` carries the same version; `npm run verify` compares the two.
|
|
549
549
|
*/
|
|
550
550
|
declare const GENERATOR_NAME = "codebase-snapshot";
|
|
551
|
-
declare const GENERATOR_VERSION = "0.
|
|
551
|
+
declare const GENERATOR_VERSION = "0.17.0";
|
|
552
552
|
/**
|
|
553
553
|
* The manifest and ownership-marker schema this build writes and understands.
|
|
554
554
|
*
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ARTIFACT_NAMES, CHECK_INTERVAL_MS, CONFIG_KEYS, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, FAILURE_INTERVAL_MS, GENERATOR_NAME, GENERATOR_VERSION, HOOK_MARKER, LANGUAGE_PROFILES, MIN_MAX_PART_BYTES, MIN_MAX_PART_TOKENS, PACKAGE_LATEST_URL, PRESETS, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, SCHEMA_VERSION, UP_TO_DATE_INTERVAL_MS, anchorForPath, appendGitignoreEntries, assertPublicHost, assertReplaceable, assertUsableConfigInput, buildImportResolver, bytesForTokens, cacheDirectory, cacheFilePath, checkForUpdate, classifyKind, classifyLayer, cloneRepository, collectFiles, compareManifests, configDigest, countInvalidUtf8Bytes, countLines, crc32, decodeText, defineConfig, detectLanguage, detectPreset, displayPath, displayWidth, enforceBudget, estimateTokens, explainPath, fenceForContent, fenceForText, fetchLatestVersion, findSecretInPath, firstRunMessage, formatTokens, formatUpdateNotice, generateProjectTree, generateSarifReport, generateSnapshot, generateSnapshotAsync, getGitInfo, getPreset, gitignorePath, globToRegExp, hasPriorSnapshot, importsChangedFile, importsOfFile, importsOfText, installKind, installPreCommitHook, isBinaryBuffer, isBinaryExtension, isBinaryFile, isEffectivelyEmpty, isInteractive, isNewer, isPrivateHost, isResolvedConfig, isSensitivePath, isSkeletonizable, isTsxFileName, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, lockPathFor, makeCloneDirectory, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, parseRemoteSource, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveChangedScope, resolveConfig, resolveSafeOutputDirs, resolveSpecifier, runInit, scanAndRedactSecrets, shouldCheck, skeletonizeTypeScript, startWebServer, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, treeTruncationWarnings, truncatePreview, truncateToBytes, tsconfigPathsFor, updateCommand, validateSnapshot, walkFiles, workerEntry, wrapLines, writeZip } from './chunk-
|
|
1
|
+
export { ARTIFACT_NAMES, CHECK_INTERVAL_MS, CONFIG_KEYS, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, FAILURE_INTERVAL_MS, GENERATOR_NAME, GENERATOR_VERSION, HOOK_MARKER, LANGUAGE_PROFILES, MIN_MAX_PART_BYTES, MIN_MAX_PART_TOKENS, PACKAGE_LATEST_URL, PRESETS, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, SCHEMA_VERSION, UP_TO_DATE_INTERVAL_MS, anchorForPath, appendGitignoreEntries, assertPublicHost, assertReplaceable, assertUsableConfigInput, buildImportResolver, bytesForTokens, cacheDirectory, cacheFilePath, checkForUpdate, classifyKind, classifyLayer, cloneRepository, collectFiles, compareManifests, configDigest, countInvalidUtf8Bytes, countLines, crc32, decodeText, defineConfig, detectLanguage, detectPreset, displayPath, displayWidth, enforceBudget, estimateTokens, explainPath, fenceForContent, fenceForText, fetchLatestVersion, findSecretInPath, firstRunMessage, formatTokens, formatUpdateNotice, generateProjectTree, generateSarifReport, generateSnapshot, generateSnapshotAsync, getGitInfo, getPreset, gitignorePath, globToRegExp, hasPriorSnapshot, importsChangedFile, importsOfFile, importsOfText, installKind, installPreCommitHook, isBinaryBuffer, isBinaryExtension, isBinaryFile, isEffectivelyEmpty, isInteractive, isNewer, isPrivateHost, isResolvedConfig, isSensitivePath, isSkeletonizable, isTsxFileName, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, lockPathFor, makeCloneDirectory, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, parseRemoteSource, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveChangedScope, resolveConfig, resolveSafeOutputDirs, resolveSpecifier, runInit, scanAndRedactSecrets, shouldCheck, skeletonizeTypeScript, startWebServer, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, treeTruncationWarnings, truncatePreview, truncateToBytes, tsconfigPathsFor, updateCommand, validateSnapshot, walkFiles, workerEntry, wrapLines, writeZip } from './chunk-PDLN24ZZ.js';
|
package/dist/mcp.cjs
CHANGED
|
@@ -2548,7 +2548,7 @@ function applySpansKeepingQuotes(line, spans) {
|
|
|
2548
2548
|
|
|
2549
2549
|
// src/version.ts
|
|
2550
2550
|
var GENERATOR_NAME = "codebase-snapshot";
|
|
2551
|
-
var GENERATOR_VERSION = "0.
|
|
2551
|
+
var GENERATOR_VERSION = "0.17.0";
|
|
2552
2552
|
var SCHEMA_VERSION = "3.0.0";
|
|
2553
2553
|
var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
|
|
2554
2554
|
function isOurGeneratorName(name) {
|
package/dist/mcp.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { generateToken, startHttpTransport } from './chunk-
|
|
2
|
-
export { ERROR_CODES, LEGACY_PROTOCOL_VERSIONS, MAX_LINE_BYTES, METHOD, MODERN_PROTOCOL_VERSIONS, SERVER_INSTRUCTIONS, SUPPORTED_PROTOCOL_VERSIONS, buildPrompts, buildResourceProvider, buildTools, classifyRequest, coerceNumericStrings, createLineReader, createMcpServer, createServer, createSession, createWriter, findSection, generateInWorker, inspectModernMeta, isCommentStrippable, negotiateLegacyVersion, parsePartSections, runStdioServer, stripComments, validateArguments, windowText } from './chunk-
|
|
1
|
+
export { generateToken, startHttpTransport } from './chunk-VI3JLKPX.js';
|
|
2
|
+
export { ERROR_CODES, LEGACY_PROTOCOL_VERSIONS, MAX_LINE_BYTES, METHOD, MODERN_PROTOCOL_VERSIONS, SERVER_INSTRUCTIONS, SUPPORTED_PROTOCOL_VERSIONS, buildPrompts, buildResourceProvider, buildTools, classifyRequest, coerceNumericStrings, createLineReader, createMcpServer, createServer, createSession, createWriter, findSection, generateInWorker, inspectModernMeta, isCommentStrippable, negotiateLegacyVersion, parsePartSections, runStdioServer, stripComments, validateArguments, windowText } from './chunk-PDLN24ZZ.js';
|
package/docs/answer.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Ask once, get cited context
|
|
2
|
+
|
|
3
|
+
An agent with a question and a token budget has three ways to spend it: guess which files to read,
|
|
4
|
+
run a tool that returns a plan, or run a tool that returns the context itself. `snapshot_answer` is
|
|
5
|
+
the third, and it is the one that answers the question rather than describing how to answer it.
|
|
6
|
+
|
|
7
|
+
## One call
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{ "name": "snapshot_answer", "arguments": { "question": "how does redaction decide what to mask?", "maxTokens": 20000 } }
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The reply is a block: each planned file as a head window with line numbers, the planner reason it
|
|
14
|
+
was chosen, and, under "Not included", every planned file that did not fit with the reason. The
|
|
15
|
+
`usedTokens` figure is measured with the same estimator the manifest uses, so it is comparable with
|
|
16
|
+
every other number this tool prints.
|
|
17
|
+
|
|
18
|
+
## Why not `plan_for` plus `read`?
|
|
19
|
+
|
|
20
|
+
You can do that, and for a large investigation you may want to: the plan is cheaper and lets you
|
|
21
|
+
decide. `snapshot_answer` exists because the common case is one question and a budget, and in that
|
|
22
|
+
case the arithmetic (which file fits, how many lines of it, what to say about the rest) belongs in
|
|
23
|
+
the server, not in every client.
|
|
24
|
+
|
|
25
|
+
| Tool | Returns | Cost |
|
|
26
|
+
| :--- | :--- | :--- |
|
|
27
|
+
| `snapshot_plan_for` | paths, tokens, reasons, no content | cheap |
|
|
28
|
+
| `snapshot_read` | one file window by path and line | medium |
|
|
29
|
+
| `snapshot_answer` | planned windows within one budget, with reasons | medium |
|
|
30
|
+
| `snapshot_budget` | what several budgets would each select | medium |
|
|
31
|
+
|
|
32
|
+
## What it will not do
|
|
33
|
+
|
|
34
|
+
- **It will not invent a path.** Every window comes from a section in `parts/`.
|
|
35
|
+
- **It will not silently truncate.** A file that did not fit is named under "Not included"; a file
|
|
36
|
+
that was cut says `first lines of N`.
|
|
37
|
+
- **It will not read the working tree.** Redaction and exclusions therefore still apply, and a file
|
|
38
|
+
the snapshot excluded cannot be selected by asking nicely.
|
|
39
|
+
- **It will not exceed the budget silently.** If the first planned file alone is larger than the
|
|
40
|
+
budget it is still returned, and the block says `first lines of N`; an empty answer would be
|
|
41
|
+
worse than an oversized one that admits it.
|
|
42
|
+
|
|
43
|
+
## The CLI version of the same question
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npx codebase-snapshot generate --slice "how does redaction decide what to mask?" --slice-tokens 20000
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
That writes a whole snapshot narrowed to the question, with `reports/selection.md` explaining every
|
|
50
|
+
choice. The tool is for an agent that needs the text now; the command is for a reader who wants the
|
|
51
|
+
selection on disk, auditable and reusable.
|
package/docs/cli.md
CHANGED
|
@@ -97,7 +97,7 @@ Exit `0` when the snapshot passes its own integrity check, `1` when it does not.
|
|
|
97
97
|
|
|
98
98
|
```
|
|
99
99
|
📸 Generating snapshot for: /path/to/repo
|
|
100
|
-
Branch: main | Part budget: 300 KB | Generator: 0.
|
|
100
|
+
Branch: main | Part budget: 300 KB | Generator: 0.17.0 (project dependency ^0.17.0)
|
|
101
101
|
|
|
102
102
|
✅ Snapshot generated in 0.14s:
|
|
103
103
|
- Tracked files: 121 included of 128 paths found — 7 skipped (default-ignore 5, binary 1, sensitive-file 1); every one is listed in snapshot/reports/audit.md
|
|
@@ -218,7 +218,7 @@ The whole first run in one command, with defaults and no prompts. This is the sa
|
|
|
218
218
|
🚀 Setup for: /path/to/repo
|
|
219
219
|
✅ Created snapshot.config.ts (preset: nextjs)
|
|
220
220
|
Added npm scripts: snapshot, snapshot:validate
|
|
221
|
-
Added devDependency: codebase-snapshot ^0.
|
|
221
|
+
Added devDependency: codebase-snapshot ^0.17.0
|
|
222
222
|
Added to .gitignore: /snapshot/, /snapshot.tmp/
|
|
223
223
|
⏳ Installing dependencies…
|
|
224
224
|
✅ Installed dependencies (npm install, 2.1s)
|
|
@@ -270,7 +270,7 @@ It also has three side effects on files you own, and it says so when it does the
|
|
|
270
270
|
```
|
|
271
271
|
✅ Created snapshot.config.ts (preset: node-lib)
|
|
272
272
|
Added npm scripts: snapshot, snapshot:validate
|
|
273
|
-
Added devDependency: codebase-snapshot ^0.
|
|
273
|
+
Added devDependency: codebase-snapshot ^0.17.0
|
|
274
274
|
Added to .gitignore: /snapshot/, /snapshot.tmp/
|
|
275
275
|
```
|
|
276
276
|
|
package/docs/deploy.md
CHANGED
|
@@ -61,8 +61,8 @@ After=network.target
|
|
|
61
61
|
Type=oneshot
|
|
62
62
|
User=deploy
|
|
63
63
|
WorkingDirectory=/srv/app
|
|
64
|
-
ExecStart=/usr/bin/npx -y codebase-snapshot@0.
|
|
65
|
-
ExecStartPost=/usr/bin/npx -y codebase-snapshot@0.
|
|
64
|
+
ExecStart=/usr/bin/npx -y codebase-snapshot@0.17.0 generate --cwd /srv/app
|
|
65
|
+
ExecStartPost=/usr/bin/npx -y codebase-snapshot@0.17.0 validate --cwd /srv/app
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
```ini
|
package/docs/mcp.md
CHANGED
|
@@ -10,7 +10,7 @@ walk — that the client sees.
|
|
|
10
10
|
## Start it
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
npx -y codebase-snapshot@0.
|
|
13
|
+
npx -y codebase-snapshot@0.17.0 mcp
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
The server serves the directory it was started in. `--cwd <path>` points it elsewhere, and that
|
|
@@ -25,7 +25,7 @@ Claude Desktop and Cursor:
|
|
|
25
25
|
"mcpServers": {
|
|
26
26
|
"codebase-snapshot": {
|
|
27
27
|
"command": "npx",
|
|
28
|
-
"args": ["-y", "codebase-snapshot@0.
|
|
28
|
+
"args": ["-y", "codebase-snapshot@0.17.0", "mcp", "--cwd", "/absolute/path/to/repo"]
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -34,7 +34,7 @@ Claude Desktop and Cursor:
|
|
|
34
34
|
Claude Code registers the same thing from a shell:
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
claude mcp add codebase-snapshot -- npx -y codebase-snapshot@0.
|
|
37
|
+
claude mcp add codebase-snapshot -- npx -y codebase-snapshot@0.17.0 mcp --cwd /absolute/path/to/repo
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
On Windows, wrap the command as `cmd /c npx` with the same arguments — `npx` is a `.cmd` shim
|
|
@@ -43,7 +43,7 @@ there, and clients that spawn without a shell cannot execute it directly.
|
|
|
43
43
|
## Over HTTP, for clients that cannot spawn a process
|
|
44
44
|
|
|
45
45
|
```bash
|
|
46
|
-
npx -y codebase-snapshot@0.
|
|
46
|
+
npx -y codebase-snapshot@0.17.0 mcp --http --port 4789
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
This is the Streamable HTTP shape: POST one JSON-RPC message (or an array) to `/mcp` and read
|
package/docs/migration.md
CHANGED
|
@@ -60,6 +60,25 @@ one port with `serve`.
|
|
|
60
60
|
you pin an exact patch version, install from the git tag or build from source until the next
|
|
61
61
|
minor.
|
|
62
62
|
|
|
63
|
+
## What changed after 0.12.x
|
|
64
|
+
|
|
65
|
+
The line from `0.13.0` to `0.17.0` added checks and two tools; it removed nothing. What a reader
|
|
66
|
+
upgrading across those milestones should know:
|
|
67
|
+
|
|
68
|
+
| Change | Since | Why it matters to you |
|
|
69
|
+
| :--- | :--- | :--- |
|
|
70
|
+
| The audit verifies bodies and counts | 0.13.6-0.13.7 | A snapshot whose parts disagree with its manifest now scores below 100 — correctly. Regenerate if a hand-edited snapshot fails. |
|
|
71
|
+
| Single-file packs are audited | 0.13.9-0.13.10 | JSON, XML and markdown packs must hold exactly the manifest's files. |
|
|
72
|
+
| `GET /metrics` on the HTTP transport | 0.13.3 | Prometheus text: request totals, per-method counts, refusals, rate limits. No path or credential is a label. |
|
|
73
|
+
| `--only` / `--ignore` | 0.14.6 | One-run narrowing without editing a config. Both enter the digest, so `validate` takes them too. |
|
|
74
|
+
| `reports/selection.md` | 0.15.3 | Written for `--slice` and `--budget-tokens`; it is a recorded artifact, so editing it is drift. |
|
|
75
|
+
| `snapshot_budget` | 0.15.2 | The planner at several budgets; the manifest also records `headroomTokens` and `nextInLine`. |
|
|
76
|
+
| `snapshot_answer` | 0.15.5 | Question to cited, line-numbered windows in one call. |
|
|
77
|
+
| 26 MCP tools | 0.15.5 | The tool count is documented and tested; a client that hard-coded 15 should read `tools/list`. |
|
|
78
|
+
|
|
79
|
+
`validate` on a snapshot written by an older version still works: the new manifest keys are
|
|
80
|
+
optional, and an artifact the manifest does not record is not required to exist.
|
|
81
|
+
|
|
63
82
|
## If you are on an older 0.12.x
|
|
64
83
|
|
|
65
84
|
Upgrade to the latest 0.12.x first; every change since 0.12.14 is a patch on the same line, and the
|
package/docs/security-review.md
CHANGED
|
@@ -78,6 +78,26 @@ file content faithfully, and **this tool cannot sanitise prose without changing
|
|
|
78
78
|
carry**. The brief says what the snapshot is and what it omits, and the security prompt tells an agent
|
|
79
79
|
to treat file content as data. This is a real, documented limitation, not a solved problem.
|
|
80
80
|
|
|
81
|
+
## What changed since this review was written
|
|
82
|
+
|
|
83
|
+
The review was written at 0.12.34. Between then and 0.17.0 the surfaces it covers grew; each
|
|
84
|
+
addition was reviewed with the same question — what new input arrives, and what does it reach?
|
|
85
|
+
|
|
86
|
+
- **`GET /metrics`** (0.13.3) publishes counters with a fixed label set. Repo paths, tokens and
|
|
87
|
+
query strings are not labels, so the endpoint cannot leak what the snapshot redacted.
|
|
88
|
+
- **The web server's allowed roots** (0.12.46, tightened since): `/api/snapshot`, `/snapshot.zip`
|
|
89
|
+
and `/api/health` answer 403 for an output directory outside the working directory or a clone
|
|
90
|
+
this process created, so the page cannot be pointed at an arbitrary path on disk.
|
|
91
|
+
- **The audit stopped trusting the manifest** (0.13.6-0.13.10): bodies, counts and pack membership
|
|
92
|
+
are recomputed. An attacker who edits a part and updates its hash, or edits a manifest count,
|
|
93
|
+
now fails the audit; before, both passed. This turns a tampered snapshot into a detected one.
|
|
94
|
+
- **`snapshot_answer`** (0.15.5) reads only `parts/` through the same parser, so redaction and
|
|
95
|
+
exclusions apply exactly as they do to `snapshot_read`; it adds no file-system surface.
|
|
96
|
+
- **`--only`/`--ignore`** (0.14.6) widen nothing: `--ignore` adds excludes, and `--only` can only
|
|
97
|
+
narrow the allow-list the config already permits. Sensitive files stay excluded by default.
|
|
98
|
+
|
|
99
|
+
The residual risks below are unchanged, including the two that are deliberate rather than solved.
|
|
100
|
+
|
|
81
101
|
## What the test suite pins
|
|
82
102
|
|
|
83
103
|
| Property | Test |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codebase-snapshot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "Create a codebase snapshot an LLM can read: budgeted Markdown parts for Claude, ChatGPT and Cursor, a manifest of every included and skipped file, secret redaction, and validate, which fails when the snapshot drifts. Local CLI and MCP server.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codebase-snapshot",
|