codebase-snapshot 0.10.0 → 0.10.2

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/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { S as SecretRule, D as DiscoveryMode, a as SkipRecord, J as JsonSummary, M as MarkdownSummary, b as SourceSummary, K as KindRule, L as LayerRule, R as ResolvedSnapshotConfig, c as SnapshotConfig, B as ByteSize, C as CliOptions, P as PartMetadata, F as FileEntry, T as TextEncoding, d as SecretFinding, V as ValidationResult, e as Manifest, A as ArtifactSelection } from './types-Z471HW65.cjs';
2
- export { f as BudgetConfig, H as HooksConfig, I as InclusionMode, g as IncompleteFile, h as ManifestArtifact, i as ManifestConfigSnapshot, j as ManifestIndexes, k as ManifestTotals, l as Mode, O as OutputFormat, m as PartFileEntry, n as ResolvedArtifacts, o as ResolvedBudgets, p as SecretRuleInput, q as SkipReason, r as SummaryQuality, s as TruncationReason, t as ValidationDrift } from './types-Z471HW65.cjs';
3
- export { w as workerEntry } from './generate-worker-D_mUjgXw.cjs';
1
+ import { S as SecretRule, D as DiscoveryMode, a as SkipRecord, J as JsonSummary, M as MarkdownSummary, b as SourceSummary, K as KindRule, L as LayerRule, R as ResolvedSnapshotConfig, c as SnapshotConfig, B as ByteSize, C as CliOptions, P as PartMetadata, F as FileEntry, T as TextEncoding, d as SecretFinding, V as ValidationResult, e as Manifest, A as ArtifactSelection } from './types-BoWneA7n.cjs';
2
+ export { f as BudgetConfig, H as HooksConfig, I as InclusionMode, g as IncompleteFile, h as ManifestArtifact, i as ManifestConfigSnapshot, j as ManifestIndexes, k as ManifestTotals, l as Mode, O as OutputFormat, m as PartFileEntry, n as ResolvedArtifacts, o as ResolvedBudgets, p as SecretRuleInput, q as SkipReason, r as SummaryQuality, s as TruncationReason, t as ValidationDrift } from './types-BoWneA7n.cjs';
3
+ export { w as workerEntry } from './generate-worker-BK4uJx7Z.cjs';
4
4
 
5
5
  interface GitInfo {
6
6
  branch: string;
@@ -185,16 +185,14 @@ interface ConfigLoadResult {
185
185
  }
186
186
  /** True when this Node can `import()` a `.ts` file natively (type stripping). */
187
187
  declare function supportsTypeScriptImports(): boolean;
188
+ declare const CONFIG_KEYS: ReadonlySet<string>;
188
189
  /**
189
- * Every key a configuration file may carry.
190
+ * Loads the first usable config file from `cwd`.
190
191
  *
191
- * This is `SnapshotConfig` plus the spellings that are read through casts: `discovery`
192
- * (validated separately), `exclude` (the flag spelling of `excludePatterns`) and
193
- * `secretRules` (the library spelling of a rule list, accepted by `resolveConfig` and
194
- * therefore needed here too — omitting it made a config file that used it fail with
195
- * "unknown setting(s): secretRules" while the same key worked when passed in code).
192
+ * Every failure is reported through `warnings` instead of being swallowed by an
193
+ * empty `catch`: a syntax error in a user's config used to be indistinguishable
194
+ * from having no config at all.
196
195
  */
197
- declare const CONFIG_KEYS: ReadonlySet<string>;
198
196
  declare function loadConfigFileDetailed(cwd: string, options?: {
199
197
  allowExecutableConfig?: boolean;
200
198
  }): Promise<ConfigLoadResult>;
@@ -261,6 +259,17 @@ declare function configDigest(config: ResolvedSnapshotConfig): string;
261
259
  declare function defineConfig(config: SnapshotConfig): SnapshotConfig;
262
260
 
263
261
  declare function generateProjectTree(filePaths: string[]): string;
262
+ /**
263
+ * A manifest warning for each cap the rendered tree reports.
264
+ *
265
+ * The tree carries its own marker, but a reader of the manifest learns nothing from an artifact
266
+ * they did not open — so the truncation is also a warning. Only the depth form was matched: a tree
267
+ * cut at the 20 000-line cap said so in the artifact and nothing in the manifest, and the two views
268
+ * of one fact disagreed.
269
+ *
270
+ * Exported so the mapping is testable without building a 20 000-file repository.
271
+ */
272
+ declare function treeTruncationWarnings(treeText: string): string[];
264
273
 
265
274
  interface PartitionedPart {
266
275
  filename: string;
@@ -293,15 +302,14 @@ declare function enforceBudget(parts: PartitionedPart[], budget: number): Partit
293
302
  */
294
303
  declare function renumberParts(parts: PartitionedPart[], contentFingerprint?: string): PartitionedPart[];
295
304
  /**
305
+ * The form of a path that is written into a part.
306
+ *
296
307
  * Paths reach the `## Files` list, the `### FILE:` heading and the navigation
297
308
  * index, so a control character in a name is rendered as `\uXXXX` instead of
298
309
  * being emitted raw: a bidi override visually reorders the line, a C1 CSI drives
299
310
  * the terminal, and a newline would break the line-oriented layout. Escaping
300
311
  * also keeps the `## Files` fence safe (see {@link fenceForText}). Paths are
301
312
  * legal UTF-8, so this is reachable with an ordinary `git mv`.
302
- */
303
- /**
304
- * The form of a path that is written into a part.
305
313
  *
306
314
  * Exported because the reader has to compare against it: a section heading holds this
307
315
  * form, not the manifest's `relativePath`, and the two differ for any path with a
@@ -497,6 +505,18 @@ declare function isBinaryFile(absolutePath: string): boolean;
497
505
 
498
506
  declare function detectLanguage(filePath: string): string;
499
507
 
508
+ /**
509
+ * Redacts secrets from `content`.
510
+ *
511
+ * - Replaces only the matched span, so unrelated code sharing the line survives
512
+ * (the previous implementation discarded the whole line).
513
+ * - When a rule declares `valueGroup`, only that capture group is masked, so
514
+ * `dbPassword: "…"` keeps its key and stays parseable.
515
+ * - Masks PEM private-key blocks as a unit; per-line rules can only see the
516
+ * `BEGIN` header, which left every body line of a real key in the output.
517
+ * - Records `{ rule, line, path }` only. No excerpt of the source is retained,
518
+ * because that excerpt was being written verbatim into `reports/audit.md`.
519
+ */
500
520
  declare function scanAndRedactSecrets(content: string, rules: SecretRule[], filePath?: string): {
501
521
  redacted: string;
502
522
  findings: SecretFinding[];
@@ -528,7 +548,7 @@ declare function validateSnapshot(configInput: ResolvedSnapshotConfig | Snapshot
528
548
  * `package.json` carries the same version; `npm run verify` compares the two.
529
549
  */
530
550
  declare const GENERATOR_NAME = "codebase-snapshot";
531
- declare const GENERATOR_VERSION = "0.10.0";
551
+ declare const GENERATOR_VERSION = "0.10.2";
532
552
  /**
533
553
  * The manifest and ownership-marker schema this build writes and understands.
534
554
  *
@@ -746,6 +766,15 @@ interface PayloadDiff {
746
766
  };
747
767
  /** Human-readable statements, rendered by the terminal form. */
748
768
  reasons: string[];
769
+ /**
770
+ * A stable code per statement in `reasons`, in the same order.
771
+ *
772
+ * `reasons` is prose for a human; a program reading `diff --format json` had to match on that
773
+ * prose to decide what changed. The codes are the vocabulary: `schema-version`,
774
+ * `config-digest`, `config-digest-missing`, `generator`, `fingerprint`, `parts-count` and
775
+ * `layer-changed`.
776
+ */
777
+ codes: string[];
749
778
  }
750
779
  interface DiffSide {
751
780
  generatedAt: string;
@@ -753,8 +782,16 @@ interface DiffSide {
753
782
  fileCount: number;
754
783
  partsCount: number;
755
784
  }
756
- /** Compares two manifests file by file. */
757
- declare function compareManifests(before: Manifest, after: Manifest): ManifestDiff;
785
+ /**
786
+ * Compares two manifests file by file.
787
+ *
788
+ * `secretRules` is the resolved rule list of the caller (`config.secretRules` — built-ins plus
789
+ * `secrets.customPatterns`, or only the custom ones when the defaults are disabled). Without it
790
+ * every masking call in this file used the built-ins alone, so a token a repository had declared
791
+ * in `secretRules` — the reason the setting exists — was printed in clear by `diff` while
792
+ * `generate`, `validate`, `explain` and the MCP server all masked it.
793
+ */
794
+ declare function compareManifests(before: Manifest, after: Manifest, secretRules?: readonly SecretRule[]): ManifestDiff;
758
795
  /** Loads a manifest from a snapshot directory or a `manifest.json` path. */
759
796
  declare function loadManifest(target: string): Manifest;
760
797
  /** Renders a diff for a terminal. */
@@ -847,6 +884,14 @@ interface InitOptions {
847
884
  /** Render the config without writing anything. */
848
885
  dryRun?: boolean;
849
886
  outDir?: string;
887
+ /**
888
+ * The scratch directory the written configuration will use.
889
+ *
890
+ * Only `setup` knows it: it resolves the configuration it found and passes the effective
891
+ * `tmpDir` here so the `.gitignore` entries match what the next run will actually write.
892
+ * `init` has no configuration to read, so it assumes the default.
893
+ */
894
+ tmpDir?: string;
850
895
  io?: PromptIO;
851
896
  }
852
897
  /** What happened to the `devDependencies` entry that makes the npm scripts self-contained. */
@@ -1228,12 +1273,6 @@ interface SkeletonResult {
1228
1273
  /** How many bodies were replaced; zero means the file had none and was left alone. */
1229
1274
  collapsed: number;
1230
1275
  }
1231
- /**
1232
- * Replaces the body of every function-like node, innermost-first, by text span.
1233
- *
1234
- * Spans are collected and then applied from the end of the file backwards so that an earlier
1235
- * replacement never invalidates a later span's offsets.
1236
- */
1237
1276
  /**
1238
1277
  * True when a filename is JavaScript-with-JSX, in any letter case.
1239
1278
  *
@@ -1244,6 +1283,12 @@ interface SkeletonResult {
1244
1283
  * parser ran.
1245
1284
  */
1246
1285
  declare function isTsxFileName(fileName: string): boolean;
1286
+ /**
1287
+ * Replaces the body of every function-like node, innermost-first, by text span.
1288
+ *
1289
+ * Spans are collected and then applied from the end of the file backwards so that an earlier
1290
+ * replacement never invalidates a later span's offsets.
1291
+ */
1247
1292
  declare function skeletonizeTypeScript(source: string, fileName?: string): SkeletonResult;
1248
1293
  /**
1249
1294
  * True for a path this module can compress.
@@ -1312,4 +1357,4 @@ declare function generateSnapshot(configInput?: SnapshotConfig | ResolvedSnapsho
1312
1357
  /** Promise-returning wrapper for consumers that prefer an async call site. */
1313
1358
  declare function generateSnapshotAsync(configInput?: SnapshotConfig | ResolvedSnapshotConfig | null, options?: GenerateOptions): Promise<Manifest>;
1314
1359
 
1315
- export { ARTIFACT_NAMES, ArtifactSelection, ByteSize, CHECK_INTERVAL_MS, CONFIG_KEYS, type ChangedScope, type ChangedScopeRequest, CliOptions, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, DiscoveryMode, type ExplainResult, FAILURE_INTERVAL_MS, FileEntry, type FirstRunFacts, type FirstRunPlan, type FirstRunRefusal, GENERATOR_NAME, GENERATOR_VERSION, type GenerateOptions, HOOK_MARKER, type HeuristicResult, type HookInstallResult, type ImportCandidate, type ImportResolver, type InitDependency, type InitOptions, type InitResult, type InstallKind, JsonSummary, KindRule, LANGUAGE_PROFILES, type LanguageProfile, LayerRule, MIN_MAX_PART_BYTES, MIN_MAX_PART_TOKENS, Manifest, type ManifestDiff, MarkdownSummary, PACKAGE_LATEST_URL, PRESETS, PartMetadata, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, ResolvedSnapshotConfig, SCHEMA_VERSION, SecretFinding, SecretRule, SkipRecord, SnapshotConfig, SourceSummary, TextEncoding, UP_TO_DATE_INTERVAL_MS, type UpdateCheckOptions, type UpdateNotice, ValidationResult, type WizardAnswers, anchorForPath, appendGitignoreEntries, assertReplaceable, assertUsableConfigInput, buildImportResolver, bytesForTokens, cacheDirectory, cacheFilePath, checkForUpdate, classifyKind, classifyLayer, collectFiles, compareManifests, configDigest, countInvalidUtf8Bytes, countLines, decodeText, defineConfig, detectLanguage, detectPreset, displayPath, displayWidth, enforceBudget, estimateTokens, explainPath, fenceForContent, fenceForText, fetchLatestVersion, findSecretInPath, firstRunMessage, formatTokens, formatUpdateNotice, generateProjectTree, generateSarifReport, generateSnapshot, generateSnapshotAsync, getGitInfo, getPreset, gitignorePath, globToRegExp, hasPriorSnapshot, importsChangedFile, importsOfFile, importsOfText, installKind, installPreCommitHook, isBinaryBuffer, isBinaryExtension, isBinaryFile, isEffectivelyEmpty, isInteractive, isNewer, isResolvedConfig, isSensitivePath, isSkeletonizable, isTsxFileName, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, lockPathFor, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveChangedScope, resolveConfig, resolveSafeOutputDirs, resolveSpecifier, runInit, scanAndRedactSecrets, shouldCheck, skeletonizeTypeScript, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, truncatePreview, truncateToBytes, tsconfigPathsFor, updateCommand, validateSnapshot, wrapLines };
1360
+ export { ARTIFACT_NAMES, ArtifactSelection, ByteSize, CHECK_INTERVAL_MS, CONFIG_KEYS, type ChangedScope, type ChangedScopeRequest, CliOptions, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, DiscoveryMode, type ExplainResult, FAILURE_INTERVAL_MS, FileEntry, type FirstRunFacts, type FirstRunPlan, type FirstRunRefusal, GENERATOR_NAME, GENERATOR_VERSION, type GenerateOptions, HOOK_MARKER, type HeuristicResult, type HookInstallResult, type ImportCandidate, type ImportResolver, type InitDependency, type InitOptions, type InitResult, type InstallKind, JsonSummary, KindRule, LANGUAGE_PROFILES, type LanguageProfile, LayerRule, MIN_MAX_PART_BYTES, MIN_MAX_PART_TOKENS, Manifest, type ManifestDiff, MarkdownSummary, PACKAGE_LATEST_URL, PRESETS, PartMetadata, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, ResolvedSnapshotConfig, SCHEMA_VERSION, SecretFinding, SecretRule, SkipRecord, SnapshotConfig, SourceSummary, TextEncoding, UP_TO_DATE_INTERVAL_MS, type UpdateCheckOptions, type UpdateNotice, ValidationResult, type WizardAnswers, anchorForPath, appendGitignoreEntries, assertReplaceable, assertUsableConfigInput, buildImportResolver, bytesForTokens, cacheDirectory, cacheFilePath, checkForUpdate, classifyKind, classifyLayer, collectFiles, compareManifests, configDigest, countInvalidUtf8Bytes, countLines, decodeText, defineConfig, detectLanguage, detectPreset, displayPath, displayWidth, enforceBudget, estimateTokens, explainPath, fenceForContent, fenceForText, fetchLatestVersion, findSecretInPath, firstRunMessage, formatTokens, formatUpdateNotice, generateProjectTree, generateSarifReport, generateSnapshot, generateSnapshotAsync, getGitInfo, getPreset, gitignorePath, globToRegExp, hasPriorSnapshot, importsChangedFile, importsOfFile, importsOfText, installKind, installPreCommitHook, isBinaryBuffer, isBinaryExtension, isBinaryFile, isEffectivelyEmpty, isInteractive, isNewer, isResolvedConfig, isSensitivePath, isSkeletonizable, isTsxFileName, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, lockPathFor, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveChangedScope, resolveConfig, resolveSafeOutputDirs, resolveSpecifier, runInit, scanAndRedactSecrets, shouldCheck, skeletonizeTypeScript, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, treeTruncationWarnings, truncatePreview, truncateToBytes, tsconfigPathsFor, updateCommand, validateSnapshot, wrapLines };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { S as SecretRule, D as DiscoveryMode, a as SkipRecord, J as JsonSummary, M as MarkdownSummary, b as SourceSummary, K as KindRule, L as LayerRule, R as ResolvedSnapshotConfig, c as SnapshotConfig, B as ByteSize, C as CliOptions, P as PartMetadata, F as FileEntry, T as TextEncoding, d as SecretFinding, V as ValidationResult, e as Manifest, A as ArtifactSelection } from './types-Z471HW65.js';
2
- export { f as BudgetConfig, H as HooksConfig, I as InclusionMode, g as IncompleteFile, h as ManifestArtifact, i as ManifestConfigSnapshot, j as ManifestIndexes, k as ManifestTotals, l as Mode, O as OutputFormat, m as PartFileEntry, n as ResolvedArtifacts, o as ResolvedBudgets, p as SecretRuleInput, q as SkipReason, r as SummaryQuality, s as TruncationReason, t as ValidationDrift } from './types-Z471HW65.js';
3
- export { w as workerEntry } from './generate-worker-D_mUjgXw.js';
1
+ import { S as SecretRule, D as DiscoveryMode, a as SkipRecord, J as JsonSummary, M as MarkdownSummary, b as SourceSummary, K as KindRule, L as LayerRule, R as ResolvedSnapshotConfig, c as SnapshotConfig, B as ByteSize, C as CliOptions, P as PartMetadata, F as FileEntry, T as TextEncoding, d as SecretFinding, V as ValidationResult, e as Manifest, A as ArtifactSelection } from './types-BoWneA7n.js';
2
+ export { f as BudgetConfig, H as HooksConfig, I as InclusionMode, g as IncompleteFile, h as ManifestArtifact, i as ManifestConfigSnapshot, j as ManifestIndexes, k as ManifestTotals, l as Mode, O as OutputFormat, m as PartFileEntry, n as ResolvedArtifacts, o as ResolvedBudgets, p as SecretRuleInput, q as SkipReason, r as SummaryQuality, s as TruncationReason, t as ValidationDrift } from './types-BoWneA7n.js';
3
+ export { w as workerEntry } from './generate-worker-BK4uJx7Z.js';
4
4
 
5
5
  interface GitInfo {
6
6
  branch: string;
@@ -185,16 +185,14 @@ interface ConfigLoadResult {
185
185
  }
186
186
  /** True when this Node can `import()` a `.ts` file natively (type stripping). */
187
187
  declare function supportsTypeScriptImports(): boolean;
188
+ declare const CONFIG_KEYS: ReadonlySet<string>;
188
189
  /**
189
- * Every key a configuration file may carry.
190
+ * Loads the first usable config file from `cwd`.
190
191
  *
191
- * This is `SnapshotConfig` plus the spellings that are read through casts: `discovery`
192
- * (validated separately), `exclude` (the flag spelling of `excludePatterns`) and
193
- * `secretRules` (the library spelling of a rule list, accepted by `resolveConfig` and
194
- * therefore needed here too — omitting it made a config file that used it fail with
195
- * "unknown setting(s): secretRules" while the same key worked when passed in code).
192
+ * Every failure is reported through `warnings` instead of being swallowed by an
193
+ * empty `catch`: a syntax error in a user's config used to be indistinguishable
194
+ * from having no config at all.
196
195
  */
197
- declare const CONFIG_KEYS: ReadonlySet<string>;
198
196
  declare function loadConfigFileDetailed(cwd: string, options?: {
199
197
  allowExecutableConfig?: boolean;
200
198
  }): Promise<ConfigLoadResult>;
@@ -261,6 +259,17 @@ declare function configDigest(config: ResolvedSnapshotConfig): string;
261
259
  declare function defineConfig(config: SnapshotConfig): SnapshotConfig;
262
260
 
263
261
  declare function generateProjectTree(filePaths: string[]): string;
262
+ /**
263
+ * A manifest warning for each cap the rendered tree reports.
264
+ *
265
+ * The tree carries its own marker, but a reader of the manifest learns nothing from an artifact
266
+ * they did not open — so the truncation is also a warning. Only the depth form was matched: a tree
267
+ * cut at the 20 000-line cap said so in the artifact and nothing in the manifest, and the two views
268
+ * of one fact disagreed.
269
+ *
270
+ * Exported so the mapping is testable without building a 20 000-file repository.
271
+ */
272
+ declare function treeTruncationWarnings(treeText: string): string[];
264
273
 
265
274
  interface PartitionedPart {
266
275
  filename: string;
@@ -293,15 +302,14 @@ declare function enforceBudget(parts: PartitionedPart[], budget: number): Partit
293
302
  */
294
303
  declare function renumberParts(parts: PartitionedPart[], contentFingerprint?: string): PartitionedPart[];
295
304
  /**
305
+ * The form of a path that is written into a part.
306
+ *
296
307
  * Paths reach the `## Files` list, the `### FILE:` heading and the navigation
297
308
  * index, so a control character in a name is rendered as `\uXXXX` instead of
298
309
  * being emitted raw: a bidi override visually reorders the line, a C1 CSI drives
299
310
  * the terminal, and a newline would break the line-oriented layout. Escaping
300
311
  * also keeps the `## Files` fence safe (see {@link fenceForText}). Paths are
301
312
  * legal UTF-8, so this is reachable with an ordinary `git mv`.
302
- */
303
- /**
304
- * The form of a path that is written into a part.
305
313
  *
306
314
  * Exported because the reader has to compare against it: a section heading holds this
307
315
  * form, not the manifest's `relativePath`, and the two differ for any path with a
@@ -497,6 +505,18 @@ declare function isBinaryFile(absolutePath: string): boolean;
497
505
 
498
506
  declare function detectLanguage(filePath: string): string;
499
507
 
508
+ /**
509
+ * Redacts secrets from `content`.
510
+ *
511
+ * - Replaces only the matched span, so unrelated code sharing the line survives
512
+ * (the previous implementation discarded the whole line).
513
+ * - When a rule declares `valueGroup`, only that capture group is masked, so
514
+ * `dbPassword: "…"` keeps its key and stays parseable.
515
+ * - Masks PEM private-key blocks as a unit; per-line rules can only see the
516
+ * `BEGIN` header, which left every body line of a real key in the output.
517
+ * - Records `{ rule, line, path }` only. No excerpt of the source is retained,
518
+ * because that excerpt was being written verbatim into `reports/audit.md`.
519
+ */
500
520
  declare function scanAndRedactSecrets(content: string, rules: SecretRule[], filePath?: string): {
501
521
  redacted: string;
502
522
  findings: SecretFinding[];
@@ -528,7 +548,7 @@ declare function validateSnapshot(configInput: ResolvedSnapshotConfig | Snapshot
528
548
  * `package.json` carries the same version; `npm run verify` compares the two.
529
549
  */
530
550
  declare const GENERATOR_NAME = "codebase-snapshot";
531
- declare const GENERATOR_VERSION = "0.10.0";
551
+ declare const GENERATOR_VERSION = "0.10.2";
532
552
  /**
533
553
  * The manifest and ownership-marker schema this build writes and understands.
534
554
  *
@@ -746,6 +766,15 @@ interface PayloadDiff {
746
766
  };
747
767
  /** Human-readable statements, rendered by the terminal form. */
748
768
  reasons: string[];
769
+ /**
770
+ * A stable code per statement in `reasons`, in the same order.
771
+ *
772
+ * `reasons` is prose for a human; a program reading `diff --format json` had to match on that
773
+ * prose to decide what changed. The codes are the vocabulary: `schema-version`,
774
+ * `config-digest`, `config-digest-missing`, `generator`, `fingerprint`, `parts-count` and
775
+ * `layer-changed`.
776
+ */
777
+ codes: string[];
749
778
  }
750
779
  interface DiffSide {
751
780
  generatedAt: string;
@@ -753,8 +782,16 @@ interface DiffSide {
753
782
  fileCount: number;
754
783
  partsCount: number;
755
784
  }
756
- /** Compares two manifests file by file. */
757
- declare function compareManifests(before: Manifest, after: Manifest): ManifestDiff;
785
+ /**
786
+ * Compares two manifests file by file.
787
+ *
788
+ * `secretRules` is the resolved rule list of the caller (`config.secretRules` — built-ins plus
789
+ * `secrets.customPatterns`, or only the custom ones when the defaults are disabled). Without it
790
+ * every masking call in this file used the built-ins alone, so a token a repository had declared
791
+ * in `secretRules` — the reason the setting exists — was printed in clear by `diff` while
792
+ * `generate`, `validate`, `explain` and the MCP server all masked it.
793
+ */
794
+ declare function compareManifests(before: Manifest, after: Manifest, secretRules?: readonly SecretRule[]): ManifestDiff;
758
795
  /** Loads a manifest from a snapshot directory or a `manifest.json` path. */
759
796
  declare function loadManifest(target: string): Manifest;
760
797
  /** Renders a diff for a terminal. */
@@ -847,6 +884,14 @@ interface InitOptions {
847
884
  /** Render the config without writing anything. */
848
885
  dryRun?: boolean;
849
886
  outDir?: string;
887
+ /**
888
+ * The scratch directory the written configuration will use.
889
+ *
890
+ * Only `setup` knows it: it resolves the configuration it found and passes the effective
891
+ * `tmpDir` here so the `.gitignore` entries match what the next run will actually write.
892
+ * `init` has no configuration to read, so it assumes the default.
893
+ */
894
+ tmpDir?: string;
850
895
  io?: PromptIO;
851
896
  }
852
897
  /** What happened to the `devDependencies` entry that makes the npm scripts self-contained. */
@@ -1228,12 +1273,6 @@ interface SkeletonResult {
1228
1273
  /** How many bodies were replaced; zero means the file had none and was left alone. */
1229
1274
  collapsed: number;
1230
1275
  }
1231
- /**
1232
- * Replaces the body of every function-like node, innermost-first, by text span.
1233
- *
1234
- * Spans are collected and then applied from the end of the file backwards so that an earlier
1235
- * replacement never invalidates a later span's offsets.
1236
- */
1237
1276
  /**
1238
1277
  * True when a filename is JavaScript-with-JSX, in any letter case.
1239
1278
  *
@@ -1244,6 +1283,12 @@ interface SkeletonResult {
1244
1283
  * parser ran.
1245
1284
  */
1246
1285
  declare function isTsxFileName(fileName: string): boolean;
1286
+ /**
1287
+ * Replaces the body of every function-like node, innermost-first, by text span.
1288
+ *
1289
+ * Spans are collected and then applied from the end of the file backwards so that an earlier
1290
+ * replacement never invalidates a later span's offsets.
1291
+ */
1247
1292
  declare function skeletonizeTypeScript(source: string, fileName?: string): SkeletonResult;
1248
1293
  /**
1249
1294
  * True for a path this module can compress.
@@ -1312,4 +1357,4 @@ declare function generateSnapshot(configInput?: SnapshotConfig | ResolvedSnapsho
1312
1357
  /** Promise-returning wrapper for consumers that prefer an async call site. */
1313
1358
  declare function generateSnapshotAsync(configInput?: SnapshotConfig | ResolvedSnapshotConfig | null, options?: GenerateOptions): Promise<Manifest>;
1314
1359
 
1315
- export { ARTIFACT_NAMES, ArtifactSelection, ByteSize, CHECK_INTERVAL_MS, CONFIG_KEYS, type ChangedScope, type ChangedScopeRequest, CliOptions, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, DiscoveryMode, type ExplainResult, FAILURE_INTERVAL_MS, FileEntry, type FirstRunFacts, type FirstRunPlan, type FirstRunRefusal, GENERATOR_NAME, GENERATOR_VERSION, type GenerateOptions, HOOK_MARKER, type HeuristicResult, type HookInstallResult, type ImportCandidate, type ImportResolver, type InitDependency, type InitOptions, type InitResult, type InstallKind, JsonSummary, KindRule, LANGUAGE_PROFILES, type LanguageProfile, LayerRule, MIN_MAX_PART_BYTES, MIN_MAX_PART_TOKENS, Manifest, type ManifestDiff, MarkdownSummary, PACKAGE_LATEST_URL, PRESETS, PartMetadata, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, ResolvedSnapshotConfig, SCHEMA_VERSION, SecretFinding, SecretRule, SkipRecord, SnapshotConfig, SourceSummary, TextEncoding, UP_TO_DATE_INTERVAL_MS, type UpdateCheckOptions, type UpdateNotice, ValidationResult, type WizardAnswers, anchorForPath, appendGitignoreEntries, assertReplaceable, assertUsableConfigInput, buildImportResolver, bytesForTokens, cacheDirectory, cacheFilePath, checkForUpdate, classifyKind, classifyLayer, collectFiles, compareManifests, configDigest, countInvalidUtf8Bytes, countLines, decodeText, defineConfig, detectLanguage, detectPreset, displayPath, displayWidth, enforceBudget, estimateTokens, explainPath, fenceForContent, fenceForText, fetchLatestVersion, findSecretInPath, firstRunMessage, formatTokens, formatUpdateNotice, generateProjectTree, generateSarifReport, generateSnapshot, generateSnapshotAsync, getGitInfo, getPreset, gitignorePath, globToRegExp, hasPriorSnapshot, importsChangedFile, importsOfFile, importsOfText, installKind, installPreCommitHook, isBinaryBuffer, isBinaryExtension, isBinaryFile, isEffectivelyEmpty, isInteractive, isNewer, isResolvedConfig, isSensitivePath, isSkeletonizable, isTsxFileName, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, lockPathFor, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveChangedScope, resolveConfig, resolveSafeOutputDirs, resolveSpecifier, runInit, scanAndRedactSecrets, shouldCheck, skeletonizeTypeScript, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, truncatePreview, truncateToBytes, tsconfigPathsFor, updateCommand, validateSnapshot, wrapLines };
1360
+ export { ARTIFACT_NAMES, ArtifactSelection, ByteSize, CHECK_INTERVAL_MS, CONFIG_KEYS, type ChangedScope, type ChangedScopeRequest, CliOptions, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, DiscoveryMode, type ExplainResult, FAILURE_INTERVAL_MS, FileEntry, type FirstRunFacts, type FirstRunPlan, type FirstRunRefusal, GENERATOR_NAME, GENERATOR_VERSION, type GenerateOptions, HOOK_MARKER, type HeuristicResult, type HookInstallResult, type ImportCandidate, type ImportResolver, type InitDependency, type InitOptions, type InitResult, type InstallKind, JsonSummary, KindRule, LANGUAGE_PROFILES, type LanguageProfile, LayerRule, MIN_MAX_PART_BYTES, MIN_MAX_PART_TOKENS, Manifest, type ManifestDiff, MarkdownSummary, PACKAGE_LATEST_URL, PRESETS, PartMetadata, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, ResolvedSnapshotConfig, SCHEMA_VERSION, SecretFinding, SecretRule, SkipRecord, SnapshotConfig, SourceSummary, TextEncoding, UP_TO_DATE_INTERVAL_MS, type UpdateCheckOptions, type UpdateNotice, ValidationResult, type WizardAnswers, anchorForPath, appendGitignoreEntries, assertReplaceable, assertUsableConfigInput, buildImportResolver, bytesForTokens, cacheDirectory, cacheFilePath, checkForUpdate, classifyKind, classifyLayer, collectFiles, compareManifests, configDigest, countInvalidUtf8Bytes, countLines, decodeText, defineConfig, detectLanguage, detectPreset, displayPath, displayWidth, enforceBudget, estimateTokens, explainPath, fenceForContent, fenceForText, fetchLatestVersion, findSecretInPath, firstRunMessage, formatTokens, formatUpdateNotice, generateProjectTree, generateSarifReport, generateSnapshot, generateSnapshotAsync, getGitInfo, getPreset, gitignorePath, globToRegExp, hasPriorSnapshot, importsChangedFile, importsOfFile, importsOfText, installKind, installPreCommitHook, isBinaryBuffer, isBinaryExtension, isBinaryFile, isEffectivelyEmpty, isInteractive, isNewer, isResolvedConfig, isSensitivePath, isSkeletonizable, isTsxFileName, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, lockPathFor, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveChangedScope, resolveConfig, resolveSafeOutputDirs, resolveSpecifier, runInit, scanAndRedactSecrets, shouldCheck, skeletonizeTypeScript, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, treeTruncationWarnings, truncatePreview, truncateToBytes, tsconfigPathsFor, updateCommand, validateSnapshot, wrapLines };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export { ARTIFACT_NAMES, CHECK_INTERVAL_MS, CONFIG_KEYS, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, FAILURE_INTERVAL_MS, GENERATOR_NAME, GENERATOR_VERSION, HOOK_MARKER, LANGUAGE_PROFILES, MIN_MAX_PART_BYTES, MIN_MAX_PART_TOKENS, PACKAGE_LATEST_URL, PRESETS, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, SCHEMA_VERSION, UP_TO_DATE_INTERVAL_MS, anchorForPath, appendGitignoreEntries, assertReplaceable, assertUsableConfigInput, buildImportResolver, bytesForTokens, cacheDirectory, cacheFilePath, checkForUpdate, classifyKind, classifyLayer, collectFiles, compareManifests, configDigest, countInvalidUtf8Bytes, countLines, decodeText, defineConfig, detectLanguage, detectPreset, displayPath, displayWidth, enforceBudget, estimateTokens, explainPath, fenceForContent, fenceForText, fetchLatestVersion, findSecretInPath, firstRunMessage, formatTokens, formatUpdateNotice, generateProjectTree, generateSarifReport, generateSnapshot, generateSnapshotAsync, getGitInfo, getPreset, gitignorePath, globToRegExp, hasPriorSnapshot, importsChangedFile, importsOfFile, importsOfText, installKind, installPreCommitHook, isBinaryBuffer, isBinaryExtension, isBinaryFile, isEffectivelyEmpty, isInteractive, isNewer, isResolvedConfig, isSensitivePath, isSkeletonizable, isTsxFileName, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, lockPathFor, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveChangedScope, resolveConfig, resolveSafeOutputDirs, resolveSpecifier, runInit, scanAndRedactSecrets, shouldCheck, skeletonizeTypeScript, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, truncatePreview, truncateToBytes, tsconfigPathsFor, updateCommand, validateSnapshot, workerEntry, wrapLines } from './chunk-EP7OCPUM.js';
1
+ export { ARTIFACT_NAMES, CHECK_INTERVAL_MS, CONFIG_KEYS, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, FAILURE_INTERVAL_MS, GENERATOR_NAME, GENERATOR_VERSION, HOOK_MARKER, LANGUAGE_PROFILES, MIN_MAX_PART_BYTES, MIN_MAX_PART_TOKENS, PACKAGE_LATEST_URL, PRESETS, PromptBack, PromptCancelled, REQUEST_TIMEOUT_MS, SCHEMA_VERSION, UP_TO_DATE_INTERVAL_MS, anchorForPath, appendGitignoreEntries, assertReplaceable, assertUsableConfigInput, buildImportResolver, bytesForTokens, cacheDirectory, cacheFilePath, checkForUpdate, classifyKind, classifyLayer, collectFiles, compareManifests, configDigest, countInvalidUtf8Bytes, countLines, decodeText, defineConfig, detectLanguage, detectPreset, displayPath, displayWidth, enforceBudget, estimateTokens, explainPath, fenceForContent, fenceForText, fetchLatestVersion, findSecretInPath, firstRunMessage, formatTokens, formatUpdateNotice, generateProjectTree, generateSarifReport, generateSnapshot, generateSnapshotAsync, getGitInfo, getPreset, gitignorePath, globToRegExp, hasPriorSnapshot, importsChangedFile, importsOfFile, importsOfText, installKind, installPreCommitHook, isBinaryBuffer, isBinaryExtension, isBinaryFile, isEffectivelyEmpty, isInteractive, isNewer, isResolvedConfig, isSensitivePath, isSkeletonizable, isTsxFileName, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, lockPathFor, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, planFirstRun, profileForPath, renderConfig, renderDiffText, renderExplainText, renumberParts, resolveChangedScope, resolveConfig, resolveSafeOutputDirs, resolveSpecifier, runInit, scanAndRedactSecrets, shouldCheck, skeletonizeTypeScript, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, treeTruncationWarnings, truncatePreview, truncateToBytes, tsconfigPathsFor, updateCommand, validateSnapshot, workerEntry, wrapLines } from './chunk-5AV7OR3J.js';