codebase-snapshot 0.15.0 → 0.16.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/dist/mcp.d.ts CHANGED
@@ -166,7 +166,7 @@ interface ToolContext {
166
166
  * Client-facing hints.
167
167
  *
168
168
  * `readOnlyHint` is the one that changes behaviour rather than appearance: clients use it to
169
- * auto-approve a call. Seven of the 24 tools never touch the filesystem, so they are marked
169
+ * auto-approve a call. Seven of the 26 tools never touch the filesystem, so they are marked
170
170
  * read-only and only `snapshot_generate` prompts.
171
171
  */
172
172
  interface ToolAnnotations {
package/dist/mcp.js CHANGED
@@ -1,2 +1,2 @@
1
- export { generateToken, startHttpTransport } from './chunk-4OHQULCV.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-KHHUC6UT.js';
1
+ export { generateToken, startHttpTransport } from './chunk-ZDTAWUD4.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-AEGJYOCF.js';
@@ -522,6 +522,8 @@ interface Manifest {
522
522
  prompt?: ManifestArtifact;
523
523
  navigation?: ManifestArtifact;
524
524
  projectTree?: ManifestArtifact;
525
+ /** Why a slice or budget snapshot holds what it holds (written only when narrowed). */
526
+ selection?: ManifestArtifact;
525
527
  audit?: ManifestArtifact;
526
528
  /** `reports/diff.md`, when `diff` was requested and the repository had changes. */
527
529
  diff?: ManifestArtifact;
@@ -578,6 +580,13 @@ interface Manifest {
578
580
  total: number;
579
581
  };
580
582
  };
583
+ /** Tokens left unspent in the budget. */
584
+ headroomTokens?: number;
585
+ /** The next files a larger budget would take, in the order it would take them. */
586
+ nextInLine?: Array<{
587
+ path: string;
588
+ tokens: number;
589
+ }>;
581
590
  /** Paths chosen, in the order they were selected. */
582
591
  files: string[];
583
592
  /** Scanned paths that did not fit. */
@@ -522,6 +522,8 @@ interface Manifest {
522
522
  prompt?: ManifestArtifact;
523
523
  navigation?: ManifestArtifact;
524
524
  projectTree?: ManifestArtifact;
525
+ /** Why a slice or budget snapshot holds what it holds (written only when narrowed). */
526
+ selection?: ManifestArtifact;
525
527
  audit?: ManifestArtifact;
526
528
  /** `reports/diff.md`, when `diff` was requested and the repository had changes. */
527
529
  diff?: ManifestArtifact;
@@ -578,6 +580,13 @@ interface Manifest {
578
580
  total: number;
579
581
  };
580
582
  };
583
+ /** Tokens left unspent in the budget. */
584
+ headroomTokens?: number;
585
+ /** The next files a larger budget would take, in the order it would take them. */
586
+ nextInLine?: Array<{
587
+ path: string;
588
+ tokens: number;
589
+ }>;
581
590
  /** Paths chosen, in the order they were selected. */
582
591
  files: string[];
583
592
  /** Scanned paths that did not fit. */
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.15.0 (project dependency ^0.15.0)
100
+ Branch: main | Part budget: 300 KB | Generator: 0.16.0 (project dependency ^0.16.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.15.0
221
+ Added devDependency: codebase-snapshot ^0.16.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.15.0
273
+ Added devDependency: codebase-snapshot ^0.16.0
274
274
  Added to .gitignore: /snapshot/, /snapshot.tmp/
275
275
  ```
276
276
 
@@ -450,7 +450,7 @@ codebase-snapshot mcp # serve the current directory over stdio
450
450
  codebase-snapshot mcp --cwd <path> # serve another repository
451
451
  ```
452
452
 
453
- Serves the repository to a Model Context Protocol client over stdio: 24 tools, `snapshot://`
453
+ Serves the repository to a Model Context Protocol client over stdio: 26 tools, `snapshot://`
454
454
  resources and two prompts. Stdout carries JSON-RPC messages and nothing else; every note goes to
455
455
  stderr. It speaks both protocol eras — the legacy `initialize` handshake and the stateless
456
456
  `2026-07-28` revision — and answers whichever the client starts with.
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.15.0 generate --cwd /srv/app
65
- ExecStartPost=/usr/bin/npx -y codebase-snapshot@0.15.0 validate --cwd /srv/app
64
+ ExecStart=/usr/bin/npx -y codebase-snapshot@0.16.0 generate --cwd /srv/app
65
+ ExecStartPost=/usr/bin/npx -y codebase-snapshot@0.16.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.15.0 mcp
13
+ npx -y codebase-snapshot@0.16.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.15.0", "mcp", "--cwd", "/absolute/path/to/repo"]
28
+ "args": ["-y", "codebase-snapshot@0.16.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.15.0 mcp --cwd /absolute/path/to/repo
37
+ claude mcp add codebase-snapshot -- npx -y codebase-snapshot@0.16.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.15.0 mcp --http --port 4789
46
+ npx -y codebase-snapshot@0.16.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
@@ -92,7 +92,7 @@ into logs and is documented as such. A heartbeat every 15 s keeps the connection
92
92
  shutdown ends the streams rather than waiting on them. Request bodies are capped at 2 MB, the rate is
93
93
  capped at 60 requests per 10 seconds per address, and every response is one bounded JSON document.
94
94
 
95
- ## The 24 tools
95
+ ## The 26 tools
96
96
 
97
97
  Each tool has an entry with a ready-to-send call in the [tool reference](tools.md).
98
98
 
@@ -107,6 +107,8 @@ between them should not have to guess.
107
107
  | `snapshot_status` | Is there a snapshot, when was it built, what does it cover? | no |
108
108
  | `snapshot_health` | Does the written snapshot match its manifest, carry any secret or host path, and cost what it claims? `maxScanBytes` bounds the text scan. | no |
109
109
  | `snapshot_query` | Filter the index by layer, kind, path pattern or symbol | no |
110
+ | `snapshot_answer` | Question to cited, line-numbered windows within a budget | no |
111
+ | `snapshot_budget` | Planner output at several budgets: what raising the budget would add | no |
110
112
  | `snapshot_history` | The commits the snapshot was built from (reads `reports/log.md`) | no |
111
113
  | `snapshot_tests` | The tests that import a file (or every test and what it covers) | no |
112
114
  | `snapshot_workspace` | The members of a multi-repository workspace and the imports that cross between them | no |
package/docs/slice.md CHANGED
@@ -38,6 +38,14 @@ Every path that was scanned and not chosen is in `skipped[]` with reason `not-se
38
38
  `unchanged`, which would be a different and untrue statement. The brief says at the top that the
39
39
  snapshot is a slice, quotes the question, and warns that unselected paths are not in the parts.
40
40
 
41
+ ## The snapshot explains its own selection
42
+
43
+ A slice writes `reports/selection.md`: the question, the budget, every chosen file with its token
44
+ cost and the reason it was chosen, how many files were left out, and — for `--budget-tokens` — the
45
+ files a larger budget would buy next, with their costs. The same numbers are in the manifest
46
+ (`slice`, `budget.headroomTokens`, `budget.nextInLine`), and `validate` checks the report like any
47
+ other artifact, so an edited report is drift.
48
+
41
49
  ## What it does not do
42
50
 
43
51
  - It does not read files that were excluded: sensitive files stay out, so a question about them
package/docs/tools.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MCP tools
2
2
 
3
- The server exposes 24 tools. This page is the reference: what each answers, what it costs, and one
3
+ The server exposes 26 tools. This page is the reference: what each answers, what it costs, and one
4
4
  call you can send as it stands. [MCP](mcp.md) covers the transports and the protocol; this page is
5
5
  the catalogue.
6
6
 
@@ -66,6 +66,18 @@ Every tool is read-only unless it says **writes**. Cost is the class `tools/list
66
66
 
67
67
  ## Reading
68
68
 
69
+ - **`snapshot_answer`** — medium, read-only. One call from question to context: plans the
70
+ question, then returns each chosen file as a head window with line numbers inside the token
71
+ budget. Every file says why it is there; every planned file that did not fit says why not.
72
+ ```json
73
+ { "name": "snapshot_answer", "arguments": { "question": "how does redaction work", "maxTokens": 20000 } }
74
+ ```
75
+ - **`snapshot_budget`** — medium, read-only. The planner at several budgets, with what each
76
+ one adds: files, tokens used, and the paths gained over the previous budget. The answer to
77
+ "should I raise the budget, and what would I get?"
78
+ ```json
79
+ { "name": "snapshot_budget", "arguments": { "budgets": [10000, 30000, 60000] } }
80
+ ```
69
81
  - **`snapshot_history`** — cheap, read-only. The commits behind the snapshot, from
70
82
  `reports/log.md`; says how to generate the report when it is absent.
71
83
  ```json
@@ -29,7 +29,7 @@ If you want the most popular, most integrated tool: **use repomix.**
29
29
  | Reproducible output | Parts are byte-identical across runs; a fingerprint covers them | Content is stable; no published determinism guarantee |
30
30
  | Staleness check | `validate` re-hashes the repository and exits non-zero on drift | Not a feature |
31
31
  | Remote repositories | No — operates on a local checkout | **Yes** — packs a GitHub URL directly |
32
- | MCP server | **Yes** — 24 tools over stdio, and it serves the validated snapshot rather than the working tree | **Yes** — packs a repository, including by URL |
32
+ | MCP server | **Yes** — 26 tools over stdio, and it serves the validated snapshot rather than the working tree | **Yes** — packs a repository, including by URL |
33
33
  | Secret handling | 32 default rules, value-span masking, per-line audit table | Secretlint integration |
34
34
  | Language awareness | 25 presets, AST or structural summaries labelled by confidence | Tree-sitter parsing with a compression mode |
35
35
  | Adoption | New | **Mature** — large user base, many integrations |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codebase-snapshot",
3
- "version": "0.15.0",
3
+ "version": "0.16.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",