@angular/cli 21.1.2 → 21.2.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +17 -18
- package/src/analytics/analytics-collector.d.ts +6 -3
- package/src/analytics/analytics-collector.js +7 -7
- package/src/analytics/analytics-collector.js.map +1 -1
- package/src/analytics/analytics.d.ts +1 -1
- package/src/command-builder/command-module.d.ts +4 -33
- package/src/command-builder/command-module.js +11 -48
- package/src/command-builder/command-module.js.map +1 -1
- package/src/command-builder/command-runner.js +59 -4
- package/src/command-builder/command-runner.js.map +1 -1
- package/src/command-builder/definitions.d.ts +41 -0
- package/src/command-builder/definitions.js +20 -0
- package/src/command-builder/definitions.js.map +1 -0
- package/src/command-builder/schematics-command-module.js +13 -1
- package/src/command-builder/schematics-command-module.js.map +1 -1
- package/src/command-builder/utilities/prettier.d.ts +13 -0
- package/src/command-builder/utilities/prettier.js +71 -0
- package/src/command-builder/utilities/prettier.js.map +1 -0
- package/src/commands/add/cli.d.ts +0 -1
- package/src/commands/add/cli.js +21 -34
- package/src/commands/add/cli.js.map +1 -1
- package/src/commands/mcp/devserver.d.ts +18 -3
- package/src/commands/mcp/devserver.js +23 -3
- package/src/commands/mcp/devserver.js.map +1 -1
- package/src/commands/mcp/mcp-server.d.ts +28 -12
- package/src/commands/mcp/resources/best-practices.md +0 -1
- package/src/commands/mcp/shared-options.d.ts +12 -0
- package/src/commands/mcp/shared-options.js +22 -0
- package/src/commands/mcp/shared-options.js.map +1 -0
- package/src/commands/mcp/tools/build.d.ts +4 -4
- package/src/commands/mcp/tools/build.js +13 -12
- package/src/commands/mcp/tools/build.js.map +1 -1
- package/src/commands/mcp/tools/devserver/devserver-start.d.ts +1 -8
- package/src/commands/mcp/tools/devserver/devserver-start.js +18 -13
- package/src/commands/mcp/tools/devserver/devserver-start.js.map +1 -1
- package/src/commands/mcp/tools/devserver/devserver-stop.d.ts +3 -20
- package/src/commands/mcp/tools/devserver/devserver-stop.js +18 -33
- package/src/commands/mcp/tools/devserver/devserver-stop.js.map +1 -1
- package/src/commands/mcp/tools/devserver/devserver-wait-for-build.d.ts +3 -12
- package/src/commands/mcp/tools/devserver/devserver-wait-for-build.js +22 -37
- package/src/commands/mcp/tools/devserver/devserver-wait-for-build.js.map +1 -1
- package/src/commands/mcp/tools/e2e.d.ts +1 -0
- package/src/commands/mcp/tools/e2e.js +14 -14
- package/src/commands/mcp/tools/e2e.js.map +1 -1
- package/src/commands/mcp/tools/modernize.d.ts +5 -4
- package/src/commands/mcp/tools/modernize.js +29 -38
- package/src/commands/mcp/tools/modernize.js.map +1 -1
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.js +2 -2
- package/src/commands/mcp/tools/onpush-zoneless-migration/migrate-test-file.js.map +1 -1
- package/src/commands/mcp/tools/test.d.ts +4 -4
- package/src/commands/mcp/tools/test.js +13 -12
- package/src/commands/mcp/tools/test.js.map +1 -1
- package/src/commands/mcp/utils.d.ts +0 -31
- package/src/commands/mcp/utils.js +4 -61
- package/src/commands/mcp/utils.js.map +1 -1
- package/src/commands/mcp/workspace-utils.d.ts +53 -0
- package/src/commands/mcp/workspace-utils.js +138 -0
- package/src/commands/mcp/workspace-utils.js.map +1 -0
- package/src/commands/update/cli.js +46 -30
- package/src/commands/update/cli.js.map +1 -1
- package/src/commands/update/schematic/index.js.map +1 -1
- package/src/commands/update/utilities/cli-version.d.ts +1 -1
- package/src/commands/version/cli.js +1 -1
- package/src/commands/version/cli.js.map +1 -1
- package/src/commands/version/version-info.d.ts +2 -7
- package/src/commands/version/version-info.js +2 -2
- package/src/commands/version/version-info.js.map +1 -1
- package/src/package-managers/factory.d.ts +5 -1
- package/src/package-managers/factory.js +39 -31
- package/src/package-managers/factory.js.map +1 -1
- package/src/package-managers/host.d.ts +9 -0
- package/src/package-managers/host.js +2 -1
- package/src/package-managers/host.js.map +1 -1
- package/src/package-managers/package-manager-descriptor.d.ts +2 -2
- package/src/package-managers/package-manager-descriptor.js +3 -3
- package/src/package-managers/package-manager-descriptor.js.map +1 -1
- package/src/package-managers/package-manager.d.ts +8 -3
- package/src/package-managers/package-manager.js +31 -3
- package/src/package-managers/package-manager.js.map +1 -1
- package/src/package-managers/package-metadata.d.ts +4 -0
- package/src/package-managers/parsers.d.ts +32 -19
- package/src/package-managers/parsers.js +94 -61
- package/src/package-managers/parsers.js.map +1 -1
- package/src/utilities/config.js +6 -6
- package/src/utilities/config.js.map +1 -1
- package/src/utilities/find-up.d.ts +14 -1
- package/src/utilities/find-up.js +47 -43
- package/src/utilities/find-up.js.map +1 -1
- package/src/utilities/package-metadata.d.ts +3 -0
- package/src/utilities/package-metadata.js.map +1 -1
- package/src/utilities/project.js +1 -1
- package/src/utilities/project.js.map +1 -1
- package/src/utilities/version.js +1 -1
- package/src/utilities/package-manager.d.ts +0 -49
- package/src/utilities/package-manager.js +0 -327
- package/src/utilities/package-manager.js.map +0 -1
- package/src/utilities/package-tree.d.ts +0 -32
- package/src/utilities/package-tree.js +0 -95
- package/src/utilities/package-tree.js.map +0 -1
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { z } from 'zod';
|
|
9
|
-
import { type
|
|
10
|
-
import { type McpToolDeclaration } from './tool-registry';
|
|
9
|
+
import { type McpToolContext, type McpToolDeclaration } from './tool-registry';
|
|
11
10
|
declare const buildToolInputSchema: z.ZodObject<{
|
|
12
|
-
project: z.ZodOptional<z.ZodString>;
|
|
13
11
|
configuration: z.ZodOptional<z.ZodString>;
|
|
12
|
+
workspace: z.ZodOptional<z.ZodString>;
|
|
13
|
+
project: z.ZodOptional<z.ZodString>;
|
|
14
14
|
}, z.core.$strip>;
|
|
15
15
|
export type BuildToolInput = z.infer<typeof buildToolInputSchema>;
|
|
16
16
|
declare const buildToolOutputSchema: z.ZodObject<{
|
|
@@ -22,7 +22,7 @@ declare const buildToolOutputSchema: z.ZodObject<{
|
|
|
22
22
|
path: z.ZodOptional<z.ZodString>;
|
|
23
23
|
}, z.core.$strip>;
|
|
24
24
|
export type BuildToolOutput = z.infer<typeof buildToolOutputSchema>;
|
|
25
|
-
export declare function runBuild(input: BuildToolInput,
|
|
25
|
+
export declare function runBuild(input: BuildToolInput, context: McpToolContext): Promise<{
|
|
26
26
|
content: {
|
|
27
27
|
type: "text";
|
|
28
28
|
text: string;
|
|
@@ -10,15 +10,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.BUILD_TOOL = void 0;
|
|
11
11
|
exports.runBuild = runBuild;
|
|
12
12
|
const zod_1 = require("zod");
|
|
13
|
+
const shared_options_1 = require("../shared-options");
|
|
13
14
|
const utils_1 = require("../utils");
|
|
15
|
+
const workspace_utils_1 = require("../workspace-utils");
|
|
14
16
|
const tool_registry_1 = require("./tool-registry");
|
|
15
17
|
const DEFAULT_CONFIGURATION = 'development';
|
|
16
18
|
const buildStatusSchema = zod_1.z.enum(['success', 'failure']);
|
|
17
19
|
const buildToolInputSchema = zod_1.z.object({
|
|
18
|
-
|
|
19
|
-
.string()
|
|
20
|
-
.optional()
|
|
21
|
-
.describe('Which project to build in a monorepo context. If not provided, builds the default project.'),
|
|
20
|
+
...shared_options_1.workspaceAndProjectOptions,
|
|
22
21
|
configuration: zod_1.z
|
|
23
22
|
.string()
|
|
24
23
|
.optional()
|
|
@@ -29,18 +28,20 @@ const buildToolOutputSchema = zod_1.z.object({
|
|
|
29
28
|
logs: zod_1.z.array(zod_1.z.string()).optional().describe('Output logs from `ng build`.'),
|
|
30
29
|
path: zod_1.z.string().optional().describe('The output location for the build, if successful.'),
|
|
31
30
|
});
|
|
32
|
-
async function runBuild(input,
|
|
31
|
+
async function runBuild(input, context) {
|
|
32
|
+
const { workspacePath, projectName } = await (0, workspace_utils_1.resolveWorkspaceAndProject)({
|
|
33
|
+
host: context.host,
|
|
34
|
+
workspacePathInput: input.workspace,
|
|
35
|
+
projectNameInput: input.project,
|
|
36
|
+
mcpWorkspace: context.workspace,
|
|
37
|
+
});
|
|
33
38
|
// Build "ng"'s command line.
|
|
34
|
-
const args = ['build'];
|
|
35
|
-
if (input.project) {
|
|
36
|
-
args.push(input.project);
|
|
37
|
-
}
|
|
38
|
-
args.push('-c', input.configuration ?? DEFAULT_CONFIGURATION);
|
|
39
|
+
const args = ['build', projectName, '-c', input.configuration ?? DEFAULT_CONFIGURATION];
|
|
39
40
|
let status = 'success';
|
|
40
41
|
let logs = [];
|
|
41
42
|
let outputPath;
|
|
42
43
|
try {
|
|
43
|
-
logs = (await host.runCommand('ng', args)).logs;
|
|
44
|
+
logs = (await context.host.runCommand('ng', args, { cwd: workspacePath })).logs;
|
|
44
45
|
}
|
|
45
46
|
catch (e) {
|
|
46
47
|
status = 'failure';
|
|
@@ -83,6 +84,6 @@ Perform a one-off, non-watched build using "ng build". Use this tool whenever th
|
|
|
83
84
|
isLocalOnly: true,
|
|
84
85
|
inputSchema: buildToolInputSchema.shape,
|
|
85
86
|
outputSchema: buildToolOutputSchema.shape,
|
|
86
|
-
factory: (context) => (input) => runBuild(input, context
|
|
87
|
+
factory: (context) => (input) => runBuild(input, context),
|
|
87
88
|
});
|
|
88
89
|
//# sourceMappingURL=build.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["build.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["build.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AA+BH,4BAqCC;AAlED,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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AS,CAAC;QACnB,IAAI,GAAG,IAAA,2BAAmB,EAAC,CAAC,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;QACxB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAClD,IAAI,KAAK,EAAE,CAAC;YACV,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAC7B,MAAM;QACR,CAAC;IACH,CAAC;IAED,MAAM,iBAAiB,GAAoB;QACzC,MAAM;QACN,IAAI;QACJ,IAAI,EAAE,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"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { type McpToolContext, type McpToolDeclaration } from '../tool-registry';
|
|
10
10
|
declare const devserverStartToolInputSchema: z.ZodObject<{
|
|
11
|
+
workspace: z.ZodOptional<z.ZodString>;
|
|
11
12
|
project: z.ZodOptional<z.ZodString>;
|
|
12
13
|
}, z.core.$strip>;
|
|
13
14
|
export type DevserverStartToolInput = z.infer<typeof devserverStartToolInputSchema>;
|
|
@@ -17,14 +18,6 @@ declare const devserverStartToolOutputSchema: z.ZodObject<{
|
|
|
17
18
|
}, z.core.$strip>;
|
|
18
19
|
export type DevserverStartToolOutput = z.infer<typeof devserverStartToolOutputSchema>;
|
|
19
20
|
export declare function startDevserver(input: DevserverStartToolInput, context: McpToolContext): Promise<{
|
|
20
|
-
content: {
|
|
21
|
-
type: "text";
|
|
22
|
-
text: string;
|
|
23
|
-
}[];
|
|
24
|
-
structuredContent: {
|
|
25
|
-
message: string[];
|
|
26
|
-
};
|
|
27
|
-
} | {
|
|
28
21
|
content: {
|
|
29
22
|
type: "text";
|
|
30
23
|
text: string;
|
|
@@ -11,13 +11,12 @@ exports.DEVSERVER_START_TOOL = void 0;
|
|
|
11
11
|
exports.startDevserver = startDevserver;
|
|
12
12
|
const zod_1 = require("zod");
|
|
13
13
|
const devserver_1 = require("../../devserver");
|
|
14
|
+
const shared_options_1 = require("../../shared-options");
|
|
14
15
|
const utils_1 = require("../../utils");
|
|
16
|
+
const workspace_utils_1 = require("../../workspace-utils");
|
|
15
17
|
const tool_registry_1 = require("../tool-registry");
|
|
16
18
|
const devserverStartToolInputSchema = zod_1.z.object({
|
|
17
|
-
|
|
18
|
-
.string()
|
|
19
|
-
.optional()
|
|
20
|
-
.describe('Which project to serve in a monorepo context. If not provided, serves the default project.'),
|
|
19
|
+
...shared_options_1.workspaceAndProjectOptions,
|
|
21
20
|
});
|
|
22
21
|
const devserverStartToolOutputSchema = zod_1.z.object({
|
|
23
22
|
message: zod_1.z.string().describe('A message indicating the result of the operation.'),
|
|
@@ -30,13 +29,14 @@ function localhostAddress(port) {
|
|
|
30
29
|
return `http://localhost:${port}/`;
|
|
31
30
|
}
|
|
32
31
|
async function startDevserver(input, context) {
|
|
33
|
-
const projectName =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
32
|
+
const { workspacePath, projectName } = await (0, workspace_utils_1.resolveWorkspaceAndProject)({
|
|
33
|
+
host: context.host,
|
|
34
|
+
workspacePathInput: input.workspace,
|
|
35
|
+
projectNameInput: input.project,
|
|
36
|
+
mcpWorkspace: context.workspace,
|
|
37
|
+
});
|
|
38
|
+
const key = (0, devserver_1.getDevserverKey)(workspacePath, projectName);
|
|
39
|
+
let devserver = context.devservers.get(key);
|
|
40
40
|
if (devserver) {
|
|
41
41
|
return (0, utils_1.createStructuredContentOutput)({
|
|
42
42
|
message: `Development server for project '${projectName}' is already running.`,
|
|
@@ -44,9 +44,14 @@ async function startDevserver(input, context) {
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
const port = await context.host.getAvailablePort();
|
|
47
|
-
devserver = new devserver_1.LocalDevserver({
|
|
47
|
+
devserver = new devserver_1.LocalDevserver({
|
|
48
|
+
host: context.host,
|
|
49
|
+
project: projectName,
|
|
50
|
+
port,
|
|
51
|
+
workspacePath,
|
|
52
|
+
});
|
|
48
53
|
devserver.start();
|
|
49
|
-
context.devservers.set(
|
|
54
|
+
context.devservers.set(key, devserver);
|
|
50
55
|
return (0, utils_1.createStructuredContentOutput)({
|
|
51
56
|
message: `Development server for project '${projectName}' started and watching for workspace changes.`,
|
|
52
57
|
address: localhostAddress(port),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devserver-start.js","sourceRoot":"","sources":["devserver-start.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;
|
|
1
|
+
{"version":3,"file":"devserver-start.js","sourceRoot":"","sources":["devserver-start.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AA+BH,wCAkCC;AA/DD,6BAAwB;AACxB,+CAAkE;AAClE,yDAAkE;AAClE,uCAA4D;AAC5D,2DAAmE;AACnE,oDAA6F;AAE7F,MAAM,6BAA6B,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,GAAG,2CAA0B;CAC9B,CAAC,CAAC;AAIH,MAAM,8BAA8B,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9C,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mDAAmD,CAAC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,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"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { type McpToolContext, type McpToolDeclaration } from '../tool-registry';
|
|
10
10
|
declare const devserverStopToolInputSchema: z.ZodObject<{
|
|
11
|
+
workspace: z.ZodOptional<z.ZodString>;
|
|
11
12
|
project: z.ZodOptional<z.ZodString>;
|
|
12
13
|
}, z.core.$strip>;
|
|
13
14
|
export type DevserverStopToolInput = z.infer<typeof devserverStopToolInputSchema>;
|
|
@@ -16,25 +17,7 @@ declare const devserverStopToolOutputSchema: z.ZodObject<{
|
|
|
16
17
|
logs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
17
18
|
}, z.core.$strip>;
|
|
18
19
|
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: undefined;
|
|
36
|
-
};
|
|
37
|
-
} | {
|
|
20
|
+
export declare function stopDevserver(input: DevserverStopToolInput, context: McpToolContext): Promise<{
|
|
38
21
|
content: {
|
|
39
22
|
type: "text";
|
|
40
23
|
text: string;
|
|
@@ -43,6 +26,6 @@ export declare function stopDevserver(input: DevserverStopToolInput, context: Mc
|
|
|
43
26
|
message: string;
|
|
44
27
|
logs: string[];
|
|
45
28
|
};
|
|
46
|
-
}
|
|
29
|
+
}>;
|
|
47
30
|
export declare const DEVSERVER_STOP_TOOL: McpToolDeclaration<typeof devserverStopToolInputSchema.shape, typeof devserverStopToolOutputSchema.shape>;
|
|
48
31
|
export {};
|
|
@@ -10,50 +10,35 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.DEVSERVER_STOP_TOOL = void 0;
|
|
11
11
|
exports.stopDevserver = stopDevserver;
|
|
12
12
|
const zod_1 = require("zod");
|
|
13
|
+
const devserver_1 = require("../../devserver");
|
|
14
|
+
const shared_options_1 = require("../../shared-options");
|
|
13
15
|
const utils_1 = require("../../utils");
|
|
16
|
+
const workspace_utils_1 = require("../../workspace-utils");
|
|
14
17
|
const tool_registry_1 = require("../tool-registry");
|
|
15
18
|
const devserverStopToolInputSchema = zod_1.z.object({
|
|
16
|
-
|
|
17
|
-
.string()
|
|
18
|
-
.optional()
|
|
19
|
-
.describe('Which project to stop serving in a monorepo context. If not provided, stops the default project server.'),
|
|
19
|
+
...shared_options_1.workspaceAndProjectOptions,
|
|
20
20
|
});
|
|
21
21
|
const devserverStopToolOutputSchema = zod_1.z.object({
|
|
22
22
|
message: zod_1.z.string().describe('A message indicating the result of the operation.'),
|
|
23
23
|
logs: zod_1.z.array(zod_1.z.string()).optional().describe('The full logs from the dev server.'),
|
|
24
24
|
});
|
|
25
|
-
function stopDevserver(input, context) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
projectName = Array.from(context.devservers.keys())[0];
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
return (0, utils_1.createStructuredContentOutput)({
|
|
40
|
-
message: ['Project name not provided, and no default project found.'],
|
|
41
|
-
logs: undefined,
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
const devServer = context.devservers.get(projectName);
|
|
46
|
-
if (!devServer) {
|
|
47
|
-
return (0, utils_1.createStructuredContentOutput)({
|
|
48
|
-
message: `Development server for project '${projectName}' was not running.`,
|
|
49
|
-
logs: undefined,
|
|
50
|
-
});
|
|
25
|
+
async function stopDevserver(input, context) {
|
|
26
|
+
const { workspacePath, projectName } = await (0, workspace_utils_1.resolveWorkspaceAndProject)({
|
|
27
|
+
host: context.host,
|
|
28
|
+
workspacePathInput: input.workspace,
|
|
29
|
+
projectNameInput: input.project,
|
|
30
|
+
mcpWorkspace: context.workspace,
|
|
31
|
+
});
|
|
32
|
+
const key = (0, devserver_1.getDevserverKey)(workspacePath, projectName);
|
|
33
|
+
const devserver = context.devservers.get(key);
|
|
34
|
+
if (!devserver) {
|
|
35
|
+
throw (0, devserver_1.createDevServerNotFoundError)(context.devservers);
|
|
51
36
|
}
|
|
52
|
-
|
|
53
|
-
context.devservers.delete(
|
|
37
|
+
devserver.stop();
|
|
38
|
+
context.devservers.delete(key);
|
|
54
39
|
return (0, utils_1.createStructuredContentOutput)({
|
|
55
40
|
message: `Development server for project '${projectName}' stopped.`,
|
|
56
|
-
logs:
|
|
41
|
+
logs: devserver.getServerLogs(),
|
|
57
42
|
});
|
|
58
43
|
}
|
|
59
44
|
exports.DEVSERVER_STOP_TOOL = (0, tool_registry_1.declareTool)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devserver-stop.js","sourceRoot":"","sources":["devserver-stop.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;
|
|
1
|
+
{"version":3,"file":"devserver-stop.js","sourceRoot":"","sources":["devserver-stop.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAsBH,sCAqBC;AAzCD,6BAAwB;AACxB,+CAAgF;AAChF,yDAAkE;AAClE,uCAA4D;AAC5D,2DAAmE;AACnE,oDAA6F;AAE7F,MAAM,4BAA4B,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5C,GAAG,2CAA0B;CAC9B,CAAC,CAAC;AAIH,MAAM,6BAA6B,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mDAAmD,CAAC;IACjF,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;CACpF,CAAC,CAAC;AAII,KAAK,UAAU,aAAa,CAAC,KAA6B,EAAE,OAAuB;IACxF,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,4CAA0B,EAAC;QACtE,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,kBAAkB,EAAE,KAAK,CAAC,SAAS;QACnC,gBAAgB,EAAE,KAAK,CAAC,OAAO;QAC/B,YAAY,EAAE,OAAO,CAAC,SAAS;KAChC,CAAC,CAAC;IACH,MAAM,GAAG,GAAG,IAAA,2BAAe,EAAC,aAAa,EAAE,WAAW,CAAC,CAAC;IACxD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAE9C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAA,wCAA4B,EAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACzD,CAAC;IAED,SAAS,CAAC,IAAI,EAAE,CAAC;IACjB,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAE/B,OAAO,IAAA,qCAA6B,EAAC;QACnC,OAAO,EAAE,mCAAmC,WAAW,YAAY;QACnE,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"}
|
|
@@ -12,8 +12,9 @@ import { type McpToolContext, type McpToolDeclaration } from '../tool-registry';
|
|
|
12
12
|
*/
|
|
13
13
|
export declare const WATCH_DELAY = 1000;
|
|
14
14
|
declare const devserverWaitForBuildToolInputSchema: z.ZodObject<{
|
|
15
|
-
project: z.ZodOptional<z.ZodString>;
|
|
16
15
|
timeout: z.ZodDefault<z.ZodNumber>;
|
|
16
|
+
workspace: z.ZodOptional<z.ZodString>;
|
|
17
|
+
project: z.ZodOptional<z.ZodString>;
|
|
17
18
|
}, z.core.$strip>;
|
|
18
19
|
export type DevserverWaitForBuildToolInput = z.infer<typeof devserverWaitForBuildToolInputSchema>;
|
|
19
20
|
declare const devserverWaitForBuildToolOutputSchema: z.ZodObject<{
|
|
@@ -22,7 +23,6 @@ declare const devserverWaitForBuildToolOutputSchema: z.ZodObject<{
|
|
|
22
23
|
timeout: "timeout";
|
|
23
24
|
failure: "failure";
|
|
24
25
|
unknown: "unknown";
|
|
25
|
-
no_devserver_found: "no_devserver_found";
|
|
26
26
|
}>;
|
|
27
27
|
logs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
28
28
|
}, z.core.$strip>;
|
|
@@ -33,16 +33,7 @@ export declare function waitForDevserverBuild(input: DevserverWaitForBuildToolIn
|
|
|
33
33
|
text: string;
|
|
34
34
|
}[];
|
|
35
35
|
structuredContent: {
|
|
36
|
-
status:
|
|
37
|
-
logs: undefined;
|
|
38
|
-
};
|
|
39
|
-
} | {
|
|
40
|
-
content: {
|
|
41
|
-
type: "text";
|
|
42
|
-
text: string;
|
|
43
|
-
}[];
|
|
44
|
-
structuredContent: {
|
|
45
|
-
status: "success" | "timeout" | "failure" | "unknown" | "no_devserver_found";
|
|
36
|
+
status: "success" | "timeout" | "failure" | "unknown";
|
|
46
37
|
logs?: string[] | undefined;
|
|
47
38
|
};
|
|
48
39
|
}>;
|
|
@@ -10,7 +10,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
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 devserver_1 = require("../../devserver");
|
|
14
|
+
const shared_options_1 = require("../../shared-options");
|
|
13
15
|
const utils_1 = require("../../utils");
|
|
16
|
+
const workspace_utils_1 = require("../../workspace-utils");
|
|
14
17
|
const tool_registry_1 = require("../tool-registry");
|
|
15
18
|
/**
|
|
16
19
|
* How long to wait to give "ng serve" time to identify whether the watched workspace has changed.
|
|
@@ -21,10 +24,7 @@ exports.WATCH_DELAY = 1000;
|
|
|
21
24
|
*/
|
|
22
25
|
const DEFAULT_TIMEOUT = 180_000; // In milliseconds
|
|
23
26
|
const devserverWaitForBuildToolInputSchema = zod_1.z.object({
|
|
24
|
-
|
|
25
|
-
.string()
|
|
26
|
-
.optional()
|
|
27
|
-
.describe('Which project to wait for in a monorepo context. If not provided, waits for the default project server.'),
|
|
27
|
+
...shared_options_1.workspaceAndProjectOptions,
|
|
28
28
|
timeout: zod_1.z
|
|
29
29
|
.number()
|
|
30
30
|
.default(DEFAULT_TIMEOUT)
|
|
@@ -32,7 +32,7 @@ const devserverWaitForBuildToolInputSchema = zod_1.z.object({
|
|
|
32
32
|
});
|
|
33
33
|
const devserverWaitForBuildToolOutputSchema = zod_1.z.object({
|
|
34
34
|
status: zod_1.z
|
|
35
|
-
.enum(['success', 'failure', 'unknown', 'timeout'
|
|
35
|
+
.enum(['success', 'failure', 'unknown', 'timeout'])
|
|
36
36
|
.describe("The status of the build if it's complete, or a status indicating why the wait operation failed."),
|
|
37
37
|
logs: zod_1.z
|
|
38
38
|
.array(zod_1.z.string())
|
|
@@ -43,35 +43,23 @@ function wait(ms) {
|
|
|
43
43
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
44
44
|
}
|
|
45
45
|
async function waitForDevserverBuild(input, context) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
projectName = Array.from(context.devservers.keys())[0];
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
return (0, utils_1.createStructuredContentOutput)({
|
|
60
|
-
status: 'no_devserver_found',
|
|
61
|
-
logs: undefined,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
const devServer = context.devservers.get(projectName);
|
|
66
|
-
if (!devServer) {
|
|
67
|
-
return (0, utils_1.createStructuredContentOutput)({
|
|
68
|
-
status: 'no_devserver_found',
|
|
69
|
-
logs: undefined,
|
|
70
|
-
});
|
|
46
|
+
const { workspacePath, projectName } = await (0, workspace_utils_1.resolveWorkspaceAndProject)({
|
|
47
|
+
host: context.host,
|
|
48
|
+
workspacePathInput: input.workspace,
|
|
49
|
+
projectNameInput: input.project,
|
|
50
|
+
mcpWorkspace: context.workspace,
|
|
51
|
+
});
|
|
52
|
+
const key = (0, devserver_1.getDevserverKey)(workspacePath, projectName);
|
|
53
|
+
const devserver = context.devservers.get(key);
|
|
54
|
+
if (!devserver) {
|
|
55
|
+
throw (0, devserver_1.createDevServerNotFoundError)(context.devservers);
|
|
71
56
|
}
|
|
72
|
-
|
|
57
|
+
return performWait(devserver, input.timeout);
|
|
58
|
+
}
|
|
59
|
+
async function performWait(devserver, timeout) {
|
|
60
|
+
const deadline = Date.now() + timeout;
|
|
73
61
|
await wait(exports.WATCH_DELAY);
|
|
74
|
-
while (
|
|
62
|
+
while (devserver.isBuilding()) {
|
|
75
63
|
if (Date.now() > deadline) {
|
|
76
64
|
return (0, utils_1.createStructuredContentOutput)({
|
|
77
65
|
status: 'timeout',
|
|
@@ -81,7 +69,7 @@ async function waitForDevserverBuild(input, context) {
|
|
|
81
69
|
await wait(exports.WATCH_DELAY);
|
|
82
70
|
}
|
|
83
71
|
return (0, utils_1.createStructuredContentOutput)({
|
|
84
|
-
...
|
|
72
|
+
...devserver.getMostRecentBuild(),
|
|
85
73
|
});
|
|
86
74
|
}
|
|
87
75
|
exports.DEVSERVER_WAIT_FOR_BUILD_TOOL = (0, tool_registry_1.declareTool)({
|
|
@@ -98,14 +86,11 @@ recent build.
|
|
|
98
86
|
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.
|
|
99
87
|
</Use Cases>
|
|
100
88
|
<Operational Notes>
|
|
101
|
-
* This tool expects that a dev server was launched on the same project with the "devserver.start" tool, otherwise
|
|
102
|
-
status will be returned.
|
|
89
|
+
* This tool expects that a dev server was launched on the same project with the "devserver.start" tool, otherwise the tool will fail.
|
|
103
90
|
* This tool will block until the build is complete or the timeout is reached. If you expect a long build process, consider increasing the
|
|
104
91
|
timeout. Timeouts on initial run (right after "devserver.start" calls) or after a big change are not necessarily indicative of an error.
|
|
105
92
|
* If you encountered a timeout and it might be reasonable, just call this tool again.
|
|
106
93
|
* If the dev server is not building, it will return quickly, with the logs from the last build.
|
|
107
|
-
* A 'no_devserver_found' status can indicate the underlying server was stopped for some reason. Try first to call the "devserver.start"
|
|
108
|
-
tool again, before giving up.
|
|
109
94
|
</Operational Notes>
|
|
110
95
|
`,
|
|
111
96
|
isReadOnly: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devserver-wait-for-build.js","sourceRoot":"","sources":["devserver-wait-for-build.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;
|
|
1
|
+
{"version":3,"file":"devserver-wait-for-build.js","sourceRoot":"","sources":["devserver-wait-for-build.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAiDH,sDAkBC;AAjED,6BAAwB;AACxB,+CAA2F;AAC3F,yDAAkE;AAClE,uCAA4D;AAC5D,2DAAmE;AACnE,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,GAAG,2CAA0B;IAC7B,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,CAAC,CAAC;SAClD,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,E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CAAC;AACL,CAAC;AAEY,QAAA,6BAA6B,GAGtC,IAAA,2BAAW,EAAC;IACd,IAAI,EAAE,0BAA0B;IAChC,KAAK,EAAE,0BAA0B;IACjC,WAAW,EAAE;;;;;;;;;;;;;;;;;CAiBd;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"}
|
|
@@ -9,6 +9,7 @@ import { z } from 'zod';
|
|
|
9
9
|
import { type Host } from '../host';
|
|
10
10
|
import { type McpToolContext, type McpToolDeclaration } from './tool-registry';
|
|
11
11
|
declare const e2eToolInputSchema: z.ZodObject<{
|
|
12
|
+
workspace: z.ZodOptional<z.ZodString>;
|
|
12
13
|
project: z.ZodOptional<z.ZodString>;
|
|
13
14
|
}, z.core.$strip>;
|
|
14
15
|
export type E2eToolInput = z.infer<typeof e2eToolInputSchema>;
|
|
@@ -10,25 +10,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.E2E_TOOL = void 0;
|
|
11
11
|
exports.runE2e = runE2e;
|
|
12
12
|
const zod_1 = require("zod");
|
|
13
|
-
const
|
|
13
|
+
const shared_options_1 = require("../shared-options");
|
|
14
14
|
const utils_1 = require("../utils");
|
|
15
|
+
const workspace_utils_1 = require("../workspace-utils");
|
|
15
16
|
const tool_registry_1 = require("./tool-registry");
|
|
16
17
|
const e2eStatusSchema = zod_1.z.enum(['success', 'failure']);
|
|
17
18
|
const e2eToolInputSchema = zod_1.z.object({
|
|
18
|
-
|
|
19
|
-
.string()
|
|
20
|
-
.optional()
|
|
21
|
-
.describe('Which project to test in a monorepo context. If not provided, tests the default project.'),
|
|
19
|
+
...shared_options_1.workspaceAndProjectOptions,
|
|
22
20
|
});
|
|
23
21
|
const e2eToolOutputSchema = zod_1.z.object({
|
|
24
22
|
status: e2eStatusSchema.describe('E2E execution status.'),
|
|
25
23
|
logs: zod_1.z.array(zod_1.z.string()).optional().describe('Output logs from `ng e2e`.'),
|
|
26
24
|
});
|
|
27
25
|
async function runE2e(input, host, context) {
|
|
28
|
-
const projectName =
|
|
29
|
-
|
|
26
|
+
const { workspacePath, workspace, projectName } = await (0, workspace_utils_1.resolveWorkspaceAndProject)({
|
|
27
|
+
host,
|
|
28
|
+
workspacePathInput: input.workspace,
|
|
29
|
+
projectNameInput: input.project,
|
|
30
|
+
mcpWorkspace: context.workspace,
|
|
31
|
+
});
|
|
32
|
+
if (workspace && projectName) {
|
|
30
33
|
// Verify that if a project can be found, it has an e2e testing already set up.
|
|
31
|
-
const targetProject =
|
|
34
|
+
const targetProject = workspace.projects.get(projectName);
|
|
32
35
|
if (targetProject) {
|
|
33
36
|
if (!targetProject.targets.has('e2e')) {
|
|
34
37
|
return (0, utils_1.createStructuredContentOutput)({
|
|
@@ -43,14 +46,11 @@ async function runE2e(input, host, context) {
|
|
|
43
46
|
}
|
|
44
47
|
}
|
|
45
48
|
// Build "ng"'s command line.
|
|
46
|
-
const args = ['e2e'];
|
|
47
|
-
if (input.project) {
|
|
48
|
-
args.push(input.project);
|
|
49
|
-
}
|
|
49
|
+
const args = ['e2e', projectName];
|
|
50
50
|
let status = 'success';
|
|
51
51
|
let logs = [];
|
|
52
52
|
try {
|
|
53
|
-
logs = (await host.runCommand('ng', args)).logs;
|
|
53
|
+
logs = (await host.runCommand('ng', args, { cwd: workspacePath })).logs;
|
|
54
54
|
}
|
|
55
55
|
catch (e) {
|
|
56
56
|
status = 'failure';
|
|
@@ -82,6 +82,6 @@ Perform an end-to-end test with ng e2e.
|
|
|
82
82
|
isLocalOnly: true,
|
|
83
83
|
inputSchema: e2eToolInputSchema.shape,
|
|
84
84
|
outputSchema: e2eToolOutputSchema.shape,
|
|
85
|
-
factory: (context) => (input) => runE2e(input,
|
|
85
|
+
factory: (context) => (input) => runE2e(input, context.host, context),
|
|
86
86
|
});
|
|
87
87
|
//# sourceMappingURL=e2e.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e2e.js","sourceRoot":"","sources":["e2e.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;
|
|
1
|
+
{"version":3,"file":"e2e.js","sourceRoot":"","sources":["e2e.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAyBH,wBA4CC;AAnED,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,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;CAC5E,CAAC,CAAC;AAII,KAAK,UAAU,MAAM,CAAC,KAAmB,EAAE,IAAU,EAAE,OAAuB;IACnF,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,4CAA0B,EAAC;QACjF,IAAI;QACJ,kBAAkB,EAAE,KAAK,CAAC,SAAS;QACnC,gBAAgB,EAAE,KAAK,CAAC,OAAO;QAC/B,YAAY,EAAE,OAAO,CAAC,SAAS;KAChC,CAAC,CAAC;IAEH,IAAI,SAAS,IAAI,WAAW,EAAE,CAAC;QAC7B,+EAA+E;QAC/E,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EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;CACtE,CAAC,CAAC"}
|
|
@@ -6,13 +6,14 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { z } from 'zod';
|
|
9
|
-
import { type
|
|
10
|
-
import { type McpToolDeclaration } from './tool-registry';
|
|
9
|
+
import { type McpToolContext, type McpToolDeclaration } from './tool-registry';
|
|
11
10
|
declare const modernizeInputSchema: z.ZodObject<{
|
|
12
|
-
directories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
13
11
|
transformations: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
14
12
|
[x: string]: string;
|
|
15
13
|
}>>>;
|
|
14
|
+
path: z.ZodOptional<z.ZodString>;
|
|
15
|
+
workspace: z.ZodOptional<z.ZodString>;
|
|
16
|
+
project: z.ZodOptional<z.ZodString>;
|
|
16
17
|
}, z.core.$strip>;
|
|
17
18
|
declare const modernizeOutputSchema: z.ZodObject<{
|
|
18
19
|
instructions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -20,7 +21,7 @@ declare const modernizeOutputSchema: z.ZodObject<{
|
|
|
20
21
|
}, z.core.$strip>;
|
|
21
22
|
export type ModernizeInput = z.infer<typeof modernizeInputSchema>;
|
|
22
23
|
export type ModernizeOutput = z.infer<typeof modernizeOutputSchema>;
|
|
23
|
-
export declare function runModernization(input: ModernizeInput,
|
|
24
|
+
export declare function runModernization(input: ModernizeInput, context: McpToolContext): Promise<{
|
|
24
25
|
content: {
|
|
25
26
|
type: "text";
|
|
26
27
|
text: string;
|