codebase-snapshot 0.21.0 → 0.22.1
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 +28 -2
- package/README.md +35 -21
- package/SECURITY.md +2 -2
- package/dist/bin.js +2239 -1063
- package/dist/{chunk-TDPYLX7X.js → chunk-7AAXOTKS.js} +1499 -724
- package/dist/cli.cjs +2359 -1189
- package/dist/cli.d.cts +20 -2
- package/dist/cli.d.ts +20 -2
- package/dist/cli.js +556 -161
- package/dist/{generate-worker-D56JeXwx.d.cts → generate-worker-BUNhTXkj.d.cts} +1 -1
- package/dist/{generate-worker-DakxZs-l.d.ts → generate-worker-TUMvHlgz.d.ts} +1 -1
- package/dist/index.cjs +1474 -710
- package/dist/index.d.cts +182 -180
- package/dist/index.d.ts +182 -180
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +875 -346
- package/dist/mcp.d.cts +7 -4
- package/dist/mcp.d.ts +7 -4
- package/dist/mcp.js +1 -1
- package/dist/{types-D5XYzksd.d.ts → types-DQXKiaXk.d.cts} +1 -1
- package/dist/{types-D5XYzksd.d.cts → types-DQXKiaXk.d.ts} +1 -1
- package/docs/about.md +3 -2
- package/docs/agent.md +2 -1
- package/docs/cli.md +53 -26
- package/docs/contents.md +2 -0
- package/docs/deploy.md +10 -4
- package/docs/guard.md +197 -0
- package/docs/impact.md +3 -2
- package/docs/mcp-server-for-codebase.md +12 -4
- package/docs/mcp.md +9 -5
- package/docs/security-review.md +3 -2
- package/docs/troubleshooting.md +2 -2
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,184 @@
|
|
|
1
1
|
import * as node_crypto from 'node:crypto';
|
|
2
|
-
import { S as SecretRule, D as DiscoveryMode, a as SkipRecord, J as JsonSummary,
|
|
3
|
-
export { h as BudgetConfig, i as CoverageStatus, j as DeclarationSpan, k as FreshnessStatus, H as HooksConfig, I as ImportBinding, l as InclusionMode, m as IncompleteFile, n as IndexSourceKind, o as ManifestArtifact, p as ManifestConfigSnapshot, q as ManifestIndexes, r as ManifestTotals, s as Mode, O as OutputFormat, t as OwnerBrief, u as PartFileEntry, P as PromptTask, v as ReExportBinding, w as ResolvedArtifacts, x as ResolvedBudgets, y as SecretRuleInput, z as SkipReason, G as SummaryQuality, N as TruncationReason, Q as ValidationDrift } from './types-
|
|
2
|
+
import { E as EdgeProvenance, M as Manifest, T as TrustEnvelope, S as SecretRule, D as DiscoveryMode, a as SkipRecord, J as JsonSummary, b as MarkdownSummary, c as SourceSummary, d as SnapshotConfig, K as KindRule, L as LayerRule, R as ResolvedSnapshotConfig, B as ByteSize, C as CliOptions, e as PartMetadata, F as FileEntry, f as TextEncoding, g as SecretFinding, V as ValidationResult, A as ArtifactSelection } from './types-DQXKiaXk.cjs';
|
|
3
|
+
export { h as BudgetConfig, i as CoverageStatus, j as DeclarationSpan, k as FreshnessStatus, H as HooksConfig, I as ImportBinding, l as InclusionMode, m as IncompleteFile, n as IndexSourceKind, o as ManifestArtifact, p as ManifestConfigSnapshot, q as ManifestIndexes, r as ManifestTotals, s as Mode, O as OutputFormat, t as OwnerBrief, u as PartFileEntry, P as PromptTask, v as ReExportBinding, w as ResolvedArtifacts, x as ResolvedBudgets, y as SecretRuleInput, z as SkipReason, G as SummaryQuality, N as TruncationReason, Q as ValidationDrift } from './types-DQXKiaXk.cjs';
|
|
4
4
|
import ts from 'typescript';
|
|
5
|
-
export { w as workerEntry } from './generate-worker-
|
|
5
|
+
export { w as workerEntry } from './generate-worker-BUNhTXkj.cjs';
|
|
6
|
+
|
|
7
|
+
declare const DEFAULT_MAX_PROGRAM_FILES = 2500;
|
|
8
|
+
type PrecisionMode = "ts-semantic" | "syntactic-fallback";
|
|
9
|
+
interface TsProgramFile {
|
|
10
|
+
relativePath: string;
|
|
11
|
+
content?: string;
|
|
12
|
+
}
|
|
13
|
+
interface ScopedProgramOptions {
|
|
14
|
+
root: string;
|
|
15
|
+
files: readonly TsProgramFile[];
|
|
16
|
+
maxProgramFiles?: number;
|
|
17
|
+
timeoutMs?: number;
|
|
18
|
+
}
|
|
19
|
+
interface ScopedProgram {
|
|
20
|
+
root: string;
|
|
21
|
+
program: ts.Program | null;
|
|
22
|
+
checker: ts.TypeChecker | null;
|
|
23
|
+
fileCount: number;
|
|
24
|
+
precisionMode: PrecisionMode;
|
|
25
|
+
coverage: "complete" | "partial";
|
|
26
|
+
reasons: string[];
|
|
27
|
+
deadline: number;
|
|
28
|
+
}
|
|
29
|
+
interface SymbolReference {
|
|
30
|
+
path: string;
|
|
31
|
+
line: number;
|
|
32
|
+
column: number;
|
|
33
|
+
name: string;
|
|
34
|
+
isDefinition: boolean;
|
|
35
|
+
confidence: "ts-semantic";
|
|
36
|
+
}
|
|
37
|
+
interface SymbolReferencesOptions extends ScopedProgramOptions {
|
|
38
|
+
symbolName: string;
|
|
39
|
+
targetPath?: string;
|
|
40
|
+
maxResults?: number;
|
|
41
|
+
}
|
|
42
|
+
interface SymbolReferencesResult {
|
|
43
|
+
symbol: string;
|
|
44
|
+
targetPath?: string;
|
|
45
|
+
precisionMode: PrecisionMode;
|
|
46
|
+
coverage: "complete" | "partial";
|
|
47
|
+
truncated: boolean;
|
|
48
|
+
reasons: string[];
|
|
49
|
+
references: SymbolReference[];
|
|
50
|
+
}
|
|
51
|
+
interface PreciseCallersOptions extends ScopedProgramOptions {
|
|
52
|
+
changedFiles: readonly string[];
|
|
53
|
+
changedSymbols: Readonly<Record<string, readonly string[]>>;
|
|
54
|
+
}
|
|
55
|
+
interface PreciseCallersResult {
|
|
56
|
+
precisionMode: PrecisionMode;
|
|
57
|
+
coverage: "complete" | "partial";
|
|
58
|
+
reasons: string[];
|
|
59
|
+
callers: Array<{
|
|
60
|
+
path: string;
|
|
61
|
+
symbol: string;
|
|
62
|
+
references: SymbolReference[];
|
|
63
|
+
}>;
|
|
64
|
+
}
|
|
65
|
+
interface SymbolQueryTarget {
|
|
66
|
+
symbolName: string;
|
|
67
|
+
targetPath?: string;
|
|
68
|
+
}
|
|
69
|
+
interface MultiSymbolReferencesOptions extends ScopedProgramOptions {
|
|
70
|
+
targets: readonly SymbolQueryTarget[];
|
|
71
|
+
maxResults?: number;
|
|
72
|
+
}
|
|
73
|
+
interface MultiSymbolReferencesResult {
|
|
74
|
+
precisionMode: PrecisionMode;
|
|
75
|
+
coverage: "complete" | "partial";
|
|
76
|
+
truncated: boolean;
|
|
77
|
+
reasons: string[];
|
|
78
|
+
results: Array<{
|
|
79
|
+
symbol: string;
|
|
80
|
+
targetPath?: string;
|
|
81
|
+
references: SymbolReference[];
|
|
82
|
+
}>;
|
|
83
|
+
}
|
|
84
|
+
declare function createScopedProgram(options: ScopedProgramOptions): ScopedProgram;
|
|
85
|
+
declare function findMultipleSymbolReferences(options: MultiSymbolReferencesOptions): MultiSymbolReferencesResult;
|
|
86
|
+
declare function findSymbolReferences(options: SymbolReferencesOptions): SymbolReferencesResult;
|
|
87
|
+
declare function resolvePreciseChangedCallers(options: PreciseCallersOptions): PreciseCallersResult;
|
|
88
|
+
|
|
89
|
+
type ImpactBaseKind = "diff" | "paths";
|
|
90
|
+
type ImpactLevel = "direct-symbol" | "file-import" | "type-only" | "reexport" | "namespace-or-cjs";
|
|
91
|
+
interface ImpactBase {
|
|
92
|
+
kind: ImpactBaseKind;
|
|
93
|
+
value: string;
|
|
94
|
+
}
|
|
95
|
+
interface ImpactChangeRequest {
|
|
96
|
+
diff?: string;
|
|
97
|
+
paths?: readonly string[];
|
|
98
|
+
}
|
|
99
|
+
interface ImpactChanges {
|
|
100
|
+
base: ImpactBase;
|
|
101
|
+
paths: string[];
|
|
102
|
+
detail: string;
|
|
103
|
+
}
|
|
104
|
+
interface ImpactChangedFile {
|
|
105
|
+
path: string;
|
|
106
|
+
inSnapshot: boolean;
|
|
107
|
+
deleted: boolean;
|
|
108
|
+
reason?: string;
|
|
109
|
+
}
|
|
110
|
+
interface ImpactAffectedFile {
|
|
111
|
+
path: string;
|
|
112
|
+
distance: number;
|
|
113
|
+
via: string;
|
|
114
|
+
specifier: string;
|
|
115
|
+
confidence?: EdgeProvenance;
|
|
116
|
+
impactKind?: ImpactLevel;
|
|
117
|
+
matchedSymbols?: string[];
|
|
118
|
+
}
|
|
119
|
+
interface ImpactTestFile {
|
|
120
|
+
path: string;
|
|
121
|
+
covers: string[];
|
|
122
|
+
reason: "imports-changed" | "imports-affected";
|
|
123
|
+
}
|
|
124
|
+
interface ImpactUnresolvedImport {
|
|
125
|
+
path: string;
|
|
126
|
+
specifier: string;
|
|
127
|
+
}
|
|
128
|
+
interface ImpactRoute {
|
|
129
|
+
path: string;
|
|
130
|
+
methods: string[];
|
|
131
|
+
}
|
|
132
|
+
interface ImpactReport {
|
|
133
|
+
schemaVersion: 1;
|
|
134
|
+
base: ImpactBase;
|
|
135
|
+
snapshot: {
|
|
136
|
+
manifest: string;
|
|
137
|
+
fingerprint: string;
|
|
138
|
+
generatedAt: string;
|
|
139
|
+
git: {
|
|
140
|
+
commit: string;
|
|
141
|
+
isDirty: boolean;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
changed: ImpactChangedFile[];
|
|
145
|
+
affected: ImpactAffectedFile[];
|
|
146
|
+
tests: ImpactTestFile[];
|
|
147
|
+
unresolved: ImpactUnresolvedImport[];
|
|
148
|
+
routesAffected?: ImpactRoute[];
|
|
149
|
+
prunedByBarrel?: number;
|
|
150
|
+
cycles?: string[][];
|
|
151
|
+
imports?: Record<string, string[]>;
|
|
152
|
+
precise?: {
|
|
153
|
+
references: SymbolReference[];
|
|
154
|
+
coverage: "complete" | "partial";
|
|
155
|
+
reasons: string[];
|
|
156
|
+
};
|
|
157
|
+
trust: TrustEnvelope;
|
|
158
|
+
truncated: boolean;
|
|
159
|
+
limits: {
|
|
160
|
+
depth: number;
|
|
161
|
+
maxResults: number;
|
|
162
|
+
affected: number;
|
|
163
|
+
};
|
|
164
|
+
warnings: string[];
|
|
165
|
+
}
|
|
166
|
+
interface ImpactInput {
|
|
167
|
+
manifest: Manifest;
|
|
168
|
+
cwd: string;
|
|
169
|
+
changes: ImpactChanges;
|
|
170
|
+
manifestPath?: string;
|
|
171
|
+
depth?: number;
|
|
172
|
+
maxResults?: number;
|
|
173
|
+
symbols?: readonly string[];
|
|
174
|
+
changedLines?: ReadonlyMap<string, Array<[number, number]>>;
|
|
175
|
+
includeImports?: boolean;
|
|
176
|
+
includeCycles?: boolean;
|
|
177
|
+
trust?: TrustEnvelope;
|
|
178
|
+
}
|
|
179
|
+
declare function resolveImpactChanges(cwd: string, request: ImpactChangeRequest): ImpactChanges;
|
|
180
|
+
declare function computeImpact(input: ImpactInput): ImpactReport;
|
|
181
|
+
declare function renderImpactText(report: ImpactReport): string;
|
|
6
182
|
|
|
7
183
|
interface GitInfo {
|
|
8
184
|
branch: string;
|
|
@@ -566,7 +742,7 @@ declare function validateSnapshot(configInput: ResolvedSnapshotConfig | Snapshot
|
|
|
566
742
|
* `package.json` carries the same version; `npm run verify` compares the two.
|
|
567
743
|
*/
|
|
568
744
|
declare const GENERATOR_NAME = "codebase-snapshot";
|
|
569
|
-
declare const GENERATOR_VERSION = "0.
|
|
745
|
+
declare const GENERATOR_VERSION = "0.22.1";
|
|
570
746
|
/**
|
|
571
747
|
* The manifest and ownership-marker schema this build writes and understands.
|
|
572
748
|
*
|
|
@@ -1000,182 +1176,6 @@ declare function loadManifest(target: string): Manifest;
|
|
|
1000
1176
|
/** Renders a diff for a terminal. */
|
|
1001
1177
|
declare function renderDiffText(diff: ManifestDiff): string;
|
|
1002
1178
|
|
|
1003
|
-
declare const DEFAULT_MAX_PROGRAM_FILES = 2500;
|
|
1004
|
-
type PrecisionMode = "ts-semantic" | "syntactic-fallback";
|
|
1005
|
-
interface TsProgramFile {
|
|
1006
|
-
relativePath: string;
|
|
1007
|
-
content?: string;
|
|
1008
|
-
}
|
|
1009
|
-
interface ScopedProgramOptions {
|
|
1010
|
-
root: string;
|
|
1011
|
-
files: readonly TsProgramFile[];
|
|
1012
|
-
maxProgramFiles?: number;
|
|
1013
|
-
timeoutMs?: number;
|
|
1014
|
-
}
|
|
1015
|
-
interface ScopedProgram {
|
|
1016
|
-
root: string;
|
|
1017
|
-
program: ts.Program | null;
|
|
1018
|
-
checker: ts.TypeChecker | null;
|
|
1019
|
-
fileCount: number;
|
|
1020
|
-
precisionMode: PrecisionMode;
|
|
1021
|
-
coverage: "complete" | "partial";
|
|
1022
|
-
reasons: string[];
|
|
1023
|
-
deadline: number;
|
|
1024
|
-
}
|
|
1025
|
-
interface SymbolReference {
|
|
1026
|
-
path: string;
|
|
1027
|
-
line: number;
|
|
1028
|
-
column: number;
|
|
1029
|
-
name: string;
|
|
1030
|
-
isDefinition: boolean;
|
|
1031
|
-
confidence: "ts-semantic";
|
|
1032
|
-
}
|
|
1033
|
-
interface SymbolReferencesOptions extends ScopedProgramOptions {
|
|
1034
|
-
symbolName: string;
|
|
1035
|
-
targetPath?: string;
|
|
1036
|
-
maxResults?: number;
|
|
1037
|
-
}
|
|
1038
|
-
interface SymbolReferencesResult {
|
|
1039
|
-
symbol: string;
|
|
1040
|
-
targetPath?: string;
|
|
1041
|
-
precisionMode: PrecisionMode;
|
|
1042
|
-
coverage: "complete" | "partial";
|
|
1043
|
-
truncated: boolean;
|
|
1044
|
-
reasons: string[];
|
|
1045
|
-
references: SymbolReference[];
|
|
1046
|
-
}
|
|
1047
|
-
interface PreciseCallersOptions extends ScopedProgramOptions {
|
|
1048
|
-
changedFiles: readonly string[];
|
|
1049
|
-
changedSymbols: Readonly<Record<string, readonly string[]>>;
|
|
1050
|
-
}
|
|
1051
|
-
interface PreciseCallersResult {
|
|
1052
|
-
precisionMode: PrecisionMode;
|
|
1053
|
-
coverage: "complete" | "partial";
|
|
1054
|
-
reasons: string[];
|
|
1055
|
-
callers: Array<{
|
|
1056
|
-
path: string;
|
|
1057
|
-
symbol: string;
|
|
1058
|
-
references: SymbolReference[];
|
|
1059
|
-
}>;
|
|
1060
|
-
}
|
|
1061
|
-
interface SymbolQueryTarget {
|
|
1062
|
-
symbolName: string;
|
|
1063
|
-
targetPath?: string;
|
|
1064
|
-
}
|
|
1065
|
-
interface MultiSymbolReferencesOptions extends ScopedProgramOptions {
|
|
1066
|
-
targets: readonly SymbolQueryTarget[];
|
|
1067
|
-
maxResults?: number;
|
|
1068
|
-
}
|
|
1069
|
-
interface MultiSymbolReferencesResult {
|
|
1070
|
-
precisionMode: PrecisionMode;
|
|
1071
|
-
coverage: "complete" | "partial";
|
|
1072
|
-
truncated: boolean;
|
|
1073
|
-
reasons: string[];
|
|
1074
|
-
results: Array<{
|
|
1075
|
-
symbol: string;
|
|
1076
|
-
targetPath?: string;
|
|
1077
|
-
references: SymbolReference[];
|
|
1078
|
-
}>;
|
|
1079
|
-
}
|
|
1080
|
-
declare function createScopedProgram(options: ScopedProgramOptions): ScopedProgram;
|
|
1081
|
-
declare function findMultipleSymbolReferences(options: MultiSymbolReferencesOptions): MultiSymbolReferencesResult;
|
|
1082
|
-
declare function findSymbolReferences(options: SymbolReferencesOptions): SymbolReferencesResult;
|
|
1083
|
-
declare function resolvePreciseChangedCallers(options: PreciseCallersOptions): PreciseCallersResult;
|
|
1084
|
-
|
|
1085
|
-
type ImpactBaseKind = "diff" | "paths";
|
|
1086
|
-
type ImpactLevel = "direct-symbol" | "file-import" | "type-only" | "reexport" | "namespace-or-cjs";
|
|
1087
|
-
interface ImpactBase {
|
|
1088
|
-
kind: ImpactBaseKind;
|
|
1089
|
-
value: string;
|
|
1090
|
-
}
|
|
1091
|
-
interface ImpactChangeRequest {
|
|
1092
|
-
diff?: string;
|
|
1093
|
-
paths?: readonly string[];
|
|
1094
|
-
}
|
|
1095
|
-
interface ImpactChanges {
|
|
1096
|
-
base: ImpactBase;
|
|
1097
|
-
paths: string[];
|
|
1098
|
-
detail: string;
|
|
1099
|
-
}
|
|
1100
|
-
interface ImpactChangedFile {
|
|
1101
|
-
path: string;
|
|
1102
|
-
inSnapshot: boolean;
|
|
1103
|
-
deleted: boolean;
|
|
1104
|
-
reason?: string;
|
|
1105
|
-
}
|
|
1106
|
-
interface ImpactAffectedFile {
|
|
1107
|
-
path: string;
|
|
1108
|
-
distance: number;
|
|
1109
|
-
via: string;
|
|
1110
|
-
specifier: string;
|
|
1111
|
-
confidence?: EdgeProvenance;
|
|
1112
|
-
impactKind?: ImpactLevel;
|
|
1113
|
-
matchedSymbols?: string[];
|
|
1114
|
-
}
|
|
1115
|
-
interface ImpactTestFile {
|
|
1116
|
-
path: string;
|
|
1117
|
-
covers: string[];
|
|
1118
|
-
reason: "imports-changed" | "imports-affected";
|
|
1119
|
-
}
|
|
1120
|
-
interface ImpactUnresolvedImport {
|
|
1121
|
-
path: string;
|
|
1122
|
-
specifier: string;
|
|
1123
|
-
}
|
|
1124
|
-
interface ImpactRoute {
|
|
1125
|
-
path: string;
|
|
1126
|
-
methods: string[];
|
|
1127
|
-
}
|
|
1128
|
-
interface ImpactReport {
|
|
1129
|
-
schemaVersion: 1;
|
|
1130
|
-
base: ImpactBase;
|
|
1131
|
-
snapshot: {
|
|
1132
|
-
manifest: string;
|
|
1133
|
-
fingerprint: string;
|
|
1134
|
-
generatedAt: string;
|
|
1135
|
-
git: {
|
|
1136
|
-
commit: string;
|
|
1137
|
-
isDirty: boolean;
|
|
1138
|
-
};
|
|
1139
|
-
};
|
|
1140
|
-
changed: ImpactChangedFile[];
|
|
1141
|
-
affected: ImpactAffectedFile[];
|
|
1142
|
-
tests: ImpactTestFile[];
|
|
1143
|
-
unresolved: ImpactUnresolvedImport[];
|
|
1144
|
-
routesAffected?: ImpactRoute[];
|
|
1145
|
-
prunedByBarrel?: number;
|
|
1146
|
-
cycles?: string[][];
|
|
1147
|
-
imports?: Record<string, string[]>;
|
|
1148
|
-
precise?: {
|
|
1149
|
-
references: SymbolReference[];
|
|
1150
|
-
coverage: "complete" | "partial";
|
|
1151
|
-
reasons: string[];
|
|
1152
|
-
};
|
|
1153
|
-
trust: TrustEnvelope;
|
|
1154
|
-
truncated: boolean;
|
|
1155
|
-
limits: {
|
|
1156
|
-
depth: number;
|
|
1157
|
-
maxResults: number;
|
|
1158
|
-
affected: number;
|
|
1159
|
-
};
|
|
1160
|
-
warnings: string[];
|
|
1161
|
-
}
|
|
1162
|
-
interface ImpactInput {
|
|
1163
|
-
manifest: Manifest;
|
|
1164
|
-
cwd: string;
|
|
1165
|
-
changes: ImpactChanges;
|
|
1166
|
-
manifestPath?: string;
|
|
1167
|
-
depth?: number;
|
|
1168
|
-
maxResults?: number;
|
|
1169
|
-
symbols?: readonly string[];
|
|
1170
|
-
changedLines?: ReadonlyMap<string, Array<[number, number]>>;
|
|
1171
|
-
includeImports?: boolean;
|
|
1172
|
-
includeCycles?: boolean;
|
|
1173
|
-
trust?: TrustEnvelope;
|
|
1174
|
-
}
|
|
1175
|
-
declare function resolveImpactChanges(cwd: string, request: ImpactChangeRequest): ImpactChanges;
|
|
1176
|
-
declare function computeImpact(input: ImpactInput): ImpactReport;
|
|
1177
|
-
declare function renderImpactText(report: ImpactReport): string;
|
|
1178
|
-
|
|
1179
1179
|
interface GitignoreUpdate {
|
|
1180
1180
|
/** The entries this call appended, in the order written. */
|
|
1181
1181
|
added: string[];
|
|
@@ -1669,6 +1669,8 @@ interface BriefInput {
|
|
|
1669
1669
|
question?: string;
|
|
1670
1670
|
changes?: ImpactChanges;
|
|
1671
1671
|
diff?: string;
|
|
1672
|
+
/** True when the caller already redacted the diff with its source file types. */
|
|
1673
|
+
diffIsRedacted?: boolean;
|
|
1672
1674
|
diffNotes?: string[];
|
|
1673
1675
|
readBody: (relativePath: string) => string | null;
|
|
1674
1676
|
secretRules: readonly SecretRule[];
|