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,152 +1,2 @@
1
- import { exec } from 'child_process';
2
- import { promisify } from 'util';
3
- import { SUPPORTED_CLIENTS } from '../../metadatas/constants.js';
4
- import { Logger } from '../../../utils/logger.js';
5
- import { handleGitHubRelease } from '../../../utils/githubUtils.js';
6
- import { compareVersions } from '../../../utils/versionUtils.js';
7
- const execAsync = promisify(exec);
8
- export class ExtensionInstaller {
9
- /**
10
- * Get VSCode path based on the OS type
11
- */
12
- static async getVSCodePath(isInsiders) {
13
- const command = isInsiders ? 'code-insiders' : 'code';
14
- try {
15
- if (process.platform === 'win32') {
16
- // Windows: Check command availability first
17
- await execAsync(`where ${command}`);
18
- return command;
19
- }
20
- else if (process.platform === 'darwin') {
21
- // macOS: Check in both system and user Applications
22
- const appName = isInsiders ? 'Visual Studio Code - Insiders.app' : 'Visual Studio Code.app';
23
- const systemPath = `/Applications/${appName}`;
24
- const userPath = `${process.env.HOME}/Applications/${appName}`;
25
- try {
26
- await execAsync(`test -d "${systemPath}"`);
27
- return systemPath;
28
- }
29
- catch {
30
- try {
31
- await execAsync(`test -d "${userPath}"`);
32
- return userPath;
33
- }
34
- catch {
35
- return null;
36
- }
37
- }
38
- }
39
- return command;
40
- }
41
- catch {
42
- return null;
43
- }
44
- }
45
- /**
46
- * List installed extensions for VSCode or VSCode Insiders
47
- */
48
- static async listExtensions(isInsiders) {
49
- const command = isInsiders ? 'code-insiders' : 'code';
50
- try {
51
- const { stdout } = await execAsync(`${command} --list-extensions --show-versions`);
52
- return stdout.split('\n')
53
- .filter(line => line.trim())
54
- .map(line => {
55
- const [extension, version] = line.split('@');
56
- const [publisher, name] = extension.split('.');
57
- return { name, publisher, version: version || '' };
58
- });
59
- }
60
- catch (error) {
61
- Logger.error(`Failed to list extensions for ${command}:`, error);
62
- return [];
63
- }
64
- }
65
- /**
66
- * Check if an extension is installed and get its version
67
- */
68
- static async checkExtension(extensionId, isInsiders) {
69
- const extensions = await this.listExtensions(isInsiders);
70
- const [publisher, name] = extensionId.split('.');
71
- const extension = extensions.find(ext => ext.publisher.toLowerCase() === publisher.toLowerCase() &&
72
- ext.name.toLowerCase() === name.toLowerCase());
73
- return extension ? extension.version : null;
74
- }
75
- /**
76
- * Install extension from marketplace
77
- */
78
- static async installPublicExtension(extensionId, isInsiders) {
79
- const command = isInsiders ? 'code-insiders' : 'code';
80
- try {
81
- await execAsync(`${command} --install-extension ${extensionId}`);
82
- return true;
83
- }
84
- catch (error) {
85
- Logger.error(`Failed to install extension ${extensionId}:`, error);
86
- return false;
87
- }
88
- }
89
- /**
90
- * Install extension from VSIX file
91
- */
92
- static async installPrivateExtension(vsixPath, isInsiders) {
93
- const command = isInsiders ? 'code-insiders' : 'code';
94
- try {
95
- await execAsync(`${command} --install-extension "${vsixPath}"`);
96
- return true;
97
- }
98
- catch (error) {
99
- Logger.error(`Failed to install extension from VSIX ${vsixPath}:`, error);
100
- return false;
101
- }
102
- }
103
- /**
104
- * Install extension for a specific client
105
- */
106
- static async installExtension(clientName) {
107
- const client = SUPPORTED_CLIENTS[clientName];
108
- if (!client?.extension?.extensionId) {
109
- Logger.error(`No extension configuration found for client ${clientName}`);
110
- return false;
111
- }
112
- const { extensionId, leastVersion, repository, assetName, private: isPrivate } = client.extension;
113
- let success = false;
114
- // Check both VSCode and VSCode Insiders
115
- for (const isInsiders of [false, true]) {
116
- const vscodePath = await this.getVSCodePath(isInsiders);
117
- if (!vscodePath) {
118
- Logger.debug(`${isInsiders ? 'VSCode Insiders' : 'VSCode'} not found, skipping...`);
119
- continue;
120
- }
121
- const currentVersion = await this.checkExtension(extensionId, isInsiders);
122
- if (!currentVersion || (isPrivate && leastVersion && compareVersions(currentVersion, leastVersion) < 0)) {
123
- // Extension not installed or needs update (for private extensions)
124
- if (!isPrivate) {
125
- // Install public extension from marketplace
126
- success = await this.installPublicExtension(extensionId, isInsiders);
127
- }
128
- else {
129
- // Install private extension from GitHub release using latest version
130
- try {
131
- if (!repository || !assetName) {
132
- throw new Error(`Missing repository or assetName for private extension ${extensionId}`);
133
- }
134
- const { resolvedPath } = await handleGitHubRelease({ name: extensionId, version: 'latest', type: 'extension' }, { repository, assetName });
135
- success = await this.installPrivateExtension(resolvedPath, isInsiders);
136
- }
137
- catch (error) {
138
- Logger.error(`Failed to install/update private extension ${extensionId}:`, error);
139
- continue;
140
- }
141
- }
142
- }
143
- else {
144
- // Extension already installed and up to date
145
- Logger.debug(`Extension ${extensionId} is already installed and up to date`);
146
- success = true;
147
- }
148
- }
149
- return success;
150
- }
151
- }
1
+ import{exec}from"child_process";import{promisify}from"util";import{SUPPORTED_CLIENTS}from"../../metadatas/constants.js";import{Logger}from"../../../utils/logger.js";import{handleGitHubRelease}from"../../../utils/githubUtils.js";import{compareVersions}from"../../../utils/versionUtils.js";const execAsync=promisify(exec);export class ExtensionInstaller{static async getVSCodePath(e){const t=e?"code-insiders":"code";try{if("win32"===process.platform)return await execAsync(`where ${t}`),t;if("darwin"===process.platform){const t=e?"Visual Studio Code - Insiders.app":"Visual Studio Code.app",s=`/Applications/${t}`,i=`${process.env.HOME}/Applications/${t}`;try{return await execAsync(`test -d "${s}"`),s}catch{try{return await execAsync(`test -d "${i}"`),i}catch{return null}}}return t}catch{return null}}static async listExtensions(e){const t=e?"code-insiders":"code";try{const{stdout:e}=await execAsync(`${t} --list-extensions --show-versions`);return e.split("\n").filter((e=>e.trim())).map((e=>{const[t,s]=e.split("@"),[i,n]=t.split(".");return{name:n,publisher:i,version:s||""}}))}catch(e){return Logger.error(`Failed to list extensions for ${t}:`,e),[]}}static async checkExtension(e,t){const s=await this.listExtensions(t),[i,n]=e.split("."),o=s.find((e=>e.publisher.toLowerCase()===i.toLowerCase()&&e.name.toLowerCase()===n.toLowerCase()));return o?o.version:null}static async installPublicExtension(e,t){const s=t?"code-insiders":"code";try{return await execAsync(`${s} --install-extension ${e}`),!0}catch(t){return Logger.error(`Failed to install extension ${e}:`,t),!1}}static async installPrivateExtension(e,t){const s=t?"code-insiders":"code";try{return await execAsync(`${s} --install-extension "${e}"`),!0}catch(t){return Logger.error(`Failed to install extension from VSIX ${e}:`,t),!1}}static async installExtension(e){const t=SUPPORTED_CLIENTS[e];if(!t?.extension?.extensionId)return Logger.error(`No extension configuration found for client ${e}`),!1;const{extensionId:s,leastVersion:i,repository:n,assetName:o,private:r}=t.extension;let a=!1;for(const e of[!1,!0]){if(!await this.getVSCodePath(e)){Logger.debug((e?"VSCode Insiders":"VSCode")+" not found, skipping...");continue}const t=await this.checkExtension(s,e);if(!t||r&&i&&compareVersions(t,i)<0)if(r)try{if(!n||!o)throw new Error(`Missing repository or assetName for private extension ${s}`);const{resolvedPath:t}=await handleGitHubRelease({name:s,version:"latest",type:"extension"},{repository:n,assetName:o});a=await this.installPrivateExtension(t,e)}catch(e){Logger.error(`Failed to install/update private extension ${s}:`,e);continue}else a=await this.installPublicExtension(s,e);else Logger.debug(`Extension ${s} is already installed and up to date`),a=!0}return a}}
152
2
  //# sourceMappingURL=ExtensionInstaller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["exec","promisify","SUPPORTED_CLIENTS","Logger","handleGitHubRelease","compareVersions","execAsync","ExtensionInstaller","getVSCodePath","isInsiders","command","process","platform","appName","systemPath","userPath","env","HOME","listExtensions","stdout","split","filter","line","trim","map","extension","version","publisher","name","error","checkExtension","extensionId","extensions","this","find","ext","toLowerCase","installPublicExtension","installPrivateExtension","vsixPath","installExtension","clientName","client","leastVersion","repository","assetName","private","isPrivate","success","debug","currentVersion","Error","resolvedPath","type"],"sources":["../../../../src/core/installers/clients/ExtensionInstaller.ts"],"mappings":"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","ignoreList":[]}
@@ -1,69 +1,2 @@
1
- import { BaseClientInstaller } from './BaseClientInstaller.js';
2
- import { readJsonFile, writeJsonFile } from '../../../utils/clientUtils.js';
3
- /**
4
- * Github Copilot client installer implementation
5
- * Handles installation of Github Copilot client including extension installation and settings configuration
6
- */
7
- export class GithubCopilotInstaller extends BaseClientInstaller {
8
- clientName = 'GithubCopilot';
9
- /**
10
- * Initialize settings with GithubCopilot-specific structure
11
- * Overrides base method to provide custom initialization
12
- */
13
- initializeSettings(settings) {
14
- if (!settings.mcp) {
15
- settings.mcp = {
16
- servers: {},
17
- inputs: []
18
- };
19
- }
20
- if (!settings.mcp.servers) {
21
- settings.mcp.servers = {};
22
- }
23
- }
24
- /**
25
- * Handle stdio mode configuration for GithubCopilot
26
- * Overrides base method to provide custom stdio configuration
27
- */
28
- async handleStdioMode(settings, serverName, finalConfig) {
29
- if (finalConfig.args) {
30
- finalConfig.args = finalConfig.args.map((arg) => typeof arg === 'string' ? arg.replace(/\\/g, '/') : arg);
31
- }
32
- settings.mcp.servers[serverName] = {
33
- command: finalConfig.command,
34
- args: finalConfig.args,
35
- env: finalConfig.env
36
- };
37
- }
38
- /**
39
- * Handle SSE mode configuration for GithubCopilot
40
- * Overrides base method to provide custom SSE configuration
41
- */
42
- handleSseMode(settings, serverName, installConfig) {
43
- settings.mcp.servers[serverName] = {
44
- type: 'sse',
45
- url: installConfig.url
46
- };
47
- }
48
- /**
49
- * Set up Github Copilot client settings
50
- * Updates VS Code settings with MCP server configuration
51
- * Note: GithubCopilot uses a different settings structure compared to other clients
52
- */
53
- async setupClientSettings(settingPath, serverName, installConfig) {
54
- // Read existing settings
55
- const settings = await readJsonFile(settingPath, true);
56
- // Initialize settings with client-specific structure
57
- this.initializeSettings(settings);
58
- // Handle different modes
59
- if (installConfig.mode === 'stdio') {
60
- await this.handleStdioMode(settings, serverName, installConfig);
61
- }
62
- else if (installConfig.mode === 'sse') {
63
- this.handleSseMode(settings, serverName, installConfig);
64
- }
65
- // Write updated settings
66
- await writeJsonFile(settingPath, settings);
67
- }
68
- }
1
+ import{BaseClientInstaller}from"./BaseClientInstaller.js";import{readJsonFile,writeJsonFile}from"../../../utils/clientUtils.js";export class GithubCopilotInstaller extends BaseClientInstaller{clientName="GithubCopilot";initializeSettings(e){e.mcp||(e.mcp={servers:{},inputs:[]}),e.mcp.servers||(e.mcp.servers={})}async handleStdioMode(e,s,t){t.args&&(t.args=t.args.map((e=>"string"==typeof e?e.replace(/\\/g,"/"):e))),e.mcp.servers[s]={command:t.command,args:t.args,env:t.env}}handleSseMode(e,s,t){e.mcp.servers[s]={type:"sse",url:t.url}}async setupClientSettings(e,s,t){const i=await readJsonFile(e,!0);this.initializeSettings(i),"stdio"===t.mode?await this.handleStdioMode(i,s,t):"sse"===t.mode&&this.handleSseMode(i,s,t),await writeJsonFile(e,i)}}
69
2
  //# sourceMappingURL=GithubCopilotInstaller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BaseClientInstaller","readJsonFile","writeJsonFile","GithubCopilotInstaller","clientName","initializeSettings","settings","mcp","servers","inputs","handleStdioMode","serverName","finalConfig","args","map","arg","replace","command","env","handleSseMode","installConfig","type","url","setupClientSettings","settingPath","this","mode"],"sources":["../../../../src/core/installers/clients/GithubCopilotInstaller.ts"],"mappings":"OAASA,wBAA2B,kCAC3BC,aAAcC,kBAAqB,uCAMtC,MAAOC,+BAA+BH,oBACrBI,WAAqB,gBAO9B,kBAAAC,CAAmBC,GACpBA,EAASC,MACVD,EAASC,IAAM,CACXC,QAAS,GACTC,OAAQ,KAIXH,EAASC,IAAIC,UACdF,EAASC,IAAIC,QAAU,GAE/B,CAMU,qBAAME,CAAgBJ,EAAeK,EAAoBC,GAC3DA,EAAYC,OACZD,EAAYC,KAAOD,EAAYC,KAAKC,KAAKC,GACtB,iBAARA,EAAmBA,EAAIC,QAAQ,MAAO,KAAOD,KAG5DT,EAASC,IAAIC,QAAQG,GAAc,CAC/BM,QAASL,EAAYK,QACrBJ,KAAMD,EAAYC,KAClBK,IAAKN,EAAYM,IAEzB,CAMU,aAAAC,CAAcb,EAAeK,EAAoBS,GACvDd,EAASC,IAAIC,QAAQG,GAAc,CAC/BU,KAAM,MACNC,IAAKF,EAAcE,IAE3B,CAOA,yBAAMC,CAAoBC,EAAqBb,EAAoBS,GAE/D,MAAMd,QAAiBL,aAAauB,GAAa,GAGjDC,KAAKpB,mBAAmBC,GAGG,UAAvBc,EAAcM,WACRD,KAAKf,gBAAgBJ,EAAUK,EAAYS,GACnB,QAAvBA,EAAcM,MACrBD,KAAKN,cAAcb,EAAUK,EAAYS,SAIvClB,cAAcsB,EAAalB,EACrC","ignoreList":[]}
@@ -1,29 +1,2 @@
1
- import { BaseClientInstaller } from './BaseClientInstaller.js';
2
- import { readJsonFile, writeJsonFile } from '../../../utils/clientUtils.js';
3
- /**
4
- * MSRooCode client installer implementation
5
- */
6
- export class MSRooCodeInstaller extends BaseClientInstaller {
7
- clientName = 'MSRooCode';
8
- /**
9
- * Set up MSRooCode client settings
10
- */
11
- async setupClientSettings(settingPath, serverName, installConfig) {
12
- // Read existing settings
13
- const settings = await readJsonFile(settingPath, true);
14
- // Initialize settings with client-specific structure
15
- this.initializeSettings(settings);
16
- // Handle different modes
17
- if (installConfig.mode === 'stdio') {
18
- // Process config for Windows NPX if needed
19
- const finalConfig = await this.handleWindowsNpx(installConfig);
20
- await this.handleStdioMode(settings, serverName, finalConfig);
21
- }
22
- else if (installConfig.mode === 'sse') {
23
- this.handleSseMode(settings, serverName, installConfig);
24
- }
25
- // Write updated settings
26
- await writeJsonFile(settingPath, settings);
27
- }
28
- }
1
+ import{BaseClientInstaller}from"./BaseClientInstaller.js";import{readJsonFile,writeJsonFile}from"../../../utils/clientUtils.js";export class MSRooCodeInstaller extends BaseClientInstaller{clientName="MSRooCode";async setupClientSettings(e,t,i){const s=await readJsonFile(e,!0);if(this.initializeSettings(s),"stdio"===i.mode){const e=await this.handleWindowsNpx(i);await this.handleStdioMode(s,t,e)}else"sse"===i.mode&&this.handleSseMode(s,t,i);await writeJsonFile(e,s)}}
29
2
  //# sourceMappingURL=MSRooCodeInstaller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BaseClientInstaller","readJsonFile","writeJsonFile","MSRooCodeInstaller","clientName","setupClientSettings","settingPath","serverName","installConfig","settings","this","initializeSettings","mode","finalConfig","handleWindowsNpx","handleStdioMode","handleSseMode"],"sources":["../../../../src/core/installers/clients/MSRooCodeInstaller.ts"],"mappings":"OAASA,wBAA2B,kCAC3BC,aAAcC,kBAAqB,uCAKtC,MAAOC,2BAA2BH,oBACjBI,WAAqB,YAIxC,yBAAMC,CAAoBC,EAAqBC,EAAoBC,GAE/D,MAAMC,QAAiBR,aAAaK,GAAa,GAMjD,GAHAI,KAAKC,mBAAmBF,GAGG,UAAvBD,EAAcI,KAAkB,CAEhC,MAAMC,QAAoBH,KAAKI,iBAAiBN,SAE1CE,KAAKK,gBAAgBN,EAAUF,EAAYM,EACrD,KAAkC,QAAvBL,EAAcI,MACrBF,KAAKM,cAAcP,EAAUF,EAAYC,SAIvCN,cAAcI,EAAaG,EACrC","ignoreList":[]}
@@ -1,9 +1,2 @@
1
- export { ClientInstaller } from './clients/ClientInstaller.js';
2
- // Export all requirement installer implementations
3
- export { BaseInstaller } from './requirements/BaseInstaller.js';
4
- export { NpmInstaller } from './requirements/NpmInstaller.js';
5
- export { PipInstaller } from './requirements/PipInstaller.js';
6
- export { GeneralInstaller } from './requirements/GeneralInstaller.js';
7
- export { CommandInstaller } from './requirements/CommandInstaller.js';
8
- export { InstallerFactory, createInstallerFactory } from './requirements/InstallerFactory.js';
1
+ export{ClientInstaller}from"./clients/ClientInstaller.js";export{BaseInstaller}from"./requirements/BaseInstaller.js";export{NpmInstaller}from"./requirements/NpmInstaller.js";export{PipInstaller}from"./requirements/PipInstaller.js";export{GeneralInstaller}from"./requirements/GeneralInstaller.js";export{CommandInstaller}from"./requirements/CommandInstaller.js";export{InstallerFactory,createInstallerFactory}from"./requirements/InstallerFactory.js";
9
2
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ClientInstaller","BaseInstaller","NpmInstaller","PipInstaller","GeneralInstaller","CommandInstaller","InstallerFactory","createInstallerFactory"],"sources":["../../../src/core/installers/index.ts"],"mappings":"OAESA,oBAAuB,sCAGvBC,kBAAqB,yCACrBC,iBAAoB,wCACpBC,iBAAoB,wCACpBC,qBAAwB,4CACxBC,qBAAwB,4CACxBC,iBAAkBC,2BAA8B","ignoreList":[]}
@@ -1,57 +1,2 @@
1
- import path from 'path';
2
- import { SETTINGS_DIR } from '../../metadatas/constants.js';
3
- import { Logger } from '../../../utils/logger.js';
4
- /**
5
- * Abstract base class with common functionality for all requirement installers
6
- */
7
- export class BaseInstaller {
8
- execPromise;
9
- downloadsDir;
10
- constructor(execPromise) {
11
- this.execPromise = execPromise;
12
- this.downloadsDir = path.join(SETTINGS_DIR, 'downloads');
13
- }
14
- /**
15
- * Check if updates are available for the requirement
16
- * @param requirement The requirement to check
17
- * @param currentStatus The current status of the requirement
18
- * @param options Optional server install options.
19
- * @returns The status of the requirement with update information
20
- */
21
- async checkForUpdates(requirement, currentStatus, options) {
22
- try {
23
- // If requirement is not installed, no need to check for updates
24
- if (!currentStatus.installed) {
25
- return currentStatus;
26
- }
27
- // If the version doesn't contain "latest", no update check needed
28
- if (!requirement.version.includes('latest')) {
29
- return currentStatus;
30
- }
31
- const latestVersion = await this.getLatestVersion(requirement, options);
32
- // If we found a latest version and it's different from current
33
- if (latestVersion && latestVersion !== currentStatus.version) {
34
- return {
35
- ...currentStatus,
36
- availableUpdate: {
37
- version: latestVersion,
38
- message: `Update available: ${currentStatus.version} → ${latestVersion}`
39
- },
40
- lastCheckTime: new Date().toISOString()
41
- };
42
- }
43
- else {
44
- return {
45
- ...currentStatus,
46
- lastCheckTime: new Date().toISOString()
47
- };
48
- }
49
- }
50
- catch (error) {
51
- // Don't update status on error, just log it
52
- Logger.log(`Error checking for updates for ${requirement.name}: ${error instanceof Error ? error.message : String(error)}`);
53
- return currentStatus;
54
- }
55
- }
56
- }
1
+ import path from"path";import{SETTINGS_DIR}from"../../metadatas/constants.js";import{Logger}from"../../../utils/logger.js";export class BaseInstaller{execPromise;downloadsDir;constructor(e){this.execPromise=e,this.downloadsDir=path.join(SETTINGS_DIR,"downloads")}async checkForUpdates(e,t,r){try{if(!t.installed)return t;if(!e.version.includes("latest"))return t;const s=await this.getLatestVersion(e,r);return s&&s!==t.version?{...t,availableUpdate:{version:s,message:`Update available: ${t.version} → ${s}`},lastCheckTime:(new Date).toISOString()}:{...t,lastCheckTime:(new Date).toISOString()}}catch(r){return Logger.log(`Error checking for updates for ${e.name}: ${r instanceof Error?r.message:String(r)}`),t}}}
57
2
  //# sourceMappingURL=BaseInstaller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["path","SETTINGS_DIR","Logger","BaseInstaller","execPromise","downloadsDir","constructor","this","join","checkForUpdates","requirement","currentStatus","options","installed","version","includes","latestVersion","getLatestVersion","availableUpdate","message","lastCheckTime","Date","toISOString","error","log","name","Error","String"],"sources":["../../../../src/core/installers/requirements/BaseInstaller.ts"],"mappings":"OACOA,SAAU,cACRC,iBAAoB,sCAEpBC,WAAc,kCAMjB,MAAgBC,cACRC,YACAC,aAEV,WAAAC,CAAYF,GACRG,KAAKH,YAAcA,EACnBG,KAAKF,aAAeL,KAAKQ,KAAKP,aAAc,YAChD,CA8BA,qBAAMQ,CAAgBC,EAAgCC,EAAkCC,GACpF,IAEI,IAAKD,EAAcE,UACf,OAAOF,EAIX,IAAKD,EAAYI,QAAQC,SAAS,UAC9B,OAAOJ,EAGX,MAAMK,QAAsBT,KAAKU,iBAAiBP,EAAaE,GAG/D,OAAII,GAAiBA,IAAkBL,EAAcG,QAC1C,IACAH,EACHO,gBAAiB,CACbJ,QAASE,EACTG,QAAS,qBAAqBR,EAAcG,aAAaE,KAE7DI,eAAe,IAAIC,MAAOC,eAGvB,IACAX,EACHS,eAAe,IAAIC,MAAOC,cAItC,CAAE,MAAOC,GAGL,OADArB,OAAOsB,IAAI,kCAAkCd,EAAYe,SAASF,aAAiBG,MAAQH,EAAMJ,QAAUQ,OAAOJ,MAC3GZ,CACX,CACJ","ignoreList":[]}
@@ -1,214 +1,2 @@
1
- import { OSType } 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 * as RecordingConstants from '../../metadatas/recordingConstants.js';
6
- /**
7
- * Installer implementation for command-line tools
8
- */
9
- export class CommandInstaller extends BaseInstaller {
10
- /**
11
- * Constructor for the CommandInstaller
12
- * @param execPromise Function to execute commands
13
- */
14
- getLatestVersion(requirement, options) {
15
- throw new Error('Method not implemented.');
16
- }
17
- /**
18
- * Mapping of command names to their package IDs
19
- * This handles special cases where the command name differs from the package ID
20
- */
21
- commandMappings = {
22
- 'uv': { windows: 'astral-sh.uv', macos: 'uv' }
23
- // Add more mappings as needed
24
- };
25
- /**
26
- * Check if this installer can handle the given requirement type
27
- * @param requirement The requirement to check
28
- * @returns True if this installer can handle the requirement
29
- */
30
- canHandle(requirement) {
31
- return requirement.type === 'command';
32
- }
33
- supportCheckUpdates() {
34
- return false;
35
- }
36
- /**
37
- * Get the mapped package ID for a command
38
- * @param commandName The command name to map
39
- * @returns The mapped package ID
40
- */
41
- getMappedPackageId(commandName) {
42
- const osType = getOSType();
43
- const mapping = this.commandMappings[commandName];
44
- if (mapping) {
45
- return osType === OSType.Windows ? mapping.windows : mapping.macos;
46
- }
47
- // If no mapping exists, use the command name itself
48
- return commandName;
49
- }
50
- /**
51
- * Check if the command is already installed
52
- * @param requirement The requirement to check
53
- * @returns The status of the requirement
54
- */
55
- async checkInstallation(requirement) {
56
- try {
57
- await refreshPathEnv();
58
- const commandName = requirement.alias || requirement.name;
59
- const osType = getOSType();
60
- let commandResult;
61
- if (osType === OSType.Windows) {
62
- // Check if command exists on Windows
63
- try {
64
- commandResult = await this.execPromise(`where ${commandName} 2>nul`);
65
- }
66
- catch (error) {
67
- Logger.debug(`Error checking command existence: ${error}`);
68
- // On Windows, 'where' command returns non-zero exit code if the command is not found
69
- // We'll handle this as "command not found" rather than an error
70
- commandResult = { stdout: '', stderr: '' };
71
- }
72
- }
73
- else {
74
- // Check if command exists on macOS/Linux
75
- try {
76
- commandResult = await this.execPromise(`which ${commandName} 2>/dev/null`);
77
- }
78
- catch (error) {
79
- Logger.debug(`Error checking command existence: ${error}`);
80
- // Similarly handle command not found on Unix systems
81
- commandResult = { stdout: '', stderr: '' };
82
- }
83
- }
84
- // If the command exists, it will return a path or multiple paths
85
- const installed = commandResult.stdout.trim().length > 0;
86
- // Try to get version information if available
87
- let version;
88
- if (installed) {
89
- try {
90
- const versionResult = await this.execPromise(`${commandName} --version`);
91
- if (versionResult.stdout) {
92
- // Extract version information - this is a simple approach that might need refinement
93
- const versionMatch = versionResult.stdout.match(/\d+\.\d+(\.\d+)?/);
94
- version = versionMatch ? versionMatch[0] : undefined;
95
- }
96
- }
97
- catch (error) {
98
- Logger.debug(`Error checking command version: ${error}`);
99
- // Ignore errors from version check, consider it installed anyway
100
- }
101
- }
102
- return {
103
- name: requirement.name,
104
- type: 'command',
105
- installed,
106
- version,
107
- inProgress: false
108
- };
109
- }
110
- catch (error) {
111
- Logger.error(`Error checking installation: ${error}`);
112
- return {
113
- name: requirement.name,
114
- type: 'command',
115
- installed: false,
116
- error: error instanceof Error ? error.message : String(error),
117
- inProgress: false
118
- };
119
- }
120
- }
121
- /**
122
- * Install the command
123
- * @param requirement The requirement to install
124
- * @returns The status of the installation
125
- */
126
- /**
127
- * Install the command
128
- * @param requirement The requirement to install
129
- * @param options Optional install options
130
- * @param recorder Optional InstallOperationManager for recording steps
131
- * @returns The status of the installation
132
- */
133
- async install(requirement, recorder, options) {
134
- const doInstall = async () => {
135
- const status = await this.checkInstallation(requirement);
136
- if (status.installed) {
137
- return status;
138
- }
139
- const packageId = this.getMappedPackageId(requirement.name);
140
- const osType = getOSType();
141
- let installCommand;
142
- if (osType === OSType.Windows) {
143
- installCommand = `winget install --id ${packageId}`;
144
- if (requirement.version && requirement.version !== 'latest') {
145
- installCommand += ` --version ${requirement.version}`;
146
- }
147
- }
148
- else if (osType === OSType.MacOS) {
149
- installCommand = `brew install ${packageId}`;
150
- if (requirement.version && requirement.version !== 'latest') {
151
- installCommand += `@${requirement.version}`;
152
- }
153
- }
154
- else {
155
- if (recorder)
156
- await recorder.recordStep('CommandInstaller:UnsupportedOS', 'failed', `Unsupported OS for ${requirement.name}`);
157
- throw new Error(`Unsupported operating system for installing ${requirement.name}`);
158
- }
159
- // Execute the installation command
160
- const { stderr } = await this.execPromise(installCommand);
161
- if (stderr && stderr.toLowerCase().includes('error')) {
162
- throw new Error(stderr);
163
- }
164
- // Check if installation was successful
165
- const updatedStatus = await this.checkInstallation(requirement);
166
- if (!updatedStatus.installed) {
167
- throw new Error(`Failed to install ${requirement.name}`);
168
- }
169
- return {
170
- name: requirement.name,
171
- type: 'command',
172
- installed: true,
173
- version: updatedStatus.version || requirement.version,
174
- inProgress: false
175
- };
176
- };
177
- if (recorder) {
178
- return recorder.recording(doInstall, {
179
- stepName: RecordingConstants.STEP_COMMAND_INSTALLER_INSTALL,
180
- inProgressMessage: `Installing command: ${requirement.name}`,
181
- endMessage: (result) => result.installed
182
- ? `Install completed for ${requirement.name}`
183
- : `Install failed for ${requirement.name}`,
184
- onError: (error) => {
185
- return {
186
- result: {
187
- name: requirement.name,
188
- type: 'command',
189
- installed: false,
190
- error: error instanceof Error ? error.message : String(error),
191
- inProgress: false,
192
- },
193
- message: error instanceof Error ? error.message : String(error),
194
- };
195
- },
196
- });
197
- }
198
- else {
199
- try {
200
- return await doInstall();
201
- }
202
- catch (error) {
203
- return {
204
- name: requirement.name,
205
- type: 'command',
206
- installed: false,
207
- error: error instanceof Error ? error.message : String(error),
208
- inProgress: false,
209
- };
210
- }
211
- }
212
- }
213
- }
1
+ import{OSType}from"../../metadatas/types.js";import{BaseInstaller}from"./BaseInstaller.js";import{getOSType,refreshPathEnv}from"../../../utils/osUtils.js";import{Logger}from"../../../utils/logger.js";import*as RecordingConstants from"../../metadatas/recordingConstants.js";export class CommandInstaller extends BaseInstaller{getLatestVersion(e,r){throw new Error("Method not implemented.")}commandMappings={uv:{windows:"astral-sh.uv",macos:"uv"}};canHandle(e){return"command"===e.type}supportCheckUpdates(){return!1}getMappedPackageId(e){const r=getOSType(),t=this.commandMappings[e];return t?r===OSType.Windows?t.windows:t.macos:e}async checkInstallation(e){try{await refreshPathEnv();const r=e.alias||e.name;let t;if(getOSType()===OSType.Windows)try{t=await this.execPromise(`where ${r} 2>nul`)}catch(e){Logger.debug(`Error checking command existence: ${e}`),t={stdout:"",stderr:""}}else try{t=await this.execPromise(`which ${r} 2>/dev/null`)}catch(e){Logger.debug(`Error checking command existence: ${e}`),t={stdout:"",stderr:""}}const n=t.stdout.trim().length>0;let s;if(n)try{const e=await this.execPromise(`${r} --version`);if(e.stdout){const r=e.stdout.match(/\d+\.\d+(\.\d+)?/);s=r?r[0]:void 0}}catch(e){Logger.debug(`Error checking command version: ${e}`)}return{name:e.name,type:"command",installed:n,version:s,inProgress:!1}}catch(r){return Logger.error(`Error checking installation: ${r}`),{name:e.name,type:"command",installed:!1,error:r instanceof Error?r.message:String(r),inProgress:!1}}}async install(e,r,t){const n=async()=>{const t=await this.checkInstallation(e);if(t.installed)return t;const n=this.getMappedPackageId(e.name),s=getOSType();let a;if(s===OSType.Windows)a=`winget install --id ${n}`,e.version&&"latest"!==e.version&&(a+=` --version ${e.version}`);else{if(s!==OSType.MacOS)throw r&&await r.recordStep("CommandInstaller:UnsupportedOS","failed",`Unsupported OS for ${e.name}`),new Error(`Unsupported operating system for installing ${e.name}`);a=`brew install ${n}`,e.version&&"latest"!==e.version&&(a+=`@${e.version}`)}const{stderr:o}=await this.execPromise(a);if(o&&o.toLowerCase().includes("error"))throw new Error(o);const i=await this.checkInstallation(e);if(!i.installed)throw new Error(`Failed to install ${e.name}`);return{name:e.name,type:"command",installed:!0,version:i.version||e.version,inProgress:!1}};if(r)return r.recording(n,{stepName:RecordingConstants.STEP_COMMAND_INSTALLER_INSTALL,inProgressMessage:`Installing command: ${e.name}`,endMessage:r=>r.installed?`Install completed for ${e.name}`:`Install failed for ${e.name}`,onError:r=>({result:{name:e.name,type:"command",installed:!1,error:r instanceof Error?r.message:String(r),inProgress:!1},message:r instanceof Error?r.message:String(r)})});try{return await n()}catch(r){return{name:e.name,type:"command",installed:!1,error:r instanceof Error?r.message:String(r),inProgress:!1}}}}
214
2
  //# sourceMappingURL=CommandInstaller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["OSType","BaseInstaller","getOSType","refreshPathEnv","Logger","RecordingConstants","CommandInstaller","getLatestVersion","requirement","options","Error","commandMappings","uv","windows","macos","canHandle","type","supportCheckUpdates","getMappedPackageId","commandName","osType","mapping","this","Windows","checkInstallation","alias","name","commandResult","execPromise","error","debug","stdout","stderr","installed","trim","length","version","versionResult","versionMatch","match","undefined","inProgress","message","String","install","recorder","doInstall","async","status","packageId","installCommand","MacOS","recordStep","toLowerCase","includes","updatedStatus","recording","stepName","STEP_COMMAND_INSTALLER_INSTALL","inProgressMessage","endMessage","result","onError"],"sources":["../../../../src/core/installers/requirements/CommandInstaller.ts"],"mappings":"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","ignoreList":[]}