codebase-snapshot 0.9.17 → 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,150 @@ 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.
102
+ ## 0.9.18
103
+
104
+ A release about what the listing says. The generator is unchanged; what changed is every place
105
+ that describes it — the npm page, the README, the machine-readable summary, and one comparison
106
+ table that had two rows wrong.
107
+
108
+ ### The update notice waited a day
109
+
110
+ The check remembered "you are already current" for 24 hours, so a release published two hours
111
+ after a run went unnoticed until the next day — even though the tool exists to prove a thing is
112
+ current. A cached answer that names a newer release still keeps the daily interval, because the
113
+ upgrade command is already known; a "you are current" answer is now re-asked after an hour. An
114
+ active run therefore notices a release within the hour, and a machine that is up to date makes at
115
+ most one request an hour instead of one a day.
116
+
117
+ ### The npm description did not contain the product's name
118
+
119
+ "Pack a codebase for an LLM into budgeted Markdown parts" described the mechanism and never said
120
+ *snapshot*. The package is called `codebase-snapshot` and the words people type are "codebase
121
+ snapshot"; the description now opens with that phrase, names the clients it is used with, and says
122
+ it is local.
123
+
124
+ The keyword list lost the words that describe the implementation rather than the job —
125
+ `partitioner`, `ast`, `ai`, `code-analysis`, `prompt-engineering` — and gained the ones a person
126
+ searching for this would use: `llm-context`, `codebase-to-markdown`, `token-budget`, `claude-code`,
127
+ `drift-detection`. Twenty terms, and none of them a competitor's name.
128
+
129
+ ### Two rows in the repomix comparison were wrong
130
+
131
+ `docs/vs-repomix.md` said repomix emits "a single packed file" with "no per-artifact ceiling". It
132
+ has `--split-output <size>` and `--token-budget <n>`, and the second exits non-zero above a token
133
+ count — a ceiling of the kind the table denied it. Both rows are corrected, and the page now lists
134
+ a token budget under *where repomix is the better choice*: tokens are what a context window
135
+ measures, and this project budgets bytes.
136
+
137
+ The page was also the first thing a search for "repomix alternative" could land on. A comparison
138
+ that is wrong about the other tool is worse than no comparison, and the correction costs less than
139
+ the credibility it protects.
140
+
141
+ ### The README asked for a command the reader did not have yet
142
+
143
+ The first block led with `snapshot`, which exists only after a global install, so the very first
144
+ thing a visitor copied could fail. It leads with `npx codebase-snapshot generate` now, with the
145
+ short form after it.
146
+
147
+ The weekly-downloads badge is gone. On a repository with two stars it advertised a number that is
148
+ mostly registry mirrors and old lockfiles, in a README whose central claim is that it does not
149
+ overstate what it has proven.
150
+
151
+ ### `llms.txt` described three of the four pillars
152
+
153
+ The summary an agent reads first mentioned budgeted parts, the manifest and a secret audit, and
154
+ left out `validate` and the MCP server — the two things the project argues about. Both are in the
155
+ summary now.
156
+
157
+ ### The scaffolder now says it is the scaffolder
158
+
159
+ `create-codebase-snapshot` described itself as "Set up codebase-snapshot in a repository", which
160
+ reads as the tool itself when it is the first npm result for the name. It describes the scaffolding
161
+ it actually performs.
162
+
163
+ ### Also
164
+
165
+ - The 0.9.5 paragraph beginning "The MCP server has not been run against a real client" now carries
166
+ a note pointing at what superseded it: the digit-as-string fix in 0.9.6 was reported from a live
167
+ client session, and `snapshot_dependents` arrived in 0.9.8. The paragraph is history, not a
168
+ current disclaimer, and a reader who found it by search had no way to tell.
169
+
26
170
  ## 0.9.17
27
171
 
28
172
  Closes the remaining entries of the 0.9.16 verified-bug report and the follow-up report from a
@@ -1307,6 +1451,10 @@ The MCP server has not been run against a real client. Its protocol is exercised
1307
1451
  binary, but a client's own configuration, timeouts and approval prompts are theirs. That is the next
1308
1452
  thing to check, not something this release proves.
1309
1453
 
1454
+ > Superseded since: the digit-as-string fix in 0.9.6 was reported from a live client session, and
1455
+ > `snapshot_dependents` arrived in 0.9.8 on the same basis. This paragraph describes 0.9.5 and is
1456
+ > left as written — it is history, not a disclaimer about the current server.
1457
+
1310
1458
  ## 0.9.4
1311
1459
 
1312
1460
  ### The snapshot is now something an agent can ask for
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  <p>
11
11
  <a href="https://www.npmjs.com/package/codebase-snapshot"><img alt="npm version" src="https://img.shields.io/npm/v/codebase-snapshot.svg"></a>
12
- <a href="https://www.npmjs.com/package/codebase-snapshot"><img alt="weekly downloads" src="https://img.shields.io/npm/dw/codebase-snapshot.svg"></a>
12
+ <a href="https://github.com/ankurhalder/codebase-snapshot/actions/workflows/pr.yml"><img alt="verify" src="https://img.shields.io/github/actions/workflow/status/ankurhalder/codebase-snapshot/pr.yml?label=verify"></a>
13
13
  <a href="#license"><img alt="license: MIT" src="https://img.shields.io/badge/license-MIT-blue.svg"></a>
14
14
  <a href="https://nodejs.org"><img alt="node: 18 or newer" src="https://img.shields.io/badge/node-%3E%3D18-brightgreen.svg"></a>
15
15
  <a href="https://ankurhalder.github.io/codebase-snapshot/"><img alt="documentation" src="https://img.shields.io/badge/docs-read-1a7f37"></a>
@@ -17,8 +17,8 @@
17
17
  </div>
18
18
 
19
19
  ```bash
20
- snapshot # detects the project, sets it up, generates
21
- npx codebase-snapshot generate # or no install at all, straight to the snapshot
20
+ npx codebase-snapshot generate # no install: straight to the snapshot
21
+ snapshot # once installed: detects the project, sets it up, generates
22
22
  ```
23
23
 
24
24
  That writes `./snapshot/` — a directory you can drop into a chat, a prompt, a RAG pipeline or a
@@ -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.17 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