driftdetect-core 0.1.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/dist/analyzers/ast-analyzer.d.ts +251 -0
- package/dist/analyzers/ast-analyzer.d.ts.map +1 -0
- package/dist/analyzers/ast-analyzer.js +548 -0
- package/dist/analyzers/ast-analyzer.js.map +1 -0
- package/dist/analyzers/flow-analyzer.d.ts +241 -0
- package/dist/analyzers/flow-analyzer.d.ts.map +1 -0
- package/dist/analyzers/flow-analyzer.js +1219 -0
- package/dist/analyzers/flow-analyzer.js.map +1 -0
- package/dist/analyzers/index.d.ts +18 -0
- package/dist/analyzers/index.d.ts.map +1 -0
- package/dist/analyzers/index.js +19 -0
- package/dist/analyzers/index.js.map +1 -0
- package/dist/analyzers/semantic-analyzer.d.ts +252 -0
- package/dist/analyzers/semantic-analyzer.d.ts.map +1 -0
- package/dist/analyzers/semantic-analyzer.js +1182 -0
- package/dist/analyzers/semantic-analyzer.js.map +1 -0
- package/dist/analyzers/type-analyzer.d.ts +289 -0
- package/dist/analyzers/type-analyzer.d.ts.map +1 -0
- package/dist/analyzers/type-analyzer.js +1269 -0
- package/dist/analyzers/type-analyzer.js.map +1 -0
- package/dist/analyzers/types.d.ts +537 -0
- package/dist/analyzers/types.d.ts.map +1 -0
- package/dist/analyzers/types.js +11 -0
- package/dist/analyzers/types.js.map +1 -0
- package/dist/config/config-loader.d.ts +166 -0
- package/dist/config/config-loader.d.ts.map +1 -0
- package/dist/config/config-loader.js +429 -0
- package/dist/config/config-loader.js.map +1 -0
- package/dist/config/config-validator.d.ts +204 -0
- package/dist/config/config-validator.d.ts.map +1 -0
- package/dist/config/config-validator.js +632 -0
- package/dist/config/config-validator.js.map +1 -0
- package/dist/config/defaults.d.ts +8 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +26 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/index.d.ts +10 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +10 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/types.d.ts +47 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +7 -0
- package/dist/config/types.js.map +1 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest/exporter.d.ts +21 -0
- package/dist/manifest/exporter.d.ts.map +1 -0
- package/dist/manifest/exporter.js +339 -0
- package/dist/manifest/exporter.js.map +1 -0
- package/dist/manifest/index.d.ts +14 -0
- package/dist/manifest/index.d.ts.map +1 -0
- package/dist/manifest/index.js +15 -0
- package/dist/manifest/index.js.map +1 -0
- package/dist/manifest/manifest-store.d.ts +111 -0
- package/dist/manifest/manifest-store.d.ts.map +1 -0
- package/dist/manifest/manifest-store.js +418 -0
- package/dist/manifest/manifest-store.js.map +1 -0
- package/dist/manifest/types.d.ts +238 -0
- package/dist/manifest/types.d.ts.map +1 -0
- package/dist/manifest/types.js +11 -0
- package/dist/manifest/types.js.map +1 -0
- package/dist/matcher/confidence-scorer.d.ts +188 -0
- package/dist/matcher/confidence-scorer.d.ts.map +1 -0
- package/dist/matcher/confidence-scorer.js +302 -0
- package/dist/matcher/confidence-scorer.js.map +1 -0
- package/dist/matcher/index.d.ts +24 -0
- package/dist/matcher/index.d.ts.map +1 -0
- package/dist/matcher/index.js +26 -0
- package/dist/matcher/index.js.map +1 -0
- package/dist/matcher/outlier-detector.d.ts +252 -0
- package/dist/matcher/outlier-detector.d.ts.map +1 -0
- package/dist/matcher/outlier-detector.js +544 -0
- package/dist/matcher/outlier-detector.js.map +1 -0
- package/dist/matcher/pattern-matcher.d.ts +169 -0
- package/dist/matcher/pattern-matcher.d.ts.map +1 -0
- package/dist/matcher/pattern-matcher.js +692 -0
- package/dist/matcher/pattern-matcher.js.map +1 -0
- package/dist/matcher/types.d.ts +476 -0
- package/dist/matcher/types.d.ts.map +1 -0
- package/dist/matcher/types.js +36 -0
- package/dist/matcher/types.js.map +1 -0
- package/dist/parsers/base-parser.d.ts +282 -0
- package/dist/parsers/base-parser.d.ts.map +1 -0
- package/dist/parsers/base-parser.js +421 -0
- package/dist/parsers/base-parser.js.map +1 -0
- package/dist/parsers/css-parser.d.ts +225 -0
- package/dist/parsers/css-parser.d.ts.map +1 -0
- package/dist/parsers/css-parser.js +477 -0
- package/dist/parsers/css-parser.js.map +1 -0
- package/dist/parsers/index.d.ts +15 -0
- package/dist/parsers/index.d.ts.map +1 -0
- package/dist/parsers/index.js +15 -0
- package/dist/parsers/index.js.map +1 -0
- package/dist/parsers/json-parser.d.ts +219 -0
- package/dist/parsers/json-parser.d.ts.map +1 -0
- package/dist/parsers/json-parser.js +602 -0
- package/dist/parsers/json-parser.js.map +1 -0
- package/dist/parsers/markdown-parser.d.ts +276 -0
- package/dist/parsers/markdown-parser.d.ts.map +1 -0
- package/dist/parsers/markdown-parser.js +731 -0
- package/dist/parsers/markdown-parser.js.map +1 -0
- package/dist/parsers/parser-manager.d.ts +294 -0
- package/dist/parsers/parser-manager.d.ts.map +1 -0
- package/dist/parsers/parser-manager.js +738 -0
- package/dist/parsers/parser-manager.js.map +1 -0
- package/dist/parsers/python-parser.d.ts +204 -0
- package/dist/parsers/python-parser.d.ts.map +1 -0
- package/dist/parsers/python-parser.js +517 -0
- package/dist/parsers/python-parser.js.map +1 -0
- package/dist/parsers/types.d.ts +43 -0
- package/dist/parsers/types.d.ts.map +1 -0
- package/dist/parsers/types.js +7 -0
- package/dist/parsers/types.js.map +1 -0
- package/dist/parsers/typescript-parser.d.ts +264 -0
- package/dist/parsers/typescript-parser.d.ts.map +1 -0
- package/dist/parsers/typescript-parser.js +658 -0
- package/dist/parsers/typescript-parser.js.map +1 -0
- package/dist/rules/evaluator.d.ts +305 -0
- package/dist/rules/evaluator.d.ts.map +1 -0
- package/dist/rules/evaluator.js +579 -0
- package/dist/rules/evaluator.js.map +1 -0
- package/dist/rules/index.d.ts +13 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +13 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/quick-fix-generator.d.ts +334 -0
- package/dist/rules/quick-fix-generator.d.ts.map +1 -0
- package/dist/rules/quick-fix-generator.js +1075 -0
- package/dist/rules/quick-fix-generator.js.map +1 -0
- package/dist/rules/rule-engine.d.ts +241 -0
- package/dist/rules/rule-engine.d.ts.map +1 -0
- package/dist/rules/rule-engine.js +585 -0
- package/dist/rules/rule-engine.js.map +1 -0
- package/dist/rules/severity-manager.d.ts +394 -0
- package/dist/rules/severity-manager.d.ts.map +1 -0
- package/dist/rules/severity-manager.js +619 -0
- package/dist/rules/severity-manager.js.map +1 -0
- package/dist/rules/types.d.ts +370 -0
- package/dist/rules/types.d.ts.map +1 -0
- package/dist/rules/types.js +133 -0
- package/dist/rules/types.js.map +1 -0
- package/dist/rules/variant-manager.d.ts +388 -0
- package/dist/rules/variant-manager.d.ts.map +1 -0
- package/dist/rules/variant-manager.js +777 -0
- package/dist/rules/variant-manager.js.map +1 -0
- package/dist/scanner/change-detector.d.ts +164 -0
- package/dist/scanner/change-detector.d.ts.map +1 -0
- package/dist/scanner/change-detector.js +263 -0
- package/dist/scanner/change-detector.js.map +1 -0
- package/dist/scanner/dependency-graph.d.ts +270 -0
- package/dist/scanner/dependency-graph.d.ts.map +1 -0
- package/dist/scanner/dependency-graph.js +436 -0
- package/dist/scanner/dependency-graph.js.map +1 -0
- package/dist/scanner/file-walker.d.ts +127 -0
- package/dist/scanner/file-walker.d.ts.map +1 -0
- package/dist/scanner/file-walker.js +526 -0
- package/dist/scanner/file-walker.js.map +1 -0
- package/dist/scanner/index.d.ts +12 -0
- package/dist/scanner/index.d.ts.map +1 -0
- package/dist/scanner/index.js +12 -0
- package/dist/scanner/index.js.map +1 -0
- package/dist/scanner/types.d.ts +218 -0
- package/dist/scanner/types.d.ts.map +1 -0
- package/dist/scanner/types.js +10 -0
- package/dist/scanner/types.js.map +1 -0
- package/dist/scanner/worker-pool.d.ts +317 -0
- package/dist/scanner/worker-pool.d.ts.map +1 -0
- package/dist/scanner/worker-pool.js +571 -0
- package/dist/scanner/worker-pool.js.map +1 -0
- package/dist/store/cache-manager.d.ts +179 -0
- package/dist/store/cache-manager.d.ts.map +1 -0
- package/dist/store/cache-manager.js +391 -0
- package/dist/store/cache-manager.js.map +1 -0
- package/dist/store/history-store.d.ts +314 -0
- package/dist/store/history-store.d.ts.map +1 -0
- package/dist/store/history-store.js +707 -0
- package/dist/store/history-store.js.map +1 -0
- package/dist/store/index.d.ts +20 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +26 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/lock-file-manager.d.ts +202 -0
- package/dist/store/lock-file-manager.d.ts.map +1 -0
- package/dist/store/lock-file-manager.js +475 -0
- package/dist/store/lock-file-manager.js.map +1 -0
- package/dist/store/pattern-store.d.ts +289 -0
- package/dist/store/pattern-store.d.ts.map +1 -0
- package/dist/store/pattern-store.js +936 -0
- package/dist/store/pattern-store.js.map +1 -0
- package/dist/store/schema-validator.d.ts +159 -0
- package/dist/store/schema-validator.d.ts.map +1 -0
- package/dist/store/schema-validator.js +1096 -0
- package/dist/store/schema-validator.js.map +1 -0
- package/dist/store/types.d.ts +585 -0
- package/dist/store/types.d.ts.map +1 -0
- package/dist/store/types.js +82 -0
- package/dist/store/types.js.map +1 -0
- package/dist/types/analysis.d.ts +19 -0
- package/dist/types/analysis.d.ts.map +1 -0
- package/dist/types/analysis.js +5 -0
- package/dist/types/analysis.js.map +1 -0
- package/dist/types/common.d.ts +7 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +5 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +10 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/patterns.d.ts +40 -0
- package/dist/types/patterns.d.ts.map +1 -0
- package/dist/types/patterns.js +7 -0
- package/dist/types/patterns.js.map +1 -0
- package/dist/types/violations.d.ts +7 -0
- package/dist/types/violations.d.ts.map +1 -0
- package/dist/types/violations.js +7 -0
- package/dist/types/violations.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rules type definitions
|
|
3
|
+
*
|
|
4
|
+
* Provides comprehensive types for violations, quick fixes, and code transformations.
|
|
5
|
+
* These types support the rule engine that evaluates patterns and generates violations.
|
|
6
|
+
*
|
|
7
|
+
* @requirements 24.1 - THE Enforcement_System SHALL support severity levels: error, warning, info, hint
|
|
8
|
+
* @requirements 25.1 - THE Quick_Fix_System SHALL generate code transformations for fixable violations
|
|
9
|
+
* @requirements 25.2 - THE Quick_Fix SHALL include a preview of the change before applying
|
|
10
|
+
* @requirements 25.3 - THE Quick_Fix SHALL support fix types: replace, wrap, extract, import, rename, move, delete
|
|
11
|
+
* @requirements 25.4 - WHEN multiple fixes are available, THE Quick_Fix_System SHALL rank by confidence
|
|
12
|
+
* @requirements 25.5 - THE Quick_Fix_System SHALL mark the preferred fix for one-click application
|
|
13
|
+
*/
|
|
14
|
+
import type { Severity as StoreSeverity } from '../store/types.js';
|
|
15
|
+
/**
|
|
16
|
+
* Severity levels for pattern violations
|
|
17
|
+
*
|
|
18
|
+
* - error: Blocks commits and merges
|
|
19
|
+
* - warning: Displayed but doesn't block
|
|
20
|
+
* - info: Informational only
|
|
21
|
+
* - hint: Subtle suggestion
|
|
22
|
+
*
|
|
23
|
+
* @requirements 24.1 - THE Enforcement_System SHALL support severity levels: error, warning, info, hint
|
|
24
|
+
*/
|
|
25
|
+
export type Severity = StoreSeverity;
|
|
26
|
+
/**
|
|
27
|
+
* Severity enum for use in switch statements and comparisons
|
|
28
|
+
*
|
|
29
|
+
* @requirements 24.1 - Severity levels support
|
|
30
|
+
*/
|
|
31
|
+
export declare const SeverityLevel: {
|
|
32
|
+
readonly Error: "error";
|
|
33
|
+
readonly Warning: "warning";
|
|
34
|
+
readonly Info: "info";
|
|
35
|
+
readonly Hint: "hint";
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Severity level ordering (higher = more severe)
|
|
39
|
+
* Used for sorting violations by severity
|
|
40
|
+
*
|
|
41
|
+
* @requirements 24.2 - WHEN severity is error, THE Violation SHALL block commits and merges
|
|
42
|
+
* @requirements 24.3 - WHEN severity is warning, THE Violation SHALL be displayed but not block
|
|
43
|
+
*/
|
|
44
|
+
export declare const SEVERITY_ORDER: Record<Severity, number>;
|
|
45
|
+
/**
|
|
46
|
+
* Array of all severity levels in order of severity (most severe first)
|
|
47
|
+
*/
|
|
48
|
+
export declare const SEVERITY_LEVELS: readonly Severity[];
|
|
49
|
+
/**
|
|
50
|
+
* Position in a text document (0-indexed)
|
|
51
|
+
* Compatible with LSP Position type
|
|
52
|
+
*/
|
|
53
|
+
export interface Position {
|
|
54
|
+
/** Line number (0-indexed) */
|
|
55
|
+
line: number;
|
|
56
|
+
/** Character offset on the line (0-indexed) */
|
|
57
|
+
character: number;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Range in a text document
|
|
61
|
+
* Compatible with LSP Range type
|
|
62
|
+
*/
|
|
63
|
+
export interface Range {
|
|
64
|
+
/** Start position (inclusive) */
|
|
65
|
+
start: Position;
|
|
66
|
+
/** End position (exclusive) */
|
|
67
|
+
end: Position;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Create a Position from line and character
|
|
71
|
+
*/
|
|
72
|
+
export declare function createPosition(line: number, character: number): Position;
|
|
73
|
+
/**
|
|
74
|
+
* Create a Range from start and end positions
|
|
75
|
+
*/
|
|
76
|
+
export declare function createRange(start: Position, end: Position): Range;
|
|
77
|
+
/**
|
|
78
|
+
* Create a Range from line/character coordinates
|
|
79
|
+
*/
|
|
80
|
+
export declare function createRangeFromCoords(startLine: number, startChar: number, endLine: number, endChar: number): Range;
|
|
81
|
+
/**
|
|
82
|
+
* A violation of a pattern rule
|
|
83
|
+
*
|
|
84
|
+
* Represents code that deviates from an approved pattern.
|
|
85
|
+
* Contains all information needed to display, explain, and fix the violation.
|
|
86
|
+
*
|
|
87
|
+
* @requirements 24.1 - Violation with severity levels
|
|
88
|
+
*/
|
|
89
|
+
export interface Violation {
|
|
90
|
+
/** Unique violation identifier */
|
|
91
|
+
id: string;
|
|
92
|
+
/** ID of the pattern that was violated */
|
|
93
|
+
patternId: string;
|
|
94
|
+
/** Severity level of the violation */
|
|
95
|
+
severity: Severity;
|
|
96
|
+
/** File path containing the violation (relative to project root) */
|
|
97
|
+
file: string;
|
|
98
|
+
/** Range of the violation in the source file */
|
|
99
|
+
range: Range;
|
|
100
|
+
/** Human-readable message describing the violation */
|
|
101
|
+
message: string;
|
|
102
|
+
/** Detailed explanation of why this is a violation (optional) */
|
|
103
|
+
explanation?: string;
|
|
104
|
+
/** What was expected based on the pattern */
|
|
105
|
+
expected: string;
|
|
106
|
+
/** What was actually found in the code */
|
|
107
|
+
actual: string;
|
|
108
|
+
/** Available quick fix for this violation (optional) */
|
|
109
|
+
quickFix?: QuickFix;
|
|
110
|
+
/** Whether AI explanation is available for this violation */
|
|
111
|
+
aiExplainAvailable: boolean;
|
|
112
|
+
/** Whether AI fix generation is available for this violation */
|
|
113
|
+
aiFixAvailable: boolean;
|
|
114
|
+
/** When this violation was first detected */
|
|
115
|
+
firstSeen: Date;
|
|
116
|
+
/** Number of times this violation has been seen */
|
|
117
|
+
occurrences: number;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Violation without computed fields (for creation)
|
|
121
|
+
*/
|
|
122
|
+
export interface ViolationInput {
|
|
123
|
+
/** ID of the pattern that was violated */
|
|
124
|
+
patternId: string;
|
|
125
|
+
/** Severity level of the violation */
|
|
126
|
+
severity: Severity;
|
|
127
|
+
/** File path containing the violation */
|
|
128
|
+
file: string;
|
|
129
|
+
/** Range of the violation in the source file */
|
|
130
|
+
range: Range;
|
|
131
|
+
/** Human-readable message describing the violation */
|
|
132
|
+
message: string;
|
|
133
|
+
/** Detailed explanation (optional) */
|
|
134
|
+
explanation?: string;
|
|
135
|
+
/** What was expected */
|
|
136
|
+
expected: string;
|
|
137
|
+
/** What was actually found */
|
|
138
|
+
actual: string;
|
|
139
|
+
/** Available quick fix (optional) */
|
|
140
|
+
quickFix?: QuickFix;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Summary of violations for reporting
|
|
144
|
+
*/
|
|
145
|
+
export interface ViolationSummary {
|
|
146
|
+
/** Total number of violations */
|
|
147
|
+
total: number;
|
|
148
|
+
/** Count by severity level */
|
|
149
|
+
bySeverity: Record<Severity, number>;
|
|
150
|
+
/** Count by pattern ID */
|
|
151
|
+
byPattern: Record<string, number>;
|
|
152
|
+
/** Count by file */
|
|
153
|
+
byFile: Record<string, number>;
|
|
154
|
+
/** Number of auto-fixable violations */
|
|
155
|
+
autoFixable: number;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Kind of quick fix action
|
|
159
|
+
*
|
|
160
|
+
* - quickfix: A quick fix for a problem (e.g., fix a typo)
|
|
161
|
+
* - refactor: A refactoring action (e.g., extract method)
|
|
162
|
+
* - source: A source action (e.g., organize imports)
|
|
163
|
+
*/
|
|
164
|
+
export type QuickFixKind = 'quickfix' | 'refactor' | 'source';
|
|
165
|
+
/**
|
|
166
|
+
* A quick fix that can be applied to resolve a violation
|
|
167
|
+
*
|
|
168
|
+
* @requirements 25.1 - THE Quick_Fix_System SHALL generate code transformations
|
|
169
|
+
* @requirements 25.2 - THE Quick_Fix SHALL include a preview of the change
|
|
170
|
+
* @requirements 25.4 - Quick fixes ranked by confidence
|
|
171
|
+
* @requirements 25.5 - Preferred fix marked for one-click application
|
|
172
|
+
*/
|
|
173
|
+
export interface QuickFix {
|
|
174
|
+
/** Human-readable title for the fix */
|
|
175
|
+
title: string;
|
|
176
|
+
/** Kind of fix action */
|
|
177
|
+
kind: QuickFixKind;
|
|
178
|
+
/** Workspace edit to apply the fix */
|
|
179
|
+
edit: WorkspaceEdit;
|
|
180
|
+
/** Whether this is the preferred fix (for one-click application) */
|
|
181
|
+
isPreferred: boolean;
|
|
182
|
+
/** Confidence score for this fix (0.0 to 1.0) */
|
|
183
|
+
confidence: number;
|
|
184
|
+
/** Preview of the change (optional, for display before applying) */
|
|
185
|
+
preview?: string;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Quick fix with additional metadata
|
|
189
|
+
*/
|
|
190
|
+
export interface QuickFixWithMetadata extends QuickFix {
|
|
191
|
+
/** Unique identifier for the fix */
|
|
192
|
+
id: string;
|
|
193
|
+
/** Type of fix operation */
|
|
194
|
+
fixType: FixType;
|
|
195
|
+
/** Violation ID this fix addresses */
|
|
196
|
+
violationId: string;
|
|
197
|
+
/** Pattern ID this fix relates to */
|
|
198
|
+
patternId: string;
|
|
199
|
+
/** Whether the fix has been validated */
|
|
200
|
+
validated: boolean;
|
|
201
|
+
/** Estimated impact of the fix */
|
|
202
|
+
impact?: FixImpact;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Impact assessment for a quick fix
|
|
206
|
+
*/
|
|
207
|
+
export interface FixImpact {
|
|
208
|
+
/** Number of files affected */
|
|
209
|
+
filesAffected: number;
|
|
210
|
+
/** Number of lines changed */
|
|
211
|
+
linesChanged: number;
|
|
212
|
+
/** Risk level of the change */
|
|
213
|
+
riskLevel: 'low' | 'medium' | 'high';
|
|
214
|
+
/** Whether the fix might break existing functionality */
|
|
215
|
+
breakingChange: boolean;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Types of fix operations supported
|
|
219
|
+
*
|
|
220
|
+
* @requirements 25.3 - Support fix types: replace, wrap, extract, import, rename, move, delete
|
|
221
|
+
*/
|
|
222
|
+
export type FixType = 'replace' | 'wrap' | 'extract' | 'import' | 'rename' | 'move' | 'delete';
|
|
223
|
+
/**
|
|
224
|
+
* Array of all fix types
|
|
225
|
+
*/
|
|
226
|
+
export declare const FIX_TYPES: readonly FixType[];
|
|
227
|
+
/**
|
|
228
|
+
* Description of each fix type
|
|
229
|
+
*/
|
|
230
|
+
export declare const FIX_TYPE_DESCRIPTIONS: Record<FixType, string>;
|
|
231
|
+
/**
|
|
232
|
+
* A workspace edit represents changes to multiple files
|
|
233
|
+
*
|
|
234
|
+
* Compatible with LSP WorkspaceEdit type
|
|
235
|
+
*/
|
|
236
|
+
export interface WorkspaceEdit {
|
|
237
|
+
/** Text edits organized by file URI */
|
|
238
|
+
changes: Record<string, TextEdit[]>;
|
|
239
|
+
/** Document changes with versioning (optional, for more complex edits) */
|
|
240
|
+
documentChanges?: DocumentChange[];
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* A text edit represents a change to a single range in a document
|
|
244
|
+
*
|
|
245
|
+
* Compatible with LSP TextEdit type
|
|
246
|
+
*/
|
|
247
|
+
export interface TextEdit {
|
|
248
|
+
/** Range to replace */
|
|
249
|
+
range: Range;
|
|
250
|
+
/** New text to insert (empty string for deletion) */
|
|
251
|
+
newText: string;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* A document change with versioning support
|
|
255
|
+
*/
|
|
256
|
+
export interface DocumentChange {
|
|
257
|
+
/** Document URI */
|
|
258
|
+
uri: string;
|
|
259
|
+
/** Document version (for conflict detection) */
|
|
260
|
+
version?: number;
|
|
261
|
+
/** Text edits to apply */
|
|
262
|
+
edits: TextEdit[];
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Create a TextEdit for replacing a range
|
|
266
|
+
*/
|
|
267
|
+
export declare function createTextEdit(range: Range, newText: string): TextEdit;
|
|
268
|
+
/**
|
|
269
|
+
* Create a TextEdit for inserting text at a position
|
|
270
|
+
*/
|
|
271
|
+
export declare function createInsertEdit(position: Position, newText: string): TextEdit;
|
|
272
|
+
/**
|
|
273
|
+
* Create a TextEdit for deleting a range
|
|
274
|
+
*/
|
|
275
|
+
export declare function createDeleteEdit(range: Range): TextEdit;
|
|
276
|
+
/**
|
|
277
|
+
* Create a WorkspaceEdit with changes to a single file
|
|
278
|
+
*/
|
|
279
|
+
export declare function createWorkspaceEdit(file: string, edits: TextEdit[]): WorkspaceEdit;
|
|
280
|
+
/**
|
|
281
|
+
* Result of evaluating a rule against code
|
|
282
|
+
*/
|
|
283
|
+
export interface RuleEvaluationResult {
|
|
284
|
+
/** Rule/pattern ID that was evaluated */
|
|
285
|
+
ruleId: string;
|
|
286
|
+
/** File that was evaluated */
|
|
287
|
+
file: string;
|
|
288
|
+
/** Whether the rule passed (no violations) */
|
|
289
|
+
passed: boolean;
|
|
290
|
+
/** Violations found (empty if passed) */
|
|
291
|
+
violations: Violation[];
|
|
292
|
+
/** Evaluation duration in milliseconds */
|
|
293
|
+
duration: number;
|
|
294
|
+
/** Any errors encountered during evaluation */
|
|
295
|
+
errors: RuleEvaluationError[];
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Error encountered during rule evaluation
|
|
299
|
+
*/
|
|
300
|
+
export interface RuleEvaluationError {
|
|
301
|
+
/** Error message */
|
|
302
|
+
message: string;
|
|
303
|
+
/** Error code */
|
|
304
|
+
code?: string;
|
|
305
|
+
/** Whether evaluation can continue */
|
|
306
|
+
recoverable: boolean;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Aggregated results from evaluating multiple rules
|
|
310
|
+
*/
|
|
311
|
+
export interface RuleEvaluationSummary {
|
|
312
|
+
/** Total rules evaluated */
|
|
313
|
+
rulesEvaluated: number;
|
|
314
|
+
/** Rules that passed */
|
|
315
|
+
rulesPassed: number;
|
|
316
|
+
/** Rules that failed (had violations) */
|
|
317
|
+
rulesFailed: number;
|
|
318
|
+
/** Total violations found */
|
|
319
|
+
totalViolations: number;
|
|
320
|
+
/** Violations by severity */
|
|
321
|
+
violationsBySeverity: Record<Severity, number>;
|
|
322
|
+
/** Total evaluation duration in milliseconds */
|
|
323
|
+
totalDuration: number;
|
|
324
|
+
/** Files evaluated */
|
|
325
|
+
filesEvaluated: string[];
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Configuration for severity overrides
|
|
329
|
+
*
|
|
330
|
+
* @requirements 24.4 - THE Enforcement_System SHALL allow severity overrides per pattern in config
|
|
331
|
+
*/
|
|
332
|
+
export interface SeverityConfig {
|
|
333
|
+
/** Default severity for patterns without explicit configuration */
|
|
334
|
+
default: Severity;
|
|
335
|
+
/** Severity overrides by pattern ID */
|
|
336
|
+
overrides: Record<string, Severity>;
|
|
337
|
+
/** Severity overrides by category */
|
|
338
|
+
categoryOverrides: Record<string, Severity>;
|
|
339
|
+
/** Escalation configuration */
|
|
340
|
+
escalation?: SeverityEscalationConfig;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Configuration for severity escalation
|
|
344
|
+
*
|
|
345
|
+
* @requirements 24.5 - THE Enforcement_System SHALL support severity escalation after N violations
|
|
346
|
+
*/
|
|
347
|
+
export interface SeverityEscalationConfig {
|
|
348
|
+
/** Whether escalation is enabled */
|
|
349
|
+
enabled: boolean;
|
|
350
|
+
/** Number of violations before escalation */
|
|
351
|
+
threshold: number;
|
|
352
|
+
/** Escalation rules (from severity -> to severity) */
|
|
353
|
+
rules: SeverityEscalationRule[];
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* A single severity escalation rule
|
|
357
|
+
*/
|
|
358
|
+
export interface SeverityEscalationRule {
|
|
359
|
+
/** Original severity level */
|
|
360
|
+
from: Severity;
|
|
361
|
+
/** Escalated severity level */
|
|
362
|
+
to: Severity;
|
|
363
|
+
/** Number of violations to trigger escalation */
|
|
364
|
+
afterCount: number;
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Default severity configuration
|
|
368
|
+
*/
|
|
369
|
+
export declare const DEFAULT_SEVERITY_CONFIG: SeverityConfig;
|
|
370
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources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;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,8BAA8B;IAC9B,IAAI,EAAE,QAAQ,CAAC;IAEf,+BAA+B;IAC/B,EAAE,EAAE,QAAQ,CAAC;IAEb,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,cAarC,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rules type definitions
|
|
3
|
+
*
|
|
4
|
+
* Provides comprehensive types for violations, quick fixes, and code transformations.
|
|
5
|
+
* These types support the rule engine that evaluates patterns and generates violations.
|
|
6
|
+
*
|
|
7
|
+
* @requirements 24.1 - THE Enforcement_System SHALL support severity levels: error, warning, info, hint
|
|
8
|
+
* @requirements 25.1 - THE Quick_Fix_System SHALL generate code transformations for fixable violations
|
|
9
|
+
* @requirements 25.2 - THE Quick_Fix SHALL include a preview of the change before applying
|
|
10
|
+
* @requirements 25.3 - THE Quick_Fix SHALL support fix types: replace, wrap, extract, import, rename, move, delete
|
|
11
|
+
* @requirements 25.4 - WHEN multiple fixes are available, THE Quick_Fix_System SHALL rank by confidence
|
|
12
|
+
* @requirements 25.5 - THE Quick_Fix_System SHALL mark the preferred fix for one-click application
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Severity enum for use in switch statements and comparisons
|
|
16
|
+
*
|
|
17
|
+
* @requirements 24.1 - Severity levels support
|
|
18
|
+
*/
|
|
19
|
+
export const SeverityLevel = {
|
|
20
|
+
Error: 'error',
|
|
21
|
+
Warning: 'warning',
|
|
22
|
+
Info: 'info',
|
|
23
|
+
Hint: 'hint',
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Severity level ordering (higher = more severe)
|
|
27
|
+
* Used for sorting violations by severity
|
|
28
|
+
*
|
|
29
|
+
* @requirements 24.2 - WHEN severity is error, THE Violation SHALL block commits and merges
|
|
30
|
+
* @requirements 24.3 - WHEN severity is warning, THE Violation SHALL be displayed but not block
|
|
31
|
+
*/
|
|
32
|
+
export const SEVERITY_ORDER = {
|
|
33
|
+
error: 4,
|
|
34
|
+
warning: 3,
|
|
35
|
+
info: 2,
|
|
36
|
+
hint: 1,
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Array of all severity levels in order of severity (most severe first)
|
|
40
|
+
*/
|
|
41
|
+
export const SEVERITY_LEVELS = ['error', 'warning', 'info', 'hint'];
|
|
42
|
+
/**
|
|
43
|
+
* Create a Position from line and character
|
|
44
|
+
*/
|
|
45
|
+
export function createPosition(line, character) {
|
|
46
|
+
return { line, character };
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Create a Range from start and end positions
|
|
50
|
+
*/
|
|
51
|
+
export function createRange(start, end) {
|
|
52
|
+
return { start, end };
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Create a Range from line/character coordinates
|
|
56
|
+
*/
|
|
57
|
+
export function createRangeFromCoords(startLine, startChar, endLine, endChar) {
|
|
58
|
+
return {
|
|
59
|
+
start: { line: startLine, character: startChar },
|
|
60
|
+
end: { line: endLine, character: endChar },
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Array of all fix types
|
|
65
|
+
*/
|
|
66
|
+
export const FIX_TYPES = [
|
|
67
|
+
'replace',
|
|
68
|
+
'wrap',
|
|
69
|
+
'extract',
|
|
70
|
+
'import',
|
|
71
|
+
'rename',
|
|
72
|
+
'move',
|
|
73
|
+
'delete',
|
|
74
|
+
];
|
|
75
|
+
/**
|
|
76
|
+
* Description of each fix type
|
|
77
|
+
*/
|
|
78
|
+
export const FIX_TYPE_DESCRIPTIONS = {
|
|
79
|
+
replace: 'Replace text with new text',
|
|
80
|
+
wrap: 'Wrap code with additional structure',
|
|
81
|
+
extract: 'Extract code into a new location',
|
|
82
|
+
import: 'Add an import statement',
|
|
83
|
+
rename: 'Rename a symbol',
|
|
84
|
+
move: 'Move code to a different location',
|
|
85
|
+
delete: 'Delete code',
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Create a TextEdit for replacing a range
|
|
89
|
+
*/
|
|
90
|
+
export function createTextEdit(range, newText) {
|
|
91
|
+
return { range, newText };
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Create a TextEdit for inserting text at a position
|
|
95
|
+
*/
|
|
96
|
+
export function createInsertEdit(position, newText) {
|
|
97
|
+
return {
|
|
98
|
+
range: { start: position, end: position },
|
|
99
|
+
newText,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Create a TextEdit for deleting a range
|
|
104
|
+
*/
|
|
105
|
+
export function createDeleteEdit(range) {
|
|
106
|
+
return { range, newText: '' };
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Create a WorkspaceEdit with changes to a single file
|
|
110
|
+
*/
|
|
111
|
+
export function createWorkspaceEdit(file, edits) {
|
|
112
|
+
return {
|
|
113
|
+
changes: { [file]: edits },
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Default severity configuration
|
|
118
|
+
*/
|
|
119
|
+
export const DEFAULT_SEVERITY_CONFIG = {
|
|
120
|
+
default: 'warning',
|
|
121
|
+
overrides: {},
|
|
122
|
+
categoryOverrides: {},
|
|
123
|
+
escalation: {
|
|
124
|
+
enabled: false,
|
|
125
|
+
threshold: 10,
|
|
126
|
+
rules: [
|
|
127
|
+
{ from: 'hint', to: 'info', afterCount: 10 },
|
|
128
|
+
{ from: 'info', to: 'warning', afterCount: 10 },
|
|
129
|
+
{ from: 'warning', to: 'error', afterCount: 10 },
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/rules/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAq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