imcp 0.1.6 → 0.1.8-dev
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 +1 -106
- package/dist/cli/commands/install.js.map +1 -0
- package/dist/cli/commands/list.js +1 -90
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/pull.js +1 -16
- package/dist/cli/commands/pull.js.map +1 -0
- package/dist/cli/commands/serve.js +1 -33
- package/dist/cli/commands/serve.js.map +1 -0
- package/dist/cli/commands/uninstall.js +1 -46
- package/dist/cli/commands/uninstall.js.map +1 -0
- package/dist/cli/index.js +1 -65
- package/dist/cli/index.js.map +1 -0
- package/dist/core/installers/clients/BaseClientInstaller.js +1 -282
- package/dist/core/installers/clients/BaseClientInstaller.js.map +1 -0
- package/dist/core/installers/clients/ClientInstaller.js +1 -163
- package/dist/core/installers/clients/ClientInstaller.js.map +1 -0
- package/dist/core/installers/clients/ClientInstallerFactory.js +1 -36
- package/dist/core/installers/clients/ClientInstallerFactory.js.map +1 -0
- package/dist/core/installers/clients/ClineInstaller.js +1 -30
- package/dist/core/installers/clients/ClineInstaller.js.map +1 -0
- package/dist/core/installers/clients/ExtensionInstaller.js +1 -151
- package/dist/core/installers/clients/ExtensionInstaller.js.map +1 -0
- package/dist/core/installers/clients/GithubCopilotInstaller.js +1 -68
- package/dist/core/installers/clients/GithubCopilotInstaller.js.map +1 -0
- package/dist/core/installers/clients/MSRooCodeInstaller.js +1 -28
- package/dist/core/installers/clients/MSRooCodeInstaller.js.map +1 -0
- package/dist/core/installers/index.js +1 -8
- package/dist/core/installers/index.js.map +1 -0
- package/dist/core/installers/requirements/BaseInstaller.js +1 -56
- package/dist/core/installers/requirements/BaseInstaller.js.map +1 -0
- package/dist/core/installers/requirements/CommandInstaller.js +1 -213
- package/dist/core/installers/requirements/CommandInstaller.js.map +1 -0
- package/dist/core/installers/requirements/GeneralInstaller.js +1 -126
- package/dist/core/installers/requirements/GeneralInstaller.js.map +1 -0
- package/dist/core/installers/requirements/InstallerFactory.js +1 -99
- package/dist/core/installers/requirements/InstallerFactory.js.map +1 -0
- package/dist/core/installers/requirements/NpmInstaller.js +1 -235
- package/dist/core/installers/requirements/NpmInstaller.js.map +1 -0
- package/dist/core/installers/requirements/NugetInstaller.js +1 -188
- package/dist/core/installers/requirements/NugetInstaller.js.map +1 -0
- package/dist/core/installers/requirements/PipInstaller.js +1 -192
- package/dist/core/installers/requirements/PipInstaller.js.map +1 -0
- package/dist/core/installers/requirements/RequirementInstaller.js +1 -2
- package/dist/core/installers/requirements/RequirementInstaller.js.map +1 -0
- package/dist/core/loaders/ConfigurationLoader.js +1 -256
- package/dist/core/loaders/ConfigurationLoader.js.map +1 -0
- package/dist/core/loaders/ConfigurationProvider.js +1 -383
- package/dist/core/loaders/ConfigurationProvider.js.map +1 -0
- package/dist/core/loaders/InstallOperationManager.js +1 -310
- package/dist/core/loaders/InstallOperationManager.js.map +1 -0
- package/dist/core/loaders/ServerSchemaLoader.js +1 -108
- package/dist/core/loaders/ServerSchemaLoader.js.map +1 -0
- package/dist/core/loaders/ServerSchemaProvider.js +1 -89
- package/dist/core/loaders/ServerSchemaProvider.js.map +1 -0
- package/dist/core/loaders/SystemSettingsManager.js +1 -256
- package/dist/core/loaders/SystemSettingsManager.js.map +1 -0
- package/dist/core/metadatas/constants.js +1 -100
- package/dist/core/metadatas/constants.js.map +1 -0
- package/dist/core/metadatas/recordingConstants.js +1 -46
- package/dist/core/metadatas/recordingConstants.js.map +1 -0
- package/dist/core/metadatas/types.js +1 -15
- package/dist/core/metadatas/types.js.map +1 -0
- package/dist/core/onboard/FeedOnboardService.js +1 -422
- package/dist/core/onboard/FeedOnboardService.js.map +1 -0
- package/dist/core/onboard/OnboardProcessor.js +1 -333
- package/dist/core/onboard/OnboardProcessor.js.map +1 -0
- package/dist/core/onboard/OnboardStatus.js +1 -9
- package/dist/core/onboard/OnboardStatus.js.map +1 -0
- package/dist/core/onboard/OnboardStatusManager.js +1 -360
- package/dist/core/onboard/OnboardStatusManager.js.map +1 -0
- package/dist/core/validators/FeedValidator.js +1 -133
- package/dist/core/validators/FeedValidator.js.map +1 -0
- package/dist/core/validators/IServerValidator.js +1 -1
- package/dist/core/validators/IServerValidator.js.map +1 -0
- package/dist/core/validators/SSEServerValidator.js +1 -38
- package/dist/core/validators/SSEServerValidator.js.map +1 -0
- package/dist/core/validators/ServerValidatorFactory.js +1 -44
- package/dist/core/validators/ServerValidatorFactory.js.map +1 -0
- package/dist/core/validators/StdioServerValidator.js +1 -281
- package/dist/core/validators/StdioServerValidator.js.map +1 -0
- package/dist/index.js +1 -18
- package/dist/index.js.map +1 -0
- package/dist/services/InstallationService.js +1 -81
- package/dist/services/InstallationService.js.map +1 -0
- package/dist/services/MCPManager.js +1 -197
- package/dist/services/MCPManager.js.map +1 -0
- package/dist/services/RequirementService.js +1 -548
- package/dist/services/RequirementService.js.map +1 -0
- package/dist/services/ServerService.js +1 -127
- package/dist/services/ServerService.js.map +1 -0
- package/dist/services/TelemetryService.js +1 -53
- package/dist/services/TelemetryService.js.map +1 -0
- package/dist/utils/UpdateCheckTracker.js +1 -79
- package/dist/utils/UpdateCheckTracker.js.map +1 -0
- package/dist/utils/adoUtils.js +1 -254
- package/dist/utils/adoUtils.js.map +1 -0
- package/dist/utils/clientUtils.js +1 -65
- package/dist/utils/clientUtils.js.map +1 -0
- package/dist/utils/feedUtils.js +1 -28
- package/dist/utils/feedUtils.js.map +1 -0
- package/dist/utils/githubAuth.js +1 -177
- package/dist/utils/githubAuth.js.map +1 -0
- package/dist/utils/githubUtils.js +1 -125
- package/dist/utils/githubUtils.js.map +1 -0
- package/dist/utils/logger.js +1 -176
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/macroExpressionUtils.js +1 -93
- package/dist/utils/macroExpressionUtils.js.map +1 -0
- package/dist/utils/osUtils.js +1 -664
- package/dist/utils/osUtils.js.map +1 -0
- package/dist/utils/versionUtils.js +1 -101
- package/dist/utils/versionUtils.js.map +1 -0
- package/dist/web/contract/serverContract.js +1 -1
- package/dist/web/contract/serverContract.js.map +1 -0
- package/dist/web/public/js/api.js +2 -132
- package/dist/web/public/js/api.js.map +1 -0
- package/dist/web/public/js/detailsWidget.js +2 -264
- package/dist/web/public/js/detailsWidget.js.map +1 -0
- package/dist/web/public/js/flights/flights.js +2 -127
- package/dist/web/public/js/flights/flights.js.map +1 -0
- package/dist/web/public/js/modal/index.js +2 -52
- package/dist/web/public/js/modal/index.js.map +1 -0
- package/dist/web/public/js/modal/installModal.js +2 -162
- package/dist/web/public/js/modal/installModal.js.map +1 -0
- package/dist/web/public/js/modal/installation.js +2 -266
- package/dist/web/public/js/modal/installation.js.map +1 -0
- package/dist/web/public/js/modal/loadingModal.js +2 -182
- package/dist/web/public/js/modal/loadingModal.js.map +1 -0
- package/dist/web/public/js/modal/modalSetup.js +2 -595
- package/dist/web/public/js/modal/modalSetup.js.map +1 -0
- package/dist/web/public/js/modal/modalUtils.js +2 -37
- package/dist/web/public/js/modal/modalUtils.js.map +1 -0
- package/dist/web/public/js/modal/versionUtils.js +2 -20
- package/dist/web/public/js/modal/versionUtils.js.map +1 -0
- package/dist/web/public/js/modal.js +2 -42
- package/dist/web/public/js/modal.js.map +1 -0
- package/dist/web/public/js/notifications.js +2 -137
- package/dist/web/public/js/notifications.js.map +1 -0
- package/dist/web/public/js/onboard/formProcessor.js +2 -1037
- package/dist/web/public/js/onboard/formProcessor.js.map +1 -0
- package/dist/web/public/js/onboard/index.js +2 -374
- package/dist/web/public/js/onboard/index.js.map +1 -0
- package/dist/web/public/js/onboard/publishHandler.js +2 -172
- package/dist/web/public/js/onboard/publishHandler.js.map +1 -0
- package/dist/web/public/js/onboard/state.js +2 -76
- package/dist/web/public/js/onboard/state.js.map +1 -0
- package/dist/web/public/js/onboard/templates.js +2 -342
- package/dist/web/public/js/onboard/templates.js.map +1 -0
- package/dist/web/public/js/onboard/uiHandlers.js +2 -1076
- package/dist/web/public/js/onboard/uiHandlers.js.map +1 -0
- package/dist/web/public/js/onboard/validationHandlers.js +2 -493
- package/dist/web/public/js/onboard/validationHandlers.js.map +1 -0
- package/dist/web/public/js/serverCategoryDetails.js +2 -364
- package/dist/web/public/js/serverCategoryDetails.js.map +1 -0
- package/dist/web/public/js/serverCategoryList.js +2 -241
- package/dist/web/public/js/serverCategoryList.js.map +1 -0
- package/dist/web/public/js/settings.js +2 -314
- package/dist/web/public/js/settings.js.map +1 -0
- package/dist/web/server.js +1 -404
- package/dist/web/server.js.map +1 -0
- package/package.json +8 -2
- package/.github/ISSUE_TEMPLATE/JitAccess.yml +0 -28
- package/.github/acl/access.yml +0 -20
- package/.github/compliance/inventory.yml +0 -5
- package/.github/policies/jit.yml +0 -19
- package/.github/workflows/build.yml +0 -28
- package/.roo/rules-code/rules.md +0 -88
- package/dist/cli/commands/start.d.ts +0 -2
- package/dist/cli/commands/start.js +0 -32
- package/dist/cli/commands/sync.d.ts +0 -2
- package/dist/cli/commands/sync.js +0 -17
- package/dist/core/ConfigurationLoader.d.ts +0 -32
- package/dist/core/ConfigurationLoader.js +0 -236
- package/dist/core/ConfigurationProvider.d.ts +0 -35
- package/dist/core/ConfigurationProvider.js +0 -375
- package/dist/core/InstallationService.d.ts +0 -50
- package/dist/core/InstallationService.js +0 -350
- package/dist/core/MCPManager.d.ts +0 -28
- package/dist/core/MCPManager.js +0 -188
- package/dist/core/RequirementService.d.ts +0 -40
- package/dist/core/RequirementService.js +0 -110
- package/dist/core/ServerSchemaLoader.d.ts +0 -11
- package/dist/core/ServerSchemaLoader.js +0 -43
- package/dist/core/ServerSchemaProvider.d.ts +0 -17
- package/dist/core/ServerSchemaProvider.js +0 -120
- package/dist/core/constants.d.ts +0 -47
- package/dist/core/constants.js +0 -94
- package/dist/core/installers/BaseInstaller.d.ts +0 -74
- package/dist/core/installers/BaseInstaller.js +0 -253
- package/dist/core/installers/ClientInstaller.d.ts +0 -23
- package/dist/core/installers/ClientInstaller.js +0 -564
- package/dist/core/installers/CommandInstaller.d.ts +0 -37
- package/dist/core/installers/CommandInstaller.js +0 -173
- package/dist/core/installers/GeneralInstaller.d.ts +0 -33
- package/dist/core/installers/GeneralInstaller.js +0 -85
- package/dist/core/installers/InstallerFactory.d.ts +0 -54
- package/dist/core/installers/InstallerFactory.js +0 -97
- package/dist/core/installers/NpmInstaller.d.ts +0 -26
- package/dist/core/installers/NpmInstaller.js +0 -127
- package/dist/core/installers/PipInstaller.d.ts +0 -28
- package/dist/core/installers/PipInstaller.js +0 -127
- package/dist/core/installers/RequirementInstaller.d.ts +0 -33
- package/dist/core/installers/RequirementInstaller.js +0 -3
- package/dist/core/types.d.ts +0 -166
- package/dist/core/types.js +0 -16
- package/dist/services/InstallRequestValidator.d.ts +0 -21
- package/dist/services/InstallRequestValidator.js +0 -99
- package/dist/web/public/js/modal/installHandler.js +0 -227
- package/dist/web/public/js/modal/loadingUI.js +0 -74
- package/dist/web/public/js/modal/messageQueue.js +0 -112
- package/dist/web/public/js/modal/modalUI.js +0 -214
- package/dist/web/public/js/modal/version.js +0 -20
- package/dist/web/public/js/onboard/ONBOARDING_PAGE_DESIGN.md +0 -370
- package/docs/ONBOARDING_PAGE_DESIGN.md +0 -260
- package/docs/Telemetry.md +0 -136
- package/memory-bank/activeContext.md +0 -26
- package/memory-bank/decisionLog.md +0 -91
- package/memory-bank/productContext.md +0 -41
- package/memory-bank/progress.md +0 -35
- package/memory-bank/systemPatterns.md +0 -10
- package/src/cli/commands/install.ts +0 -139
- package/src/cli/commands/list.ts +0 -113
- package/src/cli/commands/pull.ts +0 -16
- package/src/cli/commands/serve.ts +0 -39
- package/src/cli/commands/uninstall.ts +0 -64
- package/src/cli/index.ts +0 -82
- package/src/core/installers/clients/BaseClientInstaller.ts +0 -341
- package/src/core/installers/clients/ClientInstaller.ts +0 -222
- package/src/core/installers/clients/ClientInstallerFactory.ts +0 -43
- package/src/core/installers/clients/ClineInstaller.ts +0 -35
- package/src/core/installers/clients/ExtensionInstaller.ts +0 -165
- package/src/core/installers/clients/GithubCopilotInstaller.ts +0 -79
- package/src/core/installers/clients/MSRooCodeInstaller.ts +0 -32
- package/src/core/installers/index.ts +0 -11
- package/src/core/installers/requirements/BaseInstaller.ts +0 -85
- package/src/core/installers/requirements/CommandInstaller.ts +0 -231
- package/src/core/installers/requirements/GeneralInstaller.ts +0 -133
- package/src/core/installers/requirements/InstallerFactory.ts +0 -114
- package/src/core/installers/requirements/NpmInstaller.ts +0 -271
- package/src/core/installers/requirements/NugetInstaller.ts +0 -203
- package/src/core/installers/requirements/PipInstaller.ts +0 -207
- package/src/core/installers/requirements/RequirementInstaller.ts +0 -42
- package/src/core/loaders/ConfigurationLoader.ts +0 -298
- package/src/core/loaders/ConfigurationProvider.ts +0 -462
- package/src/core/loaders/InstallOperationManager.ts +0 -367
- package/src/core/loaders/ServerSchemaLoader.ts +0 -117
- package/src/core/loaders/ServerSchemaProvider.ts +0 -99
- package/src/core/loaders/SystemSettingsManager.ts +0 -278
- package/src/core/metadatas/constants.ts +0 -122
- package/src/core/metadatas/recordingConstants.ts +0 -65
- package/src/core/metadatas/types.ts +0 -202
- package/src/core/onboard/FeedOnboardService.ts +0 -501
- package/src/core/onboard/OnboardProcessor.ts +0 -356
- package/src/core/onboard/OnboardStatus.ts +0 -60
- package/src/core/onboard/OnboardStatusManager.ts +0 -416
- package/src/core/validators/FeedValidator.ts +0 -135
- package/src/core/validators/IServerValidator.ts +0 -21
- package/src/core/validators/SSEServerValidator.ts +0 -43
- package/src/core/validators/ServerValidatorFactory.ts +0 -51
- package/src/core/validators/StdioServerValidator.ts +0 -313
- package/src/index.ts +0 -44
- package/src/services/InstallationService.ts +0 -102
- package/src/services/MCPManager.ts +0 -249
- package/src/services/RequirementService.ts +0 -627
- package/src/services/ServerService.ts +0 -161
- package/src/services/TelemetryService.ts +0 -59
- package/src/utils/UpdateCheckTracker.ts +0 -86
- package/src/utils/adoUtils.ts +0 -293
- package/src/utils/clientUtils.ts +0 -72
- package/src/utils/feedUtils.ts +0 -31
- package/src/utils/githubAuth.ts +0 -212
- package/src/utils/githubUtils.ts +0 -164
- package/src/utils/logger.ts +0 -195
- package/src/utils/macroExpressionUtils.ts +0 -104
- package/src/utils/osUtils.ts +0 -700
- package/src/utils/versionUtils.ts +0 -114
- package/src/web/contract/serverContract.ts +0 -74
- package/src/web/public/css/detailsWidget.css +0 -235
- package/src/web/public/css/modal.css +0 -757
- package/src/web/public/css/notifications.css +0 -101
- package/src/web/public/css/onboard.css +0 -107
- package/src/web/public/css/serverCategoryList.css +0 -120
- package/src/web/public/css/serverDetails.css +0 -139
- package/src/web/public/index.html +0 -359
- package/src/web/public/js/api.js +0 -132
- package/src/web/public/js/detailsWidget.js +0 -264
- package/src/web/public/js/flights/flights.js +0 -127
- package/src/web/public/js/modal/index.js +0 -52
- package/src/web/public/js/modal/installModal.js +0 -162
- package/src/web/public/js/modal/installation.js +0 -266
- package/src/web/public/js/modal/loadingModal.js +0 -182
- package/src/web/public/js/modal/modalSetup.js +0 -595
- package/src/web/public/js/modal/modalUtils.js +0 -37
- package/src/web/public/js/modal/versionUtils.js +0 -20
- package/src/web/public/js/modal.js +0 -42
- package/src/web/public/js/notifications.js +0 -137
- package/src/web/public/js/onboard/formProcessor.js +0 -1037
- package/src/web/public/js/onboard/index.js +0 -374
- package/src/web/public/js/onboard/publishHandler.js +0 -172
- package/src/web/public/js/onboard/state.js +0 -76
- package/src/web/public/js/onboard/templates.js +0 -342
- package/src/web/public/js/onboard/uiHandlers.js +0 -1076
- package/src/web/public/js/onboard/validationHandlers.js +0 -493
- package/src/web/public/js/serverCategoryDetails.js +0 -364
- package/src/web/public/js/serverCategoryList.js +0 -241
- package/src/web/public/js/settings.js +0 -314
- package/src/web/public/modal.html +0 -84
- package/src/web/public/onboard.html +0 -296
- package/src/web/public/settings.html +0 -135
- package/src/web/public/styles.css +0 -277
- package/src/web/server.ts +0 -478
- package/tsconfig.json +0 -18
- package/wiki/Installation.md +0 -3
- package/wiki/Publish.md +0 -3
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../metadatas/types.js';
|
|
2
|
-
import { BaseInstaller } from './BaseInstaller.js';
|
|
3
|
-
import { handleGitHubRelease } from '../../../utils/githubUtils.js';
|
|
4
|
-
import { handleArtifact } from '../../../utils/adoUtils.js';
|
|
5
|
-
import { InstallOperationManager } from '../../loaders/InstallOperationManager.js';
|
|
6
|
-
import * as RecordingConstants from '../../metadatas/recordingConstants.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Installer implementation for general requirements (type 'other')
|
|
10
|
-
* This installer handles requirements that don't fit into specific package manager categories
|
|
11
|
-
*/
|
|
12
|
-
export class GeneralInstaller extends BaseInstaller {
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Constructor for the GeneralInstaller
|
|
16
|
-
* @param execPromise Function to execute commands
|
|
17
|
-
*/
|
|
18
|
-
getLatestVersion(requirement: RequirementConfig, options?: ServerInstallOptions): Promise<string | undefined> {
|
|
19
|
-
throw new Error('Method not implemented.');
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Check if this installer can handle the given requirement type
|
|
23
|
-
* @param requirement The requirement to check
|
|
24
|
-
* @returns True if this installer can handle the requirement
|
|
25
|
-
*/
|
|
26
|
-
canHandle(requirement: RequirementConfig): boolean {
|
|
27
|
-
return requirement.type === 'other';
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
supportCheckUpdates(): boolean {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Check if the requirement is already installed
|
|
35
|
-
* For general installers, we can't easily check if something is installed
|
|
36
|
-
* without specific knowledge of the requirement, so we always return false
|
|
37
|
-
*
|
|
38
|
-
* @param requirement The requirement to check
|
|
39
|
-
* @returns The status of the requirement
|
|
40
|
-
*/
|
|
41
|
-
async checkInstallation(requirement: RequirementConfig): Promise<RequirementStatus> {
|
|
42
|
-
// For general installers, we can't easily check if something is installed
|
|
43
|
-
// So we'll always return not installed, and the actual installation will check
|
|
44
|
-
return {
|
|
45
|
-
name: requirement.name,
|
|
46
|
-
type: 'other',
|
|
47
|
-
installed: false,
|
|
48
|
-
inProgress: false
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Install the general requirement
|
|
54
|
-
* For type 'other', this doesn't actually install anything, but downloads
|
|
55
|
-
* or locates the asset and returns the path for the caller to use
|
|
56
|
-
*
|
|
57
|
-
* @param requirement The requirement to install
|
|
58
|
-
* @returns The status of the installation, including the install path in updateInfo
|
|
59
|
-
*/
|
|
60
|
-
/**
|
|
61
|
-
* Install the general requirement
|
|
62
|
-
* For type 'other', this doesn't actually install anything, but downloads
|
|
63
|
-
* or locates the asset and returns the path for the caller to use
|
|
64
|
-
* @param requirement The requirement to install
|
|
65
|
-
* @param options Optional install options
|
|
66
|
-
* @param recorder Optional InstallOperationManager for recording steps
|
|
67
|
-
* @returns The status of the installation, including the install path in updateInfo
|
|
68
|
-
*/
|
|
69
|
-
async install(requirement: RequirementConfig, recorder: InstallOperationManager, options?: ServerInstallOptions): Promise<RequirementStatus> {
|
|
70
|
-
const doInstall = async (): Promise<RequirementStatus> => {
|
|
71
|
-
// For type 'other', a registry must be specified
|
|
72
|
-
if (!requirement.registry) {
|
|
73
|
-
throw new Error('Registry must be specified for requirement type "other"');
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
let installPath: string;
|
|
77
|
-
|
|
78
|
-
if (requirement.registry.githubRelease) {
|
|
79
|
-
const result = await handleGitHubRelease(requirement, requirement.registry.githubRelease);
|
|
80
|
-
installPath = result.resolvedPath;
|
|
81
|
-
} else if (requirement.registry.artifacts) {
|
|
82
|
-
await handleArtifact(requirement, requirement.registry.artifacts);
|
|
83
|
-
} else {
|
|
84
|
-
throw new Error('Invalid registry configuration');
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// For general installer, we just return the path to the downloaded/located file
|
|
88
|
-
// The actual installation mechanism would depend on the specific requirement
|
|
89
|
-
return {
|
|
90
|
-
name: requirement.name,
|
|
91
|
-
type: 'other',
|
|
92
|
-
installed: true,
|
|
93
|
-
version: requirement.version,
|
|
94
|
-
inProgress: false,
|
|
95
|
-
};
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
if (recorder) {
|
|
99
|
-
return recorder.recording(doInstall, {
|
|
100
|
-
stepName: RecordingConstants.STEP_GENERAL_INSTALLER_INSTALL,
|
|
101
|
-
inProgressMessage: `Installing general requirement: ${requirement.name}`,
|
|
102
|
-
endMessage: (result) =>
|
|
103
|
-
result.installed
|
|
104
|
-
? `Install completed for ${requirement.name}`
|
|
105
|
-
: `Install failed for ${requirement.name}`,
|
|
106
|
-
onError: (error) => {
|
|
107
|
-
return {
|
|
108
|
-
result: {
|
|
109
|
-
name: requirement.name,
|
|
110
|
-
type: 'other',
|
|
111
|
-
installed: false,
|
|
112
|
-
error: error instanceof Error ? error.message : String(error),
|
|
113
|
-
inProgress: false,
|
|
114
|
-
},
|
|
115
|
-
message: error instanceof Error ? error.message : String(error),
|
|
116
|
-
};
|
|
117
|
-
},
|
|
118
|
-
});
|
|
119
|
-
} else {
|
|
120
|
-
try {
|
|
121
|
-
return await doInstall();
|
|
122
|
-
} catch (error) {
|
|
123
|
-
return {
|
|
124
|
-
name: requirement.name,
|
|
125
|
-
type: 'other',
|
|
126
|
-
installed: false,
|
|
127
|
-
error: error instanceof Error ? error.message : String(error),
|
|
128
|
-
inProgress: false,
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../metadatas/types.js';
|
|
2
|
-
import { RequirementInstaller } from './RequirementInstaller.js';
|
|
3
|
-
import { NpmInstaller } from './NpmInstaller.js';
|
|
4
|
-
import { PipInstaller } from './PipInstaller.js';
|
|
5
|
-
import { NugetInstaller } from './NugetInstaller.js';
|
|
6
|
-
import { CommandInstaller } from './CommandInstaller.js';
|
|
7
|
-
import { GeneralInstaller } from './GeneralInstaller.js';
|
|
8
|
-
import { exec } from 'child_process';
|
|
9
|
-
import util from 'util';
|
|
10
|
-
import { InstallOperationManager } from '../../loaders/InstallOperationManager.js';
|
|
11
|
-
/**
|
|
12
|
-
* Factory for creating the appropriate installer for a requirement
|
|
13
|
-
*/
|
|
14
|
-
export class InstallerFactory {
|
|
15
|
-
private installers: RequirementInstaller[] = [];
|
|
16
|
-
private readonly execPromise: (command: string) => Promise<{ stdout: string; stderr: string }>;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Create a new InstallerFactory
|
|
20
|
-
* @param execPromise Function to execute commands
|
|
21
|
-
*/
|
|
22
|
-
constructor(execPromise: (command: string) => Promise<{ stdout: string; stderr: string }>) {
|
|
23
|
-
this.execPromise = execPromise;
|
|
24
|
-
this.registerDefaultInstallers();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Register default installers for npm, pip, and general requirements
|
|
29
|
-
* @private
|
|
30
|
-
*/
|
|
31
|
-
private registerDefaultInstallers(): void {
|
|
32
|
-
this.registerInstaller(new NpmInstaller(this.execPromise));
|
|
33
|
-
this.registerInstaller(new PipInstaller(this.execPromise));
|
|
34
|
-
this.registerInstaller(new NugetInstaller(this.execPromise));
|
|
35
|
-
this.registerInstaller(new CommandInstaller(this.execPromise));
|
|
36
|
-
this.registerInstaller(new GeneralInstaller(this.execPromise));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Register a custom installer
|
|
41
|
-
* @param installer The installer to register
|
|
42
|
-
*/
|
|
43
|
-
public registerInstaller(installer: RequirementInstaller): void {
|
|
44
|
-
this.installers.push(installer);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Get the appropriate installer for a requirement
|
|
49
|
-
* @param requirement The requirement to get an installer for
|
|
50
|
-
* @returns The appropriate installer, or undefined if none found
|
|
51
|
-
*/
|
|
52
|
-
public getInstaller(requirement: RequirementConfig): RequirementInstaller | undefined {
|
|
53
|
-
// Validate that if registry is empty, type must not be 'other'
|
|
54
|
-
if (!requirement.registry && requirement.type === 'other') {
|
|
55
|
-
throw new Error('Registry must be specified for requirement type "other"');
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return this.installers.find(installer => installer.canHandle(requirement));
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Install a requirement using the appropriate installer
|
|
63
|
-
* @param requirement The requirement to install
|
|
64
|
-
* @param recorder Optional InstallOperationManager for recording steps
|
|
65
|
-
* @param options Installation options including python environment
|
|
66
|
-
* @returns The installation status
|
|
67
|
-
*/
|
|
68
|
-
public async install(requirement: RequirementConfig, recorder: InstallOperationManager, options?: ServerInstallOptions): Promise<RequirementStatus> {
|
|
69
|
-
const installer = this.getInstaller(requirement);
|
|
70
|
-
if (!installer) {
|
|
71
|
-
return {
|
|
72
|
-
name: requirement.name,
|
|
73
|
-
type: requirement.type,
|
|
74
|
-
installed: false,
|
|
75
|
-
error: `No installer found for requirement type '${requirement.type}'`,
|
|
76
|
-
inProgress: false
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return await installer.install(requirement, recorder, options);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Check the installation status of a requirement
|
|
85
|
-
* @param requirement The requirement to check
|
|
86
|
-
* @param options Installation options including python environment
|
|
87
|
-
* @returns The installation status
|
|
88
|
-
*/
|
|
89
|
-
public async checkInstallation(requirement: RequirementConfig, options?: ServerInstallOptions): Promise<RequirementStatus> {
|
|
90
|
-
const installer = this.getInstaller(requirement);
|
|
91
|
-
if (!installer) {
|
|
92
|
-
return {
|
|
93
|
-
name: requirement.name,
|
|
94
|
-
type: requirement.type,
|
|
95
|
-
installed: false,
|
|
96
|
-
error: `No installer found for requirement type '${requirement.type}'`,
|
|
97
|
-
inProgress: false
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return await installer.checkInstallation(requirement, options);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Create a new InstallerFactory with default settings
|
|
107
|
-
* @param execPromise Optional function to execute commands
|
|
108
|
-
* @returns A new InstallerFactory
|
|
109
|
-
*/
|
|
110
|
-
export const createInstallerFactory = (
|
|
111
|
-
execPromise = util.promisify(exec)
|
|
112
|
-
): InstallerFactory => {
|
|
113
|
-
return new InstallerFactory(execPromise);
|
|
114
|
-
};
|
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../metadatas/types.js';
|
|
2
|
-
import { BaseInstaller } from './BaseInstaller.js';
|
|
3
|
-
import { compareVersions } from '../../../utils/versionUtils.js';
|
|
4
|
-
import { handleGitHubRelease, getGitHubLatestVersion } from '../../../utils/githubUtils.js';
|
|
5
|
-
// Assuming getArtifactLatestVersion will be available in adoUtils.ts
|
|
6
|
-
import { handleArtifact as handleAdoArtifact, AdoArtifactResult, getArtifactLatestVersion } from '../../../utils/adoUtils.js';
|
|
7
|
-
import path from 'path';
|
|
8
|
-
import fs from 'fs/promises';
|
|
9
|
-
import { SETTINGS_DIR } from '../../metadatas/constants.js'; // Corrected path
|
|
10
|
-
import { Logger } from '../../../utils/logger.js';
|
|
11
|
-
import { InstallOperationManager } from '../../loaders/InstallOperationManager.js';
|
|
12
|
-
import * as RecordingConstants from '../../metadatas/recordingConstants.js';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Installer implementation for NPM packages
|
|
16
|
-
*/
|
|
17
|
-
export class NpmInstaller extends BaseInstaller {
|
|
18
|
-
/**
|
|
19
|
-
* Check if this installer can handle the given requirement type
|
|
20
|
-
* @param requirement The requirement to check
|
|
21
|
-
* @returns True if this installer can handle the requirement
|
|
22
|
-
*/
|
|
23
|
-
canHandle(requirement: RequirementConfig): boolean {
|
|
24
|
-
return requirement.type === 'npm';
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
supportCheckUpdates(): boolean {
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Get the latest version available for the NPM package.
|
|
33
|
-
* @param requirement The requirement to check.
|
|
34
|
-
* @param options Optional server install options.
|
|
35
|
-
* @returns The latest version string, or undefined if not found or not applicable.
|
|
36
|
-
*/
|
|
37
|
-
async getLatestVersion(requirement: RequirementConfig, options?: ServerInstallOptions): Promise<string | undefined> {
|
|
38
|
-
if (requirement.registry) {
|
|
39
|
-
if (requirement.registry.githubRelease) {
|
|
40
|
-
return getGitHubLatestVersion(this.execPromise, requirement.registry.githubRelease.repository);
|
|
41
|
-
} else if (requirement.registry.artifacts) {
|
|
42
|
-
// Assuming getArtifactLatestVersion exists and has a compatible signature
|
|
43
|
-
// This might need adjustment based on the actual implementation of getArtifactLatestVersion
|
|
44
|
-
const targetDir = options?.settings?.folderName || this._getRequirementFolderPath(requirement);
|
|
45
|
-
return getArtifactLatestVersion(requirement, requirement.registry.artifacts, options, targetDir);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
// Default: get common latest version from npm registry
|
|
49
|
-
const { stdout } = await this.execPromise(`npm view ${requirement.name} version`);
|
|
50
|
-
return stdout.trim();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Generates a dedicated folder path for a requirement.
|
|
55
|
-
* @param requirement The requirement configuration.
|
|
56
|
-
* @returns The path to the requirement's dedicated folder.
|
|
57
|
-
* @private
|
|
58
|
-
*/
|
|
59
|
-
private _getRequirementFolderPath(requirement: RequirementConfig): string {
|
|
60
|
-
return path.join(
|
|
61
|
-
SETTINGS_DIR,
|
|
62
|
-
'npm_requirements',
|
|
63
|
-
requirement.name,
|
|
64
|
-
requirement.version.includes('latest') ? 'latest' : requirement.version);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Check if the NPM package is already installed in its dedicated folder.
|
|
69
|
-
* @param requirement The requirement to check
|
|
70
|
-
* @param options Installation options, may contain folderName.
|
|
71
|
-
* @returns The status of the requirement
|
|
72
|
-
*/
|
|
73
|
-
async checkInstallation(requirement: RequirementConfig, options?: ServerInstallOptions): Promise<RequirementStatus> {
|
|
74
|
-
const requirementDir = options?.settings?.folderName || this._getRequirementFolderPath(requirement);
|
|
75
|
-
const requirementName = this._getRequirementName(requirement);
|
|
76
|
-
Logger.debug(`Checking installation for ${requirementName} in ${requirementDir}`);
|
|
77
|
-
try {
|
|
78
|
-
const installedVersion = await this._getInstalledVersion(requirementName, requirementDir);
|
|
79
|
-
|
|
80
|
-
if (installedVersion) {
|
|
81
|
-
return {
|
|
82
|
-
name: requirement.name,
|
|
83
|
-
type: 'npm',
|
|
84
|
-
installed: true,
|
|
85
|
-
version: installedVersion,
|
|
86
|
-
npmPath: requirementDir,
|
|
87
|
-
inProgress: false,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
// If package not found in dependencies or version is missing
|
|
91
|
-
return {
|
|
92
|
-
name: requirement.name,
|
|
93
|
-
type: 'npm',
|
|
94
|
-
installed: false,
|
|
95
|
-
inProgress: false,
|
|
96
|
-
error: `Package ${requirement.name} not found or version missing in npm list output in ${requirementDir}.`,
|
|
97
|
-
};
|
|
98
|
-
} catch (error) {
|
|
99
|
-
// npm list command likely failed (e.g., package not installed, or requirementDir not an npm project)
|
|
100
|
-
Logger.debug(`Error checking installation for ${requirement.name} in ${requirementDir}: ${error instanceof Error ? error.message : String(error)}`);
|
|
101
|
-
return {
|
|
102
|
-
name: requirement.name,
|
|
103
|
-
type: 'npm',
|
|
104
|
-
installed: false,
|
|
105
|
-
inProgress: false,
|
|
106
|
-
error: error instanceof Error ? error.message : String(error),
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Retrieves the installed version of an NPM package from a given directory.
|
|
113
|
-
* @param requirementName The name of the NPM package.
|
|
114
|
-
* @param directory The directory to check for the package.
|
|
115
|
-
* @returns The installed version string, or undefined if not found or an error occurs.
|
|
116
|
-
* @private
|
|
117
|
-
*/
|
|
118
|
-
private async _getInstalledVersion(requirementName: string, directory: string): Promise<string | undefined> {
|
|
119
|
-
try {
|
|
120
|
-
const command = `npm list ${requirementName} --depth=0 --json --prefix "${directory}"`;
|
|
121
|
-
Logger.debug(`Getting installed version for ${requirementName} in ${directory} with command: ${command}`);
|
|
122
|
-
const { stdout } = await this.execPromise(command);
|
|
123
|
-
const listOutput = JSON.parse(stdout);
|
|
124
|
-
|
|
125
|
-
if (listOutput.dependencies && listOutput.dependencies[requirementName] && listOutput.dependencies[requirementName].version) {
|
|
126
|
-
return listOutput.dependencies[requirementName].version;
|
|
127
|
-
}
|
|
128
|
-
Logger.debug(`Package ${requirementName} not found in npm list output in ${directory}.`);
|
|
129
|
-
return undefined;
|
|
130
|
-
} catch (error) {
|
|
131
|
-
Logger.debug(`Error getting installed version for ${requirementName} in ${directory}: ${error instanceof Error ? error.message : String(error)}`);
|
|
132
|
-
return undefined; // Return undefined on error to indicate version couldn't be retrieved
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Get the name of the requirement, including registry information if applicable.
|
|
139
|
-
* @param requirement The requirement configuration.
|
|
140
|
-
* @returns The formatted requirement name.
|
|
141
|
-
* @private
|
|
142
|
-
*/
|
|
143
|
-
private _getRequirementName(requirement: RequirementConfig): string {
|
|
144
|
-
return requirement.registry?.artifacts?.registryName ? `@${requirement.registry.artifacts.registryName}/${requirement.name}` : requirement.name;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Installs an NPM package into a dedicated local folder.
|
|
150
|
-
* @param requirement The requirement to install.
|
|
151
|
-
* @param packageSource This can be name@version, path to tgz, or path to folder.
|
|
152
|
-
* @param targetDir Target directory for installation.
|
|
153
|
-
* @returns The installed version of the package.
|
|
154
|
-
*/
|
|
155
|
-
private async _installPackage(
|
|
156
|
-
requirement: RequirementConfig,
|
|
157
|
-
packageSource: string,
|
|
158
|
-
targetDir: string,
|
|
159
|
-
recorder: InstallOperationManager
|
|
160
|
-
): Promise<{ version: string }> {
|
|
161
|
-
Logger.debug(`Installing NPM package from "${packageSource}" into "${targetDir}"`);
|
|
162
|
-
await fs.mkdir(targetDir, { recursive: true });
|
|
163
|
-
|
|
164
|
-
const installCommand = `npm install ${packageSource} --prefix "${targetDir}"`;
|
|
165
|
-
Logger.debug(`Executing install command: ${installCommand}`);
|
|
166
|
-
const requirementName = this._getRequirementName(requirement);
|
|
167
|
-
|
|
168
|
-
return await recorder.recording(
|
|
169
|
-
async () => {
|
|
170
|
-
const { stdout: installStdout, stderr: installStderr } = await this.execPromise(installCommand);
|
|
171
|
-
Logger.debug(`NPM install stdout for ${packageSource} in ${targetDir}: ${installStdout}`);
|
|
172
|
-
if (installStderr && !installStderr.toLowerCase().includes('added') && !installStderr.toLowerCase().includes('updated') && !installStderr.toLowerCase().includes('found 0 vulnerabilities')) {
|
|
173
|
-
// Log stderr if it's not just typical success noise
|
|
174
|
-
Logger.log(`NPM install stderr for ${packageSource} in ${targetDir}: ${installStderr}`);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const installedVersion = await this._getInstalledVersion(requirementName, targetDir);
|
|
179
|
-
|
|
180
|
-
if (installedVersion) {
|
|
181
|
-
Logger.log(`Successfully installed and verified ${requirementName}@${installedVersion} into ${targetDir}`);
|
|
182
|
-
return { version: installedVersion };
|
|
183
|
-
} else {
|
|
184
|
-
throw new Error(`Successfully ran npm install for ${packageSource}, but ${requirement.name} version could not be determined via npm list in ${targetDir}, stderr: ${installStderr}`);
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
stepName: RecordingConstants.STEP_INSTALLATION_COMMAND_EXECUTION,
|
|
189
|
-
inProgressMessage: `Running: ${installCommand}`,
|
|
190
|
-
onError: (error) => {
|
|
191
|
-
Logger.error(`Error during NPM installation: ${error instanceof Error ? error.message : String(error)}`);
|
|
192
|
-
throw error;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
)
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Install the NPM package.
|
|
200
|
-
* @param requirement The requirement to install.
|
|
201
|
-
* @param recorder Optional InstallOperationManager for recording steps.
|
|
202
|
-
* @param options Installation options.
|
|
203
|
-
* @returns The status of the installation.
|
|
204
|
-
*/
|
|
205
|
-
async install(requirement: RequirementConfig, recorder: InstallOperationManager, options?: ServerInstallOptions): Promise<RequirementStatus> {
|
|
206
|
-
const targetDir = options?.settings?.folderName || this._getRequirementFolderPath(requirement);
|
|
207
|
-
await fs.mkdir(targetDir, { recursive: true });
|
|
208
|
-
return recorder.recording(
|
|
209
|
-
async (): Promise<RequirementStatus> => {
|
|
210
|
-
const status = await this.checkInstallation(requirement, { settings: { folderName: targetDir } });
|
|
211
|
-
if (status.installed && status.version && compareVersions(status.version, requirement.version) === 0 && !requirement.version.toLowerCase().includes('latest')) {
|
|
212
|
-
Logger.log(`${requirement.name}@${status.version} already installed in ${targetDir}.`);
|
|
213
|
-
return status;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
let resolvedVersion = requirement.version;
|
|
217
|
-
let packageToInstall: string = `${requirement.name}@${requirement.version}`;
|
|
218
|
-
|
|
219
|
-
if (requirement.registry) {
|
|
220
|
-
if (requirement.registry.githubRelease) {
|
|
221
|
-
const result = await handleGitHubRelease(requirement, requirement.registry.githubRelease);
|
|
222
|
-
packageToInstall = result.resolvedPath;
|
|
223
|
-
resolvedVersion = result.resolvedVersion;
|
|
224
|
-
} else if (requirement.registry.artifacts) {
|
|
225
|
-
const adoResult: AdoArtifactResult = await handleAdoArtifact(
|
|
226
|
-
requirement,
|
|
227
|
-
requirement.registry.artifacts,
|
|
228
|
-
options?.settings?.pythonCommand,
|
|
229
|
-
targetDir
|
|
230
|
-
);
|
|
231
|
-
packageToInstall = `${adoResult.package}@${adoResult.version}`;
|
|
232
|
-
resolvedVersion = adoResult.version;
|
|
233
|
-
} else {
|
|
234
|
-
if (recorder) await recorder.recordStep('NpmInstaller:RegistryConfig', 'failed', 'Invalid registry configuration for npm.');
|
|
235
|
-
throw new Error('Invalid registry configuration for npm.');
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
const finalInstallResult = await this._installPackage(requirement, packageToInstall, targetDir, recorder);
|
|
239
|
-
resolvedVersion = finalInstallResult.version;
|
|
240
|
-
|
|
241
|
-
return {
|
|
242
|
-
name: requirement.name,
|
|
243
|
-
type: 'npm',
|
|
244
|
-
installed: true,
|
|
245
|
-
version: resolvedVersion,
|
|
246
|
-
inProgress: false,
|
|
247
|
-
npmPath: targetDir
|
|
248
|
-
};
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
stepName: RecordingConstants.STEP_NPM_INSTALLER_INSTALL,
|
|
252
|
-
inProgressMessage: `Installing npm package: ${requirement.name}`,
|
|
253
|
-
endMessage: (result) =>
|
|
254
|
-
result.installed
|
|
255
|
-
? `Install completed for ${requirement.name}`
|
|
256
|
-
: `Install failed for ${requirement.name}`,
|
|
257
|
-
onError: (error) => {
|
|
258
|
-
return {
|
|
259
|
-
result: {
|
|
260
|
-
name: requirement.name,
|
|
261
|
-
type: 'npm',
|
|
262
|
-
installed: false,
|
|
263
|
-
error: error instanceof Error ? error.message : String(error),
|
|
264
|
-
inProgress: false
|
|
265
|
-
},
|
|
266
|
-
message: error instanceof Error ? error.message : String(error),
|
|
267
|
-
};
|
|
268
|
-
},
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
}
|