@angular/cli 21.1.0-next.1 → 21.1.0-next.3
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/lib/code-examples.db +0 -0
- package/lib/config/schema.json +1 -2
- package/package.json +17 -17
- package/src/commands/add/cli.js +129 -87
- package/src/commands/add/cli.js.map +1 -1
- package/src/commands/mcp/cli.js +4 -1
- package/src/commands/mcp/cli.js.map +1 -1
- package/src/commands/mcp/{dev-server.d.ts → devserver.d.ts} +4 -4
- package/src/commands/mcp/{dev-server.js → devserver.js} +14 -14
- package/src/commands/mcp/devserver.js.map +1 -0
- package/src/commands/mcp/mcp-server.d.ts +30 -0
- package/src/commands/mcp/mcp-server.js +22 -7
- package/src/commands/mcp/mcp-server.js.map +1 -1
- package/src/commands/mcp/resources/ai-tutor.md +16 -15
- package/src/commands/mcp/tools/best-practices.js.map +1 -1
- package/src/commands/mcp/tools/build.js +2 -2
- package/src/commands/mcp/tools/build.js.map +1 -1
- package/src/commands/mcp/tools/devserver/{start-devserver.d.ts → devserver-start.d.ts} +6 -7
- package/src/commands/mcp/tools/devserver/{start-devserver.js → devserver-start.js} +26 -27
- package/src/commands/mcp/tools/devserver/devserver-start.js.map +1 -0
- package/src/commands/mcp/tools/devserver/{stop-devserver.d.ts → devserver-stop.d.ts} +6 -6
- package/src/commands/mcp/tools/devserver/{stop-devserver.js → devserver-stop.js} +13 -13
- package/src/commands/mcp/tools/devserver/{stop-devserver.js.map → devserver-stop.js.map} +1 -1
- package/src/commands/mcp/tools/devserver/{wait-for-devserver-build.d.ts → devserver-wait-for-build.d.ts} +6 -6
- package/src/commands/mcp/tools/devserver/{wait-for-devserver-build.js → devserver-wait-for-build.js} +16 -16
- package/src/commands/mcp/tools/devserver/{wait-for-devserver-build.js.map → devserver-wait-for-build.js.map} +1 -1
- package/src/commands/mcp/tools/modernize.js +1 -1
- package/src/commands/mcp/tools/modernize.js.map +1 -1
- package/src/commands/mcp/tools/projects.js +47 -8
- package/src/commands/mcp/tools/projects.js.map +1 -1
- package/src/commands/mcp/tools/tool-registry.d.ts +2 -2
- package/src/commands/mcp/tools/tool-registry.js.map +1 -1
- package/src/commands/update/cli.d.ts +0 -24
- package/src/commands/update/cli.js +39 -447
- package/src/commands/update/cli.js.map +1 -1
- package/src/commands/update/schematic/index.js +0 -12
- package/src/commands/update/schematic/index.js.map +1 -1
- package/src/commands/update/utilities/cli-version.d.ts +48 -0
- package/src/commands/update/utilities/cli-version.js +196 -0
- package/src/commands/update/utilities/cli-version.js.map +1 -0
- package/src/commands/update/utilities/constants.d.ts +12 -0
- package/src/commands/update/utilities/constants.js +16 -0
- package/src/commands/update/utilities/constants.js.map +1 -0
- package/src/commands/update/utilities/git.d.ts +36 -0
- package/src/commands/update/utilities/git.js +148 -0
- package/src/commands/update/utilities/git.js.map +1 -0
- package/src/commands/update/utilities/migration.d.ts +32 -0
- package/src/commands/update/utilities/migration.js +257 -0
- package/src/commands/update/utilities/migration.js.map +1 -0
- package/src/package-managers/error.d.ts +12 -0
- package/src/package-managers/host.js +7 -3
- package/src/package-managers/host.js.map +1 -1
- package/src/package-managers/package-manager-descriptor.d.ts +28 -4
- package/src/package-managers/package-manager-descriptor.js +24 -4
- package/src/package-managers/package-manager-descriptor.js.map +1 -1
- package/src/package-managers/package-manager.js +71 -8
- package/src/package-managers/package-manager.js.map +1 -1
- package/src/package-managers/parsers.d.ts +69 -4
- package/src/package-managers/parsers.js +231 -32
- package/src/package-managers/parsers.js.map +1 -1
- package/src/utilities/version.js +1 -1
- package/src/commands/mcp/dev-server.js.map +0 -1
- package/src/commands/mcp/tools/devserver/start-devserver.js.map +0 -1
|
@@ -8,6 +8,36 @@
|
|
|
8
8
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
9
9
|
import type { AngularWorkspace } from '../../utilities/config';
|
|
10
10
|
import { type AnyMcpToolDeclaration } from './tools/tool-registry';
|
|
11
|
+
/**
|
|
12
|
+
* Experimental tools that are grouped together under a single name.
|
|
13
|
+
*
|
|
14
|
+
* Used for enabling them as a group.
|
|
15
|
+
*/
|
|
16
|
+
export declare const EXPERIMENTAL_TOOL_GROUPS: {
|
|
17
|
+
devserver: (import("./tools/tool-registry").McpToolDeclaration<{
|
|
18
|
+
project: import("zod").ZodOptional<import("zod").ZodString>;
|
|
19
|
+
}, {
|
|
20
|
+
message: import("zod").ZodString;
|
|
21
|
+
address: import("zod").ZodOptional<import("zod").ZodString>;
|
|
22
|
+
}> | import("./tools/tool-registry").McpToolDeclaration<{
|
|
23
|
+
project: import("zod").ZodOptional<import("zod").ZodString>;
|
|
24
|
+
}, {
|
|
25
|
+
message: import("zod").ZodString;
|
|
26
|
+
logs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
27
|
+
}> | import("./tools/tool-registry").McpToolDeclaration<{
|
|
28
|
+
project: import("zod").ZodOptional<import("zod").ZodString>;
|
|
29
|
+
timeout: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
30
|
+
}, {
|
|
31
|
+
status: import("zod").ZodEnum<{
|
|
32
|
+
success: "success";
|
|
33
|
+
timeout: "timeout";
|
|
34
|
+
failure: "failure";
|
|
35
|
+
unknown: "unknown";
|
|
36
|
+
no_devserver_found: "no_devserver_found";
|
|
37
|
+
}>;
|
|
38
|
+
logs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
|
|
39
|
+
}>)[];
|
|
40
|
+
};
|
|
11
41
|
/**
|
|
12
42
|
* The set of tools that are available but not enabled by default.
|
|
13
43
|
* These tools are considered experimental and may have limitations.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.EXPERIMENTAL_TOOLS = void 0;
|
|
10
|
+
exports.EXPERIMENTAL_TOOLS = exports.EXPERIMENTAL_TOOL_GROUPS = void 0;
|
|
11
11
|
exports.createMcpServer = createMcpServer;
|
|
12
12
|
exports.assembleToolDeclarations = assembleToolDeclarations;
|
|
13
13
|
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
@@ -18,9 +18,9 @@ const instructions_1 = require("./resources/instructions");
|
|
|
18
18
|
const ai_tutor_1 = require("./tools/ai-tutor");
|
|
19
19
|
const best_practices_1 = require("./tools/best-practices");
|
|
20
20
|
const build_1 = require("./tools/build");
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
21
|
+
const devserver_start_1 = require("./tools/devserver/devserver-start");
|
|
22
|
+
const devserver_stop_1 = require("./tools/devserver/devserver-stop");
|
|
23
|
+
const devserver_wait_for_build_1 = require("./tools/devserver/devserver-wait-for-build");
|
|
24
24
|
const doc_search_1 = require("./tools/doc-search");
|
|
25
25
|
const index_1 = require("./tools/examples/index");
|
|
26
26
|
const modernize_1 = require("./tools/modernize");
|
|
@@ -30,7 +30,15 @@ const tool_registry_1 = require("./tools/tool-registry");
|
|
|
30
30
|
/**
|
|
31
31
|
* Tools to manage devservers. Should be bundled together, then added to experimental or stable as a group.
|
|
32
32
|
*/
|
|
33
|
-
const
|
|
33
|
+
const DEVSERVER_TOOLS = [devserver_start_1.DEVSERVER_START_TOOL, devserver_stop_1.DEVSERVER_STOP_TOOL, devserver_wait_for_build_1.DEVSERVER_WAIT_FOR_BUILD_TOOL];
|
|
34
|
+
/**
|
|
35
|
+
* Experimental tools that are grouped together under a single name.
|
|
36
|
+
*
|
|
37
|
+
* Used for enabling them as a group.
|
|
38
|
+
*/
|
|
39
|
+
exports.EXPERIMENTAL_TOOL_GROUPS = {
|
|
40
|
+
'devserver': DEVSERVER_TOOLS,
|
|
41
|
+
};
|
|
34
42
|
/**
|
|
35
43
|
* The set of tools that are enabled by default for the MCP server.
|
|
36
44
|
* These tools are considered stable and suitable for general use.
|
|
@@ -47,7 +55,7 @@ const STABLE_TOOLS = [
|
|
|
47
55
|
* The set of tools that are available but not enabled by default.
|
|
48
56
|
* These tools are considered experimental and may have limitations.
|
|
49
57
|
*/
|
|
50
|
-
exports.EXPERIMENTAL_TOOLS = [build_1.BUILD_TOOL, modernize_1.MODERNIZE_TOOL, ...
|
|
58
|
+
exports.EXPERIMENTAL_TOOLS = [build_1.BUILD_TOOL, modernize_1.MODERNIZE_TOOL, ...DEVSERVER_TOOLS];
|
|
51
59
|
async function createMcpServer(options, logger) {
|
|
52
60
|
const server = new mcp_js_1.McpServer({
|
|
53
61
|
name: 'angular-cli-server',
|
|
@@ -97,7 +105,7 @@ equivalent actions.
|
|
|
97
105
|
workspace: options.workspace,
|
|
98
106
|
logger,
|
|
99
107
|
exampleDatabasePath: (0, node_path_1.join)(__dirname, '../../../lib/code-examples.db'),
|
|
100
|
-
|
|
108
|
+
devservers: new Map(),
|
|
101
109
|
host: host_1.LocalWorkspaceHost,
|
|
102
110
|
}, toolDeclarations);
|
|
103
111
|
return server;
|
|
@@ -114,6 +122,13 @@ function assembleToolDeclarations(stableDeclarations, experimentalDeclarations,
|
|
|
114
122
|
if (process.env['NG_MCP_CODE_EXAMPLES'] === '1') {
|
|
115
123
|
enabledExperimentalTools.add('find_examples');
|
|
116
124
|
}
|
|
125
|
+
for (const [toolGroupName, toolGroup] of Object.entries(exports.EXPERIMENTAL_TOOL_GROUPS)) {
|
|
126
|
+
if (enabledExperimentalTools.delete(toolGroupName)) {
|
|
127
|
+
for (const tool of toolGroup) {
|
|
128
|
+
enabledExperimentalTools.add(tool.name);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
117
132
|
if (enabledExperimentalTools.size > 0) {
|
|
118
133
|
const experimentalToolsMap = new Map(experimentalDeclarations.map((tool) => [tool.name, tool]));
|
|
119
134
|
for (const toolName of enabledExperimentalTools) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["mcp-server.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;
|
|
1
|
+
{"version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AAC,CAAC;YAC1C,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,wBAAwB,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;QACtC,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QAEhG,KAAK,MAAM,QAAQ,IAAI,wBAAwB,EAAE,CAAC;YAChD,MAAM,IAAI,GAAG,oBAAoB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAChD,IAAI,IAAI,EAAE,CAAC;gBACT,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC9B,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,8BAA8B,QAAQ,EAAE,CAAC,CAAC;YAChE,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -327,8 +327,9 @@ When teaching or generating code for Phase 5 (Signal Forms), you **must** strict
|
|
|
327
327
|
- Use the `[field]` directive to bind a form control to an input.
|
|
328
328
|
- **Correct Syntax**: `<input [field]="myForm.username">` (Note: `field` is lowercase here).
|
|
329
329
|
- **Submission Logic**:
|
|
330
|
-
- Use the `submit()` utility function inside
|
|
331
|
-
- **Syntax**: `submit(this.myForm, async () => { /* logic */ })
|
|
330
|
+
- Use the `submit()` utility function inside the form's `(submit)` event handler.
|
|
331
|
+
- **Syntax**: Add `(submit)="save($event)"` to the `<form>` element and use `submit(this.myForm, async () => { /* logic */ })` in the handler.
|
|
332
|
+
- The handler must call `event.preventDefault()` to prevent the default form submission behavior.
|
|
332
333
|
- **Resetting Logic**:
|
|
333
334
|
- To reset the form, you must perform two actions:
|
|
334
335
|
1. **Clear Interaction State**: Call `.reset()` on the form signal's value: `this.myForm().reset()`.
|
|
@@ -344,7 +345,7 @@ When teaching or generating code for Phase 5 (Signal Forms), you **must** strict
|
|
|
344
345
|
```html
|
|
345
346
|
@if (myForm.email().invalid()) {
|
|
346
347
|
<ul>
|
|
347
|
-
@for (error of myForm.email().errors(); track error) {
|
|
348
|
+
@for (error of myForm.email().errors(); track error.kind) {
|
|
348
349
|
<li>{{ error.message }}</li>
|
|
349
350
|
}
|
|
350
351
|
</ul>
|
|
@@ -363,14 +364,14 @@ When teaching or generating code for Phase 5 (Signal Forms), you **must** strict
|
|
|
363
364
|
standalone: true,
|
|
364
365
|
imports: [Field],
|
|
365
366
|
template: `
|
|
366
|
-
<form>
|
|
367
|
+
<form (submit)="save($event)">
|
|
367
368
|
<label>
|
|
368
369
|
Email
|
|
369
370
|
<input [field]="loginForm.email" />
|
|
370
371
|
</label>
|
|
371
372
|
@if (loginForm.email().touched() && loginForm.email().invalid()) {
|
|
372
373
|
<p class="error">
|
|
373
|
-
@for (error of loginForm.email().errors(); track
|
|
374
|
+
@for (error of loginForm.email().errors(); track error.kind) {
|
|
374
375
|
<span>{{ error.message }}</span>
|
|
375
376
|
}
|
|
376
377
|
</p>
|
|
@@ -378,7 +379,7 @@ When teaching or generating code for Phase 5 (Signal Forms), you **must** strict
|
|
|
378
379
|
|
|
379
380
|
<label>Password <input type="password" [field]="loginForm.password" /></label>
|
|
380
381
|
|
|
381
|
-
<button
|
|
382
|
+
<button type="submit">Log In</button>
|
|
382
383
|
</form>
|
|
383
384
|
`,
|
|
384
385
|
})
|
|
@@ -553,7 +554,6 @@ _(The LLM will need to interpret "project-specific" or "app-themed" below based
|
|
|
553
554
|
- **Module 20 (Validation in Signal Forms)**
|
|
554
555
|
- **20a**: The component imports validator functions (e.g., `required`, `email`) from `@angular/forms/signals`. `description`: "importing functional validators."
|
|
555
556
|
- **20b**: The `form()` definition uses a validation callback. `description`: "defining the validation schema."
|
|
556
|
-
- **20c**: The button uses `[disabled]` bound to `myForm.invalid()`. `description`: "disabling the button for invalid forms."
|
|
557
557
|
- **Module 21 (Field State & Error Messages)**
|
|
558
558
|
- **21a**: The template uses an `@if` block checking `field().invalid()` (e.g., `myForm.name().invalid()`). `description`: "checking field invalidity."
|
|
559
559
|
- **21b**: Inside the check, an `@for` loop iterates over `field().errors()`. `description`: "iterating over validation errors."
|
|
@@ -804,20 +804,21 @@ touch src/app/mock-recipes.ts
|
|
|
804
804
|
|
|
805
805
|
**Exercise**: Your goal is to create a new `AddRecipe` component that uses the modern `Signal Forms` API. Import `form` and `Field` from `@angular/forms/signals`. Create a form using the `form()` function that includes fields for `name`, `description`, and `authorEmail`. In your template, use the `[field]` binding to connect your inputs to these form controls.
|
|
806
806
|
|
|
807
|
-
- **Module 19**: **Submitting & Resetting**: Concept: Handling form submission and resetting state. **Exercise**: Inject the service into your `AddRecipe` component. Create a protected `save()` method triggered by
|
|
808
|
-
1.
|
|
809
|
-
2.
|
|
810
|
-
3.
|
|
811
|
-
4.
|
|
812
|
-
5. **
|
|
807
|
+
- **Module 19**: **Submitting & Resetting**: Concept: Handling form submission and resetting state. **Exercise**: Inject the service into your `AddRecipe` component. Create a protected `save()` method triggered by the form's `(submit)` event. Inside this method:
|
|
808
|
+
1. Call `event.preventDefault()` to prevent the default form submission.
|
|
809
|
+
2. Use the `submit(this.myForm, ...)` utility.
|
|
810
|
+
3. Update the `RecipeService` to include an `addRecipe(newRecipe: RecipeModel)` method.
|
|
811
|
+
4. Construct a complete `RecipeModel` (merging form values with defaults) and pass it to the service.
|
|
812
|
+
5. **Reset the form**: Call `this.myForm().reset()` to clear interaction flags.
|
|
813
|
+
6. **Clear the values**: Call `this.myModel.set(...)` to reset the inputs.
|
|
813
814
|
|
|
814
815
|
- **Module 20**: **Validation in Signal Forms**: Concept: Applying functional validators. **Exercise**: Import `required` and `email` from `@angular/forms/signals`. Modify your `form()` definition to add a validation callback enforcing:
|
|
815
816
|
- `name`: Required (Message: 'Recipe name is required.').
|
|
816
817
|
- `description`: Required (Message: 'Description is required.').
|
|
817
818
|
- `authorEmail`: Required (Message: 'Author email is required.') AND Email format (Message: 'Please enter a valid email address.').
|
|
818
|
-
**Finally,
|
|
819
|
+
**Finally, ensure your submit button has `type="submit"`. Note: the `submit()` utility automatically handles validation by marking all fields as touched when submission is attempted.**
|
|
819
820
|
|
|
820
821
|
- **Module 21**: **Field State & Error Messages**: Concept: Providing user feedback by accessing field state signals. **Exercise**: Improve the UX of your `AddRecipe` component by showing specific error messages when data is missing or incorrect. In your template, for the `name`, `description`, and `authorEmail` inputs:
|
|
821
822
|
1. Create an `@if` block that checks if the field is `invalid()` (e.g., `myForm.name().invalid()`).
|
|
822
|
-
2. Inside the block, use `@for` to iterate over the field's `.errors()
|
|
823
|
+
2. Inside the block, use `@for` to iterate over the field's `.errors()` (use `track error.kind` to identify each error by its type).
|
|
823
824
|
3. Display the `error.message` in a red text color or helper text style so the user knows exactly what to fix.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"best-practices.js","sourceRoot":"","sources":["best-practices.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH;;;;;;;GAOG;AAEH,+CAAkD;AAClD,6CAA4C;AAC5C,yCAAyE;AACzE,6BAAwB;AACxB,wDAAqD;AACrD,mDAAmE;AAEnE,MAAM,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,aAAa,EAAE,OAAC;SACb,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,2FAA2F;QACzF,yFAAyF;QACzF,2FAA2F;QAC3F,6EAA6E,CAChF;CACJ,CAAC,CAAC;AAIU,QAAA,mBAAmB,GAAG,IAAA,2BAAW,EAAC;IAC7C,IAAI,EAAE,oBAAoB;IAC1B,KAAK,EAAE,yCAAyC;IAChD,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;qBAoBM;IACnB,WAAW,EAAE,wBAAwB,CAAC,KAAK;IAC3C,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,IAAI;IACjB,OAAO,EAAE,0BAA0B;CACpC,CAAC,CAAC;AAE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AA0B,CAAC,EAAE,MAAM,EAAkB;IAC5D,IAAI,oBAAqC,CAAC;IAE1C,OAAO,KAAK,EAAE,KAAyB,EAAE,EAAE;QACzC,IAAI,OAA2B,CAAC;QAChC,IAAI,MAA0B,CAAC;QAE/B,gDAAgD;QAChD,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;YACxB,MAAM,eAAe,GAAG,MAAM,+BAA+B,CAAC,KAAK,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;YAC3F,IAAI,eAAe,EAAE,CAAC;gBACpB,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC;gBAClC,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC;YAClC,CAAC;QACH,CAAC;QAED,gGAAgG;QAChG,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,GAAG,MAAM,CAAC,oBAAoB,KAAK,uBAAuB,EAAE,CAAC,CAAC;YACrE,MAAM,GAAG,iBAAiB,iBAAO,CAAC,IAAI,GAAG,CAAC;QAC5C,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,OAAO;oBACb,WAAW,EAAE;wBACX,QAAQ,EAAE,CAAC,WAAoB,CAAC;wBAChC,QAAQ,EAAE,GAAG;wBACb,MAAM;qBACP;iBACF;aACF;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -82,7 +82,7 @@ Perform a one-off, non-watched build using "ng build". Use this tool whenever th
|
|
|
82
82
|
</Use Cases>
|
|
83
83
|
<Operational Notes>
|
|
84
84
|
* This tool runs "ng build" so it expects to run within an Angular workspace.
|
|
85
|
-
* If you want a watched build which updates as files are changed, use "
|
|
85
|
+
* If you want a watched build which updates as files are changed, use "devserver.start" instead, which also serves the app.
|
|
86
86
|
* You can provide a project instead of building the root one. The "list_projects" MCP tool could be used to obtain the list of projects.
|
|
87
87
|
* This tool defaults to a development environment while a regular "ng build" defaults to a production environment. An unexpected build
|
|
88
88
|
failure might suggest the project is not configured for the requested environment.
|
|
@@ -92,6 +92,6 @@ Perform a one-off, non-watched build using "ng build". Use this tool whenever th
|
|
|
92
92
|
isLocalOnly: true,
|
|
93
93
|
inputSchema: buildToolInputSchema.shape,
|
|
94
94
|
outputSchema: buildToolOutputSchema.shape,
|
|
95
|
-
factory: () => (input) => runBuild(input,
|
|
95
|
+
factory: (context) => (input) => runBuild(input, context.host),
|
|
96
96
|
});
|
|
97
97
|
//# sourceMappingURL=build.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["build.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAmCH,4BAwCC;AAzED,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["build.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAmCH,4BAwCC;AAzED,6BAAwB;AACxB,kCAAkD;AAClD,oCAAyD;AACzD,mDAAuE;AAEvE,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,OAAO,EAAE,OAAC;SACP,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,4FAA4F,CAC7F;IACH,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,8BAA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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,IAAI,CAAC;CAC/D,CAAC,CAAC"}
|
|
@@ -6,18 +6,17 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { z } from 'zod';
|
|
9
|
-
import { type Host } from '../../host';
|
|
10
9
|
import { type McpToolContext, type McpToolDeclaration } from '../tool-registry';
|
|
11
|
-
declare const
|
|
10
|
+
declare const devserverStartToolInputSchema: z.ZodObject<{
|
|
12
11
|
project: z.ZodOptional<z.ZodString>;
|
|
13
12
|
}, z.core.$strip>;
|
|
14
|
-
export type
|
|
15
|
-
declare const
|
|
13
|
+
export type DevserverStartToolInput = z.infer<typeof devserverStartToolInputSchema>;
|
|
14
|
+
declare const devserverStartToolOutputSchema: z.ZodObject<{
|
|
16
15
|
message: z.ZodString;
|
|
17
16
|
address: z.ZodOptional<z.ZodString>;
|
|
18
17
|
}, z.core.$strip>;
|
|
19
|
-
export type
|
|
20
|
-
export declare function
|
|
18
|
+
export type DevserverStartToolOutput = z.infer<typeof devserverStartToolOutputSchema>;
|
|
19
|
+
export declare function startDevserver(input: DevserverStartToolInput, context: McpToolContext): Promise<{
|
|
21
20
|
content: {
|
|
22
21
|
type: "text";
|
|
23
22
|
text: string;
|
|
@@ -27,5 +26,5 @@ export declare function startDevServer(input: StartDevserverToolInput, context:
|
|
|
27
26
|
address: string;
|
|
28
27
|
};
|
|
29
28
|
}>;
|
|
30
|
-
export declare const
|
|
29
|
+
export declare const DEVSERVER_START_TOOL: McpToolDeclaration<typeof devserverStartToolInputSchema.shape, typeof devserverStartToolOutputSchema.shape>;
|
|
31
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.
|
|
11
|
-
exports.
|
|
10
|
+
exports.DEVSERVER_START_TOOL = void 0;
|
|
11
|
+
exports.startDevserver = startDevserver;
|
|
12
12
|
const zod_1 = require("zod");
|
|
13
|
-
const
|
|
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
|
|
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
|
|
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
|
|
34
|
-
const projectKey = (0,
|
|
35
|
-
let
|
|
36
|
-
if (
|
|
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(
|
|
38
|
+
address: localhostAddress(devserver.port),
|
|
40
39
|
});
|
|
41
40
|
}
|
|
42
|
-
const port = await host.getAvailablePort();
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
context.
|
|
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.
|
|
52
|
-
name: '
|
|
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 "
|
|
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 "
|
|
63
|
-
build errors, "
|
|
64
|
-
* **Get Updated Build Logs:** Important: as long as a devserver is alive (i.e. "
|
|
65
|
-
change to the workspace, re-run "
|
|
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 '
|
|
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:
|
|
77
|
-
outputSchema:
|
|
75
|
+
inputSchema: devserverStartToolInputSchema.shape,
|
|
76
|
+
outputSchema: devserverStartToolOutputSchema.shape,
|
|
78
77
|
factory: (context) => (input) => {
|
|
79
|
-
return
|
|
78
|
+
return startDevserver(input, context);
|
|
80
79
|
},
|
|
81
80
|
});
|
|
82
|
-
//# sourceMappingURL=start
|
|
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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,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"}
|
|
@@ -7,16 +7,16 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { type McpToolContext, type McpToolDeclaration } from '../tool-registry';
|
|
10
|
-
declare const
|
|
10
|
+
declare const devserverStopToolInputSchema: z.ZodObject<{
|
|
11
11
|
project: z.ZodOptional<z.ZodString>;
|
|
12
12
|
}, z.core.$strip>;
|
|
13
|
-
export type
|
|
14
|
-
declare const
|
|
13
|
+
export type DevserverStopToolInput = z.infer<typeof devserverStopToolInputSchema>;
|
|
14
|
+
declare const devserverStopToolOutputSchema: z.ZodObject<{
|
|
15
15
|
message: z.ZodString;
|
|
16
16
|
logs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
17
17
|
}, z.core.$strip>;
|
|
18
|
-
export type
|
|
19
|
-
export declare function stopDevserver(input:
|
|
18
|
+
export type DevserverStopToolOutput = z.infer<typeof devserverStopToolOutputSchema>;
|
|
19
|
+
export declare function stopDevserver(input: DevserverStopToolInput, context: McpToolContext): {
|
|
20
20
|
content: {
|
|
21
21
|
type: "text";
|
|
22
22
|
text: string;
|
|
@@ -35,5 +35,5 @@ export declare function stopDevserver(input: StopDevserverToolInput, context: Mc
|
|
|
35
35
|
logs: string[];
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
|
-
export declare const
|
|
38
|
+
export declare const DEVSERVER_STOP_TOOL: McpToolDeclaration<typeof devserverStopToolInputSchema.shape, typeof devserverStopToolOutputSchema.shape>;
|
|
39
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.
|
|
10
|
+
exports.DEVSERVER_STOP_TOOL = void 0;
|
|
11
11
|
exports.stopDevserver = stopDevserver;
|
|
12
12
|
const zod_1 = require("zod");
|
|
13
|
-
const
|
|
13
|
+
const devserver_1 = require("../../devserver");
|
|
14
14
|
const utils_1 = require("../../utils");
|
|
15
15
|
const tool_registry_1 = require("../tool-registry");
|
|
16
|
-
const
|
|
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
|
|
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,
|
|
28
|
-
const devServer = context.
|
|
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.
|
|
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.
|
|
43
|
-
name: '
|
|
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 "
|
|
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:
|
|
61
|
-
outputSchema:
|
|
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
|
|
66
|
+
//# sourceMappingURL=devserver-stop.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stop
|
|
1
|
+
{"version":3,"file":"devserver-stop.js","sourceRoot":"","sources":["devserver-stop.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAyBH,sCAkBC;AAzCD,6BAAwB;AACxB,+CAA+C;AAC/C,uCAA4D;AAC5D,oDAA6F;AAE7F,MAAM,4BAA4B,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5C,OAAO,EAAE,OAAC;SACP,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,yGAAyG,CAC1G;CAC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aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -11,12 +11,12 @@ import { type McpToolContext, type McpToolDeclaration } from '../tool-registry';
|
|
|
11
11
|
* How long to wait to give "ng serve" time to identify whether the watched workspace has changed.
|
|
12
12
|
*/
|
|
13
13
|
export declare const WATCH_DELAY = 1000;
|
|
14
|
-
declare const
|
|
14
|
+
declare const devserverWaitForBuildToolInputSchema: z.ZodObject<{
|
|
15
15
|
project: z.ZodOptional<z.ZodString>;
|
|
16
16
|
timeout: z.ZodDefault<z.ZodNumber>;
|
|
17
17
|
}, z.core.$strip>;
|
|
18
|
-
export type
|
|
19
|
-
declare const
|
|
18
|
+
export type DevserverWaitForBuildToolInput = z.infer<typeof devserverWaitForBuildToolInputSchema>;
|
|
19
|
+
declare const devserverWaitForBuildToolOutputSchema: z.ZodObject<{
|
|
20
20
|
status: z.ZodEnum<{
|
|
21
21
|
success: "success";
|
|
22
22
|
timeout: "timeout";
|
|
@@ -26,8 +26,8 @@ declare const waitForDevserverBuildToolOutputSchema: z.ZodObject<{
|
|
|
26
26
|
}>;
|
|
27
27
|
logs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
28
28
|
}, z.core.$strip>;
|
|
29
|
-
export type
|
|
30
|
-
export declare function waitForDevserverBuild(input:
|
|
29
|
+
export type DevserverWaitForBuildToolOutput = z.infer<typeof devserverWaitForBuildToolOutputSchema>;
|
|
30
|
+
export declare function waitForDevserverBuild(input: DevserverWaitForBuildToolInput, context: McpToolContext): Promise<{
|
|
31
31
|
content: {
|
|
32
32
|
type: "text";
|
|
33
33
|
text: string;
|
|
@@ -37,5 +37,5 @@ export declare function waitForDevserverBuild(input: WaitForDevserverBuildToolIn
|
|
|
37
37
|
logs?: string[] | undefined;
|
|
38
38
|
};
|
|
39
39
|
}>;
|
|
40
|
-
export declare const
|
|
40
|
+
export declare const DEVSERVER_WAIT_FOR_BUILD_TOOL: McpToolDeclaration<typeof devserverWaitForBuildToolInputSchema.shape, typeof devserverWaitForBuildToolOutputSchema.shape>;
|
|
41
41
|
export {};
|