@rushstack/mcp-server 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +24 -0
- package/CHANGELOG.md +15 -1
- package/lib/pluginFramework/RushMcpPluginLoader.d.ts +1 -4
- package/lib/pluginFramework/RushMcpPluginLoader.d.ts.map +1 -1
- package/lib/pluginFramework/RushMcpPluginLoader.js +11 -4
- package/lib/pluginFramework/RushMcpPluginLoader.js.map +1 -1
- package/lib/schemas/rush-mcp.schema.json +0 -4
- package/lib/server.d.ts.map +1 -1
- package/lib/server.js +0 -1
- package/lib/server.js.map +1 -1
- package/lib/start.js +47 -2
- package/lib/start.js.map +1 -1
- package/lib/tools/index.d.ts +0 -1
- package/lib/tools/index.d.ts.map +1 -1
- package/lib/tools/index.js +0 -1
- package/lib/tools/index.js.map +1 -1
- package/package.json +5 -5
- package/lib/rush-doc-fragment.mock.json +0 -18
- package/lib/tools/docs.tool.d.ts +0 -9
- package/lib/tools/docs.tool.d.ts.map +0 -1
- package/lib/tools/docs.tool.js +0 -47
- package/lib/tools/docs.tool.js.map +0 -1
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/mcp-server",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.2.2",
|
|
6
|
+
"tag": "@rushstack/mcp-server_v0.2.2",
|
|
7
|
+
"date": "Sat, 14 Jun 2025 00:11:30 GMT",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Move the `rush docs` tool to a plugin package `@rushstack/rush-mcp-docs-plugin`"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"version": "0.2.1",
|
|
18
|
+
"tag": "@rushstack/mcp-server_v0.2.1",
|
|
19
|
+
"date": "Fri, 06 Jun 2025 08:20:18 GMT",
|
|
20
|
+
"comments": {
|
|
21
|
+
"patch": [
|
|
22
|
+
{
|
|
23
|
+
"comment": "Fix some errors when loading plugins"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
4
28
|
{
|
|
5
29
|
"version": "0.2.0",
|
|
6
30
|
"tag": "@rushstack/mcp-server_v0.2.0",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
# Change Log - @rushstack/mcp-server
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Sat, 14 Jun 2025 00:11:30 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 0.2.2
|
|
6
|
+
Sat, 14 Jun 2025 00:11:30 GMT
|
|
7
|
+
|
|
8
|
+
### Patches
|
|
9
|
+
|
|
10
|
+
- Move the `rush docs` tool to a plugin package `@rushstack/rush-mcp-docs-plugin`
|
|
11
|
+
|
|
12
|
+
## 0.2.1
|
|
13
|
+
Fri, 06 Jun 2025 08:20:18 GMT
|
|
14
|
+
|
|
15
|
+
### Patches
|
|
16
|
+
|
|
17
|
+
- Fix some errors when loading plugins
|
|
4
18
|
|
|
5
19
|
## 0.2.0
|
|
6
20
|
Fri, 06 Jun 2025 00:11:09 GMT
|
|
@@ -22,10 +22,6 @@ export interface IJsonRushMcpPlugin {
|
|
|
22
22
|
* @rushstack/mcp-server will ensure this folder is installed before loading the plugin.
|
|
23
23
|
*/
|
|
24
24
|
autoinstaller: string;
|
|
25
|
-
/**
|
|
26
|
-
* The name of the plugin. This is used to identify the plugin in the MCP server.
|
|
27
|
-
*/
|
|
28
|
-
pluginName: string;
|
|
29
25
|
}
|
|
30
26
|
/**
|
|
31
27
|
* Manifest file for a Rush MCP plugin.
|
|
@@ -55,6 +51,7 @@ export declare class RushMcpPluginLoader {
|
|
|
55
51
|
private readonly _rushWorkspacePath;
|
|
56
52
|
private readonly _mcpServer;
|
|
57
53
|
constructor(rushWorkspacePath: string, mcpServer: McpServer);
|
|
54
|
+
private static _formatError;
|
|
58
55
|
loadAsync(): Promise<void>;
|
|
59
56
|
}
|
|
60
57
|
//# sourceMappingURL=RushMcpPluginLoader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RushMcpPluginLoader.d.ts","sourceRoot":"","sources":["../../src/pluginFramework/RushMcpPluginLoader.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAQtE;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,UAAU,EAAE,kBAAkB,EAAE,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"RushMcpPluginLoader.d.ts","sourceRoot":"","sources":["../../src/pluginFramework/RushMcpPluginLoader.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAQtE;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,UAAU,EAAE,kBAAkB,EAAE,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CACa;IACvD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,0BAA0B,CACO;IAEzD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAS;IAC5C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;gBAEpB,iBAAiB,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS;IAKlE,OAAO,CAAC,MAAM,CAAC,YAAY;IAId,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;CAgHxC"}
|
|
@@ -52,6 +52,10 @@ class RushMcpPluginLoader {
|
|
|
52
52
|
this._rushWorkspacePath = rushWorkspacePath;
|
|
53
53
|
this._mcpServer = mcpServer;
|
|
54
54
|
}
|
|
55
|
+
static _formatError(e) {
|
|
56
|
+
var _a;
|
|
57
|
+
return (_a = e.stack) !== null && _a !== void 0 ? _a : RushMcpPluginLoader._formatError(e);
|
|
58
|
+
}
|
|
55
59
|
async loadAsync() {
|
|
56
60
|
const rushMcpFilePath = path.join(this._rushWorkspacePath, 'common/config/rush-mcp/rush-mcp.json');
|
|
57
61
|
if (!(await node_core_library_1.FileSystem.existsAsync(rushMcpFilePath))) {
|
|
@@ -91,7 +95,7 @@ class RushMcpPluginLoader {
|
|
|
91
95
|
if (jsonManifest.configFileSchema) {
|
|
92
96
|
const mcpPluginSchemaFilePath = path.resolve(installedPluginPackageFolder, jsonManifest.configFileSchema);
|
|
93
97
|
const mcpPluginSchema = await node_core_library_1.JsonSchema.fromFile(mcpPluginSchemaFilePath);
|
|
94
|
-
const rushMcpPluginOptionsFilePath = path.resolve(this._rushWorkspacePath, `common/config/rush-mcp/${
|
|
98
|
+
const rushMcpPluginOptionsFilePath = path.resolve(this._rushWorkspacePath, `common/config/rush-mcp/${jsonManifest.pluginName}.json`);
|
|
95
99
|
// Example: /path/to/my-repo/common/config/rush-mcp/rush-mcp-example-plugin.json
|
|
96
100
|
rushMcpPluginOptions = await node_core_library_1.JsonFile.loadAndValidateAsync(rushMcpPluginOptionsFilePath, mcpPluginSchema);
|
|
97
101
|
}
|
|
@@ -105,7 +109,8 @@ class RushMcpPluginLoader {
|
|
|
105
109
|
pluginFactory = entryPointModule.default;
|
|
106
110
|
}
|
|
107
111
|
catch (e) {
|
|
108
|
-
throw new Error(`Unable to load plugin entry point at ${fullEntryPointPath}
|
|
112
|
+
throw new Error(`Unable to load plugin entry point at ${fullEntryPointPath}:\n` +
|
|
113
|
+
RushMcpPluginLoader._formatError(e));
|
|
109
114
|
}
|
|
110
115
|
const session = new RushMcpPluginSession_1.RushMcpPluginSessionInternal(this._mcpServer);
|
|
111
116
|
let plugin;
|
|
@@ -113,13 +118,15 @@ class RushMcpPluginLoader {
|
|
|
113
118
|
plugin = pluginFactory(session, rushMcpPluginOptions);
|
|
114
119
|
}
|
|
115
120
|
catch (e) {
|
|
116
|
-
throw new Error(`Error invoking entry point for plugin ${jsonManifest.pluginName}
|
|
121
|
+
throw new Error(`Error invoking entry point for plugin ${jsonManifest.pluginName}:\n` +
|
|
122
|
+
RushMcpPluginLoader._formatError(e));
|
|
117
123
|
}
|
|
118
124
|
try {
|
|
119
125
|
await plugin.onInitializeAsync();
|
|
120
126
|
}
|
|
121
127
|
catch (e) {
|
|
122
|
-
throw new Error(`Error occurred in onInitializeAsync() for plugin ${jsonManifest.pluginName}
|
|
128
|
+
throw new Error(`Error occurred in onInitializeAsync() for plugin ${jsonManifest.pluginName}:\n` +
|
|
129
|
+
RushMcpPluginLoader._formatError(e));
|
|
123
130
|
}
|
|
124
131
|
}
|
|
125
132
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RushMcpPluginLoader.js","sourceRoot":"","sources":["../../src/pluginFramework/RushMcpPluginLoader.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,oEAAyG;AACzG,+EAA4E;AAC5E,mFAAgF;AAChF,qFAAkF;AAIlF,iEAAsE;AAEtE,2FAAsE;AAC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,GAAG,gBAAgB,CAAC,OAAO,CAAC;YAC3C,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,MAAM,IAAI,KAAK,CAAC,wCAAwC,kBAAkB,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;YACjG,CAAC;YAED,MAAM,OAAO,GAAiC,IAAI,mDAA4B,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAEhG,IAAI,MAAsB,CAAC;YAC3B,IAAI,CAAC;gBACH,MAAM,GAAG,aAAa,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;YACxD,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,MAAM,IAAI,KAAK,CAAC,yCAAyC,YAAY,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;YACtG,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,MAAM,CAAC,iBAAiB,EAAE,CAAC;YACnC,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,MAAM,IAAI,KAAK,CACb,oDAAoD,YAAY,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC,QAAQ,EAAE,CAC9F,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;;AAtHH,kDAuHC;AAtHyB,sCAAkB,GACxC,8BAAU,CAAC,gBAAgB,CAAC,8BAAuB,CAAC,CAAC;AAC/B,8CAA0B,GAChD,8BAAU,CAAC,gBAAgB,CAAC,qCAAyB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'path';\nimport { FileSystem, Import, JsonFile, type JsonObject, JsonSchema } from '@rushstack/node-core-library';\nimport { Autoinstaller } from '@rushstack/rush-sdk/lib/logic/Autoinstaller';\nimport { RushGlobalFolder } from '@rushstack/rush-sdk/lib/api/RushGlobalFolder';\nimport { RushConfiguration } from '@rushstack/rush-sdk/lib/api/RushConfiguration';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp';\n\nimport type { IRushMcpPlugin, RushMcpPluginFactory } from './IRushMcpPlugin';\nimport { RushMcpPluginSessionInternal } from './RushMcpPluginSession';\n\nimport rushMcpJsonSchemaObject from '../schemas/rush-mcp.schema.json';\nimport rushMcpPluginSchemaObject from '../schemas/rush-mcp-plugin.schema.json';\n\n/**\n * Configuration for @rushstack/mcp-server in a monorepo.\n * Corresponds to the contents of common/config/rush-mcp/rush-mcp.json\n */\nexport interface IJsonRushMcpConfig {\n /**\n * The list of plugins that @rushstack/mcp-server should load when processing this monorepo.\n */\n mcpPlugins: IJsonRushMcpPlugin[];\n}\n\n/**\n * Describes a single MCP plugin entry.\n */\nexport interface IJsonRushMcpPlugin {\n /**\n * The name of an NPM package that appears in the package.json \"dependencies\" for the autoinstaller.\n */\n packageName: string;\n\n /**\n * The name of a Rush autoinstaller with this package as its dependency.\n * @rushstack/mcp-server will ensure this folder is installed before loading the plugin.\n */\n autoinstaller: string;\n\n /**\n * The name of the plugin. This is used to identify the plugin in the MCP server.\n */\n pluginName: string;\n}\n\n/**\n * Manifest file for a Rush MCP plugin.\n * Every plugin package must contain a \"rush-mcp-plugin.json\" manifest in the top-level folder.\n */\nexport interface IJsonRushMcpPluginManifest {\n /**\n * A name that uniquely identifies your plugin.\n * Generally this should match the NPM package name; two plugins with the same pluginName cannot be loaded together.\n */\n pluginName: string;\n\n /**\n * Optional. Indicates that your plugin accepts a config file.\n * The MCP server will load this schema file and provide it to the plugin.\n * Path is typically `<rush-repo>/common/config/rush-mcp/<plugin-name>.json`.\n */\n configFileSchema?: string;\n\n /**\n * The module path to the plugin's entry point.\n * Its default export must be a class implementing the MCP plugin interface.\n */\n entryPoint: string;\n}\n\nexport class RushMcpPluginLoader {\n private static readonly _rushMcpJsonSchema: JsonSchema =\n JsonSchema.fromLoadedObject(rushMcpJsonSchemaObject);\n private static readonly _rushMcpPluginSchemaObject: JsonSchema =\n JsonSchema.fromLoadedObject(rushMcpPluginSchemaObject);\n\n private readonly _rushWorkspacePath: string;\n private readonly _mcpServer: McpServer;\n\n public constructor(rushWorkspacePath: string, mcpServer: McpServer) {\n this._rushWorkspacePath = rushWorkspacePath;\n this._mcpServer = mcpServer;\n }\n\n public async loadAsync(): Promise<void> {\n const rushMcpFilePath: string = path.join(\n this._rushWorkspacePath,\n 'common/config/rush-mcp/rush-mcp.json'\n );\n\n if (!(await FileSystem.existsAsync(rushMcpFilePath))) {\n return;\n }\n\n const rushConfiguration: RushConfiguration = RushConfiguration.loadFromDefaultLocation({\n startingFolder: this._rushWorkspacePath\n });\n\n const jsonRushMcpConfig: IJsonRushMcpConfig = await JsonFile.loadAndValidateAsync(\n rushMcpFilePath,\n RushMcpPluginLoader._rushMcpJsonSchema\n );\n\n if (jsonRushMcpConfig.mcpPlugins.length === 0) {\n return;\n }\n\n const rushGlobalFolder: RushGlobalFolder = new RushGlobalFolder();\n\n for (const jsonMcpPlugin of jsonRushMcpConfig.mcpPlugins) {\n // Ensure the autoinstaller is installed\n const autoinstaller: Autoinstaller = new Autoinstaller({\n autoinstallerName: jsonMcpPlugin.autoinstaller,\n rushConfiguration,\n rushGlobalFolder,\n restrictConsoleOutput: false\n });\n await autoinstaller.prepareAsync();\n\n // Load the manifest\n\n // Suppose the autoinstaller is \"my-autoinstaller\" and the package is \"rush-mcp-example-plugin\".\n // Then the folder will be:\n // \"/path/to/my-repo/common/autoinstallers/my-autoinstaller/node_modules/rush-mcp-example-plugin\"\n const installedPluginPackageFolder: string = await Import.resolvePackageAsync({\n baseFolderPath: autoinstaller.folderFullPath,\n packageName: jsonMcpPlugin.packageName\n });\n\n const manifestFilePath: string = path.join(installedPluginPackageFolder, 'rush-mcp-plugin.json');\n if (!(await FileSystem.existsAsync(manifestFilePath))) {\n throw new Error(\n 'The \"rush-mcp-plugin.json\" manifest file was not found under ' + installedPluginPackageFolder\n );\n }\n\n const jsonManifest: IJsonRushMcpPluginManifest = await JsonFile.loadAndValidateAsync(\n manifestFilePath,\n RushMcpPluginLoader._rushMcpPluginSchemaObject\n );\n\n let rushMcpPluginOptions: JsonObject = {};\n if (jsonManifest.configFileSchema) {\n const mcpPluginSchemaFilePath: string = path.resolve(\n installedPluginPackageFolder,\n jsonManifest.configFileSchema\n );\n const mcpPluginSchema: JsonSchema = await JsonSchema.fromFile(mcpPluginSchemaFilePath);\n const rushMcpPluginOptionsFilePath: string = path.resolve(\n this._rushWorkspacePath,\n `common/config/rush-mcp/${jsonMcpPlugin.pluginName}.json`\n );\n // Example: /path/to/my-repo/common/config/rush-mcp/rush-mcp-example-plugin.json\n rushMcpPluginOptions = await JsonFile.loadAndValidateAsync(\n rushMcpPluginOptionsFilePath,\n mcpPluginSchema\n );\n }\n\n const fullEntryPointPath: string = path.join(installedPluginPackageFolder, jsonManifest.entryPoint);\n let pluginFactory: RushMcpPluginFactory;\n try {\n const entryPointModule: { default?: RushMcpPluginFactory } = require(fullEntryPointPath);\n if (entryPointModule.default === undefined) {\n throw new Error('The commonJS \"default\" export is missing');\n }\n pluginFactory = entryPointModule.default;\n } catch (e) {\n throw new Error(`Unable to load plugin entry point at ${fullEntryPointPath}: ` + e.toString());\n }\n\n const session: RushMcpPluginSessionInternal = new RushMcpPluginSessionInternal(this._mcpServer);\n\n let plugin: IRushMcpPlugin;\n try {\n plugin = pluginFactory(session, rushMcpPluginOptions);\n } catch (e) {\n throw new Error(`Error invoking entry point for plugin ${jsonManifest.pluginName}:` + e.toString());\n }\n\n try {\n await plugin.onInitializeAsync();\n } catch (e) {\n throw new Error(\n `Error occurred in onInitializeAsync() for plugin ${jsonManifest.pluginName}:` + e.toString()\n );\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"RushMcpPluginLoader.js","sourceRoot":"","sources":["../../src/pluginFramework/RushMcpPluginLoader.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7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reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'path';\nimport { FileSystem, Import, JsonFile, type JsonObject, JsonSchema } from '@rushstack/node-core-library';\nimport { Autoinstaller } from '@rushstack/rush-sdk/lib/logic/Autoinstaller';\nimport { RushGlobalFolder } from '@rushstack/rush-sdk/lib/api/RushGlobalFolder';\nimport { RushConfiguration } from '@rushstack/rush-sdk/lib/api/RushConfiguration';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp';\n\nimport type { IRushMcpPlugin, RushMcpPluginFactory } from './IRushMcpPlugin';\nimport { RushMcpPluginSessionInternal } from './RushMcpPluginSession';\n\nimport rushMcpJsonSchemaObject from '../schemas/rush-mcp.schema.json';\nimport rushMcpPluginSchemaObject from '../schemas/rush-mcp-plugin.schema.json';\n\n/**\n * Configuration for @rushstack/mcp-server in a monorepo.\n * Corresponds to the contents of common/config/rush-mcp/rush-mcp.json\n */\nexport interface IJsonRushMcpConfig {\n /**\n * The list of plugins that @rushstack/mcp-server should load when processing this monorepo.\n */\n mcpPlugins: IJsonRushMcpPlugin[];\n}\n\n/**\n * Describes a single MCP plugin entry.\n */\nexport interface IJsonRushMcpPlugin {\n /**\n * The name of an NPM package that appears in the package.json \"dependencies\" for the autoinstaller.\n */\n packageName: string;\n\n /**\n * The name of a Rush autoinstaller with this package as its dependency.\n * @rushstack/mcp-server will ensure this folder is installed before loading the plugin.\n */\n autoinstaller: string;\n}\n\n/**\n * Manifest file for a Rush MCP plugin.\n * Every plugin package must contain a \"rush-mcp-plugin.json\" manifest in the top-level folder.\n */\nexport interface IJsonRushMcpPluginManifest {\n /**\n * A name that uniquely identifies your plugin.\n * Generally this should match the NPM package name; two plugins with the same pluginName cannot be loaded together.\n */\n pluginName: string;\n\n /**\n * Optional. Indicates that your plugin accepts a config file.\n * The MCP server will load this schema file and provide it to the plugin.\n * Path is typically `<rush-repo>/common/config/rush-mcp/<plugin-name>.json`.\n */\n configFileSchema?: string;\n\n /**\n * The module path to the plugin's entry point.\n * Its default export must be a class implementing the MCP plugin interface.\n */\n entryPoint: string;\n}\n\nexport class RushMcpPluginLoader {\n private static readonly _rushMcpJsonSchema: JsonSchema =\n JsonSchema.fromLoadedObject(rushMcpJsonSchemaObject);\n private static readonly _rushMcpPluginSchemaObject: JsonSchema =\n JsonSchema.fromLoadedObject(rushMcpPluginSchemaObject);\n\n private readonly _rushWorkspacePath: string;\n private readonly _mcpServer: McpServer;\n\n public constructor(rushWorkspacePath: string, mcpServer: McpServer) {\n this._rushWorkspacePath = rushWorkspacePath;\n this._mcpServer = mcpServer;\n }\n\n private static _formatError(e: Error): string {\n return e.stack ?? RushMcpPluginLoader._formatError(e);\n }\n\n public async loadAsync(): Promise<void> {\n const rushMcpFilePath: string = path.join(\n this._rushWorkspacePath,\n 'common/config/rush-mcp/rush-mcp.json'\n );\n\n if (!(await FileSystem.existsAsync(rushMcpFilePath))) {\n return;\n }\n\n const rushConfiguration: RushConfiguration = RushConfiguration.loadFromDefaultLocation({\n startingFolder: this._rushWorkspacePath\n });\n\n const jsonRushMcpConfig: IJsonRushMcpConfig = await JsonFile.loadAndValidateAsync(\n rushMcpFilePath,\n RushMcpPluginLoader._rushMcpJsonSchema\n );\n\n if (jsonRushMcpConfig.mcpPlugins.length === 0) {\n return;\n }\n\n const rushGlobalFolder: RushGlobalFolder = new RushGlobalFolder();\n\n for (const jsonMcpPlugin of jsonRushMcpConfig.mcpPlugins) {\n // Ensure the autoinstaller is installed\n const autoinstaller: Autoinstaller = new Autoinstaller({\n autoinstallerName: jsonMcpPlugin.autoinstaller,\n rushConfiguration,\n rushGlobalFolder,\n restrictConsoleOutput: false\n });\n await autoinstaller.prepareAsync();\n\n // Load the manifest\n\n // Suppose the autoinstaller is \"my-autoinstaller\" and the package is \"rush-mcp-example-plugin\".\n // Then the folder will be:\n // \"/path/to/my-repo/common/autoinstallers/my-autoinstaller/node_modules/rush-mcp-example-plugin\"\n const installedPluginPackageFolder: string = await Import.resolvePackageAsync({\n baseFolderPath: autoinstaller.folderFullPath,\n packageName: jsonMcpPlugin.packageName\n });\n\n const manifestFilePath: string = path.join(installedPluginPackageFolder, 'rush-mcp-plugin.json');\n if (!(await FileSystem.existsAsync(manifestFilePath))) {\n throw new Error(\n 'The \"rush-mcp-plugin.json\" manifest file was not found under ' + installedPluginPackageFolder\n );\n }\n\n const jsonManifest: IJsonRushMcpPluginManifest = await JsonFile.loadAndValidateAsync(\n manifestFilePath,\n RushMcpPluginLoader._rushMcpPluginSchemaObject\n );\n\n let rushMcpPluginOptions: JsonObject = {};\n if (jsonManifest.configFileSchema) {\n const mcpPluginSchemaFilePath: string = path.resolve(\n installedPluginPackageFolder,\n jsonManifest.configFileSchema\n );\n const mcpPluginSchema: JsonSchema = await JsonSchema.fromFile(mcpPluginSchemaFilePath);\n const rushMcpPluginOptionsFilePath: string = path.resolve(\n this._rushWorkspacePath,\n `common/config/rush-mcp/${jsonManifest.pluginName}.json`\n );\n // Example: /path/to/my-repo/common/config/rush-mcp/rush-mcp-example-plugin.json\n rushMcpPluginOptions = await JsonFile.loadAndValidateAsync(\n rushMcpPluginOptionsFilePath,\n mcpPluginSchema\n );\n }\n\n const fullEntryPointPath: string = path.join(installedPluginPackageFolder, jsonManifest.entryPoint);\n let pluginFactory: RushMcpPluginFactory;\n try {\n const entryPointModule: { default?: RushMcpPluginFactory } = require(fullEntryPointPath);\n if (entryPointModule.default === undefined) {\n throw new Error('The commonJS \"default\" export is missing');\n }\n pluginFactory = entryPointModule.default;\n } catch (e) {\n throw new Error(\n `Unable to load plugin entry point at ${fullEntryPointPath}:\\n` +\n RushMcpPluginLoader._formatError(e)\n );\n }\n\n const session: RushMcpPluginSessionInternal = new RushMcpPluginSessionInternal(this._mcpServer);\n\n let plugin: IRushMcpPlugin;\n try {\n plugin = pluginFactory(session, rushMcpPluginOptions);\n } catch (e) {\n throw new Error(\n `Error invoking entry point for plugin ${jsonManifest.pluginName}:\\n` +\n RushMcpPluginLoader._formatError(e)\n );\n }\n\n try {\n await plugin.onInitializeAsync();\n } catch (e) {\n throw new Error(\n `Error occurred in onInitializeAsync() for plugin ${jsonManifest.pluginName}:\\n` +\n RushMcpPluginLoader._formatError(e)\n );\n }\n }\n }\n}\n"]}
|
|
@@ -16,10 +16,6 @@
|
|
|
16
16
|
"autoinstaller": {
|
|
17
17
|
"type": "string",
|
|
18
18
|
"description": "The name of a Rush autoinstaller with this package as its dependency."
|
|
19
|
-
},
|
|
20
|
-
"pluginName": {
|
|
21
|
-
"type": "string",
|
|
22
|
-
"description": "The name of the plugin. This is used to identify the plugin in the MCP server."
|
|
23
19
|
}
|
|
24
20
|
},
|
|
25
21
|
"required": ["packageName", "autoinstaller"],
|
package/lib/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAWpE,qBAAa,aAAc,SAAQ,SAAS;IAC1C,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,aAAa,CAAsB;gBAExB,iBAAiB,EAAE,MAAM;IAU/B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAOxC,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,cAAc;CAOvB"}
|
package/lib/server.js
CHANGED
|
@@ -27,7 +27,6 @@ class RushMCPServer extends mcp_js_1.McpServer {
|
|
|
27
27
|
this._tools.push(new tools_1.RushCommandValidatorTool());
|
|
28
28
|
this._tools.push(new tools_1.RushWorkspaceDetailsTool());
|
|
29
29
|
this._tools.push(new tools_1.RushProjectDetailsTool());
|
|
30
|
-
this._tools.push(new tools_1.RushDocsTool());
|
|
31
30
|
}
|
|
32
31
|
_registerTools() {
|
|
33
32
|
process.chdir(this._rushWorkspacePath);
|
package/lib/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,oEAAoE;AACpE,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,oEAAoE;AACpE,mCAOiB;AACjB,+EAA4E;AAE5E,MAAa,aAAc,SAAQ,kBAAS;IAK1C,YAAmB,iBAAyB;QAC1C,KAAK,CAAC;YACJ,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC;QAPG,WAAM,GAAe,EAAE,CAAC;QAS9B,IAAI,CAAC,kBAAkB,GAAG,iBAAiB,CAAC;QAC5C,IAAI,CAAC,aAAa,GAAG,IAAI,yCAAmB,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;IAC9E,CAAC;IAEM,KAAK,CAAC,UAAU;QACrB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,CAAC,cAAc,EAAE,CAAC;QAEtB,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,CAAC;IACvC,CAAC;IAEO,gBAAgB;QACtB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,gCAAwB,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,8BAAsB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC;QACtE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,gCAAwB,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,gCAAwB,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,8BAAsB,EAAE,CAAC,CAAC;IACjD,CAAC;IAEO,cAAc;QACpB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAEvC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;CACF;AArCD,sCAqCC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport {\n type BaseTool,\n RushConflictResolverTool,\n RushMigrateProjectTool,\n RushCommandValidatorTool,\n RushWorkspaceDetailsTool,\n RushProjectDetailsTool\n} from './tools';\nimport { RushMcpPluginLoader } from './pluginFramework/RushMcpPluginLoader';\n\nexport class RushMCPServer extends McpServer {\n private _rushWorkspacePath: string;\n private _tools: BaseTool[] = [];\n private _pluginLoader: RushMcpPluginLoader;\n\n public constructor(rushWorkspacePath: string) {\n super({\n name: 'rush',\n version: '1.0.0'\n });\n\n this._rushWorkspacePath = rushWorkspacePath;\n this._pluginLoader = new RushMcpPluginLoader(this._rushWorkspacePath, this);\n }\n\n public async startAsync(): Promise<void> {\n this._initializeTools();\n this._registerTools();\n\n await this._pluginLoader.loadAsync();\n }\n\n private _initializeTools(): void {\n this._tools.push(new RushConflictResolverTool());\n this._tools.push(new RushMigrateProjectTool(this._rushWorkspacePath));\n this._tools.push(new RushCommandValidatorTool());\n this._tools.push(new RushWorkspaceDetailsTool());\n this._tools.push(new RushProjectDetailsTool());\n }\n\n private _registerTools(): void {\n process.chdir(this._rushWorkspacePath);\n\n for (const tool of this._tools) {\n tool.register(this);\n }\n }\n}\n"]}
|
package/lib/start.js
CHANGED
|
@@ -1,16 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
3
3
|
// See LICENSE in the project root for license information.
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
16
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
17
|
+
}) : function(o, v) {
|
|
18
|
+
o["default"] = v;
|
|
19
|
+
});
|
|
20
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
21
|
+
var ownKeys = function(o) {
|
|
22
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
23
|
+
var ar = [];
|
|
24
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
25
|
+
return ar;
|
|
26
|
+
};
|
|
27
|
+
return ownKeys(o);
|
|
28
|
+
};
|
|
29
|
+
return function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
4
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const process = __importStar(require("process"));
|
|
40
|
+
const node_core_library_1 = require("@rushstack/node-core-library");
|
|
41
|
+
const loader_1 = require("@rushstack/rush-sdk/loader");
|
|
5
42
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
6
43
|
const log_1 = require("./utilities/log");
|
|
7
|
-
const server_1 = require("./server");
|
|
8
44
|
const main = async () => {
|
|
9
45
|
const rushWorkspacePath = process.argv[2];
|
|
10
46
|
if (!rushWorkspacePath) {
|
|
11
47
|
throw new Error('Please provide workspace root path as the first argument');
|
|
12
48
|
}
|
|
13
|
-
const
|
|
49
|
+
const rushWorkspaceFullPath = path.resolve(rushWorkspacePath);
|
|
50
|
+
if (!(await node_core_library_1.FileSystem.existsAsync(rushWorkspaceFullPath))) {
|
|
51
|
+
throw new Error('The specified workspace root path does not exist:\n ' + JSON.stringify(rushWorkspacePath));
|
|
52
|
+
}
|
|
53
|
+
// Load rush-sdk from the specified repository
|
|
54
|
+
await loader_1.RushSdkLoader.loadAsync({
|
|
55
|
+
rushJsonSearchFolder: rushWorkspaceFullPath
|
|
56
|
+
});
|
|
57
|
+
const RushMCPServerClass = (await Promise.resolve().then(() => __importStar(require('./server')))).RushMCPServer;
|
|
58
|
+
const server = new RushMCPServerClass(rushWorkspaceFullPath);
|
|
14
59
|
await server.startAsync();
|
|
15
60
|
const transport = new stdio_js_1.StdioServerTransport();
|
|
16
61
|
await server.connect(transport);
|
package/lib/start.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,2CAA6B;AAC7B,iDAAmC;AACnC,oEAA0D;AAC1D,uDAA2D;AAC3D,wEAAiF;AAEjF,yCAAsC;A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corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport * as path from 'path';\nimport * as process from 'process';\nimport { FileSystem } from '@rushstack/node-core-library';\nimport { RushSdkLoader } from '@rushstack/rush-sdk/loader';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\n\nimport { log } from './utilities/log';\nimport type { RushMCPServer } from './server';\n\nconst main = async (): Promise<void> => {\n const rushWorkspacePath: string | undefined = process.argv[2];\n if (!rushWorkspacePath) {\n throw new Error('Please provide workspace root path as the first argument');\n }\n\n const rushWorkspaceFullPath: string = path.resolve(rushWorkspacePath);\n\n if (!(await FileSystem.existsAsync(rushWorkspaceFullPath))) {\n throw new Error(\n 'The specified workspace root path does not exist:\\n ' + JSON.stringify(rushWorkspacePath)\n );\n }\n\n // Load rush-sdk from the specified repository\n await RushSdkLoader.loadAsync({\n rushJsonSearchFolder: rushWorkspaceFullPath\n });\n\n const RushMCPServerClass: typeof RushMCPServer = (await import('./server')).RushMCPServer;\n\n const server: RushMCPServer = new RushMCPServerClass(rushWorkspaceFullPath);\n await server.startAsync();\n const transport: StdioServerTransport = new StdioServerTransport();\n await server.connect(transport);\n\n log('Rush MCP Server running on stdio');\n};\n\nmain().catch((error) => {\n log('Fatal error running server:', error instanceof Error ? error.message : error);\n process.exit(1);\n});\n"]}
|
package/lib/tools/index.d.ts
CHANGED
package/lib/tools/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAGA,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAGA,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC"}
|
package/lib/tools/index.js
CHANGED
|
@@ -22,5 +22,4 @@ __exportStar(require("./project-details.tool"), exports);
|
|
|
22
22
|
__exportStar(require("./rush-command-validator.tool"), exports);
|
|
23
23
|
__exportStar(require("./workspace-details"), exports);
|
|
24
24
|
__exportStar(require("./conflict-resolver.tool"), exports);
|
|
25
|
-
__exportStar(require("./docs.tool"), exports);
|
|
26
25
|
//# sourceMappingURL=index.js.map
|
package/lib/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;AAE3D,8CAA4B;AAC5B,yDAAuC;AACvC,yDAAuC;AACvC,gEAA8C;AAC9C,sDAAoC;AACpC,2DAAyC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;AAE3D,8CAA4B;AAC5B,yDAAuC;AACvC,yDAAuC;AACvC,gEAA8C;AAC9C,sDAAoC;AACpC,2DAAyC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nexport * from './base.tool';\nexport * from './migrate-project.tool';\nexport * from './project-details.tool';\nexport * from './rush-command-validator.tool';\nexport * from './workspace-details';\nexport * from './conflict-resolver.tool';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/mcp-server",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "A Model Context Protocol server implementation for Rush",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rush",
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
"zod": "~3.24.3",
|
|
31
31
|
"@rushstack/node-core-library": "5.13.1",
|
|
32
32
|
"@rushstack/terminal": "0.15.3",
|
|
33
|
-
"@rushstack/
|
|
34
|
-
"@rushstack/
|
|
33
|
+
"@rushstack/rush-sdk": "5.155.0",
|
|
34
|
+
"@rushstack/ts-command-line": "5.0.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"typescript": "~5.8.2",
|
|
38
38
|
"@types/node": "20.17.19",
|
|
39
|
-
"
|
|
40
|
-
"
|
|
39
|
+
"@rushstack/heft": "0.73.6",
|
|
40
|
+
"local-node-rig": "1.0.0"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "heft build --clean",
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"text": "---\ntitle: rush install-autoinstaller\n---\n\n```\nusage: rush install-autoinstaller [-h] --name AUTOINSTALLER_NAME\n\nUse this command to install dependencies for an autoinstaller folder.\n\nOptional arguments:\n -h, --help Show this help message and exit.\n --name AUTOINSTALLER_NAME\n The name of the autoinstaller, which must be one of\n the folders under common/autoinstallers.\n```\n\n## See also\n\n- [rush update-autoinstaller](../commands/rush_update-autoinstaller.md)\n- [rush init-autoinstaller](../commands/rush_init-autoinstaller.md)",
|
|
4
|
-
"score": 0.7231232
|
|
5
|
-
},
|
|
6
|
-
{
|
|
7
|
-
"text": "---\ntitle: rush install-autoinstaller\n---\n\n```\n用法:rush install-autoinstaller [-h] --name AUTOINSTALLER_NAME\n\n使用该指令给一个项目安装依赖。\n\n可选参数:\n -h, --help 展示帮助信息并退出\n --name AUTOINSTALLER_NAME\n 指定自动安装的包名,它必须是 common/autoinstallers\n 下的一个文件夹。\n```\n\n## See also\n\n- [rush update-autoinstaller](../commands/rush_update-autoinstaller.md)\n- [rush init-autoinstaller](../commands/rush_init-autoinstaller.md)",
|
|
8
|
-
"score": 0.7132133
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"text": "---\ntitle: rush update-autoinstaller\n---\n\n```\nusage: rush update-autoinstaller [-h] --name AUTOINSTALLER_NAME\n\nUse this command to regenerate the shrinkwrap file for an autoinstaller\nfolder.\n\nOptional arguments:\n -h, --help Show this help message and exit.\n --name AUTOINSTALLER_NAME\n The name of the autoinstaller, which must be one of\n the folders under common/autoinstallers.\n```\n\n## See also\n\n- [rush install-autoinstaller](../commands/rush_install-autoinstaller.md)\n- [rush init-autoinstaller](../commands/rush_init-autoinstaller.md)",
|
|
12
|
-
"score": 0.6632131
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"text": "---\ntitle: rush update-autoinstaller\n---\n\n```\nusage: rush update-autoinstaller [-h] --name AUTOINSTALLER_NAME\n\nUse this command to regenerate the shrinkwrap file for an autoinstaller\nfolder.\n\nOptional arguments:\n -h, --help Show this help message and exit.\n --name AUTOINSTALLER_NAME\n The name of the autoinstaller, which must be one of\n the folders under common/autoinstallers.\n```\n\n## See also\n\n- [rush install-autoinstaller](../commands/rush_install-autoinstaller.md)\n- [rush init-autoinstaller](../commands/rush_init-autoinstaller.md)",
|
|
16
|
-
"score": 0.6528328
|
|
17
|
-
}
|
|
18
|
-
]
|
package/lib/tools/docs.tool.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { BaseTool, type CallToolResult } from './base.tool';
|
|
2
|
-
export declare class RushDocsTool extends BaseTool {
|
|
3
|
-
constructor();
|
|
4
|
-
private _searchDocs;
|
|
5
|
-
executeAsync({ userQuery }: {
|
|
6
|
-
userQuery: string;
|
|
7
|
-
}): Promise<CallToolResult>;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=docs.tool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"docs.tool.d.ts","sourceRoot":"","sources":["../../src/tools/docs.tool.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAY5D,qBAAa,YAAa,SAAQ,QAAQ;;IAaxC,OAAO,CAAC,WAAW;IAeN,YAAY,CAAC,EAAE,SAAS,EAAE,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,CAAC;CAYzF"}
|
package/lib/tools/docs.tool.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
3
|
-
// See LICENSE in the project root for license information.
|
|
4
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
|
-
};
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.RushDocsTool = void 0;
|
|
9
|
-
const zod_1 = require("zod");
|
|
10
|
-
const node_core_library_1 = require("@rushstack/node-core-library");
|
|
11
|
-
const path_1 = __importDefault(require("path"));
|
|
12
|
-
const base_tool_1 = require("./base.tool");
|
|
13
|
-
class RushDocsTool extends base_tool_1.BaseTool {
|
|
14
|
-
constructor() {
|
|
15
|
-
super({
|
|
16
|
-
name: 'rush_docs',
|
|
17
|
-
description: 'Search and retrieve relevant sections from the official Rush documentation based on user queries.',
|
|
18
|
-
schema: {
|
|
19
|
-
userQuery: zod_1.z.string().describe('The user query to search for relevant documentation sections.')
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
// TODO: replace with Microsoft's service
|
|
24
|
-
_searchDocs(query) {
|
|
25
|
-
const startTime = Date.now();
|
|
26
|
-
const results = node_core_library_1.JsonFile.load(path_1.default.join(__dirname, '../rush-doc-fragment.mock.json'));
|
|
27
|
-
return {
|
|
28
|
-
query,
|
|
29
|
-
results,
|
|
30
|
-
count: results.length,
|
|
31
|
-
searchTimeMs: Date.now() - startTime
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
async executeAsync({ userQuery }) {
|
|
35
|
-
const docSearchResult = this._searchDocs(userQuery);
|
|
36
|
-
return {
|
|
37
|
-
content: [
|
|
38
|
-
{
|
|
39
|
-
type: 'text',
|
|
40
|
-
text: docSearchResult.results.map((item) => item.text).join('\n\n')
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.RushDocsTool = RushDocsTool;
|
|
47
|
-
//# sourceMappingURL=docs.tool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"docs.tool.js","sourceRoot":"","sources":["../../src/tools/docs.tool.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;AAE3D,6BAAwB;AACxB,oEAAwD;AACxD,gDAAwB;AAExB,2CAA4D;AAY5D,MAAa,YAAa,SAAQ,oBAAQ;IACxC;QACE,KAAK,CAAC;YACJ,IAAI,EAAE,WAAW;YACjB,WAAW,EACT,mGAAmG;YACrG,MAAM,EAAE;gBACN,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+DAA+D,CAAC;aAChG;SACF,CAAC,CAAC;IACL,CAAC;IAED,yCAAyC;IACjC,WAAW,CAAC,KAAa;QAC/B,MAAM,SAAS,GAAW,IAAI,CAAC,GAAG,EAAE,CAAC;QAErC,MAAM,OAAO,GAA2B,4BAAQ,CAAC,IAAI,CACnD,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,gCAAgC,CAAC,CACvD,CAAC;QAEF,OAAO;YACL,KAAK;YACL,OAAO;YACP,KAAK,EAAE,OAAO,CAAC,MAAM;YACrB,YAAY,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;SACrC,CAAC;IACJ,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,EAAE,SAAS,EAAyB;QAC5D,MAAM,eAAe,GAAgB,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAEjE,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;iBACpE;aACF;SACF,CAAC;IACJ,CAAC;CACF;AAxCD,oCAwCC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { z } from 'zod';\nimport { JsonFile } from '@rushstack/node-core-library';\nimport path from 'path';\n\nimport { BaseTool, type CallToolResult } from './base.tool';\n\ninterface IDocsResult {\n query: string;\n results: {\n score: number;\n text: string;\n }[];\n count: number;\n searchTimeMs: number;\n}\n\nexport class RushDocsTool extends BaseTool {\n public constructor() {\n super({\n name: 'rush_docs',\n description:\n 'Search and retrieve relevant sections from the official Rush documentation based on user queries.',\n schema: {\n userQuery: z.string().describe('The user query to search for relevant documentation sections.')\n }\n });\n }\n\n // TODO: replace with Microsoft's service\n private _searchDocs(query: string): IDocsResult {\n const startTime: number = Date.now();\n\n const results: IDocsResult['results'] = JsonFile.load(\n path.join(__dirname, '../rush-doc-fragment.mock.json')\n );\n\n return {\n query,\n results,\n count: results.length,\n searchTimeMs: Date.now() - startTime\n };\n }\n\n public async executeAsync({ userQuery }: { userQuery: string }): Promise<CallToolResult> {\n const docSearchResult: IDocsResult = this._searchDocs(userQuery);\n\n return {\n content: [\n {\n type: 'text',\n text: docSearchResult.results.map((item) => item.text).join('\\n\\n')\n }\n ]\n };\n }\n}\n"]}
|