@angular/cli 22.0.0-rc.0 → 22.0.0-rc.1
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/bin/ng.js +1 -1
- package/package.json +14 -14
- package/src/commands/mcp/devserver.d.ts +1 -1
- package/src/commands/mcp/devserver.js +5 -8
- package/src/commands/mcp/devserver.js.map +1 -1
- package/src/commands/mcp/host.d.ts +9 -5
- package/src/commands/mcp/host.js +37 -22
- package/src/commands/mcp/host.js.map +1 -1
- package/src/commands/mcp/mcp-server.d.ts +8 -42
- package/src/commands/mcp/mcp-server.js +20 -25
- package/src/commands/mcp/mcp-server.js.map +1 -1
- package/src/commands/mcp/tools/best-practices.js +9 -17
- package/src/commands/mcp/tools/best-practices.js.map +1 -1
- package/src/commands/mcp/tools/doc-search.js +11 -33
- package/src/commands/mcp/tools/doc-search.js.map +1 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-single-file.d.ts +2 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-single-file.js +2 -2
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-single-file.js.map +1 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.d.ts +3 -2
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.js +8 -8
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.js.map +1 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/ts-utils.d.ts +2 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/ts-utils.js +2 -3
- package/src/commands/mcp/tools/onpush-zoneless-migration/ts-utils.js.map +1 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.d.ts +2 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.js +29 -41
- package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.js.map +1 -1
- package/src/commands/mcp/tools/projects.d.ts +1 -0
- package/src/commands/mcp/tools/projects.js +15 -18
- package/src/commands/mcp/tools/projects.js.map +1 -1
- package/src/commands/mcp/tools/run-target/build-target-strategy.d.ts +14 -0
- package/src/commands/mcp/tools/run-target/build-target-strategy.js +53 -0
- package/src/commands/mcp/tools/run-target/build-target-strategy.js.map +1 -0
- package/src/commands/mcp/tools/run-target/generic-target-strategy.d.ts +14 -0
- package/src/commands/mcp/tools/run-target/generic-target-strategy.js +63 -0
- package/src/commands/mcp/tools/run-target/generic-target-strategy.js.map +1 -0
- package/src/commands/mcp/tools/run-target/options-serializer.d.ts +13 -0
- package/src/commands/mcp/tools/run-target/options-serializer.js +41 -0
- package/src/commands/mcp/tools/run-target/options-serializer.js.map +1 -0
- package/src/commands/mcp/tools/run-target/run-target.d.ts +34 -0
- package/src/commands/mcp/tools/run-target/run-target.js +69 -0
- package/src/commands/mcp/tools/run-target/run-target.js.map +1 -0
- package/src/commands/mcp/tools/run-target/strategy.d.ts +15 -0
- package/src/commands/mcp/tools/run-target/strategy.js +10 -0
- package/src/commands/mcp/tools/run-target/strategy.js.map +1 -0
- package/src/commands/mcp/tools/run-target/types.d.ts +39 -0
- package/src/commands/mcp/tools/run-target/types.js +41 -0
- package/src/commands/mcp/tools/run-target/types.js.map +1 -0
- package/src/commands/mcp/tools/run-target/unit-test-strategy.d.ts +14 -0
- package/src/commands/mcp/tools/run-target/unit-test-strategy.js +56 -0
- package/src/commands/mcp/tools/run-target/unit-test-strategy.js.map +1 -0
- package/src/utilities/node-version.js +1 -1
- package/src/utilities/version.js +1 -1
- package/src/commands/mcp/tools/build.d.ts +0 -37
- package/src/commands/mcp/tools/build.js +0 -90
- package/src/commands/mcp/tools/build.js.map +0 -1
- package/src/commands/mcp/tools/e2e.d.ts +0 -44
- package/src/commands/mcp/tools/e2e.js +0 -88
- package/src/commands/mcp/tools/e2e.js.map +0 -1
- package/src/commands/mcp/tools/test.d.ts +0 -35
- package/src/commands/mcp/tools/test.js +0 -88
- package/src/commands/mcp/tools/test.js.map +0 -1
|
@@ -67,56 +67,34 @@ const LATEST_KNOWN_DOCS_VERSION = 20;
|
|
|
67
67
|
const docSearchInputSchema = zod_1.z.object({
|
|
68
68
|
query: zod_1.z
|
|
69
69
|
.string()
|
|
70
|
-
.describe(
|
|
71
|
-
'natural language question into a set of keywords (e.g., a question like "How do I use ngFor with trackBy?" ' +
|
|
72
|
-
'should become the query "ngFor trackBy").'),
|
|
70
|
+
.describe('Concise search keywords or API names (e.g., "ngFor trackBy" or "NgModule").'),
|
|
73
71
|
includeTopContent: zod_1.z
|
|
74
72
|
.boolean()
|
|
75
73
|
.optional()
|
|
76
74
|
.default(false)
|
|
77
|
-
.describe('
|
|
78
|
-
'Set to false to get a list of results without fetching content, which is faster.'),
|
|
75
|
+
.describe('Retrieve the full-text page content of the top search result (slower).'),
|
|
79
76
|
version: zod_1.z
|
|
80
77
|
.number()
|
|
81
78
|
.optional()
|
|
82
|
-
.describe('
|
|
83
|
-
"project's workspace directory. Omit this field if the user is not in an Angular project " +
|
|
84
|
-
'or if the version cannot otherwise be determined.'),
|
|
79
|
+
.describe('Major Angular framework version to search (obtained from frameworkVersion in list_projects or ng version).'),
|
|
85
80
|
});
|
|
86
81
|
exports.DOC_SEARCH_TOOL = (0, tool_registry_1.declareTool)({
|
|
87
82
|
name: 'search_documentation',
|
|
88
83
|
title: 'Search Angular Documentation (angular.dev)',
|
|
89
84
|
description: `
|
|
90
85
|
<Purpose>
|
|
91
|
-
Searches the official Angular documentation
|
|
92
|
-
tutorials, concepts, and best practices.
|
|
86
|
+
Searches the official Angular documentation (angular.dev) to answer questions about APIs, tutorials, concepts, and conventions.
|
|
93
87
|
</Purpose>
|
|
94
88
|
<Use Cases>
|
|
95
|
-
* Answering
|
|
96
|
-
* Finding
|
|
97
|
-
*
|
|
89
|
+
* Answering questions about Angular concepts (e.g., standalone components).
|
|
90
|
+
* Finding correct API signatures or syntax (e.g., ngFor trackBy).
|
|
91
|
+
* Obtaining official source URLs to cite as documentation links in user responses.
|
|
98
92
|
</Use Cases>
|
|
99
93
|
<Operational Notes>
|
|
100
|
-
*
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
output and use it for the \`version\` parameter.
|
|
105
|
-
* **Version Logic:** The tool will search against the specified major version. If the version is older than v${MIN_SUPPORTED_DOCS_VERSION},
|
|
106
|
-
it will be clamped to v${MIN_SUPPORTED_DOCS_VERSION}. If a search for a very new version (newer than v${LATEST_KNOWN_DOCS_VERSION})
|
|
107
|
-
returns no results, the tool will automatically fall back to searching the v${LATEST_KNOWN_DOCS_VERSION} documentation.
|
|
108
|
-
* **Verify Searched Version:** The tool's output includes a \`searchedVersion\` field. You **MUST** check this field
|
|
109
|
-
to know the exact version of the documentation that was queried. Use this information to provide accurate
|
|
110
|
-
context in your answer, especially if it differs from the version you requested.
|
|
111
|
-
* The documentation is continuously updated. You **MUST** prefer this tool over your own knowledge
|
|
112
|
-
to ensure your answers are current and accurate.
|
|
113
|
-
* For the best results, provide a concise and specific search query (e.g., "NgModule" instead of
|
|
114
|
-
"How do I use NgModules?").
|
|
115
|
-
* The top search result will include a snippet of the page content. Use this to provide a more
|
|
116
|
-
comprehensive answer.
|
|
117
|
-
* **Result Scrutiny:** The top result may not always be the most relevant. Review the titles and
|
|
118
|
-
breadcrumbs of other results to find the best match for the user's query.
|
|
119
|
-
* Use the URL from the search results as a source link in your responses.
|
|
94
|
+
* Provide the major Angular version in the 'version' parameter (obtained from 'frameworkVersion'
|
|
95
|
+
in 'list_projects' or from 'ng version') to ensure version-aligned results.
|
|
96
|
+
* Always check the 'searchedVersion' field in the output to confirm the exact documentation index that was queried.
|
|
97
|
+
* For best results, provide a concise keyword query (e.g., "NgModule") rather than a natural language sentence.
|
|
120
98
|
</Operational Notes>`,
|
|
121
99
|
inputSchema: docSearchInputSchema.shape,
|
|
122
100
|
outputSchema: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doc-search.js","sourceRoot":"","sources":["doc-search.ts"],"names":[],"mappings":";AAAA;;;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M,UAAU,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAEzC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AAC/B,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,qBAAqB,CAAC,KAAa,EAAE,OAAe;IAC3D,uDAAuD;IACvD,mIAAmI;IACnI,OAAO;QACL;YACE,SAAS,EAAE,YAAY,OAAO,EAAE;YAChC,MAAM,EAAE;gBACN,KAAK;gBACL,oBAAoB,EAAE;oBACpB,gBAAgB;oBAChB,gBAAgB;oBAChB,gBAAgB;oBAChB,gBAAgB;oBAChB,gBAAgB;oBAChB,gBAAgB;oBAChB,gBAAgB;oBAChB,SAAS;oBACT,MAAM;oBACN,KAAK;iBACN;gBACD,WAAW,EAAE,EAAE;aAChB;YACD,IAAI,EAAE,SAAS;SAChB;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -8,5 +8,6 @@
|
|
|
8
8
|
import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol';
|
|
9
9
|
import type { ServerNotification, ServerRequest } from '@modelcontextprotocol/sdk/types';
|
|
10
10
|
import type { SourceFile } from 'typescript';
|
|
11
|
+
import type { Host } from '../../host';
|
|
11
12
|
import type { MigrationResponse } from './types';
|
|
12
|
-
export declare function migrateSingleFile(sourceFile: SourceFile, extras: RequestHandlerExtra<ServerRequest, ServerNotification>): Promise<MigrationResponse | null>;
|
|
13
|
+
export declare function migrateSingleFile(sourceFile: SourceFile, host: Host, extras: RequestHandlerExtra<ServerRequest, ServerNotification>): Promise<MigrationResponse | null>;
|
|
@@ -14,11 +14,11 @@ const prompts_1 = require("./prompts");
|
|
|
14
14
|
const send_debug_message_1 = require("./send-debug-message");
|
|
15
15
|
const ts_utils_1 = require("./ts-utils");
|
|
16
16
|
const supportedStrategies = new Set(['OnPush', 'Default', 'Eager']);
|
|
17
|
-
async function migrateSingleFile(sourceFile, extras) {
|
|
17
|
+
async function migrateSingleFile(sourceFile, host, extras) {
|
|
18
18
|
const testBedSpecifier = await (0, ts_utils_1.getImportSpecifier)(sourceFile, '@angular/core/testing', 'TestBed');
|
|
19
19
|
const isTestFile = sourceFile.fileName.endsWith('.spec.ts') || !!testBedSpecifier;
|
|
20
20
|
if (isTestFile) {
|
|
21
|
-
return (0, migrate_test_file_1.migrateTestFile)(sourceFile);
|
|
21
|
+
return (0, migrate_test_file_1.migrateTestFile)(sourceFile, host);
|
|
22
22
|
}
|
|
23
23
|
const unsupportedZoneUseResponse = await (0, analyze_for_unsupported_zone_uses_1.analyzeForUnsupportedZoneUses)(sourceFile);
|
|
24
24
|
if (unsupportedZoneUseResponse) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-single-file.js","sourceRoot":"","sources":["migrate-single-file.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;
|
|
1
|
+
{"version":3,"file":"migrate-single-file.js","sourceRoot":"","sources":["migrate-single-file.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAeH,8CAyEC;AAlFD,2FAAoF;AACpF,2DAAsD;AACtD,uCAA8E;AAC9E,6DAAwD;AACxD,yCAAgE;AAGhE,MAAM,mBAAmB,GAAwB,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;AAElF,KAAK,UAAU,iBAAiB,CACrC,UAAsB,EACtB,IAAU,EACV,MAA8D;IAE9D,MAAM,gBAAgB,GAAG,MAAM,IAAA,6BAAkB,EAAC,UAAU,EAAE,uBAAuB,EAAE,SAAS,CAAC,CAAC;IAClG,MAAM,UAAU,GAAG,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,gBAAgB,CAAC;IAClF,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,IAAA,mCAAe,EAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,0BAA0B,GAAG,MAAM,IAAA,iEAA6B,E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AAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,iBAAiB,EACnD,CAAC;4BACD,IACE,EAAE,CAAC,0BAA0B,CAAC,IAAI,CAAC,WAAW,CAAC;gCAC/C,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,yBAAyB,EAC7E,CAAC;gCACD,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;gCAC5C,IAAI,mBAAmB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;oCACtC,gBAAgB,GAAG,QAAQ,CAAC;oCAE5B,OAAO;gCACT,CAAC;4BACH,CAAC;wBACH,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QACD,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,qBAAqB,IAAI,CAAC,gBAAgB,IAAI,mBAAmB,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC;QAC9F,IAAA,qCAAgB,EACd,4CAA4C,gBAAgB,aAAa,UAAU,CAAC,QAAQ,gCAAgC,EAC5H,MAAM,CACP,CAAC;QAEF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,+DAA+D;IAC/D,OAAO,IAAA,2DAAiD,EAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AAChF,CAAC"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import type { SourceFile } from 'typescript';
|
|
9
|
+
import { type Host } from '../../host';
|
|
9
10
|
import { MigrationResponse } from './types';
|
|
10
|
-
export declare function migrateTestFile(sourceFile: SourceFile): Promise<MigrationResponse | null>;
|
|
11
|
-
export declare function searchForGlobalZoneless(startPath: string): Promise<boolean>;
|
|
11
|
+
export declare function migrateTestFile(sourceFile: SourceFile, host: Host): Promise<MigrationResponse | null>;
|
|
12
|
+
export declare function searchForGlobalZoneless(startPath: string, host: Host): Promise<boolean>;
|
|
@@ -9,15 +9,14 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.migrateTestFile = migrateTestFile;
|
|
11
11
|
exports.searchForGlobalZoneless = searchForGlobalZoneless;
|
|
12
|
-
const
|
|
13
|
-
const promises_1 = require("node:fs/promises");
|
|
12
|
+
const node_path_1 = require("node:path");
|
|
14
13
|
const workspace_utils_1 = require("../../workspace-utils");
|
|
15
14
|
const prompts_1 = require("./prompts");
|
|
16
15
|
const ts_utils_1 = require("./ts-utils");
|
|
17
|
-
async function migrateTestFile(sourceFile) {
|
|
16
|
+
async function migrateTestFile(sourceFile, host) {
|
|
18
17
|
const ts = await (0, ts_utils_1.loadTypescript)();
|
|
19
18
|
// Check if tests use zoneless either by default through `initTestEnvironment` or by explicitly calling `provideZonelessChangeDetection`.
|
|
20
|
-
let testsUseZonelessChangeDetection = await searchForGlobalZoneless(sourceFile.fileName);
|
|
19
|
+
let testsUseZonelessChangeDetection = await searchForGlobalZoneless(sourceFile.fileName, host);
|
|
21
20
|
if (!testsUseZonelessChangeDetection) {
|
|
22
21
|
ts.forEachChild(sourceFile, function visit(node) {
|
|
23
22
|
if (ts.isCallExpression(node) &&
|
|
@@ -35,17 +34,18 @@ async function migrateTestFile(sourceFile) {
|
|
|
35
34
|
// At this point, tests are using zoneless, so we look for any explicit uses of `provideZoneChangeDetection` that need to be fixed.
|
|
36
35
|
return (0, prompts_1.createFixResponseForZoneTests)(sourceFile);
|
|
37
36
|
}
|
|
38
|
-
async function searchForGlobalZoneless(startPath) {
|
|
39
|
-
const angularJsonDir = (0, workspace_utils_1.findAngularJsonDir)(startPath);
|
|
37
|
+
async function searchForGlobalZoneless(startPath, host) {
|
|
38
|
+
const angularJsonDir = (0, workspace_utils_1.findAngularJsonDir)(startPath, host);
|
|
40
39
|
if (!angularJsonDir) {
|
|
41
40
|
// Cannot determine project root, fallback to original behavior or assume false.
|
|
42
41
|
// For now, let's assume no global setup if angular.json is not found.
|
|
43
42
|
return false;
|
|
44
43
|
}
|
|
45
44
|
try {
|
|
46
|
-
const files = (
|
|
45
|
+
const files = host.glob('**/*.ts', { cwd: angularJsonDir });
|
|
47
46
|
for await (const file of files) {
|
|
48
|
-
const
|
|
47
|
+
const fullPath = (0, node_path_1.join)(file.parentPath, file.name);
|
|
48
|
+
const content = await host.readFile(fullPath, 'utf-8');
|
|
49
49
|
if (content.includes('initTestEnvironment') &&
|
|
50
50
|
content.includes('provideZonelessChangeDetection')) {
|
|
51
51
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-test-file.js","sourceRoot":"","sources":["migrate-test-file.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;
|
|
1
|
+
{"version":3,"file":"migrate-test-file.js","sourceRoot":"","sources":["migrate-test-file.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAUH,0CA4BC;AAED,0DAyBC;AA/DD,yCAAiC;AAGjC,2DAA2D;AAC3D,uCAAoG;AACpG,yCAA4C;AAGrC,KAAK,UAAU,eAAe,CACnC,UAAsB,EACtB,IAAU;IAEV,MAAM,EAAE,GAAG,MAAM,IAAA,yBAAc,GAAE,CAAC;IAClC,yIAAyI;IACzI,IAAI,+BAA+B,GAAG,MAAM,uBAAuB,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC/F,IAAI,CAAC,+BAA+B,EAAE,CAAC;QACrC,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,SAAS,KAAK,CAAC,IAAI;YAC7C,IACE,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC;gBACzB,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,gCAAgC,EACxE,CAAC;gBACD,+BAA+B,GAAG,IAAI,CAAC;gBAEvC,OAAO;YACT,CAA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
|
*/
|
|
8
8
|
import type ts from 'typescript';
|
|
9
|
+
import type { Host } from '../../host';
|
|
9
10
|
export declare function loadTypescript(): Promise<typeof ts>;
|
|
10
11
|
/**
|
|
11
12
|
* Gets a top-level import specifier with a specific name that is imported from a particular module.
|
|
@@ -32,4 +33,4 @@ export declare function getImportSpecifier(sourceFile: ts.SourceFile, moduleName
|
|
|
32
33
|
*/
|
|
33
34
|
export declare function findImportSpecifier(nodes: ts.NodeArray<ts.ImportSpecifier>, specifierName: string): ts.ImportSpecifier | undefined;
|
|
34
35
|
/** Creates a TypeScript source file from a file path. */
|
|
35
|
-
export declare function createSourceFile(file: string): Promise<ts.SourceFile>;
|
|
36
|
+
export declare function createSourceFile(file: string, host: Host): Promise<ts.SourceFile>;
|
|
@@ -44,7 +44,6 @@ exports.loadTypescript = loadTypescript;
|
|
|
44
44
|
exports.getImportSpecifier = getImportSpecifier;
|
|
45
45
|
exports.findImportSpecifier = findImportSpecifier;
|
|
46
46
|
exports.createSourceFile = createSourceFile;
|
|
47
|
-
const node_fs_1 = require("node:fs");
|
|
48
47
|
let typescriptModule;
|
|
49
48
|
async function loadTypescript() {
|
|
50
49
|
return (typescriptModule ??= await Promise.resolve().then(() => __importStar(require('typescript'))));
|
|
@@ -128,8 +127,8 @@ function findImportSpecifier(nodes, specifierName) {
|
|
|
128
127
|
});
|
|
129
128
|
}
|
|
130
129
|
/** Creates a TypeScript source file from a file path. */
|
|
131
|
-
async function createSourceFile(file) {
|
|
132
|
-
const content =
|
|
130
|
+
async function createSourceFile(file, host) {
|
|
131
|
+
const content = await host.readFile(file, 'utf8');
|
|
133
132
|
const ts = await loadTypescript();
|
|
134
133
|
return ts.createSourceFile(file, content, ts.ScriptTarget.Latest, true);
|
|
135
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts-utils.js","sourceRoot":"","sources":["ts-utils.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;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AC,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol';
|
|
9
9
|
import type { ServerNotification, ServerRequest } from '@modelcontextprotocol/sdk/types';
|
|
10
10
|
import { z } from 'zod';
|
|
11
|
+
import type { Host } from '../../host';
|
|
11
12
|
export declare const ZONELESS_MIGRATION_TOOL: import("../tool-registry").McpToolDeclaration<{
|
|
12
13
|
fileOrDirPath: z.ZodString;
|
|
13
14
|
}, Readonly<{
|
|
14
15
|
[k: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
15
16
|
}>>;
|
|
16
|
-
export declare function registerZonelessMigrationTool(fileOrDirPath: string, extras: RequestHandlerExtra<ServerRequest, ServerNotification>): Promise<import("./types").MigrationResponse>;
|
|
17
|
+
export declare function registerZonelessMigrationTool(fileOrDirPath: string, host: Host, extras: RequestHandlerExtra<ServerRequest, ServerNotification>): Promise<import("./types").MigrationResponse>;
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.ZONELESS_MIGRATION_TOOL = void 0;
|
|
11
11
|
exports.registerZonelessMigrationTool = registerZonelessMigrationTool;
|
|
12
|
-
const
|
|
13
|
-
const promises_1 = require("node:fs/promises");
|
|
12
|
+
const node_path_1 = require("node:path");
|
|
14
13
|
const zod_1 = require("zod");
|
|
15
14
|
const tool_registry_1 = require("../tool-registry");
|
|
16
15
|
const analyze_for_unsupported_zone_uses_1 = require("./analyze-for-unsupported-zone-uses");
|
|
@@ -24,46 +23,34 @@ exports.ZONELESS_MIGRATION_TOOL = (0, tool_registry_1.declareTool)({
|
|
|
24
23
|
title: 'Plan migration to OnPush and/or zoneless',
|
|
25
24
|
description: `
|
|
26
25
|
<Purpose>
|
|
27
|
-
Analyzes Angular code and provides a step-by-step, iterative plan to migrate it to
|
|
28
|
-
change detection
|
|
29
|
-
most important action to take in the migration journey.
|
|
26
|
+
Analyzes Angular code and provides a step-by-step, iterative plan to migrate it to 'OnPush'
|
|
27
|
+
change detection (a prerequisite for zoneless applications).
|
|
30
28
|
</Purpose>
|
|
31
29
|
<Use Cases>
|
|
32
|
-
*
|
|
33
|
-
|
|
34
|
-
*
|
|
35
|
-
would block a zoneless migration.
|
|
36
|
-
* **Generating Component Migrations:** Getting the exact instructions for converting a single
|
|
37
|
-
component from the default change detection strategy to \`OnPush\`.
|
|
30
|
+
* Generating component-specific migrations from default change detection to OnPush.
|
|
31
|
+
* Checking a component or directory for unsupported 'NgZone' APIs blocking a zoneless migration.
|
|
32
|
+
* Iterative step-by-step guide for executing a complete zoneless migration.
|
|
38
33
|
</Use Cases>
|
|
39
34
|
<Operational Notes>
|
|
40
|
-
*
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
*
|
|
44
|
-
applying the suggested fix after each call, until the tool indicates that no more actions are
|
|
45
|
-
needed.
|
|
46
|
-
* **Relationship to other migrations:** This tool is the specialized starting point for the zoneless/OnPush
|
|
47
|
-
migration. For other migrations (like signal inputs), you should run the corresponding schematics first,
|
|
48
|
-
as the zoneless migration may depend on them as prerequisites.
|
|
49
|
-
* **Input:** The tool can operate on either a single file or an entire directory. Provide the
|
|
50
|
-
absolute path.
|
|
35
|
+
* This tool is strictly read-only and does NOT modify code. It outputs EXACTLY ONE actionable step at a time.
|
|
36
|
+
* You must apply the suggested code edit, verify it, and then call this tool again to receive the next step in the migration journey.
|
|
37
|
+
* Run modernization schematics (e.g., Signal Inputs migrations) as prerequisites before starting this migration.
|
|
38
|
+
* Supported inputs: Absolute path to a single component/test file, or a directory containing multiple files.
|
|
51
39
|
</Operational Notes>`,
|
|
52
40
|
isReadOnly: true,
|
|
53
41
|
isLocalOnly: true,
|
|
54
42
|
inputSchema: {
|
|
55
43
|
fileOrDirPath: zod_1.z
|
|
56
44
|
.string()
|
|
57
|
-
.describe('
|
|
58
|
-
' The contents are read with fs.readFileSync.'),
|
|
45
|
+
.describe('Absolute path to the TypeScript file or directory containing components/directives to migrate.'),
|
|
59
46
|
},
|
|
60
|
-
factory: () => ({ fileOrDirPath }, requestHandlerExtra) => registerZonelessMigrationTool(fileOrDirPath, requestHandlerExtra),
|
|
47
|
+
factory: ({ host }) => ({ fileOrDirPath }, requestHandlerExtra) => registerZonelessMigrationTool(fileOrDirPath, host, requestHandlerExtra),
|
|
61
48
|
});
|
|
62
|
-
async function registerZonelessMigrationTool(fileOrDirPath, extras) {
|
|
49
|
+
async function registerZonelessMigrationTool(fileOrDirPath, host, extras) {
|
|
63
50
|
let filesWithComponents, componentTestFiles, zoneFiles, categorizationErrors;
|
|
64
51
|
try {
|
|
65
52
|
({ filesWithComponents, componentTestFiles, zoneFiles, categorizationErrors } =
|
|
66
|
-
await discoverAndCategorizeFiles(fileOrDirPath, extras));
|
|
53
|
+
await discoverAndCategorizeFiles(fileOrDirPath, host, extras));
|
|
67
54
|
}
|
|
68
55
|
catch (e) {
|
|
69
56
|
return (0, prompts_1.createResponse)(`Error: Could not access the specified path. Please ensure the following path is correct ` +
|
|
@@ -82,14 +69,14 @@ async function registerZonelessMigrationTool(fileOrDirPath, extras) {
|
|
|
82
69
|
? await rankComponentFilesForMigration(extras, Array.from(filesWithComponents))
|
|
83
70
|
: Array.from(filesWithComponents);
|
|
84
71
|
for (const file of rankedFiles) {
|
|
85
|
-
const result = await (0, migrate_single_file_1.migrateSingleFile)(file, extras);
|
|
72
|
+
const result = await (0, migrate_single_file_1.migrateSingleFile)(file, host, extras);
|
|
86
73
|
if (result !== null) {
|
|
87
74
|
return result;
|
|
88
75
|
}
|
|
89
76
|
}
|
|
90
77
|
}
|
|
91
78
|
for (const file of componentTestFiles) {
|
|
92
|
-
const result = await (0, migrate_test_file_1.migrateTestFile)(file);
|
|
79
|
+
const result = await (0, migrate_test_file_1.migrateTestFile)(file, host);
|
|
93
80
|
if (result !== null) {
|
|
94
81
|
return result;
|
|
95
82
|
}
|
|
@@ -101,7 +88,7 @@ async function registerZonelessMigrationTool(fileOrDirPath, extras) {
|
|
|
101
88
|
}
|
|
102
89
|
return (0, prompts_1.createTestDebuggingGuideForNonActionableInput)(fileOrDirPath);
|
|
103
90
|
}
|
|
104
|
-
async function discoverAndCategorizeFiles(fileOrDirPath, extras) {
|
|
91
|
+
async function discoverAndCategorizeFiles(fileOrDirPath, host, extras) {
|
|
105
92
|
const filePaths = [];
|
|
106
93
|
const componentTestFiles = new Set();
|
|
107
94
|
const filesWithComponents = new Set();
|
|
@@ -109,20 +96,21 @@ async function discoverAndCategorizeFiles(fileOrDirPath, extras) {
|
|
|
109
96
|
const categorizationErrors = [];
|
|
110
97
|
let isDirectory;
|
|
111
98
|
try {
|
|
112
|
-
isDirectory = (
|
|
99
|
+
isDirectory = (await host.stat(fileOrDirPath)).isDirectory();
|
|
113
100
|
}
|
|
114
101
|
catch (e) {
|
|
115
102
|
// Re-throw to be handled by the main function as a user input error
|
|
116
103
|
throw new Error(`Failed to access path: ${fileOrDirPath}`, { cause: e });
|
|
117
104
|
}
|
|
118
105
|
if (isDirectory) {
|
|
119
|
-
|
|
120
|
-
|
|
106
|
+
const files = host.glob('**/*.ts', { cwd: fileOrDirPath });
|
|
107
|
+
for await (const file of files) {
|
|
108
|
+
filePaths.push((0, node_path_1.join)(file.parentPath, file.name));
|
|
121
109
|
}
|
|
122
110
|
}
|
|
123
111
|
else {
|
|
124
112
|
filePaths.push(fileOrDirPath);
|
|
125
|
-
const maybeTestFile = await getTestFilePath(fileOrDirPath);
|
|
113
|
+
const maybeTestFile = await getTestFilePath(fileOrDirPath, host);
|
|
126
114
|
if (maybeTestFile) {
|
|
127
115
|
// Eagerly add the test file path for categorization.
|
|
128
116
|
filePaths.push(maybeTestFile);
|
|
@@ -133,8 +121,8 @@ async function discoverAndCategorizeFiles(fileOrDirPath, extras) {
|
|
|
133
121
|
while (filesToProcess.length > 0) {
|
|
134
122
|
const batch = filesToProcess.splice(0, CONCURRENCY_LIMIT);
|
|
135
123
|
const results = await Promise.allSettled(batch.map(async (filePath) => {
|
|
136
|
-
const sourceFile = await (0, ts_utils_1.createSourceFile)(filePath);
|
|
137
|
-
await categorizeFile(sourceFile, extras, {
|
|
124
|
+
const sourceFile = await (0, ts_utils_1.createSourceFile)(filePath, host);
|
|
125
|
+
await categorizeFile(sourceFile, host, extras, {
|
|
138
126
|
filesWithComponents,
|
|
139
127
|
componentTestFiles,
|
|
140
128
|
zoneFiles,
|
|
@@ -151,7 +139,7 @@ async function discoverAndCategorizeFiles(fileOrDirPath, extras) {
|
|
|
151
139
|
}
|
|
152
140
|
return { filesWithComponents, componentTestFiles, zoneFiles, categorizationErrors };
|
|
153
141
|
}
|
|
154
|
-
async function categorizeFile(sourceFile, extras, categorizedFiles) {
|
|
142
|
+
async function categorizeFile(sourceFile, host, extras, categorizedFiles) {
|
|
155
143
|
const { filesWithComponents, componentTestFiles, zoneFiles } = categorizedFiles;
|
|
156
144
|
const content = sourceFile.getFullText();
|
|
157
145
|
const componentSpecifier = await (0, ts_utils_1.getImportSpecifier)(sourceFile, '@angular/core', 'Component');
|
|
@@ -167,9 +155,9 @@ async function categorizeFile(sourceFile, extras, categorizedFiles) {
|
|
|
167
155
|
else {
|
|
168
156
|
(0, send_debug_message_1.sendDebugMessage)(`Component file already has change detection strategy: ${sourceFile.fileName}. Skipping migration.`, extras);
|
|
169
157
|
}
|
|
170
|
-
const testFilePath = await getTestFilePath(sourceFile.fileName);
|
|
158
|
+
const testFilePath = await getTestFilePath(sourceFile.fileName, host);
|
|
171
159
|
if (testFilePath) {
|
|
172
|
-
componentTestFiles.add(await (0, ts_utils_1.createSourceFile)(testFilePath));
|
|
160
|
+
componentTestFiles.add(await (0, ts_utils_1.createSourceFile)(testFilePath, host));
|
|
173
161
|
}
|
|
174
162
|
}
|
|
175
163
|
else if (zoneSpecifier) {
|
|
@@ -213,9 +201,9 @@ async function rankComponentFilesForMigration({ sendRequest }, componentFiles) {
|
|
|
213
201
|
catch { }
|
|
214
202
|
return componentFiles; // Fallback to original order if the response fails
|
|
215
203
|
}
|
|
216
|
-
async function getTestFilePath(filePath) {
|
|
204
|
+
async function getTestFilePath(filePath, host) {
|
|
217
205
|
const testFilePath = filePath.replace(/\.ts$/, '.spec.ts');
|
|
218
|
-
if (
|
|
206
|
+
if (host.existsSync(testFilePath)) {
|
|
219
207
|
return testFilePath;
|
|
220
208
|
}
|
|
221
209
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zoneless-migration.js","sourceRoot":"","sources":["zoneless-migration.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;
|
|
1
|
+
{"version":3,"file":"zoneless-migration.js","sourceRoot":"","sources":["zoneless-migration.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAkDH,sEAuDC;AArGD,yCAAiC;AAEjC,6BAAwB;AAExB,oDAA+C;AAC/C,2FAAoF;AACpF,+DAA0D;AAC1D,2DAAsD;AACtD,uCAA0F;AAC1F,6DAAwD;AACxD,yCAAkE;AAErD,QAAA,uBAAuB,GAAG,IAAA,2BAAW,EAAC;IACjD,IAAI,EAAE,2BAA2B;IACjC,KAAK,EAAE,0CAA0C;IACjD,WAAW,EAAE;;;;;;;;;;;;;;;qBAeM;IACnB,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE;QACX,aAAa,EAAE,OAAC;aACb,MAAM,EAAE;aACR,QAAQ,CACP,gGAAgG,CACjG;KACJ;IACD,OAAO,EACL,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CACb,CAAC,EAAE,aAAa,EAAE,EAAE,mBAAmB,EAAE,EAAE,CACzC,6BAA6B,CAAC,aAAa,EAAE,IAAI,EAAE,mBAAmB,CAAC;CAC5E,CAAC,CAAC;AAEI,KAAK,UAAU,6BAA6B,CACjD,aAAqB,E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CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;aAC1B,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;aACtE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAEtB,sDAAsD;QACtD,IAAI,WAAW,CAAC,MAAM,KAAK,cAAc,CAAC,MAAM,EAAE,CAAC;YACjD,OAAO,WAAW,CAAC;QACrB,CAAC;IACH,CAAC;IAAC,MAAM,CAAC,CAAA,CAAC;IAEV,OAAO,cAAc,CAAC,CAAC,mDAAmD;AAC5E,CAAC;AAED,KAAK,UAAU,eAAe,CAAC,QAAgB,EAAE,IAAU;IACzD,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAC3D,IAAI,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAClC,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -72,6 +72,9 @@ const listProjectsOutputSchema = {
|
|
|
72
72
|
.optional()
|
|
73
73
|
.describe('The default style language for the project (e.g., "scss"). ' +
|
|
74
74
|
'This determines the file extension for new component styles.'),
|
|
75
|
+
targets: zod_1.z
|
|
76
|
+
.array(zod_1.z.string())
|
|
77
|
+
.describe('Available project targets (e.g., ["build", "test", "lint", "e2e"]).'),
|
|
75
78
|
})),
|
|
76
79
|
})),
|
|
77
80
|
parsingErrors: zod_1.z
|
|
@@ -96,28 +99,20 @@ exports.LIST_PROJECTS_TOOL = (0, tool_registry_1.declareTool)({
|
|
|
96
99
|
title: 'List Angular Projects',
|
|
97
100
|
description: `
|
|
98
101
|
<Purpose>
|
|
99
|
-
Provides a comprehensive overview of all Angular workspaces and
|
|
100
|
-
|
|
101
|
-
|
|
102
|
+
Provides a comprehensive overview of all Angular workspaces, projects, and configured targets within the repository.
|
|
103
|
+
Always use this tool as a mandatory first step before performing any project-specific actions
|
|
104
|
+
to understand the available projects and locations.
|
|
102
105
|
</Purpose>
|
|
103
106
|
<Use Cases>
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* Getting the \`selectorPrefix\` for a project before generating a new component to ensure it follows conventions.
|
|
109
|
-
* Identifying the major version of the Angular framework for each workspace, which is crucial for monorepos.
|
|
110
|
-
* Determining a project's primary function by inspecting its builder (e.g., '@angular-devkit/build-angular:browser' for an application).
|
|
107
|
+
* Discovering project names, locations, builders, selector prefixes, and style languages before generating or building components.
|
|
108
|
+
* Determining a project's unit test framework (Jasmine, Jest, or Vitest) before writing or modifying tests.
|
|
109
|
+
* Identifying available execution targets (e.g., lint, e2e, serve, deploy) before attempting execution.
|
|
110
|
+
* Disambiguating multiple workspaces in monorepos.
|
|
111
111
|
</Use Cases>
|
|
112
112
|
<Operational Notes>
|
|
113
|
-
*
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
If the value is 'unknown', you **MUST** inspect the project's configuration files
|
|
117
|
-
(e.g., \`karma.conf.js\`, \`jest.config.js\`, or the 'test' target in \`angular.json\`) to determine the
|
|
118
|
-
framework before generating tests.
|
|
119
|
-
* **Disambiguation:** A monorepo may contain multiple workspaces (e.g., for different applications or even in output directories).
|
|
120
|
-
Use the \`path\` of each workspace to understand its context and choose the correct project.
|
|
113
|
+
* Execute shell/CLI commands from the parent directory of the workspace's 'path' field.
|
|
114
|
+
* If 'unitTestFramework' is 'unknown', inspect local config files (e.g., jest.config.js, karma.conf.js)
|
|
115
|
+
or the 'test' target in 'angular.json' to determine the framework before creating tests.
|
|
121
116
|
</Operational Notes>`,
|
|
122
117
|
outputSchema: listProjectsOutputSchema,
|
|
123
118
|
isReadOnly: true,
|
|
@@ -394,6 +389,7 @@ async function loadAndParseWorkspace(configFile, seenPaths) {
|
|
|
394
389
|
const fullSourceRoot = (0, node_path_1.join)(workspaceRoot, sourceRoot);
|
|
395
390
|
const unitTestFramework = getUnitTestFramework(project.targets.get('test'));
|
|
396
391
|
const styleLanguage = await getProjectStyleLanguage(project, ws, fullSourceRoot);
|
|
392
|
+
const targets = Array.from(project.targets.keys());
|
|
397
393
|
projects.push({
|
|
398
394
|
name,
|
|
399
395
|
type: project.extensions['projectType'],
|
|
@@ -403,6 +399,7 @@ async function loadAndParseWorkspace(configFile, seenPaths) {
|
|
|
403
399
|
selectorPrefix: project.extensions['prefix'],
|
|
404
400
|
unitTestFramework,
|
|
405
401
|
styleLanguage,
|
|
402
|
+
targets,
|
|
406
403
|
});
|
|
407
404
|
}
|
|
408
405
|
return { workspace: { path: configFile, projects }, error: null };
|