@nielspeter/sonarlint-mcp-server 0.1.3 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/README.md +6 -12
- package/dist/errors.d.ts +22 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +44 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.js +115 -1330
- package/dist/index.js.map +1 -1
- package/dist/resources/session.d.ts +18 -0
- package/dist/resources/session.d.ts.map +1 -0
- package/dist/resources/session.js +84 -0
- package/dist/resources/session.js.map +1 -0
- package/dist/sloop-bridge.d.ts +0 -3
- package/dist/sloop-bridge.d.ts.map +1 -1
- package/dist/sloop-bridge.js +0 -19
- package/dist/sloop-bridge.js.map +1 -1
- package/dist/state.d.ts +19 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/state.js +25 -0
- package/dist/state.js.map +1 -0
- package/dist/tools/analyze-content.d.ts +7 -0
- package/dist/tools/analyze-content.d.ts.map +1 -0
- package/dist/tools/analyze-content.js +78 -0
- package/dist/tools/analyze-content.js.map +1 -0
- package/dist/tools/analyze-file.d.ts +7 -0
- package/dist/tools/analyze-file.d.ts.map +1 -0
- package/dist/tools/analyze-file.js +66 -0
- package/dist/tools/analyze-file.js.map +1 -0
- package/dist/tools/analyze-files.d.ts +7 -0
- package/dist/tools/analyze-files.d.ts.map +1 -0
- package/dist/tools/analyze-files.js +106 -0
- package/dist/tools/analyze-files.js.map +1 -0
- package/dist/tools/analyze-project.d.ts +7 -0
- package/dist/tools/analyze-project.d.ts.map +1 -0
- package/dist/tools/analyze-project.js +109 -0
- package/dist/tools/analyze-project.js.map +1 -0
- package/dist/tools/apply-all-quick-fixes.d.ts +7 -0
- package/dist/tools/apply-all-quick-fixes.d.ts.map +1 -0
- package/dist/tools/apply-all-quick-fixes.js +166 -0
- package/dist/tools/apply-all-quick-fixes.js.map +1 -0
- package/dist/tools/apply-quick-fix.d.ts +7 -0
- package/dist/tools/apply-quick-fix.d.ts.map +1 -0
- package/dist/tools/apply-quick-fix.js +113 -0
- package/dist/tools/apply-quick-fix.js.map +1 -0
- package/dist/tools/health-check.d.ts +7 -0
- package/dist/tools/health-check.d.ts.map +1 -0
- package/dist/tools/health-check.js +113 -0
- package/dist/tools/health-check.js.map +1 -0
- package/dist/tools/list-active-rules.d.ts +7 -0
- package/dist/tools/list-active-rules.d.ts.map +1 -0
- package/dist/tools/list-active-rules.js +48 -0
- package/dist/tools/list-active-rules.js.map +1 -0
- package/dist/types.d.ts +62 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/filesystem.d.ts +8 -0
- package/dist/utils/filesystem.d.ts.map +1 -0
- package/dist/utils/filesystem.js +74 -0
- package/dist/utils/filesystem.js.map +1 -0
- package/dist/utils/formatting.d.ts +13 -0
- package/dist/utils/formatting.d.ts.map +1 -0
- package/dist/utils/formatting.js +94 -0
- package/dist/utils/formatting.js.map +1 -0
- package/dist/utils/language.d.ts +12 -0
- package/dist/utils/language.d.ts.map +1 -0
- package/dist/utils/language.js +44 -0
- package/dist/utils/language.js.map +1 -0
- package/dist/utils/scope.d.ts +8 -0
- package/dist/utils/scope.d.ts.map +1 -0
- package/dist/utils/scope.js +30 -0
- package/dist/utils/scope.js.map +1 -0
- package/dist/utils/sloop.d.ts +10 -0
- package/dist/utils/sloop.d.ts.map +1 -0
- package/dist/utils/sloop.js +39 -0
- package/dist/utils/sloop.js.map +1 -0
- package/dist/utils/transforms.d.ts +23 -0
- package/dist/utils/transforms.d.ts.map +1 -0
- package/dist/utils/transforms.js +64 -0
- package/dist/utils/transforms.js.map +1 -0
- package/package.json +10 -7
- package/scripts/setup-sonarlint.sh +115 -39
- package/dist/sonarlint-bridge.d.ts +0 -33
- package/dist/sonarlint-bridge.d.ts.map +0 -1
- package/dist/sonarlint-bridge.js +0 -91
- package/dist/sonarlint-bridge.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze-files.d.ts","sourceRoot":"","sources":["../../src/tools/analyze-files.ts"],"names":[],"mappings":"AAUA,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,GAAG;;;;;GAyIjD"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { existsSync } from "fs";
|
|
2
|
+
import { SloopError } from "../errors.js";
|
|
3
|
+
import { ensureSloopBridge } from "../utils/sloop.js";
|
|
4
|
+
import { getOrCreateScope } from "../utils/scope.js";
|
|
5
|
+
import { detectLanguage } from "../utils/language.js";
|
|
6
|
+
import { transformSloopIssues } from "../utils/transforms.js";
|
|
7
|
+
import { formatBatchAnalysisResult } from "../utils/formatting.js";
|
|
8
|
+
import { batchResults } from "../state.js";
|
|
9
|
+
export async function handleAnalyzeFiles(args) {
|
|
10
|
+
const { filePaths, minSeverity, excludeRules } = args;
|
|
11
|
+
if (!Array.isArray(filePaths) || filePaths.length === 0) {
|
|
12
|
+
throw new SloopError("No files provided", "Please provide at least one file path to analyze.", false);
|
|
13
|
+
}
|
|
14
|
+
// Validate all files exist
|
|
15
|
+
const missingFiles = filePaths.filter(fp => !existsSync(fp));
|
|
16
|
+
if (missingFiles.length > 0) {
|
|
17
|
+
throw new SloopError(`Files not found: ${missingFiles.join(', ')}`, `The following files do not exist:\n${missingFiles.map(f => `- ${f}`).join('\n')}`, false);
|
|
18
|
+
}
|
|
19
|
+
console.error(`[MCP] Batch analyzing ${filePaths.length} files...`);
|
|
20
|
+
// Group files by project root for scope management
|
|
21
|
+
const filesByScope = new Map();
|
|
22
|
+
for (const filePath of filePaths) {
|
|
23
|
+
const scopeId = getOrCreateScope(filePath);
|
|
24
|
+
if (!filesByScope.has(scopeId)) {
|
|
25
|
+
filesByScope.set(scopeId, []);
|
|
26
|
+
}
|
|
27
|
+
filesByScope.get(scopeId).push(filePath);
|
|
28
|
+
}
|
|
29
|
+
// Ensure SLOOP is initialized
|
|
30
|
+
const bridge = await ensureSloopBridge();
|
|
31
|
+
// Analyze each scope
|
|
32
|
+
const allResults = [];
|
|
33
|
+
for (const [scopeId, scopeFiles] of filesByScope) {
|
|
34
|
+
console.error(`[MCP] Analyzing ${scopeFiles.length} files in scope ${scopeId}`);
|
|
35
|
+
const rawResult = await bridge.analyzeFilesAndTrack(scopeId, scopeFiles);
|
|
36
|
+
const rawIssues = rawResult.rawIssues || [];
|
|
37
|
+
// Group issues by file
|
|
38
|
+
const issuesByFile = new Map();
|
|
39
|
+
for (const issue of rawIssues) {
|
|
40
|
+
const fileUri = issue.fileUri;
|
|
41
|
+
if (!issuesByFile.has(fileUri)) {
|
|
42
|
+
issuesByFile.set(fileUri, []);
|
|
43
|
+
}
|
|
44
|
+
issuesByFile.get(fileUri).push(issue);
|
|
45
|
+
}
|
|
46
|
+
// Create results for each file
|
|
47
|
+
for (const filePath of scopeFiles) {
|
|
48
|
+
const fileUri = `file://${filePath}`;
|
|
49
|
+
const fileIssues = issuesByFile.get(fileUri) || [];
|
|
50
|
+
let transformedIssues = transformSloopIssues(fileIssues);
|
|
51
|
+
// Apply filtering if requested
|
|
52
|
+
if (minSeverity) {
|
|
53
|
+
const severityOrder = { INFO: 0, MINOR: 1, MAJOR: 2, CRITICAL: 3, BLOCKER: 4 };
|
|
54
|
+
const minLevel = severityOrder[minSeverity];
|
|
55
|
+
transformedIssues = transformedIssues.filter(issue => (severityOrder[issue.severity] || 0) >= minLevel);
|
|
56
|
+
}
|
|
57
|
+
if (excludeRules && excludeRules.length > 0) {
|
|
58
|
+
transformedIssues = transformedIssues.filter(issue => !excludeRules.includes(issue.rule));
|
|
59
|
+
}
|
|
60
|
+
allResults.push({
|
|
61
|
+
filePath,
|
|
62
|
+
language: detectLanguage(filePath),
|
|
63
|
+
issueCount: transformedIssues.length,
|
|
64
|
+
issues: transformedIssues,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Calculate overall summary
|
|
69
|
+
const overallSummary = {
|
|
70
|
+
totalFiles: allResults.length,
|
|
71
|
+
totalIssues: allResults.reduce((sum, r) => sum + r.issueCount, 0),
|
|
72
|
+
filesWithIssues: allResults.filter(r => r.issueCount > 0).length,
|
|
73
|
+
bySeverity: {
|
|
74
|
+
blocker: 0,
|
|
75
|
+
critical: 0,
|
|
76
|
+
major: 0,
|
|
77
|
+
minor: 0,
|
|
78
|
+
info: 0,
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
for (const result of allResults) {
|
|
82
|
+
for (const issue of result.issues) {
|
|
83
|
+
const severity = issue.severity.toLowerCase();
|
|
84
|
+
if (severity in overallSummary.bySeverity) {
|
|
85
|
+
overallSummary.bySeverity[severity]++;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const batchResult = {
|
|
90
|
+
files: allResults,
|
|
91
|
+
summary: overallSummary,
|
|
92
|
+
};
|
|
93
|
+
// Store in batch results for MCP resources
|
|
94
|
+
const batchId = `batch-${Date.now()}`;
|
|
95
|
+
batchResults.set(batchId, batchResult);
|
|
96
|
+
const formattedResult = formatBatchAnalysisResult(batchResult);
|
|
97
|
+
return {
|
|
98
|
+
content: [
|
|
99
|
+
{
|
|
100
|
+
type: "text",
|
|
101
|
+
text: formattedResult,
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=analyze-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze-files.js","sourceRoot":"","sources":["../../src/tools/analyze-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC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E,CAAC;YACR,KAAK,EAAE,CAAC;YACR,IAAI,EAAE,CAAC;SACR;KACF,CAAC;IAEF,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE,CAAC;QAChC,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAClC,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,WAAW,EAA4C,CAAC;YACxF,IAAI,QAAQ,IAAI,cAAc,CAAC,UAAU,EAAE,CAAC;gBAC1C,cAAc,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YACxC,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,WAAW,GAAwB;QACvC,KAAK,EAAE,UAAU;QACjB,OAAO,EAAE,cAAc;KACxB,CAAC;IAEF,2CAA2C;IAC3C,MAAM,OAAO,GAAG,SAAS,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;IACtC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAEvC,MAAM,eAAe,GAAG,yBAAyB,CAAC,WAAW,CAAC,CAAC;IAE/D,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAe;gBACrB,IAAI,EAAE,eAAe;aACtB;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze-project.d.ts","sourceRoot":"","sources":["../../src/tools/analyze-project.ts"],"names":[],"mappings":"AAKA,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,GAAG;;;;;GAoInD"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { existsSync, statSync, readdirSync } from "fs";
|
|
2
|
+
import { join, extname, relative, basename } from "path";
|
|
3
|
+
import { SloopError } from "../errors.js";
|
|
4
|
+
import { handleAnalyzeFiles } from "./analyze-files.js";
|
|
5
|
+
export async function handleAnalyzeProject(args) {
|
|
6
|
+
const { projectPath, maxFiles = 100, minSeverity, excludeRules, includePatterns } = args;
|
|
7
|
+
// Validate project path exists
|
|
8
|
+
if (!existsSync(projectPath)) {
|
|
9
|
+
throw new SloopError(`Project path not found: ${projectPath}`, `The directory ${projectPath} does not exist. Please check the path and try again.`, false);
|
|
10
|
+
}
|
|
11
|
+
const stats = statSync(projectPath);
|
|
12
|
+
if (!stats.isDirectory()) {
|
|
13
|
+
throw new SloopError(`Not a directory: ${projectPath}`, `The path ${projectPath} is not a directory. Please provide a directory path.`, false);
|
|
14
|
+
}
|
|
15
|
+
console.error(`[MCP] Scanning project: ${projectPath}`);
|
|
16
|
+
// Define supported extensions
|
|
17
|
+
const supportedExtensions = ['.js', '.jsx', '.ts', '.tsx', '.py', '.java', '.go', '.php', '.rb', '.html', '.css', '.xml'];
|
|
18
|
+
// Directories to exclude
|
|
19
|
+
const excludeDirs = new Set([
|
|
20
|
+
'node_modules', 'dist', 'build', '.git', '.svn', '.hg',
|
|
21
|
+
'coverage', '.next', '.nuxt', 'out', 'target', 'bin',
|
|
22
|
+
'__pycache__', '.pytest_cache', '.mypy_cache', 'venv', '.venv'
|
|
23
|
+
]);
|
|
24
|
+
// Recursively find all source files
|
|
25
|
+
function findSourceFiles(dir, files = []) {
|
|
26
|
+
try {
|
|
27
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
28
|
+
for (const entry of entries) {
|
|
29
|
+
// Skip excluded directories
|
|
30
|
+
if (entry.isDirectory() && excludeDirs.has(entry.name)) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
const fullPath = join(dir, entry.name);
|
|
34
|
+
if (entry.isDirectory()) {
|
|
35
|
+
findSourceFiles(fullPath, files);
|
|
36
|
+
}
|
|
37
|
+
else if (entry.isFile()) {
|
|
38
|
+
const ext = extname(entry.name);
|
|
39
|
+
if (supportedExtensions.includes(ext)) {
|
|
40
|
+
// Check includePatterns if specified
|
|
41
|
+
if (includePatterns && includePatterns.length > 0) {
|
|
42
|
+
const relativePath = relative(projectPath, fullPath);
|
|
43
|
+
// Simple pattern matching (supports ** and *)
|
|
44
|
+
const matches = includePatterns.some(pattern => {
|
|
45
|
+
const regex = new RegExp('^' + pattern.replace(/\*\*/g, '.*').replace(/\*/g, '[^/]*') + '$');
|
|
46
|
+
return regex.test(relativePath);
|
|
47
|
+
});
|
|
48
|
+
if (matches) {
|
|
49
|
+
files.push(fullPath);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
files.push(fullPath);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
console.error(`[MCP] Error scanning directory ${dir}:`, err);
|
|
61
|
+
}
|
|
62
|
+
return files;
|
|
63
|
+
}
|
|
64
|
+
const allFiles = findSourceFiles(projectPath);
|
|
65
|
+
console.error(`[MCP] Found ${allFiles.length} source files`);
|
|
66
|
+
if (allFiles.length === 0) {
|
|
67
|
+
return {
|
|
68
|
+
content: [
|
|
69
|
+
{
|
|
70
|
+
type: "text",
|
|
71
|
+
text: `No source files found in ${projectPath}.\n\nSupported extensions: ${supportedExtensions.join(', ')}`,
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
// Limit number of files
|
|
77
|
+
const filesToAnalyze = allFiles.slice(0, maxFiles);
|
|
78
|
+
if (allFiles.length > maxFiles) {
|
|
79
|
+
console.error(`[MCP] Limiting analysis to ${maxFiles} files (found ${allFiles.length})`);
|
|
80
|
+
}
|
|
81
|
+
// Use handleAnalyzeFiles to do the actual analysis
|
|
82
|
+
const result = await handleAnalyzeFiles({
|
|
83
|
+
filePaths: filesToAnalyze,
|
|
84
|
+
groupByFile: true,
|
|
85
|
+
minSeverity,
|
|
86
|
+
excludeRules,
|
|
87
|
+
});
|
|
88
|
+
// Add project-specific context to the output
|
|
89
|
+
const resultText = result.content[0].text;
|
|
90
|
+
const projectSummary = `
|
|
91
|
+
📦 Project Scan: ${basename(projectPath)}
|
|
92
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
93
|
+
|
|
94
|
+
Project Path: ${projectPath}
|
|
95
|
+
Total Source Files: ${allFiles.length}
|
|
96
|
+
Files Analyzed: ${filesToAnalyze.length}
|
|
97
|
+
${allFiles.length > maxFiles ? `⚠️ Limited to ${maxFiles} files (use maxFiles parameter to adjust)\n` : ''}
|
|
98
|
+
${resultText}
|
|
99
|
+
`;
|
|
100
|
+
return {
|
|
101
|
+
content: [
|
|
102
|
+
{
|
|
103
|
+
type: "text",
|
|
104
|
+
text: projectSummary,
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=analyze-project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze-project.js","sourceRoot":"","sources":["../../src/tools/analyze-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,IAAS;IAClD,MAAM,EAAE,WAAW,EAAE,QAAQ,GAAG,GAAG,EAAE,WAAW,EAAE,YAAY,EAAE,eAAe,EAAE,GAAG,IAMnF,CAAC;IAEF,+BAA+B;IAC/B,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,UAAU,CAClB,2BAA2B,WAAW,EAAE,EACxC,iBAAiB,WAAW,uDAAuD,EACnF,KAAK,CACN,CAAC;IAC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","sources":["../../src/tools/apply-all-quick-fixes.ts"],"names":[],"mappings":"AAOA,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,GAAG;;;;;GAwLvD"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
2
|
+
import { SloopError } from "../errors.js";
|
|
3
|
+
import { ensureSloopBridge } from "../utils/sloop.js";
|
|
4
|
+
import { getOrCreateScope } from "../utils/scope.js";
|
|
5
|
+
import { notifyFileSystemChanged } from "../utils/filesystem.js";
|
|
6
|
+
import { transformSloopIssues } from "../utils/transforms.js";
|
|
7
|
+
export async function handleApplyAllQuickFixes(args) {
|
|
8
|
+
const { filePath } = args;
|
|
9
|
+
console.error(`[MCP] Applying all quick fixes for ${filePath}`);
|
|
10
|
+
// Validate file exists
|
|
11
|
+
if (!existsSync(filePath)) {
|
|
12
|
+
throw new SloopError(`File not found: ${filePath}`, `The file ${filePath} does not exist. Please check the path and try again.`, false);
|
|
13
|
+
}
|
|
14
|
+
// Analyze the file to get all issues with quick fixes
|
|
15
|
+
const bridge = await ensureSloopBridge();
|
|
16
|
+
const scopeId = getOrCreateScope(filePath);
|
|
17
|
+
const rawResult = await bridge.analyzeFilesAndTrack(scopeId, [filePath]);
|
|
18
|
+
const rawIssues = rawResult.rawIssues || [];
|
|
19
|
+
console.error(`[MCP] Found ${rawIssues.length} total issues`);
|
|
20
|
+
// Filter issues that have quick fixes
|
|
21
|
+
const issuesWithQuickFixes = rawIssues.filter((issue) => {
|
|
22
|
+
const hasQuickFixes = issue.quickFixes && issue.quickFixes.length > 0;
|
|
23
|
+
if (hasQuickFixes) {
|
|
24
|
+
console.error(`[DEBUG] Issue at line ${issue.textRange?.startLine || issue.startLine}: ${issue.ruleKey} has ${issue.quickFixes.length} quick fixes`);
|
|
25
|
+
}
|
|
26
|
+
return hasQuickFixes;
|
|
27
|
+
});
|
|
28
|
+
console.error(`[MCP] Found ${issuesWithQuickFixes.length} issues with quick fixes`);
|
|
29
|
+
if (issuesWithQuickFixes.length === 0) {
|
|
30
|
+
return {
|
|
31
|
+
content: [
|
|
32
|
+
{
|
|
33
|
+
type: "text",
|
|
34
|
+
text: `ℹ️ **No quick fixes available**\n\nFile: ${filePath}\nTotal issues: ${rawIssues.length}\n\nNone of the issues in this file have automated quick fixes available. All issues must be fixed manually.`,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
// Sort issues by line number (descending) to avoid line number shifts
|
|
40
|
+
const sortedIssues = [...issuesWithQuickFixes].sort((a, b) => {
|
|
41
|
+
const aLine = a.textRange?.startLine || a.startLine || 0;
|
|
42
|
+
const bLine = b.textRange?.startLine || b.startLine || 0;
|
|
43
|
+
return bLine - aLine; // Descending order
|
|
44
|
+
});
|
|
45
|
+
// Apply each quick fix
|
|
46
|
+
const appliedFixes = [];
|
|
47
|
+
const failedFixes = [];
|
|
48
|
+
for (const issue of sortedIssues) {
|
|
49
|
+
const line = issue.textRange?.startLine || issue.startLine || 0;
|
|
50
|
+
const rule = issue.ruleKey;
|
|
51
|
+
const quickFix = issue.quickFixes[0]; // Use first available quick fix
|
|
52
|
+
console.error(`[MCP] Applying fix for ${rule} at line ${line}`);
|
|
53
|
+
try {
|
|
54
|
+
// Read current file content
|
|
55
|
+
let fileContent = readFileSync(filePath, 'utf-8');
|
|
56
|
+
const lines = fileContent.split('\n');
|
|
57
|
+
// Apply the quick fix edits
|
|
58
|
+
const fileEdits = quickFix.inputFileEdits || quickFix.fileEdits || [];
|
|
59
|
+
if (fileEdits.length > 0) {
|
|
60
|
+
for (const fileEdit of fileEdits) {
|
|
61
|
+
if (fileEdit.textEdits) {
|
|
62
|
+
// Sort edits in reverse order to maintain line numbers
|
|
63
|
+
const sortedEdits = [...fileEdit.textEdits].sort((a, b) => {
|
|
64
|
+
const aStart = a.range?.startLine || 0;
|
|
65
|
+
const bStart = b.range?.startLine || 0;
|
|
66
|
+
return bStart - aStart;
|
|
67
|
+
});
|
|
68
|
+
for (const edit of sortedEdits) {
|
|
69
|
+
const startLine = (edit.range?.startLine || 1) - 1;
|
|
70
|
+
const startCol = edit.range?.startLineOffset || 0;
|
|
71
|
+
const endLine = (edit.range?.endLine || startLine + 1) - 1;
|
|
72
|
+
const endCol = edit.range?.endLineOffset || lines[endLine]?.length || 0;
|
|
73
|
+
const newText = edit.newText || '';
|
|
74
|
+
if (startLine === endLine) {
|
|
75
|
+
const currentLine = lines[startLine];
|
|
76
|
+
lines[startLine] = currentLine.substring(0, startCol) + newText + currentLine.substring(endCol);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
const firstLine = lines[startLine].substring(0, startCol) + newText;
|
|
80
|
+
const lastLine = lines[endLine].substring(endCol);
|
|
81
|
+
lines.splice(startLine, endLine - startLine + 1, firstLine + lastLine);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// Write back to file
|
|
88
|
+
fileContent = lines.join('\n');
|
|
89
|
+
writeFileSync(filePath, fileContent, 'utf-8');
|
|
90
|
+
appliedFixes.push({
|
|
91
|
+
line,
|
|
92
|
+
rule,
|
|
93
|
+
message: quickFix.message || 'Applied automated fix',
|
|
94
|
+
});
|
|
95
|
+
console.error(`[MCP] Successfully applied fix for ${rule} at line ${line}`);
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
console.error(`[MCP] Failed to apply fix for ${rule} at line ${line}:`, error);
|
|
99
|
+
failedFixes.push({
|
|
100
|
+
line,
|
|
101
|
+
rule,
|
|
102
|
+
error: error instanceof Error ? error.message : String(error),
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// Notify SLOOP about file changes
|
|
107
|
+
console.error(`[Cache] Sending file system update notification...`);
|
|
108
|
+
await notifyFileSystemChanged(filePath, scopeId);
|
|
109
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
110
|
+
// Re-analyze to get remaining issues
|
|
111
|
+
const finalResult = await bridge.analyzeFilesAndTrack(scopeId, [filePath]);
|
|
112
|
+
const remainingIssues = finalResult.rawIssues || [];
|
|
113
|
+
const transformedRemaining = transformSloopIssues(remainingIssues);
|
|
114
|
+
// Format summary
|
|
115
|
+
let summary = `✅ **Quick fixes applied**\n\n`;
|
|
116
|
+
summary += `File: ${filePath}\n`;
|
|
117
|
+
summary += `Applied: ${appliedFixes.length} fixes\n`;
|
|
118
|
+
if (failedFixes.length > 0) {
|
|
119
|
+
summary += `Failed: ${failedFixes.length} fixes\n`;
|
|
120
|
+
}
|
|
121
|
+
summary += `Remaining issues: ${remainingIssues.length}\n\n`;
|
|
122
|
+
if (appliedFixes.length > 0) {
|
|
123
|
+
summary += `**Fixed Issues:**\n`;
|
|
124
|
+
for (const fix of appliedFixes) {
|
|
125
|
+
summary += `- Line ${fix.line}: ${fix.rule} - ${fix.message}\n`;
|
|
126
|
+
}
|
|
127
|
+
summary += `\n`;
|
|
128
|
+
}
|
|
129
|
+
if (failedFixes.length > 0) {
|
|
130
|
+
summary += `**Failed Fixes:**\n`;
|
|
131
|
+
for (const fail of failedFixes) {
|
|
132
|
+
summary += `- Line ${fail.line}: ${fail.rule} - ${fail.error}\n`;
|
|
133
|
+
}
|
|
134
|
+
summary += `\n`;
|
|
135
|
+
}
|
|
136
|
+
if (remainingIssues.length > 0) {
|
|
137
|
+
summary += `**Remaining Issues (require manual fixing):**\n`;
|
|
138
|
+
const groupedBySeverity = transformedRemaining.reduce((acc, issue) => {
|
|
139
|
+
if (!acc[issue.severity])
|
|
140
|
+
acc[issue.severity] = [];
|
|
141
|
+
acc[issue.severity].push(issue);
|
|
142
|
+
return acc;
|
|
143
|
+
}, {});
|
|
144
|
+
for (const severity of ['BLOCKER', 'CRITICAL', 'MAJOR', 'MINOR', 'INFO']) {
|
|
145
|
+
const issues = groupedBySeverity[severity] || [];
|
|
146
|
+
if (issues.length > 0) {
|
|
147
|
+
summary += `\n${severity} (${issues.length}):\n`;
|
|
148
|
+
for (const issue of issues) {
|
|
149
|
+
summary += `- Line ${issue.line}: ${issue.rule} - ${issue.message}\n`;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
summary += `🎉 All issues resolved! The file has no remaining code quality issues.\n`;
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
content: [
|
|
159
|
+
{
|
|
160
|
+
type: "text",
|
|
161
|
+
text: summary,
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=apply-all-quick-fixes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-all-quick-fixes.js","sourceRoot":"","sources":["../../src/tools/apply-all-quick-fixes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,IAAS;IACtD,MAAM,EAAE,QAAQ,EAAE,GAAG,IAA4B,CAAC;IAElD,OAAO,CAAC,KAAK,CAAC,sCAAsC,QAAQ,EAAE,CAAC,CAAC;IAEhE,uBAAuB;IACvB,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,UAAU,CAClB,mBAAmB,QAAQ,EAAE,EAC7B,YAAY,QAAQ,uDAAuD,EAC3E,KAAK,CACN,CAAC;IACJ,CAAC;IA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AC,QAAQ,CAAC,GAAG,EAAE,CAAC;YACnD,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAChC,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAiD,CAAC,CAAC;QAEtD,KAAK,MAAM,QAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC;YACzE,MAAM,MAAM,GAAG,iBAAiB,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YACjD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACtB,OAAO,IAAI,KAAK,QAAQ,KAAK,MAAM,CAAC,MAAM,MAAM,CAAC;gBACjD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;oBAC3B,OAAO,IAAI,UAAU,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC,OAAO,IAAI,CAAC;gBACxE,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,0EAA0E,CAAC;IACxF,CAAC;IAED,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAe;gBACrB,IAAI,EAAE,OAAO;aACd;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-quick-fix.d.ts","sourceRoot":"","sources":["../../src/tools/apply-quick-fix.ts"],"names":[],"mappings":"AAMA,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,GAAG;;;;;GAsIlD"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
2
|
+
import { SloopError } from "../errors.js";
|
|
3
|
+
import { ensureSloopBridge } from "../utils/sloop.js";
|
|
4
|
+
import { getOrCreateScope } from "../utils/scope.js";
|
|
5
|
+
import { notifyFileSystemChanged } from "../utils/filesystem.js";
|
|
6
|
+
export async function handleApplyQuickFix(args) {
|
|
7
|
+
const { filePath, line, rule } = args;
|
|
8
|
+
console.error(`[MCP] Applying quick fix for ${rule} at ${filePath}:${line}`);
|
|
9
|
+
// Validate file exists
|
|
10
|
+
if (!existsSync(filePath)) {
|
|
11
|
+
throw new SloopError(`File not found: ${filePath}`, `The file ${filePath} does not exist. Please check the path and try again.`, false);
|
|
12
|
+
}
|
|
13
|
+
// Re-analyze the file to get current issues with quick fixes
|
|
14
|
+
const bridge = await ensureSloopBridge();
|
|
15
|
+
const scopeId = getOrCreateScope(filePath);
|
|
16
|
+
const rawResult = await bridge.analyzeFilesAndTrack(scopeId, [filePath]);
|
|
17
|
+
const rawIssues = rawResult.rawIssues || [];
|
|
18
|
+
// Find the issue at the specified line with the specified rule
|
|
19
|
+
const targetIssue = rawIssues.find((issue) => {
|
|
20
|
+
const issueLine = issue.textRange?.startLine || issue.startLine || 0;
|
|
21
|
+
return issueLine === line && issue.ruleKey === rule;
|
|
22
|
+
});
|
|
23
|
+
if (!targetIssue) {
|
|
24
|
+
throw new SloopError(`Issue not found`, `No issue found at line ${line} with rule ${rule}. The file may have changed since the last analysis.`, false);
|
|
25
|
+
}
|
|
26
|
+
if (!targetIssue.quickFixes || targetIssue.quickFixes.length === 0) {
|
|
27
|
+
throw new SloopError(`No quick fix available`, `The issue at line ${line} (${rule}) does not have an automated quick fix available.`, false);
|
|
28
|
+
}
|
|
29
|
+
// Apply the first quick fix
|
|
30
|
+
const quickFix = targetIssue.quickFixes[0];
|
|
31
|
+
console.error('[DEBUG] Quick fix structure:', JSON.stringify(quickFix, null, 2).substring(0, 1000));
|
|
32
|
+
// Write debug info to a file we can read
|
|
33
|
+
writeFileSync('/tmp/quickfix-debug.json', JSON.stringify({
|
|
34
|
+
targetIssue: {
|
|
35
|
+
ruleKey: targetIssue.ruleKey,
|
|
36
|
+
textRange: targetIssue.textRange,
|
|
37
|
+
quickFixes: targetIssue.quickFixes
|
|
38
|
+
},
|
|
39
|
+
quickFix: quickFix
|
|
40
|
+
}, null, 2), 'utf-8');
|
|
41
|
+
let fileContent = readFileSync(filePath, 'utf-8');
|
|
42
|
+
const lines = fileContent.split('\n');
|
|
43
|
+
// Apply each edit in the quick fix
|
|
44
|
+
const fileEdits = quickFix.inputFileEdits || quickFix.fileEdits || [];
|
|
45
|
+
if (fileEdits.length > 0) {
|
|
46
|
+
console.error(`[DEBUG] Found ${fileEdits.length} file edits`);
|
|
47
|
+
for (const fileEdit of fileEdits) {
|
|
48
|
+
if (fileEdit.textEdits) {
|
|
49
|
+
console.error(`[DEBUG] Found ${fileEdit.textEdits.length} text edits`);
|
|
50
|
+
// Sort edits in reverse order to maintain line numbers
|
|
51
|
+
const sortedEdits = [...fileEdit.textEdits].sort((a, b) => {
|
|
52
|
+
const aStart = a.range?.startLine || 0;
|
|
53
|
+
const bStart = b.range?.startLine || 0;
|
|
54
|
+
return bStart - aStart; // Reverse order
|
|
55
|
+
});
|
|
56
|
+
for (const edit of sortedEdits) {
|
|
57
|
+
const startLine = (edit.range?.startLine || 1) - 1; // Convert to 0-based
|
|
58
|
+
const startCol = edit.range?.startLineOffset || 0;
|
|
59
|
+
const endLine = (edit.range?.endLine || startLine + 1) - 1;
|
|
60
|
+
const endCol = edit.range?.endLineOffset || lines[endLine]?.length || 0;
|
|
61
|
+
const newText = edit.newText || '';
|
|
62
|
+
console.error(`[DEBUG] Applying edit at line ${startLine + 1}:${startCol} to ${endLine + 1}:${endCol}`);
|
|
63
|
+
console.error(`[DEBUG] Old text: "${lines[startLine].substring(startCol, endCol)}"`);
|
|
64
|
+
console.error(`[DEBUG] New text: "${newText}"`);
|
|
65
|
+
// Apply the edit
|
|
66
|
+
if (startLine === endLine) {
|
|
67
|
+
const line = lines[startLine];
|
|
68
|
+
lines[startLine] = line.substring(0, startCol) + newText + line.substring(endCol);
|
|
69
|
+
console.error(`[DEBUG] Result: "${lines[startLine]}"`);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
// Multi-line edit
|
|
73
|
+
const firstLine = lines[startLine].substring(0, startCol) + newText;
|
|
74
|
+
const lastLine = lines[endLine].substring(endCol);
|
|
75
|
+
lines.splice(startLine, endLine - startLine + 1, firstLine + lastLine);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
console.error('[DEBUG] No fileEdits found in quick fix!');
|
|
83
|
+
}
|
|
84
|
+
// Write the modified content back
|
|
85
|
+
fileContent = lines.join('\n');
|
|
86
|
+
console.error(`[DEBUG] About to write file: ${filePath}`);
|
|
87
|
+
console.error(`[DEBUG] File content length: ${fileContent.length} chars`);
|
|
88
|
+
console.error(`[DEBUG] First 200 chars: ${fileContent.substring(0, 200)}`);
|
|
89
|
+
try {
|
|
90
|
+
writeFileSync(filePath, fileContent, 'utf-8');
|
|
91
|
+
console.error(`[DEBUG] File written successfully`);
|
|
92
|
+
}
|
|
93
|
+
catch (err) {
|
|
94
|
+
console.error(`[DEBUG] Error writing file:`, err);
|
|
95
|
+
throw err;
|
|
96
|
+
}
|
|
97
|
+
// Notify SLOOP that file system was updated (proper cache invalidation)
|
|
98
|
+
console.error(`[Cache] Sending file system update notification...`);
|
|
99
|
+
await notifyFileSystemChanged(filePath, scopeId);
|
|
100
|
+
console.error(`[Cache] File system update notification sent, waiting for SLOOP to process...`);
|
|
101
|
+
// CRITICAL: Give SLOOP time to process the file system notification
|
|
102
|
+
// Without this delay, the next analysis request may arrive before SLOOP updates its registry
|
|
103
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
104
|
+
return {
|
|
105
|
+
content: [
|
|
106
|
+
{
|
|
107
|
+
type: "text",
|
|
108
|
+
text: `✅ **Quick fix applied successfully**\n\nFile: ${filePath}\nLine: ${line}\nRule: ${rule}\nFix: ${quickFix.message || 'Applied automated fix'}\n\nThe file has been modified. You may want to re-analyze it to confirm the issue is resolved.`,
|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