@rushstack/mcp-server 0.2.10 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +26 -0
- package/CHANGELOG.md +8 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/pluginFramework/RushMcpPluginLoader.d.ts.map +1 -1
- package/lib/pluginFramework/RushMcpPluginLoader.js +1 -1
- package/lib/pluginFramework/RushMcpPluginLoader.js.map +1 -1
- package/lib/pluginFramework/zodTypes.d.ts +1 -1
- package/lib/pluginFramework/zodTypes.d.ts.map +1 -1
- package/lib/pluginFramework/zodTypes.js.map +1 -1
- package/lib/server.d.ts.map +1 -1
- package/lib/server.js.map +1 -1
- package/lib/start.js +3 -3
- package/lib/start.js.map +1 -1
- package/lib/tools/conflict-resolver.tool.d.ts.map +1 -1
- package/lib/tools/conflict-resolver.tool.js.map +1 -1
- package/lib/tools/migrate-project.tool.d.ts.map +1 -1
- package/lib/tools/migrate-project.tool.js +4 -4
- package/lib/tools/migrate-project.tool.js.map +1 -1
- package/lib/tools/project-details.tool.d.ts.map +1 -1
- package/lib/tools/project-details.tool.js.map +1 -1
- package/lib/tools/rush-command-validator.tool.d.ts.map +1 -1
- package/lib/tools/rush-command-validator.tool.js +2 -2
- package/lib/tools/rush-command-validator.tool.js.map +1 -1
- package/lib/utilities/command-runner.d.ts.map +1 -1
- package/lib/utilities/command-runner.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/mcp-server",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.3.0",
|
|
6
|
+
"tag": "@rushstack/mcp-server_v0.3.0",
|
|
7
|
+
"date": "Fri, 03 Oct 2025 20:09:59 GMT",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Normalize import of builtin modules to use the `node:` protocol."
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"dependency": [
|
|
15
|
+
{
|
|
16
|
+
"comment": "Updating dependency \"@rushstack/node-core-library\" to `5.16.0`"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"comment": "Updating dependency \"@rushstack/terminal\" to `0.19.0`"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"comment": "Updating dependency \"@rushstack/ts-command-line\" to `5.1.0`"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"comment": "Updating dependency \"@rushstack/heft\" to `1.1.0`"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
4
30
|
{
|
|
5
31
|
"version": "0.2.10",
|
|
6
32
|
"tag": "@rushstack/mcp-server_v0.2.10",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# Change Log - @rushstack/mcp-server
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 03 Oct 2025 20:09:59 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 0.3.0
|
|
6
|
+
Fri, 03 Oct 2025 20:09:59 GMT
|
|
7
|
+
|
|
8
|
+
### Minor changes
|
|
9
|
+
|
|
10
|
+
- Normalize import of builtin modules to use the `node:` protocol.
|
|
4
11
|
|
|
5
12
|
## 0.2.10
|
|
6
13
|
Tue, 30 Sep 2025 23:57:45 GMT
|
package/dist/tsdoc-metadata.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RushMcpPluginLoader.d.ts","sourceRoot":"","sources":["../../src/pluginFramework/RushMcpPluginLoader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RushMcpPluginLoader.d.ts","sourceRoot":"","sources":["../../src/pluginFramework/RushMcpPluginLoader.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAYtE;;;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"}
|
|
@@ -39,7 +39,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
};
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
exports.RushMcpPluginLoader = void 0;
|
|
42
|
-
const path = __importStar(require("path"));
|
|
42
|
+
const path = __importStar(require("node:path"));
|
|
43
43
|
const node_core_library_1 = require("@rushstack/node-core-library");
|
|
44
44
|
const Autoinstaller_1 = require("@rushstack/rush-sdk/lib/logic/Autoinstaller");
|
|
45
45
|
const RushGlobalFolder_1 = require("@rushstack/rush-sdk/lib/api/RushGlobalFolder");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file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;AAjIyB,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/**\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"]}
|
|
1
|
+
{"version":3,"file":"RushMcpPluginLoader.js","sourceRoot":"","sources":["../../src/pluginFramework/RushMcpPluginLoader.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,gDAAkC;AAIlC,oEAAyG;AACzG,+EAA4E;AAC5E,mFAAgF;AAChF,qFAAkF;AAGlF,iEAAsE;AACtE,2FAAsE;AACtE,yGAA+E;AAsD/E,MAAa,mBAAmB;IAS9B,YAAmB,iBAAyB,EAAE,SAAoB;QAChE,IAAI,CAAC,kBAAkB,GAAG,iBAAiB,CAAC;QAC5C,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;IAEO,MAAM,CAAC,YAAY,CAAC,CAAQ;;QAClC,OAAO,MAAA,CAAC,CAAC,KAAK,mCAAI,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACxD,CAAC;IAEM,KAAK,CAAC,SAAS;QACpB,MAAM,eAAe,GAAW,IAAI,CAAC,IAAI,CACvC,IAAI,CAAC,kBAAkB,EACvB,sCAAsC,CACvC,CAAC;QAEF,IAAI,CAAC,CAAC,MAAM,8BAAU,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC;YACrD,OAAO;QACT,CAAC;QAED,MAAM,iBAAiB,GAAsB,qCAAiB,CAAC,uBAAuB,CAAC;YACrF,cAAc,EAAE,IAAI,CAAC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BACnE,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAC,CACtC,CAAC;YACJ,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,KAAK;oBAC9E,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAC,CACtC,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;;AAjIH,kDAkIC;AAjIyB,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 'node:path';\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp';\n\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';\n\nimport type { IRushMcpPlugin, RushMcpPluginFactory } from './IRushMcpPlugin';\nimport { RushMcpPluginSessionInternal } from './RushMcpPluginSession';\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zodTypes.d.ts","sourceRoot":"","sources":["../../src/pluginFramework/zodTypes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,GAAG,MAAM,KAAK,CAAC;AAChC,
|
|
1
|
+
{"version":3,"file":"zodTypes.d.ts","sourceRoot":"","sources":["../../src/pluginFramework/zodTypes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,GAAG,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,YAAY,EAAE,GAAG,IAAI,SAAS,EAAE,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAEhC;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zodTypes.js","sourceRoot":"","sources":["../../src/pluginFramework/zodTypes.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;
|
|
1
|
+
{"version":3,"file":"zodTypes.js","sourceRoot":"","sources":["../../src/pluginFramework/zodTypes.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAG3D,2DAAuE;AAG9D,qGAHA,4BAAoB,OAGA","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 type * as zod from 'zod';\nimport { CallToolResultSchema } from '@modelcontextprotocol/sdk/types';\n\nexport type { zod as zodModule };\nexport { CallToolResultSchema };\n\n/**\n * @public\n */\nexport type CallToolResult = zod.infer<typeof CallToolResultSchema>;\n"]}
|
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;AAYpE,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.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,oE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AAQ,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';\n\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
|
@@ -35,11 +35,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
};
|
|
36
36
|
})();
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
const path = __importStar(require("path"));
|
|
39
|
-
const process = __importStar(require("process"));
|
|
38
|
+
const path = __importStar(require("node:path"));
|
|
39
|
+
const process = __importStar(require("node:process"));
|
|
40
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
40
41
|
const node_core_library_1 = require("@rushstack/node-core-library");
|
|
41
42
|
const loader_1 = require("@rushstack/rush-sdk/loader");
|
|
42
|
-
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
43
43
|
const log_1 = require("./utilities/log");
|
|
44
44
|
const main = async () => {
|
|
45
45
|
const rushWorkspacePath = process.argv[2];
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3D,gDAAkC;AAClC,sDAAwC;AAExC,wEAAiF;AAEjF,oEAA0D;AAC1D,uDAA2D;AAE3D,yCAAsC;AAGtC,MAAM,IAAI,GAAG,KAAK,IAAmB,EAAE;IACrC,MAAM,iBAAiB,GAAuB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9D,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC9E,CAAC;IAED,MAAM,qBAAqB,GAAW,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAEtE,IAAI,CAAC,CAAC,MAAM,8BAAU,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC,EAAE,CAAC;QAC3D,MAAM,IAAI,KAAK,CACb,uDAAuD,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAC5F,CAAC;IACJ,CAAC;IAED,8CAA8C;IAC9C,MAAM,sBAAa,CAAC,SAAS,CAAC;QAC5B,oBAAoB,EAAE,qBAAqB;KAC5C,CAAC,CAAC;IAEH,MAAM,kBAAkB,GAAyB,CAAC,wDAAa,UAAU,GAAC,CAAC,CAAC,aAAa,CAAC;IAE1F,MAAM,MAAM,GAAkB,IAAI,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;IAC5E,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;IAC1B,MAAM,SAAS,GAAyB,IAAI,+BAAoB,EAAE,CAAC;IACnE,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,IAAA,SAAG,EAAC,kCAAkC,CAAC,CAAC;AAC1C,CAAC,CAAC;AAEF,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,IAAA,SAAG,EAAC,6BAA6B,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACnF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,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 'node:path';\nimport * as process from 'node:process';\n\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\n\nimport { FileSystem } from '@rushstack/node-core-library';\nimport { RushSdkLoader } from '@rushstack/rush-sdk/loader';\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conflict-resolver.tool.d.ts","sourceRoot":"","sources":["../../src/tools/conflict-resolver.tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"conflict-resolver.tool.d.ts","sourceRoot":"","sources":["../../src/tools/conflict-resolver.tool.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAE5D,qBAAa,wBAAyB,SAAQ,QAAQ;;IAYpD,OAAO,CAAC,mCAAmC;IAa9B,YAAY,CAAC,EAAE,YAAY,EAAE,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,CAAC;CA0B/F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conflict-resolver.tool.js","sourceRoot":"","sources":["../../src/tools/conflict-resolver.tool.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,6BAAwB;
|
|
1
|
+
{"version":3,"file":"conflict-resolver.tool.js","sourceRoot":"","sources":["../../src/tools/conflict-resolver.tool.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,6BAAwB;AAKxB,gEAA4D;AAC5D,gDAA2D;AAC3D,2CAA4D;AAE5D,MAAa,wBAAyB,SAAQ,oBAAQ;IACpD;QACE,KAAK,CAAC;YACJ,IAAI,EAAE,uCAAuC;YAC7C,WAAW,EACT,yHAAyH;YAC3H,MAAM,EAAE;gBACN,YAAY,EA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E in the project root for license information.\n\nimport { z } from 'zod';\n\nimport type { RushConfiguration } from '@rushstack/rush-sdk';\nimport type { IExecutableSpawnSyncOptions } from '@rushstack/node-core-library';\n\nimport { CommandRunner } from '../utilities/command-runner';\nimport { getRushConfiguration } from '../utilities/common';\nimport { BaseTool, type CallToolResult } from './base.tool';\n\nexport class RushConflictResolverTool extends BaseTool {\n public constructor() {\n super({\n name: 'rush_pnpm_lock_file_conflict_resolver',\n description:\n 'If a user requests to resolve a pnpm-lock.yaml file conflict, use this tool to automatically fix the conflict directly.',\n schema: {\n lockfilePath: z.string().describe('The path to the pnpm-lock.yaml file, should pass absolute path')\n }\n });\n }\n\n private _tryGetSubspaceNameFromLockfilePath(\n lockfilePath: string,\n rushConfiguration: RushConfiguration\n ): string | null {\n for (const subspace of rushConfiguration.subspaces) {\n const folderPath: string = subspace.getSubspaceConfigFolderPath();\n if (lockfilePath.startsWith(folderPath)) {\n return subspace.subspaceName;\n }\n }\n return null;\n }\n\n public async executeAsync({ lockfilePath }: { lockfilePath: string }): Promise<CallToolResult> {\n const rushConfiguration: RushConfiguration = await getRushConfiguration();\n const subspaceName: string | null = this._tryGetSubspaceNameFromLockfilePath(\n lockfilePath,\n rushConfiguration\n );\n if (!subspaceName) {\n throw new Error('subspace name not found');\n }\n\n const options: IExecutableSpawnSyncOptions = {\n stdio: 'inherit',\n currentWorkingDirectory: rushConfiguration.rushJsonFolder\n };\n await CommandRunner.runGitCommandAsync(['checkout', '--theirs', lockfilePath], options);\n await CommandRunner.runRushCommandAsync(['update', '--subspace', subspaceName], options);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Conflict resolved successfully'\n }\n ]\n };\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-project.tool.d.ts","sourceRoot":"","sources":["../../src/tools/migrate-project.tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"migrate-project.tool.d.ts","sourceRoot":"","sources":["../../src/tools/migrate-project.tool.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAG5D,qBAAa,sBAAuB,SAAQ,QAAQ;IAClD,OAAO,CAAC,kBAAkB,CAAS;gBAEhB,iBAAiB,EAAE,MAAM;YAc9B,mCAAmC;YAgBnC,oCAAoC;IAerC,YAAY,CAAC,EACxB,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EAClB,EAAE;QACD,WAAW,EAAE,MAAM,CAAC;QACpB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,kBAAkB,EAAE,MAAM,CAAC;KAC5B,GAAG,OAAO,CAAC,cAAc,CAAC;CA+D5B"}
|
|
@@ -6,11 +6,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
};
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.RushMigrateProjectTool = void 0;
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
10
|
const zod_1 = require("zod");
|
|
10
11
|
const node_core_library_1 = require("@rushstack/node-core-library");
|
|
11
12
|
const base_tool_1 = require("./base.tool");
|
|
12
13
|
const common_1 = require("../utilities/common");
|
|
13
|
-
const path_1 = __importDefault(require("path"));
|
|
14
14
|
class RushMigrateProjectTool extends base_tool_1.BaseTool {
|
|
15
15
|
constructor(rushWorkspacePath) {
|
|
16
16
|
super({
|
|
@@ -25,7 +25,7 @@ class RushMigrateProjectTool extends base_tool_1.BaseTool {
|
|
|
25
25
|
this._rushWorkspacePath = rushWorkspacePath;
|
|
26
26
|
}
|
|
27
27
|
async _modifyAndSaveSubspaceJsonFileAsync(rushConfiguration, cb) {
|
|
28
|
-
const subspacesFolderPath =
|
|
28
|
+
const subspacesFolderPath = node_path_1.default.resolve(rushConfiguration.commonRushConfigFolder, 'subspaces.json');
|
|
29
29
|
const subspacesConfiguration = await node_core_library_1.JsonFile.loadAsync(subspacesFolderPath);
|
|
30
30
|
const newSubspaceNames = await cb(subspacesConfiguration.subspaceNames);
|
|
31
31
|
subspacesConfiguration.subspaceNames = newSubspaceNames;
|
|
@@ -52,7 +52,7 @@ class RushMigrateProjectTool extends base_tool_1.BaseTool {
|
|
|
52
52
|
const rootPath = this._rushWorkspacePath;
|
|
53
53
|
const sourceProjectSubspaceName = project.subspace.subspaceName;
|
|
54
54
|
const sourceProjectPath = project.projectFolder;
|
|
55
|
-
const destinationPath =
|
|
55
|
+
const destinationPath = node_path_1.default.resolve(rootPath, targetProjectPath);
|
|
56
56
|
const subspacehasOnlyOneProject = project.subspace.getProjects().length === 1;
|
|
57
57
|
// 1. Remove source subspace folder
|
|
58
58
|
if (subspacehasOnlyOneProject) {
|
|
@@ -70,7 +70,7 @@ class RushMigrateProjectTool extends base_tool_1.BaseTool {
|
|
|
70
70
|
projects[projectIndex] = {
|
|
71
71
|
...projects[projectIndex],
|
|
72
72
|
subspaceName: targetSubspaceName,
|
|
73
|
-
projectFolder:
|
|
73
|
+
projectFolder: node_path_1.default.relative(rootPath, destinationPath)
|
|
74
74
|
};
|
|
75
75
|
return projects;
|
|
76
76
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-project.tool.js","sourceRoot":"","sources":["../../src/tools/migrate-project.tool.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;AAE3D,6BAAwB;
|
|
1
|
+
{"version":3,"file":"migrate-project.tool.js","sourceRoot":"","sources":["../../src/tools/migrate-project.tool.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;AAE3D,0DAA6B;AAE7B,6BAAwB;AAExB,oEAAoE;AAMpE,2CAA4D;AAC5D,gDAA2D;AAE3D,MAAa,sBAAuB,SAAQ,oBAAQ;IAGlD,YAAmB,iBAAyB;QAC1C,KAAK,CAAC;YACJ,IAAI,EAAE,sBAAsB;YAC5B,WAAW,EAAE,iFAAiF;YAC9F,MAAM,EAAE;gBACN,WAAW,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AE,EAAE,EAAE,CAAC,WAAW,KAAK,WAAW,CAAC,CAAC;YAClG,QAAQ,CAAC,YAAY,CAAC,GAAG;gBACvB,GAAG,QAAQ,CAAC,YAAY,CAAC;gBACzB,YAAY,EAAE,kBAAkB;gBAChC,aAAa,EAAE,mBAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;aACxD,CAAC;YACF,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAC,CAAC;QAEH,6BAA6B;QAC7B,MAAM,IAAI,CAAC,mCAAmC,CAAC,iBAAiB,EAAE,CAAC,aAAa,EAAE,EAAE;YAClF,IAAI,yBAAyB,EAAE,CAAC;gBAC9B,aAAa,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,yBAAyB,CAAC,EAAE,CAAC,CAAC,CAAC;YAC5E,CAAC;YACD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;gBAChD,aAAa,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;YACzC,CAAC;YACD,OAAO,aAAa,CAAC;QACvB,CAAC,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EACF,YAAY,WAAW,2BAA2B,kBAAkB,kBAAkB;wBACtF,qEAAqE,kBAAkB,2BAA2B;wBAClH,+DAA+D,kBAAkB,sBAAsB;iBAC1G;aACF;SACF,CAAC;IACJ,CAAC;CACF;AAvHD,wDAuHC","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 path from 'node:path';\n\nimport { z } from 'zod';\n\nimport { FileSystem, JsonFile } from '@rushstack/node-core-library';\nimport type { ISubspacesConfigurationJson } from '@rushstack/rush-sdk/lib/api/SubspacesConfiguration';\nimport type { RushConfiguration, RushConfigurationProject } from '@rushstack/rush-sdk';\nimport type { IRushConfigurationProjectJson } from '@rushstack/rush-sdk/lib/api/RushConfigurationProject';\nimport type { IRushConfigurationJson } from '@rushstack/rush-sdk/lib/api/RushConfiguration';\n\nimport { BaseTool, type CallToolResult } from './base.tool';\nimport { getRushConfiguration } from '../utilities/common';\n\nexport class RushMigrateProjectTool extends BaseTool {\n private _rushWorkspacePath: string;\n\n public constructor(rushWorkspacePath: string) {\n super({\n name: 'rush_migrate_project',\n description: 'Migrate a project to a different location or subspace within the Rush monorepo.',\n schema: {\n projectName: z.string().describe('The name of the project to be migrated'),\n targetProjectPath: z.string().optional().describe('The target path to migrate the project to'),\n targetSubspaceName: z.string().optional().describe('The target subspace to migrate the project to')\n }\n });\n\n this._rushWorkspacePath = rushWorkspacePath;\n }\n\n private async _modifyAndSaveSubspaceJsonFileAsync(\n rushConfiguration: RushConfiguration,\n cb: (subspaceNames: string[]) => Promise<string[]> | string[]\n ): Promise<void> {\n const subspacesFolderPath: string = path.resolve(\n rushConfiguration.commonRushConfigFolder,\n 'subspaces.json'\n );\n const subspacesConfiguration: ISubspacesConfigurationJson = await JsonFile.loadAsync(subspacesFolderPath);\n const newSubspaceNames: string[] = await cb(subspacesConfiguration.subspaceNames);\n subspacesConfiguration.subspaceNames = newSubspaceNames;\n await JsonFile.saveAsync(subspacesConfiguration, subspacesFolderPath, {\n updateExistingFile: true\n });\n }\n\n private async _modifyAndSaveRushConfigurationAsync(\n rushConfiguration: RushConfiguration,\n cb: (\n projects: IRushConfigurationProjectJson[]\n ) => Promise<IRushConfigurationProjectJson[]> | IRushConfigurationProjectJson[]\n ): Promise<void> {\n const rushConfigurationJson: IRushConfigurationJson = rushConfiguration.rushConfigurationJson;\n const rushConfigurationFile: string = rushConfiguration.rushJsonFile;\n const newRushConfigurationProjectJson: IRushConfigurationProjectJson[] = await cb(\n rushConfigurationJson.projects\n );\n rushConfigurationJson.projects = newRushConfigurationProjectJson;\n await JsonFile.saveAsync(rushConfigurationJson, rushConfigurationFile, { updateExistingFile: true });\n }\n\n public async executeAsync({\n projectName,\n targetSubspaceName,\n targetProjectPath\n }: {\n projectName: string;\n targetProjectPath: string;\n targetSubspaceName: string;\n }): Promise<CallToolResult> {\n const rushConfiguration: RushConfiguration = await getRushConfiguration();\n const project: RushConfigurationProject | undefined = rushConfiguration.getProjectByName(projectName);\n\n if (!project) {\n return {\n isError: true,\n content: [{ type: 'text', text: `Project \"${projectName}\" not found` }]\n };\n }\n\n const rootPath: string = this._rushWorkspacePath;\n const sourceProjectSubspaceName: string = project.subspace.subspaceName;\n const sourceProjectPath: string = project.projectFolder;\n const destinationPath: string = path.resolve(rootPath, targetProjectPath);\n const subspacehasOnlyOneProject: boolean = project.subspace.getProjects().length === 1;\n\n // 1. Remove source subspace folder\n if (subspacehasOnlyOneProject) {\n const subspaceConfigFolderPath: string = project.subspace.getSubspaceConfigFolderPath();\n await FileSystem.deleteFolderAsync(subspaceConfigFolderPath);\n }\n\n // 2. Move project to target subspace\n await FileSystem.moveAsync({\n sourcePath: sourceProjectPath,\n destinationPath\n });\n\n // 3. Update rush configuration\n await this._modifyAndSaveRushConfigurationAsync(rushConfiguration, (projects) => {\n const projectIndex: number = projects.findIndex(({ packageName }) => packageName === projectName);\n projects[projectIndex] = {\n ...projects[projectIndex],\n subspaceName: targetSubspaceName,\n projectFolder: path.relative(rootPath, destinationPath)\n };\n return projects;\n });\n\n // 4. Update `subspaces.json`\n await this._modifyAndSaveSubspaceJsonFileAsync(rushConfiguration, (subspaceNames) => {\n if (subspacehasOnlyOneProject) {\n subspaceNames.splice(subspaceNames.indexOf(sourceProjectSubspaceName), 1);\n }\n if (!subspaceNames.includes(targetSubspaceName)) {\n subspaceNames.push(targetSubspaceName);\n }\n return subspaceNames;\n });\n\n return {\n content: [\n {\n type: 'text',\n text:\n `Project \"${projectName}\" migrated to subspace \"${targetSubspaceName}\" successfully. ` +\n `You can ask whether the user wants to run \"rush update --subspace ${targetSubspaceName}\" to update the project. ` +\n `If the user says \"yes\", you can run \"rush update --subspace ${targetSubspaceName}\" directly for them.`\n }\n ]\n };\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-details.tool.d.ts","sourceRoot":"","sources":["../../src/tools/project-details.tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"project-details.tool.d.ts","sourceRoot":"","sources":["../../src/tools/project-details.tool.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAE5D,qBAAa,sBAAuB,SAAQ,QAAQ;;IAWrC,YAAY,CAAC,EAAE,WAAW,EAAE,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,CAAC;CAuC7F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-details.tool.js","sourceRoot":"","sources":["../../src/tools/project-details.tool.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,6BAAwB;
|
|
1
|
+
{"version":3,"file":"project-details.tool.js","sourceRoot":"","sources":["../../src/tools/project-details.tool.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,6BAAwB;AAIxB,gDAA2D;AAC3D,2CAA4D;AAE5D,MAAa,sBAAuB,SAAQ,oBAAQ;IAClD;QACE,KAAK,CAAC;YACJ,IAAI,EAAE,sBAAsB;YAC5B,WAAW,EAAE,+EAA+E;YAC5F,MAAM,EAAE;gBACN,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4CAA4C,CAAC;aAC/E;SACF,CAAC,CAAC;IACL,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,EAAE,WAAW,EAA2B;QAChE,MAAM,iBAAiB,GAAsB,MAAM,IAAA,6BAAoB,GAAE,CAAC;QAC1E,MAAM,OAAO,GAAyC,iBAAiB,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;QAEtG,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,WAAW,WAAW,YAAY,CAAC,CAAC;QACtD,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;wBACE,WAAW,EAAE,OAAO,CAAC,WAAW;wBAChC;;2BAEG;wBACH,aAAa,EAAE,OAAO,CAAC,aAAa;wBACpC;;2BAEG;wBACH,qBAAqB,EAAE,OAAO,CAAC,qBAAqB;wBACpD;;2BAEG;wBACH,uBAAuB,EAAE,OAAO,CAAC,uBAAuB;wBACxD;;2BAEG;wBACH,mBAAmB,EAAE,OAAO,CAAC,QAAQ,CAAC,YAAY;qBACnD,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;CACF;AAlDD,wDAkDC","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';\n\nimport type { RushConfiguration, RushConfigurationProject } from '@rushstack/rush-sdk';\n\nimport { getRushConfiguration } from '../utilities/common';\nimport { BaseTool, type CallToolResult } from './base.tool';\n\nexport class RushProjectDetailsTool extends BaseTool {\n public constructor() {\n super({\n name: 'rush_project_details',\n description: 'Returns the complete project details in JSON format for a given rush project.',\n schema: {\n projectName: z.string().describe('The name of the project to get details for')\n }\n });\n }\n\n public async executeAsync({ projectName }: { projectName: string }): Promise<CallToolResult> {\n const rushConfiguration: RushConfiguration = await getRushConfiguration();\n const project: RushConfigurationProject | undefined = rushConfiguration.getProjectByName(projectName);\n\n if (!project) {\n throw new Error(`Project ${projectName} not found`);\n }\n\n return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(\n {\n packageJson: project.packageJson,\n /**\n * Example: `C:\\MyRepo\\libraries\\my-project`\n */\n projectFolder: project.projectFolder,\n /**\n * Example: `libraries/my-project`\n */\n projectRelativeFolder: project.projectRelativeFolder,\n /**\n * Example: `C:\\MyRepo\\libraries\\my-project\\config\\rush`\n */\n projectRushConfigFolder: project.projectRushConfigFolder,\n /**\n * Example: `my-subspace`\n */\n projectSubspaceName: project.subspace.subspaceName\n },\n null,\n 2\n )\n }\n ]\n };\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rush-command-validator.tool.d.ts","sourceRoot":"","sources":["../../src/tools/rush-command-validator.tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rush-command-validator.tool.d.ts","sourceRoot":"","sources":["../../src/tools/rush-command-validator.tool.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAE5D,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAajD,CAAC;AAEH,qBAAa,wBAAyB,SAAQ,QAAQ;;IAkBvC,YAAY,CAAC,EACxB,WAAW,EACX,cAAc,EACd,IAAI,EACL,EAAE;QACD,WAAW,EAAE,MAAM,CAAC;QACpB,cAAc,EAAE,MAAM,CAAC;QACvB,IAAI,EAAE,MAAM,EAAE,CAAC;KAChB,GAAG,OAAO,CAAC,cAAc,CAAC;CA2D5B"}
|
|
@@ -6,9 +6,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
};
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.RushCommandValidatorTool = exports.selectionParamsSet = void 0;
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
10
|
const zod_1 = require("zod");
|
|
10
11
|
const node_core_library_1 = require("@rushstack/node-core-library");
|
|
11
|
-
const path_1 = __importDefault(require("path"));
|
|
12
12
|
const common_1 = require("../utilities/common");
|
|
13
13
|
const base_tool_1 = require("./base.tool");
|
|
14
14
|
exports.selectionParamsSet = new Set([
|
|
@@ -42,7 +42,7 @@ class RushCommandValidatorTool extends base_tool_1.BaseTool {
|
|
|
42
42
|
async executeAsync({ commandName, subCommandName, args }) {
|
|
43
43
|
var _a;
|
|
44
44
|
const rushConfiguration = await (0, common_1.getRushConfiguration)();
|
|
45
|
-
const commandLineJson = await node_core_library_1.JsonFile.loadAsync(
|
|
45
|
+
const commandLineJson = await node_core_library_1.JsonFile.loadAsync(node_path_1.default.resolve(rushConfiguration.commonFolder, 'config', 'rush', 'command-line.json'));
|
|
46
46
|
const conditionSubCommandNames = new Set((_a = commandLineJson.commands) === null || _a === void 0 ? void 0 : _a.filter((command) => command.commandKind !== 'global').map((command) => command.name));
|
|
47
47
|
if (conditionSubCommandNames.has(subCommandName) && !args.some((arg) => exports.selectionParamsSet.has(arg))) {
|
|
48
48
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rush-command-validator.tool.js","sourceRoot":"","sources":["../../src/tools/rush-command-validator.tool.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;AAE3D,6BAAwB;
|
|
1
|
+
{"version":3,"file":"rush-command-validator.tool.js","sourceRoot":"","sources":["../../src/tools/rush-command-validator.tool.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;AAE3D,0DAA6B;AAE7B,6BAAwB;AAExB,oEAAwD;AAIxD,gDAA2D;AAC3D,2CAA4D;AAE/C,QAAA,kBAAkB,GAAwB,IAAI,GAAG,CAAC;IAC7D,IAAI;IACJ,MAAM;IACN,aAAa;IACb,IAAI;IACJ,QAAQ;IACR,IAAI;IACJ,QAAQ;IACR,IAAI;IACJ,eAAe;IACf,IAAI;IACJ,sBAAsB;IACtB,IAAI;CACL,CAAC,CAAC;AAEH,MAAa,wBAAyB,SAAQ,oBAAQ;IACpD;QACE,KAAK,CAAC;YACJ,IAAI,EAAE,wBAAwB;YAC9B,WAAW,EACT,6NAA6N;YAC/N,MAAM,EAAE;gBACN,WAAW,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ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AAO,EAAE,EAAE,CAAC;YAC1C,IAAI,0BAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBAChC,MAAM,WAAW,GAAW,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;gBAC5C,MAAM,cAAc,GAClB,WAAW,KAAK,GAAG,IAAI,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,KAAK,WAAW,CAAC,CAAC;gBAE/F,IAAI,CAAC,cAAc,EAAE,CAAC;oBACpB,OAAO;wBACL,OAAO,EAAE,IAAI;wBACb,OAAO,EAAE;4BACP;gCACE,IAAI,EAAE,MAAM;gCACZ,IAAI,EAAE,gBAAgB,WAAW,+HAA+H;6BACjK;yBACF;qBACF,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;QAED,MAAM,UAAU,GAAW,GAAG,WAAW,IAAI,cAAc,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAChF,MAAM,IAAI,GAAW,YAAY,UAAU,qCACzC,WAAW,KAAK,OAAO,IAAI,cAAc,KAAK,KAAK,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,EAC1F,iBAAiB,CAAC;QAElB,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI;iBACL;aACF;SACF,CAAC;IACJ,CAAC;CACF;AArFD,4DAqFC","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 path from 'node:path';\n\nimport { z } from 'zod';\n\nimport { JsonFile } from '@rushstack/node-core-library';\nimport type { ICommandLineJson } from '@rushstack/rush-sdk/lib/api/CommandLineJson';\nimport type { RushConfiguration } from '@rushstack/rush-sdk';\n\nimport { getRushConfiguration } from '../utilities/common';\nimport { BaseTool, type CallToolResult } from './base.tool';\n\nexport const selectionParamsSet: ReadonlySet<string> = new Set([\n '-t',\n '--to',\n '--to-except',\n '-T',\n '--from',\n '-f',\n '--only',\n '-o',\n '--impacted-by',\n '-i',\n '--impacted-by-except',\n '-I'\n]);\n\nexport class RushCommandValidatorTool extends BaseTool {\n public constructor() {\n super({\n name: 'rush_command_validator',\n description:\n 'Validates Rush commands before execution by checking command format and ensuring compliance with Rush command standards. This tool helps prevent invalid command usage and provides guidance on proper parameter selection.',\n schema: {\n commandName: z.enum(['rush', 'rushx']).describe('The main command to execute (rush or rushx)'),\n subCommandName: z\n .string()\n .describe(\n 'The Rush subcommand to validate (install, update, add, remove, purge, list, build, etc.)'\n ),\n args: z.array(z.string()).describe('The arguments to validate for the subcommand')\n }\n });\n }\n\n public async executeAsync({\n commandName,\n subCommandName,\n args\n }: {\n commandName: string;\n subCommandName: string;\n args: string[];\n }): Promise<CallToolResult> {\n const rushConfiguration: RushConfiguration = await getRushConfiguration();\n const commandLineJson: ICommandLineJson = await JsonFile.loadAsync(\n path.resolve(rushConfiguration.commonFolder, 'config', 'rush', 'command-line.json')\n );\n const conditionSubCommandNames: Set<string> = new Set(\n commandLineJson.commands\n ?.filter((command) => command.commandKind !== 'global')\n .map((command) => command.name)\n );\n\n if (conditionSubCommandNames.has(subCommandName) && !args.some((arg) => selectionParamsSet.has(arg))) {\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: `Please add selection parameters like ${Array.from(selectionParamsSet).join(\n ', '\n )} to the command and re-validate. The package name should be retrieved from the package.json file in your project folder.`\n }\n ]\n };\n }\n\n for (const [index, arg] of args.entries()) {\n if (selectionParamsSet.has(arg)) {\n const packageName: string = args[index + 1];\n const isValidPackage: boolean =\n packageName === '.' || rushConfiguration.projects.some((p) => p.packageName === packageName);\n\n if (!isValidPackage) {\n return {\n isError: true,\n content: [\n {\n type: 'text',\n text: `The package \"${packageName}\" does not exist in the Rush workspace. You can retrieve the package name from the 'package.json' file in the project folder.`\n }\n ]\n };\n }\n }\n }\n\n const commandStr: string = `${commandName} ${subCommandName} ${args.join(' ')}`;\n const text: string = `Command \"${commandStr}\" validated successfully, you can ${\n commandName === 'rushx' || subCommandName === 'add' ? 'enter the project folder and ' : ''\n }execute it now.`;\n\n return {\n content: [\n {\n type: 'text',\n text\n }\n ]\n };\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-runner.d.ts","sourceRoot":"","sources":["../../src/utilities/command-runner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command-runner.d.ts","sourceRoot":"","sources":["../../src/utilities/command-runner.ts"],"names":[],"mappings":"AAKA,OAAO,EAAc,KAAK,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAE5F,UAAU,cAAc;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,qBAAa,qBAAsB,SAAQ,KAAK;gBAC3B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAInF;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAyC;IAE9E,OAAO,CAAC,MAAM,CAAC,eAAe;mBAoBT,oBAAoB;WAyCrB,mBAAmB,CACrC,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,CAAC,EAAE,2BAA2B,GACpC,OAAO,CAAC,cAAc,CAAC;WAIN,oBAAoB,CACtC,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,CAAC,EAAE,2BAA2B,GACpC,OAAO,CAAC,cAAc,CAAC;WAIN,kBAAkB,CACpC,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,CAAC,EAAE,2BAA2B,GACpC,OAAO,CAAC,cAAc,CAAC;CAG3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-runner.js","sourceRoot":"","sources":["../../src/utilities/command-runner.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;
|
|
1
|
+
{"version":3,"file":"command-runner.js","sourceRoot":"","sources":["../../src/utilities/command-runner.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAI3D,oEAA4F;AAU5F,MAAa,qBAAsB,SAAQ,KAAK;IAC9C,YAAmB,OAAe,EAAE,IAAc,EAAE,MAAc,EAAE,MAAc;QAChF,KAAK,CAAC,YAAY,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,wBAAwB,MAAM,MAAM,MAAM,EAAE,CAAC,CAAC;QACzF,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AALD,sDAKC;AAED,MAAa,aAAa;IAGhB,MAAM,CAAC,eAAe,CAAC,OAAe;;QAC5C,MAAM,UAAU,GAA8B,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC9E,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,YAAY,OAAO,4BAA4B,CAAC,CAAC;QACnE,CAAC;QAED,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,UAAU,CAAC;QACpB,CAAC;QAED,MAAM,YAAY,GAAkB,MAAA,8BAAU,CAAC,UAAU,CAAC,OAAO,CAAC,mCAAI,IAAI,CAAC;QAC3E,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QAE9C,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,YAAY,OAAO,4BAA4B,CAAC,CAAC;QACnE,CAAC;QAED,OAAO,YAAY,CAAC;IACtB,CAAC;IAEO,MAAM,CAAC,KAAK,CAAC,oBAAoB,CACvC,OAAe,EACf,IAAc,EACd,OAAqC;QAErC,MAA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AAK,CAAC,mBAAmB,CACrC,IAAc,EACd,OAAqC;QAErC,OAAO,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,oBAAoB,CACtC,IAAc,EACd,OAAqC;QAErC,OAAO,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,kBAAkB,CACpC,IAAc,EACd,OAAqC;QAErC,OAAO,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;;AAnFH,sCAoFC;AAnFyB,2BAAa,GAA+B,IAAI,GAAG,EAAE,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 type { ChildProcess } from 'node:child_process';\n\nimport { Executable, type IExecutableSpawnSyncOptions } from '@rushstack/node-core-library';\n\ninterface ICommandResult {\n status: number;\n stdout: string;\n stderr: string;\n command: string;\n args: string[];\n}\n\nexport class CommandExecutionError extends Error {\n public constructor(command: string, args: string[], stderr: string, status: number) {\n super(`Command \"${command} ${args.join(' ')}\" failed with status ${status}:\\n${stderr}`);\n this.name = 'CommandExecutionError';\n }\n}\n\nexport class CommandRunner {\n private static readonly _commandCache: Map<string, string | null> = new Map();\n\n private static _resolveCommand(command: string): string {\n const cachedPath: string | null | undefined = this._commandCache.get(command);\n if (cachedPath === null) {\n throw new Error(`Command \"${command}\" not found in system PATH`);\n }\n\n if (cachedPath) {\n return cachedPath;\n }\n\n const resolvedPath: string | null = Executable.tryResolve(command) ?? null;\n this._commandCache.set(command, resolvedPath);\n\n if (!resolvedPath) {\n throw new Error(`Command \"${command}\" not found in system PATH`);\n }\n\n return resolvedPath;\n }\n\n private static async _executeCommandAsync(\n command: string,\n args: string[],\n options?: IExecutableSpawnSyncOptions\n ): Promise<ICommandResult> {\n const commandPath: string = this._resolveCommand(command);\n\n return new Promise((resolve, reject) => {\n const childProcess: ChildProcess = Executable.spawn(commandPath, args, options);\n let stdout: string = '';\n let stderr: string = '';\n\n childProcess.stdout?.on('data', (data) => {\n stdout += data.toString();\n });\n\n childProcess.stderr?.on('data', (data) => {\n stderr += data.toString();\n });\n\n childProcess.on('close', (status) => {\n if (status !== 0) {\n reject(new CommandExecutionError(command, args, stderr, status ?? 1));\n return;\n }\n\n resolve({\n status: status ?? 0,\n stdout,\n stderr,\n command,\n args\n });\n });\n\n childProcess.on('error', (error) => {\n reject(error);\n });\n });\n }\n\n public static async runRushCommandAsync(\n args: string[],\n options?: IExecutableSpawnSyncOptions\n ): Promise<ICommandResult> {\n return this._executeCommandAsync('rush', args, options);\n }\n\n public static async runRushXCommandAsync(\n args: string[],\n options?: IExecutableSpawnSyncOptions\n ): Promise<ICommandResult> {\n return this._executeCommandAsync('rushx', args, options);\n }\n\n public static async runGitCommandAsync(\n args: string[],\n options?: IExecutableSpawnSyncOptions\n ): Promise<ICommandResult> {\n return this._executeCommandAsync('git', args, options);\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "A Model Context Protocol server implementation for Rush",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rush",
|
|
@@ -28,16 +28,16 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@modelcontextprotocol/sdk": "~1.10.2",
|
|
30
30
|
"zod": "~3.24.3",
|
|
31
|
-
"@rushstack/node-core-library": "5.
|
|
32
|
-
"@rushstack/
|
|
33
|
-
"@rushstack/
|
|
34
|
-
"@rushstack/
|
|
31
|
+
"@rushstack/node-core-library": "5.16.0",
|
|
32
|
+
"@rushstack/terminal": "0.19.0",
|
|
33
|
+
"@rushstack/rush-sdk": "5.160.0",
|
|
34
|
+
"@rushstack/ts-command-line": "5.1.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"eslint": "~9.25.1",
|
|
38
38
|
"typescript": "~5.8.2",
|
|
39
39
|
"@types/node": "20.17.19",
|
|
40
|
-
"@rushstack/heft": "1.
|
|
40
|
+
"@rushstack/heft": "1.1.0",
|
|
41
41
|
"local-node-rig": "1.0.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|