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,278 +0,0 @@
1
- import fs from 'fs/promises';
2
- import path from 'path';
3
- import { SETTINGS_DIR } from '../metadatas/constants.js';
4
- import { SystemSettings } from '../metadatas/types.js';
5
- import { Logger } from '../../utils/logger.js';
6
- import { getSystemPythonExecutablePath, getNpmExecutablePath, getBrowserPath } from '../../utils/osUtils.js';
7
-
8
- const SETTINGS_FILE_NAME = 'system_settings.json';
9
- const SETTINGS_FILE_PATH = path.join(SETTINGS_DIR, 'settings', SETTINGS_FILE_NAME);
10
-
11
- export class SystemSettingsManager {
12
- private static instance: SystemSettingsManager;
13
- private settings: SystemSettings;
14
- private settingsFilePath: string;
15
- private settingsLock: Promise<void> = Promise.resolve();
16
-
17
- private constructor() {
18
- this.settingsFilePath = SETTINGS_FILE_PATH;
19
- this.settings = {};
20
- // No await here, initialization is best-effort. Lock will protect subsequent calls.
21
- this.loadSettings().catch(error => {
22
- Logger.error('Failed to initialize SystemSettingsManager during construction:', error);
23
- // Initialize with empty settings if load fails, defaults will be applied on first access
24
- this.settings = {};
25
- });
26
- }
27
-
28
- public static getInstance(): SystemSettingsManager {
29
- if (!SystemSettingsManager.instance) {
30
- SystemSettingsManager.instance = new SystemSettingsManager();
31
- }
32
- return SystemSettingsManager.instance;
33
- }
34
-
35
- private async withLock<T>(operation: () => Promise<T>): Promise<T> {
36
- const currentLock = this.settingsLock;
37
- let releaseLock: () => void;
38
- this.settingsLock = new Promise<void>(resolve => releaseLock = resolve);
39
- try {
40
- await currentLock;
41
- return await operation();
42
- } finally {
43
- releaseLock!();
44
- }
45
- }
46
-
47
- // Internal method without lock
48
- private async _loadSettingsInternal(): Promise<void> {
49
- try {
50
- await fs.mkdir(path.dirname(this.settingsFilePath), { recursive: true });
51
- const data = await fs.readFile(this.settingsFilePath, 'utf-8');
52
- this.settings = JSON.parse(data);
53
- await this._applyDefaultsIfNeededInternal(); // Call internal version
54
- } catch (error) {
55
- if ((error as NodeJS.ErrnoException).code === 'ENOENT') {
56
- Logger.info(`Settings file not found at ${this.settingsFilePath}. Initializing with defaults.`);
57
- this.settings = {};
58
- await this._applyDefaultsIfNeededInternal(); // Call internal version
59
- } else {
60
- Logger.error(`Error loading settings from ${this.settingsFilePath}:`, error);
61
- this.settings = {};
62
- await this._applyDefaultsIfNeededInternal(); // Call internal version
63
- }
64
- }
65
- }
66
-
67
- /**
68
- * Loads settings from the file. This operation is atomic.
69
- * If the settings file doesn't exist, it initializes with defaults and creates the file.
70
- * @returns A promise that resolves when settings are loaded.
71
- */
72
- public async loadSettings(): Promise<void> {
73
- return this.withLock(() => this._loadSettingsInternal());
74
- }
75
-
76
- // Internal method without lock
77
- private async _applyDefaultsIfNeededInternal(): Promise<void> {
78
- let updated = false;
79
- const normalizePath = (p?: string) => p ? p.replace(/\\/g, '/') : undefined;
80
-
81
- if (!this.settings.pythonEnvs) {
82
- this.settings.pythonEnvs = {};
83
- updated = true;
84
- }
85
-
86
- if (!this.settings.pythonEnvs["system"]) {
87
- try {
88
- const pythonPath = normalizePath(await getSystemPythonExecutablePath() || undefined);
89
- if (pythonPath) {
90
- this.settings.pythonEnvs["system"] = pythonPath;
91
- updated = true;
92
- }
93
- } catch (e) {
94
- Logger.warn(`Could not get default pythonEnv: ${e}`);
95
- }
96
- }
97
-
98
- if (!this.settings.nodePath) {
99
- try {
100
- const npmExecDir = await getNpmExecutablePath();
101
- let nodeExecutable = process.platform === 'win32' ? 'node.exe' : 'node';
102
- const platformNodePath = process.platform === 'win32'
103
- ? path.join(npmExecDir || '', nodeExecutable)
104
- : path.join(npmExecDir || '', 'bin', nodeExecutable);
105
- this.settings.nodePath = npmExecDir ? normalizePath(platformNodePath) : undefined;
106
- if (this.settings.nodePath) updated = true;
107
- } catch (e) {
108
- Logger.warn(`Could not get default nodePath: ${e}`);
109
- }
110
- } else {
111
- this.settings.nodePath = normalizePath(this.settings.nodePath);
112
- }
113
-
114
- if (!this.settings.browserPath) {
115
- try {
116
- this.settings.browserPath = normalizePath(await getBrowserPath() || undefined);
117
- if (this.settings.browserPath) updated = true;
118
- } catch (e) {
119
- Logger.warn(`Could not get default browserPath: ${e}`);
120
- }
121
- } else {
122
- this.settings.browserPath = normalizePath(this.settings.browserPath);
123
- }
124
-
125
- if (!this.settings.systemEnvironments) {
126
- this.settings.systemEnvironments = { ...process.env } as Record<string, string>;
127
- updated = true;
128
- }
129
- if (this.settings.userConfigurations === undefined) {
130
- this.settings.userConfigurations = {};
131
- updated = true;
132
- }
133
-
134
- if (updated) {
135
- await this._saveSettingsInternal();
136
- }
137
- }
138
-
139
- /**
140
- * Applies default values to settings if they are not already set.
141
- * This operation is atomic and saves settings if defaults are applied.
142
- * @returns A promise that resolves when defaults are applied and saved if necessary.
143
- */
144
- public async applyDefaultsIfNeeded(): Promise<void> {
145
- return this.withLock(() => this._applyDefaultsIfNeededInternal());
146
- }
147
-
148
- /**
149
- * Retrieves the current system settings.
150
- * If settings haven't been loaded or are empty, it attempts to load them.
151
- * Paths within the settings are normalized (e.g., backslashes to forward slashes).
152
- * @returns A promise that resolves to the `SystemSettings` object.
153
- */
154
- public async getSystemSettings(): Promise<SystemSettings> {
155
- // Ensure settings are loaded if they are empty.
156
- if (Object.keys(this.settings).length === 0) {
157
- // Use the public, locked version of loadSettings here
158
- await this.loadSettings();
159
- }
160
- // Return a deep copy to prevent external modification of the internal state.
161
- // Ensure this.settings is used, not a potentially stale local copy.
162
- const settingsToReturn = JSON.parse(JSON.stringify(this.settings));
163
-
164
- // Ensure paths are normalized when retrieved
165
- const normalizedSettings = { ...settingsToReturn };
166
-
167
- // Normalize paths in pythonEnvs
168
- if (normalizedSettings.pythonEnvs) {
169
- const normalizedPythonEnvs: Record<string, string> = {};
170
- Object.keys(normalizedSettings.pythonEnvs).forEach(key => {
171
- normalizedPythonEnvs[key] = normalizedSettings.pythonEnvs?.[key]?.replace(/\\/g, '/') || '';
172
- });
173
- normalizedSettings.pythonEnvs = normalizedPythonEnvs;
174
- }
175
-
176
- normalizedSettings.nodePath = normalizedSettings.nodePath?.replace(/\\/g, '/');
177
- normalizedSettings.browserPath = normalizedSettings.browserPath?.replace(/\\/g, '/');
178
- return normalizedSettings;
179
- }
180
-
181
- /**
182
- * Creates or updates system settings with the provided partial settings.
183
- * This operation is atomic and protected by a lock.
184
- * It loads existing settings if not already loaded, merges the new settings,
185
- * applies any necessary defaults, and then saves the updated settings.
186
- * @param newSettings A `Partial<SystemSettings>` object containing the settings to update.
187
- * @returns A promise that resolves to the fully updated and normalized `SystemSettings`.
188
- */
189
- public async createOrUpdateSystemSettings(newSettings: Partial<SystemSettings>): Promise<SystemSettings> {
190
- return this.withLock(async () => {
191
- // Ensure current settings are loaded before modification by calling the internal, non-locking version
192
- if (Object.keys(this.settings).length === 0) {
193
- await this._loadSettingsInternal();
194
- }
195
-
196
- const normalizePath = (p?: string) => p ? p.replace(/\\/g, '/') : undefined;
197
-
198
- // Initialize pythonEnvs if it doesn't exist on the current settings
199
- if (!this.settings.pythonEnvs) {
200
- this.settings.pythonEnvs = {};
201
- }
202
-
203
- // Create a new settings object by merging current and new settings.
204
- const updatedSettings: SystemSettings = {
205
- ...this.settings, // Start with current settings
206
- ...newSettings, // Override with new settings
207
- // Explicitly handle potentially undefined paths from newSettings
208
- nodePath: normalizePath(newSettings.nodePath !== undefined ? newSettings.nodePath : this.settings.nodePath),
209
- browserPath: normalizePath(newSettings.browserPath !== undefined ? newSettings.browserPath : this.settings.browserPath),
210
- // Ensure systemEnvironments and userConfigurations are properly merged or taken from newSettings
211
- systemEnvironments: newSettings.systemEnvironments !== undefined
212
- ? newSettings.systemEnvironments
213
- : this.settings.systemEnvironments, // Keep existing if not in newSettings
214
- userConfigurations: newSettings.userConfigurations !== undefined
215
- ? newSettings.userConfigurations
216
- : this.settings.userConfigurations || {}, // Keep existing or default to empty
217
- };
218
-
219
- this.settings = updatedSettings;
220
-
221
- // Call the internal, non-locking version of applyDefaultsIfNeeded
222
- await this._applyDefaultsIfNeededInternal();
223
-
224
- // _applyDefaultsIfNeededInternal will call _saveSettingsInternal if it makes changes.
225
- // However, if newSettings were provided that didn't trigger a change in _applyDefaultsIfNeededInternal
226
- // (e.g., just updating an existing path), we still need to save.
227
- // So, always call _saveSettingsInternal to persist all merged changes.
228
- await this._saveSettingsInternal();
229
-
230
- Logger.info('System settings updated.');
231
- // getSystemSettings will handle its own locking if it needs to load.
232
- return this.getSystemSettings();
233
- });
234
- }
235
-
236
- /**
237
- * Internal method to save settings to the file without acquiring a lock.
238
- * Assumes the lock is already held by the calling public method.
239
- * Normalizes paths before saving.
240
- * @returns A promise that resolves when settings are written to disk.
241
- */
242
- private async _saveSettingsInternal(): Promise<void> {
243
- try {
244
- // Normalize paths before saving
245
- const settingsToSave = { ...this.settings };
246
- settingsToSave.nodePath = settingsToSave.nodePath?.replace(/\\/g, '/');
247
- settingsToSave.browserPath = settingsToSave.browserPath?.replace(/\\/g, '/');
248
-
249
- if (settingsToSave.pythonEnvs) {
250
- const normalizedPythonEnvs: Record<string, string> = {};
251
- Object.keys(settingsToSave.pythonEnvs).forEach(key => {
252
- normalizedPythonEnvs[key] = settingsToSave.pythonEnvs?.[key]?.replace(/\\/g, '/') || '';
253
- });
254
- settingsToSave.pythonEnvs = normalizedPythonEnvs;
255
- }
256
-
257
- await fs.mkdir(path.dirname(this.settingsFilePath), { recursive: true });
258
- await fs.writeFile(this.settingsFilePath, JSON.stringify(settingsToSave, null, 2));
259
- Logger.info(`System settings saved to ${this.settingsFilePath}`);
260
- } catch (error) {
261
- Logger.error(`Error saving settings to ${this.settingsFilePath}:`, error);
262
- throw error; // Re-throw to indicate failure
263
- }
264
- }
265
-
266
- /**
267
- * Saves the current settings to the file. This operation is atomic and protected by a lock.
268
- * Paths are normalized before saving.
269
- * @returns A promise that resolves when the settings are saved.
270
- */
271
- public async saveSettings(): Promise<void> {
272
- await this.withLock(async () => {
273
- await this._saveSettingsInternal();
274
- });
275
- }
276
- }
277
-
278
- export const systemSettingsManager = SystemSettingsManager.getInstance();
@@ -1,122 +0,0 @@
1
- import os from 'os';
2
- import path from 'path';
3
-
4
- /**
5
- * Defines constants used across the application.
6
- */
7
-
8
- /**
9
- * GitHub repository configuration for feeds
10
- */
11
- export const GITHUB_REPO = {
12
- url: 'https://github.com/ai-microsoft/imcp-feed.git',
13
- repoName: 'ai-microsoft/imcp-feed',
14
- feedsPath: 'feeds',
15
- feedAssetsName: 'imcp-feeds-${latest}.zip',
16
- };
17
-
18
- /**
19
- * Local settings directory path based on OS
20
- */
21
- export const SETTINGS_DIR = (() => {
22
- switch (process.platform) {
23
- case 'win32':
24
- return path.join(os.homedir(), '.imcp');
25
- default: // linux, darwin (macOS), etc.
26
- return path.join(os.homedir(), '.imcp');
27
- }
28
- })();
29
-
30
- /**
31
- * Local feeds directory path
32
- */
33
- export const LOCAL_FEEDS_DIR = path.join(SETTINGS_DIR, 'feeds');
34
-
35
- /**
36
- * Path to the user information file
37
- */
38
- export const USER_INFO_PATH = path.join(SETTINGS_DIR, 'settings', 'user_info.json');
39
-
40
- /**
41
- * Path to the local feeds schema directory
42
- */
43
- export const LOCAL_FEEDS_SCHEMA_DIR = path.join(LOCAL_FEEDS_DIR, 'schemas');
44
-
45
- const CODE_STRORAGE_DIR = (() => {
46
- switch (process.platform) {
47
- case 'win32':
48
- return path.join(os.homedir(), 'AppData', 'Roaming', 'Code', 'User');
49
- case 'darwin': // macOS
50
- return path.join(os.homedir(), 'Library', 'Application Support', 'Code', 'User');
51
- default: // linux
52
- return path.join(os.homedir(), '.config', 'Code', 'User');
53
- }
54
- })();
55
-
56
- const CODE_INSIDER_STRORAGE_DIR = (() => {
57
- switch (process.platform) {
58
- case 'win32':
59
- return path.join(os.homedir(), 'AppData', 'Roaming', 'Code - Insiders', 'User');
60
- case 'darwin': // macOS
61
- return path.join(os.homedir(), 'Library', 'Application Support', 'Code - Insiders', 'User');
62
- default: // linux
63
- return path.join(os.homedir(), '.config', 'Code - Insiders', 'User');
64
- }
65
- })();
66
-
67
- /**
68
- * Supported client configurations.
69
- * Key: Client name (e.g., 'vscode')
70
- * Value: Client-specific settings or configuration details.
71
- * TODO: Define actual client settings structure.
72
- */
73
- export const SUPPORTED_CLIENTS: Record<string, {
74
- extension: {
75
- extensionId: string;
76
- leastVersion?: string;
77
- repository?: string;
78
- assetName?: string;
79
- private?: boolean;
80
- };
81
- codeSettingPath: string;
82
- codeInsiderSettingPath: string;
83
- }> = {
84
- 'MSRooCode': {
85
-
86
- extension: {
87
- extensionId: 'microsoftai.ms-roo-cline',
88
- leastVersion: '0.0.8',
89
- repository: 'ai-microsoft/roo-cline',
90
- assetName: 'ms-roo-cline-${version}.vsix',
91
- private: true
92
- },
93
- codeSettingPath: path.join(CODE_STRORAGE_DIR, 'globalStorage', 'microsoftai.ms-roo-cline', 'settings', 'cline_mcp_settings.json'),
94
- codeInsiderSettingPath: path.join(CODE_INSIDER_STRORAGE_DIR, 'globalStorage', 'microsoftai.ms-roo-cline', 'settings', 'cline_mcp_settings.json'),
95
- },
96
- 'Cline': { /* VS Code specific settings */
97
- extension: {
98
- extensionId: 'saoudrizwan.claude-dev',
99
- },
100
- codeSettingPath: path.join(CODE_STRORAGE_DIR, 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json'),
101
- codeInsiderSettingPath: path.join(CODE_INSIDER_STRORAGE_DIR, 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json'),
102
- },
103
- 'GithubCopilot': { /* GitHub Copilot specific settings */
104
- extension: {
105
- extensionId: 'github.copilot',
106
- },
107
- codeSettingPath: path.join(CODE_STRORAGE_DIR, 'settings.json'),
108
- codeInsiderSettingPath: path.join(CODE_INSIDER_STRORAGE_DIR, 'settings.json'),
109
- },
110
- // Add other supported clients here
111
- };
112
-
113
- /**
114
- * List of supported client names.
115
- */
116
- export const SUPPORTED_CLIENT_NAMES = Object.keys(SUPPORTED_CLIENTS);
117
-
118
- /**
119
- * Minimum time between requirement update checks (in milliseconds)
120
- * 10 minutes = 10 * 60 * 1000 = 600000 ms
121
- */
122
- export const UPDATE_CHECK_INTERVAL_MS = 10 * 60 * 1000; // 10 minutes
@@ -1,65 +0,0 @@
1
- /**
2
- * Step name constants for InstallOperationManager and step recording.
3
- *
4
- * This file defines all static step names and documents dynamic step name patterns
5
- * used throughout the installation and onboarding process.
6
- *
7
- * Dynamic step names are documented as template string patterns.
8
- */
9
-
10
- /** Step for processing all requirement updates in a batch operation. */
11
- export const STEP_PROCESS_REQUIREMENT_UPDATES = 'Processing all requirement updates';
12
-
13
- /** Step for checking the status of a specific requirement. */
14
- export const STEP_CHECKING_REQUIREMENT_STATUS = 'Checking the status of requirement';
15
-
16
- /** Step for installing requirements in the background process. */
17
- export const STEP_INSTALLING_REQUIREMENTS_IN_BACKGROUND = 'Installing requirements in the background';
18
-
19
- /** Step for running the install logic in the NugetInstaller. */
20
- export const STEP_NUGET_INSTALLER_INSTALL = 'Running install in NugetInstaller';
21
-
22
- /** Step for checking and installing all requirements as needed. */
23
- export const STEP_CHECK_AND_INSTALL_REQUIREMENTS = 'Checking and installing all requirements';
24
-
25
- /** Step for running the install logic in the CommandInstaller. */
26
- export const STEP_COMMAND_INSTALLER_INSTALL = 'Running install in CommandInstaller';
27
-
28
- /** Step for running the install logic in the GeneralInstaller. */
29
- export const STEP_GENERAL_INSTALLER_INSTALL = 'Running install in GeneralInstaller';
30
-
31
- /** Step for executing the actual installation command (npm, pip, etc.). */
32
- export const STEP_INSTALLATION_COMMAND_EXECUTION = 'Executing installation command for requirement';
33
-
34
- /** Step for running the install logic in the PipInstaller. */
35
- export const STEP_PIP_INSTALLER_INSTALL = 'Running install in PipInstaller';
36
-
37
- /** Step for processing requirement updates in the RequirementService. */
38
- export const STEP_PROCESS_REQUIREMENT_UPDATES_SERVICE = 'Processing requirement updates in RequirementService';
39
-
40
- /** Step for checking if the server is ready after installation. */
41
- export const STEP_CHECK_SERVER_READINESS = 'Checking server readiness after installation';
42
-
43
- /** Step for running the install logic in the NpmInstaller. */
44
- export const STEP_NPM_INSTALLER_INSTALL = 'Running install in NpmInstaller';
45
-
46
- /** Prefix for steps that update a specific requirement. */
47
- export const STEP_INSTALL_REQUIREMENT_PREFIX = 'Updating requirement:';
48
-
49
- /** Prefix for steps that execute an installation command for a requirement. */
50
- export const STEP_INSTALL_COMMAND_PREFIX = 'Executing installation command for:';
51
-
52
- /** Step for checking and installing the VS Code extension for the client. */
53
- export const STEP_CHECK_VSCODE_AND_INSTALL_EXTENSION = 'Checking and installing VS Code extension for client';
54
-
55
- /** Step for setting up the installation configuration (env, args, etc.). */
56
- export const STEP_SETUP_INSTALLATION_CONFIG = 'Setting up installation configuration';
57
-
58
- /** Step for updating VS Code settings for the client/server. */
59
- export const STEP_UPDATE_VSCODE_SETTINGS = 'Updating VS Code settings for client/server';
60
-
61
- /** Step for the overall installation process of a client or server. */
62
- export const STEP_INSTALLATION = 'Running overall installation process';
63
-
64
- /** Step for marking the initiation of an onboarding or installation process. */
65
- export const STEP_INITIATED = 'Initiating onboarding or installation process';
@@ -1,202 +0,0 @@
1
- export enum OSType {
2
- Windows = 'windows',
3
- MacOS = 'macos',
4
- Linux = 'linux'
5
- }
6
-
7
- export interface RequirementStatus {
8
- name: string;
9
- type: string;
10
- installed: boolean;
11
- inProgress?: boolean;
12
- version?: string;
13
- error?: string;
14
- availableUpdate?: {
15
- version: string;
16
- message: string;
17
- };
18
- lastCheckTime?: string;
19
- operationStatus?: OperationStatus;
20
- pythonEnv?: string; // Store Python environment path for pip requirements
21
- npmPath?: string; // Path to the installed npm package path
22
- }
23
-
24
- export interface MCPServerStatus {
25
- installedStatus: Record<string, OperationStatus>; // client: installed
26
- name: string;
27
- error?: string;
28
- }
29
-
30
- export interface OperationStatus {
31
- status: 'pending' | 'in-progress' | 'completed' | 'failed';
32
- type: 'install' | 'uninstall' | 'update' | 'check';
33
- target: 'requirement' | 'server';
34
- message?: string;
35
- error?: string;
36
- operationId?: string; // Added to track async operations
37
- }
38
-
39
- export interface InstallationStatus {
40
- requirementsStatus: Record<string, RequirementStatus>;
41
- serversStatus: Record<string, MCPServerStatus>;
42
- lastUpdated: string;
43
- }
44
-
45
- export interface MCPServerCategory {
46
- name: string;
47
- displayName: string;
48
- description?: string;
49
- type: 'local';
50
- path?: string;
51
- installationStatus?: InstallationStatus;
52
- feedConfiguration?: FeedConfiguration;
53
- }
54
-
55
- export interface ServerCategoryListOptions {
56
- local?: boolean;
57
- }
58
-
59
- export interface ServerOperationResult {
60
- success: boolean;
61
- message?: string;
62
- error?: Error;
63
- output?: string; // Added to capture installation logs
64
- status?: OperationStatus[]; // Added to capture operation status
65
- }
66
-
67
- export interface MCPConfiguration {
68
- localServerCategories: MCPServerCategory[];
69
- feeds: Record<string, FeedConfiguration>;
70
- clientMCPSettings?: Record<string, Record<string, any>>;
71
- }
72
-
73
- export interface ServerInstallOptions {
74
- force?: boolean;
75
- env?: Record<string, string>; // Environment variables for installation
76
- targetClients?: string[]; // Target clients for configuration
77
- requirements?: RequirementConfig[];
78
- args?: string[]; // Arguments for installation
79
- settings?: Record<string, any>; // Settings for installation like python env
80
- }
81
-
82
- export interface UpdateRequirementOptions {
83
- requirementName: string;
84
- updateVersion: string;
85
- }
86
-
87
- export interface ServerUninstallOptions {
88
- removeData?: boolean;
89
- targets?: string[]; // List of client targets to uninstall from
90
- }
91
-
92
- // Types related to server feed configuration (e.g., ai-coder-tools.json)
93
- export interface EnvVariableConfig {
94
- Required: boolean;
95
- Description: string;
96
- Default?: string;
97
- }
98
-
99
- export interface InstallationConfig {
100
- command: string;
101
- args: string[]; // Can use ${packageSource} as template variable for installation path
102
- env?: Record<string, EnvVariableConfig>; // Note the colon in property name
103
- url?: string; // URL for sse mode
104
- }
105
-
106
- export interface DependencyConfig {
107
- requirements?: Array<{
108
- name: string;
109
- version: string;
110
- order?: number;
111
- }>;
112
- mcpServers?: Array<{
113
- name: string;
114
- }>;
115
- }
116
-
117
- export interface McpConfig {
118
- name: string;
119
- description: string;
120
- mode: 'stdio' | 'sse'; // Currently only stdio mode is supported in ai-coder-tools
121
- dependencies?: DependencyConfig;
122
- schemas?: string; // Path to the schema file
123
- repository?: string; // Repository URL for the server
124
- systemTags?: Record<string, string>; // System tags for the feed
125
- installation: InstallationConfig;
126
- }
127
-
128
- export interface RegistryConfig {
129
- githubRelease?: {
130
- repository: string;
131
- assetsName?: string; // Template string like "ai-coder-tools-${latest}.zip"
132
- assetName: string; // Template string like "ai-coder-tools-${latest}.tgz"
133
- };
134
- artifacts?: {
135
- registryUrl: string;
136
- registryName: string; // Name of the registry
137
- };
138
- }
139
-
140
- export interface RequirementConfig {
141
- name: string;
142
- type: 'npm' | 'pip' | 'command' | 'extension' | 'nuget' | 'other'; // Add other requirement types if needed
143
- alias?: string; // Alias for the command type
144
- version: string;
145
- registry?: RegistryConfig;
146
- }
147
-
148
- export interface FeedConfiguration {
149
- name: string;
150
- displayName: string;
151
- description: string;
152
- repository?: string;
153
- PullRequest?: string; // Optional Pull Request link
154
- requirements: RequirementConfig[];
155
- mcpServers: McpConfig[];
156
- systemTags?: Record<string, string>; // System tags for the feed
157
- }
158
-
159
- export interface ClientSettings {
160
- codeSettingPath: string;
161
- codeInsiderSettingPath: string;
162
- }
163
-
164
- // Events that can be emitted by the SDK
165
- export enum MCPEvent {
166
- SERVER_INSTALLED = 'server:installed',
167
- SERVER_UNINSTALLED = 'server:uninstalled',
168
- SERVER_STARTED = 'server:started',
169
- SERVER_STOPPED = 'server:stopped',
170
- CONFIG_CHANGED = 'config:changed',
171
- }
172
-
173
- export interface MCPEventData {
174
- [MCPEvent.SERVER_INSTALLED]: { server: MCPServerCategory };
175
- [MCPEvent.SERVER_UNINSTALLED]: { serverName: string; targets?: string[] };
176
- [MCPEvent.SERVER_STARTED]: { server: MCPServerCategory };
177
- [MCPEvent.SERVER_STOPPED]: { serverName: string };
178
- [MCPEvent.CONFIG_CHANGED]: { configuration: MCPConfiguration };
179
- }
180
-
181
- export interface InstallOperationStep {
182
- name: string;
183
- status: 'pending' | 'in-progress' | 'completed' | 'failed' | 'canceled';
184
- message?: string;
185
- isCritical?: boolean;
186
- timestamp: string;
187
- }
188
-
189
- export interface InstallOperationDetails {
190
- currentStep: string;
191
- steps: InstallOperationStep[];
192
- lastUpdated: string;
193
- error?: string;
194
- overallStatus: 'pending' | 'in-progress' | 'completed' | 'failed';
195
- }
196
- export interface SystemSettings {
197
- pythonEnvs?: Record<string, string>;
198
- nodePath?: string;
199
- browserPath?: string;
200
- systemEnvironments?: Record<string, string>;
201
- userConfigurations?: Record<string, string>;
202
- }