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/docs/troubleshooting.md
CHANGED
|
@@ -40,19 +40,29 @@ problem, and for an option the command does not take it also names the commands
|
|
|
40
40
|
|
|
41
41
|
```
|
|
42
42
|
❌ --watch does not apply to `report` and was not applied. It is accepted by: `generate`.
|
|
43
|
-
❌ --cwd does not apply to `describe` and was not applied. It is accepted by: `generate`, `validate`, `report`, `init`, `
|
|
43
|
+
❌ --cwd does not apply to `describe` and was not applied. It is accepted by: `generate`, `validate`, `report`, `explain`, `init`, `setup`, `skill`, `mcp`.
|
|
44
|
+
❌ --max-part-bytes does not apply to `report` and was not applied. It is accepted by: `generate`, `validate`, `explain`, `init`, `setup`.
|
|
45
|
+
❌ Unknown --mode "bogus". Expected one of: generate, validate, check, report, init, setup, explain, diff, describe, skill, mcp.
|
|
44
46
|
```
|
|
45
47
|
|
|
46
48
|
Nothing is silently ignored — that is the point of the message. The per-option `Applies to`
|
|
47
49
|
column is in the [CLI reference](cli.md#options).
|
|
48
50
|
|
|
51
|
+
`report` takes no generation settings: it reads the manifest and prints it, so for example
|
|
52
|
+
`--max-part-bytes`, `--large-file-bytes`, `--max-monolith-bytes`, `--include-monolith`,
|
|
53
|
+
`--include-sensitive-files`, `--skip-artifacts` and `--only-artifacts` are all usage errors
|
|
54
|
+
there, as are `--skeleton`, `--sarif` and `--max-part-tokens`. `--mode` names the same commands from the other side, `mcp` included, and
|
|
55
|
+
`--mode explain <path>` / `--mode diff <a> <b>` take their positionals like the command does.
|
|
56
|
+
|
|
49
57
|
| Message | Fix |
|
|
50
58
|
| :--- | :--- |
|
|
51
59
|
| `Unknown command "frobnicate". Expected one of: …` | Use one of the commands in the [CLI reference](cli.md). |
|
|
52
60
|
| `No configuration found in … and this session is not interactive, so nothing was generated.` | A first run and no terminal to ask its question. Nothing is wrong with the repository: say which setup you want — `--autopilot` for the full setup, `init --yes` then `generate` for the steps, or `generate` for the documented defaults. See [the first run](cli.md#the-first-run). |
|
|
53
61
|
| `--autopilot sets a project up and writes a config; --no-config ignores config files. Pass one or the other.` | The two flags contradict each other. Drop one. |
|
|
54
62
|
| `--no-install only applies to \`setup\`, or to \`generate --autopilot\`.` | The install only happens during a setup. Drop the flag, or add `--autopilot`. |
|
|
55
|
-
| `--preset does not apply to \`generate\` and was not applied. It is accepted by: \`init\`. To scope a run, set include/excludePatterns/preset in snapshot.config.ts (or run \`codebase-snapshot init\` to generate one).` | `--preset`, `--include`, `--exclude`, `--yes` and `--force` configure `init`, which
|
|
63
|
+
| `--preset does not apply to \`generate\` and was not applied. It is accepted by: \`init\`, \`setup\`. To scope a run, set include/excludePatterns/preset in snapshot.config.ts (or run \`codebase-snapshot init\` to generate one).` | `--preset`, `--include`, `--exclude`, `--yes` and `--force` configure `init` and `setup`, which write them into the config. Set them at generation time in `snapshot.config.ts` instead. |
|
|
64
|
+
| `--skip-artifacts does not apply to \`report\` and was not applied. It is accepted by: \`generate\`, \`validate\`, \`explain\`, \`init\`, \`setup\`.` | `report` reads the manifest and prints it, so the generation settings are rejected there. Run `generate` with the artifact selection you want. |
|
|
65
|
+
| `Unknown --mode "bogus". Expected one of: generate, validate, check, report, init, setup, explain, diff, describe, skill, mcp.` | `--mode` names the command the run uses; `mcp` is one of the accepted names. Pass the command positionally unless a wrapper builds the argument list. |
|
|
56
66
|
| `--install does not apply to \`generate\` and was not applied. It is accepted by: \`skill\`.` | `--install` and `--target` configure `skill` only. |
|
|
57
67
|
| `--cwd directory does not exist: …` / `--cwd is not a directory: …` | Point `--cwd` at an existing repository directory. |
|
|
58
68
|
| `--out-dir requires a value (received an empty string).` | An unset shell variable expanded to nothing. Quote it or drop the flag. Every string option rejects `""` rather than silently using the default. |
|
|
@@ -79,8 +89,9 @@ it wrote them. This guard exists because a mistyped `outDir` used to replace the
|
|
|
79
89
|
`outDir: "src"` deleted source code while reporting success.
|
|
80
90
|
|
|
81
91
|
Ownership is proved by a `.codebase-snapshot` marker that parses as ours — a JSON object
|
|
82
|
-
naming this generator, carrying a schema version this build understands, a per-snapshot `id
|
|
83
|
-
|
|
92
|
+
naming this generator, carrying a schema version this build understands, a per-snapshot `id`,
|
|
93
|
+
the digest of the manifest it shipped and, in current markers, the size and sha256 of every file
|
|
94
|
+
it wrote. A file with the right name is not enough:
|
|
84
95
|
|
|
85
96
|
| The directory | What the tool says |
|
|
86
97
|
| :--- | :--- |
|
|
@@ -89,10 +100,21 @@ and the digest of the manifest it shipped. A file with the right name is not eno
|
|
|
89
100
|
| has a marker that is not JSON | `its .codebase-snapshot marker is not valid JSON (found .codebase-snapshot, app.ts)` |
|
|
90
101
|
| was written by 3.0.0 | `its .codebase-snapshot marker carries no snapshot id (found .codebase-snapshot, manifest.json)` |
|
|
91
102
|
| carries our marker but you added files | `it carries this generator's ownership marker, but these entries are not part of the snapshot it recorded: custom.txt. Remove them yourself, or point outDir at a new or empty directory.` |
|
|
103
|
+
| has a marker whose recorded per-file digests no longer match the directory | `its .codebase-snapshot inventory's digest for parts/part-001.md does not match the file (found .codebase-snapshot, manifest.json, parts, reports, README.md)`, or `its .codebase-snapshot inventory records notes.txt as 12 B, but it is 20 B` |
|
|
104
|
+
| is a real snapshot and you edited a part by hand | the same digest refusal: the run stops before writing, so the edited snapshot is **not** overwritten. Delete the directory and generate again. |
|
|
105
|
+
| has a marker that records neither per-file digests nor a manifest digest | `its .codebase-snapshot marker records neither per-file digests nor a manifest digest, so it cannot prove this generator wrote the directory (found .codebase-snapshot, notes.txt)` |
|
|
106
|
+
|
|
107
|
+
Two evidence shapes are accepted. A marker with a per-file inventory is checked file by file:
|
|
108
|
+
every regular file's byte length and sha256 must match, every recorded path must still exist, and
|
|
109
|
+
every entry in the directory must be one the run recorded. A **legacy** marker (written before
|
|
110
|
+
that inventory existed) is accepted on its `manifestSha256` when `manifest.json` is present and
|
|
111
|
+
the digest matches — the upgrade path, so a snapshot from an earlier release stays replaceable. A
|
|
112
|
+
legacy snapshot generated with the manifest artifact disabled cannot prove itself and is refused
|
|
113
|
+
once; delete it and generate again.
|
|
92
114
|
|
|
93
115
|
**Fix** — point `--out-dir` somewhere new, or delete the directory yourself. Do not delete
|
|
94
116
|
your source. Accepted without complaint: a missing directory, an empty directory, one holding
|
|
95
|
-
nothing but `.DS_Store`, and a complete snapshot
|
|
117
|
+
nothing but `.DS_Store`, and a complete snapshot whose marker evidence still matches.
|
|
96
118
|
|
|
97
119
|
`.gitkeep` and `.gitignore` are **not** accepted, even in a directory that holds nothing else.
|
|
98
120
|
Both are files you create — the generator never writes either into an output directory — so a
|
|
@@ -100,7 +122,7 @@ directory holding one is somebody's data and is refused rather than replaced. Mo
|
|
|
100
122
|
or point `--out-dir` somewhere new.
|
|
101
123
|
|
|
102
124
|
A snapshot written by 3.0.0 or earlier is **not** upgraded in place: its marker has three keys
|
|
103
|
-
and no `id`, so
|
|
125
|
+
and no `id`, so this build cannot prove it wrote the directory and refuses. Delete the old
|
|
104
126
|
snapshot directory and generate again.
|
|
105
127
|
|
|
106
128
|
### `Refusing to write into outDir …: it exists but is not a directory.`
|
|
@@ -220,13 +242,15 @@ Exit `1` with one line per class of drift:
|
|
|
220
242
|
| `- modified: path` | The file changed since the snapshot. |
|
|
221
243
|
| `- deleted: path` | The file is in the snapshot but no longer on disk. |
|
|
222
244
|
| `- new file: path` | The file exists on disk and is not in the snapshot. |
|
|
245
|
+
| `- unreadable: path` | The file exists but this process may not read or stat it — usually a permissions problem. It is not a deleted file. |
|
|
223
246
|
| `- part: part-001.md (missing from snapshot/parts)` | The part file was deleted or renamed. |
|
|
224
247
|
| `- part: … (size mismatch …)` | The part was edited by hand. |
|
|
225
248
|
| `- config: …` | A setting differs from the one recorded in the manifest. |
|
|
226
249
|
| `- counts: …` | The manifest's own bookkeeping disagrees with its contents. |
|
|
227
250
|
|
|
228
|
-
**Fix** — re-run `generate
|
|
229
|
-
|
|
251
|
+
**Fix** — re-run `generate` for drift. For `unreadable`, fix the file's permissions first:
|
|
252
|
+
re-generating cannot read it either. If anything persists, the snapshot directory is being
|
|
253
|
+
modified by something else.
|
|
230
254
|
|
|
231
255
|
### `report` exits 1 (only when it cannot read the snapshot)
|
|
232
256
|
|
package/docs/vs-code2prompt.md
CHANGED
|
@@ -30,7 +30,7 @@ If the prompt format is the thing you care about: **use code2prompt.**
|
|
|
30
30
|
| Distribution | Node.js, npm | Single Rust binary, no runtime |
|
|
31
31
|
| Machine index | `manifest.json` with hashes and skip reasons | Template output only |
|
|
32
32
|
| Language awareness | 25 presets, AST/structural/heuristic summaries | Template access to file contents |
|
|
33
|
-
| Secret handling |
|
|
33
|
+
| Secret handling | 31 defaults, value-span masking, audit table | Ignore rules |
|
|
34
34
|
|
|
35
35
|
## Where code2prompt is the better choice
|
|
36
36
|
|
package/docs/vs-gitingest.md
CHANGED
|
@@ -29,7 +29,7 @@ If you want to paste a repo into a chat right now: **use gitingest.**
|
|
|
29
29
|
| Staleness check | `validate` exits non-zero on drift | Not a feature |
|
|
30
30
|
| Reproducible output | Byte-identical parts across runs, with a fingerprint | Not a published guarantee |
|
|
31
31
|
| Excluded-file accounting | Every skipped path recorded with a reason | Ignore rules applied |
|
|
32
|
-
| Secret redaction |
|
|
32
|
+
| Secret redaction | 31 default rules, value-span masking, audit table | Relies on ignore rules |
|
|
33
33
|
| Runtime | Node.js | Python |
|
|
34
34
|
| Repo URL input | No — needs a checkout | **Yes** |
|
|
35
35
|
|
package/docs/vs-repomix.md
CHANGED
|
@@ -30,7 +30,7 @@ If you want the most popular, most integrated tool: **use repomix.**
|
|
|
30
30
|
| Staleness check | `validate` re-hashes the repository and exits non-zero on drift | Not a feature |
|
|
31
31
|
| Remote repositories | No — operates on a local checkout | **Yes** — packs a GitHub URL directly |
|
|
32
32
|
| MCP server | **Yes** — eight tools over stdio, and it serves the validated snapshot rather than the working tree | **Yes** — packs a repository, including by URL |
|
|
33
|
-
| Secret handling |
|
|
33
|
+
| Secret handling | 31 default rules, value-span masking, per-line audit table | Secretlint integration |
|
|
34
34
|
| Language awareness | 25 presets, AST or structural summaries labelled by confidence | Tree-sitter parsing with a compression mode |
|
|
35
35
|
| Adoption | New | **Mature** — large user base, many integrations |
|
|
36
36
|
| Runtime | Node.js ≥ 18, one dependency | Node.js, npm package |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codebase-snapshot",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.15",
|
|
4
4
|
"description": "Pack a codebase for an LLM into budgeted Markdown parts, with a manifest of every file and skip, and validate to prove the snapshot is current.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codebase",
|
|
@@ -102,7 +102,6 @@
|
|
|
102
102
|
"pretest": "npm run build",
|
|
103
103
|
"test": "node --test tests/*.test.js",
|
|
104
104
|
"test:coverage": "node --test --experimental-test-coverage tests/*.test.js",
|
|
105
|
-
"prepublishOnly": "npm run build",
|
|
106
105
|
"publish:create": "npm publish ./packages/create --access public",
|
|
107
106
|
"prepack": "npm run sync-docs && npm run build",
|
|
108
107
|
"pack-check": "node scripts/pack-check.mjs",
|