imcp 0.0.16 → 0.0.17
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/dist/cli/commands/install.js +2 -2
- package/dist/cli/commands/list.js +2 -2
- package/dist/cli/commands/serve.js +1 -1
- package/dist/core/RequirementService.d.ts +0 -12
- package/dist/core/RequirementService.js +0 -24
- package/dist/core/installers/clients/BaseClientInstaller.d.ts +1 -1
- package/dist/core/installers/clients/ClientInstaller.d.ts +1 -1
- package/dist/core/installers/clients/ClientInstaller.js +1 -1
- package/dist/core/installers/clients/ClientInstallerFactory.js +1 -1
- package/dist/core/installers/clients/ClineInstaller.d.ts +1 -1
- package/dist/core/installers/clients/ClineInstaller.js +1 -1
- package/dist/core/installers/clients/ExtensionInstaller.js +1 -1
- package/dist/core/installers/clients/GithubCopilotInstaller.d.ts +1 -1
- package/dist/core/installers/clients/GithubCopilotInstaller.js +1 -1
- package/dist/core/installers/clients/MSRooCodeInstaller.d.ts +1 -1
- package/dist/core/installers/clients/MSRooCodeInstaller.js +1 -1
- package/dist/core/installers/requirements/BaseInstaller.d.ts +1 -1
- package/dist/core/installers/requirements/BaseInstaller.js +1 -1
- package/dist/core/installers/requirements/CommandInstaller.d.ts +1 -1
- package/dist/core/installers/requirements/CommandInstaller.js +1 -1
- package/dist/core/installers/requirements/GeneralInstaller.d.ts +1 -1
- package/dist/core/installers/requirements/InstallerFactory.d.ts +1 -1
- package/dist/core/installers/requirements/NpmInstaller.d.ts +1 -1
- package/dist/core/installers/requirements/NpmInstaller.js +1 -1
- package/dist/core/installers/requirements/PipInstaller.d.ts +1 -1
- package/dist/core/installers/requirements/RequirementInstaller.d.ts +1 -1
- package/dist/core/loaders/ConfigurationLoader.d.ts +32 -0
- package/dist/core/loaders/ConfigurationLoader.js +236 -0
- package/dist/core/loaders/ConfigurationProvider.d.ts +35 -0
- package/dist/core/loaders/ConfigurationProvider.js +375 -0
- package/dist/core/loaders/ServerSchemaLoader.d.ts +11 -0
- package/{src/core/ServerSchemaLoader.ts → dist/core/loaders/ServerSchemaLoader.js} +43 -48
- package/dist/core/loaders/ServerSchemaProvider.d.ts +17 -0
- package/{src/core/ServerSchemaProvider.ts → dist/core/loaders/ServerSchemaProvider.js} +120 -137
- package/dist/core/metadatas/constants.d.ts +47 -0
- package/dist/core/metadatas/constants.js +94 -0
- package/dist/core/metadatas/types.d.ts +166 -0
- package/dist/core/metadatas/types.js +16 -0
- package/dist/core/onboard/FeedOnboardService.d.ts +1 -1
- package/dist/core/onboard/FeedOnboardService.js +1 -1
- package/dist/core/onboard/OnboardProcessor.d.ts +1 -1
- package/dist/core/onboard/OnboardProcessor.js +1 -1
- package/dist/core/onboard/OnboardStatus.d.ts +1 -1
- package/dist/core/onboard/OnboardStatusManager.d.ts +1 -1
- package/dist/core/onboard/OnboardStatusManager.js +1 -1
- package/dist/core/validators/FeedValidator.d.ts +1 -1
- package/dist/core/validators/IServerValidator.d.ts +1 -1
- package/dist/core/validators/SSEServerValidator.d.ts +1 -1
- package/dist/core/validators/ServerValidatorFactory.d.ts +1 -1
- package/dist/core/validators/StdioServerValidator.d.ts +1 -1
- package/dist/core/validators/StdioServerValidator.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/services/InstallationService.d.ts +50 -0
- package/dist/services/InstallationService.js +350 -0
- package/dist/services/MCPManager.d.ts +28 -0
- package/dist/services/MCPManager.js +188 -0
- package/dist/services/RequirementService.d.ts +40 -0
- package/dist/services/RequirementService.js +110 -0
- package/dist/services/ServerService.d.ts +2 -2
- package/dist/services/ServerService.js +5 -5
- package/dist/utils/adoUtils.d.ts +2 -2
- package/dist/utils/adoUtils.js +1 -1
- package/dist/utils/feedUtils.js +1 -1
- package/dist/utils/githubUtils.d.ts +1 -1
- package/dist/utils/githubUtils.js +1 -1
- package/dist/utils/logger.js +1 -1
- package/dist/utils/macroExpressionUtils.d.ts +1 -1
- package/dist/utils/osUtils.d.ts +1 -1
- package/dist/utils/osUtils.js +1 -1
- package/dist/web/contract/serverContract.d.ts +1 -1
- package/dist/web/public/index.html +1 -3
- package/dist/web/public/js/api.js +2 -80
- package/dist/web/server.js +2 -2
- package/package.json +1 -1
- package/src/cli/commands/install.ts +3 -3
- package/src/cli/commands/list.ts +2 -2
- package/src/cli/commands/serve.ts +3 -2
- package/src/cli/index.ts +1 -1
- package/src/core/installers/clients/BaseClientInstaller.ts +134 -3
- package/src/core/installers/clients/ClientInstaller.ts +3 -3
- package/src/core/installers/clients/ClientInstallerFactory.ts +1 -1
- package/src/core/installers/clients/ClineInstaller.ts +1 -101
- package/src/core/installers/clients/ExtensionInstaller.ts +1 -1
- package/src/core/installers/clients/GithubCopilotInstaller.ts +1 -101
- package/src/core/installers/clients/MSRooCodeInstaller.ts +1 -102
- package/src/core/installers/requirements/BaseInstaller.ts +2 -2
- package/src/core/installers/requirements/CommandInstaller.ts +1 -1
- package/src/core/installers/requirements/GeneralInstaller.ts +1 -1
- package/src/core/installers/requirements/InstallerFactory.ts +1 -1
- package/src/core/installers/requirements/NpmInstaller.ts +12 -12
- package/src/core/installers/requirements/PipInstaller.ts +1 -1
- package/src/core/installers/requirements/RequirementInstaller.ts +1 -1
- package/src/core/{ConfigurationLoader.ts → loaders/ConfigurationLoader.ts} +31 -7
- package/src/core/{ConfigurationProvider.ts → loaders/ConfigurationProvider.ts} +18 -10
- package/src/core/loaders/ServerSchemaLoader.ts +117 -0
- package/src/core/loaders/ServerSchemaProvider.ts +99 -0
- package/src/core/{types.ts → metadatas/types.ts} +3 -2
- package/src/core/onboard/FeedOnboardService.ts +270 -146
- package/src/core/onboard/OnboardProcessor.ts +60 -11
- package/src/core/onboard/OnboardStatus.ts +7 -2
- package/src/core/onboard/OnboardStatusManager.ts +270 -43
- package/src/core/validators/FeedValidator.ts +65 -9
- package/src/core/validators/IServerValidator.ts +1 -1
- package/src/core/validators/SSEServerValidator.ts +2 -2
- package/src/core/validators/ServerValidatorFactory.ts +1 -1
- package/src/core/validators/StdioServerValidator.ts +86 -34
- package/src/index.ts +3 -3
- package/src/{core → services}/InstallationService.ts +5 -5
- package/src/{core → services}/MCPManager.ts +10 -5
- package/src/{core → services}/RequirementService.ts +2 -31
- package/src/services/ServerService.ts +7 -7
- package/src/utils/adoUtils.ts +3 -3
- package/src/utils/feedUtils.ts +2 -2
- package/src/utils/githubUtils.ts +2 -2
- package/src/utils/logger.ts +13 -1
- package/src/utils/macroExpressionUtils.ts +1 -1
- package/src/utils/osUtils.ts +4 -4
- package/src/web/contract/serverContract.ts +2 -2
- package/src/web/public/index.html +1 -3
- package/src/web/public/js/api.js +2 -80
- package/src/web/public/js/modal/installation.js +1 -1
- package/src/web/public/js/onboard/ONBOARDING_PAGE_DESIGN.md +41 -9
- package/src/web/public/js/onboard/formProcessor.js +200 -34
- package/src/web/public/js/onboard/index.js +2 -2
- package/src/web/public/js/onboard/publishHandler.js +30 -22
- package/src/web/public/js/onboard/templates.js +34 -40
- package/src/web/public/js/onboard/uiHandlers.js +175 -84
- package/src/web/public/js/onboard/validationHandlers.js +147 -64
- package/src/web/public/js/serverCategoryDetails.js +19 -4
- package/src/web/public/js/serverCategoryList.js +13 -1
- package/src/web/public/onboard.html +1 -1
- package/src/web/server.ts +30 -14
- package/src/services/InstallRequestValidator.ts +0 -112
- /package/src/core/{constants.ts → metadatas/constants.ts} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ConfigurationProvider } from '../../ConfigurationProvider.js';
|
|
2
|
-
import { SUPPORTED_CLIENTS } from '../../constants.js';
|
|
1
|
+
import { ConfigurationProvider } from '../../loaders/ConfigurationProvider.js';
|
|
2
|
+
import { SUPPORTED_CLIENTS } from '../../metadatas/constants.js';
|
|
3
3
|
import {
|
|
4
4
|
ServerOperationResult,
|
|
5
5
|
OperationStatus,
|
|
6
6
|
ServerInstallOptions,
|
|
7
7
|
McpConfig,
|
|
8
8
|
RequirementStatus
|
|
9
|
-
} from '../../types.js';
|
|
9
|
+
} from '../../metadatas/types.js';
|
|
10
10
|
import { Logger } from '../../../utils/logger.js';
|
|
11
11
|
import { ClientInstallerFactory } from './ClientInstallerFactory.js';
|
|
12
12
|
|
|
@@ -2,7 +2,7 @@ import { MSRooCodeInstaller } from './MSRooCodeInstaller.js';
|
|
|
2
2
|
import { ClineInstaller } from './ClineInstaller.js';
|
|
3
3
|
import { GithubCopilotInstaller } from './GithubCopilotInstaller.js';
|
|
4
4
|
import { BaseClientInstaller } from './BaseClientInstaller.js';
|
|
5
|
-
import { SUPPORTED_CLIENTS } from '../../constants.js';
|
|
5
|
+
import { SUPPORTED_CLIENTS } from '../../metadatas/constants.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Factory for creating client-specific installers
|
|
@@ -1,112 +1,12 @@
|
|
|
1
1
|
import { BaseClientInstaller } from './BaseClientInstaller.js';
|
|
2
|
-
import { Logger } from '../../../utils/logger.js';
|
|
3
2
|
import { readJsonFile, writeJsonFile } from '../../../utils/clientUtils.js';
|
|
4
|
-
import { ServerInstallOptions, OperationStatus, McpConfig } from '../../types.js';
|
|
5
|
-
import { ExtensionInstaller } from './ExtensionInstaller.js';
|
|
6
|
-
import { SUPPORTED_CLIENTS } from '../../constants.js';
|
|
7
|
-
import { isCommandAvailable } from '../../../utils/osUtils.js';
|
|
8
3
|
|
|
9
4
|
/**
|
|
10
5
|
* Cline client installer implementation
|
|
11
6
|
* Handles installation of Cline client including extension installation and settings configuration
|
|
12
7
|
*/
|
|
13
8
|
export class ClineInstaller extends BaseClientInstaller {
|
|
14
|
-
|
|
15
|
-
* Install Cline client
|
|
16
|
-
* @param options Installation options including environment variables and arguments
|
|
17
|
-
*/
|
|
18
|
-
async install(serverConfig: McpConfig, options: ServerInstallOptions): Promise<OperationStatus> {
|
|
19
|
-
const operationId = this.generateOperationId();
|
|
20
|
-
|
|
21
|
-
try {
|
|
22
|
-
// Check if VS Code or VS Code Insiders is installed
|
|
23
|
-
const isVSCodeInstalled = await isCommandAvailable('code');
|
|
24
|
-
const isVSCodeInsidersInstalled = await isCommandAvailable('code-insiders');
|
|
25
|
-
|
|
26
|
-
if (!isVSCodeInstalled && !isVSCodeInsidersInstalled) {
|
|
27
|
-
return {
|
|
28
|
-
status: 'failed',
|
|
29
|
-
type: 'install',
|
|
30
|
-
target: 'server',
|
|
31
|
-
message: 'Neither VS Code nor VS Code Insiders are installed on this system',
|
|
32
|
-
operationId
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Install extension
|
|
37
|
-
const extensionResult = await ExtensionInstaller.installExtension('Cline');
|
|
38
|
-
if (!extensionResult) {
|
|
39
|
-
Logger.debug('Failed to install Cline extension');
|
|
40
|
-
return {
|
|
41
|
-
status: 'failed',
|
|
42
|
-
type: 'install',
|
|
43
|
-
target: 'server',
|
|
44
|
-
message: 'Failed to install Cline extension',
|
|
45
|
-
operationId
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const installConfig = await this.setupInstallConfig(serverConfig, options);
|
|
51
|
-
// Track success for both VS Code variants
|
|
52
|
-
const results: Array<{ success: boolean; path: string; error?: string }> = [];
|
|
53
|
-
|
|
54
|
-
// Update settings for VS Code if installed
|
|
55
|
-
if (isVSCodeInstalled) {
|
|
56
|
-
try {
|
|
57
|
-
const settingPath = SUPPORTED_CLIENTS['Cline'].codeSettingPath;
|
|
58
|
-
await this.setupClientSettings(settingPath, serverConfig.name, installConfig);
|
|
59
|
-
results.push({ success: true, path: settingPath });
|
|
60
|
-
} catch (error) {
|
|
61
|
-
results.push({
|
|
62
|
-
success: false,
|
|
63
|
-
path: SUPPORTED_CLIENTS['Cline'].codeSettingPath,
|
|
64
|
-
error: error instanceof Error ? error.message : String(error)
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// Update settings for VS Code Insiders if installed
|
|
70
|
-
if (isVSCodeInsidersInstalled) {
|
|
71
|
-
try {
|
|
72
|
-
const settingPath = SUPPORTED_CLIENTS['Cline'].codeInsiderSettingPath;
|
|
73
|
-
await this.setupClientSettings(settingPath, serverConfig.name, installConfig);
|
|
74
|
-
results.push({ success: true, path: settingPath });
|
|
75
|
-
} catch (error) {
|
|
76
|
-
results.push({
|
|
77
|
-
success: false,
|
|
78
|
-
path: SUPPORTED_CLIENTS['Cline'].codeInsiderSettingPath,
|
|
79
|
-
error: error instanceof Error ? error.message : String(error)
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Determine overall success
|
|
85
|
-
const anySuccess = results.some(r => r.success);
|
|
86
|
-
const successPaths = results.filter(r => r.success).map(r => r.path);
|
|
87
|
-
const errors = results.filter(r => !r.success).map(r => r.error);
|
|
88
|
-
|
|
89
|
-
return {
|
|
90
|
-
status: anySuccess ? 'completed' : 'failed',
|
|
91
|
-
type: 'install',
|
|
92
|
-
target: 'server',
|
|
93
|
-
message: anySuccess
|
|
94
|
-
? `Successfully installed Cline client. Updated settings in: ${successPaths.join(', ')}`
|
|
95
|
-
: `Failed to install Cline client. Errors: ${errors.join('; ')}`,
|
|
96
|
-
operationId,
|
|
97
|
-
error: anySuccess ? undefined : errors.join('; ')
|
|
98
|
-
};
|
|
99
|
-
} catch (error) {
|
|
100
|
-
return {
|
|
101
|
-
status: 'failed',
|
|
102
|
-
type: 'install',
|
|
103
|
-
target: 'server',
|
|
104
|
-
message: `Unexpected error installing Cline client: ${error instanceof Error ? error.message : String(error)}`,
|
|
105
|
-
operationId,
|
|
106
|
-
error: error instanceof Error ? error.message : String(error)
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
}
|
|
9
|
+
protected readonly clientName: string = 'Cline';
|
|
110
10
|
|
|
111
11
|
/**
|
|
112
12
|
* Set up Cline client settings
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { exec } from 'child_process';
|
|
2
2
|
import { promisify } from 'util';
|
|
3
|
-
import { SUPPORTED_CLIENTS } from '../../constants.js';
|
|
3
|
+
import { SUPPORTED_CLIENTS } from '../../metadatas/constants.js';
|
|
4
4
|
import { Logger } from '../../../utils/logger.js';
|
|
5
5
|
import { handleGitHubRelease } from '../../../utils/githubUtils.js';
|
|
6
6
|
import { compareVersions } from '../../../utils/versionUtils.js';
|
|
@@ -1,113 +1,13 @@
|
|
|
1
1
|
import { BaseClientInstaller } from './BaseClientInstaller.js';
|
|
2
|
-
import { Logger } from '../../../utils/logger.js';
|
|
3
2
|
import { readJsonFile, writeJsonFile } from '../../../utils/clientUtils.js';
|
|
4
|
-
import { ServerInstallOptions, OperationStatus, McpConfig } from '../../types.js';
|
|
5
|
-
import { ExtensionInstaller } from './ExtensionInstaller.js';
|
|
6
|
-
import { SUPPORTED_CLIENTS } from '../../constants.js';
|
|
7
|
-
import { isCommandAvailable } from '../../../utils/osUtils.js';
|
|
8
3
|
|
|
9
4
|
/**
|
|
10
5
|
* Github Copilot client installer implementation
|
|
11
6
|
* Handles installation of Github Copilot client including extension installation and settings configuration
|
|
12
7
|
*/
|
|
13
8
|
export class GithubCopilotInstaller extends BaseClientInstaller {
|
|
9
|
+
protected readonly clientName: string = 'GithubCopilot';
|
|
14
10
|
|
|
15
|
-
/**
|
|
16
|
-
* Install Github Copilot client
|
|
17
|
-
* @param options Installation options including environment variables and arguments
|
|
18
|
-
*/
|
|
19
|
-
async install(serverConfig: McpConfig, options: ServerInstallOptions): Promise<OperationStatus> {
|
|
20
|
-
const operationId = this.generateOperationId();
|
|
21
|
-
|
|
22
|
-
try {
|
|
23
|
-
// Check if VS Code or VS Code Insiders is installed
|
|
24
|
-
const isVSCodeInstalled = await isCommandAvailable('code');
|
|
25
|
-
const isVSCodeInsidersInstalled = await isCommandAvailable('code-insiders');
|
|
26
|
-
|
|
27
|
-
if (!isVSCodeInstalled && !isVSCodeInsidersInstalled) {
|
|
28
|
-
return {
|
|
29
|
-
status: 'failed',
|
|
30
|
-
type: 'install',
|
|
31
|
-
target: 'server',
|
|
32
|
-
message: 'Neither VS Code nor VS Code Insiders are installed on this system',
|
|
33
|
-
operationId
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Install extension
|
|
38
|
-
const extensionResult = await ExtensionInstaller.installExtension('GithubCopilot');
|
|
39
|
-
if (!extensionResult) {
|
|
40
|
-
Logger.debug('Failed to install Github Copilot extension');
|
|
41
|
-
return {
|
|
42
|
-
status: 'failed',
|
|
43
|
-
type: 'install',
|
|
44
|
-
target: 'server',
|
|
45
|
-
message: 'Failed to install Github Copilot extension',
|
|
46
|
-
operationId
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const installConfig = await this.setupInstallConfig(serverConfig, options);
|
|
51
|
-
|
|
52
|
-
// Track success for both VS Code variants
|
|
53
|
-
const results: Array<{ success: boolean; path: string; error?: string }> = [];
|
|
54
|
-
|
|
55
|
-
// Update settings for VS Code if installed
|
|
56
|
-
if (isVSCodeInstalled) {
|
|
57
|
-
try {
|
|
58
|
-
const settingPath = SUPPORTED_CLIENTS['GithubCopilot'].codeSettingPath;
|
|
59
|
-
await this.setupClientSettings(settingPath, serverConfig.name, installConfig);
|
|
60
|
-
results.push({ success: true, path: settingPath });
|
|
61
|
-
} catch (error) {
|
|
62
|
-
results.push({
|
|
63
|
-
success: false,
|
|
64
|
-
path: SUPPORTED_CLIENTS['GithubCopilot'].codeSettingPath,
|
|
65
|
-
error: error instanceof Error ? error.message : String(error)
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Update settings for VS Code Insiders if installed
|
|
71
|
-
if (isVSCodeInsidersInstalled) {
|
|
72
|
-
try {
|
|
73
|
-
const settingPath = SUPPORTED_CLIENTS['GithubCopilot'].codeInsiderSettingPath;
|
|
74
|
-
await this.setupClientSettings(settingPath, serverConfig.name, installConfig);
|
|
75
|
-
results.push({ success: true, path: settingPath });
|
|
76
|
-
} catch (error) {
|
|
77
|
-
results.push({
|
|
78
|
-
success: false,
|
|
79
|
-
path: SUPPORTED_CLIENTS['GithubCopilot'].codeInsiderSettingPath,
|
|
80
|
-
error: error instanceof Error ? error.message : String(error)
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Determine overall success
|
|
86
|
-
const anySuccess = results.some(r => r.success);
|
|
87
|
-
const successPaths = results.filter(r => r.success).map(r => r.path);
|
|
88
|
-
const errors = results.filter(r => !r.success).map(r => r.error);
|
|
89
|
-
|
|
90
|
-
return {
|
|
91
|
-
status: anySuccess ? 'completed' : 'failed',
|
|
92
|
-
type: 'install',
|
|
93
|
-
target: 'server',
|
|
94
|
-
message: anySuccess
|
|
95
|
-
? `Successfully installed Github Copilot client. Updated settings in: ${successPaths.join(', ')}`
|
|
96
|
-
: `Failed to install Github Copilot client. Errors: ${errors.join('; ')}`,
|
|
97
|
-
operationId,
|
|
98
|
-
error: anySuccess ? undefined : errors.join('; ')
|
|
99
|
-
};
|
|
100
|
-
} catch (error) {
|
|
101
|
-
return {
|
|
102
|
-
status: 'failed',
|
|
103
|
-
type: 'install',
|
|
104
|
-
target: 'server',
|
|
105
|
-
message: `Unexpected error installing Github Copilot client: ${error instanceof Error ? error.message : String(error)}`,
|
|
106
|
-
operationId,
|
|
107
|
-
error: error instanceof Error ? error.message : String(error)
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
11
|
|
|
112
12
|
/**
|
|
113
13
|
* Initialize settings with GithubCopilot-specific structure
|
|
@@ -1,112 +1,11 @@
|
|
|
1
1
|
import { BaseClientInstaller } from './BaseClientInstaller.js';
|
|
2
|
-
import { Logger } from '../../../utils/logger.js';
|
|
3
2
|
import { readJsonFile, writeJsonFile } from '../../../utils/clientUtils.js';
|
|
4
|
-
import { ServerInstallOptions, OperationStatus, McpConfig } from '../../types.js';
|
|
5
|
-
import { ExtensionInstaller } from './ExtensionInstaller.js';
|
|
6
|
-
import { SUPPORTED_CLIENTS } from '../../constants.js';
|
|
7
|
-
import { isCommandAvailable } from '../../../utils/osUtils.js';
|
|
8
3
|
|
|
9
4
|
/**
|
|
10
5
|
* MSRooCode client installer implementation
|
|
11
6
|
*/
|
|
12
7
|
export class MSRooCodeInstaller extends BaseClientInstaller {
|
|
13
|
-
|
|
14
|
-
* Install MSRooCode client
|
|
15
|
-
*/
|
|
16
|
-
async install(serverConfig: McpConfig, options: ServerInstallOptions): Promise<OperationStatus> {
|
|
17
|
-
const operationId = this.generateOperationId();
|
|
18
|
-
|
|
19
|
-
try {
|
|
20
|
-
// Check if VS Code or VS Code Insiders is installed
|
|
21
|
-
const isVSCodeInstalled = await isCommandAvailable('code');
|
|
22
|
-
const isVSCodeInsidersInstalled = await isCommandAvailable('code-insiders');
|
|
23
|
-
|
|
24
|
-
if (!isVSCodeInstalled && !isVSCodeInsidersInstalled) {
|
|
25
|
-
return {
|
|
26
|
-
status: 'failed',
|
|
27
|
-
type: 'install',
|
|
28
|
-
target: 'server',
|
|
29
|
-
message: 'Neither VS Code nor VS Code Insiders are installed on this system',
|
|
30
|
-
operationId
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Install extension
|
|
35
|
-
const extensionResult = await ExtensionInstaller.installExtension('MSRooCode');
|
|
36
|
-
if (!extensionResult) {
|
|
37
|
-
Logger.debug('Failed to install MSRooCode extension');
|
|
38
|
-
return {
|
|
39
|
-
status: 'failed',
|
|
40
|
-
type: 'install',
|
|
41
|
-
target: 'server',
|
|
42
|
-
message: 'Failed to install MSRooCode extension',
|
|
43
|
-
operationId
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const installConfig = await this.setupInstallConfig(serverConfig, options);
|
|
48
|
-
installConfig.mode = serverConfig.mode;
|
|
49
|
-
|
|
50
|
-
// Track success for both VS Code variants
|
|
51
|
-
const results: Array<{ success: boolean; path: string; error?: string }> = [];
|
|
52
|
-
|
|
53
|
-
// Update settings for VS Code if installed
|
|
54
|
-
if (isVSCodeInstalled) {
|
|
55
|
-
try {
|
|
56
|
-
const settingPath = SUPPORTED_CLIENTS['MSRooCode'].codeSettingPath;
|
|
57
|
-
await this.setupClientSettings(settingPath, serverConfig.name, installConfig);
|
|
58
|
-
results.push({ success: true, path: settingPath });
|
|
59
|
-
} catch (error) {
|
|
60
|
-
results.push({
|
|
61
|
-
success: false,
|
|
62
|
-
path: SUPPORTED_CLIENTS['MSRooCode'].codeSettingPath,
|
|
63
|
-
error: error instanceof Error ? error.message : String(error)
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Update settings for VS Code Insiders if installed
|
|
69
|
-
if (isVSCodeInsidersInstalled) {
|
|
70
|
-
try {
|
|
71
|
-
const settingPath = SUPPORTED_CLIENTS['MSRooCode'].codeInsiderSettingPath;
|
|
72
|
-
await this.setupClientSettings(settingPath, serverConfig.name, installConfig);
|
|
73
|
-
results.push({ success: true, path: settingPath });
|
|
74
|
-
} catch (error) {
|
|
75
|
-
results.push({
|
|
76
|
-
success: false,
|
|
77
|
-
path: SUPPORTED_CLIENTS['MSRooCode'].codeInsiderSettingPath,
|
|
78
|
-
error: error instanceof Error ? error.message : String(error)
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Determine overall success
|
|
84
|
-
const anySuccess = results.some(r => r.success);
|
|
85
|
-
const successPaths = results.filter(r => r.success).map(r => r.path);
|
|
86
|
-
const errors = results.filter(r => !r.success).map(r => r.error);
|
|
87
|
-
|
|
88
|
-
return {
|
|
89
|
-
status: anySuccess ? 'completed' : 'failed',
|
|
90
|
-
type: 'install',
|
|
91
|
-
target: 'server',
|
|
92
|
-
message: anySuccess
|
|
93
|
-
? `Successfully installed MSRooCode client. Updated settings in: ${successPaths.join(', ')}`
|
|
94
|
-
: `Failed to install MSRooCode client. Errors: ${errors.join('; ')}`,
|
|
95
|
-
operationId,
|
|
96
|
-
error: anySuccess ? undefined : errors.join('; ')
|
|
97
|
-
};
|
|
98
|
-
} catch (error) {
|
|
99
|
-
return {
|
|
100
|
-
status: 'failed',
|
|
101
|
-
type: 'install',
|
|
102
|
-
target: 'server',
|
|
103
|
-
message: `Unexpected error installing MSRooCode client: ${error instanceof Error ? error.message : String(error)}`,
|
|
104
|
-
operationId,
|
|
105
|
-
error: error instanceof Error ? error.message : String(error)
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
8
|
+
protected readonly clientName: string = 'MSRooCode';
|
|
110
9
|
/**
|
|
111
10
|
* Set up MSRooCode client settings
|
|
112
11
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { RequirementConfig, RequirementStatus, RegistryConfig, ServerInstallOptions } from '../../types.js';
|
|
1
|
+
import { RequirementConfig, RequirementStatus, RegistryConfig, ServerInstallOptions } from '../../metadatas/types.js';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import { SETTINGS_DIR } from '../../constants.js';
|
|
3
|
+
import { SETTINGS_DIR } from '../../metadatas/constants.js';
|
|
4
4
|
import { RequirementInstaller } from './RequirementInstaller.js';
|
|
5
5
|
import { Logger } from '../../../utils/logger.js';
|
|
6
6
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RequirementConfig, RequirementStatus, OSType, ServerInstallOptions } from '../../types.js';
|
|
1
|
+
import { RequirementConfig, RequirementStatus, OSType, ServerInstallOptions } from '../../metadatas/types.js';
|
|
2
2
|
import { BaseInstaller } from './BaseInstaller.js';
|
|
3
3
|
import { getOSType, refreshPathEnv } from '../../../utils/osUtils.js';
|
|
4
4
|
import { Logger } from '../../../utils/logger.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../types.js';
|
|
1
|
+
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../metadatas/types.js';
|
|
2
2
|
import { BaseInstaller } from './BaseInstaller.js';
|
|
3
3
|
import { handleGitHubRelease } from '../../../utils/githubUtils.js';
|
|
4
4
|
import { handleArtifact } from '../../../utils/adoUtils.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../types.js';
|
|
1
|
+
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../metadatas/types.js';
|
|
2
2
|
import { RequirementInstaller } from './RequirementInstaller.js';
|
|
3
3
|
import { NpmInstaller } from './NpmInstaller.js';
|
|
4
4
|
import { PipInstaller } from './PipInstaller.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../types.js';
|
|
1
|
+
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../metadatas/types.js';
|
|
2
2
|
import { BaseInstaller } from './BaseInstaller.js';
|
|
3
3
|
import { compareVersions } from '../../../utils/versionUtils.js';
|
|
4
4
|
import { handleGitHubRelease, getGitHubLatestVersion } from '../../../utils/githubUtils.js';
|
|
@@ -6,7 +6,7 @@ import { handleGitHubRelease, getGitHubLatestVersion } from '../../../utils/gith
|
|
|
6
6
|
import { handleArtifact as handleAdoArtifact, AdoArtifactResult, getArtifactLatestVersion } from '../../../utils/adoUtils.js';
|
|
7
7
|
import path from 'path';
|
|
8
8
|
import fs from 'fs/promises';
|
|
9
|
-
import { SETTINGS_DIR } from '../../constants.js'; // Corrected path
|
|
9
|
+
import { SETTINGS_DIR } from '../../metadatas/constants.js'; // Corrected path
|
|
10
10
|
import { Logger } from '../../../utils/logger.js';
|
|
11
11
|
/**
|
|
12
12
|
* Installer implementation for NPM packages
|
|
@@ -55,9 +55,9 @@ export class NpmInstaller extends BaseInstaller {
|
|
|
55
55
|
*/
|
|
56
56
|
private _getRequirementFolderPath(requirement: RequirementConfig): string {
|
|
57
57
|
return path.join(
|
|
58
|
-
SETTINGS_DIR,
|
|
59
|
-
'npm_requirements',
|
|
60
|
-
requirement.name,
|
|
58
|
+
SETTINGS_DIR,
|
|
59
|
+
'npm_requirements',
|
|
60
|
+
requirement.name,
|
|
61
61
|
requirement.version.includes('latest') ? 'latest' : requirement.version);
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -156,11 +156,11 @@ export class NpmInstaller extends BaseInstaller {
|
|
|
156
156
|
): Promise<{ version: string }> {
|
|
157
157
|
Logger.debug(`Installing NPM package from "${packageSource}" into "${targetDir}"`);
|
|
158
158
|
await fs.mkdir(targetDir, { recursive: true });
|
|
159
|
-
|
|
159
|
+
|
|
160
160
|
const installCommand = `npm install ${packageSource} --prefix "${targetDir}"`;
|
|
161
161
|
Logger.debug(`Executing install command: ${installCommand}`);
|
|
162
162
|
const requirementName = this._getRequirementName(requirement);
|
|
163
|
-
|
|
163
|
+
|
|
164
164
|
try {
|
|
165
165
|
const { stdout: installStdout, stderr: installStderr } = await this.execPromise(installCommand);
|
|
166
166
|
Logger.debug(`NPM install stdout for ${packageSource} in ${targetDir}: ${installStdout}`);
|
|
@@ -194,7 +194,7 @@ export class NpmInstaller extends BaseInstaller {
|
|
|
194
194
|
*/
|
|
195
195
|
async install(requirement: RequirementConfig, options?: ServerInstallOptions): Promise<RequirementStatus> {
|
|
196
196
|
const targetDir = options?.settings?.folderName || this._getRequirementFolderPath(requirement);
|
|
197
|
-
await fs.mkdir(targetDir, { recursive: true });
|
|
197
|
+
await fs.mkdir(targetDir, { recursive: true });
|
|
198
198
|
|
|
199
199
|
try {
|
|
200
200
|
const status = await this.checkInstallation(requirement, { settings: { folderName: targetDir } });
|
|
@@ -204,19 +204,19 @@ export class NpmInstaller extends BaseInstaller {
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
let resolvedVersion = requirement.version;
|
|
207
|
-
let packageToInstall: string = `${requirement.name}@${requirement.version}`;
|
|
207
|
+
let packageToInstall: string = `${requirement.name}@${requirement.version}`;
|
|
208
208
|
|
|
209
209
|
if (requirement.registry) {
|
|
210
210
|
if (requirement.registry.githubRelease) {
|
|
211
211
|
const result = await handleGitHubRelease(requirement, requirement.registry.githubRelease);
|
|
212
|
-
packageToInstall = result.resolvedPath;
|
|
212
|
+
packageToInstall = result.resolvedPath;
|
|
213
213
|
resolvedVersion = result.resolvedVersion;
|
|
214
214
|
} else if (requirement.registry.artifacts) {
|
|
215
215
|
const adoResult: AdoArtifactResult = await handleAdoArtifact(
|
|
216
216
|
requirement,
|
|
217
217
|
requirement.registry.artifacts,
|
|
218
|
-
options?.settings?.pythonCommand,
|
|
219
|
-
targetDir
|
|
218
|
+
options?.settings?.pythonCommand,
|
|
219
|
+
targetDir
|
|
220
220
|
);
|
|
221
221
|
packageToInstall = `${adoResult.package}@${adoResult.version}`;
|
|
222
222
|
resolvedVersion = adoResult.version;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../types.js';
|
|
1
|
+
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../metadatas/types.js';
|
|
2
2
|
import { BaseInstaller } from './BaseInstaller.js';
|
|
3
3
|
import { handleGitHubRelease, getGitHubLatestVersion } from '../../../utils/githubUtils.js';
|
|
4
4
|
// Assuming getArtifactLatestVersion will be available in adoUtils.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fs from 'fs/promises';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import { LOCAL_FEEDS_DIR, SUPPORTED_CLIENTS } from '
|
|
4
|
-
import { Logger } from '
|
|
5
|
-
import { readJsonFile } from '
|
|
3
|
+
import { LOCAL_FEEDS_DIR, SUPPORTED_CLIENTS } from '../metadatas/constants.js';
|
|
4
|
+
import { Logger } from '../../utils/logger.js';
|
|
5
|
+
import { readJsonFile } from '../../utils/clientUtils.js';
|
|
6
6
|
import {
|
|
7
7
|
MCPConfiguration,
|
|
8
8
|
MCPServerCategory,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
FeedConfiguration,
|
|
12
12
|
RequirementStatus,
|
|
13
13
|
InstallationStatus
|
|
14
|
-
} from '
|
|
14
|
+
} from '../metadatas/types.js';
|
|
15
15
|
|
|
16
16
|
export class ConfigurationLoader {
|
|
17
17
|
/**
|
|
@@ -177,7 +177,7 @@ export class ConfigurationLoader {
|
|
|
177
177
|
/**
|
|
178
178
|
* Loads feed configurations into the MCP configuration
|
|
179
179
|
*/
|
|
180
|
-
static async loadFeedsIntoConfiguration(configuration: MCPConfiguration, feedFile?: string): Promise<MCPConfiguration> {
|
|
180
|
+
static async loadFeedsIntoConfiguration(configuration: MCPConfiguration, feedFile?: string, settings?: { prLink?:string, adhocServers?: string[] }): Promise<MCPConfiguration> {
|
|
181
181
|
try {
|
|
182
182
|
await fs.mkdir(LOCAL_FEEDS_DIR, { recursive: true });
|
|
183
183
|
const feeds: Record<string, FeedConfiguration> = {};
|
|
@@ -186,10 +186,34 @@ export class ConfigurationLoader {
|
|
|
186
186
|
if (feedFile) {
|
|
187
187
|
try {
|
|
188
188
|
const content = await fs.readFile(feedFile, 'utf8');
|
|
189
|
-
|
|
189
|
+
let config = JSON.parse(content) as FeedConfiguration;
|
|
190
190
|
if (config && config.name) {
|
|
191
|
+
// Update systemTags if feedFile is provided
|
|
192
|
+
if (!config.systemTags) {
|
|
193
|
+
config.systemTags = {};
|
|
194
|
+
}
|
|
195
|
+
config.systemTags['adhoc'] = 'true';
|
|
196
|
+
|
|
197
|
+
// Update PullRequest if prLink is provided in settings
|
|
198
|
+
if (settings?.prLink) {
|
|
199
|
+
config.PullRequest = settings.prLink;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Update mcpServers systemTags if adhocServers are provided in settings
|
|
203
|
+
if (settings?.adhocServers && settings.adhocServers.length > 0 && config.mcpServers) {
|
|
204
|
+
config.mcpServers = config.mcpServers.map(server => {
|
|
205
|
+
if (settings.adhocServers!.includes(server.name)) {
|
|
206
|
+
if (!server.systemTags) {
|
|
207
|
+
server.systemTags = {};
|
|
208
|
+
}
|
|
209
|
+
server.systemTags['adhoc'] = 'true';
|
|
210
|
+
}
|
|
211
|
+
return server;
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
191
215
|
feeds[config.name] = config;
|
|
192
|
-
console.log(`Loaded feed configuration from provided file: ${feedFile}`);
|
|
216
|
+
console.log(`Loaded and processed feed configuration from provided file: ${feedFile}`);
|
|
193
217
|
}
|
|
194
218
|
} catch (error) {
|
|
195
219
|
console.log(`Error loading feed configuration from provided file ${feedFile}:`, error);
|
|
@@ -3,9 +3,9 @@ import path from 'path';
|
|
|
3
3
|
import { exec } from 'child_process';
|
|
4
4
|
import { promisify } from 'util';
|
|
5
5
|
import { fileURLToPath } from 'url';
|
|
6
|
-
import { GITHUB_REPO, LOCAL_FEEDS_DIR, SETTINGS_DIR, SUPPORTED_CLIENTS } from '
|
|
7
|
-
import { Logger } from '
|
|
8
|
-
import { checkGithubAuth } from '
|
|
6
|
+
import { GITHUB_REPO, LOCAL_FEEDS_DIR, SETTINGS_DIR, SUPPORTED_CLIENTS } from '../metadatas/constants.js';
|
|
7
|
+
import { Logger } from '../../utils/logger.js';
|
|
8
|
+
import { checkGithubAuth } from '../../utils/githubAuth.js';
|
|
9
9
|
import {
|
|
10
10
|
MCPConfiguration,
|
|
11
11
|
MCPServerCategory,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
OperationStatus,
|
|
17
17
|
ClientSettings,
|
|
18
18
|
McpConfig
|
|
19
|
-
} from '
|
|
19
|
+
} from '../metadatas/types.js';
|
|
20
20
|
import { ConfigurationLoader } from './ConfigurationLoader.js';
|
|
21
21
|
|
|
22
22
|
const execAsync = promisify(exec);
|
|
@@ -59,10 +59,18 @@ export class ConfigurationProvider {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
async initialize(feedFile?: string): Promise<void> {
|
|
62
|
+
async initialize(feedFile?: string, settings?: { prLink?:string, adhocServers?: string[] }): Promise<void> {
|
|
63
63
|
await this.withLock(async () => {
|
|
64
64
|
const configDir = path.dirname(this.configPath);
|
|
65
65
|
await fs.mkdir(configDir, { recursive: true });
|
|
66
|
+
// remove the old configuration file if it exists
|
|
67
|
+
try {
|
|
68
|
+
await fs.rm(this.configPath, { recursive: true, force: true });
|
|
69
|
+
} catch (error) {
|
|
70
|
+
if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
66
74
|
|
|
67
75
|
try {
|
|
68
76
|
try {
|
|
@@ -77,7 +85,7 @@ export class ConfigurationProvider {
|
|
|
77
85
|
}
|
|
78
86
|
|
|
79
87
|
// Always load feeds and client settings, whether file existed or not
|
|
80
|
-
await this.loadFeedsIntoConfiguration(feedFile);
|
|
88
|
+
await this.loadFeedsIntoConfiguration(feedFile, settings);
|
|
81
89
|
await this.loadClientMCPSettings();
|
|
82
90
|
} catch (error) {
|
|
83
91
|
Logger.error('Error during initialization', error);
|
|
@@ -327,7 +335,7 @@ export class ConfigurationProvider {
|
|
|
327
335
|
|
|
328
336
|
// Download latest release
|
|
329
337
|
Logger.debug('Downloading latest release...');
|
|
330
|
-
const { downloadGithubRelease } = await import('
|
|
338
|
+
const { downloadGithubRelease } = await import('../../utils/githubUtils.js');
|
|
331
339
|
const { version, downloadPath } = await downloadGithubRelease(
|
|
332
340
|
GITHUB_REPO.repoName,
|
|
333
341
|
'latest',
|
|
@@ -364,8 +372,8 @@ export class ConfigurationProvider {
|
|
|
364
372
|
});
|
|
365
373
|
}
|
|
366
374
|
|
|
367
|
-
private async loadFeedsIntoConfiguration(feedFile?: string): Promise<void> {
|
|
368
|
-
this.configuration = await ConfigurationLoader.loadFeedsIntoConfiguration(this.configuration, feedFile);
|
|
375
|
+
private async loadFeedsIntoConfiguration(feedFile?: string, settings?: { prLink?:string, adhocServers?: string[] }): Promise<void> {
|
|
376
|
+
this.configuration = await ConfigurationLoader.loadFeedsIntoConfiguration(this.configuration, feedFile, settings);
|
|
369
377
|
await this.saveConfiguration();
|
|
370
378
|
}
|
|
371
379
|
|
|
@@ -384,7 +392,7 @@ export class ConfigurationProvider {
|
|
|
384
392
|
async removeServerFromClientMCPSettings(serverName: string, target?: string): Promise<void> {
|
|
385
393
|
return await this.withLock(async () => {
|
|
386
394
|
// Load utils in async context to avoid circular dependencies
|
|
387
|
-
const { readJsonFile, writeJsonFile } = await import('
|
|
395
|
+
const { readJsonFile, writeJsonFile } = await import('../../utils/clientUtils.js');
|
|
388
396
|
|
|
389
397
|
// Filter clients if target is specified
|
|
390
398
|
const clientEntries = Object.entries(SUPPORTED_CLIENTS as Record<string, ClientSettings>);
|