@angular/cli 22.0.0-rc.0 → 22.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/bin/ng.js +1 -1
  2. package/package.json +14 -14
  3. package/src/commands/mcp/devserver.d.ts +1 -1
  4. package/src/commands/mcp/devserver.js +5 -8
  5. package/src/commands/mcp/devserver.js.map +1 -1
  6. package/src/commands/mcp/host.d.ts +9 -5
  7. package/src/commands/mcp/host.js +37 -22
  8. package/src/commands/mcp/host.js.map +1 -1
  9. package/src/commands/mcp/mcp-server.d.ts +8 -42
  10. package/src/commands/mcp/mcp-server.js +20 -25
  11. package/src/commands/mcp/mcp-server.js.map +1 -1
  12. package/src/commands/mcp/tools/best-practices.js +9 -17
  13. package/src/commands/mcp/tools/best-practices.js.map +1 -1
  14. package/src/commands/mcp/tools/doc-search.js +11 -33
  15. package/src/commands/mcp/tools/doc-search.js.map +1 -1
  16. package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-single-file.d.ts +2 -1
  17. package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-single-file.js +2 -2
  18. package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-single-file.js.map +1 -1
  19. package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.d.ts +3 -2
  20. package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.js +8 -8
  21. package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.js.map +1 -1
  22. package/src/commands/mcp/tools/onpush-zoneless-migration/ts-utils.d.ts +2 -1
  23. package/src/commands/mcp/tools/onpush-zoneless-migration/ts-utils.js +2 -3
  24. package/src/commands/mcp/tools/onpush-zoneless-migration/ts-utils.js.map +1 -1
  25. package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.d.ts +2 -1
  26. package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.js +29 -41
  27. package/src/commands/mcp/tools/onpush-zoneless-migration/zoneless-migration.js.map +1 -1
  28. package/src/commands/mcp/tools/projects.d.ts +1 -0
  29. package/src/commands/mcp/tools/projects.js +15 -18
  30. package/src/commands/mcp/tools/projects.js.map +1 -1
  31. package/src/commands/mcp/tools/run-target/build-target-strategy.d.ts +14 -0
  32. package/src/commands/mcp/tools/run-target/build-target-strategy.js +53 -0
  33. package/src/commands/mcp/tools/run-target/build-target-strategy.js.map +1 -0
  34. package/src/commands/mcp/tools/run-target/generic-target-strategy.d.ts +14 -0
  35. package/src/commands/mcp/tools/run-target/generic-target-strategy.js +63 -0
  36. package/src/commands/mcp/tools/run-target/generic-target-strategy.js.map +1 -0
  37. package/src/commands/mcp/tools/run-target/options-serializer.d.ts +13 -0
  38. package/src/commands/mcp/tools/run-target/options-serializer.js +41 -0
  39. package/src/commands/mcp/tools/run-target/options-serializer.js.map +1 -0
  40. package/src/commands/mcp/tools/run-target/run-target.d.ts +34 -0
  41. package/src/commands/mcp/tools/run-target/run-target.js +69 -0
  42. package/src/commands/mcp/tools/run-target/run-target.js.map +1 -0
  43. package/src/commands/mcp/tools/run-target/strategy.d.ts +15 -0
  44. package/src/commands/mcp/tools/run-target/strategy.js +10 -0
  45. package/src/commands/mcp/tools/run-target/strategy.js.map +1 -0
  46. package/src/commands/mcp/tools/run-target/types.d.ts +39 -0
  47. package/src/commands/mcp/tools/run-target/types.js +41 -0
  48. package/src/commands/mcp/tools/run-target/types.js.map +1 -0
  49. package/src/commands/mcp/tools/run-target/unit-test-strategy.d.ts +14 -0
  50. package/src/commands/mcp/tools/run-target/unit-test-strategy.js +56 -0
  51. package/src/commands/mcp/tools/run-target/unit-test-strategy.js.map +1 -0
  52. package/src/utilities/node-version.js +1 -1
  53. package/src/utilities/version.js +1 -1
  54. package/src/commands/mcp/tools/build.d.ts +0 -37
  55. package/src/commands/mcp/tools/build.js +0 -90
  56. package/src/commands/mcp/tools/build.js.map +0 -1
  57. package/src/commands/mcp/tools/e2e.d.ts +0 -44
  58. package/src/commands/mcp/tools/e2e.js +0 -88
  59. package/src/commands/mcp/tools/e2e.js.map +0 -1
  60. package/src/commands/mcp/tools/test.d.ts +0 -35
  61. package/src/commands/mcp/tools/test.js +0 -88
  62. package/src/commands/mcp/tools/test.js.map +0 -1
@@ -1,37 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.dev/license
7
- */
8
- import { z } from 'zod';
9
- import { type McpToolContext, type McpToolDeclaration } from './tool-registry';
10
- declare const buildToolInputSchema: z.ZodObject<{
11
- configuration: z.ZodOptional<z.ZodString>;
12
- workspace: z.ZodOptional<z.ZodString>;
13
- project: z.ZodOptional<z.ZodString>;
14
- }, z.core.$strip>;
15
- export type BuildToolInput = z.infer<typeof buildToolInputSchema>;
16
- declare const buildToolOutputSchema: z.ZodObject<{
17
- status: z.ZodEnum<{
18
- success: "success";
19
- failure: "failure";
20
- }>;
21
- logs: z.ZodOptional<z.ZodArray<z.ZodString>>;
22
- path: z.ZodOptional<z.ZodString>;
23
- }, z.core.$strip>;
24
- export type BuildToolOutput = z.infer<typeof buildToolOutputSchema>;
25
- export declare function runBuild(input: BuildToolInput, context: McpToolContext): Promise<{
26
- content: {
27
- type: "text";
28
- text: string;
29
- }[];
30
- structuredContent: {
31
- status: "success" | "failure";
32
- logs?: string[] | undefined;
33
- path?: string | undefined;
34
- };
35
- }>;
36
- export declare const BUILD_TOOL: McpToolDeclaration<typeof buildToolInputSchema.shape, typeof buildToolOutputSchema.shape>;
37
- export {};
@@ -1,90 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.dev/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.BUILD_TOOL = void 0;
11
- exports.runBuild = runBuild;
12
- const zod_1 = require("zod");
13
- const shared_options_1 = require("../shared-options");
14
- const utils_1 = require("../utils");
15
- const workspace_utils_1 = require("../workspace-utils");
16
- const tool_registry_1 = require("./tool-registry");
17
- const DEFAULT_CONFIGURATION = 'development';
18
- const buildStatusSchema = zod_1.z.enum(['success', 'failure']);
19
- const buildToolInputSchema = zod_1.z.object({
20
- ...shared_options_1.workspaceAndProjectOptions,
21
- configuration: zod_1.z
22
- .string()
23
- .optional()
24
- .describe('Which build configuration to use. Defaults to "development".'),
25
- });
26
- const buildToolOutputSchema = zod_1.z.object({
27
- status: buildStatusSchema.describe('Build status.'),
28
- logs: zod_1.z.array(zod_1.z.string()).optional().describe('Output logs from `ng build`.'),
29
- path: zod_1.z.string().optional().describe('The output location for the build, if successful.'),
30
- });
31
- async function runBuild(input, context) {
32
- const { workspacePath, projectName } = await (0, workspace_utils_1.resolveWorkspaceAndProject)({
33
- host: context.host,
34
- server: context.server,
35
- workspacePathInput: input.workspace,
36
- projectNameInput: input.project,
37
- mcpWorkspace: context.workspace,
38
- });
39
- // Build "ng"'s command line.
40
- const args = ['build', projectName, '-c', input.configuration ?? DEFAULT_CONFIGURATION];
41
- let status = 'success';
42
- let logs;
43
- let outputPath;
44
- try {
45
- logs = (await context.host.runCommand('ng', args, { cwd: workspacePath })).logs;
46
- }
47
- catch (e) {
48
- status = 'failure';
49
- logs = (0, utils_1.getCommandErrorLogs)(e);
50
- }
51
- for (const line of logs) {
52
- const match = line.match(/Output location: (.*)/);
53
- if (match) {
54
- outputPath = match[1].trim();
55
- break;
56
- }
57
- }
58
- const structuredContent = {
59
- status,
60
- logs,
61
- path: outputPath,
62
- };
63
- return (0, utils_1.createStructuredContentOutput)(structuredContent);
64
- }
65
- exports.BUILD_TOOL = (0, tool_registry_1.declareTool)({
66
- name: 'build',
67
- title: 'Build Tool',
68
- description: `
69
- <Purpose>
70
- 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
71
- "ng build", but the tool is smarter about using the right configuration and collecting the output logs.
72
- </Purpose>
73
- <Use Cases>
74
- * Building an Angular project and getting build logs back.
75
- </Use Cases>
76
- <Operational Notes>
77
- * This tool runs "ng build" so it expects to run within an Angular workspace.
78
- * If you want a watched build which updates as files are changed, use "devserver.start" instead, which also serves the app.
79
- * 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.
80
- * This tool defaults to a development environment while a regular "ng build" defaults to a production environment. An unexpected build
81
- failure might suggest the project is not configured for the requested environment.
82
- </Operational Notes>
83
- `,
84
- isReadOnly: false,
85
- isLocalOnly: true,
86
- inputSchema: buildToolInputSchema.shape,
87
- outputSchema: buildToolOutputSchema.shape,
88
- factory: (context) => (input) => runBuild(input, context),
89
- });
90
- //# sourceMappingURL=build.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["build.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AA+BH,4BAsCC;AAnED,6BAAwB;AACxB,sDAA+D;AAC/D,oCAA8E;AAC9E,wDAAgE;AAChE,mDAA4F;AAE5F,MAAM,qBAAqB,GAAG,aAAa,CAAC;AAE5C,MAAM,iBAAiB,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AAGzD,MAAM,oBAAoB,GAAG,OAAC,CAAC,MAAM,CAAC;IACpC,GAAG,2CAA0B;IAC7B,aAAa,EAAE,OAAC;SACb,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,8DAA8D,CAAC;CAC5E,CAAC,CAAC;AAIH,MAAM,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,eAAe,CAAC;IACnD,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;IAC7E,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAA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,UAAU;KACjB,CAAC;IAEF,OAAO,IAAA,qCAA6B,EAAC,iBAAiB,CAAC,CAAC;AAC1D,CAAC;AAEY,QAAA,UAAU,GAGnB,IAAA,2BAAW,EAAC;IACd,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE;;;;;;;;;;;;;;;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;CAC1D,CAAC,CAAC"}
@@ -1,44 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.dev/license
7
- */
8
- import { z } from 'zod';
9
- import { type Host } from '../host';
10
- import { type McpToolContext, type McpToolDeclaration } from './tool-registry';
11
- declare const e2eToolInputSchema: z.ZodObject<{
12
- workspace: z.ZodOptional<z.ZodString>;
13
- project: z.ZodOptional<z.ZodString>;
14
- }, z.core.$strip>;
15
- export type E2eToolInput = z.infer<typeof e2eToolInputSchema>;
16
- declare const e2eToolOutputSchema: z.ZodObject<{
17
- status: z.ZodEnum<{
18
- success: "success";
19
- failure: "failure";
20
- }>;
21
- logs: z.ZodOptional<z.ZodArray<z.ZodString>>;
22
- }, z.core.$strip>;
23
- export type E2eToolOutput = z.infer<typeof e2eToolOutputSchema>;
24
- export declare function runE2e(input: E2eToolInput, host: Host, context: McpToolContext): Promise<{
25
- content: {
26
- type: "text";
27
- text: string;
28
- }[];
29
- structuredContent: {
30
- status: string;
31
- logs: string[];
32
- };
33
- } | {
34
- content: {
35
- type: "text";
36
- text: string;
37
- }[];
38
- structuredContent: {
39
- status: "success" | "failure";
40
- logs?: string[] | undefined;
41
- };
42
- }>;
43
- export declare const E2E_TOOL: McpToolDeclaration<typeof e2eToolInputSchema.shape, typeof e2eToolOutputSchema.shape>;
44
- export {};
@@ -1,88 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.dev/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.E2E_TOOL = void 0;
11
- exports.runE2e = runE2e;
12
- const zod_1 = require("zod");
13
- const shared_options_1 = require("../shared-options");
14
- const utils_1 = require("../utils");
15
- const workspace_utils_1 = require("../workspace-utils");
16
- const tool_registry_1 = require("./tool-registry");
17
- const e2eStatusSchema = zod_1.z.enum(['success', 'failure']);
18
- const e2eToolInputSchema = zod_1.z.object({
19
- ...shared_options_1.workspaceAndProjectOptions,
20
- });
21
- const e2eToolOutputSchema = zod_1.z.object({
22
- status: e2eStatusSchema.describe('E2E execution status.'),
23
- logs: zod_1.z.array(zod_1.z.string()).optional().describe('Output logs from `ng e2e`.'),
24
- });
25
- async function runE2e(input, host, context) {
26
- const { workspacePath, workspace, projectName } = await (0, workspace_utils_1.resolveWorkspaceAndProject)({
27
- host,
28
- server: context.server,
29
- workspacePathInput: input.workspace,
30
- projectNameInput: input.project,
31
- mcpWorkspace: context.workspace,
32
- });
33
- if (workspace && projectName) {
34
- // Verify that if a project can be found, it has an e2e testing already set up.
35
- const targetProject = workspace.projects.get(projectName);
36
- if (targetProject) {
37
- if (!targetProject.targets.has('e2e')) {
38
- return (0, utils_1.createStructuredContentOutput)({
39
- status: 'failure',
40
- logs: [
41
- `No e2e target is defined for project '${projectName}'. Please set up e2e testing` +
42
- ' first by calling `ng e2e` in an interactive console.' +
43
- ' See https://angular.dev/tools/cli/end-to-end.',
44
- ],
45
- });
46
- }
47
- }
48
- }
49
- // Build "ng"'s command line.
50
- const args = ['e2e', projectName];
51
- let status = 'success';
52
- let logs;
53
- try {
54
- logs = (await host.runCommand('ng', args, { cwd: workspacePath })).logs;
55
- }
56
- catch (e) {
57
- status = 'failure';
58
- logs = (0, utils_1.getCommandErrorLogs)(e);
59
- }
60
- const structuredContent = {
61
- status,
62
- logs,
63
- };
64
- return (0, utils_1.createStructuredContentOutput)(structuredContent);
65
- }
66
- exports.E2E_TOOL = (0, tool_registry_1.declareTool)({
67
- name: 'e2e',
68
- title: 'E2E Tool',
69
- description: `
70
- <Purpose>
71
- Perform an end-to-end test with ng e2e.
72
- </Purpose>
73
- <Use Cases>
74
- * When the user requests running end-to-end tests for the project.
75
- * When verifying changes that cross unit boundaries, such as changes to both client and server, changes to shared data types, etc.
76
- </Use Cases>
77
- <Operational Notes>
78
- * This tool uses "ng e2e".
79
- * Important: this relies on e2e tests being already configured for this project. It will error out if no "e2e" target is defined.
80
- </Operational Notes>
81
- `,
82
- isReadOnly: false,
83
- isLocalOnly: true,
84
- inputSchema: e2eToolInputSchema.shape,
85
- outputSchema: e2eToolOutputSchema.shape,
86
- factory: (context) => (input) => runE2e(input, context.host, context),
87
- });
88
- //# sourceMappingURL=e2e.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"e2e.js","sourceRoot":"","sources":["e2e.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAyBH,wBA6CC;AApED,6BAAwB;AAExB,sDAA+D;AAC/D,oCAA8E;AAC9E,wDAAgE;AAChE,mDAA4F;AAE5F,MAAM,eAAe,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AAGvD,MAAM,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IAClC,GAAG,2CAA0B;CAC9B,CAAC,CAAC;AAIH,MAAM,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IACnC,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,uBAAuB,CAAC;IACzD,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC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B,IAAI,GAAG,IAAA,2BAAmB,EAAC,CAAC,CAAC,CAAC;IAChC,CAAC;IAED,MAAM,iBAAiB,GAAkB;QACvC,MAAM;QACN,IAAI;KACL,CAAC;IAEF,OAAO,IAAA,qCAA6B,EAAC,iBAAiB,CAAC,CAAC;AAC1D,CAAC;AAEY,QAAA,QAAQ,GAGjB,IAAA,2BAAW,EAAC;IACd,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,UAAU;IACjB,WAAW,EAAE;;;;;;;;;;;;CAYd;IACC,UAAU,EAAE,KAAK;IACjB,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,kBAAkB,CAAC,KAAK;IACrC,YAAY,EAAE,mBAAmB,CAAC,KAAK;IACvC,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;CACtE,CAAC,CAAC"}
@@ -1,35 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.dev/license
7
- */
8
- import { z } from 'zod';
9
- import { type McpToolContext, type McpToolDeclaration } from './tool-registry';
10
- declare const testToolInputSchema: z.ZodObject<{
11
- filter: z.ZodOptional<z.ZodString>;
12
- workspace: z.ZodOptional<z.ZodString>;
13
- project: z.ZodOptional<z.ZodString>;
14
- }, z.core.$strip>;
15
- export type TestToolInput = z.infer<typeof testToolInputSchema>;
16
- declare const testToolOutputSchema: z.ZodObject<{
17
- status: z.ZodEnum<{
18
- success: "success";
19
- failure: "failure";
20
- }>;
21
- logs: z.ZodOptional<z.ZodArray<z.ZodString>>;
22
- }, z.core.$strip>;
23
- export type TestToolOutput = z.infer<typeof testToolOutputSchema>;
24
- export declare function runTest(input: TestToolInput, context: McpToolContext): Promise<{
25
- content: {
26
- type: "text";
27
- text: string;
28
- }[];
29
- structuredContent: {
30
- status: "success" | "failure";
31
- logs?: string[] | undefined;
32
- };
33
- }>;
34
- export declare const TEST_TOOL: McpToolDeclaration<typeof testToolInputSchema.shape, typeof testToolOutputSchema.shape>;
35
- export {};
@@ -1,88 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.dev/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.TEST_TOOL = void 0;
11
- exports.runTest = runTest;
12
- const zod_1 = require("zod");
13
- const shared_options_1 = require("../shared-options");
14
- const utils_1 = require("../utils");
15
- const workspace_utils_1 = require("../workspace-utils");
16
- const tool_registry_1 = require("./tool-registry");
17
- const testStatusSchema = zod_1.z.enum(['success', 'failure']);
18
- const testToolInputSchema = zod_1.z.object({
19
- ...shared_options_1.workspaceAndProjectOptions,
20
- filter: zod_1.z.string().optional().describe('Filter the executed tests by spec name.'),
21
- });
22
- const testToolOutputSchema = zod_1.z.object({
23
- status: testStatusSchema.describe('Test execution status.'),
24
- logs: zod_1.z.array(zod_1.z.string()).optional().describe('Output logs from `ng test`.'),
25
- });
26
- function shouldUseHeadlessOption(testTarget) {
27
- return (testTarget?.builder === '@angular/build:unit-test' && testTarget.options?.['runner'] !== 'karma');
28
- }
29
- async function runTest(input, context) {
30
- const { workspace, workspacePath, projectName } = await (0, workspace_utils_1.resolveWorkspaceAndProject)({
31
- host: context.host,
32
- workspacePathInput: input.workspace,
33
- projectNameInput: input.project,
34
- mcpWorkspace: context.workspace,
35
- });
36
- // Build "ng"'s command line.
37
- const args = ['test', projectName];
38
- if (shouldUseHeadlessOption(workspace.projects.get(projectName)?.targets.get('test'))) {
39
- args.push('--headless', 'true');
40
- }
41
- else {
42
- // Karma-based projects need an explicit headless browser for non-interactive MCP execution.
43
- args.push('--browsers', 'ChromeHeadless');
44
- }
45
- args.push('--watch', 'false');
46
- if (input.filter) {
47
- args.push('--filter', input.filter);
48
- }
49
- let status = 'success';
50
- let logs;
51
- try {
52
- logs = (await context.host.runCommand('ng', args, { cwd: workspacePath })).logs;
53
- }
54
- catch (e) {
55
- status = 'failure';
56
- logs = (0, utils_1.getCommandErrorLogs)(e);
57
- }
58
- const structuredContent = {
59
- status,
60
- logs,
61
- };
62
- return (0, utils_1.createStructuredContentOutput)(structuredContent);
63
- }
64
- exports.TEST_TOOL = (0, tool_registry_1.declareTool)({
65
- name: 'test',
66
- title: 'Test Tool',
67
- description: `
68
- <Purpose>
69
- Perform a one-off, non-watched unit test execution with ng test.
70
- </Purpose>
71
- <Use Cases>
72
- * Running unit tests for the project.
73
- * Verifying code changes with tests.
74
- </Use Cases>
75
- <Operational Notes>
76
- * This tool uses "ng test".
77
- * It supports filtering by spec name if the underlying builder supports it (e.g., 'unit-test' builder).
78
- * For the "@angular/build:unit-test" builder with Vitest, this tool requests headless execution via "--headless true".
79
- * For Karma-based projects, this tool forces headless Chrome with "--browsers ChromeHeadless", so Chrome must be installed.
80
- </Operational Notes>
81
- `,
82
- isReadOnly: false,
83
- isLocalOnly: true,
84
- inputSchema: testToolInputSchema.shape,
85
- outputSchema: testToolOutputSchema.shape,
86
- factory: (context) => (input) => runTest(input, context),
87
- });
88
- //# sourceMappingURL=test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAiCH,0BAwCC;AAvED,6BAAwB;AACxB,sDAA+D;AAC/D,oCAA8E;AAC9E,wDAAgE;AAChE,mDAA4F;AAE5F,MAAM,gBAAgB,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AAGxD,MAAM,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IACnC,GAAG,2CAA0B;IAC7B,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAA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