codebase-snapshot 0.9.16 → 0.9.18
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 +136 -0
- package/README.md +4 -4
- package/SECURITY.md +18 -6
- package/dist/bin.js +2024 -622
- package/dist/{chunk-WIL536QD.js → chunk-XAW5GY6X.js} +98 -25
- package/dist/{chunk-6TRFLA7N.js → chunk-ZXWAVHSZ.js} +1758 -444
- package/dist/cli.cjs +2006 -608
- package/dist/cli.d.cts +1 -11
- package/dist/cli.d.ts +1 -11
- package/dist/cli.js +17 -6
- package/dist/index.cjs +1752 -438
- package/dist/index.d.cts +106 -9
- package/dist/index.d.ts +106 -9
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +1761 -341
- package/dist/mcp.d.cts +7 -0
- package/dist/mcp.d.ts +7 -0
- package/dist/mcp.js +2 -2
- package/dist/{types-DIX6zWSt.d.cts → types-KbJvBjmV.d.cts} +46 -1
- package/dist/{types-DIX6zWSt.d.ts → types-KbJvBjmV.d.ts} +46 -1
- package/docs/cli.md +20 -13
- package/docs/configuration.md +16 -1
- package/docs/mcp.md +17 -7
- package/docs/output.md +3 -3
- package/docs/vs-gitingest.md +6 -2
- package/docs/vs-repomix.md +9 -5
- package/package.json +16 -18
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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-
|
|
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-
|
|
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-KbJvBjmV.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-KbJvBjmV.cjs';
|
|
3
3
|
export { w as workerEntry } from './generate-worker-D_mUjgXw.cjs';
|
|
4
4
|
|
|
5
5
|
interface GitInfo {
|
|
@@ -41,6 +41,15 @@ interface CollectOptions {
|
|
|
41
41
|
* Defaults to the configured mode, then `auto`.
|
|
42
42
|
*/
|
|
43
43
|
discovery?: DiscoveryMode;
|
|
44
|
+
/**
|
|
45
|
+
* Paths to consider even when discovery does not list them.
|
|
46
|
+
*
|
|
47
|
+
* `--staged` selects index paths, and a path staged for addition can be absent from the
|
|
48
|
+
* working tree (an unstaged delete), while a staged deletion has no working-tree file at all.
|
|
49
|
+
* Both must still reach the same include/exclude/sensitive filters as every other candidate, so
|
|
50
|
+
* they are appended here rather than merged into the result by hand.
|
|
51
|
+
*/
|
|
52
|
+
extraPaths?: readonly string[];
|
|
44
53
|
}
|
|
45
54
|
interface CollectResult {
|
|
46
55
|
files: string[];
|
|
@@ -186,7 +195,9 @@ declare function supportsTypeScriptImports(): boolean;
|
|
|
186
195
|
* "unknown setting(s): secretRules" while the same key worked when passed in code).
|
|
187
196
|
*/
|
|
188
197
|
declare const CONFIG_KEYS: ReadonlySet<string>;
|
|
189
|
-
declare function loadConfigFileDetailed(cwd: string
|
|
198
|
+
declare function loadConfigFileDetailed(cwd: string, options?: {
|
|
199
|
+
allowExecutableConfig?: boolean;
|
|
200
|
+
}): Promise<ConfigLoadResult>;
|
|
190
201
|
declare function loadConfigFile(cwd: string): Promise<SnapshotConfig | null>;
|
|
191
202
|
/** Smallest usable part budget: a part header plus one section must fit. */
|
|
192
203
|
declare const MIN_MAX_PART_BYTES = 4096;
|
|
@@ -509,12 +520,28 @@ declare function validateSnapshot(configInput: ResolvedSnapshotConfig | Snapshot
|
|
|
509
520
|
* `package.json` carries the same version; `npm run verify` compares the two.
|
|
510
521
|
*/
|
|
511
522
|
declare const GENERATOR_NAME = "codebase-snapshot";
|
|
512
|
-
declare const GENERATOR_VERSION = "0.9.
|
|
523
|
+
declare const GENERATOR_VERSION = "0.9.18";
|
|
524
|
+
/**
|
|
525
|
+
* The manifest and ownership-marker schema this build writes and understands.
|
|
526
|
+
*
|
|
527
|
+
* Living here rather than in `index.ts` lets `validate` decide whether a manifest is the current
|
|
528
|
+
* schema without importing the barrel that imports `validate` — the same cycle that moved
|
|
529
|
+
* {@link GENERATOR_NAME} here. `index.ts` re-exports it, so the public surface is unchanged.
|
|
530
|
+
*/
|
|
531
|
+
declare const SCHEMA_VERSION = "3.0.0";
|
|
513
532
|
|
|
514
533
|
/** The one endpoint this package will ever request. */
|
|
515
534
|
declare const PACKAGE_LATEST_URL = "https://registry.npmjs.org/codebase-snapshot/latest";
|
|
516
|
-
/** A result
|
|
535
|
+
/** A result naming a newer release is trusted for a day: the upgrade command cannot change. */
|
|
517
536
|
declare const CHECK_INTERVAL_MS: number;
|
|
537
|
+
/**
|
|
538
|
+
* How long "you are already current" is trusted.
|
|
539
|
+
*
|
|
540
|
+
* That is the only answer a new release can invalidate. Re-asking it hourly means an active run
|
|
541
|
+
* notices a release within the hour, while a cached upgrade keeps the daily interval: the notice
|
|
542
|
+
* is already known and a second request would buy nothing.
|
|
543
|
+
*/
|
|
544
|
+
declare const UP_TO_DATE_INTERVAL_MS: number;
|
|
518
545
|
/**
|
|
519
546
|
* How long a *failed* check is remembered.
|
|
520
547
|
*
|
|
@@ -725,6 +752,33 @@ declare function loadManifest(target: string): Manifest;
|
|
|
725
752
|
/** Renders a diff for a terminal. */
|
|
726
753
|
declare function renderDiffText(diff: ManifestDiff): string;
|
|
727
754
|
|
|
755
|
+
interface GitignoreUpdate {
|
|
756
|
+
/** The entries this call appended, in the order written. */
|
|
757
|
+
added: string[];
|
|
758
|
+
/** One sentence for the user when the file could not be updated; otherwise null. */
|
|
759
|
+
note: string | null;
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* Appends entries to the repository's `.gitignore`, and never fails a command over it.
|
|
763
|
+
*
|
|
764
|
+
* Two commands write files that a repository should not track — `init` (the snapshot and
|
|
765
|
+
* scratch directories) and `skill --install` (the agent skill) — and both need the same three
|
|
766
|
+
* properties: an entry is appended at most once even in a CRLF file, nothing is thrown, and a
|
|
767
|
+
* failure says exactly what to add by hand.
|
|
768
|
+
*
|
|
769
|
+
* A `.gitignore` that is a *directory* used to raise a raw `EISDIR` from the read, which aborted
|
|
770
|
+
* `init` after the config had already been written; the update is a convenience, so it is a note
|
|
771
|
+
* now and the command finishes what it promised.
|
|
772
|
+
*/
|
|
773
|
+
declare function appendGitignoreEntries(cwd: string, entries: readonly string[]): GitignoreUpdate;
|
|
774
|
+
/**
|
|
775
|
+
* A path as `.gitignore` spells it: forward slashes, relative to the repository root.
|
|
776
|
+
*
|
|
777
|
+
* `.gitignore` matching is slash-based on every platform, so a Windows install must not write
|
|
778
|
+
* `.claude\skills\…\SKILL.md` — git would read the backslashes as escapes.
|
|
779
|
+
*/
|
|
780
|
+
declare function gitignorePath(cwd: string, filePath: string): string;
|
|
781
|
+
|
|
728
782
|
interface PromptIO {
|
|
729
783
|
input: NodeJS.ReadStream;
|
|
730
784
|
output: NodeJS.WriteStream;
|
|
@@ -1054,6 +1108,10 @@ interface ChangedScopeRequest {
|
|
|
1054
1108
|
interface ChangedScope {
|
|
1055
1109
|
/** Repository-relative paths, POSIX separators. */
|
|
1056
1110
|
paths: ReadonlySet<string>;
|
|
1111
|
+
/** The subset selected by `--staged`, whose bytes must come from the index. */
|
|
1112
|
+
stagedPaths: ReadonlySet<string>;
|
|
1113
|
+
/** Paths whose staged change is a deletion; they have no index blob to read. */
|
|
1114
|
+
deletedPaths: ReadonlySet<string>;
|
|
1057
1115
|
/** How the set was produced, for the manifest and the summary line. */
|
|
1058
1116
|
detail: string;
|
|
1059
1117
|
}
|
|
@@ -1067,6 +1125,31 @@ interface ChangedScope {
|
|
|
1067
1125
|
*/
|
|
1068
1126
|
declare function resolveChangedScope(cwd: string, request: ChangedScopeRequest): ChangedScope;
|
|
1069
1127
|
|
|
1128
|
+
/** One `compilerOptions.paths` entry, with its targets already in repository-relative form. */
|
|
1129
|
+
interface TsconfigPathRule {
|
|
1130
|
+
pattern: string;
|
|
1131
|
+
targets: readonly string[];
|
|
1132
|
+
}
|
|
1133
|
+
/** The `baseUrl`/`paths` shape of the nearest `tsconfig.json`. */
|
|
1134
|
+
interface TsconfigPaths {
|
|
1135
|
+
/** Repository-relative base directory for non-relative specifiers, or null when unset. */
|
|
1136
|
+
baseUrl: string | null;
|
|
1137
|
+
paths: readonly TsconfigPathRule[];
|
|
1138
|
+
}
|
|
1139
|
+
/**
|
|
1140
|
+
* Reads `baseUrl` and `paths` from `<cwd>/tsconfig.json`, following `extends`.
|
|
1141
|
+
*
|
|
1142
|
+
* Type aliases — `@/lib/db`, `~/components/Button` — are the default in Next.js, Vite, Nuxt and
|
|
1143
|
+
* most large TypeScript repositories. `resolveSpecifier` only understood relative specifiers, so
|
|
1144
|
+
* every file importing through an alias was invisible to `--with-dependents`: the graph was
|
|
1145
|
+
* empty for exactly the files a change was most likely to break.
|
|
1146
|
+
*
|
|
1147
|
+
* `ts.parseJsonConfigFileContent` is used for the `extends` chain and for TypeScript's own
|
|
1148
|
+
* resolution of `baseUrl`, rather than a hand-written JSON reader that would disagree with the
|
|
1149
|
+
* compiler about comments and inherited fields. Failure is not fatal: a repository without a
|
|
1150
|
+
* readable tsconfig simply has no aliases, exactly as before.
|
|
1151
|
+
*/
|
|
1152
|
+
declare function tsconfigPathsFor(cwd: string): TsconfigPaths | null;
|
|
1070
1153
|
/** One-pass lookup tables for relative-import resolution.
|
|
1071
1154
|
*
|
|
1072
1155
|
* `resolveSpecifier` used to fall back to scanning every known file for every
|
|
@@ -1086,12 +1169,28 @@ interface ImportResolver {
|
|
|
1086
1169
|
byPathFolded: Map<string, string>;
|
|
1087
1170
|
byStem: Map<string, string>;
|
|
1088
1171
|
byStemFolded: Map<string, string>;
|
|
1172
|
+
/** Type aliases the graph could resolve, when a tsconfig was supplied. */
|
|
1173
|
+
tsconfig: TsconfigPaths | null;
|
|
1089
1174
|
}
|
|
1090
1175
|
/** Anything that knows its own repository-relative path; `FileEntry` is the common case. */
|
|
1091
1176
|
interface ImportCandidate {
|
|
1092
1177
|
relativePath: string;
|
|
1093
1178
|
}
|
|
1094
|
-
|
|
1179
|
+
/** Extra inputs to the resolver. */
|
|
1180
|
+
interface ImportResolverOptions {
|
|
1181
|
+
/**
|
|
1182
|
+
* Paths that changed but were not included — deleted modules.
|
|
1183
|
+
*
|
|
1184
|
+
* `resolveSpecifier` used to resolve against included files only, so when `a.ts` was deleted,
|
|
1185
|
+
* `import "./a"` in `b.ts` resolved to `null` and `b.ts` was not added as a dependent — the
|
|
1186
|
+
* one file the change was most likely to break. A tombstone makes the edge resolvable without
|
|
1187
|
+
* pretending the file is in the snapshot.
|
|
1188
|
+
*/
|
|
1189
|
+
extraPaths?: Iterable<string>;
|
|
1190
|
+
/** `baseUrl`/`paths` from the repository's tsconfig, when the caller read one. */
|
|
1191
|
+
tsconfig?: TsconfigPaths | null;
|
|
1192
|
+
}
|
|
1193
|
+
declare function buildImportResolver(files: readonly ImportCandidate[], options?: ImportResolverOptions): ImportResolver;
|
|
1095
1194
|
/** Best-effort resolution of a relative import to an included file. */
|
|
1096
1195
|
declare function resolveSpecifier(fromFile: string, specifier: string, resolver: ImportResolver): string | null;
|
|
1097
1196
|
/**
|
|
@@ -1157,8 +1256,6 @@ declare function isSkeletonizable(filePath: string): boolean;
|
|
|
1157
1256
|
*/
|
|
1158
1257
|
declare function generateSarifReport(manifest: Manifest, findings: readonly SecretFinding[], rules: readonly SecretRule[], toolVersion: string): string;
|
|
1159
1258
|
|
|
1160
|
-
declare const SCHEMA_VERSION = "3.0.0";
|
|
1161
|
-
|
|
1162
1259
|
interface GenerateOptions {
|
|
1163
1260
|
/** Compute the full manifest but write nothing to disk. */
|
|
1164
1261
|
dryRun?: boolean;
|
|
@@ -1207,4 +1304,4 @@ declare function generateSnapshot(configInput?: SnapshotConfig | ResolvedSnapsho
|
|
|
1207
1304
|
/** Promise-returning wrapper for consumers that prefer an async call site. */
|
|
1208
1305
|
declare function generateSnapshotAsync(configInput?: SnapshotConfig | ResolvedSnapshotConfig | null, options?: GenerateOptions): Promise<Manifest>;
|
|
1209
1306
|
|
|
1210
|
-
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, type UpdateCheckOptions, type UpdateNotice, ValidationResult, type WizardAnswers, anchorForPath, 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, 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, updateCommand, validateSnapshot, wrapLines };
|
|
1307
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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-
|
|
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-
|
|
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-KbJvBjmV.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-KbJvBjmV.js';
|
|
3
3
|
export { w as workerEntry } from './generate-worker-D_mUjgXw.js';
|
|
4
4
|
|
|
5
5
|
interface GitInfo {
|
|
@@ -41,6 +41,15 @@ interface CollectOptions {
|
|
|
41
41
|
* Defaults to the configured mode, then `auto`.
|
|
42
42
|
*/
|
|
43
43
|
discovery?: DiscoveryMode;
|
|
44
|
+
/**
|
|
45
|
+
* Paths to consider even when discovery does not list them.
|
|
46
|
+
*
|
|
47
|
+
* `--staged` selects index paths, and a path staged for addition can be absent from the
|
|
48
|
+
* working tree (an unstaged delete), while a staged deletion has no working-tree file at all.
|
|
49
|
+
* Both must still reach the same include/exclude/sensitive filters as every other candidate, so
|
|
50
|
+
* they are appended here rather than merged into the result by hand.
|
|
51
|
+
*/
|
|
52
|
+
extraPaths?: readonly string[];
|
|
44
53
|
}
|
|
45
54
|
interface CollectResult {
|
|
46
55
|
files: string[];
|
|
@@ -186,7 +195,9 @@ declare function supportsTypeScriptImports(): boolean;
|
|
|
186
195
|
* "unknown setting(s): secretRules" while the same key worked when passed in code).
|
|
187
196
|
*/
|
|
188
197
|
declare const CONFIG_KEYS: ReadonlySet<string>;
|
|
189
|
-
declare function loadConfigFileDetailed(cwd: string
|
|
198
|
+
declare function loadConfigFileDetailed(cwd: string, options?: {
|
|
199
|
+
allowExecutableConfig?: boolean;
|
|
200
|
+
}): Promise<ConfigLoadResult>;
|
|
190
201
|
declare function loadConfigFile(cwd: string): Promise<SnapshotConfig | null>;
|
|
191
202
|
/** Smallest usable part budget: a part header plus one section must fit. */
|
|
192
203
|
declare const MIN_MAX_PART_BYTES = 4096;
|
|
@@ -509,12 +520,28 @@ declare function validateSnapshot(configInput: ResolvedSnapshotConfig | Snapshot
|
|
|
509
520
|
* `package.json` carries the same version; `npm run verify` compares the two.
|
|
510
521
|
*/
|
|
511
522
|
declare const GENERATOR_NAME = "codebase-snapshot";
|
|
512
|
-
declare const GENERATOR_VERSION = "0.9.
|
|
523
|
+
declare const GENERATOR_VERSION = "0.9.18";
|
|
524
|
+
/**
|
|
525
|
+
* The manifest and ownership-marker schema this build writes and understands.
|
|
526
|
+
*
|
|
527
|
+
* Living here rather than in `index.ts` lets `validate` decide whether a manifest is the current
|
|
528
|
+
* schema without importing the barrel that imports `validate` — the same cycle that moved
|
|
529
|
+
* {@link GENERATOR_NAME} here. `index.ts` re-exports it, so the public surface is unchanged.
|
|
530
|
+
*/
|
|
531
|
+
declare const SCHEMA_VERSION = "3.0.0";
|
|
513
532
|
|
|
514
533
|
/** The one endpoint this package will ever request. */
|
|
515
534
|
declare const PACKAGE_LATEST_URL = "https://registry.npmjs.org/codebase-snapshot/latest";
|
|
516
|
-
/** A result
|
|
535
|
+
/** A result naming a newer release is trusted for a day: the upgrade command cannot change. */
|
|
517
536
|
declare const CHECK_INTERVAL_MS: number;
|
|
537
|
+
/**
|
|
538
|
+
* How long "you are already current" is trusted.
|
|
539
|
+
*
|
|
540
|
+
* That is the only answer a new release can invalidate. Re-asking it hourly means an active run
|
|
541
|
+
* notices a release within the hour, while a cached upgrade keeps the daily interval: the notice
|
|
542
|
+
* is already known and a second request would buy nothing.
|
|
543
|
+
*/
|
|
544
|
+
declare const UP_TO_DATE_INTERVAL_MS: number;
|
|
518
545
|
/**
|
|
519
546
|
* How long a *failed* check is remembered.
|
|
520
547
|
*
|
|
@@ -725,6 +752,33 @@ declare function loadManifest(target: string): Manifest;
|
|
|
725
752
|
/** Renders a diff for a terminal. */
|
|
726
753
|
declare function renderDiffText(diff: ManifestDiff): string;
|
|
727
754
|
|
|
755
|
+
interface GitignoreUpdate {
|
|
756
|
+
/** The entries this call appended, in the order written. */
|
|
757
|
+
added: string[];
|
|
758
|
+
/** One sentence for the user when the file could not be updated; otherwise null. */
|
|
759
|
+
note: string | null;
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* Appends entries to the repository's `.gitignore`, and never fails a command over it.
|
|
763
|
+
*
|
|
764
|
+
* Two commands write files that a repository should not track — `init` (the snapshot and
|
|
765
|
+
* scratch directories) and `skill --install` (the agent skill) — and both need the same three
|
|
766
|
+
* properties: an entry is appended at most once even in a CRLF file, nothing is thrown, and a
|
|
767
|
+
* failure says exactly what to add by hand.
|
|
768
|
+
*
|
|
769
|
+
* A `.gitignore` that is a *directory* used to raise a raw `EISDIR` from the read, which aborted
|
|
770
|
+
* `init` after the config had already been written; the update is a convenience, so it is a note
|
|
771
|
+
* now and the command finishes what it promised.
|
|
772
|
+
*/
|
|
773
|
+
declare function appendGitignoreEntries(cwd: string, entries: readonly string[]): GitignoreUpdate;
|
|
774
|
+
/**
|
|
775
|
+
* A path as `.gitignore` spells it: forward slashes, relative to the repository root.
|
|
776
|
+
*
|
|
777
|
+
* `.gitignore` matching is slash-based on every platform, so a Windows install must not write
|
|
778
|
+
* `.claude\skills\…\SKILL.md` — git would read the backslashes as escapes.
|
|
779
|
+
*/
|
|
780
|
+
declare function gitignorePath(cwd: string, filePath: string): string;
|
|
781
|
+
|
|
728
782
|
interface PromptIO {
|
|
729
783
|
input: NodeJS.ReadStream;
|
|
730
784
|
output: NodeJS.WriteStream;
|
|
@@ -1054,6 +1108,10 @@ interface ChangedScopeRequest {
|
|
|
1054
1108
|
interface ChangedScope {
|
|
1055
1109
|
/** Repository-relative paths, POSIX separators. */
|
|
1056
1110
|
paths: ReadonlySet<string>;
|
|
1111
|
+
/** The subset selected by `--staged`, whose bytes must come from the index. */
|
|
1112
|
+
stagedPaths: ReadonlySet<string>;
|
|
1113
|
+
/** Paths whose staged change is a deletion; they have no index blob to read. */
|
|
1114
|
+
deletedPaths: ReadonlySet<string>;
|
|
1057
1115
|
/** How the set was produced, for the manifest and the summary line. */
|
|
1058
1116
|
detail: string;
|
|
1059
1117
|
}
|
|
@@ -1067,6 +1125,31 @@ interface ChangedScope {
|
|
|
1067
1125
|
*/
|
|
1068
1126
|
declare function resolveChangedScope(cwd: string, request: ChangedScopeRequest): ChangedScope;
|
|
1069
1127
|
|
|
1128
|
+
/** One `compilerOptions.paths` entry, with its targets already in repository-relative form. */
|
|
1129
|
+
interface TsconfigPathRule {
|
|
1130
|
+
pattern: string;
|
|
1131
|
+
targets: readonly string[];
|
|
1132
|
+
}
|
|
1133
|
+
/** The `baseUrl`/`paths` shape of the nearest `tsconfig.json`. */
|
|
1134
|
+
interface TsconfigPaths {
|
|
1135
|
+
/** Repository-relative base directory for non-relative specifiers, or null when unset. */
|
|
1136
|
+
baseUrl: string | null;
|
|
1137
|
+
paths: readonly TsconfigPathRule[];
|
|
1138
|
+
}
|
|
1139
|
+
/**
|
|
1140
|
+
* Reads `baseUrl` and `paths` from `<cwd>/tsconfig.json`, following `extends`.
|
|
1141
|
+
*
|
|
1142
|
+
* Type aliases — `@/lib/db`, `~/components/Button` — are the default in Next.js, Vite, Nuxt and
|
|
1143
|
+
* most large TypeScript repositories. `resolveSpecifier` only understood relative specifiers, so
|
|
1144
|
+
* every file importing through an alias was invisible to `--with-dependents`: the graph was
|
|
1145
|
+
* empty for exactly the files a change was most likely to break.
|
|
1146
|
+
*
|
|
1147
|
+
* `ts.parseJsonConfigFileContent` is used for the `extends` chain and for TypeScript's own
|
|
1148
|
+
* resolution of `baseUrl`, rather than a hand-written JSON reader that would disagree with the
|
|
1149
|
+
* compiler about comments and inherited fields. Failure is not fatal: a repository without a
|
|
1150
|
+
* readable tsconfig simply has no aliases, exactly as before.
|
|
1151
|
+
*/
|
|
1152
|
+
declare function tsconfigPathsFor(cwd: string): TsconfigPaths | null;
|
|
1070
1153
|
/** One-pass lookup tables for relative-import resolution.
|
|
1071
1154
|
*
|
|
1072
1155
|
* `resolveSpecifier` used to fall back to scanning every known file for every
|
|
@@ -1086,12 +1169,28 @@ interface ImportResolver {
|
|
|
1086
1169
|
byPathFolded: Map<string, string>;
|
|
1087
1170
|
byStem: Map<string, string>;
|
|
1088
1171
|
byStemFolded: Map<string, string>;
|
|
1172
|
+
/** Type aliases the graph could resolve, when a tsconfig was supplied. */
|
|
1173
|
+
tsconfig: TsconfigPaths | null;
|
|
1089
1174
|
}
|
|
1090
1175
|
/** Anything that knows its own repository-relative path; `FileEntry` is the common case. */
|
|
1091
1176
|
interface ImportCandidate {
|
|
1092
1177
|
relativePath: string;
|
|
1093
1178
|
}
|
|
1094
|
-
|
|
1179
|
+
/** Extra inputs to the resolver. */
|
|
1180
|
+
interface ImportResolverOptions {
|
|
1181
|
+
/**
|
|
1182
|
+
* Paths that changed but were not included — deleted modules.
|
|
1183
|
+
*
|
|
1184
|
+
* `resolveSpecifier` used to resolve against included files only, so when `a.ts` was deleted,
|
|
1185
|
+
* `import "./a"` in `b.ts` resolved to `null` and `b.ts` was not added as a dependent — the
|
|
1186
|
+
* one file the change was most likely to break. A tombstone makes the edge resolvable without
|
|
1187
|
+
* pretending the file is in the snapshot.
|
|
1188
|
+
*/
|
|
1189
|
+
extraPaths?: Iterable<string>;
|
|
1190
|
+
/** `baseUrl`/`paths` from the repository's tsconfig, when the caller read one. */
|
|
1191
|
+
tsconfig?: TsconfigPaths | null;
|
|
1192
|
+
}
|
|
1193
|
+
declare function buildImportResolver(files: readonly ImportCandidate[], options?: ImportResolverOptions): ImportResolver;
|
|
1095
1194
|
/** Best-effort resolution of a relative import to an included file. */
|
|
1096
1195
|
declare function resolveSpecifier(fromFile: string, specifier: string, resolver: ImportResolver): string | null;
|
|
1097
1196
|
/**
|
|
@@ -1157,8 +1256,6 @@ declare function isSkeletonizable(filePath: string): boolean;
|
|
|
1157
1256
|
*/
|
|
1158
1257
|
declare function generateSarifReport(manifest: Manifest, findings: readonly SecretFinding[], rules: readonly SecretRule[], toolVersion: string): string;
|
|
1159
1258
|
|
|
1160
|
-
declare const SCHEMA_VERSION = "3.0.0";
|
|
1161
|
-
|
|
1162
1259
|
interface GenerateOptions {
|
|
1163
1260
|
/** Compute the full manifest but write nothing to disk. */
|
|
1164
1261
|
dryRun?: boolean;
|
|
@@ -1207,4 +1304,4 @@ declare function generateSnapshot(configInput?: SnapshotConfig | ResolvedSnapsho
|
|
|
1207
1304
|
/** Promise-returning wrapper for consumers that prefer an async call site. */
|
|
1208
1305
|
declare function generateSnapshotAsync(configInput?: SnapshotConfig | ResolvedSnapshotConfig | null, options?: GenerateOptions): Promise<Manifest>;
|
|
1209
1306
|
|
|
1210
|
-
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, type UpdateCheckOptions, type UpdateNotice, ValidationResult, type WizardAnswers, anchorForPath, 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, 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, updateCommand, validateSnapshot, wrapLines };
|
|
1307
|
+
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 };
|
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, anchorForPath, 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, 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, updateCommand, validateSnapshot, workerEntry, wrapLines } from './chunk-
|
|
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-ZXWAVHSZ.js';
|