@angular-modernizer/adapter-mcp 0.3.0 → 1.0.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 +103 -218
- package/dist/cli.js +13 -13
- package/dist/index.d.ts +4 -3
- package/dist/index.js +3 -2
- package/dist/mcp-watcher.d.ts +6 -1
- package/dist/mcp-watcher.js +11 -10
- package/dist/server/limited-stdio-transport.d.ts +68 -0
- package/dist/server/limited-stdio-transport.js +115 -0
- package/dist/server/mcp-server.d.ts +12 -14
- package/dist/server/mcp-server.js +41 -75
- package/dist/server/package-version.d.ts +16 -0
- package/dist/server/package-version.js +37 -0
- package/dist/server/sdk-server.d.ts +70 -0
- package/dist/server/sdk-server.js +113 -0
- package/dist/server/tool-registry.d.ts +3 -2
- package/dist/server/tool-registry.js +5 -5
- package/dist/tools/analyze-build-impact.d.ts +220 -1
- package/dist/tools/analyze-build-impact.js +145 -3
- package/dist/tools/analyze-core-to-shared.d.ts +134 -4
- package/dist/tools/analyze-core-to-shared.js +113 -9
- package/dist/tools/analyze-parser-performance.d.ts +200 -7
- package/dist/tools/analyze-parser-performance.js +108 -47
- package/dist/tools/analyze-project.d.ts +267 -5
- package/dist/tools/analyze-project.js +196 -8
- package/dist/tools/check-incremental-compatibility.d.ts +61 -1
- package/dist/tools/check-incremental-compatibility.js +58 -2
- package/dist/tools/collect-feedback.d.ts +199 -10
- package/dist/tools/collect-feedback.js +171 -99
- package/dist/tools/compare-health.d.ts +356 -0
- package/dist/tools/compare-health.js +472 -0
- package/dist/tools/extract-libraries.d.ts +156 -4
- package/dist/tools/extract-libraries.js +115 -10
- package/dist/tools/find-angular-symbol.d.ts +69 -3
- package/dist/tools/find-angular-symbol.js +55 -8
- package/dist/tools/find-component-hosts.d.ts +572 -2
- package/dist/tools/find-component-hosts.js +207 -6
- package/dist/tools/find-usages.d.ts +79 -1
- package/dist/tools/find-usages.js +64 -7
- package/dist/tools/get-bootstrap-execution.d.ts +151 -1
- package/dist/tools/get-bootstrap-execution.js +84 -3
- package/dist/tools/get-call-graph.d.ts +111 -1
- package/dist/tools/get-call-graph.js +72 -10
- package/dist/tools/get-operation-progress-tool.d.ts +114 -2
- package/dist/tools/get-operation-progress-tool.js +114 -7
- package/dist/tools/get-operation-progress.d.ts +1 -1
- package/dist/tools/get-operation-progress.js +5 -5
- package/dist/tools/helpers/analysis-output.d.ts +177 -0
- package/dist/tools/helpers/analysis-output.js +165 -0
- package/dist/tools/helpers/build-schemas.d.ts +36 -0
- package/dist/tools/helpers/build-schemas.js +23 -0
- package/dist/tools/helpers/citation-file-source.d.ts +10 -0
- package/dist/tools/helpers/citation-file-source.js +82 -0
- package/dist/tools/helpers/finding-window.d.ts +43 -0
- package/dist/tools/helpers/finding-window.js +64 -0
- package/dist/tools/helpers/health-delta.d.ts +86 -0
- package/dist/tools/helpers/health-delta.js +239 -0
- package/dist/tools/helpers/investigation-schemas.d.ts +93 -0
- package/dist/tools/helpers/investigation-schemas.js +48 -0
- package/dist/tools/helpers/library-imports.d.ts +57 -0
- package/dist/tools/helpers/library-imports.js +151 -0
- package/dist/tools/helpers/load-source-files.d.ts +30 -0
- package/dist/tools/helpers/load-source-files.js +34 -0
- package/dist/tools/helpers/output-contract.d.ts +32 -0
- package/dist/tools/helpers/output-contract.js +32 -0
- package/dist/tools/helpers/platform-root-resolver.d.ts +55 -25
- package/dist/tools/helpers/platform-root-resolver.js +75 -48
- package/dist/tools/helpers/process-output.d.ts +19 -0
- package/dist/tools/helpers/process-output.js +31 -0
- package/dist/tools/helpers/project-cache.d.ts +11 -4
- package/dist/tools/helpers/project-cache.js +22 -4
- package/dist/tools/helpers/project-decorators.d.ts +14 -0
- package/dist/tools/helpers/project-decorators.js +22 -0
- package/dist/tools/helpers/rule-matcher.js +5 -0
- package/dist/tools/helpers/rule-runner.d.ts +9 -4
- package/dist/tools/helpers/rule-runner.js +28 -14
- package/dist/tools/helpers/scan-cache.d.ts +22 -0
- package/dist/tools/helpers/scan-cache.js +34 -0
- package/dist/tools/helpers/scan-plan.d.ts +5 -2
- package/dist/tools/helpers/scan-plan.js +18 -3
- package/dist/tools/helpers/scope-paths.d.ts +17 -0
- package/dist/tools/helpers/scope-paths.js +32 -0
- package/dist/tools/helpers/tool-context.d.ts +60 -0
- package/dist/tools/helpers/tool-context.js +82 -0
- package/dist/tools/helpers/transform-safety.d.ts +40 -0
- package/dist/tools/helpers/transform-safety.js +87 -0
- package/dist/tools/helpers/validation-output.d.ts +53 -0
- package/dist/tools/helpers/validation-output.js +48 -0
- package/dist/tools/inspect-form-group.d.ts +232 -1
- package/dist/tools/inspect-form-group.js +120 -2
- package/dist/tools/inspect-i18n.d.ts +382 -1
- package/dist/tools/inspect-i18n.js +199 -2
- package/dist/tools/inspect-template.d.ts +232 -1
- package/dist/tools/inspect-template.js +160 -2
- package/dist/tools/learn-patterns.d.ts +122 -1
- package/dist/tools/learn-patterns.js +97 -2
- package/dist/tools/list-imports.d.ts +111 -10
- package/dist/tools/list-imports.js +110 -7
- package/dist/tools/orchestrate-migration.d.ts +128 -5
- package/dist/tools/orchestrate-migration.js +135 -13
- package/dist/tools/parse-stack-trace.d.ts +56 -1
- package/dist/tools/parse-stack-trace.js +34 -0
- package/dist/tools/plan-migration.d.ts +330 -1
- package/dist/tools/plan-migration.js +154 -3
- package/dist/tools/resolve-type.d.ts +39 -1
- package/dist/tools/resolve-type.js +31 -2
- package/dist/tools/review-feedback.d.ts +206 -11
- package/dist/tools/review-feedback.js +132 -51
- package/dist/tools/rollback-changes.d.ts +79 -2
- package/dist/tools/rollback-changes.js +66 -14
- package/dist/tools/run-angular-cli.d.ts +45 -2
- package/dist/tools/run-angular-cli.js +67 -7
- package/dist/tools/run-build.d.ts +114 -2
- package/dist/tools/run-build.js +117 -8
- package/dist/tools/run-schematic.d.ts +70 -2
- package/dist/tools/run-schematic.js +104 -10
- package/dist/tools/scan-all.d.ts +19 -11
- package/dist/tools/scan-all.js +139 -131
- package/dist/tools/scan-angular.d.ts +19 -10
- package/dist/tools/scan-angular.js +51 -23
- package/dist/tools/scan-architecture.d.ts +17 -10
- package/dist/tools/scan-architecture.js +93 -31
- package/dist/tools/scan-solid.d.ts +19 -10
- package/dist/tools/scan-solid.js +51 -23
- package/dist/tools/search-codebase.d.ts +82 -1
- package/dist/tools/search-codebase.js +55 -2
- package/dist/tools/server-status.d.ts +279 -5
- package/dist/tools/server-status.js +179 -5
- package/dist/tools/suggest-improvements.d.ts +97 -5
- package/dist/tools/suggest-improvements.js +80 -44
- package/dist/tools/trace-output-flow.d.ts +682 -2
- package/dist/tools/trace-output-flow.js +375 -15
- package/dist/tools/transform-code-batch.d.ts +3 -0
- package/dist/tools/transform-code-batch.js +10 -5
- package/dist/tools/transform-code.d.ts +335 -12
- package/dist/tools/transform-code.js +649 -608
- package/dist/tools/validate-before-transform.d.ts +116 -2
- package/dist/tools/validate-before-transform.js +55 -2
- package/dist/tools/validate-project-compatibility.d.ts +64 -2
- package/dist/tools/validate-project-compatibility.js +67 -4
- package/dist/tools/validate-transformation.d.ts +220 -2
- package/dist/tools/validate-transformation.js +113 -15
- package/dist/tools/verify-citations.d.ts +181 -0
- package/dist/tools/verify-citations.js +218 -0
- package/dist/types.d.ts +38 -1
- package/dist/utils/format-tool-response.d.ts +22 -59
- package/dist/utils/format-tool-response.js +25 -134
- package/package.json +30 -13
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/core/project-analyzer.d.ts.map +0 -1
- package/dist/core/project-analyzer.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/mcp-watcher.d.ts.map +0 -1
- package/dist/mcp-watcher.js.map +0 -1
- package/dist/server/json-rpc-handler.d.ts +0 -98
- package/dist/server/json-rpc-handler.d.ts.map +0 -1
- package/dist/server/json-rpc-handler.js +0 -301
- package/dist/server/json-rpc-handler.js.map +0 -1
- package/dist/server/mcp-server.d.ts.map +0 -1
- package/dist/server/mcp-server.js.map +0 -1
- package/dist/server/stdio-guard.d.ts.map +0 -1
- package/dist/server/stdio-guard.js.map +0 -1
- package/dist/server/tool-registry.d.ts.map +0 -1
- package/dist/server/tool-registry.js.map +0 -1
- package/dist/streaming/progress-store.d.ts.map +0 -1
- package/dist/streaming/progress-store.js.map +0 -1
- package/dist/tools/analyze-build-impact.d.ts.map +0 -1
- package/dist/tools/analyze-build-impact.js.map +0 -1
- package/dist/tools/analyze-core-to-shared.d.ts.map +0 -1
- package/dist/tools/analyze-core-to-shared.js.map +0 -1
- package/dist/tools/analyze-parser-performance.d.ts.map +0 -1
- package/dist/tools/analyze-parser-performance.js.map +0 -1
- package/dist/tools/analyze-project.d.ts.map +0 -1
- package/dist/tools/analyze-project.js.map +0 -1
- package/dist/tools/check-incremental-compatibility.d.ts.map +0 -1
- package/dist/tools/check-incremental-compatibility.js.map +0 -1
- package/dist/tools/collect-feedback.d.ts.map +0 -1
- package/dist/tools/collect-feedback.js.map +0 -1
- package/dist/tools/extract-libraries.d.ts.map +0 -1
- package/dist/tools/extract-libraries.js.map +0 -1
- package/dist/tools/find-angular-symbol.d.ts.map +0 -1
- package/dist/tools/find-angular-symbol.js.map +0 -1
- package/dist/tools/find-component-hosts.d.ts.map +0 -1
- package/dist/tools/find-component-hosts.js.map +0 -1
- package/dist/tools/find-usages.d.ts.map +0 -1
- package/dist/tools/find-usages.js.map +0 -1
- package/dist/tools/get-bootstrap-execution.d.ts.map +0 -1
- package/dist/tools/get-bootstrap-execution.js.map +0 -1
- package/dist/tools/get-call-graph.d.ts.map +0 -1
- package/dist/tools/get-call-graph.js.map +0 -1
- package/dist/tools/get-operation-progress-tool.d.ts.map +0 -1
- package/dist/tools/get-operation-progress-tool.js.map +0 -1
- package/dist/tools/get-operation-progress.d.ts.map +0 -1
- package/dist/tools/get-operation-progress.js.map +0 -1
- package/dist/tools/helpers/compact-output.d.ts.map +0 -1
- package/dist/tools/helpers/compact-output.js.map +0 -1
- package/dist/tools/helpers/feedback-analyzer.d.ts.map +0 -1
- package/dist/tools/helpers/feedback-analyzer.js.map +0 -1
- package/dist/tools/helpers/find-ts-config.d.ts.map +0 -1
- package/dist/tools/helpers/find-ts-config.js.map +0 -1
- package/dist/tools/helpers/platform-root-resolver.d.ts.map +0 -1
- package/dist/tools/helpers/platform-root-resolver.js.map +0 -1
- package/dist/tools/helpers/project-cache.d.ts.map +0 -1
- package/dist/tools/helpers/project-cache.js.map +0 -1
- package/dist/tools/helpers/rule-matcher.d.ts.map +0 -1
- package/dist/tools/helpers/rule-matcher.js.map +0 -1
- package/dist/tools/helpers/rule-runner.d.ts.map +0 -1
- package/dist/tools/helpers/rule-runner.js.map +0 -1
- package/dist/tools/helpers/scan-plan.d.ts.map +0 -1
- package/dist/tools/helpers/scan-plan.js.map +0 -1
- package/dist/tools/helpers/stack-frame-file-index.d.ts.map +0 -1
- package/dist/tools/helpers/stack-frame-file-index.js.map +0 -1
- package/dist/tools/helpers/suggestion-generator.d.ts.map +0 -1
- package/dist/tools/helpers/suggestion-generator.js.map +0 -1
- package/dist/tools/inspect-form-group.d.ts.map +0 -1
- package/dist/tools/inspect-form-group.js.map +0 -1
- package/dist/tools/inspect-i18n.d.ts.map +0 -1
- package/dist/tools/inspect-i18n.js.map +0 -1
- package/dist/tools/inspect-template.d.ts.map +0 -1
- package/dist/tools/inspect-template.js.map +0 -1
- package/dist/tools/learn-patterns.d.ts.map +0 -1
- package/dist/tools/learn-patterns.js.map +0 -1
- package/dist/tools/list-imports.d.ts.map +0 -1
- package/dist/tools/list-imports.js.map +0 -1
- package/dist/tools/orchestrate-migration.d.ts.map +0 -1
- package/dist/tools/orchestrate-migration.js.map +0 -1
- package/dist/tools/parse-stack-trace.d.ts.map +0 -1
- package/dist/tools/parse-stack-trace.js.map +0 -1
- package/dist/tools/plan-migration.d.ts.map +0 -1
- package/dist/tools/plan-migration.js.map +0 -1
- package/dist/tools/resolve-type.d.ts.map +0 -1
- package/dist/tools/resolve-type.js.map +0 -1
- package/dist/tools/review-feedback.d.ts.map +0 -1
- package/dist/tools/review-feedback.js.map +0 -1
- package/dist/tools/rollback-changes.d.ts.map +0 -1
- package/dist/tools/rollback-changes.js.map +0 -1
- package/dist/tools/run-angular-cli.d.ts.map +0 -1
- package/dist/tools/run-angular-cli.js.map +0 -1
- package/dist/tools/run-build.d.ts.map +0 -1
- package/dist/tools/run-build.js.map +0 -1
- package/dist/tools/run-schematic.d.ts.map +0 -1
- package/dist/tools/run-schematic.js.map +0 -1
- package/dist/tools/scan-all.d.ts.map +0 -1
- package/dist/tools/scan-all.js.map +0 -1
- package/dist/tools/scan-angular.d.ts.map +0 -1
- package/dist/tools/scan-angular.js.map +0 -1
- package/dist/tools/scan-architecture.d.ts.map +0 -1
- package/dist/tools/scan-architecture.js.map +0 -1
- package/dist/tools/scan-solid.d.ts.map +0 -1
- package/dist/tools/scan-solid.js.map +0 -1
- package/dist/tools/search-codebase.d.ts.map +0 -1
- package/dist/tools/search-codebase.js.map +0 -1
- package/dist/tools/server-status.d.ts.map +0 -1
- package/dist/tools/server-status.js.map +0 -1
- package/dist/tools/shared/scan-types.d.ts.map +0 -1
- package/dist/tools/shared/scan-types.js.map +0 -1
- package/dist/tools/suggest-improvements.d.ts.map +0 -1
- package/dist/tools/suggest-improvements.js.map +0 -1
- package/dist/tools/trace-output-flow.d.ts.map +0 -1
- package/dist/tools/trace-output-flow.js.map +0 -1
- package/dist/tools/transform-code-batch.d.ts.map +0 -1
- package/dist/tools/transform-code-batch.js.map +0 -1
- package/dist/tools/transform-code.d.ts.map +0 -1
- package/dist/tools/transform-code.js.map +0 -1
- package/dist/tools/validate-before-transform.d.ts.map +0 -1
- package/dist/tools/validate-before-transform.js.map +0 -1
- package/dist/tools/validate-project-compatibility.d.ts.map +0 -1
- package/dist/tools/validate-project-compatibility.js.map +0 -1
- package/dist/tools/validate-transformation.d.ts.map +0 -1
- package/dist/tools/validate-transformation.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/format-tool-response.d.ts.map +0 -1
- package/dist/utils/format-tool-response.js.map +0 -1
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* MCP tool for scanning Angular codebases for architectural issues.
|
|
5
5
|
* Runs only the ArchitecturePlugin (17 rules: import cycles, layer violations, god objects, etc.).
|
|
6
6
|
*/
|
|
7
|
-
import type { MCPTool } from '../types.js';
|
|
7
|
+
import type { MCPTool, ToolAnnotations, ToolContext } from '../types.js';
|
|
8
|
+
import { type ScanCounts } from './helpers/analysis-output.js';
|
|
8
9
|
import { type RuleTiming } from './helpers/rule-runner.js';
|
|
9
10
|
/**
|
|
10
11
|
* Scope configuration for targeted scanning.
|
|
@@ -75,15 +76,13 @@ interface ScanArchitectureResult {
|
|
|
75
76
|
metadata?: Record<string, unknown>;
|
|
76
77
|
}[];
|
|
77
78
|
/**
|
|
78
|
-
*
|
|
79
|
+
* Counts over all violations, independent of the page.
|
|
79
80
|
*/
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
byRule: Record<string, number>;
|
|
86
|
-
};
|
|
81
|
+
counts: ScanCounts;
|
|
82
|
+
/**
|
|
83
|
+
* Human-readable summary for LLM consumption.
|
|
84
|
+
*/
|
|
85
|
+
summary: string;
|
|
87
86
|
/**
|
|
88
87
|
* Analysis metadata.
|
|
89
88
|
*/
|
|
@@ -165,9 +164,12 @@ interface ScanArchitectureResult {
|
|
|
165
164
|
*/
|
|
166
165
|
export declare class ScanArchitectureTool implements MCPTool {
|
|
167
166
|
readonly name = "scan-architecture";
|
|
167
|
+
readonly title = "Scan Architecture";
|
|
168
|
+
readonly annotations: ToolAnnotations;
|
|
168
169
|
readonly description: string;
|
|
169
170
|
readonly inputSchema: {
|
|
170
171
|
type: string;
|
|
172
|
+
additionalProperties: boolean;
|
|
171
173
|
properties: {
|
|
172
174
|
rootPath: {
|
|
173
175
|
type: string;
|
|
@@ -331,7 +333,12 @@ export declare class ScanArchitectureTool implements MCPTool {
|
|
|
331
333
|
};
|
|
332
334
|
required: string[];
|
|
333
335
|
};
|
|
334
|
-
|
|
336
|
+
readonly outputSchema: {
|
|
337
|
+
type: "object";
|
|
338
|
+
properties: Record<string, unknown>;
|
|
339
|
+
required: string[];
|
|
340
|
+
};
|
|
341
|
+
execute(args: Record<string, unknown>, ctx?: ToolContext): Promise<ScanArchitectureResult>;
|
|
335
342
|
/**
|
|
336
343
|
* Execute analysis using fluent API.
|
|
337
344
|
*/
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
* Runs only the ArchitecturePlugin (17 rules: import cycles, layer violations, god objects, etc.).
|
|
6
6
|
*/
|
|
7
7
|
import { findTsConfig } from './helpers/find-ts-config.js';
|
|
8
|
+
import { cancelledExecution, fileProgress, yieldIfCancellable, } from './helpers/tool-context.js';
|
|
9
|
+
import { loadSourceFiles } from './helpers/load-source-files.js';
|
|
10
|
+
import { filterFilesByScopePaths } from './helpers/scope-paths.js';
|
|
8
11
|
import { toParallelOptions } from '../types.js';
|
|
9
12
|
import { Kernel, createToolCacheConfig, loadConfig, } from '@angular-modernizer/core';
|
|
10
13
|
import { ArchitecturePlugin } from '@angular-modernizer/plugin-architecture';
|
|
@@ -16,6 +19,7 @@ import { readFileSync, existsSync, statSync } from 'node:fs';
|
|
|
16
19
|
import { randomUUID } from 'node:crypto';
|
|
17
20
|
import { cpus } from 'node:os';
|
|
18
21
|
import { ProgressStore } from '../streaming/progress-store.js';
|
|
22
|
+
import { describeScan, scanOutputSchema, } from './helpers/analysis-output.js';
|
|
19
23
|
import { incompleteNote, parseMaxDurationMs, runRulesOverFiles, } from './helpers/rule-runner.js';
|
|
20
24
|
/** Violations per response unless `maxResults` says otherwise. */
|
|
21
25
|
const DEFAULT_MAX_RESULTS = 1000;
|
|
@@ -37,6 +41,16 @@ function paginateViolations(violations, params) {
|
|
|
37
41
|
},
|
|
38
42
|
};
|
|
39
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Adds the text summary to a scan result; an incomplete run adds its note.
|
|
46
|
+
*/
|
|
47
|
+
function withScanSummary(result) {
|
|
48
|
+
const notes = result.execution?.note === undefined ? [] : [result.execution.note];
|
|
49
|
+
return {
|
|
50
|
+
...result,
|
|
51
|
+
summary: describeScan(result.counts, result.violations, result.pagination, notes),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
40
54
|
/**
|
|
41
55
|
* Scan Architecture Tool
|
|
42
56
|
*
|
|
@@ -45,12 +59,20 @@ function paginateViolations(violations, params) {
|
|
|
45
59
|
*/
|
|
46
60
|
export class ScanArchitectureTool {
|
|
47
61
|
name = 'scan-architecture';
|
|
62
|
+
title = 'Scan Architecture';
|
|
63
|
+
annotations = {
|
|
64
|
+
readOnlyHint: true,
|
|
65
|
+
destructiveHint: false,
|
|
66
|
+
idempotentHint: true,
|
|
67
|
+
openWorldHint: false,
|
|
68
|
+
};
|
|
48
69
|
description = 'Scan Angular codebases for architectural issues with the 17 architecture rules: import cycles ' +
|
|
49
70
|
'(solid:circular-dependency, NG0919 risk), import direction, god objects, layer boundaries, content ' +
|
|
50
|
-
'placement, service bags and more.
|
|
51
|
-
'maxResults (default 1000) and resultOffset page the violations
|
|
71
|
+
'placement, service bags and more. Returns the violations directly; streaming: true (deprecated) runs in the background instead (poll get-operation-progress); ' +
|
|
72
|
+
'maxResults (default 1000) and resultOffset page the violations; counts cover all of them, summary is a short text.';
|
|
52
73
|
inputSchema = {
|
|
53
74
|
type: 'object',
|
|
75
|
+
additionalProperties: false,
|
|
54
76
|
properties: {
|
|
55
77
|
rootPath: {
|
|
56
78
|
type: 'string',
|
|
@@ -208,8 +230,8 @@ export class ScanArchitectureTool {
|
|
|
208
230
|
},
|
|
209
231
|
streaming: {
|
|
210
232
|
type: 'boolean',
|
|
211
|
-
description: '
|
|
212
|
-
default:
|
|
233
|
+
description: 'Deprecated, kept in 1.x (default: false): returns operationId immediately, the analysis runs in the background and get-operation-progress returns the result. Synchronous calls report progress through MCP progress notifications and stop on cancellation.',
|
|
234
|
+
default: false,
|
|
213
235
|
},
|
|
214
236
|
apiStyle: {
|
|
215
237
|
type: 'string',
|
|
@@ -226,10 +248,29 @@ export class ScanArchitectureTool {
|
|
|
226
248
|
},
|
|
227
249
|
required: ['rootPath'],
|
|
228
250
|
};
|
|
229
|
-
|
|
251
|
+
outputSchema = scanOutputSchema({
|
|
252
|
+
operationId: { type: 'string' },
|
|
253
|
+
execution: {
|
|
254
|
+
type: 'object',
|
|
255
|
+
properties: {
|
|
256
|
+
maxDurationMs: { type: 'number' },
|
|
257
|
+
incomplete: { type: 'boolean' },
|
|
258
|
+
stopReason: { type: 'string' },
|
|
259
|
+
skippedFiles: { type: 'integer' },
|
|
260
|
+
ruleTimings: { type: 'array', items: { type: 'object' } },
|
|
261
|
+
note: { type: 'string' },
|
|
262
|
+
},
|
|
263
|
+
required: ['maxDurationMs', 'incomplete', 'skippedFiles', 'ruleTimings'],
|
|
264
|
+
},
|
|
265
|
+
scope: { type: 'object' },
|
|
266
|
+
progress: { type: 'object' },
|
|
267
|
+
pipeline: { type: 'array', items: { type: 'string' } },
|
|
268
|
+
intermediateResults: { type: 'object' },
|
|
269
|
+
});
|
|
270
|
+
async execute(args, ctx = {}) {
|
|
230
271
|
const params = args;
|
|
231
272
|
// Check if streaming mode is enabled
|
|
232
|
-
const streaming = params.streaming ??
|
|
273
|
+
const streaming = params.streaming ?? false;
|
|
233
274
|
if (streaming) {
|
|
234
275
|
// Streaming mode - start operation in background and return operationId
|
|
235
276
|
return this.executeStreaming(params);
|
|
@@ -237,7 +278,7 @@ export class ScanArchitectureTool {
|
|
|
237
278
|
// Check if fluent API should be used
|
|
238
279
|
const apiStyle = params.apiStyle ?? 'fluent';
|
|
239
280
|
if (apiStyle === 'fluent') {
|
|
240
|
-
return this.executeWithFluentApi(params);
|
|
281
|
+
return this.executeWithFluentApi(params, ctx);
|
|
241
282
|
}
|
|
242
283
|
// Load configuration from .angular-modernizer.json if it exists
|
|
243
284
|
const config = this.loadConfig(typeof params.rootPath === 'string' ? params.rootPath : undefined);
|
|
@@ -405,8 +446,17 @@ export class ScanArchitectureTool {
|
|
|
405
446
|
rules: params.rules,
|
|
406
447
|
timeout: orchestration.timeout ?? 120000, // 2 minutes for complex architecture rules
|
|
407
448
|
};
|
|
408
|
-
// Process each batch
|
|
449
|
+
// Process each batch; cancellation is checked between batches
|
|
409
450
|
for (let batchNum = 0; batchNum < totalBatches; batchNum++) {
|
|
451
|
+
await yieldIfCancellable(ctx.signal);
|
|
452
|
+
if (ctx.signal?.aborted === true) {
|
|
453
|
+
execution = {
|
|
454
|
+
...cancelledExecution(batchNum * batchSize, totalFiles - batchNum * batchSize),
|
|
455
|
+
maxDurationMs: parseMaxDurationMs(params.maxDurationMs),
|
|
456
|
+
};
|
|
457
|
+
break;
|
|
458
|
+
}
|
|
459
|
+
ctx.progress?.(batchNum * batchSize, totalFiles, `batch ${batchNum + 1}/${totalBatches}, ${violations.length} violations`);
|
|
410
460
|
const batchStart = batchNum * batchSize;
|
|
411
461
|
const batchEnd = Math.min(batchStart + batchSize, totalFiles);
|
|
412
462
|
const batchFiles = filesToAnalyze.slice(batchStart, batchEnd);
|
|
@@ -419,9 +469,17 @@ export class ScanArchitectureTool {
|
|
|
419
469
|
for (const file of existingFiles) {
|
|
420
470
|
project.removeSourceFile(file);
|
|
421
471
|
}
|
|
422
|
-
// Add current batch files
|
|
423
|
-
|
|
424
|
-
|
|
472
|
+
// Add current batch files; a cancel during the load stops the scan
|
|
473
|
+
const loaded = await loadSourceFiles(project, batchFiles, {
|
|
474
|
+
signal: ctx.signal,
|
|
475
|
+
failOnError: true,
|
|
476
|
+
});
|
|
477
|
+
if (loaded.cancelled) {
|
|
478
|
+
execution = {
|
|
479
|
+
...cancelledExecution(batchStart, totalFiles - batchStart),
|
|
480
|
+
maxDurationMs: parseMaxDurationMs(params.maxDurationMs),
|
|
481
|
+
};
|
|
482
|
+
break;
|
|
425
483
|
}
|
|
426
484
|
console.info(`Batch ${batchNum + 1}: Project now has ${project.getSourceFiles().length} source files`);
|
|
427
485
|
// Log cache stats to show cache effectiveness
|
|
@@ -452,7 +510,7 @@ export class ScanArchitectureTool {
|
|
|
452
510
|
violations.push({
|
|
453
511
|
id: `${analysisResult.ruleId}-${analysisResult.filePath}-${analysisResult.line ?? 0}-${analysisResult.column ?? 0}`,
|
|
454
512
|
ruleId: analysisResult.ruleId,
|
|
455
|
-
severity: rule.severity,
|
|
513
|
+
severity: analysisResult.severity ?? rule.severity,
|
|
456
514
|
message: analysisResult.message,
|
|
457
515
|
filePath: analysisResult.filePath,
|
|
458
516
|
line: analysisResult.line,
|
|
@@ -480,7 +538,7 @@ export class ScanArchitectureTool {
|
|
|
480
538
|
violations.push({
|
|
481
539
|
id: `${analysisResult.ruleId}-${analysisResult.filePath}-${analysisResult.line ?? 0}-${analysisResult.column ?? 0}`,
|
|
482
540
|
ruleId: analysisResult.ruleId,
|
|
483
|
-
severity: rule.severity,
|
|
541
|
+
severity: analysisResult.severity ?? rule.severity,
|
|
484
542
|
message: analysisResult.message,
|
|
485
543
|
filePath: analysisResult.filePath,
|
|
486
544
|
line: analysisResult.line,
|
|
@@ -567,6 +625,8 @@ export class ScanArchitectureTool {
|
|
|
567
625
|
config: rulesConfig,
|
|
568
626
|
maxDurationMs,
|
|
569
627
|
startTime,
|
|
628
|
+
signal: ctx.signal,
|
|
629
|
+
onFileAnalyzed: fileProgress(ctx.progress),
|
|
570
630
|
});
|
|
571
631
|
violations.push(...run.violations);
|
|
572
632
|
execution = toExecution(run, maxDurationMs);
|
|
@@ -649,9 +709,9 @@ export class ScanArchitectureTool {
|
|
|
649
709
|
: undefined,
|
|
650
710
|
};
|
|
651
711
|
}
|
|
652
|
-
|
|
712
|
+
return withScanSummary({
|
|
653
713
|
violations: page.violations,
|
|
654
|
-
|
|
714
|
+
counts: {
|
|
655
715
|
...summary,
|
|
656
716
|
analyzedFiles: filesAnalyzed,
|
|
657
717
|
},
|
|
@@ -665,8 +725,7 @@ export class ScanArchitectureTool {
|
|
|
665
725
|
pagination: page.pagination,
|
|
666
726
|
orchestration: orchestrationMetrics,
|
|
667
727
|
progress: lastProgress,
|
|
668
|
-
};
|
|
669
|
-
return result;
|
|
728
|
+
});
|
|
670
729
|
}
|
|
671
730
|
catch (error) {
|
|
672
731
|
throw new Error(`Architecture scan failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -675,7 +734,7 @@ export class ScanArchitectureTool {
|
|
|
675
734
|
/**
|
|
676
735
|
* Execute analysis using fluent API.
|
|
677
736
|
*/
|
|
678
|
-
async executeWithFluentApi(params) {
|
|
737
|
+
async executeWithFluentApi(params, ctx) {
|
|
679
738
|
// Validate input
|
|
680
739
|
if (!params.rootPath || typeof params.rootPath !== 'string') {
|
|
681
740
|
throw new Error('rootPath is required and must be a string');
|
|
@@ -755,6 +814,8 @@ export class ScanArchitectureTool {
|
|
|
755
814
|
config: rulesConfig,
|
|
756
815
|
maxDurationMs: parseMaxDurationMs(params.maxDurationMs),
|
|
757
816
|
startTime,
|
|
817
|
+
signal: ctx.signal,
|
|
818
|
+
onFileAnalyzed: fileProgress(ctx.progress),
|
|
758
819
|
});
|
|
759
820
|
const violations = run.violations;
|
|
760
821
|
const filesAnalyzed = run.filesAnalyzed;
|
|
@@ -762,9 +823,9 @@ export class ScanArchitectureTool {
|
|
|
762
823
|
const duration = Date.now() - startTime;
|
|
763
824
|
const summary = this.calculateSummary(violations);
|
|
764
825
|
const page = paginateViolations(violations, params);
|
|
765
|
-
return {
|
|
826
|
+
return withScanSummary({
|
|
766
827
|
violations: page.violations,
|
|
767
|
-
|
|
828
|
+
counts: {
|
|
768
829
|
...summary,
|
|
769
830
|
analyzedFiles: filesAnalyzed,
|
|
770
831
|
},
|
|
@@ -783,7 +844,7 @@ export class ScanArchitectureTool {
|
|
|
783
844
|
message: `Analysis completed with ${violations.length} violations`,
|
|
784
845
|
},
|
|
785
846
|
},
|
|
786
|
-
};
|
|
847
|
+
});
|
|
787
848
|
}
|
|
788
849
|
catch (error) {
|
|
789
850
|
throw new Error(`Architecture analysis failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -815,7 +876,7 @@ export class ScanArchitectureTool {
|
|
|
815
876
|
return {
|
|
816
877
|
operationId,
|
|
817
878
|
violations: [],
|
|
818
|
-
|
|
879
|
+
counts: {
|
|
819
880
|
totalViolations: 0,
|
|
820
881
|
analyzedFiles: 0,
|
|
821
882
|
bySeverity: {},
|
|
@@ -827,6 +888,8 @@ export class ScanArchitectureTool {
|
|
|
827
888
|
duration: 0,
|
|
828
889
|
projectRoot: params.rootPath,
|
|
829
890
|
},
|
|
891
|
+
summary: `Scan started in the background as operation ${operationId}; ` +
|
|
892
|
+
'get-operation-progress returns the violations when it is complete.',
|
|
830
893
|
};
|
|
831
894
|
}
|
|
832
895
|
/**
|
|
@@ -964,10 +1027,10 @@ export class ScanArchitectureTool {
|
|
|
964
1027
|
// Store full result so get-operation-progress can return violations
|
|
965
1028
|
const summary = this.calculateSummary(violations);
|
|
966
1029
|
const page = paginateViolations(violations, params);
|
|
967
|
-
store.setResult(operationId, {
|
|
1030
|
+
store.setResult(operationId, withScanSummary({
|
|
968
1031
|
violations: page.violations,
|
|
969
1032
|
pagination: page.pagination,
|
|
970
|
-
|
|
1033
|
+
counts: {
|
|
971
1034
|
...summary,
|
|
972
1035
|
analyzedFiles: filesProcessed,
|
|
973
1036
|
},
|
|
@@ -977,7 +1040,7 @@ export class ScanArchitectureTool {
|
|
|
977
1040
|
projectRoot: params.rootPath,
|
|
978
1041
|
},
|
|
979
1042
|
execution,
|
|
980
|
-
});
|
|
1043
|
+
}));
|
|
981
1044
|
// Mark complete
|
|
982
1045
|
store.markComplete(operationId);
|
|
983
1046
|
}
|
|
@@ -994,8 +1057,9 @@ export class ScanArchitectureTool {
|
|
|
994
1057
|
});
|
|
995
1058
|
allFiles.push(...files);
|
|
996
1059
|
}
|
|
997
|
-
//
|
|
998
|
-
|
|
1060
|
+
// Sorted before the limit: glob returns files in no fixed order, and both
|
|
1061
|
+
// the chosen files and the result pages depend on it
|
|
1062
|
+
const uniqueFiles = [...new Set(allFiles)].sort().slice(0, maxFiles);
|
|
999
1063
|
// Filter to only TypeScript files and ensure they are actual files (not directories)
|
|
1000
1064
|
return uniqueFiles.filter((file) => {
|
|
1001
1065
|
const isTsFile = ['.ts', '.tsx'].includes(extname(file));
|
|
@@ -1251,10 +1315,8 @@ export class ScanArchitectureTool {
|
|
|
1251
1315
|
resolvedScope.resolvedPaths.length === 0) {
|
|
1252
1316
|
return files;
|
|
1253
1317
|
}
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
file.startsWith(scopePath.replaceAll('\\', '/')));
|
|
1257
|
-
});
|
|
1318
|
+
// Inside the folder, not a sibling sharing its prefix
|
|
1319
|
+
return filterFilesByScopePaths(files, resolvedScope.resolvedPaths);
|
|
1258
1320
|
}
|
|
1259
1321
|
}
|
|
1260
1322
|
function toExecution(run, maxDurationMs) {
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* MCP tool for scanning Angular codebases for SOLID principle violations.
|
|
5
5
|
* Runs only the SolidPlugin (7 rules: DIP, SRP, LSP, OCP, ISP).
|
|
6
6
|
*/
|
|
7
|
-
import type { MCPTool } from '../types.js';
|
|
7
|
+
import type { MCPTool, ToolAnnotations, ToolContext } from '../types.js';
|
|
8
|
+
import { type ScanCounts } from './helpers/analysis-output.js';
|
|
9
|
+
import { type CancelledExecution } from './helpers/tool-context.js';
|
|
8
10
|
interface ScanSolidResult {
|
|
9
11
|
violations: {
|
|
10
12
|
id: string;
|
|
@@ -18,13 +20,12 @@ interface ScanSolidResult {
|
|
|
18
20
|
suggestedFix?: string;
|
|
19
21
|
metadata?: Record<string, unknown>;
|
|
20
22
|
}[];
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
23
|
+
/** Counts over all violations, independent of the page. */
|
|
24
|
+
counts: ScanCounts;
|
|
25
|
+
/** Human-readable summary for LLM consumption. */
|
|
26
|
+
summary: string;
|
|
27
|
+
/** Set when the client cancelled the scan; counts cover the analyzed files. */
|
|
28
|
+
execution?: CancelledExecution;
|
|
28
29
|
metadata: {
|
|
29
30
|
rulesExecuted: string[];
|
|
30
31
|
duration: number;
|
|
@@ -51,9 +52,12 @@ interface ScanSolidResult {
|
|
|
51
52
|
*/
|
|
52
53
|
export declare class ScanSolidTool implements MCPTool {
|
|
53
54
|
readonly name = "scan-solid";
|
|
54
|
-
readonly
|
|
55
|
+
readonly title = "Scan SOLID Principles";
|
|
56
|
+
readonly annotations: ToolAnnotations;
|
|
57
|
+
readonly description: string;
|
|
55
58
|
readonly inputSchema: {
|
|
56
59
|
type: string;
|
|
60
|
+
additionalProperties: boolean;
|
|
57
61
|
properties: {
|
|
58
62
|
rootPath: {
|
|
59
63
|
type: string;
|
|
@@ -120,7 +124,12 @@ export declare class ScanSolidTool implements MCPTool {
|
|
|
120
124
|
};
|
|
121
125
|
required: string[];
|
|
122
126
|
};
|
|
123
|
-
|
|
127
|
+
readonly outputSchema: {
|
|
128
|
+
type: "object";
|
|
129
|
+
properties: Record<string, unknown>;
|
|
130
|
+
required: string[];
|
|
131
|
+
};
|
|
132
|
+
execute(args: Record<string, unknown>, ctx?: ToolContext): Promise<ScanSolidResult>;
|
|
124
133
|
/**
|
|
125
134
|
* Load configuration from .angular-modernizer.json file.
|
|
126
135
|
* Only loads from the provided root path to avoid cache directory issues.
|
package/dist/tools/scan-solid.js
CHANGED
|
@@ -12,14 +12,26 @@ import { createPublicApi } from '@angular-modernizer/api';
|
|
|
12
12
|
import { glob } from 'glob';
|
|
13
13
|
import { resolve, relative } from 'node:path';
|
|
14
14
|
import { readFileSync, existsSync } from 'node:fs';
|
|
15
|
+
import { describeScan, SCAN_EXECUTION_SCHEMA, scanOutputSchema, } from './helpers/analysis-output.js';
|
|
16
|
+
import { cancelledExecution, fileProgressMessage, yieldIfCancellable, } from './helpers/tool-context.js';
|
|
17
|
+
import { loadSourceFiles } from './helpers/load-source-files.js';
|
|
15
18
|
/**
|
|
16
19
|
* Scan for SOLID principle violations using the SolidPlugin.
|
|
17
20
|
*/
|
|
18
21
|
export class ScanSolidTool {
|
|
19
22
|
name = 'scan-solid';
|
|
20
|
-
|
|
23
|
+
title = 'Scan SOLID Principles';
|
|
24
|
+
annotations = {
|
|
25
|
+
readOnlyHint: true,
|
|
26
|
+
destructiveHint: false,
|
|
27
|
+
idempotentHint: true,
|
|
28
|
+
openWorldHint: false,
|
|
29
|
+
};
|
|
30
|
+
description = 'Scan for SOLID principle violations (DIP, SRP, LSP, OCP, ISP). maxResults (default 1000) and resultOffset ' +
|
|
31
|
+
'page the violations; counts cover all of them, summary is a short text.';
|
|
21
32
|
inputSchema = {
|
|
22
33
|
type: 'object',
|
|
34
|
+
additionalProperties: false,
|
|
23
35
|
properties: {
|
|
24
36
|
rootPath: {
|
|
25
37
|
type: 'string',
|
|
@@ -89,7 +101,8 @@ export class ScanSolidTool {
|
|
|
89
101
|
},
|
|
90
102
|
required: ['rootPath'],
|
|
91
103
|
};
|
|
92
|
-
|
|
104
|
+
outputSchema = scanOutputSchema({ execution: SCAN_EXECUTION_SCHEMA });
|
|
105
|
+
async execute(args, ctx = {}) {
|
|
93
106
|
const params = args;
|
|
94
107
|
const config = this.loadConfig(params.rootPath);
|
|
95
108
|
const mergedParams = { ...config, ...params };
|
|
@@ -133,7 +146,8 @@ export class ScanSolidTool {
|
|
|
133
146
|
});
|
|
134
147
|
allFiles.push(...files);
|
|
135
148
|
}
|
|
136
|
-
|
|
149
|
+
// Sorted: glob returns files in no fixed order, the result pages depend on it
|
|
150
|
+
const uniqueFiles = Array.from(new Set(allFiles)).sort();
|
|
137
151
|
const filesToAnalyze = uniqueFiles; // Analyze ALL files found (batch processing prevents memory issues)
|
|
138
152
|
const maxFiles = mergedParams.maxFiles ?? 100; // Batch size (default 100)
|
|
139
153
|
// Initialize kernel
|
|
@@ -220,8 +234,11 @@ export class ScanSolidTool {
|
|
|
220
234
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment
|
|
221
235
|
const results = [...cachedResults];
|
|
222
236
|
let filesAnalyzed = cachedResults.length;
|
|
223
|
-
// Process each batch
|
|
224
|
-
|
|
237
|
+
// Process each batch; cancellation is checked between files
|
|
238
|
+
const cachedFiles = filesToAnalyze.length - totalFiles;
|
|
239
|
+
let processedFiles = 0;
|
|
240
|
+
let cancelled = false;
|
|
241
|
+
for (let batchNum = 0; batchNum < totalBatches && !cancelled; batchNum++) {
|
|
225
242
|
const batchStart = batchNum * batchSize;
|
|
226
243
|
const batchEnd = Math.min(batchStart + batchSize, totalFiles);
|
|
227
244
|
const batchFiles = filesToProcess.slice(batchStart, batchEnd);
|
|
@@ -233,14 +250,11 @@ export class ScanSolidTool {
|
|
|
233
250
|
for (const file of existingFiles) {
|
|
234
251
|
project.removeSourceFile(file);
|
|
235
252
|
}
|
|
236
|
-
// Add current batch files
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
catch (error) {
|
|
242
|
-
console.warn(`Failed to add file ${filePath}:`, error);
|
|
243
|
-
}
|
|
253
|
+
// Add current batch files; a cancel during the load stops the scan
|
|
254
|
+
const loaded = await loadSourceFiles(project, batchFiles, { signal: ctx.signal });
|
|
255
|
+
if (loaded.cancelled) {
|
|
256
|
+
cancelled = true;
|
|
257
|
+
break;
|
|
244
258
|
}
|
|
245
259
|
console.info(`Batch ${batchNum + 1}: Project now has ${project.getSourceFiles().length} source files`);
|
|
246
260
|
// Create PublicApi for this batch
|
|
@@ -248,6 +262,11 @@ export class ScanSolidTool {
|
|
|
248
262
|
// Analyze files in this batch
|
|
249
263
|
let batchViolationCount = 0;
|
|
250
264
|
for (const sourceFile of project.getSourceFiles()) {
|
|
265
|
+
await yieldIfCancellable(ctx.signal);
|
|
266
|
+
if (ctx.signal?.aborted === true) {
|
|
267
|
+
cancelled = true;
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
251
270
|
for (const rule of allRules) {
|
|
252
271
|
try {
|
|
253
272
|
const ruleResults = await rule.analyze(ContextFactory.createAnalysisContext({
|
|
@@ -260,7 +279,7 @@ export class ScanSolidTool {
|
|
|
260
279
|
for (const result of ruleResults) {
|
|
261
280
|
results.push({
|
|
262
281
|
ruleId: result.ruleId,
|
|
263
|
-
severity: rule.severity,
|
|
282
|
+
severity: result.severity ?? rule.severity,
|
|
264
283
|
message: result.message,
|
|
265
284
|
filePath: result.filePath,
|
|
266
285
|
line: result.line,
|
|
@@ -276,6 +295,8 @@ export class ScanSolidTool {
|
|
|
276
295
|
console.warn(`Failed to analyze with rule ${rule.id}:`, error);
|
|
277
296
|
}
|
|
278
297
|
}
|
|
298
|
+
processedFiles++;
|
|
299
|
+
ctx.progress?.(cachedFiles + processedFiles, filesToAnalyze.length, fileProgressMessage(cachedFiles + processedFiles, filesToAnalyze.length, results.length));
|
|
279
300
|
}
|
|
280
301
|
filesAnalyzed += batchFiles.length;
|
|
281
302
|
console.info(`Batch ${batchNum + 1}: Found ${batchViolationCount} violations in ${batchFiles.length} files`);
|
|
@@ -354,13 +375,23 @@ export class ScanSolidTool {
|
|
|
354
375
|
const offset = mergedParams.resultOffset ?? 0;
|
|
355
376
|
const maxResults = mergedParams.maxResults ?? 1000;
|
|
356
377
|
const paginatedViolations = violations.slice(offset, offset + maxResults);
|
|
357
|
-
//
|
|
358
|
-
const
|
|
378
|
+
// Counts cover every violation, not only the page
|
|
379
|
+
const analyzedFiles = cancelled ? cachedFiles + processedFiles : filesToAnalyze.length;
|
|
380
|
+
const counts = this.calculateSummary(violations, analyzedFiles);
|
|
381
|
+
const execution = cancelled
|
|
382
|
+
? cancelledExecution(analyzedFiles, filesToAnalyze.length - analyzedFiles)
|
|
383
|
+
: undefined;
|
|
384
|
+
const pagination = {
|
|
385
|
+
totalResults: totalViolations,
|
|
386
|
+
returnedResults: paginatedViolations.length,
|
|
387
|
+
offset,
|
|
388
|
+
hasMore: offset + maxResults < totalViolations,
|
|
389
|
+
};
|
|
359
390
|
const duration = Date.now() - startTime;
|
|
360
391
|
const ruleIds = allRules.map((r) => r.id);
|
|
361
392
|
return {
|
|
362
393
|
violations: paginatedViolations,
|
|
363
|
-
|
|
394
|
+
counts,
|
|
364
395
|
metadata: {
|
|
365
396
|
rulesExecuted: ruleIds,
|
|
366
397
|
duration,
|
|
@@ -377,12 +408,9 @@ export class ScanSolidTool {
|
|
|
377
408
|
throughput: filesToAnalyze.length / (duration / 1000),
|
|
378
409
|
}
|
|
379
410
|
: undefined,
|
|
380
|
-
pagination
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
offset,
|
|
384
|
-
hasMore: offset + maxResults < totalViolations,
|
|
385
|
-
},
|
|
411
|
+
pagination,
|
|
412
|
+
...(execution === undefined ? {} : { execution }),
|
|
413
|
+
summary: describeScan(counts, paginatedViolations, pagination, execution === undefined ? [] : [execution.note]),
|
|
386
414
|
};
|
|
387
415
|
}
|
|
388
416
|
/**
|