test-genie-mcp 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +219 -0
- package/dist/analyzers/astAnalyzer.d.ts +108 -0
- package/dist/analyzers/astAnalyzer.d.ts.map +1 -0
- package/dist/analyzers/astAnalyzer.js +800 -0
- package/dist/analyzers/astAnalyzer.js.map +1 -0
- package/dist/analyzers/performanceAnalyzer.d.ts +90 -0
- package/dist/analyzers/performanceAnalyzer.d.ts.map +1 -0
- package/dist/analyzers/performanceAnalyzer.js +647 -0
- package/dist/analyzers/performanceAnalyzer.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +683 -0
- package/dist/index.js.map +1 -0
- package/dist/platforms/android/index.d.ts +90 -0
- package/dist/platforms/android/index.d.ts.map +1 -0
- package/dist/platforms/android/index.js +519 -0
- package/dist/platforms/android/index.js.map +1 -0
- package/dist/platforms/flutter/index.d.ts +105 -0
- package/dist/platforms/flutter/index.d.ts.map +1 -0
- package/dist/platforms/flutter/index.js +533 -0
- package/dist/platforms/flutter/index.js.map +1 -0
- package/dist/platforms/ios/index.d.ts +79 -0
- package/dist/platforms/ios/index.d.ts.map +1 -0
- package/dist/platforms/ios/index.js +393 -0
- package/dist/platforms/ios/index.js.map +1 -0
- package/dist/platforms/react-native/index.d.ts +160 -0
- package/dist/platforms/react-native/index.d.ts.map +1 -0
- package/dist/platforms/react-native/index.js +602 -0
- package/dist/platforms/react-native/index.js.map +1 -0
- package/dist/platforms/web/index.d.ts +177 -0
- package/dist/platforms/web/index.d.ts.map +1 -0
- package/dist/platforms/web/index.js +637 -0
- package/dist/platforms/web/index.js.map +1 -0
- package/dist/storage/index.d.ts +35 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +351 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/tools/analysis/analyzeAppStructure.d.ts +9 -0
- package/dist/tools/analysis/analyzeAppStructure.d.ts.map +1 -0
- package/dist/tools/analysis/analyzeAppStructure.js +289 -0
- package/dist/tools/analysis/analyzeAppStructure.js.map +1 -0
- package/dist/tools/analysis/createTestPlan.d.ts +21 -0
- package/dist/tools/analysis/createTestPlan.d.ts.map +1 -0
- package/dist/tools/analysis/createTestPlan.js +214 -0
- package/dist/tools/analysis/createTestPlan.js.map +1 -0
- package/dist/tools/analysis/generateScenarios.d.ts +21 -0
- package/dist/tools/analysis/generateScenarios.d.ts.map +1 -0
- package/dist/tools/analysis/generateScenarios.js +567 -0
- package/dist/tools/analysis/generateScenarios.js.map +1 -0
- package/dist/tools/automation/cicdIntegration.d.ts +41 -0
- package/dist/tools/automation/cicdIntegration.d.ts.map +1 -0
- package/dist/tools/automation/cicdIntegration.js +825 -0
- package/dist/tools/automation/cicdIntegration.js.map +1 -0
- package/dist/tools/automation/generateReport.d.ts +16 -0
- package/dist/tools/automation/generateReport.d.ts.map +1 -0
- package/dist/tools/automation/generateReport.js +406 -0
- package/dist/tools/automation/generateReport.js.map +1 -0
- package/dist/tools/automation/runFullAutomation.d.ts +25 -0
- package/dist/tools/automation/runFullAutomation.d.ts.map +1 -0
- package/dist/tools/automation/runFullAutomation.js +296 -0
- package/dist/tools/automation/runFullAutomation.js.map +1 -0
- package/dist/tools/detection/detectLogicErrors.d.ts +18 -0
- package/dist/tools/detection/detectLogicErrors.d.ts.map +1 -0
- package/dist/tools/detection/detectLogicErrors.js +470 -0
- package/dist/tools/detection/detectLogicErrors.js.map +1 -0
- package/dist/tools/detection/detectMemoryLeaks.d.ts +23 -0
- package/dist/tools/detection/detectMemoryLeaks.d.ts.map +1 -0
- package/dist/tools/detection/detectMemoryLeaks.js +453 -0
- package/dist/tools/detection/detectMemoryLeaks.js.map +1 -0
- package/dist/tools/execution/runScenarioTest.d.ts +34 -0
- package/dist/tools/execution/runScenarioTest.d.ts.map +1 -0
- package/dist/tools/execution/runScenarioTest.js +334 -0
- package/dist/tools/execution/runScenarioTest.js.map +1 -0
- package/dist/tools/execution/runSimulation.d.ts +17 -0
- package/dist/tools/execution/runSimulation.d.ts.map +1 -0
- package/dist/tools/execution/runSimulation.js +250 -0
- package/dist/tools/execution/runSimulation.js.map +1 -0
- package/dist/tools/execution/runStressTest.d.ts +52 -0
- package/dist/tools/execution/runStressTest.d.ts.map +1 -0
- package/dist/tools/execution/runStressTest.js +176 -0
- package/dist/tools/execution/runStressTest.js.map +1 -0
- package/dist/tools/fixing/applyFix.d.ts +44 -0
- package/dist/tools/fixing/applyFix.d.ts.map +1 -0
- package/dist/tools/fixing/applyFix.js +399 -0
- package/dist/tools/fixing/applyFix.js.map +1 -0
- package/dist/tools/fixing/confirmFix.d.ts +31 -0
- package/dist/tools/fixing/confirmFix.d.ts.map +1 -0
- package/dist/tools/fixing/confirmFix.js +136 -0
- package/dist/tools/fixing/confirmFix.js.map +1 -0
- package/dist/tools/fixing/suggestFixes.d.ts +23 -0
- package/dist/tools/fixing/suggestFixes.d.ts.map +1 -0
- package/dist/tools/fixing/suggestFixes.js +349 -0
- package/dist/tools/fixing/suggestFixes.js.map +1 -0
- package/dist/types.d.ts +322 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/codeParser.d.ts +12 -0
- package/dist/utils/codeParser.d.ts.map +1 -0
- package/dist/utils/codeParser.js +487 -0
- package/dist/utils/codeParser.js.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================
|
|
3
|
+
// Suggest Fixes Tool
|
|
4
|
+
// ============================================
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.suggestFixes = suggestFixes;
|
|
40
|
+
const uuid_1 = require("uuid");
|
|
41
|
+
const fs = __importStar(require("fs"));
|
|
42
|
+
const index_js_1 = require("../../storage/index.js");
|
|
43
|
+
const codeParser_js_1 = require("../../utils/codeParser.js");
|
|
44
|
+
function suggestFixes(params) {
|
|
45
|
+
const { issues, projectPath, platform, autoGenerate = true, maxSuggestions = 50, } = params;
|
|
46
|
+
const suggestions = [];
|
|
47
|
+
// Generate fix suggestions for each issue
|
|
48
|
+
for (const issue of issues.slice(0, maxSuggestions)) {
|
|
49
|
+
const suggestion = generateFixSuggestion(issue, platform, projectPath);
|
|
50
|
+
if (suggestion) {
|
|
51
|
+
suggestions.push(suggestion);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Save suggestions
|
|
55
|
+
(0, index_js_1.saveFixes)(suggestions, projectPath);
|
|
56
|
+
// Generate summary
|
|
57
|
+
const byConfidence = { high: 0, medium: 0, low: 0 };
|
|
58
|
+
const bySeverity = {};
|
|
59
|
+
for (const s of suggestions) {
|
|
60
|
+
if (s.confidence >= 80)
|
|
61
|
+
byConfidence.high++;
|
|
62
|
+
else if (s.confidence >= 50)
|
|
63
|
+
byConfidence.medium++;
|
|
64
|
+
else
|
|
65
|
+
byConfidence.low++;
|
|
66
|
+
const severity = issues.find(i => i.id === s.issueId)?.severity || 'unknown';
|
|
67
|
+
bySeverity[severity] = (bySeverity[severity] || 0) + 1;
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
suggestions,
|
|
71
|
+
summary: {
|
|
72
|
+
totalSuggestions: suggestions.length,
|
|
73
|
+
byConfidence,
|
|
74
|
+
bySeverity,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function generateFixSuggestion(issue, platform, projectPath) {
|
|
79
|
+
// Read the original file
|
|
80
|
+
let originalCode = '';
|
|
81
|
+
try {
|
|
82
|
+
const fileContent = fs.readFileSync(issue.file, 'utf-8');
|
|
83
|
+
const lines = fileContent.split('\n');
|
|
84
|
+
const startLine = Math.max(0, issue.line - 3);
|
|
85
|
+
const endLine = Math.min(lines.length, issue.line + 5);
|
|
86
|
+
originalCode = lines.slice(startLine, endLine).join('\n');
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
originalCode = issue.code || '';
|
|
90
|
+
}
|
|
91
|
+
// Generate fix based on issue type
|
|
92
|
+
const fix = generateFixCode(issue, platform, originalCode);
|
|
93
|
+
if (!fix)
|
|
94
|
+
return null;
|
|
95
|
+
const diff = (0, codeParser_js_1.generateDiff)(fix.original, fix.suggested);
|
|
96
|
+
// Calculate impact
|
|
97
|
+
const impact = analyzeImpact(issue, projectPath);
|
|
98
|
+
// Generate alternatives
|
|
99
|
+
const alternatives = generateAlternatives(issue, platform);
|
|
100
|
+
return {
|
|
101
|
+
id: (0, uuid_1.v4)(),
|
|
102
|
+
issueId: issue.id,
|
|
103
|
+
title: `Fix: ${issue.title}`,
|
|
104
|
+
description: issue.suggestion || `Resolve ${issue.type} issue`,
|
|
105
|
+
confidence: fix.confidence,
|
|
106
|
+
file: issue.file,
|
|
107
|
+
line: issue.line,
|
|
108
|
+
originalCode: fix.original,
|
|
109
|
+
suggestedCode: fix.suggested,
|
|
110
|
+
diff,
|
|
111
|
+
impact,
|
|
112
|
+
alternatives: alternatives.length > 0 ? alternatives : undefined,
|
|
113
|
+
status: 'pending',
|
|
114
|
+
createdAt: new Date().toISOString(),
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function generateFixCode(issue, platform, originalCode) {
|
|
118
|
+
switch (issue.type) {
|
|
119
|
+
case 'memory_leak':
|
|
120
|
+
return generateMemoryLeakFix(issue, platform, originalCode);
|
|
121
|
+
case 'retain_cycle':
|
|
122
|
+
return generateRetainCycleFix(issue, platform, originalCode);
|
|
123
|
+
case 'unclosed_resource':
|
|
124
|
+
return generateResourceCleanupFix(issue, platform, originalCode);
|
|
125
|
+
case 'race_condition':
|
|
126
|
+
return generateRaceConditionFix(issue, platform, originalCode);
|
|
127
|
+
case 'state_inconsistency':
|
|
128
|
+
return generateStateConsistencyFix(issue, platform, originalCode);
|
|
129
|
+
case 'null_reference':
|
|
130
|
+
return generateNullCheckFix(issue, platform, originalCode);
|
|
131
|
+
default:
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function generateMemoryLeakFix(issue, platform, originalCode) {
|
|
136
|
+
let suggested = originalCode;
|
|
137
|
+
let confidence = 85;
|
|
138
|
+
if (platform === 'react-native' || platform === 'web') {
|
|
139
|
+
// useEffect without cleanup
|
|
140
|
+
if (issue.title.includes('useEffect')) {
|
|
141
|
+
if (originalCode.includes('addEventListener')) {
|
|
142
|
+
suggested = originalCode.replace(/useEffect\s*\(\s*\(\s*\)\s*=>\s*\{/, 'useEffect(() => {\n const abortController = new AbortController();');
|
|
143
|
+
suggested = suggested.replace(/\}\s*,\s*\[/, `\n return () => {\n abortController.abort();\n // Cleanup event listeners here\n };\n }, [`);
|
|
144
|
+
}
|
|
145
|
+
else if (originalCode.includes('setInterval')) {
|
|
146
|
+
suggested = originalCode.replace(/(const\s+\w+\s*=\s*setInterval)/, '$1');
|
|
147
|
+
if (!suggested.includes('return')) {
|
|
148
|
+
suggested = suggested.replace(/\}\s*,\s*\[/, `\n return () => clearInterval(intervalId);\n }, [`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
else if (originalCode.includes('subscribe')) {
|
|
152
|
+
suggested = originalCode.replace(/\}\s*,\s*\[/, `\n return () => subscription.unsubscribe();\n }, [`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (platform === 'ios') {
|
|
157
|
+
// NotificationCenter
|
|
158
|
+
if (issue.title.includes('NotificationCenter')) {
|
|
159
|
+
if (!originalCode.includes('removeObserver')) {
|
|
160
|
+
suggested = originalCode + `\n\n deinit {\n NotificationCenter.default.removeObserver(self)\n }`;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
// Timer
|
|
164
|
+
if (issue.title.includes('Timer')) {
|
|
165
|
+
if (!originalCode.includes('invalidate')) {
|
|
166
|
+
suggested = originalCode + `\n\n deinit {\n timer?.invalidate()\n timer = nil\n }`;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (platform === 'flutter') {
|
|
171
|
+
// StreamSubscription
|
|
172
|
+
if (issue.title.includes('StreamSubscription')) {
|
|
173
|
+
if (!originalCode.includes('cancel')) {
|
|
174
|
+
suggested = originalCode + `\n\n @override\n void dispose() {\n subscription?.cancel();\n super.dispose();\n }`;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// AnimationController
|
|
178
|
+
if (issue.title.includes('AnimationController')) {
|
|
179
|
+
if (!originalCode.includes('dispose')) {
|
|
180
|
+
suggested = originalCode + `\n\n @override\n void dispose() {\n controller.dispose();\n super.dispose();\n }`;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (suggested === originalCode) {
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
return { original: originalCode, suggested, confidence };
|
|
188
|
+
}
|
|
189
|
+
function generateRetainCycleFix(issue, platform, originalCode) {
|
|
190
|
+
let suggested = originalCode;
|
|
191
|
+
let confidence = 90;
|
|
192
|
+
if (platform === 'ios') {
|
|
193
|
+
// Add weak self to closure
|
|
194
|
+
if (issue.title.includes('closure')) {
|
|
195
|
+
suggested = originalCode.replace(/\{\s*(\n?\s*self\.)/, '{ [weak self] in\n guard let self = self else { return }\n self.');
|
|
196
|
+
}
|
|
197
|
+
// Make delegate weak
|
|
198
|
+
if (issue.title.includes('Delegate')) {
|
|
199
|
+
suggested = originalCode.replace(/var\s+(\w*delegate\w*)\s*:\s*/i, 'weak var $1: ');
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (platform === 'react-native' || platform === 'web') {
|
|
203
|
+
// This is typically handled by the memory leak fix for useEffect
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
if (suggested === originalCode) {
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
209
|
+
return { original: originalCode, suggested, confidence };
|
|
210
|
+
}
|
|
211
|
+
function generateResourceCleanupFix(issue, platform, originalCode) {
|
|
212
|
+
let suggested = originalCode;
|
|
213
|
+
let confidence = 85;
|
|
214
|
+
if (platform === 'flutter') {
|
|
215
|
+
const controllerMatch = originalCode.match(/(\w+Controller)\s+(\w+)/);
|
|
216
|
+
if (controllerMatch) {
|
|
217
|
+
const controllerName = controllerMatch[2];
|
|
218
|
+
suggested = originalCode + `\n\n @override\n void dispose() {\n ${controllerName}.dispose();\n super.dispose();\n }`;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if (platform === 'android') {
|
|
222
|
+
if (issue.title.includes('BroadcastReceiver')) {
|
|
223
|
+
suggested = originalCode + `\n\n override fun onDestroy() {\n super.onDestroy()\n unregisterReceiver(receiver)\n }`;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
if (suggested === originalCode) {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
return { original: originalCode, suggested, confidence };
|
|
230
|
+
}
|
|
231
|
+
function generateRaceConditionFix(issue, platform, originalCode) {
|
|
232
|
+
let suggested = originalCode;
|
|
233
|
+
let confidence = 75;
|
|
234
|
+
if (platform === 'react-native' || platform === 'web') {
|
|
235
|
+
if (issue.title.includes('mount check')) {
|
|
236
|
+
// Add isMounted check
|
|
237
|
+
suggested = `const isMountedRef = useRef(true);\n\nuseEffect(() => {\n return () => { isMountedRef.current = false; };\n}, []);\n\n` + originalCode;
|
|
238
|
+
suggested = suggested.replace(/setState\s*\(/g, 'if (isMountedRef.current) setState(');
|
|
239
|
+
}
|
|
240
|
+
if (issue.title.includes('Multiple setState')) {
|
|
241
|
+
// Combine setState calls
|
|
242
|
+
suggested = originalCode.replace(/setState\s*\(\s*\{([^}]+)\}\s*\)\s*;\s*setState\s*\(\s*\{([^}]+)\}\s*\)/g, 'setState({ $1, $2 })');
|
|
243
|
+
confidence = 70;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (platform === 'flutter') {
|
|
247
|
+
if (issue.title.includes('mounted')) {
|
|
248
|
+
suggested = originalCode.replace(/await\s+([^;]+);\s*(\n\s*)setState/g, 'await $1;\n if (!mounted) return;$2setState');
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (suggested === originalCode) {
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
return { original: originalCode, suggested, confidence };
|
|
255
|
+
}
|
|
256
|
+
function generateStateConsistencyFix(issue, platform, originalCode) {
|
|
257
|
+
let suggested = originalCode;
|
|
258
|
+
let confidence = 70;
|
|
259
|
+
if (platform === 'react-native' || platform === 'web') {
|
|
260
|
+
if (issue.title.includes('stale')) {
|
|
261
|
+
// Add useEffect to sync with props
|
|
262
|
+
const propMatch = originalCode.match(/useState\s*\(\s*props\.(\w+)\s*\)/);
|
|
263
|
+
if (propMatch) {
|
|
264
|
+
const propName = propMatch[1];
|
|
265
|
+
suggested = originalCode + `\n\nuseEffect(() => {\n setValue(props.${propName});\n}, [props.${propName}]);`;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
if (suggested === originalCode) {
|
|
270
|
+
return null;
|
|
271
|
+
}
|
|
272
|
+
return { original: originalCode, suggested, confidence };
|
|
273
|
+
}
|
|
274
|
+
function generateNullCheckFix(issue, platform, originalCode) {
|
|
275
|
+
let suggested = originalCode;
|
|
276
|
+
let confidence = 85;
|
|
277
|
+
if (platform === 'react-native' || platform === 'web') {
|
|
278
|
+
// Replace force unwrap with optional chaining
|
|
279
|
+
suggested = originalCode.replace(/(\w+)!\./g, '$1?.');
|
|
280
|
+
}
|
|
281
|
+
if (platform === 'ios') {
|
|
282
|
+
// Replace force unwrap with guard or if let
|
|
283
|
+
const forceUnwrapMatch = originalCode.match(/(\w+)!/);
|
|
284
|
+
if (forceUnwrapMatch) {
|
|
285
|
+
const varName = forceUnwrapMatch[1];
|
|
286
|
+
suggested = originalCode.replace(new RegExp(`(\\w+)!`), `${varName}` // Just remove the !, the user needs to add proper handling
|
|
287
|
+
);
|
|
288
|
+
suggested = `guard let ${varName} = ${varName} else { return }\n` + suggested;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
if (platform === 'android') {
|
|
292
|
+
// Replace !! with safe call
|
|
293
|
+
suggested = originalCode.replace(/(\w+)!!/g, '$1?');
|
|
294
|
+
}
|
|
295
|
+
if (suggested === originalCode) {
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
return { original: originalCode, suggested, confidence };
|
|
299
|
+
}
|
|
300
|
+
function analyzeImpact(issue, projectPath) {
|
|
301
|
+
// Analyze affected files
|
|
302
|
+
const filesAffected = [issue.file];
|
|
303
|
+
const testsAffected = [];
|
|
304
|
+
// Determine risk level
|
|
305
|
+
let riskLevel = 'low';
|
|
306
|
+
if (issue.severity === 'critical')
|
|
307
|
+
riskLevel = 'high';
|
|
308
|
+
else if (issue.severity === 'high')
|
|
309
|
+
riskLevel = 'medium';
|
|
310
|
+
// Check for breaking changes
|
|
311
|
+
const breakingChange = issue.type === 'type_mismatch' || issue.type === 'state_inconsistency';
|
|
312
|
+
return {
|
|
313
|
+
filesAffected,
|
|
314
|
+
testsAffected,
|
|
315
|
+
riskLevel,
|
|
316
|
+
breakingChange,
|
|
317
|
+
requiresRetest: true,
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
function generateAlternatives(issue, platform) {
|
|
321
|
+
const alternatives = [];
|
|
322
|
+
if (issue.type === 'memory_leak' && platform === 'ios') {
|
|
323
|
+
alternatives.push({
|
|
324
|
+
description: 'Use unowned instead of weak',
|
|
325
|
+
suggestedCode: '{ [unowned self] in\n self.doSomething()\n}',
|
|
326
|
+
diff: '',
|
|
327
|
+
tradeoffs: 'Faster than weak, but crashes if self is deallocated',
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
if (issue.type === 'null_reference') {
|
|
331
|
+
alternatives.push({
|
|
332
|
+
description: 'Use default value with nil coalescing',
|
|
333
|
+
suggestedCode: 'value ?? defaultValue',
|
|
334
|
+
diff: '',
|
|
335
|
+
tradeoffs: 'Simpler but may hide issues if default is not appropriate',
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
if (issue.type === 'race_condition') {
|
|
339
|
+
alternatives.push({
|
|
340
|
+
description: 'Use AbortController for cancellation',
|
|
341
|
+
suggestedCode: 'const controller = new AbortController();\nfetch(url, { signal: controller.signal });',
|
|
342
|
+
diff: '',
|
|
343
|
+
tradeoffs: 'More explicit but requires handling abort errors',
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
return alternatives;
|
|
347
|
+
}
|
|
348
|
+
exports.default = suggestFixes;
|
|
349
|
+
//# sourceMappingURL=suggestFixes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suggestFixes.js","sourceRoot":"","sources":["../../../src/tools/fixing/suggestFixes.ts"],"names":[],"mappings":";AAAA,+CAA+C;AAC/C,qBAAqB;AACrB,+CAA+C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+B/C,oCA2CC;AAxED,+BAAoC;AACpC,uCAAyB;AAQzB,qDAAmD;AACnD,6DAAyD;AAmBzD,SAAgB,YAAY,CAAC,MAA0B;IACrD,MAAM,EACJ,MAAM,EACN,WAAW,EACX,QAAQ,EACR,YAAY,GAAG,IAAI,EACnB,cAAc,GAAG,EAAE,GACpB,GAAG,MAAM,CAAC;IAEX,MAAM,WAAW,GAAoB,EAAE,CAAC;IAExC,0CAA0C;IAC1C,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,EAAE,CAAC;QACpD,MAAM,UAAU,GAAG,qBAAqB,CAAC,KAAK,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;QACvE,IAAI,UAAU,EAAE,CAAC;YACf,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IAED,mBAAmB;IACnB,IAAA,oBAAS,EAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAEpC,mBAAmB;IACnB,MAAM,YAAY,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;IACpD,MAAM,UAAU,GAA2B,EAAE,CAAC;IAE9C,KAAK,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC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export type Language = 'swift' | 'kotlin' | 'java' | 'dart' | 'typescript' | 'javascript';
|
|
3
|
+
export type TestType = 'unit' | 'integration' | 'e2e' | 'performance' | 'stress' | 'memory';
|
|
4
|
+
export type Severity = 'critical' | 'high' | 'medium' | 'low' | 'info';
|
|
5
|
+
export type FixStatus = 'pending' | 'confirmed' | 'rejected' | 'applied' | 'failed';
|
|
6
|
+
export interface AppStructure {
|
|
7
|
+
projectPath: string;
|
|
8
|
+
platform: Platform;
|
|
9
|
+
language: Language;
|
|
10
|
+
screens: ScreenInfo[];
|
|
11
|
+
components: ComponentInfo[];
|
|
12
|
+
apis: ApiInfo[];
|
|
13
|
+
stateManagement: StateManagementInfo | null;
|
|
14
|
+
dependencies: DependencyInfo[];
|
|
15
|
+
analyzedAt: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ScreenInfo {
|
|
18
|
+
name: string;
|
|
19
|
+
path: string;
|
|
20
|
+
type: 'screen' | 'page' | 'view' | 'activity' | 'fragment';
|
|
21
|
+
components: string[];
|
|
22
|
+
navigation: NavigationInfo[];
|
|
23
|
+
stateUsage: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface ComponentInfo {
|
|
26
|
+
name: string;
|
|
27
|
+
path: string;
|
|
28
|
+
type: 'component' | 'widget' | 'view' | 'cell';
|
|
29
|
+
props: PropInfo[];
|
|
30
|
+
state: StateInfo[];
|
|
31
|
+
lifecycle: LifecycleInfo[];
|
|
32
|
+
dependencies: string[];
|
|
33
|
+
}
|
|
34
|
+
export interface PropInfo {
|
|
35
|
+
name: string;
|
|
36
|
+
type: string;
|
|
37
|
+
required: boolean;
|
|
38
|
+
defaultValue?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface StateInfo {
|
|
41
|
+
name: string;
|
|
42
|
+
type: string;
|
|
43
|
+
initialValue?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface LifecycleInfo {
|
|
46
|
+
method: string;
|
|
47
|
+
hasCleanup: boolean;
|
|
48
|
+
subscriptions: string[];
|
|
49
|
+
}
|
|
50
|
+
export interface NavigationInfo {
|
|
51
|
+
target: string;
|
|
52
|
+
type: 'push' | 'pop' | 'replace' | 'modal' | 'tab';
|
|
53
|
+
params?: string[];
|
|
54
|
+
}
|
|
55
|
+
export interface ApiInfo {
|
|
56
|
+
endpoint: string;
|
|
57
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
58
|
+
path: string;
|
|
59
|
+
requestType?: string;
|
|
60
|
+
responseType?: string;
|
|
61
|
+
errorHandling: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface StateManagementInfo {
|
|
64
|
+
type: 'redux' | 'mobx' | 'zustand' | 'recoil' | 'provider' | 'bloc' | 'riverpod' | 'getx' | 'other';
|
|
65
|
+
stores: string[];
|
|
66
|
+
actions: string[];
|
|
67
|
+
}
|
|
68
|
+
export interface DependencyInfo {
|
|
69
|
+
name: string;
|
|
70
|
+
version: string;
|
|
71
|
+
type: 'production' | 'development';
|
|
72
|
+
}
|
|
73
|
+
export interface TestScenario {
|
|
74
|
+
id: string;
|
|
75
|
+
name: string;
|
|
76
|
+
description: string;
|
|
77
|
+
type: TestType;
|
|
78
|
+
priority: 'critical' | 'high' | 'medium' | 'low';
|
|
79
|
+
steps: TestStep[];
|
|
80
|
+
preconditions: string[];
|
|
81
|
+
expectedResults: string[];
|
|
82
|
+
tags: string[];
|
|
83
|
+
estimatedDuration: number;
|
|
84
|
+
createdAt: string;
|
|
85
|
+
}
|
|
86
|
+
export interface TestStep {
|
|
87
|
+
order: number;
|
|
88
|
+
action: string;
|
|
89
|
+
target?: string;
|
|
90
|
+
input?: string;
|
|
91
|
+
expectedOutput?: string;
|
|
92
|
+
timeout?: number;
|
|
93
|
+
}
|
|
94
|
+
export interface TestPlan {
|
|
95
|
+
id: string;
|
|
96
|
+
name: string;
|
|
97
|
+
description: string;
|
|
98
|
+
scenarios: TestScenario[];
|
|
99
|
+
coverage: CoverageInfo;
|
|
100
|
+
schedule?: ScheduleInfo;
|
|
101
|
+
createdAt: string;
|
|
102
|
+
}
|
|
103
|
+
export interface CoverageInfo {
|
|
104
|
+
screens: number;
|
|
105
|
+
components: number;
|
|
106
|
+
apis: number;
|
|
107
|
+
stateTransitions: number;
|
|
108
|
+
edgeCases: number;
|
|
109
|
+
}
|
|
110
|
+
export interface ScheduleInfo {
|
|
111
|
+
type: 'once' | 'daily' | 'weekly' | 'on-commit';
|
|
112
|
+
nextRun?: string;
|
|
113
|
+
}
|
|
114
|
+
export interface TestResult {
|
|
115
|
+
id: string;
|
|
116
|
+
scenarioId: string;
|
|
117
|
+
scenarioName: string;
|
|
118
|
+
status: 'passed' | 'failed' | 'skipped' | 'error';
|
|
119
|
+
duration: number;
|
|
120
|
+
steps: StepResult[];
|
|
121
|
+
logs: string[];
|
|
122
|
+
screenshots?: string[];
|
|
123
|
+
error?: ErrorInfo;
|
|
124
|
+
executedAt: string;
|
|
125
|
+
}
|
|
126
|
+
export interface StepResult {
|
|
127
|
+
order: number;
|
|
128
|
+
action: string;
|
|
129
|
+
status: 'passed' | 'failed' | 'skipped';
|
|
130
|
+
duration: number;
|
|
131
|
+
actualOutput?: string;
|
|
132
|
+
error?: string;
|
|
133
|
+
}
|
|
134
|
+
export interface ErrorInfo {
|
|
135
|
+
type: string;
|
|
136
|
+
message: string;
|
|
137
|
+
stackTrace?: string;
|
|
138
|
+
file?: string;
|
|
139
|
+
line?: number;
|
|
140
|
+
}
|
|
141
|
+
export interface SimulationResult {
|
|
142
|
+
id: string;
|
|
143
|
+
duration: number;
|
|
144
|
+
userActions: number;
|
|
145
|
+
errorsFound: number;
|
|
146
|
+
memoryPeakMB: number;
|
|
147
|
+
cpuPeakPercent: number;
|
|
148
|
+
crashes: CrashInfo[];
|
|
149
|
+
anomalies: AnomalyInfo[];
|
|
150
|
+
executedAt: string;
|
|
151
|
+
}
|
|
152
|
+
export interface CrashInfo {
|
|
153
|
+
timestamp: string;
|
|
154
|
+
type: string;
|
|
155
|
+
message: string;
|
|
156
|
+
stackTrace: string;
|
|
157
|
+
screen?: string;
|
|
158
|
+
}
|
|
159
|
+
export interface AnomalyInfo {
|
|
160
|
+
type: 'memory_spike' | 'cpu_spike' | 'slow_render' | 'network_timeout' | 'state_inconsistency';
|
|
161
|
+
timestamp: string;
|
|
162
|
+
details: string;
|
|
163
|
+
severity: Severity;
|
|
164
|
+
}
|
|
165
|
+
export interface DetectedIssue {
|
|
166
|
+
id: string;
|
|
167
|
+
type: IssueType;
|
|
168
|
+
severity: Severity;
|
|
169
|
+
title: string;
|
|
170
|
+
description: string;
|
|
171
|
+
file: string;
|
|
172
|
+
line: number;
|
|
173
|
+
column?: number;
|
|
174
|
+
code?: string;
|
|
175
|
+
suggestion?: string;
|
|
176
|
+
relatedIssues?: string[];
|
|
177
|
+
detectedAt: string;
|
|
178
|
+
}
|
|
179
|
+
export type IssueType = 'memory_leak' | 'retain_cycle' | 'unclosed_resource' | 'race_condition' | 'state_inconsistency' | 'null_reference' | 'type_mismatch' | 'unhandled_error' | 'performance_bottleneck' | 'unused_code' | 'deprecated_api' | 'security_vulnerability';
|
|
180
|
+
export interface MemoryLeakInfo extends DetectedIssue {
|
|
181
|
+
type: 'memory_leak' | 'retain_cycle' | 'unclosed_resource';
|
|
182
|
+
objectType: string;
|
|
183
|
+
retainCount?: number;
|
|
184
|
+
allocationSize?: number;
|
|
185
|
+
retainCycle?: string[];
|
|
186
|
+
}
|
|
187
|
+
export interface LogicErrorInfo extends DetectedIssue {
|
|
188
|
+
type: 'race_condition' | 'state_inconsistency' | 'null_reference' | 'type_mismatch';
|
|
189
|
+
context: string;
|
|
190
|
+
possibleCause: string;
|
|
191
|
+
reproducibility: 'always' | 'intermittent' | 'rare';
|
|
192
|
+
}
|
|
193
|
+
export interface PerformanceIssue extends DetectedIssue {
|
|
194
|
+
type: 'performance_bottleneck';
|
|
195
|
+
metric: 'cpu' | 'memory' | 'render' | 'network' | 'disk';
|
|
196
|
+
currentValue: number;
|
|
197
|
+
threshold: number;
|
|
198
|
+
unit: string;
|
|
199
|
+
}
|
|
200
|
+
export interface FixSuggestion {
|
|
201
|
+
id: string;
|
|
202
|
+
issueId: string;
|
|
203
|
+
title: string;
|
|
204
|
+
description: string;
|
|
205
|
+
confidence: number;
|
|
206
|
+
file: string;
|
|
207
|
+
line: number;
|
|
208
|
+
originalCode: string;
|
|
209
|
+
suggestedCode: string;
|
|
210
|
+
diff: string;
|
|
211
|
+
impact: ImpactInfo;
|
|
212
|
+
alternatives?: AlternativeFix[];
|
|
213
|
+
status: FixStatus;
|
|
214
|
+
createdAt: string;
|
|
215
|
+
confirmedAt?: string;
|
|
216
|
+
appliedAt?: string;
|
|
217
|
+
}
|
|
218
|
+
export interface ImpactInfo {
|
|
219
|
+
filesAffected: string[];
|
|
220
|
+
testsAffected: string[];
|
|
221
|
+
riskLevel: 'low' | 'medium' | 'high';
|
|
222
|
+
breakingChange: boolean;
|
|
223
|
+
requiresRetest: boolean;
|
|
224
|
+
}
|
|
225
|
+
export interface AlternativeFix {
|
|
226
|
+
description: string;
|
|
227
|
+
suggestedCode: string;
|
|
228
|
+
diff: string;
|
|
229
|
+
tradeoffs: string;
|
|
230
|
+
}
|
|
231
|
+
export interface FixConfirmation {
|
|
232
|
+
fixId: string;
|
|
233
|
+
action: 'approve' | 'reject' | 'modify';
|
|
234
|
+
modifiedCode?: string;
|
|
235
|
+
reason?: string;
|
|
236
|
+
confirmedAt: string;
|
|
237
|
+
}
|
|
238
|
+
export interface FixApplication {
|
|
239
|
+
fixId: string;
|
|
240
|
+
success: boolean;
|
|
241
|
+
backupPath?: string;
|
|
242
|
+
error?: string;
|
|
243
|
+
retestResult?: TestResult;
|
|
244
|
+
appliedAt: string;
|
|
245
|
+
}
|
|
246
|
+
export interface AutomationConfig {
|
|
247
|
+
projectPath: string;
|
|
248
|
+
platform: Platform;
|
|
249
|
+
testTypes: TestType[];
|
|
250
|
+
autoFix: boolean;
|
|
251
|
+
confirmMode: 'auto' | 'interactive' | 'batch';
|
|
252
|
+
thresholds: ThresholdConfig;
|
|
253
|
+
notifications?: NotificationConfig;
|
|
254
|
+
}
|
|
255
|
+
export interface ThresholdConfig {
|
|
256
|
+
memoryLeakSizeMB: number;
|
|
257
|
+
cpuUsagePercent: number;
|
|
258
|
+
renderTimeMs: number;
|
|
259
|
+
apiTimeoutMs: number;
|
|
260
|
+
coveragePercent: number;
|
|
261
|
+
}
|
|
262
|
+
export interface NotificationConfig {
|
|
263
|
+
onComplete: boolean;
|
|
264
|
+
onCriticalIssue: boolean;
|
|
265
|
+
channels: ('slack' | 'email' | 'discord')[];
|
|
266
|
+
}
|
|
267
|
+
export interface AutomationResult {
|
|
268
|
+
id: string;
|
|
269
|
+
config: AutomationConfig;
|
|
270
|
+
appStructure: AppStructure;
|
|
271
|
+
testPlan: TestPlan;
|
|
272
|
+
testResults: TestResult[];
|
|
273
|
+
simulationResult?: SimulationResult;
|
|
274
|
+
detectedIssues: DetectedIssue[];
|
|
275
|
+
fixSuggestions: FixSuggestion[];
|
|
276
|
+
appliedFixes: FixApplication[];
|
|
277
|
+
summary: AutomationSummary;
|
|
278
|
+
startedAt: string;
|
|
279
|
+
completedAt: string;
|
|
280
|
+
}
|
|
281
|
+
export interface AutomationSummary {
|
|
282
|
+
totalScenarios: number;
|
|
283
|
+
passedScenarios: number;
|
|
284
|
+
failedScenarios: number;
|
|
285
|
+
totalIssues: number;
|
|
286
|
+
criticalIssues: number;
|
|
287
|
+
fixesApplied: number;
|
|
288
|
+
coveragePercent: number;
|
|
289
|
+
duration: number;
|
|
290
|
+
}
|
|
291
|
+
export interface TestReport {
|
|
292
|
+
id: string;
|
|
293
|
+
title: string;
|
|
294
|
+
format: 'markdown' | 'html' | 'json';
|
|
295
|
+
sections: ReportSection[];
|
|
296
|
+
generatedAt: string;
|
|
297
|
+
}
|
|
298
|
+
export interface ReportSection {
|
|
299
|
+
title: string;
|
|
300
|
+
type: 'summary' | 'details' | 'issues' | 'fixes' | 'recommendations';
|
|
301
|
+
content: string;
|
|
302
|
+
}
|
|
303
|
+
export interface StoredScenario {
|
|
304
|
+
scenario: TestScenario;
|
|
305
|
+
projectPath: string;
|
|
306
|
+
createdAt: string;
|
|
307
|
+
updatedAt: string;
|
|
308
|
+
}
|
|
309
|
+
export interface StoredTestResult {
|
|
310
|
+
result: TestResult;
|
|
311
|
+
projectPath: string;
|
|
312
|
+
createdAt: string;
|
|
313
|
+
}
|
|
314
|
+
export interface StoredFix {
|
|
315
|
+
fix: FixSuggestion;
|
|
316
|
+
confirmation?: FixConfirmation;
|
|
317
|
+
application?: FixApplication;
|
|
318
|
+
projectPath: string;
|
|
319
|
+
createdAt: string;
|
|
320
|
+
updatedAt: string;
|
|
321
|
+
}
|
|
322
|
+
//# sourceMappingURL=types.d.ts.map
|