codebase-snapshot 0.10.0 → 0.10.1
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 +29 -1
- package/README.md +3 -2
- package/dist/bin.js +9 -11
- package/dist/{chunk-EP7OCPUM.js → chunk-7DAW2LFZ.js} +7 -9
- package/dist/{chunk-4H7MSW64.js → chunk-WDJ3O3R4.js} +2 -2
- package/dist/cli.cjs +8 -11
- package/dist/cli.js +4 -4
- package/dist/index.cjs +7 -9
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +2 -2
- package/dist/mcp.js +2 -2
- package/docs/cli.md +3 -3
- package/docs/codebase-token-budget.md +4 -3
- package/docs/configuration.md +1 -1
- package/docs/how-to-context-budget.md +1 -0
- package/docs/how-to-feed-a-repo-to-claude.md +3 -2
- package/docs/mcp.md +4 -4
- package/docs/output.md +1 -1
- package/docs/stale-context-is-your-bug.md +6 -0
- package/docs/vs-code2prompt.md +3 -2
- package/docs/vs-gitingest.md +4 -3
- package/docs/vs-repomix.md +3 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -23,6 +23,34 @@ deprecated with an explanatory message instead. `latest` has pointed at 0.9.0 si
|
|
|
23
23
|
|
|
24
24
|
---
|
|
25
25
|
|
|
26
|
+
## 0.10.1
|
|
27
|
+
|
|
28
|
+
Documentation only. The build is 0.10.0 with the documentation that describes it — no behaviour,
|
|
29
|
+
option or manifest field changed.
|
|
30
|
+
|
|
31
|
+
`npm install codebase-snapshot@0.10.0` bundles `README.md`, `CHANGELOG.md` and `docs/*.md` as they
|
|
32
|
+
stood when that tarball was built. The documentation pass that followed 0.10.0 landed after that,
|
|
33
|
+
so anyone reading `node_modules/codebase-snapshot/docs/` got the previous release's description of
|
|
34
|
+
truncation — including `docs/output.md` explaining an `isLarge: false` preview route that 0.10.0
|
|
35
|
+
had already turned into a config error. Publishing the corrected docs is the whole change.
|
|
36
|
+
|
|
37
|
+
Corrected in that pass, for the record:
|
|
38
|
+
|
|
39
|
+
- `--help` printed the pre-0.10.0 `--large-file-bytes` default (204800).
|
|
40
|
+
- Three comparison pages promised a file too large is "truncated with a marker" rather than a
|
|
41
|
+
preview listed in `incomplete[]`.
|
|
42
|
+
- `docs/output.md` documented a preview route that no longer exists, and did not mention
|
|
43
|
+
`truncationReason`, `omittedRanges` or `summaryOmittedReason`.
|
|
44
|
+
- `docs/configuration.md` listed the old per-preset budgets (100k–200k) and quoted
|
|
45
|
+
`recommendedBudget: "120k"`.
|
|
46
|
+
- The README, the `describe` contract's `consume` step and the MCP `snapshot://manifest` row
|
|
47
|
+
described the manifest without `incomplete[]`.
|
|
48
|
+
- `setup` wrote `largeFileBytes: "200k"` beside a 300 KB budget, previewing files that would fit.
|
|
49
|
+
It follows the budget now, which is what the pages already claimed.
|
|
50
|
+
|
|
51
|
+
Also: `sync-docs` rewrites the `Generator: … (project dependency ^…)` banner sample, which sat in
|
|
52
|
+
a fence and so could not carry a marker. It described the previous release from the day after
|
|
53
|
+
every publish; it cannot now.
|
|
26
54
|
## 0.10.0
|
|
27
55
|
|
|
28
56
|
The 0.9.18 report had one real bug in it. A complete file could be cut down to fit a part budget
|
|
@@ -94,7 +122,7 @@ behaviour depends on whichever `npx` cache or global install was first on `PATH`
|
|
|
94
122
|
pinned project dependency exists to prevent:
|
|
95
123
|
|
|
96
124
|
```
|
|
97
|
-
Branch: main | Part budget: 300 KB | Generator: 0.
|
|
125
|
+
Branch: main | Part budget: 300 KB | Generator: 0.10.0 (via npx)
|
|
98
126
|
```
|
|
99
127
|
|
|
100
128
|
The origin is printed and not written into an artefact: an artefact naming an absolute install
|
package/README.md
CHANGED
|
@@ -48,7 +48,8 @@ and choosing what matters by hand neither scales nor repeats. This does it deter
|
|
|
48
48
|
a file too big for a part becomes a head/tail excerpt with an omission marker, and `manifest.json`
|
|
49
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
|
-
language, part, hash and a structural summary,
|
|
51
|
+
language, part, hash and a structural summary, every *excluded* file with the reason, and an
|
|
52
|
+
`incomplete[]` list of every file it could only emit in part, with the line ranges it lost.
|
|
52
53
|
- **Provably current.** `validate` re-hashes the repository against the snapshot and exits non-zero
|
|
53
54
|
on any drift, so a pipeline can gate on the context being fresh.
|
|
54
55
|
- **Repeatable.** Two runs over unchanged input give byte-identical parts and the same
|
|
@@ -200,7 +201,7 @@ Everything an agent needs is available as data, and the tool can install its own
|
|
|
200
201
|
```bash
|
|
201
202
|
npx codebase-snapshot describe --format json # contract: workflow, options, exit codes
|
|
202
203
|
npx codebase-snapshot skill --install # into .claude/skills + .cursor/rules
|
|
203
|
-
npx -y codebase-snapshot@0.10.
|
|
204
|
+
npx -y codebase-snapshot@0.10.1 mcp # or serve it over MCP
|
|
204
205
|
```
|
|
205
206
|
|
|
206
207
|
An agent told only "use `npx codebase-snapshot`" can read the contract, follow its ordered
|
package/dist/bin.js
CHANGED
|
@@ -2150,7 +2150,7 @@ function applySpans(line, spans) {
|
|
|
2150
2150
|
|
|
2151
2151
|
// src/version.ts
|
|
2152
2152
|
var GENERATOR_NAME = "codebase-snapshot";
|
|
2153
|
-
var GENERATOR_VERSION = "0.10.
|
|
2153
|
+
var GENERATOR_VERSION = "0.10.1";
|
|
2154
2154
|
var SCHEMA_VERSION = "3.0.0";
|
|
2155
2155
|
var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
|
|
2156
2156
|
function isOurGeneratorName(name) {
|
|
@@ -7643,7 +7643,7 @@ var DEFAULT_ANSWERS = {
|
|
|
7643
7643
|
branch: "main",
|
|
7644
7644
|
maxPartBytes: "300k",
|
|
7645
7645
|
maxPartTokens: null,
|
|
7646
|
-
largeFileBytes: "
|
|
7646
|
+
largeFileBytes: "300k",
|
|
7647
7647
|
maxMonolithBytes: null,
|
|
7648
7648
|
discovery: "auto",
|
|
7649
7649
|
skeleton: false,
|
|
@@ -8409,13 +8409,11 @@ async function runInit(options) {
|
|
|
8409
8409
|
// what the run used is drift the next `validate` reports, and `setup` is the one command
|
|
8410
8410
|
// that is supposed to leave a project in a consistent state.
|
|
8411
8411
|
maxPartTokens: options.maxPartTokens ?? DEFAULT_ANSWERS.maxPartTokens,
|
|
8412
|
-
|
|
8413
|
-
// cannot fit, so it is cut while the manifest
|
|
8414
|
-
// 200 KB beside `--max-part-tokens 32k` made
|
|
8415
|
-
|
|
8416
|
-
|
|
8417
|
-
effectiveBudgetBytes
|
|
8418
|
-
),
|
|
8412
|
+
// Follows the budget unless the caller named one. A threshold above the part budget is a
|
|
8413
|
+
// config error (a file between the two cannot fit a part, so it is cut while the manifest
|
|
8414
|
+
// calls it a preview); a fixed 200 KB beside `--max-part-tokens 32k` made setup's own output
|
|
8415
|
+
// fail its own validate, and a fixed 200 KB under a 300 KB budget previewed files that fit.
|
|
8416
|
+
largeFileBytes: options.largeFileBytes ?? effectiveBudgetBytes,
|
|
8419
8417
|
maxMonolithBytes: options.maxMonolithBytes ?? DEFAULT_ANSWERS.maxMonolithBytes,
|
|
8420
8418
|
discovery: options.discovery ?? DEFAULT_ANSWERS.discovery,
|
|
8421
8419
|
skeleton: options.skeleton ?? DEFAULT_ANSWERS.skeleton,
|
|
@@ -13692,7 +13690,7 @@ function buildAgentContract() {
|
|
|
13692
13690
|
id: "consume",
|
|
13693
13691
|
run: "read ./snapshot/parts/*.md, then ./snapshot/manifest.json, then ./snapshot/reports/audit.md",
|
|
13694
13692
|
expect: "the code, the index of what was included, and the risk findings",
|
|
13695
|
-
notes: "manifest.json.files[] lists every included file with layer, kind, language, part and summary. manifest.skipped[] explains every file that was left out and why."
|
|
13693
|
+
notes: "manifest.json.files[] lists every included file with layer, kind, language, part and summary. manifest.skipped[] explains every file that was left out and why; manifest.incomplete[] lists every included file that is not present in full, with its missing line ranges."
|
|
13696
13694
|
}
|
|
13697
13695
|
],
|
|
13698
13696
|
commands: [
|
|
@@ -15374,7 +15372,7 @@ Options:
|
|
|
15374
15372
|
--max-part-bytes <n> Maximum byte budget per markdown part (default: 307200).
|
|
15375
15373
|
Accepts units: 120k, 1.5mb
|
|
15376
15374
|
--max-part-tokens <n> Per-part budget in tokens; narrows --max-part-bytes
|
|
15377
|
-
--large-file-bytes <n>
|
|
15375
|
+
--large-file-bytes <n> Preview threshold (default: the part budget; never above it)
|
|
15378
15376
|
--changed-since <ref> Only files changed since this git ref, plus untracked ones
|
|
15379
15377
|
--staged Only files staged for the next commit
|
|
15380
15378
|
--with-dependents With the two above: also include their importers
|
|
@@ -3863,7 +3863,7 @@ function applySpans(line, spans) {
|
|
|
3863
3863
|
|
|
3864
3864
|
// src/version.ts
|
|
3865
3865
|
var GENERATOR_NAME = "codebase-snapshot";
|
|
3866
|
-
var GENERATOR_VERSION = "0.10.
|
|
3866
|
+
var GENERATOR_VERSION = "0.10.1";
|
|
3867
3867
|
var SCHEMA_VERSION = "3.0.0";
|
|
3868
3868
|
var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
|
|
3869
3869
|
function isOurGeneratorName(name) {
|
|
@@ -8838,7 +8838,7 @@ var DEFAULT_ANSWERS = {
|
|
|
8838
8838
|
branch: "main",
|
|
8839
8839
|
maxPartBytes: "300k",
|
|
8840
8840
|
maxPartTokens: null,
|
|
8841
|
-
largeFileBytes: "
|
|
8841
|
+
largeFileBytes: "300k",
|
|
8842
8842
|
maxMonolithBytes: null,
|
|
8843
8843
|
discovery: "auto",
|
|
8844
8844
|
skeleton: false,
|
|
@@ -9601,13 +9601,11 @@ async function runInit(options) {
|
|
|
9601
9601
|
// what the run used is drift the next `validate` reports, and `setup` is the one command
|
|
9602
9602
|
// that is supposed to leave a project in a consistent state.
|
|
9603
9603
|
maxPartTokens: options.maxPartTokens ?? DEFAULT_ANSWERS.maxPartTokens,
|
|
9604
|
-
|
|
9605
|
-
// cannot fit, so it is cut while the manifest
|
|
9606
|
-
// 200 KB beside `--max-part-tokens 32k` made
|
|
9607
|
-
|
|
9608
|
-
|
|
9609
|
-
effectiveBudgetBytes
|
|
9610
|
-
),
|
|
9604
|
+
// Follows the budget unless the caller named one. A threshold above the part budget is a
|
|
9605
|
+
// config error (a file between the two cannot fit a part, so it is cut while the manifest
|
|
9606
|
+
// calls it a preview); a fixed 200 KB beside `--max-part-tokens 32k` made setup's own output
|
|
9607
|
+
// fail its own validate, and a fixed 200 KB under a 300 KB budget previewed files that fit.
|
|
9608
|
+
largeFileBytes: options.largeFileBytes ?? effectiveBudgetBytes,
|
|
9611
9609
|
maxMonolithBytes: options.maxMonolithBytes ?? DEFAULT_ANSWERS.maxMonolithBytes,
|
|
9612
9610
|
discovery: options.discovery ?? DEFAULT_ANSWERS.discovery,
|
|
9613
9611
|
skeleton: options.skeleton ?? DEFAULT_ANSWERS.skeleton,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GENERATOR_VERSION, anchorForPath, displayPath, MIN_MAX_PART_BYTES, SCHEMA_VERSION, GENERATOR_NAME, ARTIFACT_NAMES, PRESETS, generateSnapshot, generateInWorker, validateSnapshot, buildImportResolver, resolveSpecifier, truncateToBytes, explainPath, renderExplainText, describeManifestShapeProblem, loadConfigFileDetailed, parseByteSize, resolveConfig } from './chunk-
|
|
1
|
+
import { GENERATOR_VERSION, anchorForPath, displayPath, MIN_MAX_PART_BYTES, SCHEMA_VERSION, GENERATOR_NAME, ARTIFACT_NAMES, PRESETS, generateSnapshot, generateInWorker, validateSnapshot, buildImportResolver, resolveSpecifier, truncateToBytes, explainPath, renderExplainText, describeManifestShapeProblem, loadConfigFileDetailed, parseByteSize, resolveConfig } from './chunk-7DAW2LFZ.js';
|
|
2
2
|
import * as fs from 'fs';
|
|
3
3
|
import * as path from 'path';
|
|
4
4
|
|
|
@@ -1768,7 +1768,7 @@ function buildAgentContract() {
|
|
|
1768
1768
|
id: "consume",
|
|
1769
1769
|
run: "read ./snapshot/parts/*.md, then ./snapshot/manifest.json, then ./snapshot/reports/audit.md",
|
|
1770
1770
|
expect: "the code, the index of what was included, and the risk findings",
|
|
1771
|
-
notes: "manifest.json.files[] lists every included file with layer, kind, language, part and summary. manifest.skipped[] explains every file that was left out and why."
|
|
1771
|
+
notes: "manifest.json.files[] lists every included file with layer, kind, language, part and summary. manifest.skipped[] explains every file that was left out and why; manifest.incomplete[] lists every included file that is not present in full, with its missing line ranges."
|
|
1772
1772
|
}
|
|
1773
1773
|
],
|
|
1774
1774
|
commands: [
|
package/dist/cli.cjs
CHANGED
|
@@ -2179,7 +2179,7 @@ function applySpans(line, spans) {
|
|
|
2179
2179
|
|
|
2180
2180
|
// src/version.ts
|
|
2181
2181
|
var GENERATOR_NAME = "codebase-snapshot";
|
|
2182
|
-
var GENERATOR_VERSION = "0.10.
|
|
2182
|
+
var GENERATOR_VERSION = "0.10.1";
|
|
2183
2183
|
var SCHEMA_VERSION = "3.0.0";
|
|
2184
2184
|
var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
|
|
2185
2185
|
function isOurGeneratorName(name) {
|
|
@@ -7622,7 +7622,6 @@ function gitignorePath(cwd, filePath) {
|
|
|
7622
7622
|
var DEFAULT_ANSWERS = {
|
|
7623
7623
|
maxPartBytes: "300k",
|
|
7624
7624
|
maxPartTokens: null,
|
|
7625
|
-
largeFileBytes: "200k",
|
|
7626
7625
|
maxMonolithBytes: null,
|
|
7627
7626
|
discovery: "auto",
|
|
7628
7627
|
skeleton: false,
|
|
@@ -8383,13 +8382,11 @@ async function runInit(options) {
|
|
|
8383
8382
|
// what the run used is drift the next `validate` reports, and `setup` is the one command
|
|
8384
8383
|
// that is supposed to leave a project in a consistent state.
|
|
8385
8384
|
maxPartTokens: options.maxPartTokens ?? DEFAULT_ANSWERS.maxPartTokens,
|
|
8386
|
-
|
|
8387
|
-
// cannot fit, so it is cut while the manifest
|
|
8388
|
-
// 200 KB beside `--max-part-tokens 32k` made
|
|
8389
|
-
|
|
8390
|
-
|
|
8391
|
-
effectiveBudgetBytes
|
|
8392
|
-
),
|
|
8385
|
+
// Follows the budget unless the caller named one. A threshold above the part budget is a
|
|
8386
|
+
// config error (a file between the two cannot fit a part, so it is cut while the manifest
|
|
8387
|
+
// calls it a preview); a fixed 200 KB beside `--max-part-tokens 32k` made setup's own output
|
|
8388
|
+
// fail its own validate, and a fixed 200 KB under a 300 KB budget previewed files that fit.
|
|
8389
|
+
largeFileBytes: options.largeFileBytes ?? effectiveBudgetBytes,
|
|
8393
8390
|
maxMonolithBytes: options.maxMonolithBytes ?? DEFAULT_ANSWERS.maxMonolithBytes,
|
|
8394
8391
|
discovery: options.discovery ?? DEFAULT_ANSWERS.discovery,
|
|
8395
8392
|
skeleton: options.skeleton ?? DEFAULT_ANSWERS.skeleton,
|
|
@@ -13614,7 +13611,7 @@ function buildAgentContract() {
|
|
|
13614
13611
|
id: "consume",
|
|
13615
13612
|
run: "read ./snapshot/parts/*.md, then ./snapshot/manifest.json, then ./snapshot/reports/audit.md",
|
|
13616
13613
|
expect: "the code, the index of what was included, and the risk findings",
|
|
13617
|
-
notes: "manifest.json.files[] lists every included file with layer, kind, language, part and summary. manifest.skipped[] explains every file that was left out and why."
|
|
13614
|
+
notes: "manifest.json.files[] lists every included file with layer, kind, language, part and summary. manifest.skipped[] explains every file that was left out and why; manifest.incomplete[] lists every included file that is not present in full, with its missing line ranges."
|
|
13618
13615
|
}
|
|
13619
13616
|
],
|
|
13620
13617
|
commands: [
|
|
@@ -15286,7 +15283,7 @@ Options:
|
|
|
15286
15283
|
--max-part-bytes <n> Maximum byte budget per markdown part (default: 307200).
|
|
15287
15284
|
Accepts units: 120k, 1.5mb
|
|
15288
15285
|
--max-part-tokens <n> Per-part budget in tokens; narrows --max-part-bytes
|
|
15289
|
-
--large-file-bytes <n>
|
|
15286
|
+
--large-file-bytes <n> Preview threshold (default: the part budget; never above it)
|
|
15290
15287
|
--changed-since <ref> Only files changed since this git ref, plus untracked ones
|
|
15291
15288
|
--staged Only files staged for the next commit
|
|
15292
15289
|
--with-dependents With the two above: also include their importers
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { buildAgentContract, runStdioServer, COMMAND_OPTION_SCOPE, commandsForOption, SKILL_NAME, renderSkill, renderContractText } from './chunk-
|
|
2
|
-
export { buildAgentContract } from './chunk-
|
|
3
|
-
import { shouldCheck, checkForUpdate, GENERATOR_VERSION, cacheFilePath, formatUpdateNotice, installKind, loadConfigFileDetailed, resolveConfig, validateSnapshot, describeManifestShapeProblem, explainPath, compareManifests, loadManifest, renderDiffText, generateSnapshot, formatNumber, isDiscoveryMode, ARTIFACT_NAMES, getPreset, unknownPresetMessage, GENERATOR_NAME, runInit, installPreCommitHook, PromptCancelled, findConfigFile, planFirstRun, isEffectivelyEmpty, isInteractive, defaultIO, hasPriorSnapshot, DEFAULT_ANSWERS, firstRunMessage, parseByteSize, stripJsonComments, gitignorePath, appendGitignoreEntries, runWithStdoutCapture, escapeControls, MIN_MAX_PART_TOKENS, MIN_MAX_PART_BYTES, renderExplainText } from './chunk-
|
|
1
|
+
import { buildAgentContract, runStdioServer, COMMAND_OPTION_SCOPE, commandsForOption, SKILL_NAME, renderSkill, renderContractText } from './chunk-WDJ3O3R4.js';
|
|
2
|
+
export { buildAgentContract } from './chunk-WDJ3O3R4.js';
|
|
3
|
+
import { shouldCheck, checkForUpdate, GENERATOR_VERSION, cacheFilePath, formatUpdateNotice, installKind, loadConfigFileDetailed, resolveConfig, validateSnapshot, describeManifestShapeProblem, explainPath, compareManifests, loadManifest, renderDiffText, generateSnapshot, formatNumber, isDiscoveryMode, ARTIFACT_NAMES, getPreset, unknownPresetMessage, GENERATOR_NAME, runInit, installPreCommitHook, PromptCancelled, findConfigFile, planFirstRun, isEffectivelyEmpty, isInteractive, defaultIO, hasPriorSnapshot, DEFAULT_ANSWERS, firstRunMessage, parseByteSize, stripJsonComments, gitignorePath, appendGitignoreEntries, runWithStdoutCapture, escapeControls, MIN_MAX_PART_TOKENS, MIN_MAX_PART_BYTES, renderExplainText } from './chunk-7DAW2LFZ.js';
|
|
4
4
|
import { spawnSync } from 'child_process';
|
|
5
5
|
import * as fs from 'fs';
|
|
6
6
|
import * as path2 from 'path';
|
|
@@ -194,7 +194,7 @@ Options:
|
|
|
194
194
|
--max-part-bytes <n> Maximum byte budget per markdown part (default: 307200).
|
|
195
195
|
Accepts units: 120k, 1.5mb
|
|
196
196
|
--max-part-tokens <n> Per-part budget in tokens; narrows --max-part-bytes
|
|
197
|
-
--large-file-bytes <n>
|
|
197
|
+
--large-file-bytes <n> Preview threshold (default: the part budget; never above it)
|
|
198
198
|
--changed-since <ref> Only files changed since this git ref, plus untracked ones
|
|
199
199
|
--staged Only files staged for the next commit
|
|
200
200
|
--with-dependents With the two above: also include their importers
|
package/dist/index.cjs
CHANGED
|
@@ -3880,7 +3880,7 @@ function applySpans(line, spans) {
|
|
|
3880
3880
|
|
|
3881
3881
|
// src/version.ts
|
|
3882
3882
|
var GENERATOR_NAME = "codebase-snapshot";
|
|
3883
|
-
var GENERATOR_VERSION = "0.10.
|
|
3883
|
+
var GENERATOR_VERSION = "0.10.1";
|
|
3884
3884
|
var SCHEMA_VERSION = "3.0.0";
|
|
3885
3885
|
var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
|
|
3886
3886
|
function isOurGeneratorName(name) {
|
|
@@ -8833,7 +8833,7 @@ var DEFAULT_ANSWERS = {
|
|
|
8833
8833
|
branch: "main",
|
|
8834
8834
|
maxPartBytes: "300k",
|
|
8835
8835
|
maxPartTokens: null,
|
|
8836
|
-
largeFileBytes: "
|
|
8836
|
+
largeFileBytes: "300k",
|
|
8837
8837
|
maxMonolithBytes: null,
|
|
8838
8838
|
discovery: "auto",
|
|
8839
8839
|
skeleton: false,
|
|
@@ -9596,13 +9596,11 @@ async function runInit(options) {
|
|
|
9596
9596
|
// what the run used is drift the next `validate` reports, and `setup` is the one command
|
|
9597
9597
|
// that is supposed to leave a project in a consistent state.
|
|
9598
9598
|
maxPartTokens: options.maxPartTokens ?? DEFAULT_ANSWERS.maxPartTokens,
|
|
9599
|
-
|
|
9600
|
-
// cannot fit, so it is cut while the manifest
|
|
9601
|
-
// 200 KB beside `--max-part-tokens 32k` made
|
|
9602
|
-
|
|
9603
|
-
|
|
9604
|
-
effectiveBudgetBytes
|
|
9605
|
-
),
|
|
9599
|
+
// Follows the budget unless the caller named one. A threshold above the part budget is a
|
|
9600
|
+
// config error (a file between the two cannot fit a part, so it is cut while the manifest
|
|
9601
|
+
// calls it a preview); a fixed 200 KB beside `--max-part-tokens 32k` made setup's own output
|
|
9602
|
+
// fail its own validate, and a fixed 200 KB under a 300 KB budget previewed files that fit.
|
|
9603
|
+
largeFileBytes: options.largeFileBytes ?? effectiveBudgetBytes,
|
|
9606
9604
|
maxMonolithBytes: options.maxMonolithBytes ?? DEFAULT_ANSWERS.maxMonolithBytes,
|
|
9607
9605
|
discovery: options.discovery ?? DEFAULT_ANSWERS.discovery,
|
|
9608
9606
|
skeleton: options.skeleton ?? DEFAULT_ANSWERS.skeleton,
|
package/dist/index.d.cts
CHANGED
|
@@ -528,7 +528,7 @@ declare function validateSnapshot(configInput: ResolvedSnapshotConfig | Snapshot
|
|
|
528
528
|
* `package.json` carries the same version; `npm run verify` compares the two.
|
|
529
529
|
*/
|
|
530
530
|
declare const GENERATOR_NAME = "codebase-snapshot";
|
|
531
|
-
declare const GENERATOR_VERSION = "0.10.
|
|
531
|
+
declare const GENERATOR_VERSION = "0.10.1";
|
|
532
532
|
/**
|
|
533
533
|
* The manifest and ownership-marker schema this build writes and understands.
|
|
534
534
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -528,7 +528,7 @@ declare function validateSnapshot(configInput: ResolvedSnapshotConfig | Snapshot
|
|
|
528
528
|
* `package.json` carries the same version; `npm run verify` compares the two.
|
|
529
529
|
*/
|
|
530
530
|
declare const GENERATOR_NAME = "codebase-snapshot";
|
|
531
|
-
declare const GENERATOR_VERSION = "0.10.
|
|
531
|
+
declare const GENERATOR_VERSION = "0.10.1";
|
|
532
532
|
/**
|
|
533
533
|
* The manifest and ownership-marker schema this build writes and understands.
|
|
534
534
|
*
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ARTIFACT_NAMES, CHECK_INTERVAL_MS, CONFIG_KEYS, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, FAILURE_INTERVAL_MS, GENERATOR_NAME, GENERATOR_VERSION, HOOK_MARKER, LANGUAGE_PROFILES, MIN_MAX_PART_BYTES, MIN_MAX_PART_TOKENS, PACKAGE_LATEST_URL, PRESETS, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, SCHEMA_VERSION, UP_TO_DATE_INTERVAL_MS, anchorForPath, appendGitignoreEntries, assertReplaceable, assertUsableConfigInput, buildImportResolver, bytesForTokens, cacheDirectory, cacheFilePath, checkForUpdate, classifyKind, classifyLayer, collectFiles, compareManifests, configDigest, countInvalidUtf8Bytes, countLines, decodeText, defineConfig, detectLanguage, detectPreset, displayPath, displayWidth, enforceBudget, estimateTokens, explainPath, fenceForContent, fenceForText, fetchLatestVersion, findSecretInPath, firstRunMessage, formatTokens, formatUpdateNotice, generateProjectTree, generateSarifReport, generateSnapshot, generateSnapshotAsync, getGitInfo, getPreset, gitignorePath, globToRegExp, hasPriorSnapshot, importsChangedFile, importsOfFile, importsOfText, installKind, installPreCommitHook, isBinaryBuffer, isBinaryExtension, isBinaryFile, isEffectivelyEmpty, isInteractive, isNewer, isResolvedConfig, isSensitivePath, isSkeletonizable, isTsxFileName, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, lockPathFor, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveChangedScope, resolveConfig, resolveSafeOutputDirs, resolveSpecifier, runInit, scanAndRedactSecrets, shouldCheck, skeletonizeTypeScript, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, truncatePreview, truncateToBytes, tsconfigPathsFor, updateCommand, validateSnapshot, workerEntry, wrapLines } from './chunk-
|
|
1
|
+
export { ARTIFACT_NAMES, CHECK_INTERVAL_MS, CONFIG_KEYS, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, FAILURE_INTERVAL_MS, GENERATOR_NAME, GENERATOR_VERSION, HOOK_MARKER, LANGUAGE_PROFILES, MIN_MAX_PART_BYTES, MIN_MAX_PART_TOKENS, PACKAGE_LATEST_URL, PRESETS, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, SCHEMA_VERSION, UP_TO_DATE_INTERVAL_MS, anchorForPath, appendGitignoreEntries, assertReplaceable, assertUsableConfigInput, buildImportResolver, bytesForTokens, cacheDirectory, cacheFilePath, checkForUpdate, classifyKind, classifyLayer, collectFiles, compareManifests, configDigest, countInvalidUtf8Bytes, countLines, decodeText, defineConfig, detectLanguage, detectPreset, displayPath, displayWidth, enforceBudget, estimateTokens, explainPath, fenceForContent, fenceForText, fetchLatestVersion, findSecretInPath, firstRunMessage, formatTokens, formatUpdateNotice, generateProjectTree, generateSarifReport, generateSnapshot, generateSnapshotAsync, getGitInfo, getPreset, gitignorePath, globToRegExp, hasPriorSnapshot, importsChangedFile, importsOfFile, importsOfText, installKind, installPreCommitHook, isBinaryBuffer, isBinaryExtension, isBinaryFile, isEffectivelyEmpty, isInteractive, isNewer, isResolvedConfig, isSensitivePath, isSkeletonizable, isTsxFileName, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, lockPathFor, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveChangedScope, resolveConfig, resolveSafeOutputDirs, resolveSpecifier, runInit, scanAndRedactSecrets, shouldCheck, skeletonizeTypeScript, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, truncatePreview, truncateToBytes, tsconfigPathsFor, updateCommand, validateSnapshot, workerEntry, wrapLines } from './chunk-7DAW2LFZ.js';
|
package/dist/mcp.cjs
CHANGED
|
@@ -2341,7 +2341,7 @@ function applySpans(line, spans) {
|
|
|
2341
2341
|
|
|
2342
2342
|
// src/version.ts
|
|
2343
2343
|
var GENERATOR_NAME = "codebase-snapshot";
|
|
2344
|
-
var GENERATOR_VERSION = "0.10.
|
|
2344
|
+
var GENERATOR_VERSION = "0.10.1";
|
|
2345
2345
|
var SCHEMA_VERSION = "3.0.0";
|
|
2346
2346
|
var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
|
|
2347
2347
|
function isOurGeneratorName(name) {
|
|
@@ -11190,7 +11190,7 @@ function buildAgentContract() {
|
|
|
11190
11190
|
id: "consume",
|
|
11191
11191
|
run: "read ./snapshot/parts/*.md, then ./snapshot/manifest.json, then ./snapshot/reports/audit.md",
|
|
11192
11192
|
expect: "the code, the index of what was included, and the risk findings",
|
|
11193
|
-
notes: "manifest.json.files[] lists every included file with layer, kind, language, part and summary. manifest.skipped[] explains every file that was left out and why."
|
|
11193
|
+
notes: "manifest.json.files[] lists every included file with layer, kind, language, part and summary. manifest.skipped[] explains every file that was left out and why; manifest.incomplete[] lists every included file that is not present in full, with its missing line ranges."
|
|
11194
11194
|
}
|
|
11195
11195
|
],
|
|
11196
11196
|
commands: [
|
package/dist/mcp.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ERROR_CODES, LEGACY_PROTOCOL_VERSIONS, MAX_LINE_BYTES, METHOD, MODERN_PROTOCOL_VERSIONS, SERVER_INSTRUCTIONS, SUPPORTED_PROTOCOL_VERSIONS, buildPrompts, buildResourceProvider, buildTools, classifyRequest, coerceNumericStrings, createLineReader, createMcpServer, createServer, createSession, createWriter, findSection, inspectModernMeta, negotiateLegacyVersion, parsePartSections, runStdioServer, validateArguments, windowText } from './chunk-
|
|
2
|
-
export { generateInWorker } from './chunk-
|
|
1
|
+
export { ERROR_CODES, LEGACY_PROTOCOL_VERSIONS, MAX_LINE_BYTES, METHOD, MODERN_PROTOCOL_VERSIONS, SERVER_INSTRUCTIONS, SUPPORTED_PROTOCOL_VERSIONS, buildPrompts, buildResourceProvider, buildTools, classifyRequest, coerceNumericStrings, createLineReader, createMcpServer, createServer, createSession, createWriter, findSection, inspectModernMeta, negotiateLegacyVersion, parsePartSections, runStdioServer, validateArguments, windowText } from './chunk-WDJ3O3R4.js';
|
|
2
|
+
export { generateInWorker } from './chunk-7DAW2LFZ.js';
|
package/docs/cli.md
CHANGED
|
@@ -97,7 +97,7 @@ Exit `0` when the snapshot passes its own integrity check, `1` when it does not.
|
|
|
97
97
|
|
|
98
98
|
```
|
|
99
99
|
📸 Generating snapshot for: /path/to/repo
|
|
100
|
-
Branch: main | Part budget: 300 KB | Generator: 0.10.
|
|
100
|
+
Branch: main | Part budget: 300 KB | Generator: 0.10.1 (project dependency ^0.10.1)
|
|
101
101
|
|
|
102
102
|
✅ Snapshot generated in 0.14s:
|
|
103
103
|
- Tracked files: 121 included of 128 found — 7 skipped (default-ignore 5, binary 1, sensitive-file 1); every one is listed in snapshot/reports/audit.md
|
|
@@ -183,7 +183,7 @@ The whole first run in one command, with defaults and no prompts. This is the sa
|
|
|
183
183
|
🚀 Setup for: /path/to/repo
|
|
184
184
|
✅ Created snapshot.config.ts (preset: nextjs)
|
|
185
185
|
Added npm scripts: snapshot, snapshot:validate
|
|
186
|
-
Added devDependency: codebase-snapshot ^0.10.
|
|
186
|
+
Added devDependency: codebase-snapshot ^0.10.1
|
|
187
187
|
Added to .gitignore: snapshot/, snapshot.tmp/
|
|
188
188
|
⏳ Installing dependencies…
|
|
189
189
|
✅ Installed dependencies (npm install, 2.1s)
|
|
@@ -235,7 +235,7 @@ It also has three side effects on files you own, and it says so when it does the
|
|
|
235
235
|
```
|
|
236
236
|
✅ Created snapshot.config.ts (preset: node-lib)
|
|
237
237
|
Added npm scripts: snapshot, snapshot:validate
|
|
238
|
-
Added devDependency: codebase-snapshot ^0.10.
|
|
238
|
+
Added devDependency: codebase-snapshot ^0.10.1
|
|
239
239
|
Added to .gitignore: snapshot/, snapshot.tmp/
|
|
240
240
|
```
|
|
241
241
|
|
|
@@ -75,9 +75,10 @@ that. In order of preference:
|
|
|
75
75
|
4. **Summarise once, in a separate session.** Ask the model for a map of the parts, then use that
|
|
76
76
|
map to choose which parts to read in detail.
|
|
77
77
|
|
|
78
|
-
What not to do: silently truncate. A snapshot never exceeds its budget — a file
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
What not to do: silently truncate. A snapshot never exceeds its budget — a file that cannot fit
|
|
79
|
+
one part becomes a head/tail excerpt with an explicit omission marker, and above `largeFileBytes`
|
|
80
|
+
(which defaults to the budget and may not exceed it) that is the only route by which content is
|
|
81
|
+
dropped. `manifest.json` names every such file in `incomplete[]`.
|
|
81
82
|
|
|
82
83
|
## Checking your own number
|
|
83
84
|
|
package/docs/configuration.md
CHANGED
|
@@ -487,7 +487,7 @@ also what lets you reference the object (from a test, or from `--dry-run`) witho
|
|
|
487
487
|
This is **not** byte-identical to a generated file. `codebase-snapshot init` starts from these
|
|
488
488
|
values and substitutes two things: `preset` becomes the detected name (`node-lib` for a plain
|
|
489
489
|
npm package), and `maxPartBytes` with `budgets.default` become that preset's
|
|
490
|
-
`recommendedBudget` (`"
|
|
490
|
+
`recommendedBudget` (`"300k"` for every preset). `generate` on its own applies no
|
|
491
491
|
recommended budget — without a config it uses `--max-part-bytes`, default 307200 — so the
|
|
492
492
|
preset's figure only takes effect once `init` has written it into a config.
|
|
493
493
|
|
|
@@ -23,6 +23,7 @@ window can take the largest.
|
|
|
23
23
|
- **`maxPartBytes`** — the hard ceiling for one part. This is a promise, not an average: no part
|
|
24
24
|
exceeds it. Set it to the destination's limit and stop worrying about the largest file.
|
|
25
25
|
- **`largeFileBytes`** — above this, a file becomes a head/tail excerpt rather than its full body.
|
|
26
|
+
It defaults to `maxPartBytes` and may not be set above it.
|
|
26
27
|
This is what stops one generated 40 MB file from consuming an entire snapshot.
|
|
27
28
|
- **`budgets.byLayer`** — different ceilings per layer. Documentation is usually worth less per byte
|
|
28
29
|
than source; `{ docs: 40_000 }` is a common shape.
|
|
@@ -66,8 +66,9 @@ const config = {
|
|
|
66
66
|
export default config;
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
A file
|
|
70
|
-
|
|
69
|
+
A file is never cut down to make a part fit. A file above `largeFileBytes` — which defaults to the
|
|
70
|
+
budget — becomes a head/tail excerpt with an explicit marker, and `manifest.json` lists it in
|
|
71
|
+
`incomplete[]` with the line ranges it lost.
|
|
71
72
|
|
|
72
73
|
### 3. Tell the model what it is looking at
|
|
73
74
|
|
package/docs/mcp.md
CHANGED
|
@@ -10,7 +10,7 @@ walk — that the client sees.
|
|
|
10
10
|
## Start it
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
npx -y codebase-snapshot@0.10.
|
|
13
|
+
npx -y codebase-snapshot@0.10.1 mcp
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
The server serves the directory it was started in. `--cwd <path>` points it elsewhere, and that
|
|
@@ -25,7 +25,7 @@ Claude Desktop and Cursor:
|
|
|
25
25
|
"mcpServers": {
|
|
26
26
|
"codebase-snapshot": {
|
|
27
27
|
"command": "npx",
|
|
28
|
-
"args": ["-y", "codebase-snapshot@0.10.
|
|
28
|
+
"args": ["-y", "codebase-snapshot@0.10.1", "mcp", "--cwd", "/absolute/path/to/repo"]
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -34,7 +34,7 @@ Claude Desktop and Cursor:
|
|
|
34
34
|
Claude Code registers the same thing from a shell:
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
claude mcp add codebase-snapshot -- npx -y codebase-snapshot@0.10.
|
|
37
|
+
claude mcp add codebase-snapshot -- npx -y codebase-snapshot@0.10.1 mcp --cwd /absolute/path/to/repo
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
On Windows, wrap the command as `cmd /c npx` with the same arguments — `npx` is a `.cmd` shim
|
|
@@ -101,7 +101,7 @@ Resources are the browse surface; tools are the act surface.
|
|
|
101
101
|
|
|
102
102
|
| URI | Contents |
|
|
103
103
|
| :-- | :-- |
|
|
104
|
-
| `snapshot://manifest` | Every included file with layer, kind, part and hash,
|
|
104
|
+
| `snapshot://manifest` | Every included file with layer, kind, part and hash, every skip reason, and `incomplete[]` — the files whose body is not the whole file, with their missing line ranges |
|
|
105
105
|
| `snapshot://parts/{index}` | One budgeted part, by 1-based index |
|
|
106
106
|
| `snapshot://reports/audit` | Secret findings, large files, parse diagnostics |
|
|
107
107
|
| `snapshot://reports/tree` | The directory tree of included files |
|
package/docs/output.md
CHANGED
|
@@ -49,7 +49,7 @@ same persistently. The ownership marker is always written.
|
|
|
49
49
|
## Parts
|
|
50
50
|
|
|
51
51
|
Each `part-NNN.md` holds whole files under the byte budget (`maxPartBytes`, default 300 KB).
|
|
52
|
-
A file is never split mid-file, and a file is never cut down just to make the part fit:
|
|
52
|
+
A file is never split mid-file, and a complete file is never cut down just to make the part fit:
|
|
53
53
|
`largeFileBytes` defaults to the part budget and may not exceed it, so a file too big for a part
|
|
54
54
|
is also over the threshold, and the preview below applies.
|
|
55
55
|
|
|
@@ -75,6 +75,12 @@ checked.
|
|
|
75
75
|
When an answer is wrong because the model never saw a file, this is the list that tells you
|
|
76
76
|
whether the file was excluded on purpose or by accident.
|
|
77
77
|
|
|
78
|
+
The second half of the same question is a file that was included but not in full.
|
|
79
|
+
`manifest.incomplete[]` names every one of those with its `reason` — `large-file-budget`,
|
|
80
|
+
`part-budget` or `section-metadata` — and `omittedRanges`, the 1-based source lines that are
|
|
81
|
+
missing or partial. A server that only reports what it included is telling half the story; this
|
|
82
|
+
is the half that explains a confident answer about code the model never saw.
|
|
83
|
+
|
|
78
84
|
## Gate it
|
|
79
85
|
|
|
80
86
|
The comparison is only a guard if something runs it. In CI, after whatever changes the tree:
|
package/docs/vs-code2prompt.md
CHANGED
|
@@ -42,8 +42,9 @@ If the prompt format is the thing you care about: **use code2prompt.**
|
|
|
42
42
|
|
|
43
43
|
## Where this is the better choice
|
|
44
44
|
|
|
45
|
-
- **You need the output to fit a budget.** `maxPartBytes` is a ceiling:
|
|
46
|
-
|
|
45
|
+
- **You need the output to fit a budget.** `maxPartBytes` is a ceiling: a file that cannot fit one
|
|
46
|
+
part becomes a head/tail preview with an omission marker, listed in `incomplete[]` with the line
|
|
47
|
+
ranges it lost, rather than silently blowing the limit.
|
|
47
48
|
- **You need to detect staleness.** `validate` compares every file hash plus a digest of the
|
|
48
49
|
generation settings, so a changed budget counts as drift. Prompt generators generally have no
|
|
49
50
|
concept of a snapshot that can expire.
|
package/docs/vs-gitingest.md
CHANGED
|
@@ -50,9 +50,10 @@ If you want to paste a repo into a chat right now: **use gitingest.**
|
|
|
50
50
|
`--no-update-check` or `CODEBASE_SNAPSHOT_NO_UPDATE_CHECK=1` disables it entirely (see
|
|
51
51
|
[the update notice](cli.md#update-notice)). If the code is private enough that a hosted digest is
|
|
52
52
|
not allowed, that settles it.
|
|
53
|
-
- **You need a size guarantee.** A part
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
- **You need a size guarantee.** A part never exceeds the budget: a file that cannot fit one is a
|
|
54
|
+
head/tail preview with an explicit marker, listed in `incomplete[]` with its missing line ranges.
|
|
55
|
+
A digest that grows with the repository eventually stops fitting, and discovering that at
|
|
56
|
+
ingestion time is too late.
|
|
56
57
|
- **You need to prove the context is current.** `validate` re-hashes the tree and compares a digest
|
|
57
58
|
of the generation settings, so a stale snapshot fails instead of quietly misleading a model.
|
|
58
59
|
- **You need the exclusions explained.** Every skipped path carries a reason — `binary`, `gitignore`,
|
package/docs/vs-repomix.md
CHANGED
|
@@ -57,8 +57,9 @@ If you want the most popular, most integrated tool: **use repomix.**
|
|
|
57
57
|
## Where this is the better choice
|
|
58
58
|
|
|
59
59
|
- **You need a guarantee, not a best effort.** `maxPartBytes` promises no part exceeds the ceiling;
|
|
60
|
-
a file
|
|
61
|
-
|
|
60
|
+
a file that cannot fit one part is a head/tail preview with an explicit marker, and the manifest
|
|
61
|
+
lists it in `incomplete[]` with the line ranges it lost. If a downstream system rejects payloads
|
|
62
|
+
above a size, a warning is not enough.
|
|
62
63
|
- **You need to know the snapshot still matches the code.** `validate` compares every file hash
|
|
63
64
|
*and* a digest of the settings the snapshot was generated with, so a changed budget or secret
|
|
64
65
|
pattern counts as drift. That makes "is my context current?" a CI-gateable question.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codebase-snapshot",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Create a codebase snapshot an LLM can read: budgeted Markdown parts for Claude, ChatGPT and Cursor, a manifest of every included and skipped file, secret redaction, and validate, which fails when the snapshot drifts. Local CLI and MCP server.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codebase-snapshot",
|