@angular-modernizer/adapter-mcp 1.0.0 → 1.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.
Files changed (131) hide show
  1. package/README.md +81 -65
  2. package/dist/cli.js +8 -0
  3. package/dist/core/project-analyzer.d.ts +3 -12
  4. package/dist/core/project-analyzer.js +3 -12
  5. package/dist/index.d.ts +118 -3
  6. package/dist/index.js +46 -3
  7. package/dist/mcp-watcher.d.ts +28 -8
  8. package/dist/mcp-watcher.js +7 -7
  9. package/dist/scan-host/scan-host.d.ts +119 -0
  10. package/dist/scan-host/scan-host.js +376 -0
  11. package/dist/scan-host/scan-protocol.d.ts +35 -0
  12. package/dist/scan-host/scan-protocol.js +6 -0
  13. package/dist/scan-host/scan-worker.d.ts +14 -0
  14. package/dist/scan-host/scan-worker.js +48 -0
  15. package/dist/server/limited-stdio-transport.d.ts +7 -0
  16. package/dist/server/mcp-server.d.ts +11 -7
  17. package/dist/server/mcp-server.js +4 -7
  18. package/dist/server/sdk-server.d.ts +1 -0
  19. package/dist/server/tool-registry.d.ts +3 -7
  20. package/dist/server/tool-registry.js +1 -7
  21. package/dist/streaming/progress-store.d.ts +22 -5
  22. package/dist/streaming/progress-store.js +9 -5
  23. package/dist/tools/analyze-build-impact.d.ts +58 -36
  24. package/dist/tools/analyze-build-impact.js +36 -29
  25. package/dist/tools/analyze-core-to-shared.d.ts +42 -12
  26. package/dist/tools/analyze-core-to-shared.js +11 -10
  27. package/dist/tools/analyze-parser-performance.d.ts +23 -22
  28. package/dist/tools/analyze-parser-performance.js +20 -18
  29. package/dist/tools/analyze-project.d.ts +87 -14
  30. package/dist/tools/analyze-project.js +140 -122
  31. package/dist/tools/check-incremental-compatibility.d.ts +13 -11
  32. package/dist/tools/check-incremental-compatibility.js +11 -8
  33. package/dist/tools/collect-feedback.d.ts +41 -26
  34. package/dist/tools/collect-feedback.js +32 -23
  35. package/dist/tools/compare-health.d.ts +76 -19
  36. package/dist/tools/compare-health.js +26 -19
  37. package/dist/tools/extract-libraries.d.ts +44 -20
  38. package/dist/tools/extract-libraries.js +16 -17
  39. package/dist/tools/find-angular-symbol.d.ts +27 -25
  40. package/dist/tools/find-angular-symbol.js +19 -16
  41. package/dist/tools/find-component-hosts.d.ts +33 -27
  42. package/dist/tools/find-component-hosts.js +27 -24
  43. package/dist/tools/find-usages.d.ts +25 -23
  44. package/dist/tools/find-usages.js +21 -18
  45. package/dist/tools/get-bootstrap-execution.d.ts +35 -27
  46. package/dist/tools/get-bootstrap-execution.js +28 -25
  47. package/dist/tools/get-call-graph.d.ts +19 -14
  48. package/dist/tools/get-call-graph.js +26 -23
  49. package/dist/tools/get-operation-progress-tool.d.ts +12 -6
  50. package/dist/tools/get-operation-progress-tool.js +11 -6
  51. package/dist/tools/get-operation-progress.d.ts +26 -0
  52. package/dist/tools/helpers/analysis-output.d.ts +5 -0
  53. package/dist/tools/helpers/batch-kernel.d.ts +14 -0
  54. package/dist/tools/helpers/batch-kernel.js +12 -0
  55. package/dist/tools/helpers/compact-output.d.ts +2 -1
  56. package/dist/tools/helpers/compact-output.js +2 -1
  57. package/dist/tools/helpers/health-delta.d.ts +27 -14
  58. package/dist/tools/helpers/health-delta.js +11 -14
  59. package/dist/tools/helpers/project-cache.d.ts +123 -36
  60. package/dist/tools/helpers/project-cache.js +227 -43
  61. package/dist/tools/helpers/rule-runner.d.ts +23 -16
  62. package/dist/tools/helpers/rule-runner.js +24 -17
  63. package/dist/tools/helpers/scan-engine.d.ts +107 -0
  64. package/dist/tools/helpers/scan-engine.js +197 -0
  65. package/dist/tools/helpers/scan-plan.d.ts +1 -1
  66. package/dist/tools/helpers/scan-plan.js +1 -1
  67. package/dist/tools/helpers/suggestion-generator.d.ts +9 -13
  68. package/dist/tools/helpers/suggestion-generator.js +0 -12
  69. package/dist/tools/helpers/tool-cache.d.ts +11 -0
  70. package/dist/tools/helpers/tool-cache.js +15 -0
  71. package/dist/tools/helpers/tool-context.d.ts +11 -8
  72. package/dist/tools/helpers/tool-context.js +5 -8
  73. package/dist/tools/inspect-form-group.d.ts +34 -27
  74. package/dist/tools/inspect-form-group.js +27 -24
  75. package/dist/tools/inspect-i18n.d.ts +31 -25
  76. package/dist/tools/inspect-i18n.js +23 -20
  77. package/dist/tools/inspect-template.d.ts +32 -25
  78. package/dist/tools/inspect-template.js +26 -23
  79. package/dist/tools/learn-patterns.d.ts +88 -12
  80. package/dist/tools/learn-patterns.js +17 -11
  81. package/dist/tools/list-imports.d.ts +45 -28
  82. package/dist/tools/list-imports.js +26 -23
  83. package/dist/tools/orchestrate-migration.d.ts +31 -9
  84. package/dist/tools/orchestrate-migration.js +12 -7
  85. package/dist/tools/parse-stack-trace.d.ts +23 -21
  86. package/dist/tools/parse-stack-trace.js +10 -7
  87. package/dist/tools/plan-migration.d.ts +67 -27
  88. package/dist/tools/plan-migration.js +22 -21
  89. package/dist/tools/resolve-type.d.ts +20 -10
  90. package/dist/tools/resolve-type.js +21 -13
  91. package/dist/tools/review-feedback.d.ts +27 -24
  92. package/dist/tools/review-feedback.js +24 -20
  93. package/dist/tools/rollback-changes.d.ts +13 -9
  94. package/dist/tools/rollback-changes.js +10 -7
  95. package/dist/tools/run-angular-cli.d.ts +12 -10
  96. package/dist/tools/run-angular-cli.js +11 -8
  97. package/dist/tools/run-build.d.ts +13 -11
  98. package/dist/tools/run-build.js +11 -8
  99. package/dist/tools/run-schematic.d.ts +12 -10
  100. package/dist/tools/run-schematic.js +11 -8
  101. package/dist/tools/scan-all.d.ts +69 -12
  102. package/dist/tools/scan-all.js +55 -122
  103. package/dist/tools/scan-angular.d.ts +41 -9
  104. package/dist/tools/scan-angular.js +66 -135
  105. package/dist/tools/scan-architecture.d.ts +75 -14
  106. package/dist/tools/scan-architecture.js +180 -185
  107. package/dist/tools/scan-solid.d.ts +40 -9
  108. package/dist/tools/scan-solid.js +64 -133
  109. package/dist/tools/search-codebase.d.ts +32 -26
  110. package/dist/tools/search-codebase.js +15 -12
  111. package/dist/tools/server-status.d.ts +116 -24
  112. package/dist/tools/server-status.js +85 -26
  113. package/dist/tools/suggest-improvements.d.ts +22 -19
  114. package/dist/tools/suggest-improvements.js +21 -17
  115. package/dist/tools/trace-output-flow.d.ts +34 -27
  116. package/dist/tools/trace-output-flow.js +27 -24
  117. package/dist/tools/transform-code.d.ts +71 -10
  118. package/dist/tools/transform-code.js +148 -54
  119. package/dist/tools/validate-before-transform.d.ts +24 -9
  120. package/dist/tools/validate-before-transform.js +10 -7
  121. package/dist/tools/validate-project-compatibility.d.ts +18 -13
  122. package/dist/tools/validate-project-compatibility.js +17 -11
  123. package/dist/tools/validate-transformation.d.ts +28 -11
  124. package/dist/tools/validate-transformation.js +14 -8
  125. package/dist/tools/verify-citations.d.ts +37 -16
  126. package/dist/tools/verify-citations.js +19 -16
  127. package/dist/types.d.ts +40 -10
  128. package/dist/types.js +0 -5
  129. package/package.json +12 -18
  130. package/dist/tools/shared/scan-types.d.ts +0 -200
  131. package/dist/tools/shared/scan-types.js +0 -7
@@ -1,6 +1,14 @@
1
+ import { type MCPTool, type ToolAnnotations, type ToolContext } from '../types.js';
2
+ import { type CallGraphResult } from '@angular-modernizer/api';
3
+ import { ProjectCache } from './helpers/project-cache.js';
4
+ /** Tool output: the call graph (trees omitted with `summaryOnly`) plus a text summary. */
5
+ export type GetCallGraphOutput = Omit<CallGraphResult, 'callers' | 'callees'> & Partial<Pick<CallGraphResult, 'callers' | 'callees'>> & {
6
+ /** Short text summary with the direct callers and callees. */
7
+ summary: string;
8
+ /** Conditions that can make the result incomplete (unresolved library imports). */
9
+ warnings?: string[];
10
+ };
1
11
  /**
2
- * @angular-modernizer/adapter-mcp - Get Call Graph Tool
3
- *
4
12
  * MCP tool for building a caller/callee graph for a named method, function,
5
13
  * constructor, get/set accessor or arrow-function property.
6
14
  * Supports configurable traversal direction and depth.
@@ -24,17 +32,6 @@
24
32
  * // projectRoot: '/project', direction: 'down', depth: 4 }
25
33
  * ```
26
34
  */
27
- import { type MCPTool, type ToolAnnotations } from '../types.js';
28
- import { type CallGraphResult } from '@angular-modernizer/api';
29
- import { ProjectCache } from './helpers/project-cache.js';
30
- /** Tool output: the call graph (trees omitted with `summaryOnly`) plus a text summary. */
31
- export type GetCallGraphOutput = Omit<CallGraphResult, 'callers' | 'callees'> & Partial<Pick<CallGraphResult, 'callers' | 'callees'>> & {
32
- summary: string;
33
- warnings?: string[];
34
- };
35
- /**
36
- * MCP tool that builds a call graph for a named method or function.
37
- */
38
35
  export declare class GetCallGraphTool implements MCPTool {
39
36
  private readonly projects;
40
37
  readonly name = "get-call-graph";
@@ -42,6 +39,10 @@ export declare class GetCallGraphTool implements MCPTool {
42
39
  readonly annotations: ToolAnnotations;
43
40
  constructor(projects?: ProjectCache);
44
41
  readonly description: string;
42
+ /**
43
+ * JSON Schema of the tool arguments.
44
+ * @hidden
45
+ */
45
46
  readonly inputSchema: {
46
47
  type: string;
47
48
  additionalProperties: boolean;
@@ -87,6 +88,10 @@ export declare class GetCallGraphTool implements MCPTool {
87
88
  };
88
89
  required: string[];
89
90
  };
91
+ /**
92
+ * JSON Schema of the tool result (`structuredContent`).
93
+ * @hidden
94
+ */
90
95
  readonly outputSchema: {
91
96
  type: string;
92
97
  $defs: {
@@ -186,7 +191,7 @@ export declare class GetCallGraphTool implements MCPTool {
186
191
  };
187
192
  required: string[];
188
193
  };
189
- execute(args: Record<string, unknown>): Promise<GetCallGraphOutput>;
194
+ execute(args: Record<string, unknown>, ctx?: ToolContext): Promise<GetCallGraphOutput>;
190
195
  private buildSummary;
191
196
  /**
192
197
  * Summary lines for the direct callers or callees, at most
@@ -1,6 +1,20 @@
1
+ import { CallGraphBuilder, } from '@angular-modernizer/api';
2
+ import { existsSync } from 'node:fs';
3
+ import { findTsConfig } from './helpers/find-ts-config.js';
4
+ import { ProjectCache, acquireProject } from './helpers/project-cache.js';
5
+ import { WARNINGS_OUTPUT_SCHEMA, withWarnings, } from './helpers/output-contract.js';
6
+ /** Direct callers and callees spelled out per list in the summary. */
7
+ const SUMMARY_MAX_NODES = 50;
8
+ const CALL_NODE_FIELDS = {
9
+ name: { type: 'string' },
10
+ file: { type: 'string' },
11
+ line: { type: 'integer' },
12
+ kind: { type: 'string' },
13
+ className: { type: 'string' },
14
+ snippet: { type: 'string' },
15
+ inheritedFrom: { type: 'string' },
16
+ };
1
17
  /**
2
- * @angular-modernizer/adapter-mcp - Get Call Graph Tool
3
- *
4
18
  * MCP tool for building a caller/callee graph for a named method, function,
5
19
  * constructor, get/set accessor or arrow-function property.
6
20
  * Supports configurable traversal direction and depth.
@@ -24,25 +38,6 @@
24
38
  * // projectRoot: '/project', direction: 'down', depth: 4 }
25
39
  * ```
26
40
  */
27
- import { CallGraphBuilder, } from '@angular-modernizer/api';
28
- import { existsSync } from 'node:fs';
29
- import { findTsConfig } from './helpers/find-ts-config.js';
30
- import { ProjectCache } from './helpers/project-cache.js';
31
- import { WARNINGS_OUTPUT_SCHEMA, withWarnings, } from './helpers/output-contract.js';
32
- /** Direct callers and callees spelled out per list in the summary. */
33
- const SUMMARY_MAX_NODES = 50;
34
- const CALL_NODE_FIELDS = {
35
- name: { type: 'string' },
36
- file: { type: 'string' },
37
- line: { type: 'integer' },
38
- kind: { type: 'string' },
39
- className: { type: 'string' },
40
- snippet: { type: 'string' },
41
- inheritedFrom: { type: 'string' },
42
- };
43
- /**
44
- * MCP tool that builds a call graph for a named method or function.
45
- */
46
41
  export class GetCallGraphTool {
47
42
  projects;
48
43
  name = 'get-call-graph';
@@ -71,6 +66,10 @@ export class GetCallGraphTool {
71
66
  '(className of the subclass, inheritedFrom of the declaring class; a subclass overriding it is left out). ' +
72
67
  'Use method "ClassName.constructor" to see what runs transitively during construction. ' +
73
68
  'Use after parse-stack-trace to trace error propagation through the call hierarchy.';
69
+ /**
70
+ * JSON Schema of the tool arguments.
71
+ * @hidden
72
+ */
74
73
  inputSchema = {
75
74
  type: 'object',
76
75
  additionalProperties: false,
@@ -119,6 +118,10 @@ export class GetCallGraphTool {
119
118
  },
120
119
  required: ['method', 'file', 'projectRoot'],
121
120
  };
121
+ /**
122
+ * JSON Schema of the tool result (`structuredContent`).
123
+ * @hidden
124
+ */
122
125
  outputSchema = {
123
126
  type: 'object',
124
127
  $defs: {
@@ -147,7 +150,7 @@ export class GetCallGraphTool {
147
150
  },
148
151
  required: ['target', 'nodeCount', 'truncated', 'summary'],
149
152
  };
150
- async execute(args) {
153
+ async execute(args, ctx = {}) {
151
154
  const params = args;
152
155
  if (!params.method) {
153
156
  throw new Error('method is required');
@@ -169,7 +172,7 @@ export class GetCallGraphTool {
169
172
  (!Number.isInteger(params.maxNodes) || params.maxNodes < 1)) {
170
173
  throw new Error('maxNodes must be a positive integer');
171
174
  }
172
- const graphBuilder = new CallGraphBuilder(this.projects.get(tsConfigPath));
175
+ const graphBuilder = new CallGraphBuilder((await acquireProject(this.projects, tsConfigPath, ctx)));
173
176
  const warnings = this.projects.warnings(tsConfigPath);
174
177
  const options = {
175
178
  direction: params.direction ?? 'both',
@@ -1,19 +1,20 @@
1
- /**
2
- * @angular-modernizer/adapter-mcp - Get Operation Progress Tool
3
- *
4
- * MCP tool for querying progress of streaming operations.
5
- */
6
1
  import type { MCPTool, ToolAnnotations } from '../types.js';
7
2
  import { getOperationProgress } from './get-operation-progress.js';
8
3
  type OperationProgress = Awaited<ReturnType<typeof getOperationProgress>>;
9
4
  /**
10
- * MCP tool for getting operation progress.
5
+ * MCP tool for querying the progress of streaming operations (deprecated, kept
6
+ * in 1.x): polls an operation started with `streaming: true` by transform-code
7
+ * or scan-architecture.
11
8
  */
12
9
  export declare class GetOperationProgressTool implements MCPTool {
13
10
  readonly name = "get-operation-progress";
14
11
  readonly title = "Get Operation Progress";
15
12
  readonly annotations: ToolAnnotations;
16
13
  readonly description: string;
14
+ /**
15
+ * JSON Schema of the tool arguments.
16
+ * @hidden
17
+ */
17
18
  readonly inputSchema: {
18
19
  type: string;
19
20
  additionalProperties: boolean;
@@ -29,6 +30,10 @@ export declare class GetOperationProgressTool implements MCPTool {
29
30
  };
30
31
  required: string[];
31
32
  };
33
+ /**
34
+ * JSON Schema of the tool result (`structuredContent`).
35
+ * @hidden
36
+ */
32
37
  readonly outputSchema: {
33
38
  type: string;
34
39
  properties: {
@@ -134,6 +139,7 @@ export declare class GetOperationProgressTool implements MCPTool {
134
139
  required: string[];
135
140
  };
136
141
  execute(args: Record<string, unknown>): Promise<OperationProgress & {
142
+ /** Short text with the status, the last event and the result summary. */
137
143
  summary: string;
138
144
  }>;
139
145
  }
@@ -1,8 +1,3 @@
1
- /**
2
- * @angular-modernizer/adapter-mcp - Get Operation Progress Tool
3
- *
4
- * MCP tool for querying progress of streaming operations.
5
- */
6
1
  import { getOperationProgress, validateInput, } from './get-operation-progress.js';
7
2
  /**
8
3
  * Text summary: status, time, events, the last event, and the stored result's
@@ -34,7 +29,9 @@ function describeProgress(progress) {
34
29
  return lines.join('\n');
35
30
  }
36
31
  /**
37
- * MCP tool for getting operation progress.
32
+ * MCP tool for querying the progress of streaming operations (deprecated, kept
33
+ * in 1.x): polls an operation started with `streaming: true` by transform-code
34
+ * or scan-architecture.
38
35
  */
39
36
  export class GetOperationProgressTool {
40
37
  name = 'get-operation-progress';
@@ -51,6 +48,10 @@ export class GetOperationProgressTool {
51
48
  'Get progress for a streaming operation (transformation or analysis). ' +
52
49
  'Returns status, events, and operation metadata including diffs and syntax errors. ' +
53
50
  'A completed operation carries the tool result in result; summary is a short text with the status, the last event and the result summary.';
51
+ /**
52
+ * JSON Schema of the tool arguments.
53
+ * @hidden
54
+ */
54
55
  inputSchema = {
55
56
  type: 'object',
56
57
  additionalProperties: false,
@@ -66,6 +67,10 @@ export class GetOperationProgressTool {
66
67
  },
67
68
  required: ['operationId'],
68
69
  };
70
+ /**
71
+ * JSON Schema of the tool result (`structuredContent`).
72
+ * @hidden
73
+ */
69
74
  outputSchema = {
70
75
  type: 'object',
71
76
  properties: {
@@ -17,35 +17,61 @@ export declare function validateInput(input: unknown): GetOperationProgressInput
17
17
  * Returns status, events, and operation metadata
18
18
  */
19
19
  export declare function getOperationProgress(input: GetOperationProgressInput): Promise<{
20
+ /** Operation id. */
20
21
  operationId: string;
22
+ /** Lifecycle status of the operation. */
21
23
  status: 'running' | 'completed' | 'failed' | 'cancelled';
24
+ /** Progress events, only those after `sinceTimestamp` when given. */
22
25
  events: {
26
+ /** Phase of the operation. */
23
27
  phase: string;
28
+ /** Progress message. */
24
29
  message: string;
30
+ /** Progress in percent (0 to 100). */
25
31
  percentage: number;
32
+ /** Time of the event in milliseconds since the epoch. */
26
33
  timestamp: number;
34
+ /** Unified diff of a transformed file. */
27
35
  unifiedDiff?: {
36
+ /** Path of the changed file. */
28
37
  filePath: string;
38
+ /** Diff text in unified format. */
29
39
  diff: string;
40
+ /** Number of added lines. */
30
41
  linesAdded: number;
42
+ /** Number of removed lines. */
31
43
  linesRemoved: number;
32
44
  };
45
+ /** Syntax errors found in transformed code. */
33
46
  syntaxErrors?: {
47
+ /** File with the error. */
34
48
  filePath: string;
49
+ /** Line of the error. */
35
50
  line: number;
51
+ /** Error message. */
36
52
  message: string;
37
53
  }[];
54
+ /** Memory usage of the process at the event. */
38
55
  memoryUsage?: {
56
+ /** V8 heap in use, bytes. */
39
57
  heapUsed: number;
58
+ /** V8 heap allocated, bytes. */
40
59
  heapTotal: number;
60
+ /** Memory of C++ objects bound to JavaScript objects, bytes. */
41
61
  external: number;
62
+ /** Heap in use as percent of the heap allocated. */
42
63
  percentage: number;
43
64
  };
44
65
  }[];
66
+ /** Number of all events of the operation, regardless of `sinceTimestamp`. */
45
67
  totalEvents: number;
68
+ /** Milliseconds since the operation started. */
46
69
  elapsedTime: number;
70
+ /** Estimated milliseconds until completion; only for running operations with progress. */
47
71
  eta?: number;
72
+ /** Error message of a failed operation. */
48
73
  error?: string;
74
+ /** Stored result of a completed operation. */
49
75
  result?: unknown;
50
76
  }>;
51
77
  //# sourceMappingURL=get-operation-progress.d.ts.map
@@ -47,10 +47,15 @@ export declare function countList(counts: Record<string, number>, max: number):
47
47
  export declare function pageNote(pagination: Pagination | undefined, noun: string): string | undefined;
48
48
  /** Counts of a scan over all violations, independent of the page. */
49
49
  export interface ScanCounts {
50
+ /** Number of all violations. */
50
51
  totalViolations: number;
52
+ /** Number of analyzed files. */
51
53
  analyzedFiles: number;
54
+ /** Violations per severity. */
52
55
  bySeverity: Record<string, number>;
56
+ /** Violations per category. */
53
57
  byCategory: Record<string, number>;
58
+ /** Violations per rule id. */
54
59
  byRule: Record<string, number>;
55
60
  }
56
61
  /** Fields of a scan violation the summary names. */
@@ -0,0 +1,14 @@
1
+ /**
2
+ * One kernel for all files of a transform-code batch. The batch used to build
3
+ * a kernel per file, and each kernel loads the whole tsconfig program: about
4
+ * 3 s per file on a 330-file package, about 8 s on a large app.
5
+ *
6
+ * The kernel loads on the first task. Tasks run one after another even when
7
+ * the batch runs files in parallel, because they share one ts-morph project.
8
+ * A failed load fails every task with the same error.
9
+ */
10
+ export interface BatchKernel<K> {
11
+ run<T>(task: (kernel: K) => Promise<T>): Promise<T>;
12
+ }
13
+ export declare function createBatchKernel<K>(load: () => Promise<K>): BatchKernel<K>;
14
+ //# sourceMappingURL=batch-kernel.d.ts.map
@@ -0,0 +1,12 @@
1
+ export function createBatchKernel(load) {
2
+ let kernel;
3
+ let queue = Promise.resolve();
4
+ return {
5
+ run(task) {
6
+ const next = queue.then(async () => task(await (kernel ??= load())));
7
+ queue = next.catch(() => undefined);
8
+ return next;
9
+ },
10
+ };
11
+ }
12
+ //# sourceMappingURL=batch-kernel.js.map
@@ -12,7 +12,8 @@
12
12
  * `truncated: true` when anything was cut. Counts always describe the full
13
13
  * result, never the shortened list.
14
14
  * Both are opt-in; without them the tools return everything, as before. The
15
- * JSON-RPC handler's 4 MB limit stays the last line of defence.
15
+ * 4 MB response limit of the stdio transport (`server/limited-stdio-transport.ts`)
16
+ * stays the last line of defence.
16
17
  */
17
18
  /** JSON schema entries for the two shared parameters. */
18
19
  export declare const COMPACT_OUTPUT_SCHEMA: {
@@ -12,7 +12,8 @@
12
12
  * `truncated: true` when anything was cut. Counts always describe the full
13
13
  * result, never the shortened list.
14
14
  * Both are opt-in; without them the tools return everything, as before. The
15
- * JSON-RPC handler's 4 MB limit stays the last line of defence.
15
+ * 4 MB response limit of the stdio transport (`server/limited-stdio-transport.ts`)
16
+ * stays the last line of defence.
16
17
  */
17
18
  import { relative, sep } from 'node:path';
18
19
  /** JSON schema entries for the two shared parameters. */
@@ -1,24 +1,16 @@
1
- /**
2
- * @angular-modernizer/adapter-mcp - Health delta
3
- *
4
- * Snapshot format and comparison behind the compare-health tool: which
5
- * violations are new, fixed or unchanged since the last scan.
6
- *
7
- * @remarks
8
- * Line numbers shift with every edit above a finding, so they are not part of
9
- * the key. Within one rule and file, violations are matched first by their
10
- * message with digits removed (counts inside messages change too), the rest
11
- * by number: three findings before and two now means one fixed. Which of the
12
- * unmatched ones is reported as fixed or new follows the line order.
13
- */
14
1
  /** One violation as stored in a snapshot and reported in a delta. */
15
2
  export interface HealthViolation {
3
+ /** Rule that reported the violation. */
16
4
  ruleId: string;
17
5
  /** Relative to the project root. */
18
6
  filePath: string;
7
+ /** Rule message. */
19
8
  message: string;
9
+ /** Severity of the violation. */
20
10
  severity: string;
11
+ /** Rule category. */
21
12
  category: string;
13
+ /** 1-based line, when the rule reports one. */
22
14
  line?: number;
23
15
  }
24
16
  /** Scan arguments that change which violations a run can find. */
@@ -38,19 +30,30 @@ export interface HealthSnapshot {
38
30
  }
39
31
  /** Counts of one rule in the previous and the current run. */
40
32
  export interface RuleDelta {
33
+ /** Rule id. */
41
34
  ruleId: string;
35
+ /** Violations of the rule in the previous run. */
42
36
  previous: number;
37
+ /** Violations of the rule in the current run. */
43
38
  current: number;
39
+ /** Violations only in the current run. */
44
40
  new: number;
41
+ /** Violations only in the previous run. */
45
42
  fixed: number;
43
+ /** Violations in both runs. */
46
44
  unchanged: number;
47
45
  }
48
46
  /** Counts of one file whose violations changed. */
49
47
  export interface FileDelta {
48
+ /** Relative to the project root. */
50
49
  filePath: string;
50
+ /** Violations in the file in the previous run. */
51
51
  previous: number;
52
+ /** Violations in the file in the current run. */
52
53
  current: number;
54
+ /** Violations only in the current run. */
53
55
  new: number;
56
+ /** Violations only in the previous run. */
54
57
  fixed: number;
55
58
  }
56
59
  /** Result of comparing two runs. */
@@ -81,6 +84,16 @@ export declare function serializeHealthSnapshot(snapshot: HealthSnapshot): strin
81
84
  export declare function parseHealthSnapshot(text: string): HealthSnapshot | undefined;
82
85
  /** Readable differences between two scopes; empty when they match. */
83
86
  export declare function scopeDifferences(previous: HealthScope, current: HealthScope): string[];
84
- /** Compares the violations of the previous run with the current one. */
87
+ /**
88
+ * Compares the violations of the previous run with the current one: which
89
+ * violations are new, fixed or unchanged.
90
+ *
91
+ * @remarks
92
+ * Line numbers shift with every edit above a finding, so they are not part of
93
+ * the key. Within one rule and file, violations are matched first by their
94
+ * message with digits removed (counts inside messages change too), the rest
95
+ * by number: three findings before and two now means one fixed. Which of the
96
+ * unmatched ones is reported as fixed or new follows the line order.
97
+ */
85
98
  export declare function compareHealth(previous: readonly HealthViolation[], current: readonly HealthViolation[]): HealthDelta;
86
99
  //# sourceMappingURL=health-delta.d.ts.map
@@ -1,16 +1,3 @@
1
- /**
2
- * @angular-modernizer/adapter-mcp - Health delta
3
- *
4
- * Snapshot format and comparison behind the compare-health tool: which
5
- * violations are new, fixed or unchanged since the last scan.
6
- *
7
- * @remarks
8
- * Line numbers shift with every edit above a finding, so they are not part of
9
- * the key. Within one rule and file, violations are matched first by their
10
- * message with digits removed (counts inside messages change too), the rest
11
- * by number: three findings before and two now means one fixed. Which of the
12
- * unmatched ones is reported as fixed or new follows the line order.
13
- */
14
1
  export const HEALTH_SNAPSHOT_VERSION = 1;
15
2
  /** Snapshot location relative to the project root, next to the scan cache. */
16
3
  export const DEFAULT_HEALTH_SNAPSHOT_PATH = '.angular-modernizer-cache/health/last-run.json';
@@ -106,7 +93,17 @@ export function scopeDifferences(previous, current) {
106
93
  .filter((key) => !sameList(previous[key], current[key]))
107
94
  .map((key) => `${key}: ${describeList(previous[key])} -> ${describeList(current[key])}`);
108
95
  }
109
- /** Compares the violations of the previous run with the current one. */
96
+ /**
97
+ * Compares the violations of the previous run with the current one: which
98
+ * violations are new, fixed or unchanged.
99
+ *
100
+ * @remarks
101
+ * Line numbers shift with every edit above a finding, so they are not part of
102
+ * the key. Within one rule and file, violations are matched first by their
103
+ * message with digits removed (counts inside messages change too), the rest
104
+ * by number: three findings before and two now means one fixed. Which of the
105
+ * unmatched ones is reported as fixed or new follows the line order.
106
+ */
110
107
  export function compareHealth(previous, current) {
111
108
  const previousGroups = groupByRuleAndFile(previous);
112
109
  const currentGroups = groupByRuleAndFile(current);