driftdetect-lsp 0.9.34 → 0.9.38
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 +3 -3
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Drift LSP Server Entry Point
|
|
4
|
+
*
|
|
5
|
+
* This is the executable entry point for the Drift LSP server.
|
|
6
|
+
* It can be run directly or spawned by an editor extension.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* drift-lsp [--debug]
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Drift LSP Server Entry Point
|
|
4
|
+
*
|
|
5
|
+
* This is the executable entry point for the Drift LSP server.
|
|
6
|
+
* It can be run directly or spawned by an editor extension.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* drift-lsp [--debug]
|
|
10
|
+
*/
|
|
11
|
+
import { startDriftServer } from '../server.js';
|
|
12
|
+
// Parse command line arguments
|
|
13
|
+
const args = process.argv.slice(2);
|
|
14
|
+
const debug = args.includes('--debug') || args.includes('-d');
|
|
15
|
+
// Start the server
|
|
16
|
+
const server = startDriftServer({ debug });
|
|
17
|
+
// Handle process signals
|
|
18
|
+
process.on('SIGINT', () => {
|
|
19
|
+
server.stop();
|
|
20
|
+
process.exit(0);
|
|
21
|
+
});
|
|
22
|
+
process.on('SIGTERM', () => {
|
|
23
|
+
server.stop();
|
|
24
|
+
process.exit(0);
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/bin/server.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,+BAA+B;AAC/B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnC,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAE9D,mBAAmB;AACnB,MAAM,MAAM,GAAG,gBAAgB,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAE3C,yBAAyB;AACzB,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;IACxB,MAAM,CAAC,IAAI,EAAE,CAAC;IACd,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;IACzB,MAAM,CAAC,IAAI,EAAE,CAAC;IACd,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LSP Server Capabilities
|
|
3
|
+
*
|
|
4
|
+
* Defines the capabilities that the Drift LSP server advertises to clients.
|
|
5
|
+
* Based on the Language Server Protocol specification.
|
|
6
|
+
*
|
|
7
|
+
* @requirements 27.1 - THE LSP_Server SHALL implement the Language Server Protocol specification
|
|
8
|
+
* @requirements 27.2 - THE LSP_Server SHALL support document synchronization
|
|
9
|
+
* @requirements 27.3 - THE LSP_Server SHALL publish diagnostics for violations
|
|
10
|
+
* @requirements 27.4 - THE LSP_Server SHALL provide code actions for quick fixes
|
|
11
|
+
* @requirements 27.5 - THE LSP_Server SHALL provide hover information for violations
|
|
12
|
+
* @requirements 27.6 - THE LSP_Server SHALL provide code lens for pattern information
|
|
13
|
+
*/
|
|
14
|
+
import type { ServerCapabilities, InitializeResult } from 'vscode-languageserver';
|
|
15
|
+
/**
|
|
16
|
+
* Server identification information
|
|
17
|
+
*/
|
|
18
|
+
export declare const SERVER_INFO: {
|
|
19
|
+
readonly name: "drift-lsp";
|
|
20
|
+
readonly version: "0.0.1";
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* All Drift LSP commands
|
|
24
|
+
* @requirements 28.1-28.9 - LSP Server Commands
|
|
25
|
+
*/
|
|
26
|
+
export declare const DRIFT_COMMANDS: {
|
|
27
|
+
/** Approve a pattern for enforcement */
|
|
28
|
+
readonly APPROVE_PATTERN: "drift.approvePattern";
|
|
29
|
+
/** Ignore a pattern (don't enforce) */
|
|
30
|
+
readonly IGNORE_PATTERN: "drift.ignorePattern";
|
|
31
|
+
/** Ignore a single occurrence of a violation */
|
|
32
|
+
readonly IGNORE_ONCE: "drift.ignoreOnce";
|
|
33
|
+
/** Create a variant (intentional deviation) */
|
|
34
|
+
readonly CREATE_VARIANT: "drift.createVariant";
|
|
35
|
+
/** Request AI explanation for a violation */
|
|
36
|
+
readonly EXPLAIN_AI: "drift.explainWithAI";
|
|
37
|
+
/** Request AI-generated fix for a violation */
|
|
38
|
+
readonly FIX_AI: "drift.fixWithAI";
|
|
39
|
+
/** Rescan workspace for patterns and violations */
|
|
40
|
+
readonly RESCAN: "drift.rescan";
|
|
41
|
+
/** Show all discovered patterns */
|
|
42
|
+
readonly SHOW_PATTERNS: "drift.showPatterns";
|
|
43
|
+
/** Show all current violations */
|
|
44
|
+
readonly SHOW_VIOLATIONS: "drift.showViolations";
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Array of all command IDs for registration
|
|
48
|
+
*/
|
|
49
|
+
export declare const ALL_COMMANDS: readonly string[];
|
|
50
|
+
/**
|
|
51
|
+
* Supported code action kinds
|
|
52
|
+
*/
|
|
53
|
+
export declare const SUPPORTED_CODE_ACTION_KINDS: readonly ["quickfix", "refactor", "source"];
|
|
54
|
+
/**
|
|
55
|
+
* Build the full server capabilities object
|
|
56
|
+
*
|
|
57
|
+
* This defines what the Drift LSP server can do, following the spec:
|
|
58
|
+
* - textDocumentSync: Document synchronization with incremental changes
|
|
59
|
+
* - diagnosticProvider: Publish diagnostics for violations
|
|
60
|
+
* - codeActionProvider: Quick fixes and refactoring actions
|
|
61
|
+
* - hoverProvider: Show violation details on hover
|
|
62
|
+
* - codeLensProvider: Inline pattern information
|
|
63
|
+
* - executeCommandProvider: All drift.* commands
|
|
64
|
+
* - workspace: Workspace folder support and file operations
|
|
65
|
+
*/
|
|
66
|
+
export declare function buildServerCapabilities(): ServerCapabilities;
|
|
67
|
+
/**
|
|
68
|
+
* Build the initialize result to send to the client
|
|
69
|
+
*/
|
|
70
|
+
export declare function buildInitializeResult(): InitializeResult;
|
|
71
|
+
/**
|
|
72
|
+
* Check if client supports a specific capability path
|
|
73
|
+
*/
|
|
74
|
+
export declare function clientSupportsCapability(clientCapabilities: Record<string, unknown> | undefined, path: string): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Check if client supports workspace configuration
|
|
77
|
+
*/
|
|
78
|
+
export declare function clientSupportsConfiguration(clientCapabilities: Record<string, unknown> | undefined): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Check if client supports workspace folders
|
|
81
|
+
*/
|
|
82
|
+
export declare function clientSupportsWorkspaceFolders(clientCapabilities: Record<string, unknown> | undefined): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Check if client supports work done progress
|
|
85
|
+
*/
|
|
86
|
+
export declare function clientSupportsWorkDoneProgress(clientCapabilities: Record<string, unknown> | undefined): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Check if client supports diagnostic related information
|
|
89
|
+
*/
|
|
90
|
+
export declare function clientSupportsDiagnosticRelatedInfo(clientCapabilities: Record<string, unknown> | undefined): boolean;
|
|
91
|
+
//# sourceMappingURL=capabilities.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Approve Pattern Command - drift.approvePattern
|
|
3
|
+
* @requirements 28.1
|
|
4
|
+
*/
|
|
5
|
+
import type { ServerContext, CommandResult } from '../server/types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Execute approve pattern command
|
|
8
|
+
* Marks a pattern as approved, removing all violations for that pattern
|
|
9
|
+
*/
|
|
10
|
+
export declare function executeApprovePattern(context: ServerContext, patternId: string): Promise<CommandResult>;
|
|
11
|
+
/**
|
|
12
|
+
* Approve multiple patterns at once
|
|
13
|
+
*/
|
|
14
|
+
export declare function executeApprovePatterns(context: ServerContext, patternIds: string[]): Promise<CommandResult>;
|
|
15
|
+
//# sourceMappingURL=approve-pattern.d.ts.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Approve Pattern Command - drift.approvePattern
|
|
3
|
+
* @requirements 28.1
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Execute approve pattern command
|
|
7
|
+
* Marks a pattern as approved, removing all violations for that pattern
|
|
8
|
+
*/
|
|
9
|
+
export async function executeApprovePattern(context, patternId) {
|
|
10
|
+
const { state, logger, connection } = context;
|
|
11
|
+
if (!patternId) {
|
|
12
|
+
return {
|
|
13
|
+
success: false,
|
|
14
|
+
error: 'Pattern ID is required',
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
logger.info(`Approving pattern: ${patternId}`);
|
|
18
|
+
// Check if pattern exists
|
|
19
|
+
const pattern = state.patterns.get(patternId);
|
|
20
|
+
if (!pattern) {
|
|
21
|
+
// Pattern might not be in cache, but we can still approve it
|
|
22
|
+
logger.warn(`Pattern not found in cache: ${patternId}`);
|
|
23
|
+
}
|
|
24
|
+
// TODO: Integrate with driftdetect-core pattern store to persist approval
|
|
25
|
+
// For now, we'll update the in-memory state
|
|
26
|
+
// Remove violations for this pattern from all documents
|
|
27
|
+
let removedCount = 0;
|
|
28
|
+
for (const [uri, violations] of state.violations) {
|
|
29
|
+
const filtered = violations.filter((v) => v.patternId !== patternId);
|
|
30
|
+
const removed = violations.length - filtered.length;
|
|
31
|
+
if (removed > 0) {
|
|
32
|
+
state.violations.set(uri, filtered);
|
|
33
|
+
removedCount += removed;
|
|
34
|
+
// Update diagnostics for this document
|
|
35
|
+
const diagnostics = state.diagnostics.get(uri);
|
|
36
|
+
if (diagnostics) {
|
|
37
|
+
const filteredDiagnostics = diagnostics.filter((d) => d.patternId !== patternId);
|
|
38
|
+
state.diagnostics.set(uri, filteredDiagnostics);
|
|
39
|
+
// Publish updated diagnostics
|
|
40
|
+
connection.sendDiagnostics({
|
|
41
|
+
uri,
|
|
42
|
+
diagnostics: filteredDiagnostics.map((diag) => ({
|
|
43
|
+
range: diag.range,
|
|
44
|
+
severity: diag.severity === 'error' ? 1 : diag.severity === 'warning' ? 2 : diag.severity === 'info' ? 3 : 4,
|
|
45
|
+
code: diag.code,
|
|
46
|
+
source: diag.source,
|
|
47
|
+
message: diag.message,
|
|
48
|
+
})),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// Show notification
|
|
54
|
+
connection.window.showInformationMessage(`Pattern "${patternId}" approved. ${removedCount} violation${removedCount === 1 ? '' : 's'} removed.`);
|
|
55
|
+
logger.info(`Pattern approved: ${patternId}, removed ${removedCount} violations`);
|
|
56
|
+
return {
|
|
57
|
+
success: true,
|
|
58
|
+
message: `Pattern "${patternId}" approved`,
|
|
59
|
+
data: {
|
|
60
|
+
patternId,
|
|
61
|
+
removedViolations: removedCount,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Approve multiple patterns at once
|
|
67
|
+
*/
|
|
68
|
+
export async function executeApprovePatterns(context, patternIds) {
|
|
69
|
+
const results = [];
|
|
70
|
+
for (const patternId of patternIds) {
|
|
71
|
+
const result = await executeApprovePattern(context, patternId);
|
|
72
|
+
if (result.success && result.data) {
|
|
73
|
+
results.push(result.data);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const totalRemoved = results.reduce((sum, r) => sum + r.removedViolations, 0);
|
|
77
|
+
return {
|
|
78
|
+
success: true,
|
|
79
|
+
message: `Approved ${results.length} patterns, removed ${totalRemoved} violations`,
|
|
80
|
+
data: { results },
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=approve-pattern.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approve-pattern.js","sourceRoot":"","sources":["../../src/commands/approve-pattern.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,OAAsB,EACtB,SAAiB;IAEjB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAE9C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,wBAAwB;SAChC,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,sBAAsB,SAAS,EAAE,CAAC,CAAC;IAE/C,0BAA0B;IAC1B,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC9C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,6DAA6D;QAC7D,MAAM,CAAC,IAAI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AI;QACb,OAAO,EAAE,YAAY,OAAO,CAAC,MAAM,sBAAsB,YAAY,aAAa;QAClF,IAAI,EAAE,EAAE,OAAO,EAAE;KAClB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create Variant Command - drift.createVariant
|
|
3
|
+
* @requirements 28.4
|
|
4
|
+
*/
|
|
5
|
+
import type { ServerContext, CommandResult } from '../server/types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Execute create variant command
|
|
8
|
+
* Creates a new pattern variant from an existing violation
|
|
9
|
+
*/
|
|
10
|
+
export declare function executeCreateVariant(context: ServerContext, patternId: string, violationId?: string): Promise<CommandResult>;
|
|
11
|
+
/**
|
|
12
|
+
* Validate variant name
|
|
13
|
+
*/
|
|
14
|
+
export declare function validateVariantName(name: string): string | null;
|
|
15
|
+
/**
|
|
16
|
+
* Get suggested variant names based on violation context
|
|
17
|
+
*/
|
|
18
|
+
export declare function getSuggestedVariantNames(basePatternName: string, violationContext?: {
|
|
19
|
+
file?: string;
|
|
20
|
+
message?: string;
|
|
21
|
+
}): string[];
|
|
22
|
+
//# sourceMappingURL=create-variant.d.ts.map
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create Variant Command - drift.createVariant
|
|
3
|
+
* @requirements 28.4
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Execute create variant command
|
|
7
|
+
* Creates a new pattern variant from an existing violation
|
|
8
|
+
*/
|
|
9
|
+
export async function executeCreateVariant(context, patternId, violationId) {
|
|
10
|
+
const { state, logger, connection } = context;
|
|
11
|
+
if (!patternId) {
|
|
12
|
+
return {
|
|
13
|
+
success: false,
|
|
14
|
+
error: 'Pattern ID is required',
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
logger.info(`Creating variant for pattern: ${patternId}`);
|
|
18
|
+
// Get the base pattern
|
|
19
|
+
const basePattern = state.patterns.get(patternId);
|
|
20
|
+
if (!basePattern) {
|
|
21
|
+
return {
|
|
22
|
+
success: false,
|
|
23
|
+
error: `Pattern not found: ${patternId}`,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
// If violation ID provided, get the violation for context
|
|
27
|
+
let violation = null;
|
|
28
|
+
if (violationId) {
|
|
29
|
+
for (const violations of state.violations.values()) {
|
|
30
|
+
const found = violations.find((v) => v.id === violationId);
|
|
31
|
+
if (found) {
|
|
32
|
+
violation = { file: found.file, location: found.range };
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// TODO: Integrate with driftdetect-core variant manager
|
|
38
|
+
// For now, we'll create a variant with a generated name
|
|
39
|
+
// Generate variant ID and name
|
|
40
|
+
const variantId = generateVariantId(patternId);
|
|
41
|
+
const variantName = `${basePattern.name ?? patternId} (variant)`;
|
|
42
|
+
// Create the variant (in-memory for now)
|
|
43
|
+
const variant = {
|
|
44
|
+
id: variantId,
|
|
45
|
+
basePatternId: patternId,
|
|
46
|
+
name: variantName,
|
|
47
|
+
description: undefined,
|
|
48
|
+
createdAt: new Date().toISOString(),
|
|
49
|
+
context: violation ? {
|
|
50
|
+
file: violation.file,
|
|
51
|
+
location: violation.location,
|
|
52
|
+
} : undefined,
|
|
53
|
+
};
|
|
54
|
+
logger.info(`Variant created: ${variantId}`);
|
|
55
|
+
// Show success message
|
|
56
|
+
connection.window.showInformationMessage(`Variant "${variantName}" created for pattern "${patternId}"`);
|
|
57
|
+
return {
|
|
58
|
+
success: true,
|
|
59
|
+
message: `Variant "${variantName}" created`,
|
|
60
|
+
data: {
|
|
61
|
+
variant,
|
|
62
|
+
basePatternId: patternId,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Generate a unique variant ID
|
|
68
|
+
*/
|
|
69
|
+
function generateVariantId(basePatternId) {
|
|
70
|
+
const timestamp = Date.now().toString(36);
|
|
71
|
+
const random = Math.random().toString(36).substring(2, 6);
|
|
72
|
+
return `${basePatternId}:variant:${timestamp}${random}`;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Validate variant name
|
|
76
|
+
*/
|
|
77
|
+
export function validateVariantName(name) {
|
|
78
|
+
if (!name || name.trim().length === 0) {
|
|
79
|
+
return 'Variant name cannot be empty';
|
|
80
|
+
}
|
|
81
|
+
if (name.length > 100) {
|
|
82
|
+
return 'Variant name must be 100 characters or less';
|
|
83
|
+
}
|
|
84
|
+
if (!/^[a-zA-Z0-9\s\-_()]+$/.test(name)) {
|
|
85
|
+
return 'Variant name can only contain letters, numbers, spaces, hyphens, underscores, and parentheses';
|
|
86
|
+
}
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Get suggested variant names based on violation context
|
|
91
|
+
*/
|
|
92
|
+
export function getSuggestedVariantNames(basePatternName, violationContext) {
|
|
93
|
+
const suggestions = [];
|
|
94
|
+
// Base suggestion
|
|
95
|
+
suggestions.push(`${basePatternName} (variant)`);
|
|
96
|
+
// File-based suggestion
|
|
97
|
+
if (violationContext?.file) {
|
|
98
|
+
const fileName = violationContext.file.split('/').pop()?.replace(/\.[^.]+$/, '');
|
|
99
|
+
if (fileName) {
|
|
100
|
+
suggestions.push(`${basePatternName} (${fileName})`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// Context-based suggestions
|
|
104
|
+
suggestions.push(`${basePatternName} (alternative)`);
|
|
105
|
+
suggestions.push(`${basePatternName} (exception)`);
|
|
106
|
+
suggestions.push(`${basePatternName} (legacy)`);
|
|
107
|
+
return suggestions;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=create-variant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-variant.js","sourceRoot":"","sources":["../../src/commands/create-variant.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,C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,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,OAAO,+FAA+F,CAAC;IACzG,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CACtC,eAAuB,EACvB,gBAGC;IAED,MAAM,WAAW,GAAa,EAAE,CAAC;IAEjC,kBAAkB;IAClB,WAAW,CAAC,IAAI,CAAC,GAAG,eAAe,YAAY,CAAC,CAAC;IAEjD,wBAAwB;IACxB,IAAI,gBAAgB,EAAE,IAAI,EAAE,CAAC;QAC3B,MAAM,QAAQ,GAAG,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QACjF,IAAI,QAAQ,EAAE,CAAC;YACb,WAAW,CAAC,IAAI,CAAC,GAAG,eAAe,KAAK,QAAQ,GAAG,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IAED,4BAA4B;IAC5B,WAAW,CAAC,IAAI,CAAC,GAAG,eAAe,gBAAgB,CAAC,CAAC;IACrD,WAAW,CAAC,IAAI,CAAC,GAAG,eAAe,cAAc,CAAC,CAAC;IACnD,WAAW,CAAC,IAAI,CAAC,GAAG,eAAe,WAAW,CAAC,CAAC;IAEhD,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Explain AI Command - drift.explainWithAI
|
|
3
|
+
* @requirements 28.5
|
|
4
|
+
*/
|
|
5
|
+
import type { ServerContext, CommandResult } from '../server/types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Execute explain with AI command
|
|
8
|
+
* Uses AI to explain why a violation occurred and how to fix it
|
|
9
|
+
*/
|
|
10
|
+
export declare function executeExplainAI(context: ServerContext, violationId: string, patternId: string): Promise<CommandResult>;
|
|
11
|
+
//# sourceMappingURL=explain-ai.d.ts.map
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Explain AI Command - drift.explainWithAI
|
|
3
|
+
* @requirements 28.5
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Execute explain with AI command
|
|
7
|
+
* Uses AI to explain why a violation occurred and how to fix it
|
|
8
|
+
*/
|
|
9
|
+
export async function executeExplainAI(context, violationId, patternId) {
|
|
10
|
+
const { state, logger, connection } = context;
|
|
11
|
+
if (!state.configuration.aiEnabled) {
|
|
12
|
+
return {
|
|
13
|
+
success: false,
|
|
14
|
+
error: 'AI features are not enabled. Enable them in settings.',
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
if (!violationId || !patternId) {
|
|
18
|
+
return {
|
|
19
|
+
success: false,
|
|
20
|
+
error: 'Violation ID and Pattern ID are required',
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
logger.info(`Explaining violation with AI: ${violationId}`);
|
|
24
|
+
// Find the violation
|
|
25
|
+
let violation = null;
|
|
26
|
+
let violationUri = '';
|
|
27
|
+
for (const [uri, violations] of state.violations) {
|
|
28
|
+
violation = violations.find((v) => v.id === violationId);
|
|
29
|
+
if (violation) {
|
|
30
|
+
violationUri = uri;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (!violation) {
|
|
35
|
+
return {
|
|
36
|
+
success: false,
|
|
37
|
+
error: `Violation not found: ${violationId}`,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
// Get the pattern
|
|
41
|
+
const pattern = state.patterns.get(patternId);
|
|
42
|
+
// Get document content for context
|
|
43
|
+
const docState = state.documents.get(violationUri);
|
|
44
|
+
const documentContent = docState?.content ?? '';
|
|
45
|
+
// Extract relevant code snippet using range (ViolationInfo uses range, not location)
|
|
46
|
+
const startLine = violation.range.start.line;
|
|
47
|
+
const endLine = violation.range.end.line;
|
|
48
|
+
const codeSnippet = extractCodeSnippet(documentContent, startLine, endLine, 5 // context lines
|
|
49
|
+
);
|
|
50
|
+
// TODO: Integrate with @drift/ai package
|
|
51
|
+
// For now, show a placeholder explanation
|
|
52
|
+
// Build explanation context
|
|
53
|
+
const explanationContext = {
|
|
54
|
+
violation: {
|
|
55
|
+
id: violationId,
|
|
56
|
+
message: violation.message,
|
|
57
|
+
severity: violation.severity,
|
|
58
|
+
range: violation.range,
|
|
59
|
+
},
|
|
60
|
+
pattern: {
|
|
61
|
+
id: patternId,
|
|
62
|
+
name: pattern?.name,
|
|
63
|
+
description: pattern?.description,
|
|
64
|
+
category: pattern?.category,
|
|
65
|
+
},
|
|
66
|
+
codeSnippet,
|
|
67
|
+
file: violationUri,
|
|
68
|
+
};
|
|
69
|
+
// Note: withProgress is not available in vscode-languageserver
|
|
70
|
+
// Show a simple message instead
|
|
71
|
+
connection.window.showInformationMessage('Analyzing violation with AI...');
|
|
72
|
+
// Simulate AI processing
|
|
73
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
74
|
+
// Generate placeholder explanation
|
|
75
|
+
const explanation = generatePlaceholderExplanation(explanationContext);
|
|
76
|
+
// Show explanation in a message
|
|
77
|
+
connection.window.showInformationMessage(`AI Explanation for "${pattern?.name ?? patternId}":\n\n${explanation}`);
|
|
78
|
+
logger.info(`AI explanation generated for: ${violationId}`);
|
|
79
|
+
return {
|
|
80
|
+
success: true,
|
|
81
|
+
message: 'AI explanation generated',
|
|
82
|
+
data: {
|
|
83
|
+
violationId,
|
|
84
|
+
patternId,
|
|
85
|
+
explanation,
|
|
86
|
+
context: explanationContext,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Extract code snippet around a location
|
|
92
|
+
*/
|
|
93
|
+
function extractCodeSnippet(content, startLine, endLine, contextLines) {
|
|
94
|
+
const lines = content.split('\n');
|
|
95
|
+
const start = Math.max(0, startLine - contextLines - 1);
|
|
96
|
+
const end = Math.min(lines.length, endLine + contextLines);
|
|
97
|
+
return lines.slice(start, end).join('\n');
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Generate placeholder explanation (to be replaced with actual AI)
|
|
101
|
+
*/
|
|
102
|
+
function generatePlaceholderExplanation(context) {
|
|
103
|
+
const lines = [];
|
|
104
|
+
lines.push(`## Why This Violation Occurred`);
|
|
105
|
+
lines.push('');
|
|
106
|
+
lines.push(context.violation.message);
|
|
107
|
+
lines.push('');
|
|
108
|
+
if (context.pattern.description) {
|
|
109
|
+
lines.push(`## Pattern Description`);
|
|
110
|
+
lines.push('');
|
|
111
|
+
lines.push(context.pattern.description);
|
|
112
|
+
lines.push('');
|
|
113
|
+
}
|
|
114
|
+
lines.push(`## How to Fix`);
|
|
115
|
+
lines.push('');
|
|
116
|
+
lines.push('To resolve this violation, consider the following approaches:');
|
|
117
|
+
lines.push('');
|
|
118
|
+
lines.push('1. **Follow the established pattern** - Update your code to match the expected pattern');
|
|
119
|
+
lines.push('2. **Create a variant** - If this is an intentional deviation, create a pattern variant');
|
|
120
|
+
lines.push('3. **Ignore this occurrence** - If this is a one-time exception, ignore this specific violation');
|
|
121
|
+
lines.push('');
|
|
122
|
+
lines.push(`## Severity: ${context.violation.severity}`);
|
|
123
|
+
lines.push('');
|
|
124
|
+
lines.push(getSeverityExplanation(context.violation.severity));
|
|
125
|
+
return lines.join('\n');
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Get severity explanation
|
|
129
|
+
*/
|
|
130
|
+
function getSeverityExplanation(severity) {
|
|
131
|
+
switch (severity) {
|
|
132
|
+
case 'error':
|
|
133
|
+
return 'This is a critical violation that should be addressed before merging.';
|
|
134
|
+
case 'warning':
|
|
135
|
+
return 'This violation indicates a potential issue that should be reviewed.';
|
|
136
|
+
case 'info':
|
|
137
|
+
return 'This is an informational finding that may be worth considering.';
|
|
138
|
+
case 'hint':
|
|
139
|
+
return 'This is a suggestion for improvement.';
|
|
140
|
+
default:
|
|
141
|
+
return 'Review this violation and determine the appropriate action.';
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=explain-ai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explain-ai.js","sourceRoot":"","sources":["../../src/commands/explain-ai.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAsB,EACtB,WAAmB,EACnB,SAAiB;IAEjB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAE9C,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,SAAS,EAAE,CAAC;QACnC,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,uDAAuD;SAC/D,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,WAAW,IAAI,CAAC,SAAS,EAAE,CAAC;QAC/B,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,0CAA0C;SAClD,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,iCAAiC,WAAW,EAAE,CAAC,CAAC;IAE5D,qBAAqB;IACrB,IAAI,SAAS,GAAG,IAAI,CAAC;IACrB,IAAI,YAAY,GAAG,EAAE,CAAC;IACtB,KAAK,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;QACjD,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,WAAW,CAAC,CAAC;QACzD,IAAI,SAAS,EAAE,CAAC;YACd,YAAY,GAAG,GAAG,CAAC;YACnB,MAAM;QACR,CAAC;IACH,CAAC;IAED,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,wBAAwB,WAAW,EAAE;SAC7C,CAAC;IACJ,CAAC;IAED,kBAAkB;IAClB,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CA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4
|
+
*/
|
|
5
|
+
import type { ServerContext, CommandResult } from '../server/types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Execute fix with AI command
|
|
8
|
+
* Uses AI to generate a fix for a violation
|
|
9
|
+
*/
|
|
10
|
+
export declare function executeFixAI(context: ServerContext, violationId: string, uri: string): Promise<CommandResult>;
|
|
11
|
+
//# sourceMappingURL=fix-ai.d.ts.map
|