@angular-modernizer/adapter-mcp 1.0.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 +78 -64
- package/dist/cli.js +8 -0
- package/dist/core/project-analyzer.d.ts +3 -12
- package/dist/core/project-analyzer.js +3 -12
- package/dist/index.d.ts +118 -3
- package/dist/index.js +46 -3
- package/dist/mcp-watcher.d.ts +28 -8
- package/dist/mcp-watcher.js +7 -7
- 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 +7 -0
- package/dist/server/mcp-server.d.ts +11 -7
- package/dist/server/mcp-server.js +4 -7
- package/dist/server/sdk-server.d.ts +1 -0
- package/dist/server/tool-registry.d.ts +3 -7
- package/dist/server/tool-registry.js +1 -7
- 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 +56 -34
- package/dist/tools/analyze-build-impact.js +30 -25
- package/dist/tools/analyze-core-to-shared.d.ts +42 -12
- package/dist/tools/analyze-core-to-shared.js +11 -10
- package/dist/tools/analyze-parser-performance.d.ts +23 -22
- package/dist/tools/analyze-parser-performance.js +20 -18
- package/dist/tools/analyze-project.d.ts +82 -12
- package/dist/tools/analyze-project.js +98 -101
- package/dist/tools/check-incremental-compatibility.d.ts +13 -11
- package/dist/tools/check-incremental-compatibility.js +11 -8
- package/dist/tools/collect-feedback.d.ts +41 -26
- package/dist/tools/collect-feedback.js +32 -23
- package/dist/tools/compare-health.d.ts +76 -19
- package/dist/tools/compare-health.js +26 -19
- package/dist/tools/extract-libraries.d.ts +44 -20
- package/dist/tools/extract-libraries.js +16 -17
- package/dist/tools/find-angular-symbol.d.ts +25 -23
- package/dist/tools/find-angular-symbol.js +17 -14
- package/dist/tools/find-component-hosts.d.ts +31 -25
- package/dist/tools/find-component-hosts.js +24 -21
- package/dist/tools/find-usages.d.ts +23 -21
- package/dist/tools/find-usages.js +19 -16
- package/dist/tools/get-bootstrap-execution.d.ts +33 -25
- package/dist/tools/get-bootstrap-execution.js +25 -22
- package/dist/tools/get-call-graph.d.ts +18 -13
- package/dist/tools/get-call-graph.js +24 -21
- package/dist/tools/get-operation-progress-tool.d.ts +12 -6
- package/dist/tools/get-operation-progress-tool.js +11 -6
- package/dist/tools/get-operation-progress.d.ts +26 -0
- package/dist/tools/helpers/analysis-output.d.ts +5 -0
- package/dist/tools/helpers/batch-kernel.d.ts +14 -0
- package/dist/tools/helpers/batch-kernel.js +12 -0
- package/dist/tools/helpers/compact-output.d.ts +2 -1
- package/dist/tools/helpers/compact-output.js +2 -1
- package/dist/tools/helpers/health-delta.d.ts +27 -14
- package/dist/tools/helpers/health-delta.js +11 -14
- package/dist/tools/helpers/project-cache.d.ts +50 -34
- package/dist/tools/helpers/project-cache.js +33 -34
- package/dist/tools/helpers/rule-runner.d.ts +23 -16
- package/dist/tools/helpers/rule-runner.js +24 -17
- package/dist/tools/helpers/scan-engine.d.ts +107 -0
- package/dist/tools/helpers/scan-engine.js +197 -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 +11 -8
- package/dist/tools/helpers/tool-context.js +5 -8
- package/dist/tools/inspect-form-group.d.ts +32 -25
- package/dist/tools/inspect-form-group.js +24 -21
- package/dist/tools/inspect-i18n.d.ts +28 -22
- package/dist/tools/inspect-i18n.js +20 -17
- package/dist/tools/inspect-template.d.ts +31 -24
- package/dist/tools/inspect-template.js +23 -20
- package/dist/tools/learn-patterns.d.ts +88 -12
- package/dist/tools/learn-patterns.js +17 -11
- package/dist/tools/list-imports.d.ts +42 -25
- package/dist/tools/list-imports.js +23 -20
- package/dist/tools/orchestrate-migration.d.ts +31 -9
- package/dist/tools/orchestrate-migration.js +12 -7
- package/dist/tools/parse-stack-trace.d.ts +23 -21
- package/dist/tools/parse-stack-trace.js +10 -7
- package/dist/tools/plan-migration.d.ts +65 -25
- package/dist/tools/plan-migration.js +19 -19
- package/dist/tools/resolve-type.d.ts +19 -9
- package/dist/tools/resolve-type.js +19 -11
- package/dist/tools/review-feedback.d.ts +27 -24
- package/dist/tools/review-feedback.js +24 -20
- package/dist/tools/rollback-changes.d.ts +13 -9
- package/dist/tools/rollback-changes.js +10 -7
- package/dist/tools/run-angular-cli.d.ts +12 -10
- package/dist/tools/run-angular-cli.js +11 -8
- package/dist/tools/run-build.d.ts +13 -11
- package/dist/tools/run-build.js +11 -8
- package/dist/tools/run-schematic.d.ts +12 -10
- package/dist/tools/run-schematic.js +11 -8
- package/dist/tools/scan-all.d.ts +69 -12
- package/dist/tools/scan-all.js +55 -122
- package/dist/tools/scan-angular.d.ts +41 -9
- package/dist/tools/scan-angular.js +66 -135
- package/dist/tools/scan-architecture.d.ts +75 -14
- package/dist/tools/scan-architecture.js +180 -185
- package/dist/tools/scan-solid.d.ts +40 -9
- package/dist/tools/scan-solid.js +64 -133
- package/dist/tools/search-codebase.d.ts +30 -24
- package/dist/tools/search-codebase.js +13 -10
- package/dist/tools/server-status.d.ts +116 -24
- package/dist/tools/server-status.js +85 -26
- package/dist/tools/suggest-improvements.d.ts +22 -19
- package/dist/tools/suggest-improvements.js +21 -17
- package/dist/tools/trace-output-flow.d.ts +32 -25
- package/dist/tools/trace-output-flow.js +24 -21
- package/dist/tools/transform-code.d.ts +71 -10
- package/dist/tools/transform-code.js +60 -42
- package/dist/tools/validate-before-transform.d.ts +24 -9
- package/dist/tools/validate-before-transform.js +10 -7
- package/dist/tools/validate-project-compatibility.d.ts +18 -13
- package/dist/tools/validate-project-compatibility.js +17 -11
- package/dist/tools/validate-transformation.d.ts +28 -11
- package/dist/tools/validate-transformation.js +14 -8
- package/dist/tools/verify-citations.d.ts +37 -16
- package/dist/tools/verify-citations.js +19 -16
- package/dist/types.d.ts +40 -10
- package/dist/types.js +0 -5
- package/package.json +12 -18
- package/dist/tools/shared/scan-types.d.ts +0 -200
- package/dist/tools/shared/scan-types.js +0 -7
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Inspect Form Group Tool
|
|
3
|
-
*
|
|
4
|
-
* MCP tool that returns the Reactive Forms of a component or service file
|
|
5
|
-
* as structure: controls with validators and initial state, and every
|
|
6
|
-
* enable/disable/validator change per control, including what an ancestor
|
|
7
|
-
* group's enable()/disable() switches with it.
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* Logic lives in `FormGroupInspector` (`@angular-modernizer/api`); this tool
|
|
11
|
-
* resolves the project, validates arguments and applies the compact output
|
|
12
|
-
* contract (`maxResults` caps the control list per form).
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* // Via MCP:
|
|
17
|
-
* // tool: inspect-form-group
|
|
18
|
-
* // args: { file: 'src/app/edit/edit.component.ts', projectRoot: '/project' }
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
1
|
import { type MCPTool, type ToolAnnotations } from '../types.js';
|
|
22
2
|
import { type InspectedForm, type InspectedFormControl } from '@angular-modernizer/api';
|
|
23
3
|
import { ProjectCache } from './helpers/project-cache.js';
|
|
24
4
|
/** A control with the cascade optionally dropped. */
|
|
25
|
-
type ControlOutput = Omit<InspectedFormControl, 'cascade'> & Partial<Pick<InspectedFormControl, 'cascade'>>;
|
|
5
|
+
export type ControlOutput = Omit<InspectedFormControl, 'cascade'> & Partial<Pick<InspectedFormControl, 'cascade'>>;
|
|
26
6
|
/** A form shaped by the compact options. */
|
|
27
|
-
type FormOutput = Omit<InspectedForm, 'controls'> & {
|
|
7
|
+
export type FormOutput = Omit<InspectedForm, 'controls'> & {
|
|
8
|
+
/** Controls, cut to `maxResults`; omitted with `summaryOnly`. */
|
|
28
9
|
controls?: ControlOutput[];
|
|
10
|
+
/** `true` when `maxResults` cut the control list. */
|
|
29
11
|
truncated: boolean;
|
|
30
12
|
};
|
|
31
13
|
/**
|
|
32
14
|
* Output of the inspect-form-group tool.
|
|
33
15
|
*/
|
|
34
|
-
interface InspectFormGroupOutput {
|
|
16
|
+
export interface InspectFormGroupOutput {
|
|
17
|
+
/** Reactive forms found in the file. */
|
|
35
18
|
forms: FormOutput[];
|
|
19
|
+
/** Short text summary of the forms and their controls. */
|
|
36
20
|
summary: string;
|
|
21
|
+
/** The tsconfig whose program was used. */
|
|
37
22
|
tsConfigPath: string;
|
|
38
23
|
/** Conditions that can make the result incomplete (unresolved library imports). */
|
|
39
24
|
warnings?: string[];
|
|
40
25
|
}
|
|
41
26
|
/**
|
|
42
|
-
* MCP tool that
|
|
27
|
+
* MCP tool that returns the Reactive Forms of a component or service file
|
|
28
|
+
* as structure: controls with validators and initial state, and every
|
|
29
|
+
* enable/disable/validator change per control, including what an ancestor
|
|
30
|
+
* group's enable()/disable() switches with it.
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Logic lives in `FormGroupInspector` (`@angular-modernizer/api`); this tool
|
|
34
|
+
* resolves the project, validates arguments and applies the compact output
|
|
35
|
+
* contract (`maxResults` caps the control list per form).
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* // Via MCP:
|
|
40
|
+
* // tool: inspect-form-group
|
|
41
|
+
* // args: { file: 'src/app/edit/edit.component.ts', projectRoot: '/project' }
|
|
42
|
+
* ```
|
|
43
43
|
*/
|
|
44
44
|
export declare class InspectFormGroupTool implements MCPTool {
|
|
45
45
|
private readonly projects;
|
|
@@ -48,6 +48,10 @@ export declare class InspectFormGroupTool implements MCPTool {
|
|
|
48
48
|
readonly annotations: ToolAnnotations;
|
|
49
49
|
constructor(projects?: ProjectCache);
|
|
50
50
|
readonly description: string;
|
|
51
|
+
/**
|
|
52
|
+
* JSON Schema of the tool arguments.
|
|
53
|
+
* @hidden
|
|
54
|
+
*/
|
|
51
55
|
readonly inputSchema: {
|
|
52
56
|
type: string;
|
|
53
57
|
additionalProperties: boolean;
|
|
@@ -90,6 +94,10 @@ export declare class InspectFormGroupTool implements MCPTool {
|
|
|
90
94
|
};
|
|
91
95
|
required: string[];
|
|
92
96
|
};
|
|
97
|
+
/**
|
|
98
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
99
|
+
* @hidden
|
|
100
|
+
*/
|
|
93
101
|
readonly outputSchema: {
|
|
94
102
|
type: string;
|
|
95
103
|
properties: {
|
|
@@ -320,5 +328,4 @@ export declare class InspectFormGroupTool implements MCPTool {
|
|
|
320
328
|
private shape;
|
|
321
329
|
private buildSummary;
|
|
322
330
|
}
|
|
323
|
-
export {};
|
|
324
331
|
//# sourceMappingURL=inspect-form-group.d.ts.map
|
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Inspect Form Group Tool
|
|
3
|
-
*
|
|
4
|
-
* MCP tool that returns the Reactive Forms of a component or service file
|
|
5
|
-
* as structure: controls with validators and initial state, and every
|
|
6
|
-
* enable/disable/validator change per control, including what an ancestor
|
|
7
|
-
* group's enable()/disable() switches with it.
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* Logic lives in `FormGroupInspector` (`@angular-modernizer/api`); this tool
|
|
11
|
-
* resolves the project, validates arguments and applies the compact output
|
|
12
|
-
* contract (`maxResults` caps the control list per form).
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* // Via MCP:
|
|
17
|
-
* // tool: inspect-form-group
|
|
18
|
-
* // args: { file: 'src/app/edit/edit.component.ts', projectRoot: '/project' }
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
1
|
import { FormGroupInspector, } from '@angular-modernizer/api';
|
|
22
2
|
import { existsSync } from 'node:fs';
|
|
23
3
|
import { isAbsolute, resolve } from 'node:path';
|
|
@@ -125,7 +105,22 @@ const FORM_SCHEMA = {
|
|
|
125
105
|
],
|
|
126
106
|
};
|
|
127
107
|
/**
|
|
128
|
-
* MCP tool that
|
|
108
|
+
* MCP tool that returns the Reactive Forms of a component or service file
|
|
109
|
+
* as structure: controls with validators and initial state, and every
|
|
110
|
+
* enable/disable/validator change per control, including what an ancestor
|
|
111
|
+
* group's enable()/disable() switches with it.
|
|
112
|
+
*
|
|
113
|
+
* @remarks
|
|
114
|
+
* Logic lives in `FormGroupInspector` (`@angular-modernizer/api`); this tool
|
|
115
|
+
* resolves the project, validates arguments and applies the compact output
|
|
116
|
+
* contract (`maxResults` caps the control list per form).
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* // Via MCP:
|
|
121
|
+
* // tool: inspect-form-group
|
|
122
|
+
* // args: { file: 'src/app/edit/edit.component.ts', projectRoot: '/project' }
|
|
123
|
+
* ```
|
|
129
124
|
*/
|
|
130
125
|
export class InspectFormGroupTool {
|
|
131
126
|
projects;
|
|
@@ -150,6 +145,10 @@ export class InspectFormGroupTool {
|
|
|
150
145
|
'lists paths that do not exist in the form (typos, stale names: a runtime error when called); ' +
|
|
151
146
|
'dynamicOperations lists computed keys (controls[key] in a loop). Only this file is searched. summaryOnly ' +
|
|
152
147
|
'drops the control lists, maxResults caps them.';
|
|
148
|
+
/**
|
|
149
|
+
* JSON Schema of the tool arguments.
|
|
150
|
+
* @hidden
|
|
151
|
+
*/
|
|
153
152
|
inputSchema = {
|
|
154
153
|
type: 'object',
|
|
155
154
|
additionalProperties: false,
|
|
@@ -184,6 +183,10 @@ export class InspectFormGroupTool {
|
|
|
184
183
|
},
|
|
185
184
|
required: ['file', 'projectRoot'],
|
|
186
185
|
};
|
|
186
|
+
/**
|
|
187
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
188
|
+
* @hidden
|
|
189
|
+
*/
|
|
187
190
|
outputSchema = {
|
|
188
191
|
type: 'object',
|
|
189
192
|
properties: {
|
|
@@ -1,41 +1,40 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Inspect i18n Tool
|
|
3
|
-
*
|
|
4
|
-
* MCP tool over `I18nInspector`: where translation keys are defined (per
|
|
5
|
-
* language, with file, line and value), where they are used in templates and
|
|
6
|
-
* code, in which language they are missing, which used keys are defined
|
|
7
|
-
* nowhere and which defined keys have no static usage. Sources are found
|
|
8
|
-
* without configuration (setTranslation, TranslateHttpLoader, TranslocoLoader,
|
|
9
|
-
* assets/i18n convention).
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* await tool.execute({ projectRoot: '/app', key: 'ERRORS.NO_ACCESS' });
|
|
14
|
-
* // { keys: [{ key: 'ERRORS.NO_ACCESS', status: 'used', definitions: [...], usages: [...] }], summary: '...' }
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
1
|
import { type MCPTool, type ToolAnnotations } from '../types.js';
|
|
18
2
|
import { type I18nReport, type I18nSourceSummary } from '@angular-modernizer/api';
|
|
19
3
|
import { ProjectCache } from './helpers/project-cache.js';
|
|
20
|
-
|
|
4
|
+
/** List fields of the report that `summaryOnly` drops and `maxResults` caps. */
|
|
5
|
+
export type ListField = 'keys' | 'undefinedKeys' | 'missingTranslations' | 'unused' | 'dynamicPrefixes' | 'unresolvedUsages';
|
|
21
6
|
/** Source fields only the full output carries. */
|
|
22
|
-
type DetailField = 'registeredAt' | 'discoveredBy' | 'kind' | 'conditionReason';
|
|
7
|
+
export type DetailField = 'registeredAt' | 'discoveredBy' | 'kind' | 'conditionReason';
|
|
23
8
|
/** A source; `summaryOnly` keeps file, lang, app, conditional, group and keyCount. */
|
|
24
|
-
type SourceOutput = Omit<I18nSourceSummary, DetailField> & Partial<Pick<I18nSourceSummary, DetailField>>;
|
|
9
|
+
export type SourceOutput = Omit<I18nSourceSummary, DetailField> & Partial<Pick<I18nSourceSummary, DetailField>>;
|
|
25
10
|
/**
|
|
26
11
|
* Output of the inspect-i18n tool.
|
|
27
12
|
*/
|
|
28
|
-
type InspectI18nOutput = Omit<I18nReport, ListField | 'sources'> & Partial<Pick<I18nReport, ListField>> & {
|
|
13
|
+
export type InspectI18nOutput = Omit<I18nReport, ListField | 'sources'> & Partial<Pick<I18nReport, ListField>> & {
|
|
14
|
+
/** Translation sources found in the project. */
|
|
29
15
|
sources: SourceOutput[];
|
|
30
16
|
/** `true` when `maxResults` cut a list. */
|
|
31
17
|
truncated: boolean;
|
|
18
|
+
/** Short text summary of the report. */
|
|
32
19
|
summary: string;
|
|
20
|
+
/** The tsconfig whose program was used. */
|
|
33
21
|
tsConfigPath: string;
|
|
34
22
|
/** Conditions that can make the result incomplete (unresolved library imports). */
|
|
35
23
|
warnings?: string[];
|
|
36
24
|
};
|
|
37
25
|
/**
|
|
38
|
-
* MCP tool
|
|
26
|
+
* MCP tool over `I18nInspector`: where translation keys are defined (per
|
|
27
|
+
* language, with file, line and value), where they are used in templates and
|
|
28
|
+
* code, in which language they are missing, which used keys are defined
|
|
29
|
+
* nowhere and which defined keys have no static usage. Sources are found
|
|
30
|
+
* without configuration (setTranslation, TranslateHttpLoader, TranslocoLoader,
|
|
31
|
+
* assets/i18n convention).
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* await tool.execute({ projectRoot: '/app', key: 'ERRORS.NO_ACCESS' });
|
|
36
|
+
* // { keys: [{ key: 'ERRORS.NO_ACCESS', status: 'used', definitions: [...], usages: [...] }], summary: '...' }
|
|
37
|
+
* ```
|
|
39
38
|
*/
|
|
40
39
|
export declare class InspectI18nTool implements MCPTool {
|
|
41
40
|
private readonly projects;
|
|
@@ -44,6 +43,10 @@ export declare class InspectI18nTool implements MCPTool {
|
|
|
44
43
|
readonly annotations: ToolAnnotations;
|
|
45
44
|
constructor(projects?: ProjectCache);
|
|
46
45
|
readonly description: string;
|
|
46
|
+
/**
|
|
47
|
+
* JSON Schema of the tool arguments.
|
|
48
|
+
* @hidden
|
|
49
|
+
*/
|
|
47
50
|
readonly inputSchema: {
|
|
48
51
|
type: string;
|
|
49
52
|
additionalProperties: boolean;
|
|
@@ -79,6 +82,10 @@ export declare class InspectI18nTool implements MCPTool {
|
|
|
79
82
|
};
|
|
80
83
|
required: string[];
|
|
81
84
|
};
|
|
85
|
+
/**
|
|
86
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
87
|
+
* @hidden
|
|
88
|
+
*/
|
|
82
89
|
readonly outputSchema: {
|
|
83
90
|
type: string;
|
|
84
91
|
properties: {
|
|
@@ -462,5 +469,4 @@ export declare class InspectI18nTool implements MCPTool {
|
|
|
462
469
|
private buildSummary;
|
|
463
470
|
private keyLines;
|
|
464
471
|
}
|
|
465
|
-
export {};
|
|
466
472
|
//# sourceMappingURL=inspect-i18n.d.ts.map
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Inspect i18n Tool
|
|
3
|
-
*
|
|
4
|
-
* MCP tool over `I18nInspector`: where translation keys are defined (per
|
|
5
|
-
* language, with file, line and value), where they are used in templates and
|
|
6
|
-
* code, in which language they are missing, which used keys are defined
|
|
7
|
-
* nowhere and which defined keys have no static usage. Sources are found
|
|
8
|
-
* without configuration (setTranslation, TranslateHttpLoader, TranslocoLoader,
|
|
9
|
-
* assets/i18n convention).
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* await tool.execute({ projectRoot: '/app', key: 'ERRORS.NO_ACCESS' });
|
|
14
|
-
* // { keys: [{ key: 'ERRORS.NO_ACCESS', status: 'used', definitions: [...], usages: [...] }], summary: '...' }
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
1
|
import { I18nInspector, } from '@angular-modernizer/api';
|
|
18
2
|
import { existsSync } from 'node:fs';
|
|
19
3
|
import { relative } from 'node:path';
|
|
@@ -73,7 +57,18 @@ const I18N_COUNT_KEYS = [
|
|
|
73
57
|
'templatesScanned',
|
|
74
58
|
];
|
|
75
59
|
/**
|
|
76
|
-
* MCP tool
|
|
60
|
+
* MCP tool over `I18nInspector`: where translation keys are defined (per
|
|
61
|
+
* language, with file, line and value), where they are used in templates and
|
|
62
|
+
* code, in which language they are missing, which used keys are defined
|
|
63
|
+
* nowhere and which defined keys have no static usage. Sources are found
|
|
64
|
+
* without configuration (setTranslation, TranslateHttpLoader, TranslocoLoader,
|
|
65
|
+
* assets/i18n convention).
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* await tool.execute({ projectRoot: '/app', key: 'ERRORS.NO_ACCESS' });
|
|
70
|
+
* // { keys: [{ key: 'ERRORS.NO_ACCESS', status: 'used', definitions: [...], usages: [...] }], summary: '...' }
|
|
71
|
+
* ```
|
|
77
72
|
*/
|
|
78
73
|
export class InspectI18nTool {
|
|
79
74
|
projects;
|
|
@@ -106,6 +101,10 @@ export class InspectI18nTool {
|
|
|
106
101
|
'key text appears as a string elsewhere, e.g. a menu config) or no-static-usage. For a project report ' +
|
|
107
102
|
'start with summaryOnly (drops the lists and the source details registeredAt, discoveredBy, kind, ' +
|
|
108
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
|
+
*/
|
|
109
108
|
inputSchema = {
|
|
110
109
|
type: 'object',
|
|
111
110
|
additionalProperties: false,
|
|
@@ -131,6 +130,10 @@ export class InspectI18nTool {
|
|
|
131
130
|
},
|
|
132
131
|
required: ['projectRoot'],
|
|
133
132
|
};
|
|
133
|
+
/**
|
|
134
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
135
|
+
* @hidden
|
|
136
|
+
*/
|
|
134
137
|
outputSchema = {
|
|
135
138
|
type: 'object',
|
|
136
139
|
properties: {
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Inspect Template Tool
|
|
3
|
-
*
|
|
4
|
-
* MCP tool that returns the structure of an Angular component template:
|
|
5
|
-
* elements with their bindings, the project components/directives and
|
|
6
|
-
* pipes they resolve to, control-flow nesting and i18n keys.
|
|
7
|
-
*
|
|
8
|
-
* @remarks
|
|
9
|
-
* Logic lives in `TemplateInspector` (`@angular-modernizer/api`); this tool
|
|
10
|
-
* only resolves the project, validates arguments and applies the compact
|
|
11
|
-
* output contract. Accepts the `.html` template or the component `.ts` file.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* // Via MCP:
|
|
16
|
-
* // tool: inspect-template
|
|
17
|
-
* // args: { file: '/project/src/app/list/list.component.html', projectRoot: '/project' }
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
1
|
import { type MCPTool, type ToolAnnotations } from '../types.js';
|
|
21
2
|
import { type ComponentTemplateReport } from '@angular-modernizer/api';
|
|
22
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';
|
|
23
6
|
/** A report shaped by the compact options. */
|
|
24
|
-
type
|
|
25
|
-
|
|
7
|
+
export type TemplateReportOutput = Omit<ComponentTemplateReport, ListField> & Partial<Pick<ComponentTemplateReport, ListField>> & {
|
|
8
|
+
/** `true` when `maxResults` cut one of the lists. */
|
|
26
9
|
truncated: boolean;
|
|
27
10
|
};
|
|
28
11
|
/**
|
|
29
12
|
* Output of the inspect-template tool.
|
|
30
13
|
*/
|
|
31
|
-
interface InspectTemplateOutput {
|
|
14
|
+
export interface InspectTemplateOutput {
|
|
15
|
+
/** One report per inspected template. */
|
|
32
16
|
templates: TemplateReportOutput[];
|
|
17
|
+
/** Short text summary of the inspected templates. */
|
|
33
18
|
summary: string;
|
|
19
|
+
/** The tsconfig whose program was used. */
|
|
34
20
|
tsConfigPath: string;
|
|
35
21
|
/** Conditions that can make the result incomplete (unresolved library imports). */
|
|
36
22
|
warnings?: string[];
|
|
37
23
|
}
|
|
38
24
|
/**
|
|
39
|
-
* MCP tool that
|
|
25
|
+
* MCP tool that returns the structure of an Angular component template:
|
|
26
|
+
* elements with their bindings, the project components/directives and
|
|
27
|
+
* pipes they resolve to, control-flow nesting and i18n keys.
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* Logic lives in `TemplateInspector` (`@angular-modernizer/api`); this tool
|
|
31
|
+
* only resolves the project, validates arguments and applies the compact
|
|
32
|
+
* output contract. Accepts the `.html` template or the component `.ts` file.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* // Via MCP:
|
|
37
|
+
* // tool: inspect-template
|
|
38
|
+
* // args: { file: '/project/src/app/list/list.component.html', projectRoot: '/project' }
|
|
39
|
+
* ```
|
|
40
40
|
*/
|
|
41
41
|
export declare class InspectTemplateTool implements MCPTool {
|
|
42
42
|
private readonly projects;
|
|
@@ -45,6 +45,10 @@ export declare class InspectTemplateTool implements MCPTool {
|
|
|
45
45
|
readonly annotations: ToolAnnotations;
|
|
46
46
|
constructor(projects?: ProjectCache);
|
|
47
47
|
readonly description: string;
|
|
48
|
+
/**
|
|
49
|
+
* JSON Schema of the tool arguments.
|
|
50
|
+
* @hidden
|
|
51
|
+
*/
|
|
48
52
|
readonly inputSchema: {
|
|
49
53
|
type: string;
|
|
50
54
|
additionalProperties: boolean;
|
|
@@ -85,6 +89,10 @@ export declare class InspectTemplateTool implements MCPTool {
|
|
|
85
89
|
};
|
|
86
90
|
required: string[];
|
|
87
91
|
};
|
|
92
|
+
/**
|
|
93
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
94
|
+
* @hidden
|
|
95
|
+
*/
|
|
88
96
|
readonly outputSchema: {
|
|
89
97
|
type: string;
|
|
90
98
|
properties: {
|
|
@@ -316,5 +324,4 @@ export declare class InspectTemplateTool implements MCPTool {
|
|
|
316
324
|
private shape;
|
|
317
325
|
private buildSummary;
|
|
318
326
|
}
|
|
319
|
-
export {};
|
|
320
327
|
//# sourceMappingURL=inspect-template.d.ts.map
|
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @angular-modernizer/adapter-mcp - Inspect Template Tool
|
|
3
|
-
*
|
|
4
|
-
* MCP tool that returns the structure of an Angular component template:
|
|
5
|
-
* elements with their bindings, the project components/directives and
|
|
6
|
-
* pipes they resolve to, control-flow nesting and i18n keys.
|
|
7
|
-
*
|
|
8
|
-
* @remarks
|
|
9
|
-
* Logic lives in `TemplateInspector` (`@angular-modernizer/api`); this tool
|
|
10
|
-
* only resolves the project, validates arguments and applies the compact
|
|
11
|
-
* output contract. Accepts the `.html` template or the component `.ts` file.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* // Via MCP:
|
|
16
|
-
* // tool: inspect-template
|
|
17
|
-
* // args: { file: '/project/src/app/list/list.component.html', projectRoot: '/project' }
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
1
|
import { TemplateInspector, } from '@angular-modernizer/api';
|
|
21
2
|
import { existsSync } from 'node:fs';
|
|
22
3
|
import { isAbsolute, resolve } from 'node:path';
|
|
@@ -163,7 +144,21 @@ const TEMPLATE_REPORT_SCHEMA = {
|
|
|
163
144
|
],
|
|
164
145
|
};
|
|
165
146
|
/**
|
|
166
|
-
* MCP tool that
|
|
147
|
+
* MCP tool that returns the structure of an Angular component template:
|
|
148
|
+
* elements with their bindings, the project components/directives and
|
|
149
|
+
* pipes they resolve to, control-flow nesting and i18n keys.
|
|
150
|
+
*
|
|
151
|
+
* @remarks
|
|
152
|
+
* Logic lives in `TemplateInspector` (`@angular-modernizer/api`); this tool
|
|
153
|
+
* only resolves the project, validates arguments and applies the compact
|
|
154
|
+
* output contract. Accepts the `.html` template or the component `.ts` file.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```typescript
|
|
158
|
+
* // Via MCP:
|
|
159
|
+
* // tool: inspect-template
|
|
160
|
+
* // args: { file: '/project/src/app/list/list.component.html', projectRoot: '/project' }
|
|
161
|
+
* ```
|
|
167
162
|
*/
|
|
168
163
|
export class InspectTemplateTool {
|
|
169
164
|
projects;
|
|
@@ -189,6 +184,10 @@ export class InspectTemplateTool {
|
|
|
189
184
|
'inspect-i18n). Plain elements without bindings are ' +
|
|
190
185
|
'omitted unless includePlainElements; counts always cover all elements. summaryOnly drops the ' +
|
|
191
186
|
'element, key and prefix lists, maxResults caps them.';
|
|
187
|
+
/**
|
|
188
|
+
* JSON Schema of the tool arguments.
|
|
189
|
+
* @hidden
|
|
190
|
+
*/
|
|
192
191
|
inputSchema = {
|
|
193
192
|
type: 'object',
|
|
194
193
|
additionalProperties: false,
|
|
@@ -219,6 +218,10 @@ export class InspectTemplateTool {
|
|
|
219
218
|
},
|
|
220
219
|
required: ['file', 'projectRoot'],
|
|
221
220
|
};
|
|
221
|
+
/**
|
|
222
|
+
* JSON Schema of the tool result (`structuredContent`).
|
|
223
|
+
* @hidden
|
|
224
|
+
*/
|
|
222
225
|
outputSchema = {
|
|
223
226
|
type: 'object',
|
|
224
227
|
properties: {
|