codebase-snapshot 0.10.0 → 0.10.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 +99 -1
- package/README.md +3 -2
- package/dist/bin.js +603 -406
- package/dist/{chunk-EP7OCPUM.js → chunk-5AV7OR3J.js} +377 -184
- package/dist/{chunk-4H7MSW64.js → chunk-5EYBTBFY.js} +25 -29
- package/dist/cli.cjs +602 -406
- package/dist/cli.d.cts +11 -9
- package/dist/cli.d.ts +11 -9
- package/dist/cli.js +15 -7
- package/dist/{generate-worker-D_mUjgXw.d.cts → generate-worker-BK4uJx7Z.d.cts} +17 -8
- package/dist/{generate-worker-D_mUjgXw.d.ts → generate-worker-BK4uJx7Z.d.ts} +17 -8
- package/dist/index.cjs +353 -177
- package/dist/index.d.cts +68 -23
- package/dist/index.d.ts +68 -23
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +454 -2695
- package/dist/mcp.d.cts +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +2 -2
- package/dist/{types-Z471HW65.d.cts → types-BoWneA7n.d.cts} +35 -4
- package/dist/{types-Z471HW65.d.ts → types-BoWneA7n.d.ts} +35 -4
- package/docs/cli.md +29 -8
- package/docs/codebase-token-budget.md +16 -12
- package/docs/configuration.md +19 -3
- package/docs/how-to-context-budget.md +2 -1
- package/docs/how-to-feed-a-repo-to-claude.md +3 -2
- package/docs/mcp.md +4 -4
- package/docs/output.md +9 -6
- package/docs/stale-context-is-your-bug.md +14 -4
- package/docs/vs-code2prompt.md +4 -3
- package/docs/vs-gitingest.md +5 -4
- package/docs/vs-repomix.md +4 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -23,6 +23,104 @@ deprecated with an explanatory message instead. `latest` has pointed at 0.9.0 si
|
|
|
23
23
|
|
|
24
24
|
---
|
|
25
25
|
|
|
26
|
+
## 0.10.2
|
|
27
|
+
|
|
28
|
+
Every finding from the 0.10.1 deep analysis, fixed and verified. The report that produced the list
|
|
29
|
+
is `audit/reports/0.10.1-code-analysis.md`; the finding-to-fix mapping is `audit/work/fix-log.md`.
|
|
30
|
+
|
|
31
|
+
This is a patch release, but three of the fixes change something a script can observe. They are
|
|
32
|
+
listed first rather than buried, because each is the point of its fix.
|
|
33
|
+
|
|
34
|
+
**Upgrading.** `validate` now fails a manifest whose `incomplete[]` and `files[]` disagree — a
|
|
35
|
+
hand-edited or foreign `manifest.json` that used to report "valid and up to date" is refused, which
|
|
36
|
+
is the point. `partitionFiles` (a library export) now throws for a byte budget below the 2 610 B a
|
|
37
|
+
part header needs, instead of silently clamping it to that size. A new built-in secret rule, the
|
|
38
|
+
32nd, masks a quoted value whose closing quote is missing, so a snapshot that used to emit such a
|
|
39
|
+
line now carries the marker — and one more line in `totals.redactedLines`. No option was added or
|
|
40
|
+
removed, and no existing manifest field changed meaning.
|
|
41
|
+
|
|
42
|
+
**Security**
|
|
43
|
+
|
|
44
|
+
- A quoted assignment whose closing quote is not on the line (`API_KEY="value` in a truncated file,
|
|
45
|
+
a hand-edited `.env`, or a string that continues on the next line) matched no rule at all: it was
|
|
46
|
+
emitted in clear and the run reported zero redactions. `credential-assignment-unterminated` now
|
|
47
|
+
masks it and records a finding. When a mask would unbalance an otherwise balanced line, the value
|
|
48
|
+
is now masked around its quotes instead of being left untouched with no finding at all.
|
|
49
|
+
- `diff` applies the caller's `secretRules`. `compareManifests` gained the parameter, every masking
|
|
50
|
+
call in `diff.ts` passes it through, and the payload block's `layers` maps are masked too — they
|
|
51
|
+
were printed verbatim while every line of prose beside them was masked.
|
|
52
|
+
- `validate` verifies the completeness contract. `incomplete[]`, `counts.incompleteCount`,
|
|
53
|
+
`omittedRanges`, `omittedLines`, `includedLines` and `incomplete[].relativePath` are checked against
|
|
54
|
+
each other and against `files[]`; `relativePath` was the only unconfined member of the three
|
|
55
|
+
path-bearing arrays. Ten tampered variants of a real record used to report "valid and up to date".
|
|
56
|
+
|
|
57
|
+
**Correctness**
|
|
58
|
+
|
|
59
|
+
- The monolith entries no longer carry a `truncationReason` or `omittedRanges` beside
|
|
60
|
+
`inclusionMode: "full"` — one object said "complete file" and "large-file-budget" at once.
|
|
61
|
+
- A previewed or oversized importer is in `indexes.imports.byFile`, so `snapshot_dependents` no
|
|
62
|
+
longer answers "0 importer(s)" for a file that has one. Its `exports` list says `exportsOmitted`.
|
|
63
|
+
- `snapshot_plan` runs on the worker thread, like `snapshot_generate`: a dry run parses the whole
|
|
64
|
+
repository and blocked the JSON-RPC loop for as long as a generate did.
|
|
65
|
+
- `discovery` is a member of `SnapshotConfig`, so a TypeScript config containing it compiles; a
|
|
66
|
+
compile-time proof on `CONFIG_KEY_NAMES` keeps the parsed key list from drifting from the
|
|
67
|
+
interface again — `CONFIG_KEYS` is built from that tuple, so both follow it.
|
|
68
|
+
- SARIF results are ordered by code unit, not `localeCompare`: the same commit produced different
|
|
69
|
+
bytes under different host locales.
|
|
70
|
+
- `generatorOrigin` reads a `package.json` behind a byte-order mark, so a pinned project is no
|
|
71
|
+
longer told it has a "global or direct install".
|
|
72
|
+
- A nested `.DS_Store` is Finder noise in the ownership check, compared by basename like the other
|
|
73
|
+
four sites; `reports/.DS_Store` used to make the tool refuse a directory it had just written.
|
|
74
|
+
- `init --out-dir .context` ignores `/.context/` rather than `/snapshot/`, so the snapshot it
|
|
75
|
+
generates is actually untracked; a nested or out-of-tree outDir is handled.
|
|
76
|
+
- `exportsKind: "esm"` is produced for a file whose exports are all ES exports, so absence means
|
|
77
|
+
"no exports" again.
|
|
78
|
+
- Both project-tree caps (lines and depth) are recorded as manifest warnings; only the depth cap was.
|
|
79
|
+
- `diff --format json` carries a stable `payload.codes` array — one code per prose reason.
|
|
80
|
+
|
|
81
|
+
**Documentation**
|
|
82
|
+
|
|
83
|
+
- The published site no longer requests two 404s: `docs/assets/*` is rewritten to the `assets/`
|
|
84
|
+
copy the build writes, and the link gate now checks `src` as well as `href`.
|
|
85
|
+
- `docs/configuration.md` lists the placeholder shapes that survive redaction, exhaustively, with a
|
|
86
|
+
test that pins the list to `PLACEHOLDER_PATTERNS`; the "a placeholder is indistinguishable from a
|
|
87
|
+
secret" claim it contradicted is gone.
|
|
88
|
+
- Three surfaces that disagreed with the binary are corrected: the `.gitignore` entries in
|
|
89
|
+
`docs/cli.md` (they are anchored), `validate`'s actual output in
|
|
90
|
+
`docs/stale-context-is-your-bug.md`, and `explain`'s `{ rules, line }` shape.
|
|
91
|
+
- `codebase-token-budget.md`'s measured example is re-measured; `how-to-context-budget.md` no
|
|
92
|
+
longer cites a `manifest.totals.events` field that does not exist.
|
|
93
|
+
- Eight test failure messages interpolate their variables; on a security failure they printed the
|
|
94
|
+
literal `${…}`.
|
|
95
|
+
|
|
96
|
+
## 0.10.1
|
|
97
|
+
|
|
98
|
+
Documentation only. The build is 0.10.0 with the documentation that describes it — no behaviour,
|
|
99
|
+
option or manifest field changed.
|
|
100
|
+
|
|
101
|
+
`npm install codebase-snapshot@0.10.0` bundles `README.md`, `CHANGELOG.md` and `docs/*.md` as they
|
|
102
|
+
stood when that tarball was built. The documentation pass that followed 0.10.0 landed after that,
|
|
103
|
+
so anyone reading `node_modules/codebase-snapshot/docs/` got the previous release's description of
|
|
104
|
+
truncation — including `docs/output.md` explaining an `isLarge: false` preview route that 0.10.0
|
|
105
|
+
had already turned into a config error. Publishing the corrected docs is the whole change.
|
|
106
|
+
|
|
107
|
+
Corrected in that pass, for the record:
|
|
108
|
+
|
|
109
|
+
- `--help` printed the pre-0.10.0 `--large-file-bytes` default (204800).
|
|
110
|
+
- Three comparison pages promised a file too large is "truncated with a marker" rather than a
|
|
111
|
+
preview listed in `incomplete[]`.
|
|
112
|
+
- `docs/output.md` documented a preview route that no longer exists, and did not mention
|
|
113
|
+
`truncationReason`, `omittedRanges` or `summaryOmittedReason`.
|
|
114
|
+
- `docs/configuration.md` listed the old per-preset budgets (100k–200k) and quoted
|
|
115
|
+
`recommendedBudget: "120k"`.
|
|
116
|
+
- The README, the `describe` contract's `consume` step and the MCP `snapshot://manifest` row
|
|
117
|
+
described the manifest without `incomplete[]`.
|
|
118
|
+
- `setup` wrote `largeFileBytes: "200k"` beside a 300 KB budget, previewing files that would fit.
|
|
119
|
+
It follows the budget now, which is what the pages already claimed.
|
|
120
|
+
|
|
121
|
+
Also: `sync-docs` rewrites the `Generator: … (project dependency ^…)` banner sample, which sat in
|
|
122
|
+
a fence and so could not carry a marker. It described the previous release from the day after
|
|
123
|
+
every publish; it cannot now.
|
|
26
124
|
## 0.10.0
|
|
27
125
|
|
|
28
126
|
The 0.9.18 report had one real bug in it. A complete file could be cut down to fit a part budget
|
|
@@ -94,7 +192,7 @@ behaviour depends on whichever `npx` cache or global install was first on `PATH`
|
|
|
94
192
|
pinned project dependency exists to prevent:
|
|
95
193
|
|
|
96
194
|
```
|
|
97
|
-
Branch: main | Part budget: 300 KB | Generator: 0.
|
|
195
|
+
Branch: main | Part budget: 300 KB | Generator: 0.10.0 (via npx)
|
|
98
196
|
```
|
|
99
197
|
|
|
100
198
|
The origin is printed and not written into an artefact: an artefact naming an absolute install
|
package/README.md
CHANGED
|
@@ -48,7 +48,8 @@ and choosing what matters by hand neither scales nor repeats. This does it deter
|
|
|
48
48
|
a file too big for a part becomes a head/tail excerpt with an omission marker, and `manifest.json`
|
|
49
49
|
records it in `incomplete[]` with the line ranges it lost.
|
|
50
50
|
- **An index, not just text.** `manifest.json` lists every included file with its layer, kind,
|
|
51
|
-
language, part, hash and a structural summary,
|
|
51
|
+
language, part, hash and a structural summary, every *excluded* file with the reason, and an
|
|
52
|
+
`incomplete[]` list of every file it could only emit in part, with the line ranges it lost.
|
|
52
53
|
- **Provably current.** `validate` re-hashes the repository against the snapshot and exits non-zero
|
|
53
54
|
on any drift, so a pipeline can gate on the context being fresh.
|
|
54
55
|
- **Repeatable.** Two runs over unchanged input give byte-identical parts and the same
|
|
@@ -200,7 +201,7 @@ Everything an agent needs is available as data, and the tool can install its own
|
|
|
200
201
|
```bash
|
|
201
202
|
npx codebase-snapshot describe --format json # contract: workflow, options, exit codes
|
|
202
203
|
npx codebase-snapshot skill --install # into .claude/skills + .cursor/rules
|
|
203
|
-
npx -y codebase-snapshot@0.10.
|
|
204
|
+
npx -y codebase-snapshot@0.10.2 mcp # or serve it over MCP
|
|
204
205
|
```
|
|
205
206
|
|
|
206
207
|
An agent told only "use `npx codebase-snapshot`" can read the contract, follow its ordered
|