@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
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @angular-modernizer/adapter-mcp - Output schema pieces of the build tools
|
|
3
|
+
*
|
|
4
|
+
* Shared by run-build and check-incremental-compatibility, which both return
|
|
5
|
+
* the `IncompatibilityCheck` list of the core IncompatibilityDetector.
|
|
6
|
+
*/
|
|
7
|
+
/** Schema of an `IncompatibilityCheck` list. */
|
|
8
|
+
export const INCOMPATIBILITY_ISSUES_SCHEMA = {
|
|
9
|
+
type: 'array',
|
|
10
|
+
items: {
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
type: { type: 'string' },
|
|
14
|
+
detected: { type: 'boolean' },
|
|
15
|
+
severity: { type: 'string', enum: ['blocker', 'warning'] },
|
|
16
|
+
message: { type: 'string' },
|
|
17
|
+
recommendation: { type: 'string' },
|
|
18
|
+
details: { type: 'object' },
|
|
19
|
+
},
|
|
20
|
+
required: ['type', 'detected', 'severity', 'message', 'recommendation'],
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=build-schemas.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node file system implementation of the api `CitationFileSource`.
|
|
3
|
+
*
|
|
4
|
+
* Lists repository files with `git ls-files` (tracked and untracked, ignored
|
|
5
|
+
* files excluded), and walks the directory without dependency and build
|
|
6
|
+
* folders when the root is not a git repository.
|
|
7
|
+
*/
|
|
8
|
+
import { type CitationFileSource } from '@angular-modernizer/api';
|
|
9
|
+
export declare function createNodeCitationFileSource(root: string): CitationFileSource;
|
|
10
|
+
//# sourceMappingURL=citation-file-source.d.ts.map
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node file system implementation of the api `CitationFileSource`.
|
|
3
|
+
*
|
|
4
|
+
* Lists repository files with `git ls-files` (tracked and untracked, ignored
|
|
5
|
+
* files excluded), and walks the directory without dependency and build
|
|
6
|
+
* folders when the root is not a git repository.
|
|
7
|
+
*/
|
|
8
|
+
import { execFileSync } from 'node:child_process';
|
|
9
|
+
import { readFileSync, readdirSync, statSync } from 'node:fs';
|
|
10
|
+
import { join, sep } from 'node:path';
|
|
11
|
+
const SKIPPED_DIRECTORIES = new Set([
|
|
12
|
+
'node_modules',
|
|
13
|
+
'.git',
|
|
14
|
+
'.angular',
|
|
15
|
+
'.nx',
|
|
16
|
+
'dist',
|
|
17
|
+
'coverage',
|
|
18
|
+
'out-tsc',
|
|
19
|
+
]);
|
|
20
|
+
/** Stops the walk on a mistaken root such as `/`. */
|
|
21
|
+
const MAX_WALKED_FILES = 200_000;
|
|
22
|
+
export function createNodeCitationFileSource(root) {
|
|
23
|
+
return {
|
|
24
|
+
listFiles: () => gitFiles(root) ?? walk(root),
|
|
25
|
+
isFile: (path) => {
|
|
26
|
+
try {
|
|
27
|
+
return statSync(path).isFile();
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
readFile: (path) => readFileSync(path, 'utf8'),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function gitFiles(root) {
|
|
37
|
+
try {
|
|
38
|
+
const out = execFileSync('git', ['ls-files', '--cached', '--others', '--exclude-standard'], {
|
|
39
|
+
cwd: root,
|
|
40
|
+
encoding: 'utf8',
|
|
41
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
42
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
43
|
+
});
|
|
44
|
+
return out
|
|
45
|
+
.split('\n')
|
|
46
|
+
.filter(Boolean)
|
|
47
|
+
.map((f) => f.split('/').join(sep));
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function walk(root) {
|
|
54
|
+
const files = [];
|
|
55
|
+
const stack = [''];
|
|
56
|
+
while (stack.length > 0 && files.length < MAX_WALKED_FILES) {
|
|
57
|
+
const dir = stack.pop();
|
|
58
|
+
if (dir === undefined) {
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
let entries;
|
|
62
|
+
try {
|
|
63
|
+
entries = readdirSync(join(root, dir), { withFileTypes: true });
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
for (const entry of entries) {
|
|
69
|
+
const rel = dir === '' ? entry.name : join(dir, entry.name);
|
|
70
|
+
if (entry.isDirectory()) {
|
|
71
|
+
if (!SKIPPED_DIRECTORIES.has(entry.name)) {
|
|
72
|
+
stack.push(rel);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
files.push(rel);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return files;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=citation-file-source.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result window of scan-all.
|
|
3
|
+
*
|
|
4
|
+
* Every finding, from the cache or newly analyzed, passes through the same
|
|
5
|
+
* steps: the rule filter, then the totals of the summary, then the page
|
|
6
|
+
* [offset, offset + limit). The window holds at most `limit` findings, so a
|
|
7
|
+
* large project does not keep all findings in memory for one page.
|
|
8
|
+
*/
|
|
9
|
+
/** A finding as scan-all collects and caches it. */
|
|
10
|
+
export interface WindowFinding {
|
|
11
|
+
ruleId?: unknown;
|
|
12
|
+
filePath?: unknown;
|
|
13
|
+
severity?: unknown;
|
|
14
|
+
category?: unknown;
|
|
15
|
+
}
|
|
16
|
+
export interface FindingTotals {
|
|
17
|
+
totalViolations: number;
|
|
18
|
+
bySeverity: Record<string, number>;
|
|
19
|
+
byCategory: Record<string, number>;
|
|
20
|
+
byRule: Record<string, number>;
|
|
21
|
+
}
|
|
22
|
+
export declare class FindingWindow<T extends WindowFinding> {
|
|
23
|
+
private readonly offset;
|
|
24
|
+
private readonly limit;
|
|
25
|
+
private readonly rules;
|
|
26
|
+
private readonly page;
|
|
27
|
+
private readonly totals;
|
|
28
|
+
/**
|
|
29
|
+
* @param rules - Rule IDs to keep; empty or undefined keeps every rule
|
|
30
|
+
* @param offset - Index of the first finding of the page
|
|
31
|
+
* @param limit - Maximum number of findings on the page
|
|
32
|
+
*/
|
|
33
|
+
constructor(rules: readonly string[] | undefined, offset: number, limit: number);
|
|
34
|
+
/** Count the finding and keep it when it falls on the page. */
|
|
35
|
+
add(finding: T): void;
|
|
36
|
+
/** Findings of the page, in the order they were added. */
|
|
37
|
+
getPage(): readonly T[];
|
|
38
|
+
/** Totals over every finding that passed the rule filter. */
|
|
39
|
+
getTotals(): FindingTotals;
|
|
40
|
+
/** Whether findings follow after the page. */
|
|
41
|
+
hasMore(): boolean;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=finding-window.d.ts.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result window of scan-all.
|
|
3
|
+
*
|
|
4
|
+
* Every finding, from the cache or newly analyzed, passes through the same
|
|
5
|
+
* steps: the rule filter, then the totals of the summary, then the page
|
|
6
|
+
* [offset, offset + limit). The window holds at most `limit` findings, so a
|
|
7
|
+
* large project does not keep all findings in memory for one page.
|
|
8
|
+
*/
|
|
9
|
+
export class FindingWindow {
|
|
10
|
+
offset;
|
|
11
|
+
limit;
|
|
12
|
+
rules;
|
|
13
|
+
page = [];
|
|
14
|
+
totals = {
|
|
15
|
+
totalViolations: 0,
|
|
16
|
+
bySeverity: {},
|
|
17
|
+
byCategory: {},
|
|
18
|
+
byRule: {},
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* @param rules - Rule IDs to keep; empty or undefined keeps every rule
|
|
22
|
+
* @param offset - Index of the first finding of the page
|
|
23
|
+
* @param limit - Maximum number of findings on the page
|
|
24
|
+
*/
|
|
25
|
+
constructor(rules, offset, limit) {
|
|
26
|
+
this.offset = offset;
|
|
27
|
+
this.limit = limit;
|
|
28
|
+
this.rules = rules?.length ? new Set(rules) : undefined;
|
|
29
|
+
}
|
|
30
|
+
/** Count the finding and keep it when it falls on the page. */
|
|
31
|
+
add(finding) {
|
|
32
|
+
if (typeof finding.ruleId !== 'string' || !finding.filePath) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (this.rules && !this.rules.has(finding.ruleId)) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const index = this.totals.totalViolations++;
|
|
39
|
+
increment(this.totals.byRule, finding.ruleId);
|
|
40
|
+
increment(this.totals.bySeverity, String(finding.severity));
|
|
41
|
+
increment(this.totals.byCategory, typeof finding.category === 'string' && finding.category
|
|
42
|
+
? finding.category
|
|
43
|
+
: 'General');
|
|
44
|
+
if (index >= this.offset && index < this.offset + this.limit) {
|
|
45
|
+
this.page.push(finding);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** Findings of the page, in the order they were added. */
|
|
49
|
+
getPage() {
|
|
50
|
+
return this.page;
|
|
51
|
+
}
|
|
52
|
+
/** Totals over every finding that passed the rule filter. */
|
|
53
|
+
getTotals() {
|
|
54
|
+
return this.totals;
|
|
55
|
+
}
|
|
56
|
+
/** Whether findings follow after the page. */
|
|
57
|
+
hasMore() {
|
|
58
|
+
return this.offset + this.limit < this.totals.totalViolations;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function increment(counts, key) {
|
|
62
|
+
counts[key] = (counts[key] ?? 0) + 1;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=finding-window.js.map
|
|
@@ -0,0 +1,86 @@
|
|
|
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
|
+
/** One violation as stored in a snapshot and reported in a delta. */
|
|
15
|
+
export interface HealthViolation {
|
|
16
|
+
ruleId: string;
|
|
17
|
+
/** Relative to the project root. */
|
|
18
|
+
filePath: string;
|
|
19
|
+
message: string;
|
|
20
|
+
severity: string;
|
|
21
|
+
category: string;
|
|
22
|
+
line?: number;
|
|
23
|
+
}
|
|
24
|
+
/** Scan arguments that change which violations a run can find. */
|
|
25
|
+
export interface HealthScope {
|
|
26
|
+
rules: string[] | null;
|
|
27
|
+
includePatterns: string[] | null;
|
|
28
|
+
excludePatterns: string[] | null;
|
|
29
|
+
}
|
|
30
|
+
/** Content of the snapshot file. */
|
|
31
|
+
export interface HealthSnapshot {
|
|
32
|
+
version: typeof HEALTH_SNAPSHOT_VERSION;
|
|
33
|
+
createdAt: string;
|
|
34
|
+
scope: HealthScope;
|
|
35
|
+
rulesExecuted: string[];
|
|
36
|
+
analyzedFiles: number;
|
|
37
|
+
violations: HealthViolation[];
|
|
38
|
+
}
|
|
39
|
+
/** Counts of one rule in the previous and the current run. */
|
|
40
|
+
export interface RuleDelta {
|
|
41
|
+
ruleId: string;
|
|
42
|
+
previous: number;
|
|
43
|
+
current: number;
|
|
44
|
+
new: number;
|
|
45
|
+
fixed: number;
|
|
46
|
+
unchanged: number;
|
|
47
|
+
}
|
|
48
|
+
/** Counts of one file whose violations changed. */
|
|
49
|
+
export interface FileDelta {
|
|
50
|
+
filePath: string;
|
|
51
|
+
previous: number;
|
|
52
|
+
current: number;
|
|
53
|
+
new: number;
|
|
54
|
+
fixed: number;
|
|
55
|
+
}
|
|
56
|
+
/** Result of comparing two runs. */
|
|
57
|
+
export interface HealthDelta {
|
|
58
|
+
newViolations: HealthViolation[];
|
|
59
|
+
fixedViolations: HealthViolation[];
|
|
60
|
+
unchanged: number;
|
|
61
|
+
/** Every rule with violations in either run. */
|
|
62
|
+
byRule: RuleDelta[];
|
|
63
|
+
/** Only files with new or fixed violations. */
|
|
64
|
+
byFile: FileDelta[];
|
|
65
|
+
}
|
|
66
|
+
export declare const HEALTH_SNAPSHOT_VERSION = 1;
|
|
67
|
+
/** Snapshot location relative to the project root, next to the scan cache. */
|
|
68
|
+
export declare const DEFAULT_HEALTH_SNAPSHOT_PATH = ".angular-modernizer-cache/health/last-run.json";
|
|
69
|
+
/** Message without digits and repeated whitespace, used as matching key. */
|
|
70
|
+
export declare function normalizeMessage(message: string): string;
|
|
71
|
+
/** Orders violations by file, line and rule. */
|
|
72
|
+
export declare function compareViolations(a: HealthViolation, b: HealthViolation): number;
|
|
73
|
+
/** Snapshot file content: one line per file with violations. */
|
|
74
|
+
export declare function serializeHealthSnapshot(snapshot: HealthSnapshot): string;
|
|
75
|
+
/**
|
|
76
|
+
* Reads snapshot file content.
|
|
77
|
+
*
|
|
78
|
+
* @returns the snapshot, or `undefined` when the text is not JSON, has another
|
|
79
|
+
* version or misses required fields.
|
|
80
|
+
*/
|
|
81
|
+
export declare function parseHealthSnapshot(text: string): HealthSnapshot | undefined;
|
|
82
|
+
/** Readable differences between two scopes; empty when they match. */
|
|
83
|
+
export declare function scopeDifferences(previous: HealthScope, current: HealthScope): string[];
|
|
84
|
+
/** Compares the violations of the previous run with the current one. */
|
|
85
|
+
export declare function compareHealth(previous: readonly HealthViolation[], current: readonly HealthViolation[]): HealthDelta;
|
|
86
|
+
//# sourceMappingURL=health-delta.d.ts.map
|
|
@@ -0,0 +1,239 @@
|
|
|
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
|
+
export const HEALTH_SNAPSHOT_VERSION = 1;
|
|
15
|
+
/** Snapshot location relative to the project root, next to the scan cache. */
|
|
16
|
+
export const DEFAULT_HEALTH_SNAPSHOT_PATH = '.angular-modernizer-cache/health/last-run.json';
|
|
17
|
+
/** Message without digits and repeated whitespace, used as matching key. */
|
|
18
|
+
export function normalizeMessage(message) {
|
|
19
|
+
return message.replace(/\d+/g, '#').replace(/\s+/g, ' ').trim();
|
|
20
|
+
}
|
|
21
|
+
/** Orders violations by file, line and rule. */
|
|
22
|
+
export function compareViolations(a, b) {
|
|
23
|
+
return (a.filePath.localeCompare(b.filePath) ||
|
|
24
|
+
(a.line ?? 0) - (b.line ?? 0) ||
|
|
25
|
+
a.ruleId.localeCompare(b.ruleId));
|
|
26
|
+
}
|
|
27
|
+
/** Snapshot file content: one line per file with violations. */
|
|
28
|
+
export function serializeHealthSnapshot(snapshot) {
|
|
29
|
+
const files = new Map();
|
|
30
|
+
for (const v of snapshot.violations) {
|
|
31
|
+
const stored = [
|
|
32
|
+
v.ruleId,
|
|
33
|
+
v.line ?? null,
|
|
34
|
+
v.severity,
|
|
35
|
+
v.category,
|
|
36
|
+
v.message,
|
|
37
|
+
];
|
|
38
|
+
pushTo(files, v.filePath, stored);
|
|
39
|
+
}
|
|
40
|
+
const header = JSON.stringify({
|
|
41
|
+
version: snapshot.version,
|
|
42
|
+
createdAt: snapshot.createdAt,
|
|
43
|
+
scope: snapshot.scope,
|
|
44
|
+
rulesExecuted: snapshot.rulesExecuted,
|
|
45
|
+
analyzedFiles: snapshot.analyzedFiles,
|
|
46
|
+
totalViolations: snapshot.violations.length,
|
|
47
|
+
});
|
|
48
|
+
const lines = [...files].map(([file, list]) => `${JSON.stringify(file)}:${JSON.stringify(list)}`);
|
|
49
|
+
return `${header.slice(0, -1)},"files":{\n${lines.join(',\n')}\n}}\n`;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Reads snapshot file content.
|
|
53
|
+
*
|
|
54
|
+
* @returns the snapshot, or `undefined` when the text is not JSON, has another
|
|
55
|
+
* version or misses required fields.
|
|
56
|
+
*/
|
|
57
|
+
export function parseHealthSnapshot(text) {
|
|
58
|
+
let data;
|
|
59
|
+
try {
|
|
60
|
+
data = JSON.parse(text);
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
if (!isRecord(data) || data['version'] !== HEALTH_SNAPSHOT_VERSION) {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
const { createdAt, scope, rulesExecuted, analyzedFiles, files } = data;
|
|
69
|
+
const valid = typeof createdAt === 'string' &&
|
|
70
|
+
isScope(scope) &&
|
|
71
|
+
isStringArray(rulesExecuted) &&
|
|
72
|
+
typeof analyzedFiles === 'number' &&
|
|
73
|
+
isRecord(files);
|
|
74
|
+
if (!valid) {
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
const violations = [];
|
|
78
|
+
for (const [filePath, list] of Object.entries(files)) {
|
|
79
|
+
if (!Array.isArray(list) || !list.every(isStoredViolation)) {
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
for (const [ruleId, line, severity, category, message] of list) {
|
|
83
|
+
violations.push({
|
|
84
|
+
ruleId,
|
|
85
|
+
filePath,
|
|
86
|
+
message,
|
|
87
|
+
severity,
|
|
88
|
+
category,
|
|
89
|
+
...(line === null ? {} : { line }),
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
version: HEALTH_SNAPSHOT_VERSION,
|
|
95
|
+
createdAt,
|
|
96
|
+
scope,
|
|
97
|
+
rulesExecuted,
|
|
98
|
+
analyzedFiles,
|
|
99
|
+
violations,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/** Readable differences between two scopes; empty when they match. */
|
|
103
|
+
export function scopeDifferences(previous, current) {
|
|
104
|
+
const keys = ['rules', 'includePatterns', 'excludePatterns'];
|
|
105
|
+
return keys
|
|
106
|
+
.filter((key) => !sameList(previous[key], current[key]))
|
|
107
|
+
.map((key) => `${key}: ${describeList(previous[key])} -> ${describeList(current[key])}`);
|
|
108
|
+
}
|
|
109
|
+
/** Compares the violations of the previous run with the current one. */
|
|
110
|
+
export function compareHealth(previous, current) {
|
|
111
|
+
const previousGroups = groupByRuleAndFile(previous);
|
|
112
|
+
const currentGroups = groupByRuleAndFile(current);
|
|
113
|
+
const keys = new Set([...previousGroups.keys(), ...currentGroups.keys()]);
|
|
114
|
+
const newViolations = [];
|
|
115
|
+
const fixedViolations = [];
|
|
116
|
+
const rules = new Map();
|
|
117
|
+
const files = new Map();
|
|
118
|
+
let unchanged = 0;
|
|
119
|
+
for (const key of keys) {
|
|
120
|
+
const before = previousGroups.get(key) ?? [];
|
|
121
|
+
const after = currentGroups.get(key) ?? [];
|
|
122
|
+
const match = matchGroup(before, after);
|
|
123
|
+
newViolations.push(...match.added);
|
|
124
|
+
fixedViolations.push(...match.removed);
|
|
125
|
+
unchanged += match.unchanged;
|
|
126
|
+
const sample = after[0] ?? before[0];
|
|
127
|
+
if (sample === undefined) {
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
const rule = rules.get(sample.ruleId) ?? emptyRule(sample.ruleId);
|
|
131
|
+
rule.previous += before.length;
|
|
132
|
+
rule.current += after.length;
|
|
133
|
+
rule.new += match.added.length;
|
|
134
|
+
rule.fixed += match.removed.length;
|
|
135
|
+
rule.unchanged += match.unchanged;
|
|
136
|
+
rules.set(sample.ruleId, rule);
|
|
137
|
+
const file = files.get(sample.filePath) ?? emptyFile(sample.filePath);
|
|
138
|
+
file.previous += before.length;
|
|
139
|
+
file.current += after.length;
|
|
140
|
+
file.new += match.added.length;
|
|
141
|
+
file.fixed += match.removed.length;
|
|
142
|
+
files.set(sample.filePath, file);
|
|
143
|
+
}
|
|
144
|
+
const changes = (d) => d.new + d.fixed;
|
|
145
|
+
return {
|
|
146
|
+
newViolations: newViolations.sort(compareViolations),
|
|
147
|
+
fixedViolations: fixedViolations.sort(compareViolations),
|
|
148
|
+
unchanged,
|
|
149
|
+
byRule: [...rules.values()].sort((a, b) => changes(b) - changes(a) ||
|
|
150
|
+
b.current - a.current ||
|
|
151
|
+
a.ruleId.localeCompare(b.ruleId)),
|
|
152
|
+
byFile: [...files.values()]
|
|
153
|
+
.filter((f) => changes(f) > 0)
|
|
154
|
+
.sort((a, b) => changes(b) - changes(a) || a.filePath.localeCompare(b.filePath)),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
function matchGroup(before, after) {
|
|
158
|
+
const byMessage = new Map();
|
|
159
|
+
for (const v of [...before].sort(compareViolations)) {
|
|
160
|
+
pushTo(byMessage, normalizeMessage(v.message), v);
|
|
161
|
+
}
|
|
162
|
+
const unmatchedAfter = [];
|
|
163
|
+
for (const v of [...after].sort(compareViolations)) {
|
|
164
|
+
const candidates = byMessage.get(normalizeMessage(v.message));
|
|
165
|
+
if (candidates === undefined || candidates.length === 0) {
|
|
166
|
+
unmatchedAfter.push(v);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
candidates.shift();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
const unmatchedBefore = [...byMessage.values()]
|
|
173
|
+
.flat()
|
|
174
|
+
.sort(compareViolations);
|
|
175
|
+
const paired = Math.min(unmatchedBefore.length, unmatchedAfter.length);
|
|
176
|
+
return {
|
|
177
|
+
added: unmatchedAfter.slice(paired),
|
|
178
|
+
removed: unmatchedBefore.slice(paired),
|
|
179
|
+
unchanged: after.length - (unmatchedAfter.length - paired),
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
function groupByRuleAndFile(violations) {
|
|
183
|
+
const groups = new Map();
|
|
184
|
+
for (const v of violations) {
|
|
185
|
+
pushTo(groups, `${v.ruleId}\u0000${v.filePath}`, v);
|
|
186
|
+
}
|
|
187
|
+
return groups;
|
|
188
|
+
}
|
|
189
|
+
function pushTo(map, key, value) {
|
|
190
|
+
const list = map.get(key);
|
|
191
|
+
if (list === undefined) {
|
|
192
|
+
map.set(key, [value]);
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
list.push(value);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function emptyRule(ruleId) {
|
|
199
|
+
return { ruleId, previous: 0, current: 0, new: 0, fixed: 0, unchanged: 0 };
|
|
200
|
+
}
|
|
201
|
+
function emptyFile(filePath) {
|
|
202
|
+
return { filePath, previous: 0, current: 0, new: 0, fixed: 0 };
|
|
203
|
+
}
|
|
204
|
+
function sameList(a, b) {
|
|
205
|
+
if (a === null || b === null) {
|
|
206
|
+
return a === b;
|
|
207
|
+
}
|
|
208
|
+
const left = [...a].sort();
|
|
209
|
+
const right = [...b].sort();
|
|
210
|
+
return left.length === right.length && left.every((x, i) => x === right[i]);
|
|
211
|
+
}
|
|
212
|
+
function describeList(list) {
|
|
213
|
+
return list === null ? 'default' : `[${list.join(', ')}]`;
|
|
214
|
+
}
|
|
215
|
+
function isRecord(value) {
|
|
216
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
217
|
+
}
|
|
218
|
+
function isStringArray(value) {
|
|
219
|
+
return Array.isArray(value) && value.every((x) => typeof x === 'string');
|
|
220
|
+
}
|
|
221
|
+
function isListOrNull(value) {
|
|
222
|
+
return value === null || isStringArray(value);
|
|
223
|
+
}
|
|
224
|
+
function isScope(value) {
|
|
225
|
+
return (isRecord(value) &&
|
|
226
|
+
isListOrNull(value['rules']) &&
|
|
227
|
+
isListOrNull(value['includePatterns']) &&
|
|
228
|
+
isListOrNull(value['excludePatterns']));
|
|
229
|
+
}
|
|
230
|
+
function isStoredViolation(value) {
|
|
231
|
+
return (Array.isArray(value) &&
|
|
232
|
+
value.length === 5 &&
|
|
233
|
+
typeof value[0] === 'string' &&
|
|
234
|
+
(value[1] === null || typeof value[1] === 'number') &&
|
|
235
|
+
typeof value[2] === 'string' &&
|
|
236
|
+
typeof value[3] === 'string' &&
|
|
237
|
+
typeof value[4] === 'string');
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=health-delta.js.map
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @angular-modernizer/adapter-mcp - Output schema parts of the investigation tools
|
|
3
|
+
*
|
|
4
|
+
* JSON Schema pieces for api result types that more than one tool returns
|
|
5
|
+
* (find-component-hosts and trace-output-flow share the dynamic host types).
|
|
6
|
+
* Objects stay open, see `output-contract.ts`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const STRING_ARRAY: {
|
|
9
|
+
readonly type: "array";
|
|
10
|
+
readonly items: {
|
|
11
|
+
readonly type: "string";
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
/** `Record<string, number>`. */
|
|
15
|
+
export declare const COUNT_OBJECT: {
|
|
16
|
+
readonly type: "object";
|
|
17
|
+
readonly additionalProperties: {
|
|
18
|
+
readonly type: "integer";
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
/** Same-name classes the query also matched. */
|
|
22
|
+
export declare const ALTERNATIVES_SCHEMA: {
|
|
23
|
+
readonly type: "array";
|
|
24
|
+
readonly items: {
|
|
25
|
+
readonly type: "object";
|
|
26
|
+
readonly properties: {
|
|
27
|
+
readonly className: {
|
|
28
|
+
readonly type: "string";
|
|
29
|
+
};
|
|
30
|
+
readonly file: {
|
|
31
|
+
readonly type: "string";
|
|
32
|
+
};
|
|
33
|
+
readonly selector: {
|
|
34
|
+
readonly type: "string";
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
readonly required: readonly ["className", "file", "selector"];
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
/** api `DynamicRoute`: a route entry that loads the component. */
|
|
41
|
+
export declare const DYNAMIC_ROUTE_SCHEMA: {
|
|
42
|
+
readonly type: "object";
|
|
43
|
+
readonly properties: {
|
|
44
|
+
readonly path: {
|
|
45
|
+
readonly type: "string";
|
|
46
|
+
};
|
|
47
|
+
readonly lazy: {
|
|
48
|
+
readonly type: "boolean";
|
|
49
|
+
};
|
|
50
|
+
readonly guards: {
|
|
51
|
+
readonly type: "array";
|
|
52
|
+
readonly items: {
|
|
53
|
+
readonly type: "string";
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
readonly data: {
|
|
57
|
+
readonly type: "string";
|
|
58
|
+
};
|
|
59
|
+
readonly resolve: {
|
|
60
|
+
readonly type: "array";
|
|
61
|
+
readonly items: {
|
|
62
|
+
readonly type: "string";
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
readonly required: readonly ["path", "lazy", "guards"];
|
|
67
|
+
};
|
|
68
|
+
/** api `DynamicResultUse`: what the creating code does with the result. */
|
|
69
|
+
export declare const DYNAMIC_RESULT_USE_SCHEMA: {
|
|
70
|
+
readonly type: "object";
|
|
71
|
+
readonly properties: {
|
|
72
|
+
readonly use: {
|
|
73
|
+
readonly type: "string";
|
|
74
|
+
};
|
|
75
|
+
readonly chain: {
|
|
76
|
+
readonly type: "array";
|
|
77
|
+
readonly items: {
|
|
78
|
+
readonly type: "string";
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
readonly target: {
|
|
82
|
+
readonly type: "string";
|
|
83
|
+
};
|
|
84
|
+
readonly text: {
|
|
85
|
+
readonly type: "string";
|
|
86
|
+
};
|
|
87
|
+
readonly note: {
|
|
88
|
+
readonly type: "string";
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
readonly required: readonly ["use", "chain"];
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=investigation-schemas.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @angular-modernizer/adapter-mcp - Output schema parts of the investigation tools
|
|
3
|
+
*
|
|
4
|
+
* JSON Schema pieces for api result types that more than one tool returns
|
|
5
|
+
* (find-component-hosts and trace-output-flow share the dynamic host types).
|
|
6
|
+
* Objects stay open, see `output-contract.ts`.
|
|
7
|
+
*/
|
|
8
|
+
export const STRING_ARRAY = { type: 'array', items: { type: 'string' } };
|
|
9
|
+
/** `Record<string, number>`. */
|
|
10
|
+
export const COUNT_OBJECT = { type: 'object', additionalProperties: { type: 'integer' } };
|
|
11
|
+
/** Same-name classes the query also matched. */
|
|
12
|
+
export const ALTERNATIVES_SCHEMA = {
|
|
13
|
+
type: 'array',
|
|
14
|
+
items: {
|
|
15
|
+
type: 'object',
|
|
16
|
+
properties: {
|
|
17
|
+
className: { type: 'string' },
|
|
18
|
+
file: { type: 'string' },
|
|
19
|
+
selector: { type: 'string' },
|
|
20
|
+
},
|
|
21
|
+
required: ['className', 'file', 'selector'],
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
/** api `DynamicRoute`: a route entry that loads the component. */
|
|
25
|
+
export const DYNAMIC_ROUTE_SCHEMA = {
|
|
26
|
+
type: 'object',
|
|
27
|
+
properties: {
|
|
28
|
+
path: { type: 'string' },
|
|
29
|
+
lazy: { type: 'boolean' },
|
|
30
|
+
guards: STRING_ARRAY,
|
|
31
|
+
data: { type: 'string' },
|
|
32
|
+
resolve: STRING_ARRAY,
|
|
33
|
+
},
|
|
34
|
+
required: ['path', 'lazy', 'guards'],
|
|
35
|
+
};
|
|
36
|
+
/** api `DynamicResultUse`: what the creating code does with the result. */
|
|
37
|
+
export const DYNAMIC_RESULT_USE_SCHEMA = {
|
|
38
|
+
type: 'object',
|
|
39
|
+
properties: {
|
|
40
|
+
use: { type: 'string' },
|
|
41
|
+
chain: STRING_ARRAY,
|
|
42
|
+
target: { type: 'string' },
|
|
43
|
+
text: { type: 'string' },
|
|
44
|
+
note: { type: 'string' },
|
|
45
|
+
},
|
|
46
|
+
required: ['use', 'chain'],
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=investigation-schemas.js.map
|