driftdetect-lsp 0.9.33 → 0.9.37
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/bin/server.d.ts +12 -0
- package/dist/bin/server.js +26 -0
- package/dist/bin/server.js.map +1 -0
- package/dist/capabilities.d.ts +91 -0
- package/dist/commands/approve-pattern.d.ts +15 -0
- package/dist/commands/approve-pattern.js +83 -0
- package/dist/commands/approve-pattern.js.map +1 -0
- package/dist/commands/create-variant.d.ts +22 -0
- package/dist/commands/create-variant.js +109 -0
- package/dist/commands/create-variant.js.map +1 -0
- package/dist/commands/explain-ai.d.ts +11 -0
- package/dist/commands/explain-ai.js +144 -0
- package/dist/commands/explain-ai.js.map +1 -0
- package/dist/commands/fix-ai.d.ts +11 -0
- package/dist/commands/fix-ai.js +146 -0
- package/dist/commands/fix-ai.js.map +1 -0
- package/dist/commands/ignore-once.d.ts +33 -0
- package/dist/commands/ignore-once.js +147 -0
- package/dist/commands/ignore-once.js.map +1 -0
- package/dist/commands/ignore-pattern.d.ts +15 -0
- package/dist/commands/ignore-pattern.js +77 -0
- package/dist/commands/ignore-pattern.js.map +1 -0
- package/dist/commands/index.d.ts +14 -0
- package/dist/commands/index.js +14 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/rescan.d.ts +19 -0
- package/dist/commands/rescan.js +125 -0
- package/dist/commands/rescan.js.map +1 -0
- package/dist/commands/show-violations.d.ts +11 -0
- package/dist/commands/show-violations.js +259 -0
- package/dist/commands/show-violations.js.map +1 -0
- package/dist/handlers/index.d.ts +23 -0
- package/dist/handlers/index.js +16 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/initialize.d.ts +41 -0
- package/dist/handlers/initialize.d.ts.map +1 -0
- package/dist/handlers/initialize.js +33 -0
- package/dist/handlers/initialize.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/integration/core-scanner.d.ts +89 -0
- package/dist/integration/index.d.ts +11 -0
- package/dist/integration/index.js +11 -0
- package/dist/integration/index.js.map +1 -0
- package/dist/server/index.d.ts +5 -0
- package/dist/server/index.js +5 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server.d.ts +63 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/lsp-types.d.ts +321 -0
- package/dist/types/lsp-types.js +274 -0
- package/dist/types/lsp-types.js.map +1 -0
- package/dist/utils/diagnostic.d.ts +84 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/position.d.ts +44 -0
- package/dist/utils/position.d.ts.map +1 -0
- package/dist/utils/position.js +96 -0
- package/dist/utils/position.js.map +1 -0
- package/dist/utils/workspace.d.ts +98 -0
- package/package.json +15 -15
- package/LICENSE +0 -121
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Show Violations Command - drift.showViolations
|
|
3
|
+
* @requirements 28.9
|
|
4
|
+
*/
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// Main Command
|
|
7
|
+
// ============================================================================
|
|
8
|
+
/**
|
|
9
|
+
* Execute show violations command
|
|
10
|
+
* Shows violations in the workspace
|
|
11
|
+
*/
|
|
12
|
+
export async function executeShowViolations(context, uri, patternId, violationId) {
|
|
13
|
+
const { state, logger, connection } = context;
|
|
14
|
+
logger.info(`Show violations requested${uri ? ` for: ${uri}` : ''}${patternId ? ` pattern: ${patternId}` : ''}`);
|
|
15
|
+
// If specific violation requested
|
|
16
|
+
if (violationId) {
|
|
17
|
+
return showSpecificViolation(context, violationId);
|
|
18
|
+
}
|
|
19
|
+
// Get violations to show
|
|
20
|
+
let violations = [];
|
|
21
|
+
if (uri) {
|
|
22
|
+
// Violations for specific document
|
|
23
|
+
const docViolations = state.violations.get(uri) ?? [];
|
|
24
|
+
violations = docViolations.map((v) => ({ uri, violation: v }));
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
// All violations
|
|
28
|
+
for (const [docUri, docViolations] of state.violations) {
|
|
29
|
+
for (const v of docViolations) {
|
|
30
|
+
violations.push({ uri: docUri, violation: v });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// Filter by pattern if specified
|
|
35
|
+
if (patternId) {
|
|
36
|
+
violations = violations.filter((entry) => entry.violation.patternId === patternId);
|
|
37
|
+
}
|
|
38
|
+
if (violations.length === 0) {
|
|
39
|
+
const message = uri
|
|
40
|
+
? `No violations found in ${getFileName(uri)}`
|
|
41
|
+
: patternId
|
|
42
|
+
? `No violations found for pattern: ${patternId}`
|
|
43
|
+
: 'No violations found in workspace';
|
|
44
|
+
connection.window.showInformationMessage(message);
|
|
45
|
+
return {
|
|
46
|
+
success: true,
|
|
47
|
+
message,
|
|
48
|
+
data: { violations: [] },
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
// Format violations summary
|
|
52
|
+
const summary = formatViolationsSummary(violations, state.patterns);
|
|
53
|
+
// Show summary
|
|
54
|
+
connection.window.showInformationMessage(summary);
|
|
55
|
+
return {
|
|
56
|
+
success: true,
|
|
57
|
+
message: `Found ${violations.length} violations`,
|
|
58
|
+
data: {
|
|
59
|
+
violations: violations.map((v) => ({
|
|
60
|
+
uri: v.uri,
|
|
61
|
+
...v.violation,
|
|
62
|
+
})),
|
|
63
|
+
summary: getViolationStatistics(violations),
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Show specific violation details
|
|
69
|
+
*/
|
|
70
|
+
async function showSpecificViolation(context, violationId) {
|
|
71
|
+
const { state, logger, connection } = context;
|
|
72
|
+
// Find the violation
|
|
73
|
+
let foundViolation = null;
|
|
74
|
+
let foundUri = '';
|
|
75
|
+
for (const [uri, violations] of state.violations) {
|
|
76
|
+
const violation = violations.find((v) => v.id === violationId);
|
|
77
|
+
if (violation) {
|
|
78
|
+
foundViolation = violation;
|
|
79
|
+
foundUri = uri;
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (!foundViolation) {
|
|
84
|
+
return {
|
|
85
|
+
success: false,
|
|
86
|
+
error: `Violation not found: ${violationId}`,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
// Get pattern details
|
|
90
|
+
const pattern = state.patterns.get(foundViolation.patternId);
|
|
91
|
+
// Format violation details
|
|
92
|
+
const details = formatViolationDetails(foundViolation, foundUri, pattern);
|
|
93
|
+
// Show details
|
|
94
|
+
connection.window.showInformationMessage(details);
|
|
95
|
+
// Offer to navigate to violation
|
|
96
|
+
const navigateResult = await connection.window.showInformationMessage(`Navigate to violation at line ${foundViolation.range.start.line + 1}?`, { title: 'Go to Location' }, { title: 'Close' });
|
|
97
|
+
if (navigateResult?.title === 'Go to Location') {
|
|
98
|
+
// TODO: Send notification to client to navigate to location
|
|
99
|
+
logger.info(`Navigate to ${foundUri}:${foundViolation.range.start.line + 1}`);
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
success: true,
|
|
103
|
+
message: `Violation details for: ${violationId}`,
|
|
104
|
+
data: {
|
|
105
|
+
violation: foundViolation,
|
|
106
|
+
uri: foundUri,
|
|
107
|
+
pattern,
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Format violations summary
|
|
113
|
+
*/
|
|
114
|
+
function formatViolationsSummary(violations, patterns) {
|
|
115
|
+
const lines = [];
|
|
116
|
+
lines.push(`⚠️ Drift Violations Summary`);
|
|
117
|
+
lines.push('');
|
|
118
|
+
// Group by severity
|
|
119
|
+
const bySeverity = groupBySeverity(violations);
|
|
120
|
+
if (bySeverity.error.length > 0) {
|
|
121
|
+
lines.push(`🔴 Errors: ${bySeverity.error.length}`);
|
|
122
|
+
}
|
|
123
|
+
if (bySeverity.warning.length > 0) {
|
|
124
|
+
lines.push(`🟡 Warnings: ${bySeverity.warning.length}`);
|
|
125
|
+
}
|
|
126
|
+
if (bySeverity.info.length > 0) {
|
|
127
|
+
lines.push(`🔵 Info: ${bySeverity.info.length}`);
|
|
128
|
+
}
|
|
129
|
+
if (bySeverity.hint.length > 0) {
|
|
130
|
+
lines.push(`💡 Hints: ${bySeverity.hint.length}`);
|
|
131
|
+
}
|
|
132
|
+
lines.push('');
|
|
133
|
+
// Group by pattern
|
|
134
|
+
const byPattern = groupByPattern(violations);
|
|
135
|
+
const patternCount = byPattern.size;
|
|
136
|
+
lines.push(`Across ${patternCount} pattern${patternCount === 1 ? '' : 's'}:`);
|
|
137
|
+
lines.push('');
|
|
138
|
+
for (const [patternId, patternViolations] of byPattern) {
|
|
139
|
+
const pattern = patterns.get(patternId);
|
|
140
|
+
const name = pattern?.name ?? patternId;
|
|
141
|
+
lines.push(` • ${name}: ${patternViolations.length}`);
|
|
142
|
+
}
|
|
143
|
+
// Group by file
|
|
144
|
+
const byFile = groupByFile(violations);
|
|
145
|
+
const fileCount = byFile.size;
|
|
146
|
+
lines.push('');
|
|
147
|
+
lines.push(`In ${fileCount} file${fileCount === 1 ? '' : 's'}`);
|
|
148
|
+
return lines.join('\n');
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Format violation details
|
|
152
|
+
*/
|
|
153
|
+
function formatViolationDetails(violation, uri, pattern) {
|
|
154
|
+
const lines = [];
|
|
155
|
+
const severityIcon = getSeverityIcon(violation.severity);
|
|
156
|
+
lines.push(`${severityIcon} Violation Details`);
|
|
157
|
+
lines.push('');
|
|
158
|
+
lines.push(`Message: ${violation.message}`);
|
|
159
|
+
lines.push(`Severity: ${violation.severity}`);
|
|
160
|
+
lines.push(`Location: ${getFileName(uri)}:${violation.range.start.line + 1}:${violation.range.start.character + 1}`);
|
|
161
|
+
lines.push('');
|
|
162
|
+
if (pattern) {
|
|
163
|
+
lines.push(`Pattern: ${pattern.name ?? violation.patternId}`);
|
|
164
|
+
if (pattern.category) {
|
|
165
|
+
lines.push(`Category: ${pattern.category}`);
|
|
166
|
+
}
|
|
167
|
+
if (pattern.description) {
|
|
168
|
+
lines.push(`Description: ${pattern.description}`);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
lines.push(`Pattern ID: ${violation.patternId}`);
|
|
173
|
+
}
|
|
174
|
+
return lines.join('\n');
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Group violations by severity
|
|
178
|
+
*/
|
|
179
|
+
function groupBySeverity(violations) {
|
|
180
|
+
const groups = {
|
|
181
|
+
error: [],
|
|
182
|
+
warning: [],
|
|
183
|
+
info: [],
|
|
184
|
+
hint: [],
|
|
185
|
+
};
|
|
186
|
+
for (const v of violations) {
|
|
187
|
+
const severity = v.violation.severity;
|
|
188
|
+
if (severity in groups) {
|
|
189
|
+
groups[severity].push(v);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
groups.hint.push(v);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return groups;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Group violations by pattern
|
|
199
|
+
*/
|
|
200
|
+
function groupByPattern(violations) {
|
|
201
|
+
const groups = new Map();
|
|
202
|
+
for (const v of violations) {
|
|
203
|
+
const patternId = v.violation.patternId;
|
|
204
|
+
const group = groups.get(patternId) ?? [];
|
|
205
|
+
group.push(v);
|
|
206
|
+
groups.set(patternId, group);
|
|
207
|
+
}
|
|
208
|
+
return groups;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Group violations by file
|
|
212
|
+
*/
|
|
213
|
+
function groupByFile(violations) {
|
|
214
|
+
const groups = new Map();
|
|
215
|
+
for (const v of violations) {
|
|
216
|
+
const group = groups.get(v.uri) ?? [];
|
|
217
|
+
group.push(v);
|
|
218
|
+
groups.set(v.uri, group);
|
|
219
|
+
}
|
|
220
|
+
return groups;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Get violation statistics
|
|
224
|
+
*/
|
|
225
|
+
function getViolationStatistics(violations) {
|
|
226
|
+
const bySeverity = {};
|
|
227
|
+
const byPattern = {};
|
|
228
|
+
const byFile = {};
|
|
229
|
+
for (const v of violations) {
|
|
230
|
+
bySeverity[v.violation.severity] = (bySeverity[v.violation.severity] ?? 0) + 1;
|
|
231
|
+
byPattern[v.violation.patternId] = (byPattern[v.violation.patternId] ?? 0) + 1;
|
|
232
|
+
byFile[v.uri] = (byFile[v.uri] ?? 0) + 1;
|
|
233
|
+
}
|
|
234
|
+
return {
|
|
235
|
+
total: violations.length,
|
|
236
|
+
bySeverity,
|
|
237
|
+
byPattern,
|
|
238
|
+
byFile,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Get severity icon
|
|
243
|
+
*/
|
|
244
|
+
function getSeverityIcon(severity) {
|
|
245
|
+
switch (severity) {
|
|
246
|
+
case 'error': return '🔴';
|
|
247
|
+
case 'warning': return '🟡';
|
|
248
|
+
case 'info': return '🔵';
|
|
249
|
+
case 'hint': return '💡';
|
|
250
|
+
default: return '⚪';
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Get file name from URI
|
|
255
|
+
*/
|
|
256
|
+
function getFileName(uri) {
|
|
257
|
+
return uri.split('/').pop() ?? uri;
|
|
258
|
+
}
|
|
259
|
+
//# sourceMappingURL=show-violations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"show-violations.js","sourceRoot":"","sources":["../../src/commands/show-violations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoBH,+EAA+E;AAC/E,eAAe;AACf,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,OAAsB,EACtB,GAAY,EACZ,SAAkB,EAClB,WAAoB;IAEpB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAE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,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QAC/E,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAC3C,CAAC;IAED,OAAO;QACL,KAAK,EAAE,UAAU,CAAC,MAAM;QACxB,UAAU;QACV,SAAS;QACT,MAAM;KACP,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,eAAe,CAAC,QAAgB;IACvC,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,OAAO,CAAC,CAAC,OAAO,IAAI,CAAC;QAC1B,KAAK,SAAS,CAAC,CAAC,OAAO,IAAI,CAAC;QAC5B,KAAK,MAAM,CAAC,CAAC,OAAO,IAAI,CAAC;QACzB,KAAK,MAAM,CAAC,CAAC,OAAO,IAAI,CAAC;QACzB,OAAO,CAAC,CAAC,OAAO,GAAG,CAAC;IACtB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,GAAW;IAC9B,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,GAAG,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LSP Handlers Module
|
|
3
|
+
*
|
|
4
|
+
* Exports all LSP request and notification handlers.
|
|
5
|
+
*
|
|
6
|
+
* @requirements 27.1-27.7 - LSP Server Core Capabilities
|
|
7
|
+
* @requirements 28.1-28.9 - LSP Server Commands
|
|
8
|
+
*/
|
|
9
|
+
export { createInitializeHandler } from './initialize.js';
|
|
10
|
+
export type { InitializeHandler } from './initialize.js';
|
|
11
|
+
export { createDocumentSyncHandler } from './document-sync.js';
|
|
12
|
+
export type { DocumentSyncHandler } from './document-sync.js';
|
|
13
|
+
export { createDiagnosticsHandler } from './diagnostics.js';
|
|
14
|
+
export type { DiagnosticsHandler, ViolationDiagnostic } from './diagnostics.js';
|
|
15
|
+
export { createCodeActionsHandler } from './code-actions.js';
|
|
16
|
+
export type { CodeActionsHandler } from './code-actions.js';
|
|
17
|
+
export { createHoverHandler } from './hover.js';
|
|
18
|
+
export type { HoverHandler } from './hover.js';
|
|
19
|
+
export { createCodeLensHandler } from './code-lens.js';
|
|
20
|
+
export type { CodeLensHandler } from './code-lens.js';
|
|
21
|
+
export { createCommandsHandler } from './commands.js';
|
|
22
|
+
export type { CommandsHandler, CommandResult } from './commands.js';
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LSP Handlers Module
|
|
3
|
+
*
|
|
4
|
+
* Exports all LSP request and notification handlers.
|
|
5
|
+
*
|
|
6
|
+
* @requirements 27.1-27.7 - LSP Server Core Capabilities
|
|
7
|
+
* @requirements 28.1-28.9 - LSP Server Commands
|
|
8
|
+
*/
|
|
9
|
+
export { createInitializeHandler } from './initialize.js';
|
|
10
|
+
export { createDocumentSyncHandler } from './document-sync.js';
|
|
11
|
+
export { createDiagnosticsHandler } from './diagnostics.js';
|
|
12
|
+
export { createCodeActionsHandler } from './code-actions.js';
|
|
13
|
+
export { createHoverHandler } from './hover.js';
|
|
14
|
+
export { createCodeLensHandler } from './code-lens.js';
|
|
15
|
+
export { createCommandsHandler } from './commands.js';
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/handlers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAG1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAG/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAG5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAG7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Initialize Handler
|
|
3
|
+
*
|
|
4
|
+
* Handles the LSP initialize request and initialized notification.
|
|
5
|
+
* Sets up server state and returns capabilities to the client.
|
|
6
|
+
*
|
|
7
|
+
* @requirements 27.1 - THE LSP_Server SHALL implement the Language Server Protocol specification
|
|
8
|
+
*/
|
|
9
|
+
import type { Connection } from 'vscode-languageserver';
|
|
10
|
+
interface ServerState {
|
|
11
|
+
initialized: boolean;
|
|
12
|
+
workspaceFolders: Array<{
|
|
13
|
+
uri: string;
|
|
14
|
+
name: string;
|
|
15
|
+
}>;
|
|
16
|
+
hasConfigurationCapability: boolean;
|
|
17
|
+
hasWorkspaceFolderCapability: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface Logger {
|
|
20
|
+
error(message: string): void;
|
|
21
|
+
warn(message: string): void;
|
|
22
|
+
info(message: string): void;
|
|
23
|
+
debug(message: string): void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Initialize handler interface
|
|
27
|
+
*/
|
|
28
|
+
export interface InitializeHandler {
|
|
29
|
+
/** Called when server is fully initialized */
|
|
30
|
+
onInitialized(): void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Create the initialize handler
|
|
34
|
+
*
|
|
35
|
+
* Note: The actual onInitialize is handled in server.ts since it needs
|
|
36
|
+
* to return the InitializeResult synchronously. This handler provides
|
|
37
|
+
* additional initialization logic.
|
|
38
|
+
*/
|
|
39
|
+
export declare function createInitializeHandler(_connection: Connection, state: ServerState, logger: Logger): InitializeHandler;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=initialize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../../src/handlers/initialize.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAMxD,UAAU,WAAW;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,gBAAgB,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACvD,0BAA0B,EAAE,OAAO,CAAC;IACpC,4BAA4B,EAAE,OAAO,CAAC;CACvC;AAED,UAAU,MAAM;IACd,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,8CAA8C;IAC9C,aAAa,IAAI,IAAI,CAAC;CACvB;AAMD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,UAAU,EACvB,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,MAAM,GACb,iBAAiB,CAenB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Initialize Handler
|
|
3
|
+
*
|
|
4
|
+
* Handles the LSP initialize request and initialized notification.
|
|
5
|
+
* Sets up server state and returns capabilities to the client.
|
|
6
|
+
*
|
|
7
|
+
* @requirements 27.1 - THE LSP_Server SHALL implement the Language Server Protocol specification
|
|
8
|
+
*/
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// Handler Factory
|
|
11
|
+
// ============================================================================
|
|
12
|
+
/**
|
|
13
|
+
* Create the initialize handler
|
|
14
|
+
*
|
|
15
|
+
* Note: The actual onInitialize is handled in server.ts since it needs
|
|
16
|
+
* to return the InitializeResult synchronously. This handler provides
|
|
17
|
+
* additional initialization logic.
|
|
18
|
+
*/
|
|
19
|
+
export function createInitializeHandler(_connection, state, logger) {
|
|
20
|
+
return {
|
|
21
|
+
onInitialized() {
|
|
22
|
+
logger.info('Server initialization complete');
|
|
23
|
+
// Perform any post-initialization tasks
|
|
24
|
+
if (state.workspaceFolders.length > 0) {
|
|
25
|
+
logger.debug(`Monitoring ${state.workspaceFolders.length} workspace folder(s)`);
|
|
26
|
+
// TODO: Initialize driftdetect-core scanner for each workspace
|
|
27
|
+
// TODO: Load patterns from .drift/ directories
|
|
28
|
+
// TODO: Perform initial scan if needed
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=initialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../src/handlers/initialize.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA8BH,+EAA+E;AAC/E,kBAAkB;AAClB,+EAA+E;AAE/E;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CACrC,WAAuB,EACvB,KAAkB,EAClB,MAAc;IAEd,OAAO;QACL,aAAa;YACX,MAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;YAE9C,wCAAwC;YACxC,IAAI,KAAK,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACtC,MAAM,CAAC,KAAK,CAAC,cAAc,KAAK,CAAC,gBAAgB,CAAC,MAAM,sBAAsB,CAAC,CAAC;gBAEhF,+DAA+D;gBAC/D,+CAA+C;gBAC/C,uCAAuC;YACzC,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @drift/lsp - Language Server Protocol implementation for Drift
|
|
3
|
+
*
|
|
4
|
+
* Provides LSP server capabilities for IDE integration:
|
|
5
|
+
* - Document synchronization (open, change, save, close)
|
|
6
|
+
* - Diagnostic publishing for violations
|
|
7
|
+
* - Code actions for quick fixes
|
|
8
|
+
* - Hover information for violations
|
|
9
|
+
* - Code lens for pattern information
|
|
10
|
+
* - Command handling for pattern management
|
|
11
|
+
*
|
|
12
|
+
* @requirements 27.1-27.7 - LSP Server Core Capabilities
|
|
13
|
+
* @requirements 28.1-28.9 - LSP Server Commands
|
|
14
|
+
*/
|
|
15
|
+
export declare const VERSION = "0.0.1";
|
|
16
|
+
export { createDriftServer, startDriftServer } from './server.js';
|
|
17
|
+
export type { DriftServer, ServerOptions } from './server.js';
|
|
18
|
+
export { buildServerCapabilities, DRIFT_COMMANDS, SERVER_INFO } from './capabilities.js';
|
|
19
|
+
export * from './handlers/index.js';
|
|
20
|
+
export * from './utils/index.js';
|
|
21
|
+
export * from './integration/index.js';
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @drift/lsp - Language Server Protocol implementation for Drift
|
|
3
|
+
*
|
|
4
|
+
* Provides LSP server capabilities for IDE integration:
|
|
5
|
+
* - Document synchronization (open, change, save, close)
|
|
6
|
+
* - Diagnostic publishing for violations
|
|
7
|
+
* - Code actions for quick fixes
|
|
8
|
+
* - Hover information for violations
|
|
9
|
+
* - Code lens for pattern information
|
|
10
|
+
* - Command handling for pattern management
|
|
11
|
+
*
|
|
12
|
+
* @requirements 27.1-27.7 - LSP Server Core Capabilities
|
|
13
|
+
* @requirements 28.1-28.9 - LSP Server Commands
|
|
14
|
+
*/
|
|
15
|
+
export const VERSION = '0.0.1';
|
|
16
|
+
// Server exports
|
|
17
|
+
export { createDriftServer, startDriftServer } from './server.js';
|
|
18
|
+
// Capabilities exports
|
|
19
|
+
export { buildServerCapabilities, DRIFT_COMMANDS, SERVER_INFO } from './capabilities.js';
|
|
20
|
+
// Handler exports
|
|
21
|
+
export * from './handlers/index.js';
|
|
22
|
+
// Utility exports
|
|
23
|
+
export * from './utils/index.js';
|
|
24
|
+
// Integration exports
|
|
25
|
+
export * from './integration/index.js';
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B,iBAAiB;AACjB,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGlE,uBAAuB;AACvB,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEzF,kBAAkB;AAClB,cAAc,qBAAqB,CAAC;AAEpC,kBAAkB;AAClB,cAAc,kBAAkB,CAAC;AAEjC,sBAAsB;AACtB,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Scanner Integration
|
|
3
|
+
*
|
|
4
|
+
* Connects the LSP diagnostics handler to driftdetect-core scanner
|
|
5
|
+
* and driftdetect-detectors for pattern detection and violation generation.
|
|
6
|
+
*
|
|
7
|
+
* @requirements 27.3 - THE LSP_Server SHALL publish diagnostics for violations
|
|
8
|
+
* @requirements 27.7 - THE LSP_Server SHALL respond to diagnostics within 200ms of file change
|
|
9
|
+
*/
|
|
10
|
+
import { PatternStore } from 'driftdetect-core';
|
|
11
|
+
import type { CoreIntegrationConfig, ScanResult, ScanOptions } from './types.js';
|
|
12
|
+
/**
|
|
13
|
+
* Logger interface for the core scanner
|
|
14
|
+
*/
|
|
15
|
+
interface Logger {
|
|
16
|
+
error(message: string): void;
|
|
17
|
+
warn(message: string): void;
|
|
18
|
+
info(message: string): void;
|
|
19
|
+
debug(message: string): void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Core Scanner - Integrates driftdetect-core with LSP diagnostics
|
|
23
|
+
*
|
|
24
|
+
* This class bridges the LSP server with the core drift detection engine.
|
|
25
|
+
* It manages the pattern store, parser manager, evaluator, and detector registry
|
|
26
|
+
* to scan documents and generate violations.
|
|
27
|
+
*/
|
|
28
|
+
export declare class CoreScanner {
|
|
29
|
+
private config;
|
|
30
|
+
private logger;
|
|
31
|
+
private patternStore;
|
|
32
|
+
private parserManager;
|
|
33
|
+
private evaluator;
|
|
34
|
+
private initialized;
|
|
35
|
+
private scanCache;
|
|
36
|
+
private cacheTimeout;
|
|
37
|
+
constructor(config: Partial<CoreIntegrationConfig> | undefined, logger: Logger);
|
|
38
|
+
/**
|
|
39
|
+
* Initialize the core scanner
|
|
40
|
+
*
|
|
41
|
+
* Sets up the pattern store, parser manager, evaluator, and detector registry.
|
|
42
|
+
*/
|
|
43
|
+
initialize(): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Check if the scanner is initialized
|
|
46
|
+
*/
|
|
47
|
+
isInitialized(): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Get the pattern store instance
|
|
50
|
+
*/
|
|
51
|
+
getPatternStore(): PatternStore | null;
|
|
52
|
+
/**
|
|
53
|
+
* Scan a document for violations
|
|
54
|
+
*
|
|
55
|
+
* @requirements 27.3 - Publish diagnostics for violations
|
|
56
|
+
* @requirements 27.7 - Respond within 200ms
|
|
57
|
+
*/
|
|
58
|
+
scan(uri: string, content: string, options?: ScanOptions): Promise<ScanResult>;
|
|
59
|
+
/**
|
|
60
|
+
* Invalidate cache for a document
|
|
61
|
+
*/
|
|
62
|
+
invalidateCache(uri: string): void;
|
|
63
|
+
/**
|
|
64
|
+
* Clear all cached scan results
|
|
65
|
+
*/
|
|
66
|
+
clearCache(): void;
|
|
67
|
+
/**
|
|
68
|
+
* Convert a driftdetect-core Violation to ViolationInfo
|
|
69
|
+
*/
|
|
70
|
+
private violationToInfo;
|
|
71
|
+
/**
|
|
72
|
+
* Convert a URI to a file path
|
|
73
|
+
*/
|
|
74
|
+
private uriToPath;
|
|
75
|
+
/**
|
|
76
|
+
* Get the language from a URI based on file extension
|
|
77
|
+
*/
|
|
78
|
+
private getLanguageFromUri;
|
|
79
|
+
/**
|
|
80
|
+
* Shutdown the core scanner
|
|
81
|
+
*/
|
|
82
|
+
shutdown(): Promise<void>;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Create a core scanner instance
|
|
86
|
+
*/
|
|
87
|
+
export declare function createCoreScanner(config: Partial<CoreIntegrationConfig> | undefined, logger: Logger): CoreScanner;
|
|
88
|
+
export {};
|
|
89
|
+
//# sourceMappingURL=core-scanner.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration module exports
|
|
3
|
+
*
|
|
4
|
+
* Provides integration between @drift/lsp and driftdetect-core.
|
|
5
|
+
* Connects the LSP server to the core scanner, pattern store,
|
|
6
|
+
* and variant manager for full drift detection functionality.
|
|
7
|
+
*/
|
|
8
|
+
export * from './core-scanner.js';
|
|
9
|
+
export * from './pattern-store-adapter.js';
|
|
10
|
+
export * from './types.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration module exports
|
|
3
|
+
*
|
|
4
|
+
* Provides integration between @drift/lsp and driftdetect-core.
|
|
5
|
+
* Connects the LSP server to the core scanner, pattern store,
|
|
6
|
+
* and variant manager for full drift detection functionality.
|
|
7
|
+
*/
|
|
8
|
+
export * from './core-scanner.js';
|
|
9
|
+
export * from './pattern-store-adapter.js';
|
|
10
|
+
export * from './types.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/integration/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,YAAY,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drift LSP Server
|
|
3
|
+
*
|
|
4
|
+
* Main entry point for the Language Server Protocol implementation.
|
|
5
|
+
* Creates and manages the LSP connection, registers handlers, and
|
|
6
|
+
* coordinates between the editor and Drift core engine.
|
|
7
|
+
*
|
|
8
|
+
* @requirements 27.1 - THE LSP_Server SHALL implement the Language Server Protocol specification
|
|
9
|
+
* @requirements 27.7 - THE LSP_Server SHALL respond to diagnostics within 200ms of file change
|
|
10
|
+
*/
|
|
11
|
+
import { TextDocuments } from 'vscode-languageserver/node.js';
|
|
12
|
+
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
13
|
+
import type { Connection } from 'vscode-languageserver';
|
|
14
|
+
/**
|
|
15
|
+
* Server configuration options
|
|
16
|
+
*/
|
|
17
|
+
export interface ServerOptions {
|
|
18
|
+
/** Workspace root path */
|
|
19
|
+
workspaceRoot?: string;
|
|
20
|
+
/** Enable debug logging */
|
|
21
|
+
debug?: boolean;
|
|
22
|
+
/** Custom connection (for testing) */
|
|
23
|
+
connection?: Connection;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Server state
|
|
27
|
+
*/
|
|
28
|
+
export interface ServerState {
|
|
29
|
+
/** Whether server has been initialized */
|
|
30
|
+
initialized: boolean;
|
|
31
|
+
/** Workspace folders */
|
|
32
|
+
workspaceFolders: Array<{
|
|
33
|
+
uri: string;
|
|
34
|
+
name: string;
|
|
35
|
+
}>;
|
|
36
|
+
/** Client capabilities */
|
|
37
|
+
hasConfigurationCapability: boolean;
|
|
38
|
+
hasWorkspaceFolderCapability: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Drift LSP Server interface
|
|
42
|
+
*/
|
|
43
|
+
export interface DriftServer {
|
|
44
|
+
/** Start the server */
|
|
45
|
+
start(): void;
|
|
46
|
+
/** Stop the server */
|
|
47
|
+
stop(): void;
|
|
48
|
+
/** Get the LSP connection */
|
|
49
|
+
getConnection(): Connection;
|
|
50
|
+
/** Get the document manager */
|
|
51
|
+
getDocuments(): TextDocuments<TextDocument>;
|
|
52
|
+
/** Check if server is running */
|
|
53
|
+
isRunning(): boolean;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Create a new Drift LSP server instance
|
|
57
|
+
*/
|
|
58
|
+
export declare function createDriftServer(options?: ServerOptions): DriftServer;
|
|
59
|
+
/**
|
|
60
|
+
* Create and start a Drift LSP server
|
|
61
|
+
*/
|
|
62
|
+
export declare function startDriftServer(options?: ServerOptions): DriftServer;
|
|
63
|
+
//# sourceMappingURL=server.d.ts.map
|