codebase-snapshot 0.20.12 → 0.21.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 +44 -6
- package/README.md +46 -19
- package/SECURITY.md +2 -2
- package/dist/bin.js +12173 -9823
- package/dist/{chunk-TUKY6KLH.js → chunk-TDPYLX7X.js} +6312 -4472
- package/dist/cli.cjs +12074 -9744
- package/dist/cli.d.cts +76 -2
- package/dist/cli.d.ts +76 -2
- package/dist/cli.js +549 -14
- package/dist/{generate-worker-DMzNbsAW.d.cts → generate-worker-D56JeXwx.d.cts} +2 -2
- package/dist/{generate-worker-CRMESc0b.d.ts → generate-worker-DakxZs-l.d.ts} +2 -2
- package/dist/index.cjs +6292 -4466
- package/dist/index.d.cts +281 -63
- package/dist/index.d.ts +281 -63
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +10486 -4393
- package/dist/mcp.d.cts +26 -11
- package/dist/mcp.d.ts +26 -11
- package/dist/mcp.js +1 -1
- package/dist/{types-C5ytHMYz.d.ts → types-D5XYzksd.d.cts} +50 -2
- package/dist/{types-C5ytHMYz.d.cts → types-D5XYzksd.d.ts} +50 -2
- package/docs/about.md +86 -0
- package/docs/agent.md +28 -6
- package/docs/answer.md +99 -48
- package/docs/benchmarks.md +34 -34
- package/docs/brief.md +80 -81
- package/docs/cli.md +103 -27
- package/docs/codebase-token-budget.md +14 -13
- package/docs/configuration.md +1 -1
- package/docs/contents.md +66 -0
- package/docs/deploy.md +2 -2
- package/docs/faq.md +112 -0
- package/docs/glossary.md +152 -0
- package/docs/health.md +1 -1
- package/docs/how-to-feed-a-repo-to-claude.md +6 -0
- package/docs/impact.md +102 -0
- package/docs/install.md +4 -3
- package/docs/llm-codebase-context.md +166 -0
- package/docs/mcp-server-for-codebase.md +155 -0
- package/docs/mcp.md +81 -82
- package/docs/migration.md +83 -85
- package/docs/output.md +1 -3
- package/docs/security-review.md +20 -9
- package/docs/slice.md +1 -1
- package/docs/tools.md +159 -185
- package/docs/troubleshooting.md +11 -11
- package/docs/vs-code2prompt.md +7 -0
- package/docs/vs-gitingest.md +7 -0
- package/docs/vs-repomix.md +10 -1
- package/docs/workspace.md +1 -1
- package/package.json +9 -2
package/dist/mcp.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { G as GenerateSummary, W as WorkerResults, g as generateInWorker } from './generate-worker-
|
|
1
|
+
export { G as GenerateSummary, W as WorkerResults, g as generateInWorker } from './generate-worker-D56JeXwx.cjs';
|
|
2
2
|
import { Readable, Writable } from 'node:stream';
|
|
3
|
-
import './types-
|
|
3
|
+
import './types-D5XYzksd.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* JSON-RPC 2.0 envelopes and the Model Context Protocol revisions this server speaks.
|
|
@@ -70,13 +70,22 @@ declare const ERROR_CODES: {
|
|
|
70
70
|
*/
|
|
71
71
|
readonly resourceTooLarge: -32000;
|
|
72
72
|
/**
|
|
73
|
-
* A known resource that this snapshot does not contain.
|
|
73
|
+
* A known resource that this snapshot does not contain, under a legacy revision.
|
|
74
74
|
*
|
|
75
|
-
* `-32002`
|
|
76
|
-
*
|
|
77
|
-
*
|
|
75
|
+
* `-32002` was the resource-not-found code through protocol revision `2025-11-25`. The
|
|
76
|
+
* `2026-07-28` revision assigns missing resources to `-32602` and says clients SHOULD still
|
|
77
|
+
* accept `-32002` from older servers. The dispatcher therefore chooses by era: `-32602` for
|
|
78
|
+
* modern requests and this code for legacy ones. Answering `-32602` for `snapshot://prompt`
|
|
79
|
+
* in a snapshot generated with `--skip-artifacts prompt` would tell a legacy client its URI
|
|
80
|
+
* was wrong when the artifact had simply been left out.
|
|
78
81
|
*/
|
|
79
82
|
readonly resourceNotFound: -32002;
|
|
83
|
+
/**
|
|
84
|
+
* Streamable HTTP headers that are missing, malformed or disagree with the request body.
|
|
85
|
+
*
|
|
86
|
+
* Protocol revision `2026-07-28` reserves `-32020` for this. The HTTP status is `400`.
|
|
87
|
+
*/
|
|
88
|
+
readonly headerMismatch: -32020;
|
|
80
89
|
/**
|
|
81
90
|
* The server is at its concurrency limit.
|
|
82
91
|
*
|
|
@@ -175,7 +184,7 @@ interface ToolContext {
|
|
|
175
184
|
* Client-facing hints.
|
|
176
185
|
*
|
|
177
186
|
* `readOnlyHint` is the one that changes behaviour rather than appearance: clients use it to
|
|
178
|
-
* auto-approve a call.
|
|
187
|
+
* auto-approve a call. Six of the seven tools never write, so they are marked read-only;
|
|
179
188
|
* only `snapshot_generate` writes.
|
|
180
189
|
*/
|
|
181
190
|
interface ToolAnnotations {
|
|
@@ -351,6 +360,8 @@ interface McpServerOptions {
|
|
|
351
360
|
context: ToolContext;
|
|
352
361
|
/** Writes a JSON-RPC notification. Present on transports that can carry one mid-call. */
|
|
353
362
|
notify?: (message: JsonObject) => void;
|
|
363
|
+
/** Shared registry so stateless modern HTTP requests can cancel an earlier request. */
|
|
364
|
+
cancellations?: Map<JsonRpcId, () => void>;
|
|
354
365
|
}
|
|
355
366
|
interface McpServer {
|
|
356
367
|
/** Handles one already-parsed message. Returns null when no response is due. */
|
|
@@ -377,6 +388,10 @@ interface PartSection {
|
|
|
377
388
|
anchor: string | null;
|
|
378
389
|
/** The file body, without its fence. Redacted and possibly a bounded preview. */
|
|
379
390
|
body: string;
|
|
391
|
+
/** 1-based first body line in the part, when known. */
|
|
392
|
+
bodyStartLine?: number;
|
|
393
|
+
/** 1-based last body line in the part, when known. */
|
|
394
|
+
bodyEndLine?: number;
|
|
380
395
|
/** `full`, `preview` or `signatures`. */
|
|
381
396
|
inclusion: string | null;
|
|
382
397
|
includedLines: number | null;
|
|
@@ -463,6 +478,8 @@ interface ServerOptions {
|
|
|
463
478
|
noConfig?: boolean;
|
|
464
479
|
/** Where operational notes go. Never stdout, which carries protocol messages only. */
|
|
465
480
|
log?: (line: string) => void;
|
|
481
|
+
/** Optional map for a caller that owns one server's request ids; the default is per server. */
|
|
482
|
+
cancellations?: Map<JsonRpcId, () => void>;
|
|
466
483
|
}
|
|
467
484
|
/** Builds a server with every capability this package implements. */
|
|
468
485
|
declare function createServer(options: ServerOptions): McpServer;
|
|
@@ -575,10 +592,8 @@ declare function createLineReader(input: Readable, options: LineReaderOptions):
|
|
|
575
592
|
/**
|
|
576
593
|
* The instructions an MCP client shows its model at handshake.
|
|
577
594
|
*
|
|
578
|
-
*
|
|
579
|
-
*
|
|
580
|
-
* *order* rather than features — an agent that reads a part end to end has already lost the
|
|
581
|
-
* budget this tool exists to protect.
|
|
595
|
+
* Seven tools, one order: impact before editing, locate before reading, read a window, explain
|
|
596
|
+
* anything missing, validate before trusting, generate only when a persisted snapshot is wanted.
|
|
582
597
|
*/
|
|
583
598
|
declare const SERVER_INSTRUCTIONS: string;
|
|
584
599
|
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { G as GenerateSummary, W as WorkerResults, g as generateInWorker } from './generate-worker-
|
|
1
|
+
export { G as GenerateSummary, W as WorkerResults, g as generateInWorker } from './generate-worker-DakxZs-l.js';
|
|
2
2
|
import { Readable, Writable } from 'node:stream';
|
|
3
|
-
import './types-
|
|
3
|
+
import './types-D5XYzksd.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* JSON-RPC 2.0 envelopes and the Model Context Protocol revisions this server speaks.
|
|
@@ -70,13 +70,22 @@ declare const ERROR_CODES: {
|
|
|
70
70
|
*/
|
|
71
71
|
readonly resourceTooLarge: -32000;
|
|
72
72
|
/**
|
|
73
|
-
* A known resource that this snapshot does not contain.
|
|
73
|
+
* A known resource that this snapshot does not contain, under a legacy revision.
|
|
74
74
|
*
|
|
75
|
-
* `-32002`
|
|
76
|
-
*
|
|
77
|
-
*
|
|
75
|
+
* `-32002` was the resource-not-found code through protocol revision `2025-11-25`. The
|
|
76
|
+
* `2026-07-28` revision assigns missing resources to `-32602` and says clients SHOULD still
|
|
77
|
+
* accept `-32002` from older servers. The dispatcher therefore chooses by era: `-32602` for
|
|
78
|
+
* modern requests and this code for legacy ones. Answering `-32602` for `snapshot://prompt`
|
|
79
|
+
* in a snapshot generated with `--skip-artifacts prompt` would tell a legacy client its URI
|
|
80
|
+
* was wrong when the artifact had simply been left out.
|
|
78
81
|
*/
|
|
79
82
|
readonly resourceNotFound: -32002;
|
|
83
|
+
/**
|
|
84
|
+
* Streamable HTTP headers that are missing, malformed or disagree with the request body.
|
|
85
|
+
*
|
|
86
|
+
* Protocol revision `2026-07-28` reserves `-32020` for this. The HTTP status is `400`.
|
|
87
|
+
*/
|
|
88
|
+
readonly headerMismatch: -32020;
|
|
80
89
|
/**
|
|
81
90
|
* The server is at its concurrency limit.
|
|
82
91
|
*
|
|
@@ -175,7 +184,7 @@ interface ToolContext {
|
|
|
175
184
|
* Client-facing hints.
|
|
176
185
|
*
|
|
177
186
|
* `readOnlyHint` is the one that changes behaviour rather than appearance: clients use it to
|
|
178
|
-
* auto-approve a call.
|
|
187
|
+
* auto-approve a call. Six of the seven tools never write, so they are marked read-only;
|
|
179
188
|
* only `snapshot_generate` writes.
|
|
180
189
|
*/
|
|
181
190
|
interface ToolAnnotations {
|
|
@@ -351,6 +360,8 @@ interface McpServerOptions {
|
|
|
351
360
|
context: ToolContext;
|
|
352
361
|
/** Writes a JSON-RPC notification. Present on transports that can carry one mid-call. */
|
|
353
362
|
notify?: (message: JsonObject) => void;
|
|
363
|
+
/** Shared registry so stateless modern HTTP requests can cancel an earlier request. */
|
|
364
|
+
cancellations?: Map<JsonRpcId, () => void>;
|
|
354
365
|
}
|
|
355
366
|
interface McpServer {
|
|
356
367
|
/** Handles one already-parsed message. Returns null when no response is due. */
|
|
@@ -377,6 +388,10 @@ interface PartSection {
|
|
|
377
388
|
anchor: string | null;
|
|
378
389
|
/** The file body, without its fence. Redacted and possibly a bounded preview. */
|
|
379
390
|
body: string;
|
|
391
|
+
/** 1-based first body line in the part, when known. */
|
|
392
|
+
bodyStartLine?: number;
|
|
393
|
+
/** 1-based last body line in the part, when known. */
|
|
394
|
+
bodyEndLine?: number;
|
|
380
395
|
/** `full`, `preview` or `signatures`. */
|
|
381
396
|
inclusion: string | null;
|
|
382
397
|
includedLines: number | null;
|
|
@@ -463,6 +478,8 @@ interface ServerOptions {
|
|
|
463
478
|
noConfig?: boolean;
|
|
464
479
|
/** Where operational notes go. Never stdout, which carries protocol messages only. */
|
|
465
480
|
log?: (line: string) => void;
|
|
481
|
+
/** Optional map for a caller that owns one server's request ids; the default is per server. */
|
|
482
|
+
cancellations?: Map<JsonRpcId, () => void>;
|
|
466
483
|
}
|
|
467
484
|
/** Builds a server with every capability this package implements. */
|
|
468
485
|
declare function createServer(options: ServerOptions): McpServer;
|
|
@@ -575,10 +592,8 @@ declare function createLineReader(input: Readable, options: LineReaderOptions):
|
|
|
575
592
|
/**
|
|
576
593
|
* The instructions an MCP client shows its model at handshake.
|
|
577
594
|
*
|
|
578
|
-
*
|
|
579
|
-
*
|
|
580
|
-
* *order* rather than features — an agent that reads a part end to end has already lost the
|
|
581
|
-
* budget this tool exists to protect.
|
|
595
|
+
* Seven tools, one order: impact before editing, locate before reading, read a window, explain
|
|
596
|
+
* anything missing, validate before trusting, generate only when a persisted snapshot is wanted.
|
|
582
597
|
*/
|
|
583
598
|
declare const SERVER_INSTRUCTIONS: string;
|
|
584
599
|
|
package/dist/mcp.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import './chunk-WMEZFLUT.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, generateToken, inspectModernMeta, isCommentStrippable, negotiateLegacyVersion, parsePartSections, runStdioServer, startHttpTransport, stripComments, validateArguments, windowText } 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, generateToken, inspectModernMeta, isCommentStrippable, negotiateLegacyVersion, parsePartSections, runStdioServer, startHttpTransport, stripComments, validateArguments, windowText } from './chunk-TDPYLX7X.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type Mode = "generate" | "validate" | "report";
|
|
2
|
-
type OutputFormat = "text" | "json";
|
|
2
|
+
type OutputFormat = "text" | "json" | "markdown" | "pr-comment";
|
|
3
3
|
/**
|
|
4
4
|
* How files are discovered.
|
|
5
5
|
*
|
|
@@ -24,6 +24,50 @@ type TextEncoding = "utf-8" | "utf-8-lossy" | "utf-16le" | "utf-16be";
|
|
|
24
24
|
* `comments-stripped` – comment text was removed (line numbers preserved) before emission.
|
|
25
25
|
*/
|
|
26
26
|
type InclusionMode = "full" | "preview" | "signatures" | "comments-stripped";
|
|
27
|
+
type IndexSourceKind = "snapshot" | "live-overlay" | "live-memory";
|
|
28
|
+
type FreshnessStatus = "current" | "stale" | "live-computed" | "unknown";
|
|
29
|
+
type CoverageStatus = "complete" | "partial";
|
|
30
|
+
type EdgeProvenance = "ts-semantic" | "ts-reexport" | "import-binding" | "tsconfig-alias" | "workspace-alias" | "relative-import" | "heuristic";
|
|
31
|
+
interface TrustEnvelope {
|
|
32
|
+
indexSource: IndexSourceKind;
|
|
33
|
+
freshness: FreshnessStatus;
|
|
34
|
+
coverage: CoverageStatus;
|
|
35
|
+
snapshotFingerprint?: string;
|
|
36
|
+
overlayStats?: {
|
|
37
|
+
reusedFromManifest: number;
|
|
38
|
+
reparsedChanged: number;
|
|
39
|
+
added: number;
|
|
40
|
+
deleted: number;
|
|
41
|
+
};
|
|
42
|
+
sensitiveExcludedCount: number;
|
|
43
|
+
redactedLines: number;
|
|
44
|
+
omittedCount: number;
|
|
45
|
+
unresolvedCount: number;
|
|
46
|
+
reasons: string[];
|
|
47
|
+
}
|
|
48
|
+
interface ImportBinding {
|
|
49
|
+
specifier: string;
|
|
50
|
+
importedNames: string[];
|
|
51
|
+
typeOnly: boolean;
|
|
52
|
+
}
|
|
53
|
+
interface ReExportBinding {
|
|
54
|
+
specifier: string;
|
|
55
|
+
kind: "star" | "namespace" | "named";
|
|
56
|
+
entries?: Array<{
|
|
57
|
+
imported: string;
|
|
58
|
+
exported: string;
|
|
59
|
+
typeOnly?: boolean;
|
|
60
|
+
}>;
|
|
61
|
+
alias?: string;
|
|
62
|
+
typeOnly: boolean;
|
|
63
|
+
}
|
|
64
|
+
interface DeclarationSpan {
|
|
65
|
+
name: string;
|
|
66
|
+
kind: "function" | "class" | "interface" | "type" | "enum" | "variable" | "export";
|
|
67
|
+
exported: boolean;
|
|
68
|
+
startLine: number;
|
|
69
|
+
endLine: number;
|
|
70
|
+
}
|
|
27
71
|
interface SourceSummary {
|
|
28
72
|
directives: string[];
|
|
29
73
|
imports: string[];
|
|
@@ -51,6 +95,10 @@ interface SourceSummary {
|
|
|
51
95
|
* means both kinds are present.
|
|
52
96
|
*/
|
|
53
97
|
exportsKind?: "esm" | "cjs" | "mixed";
|
|
98
|
+
importBindings?: ImportBinding[];
|
|
99
|
+
reExportBindings?: ReExportBinding[];
|
|
100
|
+
declarationSpans?: DeclarationSpan[];
|
|
101
|
+
declarationSpansOmitted?: true;
|
|
54
102
|
}
|
|
55
103
|
interface JsonSummary {
|
|
56
104
|
shape: string;
|
|
@@ -1009,4 +1057,4 @@ interface ValidationResult {
|
|
|
1009
1057
|
warnings: string[];
|
|
1010
1058
|
}
|
|
1011
1059
|
|
|
1012
|
-
export type { ArtifactSelection as A, ByteSize as B, CliOptions as C, DiscoveryMode as D, FileEntry as F, HooksConfig as H,
|
|
1060
|
+
export type { ArtifactSelection as A, ByteSize as B, CliOptions as C, DiscoveryMode as D, EdgeProvenance as E, FileEntry as F, SummaryQuality as G, HooksConfig as H, ImportBinding as I, JsonSummary as J, KindRule as K, LayerRule as L, MarkdownSummary as M, TruncationReason as N, OutputFormat as O, PromptTask as P, ValidationDrift as Q, ResolvedSnapshotConfig as R, SecretRule as S, TextEncoding as T, ValidationResult as V, SkipRecord as a, SourceSummary as b, SnapshotConfig as c, PartMetadata as d, SecretFinding as e, Manifest as f, TrustEnvelope as g, BudgetConfig as h, CoverageStatus as i, DeclarationSpan as j, FreshnessStatus as k, InclusionMode as l, IncompleteFile as m, IndexSourceKind as n, ManifestArtifact as o, ManifestConfigSnapshot as p, ManifestIndexes as q, ManifestTotals as r, Mode as s, OwnerBrief as t, PartFileEntry as u, ReExportBinding as v, ResolvedArtifacts as w, ResolvedBudgets as x, SecretRuleInput as y, SkipReason as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type Mode = "generate" | "validate" | "report";
|
|
2
|
-
type OutputFormat = "text" | "json";
|
|
2
|
+
type OutputFormat = "text" | "json" | "markdown" | "pr-comment";
|
|
3
3
|
/**
|
|
4
4
|
* How files are discovered.
|
|
5
5
|
*
|
|
@@ -24,6 +24,50 @@ type TextEncoding = "utf-8" | "utf-8-lossy" | "utf-16le" | "utf-16be";
|
|
|
24
24
|
* `comments-stripped` – comment text was removed (line numbers preserved) before emission.
|
|
25
25
|
*/
|
|
26
26
|
type InclusionMode = "full" | "preview" | "signatures" | "comments-stripped";
|
|
27
|
+
type IndexSourceKind = "snapshot" | "live-overlay" | "live-memory";
|
|
28
|
+
type FreshnessStatus = "current" | "stale" | "live-computed" | "unknown";
|
|
29
|
+
type CoverageStatus = "complete" | "partial";
|
|
30
|
+
type EdgeProvenance = "ts-semantic" | "ts-reexport" | "import-binding" | "tsconfig-alias" | "workspace-alias" | "relative-import" | "heuristic";
|
|
31
|
+
interface TrustEnvelope {
|
|
32
|
+
indexSource: IndexSourceKind;
|
|
33
|
+
freshness: FreshnessStatus;
|
|
34
|
+
coverage: CoverageStatus;
|
|
35
|
+
snapshotFingerprint?: string;
|
|
36
|
+
overlayStats?: {
|
|
37
|
+
reusedFromManifest: number;
|
|
38
|
+
reparsedChanged: number;
|
|
39
|
+
added: number;
|
|
40
|
+
deleted: number;
|
|
41
|
+
};
|
|
42
|
+
sensitiveExcludedCount: number;
|
|
43
|
+
redactedLines: number;
|
|
44
|
+
omittedCount: number;
|
|
45
|
+
unresolvedCount: number;
|
|
46
|
+
reasons: string[];
|
|
47
|
+
}
|
|
48
|
+
interface ImportBinding {
|
|
49
|
+
specifier: string;
|
|
50
|
+
importedNames: string[];
|
|
51
|
+
typeOnly: boolean;
|
|
52
|
+
}
|
|
53
|
+
interface ReExportBinding {
|
|
54
|
+
specifier: string;
|
|
55
|
+
kind: "star" | "namespace" | "named";
|
|
56
|
+
entries?: Array<{
|
|
57
|
+
imported: string;
|
|
58
|
+
exported: string;
|
|
59
|
+
typeOnly?: boolean;
|
|
60
|
+
}>;
|
|
61
|
+
alias?: string;
|
|
62
|
+
typeOnly: boolean;
|
|
63
|
+
}
|
|
64
|
+
interface DeclarationSpan {
|
|
65
|
+
name: string;
|
|
66
|
+
kind: "function" | "class" | "interface" | "type" | "enum" | "variable" | "export";
|
|
67
|
+
exported: boolean;
|
|
68
|
+
startLine: number;
|
|
69
|
+
endLine: number;
|
|
70
|
+
}
|
|
27
71
|
interface SourceSummary {
|
|
28
72
|
directives: string[];
|
|
29
73
|
imports: string[];
|
|
@@ -51,6 +95,10 @@ interface SourceSummary {
|
|
|
51
95
|
* means both kinds are present.
|
|
52
96
|
*/
|
|
53
97
|
exportsKind?: "esm" | "cjs" | "mixed";
|
|
98
|
+
importBindings?: ImportBinding[];
|
|
99
|
+
reExportBindings?: ReExportBinding[];
|
|
100
|
+
declarationSpans?: DeclarationSpan[];
|
|
101
|
+
declarationSpansOmitted?: true;
|
|
54
102
|
}
|
|
55
103
|
interface JsonSummary {
|
|
56
104
|
shape: string;
|
|
@@ -1009,4 +1057,4 @@ interface ValidationResult {
|
|
|
1009
1057
|
warnings: string[];
|
|
1010
1058
|
}
|
|
1011
1059
|
|
|
1012
|
-
export type { ArtifactSelection as A, ByteSize as B, CliOptions as C, DiscoveryMode as D, FileEntry as F, HooksConfig as H,
|
|
1060
|
+
export type { ArtifactSelection as A, ByteSize as B, CliOptions as C, DiscoveryMode as D, EdgeProvenance as E, FileEntry as F, SummaryQuality as G, HooksConfig as H, ImportBinding as I, JsonSummary as J, KindRule as K, LayerRule as L, MarkdownSummary as M, TruncationReason as N, OutputFormat as O, PromptTask as P, ValidationDrift as Q, ResolvedSnapshotConfig as R, SecretRule as S, TextEncoding as T, ValidationResult as V, SkipRecord as a, SourceSummary as b, SnapshotConfig as c, PartMetadata as d, SecretFinding as e, Manifest as f, TrustEnvelope as g, BudgetConfig as h, CoverageStatus as i, DeclarationSpan as j, FreshnessStatus as k, InclusionMode as l, IncompleteFile as m, IndexSourceKind as n, ManifestArtifact as o, ManifestConfigSnapshot as p, ManifestIndexes as q, ManifestTotals as r, Mode as s, OwnerBrief as t, PartFileEntry as u, ReExportBinding as v, ResolvedArtifacts as w, ResolvedBudgets as x, SecretRuleInput as y, SkipReason as z };
|
package/docs/about.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# About codebase-snapshot
|
|
2
|
+
|
|
3
|
+
codebase-snapshot is a local CLI and MCP server for turning a repository into LLM-ready context
|
|
4
|
+
that a person or an agent can actually check. It is maintained by **Ankur Halder**, a software
|
|
5
|
+
engineer who builds developer tools and writes about context engineering.
|
|
6
|
+
|
|
7
|
+
This page exists for the same reason the rest of the documentation does: a technical claim is
|
|
8
|
+
easier to trust when you can see who made it, how it was tested, and how to correct it.
|
|
9
|
+
|
|
10
|
+
## What this project is
|
|
11
|
+
|
|
12
|
+
- A deterministic scanner that writes Markdown parts under a hard byte budget.
|
|
13
|
+
- A manifest that records every included file, every skipped path and the reason, and every file
|
|
14
|
+
whose body was shortened, with the missing line ranges.
|
|
15
|
+
- A secret redactor that masks matched values in place, and an audit that re-scans the result.
|
|
16
|
+
- A validator that re-hashes the tree and exits non-zero when the snapshot no longer matches it.
|
|
17
|
+
- A live index and an MCP server with seven read-only tools, so an agent can ask for the one
|
|
18
|
+
file, symbol or impact report it needs instead of reading the whole repository.
|
|
19
|
+
- A small, dependency-light TypeScript package: one runtime dependency, no native binary.
|
|
20
|
+
|
|
21
|
+
## What this project is not
|
|
22
|
+
|
|
23
|
+
- **Not a hosted service.** The CLI reads a directory you name and writes a directory you name.
|
|
24
|
+
The MCP server runs on your machine. Nothing is uploaded by the tool itself.
|
|
25
|
+
- **Not a code graph or a replacement for a compiler.** The language profiles are heuristics; the
|
|
26
|
+
optional TypeScript pass is confined and capped, and the docs say where it stops.
|
|
27
|
+
- **Not a guarantee that a model will answer correctly.** Better context removes one failure
|
|
28
|
+
mode. It does not replace tests, review or a reproducible build.
|
|
29
|
+
- **Not a secret scanner with a compliance certificate.** Redaction is defence in depth, not a
|
|
30
|
+
promise that every possible credential shape is known. The [security review](security-review.md)
|
|
31
|
+
states the residual risks plainly.
|
|
32
|
+
|
|
33
|
+
## How the claims are tested
|
|
34
|
+
|
|
35
|
+
The repository runs one offline gate before every publish: lint, typecheck, the test suite, a
|
|
36
|
+
tarball check, the docs site and a link audit. A separate deep run generates a real snapshot,
|
|
37
|
+
validates it against the source tree, verifies every git path is accounted for, and proves the
|
|
38
|
+
run is reproducible.
|
|
39
|
+
|
|
40
|
+
Every snapshot this project publishes about itself is generated by the tool and checked by the
|
|
41
|
+
same validator users get. The docs quote measured numbers, name the version and date, and keep
|
|
42
|
+
the script that produced them in the repository. When a number changes, the page changes with it
|
|
43
|
+
or the number is removed.
|
|
44
|
+
|
|
45
|
+
The site is built from the same Markdown that ships in the package. There is no second copy of
|
|
46
|
+
the prose to drift, and every page shows its last-updated date from git history.
|
|
47
|
+
|
|
48
|
+
## Editorial policy
|
|
49
|
+
|
|
50
|
+
- **Original, tested explanations.** Guides are written from the repository, the tests and real
|
|
51
|
+
runs, not assembled from other people's summaries.
|
|
52
|
+
- **No paid placements.** Comparisons are written by the maintainer and say where the other tool
|
|
53
|
+
is the better choice. There are no bought listicles, paid reviews or guaranteed-placement
|
|
54
|
+
schemes.
|
|
55
|
+
- **Corrections are public.** Open an issue at
|
|
56
|
+
[github.com/ankurhalder/codebase-snapshot/issues](https://github.com/ankurhalder/codebase-snapshot/issues)
|
|
57
|
+
with the page, the claim and the evidence. A correction is committed like any other change.
|
|
58
|
+
- **AI-assisted editing is used; mistakes are treated as defects.** Every command, number and
|
|
59
|
+
security claim is still required to survive the test suite and a manual read. A wrong claim is
|
|
60
|
+
corrected, not defended because a model wrote it.
|
|
61
|
+
|
|
62
|
+
## How this site is built
|
|
63
|
+
|
|
64
|
+
The source of truth is [README.md](https://github.com/ankurhalder/codebase-snapshot/blob/main/README.md)
|
|
65
|
+
and [docs/](https://github.com/ankurhalder/codebase-snapshot/tree/main/docs). A build script renders
|
|
66
|
+
them to static HTML with a canonical URL, a Markdown twin, structured data and a sitemap. There is
|
|
67
|
+
no client-side router and no JavaScript required to read a page.
|
|
68
|
+
|
|
69
|
+
The [llms.txt](https://ankurhalder.github.io/codebase-snapshot/llms.txt) and
|
|
70
|
+
[llms-full.txt](https://ankurhalder.github.io/codebase-snapshot/llms-full.txt) files are generated from
|
|
71
|
+
the same source for agents that prefer one fetch. They are an agent convenience, not a search-engine ranking
|
|
72
|
+
trick.
|
|
73
|
+
|
|
74
|
+
## Elsewhere
|
|
75
|
+
|
|
76
|
+
- Source and issues: [github.com/ankurhalder/codebase-snapshot](https://github.com/ankurhalder/codebase-snapshot)
|
|
77
|
+
- Package: [npmjs.com/package/codebase-snapshot](https://www.npmjs.com/package/codebase-snapshot)
|
|
78
|
+
- Author: [GitHub](https://github.com/ankurhalder), [npm](https://www.npmjs.com/~ankurhalder)
|
|
79
|
+
- MCP listings: [Glama](https://glama.ai/mcp/servers/ankurhalder/codebase-snapshot),
|
|
80
|
+
[M8ven](https://m8ven.ai/mcp/ankurhalder-codebase-snapshot-9hzkhs)
|
|
81
|
+
|
|
82
|
+
## Related
|
|
83
|
+
|
|
84
|
+
- [FAQ](faq.md) — short answers to the questions this page raises.
|
|
85
|
+
- [Security review](security-review.md) — the threat model and residual risks.
|
|
86
|
+
- [All documentation](contents.md) — every guide, reference and comparison.
|
package/docs/agent.md
CHANGED
|
@@ -32,6 +32,23 @@ Sets the project up — config, npm scripts, devDependency, `.gitignore`, instal
|
|
|
32
32
|
with no prompts. It keeps an existing config, and `--no-install` avoids touching the lockfile.
|
|
33
33
|
`setup` is the same operation as a command word.
|
|
34
34
|
|
|
35
|
+
### Reviewing a change
|
|
36
|
+
|
|
37
|
+
`impact` answers the question a reviewer actually has without reading the whole repository again,
|
|
38
|
+
and it does not require a prior `generate`:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npx codebase-snapshot impact --diff main --format json
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
It reports changed files, the symbol-pruned reverse-import closure with the exact specifier for each
|
|
45
|
+
hop, and the tests that directly import a changed or affected file. A live index reuses a current
|
|
46
|
+
manifest, overlays uncommitted files, or scans in memory; `--no-live` requires the snapshot. The
|
|
47
|
+
same resolver handles `tsconfig` aliases. `changed[]` says whether each path is in the snapshot,
|
|
48
|
+
`unresolved[]` names internal imports that did not resolve, and `truncated`/`warnings` say when the
|
|
49
|
+
walk hit a limit. For a reviewer-ready pack, use `brief --diff <ref>`. The MCP equivalent is
|
|
50
|
+
`snapshot_impact` with `base` or `paths`.
|
|
51
|
+
|
|
35
52
|
### Do not rely on the bare command
|
|
36
53
|
|
|
37
54
|
```bash
|
|
@@ -84,16 +101,20 @@ npx codebase-snapshot skill > SKILL.md
|
|
|
84
101
|
|
|
85
102
|
| Target | Path | Read by |
|
|
86
103
|
| :--- | :--- | :--- |
|
|
104
|
+
| `agents` | `.agents/skills/codebase-snapshot/SKILL.md` | Portable agent skill registry |
|
|
87
105
|
| `claude` | `.claude/skills/codebase-snapshot/SKILL.md` | Claude Code auto-discovery |
|
|
88
106
|
| `cursor` | `.cursor/rules/codebase-snapshot.mdc` | Cursor rules |
|
|
89
107
|
|
|
90
108
|
```bash
|
|
91
109
|
npx codebase-snapshot skill --install --target claude # one registry
|
|
92
|
-
npx codebase-snapshot skill --install #
|
|
110
|
+
npx codebase-snapshot skill --install # all three (default)
|
|
111
|
+
npx codebase-snapshot skill --install --with-mcp # also merge .mcp.json
|
|
93
112
|
```
|
|
94
113
|
|
|
95
|
-
|
|
114
|
+
All three are **registries keyed by skill name**: the path carries `codebase-snapshot`, so the file
|
|
96
115
|
cannot be mistaken for your project's own documentation, and two skills cannot collide.
|
|
116
|
+
`--with-mcp` merges one `codebase-snapshot` entry into `.mcp.json` and leaves every other server
|
|
117
|
+
untouched; an existing different entry is kept and noted instead of clobbered.
|
|
97
118
|
|
|
98
119
|
**It never writes `AGENTS.md`.** That file is the repository's own agent contract — build
|
|
99
120
|
commands, conventions, house rules — and an install that creates or edits it puts a tool's
|
|
@@ -115,13 +136,14 @@ devDependency and the `.gitignore` entries for the snapshot directory, and nothi
|
|
|
115
136
|
|
|
116
137
|
## When the client speaks MCP
|
|
117
138
|
|
|
118
|
-
`codebase-snapshot mcp` serves the repository to a Model Context Protocol client over stdio:
|
|
139
|
+
`codebase-snapshot mcp` serves the repository to a Model Context Protocol client over stdio: 7
|
|
119
140
|
tools, `snapshot://` resources and seven prompts. Prefer it over shelling out when the agent already
|
|
120
141
|
has an MCP connection, for two reasons that are properties of the design rather than of the wiring:
|
|
121
142
|
|
|
122
|
-
- **Reads
|
|
123
|
-
|
|
124
|
-
stays redacted.
|
|
143
|
+
- **Reads are live by default.** The server indexes the working tree in memory, overlays uncommitted
|
|
144
|
+
edits, and needs no snapshot directory. A file the index excludes cannot be read back, and a
|
|
145
|
+
redacted value stays redacted. With `live: false`, `snapshot_read` extracts the emitted part
|
|
146
|
+
instead.
|
|
125
147
|
- **Staleness is a first-class question.** `snapshot_validate` answers "has the code moved since
|
|
126
148
|
this was built", which an agent with only a filesystem tool has no way to ask.
|
|
127
149
|
|