codebase-snapshot 0.9.14 → 0.9.15
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 +134 -0
- package/README.md +2 -2
- package/SECURITY.md +23 -5
- package/dist/bin.js +668 -280
- package/dist/{chunk-J4W74N4Y.js → chunk-AU2VNTUU.js} +650 -554
- package/dist/{chunk-DUZK5VL2.js → chunk-JL4VDGXL.js} +303 -48
- package/dist/cli.cjs +664 -276
- package/dist/cli.js +102 -65
- package/dist/index.cjs +303 -48
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +3678 -3354
- package/dist/mcp.d.cts +10 -0
- package/dist/mcp.d.ts +10 -0
- package/dist/mcp.js +2 -2
- package/docs/cli.md +74 -48
- package/docs/configuration.md +37 -12
- package/docs/install.md +4 -3
- package/docs/mcp.md +30 -6
- package/docs/output.md +38 -9
- package/docs/stale-context-is-your-bug.md +4 -3
- package/docs/troubleshooting.md +32 -8
- package/docs/vs-code2prompt.md +1 -1
- package/docs/vs-gitingest.md +1 -1
- package/docs/vs-repomix.md +1 -1
- package/package.json +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -23,6 +23,140 @@ deprecated with an explanatory message instead. `latest` has pointed at 0.9.0 si
|
|
|
23
23
|
|
|
24
24
|
---
|
|
25
25
|
|
|
26
|
+
## 0.9.15
|
|
27
|
+
|
|
28
|
+
A sixth audit, of the promises rather than the code paths the gate already covers. The gate was
|
|
29
|
+
green before this release and is green after it; every defect below lived somewhere the test suite
|
|
30
|
+
did not look. Two put credentials in the artifact, one broke the repeatability guarantee, and one
|
|
31
|
+
made `validate` fail on a snapshot it had just written.
|
|
32
|
+
|
|
33
|
+
### Two credential shapes were left in clear text
|
|
34
|
+
|
|
35
|
+
**A quoted camelCase key in JSON or YAML was never redacted.** `{"dbPassword": "hunter2"}`,
|
|
36
|
+
`"discordToken"`, `"awsSecret"`, `"botToken"`, `"jwtSecret"` and `"sessionKey"` were emitted
|
|
37
|
+
verbatim, while the same names unquoted — and the short names `"password"` and `"apiKey"` — were
|
|
38
|
+
masked. The quoted rule wanted the whole key between quotes; the bare-tail rule was suppressed
|
|
39
|
+
after a quote. Every JSON configuration file has that shape.
|
|
40
|
+
|
|
41
|
+
**A mask could print `[REDACTED]` and keep most of the value.** Unquoted values stopped at `$`,
|
|
42
|
+
`!` and `@`, so `db_password: [REDACTED]$$w0rdSecr3t` shipped twelve characters of a seventeen
|
|
43
|
+
character password while looking redacted. A value that begins with punctuation was not matched at
|
|
44
|
+
all, so `!en$value` went out whole, and one containing `&` was masked as a prefix. A mask now
|
|
45
|
+
covers the whole value or nothing is emitted: a match that cannot be bounded is dropped in source
|
|
46
|
+
code and masked whole in a data file, never half-written.
|
|
47
|
+
|
|
48
|
+
The same pass closed narrower leaks: URL userinfo with an empty user part (`redis://:pass@host`),
|
|
49
|
+
`curl -u user:pass`, short unpadded Basic credentials, and fixed shapes for Discord, Telegram,
|
|
50
|
+
Azure DevOps, Shopify and Azure SAS tokens. The rule count stays 31 — the coverage folded into
|
|
51
|
+
existing rules rather than adding new ones.
|
|
52
|
+
|
|
53
|
+
### The second run could change the preset, and drop a file
|
|
54
|
+
|
|
55
|
+
Preset detection counts markdown to decide whether a repository is `docs`. It excluded the output
|
|
56
|
+
directory only when that directory was literally named `snapshot`. With `--out-dir snap` on a
|
|
57
|
+
repository with no root `package.json`, run one detected `generic` and included `site/page.md`;
|
|
58
|
+
run two counted its own output, detected `docs`, applied that preset's `site/` exclusion, and
|
|
59
|
+
**silently dropped a source file** — with a different fingerprint, and in one variant with the same
|
|
60
|
+
fingerprint and different parts. The walk now skips any directory carrying an ownership marker,
|
|
61
|
+
whatever it is called, which is the same evidence the scanner already uses.
|
|
62
|
+
|
|
63
|
+
### validate failed on a snapshot it had just generated
|
|
64
|
+
|
|
65
|
+
A text file with a binary extension — a Git-LFS pointer is the common case, three lines of plain
|
|
66
|
+
text ending in `.png` — was skipped by `generate` as binary and then reported by `validate` as
|
|
67
|
+
`new file`, exit 1, forever. Regenerating could not clear it, because the two commands asked
|
|
68
|
+
different questions. `validate` now applies `generate`'s decision order exactly, so they agree by
|
|
69
|
+
construction, and `explain` agrees with both: it no longer says `included: true` for a file the
|
|
70
|
+
snapshot skipped, and a skipped path no longer carries layer, kind or language.
|
|
71
|
+
|
|
72
|
+
### A JSON consumer received nothing when the config was broken
|
|
73
|
+
|
|
74
|
+
`--format json` with an unparseable config, an unknown key, an invalid value or a bad preset exited
|
|
75
|
+
1 with **zero bytes on stdout**, contradicting the documented error document and the contract in
|
|
76
|
+
`describe`. Every config failure now goes through the same writer as every other failure.
|
|
77
|
+
|
|
78
|
+
### snapshot://manifest was not JSON on an ordinary repository
|
|
79
|
+
|
|
80
|
+
Above roughly 350 files the resource was cut at 512 kB with a truncation marker injected mid-document,
|
|
81
|
+
advertised as `application/json`. Resource reads are now all-or-nothing: a document that does not
|
|
82
|
+
fit one read fails with `-32000`, its size, the limit and the tool to use instead. The same rule
|
|
83
|
+
covers parts and reports.
|
|
84
|
+
|
|
85
|
+
### Ownership evidence was a shape, not evidence
|
|
86
|
+
|
|
87
|
+
A hand-written `.codebase-snapshot` listing the directory's own files was accepted as proof that
|
|
88
|
+
this tool wrote the directory, and the next `generate` deleted those files. Markers now record the
|
|
89
|
+
sha256 and byte length of every file written, and replacement verifies them. A marker that cannot
|
|
90
|
+
prove a completed run is refused and nothing is deleted. Snapshots written by earlier releases are
|
|
91
|
+
still accepted on their manifest digest, so an upgrade does not strand the output directory a user
|
|
92
|
+
already has.
|
|
93
|
+
|
|
94
|
+
### The rest
|
|
95
|
+
|
|
96
|
+
- **`setup`** honoured neither `--only-artifacts` over a reused config that disabled the artifact,
|
|
97
|
+
nor the config it actually kept: it reported a filename that did not exist and a preset it had not
|
|
98
|
+
applied. `--install-hook` baked `snapshot` as the output directory whatever the config said, and
|
|
99
|
+
`--dry-run --install-hook` wrote the hook anyway.
|
|
100
|
+
- **`--mode explain <path>`** and **`--mode diff <a> <b>`** could not work: the positional arguments
|
|
101
|
+
were parsed as the command word. Both forms now run.
|
|
102
|
+
- **`report`** accepted seven generation flags as silent no-ops while rejecting `--discovery`. It
|
|
103
|
+
rejects all of them now, and `describe` agrees.
|
|
104
|
+
- **A closed pipe** (`generate --format json | head`) was an uncaught `EPIPE` stack trace and exit 1;
|
|
105
|
+
it is now a quiet early exit.
|
|
106
|
+
- **The omission marker** named an internal section allowance (1887 B for a 4096 B part) instead of
|
|
107
|
+
the part budget the manifest and the CLI report.
|
|
108
|
+
- **The docs site** had heading elements with no `id` while carrying 49 anchor links: every table of
|
|
109
|
+
contents on all fifteen published pages was dead. The site generator emits GitHub-compatible ids
|
|
110
|
+
and the link checker now validates fragments, so the gate can see it.
|
|
111
|
+
- **`docs/install.md`** claimed the release check enforces the verified-client list "on every pull
|
|
112
|
+
request". There was no pull-request workflow and no client install test; the claim is gone.
|
|
113
|
+
- **The CLI reference** carried stale rows: `setup` missing from ten options, `report` advertised
|
|
114
|
+
with flags it rejects, `--mode` listing nine command names where there are eleven, "text-mode
|
|
115
|
+
stdout is empty" false for `skill`, and `validate` documented with five drift classes where there
|
|
116
|
+
are six. All corrected against the source.
|
|
117
|
+
- **`docs/configuration.md`**'s "complete example" omitted six settings that `init` writes.
|
|
118
|
+
- **The redaction section of `SECURITY.md`** described the old, narrower behaviour; it now states
|
|
119
|
+
what the rules do, including the shapes that are still not covered.
|
|
120
|
+
- **A pull-request workflow** now runs the same verify gate as a release, on Node 18, 20 and 22.
|
|
121
|
+
Until now that matrix ran only at release time, which is why 0.9.14 needed four publish attempts.
|
|
122
|
+
- **Publishing** asserts that the release tag agrees with `package.json`, ships the LICENSE the
|
|
123
|
+
`create` package declares, and no longer builds `dist` twice for one publish.
|
|
124
|
+
|
|
125
|
+
### Verified
|
|
126
|
+
|
|
127
|
+
`npm run verify` — lint, typecheck, 1027 tests (0 failures), the docs sync check, the site build,
|
|
128
|
+
the site audit, the readme lint and the tarball check — on the release commit. Beyond the suite:
|
|
129
|
+
the published-install path, and real repositories in five languages where every part stays inside
|
|
130
|
+
its budget, repeat runs are byte-identical, `validate` is clean, and a snapshot written by 0.9.14
|
|
131
|
+
is upgraded in place without being refused.
|
|
132
|
+
|
|
133
|
+
An independent red-team pass then ran against the built artifact, trying to reproduce each of the
|
|
134
|
+
seven blockers from the outside. Six were closed outright; the seventh exposed a `.env` value whose
|
|
135
|
+
mask left a punctuation tail, and a quoted `id-token` that was over-redacted. Both were fixed and
|
|
136
|
+
re-tested before this release — which is the argument for a verifier who did not write the fix.
|
|
137
|
+
|
|
138
|
+
### Three limitations became fixes instead
|
|
139
|
+
|
|
140
|
+
The first cut of these notes listed three known limitations. All three are fixed here, because a
|
|
141
|
+
release note that documents a leak is still a leak.
|
|
142
|
+
|
|
143
|
+
- `parsePartSections` reported the wrong count for a one-line file (`null`) and for a section that
|
|
144
|
+
collapsed to one line — `1 line of 3 lines` was read as 3, the source count. The counts are now
|
|
145
|
+
read from the metadata field that holds them, singular or plural, and free-form layer and language
|
|
146
|
+
names can no longer be mistaken for a count.
|
|
147
|
+
- `manifest.fingerprint` covered the input but not the settings, so two runs with different part
|
|
148
|
+
budgets over the same source shared a fingerprint while their parts differed. The settings digest
|
|
149
|
+
is folded in, so the fingerprint identifies the artifact set the documentation promises, and
|
|
150
|
+
`diff` says `packed or configured differently` when only the settings moved.
|
|
151
|
+
- A lowercase `key=value` credential in an INI or properties file was masked only while its value
|
|
152
|
+
fitted the rules' alphabet. In a data or shell file the whole value is masked now, whatever it
|
|
153
|
+
contains; the same line in source code is still left alone.
|
|
154
|
+
|
|
155
|
+
Two deliberate behaviours remain. A YAML value that is really a reference
|
|
156
|
+
(`password: !Ref SomeParam`) is masked, because in a data file the fail-closed choice is the right
|
|
157
|
+
one. And no rule set can promise that every credential shape is recognised — a clean audit is
|
|
158
|
+
evidence that the known patterns did not fire, not a guarantee, which `SECURITY.md` says plainly.
|
|
159
|
+
|
|
26
160
|
## 0.9.14
|
|
27
161
|
|
|
28
162
|
A fifth audit, of what the tool does to text it did not write. Three of the defects below were
|
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ with a manifest and a validator](https://raw.githubusercontent.com/ankurhalder/c
|
|
|
31
31
|
<p align="center">
|
|
32
32
|
<a href="#install">Install</a> ·
|
|
33
33
|
<a href="#quick-start">Quick start</a> ·
|
|
34
|
-
<a href="#built-to-be-trusted">Trust</a> ·
|
|
34
|
+
<a href="#built-to-be-trusted-with-a-whole-repository">Trust</a> ·
|
|
35
35
|
<a href="#for-ai-agents">AI agents</a> ·
|
|
36
36
|
<a href="#documentation">Docs</a> ·
|
|
37
37
|
<a href="https://ankurhalder.github.io/codebase-snapshot/">Site</a>
|
|
@@ -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.
|
|
203
|
+
npx -y codebase-snapshot@0.9.15 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
|
@@ -40,11 +40,29 @@ secret deliberately split across two string literals, joined with a backslash li
|
|
|
40
40
|
continuation, or assembled by template-literal concatenation can be missed, because the
|
|
41
41
|
pattern never sees the whole value on one line.
|
|
42
42
|
|
|
43
|
-
In YAML and similar `key: value` files, an **unquoted** value
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
In YAML and similar `key: value` files, the file type decides how an **unquoted** value is read.
|
|
44
|
+
A strong credential name in colon form — `password:`, `token:`, `api_key:` — makes the rest of
|
|
45
|
+
the line a value, and in a data or shell file that value is masked whole whatever symbols it
|
|
46
|
+
holds: `password: pa&ss` and `password: getPassword() & 0xff` are masked in a `.yaml`, while the
|
|
47
|
+
same lines in a `.ts` are left as written, because there they are expressions and the tool does
|
|
48
|
+
not edit expressions. In a source file a value that reads like a reference —
|
|
49
|
+
`password: opts.db.password` — is emitted as written; an unquoted value in a declaration is an
|
|
50
|
+
initializer, not a credential.
|
|
51
|
+
|
|
52
|
+
A punctuation-led value is masked when the token also carries a digit or a second punctuation
|
|
53
|
+
character — `token: !hunter2hunter2` is masked, while YAML tags such as `!Ref` and prose words such
|
|
54
|
+
as `!important` stay readable. Quote the value — `password: "…"` — when you need certainty: a
|
|
55
|
+
quoted value under a credential-shaped name is masked whatever it contains.
|
|
56
|
+
|
|
57
|
+
In a data or shell file a **colon-form** assignment is masked whole even when a symbol would make
|
|
58
|
+
the value impossible to bound — it runs to the end of the line (a trailing `#` comment is kept, and
|
|
59
|
+
the match is capped at 300 characters). In source code such a match is dropped instead, so no
|
|
60
|
+
marker is written in front of an expression. The `.env`/shell `NAME=value` rule also masks its
|
|
61
|
+
whole value, comment aside. The `=` form follows the same rule by file type: in a data or shell
|
|
62
|
+
file, a key whose name ends in a credential word — upper or lower case, `password`, `client_secret`,
|
|
63
|
+
`access_key`, `apiKey` — masks the whole value whatever symbols it contains; in source code the
|
|
64
|
+
same line is left alone unless it matches an existing source rule, and a key that merely contains a
|
|
65
|
+
credential word (`tokenCount`, `secretary`) is not a credential.
|
|
48
66
|
|
|
49
67
|
A clean audit is therefore evidence that the known patterns did not fire — not a guarantee
|
|
50
68
|
that the repository holds no credentials.
|