@angular-modernizer/adapter-mcp 0.3.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +181 -282
- package/dist/cli.js +21 -13
- package/dist/core/project-analyzer.d.ts +3 -12
- package/dist/core/project-analyzer.js +3 -12
- package/dist/index.d.ts +122 -6
- package/dist/index.js +49 -5
- package/dist/mcp-watcher.d.ts +32 -7
- package/dist/mcp-watcher.js +16 -15
- package/dist/scan-host/scan-host.d.ts +119 -0
- package/dist/scan-host/scan-host.js +376 -0
- package/dist/scan-host/scan-protocol.d.ts +35 -0
- package/dist/scan-host/scan-protocol.js +6 -0
- package/dist/scan-host/scan-worker.d.ts +14 -0
- package/dist/scan-host/scan-worker.js +48 -0
- package/dist/server/limited-stdio-transport.d.ts +75 -0
- package/dist/server/limited-stdio-transport.js +115 -0
- package/dist/server/mcp-server.d.ts +20 -18
- package/dist/server/mcp-server.js +42 -79
- package/dist/server/package-version.d.ts +16 -0
- package/dist/server/package-version.js +37 -0
- package/dist/server/sdk-server.d.ts +71 -0
- package/dist/server/sdk-server.js +113 -0
- package/dist/server/tool-registry.d.ts +6 -9
- package/dist/server/tool-registry.js +6 -12
- package/dist/streaming/progress-store.d.ts +22 -5
- package/dist/streaming/progress-store.js +9 -5
- package/dist/tools/analyze-build-impact.d.ts +276 -35
- package/dist/tools/analyze-build-impact.js +175 -28
- package/dist/tools/analyze-core-to-shared.d.ts +176 -16
- package/dist/tools/analyze-core-to-shared.js +124 -19
- package/dist/tools/analyze-parser-performance.d.ts +209 -15
- package/dist/tools/analyze-parser-performance.js +119 -56
- package/dist/tools/analyze-project.d.ts +349 -17
- package/dist/tools/analyze-project.js +282 -97
- package/dist/tools/check-incremental-compatibility.d.ts +74 -12
- package/dist/tools/check-incremental-compatibility.js +69 -10
- package/dist/tools/collect-feedback.d.ts +225 -21
- package/dist/tools/collect-feedback.js +199 -118
- package/dist/tools/compare-health.d.ts +413 -0
- package/dist/tools/compare-health.js +479 -0
- package/dist/tools/extract-libraries.d.ts +200 -24
- package/dist/tools/extract-libraries.js +131 -27
- package/dist/tools/find-angular-symbol.d.ts +92 -24
- package/dist/tools/find-angular-symbol.js +70 -20
- package/dist/tools/find-component-hosts.d.ts +603 -27
- package/dist/tools/find-component-hosts.js +223 -19
- package/dist/tools/find-usages.d.ts +102 -22
- package/dist/tools/find-usages.js +81 -21
- package/dist/tools/get-bootstrap-execution.d.ts +183 -25
- package/dist/tools/get-bootstrap-execution.js +109 -25
- package/dist/tools/get-call-graph.d.ts +127 -12
- package/dist/tools/get-call-graph.js +84 -19
- package/dist/tools/get-operation-progress-tool.d.ts +126 -8
- package/dist/tools/get-operation-progress-tool.js +124 -12
- package/dist/tools/get-operation-progress.d.ts +27 -1
- package/dist/tools/get-operation-progress.js +5 -5
- package/dist/tools/helpers/analysis-output.d.ts +182 -0
- package/dist/tools/helpers/analysis-output.js +165 -0
- package/dist/tools/helpers/batch-kernel.d.ts +14 -0
- package/dist/tools/helpers/batch-kernel.js +12 -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/compact-output.d.ts +2 -1
- package/dist/tools/helpers/compact-output.js +2 -1
- 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 +99 -0
- package/dist/tools/helpers/health-delta.js +236 -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 +60 -37
- package/dist/tools/helpers/project-cache.js +54 -37
- 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 +25 -13
- package/dist/tools/helpers/rule-runner.js +45 -24
- package/dist/tools/helpers/scan-cache.d.ts +22 -0
- package/dist/tools/helpers/scan-cache.js +34 -0
- package/dist/tools/helpers/scan-engine.d.ts +107 -0
- package/dist/tools/helpers/scan-engine.js +197 -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/suggestion-generator.d.ts +9 -13
- package/dist/tools/helpers/suggestion-generator.js +0 -12
- package/dist/tools/helpers/tool-cache.d.ts +11 -0
- package/dist/tools/helpers/tool-cache.js +15 -0
- package/dist/tools/helpers/tool-context.d.ts +63 -0
- package/dist/tools/helpers/tool-context.js +79 -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 +262 -24
- package/dist/tools/inspect-form-group.js +134 -13
- package/dist/tools/inspect-i18n.d.ts +410 -23
- package/dist/tools/inspect-i18n.js +213 -13
- package/dist/tools/inspect-template.d.ts +260 -22
- package/dist/tools/inspect-template.js +174 -13
- package/dist/tools/learn-patterns.d.ts +210 -13
- package/dist/tools/learn-patterns.js +113 -12
- package/dist/tools/list-imports.d.ts +152 -34
- package/dist/tools/list-imports.js +124 -18
- package/dist/tools/orchestrate-migration.d.ts +159 -14
- package/dist/tools/orchestrate-migration.js +147 -20
- package/dist/tools/parse-stack-trace.d.ts +78 -21
- package/dist/tools/parse-stack-trace.js +44 -7
- package/dist/tools/plan-migration.d.ts +395 -26
- package/dist/tools/plan-migration.js +173 -22
- package/dist/tools/resolve-type.d.ts +57 -9
- package/dist/tools/resolve-type.js +49 -12
- package/dist/tools/review-feedback.d.ts +214 -16
- package/dist/tools/review-feedback.js +142 -57
- package/dist/tools/rollback-changes.d.ts +88 -7
- package/dist/tools/rollback-changes.js +74 -19
- package/dist/tools/run-angular-cli.d.ts +57 -12
- package/dist/tools/run-angular-cli.js +76 -13
- package/dist/tools/run-build.d.ts +127 -13
- package/dist/tools/run-build.js +128 -16
- package/dist/tools/run-schematic.d.ts +82 -12
- package/dist/tools/run-schematic.js +115 -18
- package/dist/tools/scan-all.d.ts +88 -23
- package/dist/tools/scan-all.js +161 -220
- package/dist/tools/scan-angular.d.ts +60 -19
- package/dist/tools/scan-angular.js +100 -141
- package/dist/tools/scan-architecture.d.ts +92 -24
- package/dist/tools/scan-architecture.js +268 -211
- package/dist/tools/scan-solid.d.ts +59 -19
- package/dist/tools/scan-solid.js +98 -139
- package/dist/tools/search-codebase.d.ts +110 -23
- package/dist/tools/search-codebase.js +67 -11
- package/dist/tools/server-status.d.ts +392 -26
- package/dist/tools/server-status.js +260 -27
- package/dist/tools/suggest-improvements.d.ts +105 -10
- package/dist/tools/suggest-improvements.js +91 -51
- package/dist/tools/trace-output-flow.d.ts +713 -26
- package/dist/tools/trace-output-flow.js +396 -33
- 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 +402 -18
- package/dist/tools/transform-code.js +708 -649
- package/dist/tools/validate-before-transform.d.ts +136 -7
- package/dist/tools/validate-before-transform.js +65 -9
- package/dist/tools/validate-project-compatibility.d.ts +82 -15
- package/dist/tools/validate-project-compatibility.js +84 -15
- package/dist/tools/validate-transformation.d.ts +243 -8
- package/dist/tools/validate-transformation.js +127 -23
- package/dist/tools/verify-citations.d.ts +202 -0
- package/dist/tools/verify-citations.js +221 -0
- package/dist/types.d.ts +78 -11
- package/dist/types.js +0 -5
- package/dist/utils/format-tool-response.d.ts +22 -59
- package/dist/utils/format-tool-response.js +25 -134
- package/package.json +31 -20
- 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 +0 -200
- package/dist/tools/shared/scan-types.d.ts.map +0 -1
- package/dist/tools/shared/scan-types.js +0 -7
- 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
|
@@ -1,6 +1,62 @@
|
|
|
1
|
+
import { I18nInspector, } from '@angular-modernizer/api';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { relative } from 'node:path';
|
|
4
|
+
import { findTsConfig } from './helpers/find-ts-config.js';
|
|
5
|
+
import { ProjectCache } from './helpers/project-cache.js';
|
|
6
|
+
import { COMPACT_OUTPUT_SCHEMA, limitList, parseCompactOptions, } from './helpers/compact-output.js';
|
|
7
|
+
import { WARNINGS_OUTPUT_SCHEMA, withWarnings, } from './helpers/output-contract.js';
|
|
8
|
+
import { STRING_ARRAY } from './helpers/investigation-schemas.js';
|
|
9
|
+
const SITE_SCHEMA = {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: { file: { type: 'string' }, line: { type: 'integer' } },
|
|
12
|
+
required: ['file', 'line'],
|
|
13
|
+
};
|
|
14
|
+
const USAGES_SCHEMA = {
|
|
15
|
+
type: 'array',
|
|
16
|
+
items: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
key: { type: 'string' },
|
|
20
|
+
file: { type: 'string' },
|
|
21
|
+
line: { type: 'integer' },
|
|
22
|
+
source: { type: 'string' },
|
|
23
|
+
method: { type: 'string' },
|
|
24
|
+
traced: { type: 'boolean' },
|
|
25
|
+
},
|
|
26
|
+
required: ['key', 'file', 'line', 'source'],
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
const DYNAMIC_USAGES_SCHEMA = {
|
|
30
|
+
type: 'array',
|
|
31
|
+
items: {
|
|
32
|
+
type: 'object',
|
|
33
|
+
properties: {
|
|
34
|
+
prefix: { type: 'string' },
|
|
35
|
+
file: { type: 'string' },
|
|
36
|
+
line: { type: 'integer' },
|
|
37
|
+
source: { type: 'string' },
|
|
38
|
+
method: { type: 'string' },
|
|
39
|
+
expression: { type: 'string' },
|
|
40
|
+
},
|
|
41
|
+
required: ['file', 'line', 'source'],
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
const I18N_COUNT_KEYS = [
|
|
45
|
+
'sources',
|
|
46
|
+
'definedKeys',
|
|
47
|
+
'usedKeys',
|
|
48
|
+
'usages',
|
|
49
|
+
'undefinedKeys',
|
|
50
|
+
'missingTranslations',
|
|
51
|
+
'noStaticUsage',
|
|
52
|
+
'coveredByDynamic',
|
|
53
|
+
'referencedAsLiteral',
|
|
54
|
+
'dynamicPrefixes',
|
|
55
|
+
'dynamicUsages',
|
|
56
|
+
'unresolvedUsages',
|
|
57
|
+
'templatesScanned',
|
|
58
|
+
];
|
|
1
59
|
/**
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Inspect i18n Tool
|
|
3
|
-
*
|
|
4
60
|
* MCP tool over `I18nInspector`: where translation keys are defined (per
|
|
5
61
|
* language, with file, line and value), where they are used in templates and
|
|
6
62
|
* code, in which language they are missing, which used keys are defined
|
|
@@ -14,18 +70,16 @@
|
|
|
14
70
|
* // { keys: [{ key: 'ERRORS.NO_ACCESS', status: 'used', definitions: [...], usages: [...] }], summary: '...' }
|
|
15
71
|
* ```
|
|
16
72
|
*/
|
|
17
|
-
import { I18nInspector, } from '@angular-modernizer/api';
|
|
18
|
-
import { existsSync } from 'node:fs';
|
|
19
|
-
import { relative } from 'node:path';
|
|
20
|
-
import { findTsConfig } from './helpers/find-ts-config.js';
|
|
21
|
-
import { ProjectCache } from './helpers/project-cache.js';
|
|
22
|
-
import { COMPACT_OUTPUT_SCHEMA, limitList, parseCompactOptions, } from './helpers/compact-output.js';
|
|
23
|
-
/**
|
|
24
|
-
* MCP tool that reports translation key definitions and usages.
|
|
25
|
-
*/
|
|
26
73
|
export class InspectI18nTool {
|
|
27
74
|
projects;
|
|
28
75
|
name = 'inspect-i18n';
|
|
76
|
+
title = 'Inspect i18n';
|
|
77
|
+
annotations = {
|
|
78
|
+
readOnlyHint: true,
|
|
79
|
+
destructiveHint: false,
|
|
80
|
+
idempotentHint: true,
|
|
81
|
+
openWorldHint: false,
|
|
82
|
+
};
|
|
29
83
|
constructor(projects = new ProjectCache()) {
|
|
30
84
|
this.projects = projects;
|
|
31
85
|
}
|
|
@@ -47,8 +101,13 @@ export class InspectI18nTool {
|
|
|
47
101
|
'key text appears as a string elsewhere, e.g. a menu config) or no-static-usage. For a project report ' +
|
|
48
102
|
'start with summaryOnly (drops the lists and the source details registeredAt, discoveredBy, kind, ' +
|
|
49
103
|
'conditionReason); maxResults caps every list and the usages per key, counts cover everything.';
|
|
104
|
+
/**
|
|
105
|
+
* JSON Schema of the tool arguments.
|
|
106
|
+
* @hidden
|
|
107
|
+
*/
|
|
50
108
|
inputSchema = {
|
|
51
109
|
type: 'object',
|
|
110
|
+
additionalProperties: false,
|
|
52
111
|
properties: {
|
|
53
112
|
projectRoot: {
|
|
54
113
|
type: 'string',
|
|
@@ -71,6 +130,147 @@ export class InspectI18nTool {
|
|
|
71
130
|
},
|
|
72
131
|
required: ['projectRoot'],
|
|
73
132
|
};
|
|
133
|
+
/**
|
|
134
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
135
|
+
* @hidden
|
|
136
|
+
*/
|
|
137
|
+
outputSchema = {
|
|
138
|
+
type: 'object',
|
|
139
|
+
properties: {
|
|
140
|
+
languages: { type: 'object', additionalProperties: STRING_ARRAY },
|
|
141
|
+
sources: {
|
|
142
|
+
type: 'array',
|
|
143
|
+
items: {
|
|
144
|
+
type: 'object',
|
|
145
|
+
properties: {
|
|
146
|
+
file: { type: 'string' },
|
|
147
|
+
kind: { type: 'string' },
|
|
148
|
+
lang: { type: 'string' },
|
|
149
|
+
discoveredBy: { type: 'string' },
|
|
150
|
+
conditional: { type: 'boolean' },
|
|
151
|
+
conditionReason: { type: 'string' },
|
|
152
|
+
group: { type: 'string' },
|
|
153
|
+
registeredAt: SITE_SCHEMA,
|
|
154
|
+
app: { type: 'string' },
|
|
155
|
+
keyCount: { type: 'integer' },
|
|
156
|
+
},
|
|
157
|
+
required: ['file', 'lang', 'conditional', 'app', 'keyCount'],
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
unresolvedRegistrations: {
|
|
161
|
+
type: 'array',
|
|
162
|
+
items: {
|
|
163
|
+
type: 'object',
|
|
164
|
+
properties: {
|
|
165
|
+
file: { type: 'string' },
|
|
166
|
+
line: { type: 'integer' },
|
|
167
|
+
expressions: STRING_ARRAY,
|
|
168
|
+
reason: { type: 'string' },
|
|
169
|
+
},
|
|
170
|
+
required: ['file', 'line', 'expressions', 'reason'],
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
keys: {
|
|
174
|
+
type: 'array',
|
|
175
|
+
items: {
|
|
176
|
+
type: 'object',
|
|
177
|
+
properties: {
|
|
178
|
+
key: { type: 'string' },
|
|
179
|
+
status: { type: 'string' },
|
|
180
|
+
definitions: {
|
|
181
|
+
type: 'array',
|
|
182
|
+
items: {
|
|
183
|
+
type: 'object',
|
|
184
|
+
properties: {
|
|
185
|
+
lang: { type: 'string' },
|
|
186
|
+
app: { type: 'string' },
|
|
187
|
+
file: { type: 'string' },
|
|
188
|
+
line: { type: 'integer' },
|
|
189
|
+
value: { type: 'string' },
|
|
190
|
+
conditional: { type: 'boolean' },
|
|
191
|
+
group: { type: 'string' },
|
|
192
|
+
overrides: { type: 'boolean' },
|
|
193
|
+
},
|
|
194
|
+
required: ['lang', 'file', 'line', 'value', 'conditional'],
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
missingIn: {
|
|
198
|
+
type: 'array',
|
|
199
|
+
items: {
|
|
200
|
+
type: 'object',
|
|
201
|
+
properties: { layer: { type: 'string' }, languages: STRING_ARRAY },
|
|
202
|
+
required: ['layer', 'languages'],
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
usages: USAGES_SCHEMA,
|
|
206
|
+
coveredBy: STRING_ARRAY,
|
|
207
|
+
referencedAt: { type: 'array', items: SITE_SCHEMA },
|
|
208
|
+
},
|
|
209
|
+
required: ['key', 'status', 'definitions', 'missingIn', 'usages'],
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
undefinedKeys: {
|
|
213
|
+
type: 'array',
|
|
214
|
+
items: {
|
|
215
|
+
type: 'object',
|
|
216
|
+
properties: { key: { type: 'string' }, usages: USAGES_SCHEMA },
|
|
217
|
+
required: ['key', 'usages'],
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
missingTranslations: {
|
|
221
|
+
type: 'array',
|
|
222
|
+
items: {
|
|
223
|
+
type: 'object',
|
|
224
|
+
properties: { key: { type: 'string' }, layer: { type: 'string' }, missingIn: STRING_ARRAY },
|
|
225
|
+
required: ['key', 'layer', 'missingIn'],
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
unused: {
|
|
229
|
+
type: 'array',
|
|
230
|
+
items: {
|
|
231
|
+
type: 'object',
|
|
232
|
+
properties: {
|
|
233
|
+
key: { type: 'string' },
|
|
234
|
+
status: { type: 'string' },
|
|
235
|
+
file: { type: 'string' },
|
|
236
|
+
line: { type: 'integer' },
|
|
237
|
+
},
|
|
238
|
+
required: ['key', 'status', 'file', 'line'],
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
dynamicPrefixes: {
|
|
242
|
+
type: 'array',
|
|
243
|
+
items: {
|
|
244
|
+
type: 'object',
|
|
245
|
+
properties: {
|
|
246
|
+
prefix: { type: 'string' },
|
|
247
|
+
usages: DYNAMIC_USAGES_SCHEMA,
|
|
248
|
+
definedKeys: { type: 'integer' },
|
|
249
|
+
},
|
|
250
|
+
required: ['prefix', 'usages', 'definedKeys'],
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
unresolvedUsages: DYNAMIC_USAGES_SCHEMA,
|
|
254
|
+
counts: {
|
|
255
|
+
type: 'object',
|
|
256
|
+
properties: Object.fromEntries(I18N_COUNT_KEYS.map((k) => [k, { type: 'integer' }])),
|
|
257
|
+
required: [...I18N_COUNT_KEYS],
|
|
258
|
+
},
|
|
259
|
+
truncated: { type: 'boolean' },
|
|
260
|
+
summary: { type: 'string' },
|
|
261
|
+
tsConfigPath: { type: 'string' },
|
|
262
|
+
...WARNINGS_OUTPUT_SCHEMA,
|
|
263
|
+
},
|
|
264
|
+
required: [
|
|
265
|
+
'languages',
|
|
266
|
+
'sources',
|
|
267
|
+
'unresolvedRegistrations',
|
|
268
|
+
'counts',
|
|
269
|
+
'truncated',
|
|
270
|
+
'summary',
|
|
271
|
+
'tsConfigPath',
|
|
272
|
+
],
|
|
273
|
+
};
|
|
74
274
|
async execute(args) {
|
|
75
275
|
const params = args;
|
|
76
276
|
if (!params.projectRoot || typeof params.projectRoot !== 'string') {
|
|
@@ -97,11 +297,11 @@ export class InspectI18nTool {
|
|
|
97
297
|
...(prefix === undefined ? {} : { prefix }),
|
|
98
298
|
...(i18nNames === undefined ? {} : { i18nNames }),
|
|
99
299
|
}).inspect();
|
|
100
|
-
return {
|
|
300
|
+
return withWarnings({
|
|
101
301
|
...this.shape(report, compact.summaryOnly, compact.maxResults),
|
|
102
302
|
summary: this.buildSummary(report, params.projectRoot, key ?? prefix),
|
|
103
303
|
tsConfigPath,
|
|
104
|
-
};
|
|
304
|
+
}, this.projects.warnings(tsConfigPath));
|
|
105
305
|
}
|
|
106
306
|
parseText(value, name) {
|
|
107
307
|
if (value === undefined) {
|
|
@@ -1,6 +1,27 @@
|
|
|
1
|
+
import { type MCPTool, type ToolAnnotations } from '../types.js';
|
|
2
|
+
import { type ComponentTemplateReport } from '@angular-modernizer/api';
|
|
3
|
+
import { ProjectCache } from './helpers/project-cache.js';
|
|
4
|
+
/** List fields of a template report that `summaryOnly` drops and `maxResults` caps. */
|
|
5
|
+
export type ListField = 'elements' | 'i18nKeys' | 'dynamicI18nPrefixes';
|
|
6
|
+
/** A report shaped by the compact options. */
|
|
7
|
+
export type TemplateReportOutput = Omit<ComponentTemplateReport, ListField> & Partial<Pick<ComponentTemplateReport, ListField>> & {
|
|
8
|
+
/** `true` when `maxResults` cut one of the lists. */
|
|
9
|
+
truncated: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Output of the inspect-template tool.
|
|
13
|
+
*/
|
|
14
|
+
export interface InspectTemplateOutput {
|
|
15
|
+
/** One report per inspected template. */
|
|
16
|
+
templates: TemplateReportOutput[];
|
|
17
|
+
/** Short text summary of the inspected templates. */
|
|
18
|
+
summary: string;
|
|
19
|
+
/** The tsconfig whose program was used. */
|
|
20
|
+
tsConfigPath: string;
|
|
21
|
+
/** Conditions that can make the result incomplete (unresolved library imports). */
|
|
22
|
+
warnings?: string[];
|
|
23
|
+
}
|
|
1
24
|
/**
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Inspect Template Tool
|
|
3
|
-
*
|
|
4
25
|
* MCP tool that returns the structure of an Angular component template:
|
|
5
26
|
* elements with their bindings, the project components/directives and
|
|
6
27
|
* pipes they resolve to, control-flow nesting and i18n keys.
|
|
@@ -17,32 +38,20 @@
|
|
|
17
38
|
* // args: { file: '/project/src/app/list/list.component.html', projectRoot: '/project' }
|
|
18
39
|
* ```
|
|
19
40
|
*/
|
|
20
|
-
import { type MCPTool } from '../types.js';
|
|
21
|
-
import { type ComponentTemplateReport } from '@angular-modernizer/api';
|
|
22
|
-
import { ProjectCache } from './helpers/project-cache.js';
|
|
23
|
-
/** A report shaped by the compact options. */
|
|
24
|
-
type ListField = 'elements' | 'i18nKeys' | 'dynamicI18nPrefixes';
|
|
25
|
-
type TemplateReportOutput = Omit<ComponentTemplateReport, ListField> & Partial<Pick<ComponentTemplateReport, ListField>> & {
|
|
26
|
-
truncated: boolean;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Output of the inspect-template tool.
|
|
30
|
-
*/
|
|
31
|
-
interface InspectTemplateOutput {
|
|
32
|
-
templates: TemplateReportOutput[];
|
|
33
|
-
summary: string;
|
|
34
|
-
tsConfigPath: string;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* MCP tool that inspects the structure of component templates.
|
|
38
|
-
*/
|
|
39
41
|
export declare class InspectTemplateTool implements MCPTool {
|
|
40
42
|
private readonly projects;
|
|
41
43
|
readonly name = "inspect-template";
|
|
44
|
+
readonly title = "Inspect Template";
|
|
45
|
+
readonly annotations: ToolAnnotations;
|
|
42
46
|
constructor(projects?: ProjectCache);
|
|
43
47
|
readonly description: string;
|
|
48
|
+
/**
|
|
49
|
+
* JSON Schema of the tool arguments.
|
|
50
|
+
* @hidden
|
|
51
|
+
*/
|
|
44
52
|
readonly inputSchema: {
|
|
45
53
|
type: string;
|
|
54
|
+
additionalProperties: boolean;
|
|
46
55
|
properties: {
|
|
47
56
|
summaryOnly: {
|
|
48
57
|
readonly type: "boolean";
|
|
@@ -80,10 +89,239 @@ export declare class InspectTemplateTool implements MCPTool {
|
|
|
80
89
|
};
|
|
81
90
|
required: string[];
|
|
82
91
|
};
|
|
92
|
+
/**
|
|
93
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
94
|
+
* @hidden
|
|
95
|
+
*/
|
|
96
|
+
readonly outputSchema: {
|
|
97
|
+
type: string;
|
|
98
|
+
properties: {
|
|
99
|
+
warnings: {
|
|
100
|
+
readonly type: "array";
|
|
101
|
+
readonly items: {
|
|
102
|
+
readonly type: "string";
|
|
103
|
+
};
|
|
104
|
+
readonly description: "Conditions that can make the result incomplete, e.g. library imports that do not resolve because node_modules is missing.";
|
|
105
|
+
};
|
|
106
|
+
templates: {
|
|
107
|
+
type: string;
|
|
108
|
+
items: {
|
|
109
|
+
readonly type: "object";
|
|
110
|
+
readonly properties: {
|
|
111
|
+
readonly component: {
|
|
112
|
+
readonly type: "string";
|
|
113
|
+
};
|
|
114
|
+
readonly componentFile: {
|
|
115
|
+
readonly type: "string";
|
|
116
|
+
};
|
|
117
|
+
readonly templateFile: {
|
|
118
|
+
readonly type: "string";
|
|
119
|
+
};
|
|
120
|
+
readonly inline: {
|
|
121
|
+
readonly type: "boolean";
|
|
122
|
+
};
|
|
123
|
+
readonly directives: {
|
|
124
|
+
readonly type: "array";
|
|
125
|
+
readonly items: {
|
|
126
|
+
readonly type: "object";
|
|
127
|
+
readonly properties: {
|
|
128
|
+
readonly className: {
|
|
129
|
+
readonly type: "string";
|
|
130
|
+
};
|
|
131
|
+
readonly kind: {
|
|
132
|
+
readonly type: "string";
|
|
133
|
+
};
|
|
134
|
+
readonly selector: {
|
|
135
|
+
readonly type: "string";
|
|
136
|
+
};
|
|
137
|
+
readonly file: {
|
|
138
|
+
readonly type: "string";
|
|
139
|
+
};
|
|
140
|
+
readonly count: {
|
|
141
|
+
readonly type: "integer";
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
readonly required: readonly ["className", "kind", "selector", "file", "count"];
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
readonly pipes: {
|
|
148
|
+
readonly type: "array";
|
|
149
|
+
readonly items: {
|
|
150
|
+
readonly type: "object";
|
|
151
|
+
readonly properties: {
|
|
152
|
+
readonly name: {
|
|
153
|
+
readonly type: "string";
|
|
154
|
+
};
|
|
155
|
+
readonly count: {
|
|
156
|
+
readonly type: "integer";
|
|
157
|
+
};
|
|
158
|
+
readonly className: {
|
|
159
|
+
readonly type: "string";
|
|
160
|
+
};
|
|
161
|
+
readonly file: {
|
|
162
|
+
readonly type: "string";
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
readonly required: readonly ["name", "count"];
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
readonly unresolvedElements: {
|
|
169
|
+
readonly type: "array";
|
|
170
|
+
readonly items: {
|
|
171
|
+
readonly type: "object";
|
|
172
|
+
readonly properties: {
|
|
173
|
+
readonly tag: {
|
|
174
|
+
readonly type: "string";
|
|
175
|
+
};
|
|
176
|
+
readonly count: {
|
|
177
|
+
readonly type: "integer";
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
readonly required: readonly ["tag", "count"];
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
readonly controlFlow: {
|
|
184
|
+
readonly type: "object";
|
|
185
|
+
readonly properties: {
|
|
186
|
+
readonly blocks: {
|
|
187
|
+
readonly type: "object";
|
|
188
|
+
readonly additionalProperties: {
|
|
189
|
+
readonly type: "integer";
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
readonly structuralDirectives: {
|
|
193
|
+
readonly type: "object";
|
|
194
|
+
readonly additionalProperties: {
|
|
195
|
+
readonly type: "integer";
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
readonly maxDepth: {
|
|
199
|
+
readonly type: "integer";
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
readonly required: readonly ["blocks", "structuralDirectives", "maxDepth"];
|
|
203
|
+
};
|
|
204
|
+
readonly dynamicI18nCount: {
|
|
205
|
+
readonly type: "integer";
|
|
206
|
+
};
|
|
207
|
+
readonly parseErrors: {
|
|
208
|
+
readonly type: "array";
|
|
209
|
+
readonly items: {
|
|
210
|
+
readonly type: "string";
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
readonly counts: {
|
|
214
|
+
readonly type: "object";
|
|
215
|
+
readonly properties: {
|
|
216
|
+
[k: string]: {
|
|
217
|
+
type: string;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
readonly required: readonly ["elements", "bindings", "inputs", "outputs", "directives", "pipes", "i18nKeys"];
|
|
221
|
+
};
|
|
222
|
+
readonly elements: {
|
|
223
|
+
readonly type: "array";
|
|
224
|
+
readonly items: {
|
|
225
|
+
readonly type: "object";
|
|
226
|
+
readonly properties: {
|
|
227
|
+
readonly tag: {
|
|
228
|
+
readonly type: "string";
|
|
229
|
+
};
|
|
230
|
+
readonly line: {
|
|
231
|
+
readonly type: "integer";
|
|
232
|
+
};
|
|
233
|
+
readonly col: {
|
|
234
|
+
readonly type: "integer";
|
|
235
|
+
};
|
|
236
|
+
readonly depth: {
|
|
237
|
+
readonly type: "integer";
|
|
238
|
+
};
|
|
239
|
+
readonly matches: {
|
|
240
|
+
readonly type: "array";
|
|
241
|
+
readonly items: {
|
|
242
|
+
readonly type: "string";
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
readonly bindings: {
|
|
246
|
+
readonly type: "array";
|
|
247
|
+
readonly items: {
|
|
248
|
+
readonly type: "object";
|
|
249
|
+
readonly properties: {
|
|
250
|
+
readonly kind: {
|
|
251
|
+
readonly type: "string";
|
|
252
|
+
};
|
|
253
|
+
readonly name: {
|
|
254
|
+
readonly type: "string";
|
|
255
|
+
};
|
|
256
|
+
readonly value: {
|
|
257
|
+
readonly type: "string";
|
|
258
|
+
};
|
|
259
|
+
readonly line: {
|
|
260
|
+
readonly type: "integer";
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
readonly required: readonly ["kind", "name"];
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
readonly required: readonly ["tag", "line", "col", "depth", "matches", "bindings"];
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
readonly i18nKeys: {
|
|
271
|
+
readonly type: "array";
|
|
272
|
+
readonly items: {
|
|
273
|
+
readonly type: "object";
|
|
274
|
+
readonly properties: {
|
|
275
|
+
readonly key: {
|
|
276
|
+
readonly type: "string";
|
|
277
|
+
};
|
|
278
|
+
readonly source: {
|
|
279
|
+
readonly type: "string";
|
|
280
|
+
};
|
|
281
|
+
readonly line: {
|
|
282
|
+
readonly type: "integer";
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
readonly required: readonly ["key", "source", "line"];
|
|
286
|
+
};
|
|
287
|
+
};
|
|
288
|
+
readonly dynamicI18nPrefixes: {
|
|
289
|
+
readonly type: "array";
|
|
290
|
+
readonly items: {
|
|
291
|
+
readonly type: "object";
|
|
292
|
+
readonly properties: {
|
|
293
|
+
readonly prefix: {
|
|
294
|
+
readonly type: "string";
|
|
295
|
+
};
|
|
296
|
+
readonly source: {
|
|
297
|
+
readonly type: "string";
|
|
298
|
+
};
|
|
299
|
+
readonly line: {
|
|
300
|
+
readonly type: "integer";
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
readonly required: readonly ["prefix", "source", "line"];
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
readonly truncated: {
|
|
307
|
+
readonly type: "boolean";
|
|
308
|
+
};
|
|
309
|
+
};
|
|
310
|
+
readonly required: readonly ["component", "componentFile", "templateFile", "inline", "directives", "pipes", "unresolvedElements", "controlFlow", "dynamicI18nCount", "parseErrors", "counts", "truncated"];
|
|
311
|
+
};
|
|
312
|
+
};
|
|
313
|
+
summary: {
|
|
314
|
+
type: string;
|
|
315
|
+
};
|
|
316
|
+
tsConfigPath: {
|
|
317
|
+
type: string;
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
required: string[];
|
|
321
|
+
};
|
|
83
322
|
execute(args: Record<string, unknown>): Promise<InspectTemplateOutput>;
|
|
84
323
|
private parseI18nNames;
|
|
85
324
|
private shape;
|
|
86
325
|
private buildSummary;
|
|
87
326
|
}
|
|
88
|
-
export {};
|
|
89
327
|
//# sourceMappingURL=inspect-template.d.ts.map
|