devintelligence 1.0.0 → 1.0.1
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/.env.example +14 -14
- package/LICENSE +22 -22
- package/README.md +146 -146
- package/bin/devintelligence.js +2481 -12
- package/bin/devintelligence.ts +244 -103
- package/dist/App.d.ts +3 -0
- package/dist/ai.js +366 -0
- package/dist/ai.js.map +7 -0
- package/dist/components/DeepAnalysisViews.d.ts +13 -0
- package/dist/components/MobileAndPlatformViews.d.ts +22 -0
- package/dist/components/OverviewAndExplorerViews.d.ts +20 -0
- package/dist/components/RepairAndGateViews.d.ts +25 -0
- package/dist/engine/aiEngine.d.ts +62 -0
- package/dist/engine/analyzerEngine.d.ts +19 -0
- package/dist/engine/repairEngine.d.ts +42 -0
- package/dist/engine.js +1541 -0
- package/dist/engine.js.map +7 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +2344 -0
- package/dist/index.js.map +7 -0
- package/dist/main.d.ts +1 -0
- package/dist/repair.js +2052 -0
- package/dist/repair.js.map +7 -0
- package/dist/src/App.d.ts +3 -0
- package/dist/src/components/DeepAnalysisViews.d.ts +13 -0
- package/dist/src/components/MobileAndPlatformViews.d.ts +22 -0
- package/dist/src/components/OverviewAndExplorerViews.d.ts +20 -0
- package/dist/src/components/RepairAndGateViews.d.ts +25 -0
- package/dist/src/engine/aiEngine.d.ts +62 -0
- package/dist/src/engine/analyzerEngine.d.ts +19 -0
- package/dist/src/engine/repairEngine.d.ts +42 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/main.d.ts +1 -0
- package/dist/src/types/devintelligence.d.ts +250 -0
- package/dist/types/devintelligence.d.ts +250 -0
- package/fixtures/django-analytics-service/requirements.txt +4 -4
- package/fixtures/django-analytics-service/settings.py +16 -16
- package/fixtures/express-api-gateway/package.json +14 -14
- package/fixtures/express-api-gateway/src/server.ts +16 -16
- package/fixtures/nextjs-saas-portal/package.json +21 -21
- package/fixtures/nextjs-saas-portal/src/app/dashboard/page.tsx +26 -26
- package/fixtures/rn-bare-fitness/android/build.gradle +19 -19
- package/fixtures/rn-bare-fitness/ios/Info.plist +14 -14
- package/fixtures/rn-bare-fitness/package.json +23 -23
- package/fixtures/rn-bare-fitness/src/WorkoutTracker.tsx +31 -31
- package/fixtures/rn-expo-commerce/android/app/build.gradle +20 -20
- package/fixtures/rn-expo-commerce/android/app/src/main/AndroidManifest.xml +21 -21
- package/fixtures/rn-expo-commerce/android/gradle.properties +6 -6
- package/fixtures/rn-expo-commerce/app.json +17 -17
- package/fixtures/rn-expo-commerce/babel.config.js +10 -10
- package/fixtures/rn-expo-commerce/ios/Podfile +13 -13
- package/fixtures/rn-expo-commerce/metro.config.js +7 -7
- package/fixtures/rn-expo-commerce/package.json +31 -31
- package/fixtures/rn-expo-commerce/src/components/LegacyPromoBanner.tsx +11 -11
- package/fixtures/rn-expo-commerce/src/screens/ProductFeedScreen.tsx +48 -48
- package/fixtures/rn-expo-commerce/src/services/api.ts +15 -15
- package/package.json +89 -77
- package/index.html +0 -21
- package/server.ts +0 -275
- package/src/App.tsx +0 -783
- package/src/components/DeepAnalysisViews.tsx +0 -526
- package/src/components/MobileAndPlatformViews.tsx +0 -625
- package/src/components/OverviewAndExplorerViews.tsx +0 -753
- package/src/components/RepairAndGateViews.tsx +0 -814
- package/src/engine/aiEngine.test.ts +0 -86
- package/src/engine/aiEngine.ts +0 -346
- package/src/engine/analyzerEngine.test.ts +0 -110
- package/src/engine/analyzerEngine.ts +0 -1579
- package/src/engine/repairEngine.ts +0 -545
- package/src/index.css +0 -44
- package/src/index.ts +0 -59
- package/src/main.tsx +0 -5
- package/src/types/devintelligence.ts +0 -310
- package/tsconfig.json +0 -28
- package/vite.config.ts +0 -22
|
@@ -1,545 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import type {
|
|
4
|
-
DiagnosticIssue,
|
|
5
|
-
ProjectIntelligenceReport,
|
|
6
|
-
QualityGateConfig,
|
|
7
|
-
RepairRecord,
|
|
8
|
-
ScanSnapshot,
|
|
9
|
-
} from '../types/devintelligence.ts';
|
|
10
|
-
import {
|
|
11
|
-
analyzeProjectDirectory,
|
|
12
|
-
diagnoseRawErrorLog,
|
|
13
|
-
inspectHostEnvironment,
|
|
14
|
-
} from './analyzerEngine.ts';
|
|
15
|
-
|
|
16
|
-
interface WorkspaceProjectMeta {
|
|
17
|
-
id: string;
|
|
18
|
-
name: string;
|
|
19
|
-
rootPath: string;
|
|
20
|
-
qualityGateConfig: QualityGateConfig;
|
|
21
|
-
repairHistory: RepairRecord[];
|
|
22
|
-
scanHistory: ScanSnapshot[];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const DEFAULT_GATE_CONFIG: QualityGateConfig = {
|
|
26
|
-
minCodeQuality: 80,
|
|
27
|
-
minDesignQuality: 80,
|
|
28
|
-
minPerformanceScore: 80,
|
|
29
|
-
maxCriticalIssues: 0,
|
|
30
|
-
maxSecurityIssues: 0,
|
|
31
|
-
requireBuildVerification: true,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const WORKSPACE_PROJECTS = new Map<string, WorkspaceProjectMeta>();
|
|
35
|
-
const CACHED_REPORTS = new Map<string, ProjectIntelligenceReport>();
|
|
36
|
-
|
|
37
|
-
export function initializeWorkspaceRegistry(baseWorkspaceDir = process.cwd()): void {
|
|
38
|
-
if (WORKSPACE_PROJECTS.size > 0) return;
|
|
39
|
-
|
|
40
|
-
const initialFixtures: { id: string; name: string; relPath: string }[] = [
|
|
41
|
-
{
|
|
42
|
-
id: 'rn-expo-commerce',
|
|
43
|
-
name: 'ExpoCommerceMobile (React Native + Expo SDK 52)',
|
|
44
|
-
relPath: 'fixtures/rn-expo-commerce',
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
id: 'rn-bare-fitness',
|
|
48
|
-
name: 'BareFitnessPro (Bare React Native 0.74 CLI)',
|
|
49
|
-
relPath: 'fixtures/rn-bare-fitness',
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
id: 'nextjs-saas-portal',
|
|
53
|
-
name: 'NextJS Billing Portal (Next.js 14 App Router)',
|
|
54
|
-
relPath: 'fixtures/nextjs-saas-portal',
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
id: 'express-api-gateway',
|
|
58
|
-
name: 'Express API Gateway (Node.js + PostgreSQL)',
|
|
59
|
-
relPath: 'fixtures/express-api-gateway',
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
id: 'django-analytics-service',
|
|
63
|
-
name: 'Django Analytics Service (Python + DRF)',
|
|
64
|
-
relPath: 'fixtures/django-analytics-service',
|
|
65
|
-
},
|
|
66
|
-
];
|
|
67
|
-
|
|
68
|
-
for (const item of initialFixtures) {
|
|
69
|
-
const absPath = path.resolve(baseWorkspaceDir, item.relPath);
|
|
70
|
-
if (fs.existsSync(absPath)) {
|
|
71
|
-
WORKSPACE_PROJECTS.set(item.id, {
|
|
72
|
-
id: item.id,
|
|
73
|
-
name: item.name,
|
|
74
|
-
rootPath: absPath,
|
|
75
|
-
qualityGateConfig: { ...DEFAULT_GATE_CONFIG },
|
|
76
|
-
repairHistory: [],
|
|
77
|
-
scanHistory: [],
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export function getAllProjectReports(baseWorkspaceDir = process.cwd()): ProjectIntelligenceReport[] {
|
|
84
|
-
initializeWorkspaceRegistry(baseWorkspaceDir);
|
|
85
|
-
const reports: ProjectIntelligenceReport[] = [];
|
|
86
|
-
for (const meta of WORKSPACE_PROJECTS.values()) {
|
|
87
|
-
let report = CACHED_REPORTS.get(meta.id);
|
|
88
|
-
if (!report) {
|
|
89
|
-
report = analyzeProjectDirectory(
|
|
90
|
-
meta.id,
|
|
91
|
-
meta.name,
|
|
92
|
-
meta.rootPath,
|
|
93
|
-
meta.qualityGateConfig,
|
|
94
|
-
meta.repairHistory,
|
|
95
|
-
meta.scanHistory
|
|
96
|
-
);
|
|
97
|
-
meta.scanHistory = report.scanHistory;
|
|
98
|
-
CACHED_REPORTS.set(meta.id, report);
|
|
99
|
-
}
|
|
100
|
-
reports.push(report);
|
|
101
|
-
}
|
|
102
|
-
return reports;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export function getProjectReportById(
|
|
106
|
-
projectId: string,
|
|
107
|
-
forceRescan = false,
|
|
108
|
-
baseWorkspaceDir = process.cwd()
|
|
109
|
-
): ProjectIntelligenceReport {
|
|
110
|
-
initializeWorkspaceRegistry(baseWorkspaceDir);
|
|
111
|
-
const meta = WORKSPACE_PROJECTS.get(projectId) || Array.from(WORKSPACE_PROJECTS.values())[0];
|
|
112
|
-
if (!meta) {
|
|
113
|
-
throw new Error(`Project "${projectId}" not found in workspace registry.`);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (forceRescan || !CACHED_REPORTS.has(meta.id)) {
|
|
117
|
-
const fresh = analyzeProjectDirectory(
|
|
118
|
-
meta.id,
|
|
119
|
-
meta.name,
|
|
120
|
-
meta.rootPath,
|
|
121
|
-
meta.qualityGateConfig,
|
|
122
|
-
meta.repairHistory,
|
|
123
|
-
meta.scanHistory
|
|
124
|
-
);
|
|
125
|
-
meta.scanHistory = fresh.scanHistory;
|
|
126
|
-
CACHED_REPORTS.set(meta.id, fresh);
|
|
127
|
-
return fresh;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return CACHED_REPORTS.get(meta.id)!;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export function registerLocalProject(params: {
|
|
134
|
-
name: string;
|
|
135
|
-
rootPath: string;
|
|
136
|
-
baseWorkspaceDir?: string;
|
|
137
|
-
}): ProjectIntelligenceReport {
|
|
138
|
-
const baseDir = params.baseWorkspaceDir || process.cwd();
|
|
139
|
-
initializeWorkspaceRegistry(baseDir);
|
|
140
|
-
|
|
141
|
-
const resolvedPath = path.isAbsolute(params.rootPath)
|
|
142
|
-
? params.rootPath
|
|
143
|
-
: path.resolve(baseDir, params.rootPath);
|
|
144
|
-
|
|
145
|
-
if (!fs.existsSync(resolvedPath) || !fs.statSync(resolvedPath).isDirectory()) {
|
|
146
|
-
throw new Error(`Directory does not exist on local filesystem: ${resolvedPath}`);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const slug = params.name
|
|
150
|
-
.toLowerCase()
|
|
151
|
-
.replace(/[^a-z0-9]+/g, '-')
|
|
152
|
-
.replace(/^-|-$/g, '') || `project-${Date.now()}`;
|
|
153
|
-
|
|
154
|
-
const meta: WorkspaceProjectMeta = {
|
|
155
|
-
id: slug,
|
|
156
|
-
name: params.name.trim(),
|
|
157
|
-
rootPath: resolvedPath,
|
|
158
|
-
qualityGateConfig: { ...DEFAULT_GATE_CONFIG },
|
|
159
|
-
repairHistory: [],
|
|
160
|
-
scanHistory: [],
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
WORKSPACE_PROJECTS.set(slug, meta);
|
|
164
|
-
return getProjectReportById(slug, true, baseDir);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export function updateProjectQualityGate(
|
|
168
|
-
projectId: string,
|
|
169
|
-
newConfig: Partial<QualityGateConfig>,
|
|
170
|
-
baseWorkspaceDir = process.cwd()
|
|
171
|
-
): ProjectIntelligenceReport {
|
|
172
|
-
initializeWorkspaceRegistry(baseWorkspaceDir);
|
|
173
|
-
const meta = WORKSPACE_PROJECTS.get(projectId);
|
|
174
|
-
if (!meta) {
|
|
175
|
-
throw new Error(`Project "${projectId}" not found.`);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
meta.qualityGateConfig = {
|
|
179
|
-
...meta.qualityGateConfig,
|
|
180
|
-
...newConfig,
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
return getProjectReportById(projectId, true, baseWorkspaceDir);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
export function applyIssueRepairOnDisk(params: {
|
|
187
|
-
projectId: string;
|
|
188
|
-
issueId: string;
|
|
189
|
-
allowReviewTier?: boolean;
|
|
190
|
-
baseWorkspaceDir?: string;
|
|
191
|
-
}): {
|
|
192
|
-
repairRecord: RepairRecord;
|
|
193
|
-
updatedReport: ProjectIntelligenceReport;
|
|
194
|
-
} {
|
|
195
|
-
const baseDir = params.baseWorkspaceDir || process.cwd();
|
|
196
|
-
const report = getProjectReportById(params.projectId, true, baseDir);
|
|
197
|
-
const meta = WORKSPACE_PROJECTS.get(report.id)!;
|
|
198
|
-
|
|
199
|
-
const issue = report.issues.find((i) => i.id === params.issueId);
|
|
200
|
-
if (!issue) {
|
|
201
|
-
throw new Error(`Issue "${params.issueId}" not found or already resolved.`);
|
|
202
|
-
}
|
|
203
|
-
if (!issue.fixAvailable) {
|
|
204
|
-
throw new Error(`Issue "${issue.title}" requires manual architectural intervention and cannot be auto-patched.`);
|
|
205
|
-
}
|
|
206
|
-
if (issue.repairTier !== 'SAFE' && !params.allowReviewTier) {
|
|
207
|
-
throw new Error(
|
|
208
|
-
`Issue "${issue.title}" has tier ${issue.repairTier}. Explicit developer approval (allowReviewTier) is required.`
|
|
209
|
-
);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
const targetFullPath = path.join(meta.rootPath, issue.filePath);
|
|
213
|
-
if (!fs.existsSync(targetFullPath)) {
|
|
214
|
-
throw new Error(`Target file not found on disk: ${targetFullPath}`);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
const originalContent = fs.readFileSync(targetFullPath, 'utf8');
|
|
218
|
-
if (!originalContent.includes(issue.beforeSnippet)) {
|
|
219
|
-
throw new Error(
|
|
220
|
-
`Target code snippet in ${issue.filePath} has diverged from scan state. Re-scan project before repairing.`
|
|
221
|
-
);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// Create real backup snapshot on disk
|
|
225
|
-
const backupDir = path.join(baseDir, '.devintelligence', 'backups', meta.id);
|
|
226
|
-
fs.mkdirSync(backupDir, { recursive: true });
|
|
227
|
-
const repairId = `repair-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`;
|
|
228
|
-
const backupPath = path.join(backupDir, `${repairId}.bak`);
|
|
229
|
-
fs.writeFileSync(backupPath, originalContent, 'utf8');
|
|
230
|
-
|
|
231
|
-
// Apply safe transformation
|
|
232
|
-
const updatedContent = originalContent.replace(issue.beforeSnippet, issue.afterSnippet);
|
|
233
|
-
fs.writeFileSync(targetFullPath, updatedContent, 'utf8');
|
|
234
|
-
|
|
235
|
-
const record: RepairRecord = {
|
|
236
|
-
id: repairId,
|
|
237
|
-
projectId: meta.id,
|
|
238
|
-
issueId: issue.id,
|
|
239
|
-
issueTitle: issue.title,
|
|
240
|
-
filePath: issue.filePath,
|
|
241
|
-
repairTier: issue.repairTier,
|
|
242
|
-
appliedAt: new Date().toISOString(),
|
|
243
|
-
backupPath,
|
|
244
|
-
rolledBack: false,
|
|
245
|
-
verifiedAfterFix: true,
|
|
246
|
-
unifiedDiff: issue.unifiedDiff,
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
meta.repairHistory = [record, ...meta.repairHistory];
|
|
250
|
-
|
|
251
|
-
// Re-scan project after repair to verify fix
|
|
252
|
-
const updatedReport = getProjectReportById(meta.id, true, baseDir);
|
|
253
|
-
const stillPresent = updatedReport.issues.some((i) => i.id === issue.id);
|
|
254
|
-
record.verifiedAfterFix = !stillPresent;
|
|
255
|
-
|
|
256
|
-
return {
|
|
257
|
-
repairRecord: record,
|
|
258
|
-
updatedReport,
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
export function applyAllSafeRepairsOnDisk(
|
|
263
|
-
projectId: string,
|
|
264
|
-
baseWorkspaceDir = process.cwd()
|
|
265
|
-
): {
|
|
266
|
-
appliedRepairs: RepairRecord[];
|
|
267
|
-
updatedReport: ProjectIntelligenceReport;
|
|
268
|
-
} {
|
|
269
|
-
let currentReport = getProjectReportById(projectId, true, baseWorkspaceDir);
|
|
270
|
-
const safeIssues = currentReport.issues.filter(
|
|
271
|
-
(i: DiagnosticIssue) => i.fixAvailable && i.repairTier === 'SAFE'
|
|
272
|
-
);
|
|
273
|
-
|
|
274
|
-
const appliedRepairs: RepairRecord[] = [];
|
|
275
|
-
for (const issue of safeIssues) {
|
|
276
|
-
try {
|
|
277
|
-
const res = applyIssueRepairOnDisk({
|
|
278
|
-
projectId,
|
|
279
|
-
issueId: issue.id,
|
|
280
|
-
allowReviewTier: false,
|
|
281
|
-
baseWorkspaceDir,
|
|
282
|
-
});
|
|
283
|
-
appliedRepairs.push(res.repairRecord);
|
|
284
|
-
currentReport = res.updatedReport;
|
|
285
|
-
} catch {
|
|
286
|
-
// continue if two patches touch overlapping lines
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
return {
|
|
291
|
-
appliedRepairs,
|
|
292
|
-
updatedReport: getProjectReportById(projectId, true, baseWorkspaceDir),
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
export function rollbackRepairOnDisk(params: {
|
|
297
|
-
projectId: string;
|
|
298
|
-
repairId: string;
|
|
299
|
-
baseWorkspaceDir?: string;
|
|
300
|
-
}): {
|
|
301
|
-
restoredRecord: RepairRecord;
|
|
302
|
-
updatedReport: ProjectIntelligenceReport;
|
|
303
|
-
} {
|
|
304
|
-
const baseDir = params.baseWorkspaceDir || process.cwd();
|
|
305
|
-
initializeWorkspaceRegistry(baseDir);
|
|
306
|
-
const meta = WORKSPACE_PROJECTS.get(params.projectId);
|
|
307
|
-
if (!meta) {
|
|
308
|
-
throw new Error(`Project "${params.projectId}" not found.`);
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
const record = meta.repairHistory.find((r) => r.id === params.repairId);
|
|
312
|
-
if (!record) {
|
|
313
|
-
throw new Error(`Repair record "${params.repairId}" not found.`);
|
|
314
|
-
}
|
|
315
|
-
if (record.rolledBack) {
|
|
316
|
-
throw new Error(`Repair "${params.repairId}" has already been rolled back.`);
|
|
317
|
-
}
|
|
318
|
-
if (!fs.existsSync(record.backupPath)) {
|
|
319
|
-
throw new Error(`Backup snapshot file missing at ${record.backupPath}`);
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
const targetFullPath = path.join(meta.rootPath, record.filePath);
|
|
323
|
-
const backupContent = fs.readFileSync(record.backupPath, 'utf8');
|
|
324
|
-
fs.writeFileSync(targetFullPath, backupContent, 'utf8');
|
|
325
|
-
record.rolledBack = true;
|
|
326
|
-
|
|
327
|
-
const updatedReport = getProjectReportById(meta.id, true, baseDir);
|
|
328
|
-
return {
|
|
329
|
-
restoredRecord: record,
|
|
330
|
-
updatedReport,
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
export interface McpToolDefinition {
|
|
335
|
-
name: string;
|
|
336
|
-
description: string;
|
|
337
|
-
parameters: string[];
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
export const MCP_TOOLS_CATALOG: McpToolDefinition[] = [
|
|
341
|
-
{
|
|
342
|
-
name: 'inspect_project',
|
|
343
|
-
description: 'Inspect complete project structure, framework, scores, and issue summary.',
|
|
344
|
-
parameters: ['projectId'],
|
|
345
|
-
},
|
|
346
|
-
{
|
|
347
|
-
name: 'diagnose_error',
|
|
348
|
-
description: 'Diagnose a raw React Native, Metro, Gradle, or CocoaPods error stack trace.',
|
|
349
|
-
parameters: ['rawLog'],
|
|
350
|
-
},
|
|
351
|
-
{
|
|
352
|
-
name: 'analyze_react_native',
|
|
353
|
-
description: 'Run dedicated React Native Doctor, Babel, Metro, and component lifecycle inspection.',
|
|
354
|
-
parameters: ['projectId'],
|
|
355
|
-
},
|
|
356
|
-
{
|
|
357
|
-
name: 'inspect_android_environment',
|
|
358
|
-
description: 'Inspect AndroidManifest.xml, build.gradle, SDK targets, permissions, and Gradle heap.',
|
|
359
|
-
parameters: ['projectId'],
|
|
360
|
-
},
|
|
361
|
-
{
|
|
362
|
-
name: 'inspect_ios_environment',
|
|
363
|
-
description: 'Inspect Podfile, Info.plist, deployment targets, and host OS build capabilities.',
|
|
364
|
-
parameters: ['projectId'],
|
|
365
|
-
},
|
|
366
|
-
{
|
|
367
|
-
name: 'analyze_component',
|
|
368
|
-
description: 'Inspect React / React Native component files for memory leaks, FlatList keys, and hooks.',
|
|
369
|
-
parameters: ['projectId'],
|
|
370
|
-
},
|
|
371
|
-
{
|
|
372
|
-
name: 'inspect_dependencies',
|
|
373
|
-
description: 'Analyze package.json / requirements.txt for version conflicts and bundle weight.',
|
|
374
|
-
parameters: ['projectId'],
|
|
375
|
-
},
|
|
376
|
-
{
|
|
377
|
-
name: 'scan_design_system',
|
|
378
|
-
description: 'Discover design tokens and detect hardcoded colors, random radii, and emoji UI icons.',
|
|
379
|
-
parameters: ['projectId'],
|
|
380
|
-
},
|
|
381
|
-
{
|
|
382
|
-
name: 'find_unused_files',
|
|
383
|
-
description: 'Locate unreferenced modules and dead exports across the repository.',
|
|
384
|
-
parameters: ['projectId'],
|
|
385
|
-
},
|
|
386
|
-
{
|
|
387
|
-
name: 'analyze_performance',
|
|
388
|
-
description: 'Measure source payload, heavy dependencies, blocking I/O, and re-render risks.',
|
|
389
|
-
parameters: ['projectId'],
|
|
390
|
-
},
|
|
391
|
-
{
|
|
392
|
-
name: 'suggest_fix',
|
|
393
|
-
description: 'Generate unified diff patch and explanation for a specific diagnostic issue.',
|
|
394
|
-
parameters: ['projectId', 'issueId'],
|
|
395
|
-
},
|
|
396
|
-
{
|
|
397
|
-
name: 'apply_safe_fix',
|
|
398
|
-
description: 'Create backup and execute an approved SAFE repair on disk, then verify.',
|
|
399
|
-
parameters: ['projectId', 'issueId'],
|
|
400
|
-
},
|
|
401
|
-
{
|
|
402
|
-
name: 'verify_repair',
|
|
403
|
-
description: 'Re-scan project and evaluate Quality Gate compliance after repair.',
|
|
404
|
-
parameters: ['projectId'],
|
|
405
|
-
},
|
|
406
|
-
];
|
|
407
|
-
|
|
408
|
-
export function executeMcpToolCall(
|
|
409
|
-
toolName: string,
|
|
410
|
-
args: { projectId?: string; issueId?: string; rawLog?: string },
|
|
411
|
-
baseWorkspaceDir = process.cwd()
|
|
412
|
-
): Record<string, unknown> {
|
|
413
|
-
const projectId = args.projectId || 'rn-expo-commerce';
|
|
414
|
-
const report = getProjectReportById(projectId, false, baseWorkspaceDir);
|
|
415
|
-
|
|
416
|
-
switch (toolName) {
|
|
417
|
-
case 'inspect_project':
|
|
418
|
-
return {
|
|
419
|
-
tool: toolName,
|
|
420
|
-
projectId: report.id,
|
|
421
|
-
name: report.name,
|
|
422
|
-
ecosystem: report.ecosystem,
|
|
423
|
-
filesCount: report.filesAnalyzed.length,
|
|
424
|
-
scores: report.scores,
|
|
425
|
-
totalIssues: report.issues.length,
|
|
426
|
-
launchCommand: report.launchDoctor.recommendedStartCommand,
|
|
427
|
-
};
|
|
428
|
-
case 'diagnose_error':
|
|
429
|
-
return {
|
|
430
|
-
tool: toolName,
|
|
431
|
-
diagnosis: diagnoseRawErrorLog(
|
|
432
|
-
args.rawLog ||
|
|
433
|
-
'Error: [Reanimated] Failed to create a worklet. plugins: [react-native-reanimated/plugin]'
|
|
434
|
-
),
|
|
435
|
-
};
|
|
436
|
-
case 'analyze_react_native':
|
|
437
|
-
return {
|
|
438
|
-
tool: toolName,
|
|
439
|
-
projectId: report.id,
|
|
440
|
-
workflow: report.launchDoctor.workflowType,
|
|
441
|
-
metroConfigured: report.launchDoctor.metroConfigured,
|
|
442
|
-
babelConfigured: report.launchDoctor.babelConfigured,
|
|
443
|
-
reactNativeScore: report.scores.reactNative,
|
|
444
|
-
issues: report.issues.filter(
|
|
445
|
-
(i) => i.domain === 'react-native' || i.domain === 'android' || i.domain === 'ios'
|
|
446
|
-
),
|
|
447
|
-
};
|
|
448
|
-
case 'inspect_android_environment':
|
|
449
|
-
return {
|
|
450
|
-
tool: toolName,
|
|
451
|
-
projectId: report.id,
|
|
452
|
-
androidSummary: report.android,
|
|
453
|
-
hostAndroidChecks: inspectHostEnvironment().filter((c) => c.category === 'android'),
|
|
454
|
-
androidIssues: report.issues.filter((i) => i.domain === 'android'),
|
|
455
|
-
};
|
|
456
|
-
case 'inspect_ios_environment':
|
|
457
|
-
return {
|
|
458
|
-
tool: toolName,
|
|
459
|
-
projectId: report.id,
|
|
460
|
-
iosSummary: report.ios,
|
|
461
|
-
hostIosChecks: inspectHostEnvironment().filter((c) => c.category === 'ios'),
|
|
462
|
-
iosIssues: report.issues.filter((i) => i.domain === 'ios'),
|
|
463
|
-
};
|
|
464
|
-
case 'analyze_component':
|
|
465
|
-
return {
|
|
466
|
-
tool: toolName,
|
|
467
|
-
projectId: report.id,
|
|
468
|
-
componentIssues: report.issues.filter(
|
|
469
|
-
(i) => i.domain === 'react-native' || i.domain === 'performance' || i.domain === 'design'
|
|
470
|
-
),
|
|
471
|
-
};
|
|
472
|
-
case 'inspect_dependencies':
|
|
473
|
-
return {
|
|
474
|
-
tool: toolName,
|
|
475
|
-
projectId: report.id,
|
|
476
|
-
dependencies: report.dependencies,
|
|
477
|
-
};
|
|
478
|
-
case 'scan_design_system':
|
|
479
|
-
return {
|
|
480
|
-
tool: toolName,
|
|
481
|
-
projectId: report.id,
|
|
482
|
-
designSystem: report.designSystem,
|
|
483
|
-
designIssues: report.issues.filter((i) => i.domain === 'design'),
|
|
484
|
-
};
|
|
485
|
-
case 'find_unused_files':
|
|
486
|
-
return {
|
|
487
|
-
tool: toolName,
|
|
488
|
-
projectId: report.id,
|
|
489
|
-
unusedFiles: report.issues.filter((i) => i.ruleId === 'DEAD_CODE_UNUSED_MODULE'),
|
|
490
|
-
};
|
|
491
|
-
case 'analyze_performance':
|
|
492
|
-
return {
|
|
493
|
-
tool: toolName,
|
|
494
|
-
projectId: report.id,
|
|
495
|
-
performance: report.performance,
|
|
496
|
-
};
|
|
497
|
-
case 'suggest_fix': {
|
|
498
|
-
const targetIssue =
|
|
499
|
-
report.issues.find((i) => i.id === args.issueId) ||
|
|
500
|
-
report.issues.find((i) => i.fixAvailable) ||
|
|
501
|
-
report.issues[0];
|
|
502
|
-
return {
|
|
503
|
-
tool: toolName,
|
|
504
|
-
projectId: report.id,
|
|
505
|
-
issue: targetIssue || null,
|
|
506
|
-
};
|
|
507
|
-
}
|
|
508
|
-
case 'apply_safe_fix': {
|
|
509
|
-
const targetIssue =
|
|
510
|
-
report.issues.find((i) => i.id === args.issueId && i.fixAvailable && i.repairTier === 'SAFE') ||
|
|
511
|
-
report.issues.find((i) => i.fixAvailable && i.repairTier === 'SAFE');
|
|
512
|
-
if (!targetIssue) {
|
|
513
|
-
return {
|
|
514
|
-
tool: toolName,
|
|
515
|
-
status: 'no_safe_fix_pending',
|
|
516
|
-
message: 'All SAFE issues in this project have already been repaired.',
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
const res = applyIssueRepairOnDisk({
|
|
520
|
-
projectId: report.id,
|
|
521
|
-
issueId: targetIssue.id,
|
|
522
|
-
baseWorkspaceDir,
|
|
523
|
-
});
|
|
524
|
-
return {
|
|
525
|
-
tool: toolName,
|
|
526
|
-
status: 'repaired_and_verified',
|
|
527
|
-
repairRecord: res.repairRecord,
|
|
528
|
-
remainingIssues: res.updatedReport.issues.length,
|
|
529
|
-
};
|
|
530
|
-
}
|
|
531
|
-
case 'verify_repair': {
|
|
532
|
-
const fresh = getProjectReportById(report.id, true, baseWorkspaceDir);
|
|
533
|
-
return {
|
|
534
|
-
tool: toolName,
|
|
535
|
-
projectId: fresh.id,
|
|
536
|
-
qualityGatePassed: fresh.qualityGateEvaluation.passed,
|
|
537
|
-
exitCode: fresh.qualityGateEvaluation.exitCode,
|
|
538
|
-
remainingIssuesCount: fresh.issues.length,
|
|
539
|
-
scores: fresh.scores,
|
|
540
|
-
};
|
|
541
|
-
}
|
|
542
|
-
default:
|
|
543
|
-
throw new Error(`Unknown MCP tool: ${toolName}`);
|
|
544
|
-
}
|
|
545
|
-
}
|
package/src/index.css
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
@import "tailwindcss";
|
|
2
|
-
@custom-variant dark (&:where(.dark, .dark *));
|
|
3
|
-
|
|
4
|
-
@layer base {
|
|
5
|
-
:root {
|
|
6
|
-
--font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
|
|
7
|
-
--font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
body {
|
|
11
|
-
font-family: var(--font-sans);
|
|
12
|
-
background-color: #0B1120;
|
|
13
|
-
color: #F8FAFC;
|
|
14
|
-
overflow-x: hidden;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
code, pre, .font-mono {
|
|
18
|
-
font-family: var(--font-mono);
|
|
19
|
-
font-variant-numeric: tabular-nums;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.tabular-nums {
|
|
24
|
-
font-variant-numeric: tabular-nums;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/* Custom subtle scrollbars for enterprise dark theme */
|
|
28
|
-
::-webkit-scrollbar {
|
|
29
|
-
width: 6px;
|
|
30
|
-
height: 6px;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
::-webkit-scrollbar-track {
|
|
34
|
-
background: #0B1120;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
::-webkit-scrollbar-thumb {
|
|
38
|
-
background: #1E293B;
|
|
39
|
-
border-radius: 3px;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
::-webkit-scrollbar-thumb:hover {
|
|
43
|
-
background: #334155;
|
|
44
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DEVINTELLIGENCE — Personal Software Engineering Intelligence System
|
|
3
|
-
* Tagline: Understand. Diagnose. Repair. Optimize.
|
|
4
|
-
*
|
|
5
|
-
* Universal programmatic library entrypoint for Node.js & TypeScript projects.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// Host Environment & Tooling Doctor
|
|
9
|
-
export {
|
|
10
|
-
inspectHostEnvironment,
|
|
11
|
-
detectProjectEcosystem,
|
|
12
|
-
diagnoseRawErrorLog,
|
|
13
|
-
analyzeProjectDirectory,
|
|
14
|
-
PRESET_ERROR_LOGS,
|
|
15
|
-
} from './engine/analyzerEngine.ts';
|
|
16
|
-
|
|
17
|
-
// Automated Safe Repair, Project History & MCP Engine
|
|
18
|
-
export {
|
|
19
|
-
getAllProjectReports,
|
|
20
|
-
getProjectReportById,
|
|
21
|
-
registerLocalProject,
|
|
22
|
-
applyIssueRepairOnDisk,
|
|
23
|
-
applyAllSafeRepairsOnDisk,
|
|
24
|
-
rollbackRepairOnDisk,
|
|
25
|
-
updateProjectQualityGate,
|
|
26
|
-
MCP_TOOLS_CATALOG,
|
|
27
|
-
executeMcpToolCall,
|
|
28
|
-
} from './engine/repairEngine.ts';
|
|
29
|
-
|
|
30
|
-
// Resilient AI Engine (Groq Qwen/Llama 3 with Zero-Downtime Rule Fallback Shield)
|
|
31
|
-
export {
|
|
32
|
-
diagnoseRawErrorLogWithAi,
|
|
33
|
-
generateProjectAiAdvice,
|
|
34
|
-
askDevIntelligenceAi,
|
|
35
|
-
getGroqApiKey,
|
|
36
|
-
isAiRateLimited,
|
|
37
|
-
resetAiRateLimit,
|
|
38
|
-
} from './engine/aiEngine.ts';
|
|
39
|
-
|
|
40
|
-
// Core Type Definitions for all 18 Intelligence Modules
|
|
41
|
-
export type {
|
|
42
|
-
ProjectIntelligenceReport,
|
|
43
|
-
DiagnosticIssue,
|
|
44
|
-
IssueSeverity,
|
|
45
|
-
RepairTier,
|
|
46
|
-
RepairRecord,
|
|
47
|
-
ScanSnapshot,
|
|
48
|
-
QualityGateConfig,
|
|
49
|
-
QualityGateEvaluation,
|
|
50
|
-
EnvironmentCheckItem,
|
|
51
|
-
ErrorDiagnosisResult,
|
|
52
|
-
LaunchDoctorReport,
|
|
53
|
-
PerformanceReport,
|
|
54
|
-
DesignSystemReport,
|
|
55
|
-
VisualTestingReport,
|
|
56
|
-
ProjectEcosystem,
|
|
57
|
-
DashboardModuleId,
|
|
58
|
-
} from './types/devintelligence.ts';
|
|
59
|
-
|