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,564 +0,0 @@
1
- import { GetBrowserPath } from '../../utils/osUtils.js';
2
- import { ConfigurationProvider } from '../ConfigurationProvider.js';
3
- import { SUPPORTED_CLIENTS } from '../constants.js';
4
- import { resolveNpmModulePath, readJsonFile, writeJsonFile } from '../../utils/clientUtils.js';
5
- import { exec } from 'child_process';
6
- import { promisify } from 'util';
7
- import { Logger } from '../../utils/logger.js';
8
- import { getPythonPackagePath, getSystemPythonPackageDirectory } from '../../utils/osUtils.js';
9
- const execAsync = promisify(exec); // Moved promisify here for reuse
10
- export class ClientInstaller {
11
- categoryName;
12
- serverName;
13
- clients;
14
- configProvider;
15
- operationStatuses;
16
- constructor(categoryName, serverName, clients) {
17
- this.categoryName = categoryName;
18
- this.serverName = serverName;
19
- this.clients = clients;
20
- this.configProvider = ConfigurationProvider.getInstance();
21
- this.operationStatuses = new Map();
22
- }
23
- generateOperationId() {
24
- return `install-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
25
- }
26
- async getNpmPath() {
27
- try {
28
- // Execute the get-command npm command to find the npm path
29
- const { stdout } = await execAsync('powershell -Command "get-command npm | Select-Object -ExpandProperty Source"');
30
- // Extract the directory from the full path (removing npm.cmd)
31
- const npmPath = stdout.trim().replace(/\\npm\.cmd$/, '');
32
- return npmPath;
33
- }
34
- catch (error) {
35
- console.error('Error getting npm path:', error);
36
- // Return a default path if the command fails
37
- return 'C:\\Program Files\\nodejs';
38
- }
39
- }
40
- /**
41
- * Check if a command is available on the system
42
- * @param command The command to check
43
- * @returns True if the command is available, false otherwise
44
- */
45
- async isCommandAvailable(command) {
46
- try {
47
- if (process.platform === 'win32') {
48
- // Windows-specific command check
49
- await execAsync(`where ${command}`);
50
- }
51
- else if (process.platform === 'darwin' && (command === 'code' || command === 'code-insiders')) {
52
- // macOS-specific VS Code check
53
- const vscodePath = command === 'code' ?
54
- '/Applications/Visual Studio Code.app' :
55
- '/Applications/Visual Studio Code - Insiders.app';
56
- await execAsync(`test -d "${vscodePath}"`);
57
- }
58
- else {
59
- // Unix-like systems
60
- await execAsync(`which ${command}`);
61
- }
62
- return true;
63
- }
64
- catch (error) {
65
- if (process.platform === 'darwin' && (command === 'code' || command === 'code-insiders')) {
66
- // Try checking in ~/Applications as well for macOS
67
- try {
68
- const homedir = process.env.HOME;
69
- const vscodePath = command === 'code' ?
70
- `${homedir}/Applications/Visual Studio Code.app` :
71
- `${homedir}/Applications/Visual Studio Code - Insiders.app`;
72
- await execAsync(`test -d "${vscodePath}"`);
73
- return true;
74
- }
75
- catch (error) {
76
- return false;
77
- }
78
- }
79
- return false;
80
- }
81
- }
82
- // Modified to accept ServerInstallOptions
83
- async installClient(clientName, options) {
84
- // Check if client is supported
85
- if (!SUPPORTED_CLIENTS[clientName]) {
86
- return {
87
- status: 'failed',
88
- type: 'install',
89
- target: 'server',
90
- message: `Unsupported client: ${clientName}`,
91
- operationId: this.generateOperationId()
92
- };
93
- }
94
- // Create initial operation status
95
- const operationId = this.generateOperationId();
96
- const initialStatus = {
97
- status: 'pending',
98
- type: 'install',
99
- target: 'server',
100
- message: `Initializing installation for client: ${clientName}`,
101
- operationId: operationId
102
- };
103
- // Update server status with initial client installation status
104
- await this.configProvider.updateServerOperationStatus(this.categoryName, this.serverName, clientName, initialStatus);
105
- // Start the asynchronous installation process without awaiting it
106
- // Pass options down
107
- this.processInstallation(clientName, operationId, options);
108
- // Return the initial status immediately
109
- return initialStatus;
110
- }
111
- // Modified to accept ServerInstallOptions
112
- async processInstallation(clientName, operationId, options) {
113
- try {
114
- // Check requirements before installation
115
- let requirementsReady = await this.configProvider.isRequirementsReady(this.categoryName, this.serverName);
116
- // If requirements are not ready, periodically check with timeout
117
- if (!requirementsReady) {
118
- const pendingStatus = {
119
- status: 'pending',
120
- type: 'install',
121
- target: 'server',
122
- message: `Waiting for requirements to be ready for client: ${clientName}`,
123
- operationId: operationId
124
- };
125
- // Update status to pending with reference to configProvider
126
- await this.configProvider.updateServerOperationStatus(this.categoryName, this.serverName, clientName, pendingStatus);
127
- // Set up periodic checking with timeout
128
- const startTime = Date.now();
129
- const timeoutMs = 5 * 60 * 1000; // 5 minutes in milliseconds
130
- const intervalMs = 5 * 1000; // 5 seconds in milliseconds
131
- while (!requirementsReady && (Date.now() - startTime) < timeoutMs) {
132
- // Wait for the interval
133
- await new Promise(resolve => setTimeout(resolve, intervalMs));
134
- // Check again
135
- requirementsReady = await this.configProvider.isRequirementsReady(this.categoryName, this.serverName);
136
- }
137
- // If still not ready after timeout, update status as failed and exit
138
- if (!requirementsReady) {
139
- const failedStatus = {
140
- status: 'failed',
141
- type: 'install',
142
- target: 'server',
143
- message: `Timed out waiting for requirements to be ready for client: ${clientName} after 5 minutes`,
144
- operationId: operationId
145
- };
146
- await this.configProvider.updateServerOperationStatus(this.categoryName, this.serverName, clientName, failedStatus);
147
- return; // Exit the installation process
148
- }
149
- }
150
- // If we've reached here, requirements are ready - update status to in-progress
151
- const inProgressStatus = {
152
- status: 'in-progress',
153
- type: 'install',
154
- target: 'server',
155
- message: `Installing client: ${clientName}`,
156
- operationId: operationId
157
- };
158
- await this.configProvider.updateServerOperationStatus(this.categoryName, this.serverName, clientName, inProgressStatus);
159
- // Get feed configuration for the server
160
- const feedConfiguration = await this.configProvider.getFeedConfiguration(this.categoryName);
161
- if (!feedConfiguration) {
162
- const errorStatus = {
163
- status: 'failed',
164
- type: 'install',
165
- target: 'server',
166
- message: `Failed to get feed configuration for category: ${this.categoryName}`,
167
- operationId: operationId
168
- };
169
- await this.configProvider.updateServerOperationStatus(this.categoryName, this.serverName, clientName, errorStatus);
170
- return;
171
- }
172
- // Find the server config in the feed configuration
173
- const serverConfig = feedConfiguration.mcpServers.find(s => s.name === this.serverName);
174
- if (!serverConfig) {
175
- const errorStatus = {
176
- status: 'failed',
177
- type: 'install',
178
- target: 'server',
179
- message: `Server ${this.serverName} not found in feed configuration`,
180
- operationId: operationId
181
- };
182
- await this.configProvider.updateServerOperationStatus(this.categoryName, this.serverName, clientName, errorStatus);
183
- return;
184
- }
185
- try {
186
- // Install client-specific configuration, passing options down
187
- const result = await this.installClientConfig(clientName, options, serverConfig, feedConfiguration);
188
- const finalStatus = {
189
- status: result.success ? 'completed' : 'failed',
190
- type: 'install',
191
- target: 'server',
192
- message: result.message || `Installation for client ${clientName}: ${result.success ? 'successful' : 'failed'}`,
193
- operationId: operationId,
194
- error: result.success ? undefined : result.message
195
- };
196
- await this.configProvider.updateServerOperationStatus(this.categoryName, this.serverName, clientName, finalStatus);
197
- if (result.success) {
198
- await this.configProvider.reloadClientMCPSettings();
199
- }
200
- }
201
- catch (error) {
202
- const errorStatus = {
203
- status: 'failed',
204
- type: 'install',
205
- target: 'server',
206
- message: `Failed to install client: ${clientName}. Error: ${error instanceof Error ? error.message : String(error)}`,
207
- operationId: operationId,
208
- error: error instanceof Error ? error.message : String(error)
209
- };
210
- await this.configProvider.updateServerOperationStatus(this.categoryName, this.serverName, clientName, errorStatus);
211
- }
212
- }
213
- catch (error) {
214
- const errorStatus = {
215
- status: 'failed',
216
- type: 'install',
217
- target: 'server',
218
- message: `Unexpected error in installation process for client: ${clientName}. Error: ${error instanceof Error ? error.message : String(error)}`,
219
- operationId: operationId,
220
- error: error instanceof Error ? error.message : String(error)
221
- };
222
- await this.configProvider.updateServerOperationStatus(this.categoryName, this.serverName, clientName, errorStatus);
223
- }
224
- }
225
- // Modified to accept ServerInstallOptions
226
- async installClientConfig(clientName, options, // Use options directly
227
- serverConfig, feedConfig) {
228
- try {
229
- if (!SUPPORTED_CLIENTS[clientName]) {
230
- Logger.debug(`Client ${clientName} is not supported.`);
231
- return { success: false, message: `Unsupported client: ${clientName}` };
232
- }
233
- const clientSettings = SUPPORTED_CLIENTS[clientName];
234
- // Get both setting paths for VS Code and VS Code Insiders
235
- const regularSettingPath = clientSettings.codeSettingPath;
236
- const insidersSettingPath = clientSettings.codeInsiderSettingPath;
237
- Logger.debug(`Starting installation of ${this.serverName} for client ${clientName}`);
238
- Logger.debug(`VS Code settings path configured as: ${regularSettingPath}`);
239
- Logger.debug(`VS Code Insiders settings path configured as: ${insidersSettingPath}`);
240
- // Check if VS Code and VS Code Insiders are installed
241
- const isVSCodeInstalled = await this.isCommandAvailable('code');
242
- const isVSCodeInsidersInstalled = await this.isCommandAvailable('code-insiders');
243
- Logger.debug(isVSCodeInstalled ? 'VS Code detected on system' : 'VS Code not detected on system');
244
- Logger.debug(isVSCodeInsidersInstalled ? 'VS Code Insiders detected on system' : 'VS Code Insiders not detected on system');
245
- // If neither is installed, we can't proceed
246
- if (!isVSCodeInstalled && !isVSCodeInsidersInstalled) {
247
- Logger.debug('No VS Code installations detected on system. Cannot update settings.');
248
- return {
249
- success: false,
250
- message: `Neither VS Code nor VS Code Insiders are installed on this system. Cannot update settings for client: ${clientName}. Please install VS Code or VS Code Insiders and try again.`
251
- };
252
- }
253
- // --- Start of new logic ---
254
- // Clone the base installation configuration to avoid modifying the original serverConfig
255
- const installConfig = JSON.parse(JSON.stringify(serverConfig.installation));
256
- const pythonEnv = options.settings?.pythonEnv;
257
- let pythonDir = null;
258
- // 1. Determine which args to use and resolve npm paths
259
- let finalArgs = [];
260
- if (options.args && options.args.length > 0) {
261
- Logger.debug(`Using args from ServerInstallOptions: ${options.args.join(' ')}`);
262
- finalArgs = options.args.map(arg => resolveNpmModulePath(arg));
263
- }
264
- else if (installConfig.args && installConfig.args.length > 0) {
265
- Logger.debug(`Using args from serverConfig.installation: ${installConfig.args.join(' ')}`);
266
- finalArgs = installConfig.args.map((arg) => resolveNpmModulePath(arg));
267
- }
268
- else {
269
- Logger.debug('No args found in options or serverConfig.installation.');
270
- finalArgs = [];
271
- }
272
- // 2. Handle pythonEnv settings
273
- if (pythonEnv) {
274
- // 2.1 If pythonEnv is set
275
- Logger.debug(`Python environment specified: ${pythonEnv}`);
276
- pythonDir = getPythonPackagePath(pythonEnv);
277
- // 2.1.1 Replace ${PYTHON_PACKAGE} in args
278
- if (pythonDir) {
279
- finalArgs = finalArgs.map(arg => arg.includes('${PYTHON_PACKAGE}') ? arg.replace('${PYTHON_PACKAGE}', pythonDir) : arg);
280
- Logger.debug(`Args after PYTHON_PACKAGE replacement (using pythonEnv): ${finalArgs.join(' ')}`);
281
- }
282
- else {
283
- Logger.debug(`Could not determine directory for pythonEnv: ${pythonEnv}`);
284
- }
285
- // 2.1.2 Replace command if it's 'python'
286
- if (installConfig.command === 'python') {
287
- Logger.debug(`Replacing command 'python' with specified pythonEnv: ${pythonEnv}`);
288
- installConfig.command = pythonEnv;
289
- }
290
- }
291
- else {
292
- // 2.2 If pythonEnv is not set
293
- Logger.debug('No Python environment specified in settings.');
294
- // 2.2.1 Replace ${PYTHON_PACKAGE} with system python directory if needed
295
- if (finalArgs.some(arg => arg.includes('${PYTHON_PACKAGE}'))) {
296
- Logger.debug('Attempting to find system Python directory for ${PYTHON_PACKAGE} replacement.');
297
- pythonDir = await getSystemPythonPackageDirectory();
298
- if (pythonDir) {
299
- finalArgs = finalArgs.map(arg => arg.includes('${PYTHON_PACKAGE}') ? arg.replace('${PYTHON_PACKAGE}', pythonDir) : arg);
300
- Logger.debug(`Args after PYTHON_PACKAGE replacement (using system python): ${finalArgs.join(' ')}`);
301
- }
302
- else {
303
- Logger.debug('Could not find system Python directory. ${PYTHON_PACKAGE} replacement skipped.');
304
- // Optionally, remove or handle the arg containing ${PYTHON_PACKAGE} if Python is required
305
- // finalArgs = finalArgs.filter(arg => !arg.includes('${PYTHON_PACKAGE}'));
306
- }
307
- }
308
- }
309
- // Update installConfig with potentially modified args
310
- installConfig.args = finalArgs;
311
- // 3. Handle environment variables (merge default, serverConfig, and options.env)
312
- const baseEnv = serverConfig.installation.env || {};
313
- const defaultEnv = {};
314
- for (const [key, config] of Object.entries(baseEnv)) {
315
- const envConfig = config; // Type assertion
316
- if (envConfig.Default) {
317
- defaultEnv[key] = envConfig.Default;
318
- }
319
- }
320
- // Merge: options.env overrides defaultEnv
321
- installConfig.env = { ...defaultEnv, ...(options.env || {}) };
322
- // Replace ${BROWSER_PATH} with actual browser path
323
- const replacements = Object.entries(installConfig.env)
324
- .filter(([_, value]) => typeof value === 'string' && value.includes('${BROWSER_PATH}'))
325
- .map(async ([key, value]) => {
326
- try {
327
- const browserPath = await GetBrowserPath();
328
- return [key, value.replace('${BROWSER_PATH}', browserPath)];
329
- }
330
- catch (error) {
331
- Logger.error(`Failed to get system browser path for env var ${key}:`, error);
332
- return [key, value];
333
- }
334
- });
335
- // Wait for all replacements to complete
336
- const replacedValues = await Promise.all(replacements);
337
- replacedValues.forEach(([key, value]) => {
338
- installConfig.env[key] = value;
339
- });
340
- Logger.debug(`Final environment variables: ${JSON.stringify(installConfig.env)}`);
341
- // --- End of new logic ---
342
- // Keep track of success for both installations
343
- let regularSuccess = false;
344
- let insidersSuccess = false;
345
- let errorMessages = [];
346
- // Update client-specific settings for both VS Code and VS Code Insiders
347
- if (clientName === 'MSRooCode' || clientName === 'Cline') {
348
- // Update VS Code settings if VS Code is installed
349
- if (isVSCodeInstalled) {
350
- try {
351
- Logger.debug(`Updating VS Code settings for ${clientName} at path: ${regularSettingPath}`);
352
- // Pass the modified installConfig
353
- await this.updateClineOrMSRooSettings(regularSettingPath, this.serverName, installConfig, clientName);
354
- regularSuccess = true;
355
- Logger.debug(`Settings successfully updated to ${regularSettingPath} for ${clientName} (VS Code)`);
356
- }
357
- catch (error) {
358
- const errorMsg = `Error updating VS Code settings: ${error instanceof Error ? error.message : String(error)}`;
359
- errorMessages.push(errorMsg);
360
- console.error(errorMsg);
361
- }
362
- }
363
- // Update VS Code Insiders settings if VS Code Insiders is installed
364
- if (isVSCodeInsidersInstalled) {
365
- try {
366
- Logger.debug(`Updating VS Code Insiders settings for ${clientName} at path: ${insidersSettingPath}`);
367
- // Pass the modified installConfig
368
- await this.updateClineOrMSRooSettings(insidersSettingPath, this.serverName, installConfig, clientName);
369
- insidersSuccess = true;
370
- Logger.debug(`Settings successfully updated to ${insidersSettingPath} for ${clientName} (VS Code Insiders)`);
371
- }
372
- catch (error) {
373
- const errorMsg = `Error updating VS Code Insiders settings: ${error instanceof Error ? error.message : String(error)}`;
374
- errorMessages.push(errorMsg);
375
- console.error(errorMsg);
376
- }
377
- }
378
- }
379
- else if (clientName === 'GithubCopilot') {
380
- // Update VS Code settings if VS Code is installed
381
- if (isVSCodeInstalled) {
382
- try {
383
- Logger.debug(`Updating VS Code settings for ${clientName} at path: ${regularSettingPath}`);
384
- // Pass the modified installConfig
385
- await this.updateGithubCopilotSettings(regularSettingPath, this.serverName, installConfig);
386
- regularSuccess = true;
387
- Logger.debug(`Settings successfully updated to ${regularSettingPath} for ${clientName} (VS Code)`);
388
- }
389
- catch (error) {
390
- const errorMsg = `Error updating VS Code settings: ${error instanceof Error ? error.message : String(error)}`;
391
- errorMessages.push(errorMsg);
392
- console.error(errorMsg);
393
- }
394
- }
395
- // Update VS Code Insiders settings if VS Code Insiders is installed
396
- if (isVSCodeInsidersInstalled) {
397
- try {
398
- Logger.debug(`Updating VS Code Insiders settings for ${clientName} at path: ${insidersSettingPath}`);
399
- // Pass the modified installConfig
400
- await this.updateGithubCopilotSettings(insidersSettingPath, this.serverName, installConfig);
401
- insidersSuccess = true;
402
- Logger.debug(`Settings successfully updated to ${insidersSettingPath} for ${clientName} (VS Code Insiders)`);
403
- }
404
- catch (error) {
405
- const errorMsg = `Error updating VS Code Insiders settings: ${error instanceof Error ? error.message : String(error)}`;
406
- errorMessages.push(errorMsg);
407
- console.error(errorMsg);
408
- }
409
- }
410
- }
411
- else {
412
- Logger.debug(`No implementation exists for updating settings for client: ${clientName}`);
413
- return {
414
- success: false,
415
- message: `Client ${clientName} is supported but no implementation exists for updating its settings`
416
- };
417
- }
418
- // Determine overall success status and message
419
- const overallSuccess = regularSuccess || insidersSuccess;
420
- let message = '';
421
- if (overallSuccess) {
422
- const successDetails = [];
423
- if (regularSuccess)
424
- successDetails.push('VS Code');
425
- if (insidersSuccess)
426
- successDetails.push('VS Code Insiders');
427
- // Create a more compact success message with specific paths
428
- const pathDetails = [];
429
- if (regularSuccess) {
430
- pathDetails.push(`\n[VS Code]: ${regularSettingPath}`);
431
- }
432
- if (insidersSuccess) {
433
- pathDetails.push(`\n[VS Code Insiders]: ${insidersSettingPath}`);
434
- }
435
- message = `Successfully installed ${this.serverName} for client: ${clientName}. ${pathDetails.join(' ')}`;
436
- // Add partial failure information if applicable
437
- if (errorMessages.length > 0) {
438
- message += `\nHowever, some errors occurred:\n${errorMessages.join('\n- ')}`;
439
- }
440
- Logger.debug(`Installation complete: ${message}`);
441
- }
442
- else {
443
- // Create a more detailed failure message that includes the detection results
444
- const detectionInfo = [];
445
- if (!isVSCodeInstalled)
446
- detectionInfo.push('VS Code not detected');
447
- if (!isVSCodeInsidersInstalled)
448
- detectionInfo.push('VS Code Insiders not detected');
449
- if (errorMessages.length > 0) {
450
- message = `Failed to install ${this.serverName} for client: ${clientName}.\nDetection status: [${detectionInfo.join(', ')}].\nErrors:\n- ${errorMessages.join('\n- ')}`;
451
- }
452
- else {
453
- message = `Failed to install ${this.serverName} for client: ${clientName}.\nDetection status: [${detectionInfo.join(', ')}]`;
454
- }
455
- console.error(`Installation failed: ${message}`);
456
- }
457
- return {
458
- success: overallSuccess,
459
- message: message
460
- };
461
- }
462
- catch (error) {
463
- const errorMsg = `Error installing client ${clientName}: ${error instanceof Error ? error.message : String(error)}`;
464
- console.error(errorMsg);
465
- return {
466
- success: false,
467
- message: errorMsg
468
- };
469
- }
470
- }
471
- async updateClineOrMSRooSettings(settingPath, serverName, installConfig, // Use the processed installConfig
472
- clientName) {
473
- // Read the Cline/MSRoo settings file
474
- const settings = await readJsonFile(settingPath, true);
475
- // Initialize mcpServers section if it doesn't exist
476
- if (!settings.mcpServers) {
477
- settings.mcpServers = {};
478
- }
479
- // Special handling for Windows when command is npx for Cline and MSROO clients
480
- // Use a copy to avoid modifying the passed installConfig directly if needed elsewhere
481
- const serverConfigForClient = { ...installConfig };
482
- if (process.platform === 'win32' &&
483
- serverConfigForClient.command === 'npx' &&
484
- (clientName === 'Cline' || clientName === 'MSRooCode' || clientName === 'MSROO')) {
485
- // Update command to cmd
486
- serverConfigForClient.command = 'cmd';
487
- // Add /c and npx at the beginning of args
488
- serverConfigForClient.args = ['/c', 'npx', ...serverConfigForClient.args];
489
- // Add APPDATA environment variable pointing to npm directory
490
- if (!serverConfigForClient.env) {
491
- serverConfigForClient.env = {};
492
- }
493
- // Dynamically get npm path and set APPDATA to it
494
- const npmPath = await this.getNpmPath();
495
- serverConfigForClient.env['APPDATA'] = npmPath;
496
- Logger.debug(`Windows npx fix: command=${serverConfigForClient.command}, args=${serverConfigForClient.args.join(' ')}, env=${JSON.stringify(serverConfigForClient.env)}`);
497
- }
498
- // Convert backslashes to forward slashes in args paths
499
- if (serverConfigForClient.args) {
500
- serverConfigForClient.args = serverConfigForClient.args.map((arg) => typeof arg === 'string' ? arg.replace(/\\/g, '/') : arg);
501
- }
502
- // Add or update the server configuration
503
- settings.mcpServers[serverName] = {
504
- command: serverConfigForClient.command,
505
- args: serverConfigForClient.args,
506
- env: serverConfigForClient.env,
507
- autoApprove: [],
508
- disabled: false,
509
- alwaysAllow: []
510
- };
511
- Logger.debug(`Updating ${settingPath} for ${serverName}: ${JSON.stringify(settings.mcpServers[serverName])}`);
512
- // Write the updated settings back to the file
513
- await writeJsonFile(settingPath, settings);
514
- }
515
- async updateGithubCopilotSettings(settingPath, serverName, installConfig // Use the processed installConfig
516
- ) {
517
- // Read the VS Code settings.json file
518
- const settings = await readJsonFile(settingPath, true);
519
- // Initialize the mcp section if it doesn't exist
520
- if (!settings.mcp) {
521
- settings.mcp = {
522
- servers: {},
523
- inputs: []
524
- };
525
- }
526
- if (!settings.mcp.servers) {
527
- settings.mcp.servers = {};
528
- }
529
- // Use a copy to avoid modifying the passed installConfig directly
530
- const serverConfigForClient = { ...installConfig };
531
- // Convert backslashes to forward slashes in args paths
532
- if (serverConfigForClient.args) {
533
- serverConfigForClient.args = serverConfigForClient.args.map((arg) => typeof arg === 'string' ? arg.replace(/\\/g, '/') : arg);
534
- }
535
- // Add or update the server configuration
536
- settings.mcp.servers[serverName] = {
537
- command: serverConfigForClient.command,
538
- args: serverConfigForClient.args,
539
- env: serverConfigForClient.env
540
- };
541
- Logger.debug(`Updating ${settingPath} for ${serverName}: ${JSON.stringify(settings.mcp.servers[serverName])}`);
542
- // Write the updated settings back to the file
543
- await writeJsonFile(settingPath, settings);
544
- }
545
- async install(options) {
546
- const initialStatuses = [];
547
- // Start installation for each client asynchronously and collect initial statuses
548
- // Pass options down to installClient
549
- const installPromises = this.clients.map(async (clientName) => {
550
- const initialStatus = await this.installClient(clientName, options);
551
- initialStatuses.push(initialStatus);
552
- return initialStatus;
553
- });
554
- // Wait for all initial statuses (but actual installation continues asynchronously)
555
- await Promise.all(installPromises);
556
- // Return initial result showing installations have been initiated
557
- return {
558
- success: true,
559
- message: 'Client installations initiated successfully',
560
- status: initialStatuses
561
- };
562
- }
563
- }
564
- //# sourceMappingURL=ClientInstaller.js.map
@@ -1,37 +0,0 @@
1
- import { RequirementConfig, RequirementStatus } from '../types.js';
2
- import { BaseInstaller } from './BaseInstaller.js';
3
- /**
4
- * Installer implementation for command-line tools
5
- */
6
- export declare class CommandInstaller extends BaseInstaller {
7
- /**
8
- * Mapping of command names to their package IDs
9
- * This handles special cases where the command name differs from the package ID
10
- */
11
- private commandMappings;
12
- /**
13
- * Check if this installer can handle the given requirement type
14
- * @param requirement The requirement to check
15
- * @returns True if this installer can handle the requirement
16
- */
17
- canHandle(requirement: RequirementConfig): boolean;
18
- supportCheckUpdates(): boolean;
19
- /**
20
- * Get the mapped package ID for a command
21
- * @param commandName The command name to map
22
- * @returns The mapped package ID
23
- */
24
- private getMappedPackageId;
25
- /**
26
- * Check if the command is already installed
27
- * @param requirement The requirement to check
28
- * @returns The status of the requirement
29
- */
30
- checkInstallation(requirement: RequirementConfig): Promise<RequirementStatus>;
31
- /**
32
- * Install the command
33
- * @param requirement The requirement to install
34
- * @returns The status of the installation
35
- */
36
- install(requirement: RequirementConfig): Promise<RequirementStatus>;
37
- }