@angular/cli 20.1.0 → 20.1.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.
- package/package.json +14 -13
- package/src/commands/mcp/constants.d.ts +10 -0
- package/src/commands/mcp/constants.js +15 -0
- package/src/commands/mcp/mcp-server.js +2 -0
- package/src/commands/mcp/tools/doc-search.d.ts +16 -0
- package/src/commands/mcp/tools/doc-search.js +130 -0
- package/src/utilities/version.js +1 -1
- package/src/commands/mcp/component-generation-prompt.md +0 -60
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/cli",
|
|
3
|
-
"version": "20.1.
|
|
3
|
+
"version": "20.1.1",
|
|
4
4
|
"description": "CLI tool for Angular",
|
|
5
5
|
"main": "lib/cli/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -25,14 +25,15 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://github.com/angular/angular-cli",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@angular-devkit/architect": "0.2001.
|
|
29
|
-
"@angular-devkit/core": "20.1.
|
|
30
|
-
"@angular-devkit/schematics": "20.1.
|
|
28
|
+
"@angular-devkit/architect": "0.2001.1",
|
|
29
|
+
"@angular-devkit/core": "20.1.1",
|
|
30
|
+
"@angular-devkit/schematics": "20.1.1",
|
|
31
31
|
"@inquirer/prompts": "7.6.0",
|
|
32
32
|
"@listr2/prompt-adapter-inquirer": "2.0.22",
|
|
33
33
|
"@modelcontextprotocol/sdk": "1.13.3",
|
|
34
|
-
"@schematics/angular": "20.1.
|
|
34
|
+
"@schematics/angular": "20.1.1",
|
|
35
35
|
"@yarnpkg/lockfile": "1.1.0",
|
|
36
|
+
"algoliasearch": "5.32.0",
|
|
36
37
|
"ini": "5.0.0",
|
|
37
38
|
"jsonc-parser": "3.3.1",
|
|
38
39
|
"listr2": "8.3.3",
|
|
@@ -47,14 +48,14 @@
|
|
|
47
48
|
"ng-update": {
|
|
48
49
|
"migrations": "@schematics/angular/migrations/migration-collection.json",
|
|
49
50
|
"packageGroup": {
|
|
50
|
-
"@angular/cli": "20.1.
|
|
51
|
-
"@angular/build": "20.1.
|
|
52
|
-
"@angular/ssr": "20.1.
|
|
53
|
-
"@angular-devkit/architect": "0.2001.
|
|
54
|
-
"@angular-devkit/build-angular": "20.1.
|
|
55
|
-
"@angular-devkit/build-webpack": "0.2001.
|
|
56
|
-
"@angular-devkit/core": "20.1.
|
|
57
|
-
"@angular-devkit/schematics": "20.1.
|
|
51
|
+
"@angular/cli": "20.1.1",
|
|
52
|
+
"@angular/build": "20.1.1",
|
|
53
|
+
"@angular/ssr": "20.1.1",
|
|
54
|
+
"@angular-devkit/architect": "0.2001.1",
|
|
55
|
+
"@angular-devkit/build-angular": "20.1.1",
|
|
56
|
+
"@angular-devkit/build-webpack": "0.2001.1",
|
|
57
|
+
"@angular-devkit/core": "20.1.1",
|
|
58
|
+
"@angular-devkit/schematics": "20.1.1"
|
|
58
59
|
}
|
|
59
60
|
},
|
|
60
61
|
"packageManager": "pnpm@9.15.9",
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
export declare const k1 = "@angular/cli";
|
|
9
|
+
export declare const at = "QBHBbOdEO4CmBOC2d7jNmg==";
|
|
10
|
+
export declare const iv: Buffer<ArrayBuffer>;
|
|
@@ -0,0 +1,15 @@
|
|
|
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.iv = exports.at = exports.k1 = void 0;
|
|
11
|
+
exports.k1 = '@angular/cli';
|
|
12
|
+
exports.at = 'QBHBbOdEO4CmBOC2d7jNmg==';
|
|
13
|
+
exports.iv = Buffer.from([
|
|
14
|
+
0x97, 0xf4, 0x62, 0x95, 0x3e, 0x12, 0x76, 0x84, 0x8a, 0x09, 0x4a, 0xc9, 0xeb, 0xa2, 0x84, 0x69,
|
|
15
|
+
]);
|
|
@@ -16,6 +16,7 @@ const promises_1 = require("node:fs/promises");
|
|
|
16
16
|
const node_path_1 = __importDefault(require("node:path"));
|
|
17
17
|
const zod_1 = require("zod");
|
|
18
18
|
const version_1 = require("../../utilities/version");
|
|
19
|
+
const doc_search_1 = require("./tools/doc-search");
|
|
19
20
|
async function createMcpServer(context) {
|
|
20
21
|
const server = new mcp_js_1.McpServer({
|
|
21
22
|
name: 'angular-cli-server',
|
|
@@ -102,5 +103,6 @@ async function createMcpServer(context) {
|
|
|
102
103
|
structuredContent: { projects },
|
|
103
104
|
};
|
|
104
105
|
});
|
|
106
|
+
await (0, doc_search_1.registerDocSearchTool)(server);
|
|
105
107
|
return server;
|
|
106
108
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
9
|
+
/**
|
|
10
|
+
* Registers a tool with the MCP server to search the Angular documentation.
|
|
11
|
+
*
|
|
12
|
+
* This tool uses Algolia to search the official Angular documentation.
|
|
13
|
+
*
|
|
14
|
+
* @param server The MCP server instance with which to register the tool.
|
|
15
|
+
*/
|
|
16
|
+
export declare function registerDocSearchTool(server: McpServer): Promise<void>;
|
|
@@ -0,0 +1,130 @@
|
|
|
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
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.registerDocSearchTool = registerDocSearchTool;
|
|
44
|
+
const node_crypto_1 = require("node:crypto");
|
|
45
|
+
const zod_1 = require("zod");
|
|
46
|
+
const constants_1 = require("../constants");
|
|
47
|
+
const ALGOLIA_APP_ID = 'L1XWT2UJ7F';
|
|
48
|
+
// https://www.algolia.com/doc/guides/security/api-keys/#search-only-api-key
|
|
49
|
+
// This is a search only, rate limited key. It is sent within the URL of the query request.
|
|
50
|
+
// This is not the actual key.
|
|
51
|
+
const ALGOLIA_API_E = '322d89dab5f2080fe09b795c93413c6a89222b13a447cdf3e6486d692717bc0c';
|
|
52
|
+
/**
|
|
53
|
+
* Registers a tool with the MCP server to search the Angular documentation.
|
|
54
|
+
*
|
|
55
|
+
* This tool uses Algolia to search the official Angular documentation.
|
|
56
|
+
*
|
|
57
|
+
* @param server The MCP server instance with which to register the tool.
|
|
58
|
+
*/
|
|
59
|
+
async function registerDocSearchTool(server) {
|
|
60
|
+
let client;
|
|
61
|
+
server.registerTool('search_documentation', {
|
|
62
|
+
title: 'Search Angular Documentation (angular.dev)',
|
|
63
|
+
description: 'Searches the official Angular documentation on https://angular.dev.' +
|
|
64
|
+
' This tool is useful for finding the most up-to-date information on Angular, including APIs, tutorials, and best practices.' +
|
|
65
|
+
' Use this when creating Angular specific code or answering questions that require knowledge of the latest Angular features.',
|
|
66
|
+
annotations: {
|
|
67
|
+
readOnlyHint: true,
|
|
68
|
+
},
|
|
69
|
+
inputSchema: {
|
|
70
|
+
query: zod_1.z
|
|
71
|
+
.string()
|
|
72
|
+
.describe('The search query to use when searching the Angular documentation.' +
|
|
73
|
+
' This should be a concise and specific query to get the most relevant results.'),
|
|
74
|
+
},
|
|
75
|
+
}, async ({ query }) => {
|
|
76
|
+
if (!client) {
|
|
77
|
+
const dcip = (0, node_crypto_1.createDecipheriv)('aes-256-gcm', (constants_1.k1 + ALGOLIA_APP_ID).padEnd(32, '^'), constants_1.iv).setAuthTag(Buffer.from(constants_1.at, 'base64'));
|
|
78
|
+
const { searchClient } = await Promise.resolve().then(() => __importStar(require('algoliasearch')));
|
|
79
|
+
client = searchClient(ALGOLIA_APP_ID, dcip.update(ALGOLIA_API_E, 'hex', 'utf-8') + dcip.final('utf-8'));
|
|
80
|
+
}
|
|
81
|
+
const { results } = await client.search(createSearchArguments(query));
|
|
82
|
+
// Convert results into text content entries instead of stringifying the entire object
|
|
83
|
+
const content = results.flatMap((result) => result.hits.map((hit) => {
|
|
84
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
85
|
+
const hierarchy = Object.values(hit.hierarchy).filter((x) => typeof x === 'string');
|
|
86
|
+
const title = hierarchy.pop();
|
|
87
|
+
const description = hierarchy.join(' > ');
|
|
88
|
+
return {
|
|
89
|
+
type: 'text',
|
|
90
|
+
text: `## ${title}\n${description}\nURL: ${hit.url}`,
|
|
91
|
+
};
|
|
92
|
+
}));
|
|
93
|
+
return { content };
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Creates the search arguments for an Algolia search.
|
|
98
|
+
*
|
|
99
|
+
* The arguments are based on the search implementation in `adev`.
|
|
100
|
+
*
|
|
101
|
+
* @param query The search query string.
|
|
102
|
+
* @returns The search arguments for the Algolia client.
|
|
103
|
+
*/
|
|
104
|
+
function createSearchArguments(query) {
|
|
105
|
+
// Search arguments are based on adev's search service:
|
|
106
|
+
// https://github.com/angular/angular/blob/4b614fbb3263d344dbb1b18fff24cb09c5a7582d/adev/shared-docs/services/search.service.ts#L58
|
|
107
|
+
return [
|
|
108
|
+
{
|
|
109
|
+
// TODO: Consider major version specific indices once available
|
|
110
|
+
indexName: 'angular_v17',
|
|
111
|
+
params: {
|
|
112
|
+
query,
|
|
113
|
+
attributesToRetrieve: [
|
|
114
|
+
'hierarchy.lvl0',
|
|
115
|
+
'hierarchy.lvl1',
|
|
116
|
+
'hierarchy.lvl2',
|
|
117
|
+
'hierarchy.lvl3',
|
|
118
|
+
'hierarchy.lvl4',
|
|
119
|
+
'hierarchy.lvl5',
|
|
120
|
+
'hierarchy.lvl6',
|
|
121
|
+
'content',
|
|
122
|
+
'type',
|
|
123
|
+
'url',
|
|
124
|
+
],
|
|
125
|
+
hitsPerPage: 10,
|
|
126
|
+
},
|
|
127
|
+
type: 'default',
|
|
128
|
+
},
|
|
129
|
+
];
|
|
130
|
+
}
|
package/src/utilities/version.js
CHANGED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# Angular Component Generation Prompt
|
|
2
|
-
|
|
3
|
-
## Role and Goal
|
|
4
|
-
|
|
5
|
-
You are an expert Angular developer specializing in creating modern, high-quality components. Your goal is to generate a new Angular component based on user requirements, ensuring it follows the latest best practices and style guidelines.
|
|
6
|
-
|
|
7
|
-
## Context
|
|
8
|
-
|
|
9
|
-
You are operating within an existing Angular CLI project. You have access to the project's file system and can use tools to interact with the Angular CLI for code generation.
|
|
10
|
-
|
|
11
|
-
## Instructions
|
|
12
|
-
|
|
13
|
-
Follow these steps to fulfill the user's request:
|
|
14
|
-
|
|
15
|
-
### 1. Analyze the User's Request
|
|
16
|
-
|
|
17
|
-
Carefully analyze the user's instructions to extract the following details:
|
|
18
|
-
|
|
19
|
-
- **Component Name:** The desired name for the component (e.g., 'UserProfile', 'LoginFormComponent'). Use this to form the file name and selector.
|
|
20
|
-
- **Inputs/Outputs:** Any `input()` or `output()` properties the component needs.
|
|
21
|
-
- **Component Logic:** The business logic, properties, and methods to be implemented in the component's class.
|
|
22
|
-
- **Template Structure:** The HTML structure for the component's template.
|
|
23
|
-
- **Styling:** Any CSS styles or style requirements for the component.
|
|
24
|
-
- **CLI Options:** Any specific options for the `ng generate` command, such as `--style=scss`, `--skip-tests=true`, `--view-encapsulation=Emulated`, etc.
|
|
25
|
-
|
|
26
|
-
### 2. Generate the Base Component
|
|
27
|
-
|
|
28
|
-
You MUST generate the initial component files using the Angular CLI. Use the following methods in order of preference:
|
|
29
|
-
|
|
30
|
-
**Preference 1: Use the `generate_component` tool (if available)**
|
|
31
|
-
|
|
32
|
-
- This is the preferred method.
|
|
33
|
-
- Use the details extracted from the user's request to provide the necessary parameters.
|
|
34
|
-
- Always generate a **standalone** component unless explicitly told otherwise.
|
|
35
|
-
|
|
36
|
-
**Preference 2: Use the `run_shell_command` tool**
|
|
37
|
-
|
|
38
|
-
- If a dedicated `generate_component` tool is not available, fall back to using the shell command.
|
|
39
|
-
- Construct the command like this: `ng generate component <component-name> [options...]`
|
|
40
|
-
- **Default Options:** Always include `--standalone` to create a standalone component.
|
|
41
|
-
- **User-Defined Options:** Add any other options derived from the user's request.
|
|
42
|
-
|
|
43
|
-
### 3. Read the Generated Files
|
|
44
|
-
|
|
45
|
-
After the CLI has generated the base files, use the `read_file` tool to get the content of the newly created:
|
|
46
|
-
- Component TypeScript file (`<component-name>.component.ts`)
|
|
47
|
-
- Component template file (`<component-name>.component.html`)
|
|
48
|
-
- Component stylesheet (`<component-name>.component.css`, etc.)
|
|
49
|
-
|
|
50
|
-
### 4. Modify the Code
|
|
51
|
-
|
|
52
|
-
Modify the code from the generated files to implement the specific logic, template, and styling from the user's instructions. Ensure the final code is complete, correct, and adheres to the latest Angular best practices.
|
|
53
|
-
|
|
54
|
-
- **Class:** Add the required properties, `input()`/`output()` functions, methods, and other logic to the component's class.
|
|
55
|
-
- **Template:** Build the HTML structure in the template file. Use native control flow (`@if`, `@for`, `@switch`) instead of structural directives (`*ngIf`, `*ngFor`).
|
|
56
|
-
- **Stylesheet:** Add the necessary styles to the stylesheet.
|
|
57
|
-
|
|
58
|
-
### 5. Final Output
|
|
59
|
-
|
|
60
|
-
Present the complete, final code for each modified file. Do not show diffs or partial code snippets. The user should be able to copy and paste the code directly into their project.
|