@skastr0/quartz-engine 0.2.0
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/LICENSE +21 -0
- package/dist/analyzer.d.ts +48 -0
- package/dist/context.d.ts +21 -0
- package/dist/contracts.d.ts +440 -0
- package/dist/diagnostics.d.ts +3 -0
- package/dist/discovery.d.ts +2 -0
- package/dist/errors.d.ts +6 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +2949 -0
- package/dist/leaf-operations.d.ts +26 -0
- package/dist/reference-operations.d.ts +11 -0
- package/dist/transform-search/index.d.ts +8 -0
- package/dist/types.d.ts +30 -0
- package/dist/verification-operations.d.ts +19 -0
- package/dist/virtual-files.d.ts +43 -0
- package/dist/workspace.d.ts +25 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Guilherme Castro
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { DiagnosticOptions, DiagnosticInfo, ErrorExplanationOptions, ExplainedDiagnosticsResult, ListSymbolsOptions, RefactorPreviewOptions, SearchTypesOptions, TransformSearchOptions, TypeAnalyzer, VerifyContractOptions } from "./contracts";
|
|
2
|
+
import type { WorkspaceMetadata, WorkspaceOptions } from "./types";
|
|
3
|
+
export declare class QuartzAnalyzer implements TypeAnalyzer {
|
|
4
|
+
#private;
|
|
5
|
+
private constructor();
|
|
6
|
+
static open(root: string, options?: WorkspaceOptions): Promise<QuartzAnalyzer>;
|
|
7
|
+
get metadata(): WorkspaceMetadata;
|
|
8
|
+
getTimingInfo: () => Promise<unknown>;
|
|
9
|
+
resetTimingInfo: () => Promise<void>;
|
|
10
|
+
getPackages: () => Promise<readonly import("./contracts").PackageInfo[]>;
|
|
11
|
+
listSymbols: (options?: ListSymbolsOptions) => Promise<import("./contracts").SymbolListResult>;
|
|
12
|
+
getTypeInfo: (symbolName: string, packageName?: string) => Promise<import("./contracts").TypeInfo | null>;
|
|
13
|
+
expandType: (symbolName: string, packageName?: string) => Promise<import("./contracts").ExpandedType | null>;
|
|
14
|
+
findRelated: (symbolName: string, packageName?: string) => Promise<import("./contracts").RelatedInfo | null>;
|
|
15
|
+
searchTypes: (options: SearchTypesOptions) => Promise<readonly import("./contracts").TypeInfo[]>;
|
|
16
|
+
evalType: (expression: string, packageName?: string) => Promise<import("./contracts").TypeEvaluationResult>;
|
|
17
|
+
checkSnippet: (code: string, packageName?: string) => Promise<import("./contracts").SnippetCheckResult>;
|
|
18
|
+
getFileDeclarations: (file: string, options?: {
|
|
19
|
+
readonly symbol?: string;
|
|
20
|
+
readonly includePrivate?: boolean;
|
|
21
|
+
readonly packageName?: string;
|
|
22
|
+
}) => Promise<import("./contracts").FileInspectionResult | null>;
|
|
23
|
+
checkCompatibility: (from: string, to: string, packageName?: string) => Promise<{
|
|
24
|
+
readonly compatible: boolean;
|
|
25
|
+
readonly from: string;
|
|
26
|
+
readonly to: string;
|
|
27
|
+
readonly reason?: string;
|
|
28
|
+
readonly issues?: readonly import("./contracts").ErrorExplanationIssue[];
|
|
29
|
+
}>;
|
|
30
|
+
generateGraph: (symbol: string, options?: {
|
|
31
|
+
readonly depth?: number;
|
|
32
|
+
readonly format?: "mermaid" | "dot";
|
|
33
|
+
readonly packageName?: string;
|
|
34
|
+
}) => Promise<import("./contracts").GraphResult | null>;
|
|
35
|
+
previewRefactor: (options: RefactorPreviewOptions) => Promise<import("./contracts").RefactorPreviewResult>;
|
|
36
|
+
getDiagnostics: (packageNameOrOptions?: string | DiagnosticOptions) => Promise<readonly DiagnosticInfo[] | ExplainedDiagnosticsResult>;
|
|
37
|
+
getTypeAtPosition: (filePath: string, line: number, column: number, packageName?: string) => Promise<import("./contracts").TypeAtPositionResult | null>;
|
|
38
|
+
explainError: (options: ErrorExplanationOptions) => Promise<import("./contracts").ErrorExplanationResult | null>;
|
|
39
|
+
explainType: (expression: string, packageName?: string) => Promise<import("./contracts").TypeExplanationResult>;
|
|
40
|
+
transformSearch: (options: TransformSearchOptions & {
|
|
41
|
+
readonly packageName?: string;
|
|
42
|
+
}) => Promise<import("./contracts").TransformSearchResponse>;
|
|
43
|
+
verifyContract: (options: VerifyContractOptions) => Promise<import("./contracts").VerifyContractResult>;
|
|
44
|
+
refresh(packageName?: string): Promise<string>;
|
|
45
|
+
markDirty(): Promise<void>;
|
|
46
|
+
dispose(): Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
export declare const createTypeAnalyzer: (root: string, options?: WorkspaceOptions) => Promise<QuartzAnalyzer>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Project } from "typescript/unstable/async";
|
|
2
|
+
import type { PackageInfo } from "./contracts";
|
|
3
|
+
import type { WorkspaceFileChanges, WorkspaceMetadata, WorkspaceOptions } from "./types";
|
|
4
|
+
import { type QuartzWorkspace } from "./workspace";
|
|
5
|
+
export declare class AnalyzerContext {
|
|
6
|
+
#private;
|
|
7
|
+
private readonly defaultConfigPath?;
|
|
8
|
+
readonly root: string;
|
|
9
|
+
readonly packages: readonly PackageInfo[];
|
|
10
|
+
readonly workspace: QuartzWorkspace;
|
|
11
|
+
private constructor();
|
|
12
|
+
static open(root: string, options?: WorkspaceOptions): Promise<AnalyzerContext>;
|
|
13
|
+
package(packageName?: string): PackageInfo;
|
|
14
|
+
withProject<T>(operation: (project: Project, pkg: PackageInfo, revision: number) => Promise<T>, packageName?: string): Promise<T>;
|
|
15
|
+
cacheForRevision<T>(key: string, revision: number, load: () => T): T;
|
|
16
|
+
refresh(changes?: WorkspaceFileChanges): Promise<WorkspaceMetadata>;
|
|
17
|
+
refreshPackage(packageName: string): Promise<WorkspaceMetadata>;
|
|
18
|
+
markDirty(): void;
|
|
19
|
+
close(): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export declare const openAnalyzerContext: (root: string, options?: WorkspaceOptions) => Promise<AnalyzerContext>;
|
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
export interface PackageInfo {
|
|
2
|
+
readonly name: string;
|
|
3
|
+
readonly path: string;
|
|
4
|
+
readonly tsconfigPath: string;
|
|
5
|
+
}
|
|
6
|
+
export interface SymbolInfo {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly kind: string;
|
|
9
|
+
readonly file: string;
|
|
10
|
+
readonly line?: number;
|
|
11
|
+
readonly package?: string;
|
|
12
|
+
readonly isIndexExport?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface SymbolListResult {
|
|
15
|
+
readonly symbols: readonly SymbolInfo[];
|
|
16
|
+
readonly total: number;
|
|
17
|
+
readonly truncated: boolean;
|
|
18
|
+
readonly package?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ListSymbolsOptions {
|
|
21
|
+
readonly pattern?: string;
|
|
22
|
+
readonly kind?: string;
|
|
23
|
+
readonly packageName?: string;
|
|
24
|
+
readonly file?: string;
|
|
25
|
+
readonly limit?: number;
|
|
26
|
+
readonly indexOnly?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface TypePropertyInfo {
|
|
29
|
+
readonly name: string;
|
|
30
|
+
readonly type: string;
|
|
31
|
+
readonly optional?: boolean;
|
|
32
|
+
readonly from?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface TypeInfo {
|
|
35
|
+
readonly name: string;
|
|
36
|
+
readonly kind: string;
|
|
37
|
+
readonly type: string;
|
|
38
|
+
readonly signature?: string;
|
|
39
|
+
readonly properties?: readonly TypePropertyInfo[];
|
|
40
|
+
readonly constructors?: readonly string[];
|
|
41
|
+
readonly location: {
|
|
42
|
+
readonly file: string;
|
|
43
|
+
readonly line: number;
|
|
44
|
+
};
|
|
45
|
+
readonly package?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface ExpandedType {
|
|
48
|
+
readonly original: string;
|
|
49
|
+
readonly expanded: string;
|
|
50
|
+
readonly properties: readonly TypePropertyInfo[];
|
|
51
|
+
}
|
|
52
|
+
export interface TypeAtPositionResult {
|
|
53
|
+
readonly type: string;
|
|
54
|
+
readonly expanded: string;
|
|
55
|
+
readonly nodeKind: string;
|
|
56
|
+
readonly nodeText: string;
|
|
57
|
+
readonly location: {
|
|
58
|
+
readonly file: string;
|
|
59
|
+
readonly line: number;
|
|
60
|
+
readonly column: number;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export interface DiagnosticInfo {
|
|
64
|
+
readonly message: string;
|
|
65
|
+
readonly code: number;
|
|
66
|
+
readonly category?: string;
|
|
67
|
+
readonly file?: string;
|
|
68
|
+
readonly line?: number;
|
|
69
|
+
readonly column?: number;
|
|
70
|
+
}
|
|
71
|
+
export interface EvaluatedTypeResult {
|
|
72
|
+
readonly result: string;
|
|
73
|
+
readonly expanded: string;
|
|
74
|
+
}
|
|
75
|
+
export interface TypeEvaluationError {
|
|
76
|
+
readonly error: string;
|
|
77
|
+
}
|
|
78
|
+
export type TypeEvaluationResult = EvaluatedTypeResult | TypeEvaluationError;
|
|
79
|
+
export interface SearchTypesOptions {
|
|
80
|
+
readonly query?: string;
|
|
81
|
+
readonly pattern?: string;
|
|
82
|
+
readonly hasProperty?: string;
|
|
83
|
+
readonly extends?: string;
|
|
84
|
+
readonly packageName?: string;
|
|
85
|
+
readonly limit?: number;
|
|
86
|
+
}
|
|
87
|
+
export interface DiagnosticOptions {
|
|
88
|
+
readonly packageName?: string;
|
|
89
|
+
readonly explain?: boolean;
|
|
90
|
+
}
|
|
91
|
+
export interface ErrorExplanationOptions {
|
|
92
|
+
readonly code?: number;
|
|
93
|
+
readonly message?: string;
|
|
94
|
+
readonly file?: string;
|
|
95
|
+
readonly line?: number;
|
|
96
|
+
readonly packageName?: string;
|
|
97
|
+
}
|
|
98
|
+
export interface RefactorPreviewOptions {
|
|
99
|
+
readonly action: "rename";
|
|
100
|
+
readonly symbol: string;
|
|
101
|
+
readonly to: string;
|
|
102
|
+
readonly packageName?: string;
|
|
103
|
+
}
|
|
104
|
+
export interface RelatedInfo {
|
|
105
|
+
readonly symbol: string;
|
|
106
|
+
readonly referencedBy: readonly {
|
|
107
|
+
readonly symbol: string;
|
|
108
|
+
readonly context: string;
|
|
109
|
+
readonly file: string;
|
|
110
|
+
readonly line: number;
|
|
111
|
+
}[];
|
|
112
|
+
readonly references: readonly {
|
|
113
|
+
readonly symbol: string;
|
|
114
|
+
readonly context: string;
|
|
115
|
+
}[];
|
|
116
|
+
}
|
|
117
|
+
export interface FileDeclarationInfo {
|
|
118
|
+
readonly name: string;
|
|
119
|
+
readonly kind: string;
|
|
120
|
+
readonly line: number;
|
|
121
|
+
readonly exported: boolean;
|
|
122
|
+
readonly isDefaultExport: boolean;
|
|
123
|
+
readonly exportedAs?: string;
|
|
124
|
+
readonly type?: string;
|
|
125
|
+
readonly signature?: string;
|
|
126
|
+
}
|
|
127
|
+
export interface FileInspectionResult {
|
|
128
|
+
readonly file: string;
|
|
129
|
+
readonly package: string;
|
|
130
|
+
readonly declarations: readonly FileDeclarationInfo[];
|
|
131
|
+
readonly total: number;
|
|
132
|
+
}
|
|
133
|
+
export interface ErrorExplanationIssue {
|
|
134
|
+
readonly kind: "missing_property" | "type_mismatch" | "excess_property" | "not_callable" | "other";
|
|
135
|
+
readonly property?: string;
|
|
136
|
+
readonly expectedType?: string;
|
|
137
|
+
readonly actualType?: string;
|
|
138
|
+
readonly message: string;
|
|
139
|
+
}
|
|
140
|
+
export interface CompatibilityResult {
|
|
141
|
+
readonly compatible: boolean;
|
|
142
|
+
readonly from: string;
|
|
143
|
+
readonly to: string;
|
|
144
|
+
readonly reason?: string;
|
|
145
|
+
readonly issues?: readonly ErrorExplanationIssue[];
|
|
146
|
+
}
|
|
147
|
+
export interface GraphEdge {
|
|
148
|
+
readonly from: string;
|
|
149
|
+
readonly to: string;
|
|
150
|
+
readonly label?: string;
|
|
151
|
+
}
|
|
152
|
+
export interface GraphResult {
|
|
153
|
+
readonly root: string;
|
|
154
|
+
readonly format: "mermaid" | "dot";
|
|
155
|
+
readonly depth: number;
|
|
156
|
+
readonly nodes: readonly string[];
|
|
157
|
+
readonly edges: readonly GraphEdge[];
|
|
158
|
+
readonly graph: string;
|
|
159
|
+
}
|
|
160
|
+
export interface RefactorLocation {
|
|
161
|
+
readonly file: string;
|
|
162
|
+
readonly line: number;
|
|
163
|
+
readonly column: number;
|
|
164
|
+
readonly before: string;
|
|
165
|
+
readonly after: string;
|
|
166
|
+
}
|
|
167
|
+
export interface RefactorError {
|
|
168
|
+
readonly file: string;
|
|
169
|
+
readonly line: number;
|
|
170
|
+
readonly message: string;
|
|
171
|
+
}
|
|
172
|
+
export interface StringLiteralRef {
|
|
173
|
+
readonly file: string;
|
|
174
|
+
readonly line: number;
|
|
175
|
+
readonly content: string;
|
|
176
|
+
}
|
|
177
|
+
export interface RefactorPreviewResult {
|
|
178
|
+
readonly action: "rename";
|
|
179
|
+
readonly from: string;
|
|
180
|
+
readonly to: string;
|
|
181
|
+
readonly locations: readonly RefactorLocation[];
|
|
182
|
+
readonly totalLocations: number;
|
|
183
|
+
readonly predictedErrors: readonly RefactorError[];
|
|
184
|
+
readonly confidence: "high" | "medium" | "low";
|
|
185
|
+
readonly safe: boolean;
|
|
186
|
+
readonly safetyNotes: readonly string[];
|
|
187
|
+
readonly stringLiteralLocations: readonly StringLiteralRef[];
|
|
188
|
+
readonly commentLocations: readonly StringLiteralRef[];
|
|
189
|
+
}
|
|
190
|
+
export interface SnippetDiagnostic {
|
|
191
|
+
readonly message: string;
|
|
192
|
+
readonly line: number;
|
|
193
|
+
readonly column: number;
|
|
194
|
+
readonly severity: "error" | "warning";
|
|
195
|
+
}
|
|
196
|
+
export interface SnippetCheckResult {
|
|
197
|
+
readonly valid: boolean;
|
|
198
|
+
readonly errors?: readonly SnippetDiagnostic[];
|
|
199
|
+
}
|
|
200
|
+
export interface ErrorExplanationResult {
|
|
201
|
+
readonly error: {
|
|
202
|
+
readonly code: number;
|
|
203
|
+
readonly message: string;
|
|
204
|
+
};
|
|
205
|
+
readonly explanation: string;
|
|
206
|
+
readonly types?: {
|
|
207
|
+
readonly from?: {
|
|
208
|
+
readonly name: string;
|
|
209
|
+
readonly expanded: string;
|
|
210
|
+
};
|
|
211
|
+
readonly to?: {
|
|
212
|
+
readonly name: string;
|
|
213
|
+
readonly expanded: string;
|
|
214
|
+
};
|
|
215
|
+
readonly target?: {
|
|
216
|
+
readonly name: string;
|
|
217
|
+
readonly expanded: string;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
readonly issues: readonly ErrorExplanationIssue[];
|
|
221
|
+
readonly suggestions: readonly string[];
|
|
222
|
+
}
|
|
223
|
+
export interface ExplainedDiagnosticInfo extends DiagnosticInfo {
|
|
224
|
+
readonly explanation: ErrorExplanationResult | null;
|
|
225
|
+
}
|
|
226
|
+
export interface ExplainedDiagnosticsResult {
|
|
227
|
+
readonly totalErrors: number;
|
|
228
|
+
readonly explained: number;
|
|
229
|
+
readonly truncated: boolean;
|
|
230
|
+
readonly errors: readonly ExplainedDiagnosticInfo[];
|
|
231
|
+
}
|
|
232
|
+
export interface TypeExplanationStep {
|
|
233
|
+
readonly step: number;
|
|
234
|
+
readonly description: string;
|
|
235
|
+
readonly expression: string;
|
|
236
|
+
readonly result: string;
|
|
237
|
+
}
|
|
238
|
+
export interface TypeExplanationResult {
|
|
239
|
+
readonly expression: string;
|
|
240
|
+
readonly steps: readonly TypeExplanationStep[];
|
|
241
|
+
readonly final: string;
|
|
242
|
+
}
|
|
243
|
+
export type CallableKind = "Function" | "VariableCallable" | "ClassMethod" | "StaticMethod" | "Constructor" | "ObjectMethod" | "InterfaceMethod" | "TypeLiteralMethod" | "CallableProperty";
|
|
244
|
+
export type VerificationStatus = "verified" | "unverified" | "unverifiable";
|
|
245
|
+
export type VerificationReason = "exact_type_match" | "no_type_annotations" | "not_importable" | "type_erasure" | "synthetic_check_passed" | "synthetic_check_failed" | "partial_query"
|
|
246
|
+
/** Full from+to assignability passed; synthetic verification not yet applied. */
|
|
247
|
+
| "assignability_pending_synthetic";
|
|
248
|
+
export interface VerificationMeta {
|
|
249
|
+
readonly status: VerificationStatus;
|
|
250
|
+
readonly method: "synthetic" | "exact_match" | "assignability_only" | null;
|
|
251
|
+
readonly reason: VerificationReason;
|
|
252
|
+
readonly diagnostics?: readonly {
|
|
253
|
+
readonly code: number;
|
|
254
|
+
readonly message: string;
|
|
255
|
+
}[];
|
|
256
|
+
readonly syntheticCode?: string;
|
|
257
|
+
}
|
|
258
|
+
export interface FromMatchDetails {
|
|
259
|
+
readonly matched: boolean;
|
|
260
|
+
readonly paramIndex: number;
|
|
261
|
+
readonly paramName: string;
|
|
262
|
+
readonly queryType: string;
|
|
263
|
+
readonly paramType: string;
|
|
264
|
+
readonly exact: boolean;
|
|
265
|
+
readonly typeErasure?: boolean;
|
|
266
|
+
}
|
|
267
|
+
export interface ToMatchDetails {
|
|
268
|
+
readonly matched: boolean;
|
|
269
|
+
readonly returnType: string;
|
|
270
|
+
readonly queryType: string;
|
|
271
|
+
readonly exact: boolean;
|
|
272
|
+
readonly unwrapped: boolean;
|
|
273
|
+
readonly wrapper: "Promise" | "PromiseLike" | "Effect" | "Observable" | "Task" | null;
|
|
274
|
+
readonly typeErasure?: boolean;
|
|
275
|
+
}
|
|
276
|
+
export type MatchConfidence = "high" | "medium" | "low";
|
|
277
|
+
export interface MatchExplanation {
|
|
278
|
+
readonly summary: string;
|
|
279
|
+
readonly details: {
|
|
280
|
+
readonly fromMatch?: {
|
|
281
|
+
readonly description: string;
|
|
282
|
+
readonly paramName: string;
|
|
283
|
+
readonly paramIndex: number;
|
|
284
|
+
readonly compatibility: "exact" | "assignable" | "structural";
|
|
285
|
+
};
|
|
286
|
+
readonly toMatch?: {
|
|
287
|
+
readonly description: string;
|
|
288
|
+
readonly compatibility: "exact" | "assignable" | "structural";
|
|
289
|
+
readonly unwrapped?: {
|
|
290
|
+
readonly wrapper: string;
|
|
291
|
+
readonly originalType: string;
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
readonly verification?: {
|
|
295
|
+
readonly method: "synthetic" | "assignability-only";
|
|
296
|
+
readonly passed: boolean;
|
|
297
|
+
};
|
|
298
|
+
};
|
|
299
|
+
readonly confidence: MatchConfidence;
|
|
300
|
+
}
|
|
301
|
+
export interface TransformSearchResult {
|
|
302
|
+
readonly name: string;
|
|
303
|
+
readonly signature: string;
|
|
304
|
+
readonly kind: CallableKind;
|
|
305
|
+
readonly file: string;
|
|
306
|
+
readonly line: number;
|
|
307
|
+
readonly exported: boolean;
|
|
308
|
+
readonly deprecated: boolean;
|
|
309
|
+
readonly score: number;
|
|
310
|
+
readonly confidence: MatchConfidence;
|
|
311
|
+
readonly explanation: MatchExplanation;
|
|
312
|
+
readonly verification: VerificationMeta;
|
|
313
|
+
readonly matchDetails: {
|
|
314
|
+
readonly fromMatch: FromMatchDetails | null;
|
|
315
|
+
readonly toMatch: ToMatchDetails | null;
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
export interface TransformSearchOptions {
|
|
319
|
+
readonly from?: string;
|
|
320
|
+
readonly to?: string;
|
|
321
|
+
readonly paramPosition?: number | "any";
|
|
322
|
+
readonly unwrapReturn?: boolean;
|
|
323
|
+
readonly exportedOnly?: boolean;
|
|
324
|
+
readonly limit?: number;
|
|
325
|
+
readonly allowTypeErasure?: boolean;
|
|
326
|
+
readonly verifiedOnly?: boolean;
|
|
327
|
+
readonly minVerificationStatus?: VerificationStatus;
|
|
328
|
+
readonly includeDiagnostics?: boolean;
|
|
329
|
+
readonly includeSyntheticCode?: boolean;
|
|
330
|
+
readonly includeFailedVerification?: boolean;
|
|
331
|
+
}
|
|
332
|
+
export interface TransformSearchResponse {
|
|
333
|
+
readonly results: readonly TransformSearchResult[];
|
|
334
|
+
readonly query: {
|
|
335
|
+
readonly from: string | null;
|
|
336
|
+
readonly to: string | null;
|
|
337
|
+
readonly options: {
|
|
338
|
+
readonly paramPosition: number | "any";
|
|
339
|
+
readonly unwrapReturn: boolean;
|
|
340
|
+
readonly exportedOnly: boolean;
|
|
341
|
+
readonly verifiedOnly?: boolean;
|
|
342
|
+
readonly minVerificationStatus?: VerificationStatus;
|
|
343
|
+
readonly includeDiagnostics?: boolean;
|
|
344
|
+
readonly includeSyntheticCode?: boolean;
|
|
345
|
+
readonly includeFailedVerification?: boolean;
|
|
346
|
+
};
|
|
347
|
+
};
|
|
348
|
+
readonly stats: {
|
|
349
|
+
readonly totalCandidates: number;
|
|
350
|
+
readonly assignableMatches: number;
|
|
351
|
+
readonly verifiedMatches: number;
|
|
352
|
+
readonly verification: Readonly<Record<VerificationStatus, number>>;
|
|
353
|
+
readonly returned: number;
|
|
354
|
+
readonly timing: {
|
|
355
|
+
readonly indexLookupMs: number;
|
|
356
|
+
readonly resolutionMs: number;
|
|
357
|
+
readonly assignabilityMs: number;
|
|
358
|
+
readonly syntheticMs: number;
|
|
359
|
+
readonly totalMs: number;
|
|
360
|
+
};
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
export interface VerifyContractOptions {
|
|
364
|
+
readonly from?: string;
|
|
365
|
+
readonly to?: string;
|
|
366
|
+
readonly symbol?: string;
|
|
367
|
+
readonly snippet?: string;
|
|
368
|
+
readonly packageName?: string;
|
|
369
|
+
readonly includeDiagnostics?: boolean;
|
|
370
|
+
readonly includeTransformEvidence?: boolean;
|
|
371
|
+
readonly transformLimit?: number;
|
|
372
|
+
}
|
|
373
|
+
export type VerifyContractCheckKey = "compatibility" | "snippet" | "diagnostics" | "transform";
|
|
374
|
+
export interface VerifyContractCheck<T = unknown> {
|
|
375
|
+
readonly ran: boolean;
|
|
376
|
+
readonly passed: boolean | null;
|
|
377
|
+
readonly blocking: boolean;
|
|
378
|
+
readonly summary: string;
|
|
379
|
+
readonly evidence?: T;
|
|
380
|
+
}
|
|
381
|
+
export interface VerifyContractDiagnostic {
|
|
382
|
+
readonly file: string;
|
|
383
|
+
readonly line: number;
|
|
384
|
+
readonly column: number;
|
|
385
|
+
readonly message: string;
|
|
386
|
+
readonly code: number;
|
|
387
|
+
}
|
|
388
|
+
export interface VerifyContractEvidence {
|
|
389
|
+
readonly compatibility?: CompatibilityResult;
|
|
390
|
+
readonly snippet?: SnippetCheckResult;
|
|
391
|
+
readonly diagnostics?: readonly VerifyContractDiagnostic[];
|
|
392
|
+
readonly transformSearch?: TransformSearchResponse;
|
|
393
|
+
readonly explanations?: readonly ErrorExplanationResult[];
|
|
394
|
+
}
|
|
395
|
+
export interface VerifyContractResult {
|
|
396
|
+
readonly schemaVersion: "verify-contract/v1";
|
|
397
|
+
readonly ok: boolean;
|
|
398
|
+
readonly contract: {
|
|
399
|
+
readonly from?: string;
|
|
400
|
+
readonly to?: string;
|
|
401
|
+
readonly symbol?: string;
|
|
402
|
+
readonly package: string;
|
|
403
|
+
};
|
|
404
|
+
readonly checks: Readonly<Record<VerifyContractCheckKey, VerifyContractCheck>>;
|
|
405
|
+
readonly evidence: VerifyContractEvidence;
|
|
406
|
+
readonly gaps: readonly string[];
|
|
407
|
+
readonly next_steps: readonly string[];
|
|
408
|
+
}
|
|
409
|
+
export interface TypeAnalyzer {
|
|
410
|
+
readonly getPackages: () => Promise<readonly PackageInfo[]>;
|
|
411
|
+
readonly listSymbols: (options?: ListSymbolsOptions) => Promise<SymbolListResult>;
|
|
412
|
+
readonly getTypeInfo: (symbolName: string, packageName?: string) => Promise<TypeInfo | null>;
|
|
413
|
+
readonly expandType: (symbolName: string, packageName?: string) => Promise<ExpandedType | null>;
|
|
414
|
+
readonly findRelated: (symbolName: string, packageName?: string) => Promise<RelatedInfo | null>;
|
|
415
|
+
readonly searchTypes: (options: SearchTypesOptions) => Promise<readonly TypeInfo[]>;
|
|
416
|
+
readonly evalType: (expression: string, packageName?: string) => Promise<TypeEvaluationResult>;
|
|
417
|
+
readonly checkSnippet: (code: string, packageName?: string) => Promise<SnippetCheckResult>;
|
|
418
|
+
readonly getFileDeclarations: (file: string, options?: {
|
|
419
|
+
readonly symbol?: string;
|
|
420
|
+
readonly includePrivate?: boolean;
|
|
421
|
+
readonly packageName?: string;
|
|
422
|
+
}) => Promise<FileInspectionResult | null>;
|
|
423
|
+
readonly checkCompatibility: (from: string, to: string, packageName?: string) => Promise<CompatibilityResult>;
|
|
424
|
+
readonly generateGraph: (symbol: string, options?: {
|
|
425
|
+
readonly depth?: number;
|
|
426
|
+
readonly format?: "mermaid" | "dot";
|
|
427
|
+
readonly packageName?: string;
|
|
428
|
+
}) => Promise<GraphResult | null>;
|
|
429
|
+
readonly previewRefactor: (options: RefactorPreviewOptions) => Promise<RefactorPreviewResult>;
|
|
430
|
+
readonly getDiagnostics: (packageNameOrOptions?: string | DiagnosticOptions) => Promise<readonly DiagnosticInfo[] | ExplainedDiagnosticsResult>;
|
|
431
|
+
readonly getTypeAtPosition: (filePath: string, line: number, column: number, packageName?: string) => Promise<TypeAtPositionResult | null>;
|
|
432
|
+
readonly explainError: (options: ErrorExplanationOptions) => Promise<ErrorExplanationResult | null>;
|
|
433
|
+
readonly explainType: (expression: string, packageName?: string) => Promise<TypeExplanationResult>;
|
|
434
|
+
readonly transformSearch: (options: TransformSearchOptions & {
|
|
435
|
+
readonly packageName?: string;
|
|
436
|
+
}) => Promise<TransformSearchResponse>;
|
|
437
|
+
readonly verifyContract: (options: VerifyContractOptions) => Promise<VerifyContractResult>;
|
|
438
|
+
readonly refresh: (packageName?: string) => Promise<string>;
|
|
439
|
+
readonly markDirty: () => Promise<void>;
|
|
440
|
+
}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type QuartzEngineErrorCode = "WORKSPACE_CLOSED" | "WORKSPACE_OPEN_FAILED" | "WORKSPACE_REFRESH_FAILED" | "TRANSFORM_QUERY_UNRESOLVED";
|
|
2
|
+
export declare class QuartzEngineError extends Error {
|
|
3
|
+
readonly code: QuartzEngineErrorCode;
|
|
4
|
+
readonly cause: unknown;
|
|
5
|
+
constructor(code: QuartzEngineErrorCode, message: string, cause?: unknown);
|
|
6
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { version as analysisTypeScriptVersion } from "typescript";
|
|
2
|
+
export type * from "./contracts";
|
|
3
|
+
export { createTypeAnalyzer, QuartzAnalyzer } from "./analyzer";
|
|
4
|
+
export { QuartzEngineError } from "./errors";
|
|
5
|
+
export type { QuartzEngineErrorCode } from "./errors";
|
|
6
|
+
export { openQuartzWorkspace, QuartzWorkspace } from "./workspace";
|
|
7
|
+
export type { DiagnosticSeverity, EngineDiagnostic, WorkspaceFileChanges, WorkspaceMetadata, WorkspaceOptions, } from "./types";
|