@angular/cli 21.1.0-next.0 → 21.1.0-next.2

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 (97) hide show
  1. package/lib/code-examples.db +0 -0
  2. package/package.json +17 -17
  3. package/src/commands/add/cli.js +129 -87
  4. package/src/commands/add/cli.js.map +1 -1
  5. package/src/commands/mcp/cli.js +4 -1
  6. package/src/commands/mcp/cli.js.map +1 -1
  7. package/src/commands/mcp/{dev-server.d.ts → devserver.d.ts} +4 -4
  8. package/src/commands/mcp/{dev-server.js → devserver.js} +14 -14
  9. package/src/commands/mcp/devserver.js.map +1 -0
  10. package/src/commands/mcp/host.d.ts +27 -0
  11. package/src/commands/mcp/host.js +8 -0
  12. package/src/commands/mcp/host.js.map +1 -1
  13. package/src/commands/mcp/mcp-server.d.ts +50 -9
  14. package/src/commands/mcp/mcp-server.js +26 -9
  15. package/src/commands/mcp/mcp-server.js.map +1 -1
  16. package/src/commands/mcp/resources/ai-tutor.md +199 -3
  17. package/src/commands/mcp/tools/ai-tutor.d.ts +5 -1
  18. package/src/commands/mcp/tools/best-practices.d.ts +3 -1
  19. package/src/commands/mcp/tools/best-practices.js.map +1 -1
  20. package/src/commands/mcp/tools/build.d.ts +8 -19
  21. package/src/commands/mcp/tools/build.js +2 -2
  22. package/src/commands/mcp/tools/build.js.map +1 -1
  23. package/src/commands/mcp/tools/devserver/devserver-start.d.ts +30 -0
  24. package/src/commands/mcp/tools/devserver/{start-devserver.js → devserver-start.js} +26 -27
  25. package/src/commands/mcp/tools/devserver/devserver-start.js.map +1 -0
  26. package/src/commands/mcp/tools/devserver/devserver-stop.d.ts +39 -0
  27. package/src/commands/mcp/tools/devserver/{stop-devserver.js → devserver-stop.js} +13 -13
  28. package/src/commands/mcp/tools/devserver/{stop-devserver.js.map → devserver-stop.js.map} +1 -1
  29. package/src/commands/mcp/tools/devserver/devserver-wait-for-build.d.ts +41 -0
  30. package/src/commands/mcp/tools/devserver/{wait-for-devserver-build.js → devserver-wait-for-build.js} +16 -16
  31. package/src/commands/mcp/tools/devserver/{wait-for-devserver-build.js.map → devserver-wait-for-build.js.map} +1 -1
  32. package/src/commands/mcp/tools/doc-search.d.ts +1 -11
  33. package/src/commands/mcp/tools/examples/database-discovery.d.ts +34 -0
  34. package/src/commands/mcp/tools/examples/database-discovery.js +87 -0
  35. package/src/commands/mcp/tools/examples/database-discovery.js.map +1 -0
  36. package/src/commands/mcp/tools/examples/database.d.ts +35 -0
  37. package/src/commands/mcp/tools/examples/database.js +125 -0
  38. package/src/commands/mcp/tools/examples/database.js.map +1 -0
  39. package/src/commands/mcp/tools/examples/index.d.ts +26 -0
  40. package/src/commands/mcp/tools/examples/index.js +149 -0
  41. package/src/commands/mcp/tools/examples/index.js.map +1 -0
  42. package/src/commands/mcp/tools/examples/query-escaper.d.ts +20 -0
  43. package/src/commands/mcp/tools/examples/query-escaper.js +68 -0
  44. package/src/commands/mcp/tools/examples/query-escaper.js.map +1 -0
  45. package/src/commands/mcp/tools/examples/runtime-database.d.ts +10 -0
  46. package/src/commands/mcp/tools/examples/runtime-database.js +192 -0
  47. package/src/commands/mcp/tools/examples/runtime-database.js.map +1 -0
  48. package/src/commands/mcp/tools/examples/schemas.d.ts +29 -0
  49. package/src/commands/mcp/tools/examples/schemas.js +101 -0
  50. package/src/commands/mcp/tools/examples/schemas.js.map +1 -0
  51. package/src/commands/mcp/tools/examples/utils.d.ts +14 -0
  52. package/src/commands/mcp/tools/examples/utils.js +31 -0
  53. package/src/commands/mcp/tools/examples/utils.js.map +1 -0
  54. package/src/commands/mcp/tools/modernize.d.ts +8 -18
  55. package/src/commands/mcp/tools/modernize.js +1 -1
  56. package/src/commands/mcp/tools/modernize.js.map +1 -1
  57. package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.d.ts +3 -1
  58. package/src/commands/mcp/tools/projects.d.ts +23 -64
  59. package/src/commands/mcp/tools/tool-registry.d.ts +6 -5
  60. package/src/commands/mcp/tools/tool-registry.js.map +1 -1
  61. package/src/commands/update/cli.d.ts +0 -24
  62. package/src/commands/update/cli.js +39 -447
  63. package/src/commands/update/cli.js.map +1 -1
  64. package/src/commands/update/utilities/cli-version.d.ts +48 -0
  65. package/src/commands/update/utilities/cli-version.js +196 -0
  66. package/src/commands/update/utilities/cli-version.js.map +1 -0
  67. package/src/commands/update/utilities/constants.d.ts +12 -0
  68. package/src/commands/update/utilities/constants.js +16 -0
  69. package/src/commands/update/utilities/constants.js.map +1 -0
  70. package/src/commands/update/utilities/git.d.ts +34 -0
  71. package/src/commands/update/utilities/git.js +115 -0
  72. package/src/commands/update/utilities/git.js.map +1 -0
  73. package/src/commands/update/utilities/migration.d.ts +32 -0
  74. package/src/commands/update/utilities/migration.js +257 -0
  75. package/src/commands/update/utilities/migration.js.map +1 -0
  76. package/src/package-managers/error.d.ts +12 -0
  77. package/src/package-managers/host.d.ts +6 -0
  78. package/src/package-managers/host.js +8 -3
  79. package/src/package-managers/host.js.map +1 -1
  80. package/src/package-managers/package-manager-descriptor.d.ts +33 -9
  81. package/src/package-managers/package-manager-descriptor.js +28 -8
  82. package/src/package-managers/package-manager-descriptor.js.map +1 -1
  83. package/src/package-managers/package-manager.d.ts +21 -3
  84. package/src/package-managers/package-manager.js +133 -10
  85. package/src/package-managers/package-manager.js.map +1 -1
  86. package/src/package-managers/parsers.d.ts +69 -4
  87. package/src/package-managers/parsers.js +231 -32
  88. package/src/package-managers/parsers.js.map +1 -1
  89. package/src/utilities/version.js +1 -1
  90. package/src/commands/mcp/dev-server.js.map +0 -1
  91. package/src/commands/mcp/tools/devserver/start-devserver.d.ts +0 -41
  92. package/src/commands/mcp/tools/devserver/start-devserver.js.map +0 -1
  93. package/src/commands/mcp/tools/devserver/stop-devserver.d.ts +0 -49
  94. package/src/commands/mcp/tools/devserver/wait-for-devserver-build.d.ts +0 -47
  95. package/src/commands/mcp/tools/examples.d.ts +0 -58
  96. package/src/commands/mcp/tools/examples.js +0 -654
  97. package/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;;;;CAed;IACC,UAAU,EAAE,KAAK;IACjB,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,oBAAoB,CAAC,KAAK;IACvC,YAAY,EAAE,qBAAqB,CAAC,KAAK;IACzC,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC;CAC/D,CAAC,CAAC"}
@@ -0,0 +1,30 @@
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 devserverStartToolInputSchema: z.ZodObject<{
11
+ project: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$strip>;
13
+ export type DevserverStartToolInput = z.infer<typeof devserverStartToolInputSchema>;
14
+ declare const devserverStartToolOutputSchema: z.ZodObject<{
15
+ message: z.ZodString;
16
+ address: z.ZodOptional<z.ZodString>;
17
+ }, z.core.$strip>;
18
+ export type DevserverStartToolOutput = z.infer<typeof devserverStartToolOutputSchema>;
19
+ export declare function startDevserver(input: DevserverStartToolInput, context: McpToolContext): Promise<{
20
+ content: {
21
+ type: "text";
22
+ text: string;
23
+ }[];
24
+ structuredContent: {
25
+ message: string;
26
+ address: string;
27
+ };
28
+ }>;
29
+ export declare const DEVSERVER_START_TOOL: McpToolDeclaration<typeof devserverStartToolInputSchema.shape, typeof devserverStartToolOutputSchema.shape>;
30
+ export {};
@@ -7,20 +7,19 @@
7
7
  * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.START_DEVSERVER_TOOL = void 0;
11
- exports.startDevServer = startDevServer;
10
+ exports.DEVSERVER_START_TOOL = void 0;
11
+ exports.startDevserver = startDevserver;
12
12
  const zod_1 = require("zod");
13
- const dev_server_1 = require("../../dev-server");
14
- const host_1 = require("../../host");
13
+ const devserver_1 = require("../../devserver");
15
14
  const utils_1 = require("../../utils");
16
15
  const tool_registry_1 = require("../tool-registry");
17
- const startDevServerToolInputSchema = zod_1.z.object({
16
+ const devserverStartToolInputSchema = zod_1.z.object({
18
17
  project: zod_1.z
19
18
  .string()
20
19
  .optional()
21
20
  .describe('Which project to serve in a monorepo context. If not provided, serves the default project.'),
22
21
  });
23
- const startDevServerToolOutputSchema = zod_1.z.object({
22
+ const devserverStartToolOutputSchema = zod_1.z.object({
24
23
  message: zod_1.z.string().describe('A message indicating the result of the operation.'),
25
24
  address: zod_1.z
26
25
  .string()
@@ -30,53 +29,53 @@ const startDevServerToolOutputSchema = zod_1.z.object({
30
29
  function localhostAddress(port) {
31
30
  return `http://localhost:${port}/`;
32
31
  }
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) {
32
+ async function startDevserver(input, context) {
33
+ const projectKey = (0, devserver_1.devserverKey)(input.project);
34
+ let devserver = context.devservers.get(projectKey);
35
+ if (devserver) {
37
36
  return (0, utils_1.createStructuredContentOutput)({
38
37
  message: `Development server for project '${projectKey}' is already running.`,
39
- address: localhostAddress(devServer.port),
38
+ address: localhostAddress(devserver.port),
40
39
  });
41
40
  }
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);
41
+ const port = await context.host.getAvailablePort();
42
+ devserver = new devserver_1.LocalDevserver({ host: context.host, project: input.project, port });
43
+ devserver.start();
44
+ context.devservers.set(projectKey, devserver);
46
45
  return (0, utils_1.createStructuredContentOutput)({
47
46
  message: `Development server for project '${projectKey}' started and watching for workspace changes.`,
48
47
  address: localhostAddress(port),
49
48
  });
50
49
  }
51
- exports.START_DEVSERVER_TOOL = (0, tool_registry_1.declareTool)({
52
- name: 'start_devserver',
50
+ exports.DEVSERVER_START_TOOL = (0, tool_registry_1.declareTool)({
51
+ name: 'devserver/start',
53
52
  title: 'Start Development Server',
54
53
  description: `
55
54
  <Purpose>
56
- Starts the Angular development server ("ng serve") as a background process. Follow this up with "wait_for_devserver_build" to wait until
55
+ Starts the Angular development server ("ng serve") as a background process. Follow this up with "devserver/wait_for_build" to wait until
57
56
  the first build completes.
58
57
  </Purpose>
59
58
  <Use Cases>
60
59
  * **Starting the Server:** Use this tool to begin serving the application. The tool will return immediately while the server runs in the
61
60
  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
61
+ * **Get Initial Build Logs:** Once a dev server has started, use the "devserver/wait_for_build" tool to ensure it's alive. If there are any
62
+ build errors, "devserver/wait_for_build" would provide them back and you can give them to the user or rely on them to propose a fix.
63
+ * **Get Updated Build Logs:** Important: as long as a devserver is alive (i.e. "devserver/stop" wasn't called), after every time you make a
64
+ change to the workspace, re-run "devserver/wait_for_build" to see whether the change was successfully built and wait for the devserver to
66
65
  be updated.
67
66
  </Use Cases>
68
67
  <Operational Notes>
69
68
  * This tool manages development servers by itself. It maintains at most a single dev server instance for each project in the monorepo.
70
69
  * 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.
70
+ * Use 'devserver/stop' to gracefully shut down the server and access the full log output.
72
71
  </Operational Notes>
73
72
  `,
74
73
  isReadOnly: true,
75
74
  isLocalOnly: true,
76
- inputSchema: startDevServerToolInputSchema.shape,
77
- outputSchema: startDevServerToolOutputSchema.shape,
75
+ inputSchema: devserverStartToolInputSchema.shape,
76
+ outputSchema: devserverStartToolOutputSchema.shape,
78
77
  factory: (context) => (input) => {
79
- return startDevServer(input, context, host_1.LocalWorkspaceHost);
78
+ return startDevserver(input, context);
80
79
  },
81
80
  });
82
- //# sourceMappingURL=start-devserver.js.map
81
+ //# sourceMappingURL=devserver-start.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devserver-start.js","sourceRoot":"","sources":["devserver-start.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAkCH,wCAsBC;AAtDD,6BAAwB;AACxB,+CAA+D;AAC/D,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,CAAC,KAA8B,EAAE,OAAuB;IAC1F,MAAM,UAAU,GAAG,IAAA,wBAAY,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,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAEnD,SAAS,GAAG,IAAI,0BAAc,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IACrF,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,CAAC,CAAC;IACxC,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 devserverStopToolInputSchema: z.ZodObject<{
11
+ project: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$strip>;
13
+ export type DevserverStopToolInput = z.infer<typeof devserverStopToolInputSchema>;
14
+ declare const devserverStopToolOutputSchema: z.ZodObject<{
15
+ message: z.ZodString;
16
+ logs: z.ZodOptional<z.ZodArray<z.ZodString>>;
17
+ }, z.core.$strip>;
18
+ export type DevserverStopToolOutput = z.infer<typeof devserverStopToolOutputSchema>;
19
+ export declare function stopDevserver(input: DevserverStopToolInput, 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 DEVSERVER_STOP_TOOL: McpToolDeclaration<typeof devserverStopToolInputSchema.shape, typeof devserverStopToolOutputSchema.shape>;
39
+ export {};
@@ -7,25 +7,25 @@
7
7
  * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.STOP_DEVSERVER_TOOL = void 0;
10
+ exports.DEVSERVER_STOP_TOOL = void 0;
11
11
  exports.stopDevserver = stopDevserver;
12
12
  const zod_1 = require("zod");
13
- const dev_server_1 = require("../../dev-server");
13
+ const devserver_1 = require("../../devserver");
14
14
  const utils_1 = require("../../utils");
15
15
  const tool_registry_1 = require("../tool-registry");
16
- const stopDevserverToolInputSchema = zod_1.z.object({
16
+ const devserverStopToolInputSchema = zod_1.z.object({
17
17
  project: zod_1.z
18
18
  .string()
19
19
  .optional()
20
20
  .describe('Which project to stop serving in a monorepo context. If not provided, stops the default project server.'),
21
21
  });
22
- const stopDevserverToolOutputSchema = zod_1.z.object({
22
+ const devserverStopToolOutputSchema = zod_1.z.object({
23
23
  message: zod_1.z.string().describe('A message indicating the result of the operation.'),
24
24
  logs: zod_1.z.array(zod_1.z.string()).optional().describe('The full logs from the dev server.'),
25
25
  });
26
26
  function stopDevserver(input, context) {
27
- const projectKey = (0, dev_server_1.devServerKey)(input.project);
28
- const devServer = context.devServers.get(projectKey);
27
+ const projectKey = (0, devserver_1.devserverKey)(input.project);
28
+ const devServer = context.devservers.get(projectKey);
29
29
  if (!devServer) {
30
30
  return (0, utils_1.createStructuredContentOutput)({
31
31
  message: `Development server for project '${projectKey}' was not running.`,
@@ -33,18 +33,18 @@ function stopDevserver(input, context) {
33
33
  });
34
34
  }
35
35
  devServer.stop();
36
- context.devServers.delete(projectKey);
36
+ context.devservers.delete(projectKey);
37
37
  return (0, utils_1.createStructuredContentOutput)({
38
38
  message: `Development server for project '${projectKey}' stopped.`,
39
39
  logs: devServer.getServerLogs(),
40
40
  });
41
41
  }
42
- exports.STOP_DEVSERVER_TOOL = (0, tool_registry_1.declareTool)({
43
- name: 'stop_devserver',
42
+ exports.DEVSERVER_STOP_TOOL = (0, tool_registry_1.declareTool)({
43
+ name: 'devserver/stop',
44
44
  title: 'Stop Development Server',
45
45
  description: `
46
46
  <Purpose>
47
- Stops a running Angular development server ("ng serve") that was started with the "start_devserver" tool.
47
+ Stops a running Angular development server ("ng serve") that was started with the "devserver/start" tool.
48
48
  </Purpose>
49
49
  <Use Cases>
50
50
  * **Stopping the Server:** Use this tool to terminate a running development server and retrieve the logs.
@@ -57,10 +57,10 @@ Stops a running Angular development server ("ng serve") that was started with th
57
57
  `,
58
58
  isReadOnly: true,
59
59
  isLocalOnly: true,
60
- inputSchema: stopDevserverToolInputSchema.shape,
61
- outputSchema: stopDevserverToolOutputSchema.shape,
60
+ inputSchema: devserverStopToolInputSchema.shape,
61
+ outputSchema: devserverStopToolOutputSchema.shape,
62
62
  factory: (context) => (input) => {
63
63
  return stopDevserver(input, context);
64
64
  },
65
65
  });
66
- //# sourceMappingURL=stop-devserver.js.map
66
+ //# sourceMappingURL=devserver-stop.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stop-devserver.js","sourceRoot":"","sources":["stop-devserver.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAyBH,sCAkBC;AAzCD,6BAAwB;AACxB,i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AC,IAAI,EAAE,CAAC;IACjB,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAEtC,OAAO,IAAA,qCAA6B,EAAC;QACnC,OAAO,EAAE,mCAAmC,UAAU,YAAY;QAClE,IAAI,EAAE,SAAS,CAAC,aAAa,EAAE;KAChC,CAAC,CAAC;AACL,CAAC;AAEY,QAAA,mBAAmB,GAG5B,IAAA,2BAAW,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,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 devserverWaitForBuildToolInputSchema: z.ZodObject<{
15
+ project: z.ZodOptional<z.ZodString>;
16
+ timeout: z.ZodDefault<z.ZodNumber>;
17
+ }, z.core.$strip>;
18
+ export type DevserverWaitForBuildToolInput = z.infer<typeof devserverWaitForBuildToolInputSchema>;
19
+ declare const devserverWaitForBuildToolOutputSchema: 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 DevserverWaitForBuildToolOutput = z.infer<typeof devserverWaitForBuildToolOutputSchema>;
30
+ export declare function waitForDevserverBuild(input: DevserverWaitForBuildToolInput, 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 DEVSERVER_WAIT_FOR_BUILD_TOOL: McpToolDeclaration<typeof devserverWaitForBuildToolInputSchema.shape, typeof devserverWaitForBuildToolOutputSchema.shape>;
41
+ export {};
@@ -7,10 +7,10 @@
7
7
  * found in the LICENSE file at https://angular.dev/license
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.WAIT_FOR_DEVSERVER_BUILD_TOOL = exports.WATCH_DELAY = void 0;
10
+ exports.DEVSERVER_WAIT_FOR_BUILD_TOOL = exports.WATCH_DELAY = void 0;
11
11
  exports.waitForDevserverBuild = waitForDevserverBuild;
12
12
  const zod_1 = require("zod");
13
- const dev_server_1 = require("../../dev-server");
13
+ const devserver_1 = require("../../devserver");
14
14
  const utils_1 = require("../../utils");
15
15
  const tool_registry_1 = require("../tool-registry");
16
16
  /**
@@ -21,7 +21,7 @@ exports.WATCH_DELAY = 1000;
21
21
  * Default timeout for waiting for the build to complete.
22
22
  */
23
23
  const DEFAULT_TIMEOUT = 180_000; // In milliseconds
24
- const waitForDevserverBuildToolInputSchema = zod_1.z.object({
24
+ const devserverWaitForBuildToolInputSchema = zod_1.z.object({
25
25
  project: zod_1.z
26
26
  .string()
27
27
  .optional()
@@ -31,7 +31,7 @@ const waitForDevserverBuildToolInputSchema = zod_1.z.object({
31
31
  .default(DEFAULT_TIMEOUT)
32
32
  .describe(`The maximum time to wait for the build to complete, in milliseconds. This can't be lower than ${exports.WATCH_DELAY}.`),
33
33
  });
34
- const waitForDevserverBuildToolOutputSchema = zod_1.z.object({
34
+ const devserverWaitForBuildToolOutputSchema = zod_1.z.object({
35
35
  status: zod_1.z
36
36
  .enum(['success', 'failure', 'unknown', 'timeout', 'no_devserver_found'])
37
37
  .describe("The status of the build if it's complete, or a status indicating why the wait operation failed."),
@@ -44,8 +44,8 @@ function wait(ms) {
44
44
  return new Promise((resolve) => setTimeout(resolve, ms));
45
45
  }
46
46
  async function waitForDevserverBuild(input, context) {
47
- const projectKey = (0, dev_server_1.devServerKey)(input.project);
48
- const devServer = context.devServers.get(projectKey);
47
+ const projectKey = (0, devserver_1.devserverKey)(input.project);
48
+ const devServer = context.devservers.get(projectKey);
49
49
  const deadline = Date.now() + input.timeout;
50
50
  if (!devServer) {
51
51
  return (0, utils_1.createStructuredContentOutput)({
@@ -65,36 +65,36 @@ async function waitForDevserverBuild(input, context) {
65
65
  ...devServer.getMostRecentBuild(),
66
66
  });
67
67
  }
68
- exports.WAIT_FOR_DEVSERVER_BUILD_TOOL = (0, tool_registry_1.declareTool)({
69
- name: 'wait_for_devserver_build',
68
+ exports.DEVSERVER_WAIT_FOR_BUILD_TOOL = (0, tool_registry_1.declareTool)({
69
+ name: 'devserver/wait_for_build',
70
70
  title: 'Wait for Devserver Build',
71
71
  description: `
72
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
73
+ Waits for a dev server that was started with the "devserver/start" tool to complete its build, then reports the build logs from its most
74
74
  recent build.
75
75
  </Purpose>
76
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
77
+ * **Waiting for a build:** As long as a devserver is alive ("devserver/start" was called for this project and "devserver_stop" wasn't
78
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
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
80
  </Use Cases>
81
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"
82
+ * This tool expects that a dev server was launched on the same project with the "devserver/start" tool, otherwise a "no_devserver_found"
83
83
  status will be returned.
84
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.
85
+ timeout. Timeouts on initial run (right after "devserver/start" calls) or after a big change are not necessarily indicative of an error.
86
86
  * If you encountered a timeout and it might be reasonable, just call this tool again.
87
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"
88
+ * A 'no_devserver_found' status can indicate the underlying server was stopped for some reason. Try first to call the "devserver/start"
89
89
  tool again, before giving up.
90
90
  </Operational Notes>
91
91
  `,
92
92
  isReadOnly: true,
93
93
  isLocalOnly: true,
94
- inputSchema: waitForDevserverBuildToolInputSchema.shape,
95
- outputSchema: waitForDevserverBuildToolOutputSchema.shape,
94
+ inputSchema: devserverWaitForBuildToolInputSchema.shape,
95
+ outputSchema: devserverWaitForBuildToolOutputSchema.shape,
96
96
  factory: (context) => (input) => {
97
97
  return waitForDevserverBuild(input, context);
98
98
  },
99
99
  });
100
- //# sourceMappingURL=wait-for-devserver-build.js.map
100
+ //# sourceMappingURL=devserver-wait-for-build.js.map
@@ -1 +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,O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MAAM,IAAI,CAAC,mBAAW,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO,IAAA,qCAA6B,EAAkC;QACpE,GAAG,SAAS,CAAC,kBAAkB,EAAE;KAClC,CAAC,CAAC;AACL,CAAC;AAEY,QAAA,6BAA6B,GAGtC,IAAA,2BAAW,EAAC;IACd,IAAI,EAAE,0BAA0B;IAChC,KAAK,EAAE,0BAA0B;IACjC,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;CAoBd;IACC,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,oCAAoC,CAAC,KAAK;IACvD,YAAY,EAAE,qCAAqC,CAAC,KAAK;IACzD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE;QAC9B,OAAO,qBAAqB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;CACF,CAAC,CAAC"}
@@ -17,15 +17,5 @@ export declare const DOC_SEARCH_TOOL: import("./tool-registry").McpToolDeclarati
17
17
  breadcrumb: z.ZodString;
18
18
  url: z.ZodString;
19
19
  content: z.ZodOptional<z.ZodString>;
20
- }, "strip", z.ZodTypeAny, {
21
- title: string;
22
- breadcrumb: string;
23
- url: string;
24
- content?: string | undefined;
25
- }, {
26
- title: string;
27
- breadcrumb: string;
28
- url: string;
29
- content?: string | undefined;
30
- }>, "many">;
20
+ }, z.core.$strip>>;
31
21
  }>;
@@ -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":"","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C,IAAI,CAAC,IAAI,IAAA,sBAAU,EAAC,YAAY,CAAC,EAAE,CAAC;oBAC9D,MAAM,CAAC,IAAI,CACT,mDAAmD,WAAW,KAAK;wBACjE,aAAa,YAAY,CAAC,IAAI,kCAAkC;wBAChE,gCAAgC,CACnC,CAAC;oBACF,SAAS;gBACX,CAAC;gBAED,4DAA4D;gBAC5D,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACtC,IAAI,KAAK,CAAC,IAAI,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC;oBAClC,OAAO;oBACP,MAAM,CAAC,IAAI,CACT,4BAA4B,MAAM,0BAA0B,KAAK,CAAC,IAAI,WAAW;wBAC/E,mDAAmD,CACtD,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
+ };