@angular/cli 21.0.2 → 21.1.0-next.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.
Files changed (102) hide show
  1. package/lib/code-examples.db +0 -0
  2. package/package.json +18 -18
  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 +47 -5
  9. package/src/commands/mcp/host.js +52 -13
  10. package/src/commands/mcp/host.js.map +1 -1
  11. package/src/commands/mcp/mcp-server.d.ts +35 -4
  12. package/src/commands/mcp/mcp-server.js +16 -8
  13. package/src/commands/mcp/mcp-server.js.map +1 -1
  14. package/src/commands/mcp/resources/ai-tutor.md +199 -3
  15. package/src/commands/mcp/resources/instructions.d.ts +1 -1
  16. package/src/commands/mcp/resources/instructions.js +2 -5
  17. package/src/commands/mcp/resources/instructions.js.map +1 -1
  18. package/src/commands/mcp/tools/ai-tutor.js +2 -5
  19. package/src/commands/mcp/tools/ai-tutor.js.map +1 -1
  20. package/src/commands/mcp/tools/best-practices.js +6 -9
  21. package/src/commands/mcp/tools/best-practices.js.map +1 -1
  22. package/src/commands/mcp/tools/build.d.ts +37 -0
  23. package/src/commands/mcp/tools/build.js +97 -0
  24. package/src/commands/mcp/tools/build.js.map +1 -0
  25. package/src/commands/mcp/tools/devserver/start-devserver.d.ts +31 -0
  26. package/src/commands/mcp/tools/devserver/start-devserver.js +82 -0
  27. package/src/commands/mcp/tools/devserver/start-devserver.js.map +1 -0
  28. package/src/commands/mcp/tools/devserver/stop-devserver.d.ts +39 -0
  29. package/src/commands/mcp/tools/devserver/stop-devserver.js +66 -0
  30. package/src/commands/mcp/tools/devserver/stop-devserver.js.map +1 -0
  31. package/src/commands/mcp/tools/devserver/wait-for-devserver-build.d.ts +41 -0
  32. package/src/commands/mcp/tools/devserver/wait-for-devserver-build.js +100 -0
  33. package/src/commands/mcp/tools/devserver/wait-for-devserver-build.js.map +1 -0
  34. package/src/commands/mcp/tools/doc-search.js.map +1 -1
  35. package/src/commands/mcp/tools/examples/database-discovery.d.ts +34 -0
  36. package/src/commands/mcp/tools/examples/database-discovery.js +87 -0
  37. package/src/commands/mcp/tools/examples/database-discovery.js.map +1 -0
  38. package/src/commands/mcp/tools/examples/database.d.ts +35 -0
  39. package/src/commands/mcp/tools/examples/database.js +125 -0
  40. package/src/commands/mcp/tools/examples/database.js.map +1 -0
  41. package/src/commands/mcp/tools/examples/index.d.ts +26 -0
  42. package/src/commands/mcp/tools/examples/index.js +149 -0
  43. package/src/commands/mcp/tools/examples/index.js.map +1 -0
  44. package/src/commands/mcp/tools/examples/query-escaper.d.ts +20 -0
  45. package/src/commands/mcp/tools/examples/query-escaper.js +68 -0
  46. package/src/commands/mcp/tools/examples/query-escaper.js.map +1 -0
  47. package/src/commands/mcp/tools/examples/runtime-database.d.ts +10 -0
  48. package/src/commands/mcp/tools/examples/runtime-database.js +192 -0
  49. package/src/commands/mcp/tools/examples/runtime-database.js.map +1 -0
  50. package/src/commands/mcp/tools/{examples.d.ts → examples/schemas.d.ts} +5 -16
  51. package/src/commands/mcp/tools/examples/schemas.js +101 -0
  52. package/src/commands/mcp/tools/examples/schemas.js.map +1 -0
  53. package/src/commands/mcp/tools/examples/utils.d.ts +14 -0
  54. package/src/commands/mcp/tools/examples/utils.js +31 -0
  55. package/src/commands/mcp/tools/examples/utils.js.map +1 -0
  56. package/src/commands/mcp/tools/modernize.d.ts +13 -7
  57. package/src/commands/mcp/tools/modernize.js +13 -45
  58. package/src/commands/mcp/tools/modernize.js.map +1 -1
  59. package/src/commands/mcp/tools/onpush-zoneless-migration/{analyze_for_unsupported_zone_uses.d.ts → analyze-for-unsupported-zone-uses.d.ts} +1 -1
  60. package/src/commands/mcp/tools/onpush-zoneless-migration/{analyze_for_unsupported_zone_uses.js → analyze-for-unsupported-zone-uses.js} +2 -2
  61. package/src/commands/mcp/tools/onpush-zoneless-migration/{analyze_for_unsupported_zone_uses.js.map → analyze-for-unsupported-zone-uses.js.map} +1 -1
  62. package/src/commands/mcp/tools/onpush-zoneless-migration/{migrate_single_file.d.ts → migrate-single-file.d.ts} +3 -3
  63. package/src/commands/mcp/tools/onpush-zoneless-migration/{migrate_single_file.js → migrate-single-file.js} +5 -5
  64. package/src/commands/mcp/tools/onpush-zoneless-migration/{migrate_single_file.js.map → migrate-single-file.js.map} +1 -1
  65. package/src/commands/mcp/tools/onpush-zoneless-migration/{migrate_test_file.js → migrate-test-file.js} +6 -52
  66. package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.js.map +1 -0
  67. package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.d.ts +1 -1
  68. package/src/commands/mcp/tools/onpush-zoneless-migration/prompts.js +2 -2
  69. package/src/commands/mcp/tools/onpush-zoneless-migration/{send_debug_message.d.ts → send-debug-message.d.ts} +2 -2
  70. package/src/commands/mcp/tools/onpush-zoneless-migration/{send_debug_message.js → send-debug-message.js} +1 -1
  71. package/src/commands/mcp/tools/onpush-zoneless-migration/{send_debug_message.js.map → send-debug-message.js.map} +1 -1
  72. package/src/commands/mcp/tools/onpush-zoneless-migration/{ts_utils.d.ts → ts-utils.d.ts} +3 -4
  73. package/src/commands/mcp/tools/onpush-zoneless-migration/{ts_utils.js → ts-utils.js} +3 -3
  74. package/src/commands/mcp/tools/onpush-zoneless-migration/{ts_utils.js.map → ts-utils.js.map} +1 -1
  75. package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.d.ts +2 -2
  76. package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.js +67 -71
  77. package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.js.map +1 -1
  78. package/src/commands/mcp/tools/projects.d.ts +1 -1
  79. package/src/commands/mcp/tools/projects.js +33 -33
  80. package/src/commands/mcp/tools/projects.js.map +1 -1
  81. package/src/commands/mcp/tools/tool-registry.d.ts +4 -0
  82. package/src/commands/mcp/tools/tool-registry.js.map +1 -1
  83. package/src/commands/mcp/utils.d.ts +33 -0
  84. package/src/commands/mcp/utils.js +55 -0
  85. package/src/commands/mcp/utils.js.map +1 -0
  86. package/src/package-managers/host.d.ts +6 -0
  87. package/src/package-managers/host.js +1 -0
  88. package/src/package-managers/host.js.map +1 -1
  89. package/src/package-managers/package-manager-descriptor.d.ts +6 -6
  90. package/src/package-managers/package-manager-descriptor.js +5 -5
  91. package/src/package-managers/package-manager-descriptor.js.map +1 -1
  92. package/src/package-managers/package-manager.d.ts +21 -3
  93. package/src/package-managers/package-manager.js +74 -5
  94. package/src/package-managers/package-manager.js.map +1 -1
  95. package/src/utilities/version.js +1 -1
  96. package/src/commands/mcp/tools/examples.js +0 -657
  97. package/src/commands/mcp/tools/examples.js.map +0 -1
  98. package/src/commands/mcp/tools/onpush-zoneless-migration/migrate_test_file.js.map +0 -1
  99. package/src/package-managers/testing/mock-host.d.ts +0 -26
  100. package/src/package-managers/testing/mock-host.js +0 -53
  101. package/src/package-managers/testing/mock-host.js.map +0 -1
  102. /package/src/commands/mcp/tools/onpush-zoneless-migration/{migrate_test_file.d.ts → migrate-test-file.d.ts} +0 -0
@@ -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,IAAI,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACnD,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,IAAA,qCAA6B,EAAC;YACnC,OAAO,EAAE,mCAAmC,UAAU,uBAAuB;YAC7E,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC;SAC1C,CAAC,CAAC;IACL,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAE3C,SAAS,GAAG,IAAI,2BAAc,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IACvE,SAAS,CAAC,KAAK,EAAE,CAAC;IAElB,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAE9C,OAAO,IAAA,qCAA6B,EAAC;QACnC,OAAO,EAAE,mCAAmC,UAAU,+CAA+C;QACrG,OAAO,EAAE,gBAAgB,CAAC,IAAI,CAAC;KAChC,CAAC,CAAC;AACL,CAAC;AAEY,QAAA,oBAAoB,GAG7B,IAAA,2BAAW,EAAC;IACd,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE,0BAA0B;IACjC,WAAW,EAAE;;;;;;;;;;;;;;;;;;;CAmBd;IACC,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,6BAA6B,CAAC,KAAK;IAChD,YAAY,EAAE,8BAA8B,CAAC,KAAK;IAClD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE;QAC9B,OAAO,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,yBAAkB,CAAC,CAAC;IAC5D,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,39 @@
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 stopDevserverToolInputSchema: z.ZodObject<{
11
+ project: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$strip>;
13
+ export type StopDevserverToolInput = z.infer<typeof stopDevserverToolInputSchema>;
14
+ declare const stopDevserverToolOutputSchema: z.ZodObject<{
15
+ message: z.ZodString;
16
+ logs: z.ZodOptional<z.ZodArray<z.ZodString>>;
17
+ }, z.core.$strip>;
18
+ export type StopDevserverToolOutput = z.infer<typeof stopDevserverToolOutputSchema>;
19
+ export declare function stopDevserver(input: StopDevserverToolInput, context: McpToolContext): {
20
+ content: {
21
+ type: "text";
22
+ text: string;
23
+ }[];
24
+ structuredContent: {
25
+ message: string;
26
+ logs: undefined;
27
+ };
28
+ } | {
29
+ content: {
30
+ type: "text";
31
+ text: string;
32
+ }[];
33
+ structuredContent: {
34
+ message: string;
35
+ logs: string[];
36
+ };
37
+ };
38
+ export declare const STOP_DEVSERVER_TOOL: McpToolDeclaration<typeof stopDevserverToolInputSchema.shape, typeof stopDevserverToolOutputSchema.shape>;
39
+ 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
+ {"version":3,"file":"stop-devserver.js","sourceRoot":"","sources":["stop-devserver.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAyBH,sCAkBC;AAzCD,6BAAwB;AACxB,iDAAgD;AAChD,uCAA4D;AAC5D,oDAA6F;AAE7F,MAAM,4BAA4B,GAAG,OAAC,CAAC,MAAM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A6B,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,41 @@
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
+ }, z.core.$strip>;
18
+ export type WaitForDevserverBuildToolInput = z.infer<typeof waitForDevserverBuildToolInputSchema>;
19
+ declare const waitForDevserverBuildToolOutputSchema: z.ZodObject<{
20
+ status: z.ZodEnum<{
21
+ success: "success";
22
+ timeout: "timeout";
23
+ failure: "failure";
24
+ unknown: "unknown";
25
+ no_devserver_found: "no_devserver_found";
26
+ }>;
27
+ logs: z.ZodOptional<z.ZodArray<z.ZodString>>;
28
+ }, z.core.$strip>;
29
+ export type WaitForDevserverBuildToolOutput = z.infer<typeof waitForDevserverBuildToolOutputSchema>;
30
+ export declare function waitForDevserverBuild(input: WaitForDevserverBuildToolInput, context: McpToolContext): Promise<{
31
+ content: {
32
+ type: "text";
33
+ text: string;
34
+ }[];
35
+ structuredContent: {
36
+ status: "success" | "timeout" | "failure" | "unknown" | "no_devserver_found";
37
+ logs?: string[] | undefined;
38
+ };
39
+ }>;
40
+ export declare const WAIT_FOR_DEVSERVER_BUILD_TOOL: McpToolDeclaration<typeof waitForDevserverBuildToolInputSchema.shape, typeof waitForDevserverBuildToolOutputSchema.shape>;
41
+ 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,CAAC;SACxE,QAAQ,CACP,iGAAiG,CAClG;IACH,IAAI,EAAE,OAAC;SACJ,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;SACjB,QAAQ,EAAE;SACV,QAAQ,CAAC,qDAAqD,CAAC;CACnE,CAAC,CAAC;AAIH,SAAS,IAAI,CAAC,EAAU;IACtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC;AAEM,KAAK,UAAU,qBAAqB,CACzC,KAAqC,EACrC,OAAuB;IAEvB,MAAM,UAAU,G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G;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"}
@@ -0,0 +1,34 @@
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 type { McpToolContext } from '../tool-registry';
9
+ /**
10
+ * Attempts to find version-specific example databases from the user's installed
11
+ * versions of known Angular packages. It looks for a custom `angular` metadata property in each
12
+ * package's `package.json` to locate the database.
13
+ *
14
+ * @example A sample `package.json` `angular` field:
15
+ * ```json
16
+ * {
17
+ * "angular": {
18
+ * "examples": {
19
+ * "format": "sqlite",
20
+ * "path": "./resources/code-examples.db"
21
+ * }
22
+ * }
23
+ * }
24
+ * ```
25
+ *
26
+ * @param workspacePath The absolute path to the user's `angular.json` file.
27
+ * @param logger The MCP tool context logger for reporting warnings.
28
+ * @param host The host interface for file system and module resolution operations.
29
+ * @returns A promise that resolves to an array of objects, each containing a database path and source.
30
+ */
31
+ export declare function getVersionSpecificExampleDatabases(workspacePath: string, logger: McpToolContext['logger'], host: McpToolContext['host']): Promise<{
32
+ dbPath: string;
33
+ source: string;
34
+ }[]>;
@@ -0,0 +1,87 @@
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.getVersionSpecificExampleDatabases = getVersionSpecificExampleDatabases;
11
+ const node_path_1 = require("node:path");
12
+ /**
13
+ * A list of known Angular packages that may contain example databases.
14
+ * The tool will attempt to resolve and load example databases from these packages.
15
+ */
16
+ const KNOWN_EXAMPLE_PACKAGES = ['@angular/core', '@angular/aria', '@angular/forms'];
17
+ /**
18
+ * Attempts to find version-specific example databases from the user's installed
19
+ * versions of known Angular packages. It looks for a custom `angular` metadata property in each
20
+ * package's `package.json` to locate the database.
21
+ *
22
+ * @example A sample `package.json` `angular` field:
23
+ * ```json
24
+ * {
25
+ * "angular": {
26
+ * "examples": {
27
+ * "format": "sqlite",
28
+ * "path": "./resources/code-examples.db"
29
+ * }
30
+ * }
31
+ * }
32
+ * ```
33
+ *
34
+ * @param workspacePath The absolute path to the user's `angular.json` file.
35
+ * @param logger The MCP tool context logger for reporting warnings.
36
+ * @param host The host interface for file system and module resolution operations.
37
+ * @returns A promise that resolves to an array of objects, each containing a database path and source.
38
+ */
39
+ async function getVersionSpecificExampleDatabases(workspacePath, logger, host) {
40
+ const databases = [];
41
+ for (const packageName of KNOWN_EXAMPLE_PACKAGES) {
42
+ // 1. Resolve the path to package.json
43
+ let pkgJsonPath;
44
+ try {
45
+ pkgJsonPath = host.resolveModule(`${packageName}/package.json`, workspacePath);
46
+ }
47
+ catch (e) {
48
+ // This is not a warning because the user may not have all known packages installed.
49
+ continue;
50
+ }
51
+ // 2. Read and parse package.json, then find the database.
52
+ try {
53
+ const pkgJsonContent = await host.readFile(pkgJsonPath, 'utf-8');
54
+ const pkgJson = JSON.parse(pkgJsonContent);
55
+ const examplesInfo = pkgJson['angular']?.examples;
56
+ if (examplesInfo &&
57
+ examplesInfo.format === 'sqlite' &&
58
+ typeof examplesInfo.path === 'string') {
59
+ const packageDirectory = (0, node_path_1.dirname)(pkgJsonPath);
60
+ const dbPath = (0, node_path_1.resolve)(packageDirectory, examplesInfo.path);
61
+ // Ensure the resolved database path is within the package boundary.
62
+ const relativePath = (0, node_path_1.relative)(packageDirectory, dbPath);
63
+ if (relativePath.startsWith('..') || (0, node_path_1.isAbsolute)(relativePath)) {
64
+ logger.warn(`Detected a potential path traversal attempt in '${pkgJsonPath}'. ` +
65
+ `The path '${examplesInfo.path}' escapes the package boundary. ` +
66
+ 'This database will be skipped.');
67
+ continue;
68
+ }
69
+ // Check the file size to prevent reading a very large file.
70
+ const stats = await host.stat(dbPath);
71
+ if (stats.size > 10 * 1024 * 1024) {
72
+ // 10MB
73
+ logger.warn(`The example database at '${dbPath}' is larger than 10MB (${stats.size} bytes). ` +
74
+ 'This is unexpected and the file will not be used.');
75
+ continue;
76
+ }
77
+ const source = `package ${packageName}@${pkgJson.version}`;
78
+ databases.push({ dbPath, source });
79
+ }
80
+ }
81
+ catch (e) {
82
+ logger.warn(`Failed to read or parse version-specific examples metadata referenced in '${pkgJsonPath}': ${e instanceof Error ? e.message : e}.`);
83
+ }
84
+ }
85
+ return databases;
86
+ }
87
+ //# sourceMappingURL=database-discovery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database-discovery.js","sourceRoot":"","sources":["database-discovery.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAiCH,gFAkEC;AAjGD,yCAAmE;AAGnE;;;GAGG;AACH,MAAM,sBAAsB,GAAG,CAAC,eAAe,EAAE,eAAe,EAAE,gBAAgB,CAAC,CAAC;AAEpF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACI,KAAK,UAAU,kCAAkC,CACtD,aAAqB,EACrB,MAAgC,EAChC,IAA4B;IAE5B,MAAM,SAAS,GAAyC,EAAE,CAAC;IAE3D,KAAK,MAAM,WAAW,IAAI,sBAAsB,EAAE,CAAC;QACjD,sCAAsC;QACtC,IAAI,WAAmB,CAAC;QACxB,IAAI,CAAC;YACH,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,WAAW,eAAe,EAA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,CAAC;oBACF,SAAS;gBACX,CAAC;gBAED,MAAM,MAAM,GAAG,WAAW,WAAW,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;gBAC3D,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YACrC,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,CAAC,IAAI,CACT,6EAA6E,WAAW,MACtF,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CACnC,GAAG,CACJ,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,35 @@
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 type { DatabaseSync } from 'node:sqlite';
9
+ import type { FindExampleInput } from './schemas';
10
+ /**
11
+ * Validates the schema version of the example database.
12
+ *
13
+ * @param db The database connection to validate.
14
+ * @param dbSource A string identifying the source of the database (e.g., 'bundled' or a version number).
15
+ * @throws An error if the schema version is missing or incompatible.
16
+ */
17
+ export declare function validateDatabaseSchema(db: DatabaseSync, dbSource: string): void;
18
+ export declare function queryDatabase(dbs: DatabaseSync[], input: FindExampleInput): {
19
+ content: {
20
+ type: "text";
21
+ text: string;
22
+ }[];
23
+ structuredContent: {
24
+ examples: {
25
+ title: string;
26
+ summary: string;
27
+ keywords: string[];
28
+ required_packages: string[];
29
+ related_concepts: string[];
30
+ related_tools: string[];
31
+ content: string;
32
+ snippet: string;
33
+ }[];
34
+ };
35
+ };