driftdetect-mcp 0.8.1 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/enterprise-server.d.ts.map +1 -1
- package/dist/enterprise-server.js +12 -0
- package/dist/enterprise-server.js.map +1 -1
- package/dist/tools/analysis/index.d.ts +4 -0
- package/dist/tools/analysis/index.d.ts.map +1 -1
- package/dist/tools/analysis/index.js +116 -0
- package/dist/tools/analysis/index.js.map +1 -1
- package/dist/tools/analysis/java.d.ts +22 -0
- package/dist/tools/analysis/java.d.ts.map +1 -0
- package/dist/tools/analysis/java.js +163 -0
- package/dist/tools/analysis/java.js.map +1 -0
- package/dist/tools/analysis/php.d.ts +22 -0
- package/dist/tools/analysis/php.d.ts.map +1 -0
- package/dist/tools/analysis/php.js +164 -0
- package/dist/tools/analysis/php.js.map +1 -0
- package/dist/tools/analysis/python.d.ts +22 -0
- package/dist/tools/analysis/python.d.ts.map +1 -0
- package/dist/tools/analysis/python.js +176 -0
- package/dist/tools/analysis/python.js.map +1 -0
- package/dist/tools/analysis/typescript.d.ts +22 -0
- package/dist/tools/analysis/typescript.d.ts.map +1 -0
- package/dist/tools/analysis/typescript.js +222 -0
- package/dist/tools/analysis/typescript.js.map +1 -0
- package/dist/tools/discovery/capabilities.d.ts +41 -9
- package/dist/tools/discovery/capabilities.d.ts.map +1 -1
- package/dist/tools/discovery/capabilities.js +355 -82
- package/dist/tools/discovery/capabilities.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PHP Analysis MCP Tool
|
|
3
|
+
*
|
|
4
|
+
* Analyze PHP projects: routes, error handling, data access, traits.
|
|
5
|
+
*/
|
|
6
|
+
import { createPhpAnalyzer, } from 'driftdetect-core';
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// Tool Implementation
|
|
9
|
+
// ============================================================================
|
|
10
|
+
export async function executePhpTool(args, context) {
|
|
11
|
+
const projectPath = args.path ?? context.projectRoot;
|
|
12
|
+
const limit = args.limit ?? 50;
|
|
13
|
+
const analyzer = createPhpAnalyzer({
|
|
14
|
+
rootDir: projectPath,
|
|
15
|
+
verbose: false,
|
|
16
|
+
});
|
|
17
|
+
let result;
|
|
18
|
+
switch (args.action) {
|
|
19
|
+
case 'status': {
|
|
20
|
+
const analysisResult = await analyzer.analyze();
|
|
21
|
+
result = formatStatusResult(analysisResult, limit);
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
case 'routes': {
|
|
25
|
+
const routesResult = await analyzer.analyzeRoutes();
|
|
26
|
+
result = formatRoutesResult(routesResult, args.framework, limit);
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
case 'errors': {
|
|
30
|
+
const errorsResult = await analyzer.analyzeErrorHandling();
|
|
31
|
+
result = formatErrorsResult(errorsResult, limit);
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
case 'data-access': {
|
|
35
|
+
const dataAccessResult = await analyzer.analyzeDataAccess();
|
|
36
|
+
result = formatDataAccessResult(dataAccessResult, limit);
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
case 'traits': {
|
|
40
|
+
const traitsResult = await analyzer.analyzeTraits();
|
|
41
|
+
result = formatTraitsResult(traitsResult, limit);
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
default:
|
|
45
|
+
throw new Error(`Unknown action: ${args.action}`);
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
content: [{
|
|
49
|
+
type: 'text',
|
|
50
|
+
text: JSON.stringify(result, null, 2),
|
|
51
|
+
}],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
// ============================================================================
|
|
55
|
+
// Result Formatters
|
|
56
|
+
// ============================================================================
|
|
57
|
+
function formatStatusResult(result, _limit) {
|
|
58
|
+
return {
|
|
59
|
+
project: {
|
|
60
|
+
name: result.projectInfo.name,
|
|
61
|
+
version: result.projectInfo.version,
|
|
62
|
+
files: result.projectInfo.files,
|
|
63
|
+
framework: result.projectInfo.framework,
|
|
64
|
+
},
|
|
65
|
+
frameworks: result.detectedFrameworks,
|
|
66
|
+
stats: {
|
|
67
|
+
classes: result.stats.classCount,
|
|
68
|
+
traits: result.stats.traitCount,
|
|
69
|
+
interfaces: result.stats.interfaceCount,
|
|
70
|
+
functions: result.stats.functionCount,
|
|
71
|
+
methods: result.stats.methodCount,
|
|
72
|
+
linesOfCode: result.stats.linesOfCode,
|
|
73
|
+
testFiles: result.stats.testFileCount,
|
|
74
|
+
analysisTimeMs: Math.round(result.stats.analysisTimeMs),
|
|
75
|
+
},
|
|
76
|
+
summary: `PHP project with ${result.stats.fileCount} files, ${result.stats.classCount} classes, ${result.stats.methodCount} methods`,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function formatRoutesResult(result, framework, limit) {
|
|
80
|
+
let routes = result.routes;
|
|
81
|
+
if (framework) {
|
|
82
|
+
routes = routes.filter((r) => r.framework === framework);
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
total: routes.length,
|
|
86
|
+
byFramework: result.byFramework,
|
|
87
|
+
routes: routes.slice(0, limit).map((r) => ({
|
|
88
|
+
method: r.method,
|
|
89
|
+
path: r.path,
|
|
90
|
+
handler: r.handler,
|
|
91
|
+
framework: r.framework,
|
|
92
|
+
file: r.file,
|
|
93
|
+
line: r.line,
|
|
94
|
+
middleware: r.middleware,
|
|
95
|
+
})),
|
|
96
|
+
truncated: routes.length > limit,
|
|
97
|
+
summary: `${routes.length} HTTP routes across ${Object.keys(result.byFramework).length} framework(s)`,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function formatErrorsResult(result, limit) {
|
|
101
|
+
return {
|
|
102
|
+
stats: {
|
|
103
|
+
tryCatchBlocks: result.stats.tryCatchBlocks,
|
|
104
|
+
throwStatements: result.stats.throwStatements,
|
|
105
|
+
customExceptions: result.stats.customExceptions,
|
|
106
|
+
errorHandlers: result.stats.errorHandlers,
|
|
107
|
+
},
|
|
108
|
+
patterns: {
|
|
109
|
+
'try-catch': result.patterns.filter((p) => p.type === 'try-catch').length,
|
|
110
|
+
'throw': result.patterns.filter((p) => p.type === 'throw').length,
|
|
111
|
+
'custom-exception': result.patterns.filter((p) => p.type === 'custom-exception').length,
|
|
112
|
+
'error-handler': result.patterns.filter((p) => p.type === 'error-handler').length,
|
|
113
|
+
},
|
|
114
|
+
issues: result.issues.slice(0, limit).map((i) => ({
|
|
115
|
+
type: i.type,
|
|
116
|
+
file: i.file,
|
|
117
|
+
line: i.line,
|
|
118
|
+
message: i.message,
|
|
119
|
+
suggestion: i.suggestion,
|
|
120
|
+
})),
|
|
121
|
+
summary: `${result.stats.tryCatchBlocks} try-catch blocks, ${result.issues.length} potential issues`,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function formatDataAccessResult(result, limit) {
|
|
125
|
+
return {
|
|
126
|
+
total: result.accessPoints.length,
|
|
127
|
+
byFramework: result.byFramework,
|
|
128
|
+
byOperation: result.byOperation,
|
|
129
|
+
models: result.models,
|
|
130
|
+
accessPoints: result.accessPoints.slice(0, limit).map((a) => ({
|
|
131
|
+
model: a.model,
|
|
132
|
+
operation: a.operation,
|
|
133
|
+
framework: a.framework,
|
|
134
|
+
file: a.file,
|
|
135
|
+
line: a.line,
|
|
136
|
+
isRawSql: a.isRawSql,
|
|
137
|
+
})),
|
|
138
|
+
truncated: result.accessPoints.length > limit,
|
|
139
|
+
summary: `${result.accessPoints.length} data access points across ${result.models.length} models`,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function formatTraitsResult(result, limit) {
|
|
143
|
+
return {
|
|
144
|
+
traits: result.traits.slice(0, limit).map((t) => ({
|
|
145
|
+
name: t.name,
|
|
146
|
+
file: t.file,
|
|
147
|
+
line: t.line,
|
|
148
|
+
methods: t.methods,
|
|
149
|
+
})),
|
|
150
|
+
usages: result.usages.slice(0, limit).map((u) => ({
|
|
151
|
+
trait: u.trait,
|
|
152
|
+
usedIn: u.usedIn,
|
|
153
|
+
file: u.file,
|
|
154
|
+
line: u.line,
|
|
155
|
+
})),
|
|
156
|
+
stats: {
|
|
157
|
+
traitsDefined: result.traits.length,
|
|
158
|
+
traitUsages: result.usages.length,
|
|
159
|
+
},
|
|
160
|
+
truncated: result.traits.length > limit || result.usages.length > limit,
|
|
161
|
+
summary: `${result.traits.length} traits defined, ${result.usages.length} trait usages`,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=php.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"php.js","sourceRoot":"","sources":["../../../src/tools/analysis/php.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,iBAAiB,GAMlB,MAAM,kBAAkB,CAAC;AAwB1B,+EAA+E;AAC/E,sBAAsB;AACtB,+EAA+E;AAE/E,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,IAAa,EACb,OAAoB;IAEpB,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,WAAW,CAAC;IACrD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;IAE/B,MAAM,QAAQ,GAAG,iBAAiB,CAAC;QACjC,OAAO,EAAE,WAAW;QACpB,OAAO,EAAE,KAAK;KACf,CAAC,CAAC;IAEH,IAAI,MAAe,CAAC;IAEpB,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,MAAM,cAAc,GAAG,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;YAChD,MAAM,GAAG,kBAAkB,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;YACnD,MAAM;QACR,CAAC;QAED,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,aAAa,EAAE,CAAC;YACpD,MAAM,GAAG,kBAAkB,CAAC,YAA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AC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAChD,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,OAAO,EAAE,CAAC,CAAC,OAAO;SACnB,CAAC,CAAC;QACH,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAChD,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,MAAM,EAAE,CAAC,CAAC,MAAM;YAChB,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,IAAI,EAAE,CAAC,CAAC,IAAI;SACb,CAAC,CAAC;QACH,KAAK,EAAE;YACL,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM;YACnC,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM;SAClC;QACD,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,KAAK;QACvE,OAAO,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,oBAAoB,MAAM,CAAC,MAAM,CAAC,MAAM,eAAe;KACxF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Python Analysis MCP Tool
|
|
3
|
+
*
|
|
4
|
+
* Analyze Python projects: routes, error handling, data access, async patterns.
|
|
5
|
+
*/
|
|
6
|
+
export type PythonAction = 'status' | 'routes' | 'errors' | 'data-access' | 'decorators' | 'async';
|
|
7
|
+
export interface PythonArgs {
|
|
8
|
+
action: PythonAction;
|
|
9
|
+
path?: string;
|
|
10
|
+
framework?: string;
|
|
11
|
+
limit?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface ToolContext {
|
|
14
|
+
projectRoot: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function executePythonTool(args: PythonArgs, context: ToolContext): Promise<{
|
|
17
|
+
content: Array<{
|
|
18
|
+
type: string;
|
|
19
|
+
text: string;
|
|
20
|
+
}>;
|
|
21
|
+
}>;
|
|
22
|
+
//# sourceMappingURL=python.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python.d.ts","sourceRoot":"","sources":["../../../src/tools/analysis/python.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAgBH,MAAM,MAAM,YAAY,GACpB,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,aAAa,GACb,YAAY,GACZ,OAAO,CAAC;AAEZ,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;CACrB;AAMD,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CA0D7D"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Python Analysis MCP Tool
|
|
3
|
+
*
|
|
4
|
+
* Analyze Python projects: routes, error handling, data access, async patterns.
|
|
5
|
+
*/
|
|
6
|
+
import { createPythonAnalyzer, } from 'driftdetect-core';
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// Tool Implementation
|
|
9
|
+
// ============================================================================
|
|
10
|
+
export async function executePythonTool(args, context) {
|
|
11
|
+
const projectPath = args.path ?? context.projectRoot;
|
|
12
|
+
const limit = args.limit ?? 50;
|
|
13
|
+
const analyzer = createPythonAnalyzer({
|
|
14
|
+
rootDir: projectPath,
|
|
15
|
+
verbose: false,
|
|
16
|
+
});
|
|
17
|
+
let result;
|
|
18
|
+
switch (args.action) {
|
|
19
|
+
case 'status': {
|
|
20
|
+
const analysisResult = await analyzer.analyze();
|
|
21
|
+
result = formatStatusResult(analysisResult, limit);
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
case 'routes': {
|
|
25
|
+
const routesResult = await analyzer.analyzeRoutes();
|
|
26
|
+
result = formatRoutesResult(routesResult, args.framework, limit);
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
case 'errors': {
|
|
30
|
+
const errorsResult = await analyzer.analyzeErrorHandling();
|
|
31
|
+
result = formatErrorsResult(errorsResult, limit);
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
case 'data-access': {
|
|
35
|
+
const dataAccessResult = await analyzer.analyzeDataAccess();
|
|
36
|
+
result = formatDataAccessResult(dataAccessResult, limit);
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
case 'decorators': {
|
|
40
|
+
const decoratorsResult = await analyzer.analyzeDecorators();
|
|
41
|
+
result = formatDecoratorsResult(decoratorsResult, limit);
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
case 'async': {
|
|
45
|
+
const asyncResult = await analyzer.analyzeAsync();
|
|
46
|
+
result = formatAsyncResult(asyncResult, limit);
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
default:
|
|
50
|
+
throw new Error(`Unknown action: ${args.action}`);
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
content: [{
|
|
54
|
+
type: 'text',
|
|
55
|
+
text: JSON.stringify(result, null, 2),
|
|
56
|
+
}],
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
// ============================================================================
|
|
60
|
+
// Result Formatters
|
|
61
|
+
// ============================================================================
|
|
62
|
+
function formatStatusResult(result, _limit) {
|
|
63
|
+
return {
|
|
64
|
+
project: {
|
|
65
|
+
name: result.projectInfo.name,
|
|
66
|
+
version: result.projectInfo.version,
|
|
67
|
+
files: result.projectInfo.files,
|
|
68
|
+
},
|
|
69
|
+
frameworks: result.detectedFrameworks,
|
|
70
|
+
stats: {
|
|
71
|
+
functions: result.stats.functionCount,
|
|
72
|
+
classes: result.stats.classCount,
|
|
73
|
+
asyncFunctions: result.stats.asyncFunctionCount,
|
|
74
|
+
decorators: result.stats.decoratorCount,
|
|
75
|
+
linesOfCode: result.stats.linesOfCode,
|
|
76
|
+
testFiles: result.stats.testFileCount,
|
|
77
|
+
analysisTimeMs: Math.round(result.stats.analysisTimeMs),
|
|
78
|
+
},
|
|
79
|
+
summary: `Python project with ${result.stats.fileCount} files, ${result.stats.functionCount} functions, ${result.stats.classCount} classes`,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function formatRoutesResult(result, framework, limit) {
|
|
83
|
+
let routes = result.routes;
|
|
84
|
+
if (framework) {
|
|
85
|
+
routes = routes.filter((r) => r.framework === framework);
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
total: routes.length,
|
|
89
|
+
byFramework: result.byFramework,
|
|
90
|
+
routes: routes.slice(0, limit).map((r) => ({
|
|
91
|
+
method: r.method,
|
|
92
|
+
path: r.path,
|
|
93
|
+
handler: r.handler,
|
|
94
|
+
framework: r.framework,
|
|
95
|
+
file: r.file,
|
|
96
|
+
line: r.line,
|
|
97
|
+
decorators: r.decorators,
|
|
98
|
+
})),
|
|
99
|
+
truncated: routes.length > limit,
|
|
100
|
+
summary: `${routes.length} HTTP routes across ${Object.keys(result.byFramework).length} framework(s)`,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function formatErrorsResult(result, limit) {
|
|
104
|
+
return {
|
|
105
|
+
stats: {
|
|
106
|
+
tryExceptBlocks: result.stats.tryExceptBlocks,
|
|
107
|
+
raiseStatements: result.stats.raiseStatements,
|
|
108
|
+
customExceptions: result.stats.customExceptions,
|
|
109
|
+
contextManagers: result.stats.contextManagers,
|
|
110
|
+
},
|
|
111
|
+
patterns: {
|
|
112
|
+
'try-except': result.patterns.filter((p) => p.type === 'try-except').length,
|
|
113
|
+
'raise': result.patterns.filter((p) => p.type === 'raise').length,
|
|
114
|
+
'custom-exception': result.patterns.filter((p) => p.type === 'custom-exception').length,
|
|
115
|
+
'context-manager': result.patterns.filter((p) => p.type === 'context-manager').length,
|
|
116
|
+
},
|
|
117
|
+
issues: result.issues.slice(0, limit).map((i) => ({
|
|
118
|
+
type: i.type,
|
|
119
|
+
file: i.file,
|
|
120
|
+
line: i.line,
|
|
121
|
+
message: i.message,
|
|
122
|
+
suggestion: i.suggestion,
|
|
123
|
+
})),
|
|
124
|
+
summary: `${result.stats.tryExceptBlocks} try-except blocks, ${result.issues.length} potential issues`,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function formatDataAccessResult(result, limit) {
|
|
128
|
+
return {
|
|
129
|
+
total: result.accessPoints.length,
|
|
130
|
+
byFramework: result.byFramework,
|
|
131
|
+
byOperation: result.byOperation,
|
|
132
|
+
models: result.models,
|
|
133
|
+
accessPoints: result.accessPoints.slice(0, limit).map((a) => ({
|
|
134
|
+
model: a.model,
|
|
135
|
+
operation: a.operation,
|
|
136
|
+
framework: a.framework,
|
|
137
|
+
file: a.file,
|
|
138
|
+
line: a.line,
|
|
139
|
+
isRawSql: a.isRawSql,
|
|
140
|
+
})),
|
|
141
|
+
truncated: result.accessPoints.length > limit,
|
|
142
|
+
summary: `${result.accessPoints.length} data access points across ${result.models.length} models`,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function formatDecoratorsResult(result, limit) {
|
|
146
|
+
return {
|
|
147
|
+
total: result.decorators.length,
|
|
148
|
+
byName: result.byName,
|
|
149
|
+
decorators: result.decorators.slice(0, limit).map((d) => ({
|
|
150
|
+
name: d.name,
|
|
151
|
+
file: d.file,
|
|
152
|
+
line: d.line,
|
|
153
|
+
arguments: d.arguments,
|
|
154
|
+
})),
|
|
155
|
+
truncated: result.decorators.length > limit,
|
|
156
|
+
summary: `${result.decorators.length} decorators across ${Object.keys(result.byName).length} unique names`,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
function formatAsyncResult(result, limit) {
|
|
160
|
+
return {
|
|
161
|
+
asyncFunctions: result.asyncFunctions.slice(0, limit).map((f) => ({
|
|
162
|
+
name: f.name,
|
|
163
|
+
file: f.file,
|
|
164
|
+
line: f.line,
|
|
165
|
+
awaitCount: f.awaitCount,
|
|
166
|
+
})),
|
|
167
|
+
stats: {
|
|
168
|
+
asyncFunctions: result.asyncFunctions.length,
|
|
169
|
+
awaitCalls: result.awaitCalls,
|
|
170
|
+
asyncContextManagers: result.asyncContextManagers,
|
|
171
|
+
},
|
|
172
|
+
truncated: result.asyncFunctions.length > limit,
|
|
173
|
+
summary: `${result.asyncFunctions.length} async functions with ${result.awaitCalls} await calls`,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=python.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python.js","sourceRoot":"","sources":["../../../src/tools/analysis/python.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,oBAAoB,GAOrB,MAAM,kBAAkB,CAAC;AAyB1B,+EAA+E;AAC/E,sBAAsB;AACtB,+EAA+E;AAE/E,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,IAAgB,EAChB,OAAoB;IAEpB,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,WAAW,CAAC;IACrD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;IAE/B,MAAM,QAAQ,GAAG,oBAAoB,CAAC;QACpC,OAAO,EAAE,WAAW;QACpB,OAAO,EAAE,KAAK;KACf,CAAC,CAAC;IAEH,IAAI,MAAe,CAAC;IAEpB,QAAQ,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,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,UAAU,EAAE,CAAC,CAAC,UAAU;SACzB,CAAC,CAAC;QACH,KAAK,EAAE;YACL,cAAc,EAAE,MAAM,CAAC,cAAc,CAAC,MAAM;YAC5C,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,oBAAoB,EAAE,MAAM,CAAC,oBAAoB;SAClD;QACD,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,MAAM,GAAG,KAAK;QAC/C,OAAO,EAAE,GAAG,MAAM,CAAC,cAAc,CAAC,MAAM,yBAAyB,MAAM,CAAC,UAAU,cAAc;KACjG,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript Analysis MCP Tool
|
|
3
|
+
*
|
|
4
|
+
* Analyze TypeScript/JavaScript projects: routes, components, hooks, error handling, data access.
|
|
5
|
+
*/
|
|
6
|
+
export type TypeScriptAction = 'status' | 'routes' | 'components' | 'hooks' | 'errors' | 'data-access' | 'decorators';
|
|
7
|
+
export interface TypeScriptArgs {
|
|
8
|
+
action: TypeScriptAction;
|
|
9
|
+
path?: string;
|
|
10
|
+
framework?: string;
|
|
11
|
+
limit?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface ToolContext {
|
|
14
|
+
projectRoot: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function executeTypeScriptTool(args: TypeScriptArgs, context: ToolContext): Promise<{
|
|
17
|
+
content: Array<{
|
|
18
|
+
type: string;
|
|
19
|
+
text: string;
|
|
20
|
+
}>;
|
|
21
|
+
}>;
|
|
22
|
+
//# sourceMappingURL=typescript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../src/tools/analysis/typescript.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiBH,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,QAAQ,GACR,YAAY,GACZ,OAAO,GACP,QAAQ,GACR,aAAa,GACb,YAAY,CAAC;AAEjB,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,gBAAgB,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;CACrB;AAMD,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAgE7D"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript Analysis MCP Tool
|
|
3
|
+
*
|
|
4
|
+
* Analyze TypeScript/JavaScript projects: routes, components, hooks, error handling, data access.
|
|
5
|
+
*/
|
|
6
|
+
import { createTypeScriptAnalyzer, } from 'driftdetect-core';
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// Tool Implementation
|
|
9
|
+
// ============================================================================
|
|
10
|
+
export async function executeTypeScriptTool(args, context) {
|
|
11
|
+
const projectPath = args.path ?? context.projectRoot;
|
|
12
|
+
const limit = args.limit ?? 50;
|
|
13
|
+
const analyzer = createTypeScriptAnalyzer({
|
|
14
|
+
rootDir: projectPath,
|
|
15
|
+
verbose: false,
|
|
16
|
+
});
|
|
17
|
+
let result;
|
|
18
|
+
switch (args.action) {
|
|
19
|
+
case 'status': {
|
|
20
|
+
const analysisResult = await analyzer.analyze();
|
|
21
|
+
result = formatStatusResult(analysisResult, limit);
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
case 'routes': {
|
|
25
|
+
const routesResult = await analyzer.analyzeRoutes();
|
|
26
|
+
result = formatRoutesResult(routesResult, args.framework, limit);
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
case 'components': {
|
|
30
|
+
const componentsResult = await analyzer.analyzeComponents();
|
|
31
|
+
result = formatComponentsResult(componentsResult, limit);
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
case 'hooks': {
|
|
35
|
+
const hooksResult = await analyzer.analyzeHooks();
|
|
36
|
+
result = formatHooksResult(hooksResult, limit);
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
case 'errors': {
|
|
40
|
+
const errorsResult = await analyzer.analyzeErrorHandling();
|
|
41
|
+
result = formatErrorsResult(errorsResult, limit);
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
case 'data-access': {
|
|
45
|
+
const dataAccessResult = await analyzer.analyzeDataAccess();
|
|
46
|
+
result = formatDataAccessResult(dataAccessResult, limit);
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
case 'decorators': {
|
|
50
|
+
const decoratorsResult = await analyzer.analyzeDecorators();
|
|
51
|
+
result = formatDecoratorsResult(decoratorsResult, limit);
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
default:
|
|
55
|
+
throw new Error(`Unknown action: ${args.action}`);
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
content: [{
|
|
59
|
+
type: 'text',
|
|
60
|
+
text: JSON.stringify(result, null, 2),
|
|
61
|
+
}],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
// ============================================================================
|
|
65
|
+
// Result Formatters
|
|
66
|
+
// ============================================================================
|
|
67
|
+
function formatStatusResult(result, _limit) {
|
|
68
|
+
return {
|
|
69
|
+
project: {
|
|
70
|
+
name: result.projectInfo.name,
|
|
71
|
+
version: result.projectInfo.version,
|
|
72
|
+
files: result.projectInfo.files,
|
|
73
|
+
tsFiles: result.projectInfo.tsFiles,
|
|
74
|
+
jsFiles: result.projectInfo.jsFiles,
|
|
75
|
+
hasTypeScript: result.projectInfo.hasTypeScript,
|
|
76
|
+
hasJavaScript: result.projectInfo.hasJavaScript,
|
|
77
|
+
},
|
|
78
|
+
frameworks: result.detectedFrameworks,
|
|
79
|
+
stats: {
|
|
80
|
+
functions: result.stats.functionCount,
|
|
81
|
+
classes: result.stats.classCount,
|
|
82
|
+
components: result.stats.componentCount,
|
|
83
|
+
hooks: result.stats.hookCount,
|
|
84
|
+
asyncFunctions: result.stats.asyncFunctionCount,
|
|
85
|
+
decorators: result.stats.decoratorCount,
|
|
86
|
+
linesOfCode: result.stats.linesOfCode,
|
|
87
|
+
testFiles: result.stats.testFileCount,
|
|
88
|
+
analysisTimeMs: Math.round(result.stats.analysisTimeMs),
|
|
89
|
+
},
|
|
90
|
+
summary: `TypeScript/JS project with ${result.stats.fileCount} files, ${result.stats.functionCount} functions, ${result.stats.componentCount} components`,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function formatRoutesResult(result, framework, limit) {
|
|
94
|
+
let routes = result.routes;
|
|
95
|
+
if (framework) {
|
|
96
|
+
routes = routes.filter((r) => r.framework === framework);
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
total: routes.length,
|
|
100
|
+
byFramework: result.byFramework,
|
|
101
|
+
routes: routes.slice(0, limit).map((r) => ({
|
|
102
|
+
method: r.method,
|
|
103
|
+
path: r.path,
|
|
104
|
+
handler: r.handler,
|
|
105
|
+
framework: r.framework,
|
|
106
|
+
file: r.file,
|
|
107
|
+
line: r.line,
|
|
108
|
+
middleware: r.middleware,
|
|
109
|
+
decorators: r.decorators,
|
|
110
|
+
})),
|
|
111
|
+
truncated: routes.length > limit,
|
|
112
|
+
summary: `${routes.length} HTTP routes across ${Object.keys(result.byFramework).length} framework(s)`,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function formatComponentsResult(result, limit) {
|
|
116
|
+
return {
|
|
117
|
+
total: result.components.length,
|
|
118
|
+
byType: result.byType,
|
|
119
|
+
components: result.components.slice(0, limit).map((c) => ({
|
|
120
|
+
name: c.name,
|
|
121
|
+
type: c.type,
|
|
122
|
+
file: c.file,
|
|
123
|
+
line: c.line,
|
|
124
|
+
props: c.props,
|
|
125
|
+
hooks: c.hooks,
|
|
126
|
+
isExported: c.isExported,
|
|
127
|
+
})),
|
|
128
|
+
truncated: result.components.length > limit,
|
|
129
|
+
summary: `${result.components.length} React components (${result.byType['functional']} functional, ${result.byType['class']} class)`,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function formatHooksResult(result, limit) {
|
|
133
|
+
// Count hook usage
|
|
134
|
+
const hookCounts = {};
|
|
135
|
+
for (const hook of result.hooks) {
|
|
136
|
+
hookCounts[hook.name] = (hookCounts[hook.name] ?? 0) + 1;
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
total: result.hooks.length,
|
|
140
|
+
byType: result.byType,
|
|
141
|
+
customHooks: result.customHooks,
|
|
142
|
+
hookUsage: Object.entries(hookCounts)
|
|
143
|
+
.sort((a, b) => b[1] - a[1])
|
|
144
|
+
.slice(0, limit)
|
|
145
|
+
.map(([name, count]) => ({ name, count })),
|
|
146
|
+
hooks: result.hooks.slice(0, limit).map((h) => ({
|
|
147
|
+
name: h.name,
|
|
148
|
+
type: h.type,
|
|
149
|
+
file: h.file,
|
|
150
|
+
line: h.line,
|
|
151
|
+
dependencies: h.dependencies,
|
|
152
|
+
})),
|
|
153
|
+
truncated: result.hooks.length > limit,
|
|
154
|
+
summary: `${result.hooks.length} hook calls (${result.byType['builtin']} builtin, ${result.byType['custom']} custom), ${result.customHooks.length} custom hooks defined`,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
function formatErrorsResult(result, limit) {
|
|
158
|
+
return {
|
|
159
|
+
stats: {
|
|
160
|
+
tryCatchBlocks: result.stats.tryCatchBlocks,
|
|
161
|
+
promiseCatches: result.stats.promiseCatches,
|
|
162
|
+
errorBoundaries: result.stats.errorBoundaries,
|
|
163
|
+
throwStatements: result.stats.throwStatements,
|
|
164
|
+
},
|
|
165
|
+
patterns: {
|
|
166
|
+
'try-catch': result.patterns.filter((p) => p.type === 'try-catch').length,
|
|
167
|
+
'promise-catch': result.patterns.filter((p) => p.type === 'promise-catch').length,
|
|
168
|
+
'error-boundary': result.patterns.filter((p) => p.type === 'error-boundary').length,
|
|
169
|
+
'throw': result.patterns.filter((p) => p.type === 'throw').length,
|
|
170
|
+
},
|
|
171
|
+
issues: result.issues.slice(0, limit).map((i) => ({
|
|
172
|
+
type: i.type,
|
|
173
|
+
file: i.file,
|
|
174
|
+
line: i.line,
|
|
175
|
+
message: i.message,
|
|
176
|
+
suggestion: i.suggestion,
|
|
177
|
+
})),
|
|
178
|
+
summary: `${result.stats.tryCatchBlocks} try-catch blocks, ${result.issues.length} potential issues`,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
function formatDataAccessResult(result, limit) {
|
|
182
|
+
return {
|
|
183
|
+
total: result.accessPoints.length,
|
|
184
|
+
byFramework: result.byFramework,
|
|
185
|
+
byOperation: result.byOperation,
|
|
186
|
+
models: result.models,
|
|
187
|
+
accessPoints: result.accessPoints.slice(0, limit).map((a) => ({
|
|
188
|
+
model: a.model,
|
|
189
|
+
operation: a.operation,
|
|
190
|
+
framework: a.framework,
|
|
191
|
+
file: a.file,
|
|
192
|
+
line: a.line,
|
|
193
|
+
isRawSql: a.isRawSql,
|
|
194
|
+
})),
|
|
195
|
+
truncated: result.accessPoints.length > limit,
|
|
196
|
+
summary: `${result.accessPoints.length} data access points across ${result.models.length} models`,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
function formatDecoratorsResult(result, limit) {
|
|
200
|
+
// Count by target
|
|
201
|
+
const byTarget = {
|
|
202
|
+
class: result.decorators.filter((d) => d.target === 'class').length,
|
|
203
|
+
method: result.decorators.filter((d) => d.target === 'method').length,
|
|
204
|
+
property: result.decorators.filter((d) => d.target === 'property').length,
|
|
205
|
+
parameter: result.decorators.filter((d) => d.target === 'parameter').length,
|
|
206
|
+
};
|
|
207
|
+
return {
|
|
208
|
+
total: result.decorators.length,
|
|
209
|
+
byName: result.byName,
|
|
210
|
+
byTarget,
|
|
211
|
+
decorators: result.decorators.slice(0, limit).map((d) => ({
|
|
212
|
+
name: d.name,
|
|
213
|
+
target: d.target,
|
|
214
|
+
file: d.file,
|
|
215
|
+
line: d.line,
|
|
216
|
+
arguments: d.arguments,
|
|
217
|
+
})),
|
|
218
|
+
truncated: result.decorators.length > limit,
|
|
219
|
+
summary: `${result.decorators.length} decorators (${byTarget.class} class, ${byTarget.method} method, ${byTarget.property} property)`,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
//# sourceMappingURL=typescript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../../src/tools/analysis/typescript.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,wBAAwB,GAQzB,MAAM,kBAAkB,CAAC;AA0B1B,+EAA+E;AAC/E,sBAAsB;AACtB,+EAA+E;AAE/E,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,IAAoB,EACpB,OAAoB;IAEpB,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,WAAW,CAAC;IACrD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;IAE/B,MAAM,QAAQ,GAAG,wBAAwB,CAAC;QACxC,OAAO,EAAE,WAAW;QACpB,OAAO,EAAE,KAAK;KACf,CAAC,CAAC;IAEH,IAAI,MAAe,CAAC;IAEpB,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,MAAM,cAAc,GAAG,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;YAChD,MAAM,GAAG,kBAAkB,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;YACnD,MAAM;QACR,CAAC;QAED,KAAK,QAAQ,CAAC,CAAC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