@angular/cli 21.0.1 → 21.1.0-next.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.
Files changed (71) hide show
  1. package/lib/code-examples.db +0 -0
  2. package/package.json +19 -19
  3. package/src/commands/mcp/cli.d.ts +2 -2
  4. package/src/commands/mcp/cli.js.map +1 -1
  5. package/src/commands/mcp/dev-server.d.ts +71 -0
  6. package/src/commands/mcp/dev-server.js +96 -0
  7. package/src/commands/mcp/dev-server.js.map +1 -0
  8. package/src/commands/mcp/host.d.ts +20 -5
  9. package/src/commands/mcp/host.js +44 -13
  10. package/src/commands/mcp/host.js.map +1 -1
  11. package/src/commands/mcp/mcp-server.d.ts +26 -4
  12. package/src/commands/mcp/mcp-server.js +12 -6
  13. package/src/commands/mcp/mcp-server.js.map +1 -1
  14. package/src/commands/mcp/resources/instructions.d.ts +1 -1
  15. package/src/commands/mcp/resources/instructions.js +2 -5
  16. package/src/commands/mcp/resources/instructions.js.map +1 -1
  17. package/src/commands/mcp/tools/ai-tutor.js +2 -5
  18. package/src/commands/mcp/tools/ai-tutor.js.map +1 -1
  19. package/src/commands/mcp/tools/best-practices.js +6 -9
  20. package/src/commands/mcp/tools/best-practices.js.map +1 -1
  21. package/src/commands/mcp/tools/build.d.ts +48 -0
  22. package/src/commands/mcp/tools/build.js +97 -0
  23. package/src/commands/mcp/tools/build.js.map +1 -0
  24. package/src/commands/mcp/tools/devserver/start-devserver.d.ts +41 -0
  25. package/src/commands/mcp/tools/devserver/start-devserver.js +82 -0
  26. package/src/commands/mcp/tools/devserver/start-devserver.js.map +1 -0
  27. package/src/commands/mcp/tools/devserver/stop-devserver.d.ts +49 -0
  28. package/src/commands/mcp/tools/devserver/stop-devserver.js +66 -0
  29. package/src/commands/mcp/tools/devserver/stop-devserver.js.map +1 -0
  30. package/src/commands/mcp/tools/devserver/wait-for-devserver-build.d.ts +47 -0
  31. package/src/commands/mcp/tools/devserver/wait-for-devserver-build.js +100 -0
  32. package/src/commands/mcp/tools/devserver/wait-for-devserver-build.js.map +1 -0
  33. package/src/commands/mcp/tools/doc-search.js.map +1 -1
  34. package/src/commands/mcp/tools/examples.js +6 -9
  35. package/src/commands/mcp/tools/examples.js.map +1 -1
  36. package/src/commands/mcp/tools/modernize.d.ts +15 -11
  37. package/src/commands/mcp/tools/modernize.js +13 -45
  38. package/src/commands/mcp/tools/modernize.js.map +1 -1
  39. package/src/commands/mcp/tools/onpush-zoneless-migration/{analyze_for_unsupported_zone_uses.d.ts → analyze-for-unsupported-zone-uses.d.ts} +1 -1
  40. package/src/commands/mcp/tools/onpush-zoneless-migration/{analyze_for_unsupported_zone_uses.js → analyze-for-unsupported-zone-uses.js} +2 -2
  41. package/src/commands/mcp/tools/onpush-zoneless-migration/{analyze_for_unsupported_zone_uses.js.map → analyze-for-unsupported-zone-uses.js.map} +1 -1
  42. package/src/commands/mcp/tools/onpush-zoneless-migration/{migrate_single_file.d.ts → migrate-single-file.d.ts} +3 -3
  43. package/src/commands/mcp/tools/onpush-zoneless-migration/{migrate_single_file.js → migrate-single-file.js} +5 -5
  44. package/src/commands/mcp/tools/onpush-zoneless-migration/{migrate_single_file.js.map → migrate-single-file.js.map} +1 -1
  45. package/src/commands/mcp/tools/onpush-zoneless-migration/{migrate_test_file.js → migrate-test-file.js} +6 -52
  46. package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.js.map +1 -0
  47. package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.d.ts +1 -1
  48. package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.js +2 -2
  49. package/src/commands/mcp/tools/onpush-zoneless-migration/{send_debug_message.d.ts → send-debug-message.d.ts} +2 -2
  50. package/src/commands/mcp/tools/onpush-zoneless-migration/{send_debug_message.js → send-debug-message.js} +1 -1
  51. package/src/commands/mcp/tools/onpush-zoneless-migration/{send_debug_message.js.map → send-debug-message.js.map} +1 -1
  52. package/src/commands/mcp/tools/onpush-zoneless-migration/{ts_utils.d.ts → ts-utils.d.ts} +3 -4
  53. package/src/commands/mcp/tools/onpush-zoneless-migration/{ts_utils.js → ts-utils.js} +3 -3
  54. package/src/commands/mcp/tools/onpush-zoneless-migration/{ts_utils.js.map → ts-utils.js.map} +1 -1
  55. package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.d.ts +2 -2
  56. package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.js +67 -71
  57. package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.js.map +1 -1
  58. package/src/commands/mcp/tools/projects.d.ts +1 -1
  59. package/src/commands/mcp/tools/projects.js +33 -33
  60. package/src/commands/mcp/tools/projects.js.map +1 -1
  61. package/src/commands/mcp/tools/tool-registry.d.ts +3 -1
  62. package/src/commands/mcp/tools/tool-registry.js.map +1 -1
  63. package/src/commands/mcp/utils.d.ts +33 -0
  64. package/src/commands/mcp/utils.js +55 -0
  65. package/src/commands/mcp/utils.js.map +1 -0
  66. package/src/utilities/version.js +1 -1
  67. package/src/commands/mcp/tools/onpush-zoneless-migration/migrate_test_file.js.map +0 -1
  68. package/src/package-managers/testing/mock-host.d.ts +0 -26
  69. package/src/package-managers/testing/mock-host.js +0 -53
  70. package/src/package-managers/testing/mock-host.js.map +0 -1
  71. /package/src/commands/mcp/tools/onpush-zoneless-migration/{migrate_test_file.d.ts → migrate-test-file.d.ts} +0 -0
@@ -6,9 +6,6 @@
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
- var __importDefault = (this && this.__importDefault) || function (mod) {
10
- return (mod && mod.__esModule) ? mod : { "default": mod };
11
- };
12
9
  Object.defineProperty(exports, "__esModule", { value: true });
13
10
  exports.BEST_PRACTICES_TOOL = void 0;
14
11
  /**
@@ -21,7 +18,7 @@ exports.BEST_PRACTICES_TOOL = void 0;
21
18
  */
22
19
  const promises_1 = require("node:fs/promises");
23
20
  const node_module_1 = require("node:module");
24
- const node_path_1 = __importDefault(require("node:path"));
21
+ const node_path_1 = require("node:path");
25
22
  const zod_1 = require("zod");
26
23
  const version_1 = require("../../../utilities/version");
27
24
  const tool_registry_1 = require("./tool-registry");
@@ -69,7 +66,7 @@ that **MUST** be followed for any task involving the creation, analysis, or modi
69
66
  * @returns A promise that resolves to the string content of the bundled markdown file.
70
67
  */
71
68
  async function getBundledBestPractices() {
72
- return (0, promises_1.readFile)(node_path_1.default.join(__dirname, '..', 'resources', 'best-practices.md'), 'utf-8');
69
+ return (0, promises_1.readFile)((0, node_path_1.join)(__dirname, '../resources/best-practices.md'), 'utf-8');
73
70
  }
74
71
  /**
75
72
  * Attempts to find and read a version-specific best practices guide from the user's installed
@@ -113,13 +110,13 @@ async function getVersionSpecificBestPractices(workspacePath, logger) {
113
110
  if (bestPracticesInfo &&
114
111
  bestPracticesInfo.format === 'markdown' &&
115
112
  typeof bestPracticesInfo.path === 'string') {
116
- const packageDirectory = node_path_1.default.dirname(pkgJsonPath);
117
- const guidePath = node_path_1.default.resolve(packageDirectory, bestPracticesInfo.path);
113
+ const packageDirectory = (0, node_path_1.dirname)(pkgJsonPath);
114
+ const guidePath = (0, node_path_1.resolve)(packageDirectory, bestPracticesInfo.path);
118
115
  // Ensure the resolved guide path is within the package boundary.
119
116
  // Uses path.relative to create a cross-platform, case-insensitive check.
120
117
  // If the relative path starts with '..' or is absolute, it is a traversal attempt.
121
- const relativePath = node_path_1.default.relative(packageDirectory, guidePath);
122
- if (relativePath.startsWith('..') || node_path_1.default.isAbsolute(relativePath)) {
118
+ const relativePath = (0, node_path_1.relative)(packageDirectory, guidePath);
119
+ if (relativePath.startsWith('..') || (0, node_path_1.isAbsolute)(relativePath)) {
123
120
  logger.warn(`Detected a potential path traversal attempt in '${pkgJsonPath}'. ` +
124
121
  `The path '${bestPracticesInfo.path}' escapes the package boundary. ` +
125
122
  'Falling back to the bundled guide.');
@@ -1 +1 @@
1
- {"version":3,"file":"best-practices.js","sourceRoot":"","sources":["best-practices.ts"],"names":[],"mapp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AChG,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,GAAG,MAAM,CAAC,oBAAoB,KAAK,uBAAuB,EAAE,CAAC,CAAC;YACrE,MAAM,GAAG,iBAAiB,iBAAO,CAAC,IAAI,GAAG,CAAC;QAC5C,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,OAAO;oBACb,WAAW,EAAE;wBACX,QAAQ,EAAE,CAAC,WAAW,CAAC;wBACvB,QAAQ,EAAE,GAAG;wBACb,MAAM;qBACP;iBACF;aACF;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,48 @@
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 Host } from '../host';
10
+ import { type McpToolDeclaration } from './tool-registry';
11
+ declare const buildToolInputSchema: z.ZodObject<{
12
+ project: z.ZodOptional<z.ZodString>;
13
+ configuration: z.ZodOptional<z.ZodString>;
14
+ }, "strip", z.ZodTypeAny, {
15
+ project?: string | undefined;
16
+ configuration?: string | undefined;
17
+ }, {
18
+ project?: string | undefined;
19
+ configuration?: string | undefined;
20
+ }>;
21
+ export type BuildToolInput = z.infer<typeof buildToolInputSchema>;
22
+ declare const buildToolOutputSchema: z.ZodObject<{
23
+ status: z.ZodEnum<["success", "failure"]>;
24
+ logs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
25
+ path: z.ZodOptional<z.ZodString>;
26
+ }, "strip", z.ZodTypeAny, {
27
+ status: "success" | "failure";
28
+ path?: string | undefined;
29
+ logs?: string[] | undefined;
30
+ }, {
31
+ status: "success" | "failure";
32
+ path?: string | undefined;
33
+ logs?: string[] | undefined;
34
+ }>;
35
+ export type BuildToolOutput = z.infer<typeof buildToolOutputSchema>;
36
+ export declare function runBuild(input: BuildToolInput, host: Host): Promise<{
37
+ content: {
38
+ type: "text";
39
+ text: string;
40
+ }[];
41
+ structuredContent: {
42
+ status: "success" | "failure";
43
+ path?: string | undefined;
44
+ logs?: string[] | undefined;
45
+ };
46
+ }>;
47
+ export declare const BUILD_TOOL: McpToolDeclaration<typeof buildToolInputSchema.shape, typeof buildToolOutputSchema.shape>;
48
+ export {};
@@ -0,0 +1,97 @@
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.BUILD_TOOL = void 0;
11
+ exports.runBuild = runBuild;
12
+ const zod_1 = require("zod");
13
+ const host_1 = require("../host");
14
+ const utils_1 = require("../utils");
15
+ const tool_registry_1 = require("./tool-registry");
16
+ const DEFAULT_CONFIGURATION = 'development';
17
+ const buildStatusSchema = zod_1.z.enum(['success', 'failure']);
18
+ const buildToolInputSchema = zod_1.z.object({
19
+ project: zod_1.z
20
+ .string()
21
+ .optional()
22
+ .describe('Which project to build in a monorepo context. If not provided, builds the default project.'),
23
+ configuration: zod_1.z
24
+ .string()
25
+ .optional()
26
+ .describe('Which build configuration to use. Defaults to "development".'),
27
+ });
28
+ const buildToolOutputSchema = zod_1.z.object({
29
+ status: buildStatusSchema.describe('Build status.'),
30
+ logs: zod_1.z.array(zod_1.z.string()).optional().describe('Output logs from `ng build`.'),
31
+ path: zod_1.z.string().optional().describe('The output location for the build, if successful.'),
32
+ });
33
+ async function runBuild(input, host) {
34
+ // Build "ng"'s command line.
35
+ const args = ['build'];
36
+ if (input.project) {
37
+ args.push(input.project);
38
+ }
39
+ args.push('-c', input.configuration ?? DEFAULT_CONFIGURATION);
40
+ let status = 'success';
41
+ let logs = [];
42
+ let outputPath;
43
+ try {
44
+ logs = (await host.runCommand('ng', args)).logs;
45
+ }
46
+ catch (e) {
47
+ status = 'failure';
48
+ if (e instanceof host_1.CommandError) {
49
+ logs = e.logs;
50
+ }
51
+ else if (e instanceof Error) {
52
+ logs = [e.message];
53
+ }
54
+ else {
55
+ logs = [String(e)];
56
+ }
57
+ }
58
+ for (const line of logs) {
59
+ const match = line.match(/Output location: (.*)/);
60
+ if (match) {
61
+ outputPath = match[1].trim();
62
+ break;
63
+ }
64
+ }
65
+ const structuredContent = {
66
+ status,
67
+ logs,
68
+ path: outputPath,
69
+ };
70
+ return (0, utils_1.createStructuredContentOutput)(structuredContent);
71
+ }
72
+ exports.BUILD_TOOL = (0, tool_registry_1.declareTool)({
73
+ name: 'build',
74
+ title: 'Build Tool',
75
+ description: `
76
+ <Purpose>
77
+ Perform a one-off, non-watched build using "ng build". Use this tool whenever the user wants to build an Angular project; this is similar to
78
+ "ng build", but the tool is smarter about using the right configuration and collecting the output logs.
79
+ </Purpose>
80
+ <Use Cases>
81
+ * Building an Angular project and getting build logs back.
82
+ </Use Cases>
83
+ <Operational Notes>
84
+ * This tool runs "ng build" so it expects to run within an Angular workspace.
85
+ * If you want a watched build which updates as files are changed, use "start_devserver" instead, which also serves the app.
86
+ * You can provide a project instead of building the root one. The "list_projects" MCP tool could be used to obtain the list of projects.
87
+ * This tool defaults to a development environment while a regular "ng build" defaults to a production environment. An unexpected build
88
+ failure might suggest the project is not configured for the requested environment.
89
+ </Operational Notes>
90
+ `,
91
+ isReadOnly: false,
92
+ isLocalOnly: true,
93
+ inputSchema: buildToolInputSchema.shape,
94
+ outputSchema: buildToolOutputSchema.shape,
95
+ factory: () => (input) => runBuild(input, host_1.LocalWorkspaceHost),
96
+ });
97
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["build.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAmCH,4BAwCC;AAzED,6BAAwB;AACxB,kCAAsE;AACtE,oCAAyD;AACzD,mDAAuE;AAEvE,MAAM,qBAAq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served.
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 Host } from '../../host';
10
+ import { type McpToolContext, type McpToolDeclaration } from '../tool-registry';
11
+ declare const startDevServerToolInputSchema: z.ZodObject<{
12
+ project: z.ZodOptional<z.ZodString>;
13
+ }, "strip", z.ZodTypeAny, {
14
+ project?: string | undefined;
15
+ }, {
16
+ project?: string | undefined;
17
+ }>;
18
+ export type StartDevserverToolInput = z.infer<typeof startDevServerToolInputSchema>;
19
+ declare const startDevServerToolOutputSchema: z.ZodObject<{
20
+ message: z.ZodString;
21
+ address: z.ZodOptional<z.ZodString>;
22
+ }, "strip", z.ZodTypeAny, {
23
+ message: string;
24
+ address?: string | undefined;
25
+ }, {
26
+ message: string;
27
+ address?: string | undefined;
28
+ }>;
29
+ export type StartDevserverToolOutput = z.infer<typeof startDevServerToolOutputSchema>;
30
+ export declare function startDevServer(input: StartDevserverToolInput, context: McpToolContext, host: Host): Promise<{
31
+ content: {
32
+ type: "text";
33
+ text: string;
34
+ }[];
35
+ structuredContent: {
36
+ message: string;
37
+ address: string;
38
+ };
39
+ }>;
40
+ export declare const START_DEVSERVER_TOOL: McpToolDeclaration<typeof startDevServerToolInputSchema.shape, typeof startDevServerToolOutputSchema.shape>;
41
+ export {};
@@ -0,0 +1,82 @@
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.START_DEVSERVER_TOOL = void 0;
11
+ exports.startDevServer = startDevServer;
12
+ const zod_1 = require("zod");
13
+ const dev_server_1 = require("../../dev-server");
14
+ const host_1 = require("../../host");
15
+ const utils_1 = require("../../utils");
16
+ const tool_registry_1 = require("../tool-registry");
17
+ const startDevServerToolInputSchema = zod_1.z.object({
18
+ project: zod_1.z
19
+ .string()
20
+ .optional()
21
+ .describe('Which project to serve in a monorepo context. If not provided, serves the default project.'),
22
+ });
23
+ const startDevServerToolOutputSchema = zod_1.z.object({
24
+ message: zod_1.z.string().describe('A message indicating the result of the operation.'),
25
+ address: zod_1.z
26
+ .string()
27
+ .optional()
28
+ .describe('If the operation was successful, this is the HTTP address that the server can be found at.'),
29
+ });
30
+ function localhostAddress(port) {
31
+ return `http://localhost:${port}/`;
32
+ }
33
+ async function startDevServer(input, context, host) {
34
+ const projectKey = (0, dev_server_1.devServerKey)(input.project);
35
+ let devServer = context.devServers.get(projectKey);
36
+ if (devServer) {
37
+ return (0, utils_1.createStructuredContentOutput)({
38
+ message: `Development server for project '${projectKey}' is already running.`,
39
+ address: localhostAddress(devServer.port),
40
+ });
41
+ }
42
+ const port = await host.getAvailablePort();
43
+ devServer = new dev_server_1.LocalDevServer({ host, project: input.project, port });
44
+ devServer.start();
45
+ context.devServers.set(projectKey, devServer);
46
+ return (0, utils_1.createStructuredContentOutput)({
47
+ message: `Development server for project '${projectKey}' started and watching for workspace changes.`,
48
+ address: localhostAddress(port),
49
+ });
50
+ }
51
+ exports.START_DEVSERVER_TOOL = (0, tool_registry_1.declareTool)({
52
+ name: 'start_devserver',
53
+ title: 'Start Development Server',
54
+ description: `
55
+ <Purpose>
56
+ Starts the Angular development server ("ng serve") as a background process. Follow this up with "wait_for_devserver_build" to wait until
57
+ the first build completes.
58
+ </Purpose>
59
+ <Use Cases>
60
+ * **Starting the Server:** Use this tool to begin serving the application. The tool will return immediately while the server runs in the
61
+ background.
62
+ * **Get Initial Build Logs:** Once a dev server has started, use the "wait_for_devserver_build" tool to ensure it's alive. If there are any
63
+ build errors, "wait_for_devserver_build" would provide them back and you can give them to the user or rely on them to propose a fix.
64
+ * **Get Updated Build Logs:** Important: as long as a devserver is alive (i.e. "stop_devserver" wasn't called), after every time you make a
65
+ change to the workspace, re-run "wait_for_devserver_build" to see whether the change was successfully built and wait for the devserver to
66
+ be updated.
67
+ </Use Cases>
68
+ <Operational Notes>
69
+ * This tool manages development servers by itself. It maintains at most a single dev server instance for each project in the monorepo.
70
+ * This is an asynchronous operation. Subsequent commands can be ran while the server is active.
71
+ * Use 'stop_devserver' to gracefully shut down the server and access the full log output.
72
+ </Operational Notes>
73
+ `,
74
+ isReadOnly: true,
75
+ isLocalOnly: true,
76
+ inputSchema: startDevServerToolInputSchema.shape,
77
+ outputSchema: startDevServerToolOutputSchema.shape,
78
+ factory: (context) => (input) => {
79
+ return startDevServer(input, context, host_1.LocalWorkspaceHost);
80
+ },
81
+ });
82
+ //# sourceMappingURL=start-devserver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start-devserver.js","sourceRoot":"","sources":["start-devserver.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAmCH,wCA0BC;AA3DD,6BAAwB;AACxB,iDAAgE;AAChE,qCAA2D;AAC3D,uCAA4D;AAC5D,oDAA6F;AAE7F,MAAM,6BAA6B,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,OAAO,EAAE,OAAC;SACP,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,4FAA4F,CAC7F;CACJ,CAAC,CAAC;AAIH,MAAM,8BAA8B,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9C,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mDAAmD,CAAC;IACjF,OAAO,EAAE,OAAC;SACP,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,4FAA4F,CAC7F;CACJ,CAAC,CAAC;AAIH,SAAS,gBAAgB,CAAC,IAAY;IACpC,OAAO,oBAAoB,IAAI,GAAG,CAAC;AACrC,CAAC;AAEM,KAAK,UAAU,cAAc,CAClC,KAA8B,EAC9B,OAAuB,EACvB,IAAU;IAEV,MAAM,UAAU,GAAG,IAAA,yBAAY,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAE/C,IA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IT-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 stopDevserverToolInputSchema: z.ZodObject<{
11
+ project: z.ZodOptional<z.ZodString>;
12
+ }, "strip", z.ZodTypeAny, {
13
+ project?: string | undefined;
14
+ }, {
15
+ project?: string | undefined;
16
+ }>;
17
+ export type StopDevserverToolInput = z.infer<typeof stopDevserverToolInputSchema>;
18
+ declare const stopDevserverToolOutputSchema: z.ZodObject<{
19
+ message: z.ZodString;
20
+ logs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
21
+ }, "strip", z.ZodTypeAny, {
22
+ message: string;
23
+ logs?: string[] | undefined;
24
+ }, {
25
+ message: string;
26
+ logs?: string[] | undefined;
27
+ }>;
28
+ export type StopDevserverToolOutput = z.infer<typeof stopDevserverToolOutputSchema>;
29
+ export declare function stopDevserver(input: StopDevserverToolInput, context: McpToolContext): {
30
+ content: {
31
+ type: "text";
32
+ text: string;
33
+ }[];
34
+ structuredContent: {
35
+ message: string;
36
+ logs: undefined;
37
+ };
38
+ } | {
39
+ content: {
40
+ type: "text";
41
+ text: string;
42
+ }[];
43
+ structuredContent: {
44
+ message: string;
45
+ logs: string[];
46
+ };
47
+ };
48
+ export declare const STOP_DEVSERVER_TOOL: McpToolDeclaration<typeof stopDevserverToolInputSchema.shape, typeof stopDevserverToolOutputSchema.shape>;
49
+ export {};
@@ -0,0 +1,66 @@
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.STOP_DEVSERVER_TOOL = void 0;
11
+ exports.stopDevserver = stopDevserver;
12
+ const zod_1 = require("zod");
13
+ const dev_server_1 = require("../../dev-server");
14
+ const utils_1 = require("../../utils");
15
+ const tool_registry_1 = require("../tool-registry");
16
+ const stopDevserverToolInputSchema = zod_1.z.object({
17
+ project: zod_1.z
18
+ .string()
19
+ .optional()
20
+ .describe('Which project to stop serving in a monorepo context. If not provided, stops the default project server.'),
21
+ });
22
+ const stopDevserverToolOutputSchema = zod_1.z.object({
23
+ message: zod_1.z.string().describe('A message indicating the result of the operation.'),
24
+ logs: zod_1.z.array(zod_1.z.string()).optional().describe('The full logs from the dev server.'),
25
+ });
26
+ function stopDevserver(input, context) {
27
+ const projectKey = (0, dev_server_1.devServerKey)(input.project);
28
+ const devServer = context.devServers.get(projectKey);
29
+ if (!devServer) {
30
+ return (0, utils_1.createStructuredContentOutput)({
31
+ message: `Development server for project '${projectKey}' was not running.`,
32
+ logs: undefined,
33
+ });
34
+ }
35
+ devServer.stop();
36
+ context.devServers.delete(projectKey);
37
+ return (0, utils_1.createStructuredContentOutput)({
38
+ message: `Development server for project '${projectKey}' stopped.`,
39
+ logs: devServer.getServerLogs(),
40
+ });
41
+ }
42
+ exports.STOP_DEVSERVER_TOOL = (0, tool_registry_1.declareTool)({
43
+ name: 'stop_devserver',
44
+ title: 'Stop Development Server',
45
+ description: `
46
+ <Purpose>
47
+ Stops a running Angular development server ("ng serve") that was started with the "start_devserver" tool.
48
+ </Purpose>
49
+ <Use Cases>
50
+ * **Stopping the Server:** Use this tool to terminate a running development server and retrieve the logs.
51
+ </Use Cases>
52
+ <Operational Notes>
53
+ * This should be called to gracefully shut down the server and access the full log output.
54
+ * This just sends a SIGTERM to the server and returns immediately; so the server might still be functional for a short
55
+ time after this is called. However note that this is not a blocker for starting a new devserver.
56
+ </Operational Notes>
57
+ `,
58
+ isReadOnly: true,
59
+ isLocalOnly: true,
60
+ inputSchema: stopDevserverToolInputSchema.shape,
61
+ outputSchema: stopDevserverToolOutputSchema.shape,
62
+ factory: (context) => (input) => {
63
+ return stopDevserver(input, context);
64
+ },
65
+ });
66
+ //# sourceMappingURL=stop-devserver.js.map
@@ -0,0 +1 @@
1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BAAW,EAAC;IACd,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE,yBAAyB;IAChC,WAAW,EAAE;;;;;;;;;;;;CAYd;IACC,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,4BAA4B,CAAC,KAAK;IAC/C,YAAY,EAAE,6BAA6B,CAAC,KAAK;IACjD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE;QAC9B,OAAO,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,47 @@
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
+ /**
11
+ * How long to wait to give "ng serve" time to identify whether the watched workspace has changed.
12
+ */
13
+ export declare const WATCH_DELAY = 1000;
14
+ declare const waitForDevserverBuildToolInputSchema: z.ZodObject<{
15
+ project: z.ZodOptional<z.ZodString>;
16
+ timeout: z.ZodDefault<z.ZodNumber>;
17
+ }, "strip", z.ZodTypeAny, {
18
+ timeout: number;
19
+ project?: string | undefined;
20
+ }, {
21
+ project?: string | undefined;
22
+ timeout?: number | undefined;
23
+ }>;
24
+ export type WaitForDevserverBuildToolInput = z.infer<typeof waitForDevserverBuildToolInputSchema>;
25
+ declare const waitForDevserverBuildToolOutputSchema: z.ZodObject<{
26
+ status: z.ZodEnum<["success", "failure", "unknown", "timeout", "no_devserver_found"]>;
27
+ logs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
28
+ }, "strip", z.ZodTypeAny, {
29
+ status: "success" | "timeout" | "failure" | "unknown" | "no_devserver_found";
30
+ logs?: string[] | undefined;
31
+ }, {
32
+ status: "success" | "timeout" | "failure" | "unknown" | "no_devserver_found";
33
+ logs?: string[] | undefined;
34
+ }>;
35
+ export type WaitForDevserverBuildToolOutput = z.infer<typeof waitForDevserverBuildToolOutputSchema>;
36
+ export declare function waitForDevserverBuild(input: WaitForDevserverBuildToolInput, context: McpToolContext): Promise<{
37
+ content: {
38
+ type: "text";
39
+ text: string;
40
+ }[];
41
+ structuredContent: {
42
+ status: "success" | "timeout" | "failure" | "unknown" | "no_devserver_found";
43
+ logs?: string[] | undefined;
44
+ };
45
+ }>;
46
+ export declare const WAIT_FOR_DEVSERVER_BUILD_TOOL: McpToolDeclaration<typeof waitForDevserverBuildToolInputSchema.shape, typeof waitForDevserverBuildToolOutputSchema.shape>;
47
+ export {};
@@ -0,0 +1,100 @@
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.WAIT_FOR_DEVSERVER_BUILD_TOOL = exports.WATCH_DELAY = void 0;
11
+ exports.waitForDevserverBuild = waitForDevserverBuild;
12
+ const zod_1 = require("zod");
13
+ const dev_server_1 = require("../../dev-server");
14
+ const utils_1 = require("../../utils");
15
+ const tool_registry_1 = require("../tool-registry");
16
+ /**
17
+ * How long to wait to give "ng serve" time to identify whether the watched workspace has changed.
18
+ */
19
+ exports.WATCH_DELAY = 1000;
20
+ /**
21
+ * Default timeout for waiting for the build to complete.
22
+ */
23
+ const DEFAULT_TIMEOUT = 180_000; // In milliseconds
24
+ const waitForDevserverBuildToolInputSchema = zod_1.z.object({
25
+ project: zod_1.z
26
+ .string()
27
+ .optional()
28
+ .describe('Which project to wait for in a monorepo context. If not provided, waits for the default project server.'),
29
+ timeout: zod_1.z
30
+ .number()
31
+ .default(DEFAULT_TIMEOUT)
32
+ .describe(`The maximum time to wait for the build to complete, in milliseconds. This can't be lower than ${exports.WATCH_DELAY}.`),
33
+ });
34
+ const waitForDevserverBuildToolOutputSchema = zod_1.z.object({
35
+ status: zod_1.z
36
+ .enum(['success', 'failure', 'unknown', 'timeout', 'no_devserver_found'])
37
+ .describe("The status of the build if it's complete, or a status indicating why the wait operation failed."),
38
+ logs: zod_1.z
39
+ .array(zod_1.z.string())
40
+ .optional()
41
+ .describe('The logs from the most recent build, if one exists.'),
42
+ });
43
+ function wait(ms) {
44
+ return new Promise((resolve) => setTimeout(resolve, ms));
45
+ }
46
+ async function waitForDevserverBuild(input, context) {
47
+ const projectKey = (0, dev_server_1.devServerKey)(input.project);
48
+ const devServer = context.devServers.get(projectKey);
49
+ const deadline = Date.now() + input.timeout;
50
+ if (!devServer) {
51
+ return (0, utils_1.createStructuredContentOutput)({
52
+ status: 'no_devserver_found',
53
+ });
54
+ }
55
+ await wait(exports.WATCH_DELAY);
56
+ while (devServer.isBuilding()) {
57
+ if (Date.now() > deadline) {
58
+ return (0, utils_1.createStructuredContentOutput)({
59
+ status: 'timeout',
60
+ });
61
+ }
62
+ await wait(exports.WATCH_DELAY);
63
+ }
64
+ return (0, utils_1.createStructuredContentOutput)({
65
+ ...devServer.getMostRecentBuild(),
66
+ });
67
+ }
68
+ exports.WAIT_FOR_DEVSERVER_BUILD_TOOL = (0, tool_registry_1.declareTool)({
69
+ name: 'wait_for_devserver_build',
70
+ title: 'Wait for Devserver Build',
71
+ description: `
72
+ <Purpose>
73
+ Waits for a dev server that was started with the "start_devserver" tool to complete its build, then reports the build logs from its most
74
+ recent build.
75
+ </Purpose>
76
+ <Use Cases>
77
+ * **Waiting for a build:** As long as a devserver is alive ("start_devserver" was called for this project and "stop_devserver" wasn't
78
+ called yet), then if you're making a file change and want to ensure it was successfully built, call this tool instead of any other build
79
+ tool or command. When it retuns you'll get build logs back **and** you'll know the user's devserver is up-to-date with the latest changes.
80
+ </Use Cases>
81
+ <Operational Notes>
82
+ * This tool expects that a dev server was launched on the same project with the "start_devserver" tool, otherwise a "no_devserver_found"
83
+ status will be returned.
84
+ * This tool will block until the build is complete or the timeout is reached. If you expect a long build process, consider increasing the
85
+ timeout. Timeouts on initial run (right after "start_devserver" calls) or after a big change are not necessarily indicative of an error.
86
+ * If you encountered a timeout and it might be reasonable, just call this tool again.
87
+ * If the dev server is not building, it will return quickly, with the logs from the last build.
88
+ * A 'no_devserver_found' status can indicate the underlying server was stopped for some reason. Try first to call the "start_devserver"
89
+ tool again, before giving up.
90
+ </Operational Notes>
91
+ `,
92
+ isReadOnly: true,
93
+ isLocalOnly: true,
94
+ inputSchema: waitForDevserverBuildToolInputSchema.shape,
95
+ outputSchema: waitForDevserverBuildToolOutputSchema.shape,
96
+ factory: (context) => (input) => {
97
+ return waitForDevserverBuild(input, context);
98
+ },
99
+ });
100
+ //# sourceMappingURL=wait-for-devserver-build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait-for-devserver-build.js","sourceRoot":"","sources":["wait-for-devserver-build.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAoDH,sDA2BC;AA7ED,6BAAwB;AACxB,iDAAgD;AAChD,uCAA4D;AAC5D,oDAA6F;AAE7F;;GAEG;AACU,QAAA,WAAW,GAAG,IAAI,CAAC;AAEhC;;GAEG;AACH,MAAM,eAAe,GAAG,OAAO,CAAC,CAAC,kBAAkB;AAEnD,MAAM,oCAAoC,GAAG,OAAC,CAAC,MAAM,CAAC;IACpD,OAAO,EAAE,OAAC;SACP,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,yGAAyG,CAC1G;IACH,OAAO,EAAE,OAAC;SACP,MAAM,EAAE;SACR,OAAO,CAAC,eAAe,CAAC;SACxB,QAAQ,CACP,iGAAiG,mBAAW,GAAG,CAChH;CACJ,CAAC,CAAC;AAIH,MAAM,qCAAqC,GAAG,OAAC,CAAC,MAAM,CAAC;IACrD,MAAM,EAAE,OAAC;SACN,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,oBAAoB,CAAC,CA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