@angular-modernizer/adapter-mcp 1.0.0 → 1.1.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 +78 -64
- package/dist/cli.js +8 -0
- package/dist/core/project-analyzer.d.ts +3 -12
- package/dist/core/project-analyzer.js +3 -12
- package/dist/index.d.ts +118 -3
- package/dist/index.js +46 -3
- package/dist/mcp-watcher.d.ts +28 -8
- package/dist/mcp-watcher.js +7 -7
- package/dist/scan-host/scan-host.d.ts +119 -0
- package/dist/scan-host/scan-host.js +376 -0
- package/dist/scan-host/scan-protocol.d.ts +35 -0
- package/dist/scan-host/scan-protocol.js +6 -0
- package/dist/scan-host/scan-worker.d.ts +14 -0
- package/dist/scan-host/scan-worker.js +48 -0
- package/dist/server/limited-stdio-transport.d.ts +7 -0
- package/dist/server/mcp-server.d.ts +11 -7
- package/dist/server/mcp-server.js +4 -7
- package/dist/server/sdk-server.d.ts +1 -0
- package/dist/server/tool-registry.d.ts +3 -7
- package/dist/server/tool-registry.js +1 -7
- package/dist/streaming/progress-store.d.ts +22 -5
- package/dist/streaming/progress-store.js +9 -5
- package/dist/tools/analyze-build-impact.d.ts +56 -34
- package/dist/tools/analyze-build-impact.js +30 -25
- package/dist/tools/analyze-core-to-shared.d.ts +42 -12
- package/dist/tools/analyze-core-to-shared.js +11 -10
- package/dist/tools/analyze-parser-performance.d.ts +23 -22
- package/dist/tools/analyze-parser-performance.js +20 -18
- package/dist/tools/analyze-project.d.ts +82 -12
- package/dist/tools/analyze-project.js +98 -101
- package/dist/tools/check-incremental-compatibility.d.ts +13 -11
- package/dist/tools/check-incremental-compatibility.js +11 -8
- package/dist/tools/collect-feedback.d.ts +41 -26
- package/dist/tools/collect-feedback.js +32 -23
- package/dist/tools/compare-health.d.ts +76 -19
- package/dist/tools/compare-health.js +26 -19
- package/dist/tools/extract-libraries.d.ts +44 -20
- package/dist/tools/extract-libraries.js +16 -17
- package/dist/tools/find-angular-symbol.d.ts +25 -23
- package/dist/tools/find-angular-symbol.js +17 -14
- package/dist/tools/find-component-hosts.d.ts +31 -25
- package/dist/tools/find-component-hosts.js +24 -21
- package/dist/tools/find-usages.d.ts +23 -21
- package/dist/tools/find-usages.js +19 -16
- package/dist/tools/get-bootstrap-execution.d.ts +33 -25
- package/dist/tools/get-bootstrap-execution.js +25 -22
- package/dist/tools/get-call-graph.d.ts +18 -13
- package/dist/tools/get-call-graph.js +24 -21
- package/dist/tools/get-operation-progress-tool.d.ts +12 -6
- package/dist/tools/get-operation-progress-tool.js +11 -6
- package/dist/tools/get-operation-progress.d.ts +26 -0
- package/dist/tools/helpers/analysis-output.d.ts +5 -0
- package/dist/tools/helpers/batch-kernel.d.ts +14 -0
- package/dist/tools/helpers/batch-kernel.js +12 -0
- package/dist/tools/helpers/compact-output.d.ts +2 -1
- package/dist/tools/helpers/compact-output.js +2 -1
- package/dist/tools/helpers/health-delta.d.ts +27 -14
- package/dist/tools/helpers/health-delta.js +11 -14
- package/dist/tools/helpers/project-cache.d.ts +50 -34
- package/dist/tools/helpers/project-cache.js +33 -34
- package/dist/tools/helpers/rule-runner.d.ts +23 -16
- package/dist/tools/helpers/rule-runner.js +24 -17
- package/dist/tools/helpers/scan-engine.d.ts +107 -0
- package/dist/tools/helpers/scan-engine.js +197 -0
- package/dist/tools/helpers/suggestion-generator.d.ts +9 -13
- package/dist/tools/helpers/suggestion-generator.js +0 -12
- package/dist/tools/helpers/tool-cache.d.ts +11 -0
- package/dist/tools/helpers/tool-cache.js +15 -0
- package/dist/tools/helpers/tool-context.d.ts +11 -8
- package/dist/tools/helpers/tool-context.js +5 -8
- package/dist/tools/inspect-form-group.d.ts +32 -25
- package/dist/tools/inspect-form-group.js +24 -21
- package/dist/tools/inspect-i18n.d.ts +28 -22
- package/dist/tools/inspect-i18n.js +20 -17
- package/dist/tools/inspect-template.d.ts +31 -24
- package/dist/tools/inspect-template.js +23 -20
- package/dist/tools/learn-patterns.d.ts +88 -12
- package/dist/tools/learn-patterns.js +17 -11
- package/dist/tools/list-imports.d.ts +42 -25
- package/dist/tools/list-imports.js +23 -20
- package/dist/tools/orchestrate-migration.d.ts +31 -9
- package/dist/tools/orchestrate-migration.js +12 -7
- package/dist/tools/parse-stack-trace.d.ts +23 -21
- package/dist/tools/parse-stack-trace.js +10 -7
- package/dist/tools/plan-migration.d.ts +65 -25
- package/dist/tools/plan-migration.js +19 -19
- package/dist/tools/resolve-type.d.ts +19 -9
- package/dist/tools/resolve-type.js +19 -11
- package/dist/tools/review-feedback.d.ts +27 -24
- package/dist/tools/review-feedback.js +24 -20
- package/dist/tools/rollback-changes.d.ts +13 -9
- package/dist/tools/rollback-changes.js +10 -7
- package/dist/tools/run-angular-cli.d.ts +12 -10
- package/dist/tools/run-angular-cli.js +11 -8
- package/dist/tools/run-build.d.ts +13 -11
- package/dist/tools/run-build.js +11 -8
- package/dist/tools/run-schematic.d.ts +12 -10
- package/dist/tools/run-schematic.js +11 -8
- package/dist/tools/scan-all.d.ts +69 -12
- package/dist/tools/scan-all.js +55 -122
- package/dist/tools/scan-angular.d.ts +41 -9
- package/dist/tools/scan-angular.js +66 -135
- package/dist/tools/scan-architecture.d.ts +75 -14
- package/dist/tools/scan-architecture.js +180 -185
- package/dist/tools/scan-solid.d.ts +40 -9
- package/dist/tools/scan-solid.js +64 -133
- package/dist/tools/search-codebase.d.ts +30 -24
- package/dist/tools/search-codebase.js +13 -10
- package/dist/tools/server-status.d.ts +116 -24
- package/dist/tools/server-status.js +85 -26
- package/dist/tools/suggest-improvements.d.ts +22 -19
- package/dist/tools/suggest-improvements.js +21 -17
- package/dist/tools/trace-output-flow.d.ts +32 -25
- package/dist/tools/trace-output-flow.js +24 -21
- package/dist/tools/transform-code.d.ts +71 -10
- package/dist/tools/transform-code.js +60 -42
- package/dist/tools/validate-before-transform.d.ts +24 -9
- package/dist/tools/validate-before-transform.js +10 -7
- package/dist/tools/validate-project-compatibility.d.ts +18 -13
- package/dist/tools/validate-project-compatibility.js +17 -11
- package/dist/tools/validate-transformation.d.ts +28 -11
- package/dist/tools/validate-transformation.js +14 -8
- package/dist/tools/verify-citations.d.ts +37 -16
- package/dist/tools/verify-citations.js +19 -16
- package/dist/types.d.ts +40 -10
- package/dist/types.js +0 -5
- package/package.json +12 -18
- package/dist/tools/shared/scan-types.d.ts +0 -200
- package/dist/tools/shared/scan-types.js +0 -7
|
@@ -1,29 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Server Status Tool
|
|
3
|
-
*
|
|
4
|
-
* MCP tool that reports on the running server itself: memory, uptime, the
|
|
5
|
-
* negotiated protocol era and revision, the ts-morph projects held in the
|
|
6
|
-
* shared cache, response sizes, and whether the build on disk changed after
|
|
7
|
-
* the server started.
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* A session keeps the code it started with; after `pnpm run build` it serves
|
|
11
|
-
* stale tools until the client reconnects. `build.rebuiltSinceStart` makes
|
|
12
|
-
* that visible from inside the session. The check compares the newest `.js`
|
|
13
|
-
* mtime per package `dist/` at start and at call time; it walks the
|
|
14
|
-
* directories on every call (a few hundred files, milliseconds).
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* // Via MCP:
|
|
19
|
-
* // tool: server-status
|
|
20
|
-
* // args: {}
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
1
|
import { existsSync, readdirSync, statSync } from 'node:fs';
|
|
24
2
|
import { join } from 'node:path';
|
|
25
3
|
import { getHeapStatistics } from 'node:v8';
|
|
26
4
|
import { PACKAGE_VERSION } from '../server/package-version.js';
|
|
5
|
+
import { describeScanHost } from '../scan-host/scan-host.js';
|
|
27
6
|
import { toMB, } from './helpers/project-cache.js';
|
|
28
7
|
const BYTES_PER_MB = 1024 * 1024;
|
|
29
8
|
/** One response in the response statistics. */
|
|
@@ -88,12 +67,30 @@ function iso(ms) {
|
|
|
88
67
|
return ms === undefined ? undefined : new Date(ms).toISOString();
|
|
89
68
|
}
|
|
90
69
|
/**
|
|
91
|
-
* MCP tool that reports server
|
|
70
|
+
* MCP tool that reports on the running server itself: memory, uptime, the
|
|
71
|
+
* negotiated protocol era and revision, the ts-morph projects held in the
|
|
72
|
+
* shared cache, response sizes, and whether the build on disk changed after
|
|
73
|
+
* the server started.
|
|
74
|
+
*
|
|
75
|
+
* @remarks
|
|
76
|
+
* A session keeps the code it started with; after a rebuild it serves stale
|
|
77
|
+
* tools until the client reconnects. `build.rebuiltSinceStart` makes that
|
|
78
|
+
* visible from inside the session. The check compares the newest `.js` mtime
|
|
79
|
+
* per package `dist/` at start and at call time; it walks the directories on
|
|
80
|
+
* every call (a few hundred files, milliseconds).
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```typescript
|
|
84
|
+
* // Via MCP:
|
|
85
|
+
* // tool: server-status
|
|
86
|
+
* // args: {}
|
|
87
|
+
* ```
|
|
92
88
|
*/
|
|
93
89
|
export class ServerStatusTool {
|
|
94
90
|
projects;
|
|
95
91
|
runtime;
|
|
96
92
|
distDirectories;
|
|
93
|
+
scanWorkers;
|
|
97
94
|
name = 'server-status';
|
|
98
95
|
title = 'Server Status';
|
|
99
96
|
annotations = {
|
|
@@ -109,11 +106,19 @@ export class ServerStatusTool {
|
|
|
109
106
|
'whether a package dist/ was rebuilt after the server started. When build.rebuiltSinceStart ' +
|
|
110
107
|
'is true this session still runs the old code: reconnect the MCP server to load the new build. ' +
|
|
111
108
|
'Use it when results look stale, before measuring response sizes, or when memory grows.';
|
|
109
|
+
/**
|
|
110
|
+
* JSON Schema of the tool arguments.
|
|
111
|
+
* @hidden
|
|
112
|
+
*/
|
|
112
113
|
inputSchema = {
|
|
113
114
|
type: 'object',
|
|
114
115
|
additionalProperties: false,
|
|
115
116
|
properties: {},
|
|
116
117
|
};
|
|
118
|
+
/**
|
|
119
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
120
|
+
* @hidden
|
|
121
|
+
*/
|
|
117
122
|
outputSchema = {
|
|
118
123
|
type: 'object',
|
|
119
124
|
properties: {
|
|
@@ -230,6 +235,43 @@ export class ServerStatusTool {
|
|
|
230
235
|
},
|
|
231
236
|
required: ['cached', 'capacity', 'maxHeapMB', 'entries', 'evictions'],
|
|
232
237
|
},
|
|
238
|
+
scanWorkers: {
|
|
239
|
+
type: 'object',
|
|
240
|
+
properties: {
|
|
241
|
+
enabled: { type: 'boolean' },
|
|
242
|
+
maxHeapMB: { type: 'number' },
|
|
243
|
+
standby: { type: 'boolean' },
|
|
244
|
+
running: {
|
|
245
|
+
type: 'array',
|
|
246
|
+
items: {
|
|
247
|
+
type: 'object',
|
|
248
|
+
properties: {
|
|
249
|
+
threadId: { type: 'integer' },
|
|
250
|
+
tool: { type: 'string' },
|
|
251
|
+
startedAt: { type: 'string' },
|
|
252
|
+
files: { type: 'integer' },
|
|
253
|
+
filesDone: { type: 'integer' },
|
|
254
|
+
heapUsedMB: { type: 'number' },
|
|
255
|
+
},
|
|
256
|
+
required: ['threadId', 'tool', 'startedAt', 'files', 'filesDone'],
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
queued: { type: 'integer' },
|
|
260
|
+
started: { type: 'integer' },
|
|
261
|
+
cancelled: { type: 'integer' },
|
|
262
|
+
failed: { type: 'integer' },
|
|
263
|
+
},
|
|
264
|
+
required: [
|
|
265
|
+
'enabled',
|
|
266
|
+
'maxHeapMB',
|
|
267
|
+
'standby',
|
|
268
|
+
'running',
|
|
269
|
+
'queued',
|
|
270
|
+
'started',
|
|
271
|
+
'cancelled',
|
|
272
|
+
'failed',
|
|
273
|
+
],
|
|
274
|
+
},
|
|
233
275
|
build: {
|
|
234
276
|
type: 'object',
|
|
235
277
|
properties: {
|
|
@@ -253,18 +295,20 @@ export class ServerStatusTool {
|
|
|
253
295
|
},
|
|
254
296
|
summary: { type: 'string' },
|
|
255
297
|
},
|
|
256
|
-
required: ['process', 'server', 'projects', 'build', 'summary'],
|
|
298
|
+
required: ['process', 'server', 'projects', 'scanWorkers', 'build', 'summary'],
|
|
257
299
|
};
|
|
258
300
|
baseline;
|
|
259
301
|
/**
|
|
260
302
|
* @param projects - The project cache shared by the investigation tools.
|
|
261
303
|
* @param runtime - Server start time, tool count, response sizes and protocol.
|
|
262
304
|
* @param distDirectories - Package `dist/` directories to watch; missing ones are skipped.
|
|
305
|
+
* @param scanWorkers - State of the scan workers; default the server's scan host.
|
|
263
306
|
*/
|
|
264
|
-
constructor(projects, runtime, distDirectories = []) {
|
|
307
|
+
constructor(projects, runtime, distDirectories = [], scanWorkers = describeScanHost) {
|
|
265
308
|
this.projects = projects;
|
|
266
309
|
this.runtime = runtime;
|
|
267
310
|
this.distDirectories = distDirectories;
|
|
311
|
+
this.scanWorkers = scanWorkers;
|
|
268
312
|
this.baseline = new Map(distDirectories
|
|
269
313
|
.filter((d) => existsSync(d.dir))
|
|
270
314
|
.map((d) => [d.dir, newestJsMtime(d.dir)]));
|
|
@@ -310,6 +354,7 @@ export class ServerStatusTool {
|
|
|
310
354
|
entries: this.projects.describe(),
|
|
311
355
|
evictions: this.projects.evictions,
|
|
312
356
|
},
|
|
357
|
+
scanWorkers: this.scanWorkers(),
|
|
313
358
|
build: {
|
|
314
359
|
rebuiltSinceStart: packages.some((p) => p.rebuilt),
|
|
315
360
|
packages,
|
|
@@ -318,7 +363,7 @@ export class ServerStatusTool {
|
|
|
318
363
|
return { ...result, summary: this.buildSummary(result) };
|
|
319
364
|
}
|
|
320
365
|
buildSummary(status) {
|
|
321
|
-
const { process: proc, server, projects, build } = status;
|
|
366
|
+
const { process: proc, server, projects, scanWorkers, build } = status;
|
|
322
367
|
const lines = [
|
|
323
368
|
`angular-modernizer ${server.version}, pid ${proc.pid} (parent ${proc.ppid}), up ${proc.uptimeSec} s since ${server.startedAt}, ` +
|
|
324
369
|
`${server.toolCount} tools, Node ${proc.nodeVersion}.`,
|
|
@@ -339,6 +384,7 @@ export class ServerStatusTool {
|
|
|
339
384
|
lines.push(`Evictions: ${evictions.count}; last ${last.tsConfigPath} (${last.reason}) at ${last.at}, ` +
|
|
340
385
|
`heap ${last.heapMB.before} -> ${last.heapMB.after} MB, RSS ${last.rssMB.before} -> ${last.rssMB.after} MB.`);
|
|
341
386
|
}
|
|
387
|
+
lines.push(describeScanWorkers(scanWorkers));
|
|
342
388
|
const { responses } = server;
|
|
343
389
|
if (responses.count > 0) {
|
|
344
390
|
const last = responses.last;
|
|
@@ -366,4 +412,17 @@ export class ServerStatusTool {
|
|
|
366
412
|
return lines.join('\n');
|
|
367
413
|
}
|
|
368
414
|
}
|
|
415
|
+
function describeScanWorkers(workers) {
|
|
416
|
+
if (!workers.enabled) {
|
|
417
|
+
return 'Scan workers: off, scans analyze on the main thread.';
|
|
418
|
+
}
|
|
419
|
+
const running = workers.running.map((w) => `${w.tool} (thread ${w.threadId}, ${w.filesDone}/${w.files} files` +
|
|
420
|
+
(w.heapUsedMB === undefined ? '' : `, heap ~${w.heapUsedMB} MB`) +
|
|
421
|
+
')');
|
|
422
|
+
return (`Scan workers: ${running.length === 0 ? 'none running' : `running ${running.join(', ')}`}` +
|
|
423
|
+
(workers.queued > 0 ? `, ${workers.queued} queued` : '') +
|
|
424
|
+
(workers.standby ? ', standby ready' : '') +
|
|
425
|
+
`; heap limit ${workers.maxHeapMB === 0 ? 'off' : `${workers.maxHeapMB} MB`}; ` +
|
|
426
|
+
`${workers.started} started, ${workers.cancelled} cancelled, ${workers.failed} failed.`);
|
|
427
|
+
}
|
|
369
428
|
//# sourceMappingURL=server-status.js.map
|
|
@@ -1,25 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Suggest Improvements Tool
|
|
3
|
-
*
|
|
4
|
-
* MCP tool for suggesting rule adjustments based on feedback analysis.
|
|
5
|
-
* Analyzes transformation feedback to identify improvement opportunities.
|
|
6
|
-
*
|
|
7
|
-
* Suggestion Types:
|
|
8
|
-
* - Parameter adjustment: Lower confidence thresholds when high-confidence fails
|
|
9
|
-
* - Prerequisite check: Add validation when common failure patterns detected
|
|
10
|
-
* - Approach change: Switch to more successful approach alternatives
|
|
11
|
-
* - Validation enhancement: Improve validation based on quality trends
|
|
12
|
-
* - Tool blind spot: an analysis tool (ruleId = tool name, e.g. 'find-usages')
|
|
13
|
-
* was corrected repeatedly via kind 'analysis' feedback
|
|
14
|
-
*
|
|
15
|
-
* All suggestions require human approval before implementation.
|
|
16
|
-
*/
|
|
17
1
|
import { type MCPTool, type ToolAnnotations } from '../types.js';
|
|
18
2
|
import { type Performance, type Suggestion } from './helpers/suggestion-generator.js';
|
|
19
3
|
/**
|
|
20
4
|
* Output from suggest-improvements tool
|
|
21
5
|
*/
|
|
22
|
-
interface SuggestImprovementsOutput {
|
|
6
|
+
export interface SuggestImprovementsOutput {
|
|
23
7
|
/** Rule identifier analyzed */
|
|
24
8
|
ruleId: string;
|
|
25
9
|
/** Current performance metrics */
|
|
@@ -36,13 +20,29 @@ interface SuggestImprovementsOutput {
|
|
|
36
20
|
summary: string;
|
|
37
21
|
}
|
|
38
22
|
/**
|
|
39
|
-
*
|
|
23
|
+
* MCP tool for suggesting rule adjustments based on feedback analysis.
|
|
24
|
+
* Analyzes transformation feedback to identify improvement opportunities.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* Suggestion Types:
|
|
28
|
+
* - Parameter adjustment: Lower confidence thresholds when high-confidence fails
|
|
29
|
+
* - Prerequisite check: Add validation when common failure patterns detected
|
|
30
|
+
* - Approach change: Switch to more successful approach alternatives
|
|
31
|
+
* - Validation enhancement: Improve validation based on quality trends
|
|
32
|
+
* - Tool blind spot: an analysis tool (ruleId = tool name, e.g. 'find-usages')
|
|
33
|
+
* was corrected repeatedly via kind 'analysis' feedback
|
|
34
|
+
*
|
|
35
|
+
* All suggestions require human approval before implementation.
|
|
40
36
|
*/
|
|
41
37
|
export declare class SuggestImprovementsTool implements MCPTool {
|
|
42
38
|
name: string;
|
|
43
39
|
title: string;
|
|
44
40
|
annotations: ToolAnnotations;
|
|
45
41
|
description: string;
|
|
42
|
+
/**
|
|
43
|
+
* JSON Schema of the tool arguments.
|
|
44
|
+
* @hidden
|
|
45
|
+
*/
|
|
46
46
|
inputSchema: {
|
|
47
47
|
readonly type: "object";
|
|
48
48
|
readonly additionalProperties: false;
|
|
@@ -70,6 +70,10 @@ export declare class SuggestImprovementsTool implements MCPTool {
|
|
|
70
70
|
};
|
|
71
71
|
readonly required: readonly ["ruleId"];
|
|
72
72
|
};
|
|
73
|
+
/**
|
|
74
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
75
|
+
* @hidden
|
|
76
|
+
*/
|
|
73
77
|
outputSchema: {
|
|
74
78
|
type: string;
|
|
75
79
|
properties: {
|
|
@@ -186,5 +190,4 @@ export declare class SuggestImprovementsTool implements MCPTool {
|
|
|
186
190
|
*/
|
|
187
191
|
execute(args: Record<string, unknown>): Promise<SuggestImprovementsOutput>;
|
|
188
192
|
}
|
|
189
|
-
export {};
|
|
190
193
|
//# sourceMappingURL=suggest-improvements.d.ts.map
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Suggest Improvements Tool
|
|
3
|
-
*
|
|
4
|
-
* MCP tool for suggesting rule adjustments based on feedback analysis.
|
|
5
|
-
* Analyzes transformation feedback to identify improvement opportunities.
|
|
6
|
-
*
|
|
7
|
-
* Suggestion Types:
|
|
8
|
-
* - Parameter adjustment: Lower confidence thresholds when high-confidence fails
|
|
9
|
-
* - Prerequisite check: Add validation when common failure patterns detected
|
|
10
|
-
* - Approach change: Switch to more successful approach alternatives
|
|
11
|
-
* - Validation enhancement: Improve validation based on quality trends
|
|
12
|
-
* - Tool blind spot: an analysis tool (ruleId = tool name, e.g. 'find-usages')
|
|
13
|
-
* was corrected repeatedly via kind 'analysis' feedback
|
|
14
|
-
*
|
|
15
|
-
* All suggestions require human approval before implementation.
|
|
16
|
-
*/
|
|
17
1
|
import { FeedbackStorage, loadConfig, findRepeatedToolMisses, fromLegacyAnalysisRecord, summarizeAnalysisFeedback, } from '@angular-modernizer/core';
|
|
18
2
|
import { calculatePerformance, generateSuggestions, } from './helpers/suggestion-generator.js';
|
|
19
3
|
import { feedbackSessionDirs, feedbackStorageConfig, resolveFeedbackRoots, } from './helpers/platform-root-resolver.js';
|
|
@@ -34,7 +18,19 @@ function describeSuggestions(output) {
|
|
|
34
18
|
return lines.join('\n');
|
|
35
19
|
}
|
|
36
20
|
/**
|
|
37
|
-
*
|
|
21
|
+
* MCP tool for suggesting rule adjustments based on feedback analysis.
|
|
22
|
+
* Analyzes transformation feedback to identify improvement opportunities.
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
* Suggestion Types:
|
|
26
|
+
* - Parameter adjustment: Lower confidence thresholds when high-confidence fails
|
|
27
|
+
* - Prerequisite check: Add validation when common failure patterns detected
|
|
28
|
+
* - Approach change: Switch to more successful approach alternatives
|
|
29
|
+
* - Validation enhancement: Improve validation based on quality trends
|
|
30
|
+
* - Tool blind spot: an analysis tool (ruleId = tool name, e.g. 'find-usages')
|
|
31
|
+
* was corrected repeatedly via kind 'analysis' feedback
|
|
32
|
+
*
|
|
33
|
+
* All suggestions require human approval before implementation.
|
|
38
34
|
*/
|
|
39
35
|
export class SuggestImprovementsTool {
|
|
40
36
|
name = 'suggest-improvements';
|
|
@@ -50,6 +46,10 @@ export class SuggestImprovementsTool {
|
|
|
50
46
|
'parameter adjustments, prerequisite checks, approach changes, validation enhancements. ' +
|
|
51
47
|
'All suggestions require human approval. ' +
|
|
52
48
|
'summary is a short text with the data points, the current performance and the top suggestions.';
|
|
49
|
+
/**
|
|
50
|
+
* JSON Schema of the tool arguments.
|
|
51
|
+
* @hidden
|
|
52
|
+
*/
|
|
53
53
|
inputSchema = {
|
|
54
54
|
type: 'object',
|
|
55
55
|
additionalProperties: false,
|
|
@@ -79,6 +79,10 @@ export class SuggestImprovementsTool {
|
|
|
79
79
|
},
|
|
80
80
|
required: ['ruleId'],
|
|
81
81
|
};
|
|
82
|
+
/**
|
|
83
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
84
|
+
* @hidden
|
|
85
|
+
*/
|
|
82
86
|
outputSchema = {
|
|
83
87
|
type: 'object',
|
|
84
88
|
properties: {
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Trace Output Flow Tool
|
|
3
|
-
*
|
|
4
|
-
* MCP tool that follows the payload of a component's outputs across the
|
|
5
|
-
* template boundary: emit sites, the host bindings and handlers that receive
|
|
6
|
-
* the value, and what the handler methods do with `$event`.
|
|
7
|
-
*
|
|
8
|
-
* @remarks
|
|
9
|
-
* Logic lives in `OutputFlowTracer` (`@angular-modernizer/api`); this tool
|
|
10
|
-
* resolves the project, validates arguments and applies the compact output
|
|
11
|
-
* contract (`maxResults` caps emit sites, bound hosts and unbound hosts per
|
|
12
|
-
* output).
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* // Via MCP:
|
|
17
|
-
* // tool: trace-output-flow
|
|
18
|
-
* // args: { className: 'ItemComponent', output: 'formError', projectRoot: '/project' }
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
1
|
import { type MCPTool, type ToolAnnotations } from '../types.js';
|
|
22
2
|
import { type DynamicResultFlow, type OutputFlow, type OutputFlowResult } from '@angular-modernizer/api';
|
|
23
3
|
import { ProjectCache } from './helpers/project-cache.js';
|
|
24
4
|
/** An output with its lists dropped (summaryOnly) or capped (maxResults). */
|
|
25
|
-
type OutputFlowOutput = Omit<OutputFlow, 'emits' | 'boundIn' | 'unboundIn' | 'subscribedIn'> & Partial<Pick<OutputFlow, 'emits' | 'boundIn' | 'unboundIn' | 'subscribedIn'>> & {
|
|
5
|
+
export type OutputFlowOutput = Omit<OutputFlow, 'emits' | 'boundIn' | 'unboundIn' | 'subscribedIn'> & Partial<Pick<OutputFlow, 'emits' | 'boundIn' | 'unboundIn' | 'subscribedIn'>> & {
|
|
6
|
+
/** `true` when `maxResults` cut one of the lists. */
|
|
26
7
|
truncated: boolean;
|
|
27
8
|
};
|
|
28
9
|
/** The dynamic section with its lists dropped (summaryOnly) or capped (maxResults). */
|
|
29
|
-
type DynamicFlowOutput = Pick<DynamicResultFlow, 'counts'> & Partial<Pick<DynamicResultFlow, 'dataInjections' | 'closeSites' | 'hosts'>> & {
|
|
10
|
+
export type DynamicFlowOutput = Pick<DynamicResultFlow, 'counts'> & Partial<Pick<DynamicResultFlow, 'dataInjections' | 'closeSites' | 'hosts'>> & {
|
|
11
|
+
/** `true` when `maxResults` cut one of the lists. */
|
|
30
12
|
truncated: boolean;
|
|
31
13
|
};
|
|
32
14
|
/**
|
|
33
15
|
* Output of the trace-output-flow tool.
|
|
34
16
|
*/
|
|
35
|
-
interface TraceOutputFlowOutput extends Omit<OutputFlowResult, 'outputs' | 'dynamic'> {
|
|
17
|
+
export interface TraceOutputFlowOutput extends Omit<OutputFlowResult, 'outputs' | 'dynamic'> {
|
|
18
|
+
/** Traced outputs. */
|
|
36
19
|
outputs: OutputFlowOutput[];
|
|
37
20
|
/** Components created in code: data injected, close sites, creation sites with result handlers. */
|
|
38
21
|
dynamic?: DynamicFlowOutput;
|
|
39
22
|
/** `true` when the effect budget or `maxResults` cut a list. */
|
|
40
23
|
truncated: boolean;
|
|
24
|
+
/** Short text summary of the traced flows. */
|
|
41
25
|
summary: string;
|
|
26
|
+
/** The tsconfig whose program was used. */
|
|
42
27
|
tsConfigPath: string;
|
|
43
28
|
/** Conditions that can make the result incomplete (unresolved library imports). */
|
|
44
29
|
warnings?: string[];
|
|
45
30
|
}
|
|
46
31
|
/**
|
|
47
|
-
* MCP tool that
|
|
32
|
+
* MCP tool that follows the payload of a component's outputs across the
|
|
33
|
+
* template boundary: emit sites, the host bindings and handlers that receive
|
|
34
|
+
* the value, and what the handler methods do with `$event`.
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* Logic lives in `OutputFlowTracer` (`@angular-modernizer/api`); this tool
|
|
38
|
+
* resolves the project, validates arguments and applies the compact output
|
|
39
|
+
* contract (`maxResults` caps emit sites, bound hosts and unbound hosts per
|
|
40
|
+
* output).
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* // Via MCP:
|
|
45
|
+
* // tool: trace-output-flow
|
|
46
|
+
* // args: { className: 'ItemComponent', output: 'formError', projectRoot: '/project' }
|
|
47
|
+
* ```
|
|
48
48
|
*/
|
|
49
49
|
export declare class TraceOutputFlowTool implements MCPTool {
|
|
50
50
|
private readonly projects;
|
|
@@ -53,6 +53,10 @@ export declare class TraceOutputFlowTool implements MCPTool {
|
|
|
53
53
|
readonly annotations: ToolAnnotations;
|
|
54
54
|
constructor(projects?: ProjectCache);
|
|
55
55
|
readonly description: string;
|
|
56
|
+
/**
|
|
57
|
+
* JSON Schema of the tool arguments.
|
|
58
|
+
* @hidden
|
|
59
|
+
*/
|
|
56
60
|
readonly inputSchema: {
|
|
57
61
|
type: string;
|
|
58
62
|
additionalProperties: boolean;
|
|
@@ -104,6 +108,10 @@ export declare class TraceOutputFlowTool implements MCPTool {
|
|
|
104
108
|
};
|
|
105
109
|
required: string[];
|
|
106
110
|
};
|
|
111
|
+
/**
|
|
112
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
113
|
+
* @hidden
|
|
114
|
+
*/
|
|
107
115
|
readonly outputSchema: {
|
|
108
116
|
type: string;
|
|
109
117
|
$defs: {
|
|
@@ -787,5 +795,4 @@ export declare class TraceOutputFlowTool implements MCPTool {
|
|
|
787
795
|
private handlerText;
|
|
788
796
|
private effectList;
|
|
789
797
|
}
|
|
790
|
-
export {};
|
|
791
798
|
//# sourceMappingURL=trace-output-flow.d.ts.map
|
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Trace Output Flow Tool
|
|
3
|
-
*
|
|
4
|
-
* MCP tool that follows the payload of a component's outputs across the
|
|
5
|
-
* template boundary: emit sites, the host bindings and handlers that receive
|
|
6
|
-
* the value, and what the handler methods do with `$event`.
|
|
7
|
-
*
|
|
8
|
-
* @remarks
|
|
9
|
-
* Logic lives in `OutputFlowTracer` (`@angular-modernizer/api`); this tool
|
|
10
|
-
* resolves the project, validates arguments and applies the compact output
|
|
11
|
-
* contract (`maxResults` caps emit sites, bound hosts and unbound hosts per
|
|
12
|
-
* output).
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* // Via MCP:
|
|
17
|
-
* // tool: trace-output-flow
|
|
18
|
-
* // args: { className: 'ItemComponent', output: 'formError', projectRoot: '/project' }
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
1
|
import { OutputFlowTracer, } from '@angular-modernizer/api';
|
|
22
2
|
import { existsSync } from 'node:fs';
|
|
23
3
|
import { isAbsolute, resolve } from 'node:path';
|
|
@@ -303,7 +283,22 @@ const DYNAMIC_FLOW_SCHEMA = {
|
|
|
303
283
|
required: ['counts', 'truncated'],
|
|
304
284
|
};
|
|
305
285
|
/**
|
|
306
|
-
* MCP tool that
|
|
286
|
+
* MCP tool that follows the payload of a component's outputs across the
|
|
287
|
+
* template boundary: emit sites, the host bindings and handlers that receive
|
|
288
|
+
* the value, and what the handler methods do with `$event`.
|
|
289
|
+
*
|
|
290
|
+
* @remarks
|
|
291
|
+
* Logic lives in `OutputFlowTracer` (`@angular-modernizer/api`); this tool
|
|
292
|
+
* resolves the project, validates arguments and applies the compact output
|
|
293
|
+
* contract (`maxResults` caps emit sites, bound hosts and unbound hosts per
|
|
294
|
+
* output).
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* ```typescript
|
|
298
|
+
* // Via MCP:
|
|
299
|
+
* // tool: trace-output-flow
|
|
300
|
+
* // args: { className: 'ItemComponent', output: 'formError', projectRoot: '/project' }
|
|
301
|
+
* ```
|
|
307
302
|
*/
|
|
308
303
|
export class TraceOutputFlowTool {
|
|
309
304
|
projects;
|
|
@@ -339,6 +334,10 @@ export class TraceOutputFlowTool {
|
|
|
339
334
|
'dynamic result. For widely used components start with summaryOnly. summaryOnly drops emit sites, ' +
|
|
340
335
|
'host and subscription lists and the dynamic lists, maxResults caps them per output and per dynamic ' +
|
|
341
336
|
'list; counts always cover everything.';
|
|
337
|
+
/**
|
|
338
|
+
* JSON Schema of the tool arguments.
|
|
339
|
+
* @hidden
|
|
340
|
+
*/
|
|
342
341
|
inputSchema = {
|
|
343
342
|
type: 'object',
|
|
344
343
|
additionalProperties: false,
|
|
@@ -385,6 +384,10 @@ export class TraceOutputFlowTool {
|
|
|
385
384
|
},
|
|
386
385
|
required: ['projectRoot'],
|
|
387
386
|
};
|
|
387
|
+
/**
|
|
388
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
389
|
+
* @hidden
|
|
390
|
+
*/
|
|
388
391
|
outputSchema = {
|
|
389
392
|
type: 'object',
|
|
390
393
|
$defs: OUTPUT_FLOW_DEFS,
|