imcp 0.0.14 → 0.0.16
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/core/ConfigurationProvider.d.ts +1 -0
- package/dist/core/ConfigurationProvider.js +15 -0
- package/dist/core/InstallationService.js +2 -7
- package/dist/core/MCPManager.d.ts +11 -2
- package/dist/core/MCPManager.js +24 -1
- package/dist/core/RequirementService.js +2 -8
- package/dist/core/installers/clients/BaseClientInstaller.d.ts +51 -0
- package/dist/core/installers/clients/BaseClientInstaller.js +160 -0
- package/dist/core/installers/clients/ClientInstaller.d.ts +16 -9
- package/dist/core/installers/clients/ClientInstaller.js +80 -527
- package/dist/core/installers/clients/ClientInstallerFactory.d.ts +20 -0
- package/dist/core/installers/clients/ClientInstallerFactory.js +37 -0
- package/dist/core/installers/clients/ClineInstaller.d.ts +18 -0
- package/dist/core/installers/clients/ClineInstaller.js +124 -0
- package/dist/core/installers/clients/GithubCopilotInstaller.d.ts +34 -0
- package/dist/core/installers/clients/GithubCopilotInstaller.js +162 -0
- package/dist/core/installers/clients/MSRooCodeInstaller.d.ts +15 -0
- package/dist/core/installers/clients/MSRooCodeInstaller.js +122 -0
- package/dist/core/installers/requirements/BaseInstaller.d.ts +11 -34
- package/dist/core/installers/requirements/BaseInstaller.js +5 -116
- package/dist/core/installers/requirements/CommandInstaller.d.ts +6 -1
- package/dist/core/installers/requirements/CommandInstaller.js +7 -0
- package/dist/core/installers/requirements/GeneralInstaller.d.ts +6 -1
- package/dist/core/installers/requirements/GeneralInstaller.js +9 -4
- package/dist/core/installers/requirements/NpmInstaller.d.ts +46 -7
- package/dist/core/installers/requirements/NpmInstaller.js +150 -58
- package/dist/core/installers/requirements/PipInstaller.d.ts +9 -0
- package/dist/core/installers/requirements/PipInstaller.js +66 -28
- package/dist/core/onboard/FeedOnboardService.d.ts +50 -13
- package/dist/core/onboard/FeedOnboardService.js +263 -88
- package/dist/core/onboard/OnboardProcessor.d.ts +79 -0
- package/dist/core/onboard/OnboardProcessor.js +290 -0
- package/dist/core/onboard/OnboardStatus.d.ts +49 -0
- package/dist/core/onboard/OnboardStatus.js +10 -0
- package/dist/core/onboard/OnboardStatusManager.d.ts +57 -0
- package/dist/core/onboard/OnboardStatusManager.js +176 -0
- package/dist/core/types.d.ts +4 -5
- package/dist/core/validators/FeedValidator.d.ts +8 -1
- package/dist/core/validators/FeedValidator.js +60 -7
- package/dist/core/validators/IServerValidator.d.ts +19 -0
- package/dist/core/validators/IServerValidator.js +2 -0
- package/dist/core/validators/SSEServerValidator.d.ts +15 -0
- package/dist/core/validators/SSEServerValidator.js +39 -0
- package/dist/core/validators/ServerValidatorFactory.d.ts +24 -0
- package/dist/core/validators/ServerValidatorFactory.js +45 -0
- package/dist/core/validators/StdioServerValidator.d.ts +46 -0
- package/dist/core/validators/StdioServerValidator.js +229 -0
- package/dist/services/InstallRequestValidator.d.ts +1 -1
- package/dist/services/ServerService.d.ts +9 -6
- package/dist/services/ServerService.js +18 -7
- package/dist/utils/adoUtils.d.ts +29 -0
- package/dist/utils/adoUtils.js +252 -0
- package/dist/utils/clientUtils.d.ts +0 -7
- package/dist/utils/clientUtils.js +0 -42
- package/dist/utils/githubUtils.d.ts +10 -0
- package/dist/utils/githubUtils.js +22 -0
- package/dist/utils/macroExpressionUtils.d.ts +38 -0
- package/dist/utils/macroExpressionUtils.js +116 -0
- package/dist/utils/osUtils.d.ts +4 -20
- package/dist/utils/osUtils.js +78 -23
- package/dist/web/contract/serverContract.d.ts +3 -1
- package/dist/web/public/css/notifications.css +48 -17
- package/dist/web/public/css/onboard.css +66 -3
- package/dist/web/public/index.html +84 -16
- package/dist/web/public/js/api.js +3 -6
- package/dist/web/public/js/flights/flights.js +127 -0
- package/dist/web/public/js/modal/installation.js +5 -5
- package/dist/web/public/js/modal/modalSetup.js +3 -2
- package/dist/web/public/js/notifications.js +66 -27
- package/dist/web/public/js/onboard/ONBOARDING_PAGE_DESIGN.md +338 -0
- package/dist/web/public/js/onboard/formProcessor.js +810 -255
- package/dist/web/public/js/onboard/index.js +328 -85
- package/dist/web/public/js/onboard/publishHandler.js +132 -0
- package/dist/web/public/js/onboard/state.js +61 -17
- package/dist/web/public/js/onboard/templates.js +217 -249
- package/dist/web/public/js/onboard/uiHandlers.js +679 -117
- package/dist/web/public/js/onboard/validationHandlers.js +378 -0
- package/dist/web/public/js/serverCategoryList.js +15 -2
- package/dist/web/public/onboard.html +191 -45
- package/dist/web/public/styles.css +91 -1
- package/dist/web/server.d.ts +0 -10
- package/dist/web/server.js +131 -22
- package/package.json +2 -2
- package/src/core/ConfigurationProvider.ts +15 -0
- package/src/core/InstallationService.ts +2 -7
- package/src/core/MCPManager.ts +26 -1
- package/src/core/RequirementService.ts +2 -9
- package/src/core/installers/clients/BaseClientInstaller.ts +196 -0
- package/src/core/installers/clients/ClientInstaller.ts +97 -608
- package/src/core/installers/clients/ClientInstallerFactory.ts +43 -0
- package/src/core/installers/clients/ClineInstaller.ts +135 -0
- package/src/core/installers/clients/GithubCopilotInstaller.ts +179 -0
- package/src/core/installers/clients/MSRooCodeInstaller.ts +133 -0
- package/src/core/installers/requirements/BaseInstaller.ts +13 -136
- package/src/core/installers/requirements/CommandInstaller.ts +9 -1
- package/src/core/installers/requirements/GeneralInstaller.ts +11 -4
- package/src/core/installers/requirements/NpmInstaller.ts +178 -61
- package/src/core/installers/requirements/PipInstaller.ts +68 -29
- package/src/core/onboard/FeedOnboardService.ts +346 -0
- package/src/core/onboard/OnboardProcessor.ts +305 -0
- package/src/core/onboard/OnboardStatus.ts +55 -0
- package/src/core/onboard/OnboardStatusManager.ts +188 -0
- package/src/core/types.ts +4 -5
- package/src/core/validators/FeedValidator.ts +79 -0
- package/src/core/validators/IServerValidator.ts +21 -0
- package/src/core/validators/SSEServerValidator.ts +43 -0
- package/src/core/validators/ServerValidatorFactory.ts +51 -0
- package/src/core/validators/StdioServerValidator.ts +259 -0
- package/src/services/InstallRequestValidator.ts +1 -1
- package/src/services/ServerService.ts +22 -7
- package/src/utils/adoUtils.ts +291 -0
- package/src/utils/clientUtils.ts +0 -44
- package/src/utils/githubUtils.ts +24 -0
- package/src/utils/macroExpressionUtils.ts +121 -0
- package/src/utils/osUtils.ts +89 -24
- package/src/web/contract/serverContract.ts +74 -0
- package/src/web/public/css/notifications.css +48 -17
- package/src/web/public/css/onboard.css +107 -0
- package/src/web/public/index.html +84 -16
- package/src/web/public/js/api.js +3 -6
- package/src/web/public/js/flights/flights.js +127 -0
- package/src/web/public/js/modal/installation.js +5 -5
- package/src/web/public/js/modal/modalSetup.js +3 -2
- package/src/web/public/js/notifications.js +66 -27
- package/src/web/public/js/onboard/ONBOARDING_PAGE_DESIGN.md +338 -0
- package/src/web/public/js/onboard/formProcessor.js +864 -0
- package/src/web/public/js/onboard/index.js +374 -0
- package/src/web/public/js/onboard/publishHandler.js +132 -0
- package/src/web/public/js/onboard/state.js +76 -0
- package/src/web/public/js/onboard/templates.js +343 -0
- package/src/web/public/js/onboard/uiHandlers.js +758 -0
- package/src/web/public/js/onboard/validationHandlers.js +378 -0
- package/src/web/public/js/serverCategoryList.js +15 -2
- package/src/web/public/onboard.html +296 -0
- package/src/web/public/styles.css +91 -1
- package/src/web/server.ts +167 -58
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { BaseInstaller } from './BaseInstaller.js';
|
|
2
|
-
import { handleGitHubRelease } from '../../../utils/githubUtils.js';
|
|
2
|
+
import { handleGitHubRelease, getGitHubLatestVersion } from '../../../utils/githubUtils.js';
|
|
3
|
+
// Assuming getArtifactLatestVersion will be available in adoUtils.ts
|
|
4
|
+
import { handleArtifact as handleAdoArtifact, getArtifactLatestVersion } from '../../../utils/adoUtils.js';
|
|
5
|
+
import { compareVersions } from '../../../utils/versionUtils.js';
|
|
6
|
+
import { Logger } from '../../../utils/logger.js';
|
|
3
7
|
/**
|
|
4
8
|
* Installer implementation for Python packages using pip
|
|
5
9
|
*/
|
|
@@ -20,29 +24,71 @@ export class PipInstaller extends BaseInstaller {
|
|
|
20
24
|
return requirement.type === 'pip';
|
|
21
25
|
}
|
|
22
26
|
supportCheckUpdates() {
|
|
23
|
-
/// temporarily disabling update check for pip as not able to get which pip of python is being used
|
|
24
27
|
return true;
|
|
25
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Get the latest version available for the pip package.
|
|
31
|
+
* @param requirement The requirement to check.
|
|
32
|
+
* @param options Optional server install options.
|
|
33
|
+
* @returns The latest version string, or undefined if not found or not applicable.
|
|
34
|
+
*/
|
|
35
|
+
async getLatestVersion(requirement, options) {
|
|
36
|
+
if (requirement.registry) {
|
|
37
|
+
if (requirement.registry.githubRelease) {
|
|
38
|
+
return getGitHubLatestVersion(this.execPromise, requirement.registry.githubRelease.repository);
|
|
39
|
+
}
|
|
40
|
+
else if (requirement.registry.artifacts) {
|
|
41
|
+
// Assuming getArtifactLatestVersion exists and has a compatible signature
|
|
42
|
+
return getArtifactLatestVersion(requirement, requirement.registry.artifacts, options);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// Default: get common latest version from pip index
|
|
46
|
+
const pipCmd = this.getPipCommand(options);
|
|
47
|
+
const { stdout } = await this.execPromise(`${pipCmd} index versions ${requirement.name} --pre=0`);
|
|
48
|
+
// Parse output to find the latest version. Example output:
|
|
49
|
+
// mypackage (1.0.0)
|
|
50
|
+
// Available versions: 1.0.0, 0.9.0
|
|
51
|
+
// LATEST: 1.0.0
|
|
52
|
+
// Or for some packages:
|
|
53
|
+
// mypackage
|
|
54
|
+
// VERSIONS: 1.0.0, 0.9.0
|
|
55
|
+
// Latest: 1.0.0
|
|
56
|
+
const latestMatch = stdout.match(/(?:LATEST|Latest):\s*([^\s]+)/);
|
|
57
|
+
if (latestMatch && latestMatch[1]) {
|
|
58
|
+
return latestMatch[1];
|
|
59
|
+
}
|
|
60
|
+
// Fallback if LATEST line is not found, try to get the first version from "Available versions" or "VERSIONS"
|
|
61
|
+
const versionsMatch = stdout.match(/(?:Available versions|VERSIONS):\s*([^\n]+)/);
|
|
62
|
+
if (versionsMatch && versionsMatch[1]) {
|
|
63
|
+
const versions = versionsMatch[1].split(',').map(v => v.trim());
|
|
64
|
+
if (versions.length > 0) {
|
|
65
|
+
// Assuming versions are listed in a somewhat reasonable order,
|
|
66
|
+
// or we might need more sophisticated version sorting here.
|
|
67
|
+
return versions[0];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return undefined; // Or throw an error if version cannot be determined
|
|
71
|
+
}
|
|
26
72
|
/**
|
|
27
73
|
* Check if the Python package is already installed
|
|
28
74
|
* @param requirement The requirement to check
|
|
75
|
+
* @param options Optional server install options
|
|
29
76
|
* @returns The status of the requirement
|
|
30
77
|
*/
|
|
31
78
|
async checkInstallation(requirement, options) {
|
|
32
79
|
try {
|
|
33
80
|
const pipCmd = this.getPipCommand(options);
|
|
34
81
|
const { stdout, stderr } = await this.execPromise(`${pipCmd} show ${requirement.name}`);
|
|
35
|
-
|
|
36
|
-
const installed = stdout.includes(requirement.name);
|
|
82
|
+
const installed = stdout.includes(requirement.name.toLowerCase());
|
|
37
83
|
const versionMatch = stdout.match(/Version: (.+)/);
|
|
38
84
|
const installedVersion = versionMatch ? versionMatch[1] : undefined;
|
|
39
85
|
return {
|
|
40
86
|
name: requirement.name,
|
|
41
87
|
type: 'pip',
|
|
42
|
-
installed,
|
|
88
|
+
installed: installed,
|
|
43
89
|
version: installedVersion,
|
|
44
90
|
inProgress: false,
|
|
45
|
-
pythonEnv: this.getPythonCommand(options)
|
|
91
|
+
pythonEnv: this.getPythonCommand(options)
|
|
46
92
|
};
|
|
47
93
|
}
|
|
48
94
|
catch (error) {
|
|
@@ -52,70 +98,62 @@ export class PipInstaller extends BaseInstaller {
|
|
|
52
98
|
installed: false,
|
|
53
99
|
error: error instanceof Error ? error.message : String(error),
|
|
54
100
|
inProgress: false,
|
|
55
|
-
pythonEnv: this.getPythonCommand(options)
|
|
101
|
+
pythonEnv: this.getPythonCommand(options)
|
|
56
102
|
};
|
|
57
103
|
}
|
|
58
104
|
}
|
|
59
105
|
/**
|
|
60
106
|
* Install the Python package
|
|
61
107
|
* @param requirement The requirement to install
|
|
108
|
+
* @param options Optional server install options
|
|
62
109
|
* @returns The status of the installation
|
|
63
110
|
*/
|
|
64
111
|
async install(requirement, options) {
|
|
65
112
|
try {
|
|
66
113
|
const status = await this.checkInstallation(requirement, options);
|
|
67
|
-
if (status.installed) {
|
|
114
|
+
if (status.installed && status.version && compareVersions(status.version, requirement.version) === 0 && !requirement.version.toLowerCase().includes('latest')) {
|
|
115
|
+
Logger.log(`${requirement.name}==${status.version} already installed for ${this.getPythonCommand}.`);
|
|
68
116
|
return status;
|
|
69
117
|
}
|
|
70
118
|
const pipCmd = this.getPipCommand(options);
|
|
71
|
-
// If no registry is specified, use standard pip installation
|
|
72
119
|
if (!requirement.registry) {
|
|
73
|
-
// Standard pip installation
|
|
74
120
|
const { stderr } = await this.execPromise(`${pipCmd} install ${requirement.name}==${requirement.version}`);
|
|
75
121
|
if (stderr && stderr.toLowerCase().includes('error')) {
|
|
76
122
|
throw new Error(stderr);
|
|
77
123
|
}
|
|
78
124
|
}
|
|
79
125
|
else {
|
|
80
|
-
// Handle different registry types
|
|
81
126
|
let packageSource;
|
|
82
127
|
if (requirement.registry.githubRelease) {
|
|
83
128
|
const result = await handleGitHubRelease(requirement, requirement.registry.githubRelease);
|
|
84
129
|
packageSource = result.resolvedPath;
|
|
85
|
-
// Install from the downloaded wheel or tar.gz file
|
|
86
130
|
const { stderr } = await this.execPromise(`${pipCmd} install "${packageSource}"`);
|
|
87
131
|
if (stderr && stderr.toLowerCase().includes('error')) {
|
|
88
132
|
throw new Error(stderr);
|
|
89
133
|
}
|
|
90
134
|
}
|
|
91
135
|
else if (requirement.registry.artifacts) {
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
const { stderr } = await this.execPromise(`${pipCmd} install ${
|
|
136
|
+
const pythonCmd = this.getPythonCommand(options);
|
|
137
|
+
const adoArtifactResult = await handleAdoArtifact(requirement, requirement.registry.artifacts, pythonCmd);
|
|
138
|
+
const { stderr } = await this.execPromise(`${pipCmd} install ${adoArtifactResult.package} --extra-index-url ${adoArtifactResult.registryUrl}`);
|
|
95
139
|
if (stderr && stderr.toLowerCase().includes('error')) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
packageSource = await this.handleLocalRegistry(requirement, requirement.registry.local);
|
|
101
|
-
// Install from the local path
|
|
102
|
-
const { stderr } = await this.execPromise(`${pipCmd} install "${packageSource}"`);
|
|
103
|
-
if (stderr && stderr.toLowerCase().includes('error')) {
|
|
104
|
-
throw new Error(stderr);
|
|
140
|
+
const checkStatus = await this.checkInstallation(requirement, options);
|
|
141
|
+
if (!checkStatus.installed) {
|
|
142
|
+
throw new Error(`Pip installation failed with: ${stderr}`);
|
|
143
|
+
}
|
|
105
144
|
}
|
|
106
145
|
}
|
|
107
146
|
else {
|
|
108
147
|
throw new Error('Invalid registry configuration');
|
|
109
148
|
}
|
|
110
149
|
}
|
|
111
|
-
// Store the pythonEnv in the status for future use
|
|
112
150
|
return {
|
|
113
151
|
name: requirement.name,
|
|
114
152
|
type: 'pip',
|
|
115
153
|
installed: true,
|
|
116
|
-
version: requirement.version,
|
|
154
|
+
version: requirement.version, // This might need to be updated to actual installed version
|
|
117
155
|
inProgress: false,
|
|
118
|
-
pythonEnv: this.getPythonCommand(options)
|
|
156
|
+
pythonEnv: this.getPythonCommand(options)
|
|
119
157
|
};
|
|
120
158
|
}
|
|
121
159
|
catch (error) {
|
|
@@ -125,7 +163,7 @@ export class PipInstaller extends BaseInstaller {
|
|
|
125
163
|
installed: false,
|
|
126
164
|
error: error instanceof Error ? error.message : String(error),
|
|
127
165
|
inProgress: false,
|
|
128
|
-
pythonEnv: this.getPythonCommand(options)
|
|
166
|
+
pythonEnv: this.getPythonCommand(options)
|
|
129
167
|
};
|
|
130
168
|
}
|
|
131
169
|
}
|
|
@@ -1,35 +1,72 @@
|
|
|
1
1
|
import { FeedConfiguration } from '../types.js';
|
|
2
|
+
import { OperationStatus } from './OnboardStatus.js';
|
|
2
3
|
/**
|
|
3
4
|
* Service for handling feed onboarding operations
|
|
4
5
|
*/
|
|
5
6
|
export declare class FeedOnboardService {
|
|
6
|
-
private tempDir;
|
|
7
|
-
private repoDir;
|
|
8
7
|
constructor();
|
|
9
8
|
/**
|
|
10
9
|
* Onboard a new feed configuration
|
|
11
10
|
* @param config Feed configuration to onboard
|
|
12
11
|
*/
|
|
13
|
-
onboardFeed(config: FeedConfiguration): Promise<
|
|
12
|
+
onboardFeed(config: FeedConfiguration, forExistingCategory?: boolean): Promise<OperationStatus & {
|
|
13
|
+
feedConfiguration?: FeedConfiguration;
|
|
14
|
+
}>;
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
+
* Validate a feed configuration without performing full onboarding
|
|
17
|
+
* @param config Feed configuration to validate
|
|
18
|
+
* @returns Operation status indicating the result of the validation initiation
|
|
16
19
|
*/
|
|
17
|
-
|
|
20
|
+
validateFeed(config: FeedConfiguration, forExistingCategory?: boolean): Promise<OperationStatus & {
|
|
21
|
+
feedConfiguration?: FeedConfiguration;
|
|
22
|
+
}>;
|
|
18
23
|
/**
|
|
19
|
-
*
|
|
24
|
+
* Initiates either a full onboarding or a validation-only operation.
|
|
25
|
+
* It checks for existing non-completed operations for the same feed and operation type.
|
|
26
|
+
* If an existing operation is found, its status is returned. Otherwise, a new operation is created and started.
|
|
27
|
+
* @param config The feed configuration.
|
|
28
|
+
* @param operationType The type of operation to initiate (FULL_ONBOARDING or VALIDATION_ONLY).
|
|
29
|
+
* @returns A promise that resolves to the operation status.
|
|
20
30
|
*/
|
|
21
|
-
private
|
|
31
|
+
private _initiateOperation;
|
|
22
32
|
/**
|
|
23
|
-
*
|
|
33
|
+
* Finds an existing non-completed operation for a given feed name, server name, and operation type.
|
|
34
|
+
* @param feedName The name of the feed.
|
|
35
|
+
* @param operationType The type of operation.
|
|
36
|
+
* @returns A promise that resolves to the OnboardStatus of the existing operation, or undefined if not found.
|
|
24
37
|
*/
|
|
25
|
-
private
|
|
38
|
+
private _findExistingNonCompletedOperation;
|
|
26
39
|
/**
|
|
27
|
-
*
|
|
40
|
+
* Performs static validation of the feed configuration.
|
|
41
|
+
* @param config The feed configuration to validate.
|
|
42
|
+
* @param forExistingCategory Whether this is for an existing category.
|
|
43
|
+
* @throws Error if validation fails.
|
|
28
44
|
*/
|
|
29
|
-
private
|
|
45
|
+
private validateStaticConfig;
|
|
30
46
|
/**
|
|
31
|
-
*
|
|
47
|
+
* Validates the feed configuration.
|
|
48
|
+
* Updates the onboarding status to VALIDATING, then to VALIDATED or FAILED based on the validation result.
|
|
49
|
+
* @param onboardingId The ID of the onboarding process.
|
|
50
|
+
* @param config The feed configuration to validate.
|
|
51
|
+
* @throws Error if validation fails, to be caught by the calling process.
|
|
32
52
|
*/
|
|
33
|
-
private
|
|
53
|
+
private _validateFeedConfiguration;
|
|
54
|
+
/**
|
|
55
|
+
* Processes a validation-only operation for a feed configuration.
|
|
56
|
+
* It validates the configuration and updates the status to SUCCEEDED if validation is successful.
|
|
57
|
+
* If validation fails, the error is handled by _validateFeedConfiguration and the calling _initiateOperation method.
|
|
58
|
+
* @param onboardingId The ID of the onboarding process.
|
|
59
|
+
* @param config The feed configuration.
|
|
60
|
+
*/
|
|
61
|
+
private processValidationOnly;
|
|
62
|
+
/**
|
|
63
|
+
* Processes the full onboarding for a feed configuration.
|
|
64
|
+
* This includes validation, forking/cloning the repository, saving the config, and creating a pull request.
|
|
65
|
+
* Manages status updates throughout the process and handles cleanup of temporary directories.
|
|
66
|
+
* @param onboardingId The ID of the onboarding process.
|
|
67
|
+
* @param config The feed configuration.
|
|
68
|
+
* @throws Error if any step of the full onboarding process fails.
|
|
69
|
+
*/
|
|
70
|
+
private processFullOnboarding;
|
|
34
71
|
}
|
|
35
72
|
export declare const feedOnboardService: FeedOnboardService;
|