codebase-snapshot 0.20.4 → 0.20.5
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 +45 -0
- package/README.md +1 -1
- package/dist/bin.js +1241 -687
- package/dist/{chunk-AQZNT3QL.js → chunk-C3WVC4FV.js} +1230 -761
- package/dist/{chunk-QB5TNXMZ.js → chunk-HYTY6T7P.js} +67 -12
- package/dist/cli.cjs +1426 -875
- package/dist/cli.d.cts +4 -2
- package/dist/cli.d.ts +4 -2
- package/dist/cli.js +35 -9
- package/dist/index.cjs +1222 -753
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +628 -331
- package/dist/mcp.js +2 -2
- package/dist/{types-Drw1J0e0.d.cts → types-DnYsA6_Y.d.cts} +4 -0
- package/dist/{types-Drw1J0e0.d.ts → types-DnYsA6_Y.d.ts} +4 -0
- package/docs/cli.md +5 -5
- package/docs/deploy.md +2 -2
- package/docs/mcp.md +4 -4
- package/docs/security-review.md +26 -1
- package/docs/workspace.md +3 -0
- package/package.json +1 -1
package/dist/mcp.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { generateToken, startHttpTransport } from './chunk-
|
|
2
|
-
export { ERROR_CODES, LEGACY_PROTOCOL_VERSIONS, MAX_LINE_BYTES, METHOD, MODERN_PROTOCOL_VERSIONS, REPORT_RESOURCE_URIS, RESOURCE_TEMPLATE_URIS, SERVER_INSTRUCTIONS, STATIC_RESOURCE_URIS, SUPPORTED_PROTOCOL_VERSIONS, buildPrompts, buildResourceProvider, buildTools, classifyRequest, coerceNumericStrings, createLineReader, createMcpServer, createServer, createSession, createWriter, findSection, generateInWorker, inspectModernMeta, isCommentStrippable, negotiateLegacyVersion, parsePartSections, runStdioServer, stripComments, validateArguments, windowText } from './chunk-
|
|
1
|
+
export { generateToken, startHttpTransport } from './chunk-HYTY6T7P.js';
|
|
2
|
+
export { ERROR_CODES, LEGACY_PROTOCOL_VERSIONS, MAX_LINE_BYTES, METHOD, MODERN_PROTOCOL_VERSIONS, REPORT_RESOURCE_URIS, RESOURCE_TEMPLATE_URIS, SERVER_INSTRUCTIONS, STATIC_RESOURCE_URIS, SUPPORTED_PROTOCOL_VERSIONS, buildPrompts, buildResourceProvider, buildTools, classifyRequest, coerceNumericStrings, createLineReader, createMcpServer, createServer, createSession, createWriter, findSection, generateInWorker, inspectModernMeta, isCommentStrippable, negotiateLegacyVersion, parsePartSections, runStdioServer, stripComments, validateArguments, windowText } from './chunk-C3WVC4FV.js';
|
|
@@ -843,6 +843,10 @@ interface SnapshotConfig {
|
|
|
843
843
|
layers?: LayerRule[];
|
|
844
844
|
kinds?: KindRule[];
|
|
845
845
|
excludePatterns?: string[];
|
|
846
|
+
/** Alias of `excludePatterns`, accepted because `--exclude` is the flag spelling. */
|
|
847
|
+
exclude?: string[];
|
|
848
|
+
/** Library spelling of `secrets.customPatterns`; the loader compiles either form. */
|
|
849
|
+
secretRules?: SecretRuleInput[];
|
|
846
850
|
secrets?: {
|
|
847
851
|
customPatterns?: SecretRuleInput[];
|
|
848
852
|
disableDefaultPatterns?: boolean;
|
|
@@ -843,6 +843,10 @@ interface SnapshotConfig {
|
|
|
843
843
|
layers?: LayerRule[];
|
|
844
844
|
kinds?: KindRule[];
|
|
845
845
|
excludePatterns?: string[];
|
|
846
|
+
/** Alias of `excludePatterns`, accepted because `--exclude` is the flag spelling. */
|
|
847
|
+
exclude?: string[];
|
|
848
|
+
/** Library spelling of `secrets.customPatterns`; the loader compiles either form. */
|
|
849
|
+
secretRules?: SecretRuleInput[];
|
|
846
850
|
secrets?: {
|
|
847
851
|
customPatterns?: SecretRuleInput[];
|
|
848
852
|
disableDefaultPatterns?: boolean;
|
package/docs/cli.md
CHANGED
|
@@ -98,7 +98,7 @@ Exit `0` when the snapshot passes its own integrity check, `1` when it does not.
|
|
|
98
98
|
|
|
99
99
|
```
|
|
100
100
|
📸 Generating snapshot for: /path/to/repo
|
|
101
|
-
Branch: main (fallback) | Part budget: 300 KB | Generator: 0.20.
|
|
101
|
+
Branch: main (fallback) | Part budget: 300 KB | Generator: 0.20.5 (project dependency ^0.20.5)
|
|
102
102
|
|
|
103
103
|
✅ Snapshot generated in 0.14s:
|
|
104
104
|
- Tracked files: 121 included of 128 paths found — 7 skipped (default-ignore 5, binary 1, sensitive-file 1); every one is listed in snapshot/reports/audit.md
|
|
@@ -223,7 +223,7 @@ The whole first run in one command, with defaults and no prompts. This is the sa
|
|
|
223
223
|
🚀 Setup for: /path/to/repo
|
|
224
224
|
✅ Created snapshot.config.ts (preset: nextjs)
|
|
225
225
|
Added npm scripts: snapshot, snapshot:validate
|
|
226
|
-
Added devDependency: codebase-snapshot ^0.20.
|
|
226
|
+
Added devDependency: codebase-snapshot ^0.20.5
|
|
227
227
|
Added to .gitignore: /snapshot/, /snapshot.tmp/
|
|
228
228
|
⏳ Installing dependencies…
|
|
229
229
|
✅ Installed dependencies (npm install, 2.1s)
|
|
@@ -275,7 +275,7 @@ It also has three side effects on files you own, and it says so when it does the
|
|
|
275
275
|
```
|
|
276
276
|
✅ Created snapshot.config.ts (preset: node-lib)
|
|
277
277
|
Added npm scripts: snapshot, snapshot:validate
|
|
278
|
-
Added devDependency: codebase-snapshot ^0.20.
|
|
278
|
+
Added devDependency: codebase-snapshot ^0.20.5
|
|
279
279
|
Added to .gitignore: /snapshot/, /snapshot.tmp/
|
|
280
280
|
```
|
|
281
281
|
|
|
@@ -425,8 +425,8 @@ agent](agent.md).
|
|
|
425
425
|
Ask the npm registry whether a newer release exists, and print the version it compared against:
|
|
426
426
|
|
|
427
427
|
```bash
|
|
428
|
-
npx codebase-snapshot@0.20.
|
|
429
|
-
npx codebase-snapshot@0.20.
|
|
428
|
+
npx codebase-snapshot@0.20.5 update # is 0.17.0 still current? print the answer
|
|
429
|
+
npx codebase-snapshot@0.20.5 update --format json
|
|
430
430
|
```
|
|
431
431
|
|
|
432
432
|
```text
|
package/docs/deploy.md
CHANGED
|
@@ -61,8 +61,8 @@ After=network.target
|
|
|
61
61
|
Type=oneshot
|
|
62
62
|
User=deploy
|
|
63
63
|
WorkingDirectory=/srv/app
|
|
64
|
-
ExecStart=/usr/bin/npx -y codebase-snapshot@0.20.
|
|
65
|
-
ExecStartPost=/usr/bin/npx -y codebase-snapshot@0.20.
|
|
64
|
+
ExecStart=/usr/bin/npx -y codebase-snapshot@0.20.5 generate --cwd /srv/app
|
|
65
|
+
ExecStartPost=/usr/bin/npx -y codebase-snapshot@0.20.5 validate --cwd /srv/app
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
```ini
|
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.20.
|
|
13
|
+
npx -y codebase-snapshot@0.20.5 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.20.
|
|
28
|
+
"args": ["-y", "codebase-snapshot@0.20.5", "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.20.
|
|
37
|
+
claude mcp add codebase-snapshot -- npx -y codebase-snapshot@0.20.5 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
|
|
@@ -43,7 +43,7 @@ there, and clients that spawn without a shell cannot execute it directly.
|
|
|
43
43
|
## Over HTTP, for clients that cannot spawn a process
|
|
44
44
|
|
|
45
45
|
```bash
|
|
46
|
-
npx -y codebase-snapshot@0.20.
|
|
46
|
+
npx -y codebase-snapshot@0.20.5 mcp --http --port 4789
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
This is the Streamable HTTP shape: POST one JSON-RPC message (or an array) to `/mcp` and read
|
package/docs/security-review.md
CHANGED
|
@@ -30,6 +30,18 @@ untrusted input can arrive.
|
|
|
30
30
|
- **Paths are masked too.** A path that itself matches a secret rule is recorded masked.
|
|
31
31
|
- **The health audit re-scans every written text file** for unmasked secrets and compares values
|
|
32
32
|
from excluded sensitive files byte for byte against the artifacts (`snapshot health`).
|
|
33
|
+
- **A symlink is only a second name for included content.** The target must survive the same
|
|
34
|
+
include/exclude/ignore filters as the link alias; `.git/config` cannot be reached through a
|
|
35
|
+
tracked `notes.txt`.
|
|
36
|
+
- **Every snapshot file read is confined.** PROMPT.md, reports, the manifest and WORKSPACE.json
|
|
37
|
+
are opened through one reader that refuses a symlink and requires the canonical target inside
|
|
38
|
+
the snapshot directory. The MCP resources, `snapshot_history`, `snapshot_workspace` and
|
|
39
|
+
`serve` use it; the part reader keeps its older equivalent.
|
|
40
|
+
- **The diff report fails closed.** Git is forced to emit unquoted ASCII prefixes, a section that
|
|
41
|
+
cannot be attributed to a path is omitted rather than trusted, redaction runs before truncation
|
|
42
|
+
with the diffed file's extension, and `--only` applies to the diff too.
|
|
43
|
+
- **Owner prose is content.** A token in a brief heading, a project-overview line or a commit
|
|
44
|
+
subject goes through the full scanner, not only the path rules.
|
|
33
45
|
|
|
34
46
|
### Executable configuration
|
|
35
47
|
|
|
@@ -44,7 +56,12 @@ executable config in it is refused, because a fetched repository is not a truste
|
|
|
44
56
|
`--no-auth` is refused on a non-loopback bind.
|
|
45
57
|
- **Constant-time** token comparison; the token is generated with `crypto.randomBytes`.
|
|
46
58
|
- **CORS only for loopback origins** and explicit `--allow-origin` values; everything else is 403.
|
|
47
|
-
- **Bounded work**: 2 MiB bodies, 60 requests per 10 s per address, one JSON document per response
|
|
59
|
+
- **Bounded work**: 2 MiB bodies, 60 requests per 10 s per address, one JSON document per response,
|
|
60
|
+
and at most four MCP tool calls in flight across all HTTP sessions. The session and rate maps are
|
|
61
|
+
capped and evicted, so a client cannot grow either without bound.
|
|
62
|
+
- **Untrusted regexes are bounded.** `snapshot_search`, `snapshot_routes` and `snapshot_query`
|
|
63
|
+
reject nested quantifiers, more than one unbounded repetition and oversized repetition bounds
|
|
64
|
+
before compiling; JavaScript has no regex timeout, so the alternative is a main-thread stall.
|
|
48
65
|
- **Errors are JSON-RPC error objects**, never stack traces.
|
|
49
66
|
|
|
50
67
|
### The browser page
|
|
@@ -73,6 +90,7 @@ executable config in it is refused, because a fetched repository is not a truste
|
|
|
73
90
|
arbitrary `--remote` host.
|
|
74
91
|
- **Shallow clone** into a temp directory removed on exit; the token reaches git through the
|
|
75
92
|
environment (`http.extraheader` via `GIT_CONFIG_*`), never argv, and never enters the manifest.
|
|
93
|
+
A clone that fails or exceeds 1 GB is removed before the error is rethrown.
|
|
76
94
|
- A clone larger than 1 GB is refused before scanning.
|
|
77
95
|
|
|
78
96
|
### Signing
|
|
@@ -108,6 +126,12 @@ addition was reviewed with the same question — what new input arrives, and wha
|
|
|
108
126
|
exclusions apply exactly as they do to `snapshot_read`; it adds no file-system surface.
|
|
109
127
|
- **`--only`/`--ignore`** (0.14.6) widen nothing: `--ignore` adds excludes, and `--only` can only
|
|
110
128
|
narrow the allow-list the config already permits. Sensitive files stay excluded by default.
|
|
129
|
+
- **The 0.20.5 second audit** closed the bypasses left by 0.20.4: symlink targets now have to be
|
|
130
|
+
included under their own name, uppercase authorization headers are masked, C-quoted diff paths
|
|
131
|
+
and gitignore/exclude targets are handled, resource/manifest/report reads are confined,
|
|
132
|
+
catastrophic MCP regexes are refused before compilation, HTTP tool concurrency is bounded,
|
|
133
|
+
failed clones are removed, workspace dry runs write nothing, staged validation reads the index,
|
|
134
|
+
and hook installation refuses a symlink or hard link.
|
|
111
135
|
|
|
112
136
|
The residual risks below are unchanged, including the two that are deliberate rather than solved.
|
|
113
137
|
|
|
@@ -123,6 +147,7 @@ The residual risks below are unchanged, including the two that are deliberate ra
|
|
|
123
147
|
| Remote: private addresses refused, credentials in URL refused, `file:` gated | `tests/remote-source.test.js` |
|
|
124
148
|
| Serve: page without token, API with token, zip restricted | `tests/web-serve.test.js` |
|
|
125
149
|
| Signature: tamper detected | `tests/signing.test.js` |
|
|
150
|
+
| Second 0.20 audit: symlink targets, auth case, diff quoting, brief headings, ReDoS, HTTP cap, workspace dry run, staged validation, hook links | `tests/audit-0-20-5-ultimate.test.js` |
|
|
126
151
|
|
|
127
152
|
## Residual risks, stated
|
|
128
153
|
|
package/docs/workspace.md
CHANGED
|
@@ -78,6 +78,9 @@ directory configured if the member should be served on its own.
|
|
|
78
78
|
- **No combination.** `--workspace` is refused with `--remote`, `--delta`, `--slice`,
|
|
79
79
|
`--budget-tokens` and `--sign`: each of those narrows or signs *one* snapshot, and a workspace is
|
|
80
80
|
several.
|
|
81
|
+
- **Dry run means nothing is written.** `--dry-run` returns the member plans and the index shape but
|
|
82
|
+
creates no member snapshot and no `WORKSPACE.json`. The workspace output root may be inside the
|
|
83
|
+
working directory; it may not be the working directory or one of its ancestors.
|
|
81
84
|
- **Names come from the directories.** `--workspace a/api,b/api` would collide; use paths whose last
|
|
82
85
|
segment is unique.
|
|
83
86
|
- **Cross-member imports are recorded, not judged.** A relative import in one member that resolves
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codebase-snapshot",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.5",
|
|
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",
|