codebase-snapshot 0.9.18 → 0.10.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 CHANGED
@@ -23,6 +23,82 @@ deprecated with an explanatory message instead. `latest` has pointed at 0.9.0 si
23
23
 
24
24
  ---
25
25
 
26
+ ## 0.10.0
27
+
28
+ The 0.9.18 report had one real bug in it. A complete file could be cut down to fit a part budget
29
+ and the run still exited 0: 1 241 of 2 883 lines emitted, a marker on line 1 300, and a manifest
30
+ that recorded `inclusionMode: "preview"` beside `isLarge: false` — a shape that reads as policy
31
+ whether the preview was chosen or 57 % of the file had been lost.
32
+
33
+ **Upgrading.** A config that sets `largeFileBytes` above `maxPartBytes` now refuses to run. That
34
+ is the change, and the refusal is the point: the pair described a file the tool could not emit
35
+ whole but would not call large either. Raise `maxPartBytes` to at least `largeFileBytes`, or
36
+ delete the `largeFileBytes` line so it follows the budget. Configs written by this release's
37
+ `setup` already agree, and every preset now recommends the same 300 KB budget.
38
+
39
+ ### A file is not cut to fit a part
40
+
41
+ The two ceilings answer one question — *can this file be emitted whole?* — so they are now
42
+ resolved together and cannot disagree:
43
+
44
+ - `largeFileBytes` defaults to `maxPartBytes`, and an explicit value **above** it is a config
45
+ error before anything is written. A file between the two cannot fit a part, so it would be cut
46
+ while the manifest called it a preview by policy.
47
+ - Every preset recommends the same 300 KB budget. The old per-preset tuning went as low as
48
+ 100 KB, which is exactly how a 197 KB file ended up gutted in a repository that had one.
49
+ - A file above the threshold is a head/tail preview — the declared policy for something that
50
+ cannot fit — and the `isLarge: false` + `isPreviewTruncated: true` combination is now
51
+ unreachable.
52
+
53
+ Nothing is lost silently either way: `manifest.json` gained a top-level `incomplete[]` naming
54
+ every included file that is not present in full, with `reason` (`large-file-budget`,
55
+ `part-budget`, `section-metadata`) and `omittedRanges`, 1-based inclusive source lines that are
56
+ missing or partial. `files[]` carries the same two fields per entry, and `counts.incompleteCount`
57
+ is the length of the list.
58
+
59
+ A summary dropped for size now records *why* — `summaryOmittedReason` is `oversize`, `preview` or
60
+ `part-budget` — and the part says which, instead of printing "exceeds the part budget" for a
61
+ summary that was never built because the file was a preview.
62
+
63
+ ### The run summary says what it left out
64
+
65
+ `Tracked files: 434` read as "the whole repository" when 155 tracked files had gone out the
66
+ window. It now prints the coverage and the reasons that took the rest:
67
+
68
+ ```
69
+ - 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
70
+ - Incomplete: 2 file(s) — 1 large-file-budget, 1 part-budget; see manifest.json incomplete[]
71
+ ```
72
+
73
+ The generator also asserts the invariant behind that line: every scanned path appears in
74
+ `files[]` or in `skipped[]` with a reason, and a truncated file has both a reason and ranges. A
75
+ run that fails the check reports `validation.status: "failed"` instead of a clean bill.
76
+
77
+ ### The output swap survives a held handle
78
+
79
+ On Windows and OneDrive the second run failed with `EPERM: rename 'snapshot' ->
80
+ 'snapshot.backup-…'`: an indexer, an antivirus or a sync client holds a handle *inside* the
81
+ directory, which makes the directory itself un-renameable, and the handle outlives the retry
82
+ budget. When the retries end, the snapshot that the ownership guard has already proved is this
83
+ tool's own is now removed and replaced in place, with a note on stderr naming the cause. Anything
84
+ that is not a lock error, and any directory the guard has not cleared, still fails as before.
85
+
86
+ ### `setup` no longer installs into a directory that is not a package
87
+
88
+ With no `package.json`, the install step answered `ENOENT` and npm left an empty
89
+ `package-lock.json` at the repository root — a file nobody asked for, in a run that said nothing
90
+ about it. The install is skipped, and the skip is stated.
91
+
92
+ The run banner also names the generator and where it came from, because a snapshot whose
93
+ behaviour depends on whichever `npx` cache or global install was first on `PATH` is what a
94
+ pinned project dependency exists to prevent:
95
+
96
+ ```
97
+ Branch: main | Part budget: 300 KB | Generator: 0.9.19 (via npx)
98
+ ```
99
+
100
+ The origin is printed and not written into an artefact: an artefact naming an absolute install
101
+ path would stop being byte-identical across machines.
26
102
  ## 0.9.18
27
103
 
28
104
  A release about what the listing says. The generator is unchanged; what changed is every place
package/README.md CHANGED
@@ -44,9 +44,9 @@ 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
51
  language, part, hash and a structural summary, and every *excluded* file with the reason.
52
52
  - **Provably current.** `validate` re-hashes the repository against the snapshot and exits non-zero
@@ -200,7 +200,7 @@ Everything an agent needs is available as data, and the tool can install its own
200
200
  ```bash
201
201
  npx codebase-snapshot describe --format json # contract: workflow, options, exit codes
202
202
  npx codebase-snapshot skill --install # into .claude/skills + .cursor/rules
203
- npx -y codebase-snapshot@0.9.18 mcp # or serve it over MCP
203
+ npx -y codebase-snapshot@0.10.0 mcp # or serve it over MCP
204
204
  ```
205
205
 
206
206
  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