@angular/cli 22.0.0-next.6 → 22.0.0-next.8
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 +2 -2
- package/lib/config/schema.json +10 -1
- package/lib/config/workspace-schema.d.ts +4 -0
- package/package.json +17 -17
- package/src/commands/mcp/devserver.js +1 -1
- package/src/commands/mcp/devserver.js.map +1 -1
- package/src/commands/mcp/host.d.ts +8 -12
- package/src/commands/mcp/host.js +96 -11
- package/src/commands/mcp/host.js.map +1 -1
- package/src/commands/mcp/mcp-server.d.ts +0 -20
- package/src/commands/mcp/mcp-server.js +38 -15
- package/src/commands/mcp/mcp-server.js.map +1 -1
- package/src/commands/mcp/resources/ai-tutor.md +5 -7
- package/src/commands/mcp/tools/build.js +2 -1
- package/src/commands/mcp/tools/build.js.map +1 -1
- package/src/commands/mcp/tools/devserver/devserver-start.js +1 -0
- package/src/commands/mcp/tools/devserver/devserver-start.js.map +1 -1
- package/src/commands/mcp/tools/devserver/devserver-stop.js +1 -0
- package/src/commands/mcp/tools/devserver/devserver-stop.js.map +1 -1
- package/src/commands/mcp/tools/devserver/devserver-wait-for-build.js +1 -0
- package/src/commands/mcp/tools/devserver/devserver-wait-for-build.js.map +1 -1
- package/src/commands/mcp/tools/e2e.js +2 -1
- package/src/commands/mcp/tools/e2e.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 +21 -21
- package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.js.map +1 -1
- package/src/commands/mcp/tools/test.js +1 -1
- package/src/commands/mcp/tools/test.js.map +1 -1
- package/src/commands/mcp/workspace-utils.d.ts +2 -1
- package/src/commands/mcp/workspace-utils.js +43 -1
- package/src/commands/mcp/workspace-utils.js.map +1 -1
- package/src/package-managers/package-manager-descriptor.d.ts +7 -1
- package/src/package-managers/package-manager-descriptor.js +2 -0
- package/src/package-managers/package-manager-descriptor.js.map +1 -1
- package/src/package-managers/package-manager.d.ts +4 -0
- package/src/package-managers/package-manager.js +26 -1
- package/src/package-managers/package-manager.js.map +1 -1
- package/src/package-managers/parsers.d.ts +3 -6
- package/src/package-managers/parsers.js +84 -7
- package/src/package-managers/parsers.js.map +1 -1
- package/src/utilities/node-version.js +1 -1
- package/src/utilities/package-metadata.d.ts +0 -10
- package/src/utilities/package-metadata.js +0 -49
- package/src/utilities/package-metadata.js.map +1 -1
- package/src/utilities/version.js +1 -1
- package/lib/code-examples.db +0 -0
- package/src/commands/mcp/tools/examples/database-discovery.d.ts +0 -34
- package/src/commands/mcp/tools/examples/database-discovery.js +0 -87
- package/src/commands/mcp/tools/examples/database-discovery.js.map +0 -1
- package/src/commands/mcp/tools/examples/database.d.ts +0 -35
- package/src/commands/mcp/tools/examples/database.js +0 -125
- package/src/commands/mcp/tools/examples/database.js.map +0 -1
- package/src/commands/mcp/tools/examples/index.d.ts +0 -26
- package/src/commands/mcp/tools/examples/index.js +0 -149
- package/src/commands/mcp/tools/examples/index.js.map +0 -1
- package/src/commands/mcp/tools/examples/query-escaper.d.ts +0 -20
- package/src/commands/mcp/tools/examples/query-escaper.js +0 -68
- package/src/commands/mcp/tools/examples/query-escaper.js.map +0 -1
- package/src/commands/mcp/tools/examples/runtime-database.d.ts +0 -10
- package/src/commands/mcp/tools/examples/runtime-database.js +0 -192
- package/src/commands/mcp/tools/examples/runtime-database.js.map +0 -1
- package/src/commands/mcp/tools/examples/schemas.d.ts +0 -29
- package/src/commands/mcp/tools/examples/schemas.js +0 -101
- package/src/commands/mcp/tools/examples/schemas.js.map +0 -1
- package/src/commands/mcp/tools/examples/utils.d.ts +0 -14
- package/src/commands/mcp/tools/examples/utils.js +0 -31
- package/src/commands/mcp/tools/examples/utils.js.map +0 -1
- package/src/commands/mcp/tools/modernize.d.ts +0 -43
- package/src/commands/mcp/tools/modernize.js +0 -165
- package/src/commands/mcp/tools/modernize.js.map +0 -1
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
-
*/
|
|
8
|
-
import { z } from 'zod';
|
|
9
|
-
export declare const findExampleInputSchema: z.ZodObject<{
|
|
10
|
-
workspacePath: z.ZodOptional<z.ZodString>;
|
|
11
|
-
query: z.ZodString;
|
|
12
|
-
keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
13
|
-
required_packages: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
14
|
-
related_concepts: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
15
|
-
includeExperimental: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
16
|
-
}, z.core.$strip>;
|
|
17
|
-
export type FindExampleInput = z.infer<typeof findExampleInputSchema>;
|
|
18
|
-
export declare const findExampleOutputSchema: z.ZodObject<{
|
|
19
|
-
examples: z.ZodArray<z.ZodObject<{
|
|
20
|
-
title: z.ZodString;
|
|
21
|
-
summary: z.ZodString;
|
|
22
|
-
keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
23
|
-
required_packages: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
24
|
-
related_concepts: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
25
|
-
related_tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
26
|
-
content: z.ZodString;
|
|
27
|
-
snippet: z.ZodOptional<z.ZodString>;
|
|
28
|
-
}, z.core.$strip>>;
|
|
29
|
-
}, z.core.$strip>;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright Google LLC All Rights Reserved.
|
|
5
|
-
*
|
|
6
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.findExampleOutputSchema = exports.findExampleInputSchema = void 0;
|
|
11
|
-
const zod_1 = require("zod");
|
|
12
|
-
exports.findExampleInputSchema = zod_1.z.object({
|
|
13
|
-
workspacePath: zod_1.z
|
|
14
|
-
.string()
|
|
15
|
-
.optional()
|
|
16
|
-
.describe('The absolute path to the `angular.json` file for the workspace. This is used to find the ' +
|
|
17
|
-
'version-specific code examples that correspond to the installed version of the ' +
|
|
18
|
-
'Angular framework. You **MUST** get this path from the `list_projects` tool. ' +
|
|
19
|
-
'If omitted, the tool will search the generic code examples bundled with the CLI.'),
|
|
20
|
-
query: zod_1.z
|
|
21
|
-
.string()
|
|
22
|
-
.describe("The primary, conceptual search query. This should capture the user's main goal or question " +
|
|
23
|
-
"(e.g., 'lazy loading a route' or 'how to use signal inputs'). The query will be processed " +
|
|
24
|
-
'by a powerful full-text search engine.\n\n' +
|
|
25
|
-
'Key Syntax Features (see https://www.sqlite.org/fts5.html for full documentation):\n' +
|
|
26
|
-
' - AND (default): Space-separated terms are combined with AND.\n' +
|
|
27
|
-
' - Example: \'standalone component\' (finds results with both "standalone" and "component")\n' +
|
|
28
|
-
' - OR: Use the OR operator to find results with either term.\n' +
|
|
29
|
-
" - Example: 'validation OR validator'\n" +
|
|
30
|
-
' - NOT: Use the NOT operator to exclude terms.\n' +
|
|
31
|
-
" - Example: 'forms NOT reactive'\n" +
|
|
32
|
-
' - Grouping: Use parentheses () to group expressions.\n' +
|
|
33
|
-
" - Example: '(validation OR validator) AND forms'\n" +
|
|
34
|
-
' - Phrase Search: Use double quotes "" for exact phrases.\n' +
|
|
35
|
-
' - Example: \'"template-driven forms"\'\n' +
|
|
36
|
-
' - Prefix Search: Use an asterisk * for prefix matching.\n' +
|
|
37
|
-
' - Example: \'rout*\' (matches "route", "router", "routing")'),
|
|
38
|
-
keywords: zod_1.z
|
|
39
|
-
.array(zod_1.z.string())
|
|
40
|
-
.optional()
|
|
41
|
-
.describe('A list of specific, exact keywords to narrow the search. Use this for precise terms like '),
|
|
42
|
-
required_packages: zod_1.z
|
|
43
|
-
.array(zod_1.z.string())
|
|
44
|
-
.optional()
|
|
45
|
-
.describe("A list of NPM packages that an example must use. Use this when the user's request is " +
|
|
46
|
-
'specific to a feature within a certain package (e.g., if the user asks about `ngModel`, ' +
|
|
47
|
-
'you should filter by `@angular/forms`).'),
|
|
48
|
-
related_concepts: zod_1.z
|
|
49
|
-
.array(zod_1.z.string())
|
|
50
|
-
.optional()
|
|
51
|
-
.describe('A list of high-level concepts to filter by. Use this to find examples related to broader ' +
|
|
52
|
-
'architectural ideas or patterns (e.g., `signals`, `dependency injection`, `routing`).'),
|
|
53
|
-
includeExperimental: zod_1.z
|
|
54
|
-
.boolean()
|
|
55
|
-
.optional()
|
|
56
|
-
.default(false)
|
|
57
|
-
.describe('By default, this tool returns only production-safe examples. Set this to `true` **only if** ' +
|
|
58
|
-
'the user explicitly asks for a bleeding-edge feature or if a stable solution to their ' +
|
|
59
|
-
'problem cannot be found. If you set this to `true`, you **MUST** preface your answer by ' +
|
|
60
|
-
'warning the user that the example uses experimental APIs that are not suitable for production.'),
|
|
61
|
-
});
|
|
62
|
-
exports.findExampleOutputSchema = zod_1.z.object({
|
|
63
|
-
examples: zod_1.z.array(zod_1.z.object({
|
|
64
|
-
title: zod_1.z
|
|
65
|
-
.string()
|
|
66
|
-
.describe('The title of the example. Use this as a heading when presenting the example to the user.'),
|
|
67
|
-
summary: zod_1.z
|
|
68
|
-
.string()
|
|
69
|
-
.describe("A one-sentence summary of the example's purpose. Use this to help the user decide " +
|
|
70
|
-
'if the example is relevant to them.'),
|
|
71
|
-
keywords: zod_1.z
|
|
72
|
-
.array(zod_1.z.string())
|
|
73
|
-
.optional()
|
|
74
|
-
.describe('A list of keywords for the example. You can use these to explain why this example ' +
|
|
75
|
-
"was a good match for the user's query."),
|
|
76
|
-
required_packages: zod_1.z
|
|
77
|
-
.array(zod_1.z.string())
|
|
78
|
-
.optional()
|
|
79
|
-
.describe('A list of NPM packages required for the example to work. Before presenting the code, ' +
|
|
80
|
-
'you should inform the user if any of these packages need to be installed.'),
|
|
81
|
-
related_concepts: zod_1.z
|
|
82
|
-
.array(zod_1.z.string())
|
|
83
|
-
.optional()
|
|
84
|
-
.describe('A list of related concepts. You can suggest these to the user as topics for ' +
|
|
85
|
-
'follow-up questions.'),
|
|
86
|
-
related_tools: zod_1.z
|
|
87
|
-
.array(zod_1.z.string())
|
|
88
|
-
.optional()
|
|
89
|
-
.describe('A list of related MCP tools. You can suggest these as potential next steps for the user.'),
|
|
90
|
-
content: zod_1.z
|
|
91
|
-
.string()
|
|
92
|
-
.describe('A complete, self-contained Angular code example in Markdown format. This should be ' +
|
|
93
|
-
'presented to the user inside a markdown code block.'),
|
|
94
|
-
snippet: zod_1.z
|
|
95
|
-
.string()
|
|
96
|
-
.optional()
|
|
97
|
-
.describe('A contextual snippet from the content showing the matched search term. This field is ' +
|
|
98
|
-
'critical for efficiently evaluating a result`s relevance. It enables two primary '),
|
|
99
|
-
})),
|
|
100
|
-
});
|
|
101
|
-
//# sourceMappingURL=sch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AA,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9C,QAAQ,EAAE,OAAC,CAAC,KAAK,CACf,OAAC,CAAC,MAAM,CAAC;QACP,KAAK,EAAE,OAAC;aACL,MAAM,EAAE;aACR,QAAQ,CACP,0FAA0F,CAC3F;QACH,OAAO,EAAE,OAAC;aACP,MAAM,EAAE;aACR,QAAQ,CACP,oFAAoF;YAClF,qCAAqC,CACxC;QACH,QAAQ,EAAE,OAAC;aACR,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;aACjB,QAAQ,EAAE;aACV,QAAQ,CACP,oFAAoF;YAClF,wCAAwC,CAC3C;QACH,iBAAiB,EAAE,OAAC;aACjB,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;aACjB,QAAQ,EAAE;aACV,QAAQ,CACP,uFAAuF;YACrF,2EAA2E,CAC9E;QACH,gBAAgB,EAAE,OAAC;aAChB,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;aACjB,QAAQ,EAAE;aACV,QAAQ,CACP,8EAA8E;YAC5E,sBAAsB,CACzB;QACH,aAAa,EAAE,OAAC;aACb,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;aACjB,QAAQ,EAAE;aACV,QAAQ,CACP,0FAA0F,CAC3F;QACH,OAAO,EAAE,OAAC;aACP,MAAM,EAAE;aACR,QAAQ,CACP,qFAAqF;YACnF,qDAAqD,CACxD;QACH,OAAO,EAAE,OAAC;aACP,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,uFAAuF;YACrF,mFAAmF,CACtF;KACJ,CAAC,CACH;CACF,CAAC,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Suppresses the experimental warning emitted by Node.js for the `node:sqlite` module.
|
|
10
|
-
*
|
|
11
|
-
* This is a workaround to prevent the console from being cluttered with warnings
|
|
12
|
-
* about the experimental status of the SQLite module, which is used by this tool.
|
|
13
|
-
*/
|
|
14
|
-
export declare function suppressSqliteWarning(): void;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright Google LLC All Rights Reserved.
|
|
5
|
-
*
|
|
6
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.suppressSqliteWarning = suppressSqliteWarning;
|
|
11
|
-
/**
|
|
12
|
-
* Suppresses the experimental warning emitted by Node.js for the `node:sqlite` module.
|
|
13
|
-
*
|
|
14
|
-
* This is a workaround to prevent the console from being cluttered with warnings
|
|
15
|
-
* about the experimental status of the SQLite module, which is used by this tool.
|
|
16
|
-
*/
|
|
17
|
-
function suppressSqliteWarning() {
|
|
18
|
-
const originalProcessEmit = process.emit;
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
-
process.emit = function (event, error) {
|
|
21
|
-
if (event === 'warning' &&
|
|
22
|
-
error instanceof Error &&
|
|
23
|
-
error.name === 'ExperimentalWarning' &&
|
|
24
|
-
error.message.includes('SQLite')) {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, prefer-rest-params
|
|
28
|
-
return originalProcessEmit.apply(process, arguments);
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["utils.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAQH,sDAgBC;AAtBD;;;;;GAKG;AACH,SAAgB,qBAAqB;IACnC,MAAM,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IACzC,8DAA8D;IAC9D,OAAO,CAAC,IAAI,GAAG,UAAU,KAAa,EAAE,KAAe;QACrD,IACE,KAAK,KAAK,SAAS;YACnB,KAAK,YAAY,KAAK;YACtB,KAAK,CAAC,IAAI,KAAK,qBAAqB;YACpC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAChC,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;QAED,kFAAkF;QAClF,OAAO,mBAAmB,CAAC,KAAK,CAAC,OAAO,EAAE,SAAgB,CAAC,CAAC;IAC9D,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
-
*/
|
|
8
|
-
import { z } from 'zod';
|
|
9
|
-
import { type McpToolContext, type McpToolDeclaration } from './tool-registry';
|
|
10
|
-
declare const modernizeInputSchema: z.ZodObject<{
|
|
11
|
-
transformations: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
12
|
-
[x: string]: string;
|
|
13
|
-
}>>>;
|
|
14
|
-
path: z.ZodOptional<z.ZodString>;
|
|
15
|
-
workspace: z.ZodOptional<z.ZodString>;
|
|
16
|
-
project: z.ZodOptional<z.ZodString>;
|
|
17
|
-
}, z.core.$strip>;
|
|
18
|
-
declare const modernizeOutputSchema: z.ZodObject<{
|
|
19
|
-
instructions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
20
|
-
logs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
21
|
-
}, z.core.$strip>;
|
|
22
|
-
export type ModernizeInput = z.infer<typeof modernizeInputSchema>;
|
|
23
|
-
export type ModernizeOutput = z.infer<typeof modernizeOutputSchema>;
|
|
24
|
-
export declare function runModernization(input: ModernizeInput, context: McpToolContext): Promise<{
|
|
25
|
-
content: {
|
|
26
|
-
type: "text";
|
|
27
|
-
text: string;
|
|
28
|
-
}[];
|
|
29
|
-
structuredContent: {
|
|
30
|
-
instructions: string[];
|
|
31
|
-
};
|
|
32
|
-
} | {
|
|
33
|
-
content: {
|
|
34
|
-
type: "text";
|
|
35
|
-
text: string;
|
|
36
|
-
}[];
|
|
37
|
-
structuredContent: {
|
|
38
|
-
instructions: string[] | undefined;
|
|
39
|
-
logs: string[];
|
|
40
|
-
};
|
|
41
|
-
}>;
|
|
42
|
-
export declare const MODERNIZE_TOOL: McpToolDeclaration<typeof modernizeInputSchema.shape, typeof modernizeOutputSchema.shape>;
|
|
43
|
-
export {};
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright Google LLC All Rights Reserved.
|
|
5
|
-
*
|
|
6
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.MODERNIZE_TOOL = void 0;
|
|
11
|
-
exports.runModernization = runModernization;
|
|
12
|
-
const zod_1 = require("zod");
|
|
13
|
-
const shared_options_1 = require("../shared-options");
|
|
14
|
-
const utils_1 = require("../utils");
|
|
15
|
-
const workspace_utils_1 = require("../workspace-utils");
|
|
16
|
-
const tool_registry_1 = require("./tool-registry");
|
|
17
|
-
const TRANSFORMATIONS = [
|
|
18
|
-
{
|
|
19
|
-
name: 'control-flow',
|
|
20
|
-
description: 'Migrates from `*ngIf`, `*ngFor`, and `*ngSwitch` to the new `@if`, `@for`, and `@switch` block syntax in templates.',
|
|
21
|
-
documentationUrl: 'https://angular.dev/reference/migrations/control-flow',
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
name: 'self-closing-tag',
|
|
25
|
-
description: 'Converts tags for elements with no content to be self-closing (e.g., `<app-foo></app-foo>` becomes `<app-foo />`).',
|
|
26
|
-
documentationUrl: 'https://angular.dev/reference/migrations/self-closing-tags',
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
name: 'inject',
|
|
30
|
-
description: 'Converts usages of constructor-based injection to the inject() function.',
|
|
31
|
-
documentationUrl: 'https://angular.dev/reference/migrations/inject-function',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: 'output-migration',
|
|
35
|
-
description: 'Converts `@Output` declarations to the new functional `output()` syntax.',
|
|
36
|
-
documentationUrl: 'https://angular.dev/reference/migrations/outputs',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: 'signal-input-migration',
|
|
40
|
-
description: 'Migrates `@Input` declarations to the new signal-based `input()` syntax.',
|
|
41
|
-
documentationUrl: 'https://angular.dev/reference/migrations/signal-inputs',
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: 'signal-queries-migration',
|
|
45
|
-
description: 'Migrates `@ViewChild` and `@ContentChild` queries to their signal-based `viewChild` and `contentChild` versions.',
|
|
46
|
-
documentationUrl: 'https://angular.dev/reference/migrations/signal-queries',
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
name: 'standalone',
|
|
50
|
-
description: 'Converts the application to use standalone components, directives, and pipes. This is a ' +
|
|
51
|
-
'three-step process. After each step, you should verify that your application builds and ' +
|
|
52
|
-
'runs correctly.',
|
|
53
|
-
instructions: 'This migration requires running a cli schematic multiple times. Run the commands in the ' +
|
|
54
|
-
'order listed below, verifying that your code builds and runs between each step:\n\n' +
|
|
55
|
-
'1. Run `ng g @angular/core:standalone` and select "Convert all components, directives and pipes to standalone"\n' +
|
|
56
|
-
'2. Run `ng g @angular/core:standalone` and select "Remove unnecessary NgModule classes"\n' +
|
|
57
|
-
'3. Run `ng g @angular/core:standalone` and select "Bootstrap the project using standalone APIs"',
|
|
58
|
-
documentationUrl: 'https://angular.dev/reference/migrations/standalone',
|
|
59
|
-
},
|
|
60
|
-
];
|
|
61
|
-
const modernizeInputSchema = zod_1.z.object({
|
|
62
|
-
...shared_options_1.workspaceAndProjectOptions,
|
|
63
|
-
transformations: zod_1.z
|
|
64
|
-
.array(zod_1.z.enum(TRANSFORMATIONS.map((t) => t.name)))
|
|
65
|
-
.optional()
|
|
66
|
-
.describe('A list of specific transformations to apply.'),
|
|
67
|
-
path: zod_1.z
|
|
68
|
-
.string()
|
|
69
|
-
.optional()
|
|
70
|
-
.describe('The path to the file or directory to modernize, relative to the workspace root.'),
|
|
71
|
-
});
|
|
72
|
-
const modernizeOutputSchema = zod_1.z.object({
|
|
73
|
-
instructions: zod_1.z
|
|
74
|
-
.array(zod_1.z.string())
|
|
75
|
-
.optional()
|
|
76
|
-
.describe('Migration summary, as well as any instructions that need to be performed to complete the migrations.'),
|
|
77
|
-
logs: zod_1.z.array(zod_1.z.string()).optional().describe('All logs from all executed commands.'),
|
|
78
|
-
});
|
|
79
|
-
async function runModernization(input, context) {
|
|
80
|
-
const transformationNames = input.transformations ?? [];
|
|
81
|
-
if (transformationNames.length === 0) {
|
|
82
|
-
return (0, utils_1.createStructuredContentOutput)({
|
|
83
|
-
instructions: [
|
|
84
|
-
'Call this tool with the specific transformations you want to run. See the tool description for more info. Also call the' +
|
|
85
|
-
' `get_best_practices` tool for general Angular best practices.',
|
|
86
|
-
],
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
const { workspacePath, projectName } = await (0, workspace_utils_1.resolveWorkspaceAndProject)({
|
|
90
|
-
host: context.host,
|
|
91
|
-
workspacePathInput: input.workspace,
|
|
92
|
-
projectNameInput: input.project,
|
|
93
|
-
mcpWorkspace: context.workspace,
|
|
94
|
-
});
|
|
95
|
-
const instructions = [];
|
|
96
|
-
let logs = [];
|
|
97
|
-
const transformationsToRun = TRANSFORMATIONS.filter((t) => transformationNames.includes(t.name));
|
|
98
|
-
for (const transformation of transformationsToRun) {
|
|
99
|
-
if (transformation.instructions) {
|
|
100
|
-
// This is a complex case, return instructions.
|
|
101
|
-
let transformationInstructions = transformation.instructions;
|
|
102
|
-
if (transformation.documentationUrl) {
|
|
103
|
-
transformationInstructions += `\nFor more information, see ${transformation.documentationUrl}.`;
|
|
104
|
-
}
|
|
105
|
-
instructions.push(transformationInstructions);
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
// Simple case, run the command.
|
|
109
|
-
const command = 'ng';
|
|
110
|
-
const args = ['generate', `@angular/core:${transformation.name}`, '--project', projectName];
|
|
111
|
-
if (input.path) {
|
|
112
|
-
args.push('--path', input.path);
|
|
113
|
-
}
|
|
114
|
-
try {
|
|
115
|
-
logs = (await context.host.runCommand(command, args, {
|
|
116
|
-
cwd: workspacePath,
|
|
117
|
-
})).logs;
|
|
118
|
-
instructions.push(`Migration ${transformation.name} completed successfully.`);
|
|
119
|
-
}
|
|
120
|
-
catch (e) {
|
|
121
|
-
logs = (0, utils_1.getCommandErrorLogs)(e);
|
|
122
|
-
instructions.push(`Migration ${transformation.name} failed.`);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return (0, utils_1.createStructuredContentOutput)({
|
|
127
|
-
instructions: instructions.length > 0 ? instructions : undefined,
|
|
128
|
-
logs,
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
exports.MODERNIZE_TOOL = (0, tool_registry_1.declareTool)({
|
|
132
|
-
name: 'modernize',
|
|
133
|
-
title: 'Modernize Angular Code',
|
|
134
|
-
description: `
|
|
135
|
-
<Purpose>
|
|
136
|
-
Provides instructions and commands for modernizing Angular code to align with the latest best
|
|
137
|
-
practices and syntax. This tool helps ensure code is idiomatic, readable, and maintainable by
|
|
138
|
-
generating the exact steps needed to perform specific migrations.
|
|
139
|
-
</Purpose>
|
|
140
|
-
<Use Cases>
|
|
141
|
-
* **Applying Specific Migrations:** Get the precise commands to update code to modern patterns
|
|
142
|
-
(e.g., selecting 'control-flow-migration' to replace *ngIf with @if).
|
|
143
|
-
* **Upgrading Existing Code:** Modernize an entire project by running the 'standalone' migration,
|
|
144
|
-
which provides a multi-step command sequence.
|
|
145
|
-
* **Discovering Available Migrations:** Call the tool with no transformations to get a link to the
|
|
146
|
-
general best practices guide.
|
|
147
|
-
</Use Cases>
|
|
148
|
-
<Operational Notes>
|
|
149
|
-
* **Execution:** This tool executes 'ng generate' commands for simple migrations in a temporary
|
|
150
|
-
environment using the provided file content. For complex migrations like 'standalone', it
|
|
151
|
-
provides instructions which you **MUST** then execute as shell commands.
|
|
152
|
-
* **File Modifications:** This tool has been fixed and now correctly finds the node_modules directory in a Bazel environment.
|
|
153
|
-
* **Standalone Migration:** The 'standalone' transformation is a special, multi-step process.
|
|
154
|
-
The tool will provide instructions. You **MUST** execute the commands in the exact order
|
|
155
|
-
provided and validate your application between each step.
|
|
156
|
-
* **Transformation List:** The following transformations are available:
|
|
157
|
-
${TRANSFORMATIONS.map((t) => ` * ${t.name}: ${t.description}`).join('\n')}
|
|
158
|
-
</Operational Notes>`,
|
|
159
|
-
inputSchema: modernizeInputSchema.shape,
|
|
160
|
-
outputSchema: modernizeOutputSchema.shape,
|
|
161
|
-
isLocalOnly: true,
|
|
162
|
-
isReadOnly: false,
|
|
163
|
-
factory: (context) => (input) => runModernization(input, context),
|
|
164
|
-
});
|
|
165
|
-
//# sourceMappingURL=modernize.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"modernize.js","sourceRoot":"","sources":["modernize.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AA0FH,4CAyDC;AAjJD,6BAAwB;AACxB,sDAA+D;AAC/D,oCAA8E;AAC9E,wDAAgE;AAChE,mDAA4F;AAS5F,MAAM,eAAe,GAA0B;IAC7C;QACE,IAAI,EAAE,cAAc;QACpB,WAAW,EACT,qHAAqH;QACvH,gBAAgB,EAAE,uD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