codebase-snapshot 0.9.12 → 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 +513 -0
- package/README.md +2 -2
- package/SECURITY.md +23 -5
- package/dist/bin.js +2021 -953
- package/dist/{chunk-5OR3WVPW.js → chunk-AU2VNTUU.js} +663 -467
- package/dist/{chunk-3H45YMBG.js → chunk-JL4VDGXL.js} +1666 -765
- package/dist/cli.cjs +2006 -941
- package/dist/cli.d.cts +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +136 -110
- package/dist/{generate-worker-D5Xgh27c.d.cts → generate-worker-D_mUjgXw.d.cts} +21 -5
- package/dist/{generate-worker-D5Xgh27c.d.ts → generate-worker-D_mUjgXw.d.ts} +21 -5
- package/dist/index.cjs +1642 -758
- package/dist/index.d.cts +58 -35
- package/dist/index.d.ts +58 -35
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +4873 -3981
- package/dist/mcp.d.cts +77 -67
- package/dist/mcp.d.ts +77 -67
- package/dist/mcp.js +2 -2
- package/dist/{types-CTewen3J.d.cts → types-DIX6zWSt.d.cts} +15 -0
- package/dist/{types-CTewen3J.d.ts → types-DIX6zWSt.d.ts} +15 -0
- package/docs/cli.md +76 -48
- package/docs/configuration.md +81 -22
- package/docs/install.md +4 -3
- package/docs/mcp.md +43 -6
- package/docs/output.md +51 -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/dist/mcp.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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-D_mUjgXw.cjs';
|
|
2
2
|
import { Readable, Writable } from 'node:stream';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -58,6 +58,16 @@ declare const ERROR_CODES: {
|
|
|
58
58
|
readonly methodNotFound: -32601;
|
|
59
59
|
readonly invalidParams: -32602;
|
|
60
60
|
readonly internalError: -32603;
|
|
61
|
+
/**
|
|
62
|
+
* A resource whose complete text is larger than one read may return.
|
|
63
|
+
*
|
|
64
|
+
* `-32000` is JSON-RPC's range for implementation-defined server errors, which is what this is:
|
|
65
|
+
* there is no standard code for "the document is too large", and answering with -32602 would tell
|
|
66
|
+
* a client its request was malformed when it was not. The message names the size, the limit and
|
|
67
|
+
* the tool to use instead, because a resource read that cannot return the whole resource must not
|
|
68
|
+
* invent a partial one.
|
|
69
|
+
*/
|
|
70
|
+
readonly resourceTooLarge: -32000;
|
|
61
71
|
readonly unsupportedProtocolVersion: -32022;
|
|
62
72
|
};
|
|
63
73
|
/** Method names, kept as constants so a typo is a compile error rather than a `-32601`. */
|
|
@@ -101,72 +111,6 @@ interface InputSchema extends JsonSchema {
|
|
|
101
111
|
properties: Record<string, JsonSchema>;
|
|
102
112
|
}
|
|
103
113
|
|
|
104
|
-
type ProtocolEra = "legacy" | "modern";
|
|
105
|
-
/** Per-connection state. The modern era has no session, so this stays empty until legacy init. */
|
|
106
|
-
interface SessionState {
|
|
107
|
-
/** Which era the connection committed to, or null before the first decisive request. */
|
|
108
|
-
era: ProtocolEra | null;
|
|
109
|
-
/** The revision in force. Null in legacy until `initialize` has been negotiated. */
|
|
110
|
-
protocolVersion: string | null;
|
|
111
|
-
/** True once `initialize` has been answered, which is the legacy lifecycle's gate. */
|
|
112
|
-
ready: boolean;
|
|
113
|
-
}
|
|
114
|
-
declare function createSession(): SessionState;
|
|
115
|
-
/** The modern request metadata, when a request carries it at all. */
|
|
116
|
-
interface ModernMeta {
|
|
117
|
-
version: string;
|
|
118
|
-
clientCapabilities: JsonObject;
|
|
119
|
-
clientInfo: JsonObject | null;
|
|
120
|
-
}
|
|
121
|
-
type MetaInspection = {
|
|
122
|
-
kind: "absent";
|
|
123
|
-
} | {
|
|
124
|
-
kind: "incomplete";
|
|
125
|
-
missing: string;
|
|
126
|
-
} | {
|
|
127
|
-
kind: "present";
|
|
128
|
-
meta: ModernMeta;
|
|
129
|
-
};
|
|
130
|
-
/**
|
|
131
|
-
* Reads `_meta` from a request.
|
|
132
|
-
*
|
|
133
|
-
* `absent` and `incomplete` are different answers: a request with no `_meta` at all is a legacy
|
|
134
|
-
* client, while a request with `_meta` that lacks a required key is a modern client making a
|
|
135
|
-
* mistake — and telling those two apart is what keeps the legacy era from being rejected for a
|
|
136
|
-
* field it never had.
|
|
137
|
-
*/
|
|
138
|
-
declare function inspectModernMeta(params: JsonObject | undefined): MetaInspection;
|
|
139
|
-
type EraDecision = {
|
|
140
|
-
kind: "era";
|
|
141
|
-
era: ProtocolEra;
|
|
142
|
-
version: string | null;
|
|
143
|
-
} | {
|
|
144
|
-
kind: "error";
|
|
145
|
-
code: number;
|
|
146
|
-
message: string;
|
|
147
|
-
data?: unknown;
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* Decides which era a request belongs to, and whether its version is acceptable.
|
|
151
|
-
*
|
|
152
|
-
* Once a connection commits to an era it stays committed. A legacy client that suddenly sends
|
|
153
|
-
* modern `_meta` is confused rather than clever, and silently switching would answer half a
|
|
154
|
-
* session in each shape.
|
|
155
|
-
*/
|
|
156
|
-
declare function classifyRequest(method: string, params: JsonObject | undefined, session: SessionState): EraDecision;
|
|
157
|
-
interface LegacyNegotiation {
|
|
158
|
-
version: string;
|
|
159
|
-
/** False when the client asked for something we cannot speak and was negotiated down. */
|
|
160
|
-
matched: boolean;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Legacy version negotiation: echo a supported request, otherwise answer with our best.
|
|
164
|
-
*
|
|
165
|
-
* A client that asked for a modern revision here gets the newest *legacy* revision, not an error:
|
|
166
|
-
* under this lifecycle the server's answer is the offer, and the client decides.
|
|
167
|
-
*/
|
|
168
|
-
declare function negotiateLegacyVersion(requested: unknown): LegacyNegotiation;
|
|
169
|
-
|
|
170
114
|
/**
|
|
171
115
|
* The capability records the MCP server serves.
|
|
172
116
|
*
|
|
@@ -279,6 +223,72 @@ interface McpServerInfo {
|
|
|
279
223
|
websiteUrl: string;
|
|
280
224
|
}
|
|
281
225
|
|
|
226
|
+
type ProtocolEra = "legacy" | "modern";
|
|
227
|
+
/** Per-connection state. The modern era has no session, so this stays empty until legacy init. */
|
|
228
|
+
interface SessionState {
|
|
229
|
+
/** Which era the connection committed to, or null before the first decisive request. */
|
|
230
|
+
era: ProtocolEra | null;
|
|
231
|
+
/** The revision in force. Null in legacy until `initialize` has been negotiated. */
|
|
232
|
+
protocolVersion: string | null;
|
|
233
|
+
/** True once `initialize` has been answered, which is the legacy lifecycle's gate. */
|
|
234
|
+
ready: boolean;
|
|
235
|
+
}
|
|
236
|
+
declare function createSession(): SessionState;
|
|
237
|
+
/** The modern request metadata, when a request carries it at all. */
|
|
238
|
+
interface ModernMeta {
|
|
239
|
+
version: string;
|
|
240
|
+
clientCapabilities: JsonObject;
|
|
241
|
+
clientInfo: JsonObject | null;
|
|
242
|
+
}
|
|
243
|
+
type MetaInspection = {
|
|
244
|
+
kind: "absent";
|
|
245
|
+
} | {
|
|
246
|
+
kind: "incomplete";
|
|
247
|
+
missing: string;
|
|
248
|
+
} | {
|
|
249
|
+
kind: "present";
|
|
250
|
+
meta: ModernMeta;
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* Reads `_meta` from a request.
|
|
254
|
+
*
|
|
255
|
+
* `absent` and `incomplete` are different answers: a request with no `_meta` at all is a legacy
|
|
256
|
+
* client, while a request with `_meta` that lacks a required key is a modern client making a
|
|
257
|
+
* mistake — and telling those two apart is what keeps the legacy era from being rejected for a
|
|
258
|
+
* field it never had.
|
|
259
|
+
*/
|
|
260
|
+
declare function inspectModernMeta(params: JsonObject | undefined): MetaInspection;
|
|
261
|
+
type EraDecision = {
|
|
262
|
+
kind: "era";
|
|
263
|
+
era: ProtocolEra;
|
|
264
|
+
version: string | null;
|
|
265
|
+
} | {
|
|
266
|
+
kind: "error";
|
|
267
|
+
code: number;
|
|
268
|
+
message: string;
|
|
269
|
+
data?: unknown;
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* Decides which era a request belongs to, and whether its version is acceptable.
|
|
273
|
+
*
|
|
274
|
+
* Once a connection commits to an era it stays committed. A legacy client that suddenly sends
|
|
275
|
+
* modern `_meta` is confused rather than clever, and silently switching would answer half a
|
|
276
|
+
* session in each shape.
|
|
277
|
+
*/
|
|
278
|
+
declare function classifyRequest(method: string, params: JsonObject | undefined, session: SessionState): EraDecision;
|
|
279
|
+
interface LegacyNegotiation {
|
|
280
|
+
version: string;
|
|
281
|
+
/** False when the client asked for something we cannot speak and was negotiated down. */
|
|
282
|
+
matched: boolean;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Legacy version negotiation: echo a supported request, otherwise answer with our best.
|
|
286
|
+
*
|
|
287
|
+
* A client that asked for a modern revision here gets the newest *legacy* revision, not an error:
|
|
288
|
+
* under this lifecycle the server's answer is the offer, and the client decides.
|
|
289
|
+
*/
|
|
290
|
+
declare function negotiateLegacyVersion(requested: unknown): LegacyNegotiation;
|
|
291
|
+
|
|
282
292
|
interface McpServerOptions {
|
|
283
293
|
info: McpServerInfo;
|
|
284
294
|
instructions: string;
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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-D_mUjgXw.js';
|
|
2
2
|
import { Readable, Writable } from 'node:stream';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -58,6 +58,16 @@ declare const ERROR_CODES: {
|
|
|
58
58
|
readonly methodNotFound: -32601;
|
|
59
59
|
readonly invalidParams: -32602;
|
|
60
60
|
readonly internalError: -32603;
|
|
61
|
+
/**
|
|
62
|
+
* A resource whose complete text is larger than one read may return.
|
|
63
|
+
*
|
|
64
|
+
* `-32000` is JSON-RPC's range for implementation-defined server errors, which is what this is:
|
|
65
|
+
* there is no standard code for "the document is too large", and answering with -32602 would tell
|
|
66
|
+
* a client its request was malformed when it was not. The message names the size, the limit and
|
|
67
|
+
* the tool to use instead, because a resource read that cannot return the whole resource must not
|
|
68
|
+
* invent a partial one.
|
|
69
|
+
*/
|
|
70
|
+
readonly resourceTooLarge: -32000;
|
|
61
71
|
readonly unsupportedProtocolVersion: -32022;
|
|
62
72
|
};
|
|
63
73
|
/** Method names, kept as constants so a typo is a compile error rather than a `-32601`. */
|
|
@@ -101,72 +111,6 @@ interface InputSchema extends JsonSchema {
|
|
|
101
111
|
properties: Record<string, JsonSchema>;
|
|
102
112
|
}
|
|
103
113
|
|
|
104
|
-
type ProtocolEra = "legacy" | "modern";
|
|
105
|
-
/** Per-connection state. The modern era has no session, so this stays empty until legacy init. */
|
|
106
|
-
interface SessionState {
|
|
107
|
-
/** Which era the connection committed to, or null before the first decisive request. */
|
|
108
|
-
era: ProtocolEra | null;
|
|
109
|
-
/** The revision in force. Null in legacy until `initialize` has been negotiated. */
|
|
110
|
-
protocolVersion: string | null;
|
|
111
|
-
/** True once `initialize` has been answered, which is the legacy lifecycle's gate. */
|
|
112
|
-
ready: boolean;
|
|
113
|
-
}
|
|
114
|
-
declare function createSession(): SessionState;
|
|
115
|
-
/** The modern request metadata, when a request carries it at all. */
|
|
116
|
-
interface ModernMeta {
|
|
117
|
-
version: string;
|
|
118
|
-
clientCapabilities: JsonObject;
|
|
119
|
-
clientInfo: JsonObject | null;
|
|
120
|
-
}
|
|
121
|
-
type MetaInspection = {
|
|
122
|
-
kind: "absent";
|
|
123
|
-
} | {
|
|
124
|
-
kind: "incomplete";
|
|
125
|
-
missing: string;
|
|
126
|
-
} | {
|
|
127
|
-
kind: "present";
|
|
128
|
-
meta: ModernMeta;
|
|
129
|
-
};
|
|
130
|
-
/**
|
|
131
|
-
* Reads `_meta` from a request.
|
|
132
|
-
*
|
|
133
|
-
* `absent` and `incomplete` are different answers: a request with no `_meta` at all is a legacy
|
|
134
|
-
* client, while a request with `_meta` that lacks a required key is a modern client making a
|
|
135
|
-
* mistake — and telling those two apart is what keeps the legacy era from being rejected for a
|
|
136
|
-
* field it never had.
|
|
137
|
-
*/
|
|
138
|
-
declare function inspectModernMeta(params: JsonObject | undefined): MetaInspection;
|
|
139
|
-
type EraDecision = {
|
|
140
|
-
kind: "era";
|
|
141
|
-
era: ProtocolEra;
|
|
142
|
-
version: string | null;
|
|
143
|
-
} | {
|
|
144
|
-
kind: "error";
|
|
145
|
-
code: number;
|
|
146
|
-
message: string;
|
|
147
|
-
data?: unknown;
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* Decides which era a request belongs to, and whether its version is acceptable.
|
|
151
|
-
*
|
|
152
|
-
* Once a connection commits to an era it stays committed. A legacy client that suddenly sends
|
|
153
|
-
* modern `_meta` is confused rather than clever, and silently switching would answer half a
|
|
154
|
-
* session in each shape.
|
|
155
|
-
*/
|
|
156
|
-
declare function classifyRequest(method: string, params: JsonObject | undefined, session: SessionState): EraDecision;
|
|
157
|
-
interface LegacyNegotiation {
|
|
158
|
-
version: string;
|
|
159
|
-
/** False when the client asked for something we cannot speak and was negotiated down. */
|
|
160
|
-
matched: boolean;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Legacy version negotiation: echo a supported request, otherwise answer with our best.
|
|
164
|
-
*
|
|
165
|
-
* A client that asked for a modern revision here gets the newest *legacy* revision, not an error:
|
|
166
|
-
* under this lifecycle the server's answer is the offer, and the client decides.
|
|
167
|
-
*/
|
|
168
|
-
declare function negotiateLegacyVersion(requested: unknown): LegacyNegotiation;
|
|
169
|
-
|
|
170
114
|
/**
|
|
171
115
|
* The capability records the MCP server serves.
|
|
172
116
|
*
|
|
@@ -279,6 +223,72 @@ interface McpServerInfo {
|
|
|
279
223
|
websiteUrl: string;
|
|
280
224
|
}
|
|
281
225
|
|
|
226
|
+
type ProtocolEra = "legacy" | "modern";
|
|
227
|
+
/** Per-connection state. The modern era has no session, so this stays empty until legacy init. */
|
|
228
|
+
interface SessionState {
|
|
229
|
+
/** Which era the connection committed to, or null before the first decisive request. */
|
|
230
|
+
era: ProtocolEra | null;
|
|
231
|
+
/** The revision in force. Null in legacy until `initialize` has been negotiated. */
|
|
232
|
+
protocolVersion: string | null;
|
|
233
|
+
/** True once `initialize` has been answered, which is the legacy lifecycle's gate. */
|
|
234
|
+
ready: boolean;
|
|
235
|
+
}
|
|
236
|
+
declare function createSession(): SessionState;
|
|
237
|
+
/** The modern request metadata, when a request carries it at all. */
|
|
238
|
+
interface ModernMeta {
|
|
239
|
+
version: string;
|
|
240
|
+
clientCapabilities: JsonObject;
|
|
241
|
+
clientInfo: JsonObject | null;
|
|
242
|
+
}
|
|
243
|
+
type MetaInspection = {
|
|
244
|
+
kind: "absent";
|
|
245
|
+
} | {
|
|
246
|
+
kind: "incomplete";
|
|
247
|
+
missing: string;
|
|
248
|
+
} | {
|
|
249
|
+
kind: "present";
|
|
250
|
+
meta: ModernMeta;
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* Reads `_meta` from a request.
|
|
254
|
+
*
|
|
255
|
+
* `absent` and `incomplete` are different answers: a request with no `_meta` at all is a legacy
|
|
256
|
+
* client, while a request with `_meta` that lacks a required key is a modern client making a
|
|
257
|
+
* mistake — and telling those two apart is what keeps the legacy era from being rejected for a
|
|
258
|
+
* field it never had.
|
|
259
|
+
*/
|
|
260
|
+
declare function inspectModernMeta(params: JsonObject | undefined): MetaInspection;
|
|
261
|
+
type EraDecision = {
|
|
262
|
+
kind: "era";
|
|
263
|
+
era: ProtocolEra;
|
|
264
|
+
version: string | null;
|
|
265
|
+
} | {
|
|
266
|
+
kind: "error";
|
|
267
|
+
code: number;
|
|
268
|
+
message: string;
|
|
269
|
+
data?: unknown;
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* Decides which era a request belongs to, and whether its version is acceptable.
|
|
273
|
+
*
|
|
274
|
+
* Once a connection commits to an era it stays committed. A legacy client that suddenly sends
|
|
275
|
+
* modern `_meta` is confused rather than clever, and silently switching would answer half a
|
|
276
|
+
* session in each shape.
|
|
277
|
+
*/
|
|
278
|
+
declare function classifyRequest(method: string, params: JsonObject | undefined, session: SessionState): EraDecision;
|
|
279
|
+
interface LegacyNegotiation {
|
|
280
|
+
version: string;
|
|
281
|
+
/** False when the client asked for something we cannot speak and was negotiated down. */
|
|
282
|
+
matched: boolean;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Legacy version negotiation: echo a supported request, otherwise answer with our best.
|
|
286
|
+
*
|
|
287
|
+
* A client that asked for a modern revision here gets the newest *legacy* revision, not an error:
|
|
288
|
+
* under this lifecycle the server's answer is the offer, and the client decides.
|
|
289
|
+
*/
|
|
290
|
+
declare function negotiateLegacyVersion(requested: unknown): LegacyNegotiation;
|
|
291
|
+
|
|
282
292
|
interface McpServerOptions {
|
|
283
293
|
info: McpServerInfo;
|
|
284
294
|
instructions: string;
|
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-AU2VNTUU.js';
|
|
2
|
+
export { generateInWorker } from './chunk-JL4VDGXL.js';
|
|
@@ -568,9 +568,24 @@ interface CliOptions {
|
|
|
568
568
|
includeSensitiveFiles?: boolean;
|
|
569
569
|
maxMonolithBytes?: number | null;
|
|
570
570
|
maxPartBytes?: number;
|
|
571
|
+
maxPartTokens?: ByteSize | null;
|
|
571
572
|
largeFileBytes?: number;
|
|
572
573
|
/** Artifact names to suppress for this invocation (`--skip-artifacts`). */
|
|
573
574
|
skipArtifacts?: string[];
|
|
575
|
+
/**
|
|
576
|
+
* Artifact names to keep, with everything else off (`--only-artifacts`).
|
|
577
|
+
*
|
|
578
|
+
* Separate from the derived `skipArtifacts` because the two are not interchangeable: "only
|
|
579
|
+
* these" is a statement about the whole selection, and the suppression list cannot express it
|
|
580
|
+
* when the configuration has already turned one of the named artifacts off.
|
|
581
|
+
*/
|
|
582
|
+
onlyArtifacts?: string[];
|
|
583
|
+
discovery?: DiscoveryMode;
|
|
584
|
+
changedSince?: string;
|
|
585
|
+
staged?: boolean;
|
|
586
|
+
withDependents?: boolean;
|
|
587
|
+
skeleton?: boolean;
|
|
588
|
+
sarif?: boolean;
|
|
574
589
|
}
|
|
575
590
|
interface ValidationDrift {
|
|
576
591
|
missingInSnapshot: string[];
|
|
@@ -568,9 +568,24 @@ interface CliOptions {
|
|
|
568
568
|
includeSensitiveFiles?: boolean;
|
|
569
569
|
maxMonolithBytes?: number | null;
|
|
570
570
|
maxPartBytes?: number;
|
|
571
|
+
maxPartTokens?: ByteSize | null;
|
|
571
572
|
largeFileBytes?: number;
|
|
572
573
|
/** Artifact names to suppress for this invocation (`--skip-artifacts`). */
|
|
573
574
|
skipArtifacts?: string[];
|
|
575
|
+
/**
|
|
576
|
+
* Artifact names to keep, with everything else off (`--only-artifacts`).
|
|
577
|
+
*
|
|
578
|
+
* Separate from the derived `skipArtifacts` because the two are not interchangeable: "only
|
|
579
|
+
* these" is a statement about the whole selection, and the suppression list cannot express it
|
|
580
|
+
* when the configuration has already turned one of the named artifacts off.
|
|
581
|
+
*/
|
|
582
|
+
onlyArtifacts?: string[];
|
|
583
|
+
discovery?: DiscoveryMode;
|
|
584
|
+
changedSince?: string;
|
|
585
|
+
staged?: boolean;
|
|
586
|
+
withDependents?: boolean;
|
|
587
|
+
skeleton?: boolean;
|
|
588
|
+
sarif?: boolean;
|
|
574
589
|
}
|
|
575
590
|
interface ValidationDrift {
|
|
576
591
|
missingInSnapshot: string[];
|
package/docs/cli.md
CHANGED
|
@@ -132,9 +132,14 @@ says `… and N more in manifest.warnings[]`; nothing is dropped silently.
|
|
|
132
132
|
codebase-snapshot validate [options]
|
|
133
133
|
```
|
|
134
134
|
|
|
135
|
-
Compares the snapshot on disk with the repository. Reports
|
|
136
|
-
files, deleted files, files added since the snapshot, damaged or missing parts,
|
|
137
|
-
changes — plus bookkeeping mismatches in the manifest.
|
|
135
|
+
Compares the snapshot on disk with the repository. Reports six classes of drift — modified
|
|
136
|
+
files, deleted files, files added since the snapshot, damaged or missing parts, unreadable
|
|
137
|
+
files, and config changes — plus bookkeeping mismatches in the manifest.
|
|
138
|
+
|
|
139
|
+
An **unreadable** file is one that exists but that this process may not read or stat, usually a
|
|
140
|
+
filesystem-permission problem. It is a class of its own because the fix is different: filing it
|
|
141
|
+
as "deleted" sent the reader looking for a file that is still there. Text mode lists each path
|
|
142
|
+
as `unreadable: <path>`; `--format json` carries them in `drift.unreadable`.
|
|
138
143
|
|
|
139
144
|
Exit `0` when the snapshot is current, `1` on any drift. It never writes anything.
|
|
140
145
|
|
|
@@ -150,6 +155,10 @@ snapshot reports in about half a second. Requires an existing `manifest.json` (e
|
|
|
150
155
|
missing); exits `0` otherwise. It does **not** check whether the snapshot is still true — that
|
|
151
156
|
is `validate`, which re-reads the repository and exits `1` on drift.
|
|
152
157
|
|
|
158
|
+
It takes `--cwd`, `--out-dir`, `--no-config`, `--format` and `--no-update-check`. The
|
|
159
|
+
generation settings are rejected, not ignored: `report --max-part-bytes 120k` exits `2` with a
|
|
160
|
+
message naming the commands that do accept it.
|
|
161
|
+
|
|
153
162
|
### `setup`
|
|
154
163
|
|
|
155
164
|
```bash
|
|
@@ -174,7 +183,7 @@ The whole first run in one command, with defaults and no prompts. This is the sa
|
|
|
174
183
|
🚀 Setup for: /path/to/repo
|
|
175
184
|
✅ Created snapshot.config.ts (preset: nextjs)
|
|
176
185
|
Added npm scripts: snapshot, snapshot:validate
|
|
177
|
-
Added devDependency: codebase-snapshot ^0.9.
|
|
186
|
+
Added devDependency: codebase-snapshot ^0.9.15
|
|
178
187
|
Added to .gitignore: snapshot/, snapshot.tmp/
|
|
179
188
|
⏳ Installing dependencies…
|
|
180
189
|
✅ Installed dependencies (npm install, 2.1s)
|
|
@@ -186,13 +195,25 @@ The whole first run in one command, with defaults and no prompts. This is the sa
|
|
|
186
195
|
|
|
187
196
|
- `--no-install` skips step 4 — CI, an offline machine, or a lockfile you would rather no package
|
|
188
197
|
manager touched.
|
|
189
|
-
- `--dry-run` prints the plan and the config it would write, and writes nothing
|
|
198
|
+
- `--dry-run` prints the plan and the config it would write, and writes nothing — including the
|
|
199
|
+
`.git/hooks/pre-commit` that `--install-hook` would otherwise install.
|
|
190
200
|
- `--force` rewrites an existing config; `--preset`, `--include`, `--exclude`, `--out-dir`,
|
|
191
201
|
`--max-part-bytes`, `--include-sensitive-files` and `--skip-artifacts` behave as they do for
|
|
192
|
-
`generate` and `init`.
|
|
202
|
+
`generate` and `init`. `--only-artifacts` reaches the generation as itself rather than as a
|
|
203
|
+
derived suppression list, so it can switch an artifact back on even when the kept config
|
|
204
|
+
disables it.
|
|
205
|
+
- On a **kept** config, `--preset` cannot be applied: the file belongs to the repository and this
|
|
206
|
+
run does not rewrite it. The run still exits `0`; text mode prints
|
|
207
|
+
`⚠ --preset <name> was not applied: the existing config is kept.` and the setup document
|
|
208
|
+
reports `"preset": null` with the same explanation in `setup.notes[]`. Edit the config, or run
|
|
209
|
+
`init --force`, to change it.
|
|
193
210
|
- `--format json` emits **one** document:
|
|
194
|
-
`{ "setup": { configPath, configReused, preset, scripts, dependency, gitignoreEntries, install, notes }, "manifest": { … } }`,
|
|
195
|
-
where `manifest` is the same object `generate --format json` writes.
|
|
211
|
+
`{ "setup": { configPath, configReused, preset, scripts, dependency, gitignoreEntries, install, notes, hook }, "manifest": { … } }`,
|
|
212
|
+
where `manifest` is the same object `generate --format json` writes. With `--dry-run` the
|
|
213
|
+
document is the plan instead — `{ "dryRun": true, configPath, configReused, preset, install, configText }` —
|
|
214
|
+
because nothing was written. If the generate fails, the document is
|
|
215
|
+
`{ "error": { … }, "setup": { … }, "manifest": null }` and the exit code is the generate's: one
|
|
216
|
+
document per invocation, a payload or an error, never a payload holding an error.
|
|
196
217
|
- If `outDir` holds files this tool did not write, `setup` still refuses to replace it (exit 1,
|
|
197
218
|
naming the entries) after writing the config — the guard is not weakened by the convenience.
|
|
198
219
|
### `init`
|
|
@@ -211,7 +232,7 @@ It also has three side effects on files you own, and it says so when it does the
|
|
|
211
232
|
```
|
|
212
233
|
✅ Created snapshot.config.ts (preset: node-lib)
|
|
213
234
|
Added npm scripts: snapshot, snapshot:validate
|
|
214
|
-
Added devDependency: codebase-snapshot ^0.9.
|
|
235
|
+
Added devDependency: codebase-snapshot ^0.9.15
|
|
215
236
|
Added to .gitignore: snapshot/, snapshot.tmp/
|
|
216
237
|
```
|
|
217
238
|
|
|
@@ -248,7 +269,7 @@ generated file is a plain object with no imports, so it works even when the pack
|
|
|
248
269
|
run through `npx` and never installed.
|
|
249
270
|
|
|
250
271
|
Related options: `--preset`, `--include`, `--exclude`, `--yes` and `--force`
|
|
251
|
-
apply to `init` only. `init` also accepts `--dry-run`, `--max-part-bytes`, `--out-dir`,
|
|
272
|
+
apply to `init` and `setup` only. `init` also accepts `--dry-run`, `--max-part-bytes`, `--out-dir`,
|
|
252
273
|
`--include-sensitive-files`, `--skip-artifacts` and `--only-artifacts`, which it shares with
|
|
253
274
|
the commands that re-read a snapshot, and records their effect in the generated file. The
|
|
254
275
|
`Applies to` column is in the [options table](#options).
|
|
@@ -393,49 +414,48 @@ URIs and protocol versions appear in [the MCP server guide](mcp.md) and in
|
|
|
393
414
|
## Options
|
|
394
415
|
|
|
395
416
|
An option a command does not accept is **rejected**, not ignored: exit `2` and a message
|
|
396
|
-
naming the commands that do accept it.
|
|
397
|
-
|
|
417
|
+
naming the commands that do accept it. The narrowest scopes say so in the table: *skill only*
|
|
418
|
+
for the two install flags, and the init-and-setup flags list both commands.
|
|
398
419
|
|
|
399
420
|
| Option | Type | Default | Applies to | Meaning |
|
|
400
421
|
| :--- | :--- | :--- | :--- | :--- |
|
|
401
|
-
| `--cwd <path>` | path | current directory | generate, validate, report, explain, init, skill | Repository to operate on. Must exist and be a directory. `diff` and `describe` take no `--cwd
|
|
402
|
-
| `--out-dir <path>` | path | `snapshot` | generate, validate, report, explain, init | Where the snapshot is written or read. May be absolute. |
|
|
403
|
-
| `--max-part-bytes <n>` | size | `307200` (300 KB) | generate, validate,
|
|
422
|
+
| `--cwd <path>` | path | current directory | generate, validate, report, explain, init, setup, skill, mcp | Repository to operate on. Must exist and be a directory. `diff` and `describe` take no `--cwd`; for `mcp` it chooses the one repository the server serves. |
|
|
423
|
+
| `--out-dir <path>` | path | `snapshot` | generate, validate, report, explain, init, setup | Where the snapshot is written or read. May be absolute. |
|
|
424
|
+
| `--max-part-bytes <n>` | size | `307200` (300 KB) | generate, validate, explain, init, setup | Hard ceiling per markdown part. Accepts `120k`, `1.5mb`. Minimum 4096. |
|
|
404
425
|
| `--max-part-tokens <n>` | size | unset | generate, validate, setup | A per-part ceiling in **tokens**, for a context window rather than a disk. Narrows `--max-part-bytes` to the equivalent byte count (`tokens × 4`); the smaller of the two ceilings always wins, and both are recorded in the manifest. Accepts `32k`. Minimum 1024 — below that it is a usage error, not a value quietly raised to the floor. |
|
|
405
|
-
| `--large-file-bytes <n>` | size | `204800` (200 KB) | generate, validate,
|
|
406
|
-
| `--max-monolith-bytes <n>` | size | unset | generate, validate,
|
|
407
|
-
| `--include-monolith` | flag | off | generate, validate,
|
|
408
|
-
| `--include-sensitive-files` | flag | off | generate, validate,
|
|
409
|
-
| `--skip-artifacts <names>` | list | unset | generate, validate,
|
|
410
|
-
| `--only-artifacts <names>` | list | unset | generate, validate,
|
|
411
|
-
| `--format <text\|json>` | enum | `text` | generate, validate, report, explain, init, setup, diff, describe, skill | `json` writes a pure JSON payload to stdout. Every command honours it
|
|
426
|
+
| `--large-file-bytes <n>` | size | `204800` (200 KB) | generate, validate, explain, setup | Above this, a file becomes a head/tail preview. |
|
|
427
|
+
| `--max-monolith-bytes <n>` | size | unset | generate, validate, explain, setup | Skip the single-file monolith when it would exceed this. |
|
|
428
|
+
| `--include-monolith` | flag | off | generate, validate, explain, setup | Also write `full-codebase.json` and `full-codebase.md`. |
|
|
429
|
+
| `--include-sensitive-files` | flag | off | generate, validate, explain, init, setup | Emit `.env`, `*.pem`, `.npmrc` and similar. Off by default; they are reported as skipped. |
|
|
430
|
+
| `--skip-artifacts <names>` | list | unset | generate, validate, explain, init, setup | Comma-separated artifacts to omit. |
|
|
431
|
+
| `--only-artifacts <names>` | list | unset | generate, validate, explain, init, setup | Write *only* these, and **turn on** any this names: a config with `artifacts: { audit: false }` still gets `reports/audit.md` from `--only-artifacts audit`, because "only these" is a statement about the whole selection rather than a suppression list. Cannot be combined with `--skip-artifacts`. |
|
|
432
|
+
| `--format <text\|json>` | enum | `text` | generate, validate, report, explain, init, setup, diff, describe, skill | `json` writes a pure JSON payload to stdout. Every command except `mcp` honours it — stdout there is the JSON-RPC protocol stream — and `describe` reports the same nine-command list. |
|
|
412
433
|
| `--sarif` | flag | off | generate, validate, setup | Also write `reports/audit.sarif`: the redaction findings as SARIF 2.1.0, for upload to GitHub Code Scanning. The artefact carries the path, the line and the rule — never the value. Works with `--skip-artifacts audit`, because a CI gate does not read markdown. Rule ids are fixed per rule name, so adding a custom rule never re-points an existing alert. |
|
|
413
|
-
| `--skeleton` | flag | off | generate, validate, setup | Emit
|
|
434
|
+
| `--skeleton` | flag | off | generate, validate, setup | Emit signatures instead of bodies: each function or method body becomes `{ /* ... */ }` in place, so formatting and comments around it are untouched. Covers `.ts`, `.tsx`, `.mts`, `.cts`, `.js`, `.jsx`, `.mjs` and `.cjs`; `.d.ts` files are left alone because they are already declarations. The summary still describes the whole file, and affected entries carry `inclusionMode: "signatures"`. `--include-monolith` still writes the whole body, so the monolith's `inclusionMode: "full"` stays true. |
|
|
414
435
|
| `--changed-since <ref>` | git ref | unset | generate, validate, explain | Include only files changed since this ref, plus untracked ones. Every other file is recorded in `manifest.skipped[]` with reason `unchanged` and is never opened. `validate` re-resolves the scope: a skipped file that has changed since is reported as drift, and one that has not is left alone — and with `--with-dependents`, so is a file that now imports one that changed. `explain` answers with the same rule. A ref beginning with `-` is refused. |
|
|
415
436
|
| `--staged` | flag | off | generate, validate, explain | Include only files staged for the next commit. |
|
|
416
437
|
| `--with-dependents` | flag | off | generate, validate, explain | With either of the two above, also include the files that import a changed one — a one-hop closure, not a transitive walk. Needs a scope; alone it is a usage error. |
|
|
417
438
|
| `--install-hook` | flag | off | init, setup | Write `.git/hooks/pre-commit` so a commit is refused while the snapshot is out of date. The hook checks the `outDir` the config names, so it works for a project that does not use `snapshot/`. An existing hook is never replaced; the note says what to add to it instead. |
|
|
418
439
|
| `--dry-run` | flag | off | generate, init, setup | Compute everything, print it, write nothing. |
|
|
419
|
-
| `--watch` | flag | off | generate | Regenerate on every change until interrupted. |
|
|
440
|
+
| `--watch` | flag | off | generate | Regenerate on every change until interrupted. Redaction and parsing are cached per file across runs in the same process, keyed on the content hash, so a one-file edit regenerates from that one file instead of from the whole repository. The cache is memory only and is dropped when the process exits. |
|
|
420
441
|
| `--autopilot` | flag | off | generate | Set the project up without asking — config, `.gitignore`, npm scripts, devDependency, install — then generate. Never overwrites an existing config; refuses an empty directory (exit `1`); contradicts `--no-config` (exit `2`). |
|
|
421
442
|
| `--no-install` | flag | off | setup, generate `--autopilot` | Skip the dependency install. Anywhere else it is a usage error, because it would change nothing. |
|
|
422
443
|
| `--no-config` | flag | off | generate, validate, report, explain, diff | Ignore every `snapshot.config.*` file and run on the built-in defaults. `diff` never loads a config anyway and accepts the flag for consistency. |
|
|
423
|
-
| `--discovery <mode>` | enum | `auto` | generate, validate, explain | How files are found: `auto` lists through git when git works and refuses when a `.git` directory cannot be listed; `git` requires git; `walk` scans the tree and reads `.gitignore` files directly. The escape hatch for a broken `.git`. |
|
|
424
|
-
| `--preset <name>` | name | detected |
|
|
425
|
-
| `--include <globs>` | list | unset |
|
|
426
|
-
| `--exclude <globs>` | list | unset |
|
|
427
|
-
| `--yes` | flag | off |
|
|
428
|
-
| `--force` | flag | off |
|
|
444
|
+
| `--discovery <mode>` | enum | `auto` | generate, validate, explain, setup | How files are found: `auto` lists through git when git works and refuses when a `.git` directory cannot be listed; `git` requires git; `walk` scans the tree and reads `.gitignore` files directly. The escape hatch for a broken `.git`. |
|
|
445
|
+
| `--preset <name>` | name | detected | init, setup | Force a preset instead of detecting one. |
|
|
446
|
+
| `--include <globs>` | list | unset | init, setup | Allow-list recorded in the generated config. |
|
|
447
|
+
| `--exclude <globs>` | list | unset | init, setup | Exclude globs recorded in the generated config. |
|
|
448
|
+
| `--yes` | flag | off | init, setup | Never prompt; accept every default. |
|
|
449
|
+
| `--force` | flag | off | init, setup | Replace an existing `.ts`/`.js`/`.mjs` config in place. A JSON-family config is refused, naming the file to remove. |
|
|
429
450
|
| `--install` | flag | off | *skill only* | Write the skill into the repository instead of printing it. |
|
|
430
451
|
| `--target <name>` | enum | `all` | *skill only* | `claude`, `cursor` or `all`. |
|
|
431
452
|
| `-h`, `--help` | flag | — | every command | Print usage. |
|
|
432
453
|
| `-v`, `--version` | flag | — | every command | Print the version on stdout: a bare `v`-prefixed semver (for example `v1.2.3`), with no package name. |
|
|
433
454
|
|
|
434
|
-
The artifact and size options apply to `validate
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
config mismatch.
|
|
455
|
+
The artifact and size options apply to `validate` and `explain` as well as `generate` because
|
|
456
|
+
those commands re-derive the configuration: pass the selection you generated with and the
|
|
457
|
+
comparison is like for like. `validate --skip-artifacts parts` on a snapshot built without parts
|
|
458
|
+
therefore agrees, while the same flag on a full snapshot reports a config mismatch.
|
|
439
459
|
|
|
440
460
|
The same rule applies to the compression and scope options. `--skeleton`, `--sarif` and
|
|
441
461
|
`--max-part-tokens` are recorded in `manifest.config.digest`, so `validate` accepts them too —
|
|
@@ -444,9 +464,11 @@ the flag to `validate` was rejected as a flag that "does not apply to validate".
|
|
|
444
464
|
`--staged` and `--with-dependents` are accepted by `validate` and `explain` because they decide
|
|
445
465
|
which recorded `unchanged` skips are re-checked and what `explain` answers about one file.
|
|
446
466
|
|
|
447
|
-
`report`
|
|
448
|
-
generation setting would change nothing
|
|
449
|
-
|
|
467
|
+
`report` takes none of the generation settings: it reads the manifest and prints what is there,
|
|
468
|
+
so a generation setting would change nothing — which is why it no longer accepts them as silent
|
|
469
|
+
no-ops. `report --max-part-bytes 120k` exits `2` with a message naming the commands that do
|
|
470
|
+
accept it. A flag that parses and does nothing is the silent fallback this table exists to
|
|
471
|
+
prevent.
|
|
450
472
|
|
|
451
473
|
Every option also accepts the `--option=value` form. That form is required for negative
|
|
452
474
|
numbers, which otherwise look like flags.
|
|
@@ -455,16 +477,21 @@ numbers, which otherwise look like flags.
|
|
|
455
477
|
|
|
456
478
|
`--mode <command>` names the command instead of passing it positionally, which is handy when
|
|
457
479
|
a wrapper builds the argument list. `--mode validate` and `codebase-snapshot validate` are the
|
|
458
|
-
same run.
|
|
459
|
-
|
|
480
|
+
same run. With `--mode`, the remaining positionals are that command's arguments, so
|
|
481
|
+
`--mode explain src/server.ts` and `--mode diff old-snapshot snapshot` work the same way the
|
|
482
|
+
positional form does.
|
|
483
|
+
|
|
484
|
+
It accepts the ten commands plus the `check` alias — the eleven names the error lists — and it is
|
|
485
|
+
deliberately strict: asking for two different commands is an error rather than a silent winner.
|
|
460
486
|
|
|
461
487
|
```
|
|
462
488
|
❌ --mode validate contradicts the command "generate". Pass one or the other.
|
|
463
|
-
❌ Unknown --mode "bogus". Expected one of: generate, validate, check, report, init, explain, diff, describe, skill.
|
|
489
|
+
❌ Unknown --mode "bogus". Expected one of: generate, validate, check, report, init, setup, explain, diff, describe, skill, mcp.
|
|
464
490
|
```
|
|
465
491
|
|
|
466
|
-
|
|
467
|
-
|
|
492
|
+
`describe` does list `--mode` in its option table (`appliesTo` names the ten canonical commands),
|
|
493
|
+
but `--help` does not: the positional form is the documented one for people, and the flag exists
|
|
494
|
+
for wrappers and for the contract.
|
|
468
495
|
|
|
469
496
|
## Exit codes
|
|
470
497
|
|
|
@@ -483,11 +510,12 @@ wrong and retrying it unchanged will fail the same way.
|
|
|
483
510
|
- **stdout** carries the payload. With `--format json` it is pure JSON, safe to pipe into
|
|
484
511
|
`jq` or `JSON.parse`.
|
|
485
512
|
- **stderr** carries progress, the human summary, warnings and errors.
|
|
486
|
-
- **In text mode the human result is on stderr, and stdout is empty
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
513
|
+
- **In text mode the human result is on stderr, and stdout is empty** — for every command
|
|
514
|
+
except `skill`. `report`, `explain`, `diff`, `validate`, `describe`, `setup` and
|
|
515
|
+
`generate` print their answer and progress to stderr, so redirecting `command > file.txt`
|
|
516
|
+
writes an empty file in text mode; use `--format json` when you want the output on stdout.
|
|
517
|
+
`skill` without `--install` prints the skill to stdout so it can be redirected, and the
|
|
518
|
+
`--help` / `--version` print paths do the same. `mcp` uses stdout for the JSON-RPC protocol.
|
|
491
519
|
|
|
492
520
|
A failing invocation still writes one JSON document to stdout, so an agent never has to parse an
|
|
493
521
|
empty string:
|