imcp 0.1.7 → 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.
Files changed (314) hide show
  1. package/dist/cli/commands/install.js +1 -106
  2. package/dist/cli/commands/install.js.map +1 -0
  3. package/dist/cli/commands/list.js +1 -90
  4. package/dist/cli/commands/list.js.map +1 -0
  5. package/dist/cli/commands/pull.js +1 -16
  6. package/dist/cli/commands/pull.js.map +1 -0
  7. package/dist/cli/commands/serve.js +1 -33
  8. package/dist/cli/commands/serve.js.map +1 -0
  9. package/dist/cli/commands/uninstall.js +1 -46
  10. package/dist/cli/commands/uninstall.js.map +1 -0
  11. package/dist/cli/index.js +1 -65
  12. package/dist/cli/index.js.map +1 -0
  13. package/dist/core/installers/clients/BaseClientInstaller.js +1 -282
  14. package/dist/core/installers/clients/BaseClientInstaller.js.map +1 -0
  15. package/dist/core/installers/clients/ClientInstaller.js +1 -163
  16. package/dist/core/installers/clients/ClientInstaller.js.map +1 -0
  17. package/dist/core/installers/clients/ClientInstallerFactory.js +1 -36
  18. package/dist/core/installers/clients/ClientInstallerFactory.js.map +1 -0
  19. package/dist/core/installers/clients/ClineInstaller.js +1 -30
  20. package/dist/core/installers/clients/ClineInstaller.js.map +1 -0
  21. package/dist/core/installers/clients/ExtensionInstaller.js +1 -151
  22. package/dist/core/installers/clients/ExtensionInstaller.js.map +1 -0
  23. package/dist/core/installers/clients/GithubCopilotInstaller.js +1 -68
  24. package/dist/core/installers/clients/GithubCopilotInstaller.js.map +1 -0
  25. package/dist/core/installers/clients/MSRooCodeInstaller.js +1 -28
  26. package/dist/core/installers/clients/MSRooCodeInstaller.js.map +1 -0
  27. package/dist/core/installers/index.js +1 -8
  28. package/dist/core/installers/index.js.map +1 -0
  29. package/dist/core/installers/requirements/BaseInstaller.js +1 -56
  30. package/dist/core/installers/requirements/BaseInstaller.js.map +1 -0
  31. package/dist/core/installers/requirements/CommandInstaller.js +1 -213
  32. package/dist/core/installers/requirements/CommandInstaller.js.map +1 -0
  33. package/dist/core/installers/requirements/GeneralInstaller.js +1 -126
  34. package/dist/core/installers/requirements/GeneralInstaller.js.map +1 -0
  35. package/dist/core/installers/requirements/InstallerFactory.js +1 -99
  36. package/dist/core/installers/requirements/InstallerFactory.js.map +1 -0
  37. package/dist/core/installers/requirements/NpmInstaller.js +1 -235
  38. package/dist/core/installers/requirements/NpmInstaller.js.map +1 -0
  39. package/dist/core/installers/requirements/NugetInstaller.js +1 -188
  40. package/dist/core/installers/requirements/NugetInstaller.js.map +1 -0
  41. package/dist/core/installers/requirements/PipInstaller.js +1 -192
  42. package/dist/core/installers/requirements/PipInstaller.js.map +1 -0
  43. package/dist/core/installers/requirements/RequirementInstaller.js +1 -2
  44. package/dist/core/installers/requirements/RequirementInstaller.js.map +1 -0
  45. package/dist/core/loaders/ConfigurationLoader.js +1 -256
  46. package/dist/core/loaders/ConfigurationLoader.js.map +1 -0
  47. package/dist/core/loaders/ConfigurationProvider.js +1 -383
  48. package/dist/core/loaders/ConfigurationProvider.js.map +1 -0
  49. package/dist/core/loaders/InstallOperationManager.js +1 -310
  50. package/dist/core/loaders/InstallOperationManager.js.map +1 -0
  51. package/dist/core/loaders/ServerSchemaLoader.js +1 -108
  52. package/dist/core/loaders/ServerSchemaLoader.js.map +1 -0
  53. package/dist/core/loaders/ServerSchemaProvider.js +1 -89
  54. package/dist/core/loaders/ServerSchemaProvider.js.map +1 -0
  55. package/dist/core/loaders/SystemSettingsManager.js +1 -256
  56. package/dist/core/loaders/SystemSettingsManager.js.map +1 -0
  57. package/dist/core/metadatas/constants.js +1 -100
  58. package/dist/core/metadatas/constants.js.map +1 -0
  59. package/dist/core/metadatas/recordingConstants.js +1 -46
  60. package/dist/core/metadatas/recordingConstants.js.map +1 -0
  61. package/dist/core/metadatas/types.js +1 -15
  62. package/dist/core/metadatas/types.js.map +1 -0
  63. package/dist/core/onboard/FeedOnboardService.js +1 -422
  64. package/dist/core/onboard/FeedOnboardService.js.map +1 -0
  65. package/dist/core/onboard/OnboardProcessor.js +1 -333
  66. package/dist/core/onboard/OnboardProcessor.js.map +1 -0
  67. package/dist/core/onboard/OnboardStatus.js +1 -9
  68. package/dist/core/onboard/OnboardStatus.js.map +1 -0
  69. package/dist/core/onboard/OnboardStatusManager.js +1 -360
  70. package/dist/core/onboard/OnboardStatusManager.js.map +1 -0
  71. package/dist/core/validators/FeedValidator.js +1 -133
  72. package/dist/core/validators/FeedValidator.js.map +1 -0
  73. package/dist/core/validators/IServerValidator.js +1 -1
  74. package/dist/core/validators/IServerValidator.js.map +1 -0
  75. package/dist/core/validators/SSEServerValidator.js +1 -38
  76. package/dist/core/validators/SSEServerValidator.js.map +1 -0
  77. package/dist/core/validators/ServerValidatorFactory.js +1 -44
  78. package/dist/core/validators/ServerValidatorFactory.js.map +1 -0
  79. package/dist/core/validators/StdioServerValidator.js +1 -281
  80. package/dist/core/validators/StdioServerValidator.js.map +1 -0
  81. package/dist/index.js +1 -18
  82. package/dist/index.js.map +1 -0
  83. package/dist/services/InstallationService.js +1 -81
  84. package/dist/services/InstallationService.js.map +1 -0
  85. package/dist/services/MCPManager.js +1 -197
  86. package/dist/services/MCPManager.js.map +1 -0
  87. package/dist/services/RequirementService.js +1 -548
  88. package/dist/services/RequirementService.js.map +1 -0
  89. package/dist/services/ServerService.js +1 -127
  90. package/dist/services/ServerService.js.map +1 -0
  91. package/dist/services/TelemetryService.js +1 -53
  92. package/dist/services/TelemetryService.js.map +1 -0
  93. package/dist/utils/UpdateCheckTracker.js +1 -79
  94. package/dist/utils/UpdateCheckTracker.js.map +1 -0
  95. package/dist/utils/adoUtils.js +1 -254
  96. package/dist/utils/adoUtils.js.map +1 -0
  97. package/dist/utils/clientUtils.js +1 -65
  98. package/dist/utils/clientUtils.js.map +1 -0
  99. package/dist/utils/feedUtils.js +1 -28
  100. package/dist/utils/feedUtils.js.map +1 -0
  101. package/dist/utils/githubAuth.js +1 -177
  102. package/dist/utils/githubAuth.js.map +1 -0
  103. package/dist/utils/githubUtils.js +1 -125
  104. package/dist/utils/githubUtils.js.map +1 -0
  105. package/dist/utils/logger.js +1 -176
  106. package/dist/utils/logger.js.map +1 -0
  107. package/dist/utils/macroExpressionUtils.js +1 -93
  108. package/dist/utils/macroExpressionUtils.js.map +1 -0
  109. package/dist/utils/osUtils.js +1 -664
  110. package/dist/utils/osUtils.js.map +1 -0
  111. package/dist/utils/versionUtils.js +1 -101
  112. package/dist/utils/versionUtils.js.map +1 -0
  113. package/dist/web/contract/serverContract.js +1 -1
  114. package/dist/web/contract/serverContract.js.map +1 -0
  115. package/dist/web/public/js/api.js +2 -132
  116. package/dist/web/public/js/api.js.map +1 -0
  117. package/dist/web/public/js/detailsWidget.js +2 -264
  118. package/dist/web/public/js/detailsWidget.js.map +1 -0
  119. package/dist/web/public/js/flights/flights.js +2 -127
  120. package/dist/web/public/js/flights/flights.js.map +1 -0
  121. package/dist/web/public/js/modal/index.js +2 -52
  122. package/dist/web/public/js/modal/index.js.map +1 -0
  123. package/dist/web/public/js/modal/installModal.js +2 -162
  124. package/dist/web/public/js/modal/installModal.js.map +1 -0
  125. package/dist/web/public/js/modal/installation.js +2 -266
  126. package/dist/web/public/js/modal/installation.js.map +1 -0
  127. package/dist/web/public/js/modal/loadingModal.js +2 -182
  128. package/dist/web/public/js/modal/loadingModal.js.map +1 -0
  129. package/dist/web/public/js/modal/modalSetup.js +2 -595
  130. package/dist/web/public/js/modal/modalSetup.js.map +1 -0
  131. package/dist/web/public/js/modal/modalUtils.js +2 -37
  132. package/dist/web/public/js/modal/modalUtils.js.map +1 -0
  133. package/dist/web/public/js/modal/versionUtils.js +2 -20
  134. package/dist/web/public/js/modal/versionUtils.js.map +1 -0
  135. package/dist/web/public/js/modal.js +2 -42
  136. package/dist/web/public/js/modal.js.map +1 -0
  137. package/dist/web/public/js/notifications.js +2 -137
  138. package/dist/web/public/js/notifications.js.map +1 -0
  139. package/dist/web/public/js/onboard/formProcessor.js +2 -1037
  140. package/dist/web/public/js/onboard/formProcessor.js.map +1 -0
  141. package/dist/web/public/js/onboard/index.js +2 -374
  142. package/dist/web/public/js/onboard/index.js.map +1 -0
  143. package/dist/web/public/js/onboard/publishHandler.js +2 -172
  144. package/dist/web/public/js/onboard/publishHandler.js.map +1 -0
  145. package/dist/web/public/js/onboard/state.js +2 -76
  146. package/dist/web/public/js/onboard/state.js.map +1 -0
  147. package/dist/web/public/js/onboard/templates.js +2 -342
  148. package/dist/web/public/js/onboard/templates.js.map +1 -0
  149. package/dist/web/public/js/onboard/uiHandlers.js +2 -1076
  150. package/dist/web/public/js/onboard/uiHandlers.js.map +1 -0
  151. package/dist/web/public/js/onboard/validationHandlers.js +2 -493
  152. package/dist/web/public/js/onboard/validationHandlers.js.map +1 -0
  153. package/dist/web/public/js/serverCategoryDetails.js +2 -364
  154. package/dist/web/public/js/serverCategoryDetails.js.map +1 -0
  155. package/dist/web/public/js/serverCategoryList.js +2 -241
  156. package/dist/web/public/js/serverCategoryList.js.map +1 -0
  157. package/dist/web/public/js/settings.js +2 -314
  158. package/dist/web/public/js/settings.js.map +1 -0
  159. package/dist/web/server.js +1 -404
  160. package/dist/web/server.js.map +1 -0
  161. package/package.json +8 -2
  162. package/.github/ISSUE_TEMPLATE/JitAccess.yml +0 -28
  163. package/.github/acl/access.yml +0 -20
  164. package/.github/compliance/inventory.yml +0 -5
  165. package/.github/policies/jit.yml +0 -19
  166. package/.github/workflows/build.yml +0 -28
  167. package/.roo/rules-code/rules.md +0 -88
  168. package/dist/cli/commands/start.d.ts +0 -2
  169. package/dist/cli/commands/start.js +0 -32
  170. package/dist/cli/commands/sync.d.ts +0 -2
  171. package/dist/cli/commands/sync.js +0 -17
  172. package/dist/core/ConfigurationLoader.d.ts +0 -32
  173. package/dist/core/ConfigurationLoader.js +0 -236
  174. package/dist/core/ConfigurationProvider.d.ts +0 -35
  175. package/dist/core/ConfigurationProvider.js +0 -375
  176. package/dist/core/InstallationService.d.ts +0 -50
  177. package/dist/core/InstallationService.js +0 -350
  178. package/dist/core/MCPManager.d.ts +0 -28
  179. package/dist/core/MCPManager.js +0 -188
  180. package/dist/core/RequirementService.d.ts +0 -40
  181. package/dist/core/RequirementService.js +0 -110
  182. package/dist/core/ServerSchemaLoader.d.ts +0 -11
  183. package/dist/core/ServerSchemaLoader.js +0 -43
  184. package/dist/core/ServerSchemaProvider.d.ts +0 -17
  185. package/dist/core/ServerSchemaProvider.js +0 -120
  186. package/dist/core/constants.d.ts +0 -47
  187. package/dist/core/constants.js +0 -94
  188. package/dist/core/installers/BaseInstaller.d.ts +0 -74
  189. package/dist/core/installers/BaseInstaller.js +0 -253
  190. package/dist/core/installers/ClientInstaller.d.ts +0 -23
  191. package/dist/core/installers/ClientInstaller.js +0 -564
  192. package/dist/core/installers/CommandInstaller.d.ts +0 -37
  193. package/dist/core/installers/CommandInstaller.js +0 -173
  194. package/dist/core/installers/GeneralInstaller.d.ts +0 -33
  195. package/dist/core/installers/GeneralInstaller.js +0 -85
  196. package/dist/core/installers/InstallerFactory.d.ts +0 -54
  197. package/dist/core/installers/InstallerFactory.js +0 -97
  198. package/dist/core/installers/NpmInstaller.d.ts +0 -26
  199. package/dist/core/installers/NpmInstaller.js +0 -127
  200. package/dist/core/installers/PipInstaller.d.ts +0 -28
  201. package/dist/core/installers/PipInstaller.js +0 -127
  202. package/dist/core/installers/RequirementInstaller.d.ts +0 -33
  203. package/dist/core/installers/RequirementInstaller.js +0 -3
  204. package/dist/core/types.d.ts +0 -166
  205. package/dist/core/types.js +0 -16
  206. package/dist/services/InstallRequestValidator.d.ts +0 -21
  207. package/dist/services/InstallRequestValidator.js +0 -99
  208. package/dist/web/public/js/modal/installHandler.js +0 -227
  209. package/dist/web/public/js/modal/loadingUI.js +0 -74
  210. package/dist/web/public/js/modal/messageQueue.js +0 -112
  211. package/dist/web/public/js/modal/modalUI.js +0 -214
  212. package/dist/web/public/js/modal/version.js +0 -20
  213. package/dist/web/public/js/onboard/ONBOARDING_PAGE_DESIGN.md +0 -370
  214. package/docs/ONBOARDING_PAGE_DESIGN.md +0 -260
  215. package/docs/Telemetry.md +0 -136
  216. package/memory-bank/activeContext.md +0 -26
  217. package/memory-bank/decisionLog.md +0 -91
  218. package/memory-bank/productContext.md +0 -41
  219. package/memory-bank/progress.md +0 -35
  220. package/memory-bank/systemPatterns.md +0 -10
  221. package/src/cli/commands/install.ts +0 -139
  222. package/src/cli/commands/list.ts +0 -113
  223. package/src/cli/commands/pull.ts +0 -16
  224. package/src/cli/commands/serve.ts +0 -39
  225. package/src/cli/commands/uninstall.ts +0 -64
  226. package/src/cli/index.ts +0 -82
  227. package/src/core/installers/clients/BaseClientInstaller.ts +0 -341
  228. package/src/core/installers/clients/ClientInstaller.ts +0 -222
  229. package/src/core/installers/clients/ClientInstallerFactory.ts +0 -43
  230. package/src/core/installers/clients/ClineInstaller.ts +0 -35
  231. package/src/core/installers/clients/ExtensionInstaller.ts +0 -165
  232. package/src/core/installers/clients/GithubCopilotInstaller.ts +0 -79
  233. package/src/core/installers/clients/MSRooCodeInstaller.ts +0 -32
  234. package/src/core/installers/index.ts +0 -11
  235. package/src/core/installers/requirements/BaseInstaller.ts +0 -85
  236. package/src/core/installers/requirements/CommandInstaller.ts +0 -231
  237. package/src/core/installers/requirements/GeneralInstaller.ts +0 -133
  238. package/src/core/installers/requirements/InstallerFactory.ts +0 -114
  239. package/src/core/installers/requirements/NpmInstaller.ts +0 -271
  240. package/src/core/installers/requirements/NugetInstaller.ts +0 -203
  241. package/src/core/installers/requirements/PipInstaller.ts +0 -207
  242. package/src/core/installers/requirements/RequirementInstaller.ts +0 -42
  243. package/src/core/loaders/ConfigurationLoader.ts +0 -298
  244. package/src/core/loaders/ConfigurationProvider.ts +0 -462
  245. package/src/core/loaders/InstallOperationManager.ts +0 -367
  246. package/src/core/loaders/ServerSchemaLoader.ts +0 -117
  247. package/src/core/loaders/ServerSchemaProvider.ts +0 -99
  248. package/src/core/loaders/SystemSettingsManager.ts +0 -278
  249. package/src/core/metadatas/constants.ts +0 -122
  250. package/src/core/metadatas/recordingConstants.ts +0 -65
  251. package/src/core/metadatas/types.ts +0 -202
  252. package/src/core/onboard/FeedOnboardService.ts +0 -501
  253. package/src/core/onboard/OnboardProcessor.ts +0 -356
  254. package/src/core/onboard/OnboardStatus.ts +0 -60
  255. package/src/core/onboard/OnboardStatusManager.ts +0 -416
  256. package/src/core/validators/FeedValidator.ts +0 -135
  257. package/src/core/validators/IServerValidator.ts +0 -21
  258. package/src/core/validators/SSEServerValidator.ts +0 -43
  259. package/src/core/validators/ServerValidatorFactory.ts +0 -51
  260. package/src/core/validators/StdioServerValidator.ts +0 -313
  261. package/src/index.ts +0 -44
  262. package/src/services/InstallationService.ts +0 -102
  263. package/src/services/MCPManager.ts +0 -249
  264. package/src/services/RequirementService.ts +0 -627
  265. package/src/services/ServerService.ts +0 -161
  266. package/src/services/TelemetryService.ts +0 -59
  267. package/src/utils/UpdateCheckTracker.ts +0 -86
  268. package/src/utils/adoUtils.ts +0 -293
  269. package/src/utils/clientUtils.ts +0 -72
  270. package/src/utils/feedUtils.ts +0 -31
  271. package/src/utils/githubAuth.ts +0 -212
  272. package/src/utils/githubUtils.ts +0 -164
  273. package/src/utils/logger.ts +0 -195
  274. package/src/utils/macroExpressionUtils.ts +0 -104
  275. package/src/utils/osUtils.ts +0 -700
  276. package/src/utils/versionUtils.ts +0 -114
  277. package/src/web/contract/serverContract.ts +0 -74
  278. package/src/web/public/css/detailsWidget.css +0 -235
  279. package/src/web/public/css/modal.css +0 -757
  280. package/src/web/public/css/notifications.css +0 -101
  281. package/src/web/public/css/onboard.css +0 -107
  282. package/src/web/public/css/serverCategoryList.css +0 -120
  283. package/src/web/public/css/serverDetails.css +0 -139
  284. package/src/web/public/index.html +0 -359
  285. package/src/web/public/js/api.js +0 -132
  286. package/src/web/public/js/detailsWidget.js +0 -264
  287. package/src/web/public/js/flights/flights.js +0 -127
  288. package/src/web/public/js/modal/index.js +0 -52
  289. package/src/web/public/js/modal/installModal.js +0 -162
  290. package/src/web/public/js/modal/installation.js +0 -266
  291. package/src/web/public/js/modal/loadingModal.js +0 -182
  292. package/src/web/public/js/modal/modalSetup.js +0 -595
  293. package/src/web/public/js/modal/modalUtils.js +0 -37
  294. package/src/web/public/js/modal/versionUtils.js +0 -20
  295. package/src/web/public/js/modal.js +0 -42
  296. package/src/web/public/js/notifications.js +0 -137
  297. package/src/web/public/js/onboard/formProcessor.js +0 -1037
  298. package/src/web/public/js/onboard/index.js +0 -374
  299. package/src/web/public/js/onboard/publishHandler.js +0 -172
  300. package/src/web/public/js/onboard/state.js +0 -76
  301. package/src/web/public/js/onboard/templates.js +0 -342
  302. package/src/web/public/js/onboard/uiHandlers.js +0 -1076
  303. package/src/web/public/js/onboard/validationHandlers.js +0 -493
  304. package/src/web/public/js/serverCategoryDetails.js +0 -364
  305. package/src/web/public/js/serverCategoryList.js +0 -241
  306. package/src/web/public/js/settings.js +0 -314
  307. package/src/web/public/modal.html +0 -84
  308. package/src/web/public/onboard.html +0 -296
  309. package/src/web/public/settings.html +0 -135
  310. package/src/web/public/styles.css +0 -277
  311. package/src/web/server.ts +0 -478
  312. package/tsconfig.json +0 -18
  313. package/wiki/Installation.md +0 -3
  314. package/wiki/Publish.md +0 -3
@@ -1,203 +0,0 @@
1
- import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../metadatas/types.js';
2
- import { BaseInstaller } from './BaseInstaller.js';
3
- import { handleGitHubRelease, getGitHubLatestVersion } from '../../../utils/githubUtils.js';
4
- import { compareVersions } from '../../../utils/versionUtils.js';
5
- import { Logger } from '../../../utils/logger.js';
6
- import { InstallOperationManager } from '../../loaders/InstallOperationManager.js';
7
- import * as RecordingConstants from '../../metadatas/recordingConstants.js';
8
- import { ensureDotnetToolsInPath } from '../../../utils/osUtils.js';
9
- import * as fs from 'fs';
10
- import * as path from 'path';
11
-
12
- /**
13
- * Installer implementation for .NET packages using NuGet
14
- */
15
- export class NugetInstaller extends BaseInstaller {
16
- /**
17
- * Check if this installer can handle the given requirement type
18
- * @param requirement The requirement to check
19
- * @returns True if this installer can handle the requirement
20
- */
21
- canHandle(requirement: RequirementConfig): boolean {
22
- return requirement.type === 'nuget';
23
- }
24
-
25
- supportCheckUpdates(): boolean {
26
- return true;
27
- }
28
-
29
- /**
30
- * Get the latest version available for the NuGet package.
31
- * @param requirement The requirement to check.
32
- * @param _options Optional server install options (not used for NuGet).
33
- * @returns The latest version string, or undefined if not found or not applicable.
34
- */
35
- async getLatestVersion(requirement: RequirementConfig, _options?: ServerInstallOptions): Promise<string | undefined> {
36
- if (requirement.registry && requirement.registry.githubRelease) {
37
- return getGitHubLatestVersion(this.execPromise, requirement.registry.githubRelease.repository);
38
- }
39
- // Artifacts registry is not supported for nuget tools
40
- if (requirement.registry && requirement.registry.artifacts) {
41
- Logger.warn(`Artifacts registry is not supported for NuGet tool '${requirement.name}'.`);
42
- return undefined;
43
- }
44
- // Default behavior: Nuget tools are often specific versions from specific sources,
45
- // or global tools might not have a central "latest version" query like pip/npm.
46
- // Returning current version if specified, otherwise undefined.
47
- Logger.warn(`Direct latest version check for NuGet tool '${requirement.name}' without a GitHub release registry is not supported. Please specify a version or use a GitHub release.`);
48
- return requirement.version || undefined;
49
- }
50
-
51
- /**
52
- * Check if the .NET tool is already installed
53
- * @param requirement The requirement to check
54
- * @param _options Optional server install options (not used for NuGet)
55
- * @returns The status of the requirement
56
- */
57
- async checkInstallation(requirement: RequirementConfig, _options?: ServerInstallOptions): Promise<RequirementStatus> {
58
- try {
59
- // Command: dotnet tool list -g
60
- // Output:
61
- // Package Id Version Commands
62
- // -----------------------------------------
63
- // jarvistools 1.0.0 jarvistools
64
- const { stdout } = await this.execPromise(`dotnet tool list -g`);
65
- const lines = stdout.split('\n');
66
- let installedVersion: string | undefined;
67
- let isInstalled = false;
68
-
69
- for (const line of lines) {
70
- const parts = line.trim().split(/\s+/);
71
- if (parts.length >= 2 && parts[0].toLowerCase() === requirement.name.toLowerCase()) {
72
- installedVersion = parts[1];
73
- isInstalled = true;
74
- break;
75
- }
76
- }
77
-
78
- return {
79
- name: requirement.name,
80
- type: 'nuget',
81
- installed: isInstalled,
82
- version: installedVersion,
83
- inProgress: false,
84
- };
85
- } catch (error) {
86
- // If 'dotnet tool list -g' fails, it might mean dotnet CLI is not properly installed or configured.
87
- // Or it could mean no tools are installed, which in some dotnet versions might return non-zero exit code.
88
- // We'll assume not installed in case of error, but log it.
89
- Logger.debug(`Error checking NuGet tool installation for ${requirement.name}: ${error instanceof Error ? error.message : String(error)}`);
90
- return {
91
- name: requirement.name,
92
- type: 'nuget',
93
- installed: false,
94
- error: `Failed to check installation: ${error instanceof Error ? error.message : String(error)}`,
95
- inProgress: false,
96
- };
97
- }
98
- }
99
-
100
- /**
101
- * Install the .NET tool
102
- * @param requirement The requirement to install
103
- * @param recorder Optional InstallOperationManager for recording steps
104
- * @param _options Optional server install options (not used for NuGet)
105
- * @returns The status of the installation
106
- */
107
- async install(requirement: RequirementConfig, recorder: InstallOperationManager, _options?: ServerInstallOptions): Promise<RequirementStatus> {
108
- return await recorder.recording(
109
- async (): Promise<RequirementStatus> => {
110
- const status = await this.checkInstallation(requirement, _options);
111
- if (status.installed && status.version && requirement.version &&
112
- compareVersions(status.version, requirement.version) === 0 &&
113
- !requirement.version.toLowerCase().includes('latest')) {
114
- Logger.log(`NuGet tool ${requirement.name}==${status.version} already installed.`);
115
- return status;
116
- }
117
-
118
- let command: string;
119
-
120
- if (requirement.registry && requirement.registry.githubRelease) {
121
- const result = await handleGitHubRelease(requirement, requirement.registry.githubRelease);
122
- // Nuget package name might be different from the requirement name if alias is used.
123
- // However, dotnet tool install uses the package ID from the nupkg.
124
- // We assume requirement.name is the package ID.
125
- const packageId = requirement.name;
126
- const resolvedDir = fs.existsSync(result.resolvedPath) && fs.lstatSync(result.resolvedPath).isDirectory() ? result.resolvedPath : path.dirname(result.resolvedPath);
127
-
128
- if (requirement.version && !requirement.version.toLowerCase().includes('latest')) {
129
- command = `dotnet tool install --global --add-source "${resolvedDir}" ${packageId} --version ${requirement.version}`;
130
- } else {
131
- // Install latest from the source
132
- command = `dotnet tool install --global --add-source "${resolvedDir}" ${packageId}`;
133
- }
134
- } else if (requirement.registry && requirement.registry.artifacts) {
135
- const errorMessage = `Artifacts registry is not supported for NuGet tool yet'${requirement.name}'. Only GitHubRelease is supported.`;
136
- Logger.error(errorMessage);
137
- await recorder.recordStep('NugetInstaller:RegistryConfig', 'failed', errorMessage);
138
- throw new Error(errorMessage);
139
- } else {
140
- // Default installation from nuget.org or configured feeds
141
- if (requirement.version && !requirement.version.toLowerCase().includes('latest')) {
142
- command = `dotnet tool install --global ${requirement.name} --version ${requirement.version}`;
143
- } else {
144
- command = `dotnet tool install --global ${requirement.name}`;
145
- }
146
- }
147
-
148
- return await recorder.recording(
149
- async () => {
150
- const { stdout, stderr } = await this.execPromise(command);
151
- if (stderr && !stdout.toLowerCase().includes('already installed')) { // Some warnings might go to stderr
152
- Logger.debug(`NuGet tool installation stderr for ${requirement.name}: ${stderr}`);
153
- // Check if it was actually an error or just a warning
154
- const checkStatus = await this.checkInstallation(requirement, _options);
155
- if (!checkStatus.installed) {
156
- Logger.error(`NuGet tool ${requirement.name} not found after install command, stderr: ${stderr}`);
157
- throw new Error(`NuGet tool installation failed with: ${stderr}`);
158
- }
159
- }
160
-
161
- const finalStatus = await this.checkInstallation(requirement, _options);
162
- if (!finalStatus.installed) {
163
- throw new Error(`NuGet tool ${requirement.name} failed to install. Please check logs.`);
164
- }
165
- // After successful installation, ensure .NET tools path is in system PATH
166
- await ensureDotnetToolsInPath();
167
- return {
168
- name: requirement.name,
169
- type: 'nuget',
170
- installed: true,
171
- version: finalStatus.version || requirement.version, // Use checked version if available
172
- inProgress: false,
173
- };
174
- },
175
- {
176
- stepName: `${RecordingConstants.STEP_INSTALL_COMMAND_PREFIX}: ${requirement.name} : ${requirement.version || 'latest'}`,
177
- inProgressMessage: `Running: ${command}`,
178
- endMessage: (result) => result.installed ? `Succeeded: ${command}` : `Failed: ${command}`,
179
- }
180
- );
181
- },
182
- {
183
- stepName: RecordingConstants.STEP_NUGET_INSTALLER_INSTALL,
184
- inProgressMessage: `Installing NuGet tool: ${requirement.name}`,
185
- endMessage: (result) => result.installed
186
- ? `Install completed for ${requirement.name} with version ${result.version}`
187
- : `Install failed for ${requirement.name}`,
188
- onError: (error) => {
189
- return {
190
- result: {
191
- name: requirement.name,
192
- type: 'nuget',
193
- installed: false,
194
- error: error instanceof Error ? error.message : String(error),
195
- inProgress: false,
196
- },
197
- message: error instanceof Error ? error.message : String(error),
198
- };
199
- },
200
- }
201
- );
202
- }
203
- }
@@ -1,207 +0,0 @@
1
- import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../metadatas/types.js';
2
- import { BaseInstaller } from './BaseInstaller.js';
3
- import { handleGitHubRelease, getGitHubLatestVersion } from '../../../utils/githubUtils.js';
4
- import { handleArtifact as handleAdoArtifact, getArtifactLatestVersion } from '../../../utils/adoUtils.js';
5
- import { compareVersions } from '../../../utils/versionUtils.js';
6
- import { Logger } from '../../../utils/logger.js';
7
- import { InstallOperationManager } from '../../loaders/InstallOperationManager.js';
8
- import * as RecordingConstants from '../../metadatas/recordingConstants.js';
9
- /**
10
- * Installer implementation for Python packages using pip
11
- */
12
- export class PipInstaller extends BaseInstaller {
13
- private getPythonCommand(options?: ServerInstallOptions): string {
14
- return options?.settings?.pythonEnv as string || 'python';
15
- }
16
-
17
- private getPipCommand(options?: ServerInstallOptions): string {
18
- const pythonCmd = this.getPythonCommand(options);
19
- return `${pythonCmd} -m pip`;
20
- }
21
-
22
- /**
23
- * Check if this installer can handle the given requirement type
24
- * @param requirement The requirement to check
25
- * @returns True if this installer can handle the requirement
26
- */
27
- canHandle(requirement: RequirementConfig): boolean {
28
- return requirement.type === 'pip';
29
- }
30
-
31
- supportCheckUpdates(): boolean {
32
- return true;
33
- }
34
-
35
- /**
36
- * Get the latest version available for the pip package.
37
- * @param requirement The requirement to check.
38
- * @param options Optional server install options.
39
- * @returns The latest version string, or undefined if not found or not applicable.
40
- */
41
- async getLatestVersion(requirement: RequirementConfig, options?: ServerInstallOptions): Promise<string | undefined> {
42
- if (requirement.registry) {
43
- if (requirement.registry.githubRelease) {
44
- return getGitHubLatestVersion(this.execPromise, requirement.registry.githubRelease.repository);
45
- } else if (requirement.registry.artifacts) {
46
- // Assuming getArtifactLatestVersion exists and has a compatible signature
47
- return getArtifactLatestVersion(requirement, requirement.registry.artifacts, options);
48
- }
49
- }
50
- // Default: get common latest version from pip index
51
- const pipCmd = this.getPipCommand(options);
52
- const { stdout } = await this.execPromise(`${pipCmd} index versions ${requirement.name} --pre=0`);
53
- // Parse output to find the latest version. Example output:
54
- // mypackage (1.0.0)
55
- // Available versions: 1.0.0, 0.9.0
56
- // LATEST: 1.0.0
57
- // Or for some packages:
58
- // mypackage
59
- // VERSIONS: 1.0.0, 0.9.0
60
- // Latest: 1.0.0
61
- const latestMatch = stdout.match(/(?:LATEST|Latest):\s*([^\s]+)/);
62
- if (latestMatch && latestMatch[1]) {
63
- return latestMatch[1];
64
- }
65
- // Fallback if LATEST line is not found, try to get the first version from "Available versions" or "VERSIONS"
66
- const versionsMatch = stdout.match(/(?:Available versions|VERSIONS):\s*([^\n]+)/);
67
- if (versionsMatch && versionsMatch[1]) {
68
- const versions = versionsMatch[1].split(',').map(v => v.trim());
69
- if (versions.length > 0) {
70
- // Assuming versions are listed in a somewhat reasonable order,
71
- // or we might need more sophisticated version sorting here.
72
- return versions[0];
73
- }
74
- }
75
- return undefined; // Or throw an error if version cannot be determined
76
- }
77
-
78
- /**
79
- * Check if the Python package is already installed
80
- * @param requirement The requirement to check
81
- * @param options Optional server install options
82
- * @returns The status of the requirement
83
- */
84
- async checkInstallation(requirement: RequirementConfig, options?: ServerInstallOptions): Promise<RequirementStatus> {
85
- try {
86
- const pipCmd = this.getPipCommand(options);
87
- const { stdout, stderr } = await this.execPromise(`${pipCmd} show ${requirement.name}`);
88
-
89
- const installed = stdout.includes(requirement.name.toLowerCase());
90
- const versionMatch = stdout.match(/Version: (.+)/);
91
- const installedVersion = versionMatch ? versionMatch[1] : undefined;
92
-
93
- return {
94
- name: requirement.name,
95
- type: 'pip',
96
- installed: installed,
97
- version: installedVersion,
98
- inProgress: false,
99
- pythonEnv: this.getPythonCommand(options)
100
- };
101
- } catch (error) {
102
- return {
103
- name: requirement.name,
104
- type: 'pip',
105
- installed: false,
106
- error: error instanceof Error ? error.message : String(error),
107
- inProgress: false,
108
- pythonEnv: this.getPythonCommand(options)
109
- };
110
- }
111
- }
112
-
113
- /**
114
- * Install the Python package
115
- * @param requirement The requirement to install
116
- * @param recorder Optional InstallOperationManager for recording steps
117
- * @param options Optional server install options
118
- * @returns The status of the installation
119
- */
120
- async install(requirement: RequirementConfig, recorder: InstallOperationManager, options?: ServerInstallOptions): Promise<RequirementStatus> {
121
-
122
- return await recorder.recording(
123
- async (): Promise<RequirementStatus> => {
124
- const status = await this.checkInstallation(requirement, options);
125
- if (status.installed && status.version && compareVersions(status.version, requirement.version) === 0 && !requirement.version.toLowerCase().includes('latest')) {
126
- Logger.log(`${requirement.name}==${status.version} already installed for ${this.getPythonCommand}.`);
127
- return status;
128
- }
129
-
130
- const pipCmd = this.getPipCommand(options);
131
- let command: string
132
-
133
- if (!requirement.registry) {
134
- if (requirement.version && !requirement.version.includes('latest')) {
135
- command = `${pipCmd} install ${requirement.name}==${requirement.version}`;
136
- } else {
137
- command = `${pipCmd} install --upgrade ${requirement.name}`;
138
- }
139
- } else {
140
- let packageSource: string;
141
- if (requirement.registry.githubRelease) {
142
- const result = await handleGitHubRelease(requirement, requirement.registry.githubRelease);
143
- packageSource = result.resolvedPath;
144
- command = `${pipCmd} install "${packageSource}"`
145
- } else if (requirement.registry.artifacts) {
146
- const pythonCmd = this.getPythonCommand(options);
147
- const adoArtifactResult = await handleAdoArtifact(requirement, requirement.registry.artifacts, pythonCmd);
148
-
149
- command = `${pipCmd} install ${adoArtifactResult.package} --extra-index-url ${adoArtifactResult.registryUrl}`;
150
- } else {
151
- await recorder.recordStep('PipInstaller:RegistryConfig', 'failed', 'Invalid registry configuration');
152
- throw new Error('Invalid registry configuration');
153
- }
154
- }
155
- return await recorder.recording(
156
- async () => {
157
- const { stderr } = await this.execPromise(command);
158
- if (stderr && stderr.toLowerCase().includes('error')) {
159
- Logger.debug(`Pip installation error: ${stderr}`);
160
-
161
- // wait for 5 seconds as python pip would be little delayed
162
- await new Promise(resolve => setTimeout(resolve, 5000));
163
- const checkStatus = await this.checkInstallation(requirement, options);
164
- if (!checkStatus.installed) {
165
- Logger.error(`Package not found after the command, ${stderr}`);
166
- throw new Error(`Pip installation failed with: ${stderr}`);
167
- }
168
- }
169
-
170
- return {
171
- name: requirement.name,
172
- type: 'pip',
173
- installed: true,
174
- version: requirement.version, // This might need to be updated to actual installed version
175
- inProgress: false,
176
- pythonEnv: this.getPythonCommand(options)
177
- };
178
- },
179
- {
180
- stepName: `${RecordingConstants.STEP_INSTALL_COMMAND_PREFIX}: ${requirement.name} : ${requirement.version}`,
181
- inProgressMessage: `Running: ${command}`,
182
- endMessage: (result) => result.installed ? `Succeeded: ${command}` : `Failed: ${command}`,
183
- }
184
- );
185
- },
186
- {
187
- stepName: RecordingConstants.STEP_PIP_INSTALLER_INSTALL,
188
- inProgressMessage: `Installing pip package: ${requirement.name}`,
189
- endMessage: (result) => result.installed
190
- ? `Install completed for ${requirement.name} with version ${result.version}`
191
- : `Install failed for ${requirement.name}`,
192
- onError: (error) => {
193
- return {
194
- result: {
195
- name: requirement.name,
196
- type: 'pip',
197
- installed: false,
198
- error: error instanceof Error ? error.message : String(error),
199
- inProgress: false,
200
- pythonEnv: this.getPythonCommand(options)
201
- },
202
- message: error instanceof Error ? error.message : String(error),
203
- };
204
- },
205
- });
206
- }
207
- }
@@ -1,42 +0,0 @@
1
- import { RequirementConfig, RequirementStatus, ServerInstallOptions } from '../../metadatas/types.js';
2
- import { InstallOperationManager } from '../../loaders/InstallOperationManager.js';
3
-
4
- /**
5
- * Interface for requirement installers.
6
- * Implementations should handle specific requirement types.
7
- */
8
- export interface RequirementInstaller {
9
- /**
10
- * Check if this installer can handle the given requirement type
11
- * @param requirement The requirement to check
12
- * @returns True if this installer can handle the requirement
13
- */
14
- canHandle(requirement: RequirementConfig): boolean;
15
-
16
- supportCheckUpdates(): boolean;
17
- /**
18
- * Install the requirement
19
- * @param requirement The requirement to install
20
- * @param options Optional install options
21
- * @param recorder Optional InstallOperationManager for recording steps
22
- * @returns The status of the installation
23
- */
24
- install(requirement: RequirementConfig, recorder: InstallOperationManager, options?: ServerInstallOptions): Promise<RequirementStatus>;
25
-
26
- /**
27
- * Check if the requirement is already installed
28
- * @param requirement The requirement to check
29
- * @returns The status of the requirement
30
- */
31
- checkInstallation(requirement: RequirementConfig, options?: ServerInstallOptions): Promise<RequirementStatus>;
32
-
33
- /**
34
- * Check if updates are available for the requirement
35
- * @param requirement The requirement to check
36
- * @param currentStatus The current status of the requirement
37
- * @returns The status of the requirement with update information
38
- */
39
- checkForUpdates(requirement: RequirementConfig, currentStatus: RequirementStatus): Promise<RequirementStatus>;
40
- }
41
-
42
- // Note: Do not re-export implementations from here to avoid circular dependencies