imcp 0.1.3 → 0.1.5

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.
Files changed (239) hide show
  1. package/README.md +21 -4
  2. package/dist/cli/commands/install.js.map +1 -0
  3. package/dist/cli/commands/list.js.map +1 -0
  4. package/dist/cli/commands/pull.js.map +1 -0
  5. package/dist/cli/commands/serve.js.map +1 -0
  6. package/dist/cli/commands/start.d.ts +2 -0
  7. package/dist/cli/commands/start.js +32 -0
  8. package/dist/cli/commands/start.js.map +1 -0
  9. package/dist/cli/commands/sync.d.ts +2 -0
  10. package/dist/cli/commands/sync.js +17 -0
  11. package/dist/cli/commands/sync.js.map +1 -0
  12. package/dist/cli/commands/uninstall.js.map +1 -0
  13. package/dist/cli/index.js +0 -0
  14. package/dist/cli/index.js.map +1 -0
  15. package/dist/core/ConfigurationLoader.d.ts +32 -0
  16. package/{src/core/loaders/ConfigurationLoader.ts → dist/core/ConfigurationLoader.js} +236 -298
  17. package/dist/core/ConfigurationLoader.js.map +1 -0
  18. package/dist/core/ConfigurationProvider.d.ts +35 -0
  19. package/{src/core/loaders/ConfigurationProvider.ts → dist/core/ConfigurationProvider.js} +375 -462
  20. package/dist/core/ConfigurationProvider.js.map +1 -0
  21. package/dist/core/InstallationService.d.ts +50 -0
  22. package/dist/core/InstallationService.js +350 -0
  23. package/dist/core/InstallationService.js.map +1 -0
  24. package/dist/core/MCPManager.d.ts +28 -0
  25. package/dist/core/MCPManager.js +188 -0
  26. package/dist/core/MCPManager.js.map +1 -0
  27. package/dist/core/RequirementService.d.ts +40 -0
  28. package/dist/core/RequirementService.js +110 -0
  29. package/dist/core/RequirementService.js.map +1 -0
  30. package/dist/core/ServerSchemaLoader.d.ts +11 -0
  31. package/dist/core/ServerSchemaLoader.js +43 -0
  32. package/dist/core/ServerSchemaLoader.js.map +1 -0
  33. package/dist/core/ServerSchemaProvider.d.ts +17 -0
  34. package/dist/core/ServerSchemaProvider.js +120 -0
  35. package/dist/core/ServerSchemaProvider.js.map +1 -0
  36. package/dist/core/constants.d.ts +47 -0
  37. package/dist/core/constants.js +94 -0
  38. package/dist/core/constants.js.map +1 -0
  39. package/dist/core/installers/BaseInstaller.d.ts +74 -0
  40. package/dist/core/installers/BaseInstaller.js +253 -0
  41. package/dist/core/installers/BaseInstaller.js.map +1 -0
  42. package/dist/core/installers/ClientInstaller.d.ts +23 -0
  43. package/dist/core/installers/ClientInstaller.js +564 -0
  44. package/dist/core/installers/ClientInstaller.js.map +1 -0
  45. package/dist/core/installers/CommandInstaller.d.ts +37 -0
  46. package/{src/core/installers/requirements/CommandInstaller.ts → dist/core/installers/CommandInstaller.js} +173 -231
  47. package/dist/core/installers/CommandInstaller.js.map +1 -0
  48. package/dist/core/installers/GeneralInstaller.d.ts +33 -0
  49. package/dist/core/installers/GeneralInstaller.js +85 -0
  50. package/dist/core/installers/GeneralInstaller.js.map +1 -0
  51. package/dist/core/installers/InstallerFactory.d.ts +54 -0
  52. package/{src/core/installers/requirements/InstallerFactory.ts → dist/core/installers/InstallerFactory.js} +97 -112
  53. package/dist/core/installers/InstallerFactory.js.map +1 -0
  54. package/dist/core/installers/NpmInstaller.d.ts +26 -0
  55. package/dist/core/installers/NpmInstaller.js +127 -0
  56. package/dist/core/installers/NpmInstaller.js.map +1 -0
  57. package/dist/core/installers/PipInstaller.d.ts +28 -0
  58. package/dist/core/installers/PipInstaller.js +127 -0
  59. package/dist/core/installers/PipInstaller.js.map +1 -0
  60. package/{src/core/installers/requirements/RequirementInstaller.ts → dist/core/installers/RequirementInstaller.d.ts} +33 -42
  61. package/dist/core/installers/RequirementInstaller.js +3 -0
  62. package/dist/core/installers/RequirementInstaller.js.map +1 -0
  63. package/dist/core/installers/clients/BaseClientInstaller.js.map +1 -0
  64. package/dist/core/installers/clients/ClientInstaller.js.map +1 -0
  65. package/dist/core/installers/clients/ClientInstallerFactory.js.map +1 -0
  66. package/dist/core/installers/clients/ClineInstaller.js.map +1 -0
  67. package/dist/core/installers/clients/ExtensionInstaller.js.map +1 -0
  68. package/dist/core/installers/clients/GithubCopilotInstaller.js.map +1 -0
  69. package/dist/core/installers/clients/MSRooCodeInstaller.js.map +1 -0
  70. package/dist/core/installers/index.js.map +1 -0
  71. package/dist/core/installers/requirements/BaseInstaller.js.map +1 -0
  72. package/dist/core/installers/requirements/CommandInstaller.js.map +1 -0
  73. package/dist/core/installers/requirements/GeneralInstaller.js.map +1 -0
  74. package/dist/core/installers/requirements/InstallerFactory.js +2 -0
  75. package/dist/core/installers/requirements/InstallerFactory.js.map +1 -0
  76. package/dist/core/installers/requirements/NpmInstaller.js.map +1 -0
  77. package/dist/core/installers/requirements/NugetInstaller.d.ts +37 -0
  78. package/dist/core/installers/requirements/NugetInstaller.js +189 -0
  79. package/dist/core/installers/requirements/NugetInstaller.js.map +1 -0
  80. package/dist/core/installers/requirements/PipInstaller.js.map +1 -0
  81. package/dist/core/installers/requirements/RequirementInstaller.js.map +1 -0
  82. package/dist/core/loaders/ConfigurationLoader.js.map +1 -0
  83. package/dist/core/loaders/ConfigurationProvider.js.map +1 -0
  84. package/dist/core/loaders/InstallOperationManager.js.map +1 -0
  85. package/dist/core/loaders/ServerSchemaLoader.js.map +1 -0
  86. package/dist/core/loaders/ServerSchemaProvider.js.map +1 -0
  87. package/dist/core/loaders/SystemSettingsManager.js.map +1 -0
  88. package/dist/core/metadatas/constants.js.map +1 -0
  89. package/dist/core/metadatas/recordingConstants.d.ts +2 -0
  90. package/dist/core/metadatas/recordingConstants.js +2 -0
  91. package/dist/core/metadatas/recordingConstants.js.map +1 -0
  92. package/dist/core/metadatas/types.d.ts +1 -1
  93. package/dist/core/metadatas/types.js.map +1 -0
  94. package/dist/core/onboard/FeedOnboardService.js +1 -22
  95. package/dist/core/onboard/FeedOnboardService.js.map +1 -0
  96. package/dist/core/onboard/OnboardProcessor.js.map +1 -0
  97. package/dist/core/onboard/OnboardStatus.js.map +1 -0
  98. package/dist/core/onboard/OnboardStatusManager.js.map +1 -0
  99. package/dist/core/types.d.ts +166 -0
  100. package/dist/core/types.js +16 -0
  101. package/dist/core/types.js.map +1 -0
  102. package/dist/core/validators/FeedValidator.js.map +1 -0
  103. package/dist/core/validators/IServerValidator.js.map +1 -0
  104. package/dist/core/validators/SSEServerValidator.js.map +1 -0
  105. package/dist/core/validators/ServerValidatorFactory.js.map +1 -0
  106. package/dist/core/validators/StdioServerValidator.js +5 -5
  107. package/dist/core/validators/StdioServerValidator.js.map +1 -0
  108. package/dist/index.js.map +1 -0
  109. package/dist/services/InstallRequestValidator.d.ts +21 -0
  110. package/dist/services/InstallRequestValidator.js +99 -0
  111. package/dist/services/InstallRequestValidator.js.map +1 -0
  112. package/dist/services/InstallationService.js.map +1 -0
  113. package/dist/services/MCPManager.js.map +1 -0
  114. package/dist/services/RequirementService.js.map +1 -0
  115. package/dist/services/ServerService.js.map +1 -0
  116. package/dist/services/TelemetryService.js.map +1 -0
  117. package/dist/utils/UpdateCheckTracker.js.map +1 -0
  118. package/dist/utils/adoUtils.js.map +1 -0
  119. package/dist/utils/clientUtils.js.map +1 -0
  120. package/dist/utils/feedUtils.js.map +1 -0
  121. package/dist/utils/githubAuth.js.map +1 -0
  122. package/dist/utils/githubUtils.js.map +1 -0
  123. package/dist/utils/logger.js.map +1 -0
  124. package/dist/utils/macroExpressionUtils.js.map +1 -0
  125. package/dist/utils/osUtils.d.ts +11 -0
  126. package/dist/utils/osUtils.js +100 -0
  127. package/dist/utils/osUtils.js.map +1 -0
  128. package/dist/utils/versionUtils.js.map +1 -0
  129. package/dist/web/contract/serverContract.js.map +1 -0
  130. package/dist/web/public/index.html +1 -1
  131. package/dist/web/public/js/modal/installHandler.js +227 -0
  132. package/dist/web/public/js/modal/loadingUI.js +74 -0
  133. package/dist/web/public/js/modal/messageQueue.js +101 -45
  134. package/dist/web/public/js/modal/modalUI.js +214 -0
  135. package/{src/web/public/js/modal/versionUtils.js → dist/web/public/js/modal/version.js} +1 -1
  136. package/dist/web/public/js/onboard/templates.js +1 -0
  137. package/dist/web/public/js/serverCategoryList.js +3 -3
  138. package/dist/web/public/onboard.html +4 -4
  139. package/dist/web/server.js.map +1 -0
  140. package/package.json +5 -1
  141. package/.github/ISSUE_TEMPLATE/JitAccess.yml +0 -28
  142. package/.github/acl/access.yml +0 -20
  143. package/.github/compliance/inventory.yml +0 -5
  144. package/.github/policies/jit.yml +0 -19
  145. package/.roo/rules-code/rules.md +0 -88
  146. package/dist/core/onboard/InstallOperationManager.d.ts +0 -23
  147. package/dist/core/onboard/InstallOperationManager.js +0 -144
  148. package/docs/ONBOARDING_PAGE_DESIGN.md +0 -260
  149. package/docs/Telemetry.md +0 -136
  150. package/memory-bank/activeContext.md +0 -26
  151. package/memory-bank/decisionLog.md +0 -91
  152. package/memory-bank/productContext.md +0 -41
  153. package/memory-bank/progress.md +0 -35
  154. package/memory-bank/systemPatterns.md +0 -10
  155. package/src/cli/commands/install.ts +0 -139
  156. package/src/cli/commands/list.ts +0 -113
  157. package/src/cli/commands/pull.ts +0 -16
  158. package/src/cli/commands/serve.ts +0 -39
  159. package/src/cli/commands/uninstall.ts +0 -64
  160. package/src/cli/index.ts +0 -82
  161. package/src/core/installers/clients/BaseClientInstaller.ts +0 -341
  162. package/src/core/installers/clients/ClientInstaller.ts +0 -222
  163. package/src/core/installers/clients/ClientInstallerFactory.ts +0 -43
  164. package/src/core/installers/clients/ClineInstaller.ts +0 -35
  165. package/src/core/installers/clients/ExtensionInstaller.ts +0 -165
  166. package/src/core/installers/clients/GithubCopilotInstaller.ts +0 -79
  167. package/src/core/installers/clients/MSRooCodeInstaller.ts +0 -32
  168. package/src/core/installers/index.ts +0 -11
  169. package/src/core/installers/requirements/BaseInstaller.ts +0 -85
  170. package/src/core/installers/requirements/GeneralInstaller.ts +0 -133
  171. package/src/core/installers/requirements/NpmInstaller.ts +0 -271
  172. package/src/core/installers/requirements/PipInstaller.ts +0 -207
  173. package/src/core/loaders/InstallOperationManager.ts +0 -367
  174. package/src/core/loaders/ServerSchemaLoader.ts +0 -117
  175. package/src/core/loaders/ServerSchemaProvider.ts +0 -99
  176. package/src/core/loaders/SystemSettingsManager.ts +0 -278
  177. package/src/core/metadatas/constants.ts +0 -122
  178. package/src/core/metadatas/recordingConstants.ts +0 -62
  179. package/src/core/metadatas/types.ts +0 -202
  180. package/src/core/onboard/FeedOnboardService.ts +0 -524
  181. package/src/core/onboard/OnboardProcessor.ts +0 -356
  182. package/src/core/onboard/OnboardStatus.ts +0 -60
  183. package/src/core/onboard/OnboardStatusManager.ts +0 -416
  184. package/src/core/validators/FeedValidator.ts +0 -135
  185. package/src/core/validators/IServerValidator.ts +0 -21
  186. package/src/core/validators/SSEServerValidator.ts +0 -43
  187. package/src/core/validators/ServerValidatorFactory.ts +0 -51
  188. package/src/core/validators/StdioServerValidator.ts +0 -312
  189. package/src/index.ts +0 -44
  190. package/src/services/InstallationService.ts +0 -102
  191. package/src/services/MCPManager.ts +0 -249
  192. package/src/services/RequirementService.ts +0 -627
  193. package/src/services/ServerService.ts +0 -161
  194. package/src/services/TelemetryService.ts +0 -59
  195. package/src/utils/UpdateCheckTracker.ts +0 -86
  196. package/src/utils/adoUtils.ts +0 -293
  197. package/src/utils/clientUtils.ts +0 -72
  198. package/src/utils/feedUtils.ts +0 -31
  199. package/src/utils/githubAuth.ts +0 -212
  200. package/src/utils/githubUtils.ts +0 -164
  201. package/src/utils/logger.ts +0 -195
  202. package/src/utils/macroExpressionUtils.ts +0 -104
  203. package/src/utils/osUtils.ts +0 -597
  204. package/src/utils/versionUtils.ts +0 -114
  205. package/src/web/contract/serverContract.ts +0 -74
  206. package/src/web/public/css/detailsWidget.css +0 -235
  207. package/src/web/public/css/modal.css +0 -757
  208. package/src/web/public/css/notifications.css +0 -101
  209. package/src/web/public/css/onboard.css +0 -107
  210. package/src/web/public/css/serverCategoryList.css +0 -120
  211. package/src/web/public/css/serverDetails.css +0 -139
  212. package/src/web/public/index.html +0 -359
  213. package/src/web/public/js/api.js +0 -132
  214. package/src/web/public/js/detailsWidget.js +0 -264
  215. package/src/web/public/js/flights/flights.js +0 -127
  216. package/src/web/public/js/modal/index.js +0 -52
  217. package/src/web/public/js/modal/installModal.js +0 -162
  218. package/src/web/public/js/modal/installation.js +0 -266
  219. package/src/web/public/js/modal/loadingModal.js +0 -182
  220. package/src/web/public/js/modal/modalSetup.js +0 -595
  221. package/src/web/public/js/modal/modalUtils.js +0 -37
  222. package/src/web/public/js/modal.js +0 -42
  223. package/src/web/public/js/notifications.js +0 -137
  224. package/src/web/public/js/onboard/formProcessor.js +0 -1037
  225. package/src/web/public/js/onboard/index.js +0 -374
  226. package/src/web/public/js/onboard/publishHandler.js +0 -172
  227. package/src/web/public/js/onboard/state.js +0 -76
  228. package/src/web/public/js/onboard/templates.js +0 -341
  229. package/src/web/public/js/onboard/uiHandlers.js +0 -1076
  230. package/src/web/public/js/onboard/validationHandlers.js +0 -493
  231. package/src/web/public/js/serverCategoryDetails.js +0 -364
  232. package/src/web/public/js/serverCategoryList.js +0 -241
  233. package/src/web/public/js/settings.js +0 -314
  234. package/src/web/public/modal.html +0 -84
  235. package/src/web/public/onboard.html +0 -296
  236. package/src/web/public/settings.html +0 -135
  237. package/src/web/public/styles.css +0 -277
  238. package/src/web/server.ts +0 -478
  239. package/tsconfig.json +0 -18
@@ -1,231 +1,173 @@
1
- import { RequirementConfig, RequirementStatus, OSType, ServerInstallOptions } from '../../metadatas/types.js';
2
- import { BaseInstaller } from './BaseInstaller.js';
3
- import { getOSType, refreshPathEnv } from '../../../utils/osUtils.js';
4
- import { Logger } from '../../../utils/logger.js';
5
- import { InstallOperationManager } from '../../loaders/InstallOperationManager.js';
6
- import * as RecordingConstants from '../../metadatas/recordingConstants.js';
7
-
8
- /**
9
- * Mapping of command names to their package IDs on different platforms
10
- */
11
- interface CommandMapping {
12
- windows: string;
13
- macos: string;
14
- }
15
-
16
- /**
17
- * Installer implementation for command-line tools
18
- */
19
- export class CommandInstaller extends BaseInstaller {
20
-
21
- /**
22
- * Constructor for the CommandInstaller
23
- * @param execPromise Function to execute commands
24
- */
25
- getLatestVersion(requirement: RequirementConfig, options?: ServerInstallOptions): Promise<string | undefined> {
26
- throw new Error('Method not implemented.');
27
- }
28
-
29
- /**
30
- * Mapping of command names to their package IDs
31
- * This handles special cases where the command name differs from the package ID
32
- */
33
- private commandMappings: Record<string, CommandMapping> = {
34
- 'uv': { windows: 'astral-sh.uv', macos: 'uv' }
35
- // Add more mappings as needed
36
- };
37
-
38
- /**
39
- * Check if this installer can handle the given requirement type
40
- * @param requirement The requirement to check
41
- * @returns True if this installer can handle the requirement
42
- */
43
- canHandle(requirement: RequirementConfig): boolean {
44
- return requirement.type === 'command';
45
- }
46
-
47
- supportCheckUpdates(): boolean {
48
- return false;
49
- }
50
- /**
51
- * Get the mapped package ID for a command
52
- * @param commandName The command name to map
53
- * @returns The mapped package ID
54
- */
55
- private getMappedPackageId(commandName: string): string {
56
- const osType = getOSType();
57
- const mapping = this.commandMappings[commandName];
58
-
59
- if (mapping) {
60
- return osType === OSType.Windows ? mapping.windows : mapping.macos;
61
- }
62
-
63
- // If no mapping exists, use the command name itself
64
- return commandName;
65
- }
66
-
67
- /**
68
- * Check if the command is already installed
69
- * @param requirement The requirement to check
70
- * @returns The status of the requirement
71
- */
72
- async checkInstallation(requirement: RequirementConfig): Promise<RequirementStatus> {
73
- try {
74
- await refreshPathEnv();
75
- const commandName = requirement.alias || requirement.name;
76
- const osType = getOSType();
77
- let commandResult;
78
-
79
- if (osType === OSType.Windows) {
80
- // Check if command exists on Windows
81
- try {
82
- commandResult = await this.execPromise(`where ${commandName} 2>nul`);
83
- } catch (error) {
84
- Logger.debug(`Error checking command existence: ${error}`);
85
- // On Windows, 'where' command returns non-zero exit code if the command is not found
86
- // We'll handle this as "command not found" rather than an error
87
- commandResult = { stdout: '', stderr: '' };
88
- }
89
- } else {
90
- // Check if command exists on macOS/Linux
91
- try {
92
- commandResult = await this.execPromise(`which ${commandName} 2>/dev/null`);
93
- } catch (error) {
94
- Logger.debug(`Error checking command existence: ${error}`);
95
- // Similarly handle command not found on Unix systems
96
- commandResult = { stdout: '', stderr: '' };
97
- }
98
- }
99
-
100
- // If the command exists, it will return a path or multiple paths
101
- const installed = commandResult.stdout.trim().length > 0;
102
-
103
- // Try to get version information if available
104
- let version: string | undefined;
105
- if (installed) {
106
- try {
107
- const versionResult = await this.execPromise(`${commandName} --version`);
108
- if (versionResult.stdout) {
109
- // Extract version information - this is a simple approach that might need refinement
110
- const versionMatch = versionResult.stdout.match(/\d+\.\d+(\.\d+)?/);
111
- version = versionMatch ? versionMatch[0] : undefined;
112
- }
113
- } catch (error) {
114
- Logger.debug(`Error checking command version: ${error}`);
115
- // Ignore errors from version check, consider it installed anyway
116
- }
117
- }
118
-
119
- return {
120
- name: requirement.name,
121
- type: 'command',
122
- installed,
123
- version,
124
- inProgress: false
125
- };
126
- } catch (error) {
127
- Logger.error(`Error checking installation: ${error}`);
128
- return {
129
- name: requirement.name,
130
- type: 'command',
131
- installed: false,
132
- error: error instanceof Error ? error.message : String(error),
133
- inProgress: false
134
- };
135
- }
136
- }
137
-
138
- /**
139
- * Install the command
140
- * @param requirement The requirement to install
141
- * @returns The status of the installation
142
- */
143
- /**
144
- * Install the command
145
- * @param requirement The requirement to install
146
- * @param options Optional install options
147
- * @param recorder Optional InstallOperationManager for recording steps
148
- * @returns The status of the installation
149
- */
150
- async install(requirement: RequirementConfig, recorder: InstallOperationManager, options?: ServerInstallOptions): Promise<RequirementStatus> {
151
- const doInstall = async (): Promise<RequirementStatus> => {
152
- const status = await this.checkInstallation(requirement);
153
- if (status.installed) {
154
- return status;
155
- }
156
-
157
- const packageId = this.getMappedPackageId(requirement.name);
158
- const osType = getOSType();
159
- let installCommand: string;
160
-
161
- if (osType === OSType.Windows) {
162
- installCommand = `winget install --id ${packageId}`;
163
- if (requirement.version && requirement.version !== 'latest') {
164
- installCommand += ` --version ${requirement.version}`;
165
- }
166
- } else if (osType === OSType.MacOS) {
167
- installCommand = `brew install ${packageId}`;
168
- if (requirement.version && requirement.version !== 'latest') {
169
- installCommand += `@${requirement.version}`;
170
- }
171
- } else {
172
- if (recorder) await recorder.recordStep('CommandInstaller:UnsupportedOS', 'failed', `Unsupported OS for ${requirement.name}`);
173
- throw new Error(`Unsupported operating system for installing ${requirement.name}`);
174
- }
175
-
176
- // Execute the installation command
177
- const { stderr } = await this.execPromise(installCommand);
178
- if (stderr && stderr.toLowerCase().includes('error')) {
179
- throw new Error(stderr);
180
- }
181
-
182
- // Check if installation was successful
183
- const updatedStatus = await this.checkInstallation(requirement);
184
- if (!updatedStatus.installed) {
185
- throw new Error(`Failed to install ${requirement.name}`);
186
- }
187
- return {
188
- name: requirement.name,
189
- type: 'command',
190
- installed: true,
191
- version: updatedStatus.version || requirement.version,
192
- inProgress: false
193
- };
194
- };
195
-
196
- if (recorder) {
197
- return recorder.recording(doInstall, {
198
- stepName: RecordingConstants.STEP_COMMAND_INSTALLER_INSTALL,
199
- inProgressMessage: `Installing command: ${requirement.name}`,
200
- endMessage: (result) =>
201
- result.installed
202
- ? `Install completed for ${requirement.name}`
203
- : `Install failed for ${requirement.name}`,
204
- onError: (error) => {
205
- return {
206
- result: {
207
- name: requirement.name,
208
- type: 'command',
209
- installed: false,
210
- error: error instanceof Error ? error.message : String(error),
211
- inProgress: false,
212
- },
213
- message: error instanceof Error ? error.message : String(error),
214
- };
215
- },
216
- });
217
- } else {
218
- try {
219
- return await doInstall();
220
- } catch (error) {
221
- return {
222
- name: requirement.name,
223
- type: 'command',
224
- installed: false,
225
- error: error instanceof Error ? error.message : String(error),
226
- inProgress: false,
227
- };
228
- }
229
- }
230
- }
231
- }
1
+ import { OSType } from '../types.js';
2
+ import { BaseInstaller } from './BaseInstaller.js';
3
+ import { getOSType, refreshPathEnv } from '../../utils/osUtils.js';
4
+ import { Logger } from '../../utils/logger.js';
5
+ /**
6
+ * Installer implementation for command-line tools
7
+ */
8
+ export class CommandInstaller extends BaseInstaller {
9
+ /**
10
+ * Mapping of command names to their package IDs
11
+ * This handles special cases where the command name differs from the package ID
12
+ */
13
+ commandMappings = {
14
+ 'uv': { windows: 'astral-sh.uv', macos: 'uv' }
15
+ // Add more mappings as needed
16
+ };
17
+ /**
18
+ * Check if this installer can handle the given requirement type
19
+ * @param requirement The requirement to check
20
+ * @returns True if this installer can handle the requirement
21
+ */
22
+ canHandle(requirement) {
23
+ return requirement.type === 'command';
24
+ }
25
+ supportCheckUpdates() {
26
+ return false;
27
+ }
28
+ /**
29
+ * Get the mapped package ID for a command
30
+ * @param commandName The command name to map
31
+ * @returns The mapped package ID
32
+ */
33
+ getMappedPackageId(commandName) {
34
+ const osType = getOSType();
35
+ const mapping = this.commandMappings[commandName];
36
+ if (mapping) {
37
+ return osType === OSType.Windows ? mapping.windows : mapping.macos;
38
+ }
39
+ // If no mapping exists, use the command name itself
40
+ return commandName;
41
+ }
42
+ /**
43
+ * Check if the command is already installed
44
+ * @param requirement The requirement to check
45
+ * @returns The status of the requirement
46
+ */
47
+ async checkInstallation(requirement) {
48
+ try {
49
+ await refreshPathEnv();
50
+ const commandName = requirement.alias || requirement.name;
51
+ const osType = getOSType();
52
+ let commandResult;
53
+ if (osType === OSType.Windows) {
54
+ // Check if command exists on Windows
55
+ try {
56
+ commandResult = await this.execPromise(`where ${commandName} 2>nul`);
57
+ }
58
+ catch (error) {
59
+ Logger.debug(`Error checking command existence: ${error}`);
60
+ // On Windows, 'where' command returns non-zero exit code if the command is not found
61
+ // We'll handle this as "command not found" rather than an error
62
+ commandResult = { stdout: '', stderr: '' };
63
+ }
64
+ }
65
+ else {
66
+ // Check if command exists on macOS/Linux
67
+ try {
68
+ commandResult = await this.execPromise(`which ${commandName} 2>/dev/null`);
69
+ }
70
+ catch (error) {
71
+ Logger.debug(`Error checking command existence: ${error}`);
72
+ // Similarly handle command not found on Unix systems
73
+ commandResult = { stdout: '', stderr: '' };
74
+ }
75
+ }
76
+ // If the command exists, it will return a path or multiple paths
77
+ const installed = commandResult.stdout.trim().length > 0;
78
+ // Try to get version information if available
79
+ let version;
80
+ if (installed) {
81
+ try {
82
+ const versionResult = await this.execPromise(`${commandName} --version`);
83
+ if (versionResult.stdout) {
84
+ // Extract version information - this is a simple approach that might need refinement
85
+ const versionMatch = versionResult.stdout.match(/\d+\.\d+(\.\d+)?/);
86
+ version = versionMatch ? versionMatch[0] : undefined;
87
+ }
88
+ }
89
+ catch (error) {
90
+ Logger.debug(`Error checking command version: ${error}`);
91
+ // Ignore errors from version check, consider it installed anyway
92
+ }
93
+ }
94
+ return {
95
+ name: requirement.name,
96
+ type: 'command',
97
+ installed,
98
+ version,
99
+ inProgress: false
100
+ };
101
+ }
102
+ catch (error) {
103
+ Logger.error(`Error checking installation: ${error}`);
104
+ return {
105
+ name: requirement.name,
106
+ type: 'command',
107
+ installed: false,
108
+ error: error instanceof Error ? error.message : String(error),
109
+ inProgress: false
110
+ };
111
+ }
112
+ }
113
+ /**
114
+ * Install the command
115
+ * @param requirement The requirement to install
116
+ * @returns The status of the installation
117
+ */
118
+ async install(requirement) {
119
+ try {
120
+ const status = await this.checkInstallation(requirement);
121
+ if (status.installed) {
122
+ return status;
123
+ }
124
+ const packageId = this.getMappedPackageId(requirement.name);
125
+ const osType = getOSType();
126
+ let installCommand;
127
+ if (osType === OSType.Windows) {
128
+ // Windows installation using winget
129
+ installCommand = `winget install --id ${packageId}`;
130
+ if (requirement.version && requirement.version !== 'latest') {
131
+ installCommand += ` --version ${requirement.version}`;
132
+ }
133
+ }
134
+ else if (osType === OSType.MacOS) {
135
+ // macOS installation using Homebrew
136
+ installCommand = `brew install ${packageId}`;
137
+ if (requirement.version && requirement.version !== 'latest') {
138
+ installCommand += `@${requirement.version}`;
139
+ }
140
+ }
141
+ else {
142
+ throw new Error(`Unsupported operating system for installing ${requirement.name}`);
143
+ }
144
+ // Execute the installation command
145
+ const { stderr } = await this.execPromise(installCommand);
146
+ if (stderr && stderr.toLowerCase().includes('error')) {
147
+ throw new Error(stderr);
148
+ }
149
+ // Check if installation was successful
150
+ const updatedStatus = await this.checkInstallation(requirement);
151
+ if (!updatedStatus.installed) {
152
+ throw new Error(`Failed to install ${requirement.name}`);
153
+ }
154
+ return {
155
+ name: requirement.name,
156
+ type: 'command',
157
+ installed: true,
158
+ version: updatedStatus.version || requirement.version,
159
+ inProgress: false
160
+ };
161
+ }
162
+ catch (error) {
163
+ return {
164
+ name: requirement.name,
165
+ type: 'command',
166
+ installed: false,
167
+ error: error instanceof Error ? error.message : String(error),
168
+ inProgress: false
169
+ };
170
+ }
171
+ }
172
+ }
173
+ //# sourceMappingURL=CommandInstaller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandInstaller.js","sourceRoot":"","sources":["../../../src/core/installers/CommandInstaller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,MAAM,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAU/C;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,aAAa;IAE/C;;;OAGG;IACK,eAAe,GAAmC;QACtD,IAAI,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,IAAI,EAAE;QAC9C,8BAA8B;KACjC,CAAC;IAEF;;;;OAIG;IACH,SAAS,CAAC,WAA8B;QACpC,OAAO,WAAW,CAAC,IAAI,KAAK,SAAS,CAAC;IAC1C,CAAC;IAED,mBAAmB;QACf,OAAO,KAAK,CAAC;IACjB,CAAC;IACD;;;;OAIG;IACK,kBAAkB,CAAC,WAAmB;QAC1C,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;QAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;QAElD,IAAI,OAAO,EAAE,CAAC;YACV,OAAO,MAAM,KAAK,MAAM,CA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,WAAW,CAAC,CAAC;YAChE,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,CAAC;gBAC3B,MAAM,IAAI,KAAK,CAAC,qBAAqB,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;YAC7D,CAAC;YAED,OAAO;gBACH,IAAI,EAAE,WAAW,CAAC,IAAI;gBACtB,IAAI,EAAE,SAAS;gBACf,SAAS,EAAE,IAAI;gBACf,OAAO,EAAE,aAAa,CAAC,OAAO,IAAI,WAAW,CAAC,OAAO;gBACrD,UAAU,EAAE,KAAK;aACpB,CAAC;QACN,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO;gBACH,IAAI,EAAE,WAAW,CAAC,IAAI;gBACtB,IAAI,EAAE,SAAS;gBACf,SAAS,EAAE,KAAK;gBAChB,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;gBAC7D,UAAU,EAAE,KAAK;aACpB,CAAC;QACN,CAAC;IACL,CAAC;CACJ"}
@@ -0,0 +1,33 @@
1
+ import { RequirementConfig, RequirementStatus } from '../types.js';
2
+ import { BaseInstaller } from './BaseInstaller.js';
3
+ /**
4
+ * Installer implementation for general requirements (type 'other')
5
+ * This installer handles requirements that don't fit into specific package manager categories
6
+ */
7
+ export declare class GeneralInstaller extends BaseInstaller {
8
+ /**
9
+ * Check if this installer can handle the given requirement type
10
+ * @param requirement The requirement to check
11
+ * @returns True if this installer can handle the requirement
12
+ */
13
+ canHandle(requirement: RequirementConfig): boolean;
14
+ supportCheckUpdates(): boolean;
15
+ /**
16
+ * Check if the requirement is already installed
17
+ * For general installers, we can't easily check if something is installed
18
+ * without specific knowledge of the requirement, so we always return false
19
+ *
20
+ * @param requirement The requirement to check
21
+ * @returns The status of the requirement
22
+ */
23
+ checkInstallation(requirement: RequirementConfig): Promise<RequirementStatus>;
24
+ /**
25
+ * Install the general requirement
26
+ * For type 'other', this doesn't actually install anything, but downloads
27
+ * or locates the asset and returns the path for the caller to use
28
+ *
29
+ * @param requirement The requirement to install
30
+ * @returns The status of the installation, including the install path in updateInfo
31
+ */
32
+ install(requirement: RequirementConfig): Promise<RequirementStatus>;
33
+ }
@@ -0,0 +1,85 @@
1
+ import { BaseInstaller } from './BaseInstaller.js';
2
+ /**
3
+ * Installer implementation for general requirements (type 'other')
4
+ * This installer handles requirements that don't fit into specific package manager categories
5
+ */
6
+ export class GeneralInstaller extends BaseInstaller {
7
+ /**
8
+ * Check if this installer can handle the given requirement type
9
+ * @param requirement The requirement to check
10
+ * @returns True if this installer can handle the requirement
11
+ */
12
+ canHandle(requirement) {
13
+ return requirement.type === 'other';
14
+ }
15
+ supportCheckUpdates() {
16
+ return false;
17
+ }
18
+ /**
19
+ * Check if the requirement is already installed
20
+ * For general installers, we can't easily check if something is installed
21
+ * without specific knowledge of the requirement, so we always return false
22
+ *
23
+ * @param requirement The requirement to check
24
+ * @returns The status of the requirement
25
+ */
26
+ async checkInstallation(requirement) {
27
+ // For general installers, we can't easily check if something is installed
28
+ // So we'll always return not installed, and the actual installation will check
29
+ return {
30
+ name: requirement.name,
31
+ type: 'other',
32
+ installed: false,
33
+ inProgress: false
34
+ };
35
+ }
36
+ /**
37
+ * Install the general requirement
38
+ * For type 'other', this doesn't actually install anything, but downloads
39
+ * or locates the asset and returns the path for the caller to use
40
+ *
41
+ * @param requirement The requirement to install
42
+ * @returns The status of the installation, including the install path in updateInfo
43
+ */
44
+ async install(requirement) {
45
+ try {
46
+ // For type 'other', a registry must be specified
47
+ if (!requirement.registry) {
48
+ throw new Error('Registry must be specified for requirement type "other"');
49
+ }
50
+ let installPath;
51
+ if (requirement.registry.githubRelease) {
52
+ const result = await this.handleGitHubRelease(requirement, requirement.registry.githubRelease);
53
+ installPath = result.resolvedPath;
54
+ }
55
+ else if (requirement.registry.artifacts) {
56
+ installPath = await this.handleArtifactsRegistry(requirement, requirement.registry.artifacts);
57
+ }
58
+ else if (requirement.registry.local) {
59
+ installPath = await this.handleLocalRegistry(requirement, requirement.registry.local);
60
+ }
61
+ else {
62
+ throw new Error('Invalid registry configuration');
63
+ }
64
+ // For general installer, we just return the path to the downloaded/located file
65
+ // The actual installation mechanism would depend on the specific requirement
66
+ return {
67
+ name: requirement.name,
68
+ type: 'other',
69
+ installed: true,
70
+ version: requirement.version,
71
+ inProgress: false,
72
+ };
73
+ }
74
+ catch (error) {
75
+ return {
76
+ name: requirement.name,
77
+ type: 'other',
78
+ installed: false,
79
+ error: error instanceof Error ? error.message : String(error),
80
+ inProgress: false
81
+ };
82
+ }
83
+ }
84
+ }
85
+ //# sourceMappingURL=GeneralInstaller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GeneralInstaller.js","sourceRoot":"","sources":["../../../src/core/installers/GeneralInstaller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;GAGG;AACH,MAAM,OAAO,gBAAiB,SAAQ,aAAa;IAC/C;;;;OAIG;IACH,SAAS,CAAC,WAA8B;QACpC,OAAO,WAAW,CAAC,IAAI,KAAK,OAAO,CAAC;IACxC,CAAC;IAED,mBAAmB;QACf,OAAO,KAAK,CAAC;IACjB,CAAC;IACD;;;;;;;OAOG;IACH,KAAK,CAAC,iBAAiB,CAAC,WAA8B;QAClD,0EAA0E;QAC1E,+EAA+E;QAC/E,OAAO;YACH,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,IAAI,EAAE,OAAO;YACb,SAAS,EAAE,KAAK;YAChB,UAAU,EAAE,KAAK;SACpB,CAAC;IACN,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,OAAO,CAAC,WAA8B;QACxC,IAAI,CAAC;YACD,iDAAiD;YACjD,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;gBACxB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;YAC/E,CAAC;YAED,IAAI,WAAmB,CAAC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ptions } from '../types.js';
2
+ import { RequirementInstaller } from './RequirementInstaller.js';
3
+ import { exec } from 'child_process';
4
+ /**
5
+ * Factory for creating the appropriate installer for a requirement
6
+ */
7
+ export declare class InstallerFactory {
8
+ private installers;
9
+ private readonly execPromise;
10
+ /**
11
+ * Create a new InstallerFactory
12
+ * @param execPromise Function to execute commands
13
+ */
14
+ constructor(execPromise: (command: string) => Promise<{
15
+ stdout: string;
16
+ stderr: string;
17
+ }>);
18
+ /**
19
+ * Register default installers for npm, pip, and general requirements
20
+ * @private
21
+ */
22
+ private registerDefaultInstallers;
23
+ /**
24
+ * Register a custom installer
25
+ * @param installer The installer to register
26
+ */
27
+ registerInstaller(installer: RequirementInstaller): void;
28
+ /**
29
+ * Get the appropriate installer for a requirement
30
+ * @param requirement The requirement to get an installer for
31
+ * @returns The appropriate installer, or undefined if none found
32
+ */
33
+ getInstaller(requirement: RequirementConfig): RequirementInstaller | undefined;
34
+ /**
35
+ * Install a requirement using the appropriate installer
36
+ * @param requirement The requirement to install
37
+ * @param options Installation options including python environment
38
+ * @returns The installation status
39
+ */
40
+ install(requirement: RequirementConfig, options?: ServerInstallOptions): Promise<RequirementStatus>;
41
+ /**
42
+ * Check the installation status of a requirement
43
+ * @param requirement The requirement to check
44
+ * @param options Installation options including python environment
45
+ * @returns The installation status
46
+ */
47
+ checkInstallation(requirement: RequirementConfig, options?: ServerInstallOptions): Promise<RequirementStatus>;
48
+ }
49
+ /**
50
+ * Create a new InstallerFactory with default settings
51
+ * @param execPromise Optional function to execute commands
52
+ * @returns A new InstallerFactory
53
+ */
54
+ export declare const createInstallerFactory: (execPromise?: typeof exec.__promisify__) => InstallerFactory;