@angular-modernizer/adapter-mcp 0.1.3 → 0.2.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 +22 -0
- package/dist/cli.js +20 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/tools/analyze-build-impact.d.ts +47 -3
- package/dist/tools/analyze-build-impact.d.ts.map +1 -1
- package/dist/tools/analyze-build-impact.js +57 -14
- package/dist/tools/analyze-build-impact.js.map +1 -1
- package/dist/tools/analyze-parser-performance.d.ts.map +1 -1
- package/dist/tools/analyze-parser-performance.js +6 -4
- package/dist/tools/analyze-parser-performance.js.map +1 -1
- package/dist/tools/collect-feedback.d.ts +112 -1
- package/dist/tools/collect-feedback.d.ts.map +1 -1
- package/dist/tools/collect-feedback.js +240 -11
- package/dist/tools/collect-feedback.js.map +1 -1
- package/dist/tools/extract-libraries.d.ts +4 -0
- package/dist/tools/extract-libraries.d.ts.map +1 -1
- package/dist/tools/extract-libraries.js +40 -8
- package/dist/tools/extract-libraries.js.map +1 -1
- package/dist/tools/find-usages.d.ts +13 -1
- package/dist/tools/find-usages.d.ts.map +1 -1
- package/dist/tools/find-usages.js +34 -6
- package/dist/tools/find-usages.js.map +1 -1
- package/dist/tools/get-call-graph.d.ts +5 -1
- package/dist/tools/get-call-graph.d.ts.map +1 -1
- package/dist/tools/get-call-graph.js +21 -6
- package/dist/tools/get-call-graph.js.map +1 -1
- package/dist/tools/helpers/find-ts-config.d.ts +24 -1
- package/dist/tools/helpers/find-ts-config.d.ts.map +1 -1
- package/dist/tools/helpers/find-ts-config.js +213 -7
- package/dist/tools/helpers/find-ts-config.js.map +1 -1
- package/dist/tools/helpers/suggestion-generator.d.ts +1 -1
- package/dist/tools/helpers/suggestion-generator.d.ts.map +1 -1
- package/dist/tools/helpers/suggestion-generator.js.map +1 -1
- package/dist/tools/list-imports.d.ts +103 -0
- package/dist/tools/list-imports.d.ts.map +1 -0
- package/dist/tools/list-imports.js +154 -0
- package/dist/tools/list-imports.js.map +1 -0
- package/dist/tools/review-feedback.d.ts +7 -0
- package/dist/tools/review-feedback.d.ts.map +1 -1
- package/dist/tools/review-feedback.js +68 -16
- package/dist/tools/review-feedback.js.map +1 -1
- package/dist/tools/search-codebase.d.ts +29 -6
- package/dist/tools/search-codebase.d.ts.map +1 -1
- package/dist/tools/search-codebase.js +54 -12
- package/dist/tools/search-codebase.js.map +1 -1
- package/dist/tools/suggest-improvements.d.ts +3 -1
- package/dist/tools/suggest-improvements.d.ts.map +1 -1
- package/dist/tools/suggest-improvements.js +47 -10
- package/dist/tools/suggest-improvements.js.map +1 -1
- package/package.json +13 -12
|
@@ -16,6 +16,33 @@ import { ContextFactory } from '@angular-modernizer/plugin-system';
|
|
|
16
16
|
import { createPublicApi } from '@angular-modernizer/api';
|
|
17
17
|
import { glob } from 'glob';
|
|
18
18
|
import { resolve, extname } from 'node:path';
|
|
19
|
+
/**
|
|
20
|
+
* Default folders scanned for candidates. `libs` / `projects` cover Nx and
|
|
21
|
+
* Angular CLI library workspaces; `models` / `interfaces` cover data-only
|
|
22
|
+
* foundations (interfaces, types, enums, consts).
|
|
23
|
+
*/
|
|
24
|
+
const DEFAULT_TARGET_FOLDERS = [
|
|
25
|
+
'shared',
|
|
26
|
+
'common',
|
|
27
|
+
'core',
|
|
28
|
+
'libs',
|
|
29
|
+
'models',
|
|
30
|
+
'interfaces',
|
|
31
|
+
'projects',
|
|
32
|
+
];
|
|
33
|
+
/**
|
|
34
|
+
* Default minimum reusability (0-100). Every file in a target folder starts
|
|
35
|
+
* at 30 (location bonus), so 40 still requires real signals (few external
|
|
36
|
+
* dependencies, barrel export or importers) without demanding 2+ importers
|
|
37
|
+
* AND a barrel export like the former 60 did. The scanner itself uses 20.
|
|
38
|
+
*/
|
|
39
|
+
const DEFAULT_MIN_REUSABILITY = 40;
|
|
40
|
+
/**
|
|
41
|
+
* Default minimum cohesion (0-1). 0.5 means at least half of the weighted
|
|
42
|
+
* location / naming / import signals agree; the former 0.7 rejected any
|
|
43
|
+
* cluster spread over more than one sub-folder. The scanner itself uses 0.3.
|
|
44
|
+
*/
|
|
45
|
+
const DEFAULT_MIN_COHESION = 0.5;
|
|
19
46
|
/**
|
|
20
47
|
* Extract Libraries Tool
|
|
21
48
|
*
|
|
@@ -38,17 +65,17 @@ export class ExtractLibrariesTool {
|
|
|
38
65
|
targetFolders: {
|
|
39
66
|
type: 'array',
|
|
40
67
|
items: { type: 'string' },
|
|
41
|
-
description: "Folders to scan for extraction candidates. Default: ['shared', 'common', 'core']",
|
|
68
|
+
description: "Folders to scan for extraction candidates. Default: ['shared', 'common', 'core', 'libs', 'models', 'interfaces', 'projects']",
|
|
42
69
|
},
|
|
43
70
|
minReusabilityScore: {
|
|
44
71
|
type: 'number',
|
|
45
|
-
description: 'Minimum reusability score (0-100) to qualify as a candidate. Default:
|
|
46
|
-
default:
|
|
72
|
+
description: 'Minimum reusability score (0-100) to qualify as a candidate. Default: 40',
|
|
73
|
+
default: DEFAULT_MIN_REUSABILITY,
|
|
47
74
|
},
|
|
48
75
|
minCohesionScore: {
|
|
49
76
|
type: 'number',
|
|
50
|
-
description: 'Minimum cohesion score (0-1) for an artifact cluster. Default: 0.
|
|
51
|
-
default:
|
|
77
|
+
description: 'Minimum cohesion score (0-1) for an artifact cluster. Default: 0.5',
|
|
78
|
+
default: DEFAULT_MIN_COHESION,
|
|
52
79
|
},
|
|
53
80
|
maxResults: {
|
|
54
81
|
type: 'number',
|
|
@@ -75,9 +102,9 @@ export class ExtractLibrariesTool {
|
|
|
75
102
|
}
|
|
76
103
|
const startTime = Date.now();
|
|
77
104
|
const projectRoot = resolve(params.rootPath);
|
|
78
|
-
const targetFolders = params.targetFolders ??
|
|
79
|
-
const minReusabilityScore = params.minReusabilityScore ??
|
|
80
|
-
const minCohesionScore = params.minCohesionScore ??
|
|
105
|
+
const targetFolders = params.targetFolders ?? DEFAULT_TARGET_FOLDERS;
|
|
106
|
+
const minReusabilityScore = params.minReusabilityScore ?? DEFAULT_MIN_REUSABILITY;
|
|
107
|
+
const minCohesionScore = params.minCohesionScore ?? DEFAULT_MIN_COHESION;
|
|
81
108
|
const maxResults = params.maxResults ?? 1000;
|
|
82
109
|
const resultOffset = params.resultOffset ?? 0;
|
|
83
110
|
// Find tsconfig
|
|
@@ -144,11 +171,14 @@ export class ExtractLibrariesTool {
|
|
|
144
171
|
// Build summary
|
|
145
172
|
const byCategory = {};
|
|
146
173
|
const byComplexity = {};
|
|
174
|
+
const byKind = {};
|
|
147
175
|
let totalArtifacts = 0;
|
|
148
176
|
for (const opp of allOpportunities) {
|
|
149
177
|
byCategory[opp.category] = (byCategory[opp.category] ?? 0) + 1;
|
|
150
178
|
byComplexity[opp.migrationComplexity] =
|
|
151
179
|
(byComplexity[opp.migrationComplexity] ?? 0) + 1;
|
|
180
|
+
const kind = opp.candidateKind ?? 'standard';
|
|
181
|
+
byKind[kind] = (byKind[kind] ?? 0) + 1;
|
|
152
182
|
totalArtifacts += opp.artifacts.length;
|
|
153
183
|
}
|
|
154
184
|
const nextSteps = this.buildNextSteps(allOpportunities);
|
|
@@ -159,6 +189,7 @@ export class ExtractLibrariesTool {
|
|
|
159
189
|
analyzedFiles,
|
|
160
190
|
byCategory,
|
|
161
191
|
byComplexity,
|
|
192
|
+
byKind,
|
|
162
193
|
totalArtifacts,
|
|
163
194
|
},
|
|
164
195
|
nextSteps,
|
|
@@ -182,6 +213,7 @@ export class ExtractLibrariesTool {
|
|
|
182
213
|
analyzedFiles,
|
|
183
214
|
byCategory: {},
|
|
184
215
|
byComplexity: {},
|
|
216
|
+
byKind: {},
|
|
185
217
|
totalArtifacts: 0,
|
|
186
218
|
},
|
|
187
219
|
nextSteps: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-libraries.js","sourceRoot":"","sources":["../../src/tools/extract-libraries.ts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AAC,CAAC,EAAE,CAAC;YACjE,KAAK,CAAC,IAAI,CACR,iGAAiG,CAClG,CAAC;QACJ,CAAC;QAED,KAAK,CAAC,IAAI,CACR,oGAAoG;YAClG,+EAA+E,CAClF,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
19
|
import { type MCPTool } from '../types.js';
|
|
20
|
-
import { type SymbolUsage } from '@angular-modernizer/api';
|
|
20
|
+
import { type SymbolUsage, type UsageType } from '@angular-modernizer/api';
|
|
21
21
|
/**
|
|
22
22
|
* Output of the find-usages tool.
|
|
23
23
|
*/
|
|
@@ -28,6 +28,10 @@ interface FindUsagesOutput {
|
|
|
28
28
|
totalCount: number;
|
|
29
29
|
/** Human-readable summary for LLM consumption. */
|
|
30
30
|
summary: string;
|
|
31
|
+
/** Usage counts per usage type. */
|
|
32
|
+
countsByType: Partial<Record<UsageType, number>>;
|
|
33
|
+
/** The tsconfig whose program was searched. */
|
|
34
|
+
tsConfigPath: string;
|
|
31
35
|
}
|
|
32
36
|
/**
|
|
33
37
|
* MCP tool that finds all references to a named symbol across a TypeScript project.
|
|
@@ -55,6 +59,14 @@ export declare class FindUsagesTool implements MCPTool {
|
|
|
55
59
|
enum: string[];
|
|
56
60
|
description: string;
|
|
57
61
|
};
|
|
62
|
+
includeTemplates: {
|
|
63
|
+
type: string;
|
|
64
|
+
description: string;
|
|
65
|
+
};
|
|
66
|
+
includeUnresolved: {
|
|
67
|
+
type: string;
|
|
68
|
+
description: string;
|
|
69
|
+
};
|
|
58
70
|
};
|
|
59
71
|
required: string[];
|
|
60
72
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-usages.d.ts","sourceRoot":"","sources":["../../src/tools/find-usages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAEL,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"find-usages.d.ts","sourceRoot":"","sources":["../../src/tools/find-usages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,SAAS,EACf,MAAM,yBAAyB,CAAC;AAkCjC;;GAEG;AACH,UAAU,gBAAgB;IACxB,2BAA2B;IAC3B,MAAM,EAAE,WAAW,EAAE,CAAC;IAEtB,oCAAoC;IACpC,UAAU,EAAE,MAAM,CAAC;IAEnB,kDAAkD;IAClD,OAAO,EAAE,MAAM,CAAC;IAEhB,mCAAmC;IACnC,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;IAEjD,+CAA+C;IAC/C,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,cAAe,YAAW,OAAO;IAC5C,QAAQ,CAAC,IAAI,iBAAiB;IAE9B,QAAQ,CAAC,WAAW,SAUK;IAEzB,QAAQ,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAoClB;IAEI,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA6CvE,OAAO,CAAC,YAAY;CAyCrB"}
|
|
@@ -27,8 +27,14 @@ export class FindUsagesTool {
|
|
|
27
27
|
name = 'find-usages';
|
|
28
28
|
description = 'Find all references to a symbol (class, method, function, variable, or constant) ' +
|
|
29
29
|
'across a TypeScript project. Returns file paths, line numbers, source snippets, ' +
|
|
30
|
-
'and usage type
|
|
31
|
-
'
|
|
30
|
+
'and usage type: read/write/call (resolved references), template (Angular template ' +
|
|
31
|
+
'usage: component/directive selector, pipe name, member read/call/write, input/output ' +
|
|
32
|
+
'binding; external templateUrl and inline templates; templateMatch is "verified" or ' +
|
|
33
|
+
'"template-unverified" for same-name matches that could not be tied to the symbol), ' +
|
|
34
|
+
'and unresolved (same-name identifiers whose symbol does not resolve, e.g. a class ' +
|
|
35
|
+
'still used after its import was removed). The file option filters reported usages only. ' +
|
|
36
|
+
'Use after parse-stack-trace to trace call paths and determine blast radius before ' +
|
|
37
|
+
'proposing a bug fix.';
|
|
32
38
|
inputSchema = {
|
|
33
39
|
type: 'object',
|
|
34
40
|
properties: {
|
|
@@ -42,13 +48,22 @@ export class FindUsagesTool {
|
|
|
42
48
|
},
|
|
43
49
|
file: {
|
|
44
50
|
type: 'string',
|
|
45
|
-
description: '
|
|
51
|
+
description: 'Only report usages located in this file (absolute path, .ts or .html). ' +
|
|
52
|
+
'The symbol declaration may live in any file. Optional.',
|
|
46
53
|
},
|
|
47
54
|
usageType: {
|
|
48
55
|
type: 'string',
|
|
49
|
-
enum: ['read', 'write', 'call'],
|
|
56
|
+
enum: ['read', 'write', 'call', 'template', 'unresolved'],
|
|
50
57
|
description: 'Restrict results to this usage type. Optional.',
|
|
51
58
|
},
|
|
59
|
+
includeTemplates: {
|
|
60
|
+
type: 'boolean',
|
|
61
|
+
description: 'Include Angular template usages (selectors, pipes, member reads/calls, bindings). Defaults to true.',
|
|
62
|
+
},
|
|
63
|
+
includeUnresolved: {
|
|
64
|
+
type: 'boolean',
|
|
65
|
+
description: 'Include same-name identifiers that do not resolve to any symbol (e.g. missing import, TS2304). Defaults to true.',
|
|
66
|
+
},
|
|
52
67
|
},
|
|
53
68
|
required: ['symbol', 'projectRoot'],
|
|
54
69
|
};
|
|
@@ -72,17 +87,27 @@ export class FindUsagesTool {
|
|
|
72
87
|
const usages = finder.findUsages(params.symbol, {
|
|
73
88
|
file: params.file,
|
|
74
89
|
usageType: params.usageType,
|
|
90
|
+
includeTemplates: params.includeTemplates !== false,
|
|
91
|
+
includeUnresolved: params.includeUnresolved !== false,
|
|
75
92
|
});
|
|
93
|
+
const countsByType = {};
|
|
94
|
+
for (const u of usages) {
|
|
95
|
+
countsByType[u.usageType] = (countsByType[u.usageType] ?? 0) + 1;
|
|
96
|
+
}
|
|
76
97
|
return {
|
|
77
98
|
usages,
|
|
78
99
|
totalCount: usages.length,
|
|
79
100
|
summary: this.buildSummary(params.symbol, usages, params.file),
|
|
101
|
+
countsByType,
|
|
102
|
+
tsConfigPath,
|
|
80
103
|
};
|
|
81
104
|
}
|
|
82
105
|
buildSummary(symbol, usages, file) {
|
|
83
106
|
if (usages.length === 0) {
|
|
84
107
|
const scope = file ? `in ${file}` : 'across the project';
|
|
85
|
-
return `No usages of '${symbol}' found ${scope}
|
|
108
|
+
return (`No usages of '${symbol}' found ${scope}. Only files in the tsconfig program ` +
|
|
109
|
+
'and component templates were searched; verify with search-codebase (text mode) ' +
|
|
110
|
+
'before treating this as proof of absence.');
|
|
86
111
|
}
|
|
87
112
|
const byFile = new Map();
|
|
88
113
|
for (const u of usages) {
|
|
@@ -96,7 +121,10 @@ export class FindUsagesTool {
|
|
|
96
121
|
for (const [filePath, fileUsages] of byFile) {
|
|
97
122
|
lines.push(` ${filePath} (${fileUsages.length})`);
|
|
98
123
|
for (const u of fileUsages.slice(0, 3)) {
|
|
99
|
-
|
|
124
|
+
const tag = u.templateMatch === 'template-unverified'
|
|
125
|
+
? `${u.usageType}:unverified`
|
|
126
|
+
: u.usageType;
|
|
127
|
+
lines.push(` L${u.line}: [${tag}] ${u.snippet}`);
|
|
100
128
|
}
|
|
101
129
|
if (fileUsages.length > 3) {
|
|
102
130
|
lines.push(` ... and ${fileUsages.length - 3} more`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-usages.js","sourceRoot":"","sources":["../../src/tools/find-usages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EACL,WAAW,GAGZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"find-usages.js","sourceRoot":"","sources":["../../src/tools/find-usages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EACL,WAAW,GAGZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAoD3D;;GAEG;AACH,MAAM,OAAO,cAAc;IAChB,IAAI,GAAG,aAAa,CAAC;IAErB,WAAW,GAClB,mFAAmF;QACnF,kFAAkF;QAClF,oFAAoF;QACpF,uFAAuF;QACvF,qFAAqF;QACrF,qFAAqF;QACrF,oFAAoF;QACpF,0FAA0F;QAC1F,oFAAoF;QACpF,sBAAsB,CAAC;IAEhB,WAAW,GAAG;QACrB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,0EAA0E;aAC7E;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,kEAAkE;aACrE;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,yEAAyE;oBACzE,wDAAwD;aAC3D;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,CAAC;gBACzD,WAAW,EAAE,gDAAgD;aAC9D;YACD,gBAAgB,EAAE;gBAChB,IAAI,EAAE,SAAS;gBACf,WAAW,EACT,qGAAqG;aACxG;YACD,iBAAiB,EAAE;gBACjB,IAAI,EAAE,SAAS;gBACf,WAAW,EACT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YACnD,KAAK,MAAM,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;gBACvC,MAAM,GAAG,GACP,CAAC,CAAC,aAAa,KAAK,qBAAqB;oBACvC,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,aAAa;oBAC7B,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;gBAClB,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,MAAM,GAAG,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YACtD,CAAC;YACD,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC1B,KAAK,CAAC,IAAI,CAAC,eAAe,UAAU,CAAC,MAAM,GAAG,CAAC,OAAO,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @angular-modernizer/adapter-mcp - Get Call Graph Tool
|
|
3
3
|
*
|
|
4
|
-
* MCP tool for building a caller/callee graph for a named method
|
|
4
|
+
* MCP tool for building a caller/callee graph for a named method, function,
|
|
5
|
+
* constructor, get/set accessor or arrow-function property.
|
|
5
6
|
* Supports configurable traversal direction and depth.
|
|
6
7
|
*
|
|
7
8
|
* @remarks
|
|
@@ -14,6 +15,8 @@
|
|
|
14
15
|
* // Via MCP:
|
|
15
16
|
* // tool: get-call-graph
|
|
16
17
|
* // args: { method: 'getUser', file: '/project/src/app/user.service.ts', projectRoot: '/project' }
|
|
18
|
+
* // args: { method: 'AuthInterceptor.constructor', file: '/project/src/app/auth.interceptor.ts',
|
|
19
|
+
* // projectRoot: '/project', direction: 'down', depth: 4 }
|
|
17
20
|
* ```
|
|
18
21
|
*/
|
|
19
22
|
import { type MCPTool } from '../types.js';
|
|
@@ -57,5 +60,6 @@ export declare class GetCallGraphTool implements MCPTool {
|
|
|
57
60
|
summary: string;
|
|
58
61
|
}>;
|
|
59
62
|
private buildSummary;
|
|
63
|
+
private label;
|
|
60
64
|
}
|
|
61
65
|
//# sourceMappingURL=get-call-graph.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-call-graph.d.ts","sourceRoot":"","sources":["../../src/tools/get-call-graph.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"get-call-graph.d.ts","sourceRoot":"","sources":["../../src/tools/get-call-graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAGL,KAAK,eAAe,EAErB,MAAM,yBAAyB,CAAC;AAkCjC;;GAEG;AACH,qBAAa,gBAAiB,YAAW,OAAO;IAC9C,QAAQ,CAAC,IAAI,oBAAoB;IAEjC,QAAQ,CAAC,WAAW,SAQmE;IAEvF,QAAQ,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA+BlB;IAEI,OAAO,CACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,eAAe,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IA4CjD,OAAO,CAAC,YAAY;IA8BpB,OAAO,CAAC,KAAK;CAOd"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @angular-modernizer/adapter-mcp - Get Call Graph Tool
|
|
3
3
|
*
|
|
4
|
-
* MCP tool for building a caller/callee graph for a named method
|
|
4
|
+
* MCP tool for building a caller/callee graph for a named method, function,
|
|
5
|
+
* constructor, get/set accessor or arrow-function property.
|
|
5
6
|
* Supports configurable traversal direction and depth.
|
|
6
7
|
*
|
|
7
8
|
* @remarks
|
|
@@ -14,6 +15,8 @@
|
|
|
14
15
|
* // Via MCP:
|
|
15
16
|
* // tool: get-call-graph
|
|
16
17
|
* // args: { method: 'getUser', file: '/project/src/app/user.service.ts', projectRoot: '/project' }
|
|
18
|
+
* // args: { method: 'AuthInterceptor.constructor', file: '/project/src/app/auth.interceptor.ts',
|
|
19
|
+
* // projectRoot: '/project', direction: 'down', depth: 4 }
|
|
17
20
|
* ```
|
|
18
21
|
*/
|
|
19
22
|
import { Project } from 'ts-morph';
|
|
@@ -25,16 +28,21 @@ import { findTsConfig } from './helpers/find-ts-config.js';
|
|
|
25
28
|
*/
|
|
26
29
|
export class GetCallGraphTool {
|
|
27
30
|
name = 'get-call-graph';
|
|
28
|
-
description = 'Build a caller/callee graph for a named method
|
|
29
|
-
'
|
|
31
|
+
description = 'Build a caller/callee graph for a named method, function, constructor, ' +
|
|
32
|
+
'get/set accessor or arrow-function property. ' +
|
|
33
|
+
'Direction "up" shows who calls it, "down" shows what it calls, ' +
|
|
30
34
|
'"both" returns the full call tree. Configurable depth (default: 2). ' +
|
|
35
|
+
'Callees are resolved via the type checker and include new X() (constructor incl. field initializers), ' +
|
|
36
|
+
'super(), and property reads that resolve to getters. ' +
|
|
37
|
+
'Use method "ClassName.constructor" to see what runs transitively during construction. ' +
|
|
31
38
|
'Use after parse-stack-trace to trace error propagation through the call hierarchy.';
|
|
32
39
|
inputSchema = {
|
|
33
40
|
type: 'object',
|
|
34
41
|
properties: {
|
|
35
42
|
method: {
|
|
36
43
|
type: 'string',
|
|
37
|
-
description: 'Name of the method
|
|
44
|
+
description: 'Name of the callable to analyse: method, function, get/set accessor, arrow-function property, ' +
|
|
45
|
+
'"constructor", or class-qualified ("ClassName.member", "ClassName.constructor").',
|
|
38
46
|
},
|
|
39
47
|
file: {
|
|
40
48
|
type: 'string',
|
|
@@ -98,7 +106,7 @@ export class GetCallGraphTool {
|
|
|
98
106
|
if (result.callers.length > 0) {
|
|
99
107
|
lines.push(`\nCallers (${result.callers.length}):`);
|
|
100
108
|
for (const c of result.callers) {
|
|
101
|
-
lines.push(` ← ${c
|
|
109
|
+
lines.push(` ← ${this.label(c)} (${c.file}:${c.line})`);
|
|
102
110
|
}
|
|
103
111
|
}
|
|
104
112
|
else {
|
|
@@ -107,7 +115,7 @@ export class GetCallGraphTool {
|
|
|
107
115
|
if (result.callees.length > 0) {
|
|
108
116
|
lines.push(`\nCallees (${result.callees.length}):`);
|
|
109
117
|
for (const c of result.callees) {
|
|
110
|
-
lines.push(` → ${c
|
|
118
|
+
lines.push(` → ${this.label(c)} (${c.file}:${c.line})`);
|
|
111
119
|
}
|
|
112
120
|
}
|
|
113
121
|
else {
|
|
@@ -115,5 +123,12 @@ export class GetCallGraphTool {
|
|
|
115
123
|
}
|
|
116
124
|
return lines.join('\n');
|
|
117
125
|
}
|
|
126
|
+
label(node) {
|
|
127
|
+
const qualified = node.className
|
|
128
|
+
? `${node.className}.${node.name}`
|
|
129
|
+
: node.name;
|
|
130
|
+
const kind = node.kind && node.kind !== 'method' ? ` [${node.kind}]` : '';
|
|
131
|
+
return `${qualified}${kind}`;
|
|
132
|
+
}
|
|
118
133
|
}
|
|
119
134
|
//# sourceMappingURL=get-call-graph.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-call-graph.js","sourceRoot":"","sources":["../../src/tools/get-call-graph.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"get-call-graph.js","sourceRoot":"","sources":["../../src/tools/get-call-graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EACL,gBAAgB,GAIjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAgC3D;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAClB,IAAI,GAAG,gBAAgB,CAAC;IAExB,WAAW,GAClB,yEAAyE;QACzE,+CA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
|
|
2
2
|
* @angular-modernizer/adapter-mcp - TypeScript Config Finder
|
|
3
|
+
*
|
|
4
|
+
* Shared by every MCP tool that builds a ts-morph `Project`.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Angular CLI workspaces often use a "solution style" root `tsconfig.json`
|
|
8
|
+
* with `"files": []` plus `references`. Loading that root yields an (almost)
|
|
9
|
+
* empty program, so investigation tools would silently search nothing. The
|
|
10
|
+
* finder therefore prefers a config that actually contains source files:
|
|
11
|
+
*
|
|
12
|
+
* 1. the first existing candidate, if it has files
|
|
13
|
+
* 2. its `references` (recursively, `*.app.*` first, `*.spec.*` last)
|
|
14
|
+
* 3. `tsconfig.app.json` (root, then `src/`)
|
|
15
|
+
* 4. any other existing candidate with files
|
|
16
|
+
* 5. the first existing candidate (legacy behaviour)
|
|
17
|
+
*
|
|
18
|
+
* "Has files" is decided from the config JSON (own or inherited `files` /
|
|
19
|
+
* `include`, and whether the static directory of an `include` pattern
|
|
20
|
+
* exists) instead of the TypeScript API: loading `typescript` at module
|
|
21
|
+
* scope breaks the many adapter test suites that mock `node:fs`, and those
|
|
22
|
+
* suites also mock `@angular-modernizer/core`, so this helper stays free of
|
|
23
|
+
* workspace imports. An unreadable config counts as "has files", which keeps
|
|
24
|
+
* the legacy first-existing behaviour.
|
|
3
25
|
*/
|
|
4
26
|
/**
|
|
5
|
-
* Locate the
|
|
27
|
+
* Locate the tsconfig file that should back a ts-morph `Project` under
|
|
28
|
+
* `rootPath` (see module remarks for the selection order).
|
|
6
29
|
*
|
|
7
30
|
* @returns Absolute path to the tsconfig file, or `null` if none found.
|
|
8
31
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-ts-config.d.ts","sourceRoot":"","sources":["../../../src/tools/helpers/find-ts-config.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"find-ts-config.d.ts","sourceRoot":"","sources":["../../../src/tools/helpers/find-ts-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAqNH;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAe5D"}
|