@angular-modernizer/adapter-mcp 2.0.0 → 2.1.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/CHANGELOG.md +45 -0
- package/README.md +3 -1
- package/dist/cli.js +6 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -0
- package/dist/server/build-staleness.d.ts +92 -0
- package/dist/server/build-staleness.js +159 -0
- package/dist/server/limited-stdio-transport.js +28 -1
- package/dist/server/sdk-server.d.ts +6 -0
- package/dist/server/sdk-server.js +21 -2
- package/dist/server/tool-registry.d.ts +2 -1
- package/dist/server/tool-registry.js +8 -2
- package/dist/tools/analyze-project.d.ts +26 -1
- package/dist/tools/analyze-project.js +8 -3
- package/dist/tools/compare-health.d.ts +40 -4
- package/dist/tools/compare-health.js +22 -5
- package/dist/tools/helpers/analysis-output.js +3 -0
- package/dist/tools/helpers/health-delta.d.ts +6 -0
- package/dist/tools/helpers/health-delta.js +4 -1
- package/dist/tools/helpers/library-import-warning.d.ts +33 -0
- package/dist/tools/helpers/library-import-warning.js +38 -0
- package/dist/tools/helpers/library-imports.d.ts +38 -14
- package/dist/tools/helpers/library-imports.js +128 -23
- package/dist/tools/helpers/output-contract.d.ts +24 -2
- package/dist/tools/helpers/output-contract.js +15 -2
- package/dist/tools/helpers/refresh-apply.js +1 -1
- package/dist/tools/helpers/refresh-inventory.d.ts +1 -1
- package/dist/tools/helpers/refresh-inventory.js +24 -3
- package/dist/tools/helpers/scan-cache.d.ts +45 -2
- package/dist/tools/helpers/scan-cache.js +47 -2
- package/dist/tools/helpers/scan-engine.d.ts +13 -0
- package/dist/tools/helpers/scan-engine.js +10 -0
- package/dist/tools/learn-patterns.js +6 -6
- package/dist/tools/list-imports.d.ts +1 -1
- package/dist/tools/refresh-state.js +1 -1
- package/dist/tools/scan-all.d.ts +7 -1
- package/dist/tools/scan-all.js +8 -13
- package/dist/tools/scan-angular.d.ts +7 -1
- package/dist/tools/scan-angular.js +7 -2
- package/dist/tools/scan-architecture.d.ts +8 -0
- package/dist/tools/scan-architecture.js +25 -14
- package/dist/tools/scan-solid.d.ts +7 -1
- package/dist/tools/scan-solid.js +7 -2
- package/dist/tools/server-status.d.ts +6 -24
- package/dist/tools/server-status.js +9 -57
- package/package.json +11 -11
|
@@ -1,27 +1,9 @@
|
|
|
1
1
|
import { type MCPTool, type ToolAnnotations } from '../types.js';
|
|
2
2
|
import { type ServerRuntimeStats } from '../server/mcp-server.js';
|
|
3
|
+
import { BuildStaleness, type DistDirectory, type DistPackageState } from '../server/build-staleness.js';
|
|
3
4
|
import { type ScanHostStatus } from '../scan-host/scan-host.js';
|
|
4
5
|
import { type CachedProjectInfo, type EvictionStats, type ProjectCache } from './helpers/project-cache.js';
|
|
5
|
-
|
|
6
|
-
export interface DistDirectory {
|
|
7
|
-
/** Package folder name, e.g. `core`. */
|
|
8
|
-
name: string;
|
|
9
|
-
/** Absolute path of the package's `dist/` directory. */
|
|
10
|
-
dir: string;
|
|
11
|
-
}
|
|
12
|
-
/** Build state of one package. */
|
|
13
|
-
export interface DistPackageState {
|
|
14
|
-
/** Package folder name. */
|
|
15
|
-
name: string;
|
|
16
|
-
/** Absolute path of the package's `dist/` directory. */
|
|
17
|
-
dir: string;
|
|
18
|
-
/** Newest `.js` mtime when the server started. */
|
|
19
|
-
builtAtStart?: string;
|
|
20
|
-
/** Newest `.js` mtime now. */
|
|
21
|
-
builtNow?: string;
|
|
22
|
-
/** The newest `.js` mtime changed since the server started. */
|
|
23
|
-
rebuilt: boolean;
|
|
24
|
-
}
|
|
6
|
+
export type { DistDirectory, DistPackageState } from '../server/build-staleness.js';
|
|
25
7
|
/** Output of the server-status tool. */
|
|
26
8
|
export interface ServerStatusOutput {
|
|
27
9
|
/** The server process. */
|
|
@@ -108,7 +90,6 @@ export interface ServerStatusOutput {
|
|
|
108
90
|
export declare class ServerStatusTool implements MCPTool {
|
|
109
91
|
private readonly projects;
|
|
110
92
|
private readonly runtime;
|
|
111
|
-
private readonly distDirectories;
|
|
112
93
|
private readonly scanWorkers;
|
|
113
94
|
readonly name = "server-status";
|
|
114
95
|
readonly title = "Server Status";
|
|
@@ -448,14 +429,15 @@ export declare class ServerStatusTool implements MCPTool {
|
|
|
448
429
|
};
|
|
449
430
|
required: string[];
|
|
450
431
|
};
|
|
451
|
-
private readonly
|
|
432
|
+
private readonly build;
|
|
452
433
|
/**
|
|
453
434
|
* @param projects - The project cache shared by the investigation tools.
|
|
454
435
|
* @param runtime - Server start time, tool count, response sizes and protocol.
|
|
455
|
-
* @param distDirectories - Package `dist/` directories to watch
|
|
436
|
+
* @param distDirectories - Package `dist/` directories to watch (missing ones are skipped), or the
|
|
437
|
+
* tracker `cli.ts` shares with the stale-build warning of every answer.
|
|
456
438
|
* @param scanWorkers - State of the scan workers; default the server's scan host.
|
|
457
439
|
*/
|
|
458
|
-
constructor(projects: ProjectCache, runtime: () => ServerRuntimeStats, distDirectories?: readonly DistDirectory[], scanWorkers?: () => ScanHostStatus);
|
|
440
|
+
constructor(projects: ProjectCache, runtime: () => ServerRuntimeStats, distDirectories?: readonly DistDirectory[] | BuildStaleness, scanWorkers?: () => ScanHostStatus);
|
|
459
441
|
execute(_args: Record<string, unknown>): Promise<ServerStatusOutput>;
|
|
460
442
|
private buildSummary;
|
|
461
443
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { existsSync, readdirSync, statSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
1
|
import { getHeapStatistics } from 'node:v8';
|
|
4
2
|
import { PACKAGE_VERSION } from '../server/package-version.js';
|
|
3
|
+
import { BuildStaleness, } from '../server/build-staleness.js';
|
|
5
4
|
import { describeScanHost } from '../scan-host/scan-host.js';
|
|
6
5
|
import { toMB, } from './helpers/project-cache.js';
|
|
7
6
|
const BYTES_PER_MB = 1024 * 1024;
|
|
@@ -33,39 +32,6 @@ function formatBytes(bytes) {
|
|
|
33
32
|
? `${(bytes / 1024).toFixed(1)} KB`
|
|
34
33
|
: `${toMB(bytes)} MB`;
|
|
35
34
|
}
|
|
36
|
-
/** Newest `.js` mtime under `dir` in ms, or undefined when there is none. */
|
|
37
|
-
function newestJsMtime(dir) {
|
|
38
|
-
let newest;
|
|
39
|
-
const stack = [dir];
|
|
40
|
-
while (stack.length > 0) {
|
|
41
|
-
const current = stack.pop();
|
|
42
|
-
if (current === undefined) {
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
let entries;
|
|
46
|
-
try {
|
|
47
|
-
entries = readdirSync(current, { withFileTypes: true });
|
|
48
|
-
}
|
|
49
|
-
catch {
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
for (const entry of entries) {
|
|
53
|
-
const full = join(current, entry.name);
|
|
54
|
-
if (entry.isDirectory()) {
|
|
55
|
-
stack.push(full);
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
if (entry.name.endsWith('.js')) {
|
|
59
|
-
const mtime = statSync(full).mtimeMs;
|
|
60
|
-
newest = newest === undefined ? mtime : Math.max(newest, mtime);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return newest;
|
|
65
|
-
}
|
|
66
|
-
function iso(ms) {
|
|
67
|
-
return ms === undefined ? undefined : new Date(ms).toISOString();
|
|
68
|
-
}
|
|
69
35
|
/**
|
|
70
36
|
* MCP tool that reports on the running server itself: memory, uptime, the
|
|
71
37
|
* negotiated protocol era and revision, the ts-morph projects held in the
|
|
@@ -89,7 +55,6 @@ function iso(ms) {
|
|
|
89
55
|
export class ServerStatusTool {
|
|
90
56
|
projects;
|
|
91
57
|
runtime;
|
|
92
|
-
distDirectories;
|
|
93
58
|
scanWorkers;
|
|
94
59
|
name = 'server-status';
|
|
95
60
|
title = 'Server Status';
|
|
@@ -297,39 +262,26 @@ export class ServerStatusTool {
|
|
|
297
262
|
},
|
|
298
263
|
required: ['process', 'server', 'projects', 'scanWorkers', 'build', 'summary'],
|
|
299
264
|
};
|
|
300
|
-
|
|
265
|
+
build;
|
|
301
266
|
/**
|
|
302
267
|
* @param projects - The project cache shared by the investigation tools.
|
|
303
268
|
* @param runtime - Server start time, tool count, response sizes and protocol.
|
|
304
|
-
* @param distDirectories - Package `dist/` directories to watch
|
|
269
|
+
* @param distDirectories - Package `dist/` directories to watch (missing ones are skipped), or the
|
|
270
|
+
* tracker `cli.ts` shares with the stale-build warning of every answer.
|
|
305
271
|
* @param scanWorkers - State of the scan workers; default the server's scan host.
|
|
306
272
|
*/
|
|
307
273
|
constructor(projects, runtime, distDirectories = [], scanWorkers = describeScanHost) {
|
|
308
274
|
this.projects = projects;
|
|
309
275
|
this.runtime = runtime;
|
|
310
|
-
this.distDirectories = distDirectories;
|
|
311
276
|
this.scanWorkers = scanWorkers;
|
|
312
|
-
this.
|
|
313
|
-
|
|
314
|
-
|
|
277
|
+
this.build =
|
|
278
|
+
distDirectories instanceof BuildStaleness
|
|
279
|
+
? distDirectories
|
|
280
|
+
: new BuildStaleness(distDirectories);
|
|
315
281
|
}
|
|
316
282
|
async execute(_args) {
|
|
317
283
|
const memory = process.memoryUsage();
|
|
318
|
-
const packages = this.
|
|
319
|
-
.filter((d) => this.baseline.has(d.dir))
|
|
320
|
-
.map((d) => {
|
|
321
|
-
const atStart = this.baseline.get(d.dir);
|
|
322
|
-
const now = newestJsMtime(d.dir);
|
|
323
|
-
const builtAtStart = iso(atStart);
|
|
324
|
-
const builtNow = iso(now);
|
|
325
|
-
return {
|
|
326
|
-
name: d.name,
|
|
327
|
-
dir: d.dir,
|
|
328
|
-
...(builtAtStart === undefined ? {} : { builtAtStart }),
|
|
329
|
-
...(builtNow === undefined ? {} : { builtNow }),
|
|
330
|
-
rebuilt: now !== undefined && (atStart === undefined || now > atStart),
|
|
331
|
-
};
|
|
332
|
-
});
|
|
284
|
+
const packages = this.build.packages();
|
|
333
285
|
const result = {
|
|
334
286
|
process: {
|
|
335
287
|
pid: process.pid,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-modernizer/adapter-mcp",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "MCP Server to expose Angular Modernizer tools to an AI assistant.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -32,16 +32,16 @@
|
|
|
32
32
|
"glob": "^11.0.3",
|
|
33
33
|
"ts-morph": "^27.0.2",
|
|
34
34
|
"zod": "^4.6.5",
|
|
35
|
-
"@angular-modernizer/api": "2.
|
|
36
|
-
"@angular-modernizer/orchestration": "2.
|
|
37
|
-
"@angular-modernizer/
|
|
38
|
-
"@angular-modernizer/
|
|
39
|
-
"@angular-modernizer/plugin-
|
|
40
|
-
"@angular-modernizer/plugin-
|
|
41
|
-
"@angular-modernizer/plugin-
|
|
42
|
-
"@angular-modernizer/plugin-
|
|
43
|
-
"@angular-modernizer/worker": "2.
|
|
44
|
-
"@angular-modernizer/plugin-
|
|
35
|
+
"@angular-modernizer/api": "2.1.1",
|
|
36
|
+
"@angular-modernizer/orchestration": "2.1.1",
|
|
37
|
+
"@angular-modernizer/core": "2.1.1",
|
|
38
|
+
"@angular-modernizer/plugin-analyzer": "2.1.1",
|
|
39
|
+
"@angular-modernizer/plugin-angular": "2.1.1",
|
|
40
|
+
"@angular-modernizer/plugin-architecture": "2.1.1",
|
|
41
|
+
"@angular-modernizer/plugin-solid": "2.1.1",
|
|
42
|
+
"@angular-modernizer/plugin-standalone": "2.1.1",
|
|
43
|
+
"@angular-modernizer/worker": "2.1.1",
|
|
44
|
+
"@angular-modernizer/plugin-system": "2.1.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/express": "^4.17.13",
|