codebase-snapshot 0.14.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/CHANGELOG.md +184 -0
- package/README.md +3 -3
- package/SECURITY.md +2 -2
- package/dist/bin.js +341 -10
- package/dist/{chunk-2YNQ42B3.js → chunk-AEGJYOCF.js} +326 -10
- package/dist/{chunk-7WSZUMT6.js → chunk-ZDTAWUD4.js} +1 -1
- package/dist/cli.cjs +341 -10
- package/dist/cli.d.cts +11 -1
- package/dist/cli.d.ts +11 -1
- package/dist/cli.js +18 -3
- package/dist/index.cjs +326 -10
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +248 -9
- package/dist/mcp.d.cts +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +2 -2
- package/dist/{types-CbD8yQRZ.d.cts → types-Cr5H2Y3t.d.cts} +13 -0
- package/dist/{types-CbD8yQRZ.d.ts → types-Cr5H2Y3t.d.ts} +13 -0
- package/docs/benchmarks.md +54 -9
- package/docs/cli.md +7 -5
- package/docs/deploy.md +2 -2
- package/docs/mcp.md +7 -5
- package/docs/slice.md +8 -0
- package/docs/tools.md +16 -2
- package/docs/vs-repomix.md +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -30,6 +30,190 @@ deprecated with an explanatory message instead. `latest` has pointed at 0.9.0 si
|
|
|
30
30
|
|
|
31
31
|
---
|
|
32
32
|
|
|
33
|
+
## 0.16.0
|
|
34
|
+
|
|
35
|
+
**Things neither competitor has.**
|
|
36
|
+
|
|
37
|
+
Parity was the floor. This milestone is what the snapshot does that repomix and gitingest do not:
|
|
38
|
+
|
|
39
|
+
- **Selections, not dumps.** `--slice "question"`, `--budget-tokens N` and `--delta <base>` each
|
|
40
|
+
narrow the snapshot to what answers a question, fits a budget, or changed. The three are mutually
|
|
41
|
+
exclusive on purpose: each is a different claim, and letting two win silently would make the
|
|
42
|
+
manifest describe a selection nobody asked for.
|
|
43
|
+
- **The selection explains itself.** `reports/selection.md` (0.15.3) lists every chosen file with its
|
|
44
|
+
cost and reason, what was left out, and what a larger budget would buy next; it is a recorded
|
|
45
|
+
artifact, so `validate` treats an edited one as drift.
|
|
46
|
+
- **Budgets answer "what if".** `snapshot_budget` (0.15.2) runs the planner at several budgets and
|
|
47
|
+
reports what each adds; the manifest records `headroomTokens` and `nextInLine`.
|
|
48
|
+
- **Question in, cited context out.** `snapshot_answer` (0.15.5) plans a question and returns
|
|
49
|
+
line-numbered windows within one budget, each with its reason, every omission named.
|
|
50
|
+
- **Multi-repo workspaces** with `WORKSPACE.json`, cross-member import links and a workspace-wide
|
|
51
|
+
audit (`health --all-members`).
|
|
52
|
+
- **Signed manifests** (Ed25519) behind `--sign`, verified by `validate` and the audit.
|
|
53
|
+
- **An audit that proves the manifest** rather than trusting it: bodies, counts, packs, the workspace
|
|
54
|
+
index, host paths and secrets — the work of 0.14.x, now part of what a snapshot is.
|
|
55
|
+
|
|
56
|
+
### The shape of the whole
|
|
57
|
+
|
|
58
|
+
A reader should be able to take a snapshot and answer three questions without the working tree:
|
|
59
|
+
what is in it (manifest, navigation, tree), why it is in it (selection report, skip records), and
|
|
60
|
+
whether it is what it says it is (hashes, signatures, audit). None of the three depends on the other
|
|
61
|
+
two agreeing by accident.
|
|
62
|
+
|
|
63
|
+
### How it was verified
|
|
64
|
+
|
|
65
|
+
Full `npm run verify`: 1333 tests, 1325 pass, 0 fail, 8 host skips; 29 site pages with no link or
|
|
66
|
+
metadata problems; a 52-file tarball whose lockfile agrees with `package.json`. The new tools are
|
|
67
|
+
pinned by tests that call them over the real MCP registry, and the docs/schema parity test fails if a
|
|
68
|
+
tool is documented but absent or present but undocumented.
|
|
69
|
+
## 0.15.5
|
|
70
|
+
|
|
71
|
+
**`snapshot_answer`: question in, cited context out, in one call.**
|
|
72
|
+
|
|
73
|
+
- The 26th tool. `snapshot_plan_for` says which files to read and `snapshot_read` returns one of
|
|
74
|
+
them; an agent that wants an answer had to make a call per file and do its own budget arithmetic.
|
|
75
|
+
`snapshot_answer` plans the question, then returns each chosen file as a head window with line
|
|
76
|
+
numbers, within one token budget.
|
|
77
|
+
- Every included file carries its `why` from the planner. Every planned file that did not fit is
|
|
78
|
+
listed under "Not included" with the reason — the budget, a missing part, or a missing section —
|
|
79
|
+
so a truncated answer never looks like a complete one.
|
|
80
|
+
- The block is measured with the same estimator as the manifest, so `usedTokens` is comparable with
|
|
81
|
+
every other token figure this tool prints.
|
|
82
|
+
|
|
83
|
+
Verified: a question about a fixture module returns line-numbered windows, each with a reason;
|
|
84
|
+
`usedTokens` stays within the requested budget.
|
|
85
|
+
## 0.15.4
|
|
86
|
+
|
|
87
|
+
- The goal log records the 0.15.2-0.15.3 round: `snapshot_budget`, budget headroom and `nextInLine`,
|
|
88
|
+
and `reports/selection.md` for narrowed snapshots.
|
|
89
|
+
- `AGENTS.md` said the MCP server exposes 21 tools; it exposes 25. The count is part of the contract
|
|
90
|
+
and a wrong one is a lie, however small.
|
|
91
|
+
## 0.15.3
|
|
92
|
+
|
|
93
|
+
**A narrowed snapshot explains itself.**
|
|
94
|
+
|
|
95
|
+
- A slice or a budget now writes `reports/selection.md`: the question and budget, every chosen file
|
|
96
|
+
with its token cost and the reason it was chosen, the count of files left out, and for a budget
|
|
97
|
+
the files a larger budget would buy next. The numbers come from the manifest blocks, so the report
|
|
98
|
+
and the data cannot drift.
|
|
99
|
+
- The report is a recorded artifact: `validate` fails when it is edited or deleted, and the audit
|
|
100
|
+
expects it only when the manifest records it.
|
|
101
|
+
|
|
102
|
+
Verified: `--slice` writes the question and the chosen path; `--budget-tokens 500` names the
|
|
103
|
+
headroom and the next files; appending one line to the report makes `validate` fail with the path.
|
|
104
|
+
## 0.15.2
|
|
105
|
+
|
|
106
|
+
**Budgets answer "what if", not only "what fits".**
|
|
107
|
+
|
|
108
|
+
- **`snapshot_budget`, the 25th tool**: run the planner at several budgets and report what each one
|
|
109
|
+
adds — files, tokens used, and the paths gained over the previous budget. The question a budget
|
|
110
|
+
raises ("should I raise it, and what would I get?") is now answerable without writing a snapshot.
|
|
111
|
+
- The budget block in the manifest records `headroomTokens` and `nextInLine` — the files a larger
|
|
112
|
+
budget would take, in the order it would take them. `report` prints both, so the CLI shows the same
|
|
113
|
+
answer as the tool.
|
|
114
|
+
|
|
115
|
+
Verified: a 500-token budget on a fixture selects 3 of 8 files, reports 2 tokens of headroom and
|
|
116
|
+
names the next six by cost; `snapshot_budget` at 500 and 5,000 returns a superset with the gained
|
|
117
|
+
paths listed.
|
|
118
|
+
## 0.15.1
|
|
119
|
+
|
|
120
|
+
- The goal log records the third published milestone: 0.15.0 tagged, released on GitHub and
|
|
121
|
+
published to npm (`latest` at 01:33Z). `ROADMAP.md` marks it published.
|
|
122
|
+
## 0.15.0
|
|
123
|
+
|
|
124
|
+
**Parity, measured on someone else's repositories.**
|
|
125
|
+
|
|
126
|
+
0.15.x was the parity phase, and the honest test of parity is not a feature list — it is running the
|
|
127
|
+
same repositories through both tools and publishing what happened.
|
|
128
|
+
|
|
129
|
+
- **Ten public repositories, three tools, one command** (`scripts/benchmark-suite.mjs`): is-odd,
|
|
130
|
+
chalk, co, minimatch, luxon, requests, click, express, zod and github-readme-stats, cloned shallow
|
|
131
|
+
and packed by this tool, repomix 1.19.0 and gitingest. Nine of ten land within about plus or minus
|
|
132
|
+
30% of repomix's own token count. The tenth, minimatch, is a policy difference: five 20–25 MB
|
|
133
|
+
benchmark fixtures are emitted by repomix (64.8M tokens) and bounded-previewed by us (319,879).
|
|
134
|
+
The page says which is which instead of celebrating a ratio.
|
|
135
|
+
- **`--only` and `--ignore`** narrow a single run without editing a configuration: `--only` replaces
|
|
136
|
+
the allow-list, `--ignore` adds to the deny-list, and both enter the config digest so `validate`
|
|
137
|
+
and `explain` compare like with like. An ignored path is recorded in `skipped[]`, never dropped.
|
|
138
|
+
- **gitingest runs in the harness** now, with `PYTHONIOENCODING=utf-8` for the child process;
|
|
139
|
+
without it, gitingest aborts on Windows while printing its tree and the comparison silently
|
|
140
|
+
degrades to two tools.
|
|
141
|
+
|
|
142
|
+
### What parity means here
|
|
143
|
+
|
|
144
|
+
Feature-for-feature, the floor is covered: diffs, logs, a token tree, single-file packs in three
|
|
145
|
+
formats, comment stripping, blank-line stripping, and structural parsers for seven non-TypeScript
|
|
146
|
+
languages. What is different is deliberate and stated: a selection (slice, budget, delta) that neither
|
|
147
|
+
competitor produces, an audit that verifies the manifest instead of trusting it, and a token estimate
|
|
148
|
+
that is documented as an estimate.
|
|
149
|
+
|
|
150
|
+
### How it was verified
|
|
151
|
+
|
|
152
|
+
Full `npm run verify`: 1328 tests, 1320 pass, 0 fail, 8 host skips; 29 site pages with no link or
|
|
153
|
+
metadata problems; a 52-file tarball whose lockfile agrees with `package.json`. The ten-repository
|
|
154
|
+
run is reproducible with one command and reports its own skips.
|
|
155
|
+
## 0.14.6
|
|
156
|
+
|
|
157
|
+
**Per-run narrowing: `--only` and `--ignore`.**
|
|
158
|
+
|
|
159
|
+
- Both tools this is measured against let one run narrow the files without editing a config. This
|
|
160
|
+
tool did not: `--include`/`--exclude` only wrote settings into a config during `init`/`setup`.
|
|
161
|
+
- `--only <globs>` **replaces** the include allow-list for the run; `--ignore <globs>` **adds to** the
|
|
162
|
+
exclude list. The directions differ on purpose — a narrower allow-list is a statement about the
|
|
163
|
+
whole run, while "also ignore this" is naturally cumulative with what the config already denies.
|
|
164
|
+
- Both enter the config digest, so `validate` and `explain` accept them and need them to compare like
|
|
165
|
+
with like; an ignored path is recorded in `skipped[]`, not dropped.
|
|
166
|
+
|
|
167
|
+
Verified: an ignored file disappears from `files[]` and appears in `skipped[]`; `validate` with the
|
|
168
|
+
same flag passes and without it reports drift; `explain --ignore` answers "excluded".
|
|
169
|
+
## 0.14.5
|
|
170
|
+
|
|
171
|
+
**Ten public repositories, three tools, one run.**
|
|
172
|
+
|
|
173
|
+
- `scripts/benchmark-suite.mjs` shallow-clones a list of repositories, packs each with this tool,
|
|
174
|
+
repomix and gitingest, and prints one table (or `--json`). A repository it cannot clone is a skip
|
|
175
|
+
with the reason, never a missing row.
|
|
176
|
+
- `docs/benchmarks.md` carries the run: ten repositories from `jonschlinkert/is-odd` (5,450 tokens)
|
|
177
|
+
to `colinhacks/zod` (1.76M). Nine of ten land within about plus or minus 30% of repomix's own
|
|
178
|
+
token count — expected for two estimators.
|
|
179
|
+
- The tenth is the interesting one: `isaacs/minimatch` holds five 20–25 MB benchmark fixtures.
|
|
180
|
+
repomix emits them (64.8M tokens); our large-file rule emits a bounded preview and records the
|
|
181
|
+
omission, so the pack is 319,879 tokens. The page says exactly that instead of celebrating a ratio
|
|
182
|
+
that a policy difference produced.
|
|
183
|
+
|
|
184
|
+
Verified: the suite runs end to end, and a test pins that an uncloneable input becomes a skip with
|
|
185
|
+
its reason.
|
|
186
|
+
## 0.14.4
|
|
187
|
+
|
|
188
|
+
- The goal log records the 0.14.2-0.14.3 round. `ROADMAP.md` marks item 27 (`--remove-empty-lines`)
|
|
189
|
+
and item 33 (call-site evidence) as shipped, and item 36 as measured three ways on this repository
|
|
190
|
+
with ten public repositories still to run.
|
|
191
|
+
## 0.14.3
|
|
192
|
+
|
|
193
|
+
- **`snapshot_symbol` reports call sites.** The definition says what a symbol is; the call sites say
|
|
194
|
+
who depends on it. Unless `references: false`, the tool scans the parts (never the working tree) for
|
|
195
|
+
the name, bounded by `MAX_SEARCH_BYTES` and `maxReferences` (default 20), and returns path, line and
|
|
196
|
+
the line text — marking the definition line itself.
|
|
197
|
+
- Case-sensitive matching on purpose: a case-insensitive scan of a common word is noise. Import lines
|
|
198
|
+
count as sites, which is why a rename sees them.
|
|
199
|
+
|
|
200
|
+
Verified: a call in `src/auth.ts` is reported with its line, the import line is included, and
|
|
201
|
+
`references: false` skips the scan.
|
|
202
|
+
## 0.14.2
|
|
203
|
+
|
|
204
|
+
- **The comparison harness runs gitingest, and now does.** `--gitingest` reported "not available" here
|
|
205
|
+
because gitingest aborts on Windows with `charmap codec can't encode` while printing its tree; the
|
|
206
|
+
harness sets `PYTHONIOENCODING=utf-8` for that child process and it completes.
|
|
207
|
+
- `docs/benchmarks.md` carries the three-way table from a real run: our full pack 336 files /
|
|
208
|
+
1,060,727 estimated tokens, repomix 335 / 888,168, gitingest 3.12 MB of digest with no token count.
|
|
209
|
+
The caveats say which numbers are comparable (bytes) and which are not (tokenizers).
|
|
210
|
+
|
|
211
|
+
## 0.14.1
|
|
212
|
+
|
|
213
|
+
- The goal log records the second published milestone: 0.14.0 tagged, released on GitHub and
|
|
214
|
+
published to npm (the registry reports `latest = 0.14.0`), after the same few-minute processing
|
|
215
|
+
window that 0.13.0 had. `ROADMAP.md` marks it published.
|
|
216
|
+
|
|
33
217
|
## 0.14.0
|
|
34
218
|
|
|
35
219
|
**The audit now proves the manifest, instead of trusting it.**
|
package/README.md
CHANGED
|
@@ -210,13 +210,13 @@ 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.16.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
|
|
217
217
|
workflow, and produce a validated snapshot unaided — that path is covered by a test.
|
|
218
218
|
|
|
219
|
-
The MCP server exposes
|
|
219
|
+
The MCP server exposes 26 tools — status, health, entrypoints, neighbors, routes, cycles, stats, search, review, symbol, diff_context, context, query, plan_for, plan, generate, validate, locate, dependents, read, explain — plus
|
|
220
220
|
`snapshot://` resources and two prompts. Its reads come from the snapshot rather than the working
|
|
221
221
|
tree, so an excluded file stays excluded and a redacted value stays redacted, and
|
|
222
222
|
`snapshot_validate` answers the question an agent otherwise cannot ask: is the context I was given
|
|
@@ -283,7 +283,7 @@ others.
|
|
|
283
283
|
| [Token budget](https://github.com/ankurhalder/codebase-snapshot/blob/main/docs/budget.md) | `--budget-tokens`: whole files chosen to fit a limit, not torn to fit a part |
|
|
284
284
|
| [The brief](https://github.com/ankurhalder/codebase-snapshot/blob/main/docs/brief.md) | The half of PROMPT.md only you can write, and what is refused |
|
|
285
285
|
| [AI agents](https://github.com/ankurhalder/codebase-snapshot/blob/main/docs/agent.md) | The contract, the skill, what an agent should avoid |
|
|
286
|
-
| [MCP server](https://github.com/ankurhalder/codebase-snapshot/blob/main/docs/mcp.md) |
|
|
286
|
+
| [MCP server](https://github.com/ankurhalder/codebase-snapshot/blob/main/docs/mcp.md) | 26 tools, resources, both protocol eras |
|
|
287
287
|
| [Troubleshooting](https://github.com/ankurhalder/codebase-snapshot/blob/main/docs/troubleshooting.md) | Every message and what to do about it |
|
|
288
288
|
| [Changelog](https://github.com/ankurhalder/codebase-snapshot/blob/main/CHANGELOG.md) | Release history and breaking changes |
|
|
289
289
|
|
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.16<!--/@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.16<!--/@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
|