codebase-snapshot 0.9.18 → 0.10.1

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 CHANGED
@@ -23,6 +23,110 @@ deprecated with an explanatory message instead. `latest` has pointed at 0.9.0 si
23
23
 
24
24
  ---
25
25
 
26
+ ## 0.10.1
27
+
28
+ Documentation only. The build is 0.10.0 with the documentation that describes it — no behaviour,
29
+ option or manifest field changed.
30
+
31
+ `npm install codebase-snapshot@0.10.0` bundles `README.md`, `CHANGELOG.md` and `docs/*.md` as they
32
+ stood when that tarball was built. The documentation pass that followed 0.10.0 landed after that,
33
+ so anyone reading `node_modules/codebase-snapshot/docs/` got the previous release's description of
34
+ truncation — including `docs/output.md` explaining an `isLarge: false` preview route that 0.10.0
35
+ had already turned into a config error. Publishing the corrected docs is the whole change.
36
+
37
+ Corrected in that pass, for the record:
38
+
39
+ - `--help` printed the pre-0.10.0 `--large-file-bytes` default (204800).
40
+ - Three comparison pages promised a file too large is "truncated with a marker" rather than a
41
+ preview listed in `incomplete[]`.
42
+ - `docs/output.md` documented a preview route that no longer exists, and did not mention
43
+ `truncationReason`, `omittedRanges` or `summaryOmittedReason`.
44
+ - `docs/configuration.md` listed the old per-preset budgets (100k–200k) and quoted
45
+ `recommendedBudget: "120k"`.
46
+ - The README, the `describe` contract's `consume` step and the MCP `snapshot://manifest` row
47
+ described the manifest without `incomplete[]`.
48
+ - `setup` wrote `largeFileBytes: "200k"` beside a 300 KB budget, previewing files that would fit.
49
+ It follows the budget now, which is what the pages already claimed.
50
+
51
+ Also: `sync-docs` rewrites the `Generator: … (project dependency ^…)` banner sample, which sat in
52
+ a fence and so could not carry a marker. It described the previous release from the day after
53
+ every publish; it cannot now.
54
+ ## 0.10.0
55
+
56
+ The 0.9.18 report had one real bug in it. A complete file could be cut down to fit a part budget
57
+ and the run still exited 0: 1 241 of 2 883 lines emitted, a marker on line 1 300, and a manifest
58
+ that recorded `inclusionMode: "preview"` beside `isLarge: false` — a shape that reads as policy
59
+ whether the preview was chosen or 57 % of the file had been lost.
60
+
61
+ **Upgrading.** A config that sets `largeFileBytes` above `maxPartBytes` now refuses to run. That
62
+ is the change, and the refusal is the point: the pair described a file the tool could not emit
63
+ whole but would not call large either. Raise `maxPartBytes` to at least `largeFileBytes`, or
64
+ delete the `largeFileBytes` line so it follows the budget. Configs written by this release's
65
+ `setup` already agree, and every preset now recommends the same 300 KB budget.
66
+
67
+ ### A file is not cut to fit a part
68
+
69
+ The two ceilings answer one question — *can this file be emitted whole?* — so they are now
70
+ resolved together and cannot disagree:
71
+
72
+ - `largeFileBytes` defaults to `maxPartBytes`, and an explicit value **above** it is a config
73
+ error before anything is written. A file between the two cannot fit a part, so it would be cut
74
+ while the manifest called it a preview by policy.
75
+ - Every preset recommends the same 300 KB budget. The old per-preset tuning went as low as
76
+ 100 KB, which is exactly how a 197 KB file ended up gutted in a repository that had one.
77
+ - A file above the threshold is a head/tail preview — the declared policy for something that
78
+ cannot fit — and the `isLarge: false` + `isPreviewTruncated: true` combination is now
79
+ unreachable.
80
+
81
+ Nothing is lost silently either way: `manifest.json` gained a top-level `incomplete[]` naming
82
+ every included file that is not present in full, with `reason` (`large-file-budget`,
83
+ `part-budget`, `section-metadata`) and `omittedRanges`, 1-based inclusive source lines that are
84
+ missing or partial. `files[]` carries the same two fields per entry, and `counts.incompleteCount`
85
+ is the length of the list.
86
+
87
+ A summary dropped for size now records *why* — `summaryOmittedReason` is `oversize`, `preview` or
88
+ `part-budget` — and the part says which, instead of printing "exceeds the part budget" for a
89
+ summary that was never built because the file was a preview.
90
+
91
+ ### The run summary says what it left out
92
+
93
+ `Tracked files: 434` read as "the whole repository" when 155 tracked files had gone out the
94
+ window. It now prints the coverage and the reasons that took the rest:
95
+
96
+ ```
97
+ - Tracked files: 434 included of 589 found — 155 skipped (binary 152, gitignore 18, sensitive-file 1); every one is listed in snapshot\reports\audit.md
98
+ - Incomplete: 2 file(s) — 1 large-file-budget, 1 part-budget; see manifest.json incomplete[]
99
+ ```
100
+
101
+ The generator also asserts the invariant behind that line: every scanned path appears in
102
+ `files[]` or in `skipped[]` with a reason, and a truncated file has both a reason and ranges. A
103
+ run that fails the check reports `validation.status: "failed"` instead of a clean bill.
104
+
105
+ ### The output swap survives a held handle
106
+
107
+ On Windows and OneDrive the second run failed with `EPERM: rename 'snapshot' ->
108
+ 'snapshot.backup-…'`: an indexer, an antivirus or a sync client holds a handle *inside* the
109
+ directory, which makes the directory itself un-renameable, and the handle outlives the retry
110
+ budget. When the retries end, the snapshot that the ownership guard has already proved is this
111
+ tool's own is now removed and replaced in place, with a note on stderr naming the cause. Anything
112
+ that is not a lock error, and any directory the guard has not cleared, still fails as before.
113
+
114
+ ### `setup` no longer installs into a directory that is not a package
115
+
116
+ With no `package.json`, the install step answered `ENOENT` and npm left an empty
117
+ `package-lock.json` at the repository root — a file nobody asked for, in a run that said nothing
118
+ about it. The install is skipped, and the skip is stated.
119
+
120
+ The run banner also names the generator and where it came from, because a snapshot whose
121
+ behaviour depends on whichever `npx` cache or global install was first on `PATH` is what a
122
+ pinned project dependency exists to prevent:
123
+
124
+ ```
125
+ Branch: main | Part budget: 300 KB | Generator: 0.10.0 (via npx)
126
+ ```
127
+
128
+ The origin is printed and not written into an artefact: an artefact naming an absolute install
129
+ path would stop being byte-identical across machines.
26
130
  ## 0.9.18
27
131
 
28
132
  A release about what the listing says. The generator is unchanged; what changed is every place
package/README.md CHANGED
@@ -44,11 +44,12 @@ with a manifest and a validator](https://raw.githubusercontent.com/ankurhalder/c
44
44
  Feeding a real repository to a model is awkward: files are too big, context windows are too small,
45
45
  and choosing what matters by hand neither scales nor repeats. This does it deterministically.
46
46
 
47
- - **A hard ceiling, not a target.** `maxPartBytes` is a limit. A file bigger than the budget is cut
48
- with an explicit omission marker naming the budget, and above `largeFileBytes` it becomes a
49
- head/tail excerpt instead — nothing silently overflows the window you sized.
47
+ - **A hard ceiling, not a target.** `maxPartBytes` is a limit, and nothing overflows it silently:
48
+ a file too big for a part becomes a head/tail excerpt with an omission marker, and `manifest.json`
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, and every *excluded* file with the reason.
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.9.18 mcp # or serve it over MCP
204
+ npx -y codebase-snapshot@0.10.1 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
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-->.x | ✅ |
9
+ | <!--@majorMinor-->0.10<!--/@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.9<!--/@majorMinor-->.x is newer than 4.4.1, not older. That is explained in full in the
13
+ so <!--@majorMinor-->0.10<!--/@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