codebase-snapshot 0.12.14 → 0.13.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +950 -3
  2. package/README.md +15 -3
  3. package/SECURITY.md +2 -2
  4. package/dist/bin.js +9848 -5460
  5. package/dist/{chunk-UQHIG2KN.js → chunk-BOJYZQFB.js} +7651 -747
  6. package/dist/chunk-NESEHOPU.js +266 -0
  7. package/dist/cli.cjs +9954 -5619
  8. package/dist/cli.d.cts +120 -2
  9. package/dist/cli.d.ts +120 -2
  10. package/dist/cli.js +422 -8
  11. package/dist/{generate-worker-BK4uJx7Z.d.cts → generate-worker-B79yGkQO.d.cts} +16 -0
  12. package/dist/{generate-worker-BK4uJx7Z.d.ts → generate-worker-B79yGkQO.d.ts} +16 -0
  13. package/dist/index.cjs +7389 -680
  14. package/dist/index.d.cts +145 -6
  15. package/dist/index.d.ts +145 -6
  16. package/dist/index.js +1 -1
  17. package/dist/mcp.cjs +3830 -1057
  18. package/dist/mcp.d.cts +86 -4
  19. package/dist/mcp.d.ts +86 -4
  20. package/dist/mcp.js +2 -2
  21. package/dist/{types-c0tLF2WC.d.cts → types-CbD8yQRZ.d.cts} +145 -1
  22. package/dist/{types-c0tLF2WC.d.ts → types-CbD8yQRZ.d.ts} +145 -1
  23. package/docs/agent.md +1 -1
  24. package/docs/benchmarks.md +80 -0
  25. package/docs/budget.md +59 -0
  26. package/docs/cli.md +56 -4
  27. package/docs/configuration.md +27 -0
  28. package/docs/delta.md +50 -0
  29. package/docs/deploy.md +75 -0
  30. package/docs/health.md +75 -0
  31. package/docs/mcp.md +112 -10
  32. package/docs/migration.md +68 -0
  33. package/docs/output.md +9 -3
  34. package/docs/remote.md +60 -0
  35. package/docs/security-review.md +117 -0
  36. package/docs/serve.md +66 -0
  37. package/docs/signing.md +61 -0
  38. package/docs/slice.md +57 -0
  39. package/docs/tools.md +161 -0
  40. package/docs/troubleshooting.md +63 -0
  41. package/docs/vs-repomix.md +1 -1
  42. package/docs/workspace.md +93 -0
  43. package/package.json +1 -1
  44. package/dist/chunk-6EGIFYWK.js +0 -3248
package/dist/mcp.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { G as GenerateSummary, W as WorkerResults, g as generateInWorker } from './generate-worker-BK4uJx7Z.cjs';
1
+ export { G as GenerateSummary, W as WorkerResults, g as generateInWorker } from './generate-worker-B79yGkQO.cjs';
2
2
  import { Readable, Writable } from 'node:stream';
3
3
 
4
4
  /**
@@ -142,12 +142,31 @@ interface ToolContext {
142
142
  roots: string[];
143
143
  /** Writes one line to stderr. Never stdout, which carries protocol messages only. */
144
144
  log: (line: string) => void;
145
+ /**
146
+ * Emits a progress notification for the current call.
147
+ *
148
+ * Present only when the client supplied a `progressToken` in `_meta` and the transport can carry
149
+ * a notification mid-call (stdio). A tool that never calls it is still correct; a tool that does
150
+ * gives a long run a heartbeat instead of a silent pause.
151
+ */
152
+ notify?: (event: {
153
+ message: string;
154
+ progress?: number;
155
+ total?: number;
156
+ }) => void;
157
+ /**
158
+ * Registers a callback the server runs when the client cancels this call.
159
+ *
160
+ * A tool that can stop early (a generate terminates its worker) calls this once with the function
161
+ * that stops it. A tool that cannot stops nothing, and the server simply runs it to completion.
162
+ */
163
+ onCancel?: (cancel: () => void) => void;
145
164
  }
146
165
  /**
147
166
  * Client-facing hints.
148
167
  *
149
168
  * `readOnlyHint` is the one that changes behaviour rather than appearance: clients use it to
150
- * auto-approve a call. Seven of the eight tools never touch the filesystem, so they are marked
169
+ * auto-approve a call. Seven of the 24 tools never touch the filesystem, so they are marked
151
170
  * read-only and only `snapshot_generate` prompts.
152
171
  */
153
172
  interface ToolAnnotations {
@@ -165,6 +184,14 @@ interface ToolOutcome {
165
184
  /** True for a tool-level failure. Reported inside the result, not as a JSON-RPC error. */
166
185
  isError?: boolean;
167
186
  }
187
+ /**
188
+ * How expensive a tool call is, in the units an agent can act on.
189
+ *
190
+ * `cheap` reads the manifest; `medium` reads one or a few parts; `expensive` reads the repository,
191
+ * partitions it, or writes. The class is a hint for choosing between two tools that answer the
192
+ * same question, and it is stated as a class because a token count depends on the repository.
193
+ */
194
+ type ToolCost = "cheap" | "medium" | "expensive";
168
195
  interface McpTool {
169
196
  name: string;
170
197
  title: string;
@@ -172,6 +199,8 @@ interface McpTool {
172
199
  inputSchema: InputSchema;
173
200
  outputSchema?: InputSchema;
174
201
  annotations: ToolAnnotations;
202
+ /** Relative cost of a call; see `ToolCost`. */
203
+ cost: ToolCost;
175
204
  handler(args: JsonObject, context: ToolContext): Promise<ToolOutcome>;
176
205
  }
177
206
  /** One addressable resource, as `resources/list` reports it. */
@@ -311,6 +340,8 @@ interface McpServerOptions {
311
340
  resources: ResourceProvider;
312
341
  prompts: McpPrompt[];
313
342
  context: ToolContext;
343
+ /** Writes a JSON-RPC notification. Present on transports that can carry one mid-call. */
344
+ notify?: (message: JsonObject) => void;
314
345
  }
315
346
  interface McpServer {
316
347
  /** Handles one already-parsed message. Returns null when no response is due. */
@@ -320,9 +351,16 @@ interface McpServer {
320
351
  }
321
352
  declare function createMcpServer(options: McpServerOptions): McpServer;
322
353
 
323
- /** Every tool this server exposes, in the order a first-time caller should read them. */
324
354
  declare function buildTools(): McpTool[];
325
355
 
356
+ declare function isCommentStrippable(relativePath: string): boolean;
357
+ interface StripResult {
358
+ text: string;
359
+ /** Comment characters removed, before newline preservation. */
360
+ removed: number;
361
+ }
362
+ declare function stripComments(text: string, relativePath: string): StripResult;
363
+
326
364
  /**
327
365
  * Reads one file's section back out of a rendered part.
328
366
  *
@@ -397,6 +435,8 @@ declare function buildResourceProvider(): ResourceProvider;
397
435
  interface ServerOptions {
398
436
  /** Repository the tools operate on. Also the only directory they may read. */
399
437
  cwd: string;
438
+ /** Writes a JSON-RPC notification. The stdio loop supplies it; HTTP answers one request at a time. */
439
+ notify?: (message: JsonObject) => void;
400
440
  /** Additional directories callers may name as `root`. Defaults to `cwd` alone. */
401
441
  roots?: string[];
402
442
  /** Where operational notes go. Never stdout, which carries protocol messages only. */
@@ -414,6 +454,48 @@ declare function createServer(options: ServerOptions): McpServer;
414
454
  */
415
455
  declare function runStdioServer(options: ServerOptions): Promise<number>;
416
456
 
457
+ /**
458
+ * MCP over HTTP, for clients that are not a child process.
459
+ *
460
+ * The stdio transport is the default and stays the default: a client that can spawn a process
461
+ * gets the simplest, most reliable path. This exists for the clients that cannot — browser-based
462
+ * agents, hosted editors, anything living inside a page. It implements the Streamable HTTP shape:
463
+ * one POST endpoint that carries a JSON-RPC message and answers with a JSON-RPC response.
464
+ *
465
+ * Three properties are deliberate:
466
+ *
467
+ * - **Loopback unless told otherwise.** The server binds 127.0.0.1 by default. Making a
468
+ * repository readable from the network is a decision the user makes with --host, not a default.
469
+ * - **A token, or an explicit opt-out.** A page in a browser is a request with an Origin, and
470
+ * localhost ports are guessable. The token is generated on first use, printed once, and
471
+ * compared in constant time. --no-auth exists for the case where the client cannot send a
472
+ * header, and says what it gave up.
473
+ * - **No unbounded reads.** Request bodies are capped, rate is capped, and every response is one
474
+ * bounded JSON document. A browser tab that loops cannot pin the CPU.
475
+ */
476
+ interface HttpTransportOptions {
477
+ /** Repository the tools operate on. */
478
+ cwd: string;
479
+ host?: string;
480
+ port?: number;
481
+ /** Bearer token. `undefined` generates one, `null` disables auth. */
482
+ token?: string | null;
483
+ /** Extra origins, beyond loopback. */
484
+ allowedOrigins?: readonly string[];
485
+ maxBodyBytes?: number;
486
+ log?: (line: string) => void;
487
+ }
488
+ interface HttpTransport {
489
+ url: string;
490
+ port: number;
491
+ host: string;
492
+ token: string | null;
493
+ close(): Promise<void>;
494
+ }
495
+ /** The token a server generates when the caller did not pick one. */
496
+ declare function generateToken(): string;
497
+ declare function startHttpTransport(options: HttpTransportOptions): Promise<HttpTransport>;
498
+
417
499
  /**
418
500
  * The stdio transport: one JSON-RPC message per line, UTF-8, nothing else on the stream.
419
501
  *
@@ -502,4 +584,4 @@ declare function validateArguments(schema: InputSchema, value: unknown): string[
502
584
  */
503
585
  declare function coerceNumericStrings(schema: InputSchema, value: JsonObject): JsonObject;
504
586
 
505
- export { ERROR_CODES, type JsonRpcResponse, type JsonSchema, LEGACY_PROTOCOL_VERSIONS, type LineReaderOptions, MAX_LINE_BYTES, METHOD, MODERN_PROTOCOL_VERSIONS, type McpPrompt, type McpResourceContents, type McpResourceDescriptor, type McpResourceTemplate, type McpServer, type McpServerInfo, type McpServerOptions, type McpTool, type MessageWriter, type PartSection, type ProtocolEra, type ResourceProvider, SERVER_INSTRUCTIONS, SUPPORTED_PROTOCOL_VERSIONS, type ServerOptions, type SessionState, type ToolAnnotations, type ToolContext, type ToolOutcome, type Window, buildPrompts, buildResourceProvider, buildTools, classifyRequest, coerceNumericStrings, createLineReader, createMcpServer, createServer, createSession, createWriter, findSection, inspectModernMeta, negotiateLegacyVersion, parsePartSections, runStdioServer, validateArguments, windowText };
587
+ export { ERROR_CODES, type HttpTransport, type HttpTransportOptions, type JsonRpcResponse, type JsonSchema, LEGACY_PROTOCOL_VERSIONS, type LineReaderOptions, MAX_LINE_BYTES, METHOD, MODERN_PROTOCOL_VERSIONS, type McpPrompt, type McpResourceContents, type McpResourceDescriptor, type McpResourceTemplate, type McpServer, type McpServerInfo, type McpServerOptions, type McpTool, type MessageWriter, type PartSection, type ProtocolEra, type ResourceProvider, SERVER_INSTRUCTIONS, SUPPORTED_PROTOCOL_VERSIONS, type ServerOptions, type SessionState, type ToolAnnotations, type ToolContext, type ToolOutcome, type Window, buildPrompts, buildResourceProvider, buildTools, classifyRequest, coerceNumericStrings, createLineReader, createMcpServer, createServer, createSession, createWriter, findSection, generateToken, inspectModernMeta, isCommentStrippable, negotiateLegacyVersion, parsePartSections, runStdioServer, startHttpTransport, stripComments, validateArguments, windowText };
package/dist/mcp.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { G as GenerateSummary, W as WorkerResults, g as generateInWorker } from './generate-worker-BK4uJx7Z.js';
1
+ export { G as GenerateSummary, W as WorkerResults, g as generateInWorker } from './generate-worker-B79yGkQO.js';
2
2
  import { Readable, Writable } from 'node:stream';
3
3
 
4
4
  /**
@@ -142,12 +142,31 @@ interface ToolContext {
142
142
  roots: string[];
143
143
  /** Writes one line to stderr. Never stdout, which carries protocol messages only. */
144
144
  log: (line: string) => void;
145
+ /**
146
+ * Emits a progress notification for the current call.
147
+ *
148
+ * Present only when the client supplied a `progressToken` in `_meta` and the transport can carry
149
+ * a notification mid-call (stdio). A tool that never calls it is still correct; a tool that does
150
+ * gives a long run a heartbeat instead of a silent pause.
151
+ */
152
+ notify?: (event: {
153
+ message: string;
154
+ progress?: number;
155
+ total?: number;
156
+ }) => void;
157
+ /**
158
+ * Registers a callback the server runs when the client cancels this call.
159
+ *
160
+ * A tool that can stop early (a generate terminates its worker) calls this once with the function
161
+ * that stops it. A tool that cannot stops nothing, and the server simply runs it to completion.
162
+ */
163
+ onCancel?: (cancel: () => void) => void;
145
164
  }
146
165
  /**
147
166
  * Client-facing hints.
148
167
  *
149
168
  * `readOnlyHint` is the one that changes behaviour rather than appearance: clients use it to
150
- * auto-approve a call. Seven of the eight tools never touch the filesystem, so they are marked
169
+ * auto-approve a call. Seven of the 24 tools never touch the filesystem, so they are marked
151
170
  * read-only and only `snapshot_generate` prompts.
152
171
  */
153
172
  interface ToolAnnotations {
@@ -165,6 +184,14 @@ interface ToolOutcome {
165
184
  /** True for a tool-level failure. Reported inside the result, not as a JSON-RPC error. */
166
185
  isError?: boolean;
167
186
  }
187
+ /**
188
+ * How expensive a tool call is, in the units an agent can act on.
189
+ *
190
+ * `cheap` reads the manifest; `medium` reads one or a few parts; `expensive` reads the repository,
191
+ * partitions it, or writes. The class is a hint for choosing between two tools that answer the
192
+ * same question, and it is stated as a class because a token count depends on the repository.
193
+ */
194
+ type ToolCost = "cheap" | "medium" | "expensive";
168
195
  interface McpTool {
169
196
  name: string;
170
197
  title: string;
@@ -172,6 +199,8 @@ interface McpTool {
172
199
  inputSchema: InputSchema;
173
200
  outputSchema?: InputSchema;
174
201
  annotations: ToolAnnotations;
202
+ /** Relative cost of a call; see `ToolCost`. */
203
+ cost: ToolCost;
175
204
  handler(args: JsonObject, context: ToolContext): Promise<ToolOutcome>;
176
205
  }
177
206
  /** One addressable resource, as `resources/list` reports it. */
@@ -311,6 +340,8 @@ interface McpServerOptions {
311
340
  resources: ResourceProvider;
312
341
  prompts: McpPrompt[];
313
342
  context: ToolContext;
343
+ /** Writes a JSON-RPC notification. Present on transports that can carry one mid-call. */
344
+ notify?: (message: JsonObject) => void;
314
345
  }
315
346
  interface McpServer {
316
347
  /** Handles one already-parsed message. Returns null when no response is due. */
@@ -320,9 +351,16 @@ interface McpServer {
320
351
  }
321
352
  declare function createMcpServer(options: McpServerOptions): McpServer;
322
353
 
323
- /** Every tool this server exposes, in the order a first-time caller should read them. */
324
354
  declare function buildTools(): McpTool[];
325
355
 
356
+ declare function isCommentStrippable(relativePath: string): boolean;
357
+ interface StripResult {
358
+ text: string;
359
+ /** Comment characters removed, before newline preservation. */
360
+ removed: number;
361
+ }
362
+ declare function stripComments(text: string, relativePath: string): StripResult;
363
+
326
364
  /**
327
365
  * Reads one file's section back out of a rendered part.
328
366
  *
@@ -397,6 +435,8 @@ declare function buildResourceProvider(): ResourceProvider;
397
435
  interface ServerOptions {
398
436
  /** Repository the tools operate on. Also the only directory they may read. */
399
437
  cwd: string;
438
+ /** Writes a JSON-RPC notification. The stdio loop supplies it; HTTP answers one request at a time. */
439
+ notify?: (message: JsonObject) => void;
400
440
  /** Additional directories callers may name as `root`. Defaults to `cwd` alone. */
401
441
  roots?: string[];
402
442
  /** Where operational notes go. Never stdout, which carries protocol messages only. */
@@ -414,6 +454,48 @@ declare function createServer(options: ServerOptions): McpServer;
414
454
  */
415
455
  declare function runStdioServer(options: ServerOptions): Promise<number>;
416
456
 
457
+ /**
458
+ * MCP over HTTP, for clients that are not a child process.
459
+ *
460
+ * The stdio transport is the default and stays the default: a client that can spawn a process
461
+ * gets the simplest, most reliable path. This exists for the clients that cannot — browser-based
462
+ * agents, hosted editors, anything living inside a page. It implements the Streamable HTTP shape:
463
+ * one POST endpoint that carries a JSON-RPC message and answers with a JSON-RPC response.
464
+ *
465
+ * Three properties are deliberate:
466
+ *
467
+ * - **Loopback unless told otherwise.** The server binds 127.0.0.1 by default. Making a
468
+ * repository readable from the network is a decision the user makes with --host, not a default.
469
+ * - **A token, or an explicit opt-out.** A page in a browser is a request with an Origin, and
470
+ * localhost ports are guessable. The token is generated on first use, printed once, and
471
+ * compared in constant time. --no-auth exists for the case where the client cannot send a
472
+ * header, and says what it gave up.
473
+ * - **No unbounded reads.** Request bodies are capped, rate is capped, and every response is one
474
+ * bounded JSON document. A browser tab that loops cannot pin the CPU.
475
+ */
476
+ interface HttpTransportOptions {
477
+ /** Repository the tools operate on. */
478
+ cwd: string;
479
+ host?: string;
480
+ port?: number;
481
+ /** Bearer token. `undefined` generates one, `null` disables auth. */
482
+ token?: string | null;
483
+ /** Extra origins, beyond loopback. */
484
+ allowedOrigins?: readonly string[];
485
+ maxBodyBytes?: number;
486
+ log?: (line: string) => void;
487
+ }
488
+ interface HttpTransport {
489
+ url: string;
490
+ port: number;
491
+ host: string;
492
+ token: string | null;
493
+ close(): Promise<void>;
494
+ }
495
+ /** The token a server generates when the caller did not pick one. */
496
+ declare function generateToken(): string;
497
+ declare function startHttpTransport(options: HttpTransportOptions): Promise<HttpTransport>;
498
+
417
499
  /**
418
500
  * The stdio transport: one JSON-RPC message per line, UTF-8, nothing else on the stream.
419
501
  *
@@ -502,4 +584,4 @@ declare function validateArguments(schema: InputSchema, value: unknown): string[
502
584
  */
503
585
  declare function coerceNumericStrings(schema: InputSchema, value: JsonObject): JsonObject;
504
586
 
505
- export { ERROR_CODES, type JsonRpcResponse, type JsonSchema, LEGACY_PROTOCOL_VERSIONS, type LineReaderOptions, MAX_LINE_BYTES, METHOD, MODERN_PROTOCOL_VERSIONS, type McpPrompt, type McpResourceContents, type McpResourceDescriptor, type McpResourceTemplate, type McpServer, type McpServerInfo, type McpServerOptions, type McpTool, type MessageWriter, type PartSection, type ProtocolEra, type ResourceProvider, SERVER_INSTRUCTIONS, SUPPORTED_PROTOCOL_VERSIONS, type ServerOptions, type SessionState, type ToolAnnotations, type ToolContext, type ToolOutcome, type Window, buildPrompts, buildResourceProvider, buildTools, classifyRequest, coerceNumericStrings, createLineReader, createMcpServer, createServer, createSession, createWriter, findSection, inspectModernMeta, negotiateLegacyVersion, parsePartSections, runStdioServer, validateArguments, windowText };
587
+ export { ERROR_CODES, type HttpTransport, type HttpTransportOptions, type JsonRpcResponse, type JsonSchema, LEGACY_PROTOCOL_VERSIONS, type LineReaderOptions, MAX_LINE_BYTES, METHOD, MODERN_PROTOCOL_VERSIONS, type McpPrompt, type McpResourceContents, type McpResourceDescriptor, type McpResourceTemplate, type McpServer, type McpServerInfo, type McpServerOptions, type McpTool, type MessageWriter, type PartSection, type ProtocolEra, type ResourceProvider, SERVER_INSTRUCTIONS, SUPPORTED_PROTOCOL_VERSIONS, type ServerOptions, type SessionState, type ToolAnnotations, type ToolContext, type ToolOutcome, type Window, buildPrompts, buildResourceProvider, buildTools, classifyRequest, coerceNumericStrings, createLineReader, createMcpServer, createServer, createSession, createWriter, findSection, generateToken, inspectModernMeta, isCommentStrippable, negotiateLegacyVersion, parsePartSections, runStdioServer, startHttpTransport, stripComments, validateArguments, windowText };
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-6EGIFYWK.js';
2
- export { generateInWorker } from './chunk-UQHIG2KN.js';
1
+ export { generateToken, startHttpTransport } from './chunk-NESEHOPU.js';
2
+ 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, generateInWorker, inspectModernMeta, isCommentStrippable, negotiateLegacyVersion, parsePartSections, runStdioServer, stripComments, validateArguments, windowText } from './chunk-BOJYZQFB.js';
@@ -20,8 +20,10 @@ type TextEncoding = "utf-8" | "utf-8-lossy" | "utf-16le" | "utf-16be";
20
20
  * How much of a file made it into the snapshot.
21
21
  * `full` – the complete file body was emitted.
22
22
  * `preview` – the body was truncated (by lines and/or bytes) before emission.
23
+ * `signatures` – function and method bodies were collapsed to an empty block.
24
+ * `comments-stripped` – comment text was removed (line numbers preserved) before emission.
23
25
  */
24
- type InclusionMode = "full" | "preview" | "signatures";
26
+ type InclusionMode = "full" | "preview" | "signatures" | "comments-stripped";
25
27
  interface SourceSummary {
26
28
  directives: string[];
27
29
  imports: string[];
@@ -115,6 +117,13 @@ type SkipReason = "binary" | "read-error" | "not-file"
115
117
  * `excluded` would send a reader looking for an exclude pattern they never wrote.
116
118
  */
117
119
  | "unchanged"
120
+ /**
121
+ * Scanned, but the `--slice` planner did not choose it for the question.
122
+ *
123
+ * Different from `unchanged`: the file may have changed and may still matter; it simply is not
124
+ * part of the budgeted answer to the question this snapshot was asked to serve.
125
+ */
126
+ | "not-selected"
118
127
  /**
119
128
  * Staged for deletion: the path is in the next commit's parent, not in the next commit.
120
129
  *
@@ -163,6 +172,14 @@ interface FileEntry {
163
172
  * would be the same silence this field exists to end.
164
173
  */
165
174
  omittedRanges?: Array<[number, number]>;
175
+ /**
176
+ * Blank lines were dropped from this body, so its line numbers do not match the source.
177
+ *
178
+ * Only `--remove-empty-lines` sets it. It is a separate field rather than an `inclusionMode`
179
+ * because the two describe different things: the mode says how the body was produced (full,
180
+ * preview, signatures) and this says the numbering moved.
181
+ */
182
+ emptyLinesRemoved?: true;
166
183
  /** Line count of the file on disk. */
167
184
  originalLines: number;
168
185
  /** Lines actually emitted into the snapshot. */
@@ -374,6 +391,8 @@ interface ManifestConfigSnapshot {
374
391
  */
375
392
  maxMonolithBytes?: number | null;
376
393
  includeSensitiveFiles: boolean;
394
+ /** Whether comment text was stripped from JS/TS bodies in this run. */
395
+ stripComments?: boolean;
377
396
  /**
378
397
  * The file-slot ceiling `PROMPT.md` was planned for; `0` for no limit.
379
398
  *
@@ -454,6 +473,21 @@ interface Manifest {
454
473
  commit: string;
455
474
  isDirty: boolean;
456
475
  };
476
+ /**
477
+ * Where the described tree came from, when it was fetched rather than found on disk.
478
+ *
479
+ * Absent for a local run. Present for `--remote`, with the commit that was actually cloned so
480
+ * a reader can trace the snapshot back to a revision rather than to a URL that may have moved.
481
+ */
482
+ source?: {
483
+ url: string;
484
+ host: string;
485
+ owner: string;
486
+ repo: string;
487
+ ref: string | null;
488
+ commit: string;
489
+ fetchedAt: string;
490
+ };
457
491
  budgets: {
458
492
  maxPartBytes: number;
459
493
  largeFileBytes: number;
@@ -489,8 +523,16 @@ interface Manifest {
489
523
  navigation?: ManifestArtifact;
490
524
  projectTree?: ManifestArtifact;
491
525
  audit?: ManifestArtifact;
526
+ /** `reports/diff.md`, when `diff` was requested and the repository had changes. */
527
+ diff?: ManifestArtifact;
528
+ /** `reports/log.md`, when `log` was requested and the repository had commits. */
529
+ log?: ManifestArtifact;
530
+ /** `reports/tokens.md`, when `tokenTree` was requested. */
531
+ tokenTree?: ManifestArtifact;
492
532
  fullJson: ManifestArtifact | null;
493
533
  fullMarkdown: ManifestArtifact | null;
534
+ /** `full-codebase.xml`, when `--pack xml` asked for it. */
535
+ fullXml?: ManifestArtifact | null;
494
536
  /**
495
537
  * `reports/audit.sarif`, when `--sarif` asked for it.
496
538
  *
@@ -500,6 +542,68 @@ interface Manifest {
500
542
  */
501
543
  sarif?: ManifestArtifact;
502
544
  };
545
+ /**
546
+ * What this snapshot contains relative to a base snapshot (`--delta`).
547
+ *
548
+ * Present only when a base was given. `files[]` then contains the changed and added files and
549
+ * their one-hop dependents; every unchanged file is accounted in `delta.unchanged` and in
550
+ * `skipped[]` with reason "unchanged", so nothing disappears without a record.
551
+ */
552
+ /**
553
+ * A task-scoped slice (`--slice`): which question the snapshot was narrowed for.
554
+ *
555
+ * `files[]` then contains the planner selection; every other scanned path is in `skipped[]`
556
+ * with reason "slice-dropped", so the accounting contract still holds.
557
+ */
558
+ /**
559
+ * A token-budget selection (`--budget-tokens`): the plan that fit the repository into a budget.
560
+ *
561
+ * `files[]` holds the selection; the rest are in `skipped[]` with reason "not-selected".
562
+ */
563
+ budget?: {
564
+ maxTokens: number;
565
+ usedTokens: number;
566
+ /** What survived, by layer and by symbol, so a reader can judge the cut. */
567
+ coverage?: {
568
+ byLayer: Record<string, {
569
+ kept: number;
570
+ total: number;
571
+ }>;
572
+ entryPoints: {
573
+ kept: number;
574
+ total: number;
575
+ };
576
+ symbols: {
577
+ kept: number;
578
+ total: number;
579
+ };
580
+ };
581
+ /** Paths chosen, in the order they were selected. */
582
+ files: string[];
583
+ /** Scanned paths that did not fit. */
584
+ dropped: number;
585
+ };
586
+ slice?: {
587
+ question: string;
588
+ budgetTokens: number;
589
+ usedTokens: number;
590
+ /** The paths the planner chose, in reading order. */
591
+ files: string[];
592
+ /** Scanned paths the planner did not choose. */
593
+ dropped: number;
594
+ };
595
+ delta?: {
596
+ base: {
597
+ path: string;
598
+ fingerprint: string;
599
+ generatedAt: string;
600
+ };
601
+ added: string[];
602
+ changed: string[];
603
+ removed: string[];
604
+ /** Paths present in both snapshots with the same hash; omitted from parts, listed here. */
605
+ unchanged: string[];
606
+ };
503
607
  layers: Record<string, number>;
504
608
  kinds: Record<string, number>;
505
609
  indexes: ManifestIndexes;
@@ -570,6 +674,12 @@ interface ArtifactSelection {
570
674
  projectTree?: boolean;
571
675
  /** `reports/audit.md` — security, layer, kind and skip findings. */
572
676
  audit?: boolean;
677
+ /** `reports/diff.md` — the uncommitted diff, when the repository has one. */
678
+ diff?: boolean;
679
+ /** `reports/log.md` — recent commits. */
680
+ log?: boolean;
681
+ /** `reports/tokens.md` — per-file token estimates. */
682
+ tokenTree?: boolean;
573
683
  /** `full-codebase.{json,md}` — one file per format, the whole payload again. */
574
684
  monolith?: boolean;
575
685
  }
@@ -678,6 +788,23 @@ interface SnapshotConfig {
678
788
  skeleton?: boolean;
679
789
  /** Also write `reports/audit.sarif` so a CI security gate can read the findings. */
680
790
  sarif?: boolean;
791
+ /** How many commits `reports/log.md` carries when it is enabled (default 20). */
792
+ logCount?: number;
793
+ /** Remove comment text from JavaScript/TypeScript bodies (line numbers preserved). */
794
+ stripComments?: boolean;
795
+ /**
796
+ * Drop blank and whitespace-only lines from emitted bodies.
797
+ *
798
+ * Unlike `stripComments`, this moves line numbers: the body no longer lines up with the source.
799
+ * Each affected file records `emptyLinesRemoved: true`, and the brief says so.
800
+ */
801
+ removeEmptyLines?: boolean;
802
+ /**
803
+ * Which single-file pack to write: `single` (markdown), `xml` or `json`.
804
+ *
805
+ * Unset keeps the historical `--include-monolith` behaviour: markdown and JSON together.
806
+ */
807
+ pack?: "single" | "xml" | "json";
681
808
  /**
682
809
  * With `changedSince` or `staged`, also include the files that import a changed one.
683
810
  *
@@ -745,6 +872,13 @@ interface ResolvedSnapshotConfig {
745
872
  * ingest is a finding nobody's build can act on.
746
873
  */
747
874
  sarif?: boolean;
875
+ /** How many commits `reports/log.md` carries when it is enabled. */
876
+ logCount: number;
877
+ /** Comment stripping for JS/TS bodies. */
878
+ stripComments: boolean;
879
+ removeEmptyLines: boolean;
880
+ /** The chosen single-file pack, or null for the historical pair. */
881
+ pack: "single" | "xml" | "json" | null;
748
882
  /** Also include the files that import a changed one. */
749
883
  withDependents?: boolean;
750
884
  /** Empty means "no allow-list"; every discovered file is a candidate. */
@@ -779,6 +913,16 @@ interface CliOptions {
779
913
  brief?: string;
780
914
  /** `--prompt-task`: which job the brief is written for. */
781
915
  promptTask?: PromptTask;
916
+ /** `--include-diffs`: write reports/diff.md from the uncommitted diff. */
917
+ includeDiffs?: boolean;
918
+ /** `--include-logs <n>`: write reports/log.md with the last n commits. */
919
+ includeLogs?: number;
920
+ /** `--token-tree`: write reports/tokens.md. */
921
+ tokenTree?: boolean;
922
+ /** `--strip-comments`: remove comment text from JS/TS bodies. */
923
+ stripComments?: boolean;
924
+ /** `--remove-empty-lines`: drop blank lines from emitted bodies. */
925
+ removeEmptyLines?: boolean;
782
926
  maxPartBytes?: number;
783
927
  maxPartTokens?: ByteSize | null;
784
928
  largeFileBytes?: number;