codebase-snapshot 0.9.16 → 0.9.17
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 +64 -0
- package/README.md +1 -1
- package/SECURITY.md +18 -6
- package/dist/bin.js +2019 -619
- package/dist/{chunk-6TRFLA7N.js → chunk-IIP43I7C.js} +1755 -443
- package/dist/{chunk-WIL536QD.js → chunk-S4367K5X.js} +97 -24
- package/dist/cli.cjs +2001 -605
- package/dist/cli.d.cts +1 -11
- package/dist/cli.d.ts +1 -11
- package/dist/cli.js +16 -5
- package/dist/index.cjs +1748 -437
- package/dist/index.d.cts +97 -8
- package/dist/index.d.ts +97 -8
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +1760 -340
- 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 +14 -9
- 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/package.json +3 -2
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,7 +520,15 @@ 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.17";
|
|
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";
|
|
@@ -725,6 +744,33 @@ declare function loadManifest(target: string): Manifest;
|
|
|
725
744
|
/** Renders a diff for a terminal. */
|
|
726
745
|
declare function renderDiffText(diff: ManifestDiff): string;
|
|
727
746
|
|
|
747
|
+
interface GitignoreUpdate {
|
|
748
|
+
/** The entries this call appended, in the order written. */
|
|
749
|
+
added: string[];
|
|
750
|
+
/** One sentence for the user when the file could not be updated; otherwise null. */
|
|
751
|
+
note: string | null;
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Appends entries to the repository's `.gitignore`, and never fails a command over it.
|
|
755
|
+
*
|
|
756
|
+
* Two commands write files that a repository should not track — `init` (the snapshot and
|
|
757
|
+
* scratch directories) and `skill --install` (the agent skill) — and both need the same three
|
|
758
|
+
* properties: an entry is appended at most once even in a CRLF file, nothing is thrown, and a
|
|
759
|
+
* failure says exactly what to add by hand.
|
|
760
|
+
*
|
|
761
|
+
* A `.gitignore` that is a *directory* used to raise a raw `EISDIR` from the read, which aborted
|
|
762
|
+
* `init` after the config had already been written; the update is a convenience, so it is a note
|
|
763
|
+
* now and the command finishes what it promised.
|
|
764
|
+
*/
|
|
765
|
+
declare function appendGitignoreEntries(cwd: string, entries: readonly string[]): GitignoreUpdate;
|
|
766
|
+
/**
|
|
767
|
+
* A path as `.gitignore` spells it: forward slashes, relative to the repository root.
|
|
768
|
+
*
|
|
769
|
+
* `.gitignore` matching is slash-based on every platform, so a Windows install must not write
|
|
770
|
+
* `.claude\skills\…\SKILL.md` — git would read the backslashes as escapes.
|
|
771
|
+
*/
|
|
772
|
+
declare function gitignorePath(cwd: string, filePath: string): string;
|
|
773
|
+
|
|
728
774
|
interface PromptIO {
|
|
729
775
|
input: NodeJS.ReadStream;
|
|
730
776
|
output: NodeJS.WriteStream;
|
|
@@ -1054,6 +1100,10 @@ interface ChangedScopeRequest {
|
|
|
1054
1100
|
interface ChangedScope {
|
|
1055
1101
|
/** Repository-relative paths, POSIX separators. */
|
|
1056
1102
|
paths: ReadonlySet<string>;
|
|
1103
|
+
/** The subset selected by `--staged`, whose bytes must come from the index. */
|
|
1104
|
+
stagedPaths: ReadonlySet<string>;
|
|
1105
|
+
/** Paths whose staged change is a deletion; they have no index blob to read. */
|
|
1106
|
+
deletedPaths: ReadonlySet<string>;
|
|
1057
1107
|
/** How the set was produced, for the manifest and the summary line. */
|
|
1058
1108
|
detail: string;
|
|
1059
1109
|
}
|
|
@@ -1067,6 +1117,31 @@ interface ChangedScope {
|
|
|
1067
1117
|
*/
|
|
1068
1118
|
declare function resolveChangedScope(cwd: string, request: ChangedScopeRequest): ChangedScope;
|
|
1069
1119
|
|
|
1120
|
+
/** One `compilerOptions.paths` entry, with its targets already in repository-relative form. */
|
|
1121
|
+
interface TsconfigPathRule {
|
|
1122
|
+
pattern: string;
|
|
1123
|
+
targets: readonly string[];
|
|
1124
|
+
}
|
|
1125
|
+
/** The `baseUrl`/`paths` shape of the nearest `tsconfig.json`. */
|
|
1126
|
+
interface TsconfigPaths {
|
|
1127
|
+
/** Repository-relative base directory for non-relative specifiers, or null when unset. */
|
|
1128
|
+
baseUrl: string | null;
|
|
1129
|
+
paths: readonly TsconfigPathRule[];
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* Reads `baseUrl` and `paths` from `<cwd>/tsconfig.json`, following `extends`.
|
|
1133
|
+
*
|
|
1134
|
+
* Type aliases — `@/lib/db`, `~/components/Button` — are the default in Next.js, Vite, Nuxt and
|
|
1135
|
+
* most large TypeScript repositories. `resolveSpecifier` only understood relative specifiers, so
|
|
1136
|
+
* every file importing through an alias was invisible to `--with-dependents`: the graph was
|
|
1137
|
+
* empty for exactly the files a change was most likely to break.
|
|
1138
|
+
*
|
|
1139
|
+
* `ts.parseJsonConfigFileContent` is used for the `extends` chain and for TypeScript's own
|
|
1140
|
+
* resolution of `baseUrl`, rather than a hand-written JSON reader that would disagree with the
|
|
1141
|
+
* compiler about comments and inherited fields. Failure is not fatal: a repository without a
|
|
1142
|
+
* readable tsconfig simply has no aliases, exactly as before.
|
|
1143
|
+
*/
|
|
1144
|
+
declare function tsconfigPathsFor(cwd: string): TsconfigPaths | null;
|
|
1070
1145
|
/** One-pass lookup tables for relative-import resolution.
|
|
1071
1146
|
*
|
|
1072
1147
|
* `resolveSpecifier` used to fall back to scanning every known file for every
|
|
@@ -1086,12 +1161,28 @@ interface ImportResolver {
|
|
|
1086
1161
|
byPathFolded: Map<string, string>;
|
|
1087
1162
|
byStem: Map<string, string>;
|
|
1088
1163
|
byStemFolded: Map<string, string>;
|
|
1164
|
+
/** Type aliases the graph could resolve, when a tsconfig was supplied. */
|
|
1165
|
+
tsconfig: TsconfigPaths | null;
|
|
1089
1166
|
}
|
|
1090
1167
|
/** Anything that knows its own repository-relative path; `FileEntry` is the common case. */
|
|
1091
1168
|
interface ImportCandidate {
|
|
1092
1169
|
relativePath: string;
|
|
1093
1170
|
}
|
|
1094
|
-
|
|
1171
|
+
/** Extra inputs to the resolver. */
|
|
1172
|
+
interface ImportResolverOptions {
|
|
1173
|
+
/**
|
|
1174
|
+
* Paths that changed but were not included — deleted modules.
|
|
1175
|
+
*
|
|
1176
|
+
* `resolveSpecifier` used to resolve against included files only, so when `a.ts` was deleted,
|
|
1177
|
+
* `import "./a"` in `b.ts` resolved to `null` and `b.ts` was not added as a dependent — the
|
|
1178
|
+
* one file the change was most likely to break. A tombstone makes the edge resolvable without
|
|
1179
|
+
* pretending the file is in the snapshot.
|
|
1180
|
+
*/
|
|
1181
|
+
extraPaths?: Iterable<string>;
|
|
1182
|
+
/** `baseUrl`/`paths` from the repository's tsconfig, when the caller read one. */
|
|
1183
|
+
tsconfig?: TsconfigPaths | null;
|
|
1184
|
+
}
|
|
1185
|
+
declare function buildImportResolver(files: readonly ImportCandidate[], options?: ImportResolverOptions): ImportResolver;
|
|
1095
1186
|
/** Best-effort resolution of a relative import to an included file. */
|
|
1096
1187
|
declare function resolveSpecifier(fromFile: string, specifier: string, resolver: ImportResolver): string | null;
|
|
1097
1188
|
/**
|
|
@@ -1157,8 +1248,6 @@ declare function isSkeletonizable(filePath: string): boolean;
|
|
|
1157
1248
|
*/
|
|
1158
1249
|
declare function generateSarifReport(manifest: Manifest, findings: readonly SecretFinding[], rules: readonly SecretRule[], toolVersion: string): string;
|
|
1159
1250
|
|
|
1160
|
-
declare const SCHEMA_VERSION = "3.0.0";
|
|
1161
|
-
|
|
1162
1251
|
interface GenerateOptions {
|
|
1163
1252
|
/** Compute the full manifest but write nothing to disk. */
|
|
1164
1253
|
dryRun?: boolean;
|
|
@@ -1207,4 +1296,4 @@ declare function generateSnapshot(configInput?: SnapshotConfig | ResolvedSnapsho
|
|
|
1207
1296
|
/** Promise-returning wrapper for consumers that prefer an async call site. */
|
|
1208
1297
|
declare function generateSnapshotAsync(configInput?: SnapshotConfig | ResolvedSnapshotConfig | null, options?: GenerateOptions): Promise<Manifest>;
|
|
1209
1298
|
|
|
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 };
|
|
1299
|
+
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, 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,7 +520,15 @@ 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.17";
|
|
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";
|
|
@@ -725,6 +744,33 @@ declare function loadManifest(target: string): Manifest;
|
|
|
725
744
|
/** Renders a diff for a terminal. */
|
|
726
745
|
declare function renderDiffText(diff: ManifestDiff): string;
|
|
727
746
|
|
|
747
|
+
interface GitignoreUpdate {
|
|
748
|
+
/** The entries this call appended, in the order written. */
|
|
749
|
+
added: string[];
|
|
750
|
+
/** One sentence for the user when the file could not be updated; otherwise null. */
|
|
751
|
+
note: string | null;
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Appends entries to the repository's `.gitignore`, and never fails a command over it.
|
|
755
|
+
*
|
|
756
|
+
* Two commands write files that a repository should not track — `init` (the snapshot and
|
|
757
|
+
* scratch directories) and `skill --install` (the agent skill) — and both need the same three
|
|
758
|
+
* properties: an entry is appended at most once even in a CRLF file, nothing is thrown, and a
|
|
759
|
+
* failure says exactly what to add by hand.
|
|
760
|
+
*
|
|
761
|
+
* A `.gitignore` that is a *directory* used to raise a raw `EISDIR` from the read, which aborted
|
|
762
|
+
* `init` after the config had already been written; the update is a convenience, so it is a note
|
|
763
|
+
* now and the command finishes what it promised.
|
|
764
|
+
*/
|
|
765
|
+
declare function appendGitignoreEntries(cwd: string, entries: readonly string[]): GitignoreUpdate;
|
|
766
|
+
/**
|
|
767
|
+
* A path as `.gitignore` spells it: forward slashes, relative to the repository root.
|
|
768
|
+
*
|
|
769
|
+
* `.gitignore` matching is slash-based on every platform, so a Windows install must not write
|
|
770
|
+
* `.claude\skills\…\SKILL.md` — git would read the backslashes as escapes.
|
|
771
|
+
*/
|
|
772
|
+
declare function gitignorePath(cwd: string, filePath: string): string;
|
|
773
|
+
|
|
728
774
|
interface PromptIO {
|
|
729
775
|
input: NodeJS.ReadStream;
|
|
730
776
|
output: NodeJS.WriteStream;
|
|
@@ -1054,6 +1100,10 @@ interface ChangedScopeRequest {
|
|
|
1054
1100
|
interface ChangedScope {
|
|
1055
1101
|
/** Repository-relative paths, POSIX separators. */
|
|
1056
1102
|
paths: ReadonlySet<string>;
|
|
1103
|
+
/** The subset selected by `--staged`, whose bytes must come from the index. */
|
|
1104
|
+
stagedPaths: ReadonlySet<string>;
|
|
1105
|
+
/** Paths whose staged change is a deletion; they have no index blob to read. */
|
|
1106
|
+
deletedPaths: ReadonlySet<string>;
|
|
1057
1107
|
/** How the set was produced, for the manifest and the summary line. */
|
|
1058
1108
|
detail: string;
|
|
1059
1109
|
}
|
|
@@ -1067,6 +1117,31 @@ interface ChangedScope {
|
|
|
1067
1117
|
*/
|
|
1068
1118
|
declare function resolveChangedScope(cwd: string, request: ChangedScopeRequest): ChangedScope;
|
|
1069
1119
|
|
|
1120
|
+
/** One `compilerOptions.paths` entry, with its targets already in repository-relative form. */
|
|
1121
|
+
interface TsconfigPathRule {
|
|
1122
|
+
pattern: string;
|
|
1123
|
+
targets: readonly string[];
|
|
1124
|
+
}
|
|
1125
|
+
/** The `baseUrl`/`paths` shape of the nearest `tsconfig.json`. */
|
|
1126
|
+
interface TsconfigPaths {
|
|
1127
|
+
/** Repository-relative base directory for non-relative specifiers, or null when unset. */
|
|
1128
|
+
baseUrl: string | null;
|
|
1129
|
+
paths: readonly TsconfigPathRule[];
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* Reads `baseUrl` and `paths` from `<cwd>/tsconfig.json`, following `extends`.
|
|
1133
|
+
*
|
|
1134
|
+
* Type aliases — `@/lib/db`, `~/components/Button` — are the default in Next.js, Vite, Nuxt and
|
|
1135
|
+
* most large TypeScript repositories. `resolveSpecifier` only understood relative specifiers, so
|
|
1136
|
+
* every file importing through an alias was invisible to `--with-dependents`: the graph was
|
|
1137
|
+
* empty for exactly the files a change was most likely to break.
|
|
1138
|
+
*
|
|
1139
|
+
* `ts.parseJsonConfigFileContent` is used for the `extends` chain and for TypeScript's own
|
|
1140
|
+
* resolution of `baseUrl`, rather than a hand-written JSON reader that would disagree with the
|
|
1141
|
+
* compiler about comments and inherited fields. Failure is not fatal: a repository without a
|
|
1142
|
+
* readable tsconfig simply has no aliases, exactly as before.
|
|
1143
|
+
*/
|
|
1144
|
+
declare function tsconfigPathsFor(cwd: string): TsconfigPaths | null;
|
|
1070
1145
|
/** One-pass lookup tables for relative-import resolution.
|
|
1071
1146
|
*
|
|
1072
1147
|
* `resolveSpecifier` used to fall back to scanning every known file for every
|
|
@@ -1086,12 +1161,28 @@ interface ImportResolver {
|
|
|
1086
1161
|
byPathFolded: Map<string, string>;
|
|
1087
1162
|
byStem: Map<string, string>;
|
|
1088
1163
|
byStemFolded: Map<string, string>;
|
|
1164
|
+
/** Type aliases the graph could resolve, when a tsconfig was supplied. */
|
|
1165
|
+
tsconfig: TsconfigPaths | null;
|
|
1089
1166
|
}
|
|
1090
1167
|
/** Anything that knows its own repository-relative path; `FileEntry` is the common case. */
|
|
1091
1168
|
interface ImportCandidate {
|
|
1092
1169
|
relativePath: string;
|
|
1093
1170
|
}
|
|
1094
|
-
|
|
1171
|
+
/** Extra inputs to the resolver. */
|
|
1172
|
+
interface ImportResolverOptions {
|
|
1173
|
+
/**
|
|
1174
|
+
* Paths that changed but were not included — deleted modules.
|
|
1175
|
+
*
|
|
1176
|
+
* `resolveSpecifier` used to resolve against included files only, so when `a.ts` was deleted,
|
|
1177
|
+
* `import "./a"` in `b.ts` resolved to `null` and `b.ts` was not added as a dependent — the
|
|
1178
|
+
* one file the change was most likely to break. A tombstone makes the edge resolvable without
|
|
1179
|
+
* pretending the file is in the snapshot.
|
|
1180
|
+
*/
|
|
1181
|
+
extraPaths?: Iterable<string>;
|
|
1182
|
+
/** `baseUrl`/`paths` from the repository's tsconfig, when the caller read one. */
|
|
1183
|
+
tsconfig?: TsconfigPaths | null;
|
|
1184
|
+
}
|
|
1185
|
+
declare function buildImportResolver(files: readonly ImportCandidate[], options?: ImportResolverOptions): ImportResolver;
|
|
1095
1186
|
/** Best-effort resolution of a relative import to an included file. */
|
|
1096
1187
|
declare function resolveSpecifier(fromFile: string, specifier: string, resolver: ImportResolver): string | null;
|
|
1097
1188
|
/**
|
|
@@ -1157,8 +1248,6 @@ declare function isSkeletonizable(filePath: string): boolean;
|
|
|
1157
1248
|
*/
|
|
1158
1249
|
declare function generateSarifReport(manifest: Manifest, findings: readonly SecretFinding[], rules: readonly SecretRule[], toolVersion: string): string;
|
|
1159
1250
|
|
|
1160
|
-
declare const SCHEMA_VERSION = "3.0.0";
|
|
1161
|
-
|
|
1162
1251
|
interface GenerateOptions {
|
|
1163
1252
|
/** Compute the full manifest but write nothing to disk. */
|
|
1164
1253
|
dryRun?: boolean;
|
|
@@ -1207,4 +1296,4 @@ declare function generateSnapshot(configInput?: SnapshotConfig | ResolvedSnapsho
|
|
|
1207
1296
|
/** Promise-returning wrapper for consumers that prefer an async call site. */
|
|
1208
1297
|
declare function generateSnapshotAsync(configInput?: SnapshotConfig | ResolvedSnapshotConfig | null, options?: GenerateOptions): Promise<Manifest>;
|
|
1209
1298
|
|
|
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 };
|
|
1299
|
+
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, 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, 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-IIP43I7C.js';
|