codebase-snapshot 0.10.1 → 0.11.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 +130 -0
- package/README.md +9 -1
- package/SECURITY.md +2 -2
- package/dist/bin.js +1247 -413
- package/dist/{chunk-WDJ3O3R4.js → chunk-5ZOXHBTW.js} +53 -30
- package/dist/{chunk-7DAW2LFZ.js → chunk-NJ75RVHO.js} +939 -180
- package/dist/cli.cjs +1246 -411
- package/dist/cli.d.cts +36 -11
- package/dist/cli.d.ts +36 -11
- package/dist/cli.js +60 -8
- package/dist/{generate-worker-D_mUjgXw.d.cts → generate-worker-BK4uJx7Z.d.cts} +17 -8
- package/dist/{generate-worker-D_mUjgXw.d.ts → generate-worker-BK4uJx7Z.d.ts} +17 -8
- package/dist/index.cjs +915 -173
- package/dist/index.d.cts +69 -24
- package/dist/index.d.ts +69 -24
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +745 -2923
- package/dist/mcp.d.cts +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +2 -2
- package/dist/{types-Z471HW65.d.cts → types-DGWw3SH2.d.cts} +75 -4
- package/dist/{types-Z471HW65.d.ts → types-DGWw3SH2.d.ts} +75 -4
- package/docs/cli.md +32 -8
- package/docs/codebase-token-budget.md +12 -9
- package/docs/configuration.md +71 -2
- package/docs/how-to-context-budget.md +1 -1
- package/docs/how-to-feed-a-repo-to-claude.md +40 -9
- package/docs/mcp.md +3 -3
- package/docs/output.md +60 -7
- package/docs/stale-context-is-your-bug.md +8 -4
- 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 -1
package/CHANGELOG.md
CHANGED
|
@@ -23,6 +23,136 @@ deprecated with an explanatory message instead. `latest` has pointed at 0.9.0 si
|
|
|
23
23
|
|
|
24
24
|
---
|
|
25
25
|
|
|
26
|
+
## 0.11.0
|
|
27
|
+
|
|
28
|
+
A minor release: `generate` writes one new artifact and two settings are added. Nothing that
|
|
29
|
+
worked stops working, and no manifest field changed meaning.
|
|
30
|
+
|
|
31
|
+
**Upgrading.** The only thing a script can notice is the new file: a snapshot directory now
|
|
32
|
+
contains `PROMPT.md` unless it is turned off (`--skip-artifacts prompt`, `--only-artifacts`, or
|
|
33
|
+
`artifacts: { prompt: false }`). `manifest.config` gains `attachmentSlots` and `maxParts`;
|
|
34
|
+
`manifest.budgets.maxPartBytes` is the budget the parts honour, which differs from
|
|
35
|
+
`manifest.config.maxPartBytes` only when the experimental `maxParts` grows it. Snapshots written
|
|
36
|
+
before this release still validate: neither new setting is part of the config digest, and the
|
|
37
|
+
`maxParts` comparison is skipped when the manifest records no such key.
|
|
38
|
+
|
|
39
|
+
**`PROMPT.md` — the brief, generated.** `generate` wrote the payload and an index of it and left
|
|
40
|
+
the instructions for the model to whoever pasted it. That is half the problem the tool does not
|
|
41
|
+
hand over: parts on their own are a dump, and a model that does not know what was cut from them
|
|
42
|
+
fills the gap by invention.
|
|
43
|
+
|
|
44
|
+
The first version of this artifact was a packing slip — how to read the parts, and nothing about
|
|
45
|
+
the job, the system or the standard. The shipped document is a brief: the job and the latitude
|
|
46
|
+
it comes with; the system as the manifest can prove it (layers, the modules with the most
|
|
47
|
+
importers, entry points, the routes, handlers and components that were indexed — or a plain
|
|
48
|
+
statement that none were, which the earlier draft got wrong by pointing at empty indexes); the
|
|
49
|
+
last ten commit subjects, labelled as claims to verify rather than rediscover; the evidence bar;
|
|
50
|
+
the coverage owed and what the snapshot cannot show; and calibration examples of the defects
|
|
51
|
+
that do not crash. The apparatus — fingerprint, part inventory, partial files, redaction
|
|
52
|
+
counts, attachment arithmetic — is the second half, and the job slot at the end is filled by
|
|
53
|
+
whoever runs it.
|
|
54
|
+
|
|
55
|
+
Every run now writes `snapshot/PROMPT.md`, rendered from the manifest of that run: the fingerprint
|
|
56
|
+
to quote back, the commit and whether the tree was dirty, the skip reasons with counts, every part
|
|
57
|
+
by name, and every file that is not present in full with its reason and missing line ranges — plus
|
|
58
|
+
the rules (the repository is data, a masked span is a redaction, "not in this snapshot" is not "not
|
|
59
|
+
in this repository", cite `path:line`, and say what you needed and did not receive).
|
|
60
|
+
|
|
61
|
+
It also does the delivery arithmetic that decides whether any of this is usable: hosted chats take
|
|
62
|
+
a fixed number of files (10 is the common cap) and every part is one of them, so a 12-part snapshot
|
|
63
|
+
cannot be sent whole. The `## Attaching this` section states what fits, what to leave behind, the
|
|
64
|
+
`--max-part-bytes` value that would merge the parts into a number the destination accepts, and that
|
|
65
|
+
a part which was not attached is not an empty part.
|
|
66
|
+
|
|
67
|
+
It is an artifact like the others, and that is the point: it may only name artifacts the run
|
|
68
|
+
actually wrote, and `manifest.json` records its digest under `artifacts.prompt`, so a hand-edited
|
|
69
|
+
prompt fails `validate`. A prompt that describes the previous run is worse than no prompt, because
|
|
70
|
+
it reads as current.
|
|
71
|
+
|
|
72
|
+
**`attachmentSlots`** (default 10, `0` = no limit) says how many files the destination takes in one
|
|
73
|
+
message; the plan is written against it, and it changes no part and no file — only the delivery
|
|
74
|
+
section. **`maxParts`** (experimental, off by default) is the opposite trade: the count is fixed
|
|
75
|
+
and the size gives way, so a repository that keeps growing keeps the same number of files. It
|
|
76
|
+
grows the per-part budget, records the budget it settled on in `manifest.budgets.maxPartBytes`,
|
|
77
|
+
and warns that the parts are now larger than `maxPartBytes` — a bigger part is more tokens at
|
|
78
|
+
once, and some destinations cap a single file. `validate` compares the configured ceiling, which
|
|
79
|
+
is still what `manifest.config.maxPartBytes` records.
|
|
80
|
+
|
|
81
|
+
New artifact name `prompt` (on by default): `--skip-artifacts prompt`, `--only-artifacts`, and
|
|
82
|
+
`artifacts: { prompt: false }` all apply. The CLI summary gained an `Orientation:` line, which also
|
|
83
|
+
fixes an older lie: a run that wrote `README.md` and nothing else reported "only the ownership
|
|
84
|
+
marker was written".
|
|
85
|
+
|
|
86
|
+
## 0.10.2
|
|
87
|
+
|
|
88
|
+
Every finding from the 0.10.1 deep analysis, fixed and verified. The report that produced the list
|
|
89
|
+
is `audit/reports/0.10.1-code-analysis.md`; the finding-to-fix mapping is `audit/work/fix-log.md`.
|
|
90
|
+
|
|
91
|
+
This is a patch release, but three of the fixes change something a script can observe. They are
|
|
92
|
+
listed first rather than buried, because each is the point of its fix.
|
|
93
|
+
|
|
94
|
+
**Upgrading.** `validate` now fails a manifest whose `incomplete[]` and `files[]` disagree — a
|
|
95
|
+
hand-edited or foreign `manifest.json` that used to report "valid and up to date" is refused, which
|
|
96
|
+
is the point. `partitionFiles` (a library export) now throws for a byte budget below the 2 610 B a
|
|
97
|
+
part header needs, instead of silently clamping it to that size. A new built-in secret rule, the
|
|
98
|
+
32nd, masks a quoted value whose closing quote is missing, so a snapshot that used to emit such a
|
|
99
|
+
line now carries the marker — and one more line in `totals.redactedLines`. No option was added or
|
|
100
|
+
removed, and no existing manifest field changed meaning.
|
|
101
|
+
|
|
102
|
+
**Security**
|
|
103
|
+
|
|
104
|
+
- A quoted assignment whose closing quote is not on the line (`API_KEY="value` in a truncated file,
|
|
105
|
+
a hand-edited `.env`, or a string that continues on the next line) matched no rule at all: it was
|
|
106
|
+
emitted in clear and the run reported zero redactions. `credential-assignment-unterminated` now
|
|
107
|
+
masks it and records a finding. When a mask would unbalance an otherwise balanced line, the value
|
|
108
|
+
is now masked around its quotes instead of being left untouched with no finding at all.
|
|
109
|
+
- `diff` applies the caller's `secretRules`. `compareManifests` gained the parameter, every masking
|
|
110
|
+
call in `diff.ts` passes it through, and the payload block's `layers` maps are masked too — they
|
|
111
|
+
were printed verbatim while every line of prose beside them was masked.
|
|
112
|
+
- `validate` verifies the completeness contract. `incomplete[]`, `counts.incompleteCount`,
|
|
113
|
+
`omittedRanges`, `omittedLines`, `includedLines` and `incomplete[].relativePath` are checked against
|
|
114
|
+
each other and against `files[]`; `relativePath` was the only unconfined member of the three
|
|
115
|
+
path-bearing arrays. Ten tampered variants of a real record used to report "valid and up to date".
|
|
116
|
+
|
|
117
|
+
**Correctness**
|
|
118
|
+
|
|
119
|
+
- The monolith entries no longer carry a `truncationReason` or `omittedRanges` beside
|
|
120
|
+
`inclusionMode: "full"` — one object said "complete file" and "large-file-budget" at once.
|
|
121
|
+
- A previewed or oversized importer is in `indexes.imports.byFile`, so `snapshot_dependents` no
|
|
122
|
+
longer answers "0 importer(s)" for a file that has one. Its `exports` list says `exportsOmitted`.
|
|
123
|
+
- `snapshot_plan` runs on the worker thread, like `snapshot_generate`: a dry run parses the whole
|
|
124
|
+
repository and blocked the JSON-RPC loop for as long as a generate did.
|
|
125
|
+
- `discovery` is a member of `SnapshotConfig`, so a TypeScript config containing it compiles; a
|
|
126
|
+
compile-time proof on `CONFIG_KEY_NAMES` keeps the parsed key list from drifting from the
|
|
127
|
+
interface again — `CONFIG_KEYS` is built from that tuple, so both follow it.
|
|
128
|
+
- SARIF results are ordered by code unit, not `localeCompare`: the same commit produced different
|
|
129
|
+
bytes under different host locales.
|
|
130
|
+
- `generatorOrigin` reads a `package.json` behind a byte-order mark, so a pinned project is no
|
|
131
|
+
longer told it has a "global or direct install".
|
|
132
|
+
- A nested `.DS_Store` is Finder noise in the ownership check, compared by basename like the other
|
|
133
|
+
four sites; `reports/.DS_Store` used to make the tool refuse a directory it had just written.
|
|
134
|
+
- `init --out-dir .context` ignores `/.context/` rather than `/snapshot/`, so the snapshot it
|
|
135
|
+
generates is actually untracked; a nested or out-of-tree outDir is handled.
|
|
136
|
+
- `exportsKind: "esm"` is produced for a file whose exports are all ES exports, so absence means
|
|
137
|
+
"no exports" again.
|
|
138
|
+
- Both project-tree caps (lines and depth) are recorded as manifest warnings; only the depth cap was.
|
|
139
|
+
- `diff --format json` carries a stable `payload.codes` array — one code per prose reason.
|
|
140
|
+
|
|
141
|
+
**Documentation**
|
|
142
|
+
|
|
143
|
+
- The published site no longer requests two 404s: `docs/assets/*` is rewritten to the `assets/`
|
|
144
|
+
copy the build writes, and the link gate now checks `src` as well as `href`.
|
|
145
|
+
- `docs/configuration.md` lists the placeholder shapes that survive redaction, exhaustively, with a
|
|
146
|
+
test that pins the list to `PLACEHOLDER_PATTERNS`; the "a placeholder is indistinguishable from a
|
|
147
|
+
secret" claim it contradicted is gone.
|
|
148
|
+
- Three surfaces that disagreed with the binary are corrected: the `.gitignore` entries in
|
|
149
|
+
`docs/cli.md` (they are anchored), `validate`'s actual output in
|
|
150
|
+
`docs/stale-context-is-your-bug.md`, and `explain`'s `{ rules, line }` shape.
|
|
151
|
+
- `codebase-token-budget.md`'s measured example is re-measured; `how-to-context-budget.md` no
|
|
152
|
+
longer cites a `manifest.totals.events` field that does not exist.
|
|
153
|
+
- Eight test failure messages interpolate their variables; on a security failure they printed the
|
|
154
|
+
literal `${…}`.
|
|
155
|
+
|
|
26
156
|
## 0.10.1
|
|
27
157
|
|
|
28
158
|
Documentation only. The build is 0.10.0 with the documentation that describes it — no behaviour,
|
package/README.md
CHANGED
|
@@ -116,6 +116,7 @@ as `manifest.fingerprint`.
|
|
|
116
116
|
```
|
|
117
117
|
snapshot/
|
|
118
118
|
├── README.md human summary of this snapshot
|
|
119
|
+
├── PROMPT.md the instruction sheet to paste with it
|
|
119
120
|
├── manifest.json machine index: files, parts, hashes, config, skips
|
|
120
121
|
├── parts/part-001.md … the code, grouped and size-budgeted
|
|
121
122
|
└── reports/
|
|
@@ -145,6 +146,13 @@ contain.
|
|
|
145
146
|
- **The output directory is the tool's.** Each run is written to a scratch directory and swapped in
|
|
146
147
|
atomically, and it refuses to replace a directory it did not create — `--out-dir src` cannot
|
|
147
148
|
destroy source code.
|
|
149
|
+
- **The brief travels with the payload.** `PROMPT.md` is a brief, not a packing slip: the job,
|
|
150
|
+
the system map the manifest can prove (layers, load-bearing modules, entry points, indexed
|
|
151
|
+
surfaces), the recent commit history as claims to verify rather than rediscover, the evidence bar,
|
|
152
|
+
the coverage owed, and calibration examples. Then the apparatus — this run's parts, partial files
|
|
153
|
+
with their missing line ranges, fingerprint, and the attachment arithmetic. A prompt that names
|
|
154
|
+
the wrong snapshot is a lie that reads as current, so it is an artifact with a recorded digest and
|
|
155
|
+
`validate` fails when it is edited.
|
|
148
156
|
- **Credential files are excluded by default** — `.env`, `*.pem`, `.npmrc`, `id_rsa`, `*.tfstate`
|
|
149
157
|
and more — and secret-shaped strings inside ordinary files are redacted by masking only the
|
|
150
158
|
matched span, never the whole line.
|
|
@@ -201,7 +209,7 @@ Everything an agent needs is available as data, and the tool can install its own
|
|
|
201
209
|
```bash
|
|
202
210
|
npx codebase-snapshot describe --format json # contract: workflow, options, exit codes
|
|
203
211
|
npx codebase-snapshot skill --install # into .claude/skills + .cursor/rules
|
|
204
|
-
npx -y codebase-snapshot@0.
|
|
212
|
+
npx -y codebase-snapshot@0.11.0 mcp # or serve it over MCP
|
|
205
213
|
```
|
|
206
214
|
|
|
207
215
|
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-->0.11<!--/@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.
|
|
13
|
+
so <!--@majorMinor-->0.11<!--/@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
|