codebase-snapshot 0.9.15 → 0.9.17
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 +102 -0
- package/README.md +1 -1
- package/SECURITY.md +41 -0
- package/dist/bin.js +2021 -615
- package/dist/{chunk-JL4VDGXL.js → chunk-IIP43I7C.js} +1762 -444
- package/dist/{chunk-AU2VNTUU.js → chunk-S4367K5X.js} +97 -24
- package/dist/cli.cjs +2039 -637
- package/dist/cli.d.cts +1 -11
- package/dist/cli.d.ts +1 -11
- package/dist/cli.js +16 -5
- package/dist/index.cjs +1755 -438
- package/dist/index.d.cts +97 -8
- package/dist/index.d.ts +97 -8
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +1760 -340
- package/dist/mcp.d.cts +7 -0
- package/dist/mcp.d.ts +7 -0
- package/dist/mcp.js +2 -2
- package/dist/{types-DIX6zWSt.d.cts → types-KbJvBjmV.d.cts} +46 -1
- package/dist/{types-DIX6zWSt.d.ts → types-KbJvBjmV.d.ts} +46 -1
- package/docs/cli.md +14 -9
- package/docs/configuration.md +16 -1
- package/docs/mcp.md +17 -7
- package/docs/output.md +3 -3
- package/docs/vs-gitingest.md +6 -2
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -23,6 +23,108 @@ deprecated with an explanatory message instead. `latest` has pointed at 0.9.0 si
|
|
|
23
23
|
|
|
24
24
|
---
|
|
25
25
|
|
|
26
|
+
## 0.9.17
|
|
27
|
+
|
|
28
|
+
Closes the remaining entries of the 0.9.16 verified-bug report and the follow-up report from a
|
|
29
|
+
CommonJS gateway. The theme is that a gate now proves what it claims: the manifest is the schema
|
|
30
|
+
it says it is, an artifact cannot be deleted while `validate` stays green, a staged snapshot is
|
|
31
|
+
what `git commit` will write, and a mask never changes what a file means.
|
|
32
|
+
|
|
33
|
+
**Redaction.** Unquoted assignments in source files are expressions, not credentials:
|
|
34
|
+
`SEARXNG_SECRET_KEY: optionalString`, `{ "x-api-key": key }` and `? "PASS" : "MUTATE"` survive
|
|
35
|
+
verbatim, while the same text in YAML, a `.env` or a shell file is still masked. A shell
|
|
36
|
+
expansion (`"${VAR:-…}"`, `$(date -u …)`) is a reference and is never partially masked; the
|
|
37
|
+
`-u` userinfo rule no longer matches a date format; `${VAR:?message}` keeps its message; and
|
|
38
|
+
placeholders (`replace-me-…`, `sk-...`, `<…>`) stay readable. A line whose quotes were balanced
|
|
39
|
+
before masking and not after is left untouched rather than emitted broken.
|
|
40
|
+
|
|
41
|
+
**Scope and graph.** `--staged` reads the index blob, so further unstaged edits are not
|
|
42
|
+
snapshotted, and a staged deletion is recorded as `deleted`. Git paths keep their bytes (no
|
|
43
|
+
`.trim()`, no backslash rewrite). A deleted module is a tombstone, so its importers are found by
|
|
44
|
+
`--with-dependents`. `tsconfig` `baseUrl`/`paths` aliases resolve. Case folding is a
|
|
45
|
+
platform property. `**` inside a segment no longer crosses `/`. `.gitignore` updates preserve
|
|
46
|
+
UTF-8/UTF-16 BOMs and dedupe by meaning; the entries written are root-anchored.
|
|
47
|
+
|
|
48
|
+
**Lifecycle.** The run lock carries a heartbeat refreshed from a worker thread (the main loop is
|
|
49
|
+
synchronous), so a zero-byte or pid-reused lock recovers in two minutes instead of an hour or
|
|
50
|
+
never. An async `afterGenerate` hook holds both locks until it settles, so it cannot mutate a
|
|
51
|
+
newer snapshot. Size limits are checked before the skeleton parse and before serialising a
|
|
52
|
+
monolith that cannot fit.
|
|
53
|
+
|
|
54
|
+
**Validation.** The manifest shape guard checks the schema it claims (`generator`, `git`,
|
|
55
|
+
`config`, `budgets`, `indexes`, `kinds`, per-file part/hash/size/mode, per-part
|
|
56
|
+
sha256/byteSize/index). `README.md`, `reports/navigation.md`, `reports/project-tree.md` and
|
|
57
|
+
`reports/audit.md` carry recorded digests and are verified; a navigation link that points at
|
|
58
|
+
nothing fails. `counts.totalLines` is summed from `files[]`, and the fingerprint is recomputed
|
|
59
|
+
from the manifest's files and recorded settings digest. A file deleted from disk is `missing`
|
|
60
|
+
with a detail, not a bare `read-error`, and `validate` surfaces unreadable skips.
|
|
61
|
+
|
|
62
|
+
**Internals.** Module configs are re-evaluated only when their bytes change. Layer/kind registries
|
|
63
|
+
are ordered-safe (`constructor`, `__proto__`). The derivation cache subtracts replaced entries
|
|
64
|
+
and is LRU. Part assembly is memoised. The ownership marker reuses digests recorded at write time.
|
|
65
|
+
`.js` is parsed as JavaScript, CommonJS exports are summarised, and Express/Hono/Koa/Fastify
|
|
66
|
+
route registrations populate route methods.
|
|
67
|
+
|
|
68
|
+
**MCP.** At most four requests run at once, with a typed `overloaded` error for the rest. The route
|
|
69
|
+
lookup is indexed rather than quadratic. A `snapshot_read` page that ends inside one very long line
|
|
70
|
+
reports `pageable: false` instead of advancing `fromLine` past the only line.
|
|
71
|
+
|
|
72
|
+
**Contracts and repository gates.** `describe` says JS/JSX for `--skeleton` and nested
|
|
73
|
+
`.gitignore` files for `--discovery`, and says `--autopilot` chooses the preset. `explain`
|
|
74
|
+
rejects the partitioning/artifact flags it never read and reports the inclusion mode
|
|
75
|
+
`generate` would choose. Every workflow action is pinned to a commit SHA, enforced by
|
|
76
|
+
`scripts/check-workflows.mjs` in `npm run verify`. Secret scanning no longer ignores `docs/**`,
|
|
77
|
+
`**/*.md` or `llms.txt`; the residual risk and the documented example values are stated in
|
|
78
|
+
`SECURITY.md`.
|
|
79
|
+
|
|
80
|
+
### Verified
|
|
81
|
+
|
|
82
|
+
`npm run verify` — lint, typecheck, 1,080 tests (0 failures, 8 skipped), the workflow pin check,
|
|
83
|
+
the docs sync check, the site build, the site link check, the site audit, the readme lint and the
|
|
84
|
+
tarball check
|
|
85
|
+
(38 files, lockfile agrees with 0.9.17). The publish workflow runs the same gate on Node 18, 20
|
|
86
|
+
and 22 before it uploads.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 0.9.16
|
|
91
|
+
|
|
92
|
+
A run refused by the lock it did not get could leave a lock of its own behind — one naming a
|
|
93
|
+
**live** pid, so the refusal outlived the run that caused it. The suite that should have noticed
|
|
94
|
+
was itself leaving scratch directories in the host temp directory: five days of runs had left 616
|
|
95
|
+
of them and about 600 MB. Both are fixed, and the second is why the first stayed hidden.
|
|
96
|
+
|
|
97
|
+
### A refused run kept the lock it took
|
|
98
|
+
|
|
99
|
+
`generate` locks the staging root and the output directory, in sorted order, before staging is
|
|
100
|
+
touched. The acquisitions came from one `map()`, so when the second lock was refused the first was
|
|
101
|
+
still held — and there was no list of releases to run in the `finally`, because the throw happened
|
|
102
|
+
before the assignment. The file left behind named the current process, so `reclaimStaleLock` read
|
|
103
|
+
it as an active run. An MCP server, watch mode, or a `setup` that retries would be refused for the
|
|
104
|
+
rest of that process's life, with no other run in existence.
|
|
105
|
+
|
|
106
|
+
Each acquisition is now recorded, and a failure releases the locks already taken. The regression
|
|
107
|
+
test starts a run that a fresh staging lock must refuse and asserts the output-directory lock is
|
|
108
|
+
gone afterwards.
|
|
109
|
+
|
|
110
|
+
### The test suite stops leaving its scratch directories behind
|
|
111
|
+
|
|
112
|
+
`npm test` created every fixture in the host temp directory and relied on each test to remove it.
|
|
113
|
+
Two tests never did: `agent-simulation.test.js` made two fixtures per run with no cleanup, and one
|
|
114
|
+
`repo()` argument in `generation-truth.test.js` was never assigned, so its directory had no handle
|
|
115
|
+
to remove. A wrapper now runs the suite with `TEMP`, `TMP` and `TMPDIR` pointed at one scratch root
|
|
116
|
+
that is deleted when the run ends, pass or fail, and reports by name anything a test leaves inside
|
|
117
|
+
it. Tests create scratch trees with `makeTempDir(t, prefix)`, which registers the removal with the
|
|
118
|
+
test, and a hygiene suite fails the build if a test creates a directory it never removes, if the
|
|
119
|
+
npm scripts stop using the wrapper, or if the fixture-heavy generation suite leaves anything behind.
|
|
120
|
+
|
|
121
|
+
### Verified
|
|
122
|
+
|
|
123
|
+
`npm run verify` — lint, typecheck, 1032 tests (0 failures, 7 skipped), the docs sync check, the
|
|
124
|
+
site build, the site audit, the readme lint and the tarball check — on the release commit. The same
|
|
125
|
+
gate runs on every pull request and every push to `main`, and the release runs it on Node 18, 20
|
|
126
|
+
and 22; Node 18 caught a portability defect in this release's own new test before it shipped.
|
|
127
|
+
|
|
26
128
|
## 0.9.15
|
|
27
129
|
|
|
28
130
|
A sixth audit, of the promises rather than the code paths the gate already covers. The gate was
|
package/README.md
CHANGED
|
@@ -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.17 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
|
@@ -71,6 +71,47 @@ Reports we want to hear about: a pattern that is *not* detected, a redaction tha
|
|
|
71
71
|
secret readable elsewhere (a report file, the manifest, a navigation index), or a way to make
|
|
72
72
|
the tool emit a sensitive file without `--include-sensitive-files`.
|
|
73
73
|
|
|
74
|
+
### Secret scanning of this repository
|
|
75
|
+
|
|
76
|
+
This repository is a *secret-redaction engine*, so it necessarily contains credential-shaped
|
|
77
|
+
strings: the test suites, the rule definitions in `src/security/patterns.ts` and
|
|
78
|
+
`src/security/redact.ts`, and the documentation all carry synthetic samples. They are the vectors
|
|
79
|
+
the engine is meant to detect, they cannot authenticate against any service, and they exist so
|
|
80
|
+
that detection can be proved. They are **not** credentials.
|
|
81
|
+
|
|
82
|
+
Secret scanners are therefore configured to skip the surfaces that are synthetic by
|
|
83
|
+
construction, instead of asking a human to dismiss the same alert on every push:
|
|
84
|
+
|
|
85
|
+
| Surface | Why it is excluded |
|
|
86
|
+
| :--- | :--- |
|
|
87
|
+
| `tests/**` | the fixtures assert that detection fires |
|
|
88
|
+
| `audit/**` | verification reports quote the probes they describe |
|
|
89
|
+
| `src/security/patterns.ts`, `src/security/redact.ts` | the rule definitions and their worked examples |
|
|
90
|
+
| `package-lock.json` | integrity digests are not credentials |
|
|
91
|
+
|
|
92
|
+
`docs/**`, `**/*.md` and `llms.txt` are **not** excluded any more. They used to be, which put
|
|
93
|
+
every published page and the README outside the detector: a real token pasted into documentation
|
|
94
|
+
would not have been reported. Those files are scanned now.
|
|
95
|
+
|
|
96
|
+
The documented example values that remain in scanned files are
|
|
97
|
+
`hunter2`/`hunter2hunter2`, `AKIAIOSFODNN7EXAMPLE`, `replace-me-…`, `<…>` placeholders and
|
|
98
|
+
`sk-...`. They are synthetic and cannot authenticate. An alert naming one of them is reviewed
|
|
99
|
+
and allowlisted by value in the scanner's dashboard rather than by excluding the whole file —
|
|
100
|
+
**owner: the maintainers**, reviewed when a scanner version changes its generic detectors. This is
|
|
101
|
+
a residual risk: a real credential in a Markdown file is outside the file-level exclusion list and
|
|
102
|
+
is reported, but a real credential *inside a documented example value* would not be.
|
|
103
|
+
|
|
104
|
+
Both scanner configurations carry the file-level list: `.github/secret_scanning.yml` for GitHub's
|
|
105
|
+
scanner and `.gitguardian.yaml` for ggshield, the GitGuardian CLI and CI scanner. The GitGuardian
|
|
106
|
+
*dashboard* does not read either file — its exclusions live in workspace settings
|
|
107
|
+
(**Secrets detection → Filepath exclusions**) and are applied retroactively, so adding them
|
|
108
|
+
there also clears incidents that already exist. Its allowlist is configured there too.
|
|
109
|
+
|
|
110
|
+
Anywhere outside those paths, a real credential is handled normally: it is reported and it must
|
|
111
|
+
be revoked. If you add a fixture outside them, use a placeholder no detector matches, or extend
|
|
112
|
+
the exclusion list deliberately in the same commit — do not weaken detection.
|
|
113
|
+
|
|
114
|
+
|
|
74
115
|
**Filesystem safety.** The output directory is written to a scratch directory and swapped in
|
|
75
116
|
atomically, and it is only replaced when a previous run wrote it. Ownership is proved by the
|
|
76
117
|
`.codebase-snapshot` marker — a JSON object naming this generator, with a schema version, a
|