@ankurhalder/codebase-snapshot 4.0.0 → 4.0.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,5 +1,5 @@
1
- import { J as JsonSummary, M as MarkdownSummary, S as SourceSummary, R as ResolvedSnapshotConfig, a as SnapshotConfig, B as ByteSize, C as CliOptions, F as FileEntry, P as PartMetadata, L as LayerRule, K as KindRule, b as SecretRule, c as SecretFinding, V as ValidationResult, d as Manifest, A as ArtifactSelection, e as SkipRecord } from './types-BdpT_4b8.cjs';
2
- export { f as BudgetConfig, H as HooksConfig, I as InclusionMode, g as ManifestArtifact, h as ManifestConfigSnapshot, i as ManifestIndexes, j as ManifestTotals, k as Mode, O as OutputFormat, l as PartFileEntry, m as ResolvedArtifacts, n as ResolvedBudgets, o as SecretRuleInput, p as SkipReason, q as SummaryQuality, r as ValidationDrift } from './types-BdpT_4b8.cjs';
1
+ import { J as JsonSummary, M as MarkdownSummary, S as SourceSummary, R as ResolvedSnapshotConfig, a as SnapshotConfig, B as ByteSize, C as CliOptions, F as FileEntry, P as PartMetadata, L as LayerRule, K as KindRule, b as SecretRule, c as SecretFinding, V as ValidationResult, d as Manifest, A as ArtifactSelection, e as SkipRecord } from './types-LSfwsKE-.cjs';
2
+ export { f as BudgetConfig, H as HooksConfig, I as InclusionMode, g as ManifestArtifact, h as ManifestConfigSnapshot, i as ManifestIndexes, j as ManifestTotals, k as Mode, O as OutputFormat, l as PartFileEntry, m as ResolvedArtifacts, n as ResolvedBudgets, o as SecretRuleInput, p as SkipReason, q as SummaryQuality, r as ValidationDrift } from './types-LSfwsKE-.cjs';
3
3
 
4
4
  /**
5
5
  * Strips `//` and block comments the way JSONC does, without touching anything
@@ -457,6 +457,11 @@ interface CollectOptions {
457
457
  * Default `false`: they are skipped with `reason: "sensitive-file"`.
458
458
  */
459
459
  includeSensitiveFiles?: boolean;
460
+ /**
461
+ * Secret rules used to scan *paths* (defaults are always applied). Pass
462
+ * `config.secretRules` so `customPatterns` also protect file names.
463
+ */
464
+ secretRules?: readonly SecretRule[];
460
465
  }
461
466
  interface CollectResult {
462
467
  files: string[];
@@ -490,7 +495,7 @@ declare function matchesExclude(relativePath: string, pattern: string): boolean;
490
495
  declare function collectFiles(cwd: string, options?: CollectOptions): CollectResult;
491
496
 
492
497
  declare const GENERATOR_NAME = "@ankurhalder/codebase-snapshot";
493
- declare const GENERATOR_VERSION = "4.0.0";
498
+ declare const GENERATOR_VERSION = "4.0.2";
494
499
  declare const SCHEMA_VERSION = "3.0.0";
495
500
  interface GenerateOptions {
496
501
  /** Compute the full manifest but write nothing to disk. */
@@ -514,13 +519,13 @@ declare function resolveSafeOutputDirs(config: {
514
519
  /**
515
520
  * Refuses to replace a directory that this generator did not write.
516
521
  *
517
- * Path checks alone cannot make the swap and the staging wipe safe: `outDir:
518
- * "src"` is a plausible typo, and a user directory that happens to contain a
519
- * `.codebase-snapshot` file or a manifest-shaped JSON document is not a
520
- * snapshot. `tmpDir` is held to the same standard: it is only cleared when it
521
- * carries our marker and holds nothing but our artifacts.
522
+ * Path checks alone cannot make the swap safe: `outDir: "src"` is a plausible
523
+ * typo, and a user directory that happens to contain a `.codebase-snapshot` file
524
+ * or a manifest-shaped JSON document is not a snapshot. The staging root is
525
+ * checked separately by {@link assertStagingRootUsable}, because it holds one
526
+ * directory per run rather than a single snapshot.
522
527
  */
523
- declare function assertReplaceable(target: string, label: "outDir" | "tmpDir"): void;
528
+ declare function assertReplaceable(target: string, label: "outDir" | "tmpDir", secretRules?: readonly SecretRule[]): void;
524
529
  /**
525
530
  * Generates the snapshot.
526
531
  *
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { J as JsonSummary, M as MarkdownSummary, S as SourceSummary, R as ResolvedSnapshotConfig, a as SnapshotConfig, B as ByteSize, C as CliOptions, F as FileEntry, P as PartMetadata, L as LayerRule, K as KindRule, b as SecretRule, c as SecretFinding, V as ValidationResult, d as Manifest, A as ArtifactSelection, e as SkipRecord } from './types-BdpT_4b8.js';
2
- export { f as BudgetConfig, H as HooksConfig, I as InclusionMode, g as ManifestArtifact, h as ManifestConfigSnapshot, i as ManifestIndexes, j as ManifestTotals, k as Mode, O as OutputFormat, l as PartFileEntry, m as ResolvedArtifacts, n as ResolvedBudgets, o as SecretRuleInput, p as SkipReason, q as SummaryQuality, r as ValidationDrift } from './types-BdpT_4b8.js';
1
+ import { J as JsonSummary, M as MarkdownSummary, S as SourceSummary, R as ResolvedSnapshotConfig, a as SnapshotConfig, B as ByteSize, C as CliOptions, F as FileEntry, P as PartMetadata, L as LayerRule, K as KindRule, b as SecretRule, c as SecretFinding, V as ValidationResult, d as Manifest, A as ArtifactSelection, e as SkipRecord } from './types-LSfwsKE-.js';
2
+ export { f as BudgetConfig, H as HooksConfig, I as InclusionMode, g as ManifestArtifact, h as ManifestConfigSnapshot, i as ManifestIndexes, j as ManifestTotals, k as Mode, O as OutputFormat, l as PartFileEntry, m as ResolvedArtifacts, n as ResolvedBudgets, o as SecretRuleInput, p as SkipReason, q as SummaryQuality, r as ValidationDrift } from './types-LSfwsKE-.js';
3
3
 
4
4
  /**
5
5
  * Strips `//` and block comments the way JSONC does, without touching anything
@@ -457,6 +457,11 @@ interface CollectOptions {
457
457
  * Default `false`: they are skipped with `reason: "sensitive-file"`.
458
458
  */
459
459
  includeSensitiveFiles?: boolean;
460
+ /**
461
+ * Secret rules used to scan *paths* (defaults are always applied). Pass
462
+ * `config.secretRules` so `customPatterns` also protect file names.
463
+ */
464
+ secretRules?: readonly SecretRule[];
460
465
  }
461
466
  interface CollectResult {
462
467
  files: string[];
@@ -490,7 +495,7 @@ declare function matchesExclude(relativePath: string, pattern: string): boolean;
490
495
  declare function collectFiles(cwd: string, options?: CollectOptions): CollectResult;
491
496
 
492
497
  declare const GENERATOR_NAME = "@ankurhalder/codebase-snapshot";
493
- declare const GENERATOR_VERSION = "4.0.0";
498
+ declare const GENERATOR_VERSION = "4.0.2";
494
499
  declare const SCHEMA_VERSION = "3.0.0";
495
500
  interface GenerateOptions {
496
501
  /** Compute the full manifest but write nothing to disk. */
@@ -514,13 +519,13 @@ declare function resolveSafeOutputDirs(config: {
514
519
  /**
515
520
  * Refuses to replace a directory that this generator did not write.
516
521
  *
517
- * Path checks alone cannot make the swap and the staging wipe safe: `outDir:
518
- * "src"` is a plausible typo, and a user directory that happens to contain a
519
- * `.codebase-snapshot` file or a manifest-shaped JSON document is not a
520
- * snapshot. `tmpDir` is held to the same standard: it is only cleared when it
521
- * carries our marker and holds nothing but our artifacts.
522
+ * Path checks alone cannot make the swap safe: `outDir: "src"` is a plausible
523
+ * typo, and a user directory that happens to contain a `.codebase-snapshot` file
524
+ * or a manifest-shaped JSON document is not a snapshot. The staging root is
525
+ * checked separately by {@link assertStagingRootUsable}, because it holds one
526
+ * directory per run rather than a single snapshot.
522
527
  */
523
- declare function assertReplaceable(target: string, label: "outDir" | "tmpDir"): void;
528
+ declare function assertReplaceable(target: string, label: "outDir" | "tmpDir", secretRules?: readonly SecretRule[]): void;
524
529
  /**
525
530
  * Generates the snapshot.
526
531
  *
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { ARTIFACT_NAMES, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, GENERATOR_NAME, GENERATOR_VERSION, LANGUAGE_PROFILES, MIN_MAX_PART_BYTES, PRESETS, PromptCancelled, SCHEMA_VERSION, anchorForPath, assertReplaceable, assertUsableConfigInput, collectFiles, compareManifests, countLines, defineConfig, detectLanguage, detectPreset, explainPath, fenceForContent, fenceForText, generateProjectTree, generateSnapshot, generateSnapshotAsync, getPreset, globToRegExp, isBinaryBuffer, isBinaryExtension, isBinaryFile, isInteractive, isResolvedConfig, isSensitivePath, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, profileForPath, renderConfig, renderDiffText, renderExplainText, renderMinimalConfig, renumberParts, resolveConfig, resolveSafeOutputDirs, runInit, scanAndRedactSecrets, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, truncatePreview, truncateToBytes, validateSnapshot } from './chunk-FM4OOQPF.js';
1
+ export { ARTIFACT_NAMES, DEFAULT_ANSWERS, DEFAULT_SECRET_PATTERNS, GENERATOR_NAME, GENERATOR_VERSION, LANGUAGE_PROFILES, MIN_MAX_PART_BYTES, PRESETS, PromptCancelled, SCHEMA_VERSION, anchorForPath, assertReplaceable, assertUsableConfigInput, collectFiles, compareManifests, countLines, defineConfig, detectLanguage, detectPreset, explainPath, fenceForContent, fenceForText, generateProjectTree, generateSnapshot, generateSnapshotAsync, getPreset, globToRegExp, isBinaryBuffer, isBinaryExtension, isBinaryFile, isInteractive, isResolvedConfig, isSensitivePath, listPresetNames, loadConfigFile, loadConfigFileDetailed, loadManifest, markResolvedConfig, matchRule, matchesExclude, normalizeResolvedConfig, parseByteSize, partitionFiles, profileForPath, renderConfig, renderDiffText, renderExplainText, renderMinimalConfig, renumberParts, resolveConfig, resolveSafeOutputDirs, runInit, scanAndRedactSecrets, stripJsonComments, summarizeJson, summarizeMarkdown, summarizeTypeScriptSource, summarizeWithProfile, supportsTypeScriptImports, truncatePreview, truncateToBytes, validateSnapshot } from './chunk-CY3XU5TS.js';
2
2
  //# sourceMappingURL=index.js.map
3
3
  //# sourceMappingURL=index.js.map
@@ -66,6 +66,7 @@ type SkipReason = "binary" | "read-error" | "not-file"
66
66
  /** Excluded by the user's own `excludePatterns` or `include` allow-list. */
67
67
  | "excluded";
68
68
  interface SkipRecord {
69
+ /** Path as it may be shown in an artifact: secret spans are masked. */
69
70
  path: string;
70
71
  reason: SkipReason;
71
72
  detail?: string;
@@ -66,6 +66,7 @@ type SkipReason = "binary" | "read-error" | "not-file"
66
66
  /** Excluded by the user's own `excludePatterns` or `include` allow-list. */
67
67
  | "excluded";
68
68
  interface SkipRecord {
69
+ /** Path as it may be shown in an artifact: secret spans are masked. */
69
70
  path: string;
70
71
  reason: SkipReason;
71
72
  detail?: string;
package/docs/cli.md CHANGED
@@ -85,9 +85,11 @@ Exit `0` when the snapshot is current, `1` on any drift. It never writes anythin
85
85
  codebase-snapshot report [options]
86
86
  ```
87
87
 
88
- Prints snapshot health without re-scanning everything: counts, layer breakdown, warnings,
89
- and the validation verdict. Requires an existing `manifest.json` (exit `1` if missing). Also
90
- exits `1` when it detects drift.
88
+ Prints what the snapshot says about itself: counts, layer breakdown, warnings, fingerprint.
89
+ It reads `manifest.json` and nothing else, so it is fast on any repository size — a 20 000-file
90
+ snapshot reports in about half a second. Requires an existing `manifest.json` (exit `1` if
91
+ missing); exits `0` otherwise. It does **not** check whether the snapshot is still true — that
92
+ is `validate`, which re-reads the repository and exits `1` on drift.
91
93
 
92
94
  ### `init`
93
95
 
@@ -167,7 +167,7 @@ Exit `1` with one line per class of drift:
167
167
  **Fix** — re-run `generate`. If it persists, the snapshot directory is being modified by
168
168
  something else.
169
169
 
170
- ### `report` exits 1
170
+ ### `report` exits 1 (only when it cannot read the snapshot)
171
171
 
172
172
  - `Manifest not found at … Run generate first.` — nothing has been generated yet.
173
173
  - `… is not a snapshot manifest: missing \`counts\`` — the file parsed as JSON but is not a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ankurhalder/codebase-snapshot",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "Production-grade LLM codebase snapshot generator, auditor, and AST partitioner",
5
5
  "keywords": [
6
6
  "codebase",