imcp 0.1.19 → 0.2.1

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 (94) hide show
  1. package/README.md +56 -0
  2. package/dist/__mocks__/strip-json-comments.d.ts +1 -0
  3. package/dist/__mocks__/strip-json-comments.js +2 -0
  4. package/dist/__mocks__/strip-json-comments.js.map +1 -0
  5. package/dist/cli/commands/install.js +1 -1
  6. package/dist/cli/commands/install.js.map +1 -1
  7. package/dist/cli/commands/tui.d.ts +2 -0
  8. package/dist/cli/commands/tui.js +2 -0
  9. package/dist/cli/commands/tui.js.map +1 -0
  10. package/dist/cli/commands/uninstall.js +1 -1
  11. package/dist/cli/commands/uninstall.js.map +1 -1
  12. package/dist/cli/index.js +1 -1
  13. package/dist/cli/index.js.map +1 -1
  14. package/dist/cli/tui/App.d.ts +1 -0
  15. package/dist/cli/tui/App.js +2 -0
  16. package/dist/cli/tui/App.js.map +1 -0
  17. package/dist/cli/tui/components/ClientSelector.d.ts +11 -0
  18. package/dist/cli/tui/components/ClientSelector.js +2 -0
  19. package/dist/cli/tui/components/ClientSelector.js.map +1 -0
  20. package/dist/cli/tui/components/Header.d.ts +1 -0
  21. package/dist/cli/tui/components/Header.js +2 -0
  22. package/dist/cli/tui/components/Header.js.map +1 -0
  23. package/dist/cli/tui/components/InstallProgress.d.ts +8 -0
  24. package/dist/cli/tui/components/InstallProgress.js +2 -0
  25. package/dist/cli/tui/components/InstallProgress.js.map +1 -0
  26. package/dist/cli/tui/components/Panel.d.ts +8 -0
  27. package/dist/cli/tui/components/Panel.js +2 -0
  28. package/dist/cli/tui/components/Panel.js.map +1 -0
  29. package/dist/cli/tui/components/SearchBar.d.ts +11 -0
  30. package/dist/cli/tui/components/SearchBar.js +2 -0
  31. package/dist/cli/tui/components/SearchBar.js.map +1 -0
  32. package/dist/cli/tui/components/ServerList.d.ts +16 -0
  33. package/dist/cli/tui/components/ServerList.js +2 -0
  34. package/dist/cli/tui/components/ServerList.js.map +1 -0
  35. package/dist/cli/tui/components/StepIndicator.d.ts +7 -0
  36. package/dist/cli/tui/components/StepIndicator.js +2 -0
  37. package/dist/cli/tui/components/StepIndicator.js.map +1 -0
  38. package/dist/cli/tui/hooks/useInstall.d.ts +18 -0
  39. package/dist/cli/tui/hooks/useInstall.js +2 -0
  40. package/dist/cli/tui/hooks/useInstall.js.map +1 -0
  41. package/dist/cli/tui/hooks/useServers.d.ts +18 -0
  42. package/dist/cli/tui/hooks/useServers.js +2 -0
  43. package/dist/cli/tui/hooks/useServers.js.map +1 -0
  44. package/dist/cli/tui/utils/fuzzySearch.d.ts +9 -0
  45. package/dist/cli/tui/utils/fuzzySearch.js +2 -0
  46. package/dist/cli/tui/utils/fuzzySearch.js.map +1 -0
  47. package/dist/cli/utils/clientOptions.d.ts +3 -0
  48. package/dist/cli/utils/clientOptions.js +2 -0
  49. package/dist/cli/utils/clientOptions.js.map +1 -0
  50. package/dist/core/installers/clients/BaseClientInstaller.d.ts +8 -0
  51. package/dist/core/installers/clients/BaseClientInstaller.js +1 -1
  52. package/dist/core/installers/clients/BaseClientInstaller.js.map +1 -1
  53. package/dist/core/installers/clients/ClaudeCodeInstaller.js +1 -1
  54. package/dist/core/installers/clients/ClaudeCodeInstaller.js.map +1 -1
  55. package/dist/core/installers/clients/ClientInstaller.d.ts +3 -0
  56. package/dist/core/installers/clients/ClientInstaller.js +1 -1
  57. package/dist/core/installers/clients/ClientInstaller.js.map +1 -1
  58. package/dist/core/installers/clients/ClientInstallerFactory.js +1 -1
  59. package/dist/core/installers/clients/ClientInstallerFactory.js.map +1 -1
  60. package/dist/core/installers/clients/CodexInstaller.d.ts +45 -0
  61. package/dist/core/installers/clients/CodexInstaller.js +2 -0
  62. package/dist/core/installers/clients/CodexInstaller.js.map +1 -0
  63. package/dist/core/installers/clients/GithubCopilotInstaller.js +1 -1
  64. package/dist/core/installers/clients/GithubCopilotInstaller.js.map +1 -1
  65. package/dist/core/installers/clients/RooCodeInstaller.d.ts +11 -0
  66. package/dist/core/installers/clients/RooCodeInstaller.js +2 -0
  67. package/dist/core/installers/clients/RooCodeInstaller.js.map +1 -0
  68. package/dist/core/installers/clients/VisualStudioInstaller.js +1 -1
  69. package/dist/core/installers/clients/VisualStudioInstaller.js.map +1 -1
  70. package/dist/core/loaders/ConfigurationLoader.js +1 -1
  71. package/dist/core/loaders/ConfigurationLoader.js.map +1 -1
  72. package/dist/core/loaders/ConfigurationProvider.d.ts +1 -0
  73. package/dist/core/loaders/ConfigurationProvider.js +1 -1
  74. package/dist/core/loaders/ConfigurationProvider.js.map +1 -1
  75. package/dist/core/metadatas/constants.js +1 -1
  76. package/dist/core/metadatas/constants.js.map +1 -1
  77. package/dist/core/metadatas/types.d.ts +2 -0
  78. package/dist/core/metadatas/types.js.map +1 -1
  79. package/dist/services/InstallationService.js +1 -1
  80. package/dist/services/InstallationService.js.map +1 -1
  81. package/dist/services/RequirementService.d.ts +2 -3
  82. package/dist/services/RequirementService.js +1 -1
  83. package/dist/services/RequirementService.js.map +1 -1
  84. package/dist/services/ServerService.d.ts +5 -0
  85. package/dist/services/ServerService.js +1 -1
  86. package/dist/services/ServerService.js.map +1 -1
  87. package/dist/services/TelemetryService.js +1 -1
  88. package/dist/services/TelemetryService.js.map +1 -1
  89. package/dist/utils/tomlUtils.d.ts +17 -0
  90. package/dist/utils/tomlUtils.js +2 -0
  91. package/dist/utils/tomlUtils.js.map +1 -0
  92. package/dist/web/public/js/modal/modalSetup.js +1 -1
  93. package/dist/web/public/js/modal/modalSetup.js.map +1 -1
  94. package/package.json +7 -1
@@ -1,2 +1,2 @@
1
- import{Logger}from"../../../utils/logger.js";import{exec,spawn}from"child_process";import{promisify}from"util";import*as http from"http";import*as https from"https";import{isCommandAvailable,getNpmExecutablePath}from"../../../utils/osUtils.js";import{ExtensionInstaller}from"./ExtensionInstaller.js";import{SUPPORTED_CLIENTS,INSTRUMENTATION_KEY}from"../../metadatas/constants.js";import{MACRO_EXPRESSIONS,MacroResolverFunctions}from"../../../utils/macroExpressionUtils.js";import{InstallOperationManager}from"../../loaders/InstallOperationManager.js";import*as RecordingConstants from"../../metadatas/recordingConstants.js";const execAsync=promisify(exec);export class BaseClientInstaller{generateOperationId(){return`install-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}async setupInstallConfig(e,t){const s={...e.installation};s.mode=e.mode,t.args&&t.args.length>0&&(Logger.debug(`Using args from ServerInstallOptions: ${t.args.join(" ")}`),s.args=t.args);const n=s.env||{},r={APPLICATIONINSIGHTS_CONNECTION_STRING:`InstrumentationKey=${INSTRUMENTATION_KEY}`};for(const[e,t]of Object.entries(n)){const s=t;s.Default&&(r[e]=s.Default)}return s.env={...r,...t.env||{}},await this._resolveConfigMacros(s,t),Logger.debug(`Final installation config: ${JSON.stringify(s)}`),s}async _resolveConfigMacros(e,t){for(const s of Object.values(MACRO_EXPRESSIONS)){const n=e.args?.some((e=>"string"==typeof e&&e.includes(s))),r=Object.values(e.env||{}).some((e=>"string"==typeof e&&e.includes(s)));if(!n&&!r&&s!==MACRO_EXPRESSIONS.PYTHON_PACKAGE){Logger.debug(`Macro ${s} not found in args or env, skipping resolution.`);continue}const a=MacroResolverFunctions[s];if(a){const n=await a(e,t);if(void 0!==n){if(e.args){const t=e.args.join(" ");e.args=e.args.map((e=>"string"==typeof e&&e.includes(s)?e.replace(new RegExp(s.replace(/[${}]/g,"\\$&"),"g"),n):e)),e.args.join(" ")!==t&&Logger.debug(`Args after ${s} ('${n}') replacement: ${e.args.join(" ")}`)}if(e.env){const t=JSON.stringify(e.env);for(const t in e.env)"string"==typeof e.env[t]&&e.env[t].includes(s)&&(e.env[t]=e.env[t].replace(new RegExp(s.replace(/[${}]/g,"\\$&"),"g"),n));JSON.stringify(e.env)!==t&&Logger.debug(`Env after ${s} ('${n}') replacement: ${JSON.stringify(e.env)}`)}}else Logger.debug(`Could not resolve value for macro: ${s}. It will not be replaced.`)}}}async handleWindowsNpx(e){if("win32"===process.platform&&"npx"===e.command){const t=await getNpmExecutablePath();return{...e,command:"cmd",args:["/c","npx",...e.args],env:{...e.env,APPDATA:t}}}return e}initializeSettings(e){e.mcpServers||(e.mcpServers={})}setupSettings(e,t,s){e.mcpServers[t]={type:s.mode||"sse",url:s.url}}async handleStdioMode(e,t,s){s.args&&(s.args=s.args.map((e=>"string"==typeof e?e.replace(/\\/g,"/"):e))),e.mcpServers[t]={command:s.command,args:s.args,env:s.env,autoApprove:[],disabled:!1,alwaysAllow:[]}}async isServerReachable(e){return new Promise((t=>{try{const s=new URL(e),n=("https:"===s.protocol?https:http).request(s,{method:"HEAD",timeout:2e3},(e=>{t(!0),e.resume()}));n.on("error",(s=>{Logger.debug(`Server at ${e} is not reachable: ${s.message}`),t(!1)})),n.on("timeout",(()=>{Logger.debug(`Timeout checking server reachability at ${e}`),n.destroy(),t(!1)})),n.end()}catch(s){Logger.error(`Error parsing URL or making request to ${e}: ${s.message}`),t(!1)}}))}async handleSseAndStreamableMode(e,t,s){if(s.url){if(await this.isServerReachable(s.url))Logger.info(`Server at ${s.url} is already running or reachable. Skipping start command.`);else if(s.startingCommand&&"string"==typeof s.startingCommand){Logger.info(`Server at ${s.url} not reachable. Attempting to start server with command: ${s.startingCommand}`);const e=s.startingCommand.split(" "),t=e[0],n=e.slice(1);try{const e=spawn(t,n,{detached:!0,stdio:"ignore",shell:"win32"===process.platform});e.on("error",(e=>{Logger.error(`Failed to start server process with command "${s.startingCommand}": ${e.message}`)})),e.unref(),Logger.info(`Detached server process (PID: ${e.pid}) started with command: "${s.startingCommand}". It will continue running if this main process exits.`)}catch(e){Logger.error(`Exception when trying to spawn server process with command "${s.startingCommand}": ${e.message}`)}}else s.startingCommand?Logger.warn(`startingCommand is present but not a string: ${JSON.stringify(s.startingCommand)}`):Logger.info(`Server at ${s.url} not reachable and no startingCommand provided.`)}else Logger.warn("No URL provided in installConfig for SSE mode. Cannot check reachability or configure server.");this.setupSettings(e,t,s)}async checkVSCodeAndInstallExtension(e){const t=await isCommandAvailable("code"),s=await isCommandAvailable("code-insiders");if(!t&&!s)return{status:"failed",type:"install",target:"server",message:"Failed to install as neither VS Code nor VS Code Insiders are installed on this system. Please run `code` or `code-insiders` to make sure they are installed. Relaunch imcp after installation.",operationId:e};return await ExtensionInstaller.installExtension(this.clientName)?void 0:(Logger.debug(`Failed to install ${this.clientName} extension`),{status:"failed",type:"install",target:"server",message:`Failed to install ${this.clientName} extension`,operationId:e})}async updateVSCodeSettings(e,t){const s=[],n=await isCommandAvailable("code"),r=await isCommandAvailable("code-insiders");if(n)try{const n=SUPPORTED_CLIENTS[this.clientName].codeSettingPath;await this.setupClientSettings(n,e,t),s.push({success:!0,path:n})}catch(e){s.push({success:!1,path:SUPPORTED_CLIENTS[this.clientName].codeSettingPath,error:e instanceof Error?e.message:String(e)})}if(r)try{const n=SUPPORTED_CLIENTS[this.clientName].codeInsiderSettingPath;await this.setupClientSettings(n,e,t),s.push({success:!0,path:n})}catch(e){s.push({success:!1,path:SUPPORTED_CLIENTS[this.clientName].codeInsiderSettingPath,error:e instanceof Error?e.message:String(e)})}return s}async install(e,t,s){const n=this.generateOperationId(),r=InstallOperationManager.getInstance(s||e.name,e.name);return await r.recording((async()=>{await r.recording((()=>this.checkVSCodeAndInstallExtension(n)),{stepName:RecordingConstants.STEP_CHECK_VSCODE_AND_INSTALL_EXTENSION,endMessage:e=>e?.message,onResult:e=>"failed"!==e?.status});const s=await r.recording((()=>this.setupInstallConfig(e,t)),{stepName:RecordingConstants.STEP_SETUP_INSTALLATION_CONFIG});e.mode&&(s.mode=e.mode);const a=await r.recording((()=>this.updateVSCodeSettings(e.name,s)),{stepName:RecordingConstants.STEP_UPDATE_VSCODE_SETTINGS,endMessage:e=>e?.some((e=>e.success))?`Updated settings in: ${e.map((e=>e.path)).join(", ")}`:`Failed to update settings: ${e.map((e=>e.error)).join("; ")}`,onResult:e=>e?.some((e=>e.success))}),o=a.some((e=>e.success)),i=a.filter((e=>e.success)).map((e=>e.path)),l=a.filter((e=>!e.success)).map((e=>e.error));return{status:o?"completed":"failed",type:"install",target:"server",message:o?`Successfully installed ${this.clientName} client. Updated settings in: ${i.join(", ")}`:`Failed to install ${this.clientName} client. Errors: ${l.join("; ")}`,operationId:n,error:o?void 0:l.join("; ")}}),{stepName:RecordingConstants.STEP_INSTALLATION,onResult:e=>"failed"!==e?.status,endMessage:e=>e?.message,onError:e=>{const t=`Unexpected error installing ${this.clientName} client: ${e instanceof Error?e.message:String(e)}`;return{result:{status:"failed",type:"install",target:"server",message:t,operationId:n,error:e instanceof Error?e.message:String(e)},message:t}}})}}
1
+ import{Logger}from"../../../utils/logger.js";import{exec,spawn}from"child_process";import{promisify}from"util";import*as http from"http";import*as https from"https";import{isCommandAvailable,getNpmExecutablePath}from"../../../utils/osUtils.js";import{ExtensionInstaller}from"./ExtensionInstaller.js";import{SUPPORTED_CLIENTS,INSTRUMENTATION_KEY}from"../../metadatas/constants.js";import{MACRO_EXPRESSIONS,MacroResolverFunctions}from"../../../utils/macroExpressionUtils.js";import{InstallOperationManager}from"../../loaders/InstallOperationManager.js";import*as RecordingConstants from"../../metadatas/recordingConstants.js";const execAsync=promisify(exec);export class BaseClientInstaller{generateOperationId(){return`install-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}async setupInstallConfig(e,t){const s={...e.installation};s.mode=e.mode,t.args&&t.args.length>0&&(Logger.debug(`Using args from ServerInstallOptions: ${t.args.join(" ")}`),s.args=t.args);const n=s.env||{},r={APPLICATIONINSIGHTS_CONNECTION_STRING:`InstrumentationKey=${INSTRUMENTATION_KEY}`};for(const[e,t]of Object.entries(n)){const s=t;s.Default&&(r[e]=s.Default)}return s.env={...r,...t.env||{}},await this._resolveConfigMacros(s,t),Logger.debug(`Final installation config: ${JSON.stringify(s)}`),s}async _resolveConfigMacros(e,t){for(const s of Object.values(MACRO_EXPRESSIONS)){const n=e.args?.some((e=>"string"==typeof e&&e.includes(s))),r=Object.values(e.env||{}).some((e=>"string"==typeof e&&e.includes(s)));if(!n&&!r&&s!==MACRO_EXPRESSIONS.PYTHON_PACKAGE){Logger.debug(`Macro ${s} not found in args or env, skipping resolution.`);continue}const a=MacroResolverFunctions[s];if(a){const n=await a(e,t);if(void 0!==n){if(e.args){const t=e.args.join(" ");e.args=e.args.map((e=>"string"==typeof e&&e.includes(s)?e.replace(new RegExp(s.replace(/[${}]/g,"\\$&"),"g"),n):e)),e.args.join(" ")!==t&&Logger.debug(`Args after ${s} ('${n}') replacement: ${e.args.join(" ")}`)}if(e.env){const t=JSON.stringify(e.env);for(const t in e.env)"string"==typeof e.env[t]&&e.env[t].includes(s)&&(e.env[t]=e.env[t].replace(new RegExp(s.replace(/[${}]/g,"\\$&"),"g"),n));JSON.stringify(e.env)!==t&&Logger.debug(`Env after ${s} ('${n}') replacement: ${JSON.stringify(e.env)}`)}}else Logger.debug(`Could not resolve value for macro: ${s}. It will not be replaced.`)}}}async handleWindowsNpx(e){if("win32"===process.platform&&"npx"===e.command){const t=await getNpmExecutablePath();return{...e,command:"cmd",args:["/c","npx",...e.args],env:{...e.env,APPDATA:t}}}return e}initializeSettings(e){e.mcpServers||(e.mcpServers={})}normalizeServerName(e){return(e||"").toLowerCase().replace(/_/g,"-")}applySourceEnv(e,t){e&&"coding-flow"===this.normalizeServerName(t)&&(e.env&&"object"==typeof e.env||(e.env={}),e.env.SOURCE=this.clientName)}setupSettings(e,t,s){e.mcpServers[t]={type:s.mode||"sse",url:s.url},this.applySourceEnv(e.mcpServers[t],t)}async handleStdioMode(e,t,s){s.args&&(s.args=s.args.map((e=>"string"==typeof e?e.replace(/\\/g,"/"):e))),e.mcpServers[t]={command:s.command,args:s.args,env:s.env,autoApprove:[],disabled:!1,alwaysAllow:[]},this.applySourceEnv(e.mcpServers[t],t)}async isServerReachable(e){return new Promise((t=>{try{const s=new URL(e),n=("https:"===s.protocol?https:http).request(s,{method:"HEAD",timeout:2e3},(e=>{t(!0),e.resume()}));n.on("error",(s=>{Logger.debug(`Server at ${e} is not reachable: ${s.message}`),t(!1)})),n.on("timeout",(()=>{Logger.debug(`Timeout checking server reachability at ${e}`),n.destroy(),t(!1)})),n.end()}catch(s){Logger.error(`Error parsing URL or making request to ${e}: ${s.message}`),t(!1)}}))}async handleSseAndStreamableMode(e,t,s){if(s.url){if(await this.isServerReachable(s.url))Logger.info(`Server at ${s.url} is already running or reachable. Skipping start command.`);else if(s.startingCommand&&"string"==typeof s.startingCommand){Logger.info(`Server at ${s.url} not reachable. Attempting to start server with command: ${s.startingCommand}`);const e=s.startingCommand.split(" "),t=e[0],n=e.slice(1);try{const e=spawn(t,n,{detached:!0,stdio:"ignore",shell:"win32"===process.platform});e.on("error",(e=>{Logger.error(`Failed to start server process with command "${s.startingCommand}": ${e.message}`)})),e.unref(),Logger.info(`Detached server process (PID: ${e.pid}) started with command: "${s.startingCommand}". It will continue running if this main process exits.`)}catch(e){Logger.error(`Exception when trying to spawn server process with command "${s.startingCommand}": ${e.message}`)}}else s.startingCommand?Logger.warn(`startingCommand is present but not a string: ${JSON.stringify(s.startingCommand)}`):Logger.info(`Server at ${s.url} not reachable and no startingCommand provided.`)}else Logger.warn("No URL provided in installConfig for SSE mode. Cannot check reachability or configure server.");this.setupSettings(e,t,s)}async checkVSCodeAndInstallExtension(e){const t=await isCommandAvailable("code"),s=await isCommandAvailable("code-insiders");if(!t&&!s)return{status:"failed",type:"install",target:"server",message:"Failed to install as neither VS Code nor VS Code Insiders are installed on this system. Please run `code` or `code-insiders` to make sure they are installed. Relaunch imcp after installation.",operationId:e};return await ExtensionInstaller.installExtension(this.clientName)?void 0:(Logger.debug(`Failed to install ${this.clientName} extension`),{status:"failed",type:"install",target:"server",message:`Failed to install ${this.clientName} extension`,operationId:e})}async updateVSCodeSettings(e,t){const s=[],n=await isCommandAvailable("code"),r=await isCommandAvailable("code-insiders");if(n)try{const n=SUPPORTED_CLIENTS[this.clientName].codeSettingPath;await this.setupClientSettings(n,e,t),s.push({success:!0,path:n})}catch(e){s.push({success:!1,path:SUPPORTED_CLIENTS[this.clientName].codeSettingPath,error:e instanceof Error?e.message:String(e)})}if(r)try{const n=SUPPORTED_CLIENTS[this.clientName].codeInsiderSettingPath;await this.setupClientSettings(n,e,t),s.push({success:!0,path:n})}catch(e){s.push({success:!1,path:SUPPORTED_CLIENTS[this.clientName].codeInsiderSettingPath,error:e instanceof Error?e.message:String(e)})}return s}async install(e,t,s){const n=this.generateOperationId(),r=InstallOperationManager.getInstance(s||e.name,e.name);return await r.recording((async()=>{await r.recording((()=>this.checkVSCodeAndInstallExtension(n)),{stepName:RecordingConstants.STEP_CHECK_VSCODE_AND_INSTALL_EXTENSION,endMessage:e=>e?.message,onResult:e=>"failed"!==e?.status});const s=await r.recording((()=>this.setupInstallConfig(e,t)),{stepName:RecordingConstants.STEP_SETUP_INSTALLATION_CONFIG});e.mode&&(s.mode=e.mode);const a=await r.recording((()=>this.updateVSCodeSettings(e.name,s)),{stepName:RecordingConstants.STEP_UPDATE_VSCODE_SETTINGS,endMessage:e=>e?.some((e=>e.success))?`Updated settings in: ${e.map((e=>e.path)).join(", ")}`:`Failed to update settings: ${e.map((e=>e.error)).join("; ")}`,onResult:e=>e?.some((e=>e.success))}),o=a.some((e=>e.success)),i=a.filter((e=>e.success)).map((e=>e.path)),l=a.filter((e=>!e.success)).map((e=>e.error));return{status:o?"completed":"failed",type:"install",target:"server",message:o?`Successfully installed ${this.clientName} client. Updated settings in: ${i.join(", ")}`:`Failed to install ${this.clientName} client. Errors: ${l.join("; ")}`,operationId:n,error:o?void 0:l.join("; ")}}),{stepName:RecordingConstants.STEP_INSTALLATION,onResult:e=>"failed"!==e?.status,endMessage:e=>e?.message,onError:e=>{const t=`Unexpected error installing ${this.clientName} client: ${e instanceof Error?e.message:String(e)}`;return{result:{status:"failed",type:"install",target:"server",message:t,operationId:n,error:e instanceof Error?e.message:String(e)},message:t}}})}}
2
2
  //# sourceMappingURL=BaseClientInstaller.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Logger","exec","spawn","promisify","http","https","isCommandAvailable","getNpmExecutablePath","ExtensionInstaller","SUPPORTED_CLIENTS","INSTRUMENTATION_KEY","MACRO_EXPRESSIONS","MacroResolverFunctions","InstallOperationManager","RecordingConstants","execAsync","BaseClientInstaller","generateOperationId","Date","now","Math","random","toString","substr","setupInstallConfig","serverConfig","options","finalConfig","installation","mode","args","length","debug","join","baseEnv","env","defaultEnv","APPLICATIONINSIGHTS_CONNECTION_STRING","key","config","Object","entries","envConfig","Default","this","_resolveConfigMacros","JSON","stringify","macro","values","isMacroInArgs","some","arg","includes","isMacroInEnv","value","PYTHON_PACKAGE","resolver","resolvedValue","undefined","originalArgsString","map","replace","RegExp","originalEnvJson","handleWindowsNpx","process","platform","command","npmPath","APPDATA","initializeSettings","settings","mcpServers","setupSettings","serverName","installConfig","type","url","handleStdioMode","autoApprove","disabled","alwaysAllow","isServerReachable","urlString","Promise","resolve","URL","request","protocol","method","timeout","res","resume","on","err","message","destroy","end","error","handleSseAndStreamableMode","info","startingCommand","commandParts","split","slice","child","detached","stdio","shell","unref","pid","warn","checkVSCodeAndInstallExtension","operationId","isVSCodeInstalled","isVSCodeInsidersInstalled","status","target","installExtension","clientName","updateVSCodeSettings","results","settingPath","codeSettingPath","setupClientSettings","push","success","path","Error","String","codeInsiderSettingPath","install","categoryName","recorder","getInstance","name","recording","async","stepName","STEP_CHECK_VSCODE_AND_INSTALL_EXTENSION","endMessage","result","onResult","STEP_SETUP_INSTALLATION_CONFIG","STEP_UPDATE_VSCODE_SETTINGS","r","anySuccess","successPaths","filter","errors","STEP_INSTALLATION","onError","errorMsg"],"sources":["../../../../src/core/installers/clients/BaseClientInstaller.ts"],"mappings":"OAASA,WAAc,kCACdC,KAAMC,UAA4B,uBAClCC,cAAiB,iBACdC,SAAU,iBACVC,UAAW,eACdC,mBAAoBC,yBAA4B,mCAChDC,uBAA0B,iCAC1BC,kBAAmBC,wBAA2B,sCAOnDC,kBACAC,2BACG,gDACEC,4BAA+B,qDAC5BC,uBAAwB,wCAEpC,MAAMC,UAAYZ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vE,MAAK+F,GAAKA,EAAEnB,UACjCqB,EAAe1B,EAAQ2B,QAAOH,GAAKA,EAAEnB,UAASlE,KAAIqF,GAAKA,EAAElB,OACzDsB,EAAS5B,EAAQ2B,QAAOH,IAAMA,EAAEnB,UAASlE,KAAIqF,GAAKA,EAAE/C,QAM1D,MAAO,CACHkB,OAAQ8B,EAAa,YAAc,SACnCtE,KAAM,UACNyC,OAAQ,SACRtB,QARiBmD,EACf,0BAA0BvG,KAAK4E,2CAA2C4B,EAAanH,KAAK,QAC5F,qBAAqBW,KAAK4E,8BAA8B8B,EAAOrH,KAAK,QAOtEiF,cACAf,MAAOgD,OAAaxF,EAAY2F,EAAOrH,KAAK,MAC/C,GAEL,CACI0G,SAAU7H,mBAAmByI,kBAC7BR,SAAWD,GAA8B,WAAnBA,GAAQzB,OAC9BwB,WAAaC,GAAYA,GAA4B9C,QACrDwD,QAAUrD,IACN,MAAMsD,EAAW,+BAA+B7G,KAAK4E,sBAAsBrB,aAAiB8B,MAAQ9B,EAAMH,QAAUkC,OAAO/B,KAC3H,MAAO,CACH2C,OAAQ,CACJzB,OAAQ,SACRxC,KAAM,UACNyC,OAAQ,SACRtB,QAASyD,EACTvC,cACAf,MAAOA,aAAiB8B,MAAQ9B,EAAMH,QAAUkC,OAAO/B,IACxDH,QAASyD,EACf,GAKjB","ignoreList":[]}
1
+ {"version":3,"names":["Logger","exec","spawn","promisify","http","https","isCommandAvailable","getNpmExecutablePath","ExtensionInstaller","SUPPORTED_CLIENTS","INSTRUMENTATION_KEY","MACRO_EXPRESSIONS","MacroResolverFunctions","InstallOperationManager","RecordingConstants","execAsync","BaseClientInstaller","generateOperationId","Date","now","Math","random","toString","substr","setupInstallConfig","serverConfig","options","finalConfig","installation","mode","args","length","debug","join","baseEnv","env","defaultEnv","APPLICATIONINSIGHTS_CONNECTION_STRING","key","config","Object","entries","envConfig","Default","this","_resolveConfigMacros","JSON","stringify","macro","values","isMacroInArgs","some","arg","includes","isMacroInEnv","value","PYTHON_PACKAGE","resolver","resolvedValue","undefined","originalArgsString","map","replace","RegExp","originalEnvJson","handleWindowsNpx","process","platform","command","npmPath","APPDATA","initializeSettings","settings","mcpServers","normalizeServerName","serverName","toLowerCase","applySourceEnv","target","SOURCE","clientName","setupSettings","installConfig","type","url","handleStdioMode","autoApprove","disabled","alwaysAllow","isServerReachable","urlString","Promise","resolve","URL","request","protocol","method","timeout","res","resume","on","err","message","destroy","end","error","handleSseAndStreamableMode","info","startingCommand","commandParts","split","slice","child","detached","stdio","shell","unref","pid","warn","checkVSCodeAndInstallExtension","operationId","isVSCodeInstalled","isVSCodeInsidersInstalled","status","installExtension","updateVSCodeSettings","results","settingPath","codeSettingPath","setupClientSettings","push","success","path","Error","String","codeInsiderSettingPath","install","categoryName","recorder","getInstance","name","recording","async","stepName","STEP_CHECK_VSCODE_AND_INSTALL_EXTENSION","endMessage","result","onResult","STEP_SETUP_INSTALLATION_CONFIG","STEP_UPDATE_VSCODE_SETTINGS","r","anySuccess","successPaths","filter","errors","STEP_INSTALLATION","onError","errorMsg"],"sources":["../../../../src/core/installers/clients/BaseClientInstaller.ts"],"mappings":"OAASA,WAAc,kCACdC,KAAMC,UAA4B,uBAClCC,cAAiB,iBACdC,SAAU,iBACVC,UAAW,eACdC,mBAAoBC,yBAA4B,mCAChDC,uBAA0B,iCAC1BC,kBAAmBC,wBAA2B,sCAOnDC,kBACAC,2BACG,gDACEC,4BAA+B,qDAC5BC,uBAAwB,wCAEpC,MAAMC,UAAYZ,UAAUF,aAKtB,MAAgBe,oBAKR,mBAAAC,GACN,MAAO,WAAWC,KAAKC,SAASC,KAAKC,SAASC,SAAS,IAAIC,OAAO,EAAG,IACzE,CAMU,wBAAMC,CACZC,EACAC,GAEA,MAAMC,EAAmB,IAAKF,EAAaG,cAC3CD,EAAYE,KAAOJ,EAAaI,KAG5BH,EAAQI,MAAQJ,EAAQI,KAAKC,OAAS,IACtC/B,OAAOgC,MAAM,yCAAyCN,EAAQI,KAAKG,KAAK,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/F,MAAKmG,GAAKA,EAAEnB,YAKxCoB,EAAazB,EAAQ3E,MAAKmG,GAAKA,EAAEnB,UACjCqB,EAAe1B,EAAQ2B,QAAOH,GAAKA,EAAEnB,UAAStE,KAAIyF,GAAKA,EAAElB,OACzDsB,EAAS5B,EAAQ2B,QAAOH,IAAMA,EAAEnB,UAAStE,KAAIyF,GAAKA,EAAE7C,QAM1D,MAAO,CACHkB,OAAQ4B,EAAa,YAAc,SACnCpE,KAAM,UACNL,OAAQ,SACRwB,QARiBiD,EACf,0BAA0B3G,KAAKoC,2CAA2CwE,EAAavH,KAAK,QAC5F,qBAAqBW,KAAKoC,8BAA8B0E,EAAOzH,KAAK,QAOtEuF,cACAf,MAAO8C,OAAa5F,EAAY+F,EAAOzH,KAAK,MAC/C,GAEL,CACI8G,SAAUjI,mBAAmB6I,kBAC7BR,SAAWD,GAA8B,WAAnBA,GAAQvB,OAC9BsB,WAAaC,GAAYA,GAA4B5C,QACrDsD,QAAUnD,IACN,MAAMoD,EAAW,+BAA+BjH,KAAKoC,sBAAsByB,aAAiB4B,MAAQ5B,EAAMH,QAAUgC,OAAO7B,KAC3H,MAAO,CACHyC,OAAQ,CACJvB,OAAQ,SACRxC,KAAM,UACNL,OAAQ,SACRwB,QAASuD,EACTrC,cACAf,MAAOA,aAAiB4B,MAAQ5B,EAAMH,QAAUgC,OAAO7B,IACxDH,QAASuD,EACf,GAKjB","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import{BaseClientInstaller}from"./BaseClientInstaller.js";import{Logger}from"../../../utils/logger.js";import fs from"fs/promises";import path from"path";import{SUPPORTED_CLIENTS}from"../../metadatas/constants.js";import{InstallOperationManager}from"../../loaders/InstallOperationManager.js";import*as RecordingConstants from"../../metadatas/recordingConstants.js";export class ClaudeCodeInstaller extends BaseClientInstaller{clientName="ClaudeCode";async updateClaudeSettings(e,t){Logger.debug("Updating Claude Desktop settings");const s=[];try{const a=SUPPORTED_CLIENTS[this.clientName].codeSettingPath;Logger.debug(`Attempting to update settings at: ${a}`),await this.setupClientSettings(a,e,t),s.push({success:!0,path:a}),Logger.debug("Successfully updated Claude Desktop settings")}catch(e){const t=e instanceof Error?e.message:String(e);Logger.error("Failed to update Claude Desktop settings:",e),s.push({success:!1,path:SUPPORTED_CLIENTS[this.clientName].codeSettingPath,error:t})}return s}async setupClientSettings(e,t,s){Logger.debug(`Setting up Claude Desktop client settings at ${e}`);try{const a=path.dirname(e);await fs.mkdir(a,{recursive:!0});let n={};try{const t=await fs.readFile(e,"utf8");n=JSON.parse(t)}catch(e){Logger.debug("No existing settings file found, creating new one")}this.initializeSettings(n),"stdio"===s.mode?await this.handleStdioMode(n,t,s):"sse"!==s.mode&&"streamable-http"!==s.mode||await this.handleSseAndStreamableMode(n,t,s),await fs.writeFile(e,JSON.stringify(n,null,2),"utf8"),Logger.debug(`Successfully updated Claude Desktop settings at ${e}`)}catch(e){throw Logger.error("Failed to setup Claude Desktop client settings:",e),e}}initializeSettings(e){e.mcpServers||(e.mcpServers={})}async handleStdioMode(e,t,s){s.args&&(s.args=s.args.map((e=>"string"==typeof e?e.replace(/\\/g,"/"):e))),e.mcpServers[t]={type:"stdio",command:s.command,args:s.args,env:s.env||{}}}async install(e,t,s){const a=this.generateOperationId(),n=InstallOperationManager.getInstance(s||e.name,e.name);return await n.recording((async()=>{const s=await n.recording((()=>this.setupInstallConfig(e,t)),{stepName:RecordingConstants.STEP_SETUP_INSTALLATION_CONFIG});e.mode&&(s.mode=e.mode);const r=await n.recording((()=>this.updateClaudeSettings(e.name,s)),{stepName:"Update Claude Desktop Settings",onResult:e=>e?.some((e=>e.success))}),i=r.some((e=>e.success)),o=r.filter((e=>e.success)).map((e=>e.path)),l=r.filter((e=>!e.success)).map((e=>e.error));return{status:i?"completed":"failed",type:"install",target:"server",message:i?`Successfully installed ${this.clientName} client. Updated settings in: ${o.join(", ")}`:`Failed to install ${this.clientName} client. Errors: ${l.join("; ")}`,operationId:a,error:i?void 0:l.join("; ")}}),{stepName:RecordingConstants.STEP_INSTALLATION,onResult:e=>"failed"!==e?.status,endMessage:e=>e?.message,onError:e=>{const t=`Unexpected error installing ${this.clientName} client: ${e instanceof Error?e.message:String(e)}`;return{result:{status:"failed",type:"install",target:"server",message:t,operationId:a,error:e instanceof Error?e.message:String(e)},message:t}}})}}
1
+ import{BaseClientInstaller}from"./BaseClientInstaller.js";import{Logger}from"../../../utils/logger.js";import fs from"fs/promises";import path from"path";import{SUPPORTED_CLIENTS}from"../../metadatas/constants.js";import{InstallOperationManager}from"../../loaders/InstallOperationManager.js";import*as RecordingConstants from"../../metadatas/recordingConstants.js";export class ClaudeCodeInstaller extends BaseClientInstaller{clientName="ClaudeCode";async updateClaudeSettings(e,t){Logger.debug("Updating Claude Desktop settings");const s=[];try{const a=SUPPORTED_CLIENTS[this.clientName].codeSettingPath;Logger.debug(`Attempting to update settings at: ${a}`),await this.setupClientSettings(a,e,t),s.push({success:!0,path:a}),Logger.debug("Successfully updated Claude Desktop settings")}catch(e){const t=e instanceof Error?e.message:String(e);Logger.error("Failed to update Claude Desktop settings:",e),s.push({success:!1,path:SUPPORTED_CLIENTS[this.clientName].codeSettingPath,error:t})}return s}async setupClientSettings(e,t,s){Logger.debug(`Setting up Claude Desktop client settings at ${e}`);try{const a=path.dirname(e);await fs.mkdir(a,{recursive:!0});let n={};try{const t=await fs.readFile(e,"utf8");n=JSON.parse(t)}catch(e){Logger.debug("No existing settings file found, creating new one")}this.initializeSettings(n),"stdio"===s.mode?await this.handleStdioMode(n,t,s):"sse"!==s.mode&&"streamable-http"!==s.mode||await this.handleSseAndStreamableMode(n,t,s),await fs.writeFile(e,JSON.stringify(n,null,2),"utf8"),Logger.debug(`Successfully updated Claude Desktop settings at ${e}`)}catch(e){throw Logger.error("Failed to setup Claude Desktop client settings:",e),e}}initializeSettings(e){e.mcpServers||(e.mcpServers={})}async handleStdioMode(e,t,s){s.args&&(s.args=s.args.map((e=>"string"==typeof e?e.replace(/\\/g,"/"):e))),e.mcpServers[t]={type:"stdio",command:s.command,args:s.args,env:s.env||{}},this.applySourceEnv(e.mcpServers[t],t)}async install(e,t,s){const a=this.generateOperationId(),n=InstallOperationManager.getInstance(s||e.name,e.name);return await n.recording((async()=>{const s=await n.recording((()=>this.setupInstallConfig(e,t)),{stepName:RecordingConstants.STEP_SETUP_INSTALLATION_CONFIG});e.mode&&(s.mode=e.mode);const r=await n.recording((()=>this.updateClaudeSettings(e.name,s)),{stepName:"Update Claude Desktop Settings",onResult:e=>e?.some((e=>e.success))}),i=r.some((e=>e.success)),o=r.filter((e=>e.success)).map((e=>e.path)),l=r.filter((e=>!e.success)).map((e=>e.error));return{status:i?"completed":"failed",type:"install",target:"server",message:i?`Successfully installed ${this.clientName} client. Updated settings in: ${o.join(", ")}`:`Failed to install ${this.clientName} client. Errors: ${l.join("; ")}`,operationId:a,error:i?void 0:l.join("; ")}}),{stepName:RecordingConstants.STEP_INSTALLATION,onResult:e=>"failed"!==e?.status,endMessage:e=>e?.message,onError:e=>{const t=`Unexpected error installing ${this.clientName} client: ${e instanceof Error?e.message:String(e)}`;return{result:{status:"failed",type:"install",target:"server",message:t,operationId:a,error:e instanceof Error?e.message:String(e)},message:t}}})}}
2
2
  //# sourceMappingURL=ClaudeCodeInstaller.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["BaseClientInstaller","Logger","fs","path","SUPPORTED_CLIENTS","InstallOperationManager","RecordingConstants","ClaudeCodeInstaller","clientName","updateClaudeSettings","serverName","installConfig","debug","results","settingPath","this","codeSettingPath","setupClientSettings","push","success","error","errorMessage","Error","message","String","settingsDir","dirname","mkdir","recursive","settings","existingContent","readFile","JSON","parse","initializeSettings","mode","handleStdioMode","handleSseAndStreamableMode","writeFile","stringify","mcpServers","finalConfig","args","map","arg","replace","type","command","env","install","serverConfig","options","categoryName","operationId","generateOperationId","recorder","getInstance","name","recording","async","setupInstallConfig","stepName","STEP_SETUP_INSTALLATION_CONFIG","onResult","result","some","r","anySuccess","successPaths","filter","errors","status","target","join","undef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B4C,EACf,0BAA0BpD,KAAKP,2CAA2C4D,EAAaK,KAAK,QAC5F,qBAAqB1D,KAAKP,8BAA8B8D,EAAOG,KAAK,QAOtEpB,cACAjC,MAAO+C,OAAaO,EAAYJ,EAAOG,KAAK,MAC/C,GAEL,CACIZ,SAAUvD,mBAAmBqE,kBAC7BZ,SAAWC,GAA8B,WAAnBA,GAAQO,OAC9BK,WAAaZ,GAAYA,GAA4BzC,QACrDsD,QAAUzD,IACN,MAAM0D,EAAW,+BAA+B/D,KAAKP,sBAAsBY,aAAiBE,MAAQF,EAAMG,QAAUC,OAAOJ,KAC3H,MAAO,CACH4C,OAAQ,CACJO,OAAQ,SACRzB,KAAM,UACN0B,OAAQ,SACRjD,QAASuD,EACTzB,cACAjC,MAAOA,aAAiBE,MAAQF,EAAMG,QAAUC,OAAOJ,IACxDG,QAASuD,EACf,GAIjB","ignoreList":[]}
1
+ {"version":3,"names":["BaseClientInstaller","Logger","fs","path","SUPPORTED_CLIENTS","InstallOperationManager","RecordingConstants","ClaudeCodeInstaller","clientName","updateClaudeSettings","serverName","installConfig","debug","results","settingPath","this","codeSettingPath","setupClientSettings","push","success","error","errorMessage","Error","message","String","settingsDir","dirname","mkdir","recursive","settings","existingContent","readFile","JSON","parse","initializeSettings","mode","handleStdioMode","handleSseAndStreamableMode","writeFile","stringify","mcpServers","finalConfig","args","map","arg","replace","type","command","env","applySourceEnv","install","serverConfig","options","categoryName","operationId","generateOperationId","recorder","getInstance","name","recording","async","setupInstallConfig","stepName","STEP_SETUP_INSTALLATION_CONFIG","onResult","result","some","r","anySuccess","successPaths","filter","errors","status","target","join","undefined","STEP_INSTALLATION","endMessage","onError","errorMsg"],"sources":["../../../../src/core/installers/clients/ClaudeCodeInstaller.ts"],"mappings":"OAASA,wBAA2B,kCAC3BC,WAAc,kCAChBC,OAAQ,qBACRC,SAAU,cACRC,sBAAyB,sCAEzBC,4BAA+B,qDAC5BC,uBAAwB,+CAM9B,MAAOC,4BAA4BP,oBAClBQ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SAAUxD,mBAAmBsE,kBAC7BZ,SAAWC,GAA8B,WAAnBA,GAAQO,OAC9BK,WAAaZ,GAAYA,GAA4B1C,QACrDuD,QAAU1D,IACN,MAAM2D,EAAW,+BAA+BhE,KAAKP,sBAAsBY,aAAiBE,MAAQF,EAAMG,QAAUC,OAAOJ,KAC3H,MAAO,CACH6C,OAAQ,CACJO,OAAQ,SACR1B,KAAM,UACN2B,OAAQ,SACRlD,QAASwD,EACTzB,cACAlC,MAAOA,aAAiBE,MAAQF,EAAMG,QAAUC,OAAOJ,IACxDG,QAASwD,EACf,GAIjB","ignoreList":[]}
@@ -17,6 +17,9 @@ export declare class ClientInstaller {
17
17
  * Install client with requirements checking
18
18
  */
19
19
  private installClient;
20
+ private runInstallationBlocking;
21
+ private runInstallationAsync;
22
+ private finalizeClientStatus;
20
23
  private processInstallation;
21
24
  /**
22
25
  * Generate a unique operation ID for tracking installations
@@ -1,2 +1,2 @@
1
- import{ConfigurationProvider}from"../../loaders/ConfigurationProvider.js";import{Logger}from"../../../utils/logger.js";import{ClientInstallerFactory}from"./ClientInstallerFactory.js";import{InstallOperationManager}from"../../loaders/InstallOperationManager.js";export class ClientInstaller{categoryName;serverName;clients;configProvider;constructor(e,t,r){this.categoryName=e,this.serverName=t,this.clients=r,this.configProvider=ConfigurationProvider.getInstance()}async install(e){const t=[],r=this.clients.map((async r=>{const a=await this.installClient(r,e);return t.push(a),a}));return await Promise.all(r),{success:!0,message:"Client installations completed",status:t}}async installClient(e,t){const r=this.generateOperationId();if(!ClientInstallerFactory.isClientSupported(e))return{status:"failed",type:"install",target:"server",message:`Unsupported client: ${e}`,operationId:r};const a={status:"pending",type:"install",target:"server",message:`Initializing installation for client: ${e}`,operationId:r};return this.processInstallation(e,r,t).then((t=>{"completed"!==t.status&&"failed"!==t.status||InstallOperationManager.getInstance(this.categoryName,this.serverName).markOverallStatus(t.status),this.configProvider.updateServerOperationStatus(this.categoryName,this.serverName,e,t)})).catch((t=>{this.configProvider.updateServerOperationStatus(this.categoryName,this.serverName,e,{status:"failed",type:"install",target:"server",message:`Error installing client ${e}: ${t instanceof Error?t.message:String(t)}`,operationId:r,error:t instanceof Error?t.message:String(t)}),Logger.error(`Error installing client ${e}: ${t instanceof Error?t.message:String(t)}`),InstallOperationManager.getInstance(this.categoryName,this.serverName).markOverallStatus("failed",t)})),await this.configProvider.updateServerOperationStatus(this.categoryName,this.serverName,e,a),a}async processInstallation(e,t,r){if(!await this.checkRequirements(t,e,r)){return{status:"failed",type:"install",target:"server",message:`Requirements not ready for client: ${e} after timeout`,operationId:t}}const a=ClientInstallerFactory.getInstaller(e);if(!a)throw new Error(`Failed to create installer for client: ${e}`);const s=await this.configProvider.getServerMcpConfig(this.categoryName,this.serverName);if(!s)throw new Error(`Server configuration not found for category: ${this.categoryName}, server: ${this.serverName}`);const i={status:"in-progress",type:"install",target:"server",message:`Installing client: ${e}`,operationId:t};return await this.configProvider.updateServerOperationStatus(this.categoryName,this.serverName,e,i),await a.install(s,r,this.categoryName)}generateOperationId(){return`install-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}async checkRequirements(e,t,r){let a=await this.configProvider.isRequirementsReady(this.categoryName,this.serverName);if(!a){const r={status:"pending",type:"install",target:"server",message:`Waiting for requirements to be ready for client: ${t}`,operationId:e};await this.configProvider.updateServerOperationStatus(this.categoryName,this.serverName,t,r);const s=Date.now(),i=3e5,n=5e3;for(;!a&&Date.now()-s<i;)await new Promise((e=>setTimeout(e,n))),a=await this.configProvider.isRequirementsReady(this.categoryName,this.serverName)}const s=(await this.configProvider.GetServerRequirementStatus(this.categoryName,this.serverName)).find((e=>e.npmPath&&e.npmPath.length>0));return s&&s.npmPath&&(r.settings=r.settings||{},r.settings.npmPath=s.npmPath),a}}
1
+ import{ConfigurationProvider}from"../../loaders/ConfigurationProvider.js";import{Logger}from"../../../utils/logger.js";import{ClientInstallerFactory}from"./ClientInstallerFactory.js";import{InstallOperationManager}from"../../loaders/InstallOperationManager.js";export class ClientInstaller{categoryName;serverName;clients;configProvider;constructor(t,e,r){this.categoryName=t,this.serverName=e,this.clients=r,this.configProvider=ConfigurationProvider.getInstance()}async install(t){const e=await Promise.all(this.clients.map((e=>this.installClient(e,t)))),r=e.every((t=>"failed"!==t.status));return{success:r,message:r?"Client installations completed":"One or more client installations failed",status:e}}async installClient(t,e){const r=this.generateOperationId();if(!ClientInstallerFactory.isClientSupported(t))return{status:"failed",type:"install",target:"server",message:`Unsupported client: ${t}`,operationId:r};const a={status:"pending",type:"install",target:"server",message:`Initializing installation for client: ${t}`,operationId:r};return await this.configProvider.updateServerOperationStatus(this.categoryName,this.serverName,t,a),e.blockUntilComplete?await this.runInstallationBlocking(t,r,e):(this.runInstallationAsync(t,r,e),a)}async runInstallationBlocking(t,e,r){try{const a=await this.processInstallation(t,e,r);return await this.finalizeClientStatus(t,a),a}catch(r){const a={status:"failed",type:"install",target:"server",message:`Error installing client ${t}: ${r instanceof Error?r.message:String(r)}`,operationId:e,error:r instanceof Error?r.message:String(r)};return await this.finalizeClientStatus(t,a,r),a}}runInstallationAsync(t,e,r){this.processInstallation(t,e,r).then((e=>this.finalizeClientStatus(t,e))).catch((async r=>{const a={status:"failed",type:"install",target:"server",message:`Error installing client ${t}: ${r instanceof Error?r.message:String(r)}`,operationId:e,error:r instanceof Error?r.message:String(r)};await this.finalizeClientStatus(t,a,r)}))}async finalizeClientStatus(t,e,r){await this.configProvider.updateServerOperationStatus(this.categoryName,this.serverName,t,e),"failed"===e.status&&r&&Logger.error(`Error installing client ${t}: ${r instanceof Error?r.message:String(r)}`),"completed"!==e.status&&"failed"!==e.status||await InstallOperationManager.getInstance(this.categoryName,this.serverName).markOverallStatus(e.status,"failed"===e.status?e.error||e.message:void 0)}async processInstallation(t,e,r){if(!await this.checkRequirements(e,t,r)){return{status:"failed",type:"install",target:"server",message:`Requirements not ready for client: ${t} after timeout`,operationId:e}}const a=ClientInstallerFactory.getInstaller(t);if(!a)throw new Error(`Failed to create installer for client: ${t}`);const i=await this.configProvider.getServerMcpConfig(this.categoryName,this.serverName);if(!i)throw new Error(`Server configuration not found for category: ${this.categoryName}, server: ${this.serverName}`);const s={status:"in-progress",type:"install",target:"server",message:`Installing client: ${t}`,operationId:e};return await this.configProvider.updateServerOperationStatus(this.categoryName,this.serverName,t,s),await a.install(i,r,this.categoryName)}generateOperationId(){return`install-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}async checkRequirements(t,e,r){let a=await this.configProvider.isRequirementsReady(this.categoryName,this.serverName);if(!a){const r={status:"pending",type:"install",target:"server",message:`Waiting for requirements to be ready for client: ${e}`,operationId:t};await this.configProvider.updateServerOperationStatus(this.categoryName,this.serverName,e,r);const i=Date.now(),s=3e5,n=5e3;for(;!a&&Date.now()-i<s;)await new Promise((t=>setTimeout(t,n))),a=await this.configProvider.isRequirementsReady(this.categoryName,this.serverName)}const i=(await this.configProvider.GetServerRequirementStatus(this.categoryName,this.serverName)).find((t=>t.npmPath&&t.npmPath.length>0));return i&&i.npmPath&&(r.settings=r.settings||{},r.settings.npmPath=i.npmPath),a}}
2
2
  //# sourceMappingURL=ClientInstaller.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ConfigurationProvider","Logger","ClientInstallerFactory","InstallOperationManager","ClientInstaller","categoryName","serverName","clients","configProvider","constructor","this","getInstance","install","options","initialStatuses","installPromises","map","async","clientName","status","installClient","push","Promise","all","success","message","operationId","generateOperationId","isClientSupported","type","target","initialStatus","processInstallation","then","markOverallStatus","updateServerOperationStatus","catch","error","Error","String","checkRequirements","installer","getInstaller","serverConfig","getServerMcpConfig","inProgressStatus","Date","now","Math","random","toString","substr","requirementsReady","isRequirementsReady","pendingStatus","startTime","timeoutMs","intervalMs","resolve","setTimeout","npmPathRequirement","GetServerRequirementStatus","find","npmPath","length","settings"],"sources":["../../../../src/core/installers/clients/ClientInstaller.ts"],"mappings":"OAASA,0BAA6B,gDAS7BC,WAAc,kCACdC,2BAA8B,qCAC9BC,4BAA+B,kDAOlC,MAAOC,gBAIGC,a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YT,KAAKC,MACjBS,EAAY,IACZC,EAAa,IAEnB,MAAQL,GAAsBN,KAAKC,MAAQQ,EAAaC,SAC9C,IAAIlC,SAAQoC,GAAWC,WAAWD,EAASD,KACjDL,QAA0B1C,KAAKF,eAAe6C,oBAAoB3C,KAAKL,aAAcK,KAAKJ,WAElG,CAKA,MAAMsD,SAH8ClD,KAAKF,eAAeqD,2BAA2BnD,KAAKL,aAAcK,KAAKJ,aAG7EwD,MAAK3C,GAAUA,EAAO4C,SAAW5C,EAAO4C,QAAQC,OAAS,IAMvG,OALIJ,GAAsBA,EAAmBG,UACzClD,EAAQoD,SAAWpD,EAAQoD,UAAY,GACvCpD,EAAQoD,SAASF,QAAUH,EAAmBG,SAG3CX,CACX","ignoreList":[]}
1
+ {"version":3,"names":["ConfigurationProvider","Logger","ClientInstallerFactory","InstallOperationManager","ClientInstaller","categoryName","serverName","clients","configProvider","constructor","this","getInstance","install","options","statuses","Promise","all","map","clientName","installClient","allSuccessful","every","status","success","message","operationId","generateOperationId","isClientSupported","type","target","initialStatus","updateServerOperationStatus","blockUntilComplete","runInstallationBlocking","runInstallationAsync","processInstallation","finalizeClientStatus","error","failureStatus","Error","String","then","catch","async","markOverallStatus","undefined","checkRequirements","installer","getInstaller","serverConfig","getServerMcpConfig","inProgressStatus","Date","now","Math","random","toString","substr","requirementsReady","isRequirementsReady","pendingStatus","startTime","timeoutMs","intervalMs","resolve","setTimeout","npmPathRequirement","GetServerRequirementStatus","find","npmPath","length","settings"],"sources":["../../../../src/core/installers/clients/ClientInstaller.ts"],"mappings":"OAASA,0BAA6B,gDAS7BC,WAAc,kCACdC,2BAA8B,qCAC9BC,4BAA+B,kDAMlC,MAAOC,gBAIGC,aACAC,WACAC,QALJC,eAER,WAAAC,CACYJ,EACAC,EACAC,GAFAG,KAAAL,eACAK,KAAAJ,aACAI,KAAAH,UAERG,KAAKF,eAAiBR,sBAAsBW,aAChD,CAKA,aAAMC,CAAQC,GACV,MAAMC,QAAiBC,QAAQC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ACLK,KAAKJ,WACLY,EACAiC,SAGSJ,EAAUnC,QAAQqC,EAAcpC,EAASH,KAAKL,aAC/D,CAKQ,mBAAAqB,GACJ,MAAO,WAAW0B,KAAKC,SAASC,KAAKC,SAASC,SAAS,IAAIC,OAAO,EAAG,IACzE,CAMQ,uBAAMX,CAAkBrB,EAAqBP,EAAoBL,GACrE,IAAI6C,QAA0BhD,KAAKF,eAAemD,oBAAoBjD,KAAKL,aAAcK,KAAKJ,YAE9F,IAAKoD,EAAmB,CACpB,MAAME,EAAiC,CACnCtC,OAAQ,UACRM,KAAM,UACNC,OAAQ,SACRL,QAAS,oDAAoDN,IAC7DO,qBAGEf,KAAKF,eAAeuB,4BACtBrB,KAAKL,aACLK,KAAKJ,WACLY,EACA0C,GAIJ,MAAMC,EAAYT,KAAKC,MACjBS,EAAY,IACZC,EAAa,IAEnB,MAAQL,GAAsBN,KAAKC,MAAQQ,EAAaC,SAC9C,IAAI/C,SAAQiD,GAAWC,WAAWD,EAASD,KACjDL,QAA0BhD,KAAKF,eAAemD,oBAAoBjD,KAAKL,aAAcK,KAAKJ,WAElG,CAKA,MAAM4D,SAH8CxD,KAAKF,eAAe2D,2BAA2BzD,KAAKL,aAAcK,KAAKJ,aAG7E8D,MAAK9C,GAAUA,EAAO+C,SAAW/C,EAAO+C,QAAQC,OAAS,IAMvG,OALIJ,GAAsBA,EAAmBG,UACzCxD,EAAQ0D,SAAW1D,EAAQ0D,UAAY,GACvC1D,EAAQ0D,SAASF,QAAUH,EAAmBG,SAG3CX,CACX","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import{MSRooCodeInstaller}from"./MSRooCodeInstaller.js";import{ClineInstaller}from"./ClineInstaller.js";import{GithubCopilotInstaller}from"./GithubCopilotInstaller.js";import{VisualStudioInstaller}from"./VisualStudioInstaller.js";import{ClaudeCodeInstaller}from"./ClaudeCodeInstaller.js";import{SUPPORTED_CLIENTS}from"../../metadatas/constants.js";export class ClientInstallerFactory{static installerMap={[Object.keys(SUPPORTED_CLIENTS)[0]]:MSRooCodeInstaller,[Object.keys(SUPPORTED_CLIENTS)[1]]:ClineInstaller,[Object.keys(SUPPORTED_CLIENTS)[2]]:GithubCopilotInstaller,[Object.keys(SUPPORTED_CLIENTS)[3]]:ClaudeCodeInstaller,[Object.keys(SUPPORTED_CLIENTS)[4]]:VisualStudioInstaller};static getInstaller(t){if(!SUPPORTED_CLIENTS[t])return;const l=this.installerMap[t];return l?new l:void 0}static isClientSupported(t){return!!SUPPORTED_CLIENTS[t]}}
1
+ import{MSRooCodeInstaller}from"./MSRooCodeInstaller.js";import{ClineInstaller}from"./ClineInstaller.js";import{GithubCopilotInstaller}from"./GithubCopilotInstaller.js";import{VisualStudioInstaller}from"./VisualStudioInstaller.js";import{ClaudeCodeInstaller}from"./ClaudeCodeInstaller.js";import{SUPPORTED_CLIENTS}from"../../metadatas/constants.js";import{RooCodeInstaller}from"./RooCodeInstaller.js";export class ClientInstallerFactory{static installerMap=(()=>{const t={MSRooCode:MSRooCodeInstaller,RooCode:RooCodeInstaller,Cline:ClineInstaller,GithubCopilot:GithubCopilotInstaller,ClaudeCode:ClaudeCodeInstaller};return SUPPORTED_CLIENTS.VisualStudio&&(t.VisualStudio=VisualStudioInstaller),t})();static getInstaller(t){if(!SUPPORTED_CLIENTS[t])return;const l=this.installerMap[t];return l?new l:void 0}static isClientSupported(t){return!!SUPPORTED_CLIENTS[t]}}
2
2
  //# sourceMappingURL=ClientInstallerFactory.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["MSRooCodeInstaller","ClineInstaller","GithubCopilotInstaller","VisualStudioInstaller","ClaudeCodeInstaller","SUPPORTED_CLIENTS","ClientInstallerFactory","static","Object","keys","getInstaller","clientName","InstallerClass","this","installerMap","undefined","isClientSupported"],"sources":["../../../../src/core/installers/clients/ClientInstallerFactory.ts"],"mappings":"OAASA,uBAA0B,iCAC1BC,mBAAsB,6BACtBC,2BAA8B,qCAC9BC,0BAA6B,oCAC7BC,wBAA2B,kCAE3BC,sBAAyB,sCAM5B,MAAOC,uBACDC,oBAA8E,CAClF,CAACC,OAAOC,KAAKJ,mBAAmB,IAAKL,mBACrC,CAACQ,OAAOC,KAAKJ,mBAAmB,IAAKJ,eACrC,CAACO,OAAOC,KAAKJ,mBAAmB,IAAKH,uBACrC,CAACM,OAAOC,KAAKJ,mBAAmB,IAAKD,oBACrC,CAACI,OAAOC,KAAKJ,mBAAmB,IAAKF,uBAQzC,mBAAOO,CACHC,GAGA,IAAKN,kBAAkBM,GACnB,OAGJ,MAAMC,EAAiBC,KAAKC,aAAaH,GACzC,OAAOC,EAAiB,IAAIA,OAAmBG,CACnD,CAOA,wBAAOC,CAAkBL,GACrB,QAASN,kBAAkBM,EAC/B","ignoreList":[]}
1
+ {"version":3,"names":["MSRooCodeInstaller","ClineInstaller","GithubCopilotInstaller","VisualStudioInstaller","ClaudeCodeInstaller","SUPPORTED_CLIENTS","RooCodeInstaller","ClientInstallerFactory","static","map","MSRooCode","RooCode","Cline","GithubCopilot","ClaudeCode","VisualStudio","getInstaller","clientName","InstallerClass","this","installerMap","undefined","isClientSupported"],"sources":["../../../../src/core/installers/clients/ClientInstallerFactory.ts"],"mappings":"OAASA,uBAA0B,iCAC1BC,mBAAsB,6BACtBC,2BAA8B,qCAC9BC,0BAA6B,oCAC7BC,wBAA2B,kCAE3BC,sBAAyB,sCACzBC,qBAAwB,+BAM3B,MAAOC,uBACDC,oBAA8E,MAClF,MAAMC,EAAqD,CACvDC,UAAWV,mBACXW,QAASL,iBACTM,MAAOX,eACPY,cAAeX,uBACfY,WAAYV,qBAOhB,OAJIC,kBAAkBU,eAClBN,EAAIM,aAAeZ,uBAGhBM,CACV,EAdqF,GAqBtF,mBAAOO,CACHC,GAGA,IAAKZ,kBAAkBY,GACnB,OAGJ,MAAMC,EAAiBC,KAAKC,aAAaH,GACzC,OAAOC,EAAiB,IAAIA,OAAmBG,CACnD,CAOA,wBAAOC,CAAkBL,GACrB,QAASZ,kBAAkBY,EAC/B","ignoreList":[]}
@@ -0,0 +1,45 @@
1
+ import { BaseClientInstaller } from './BaseClientInstaller.js';
2
+ /**
3
+ * Codex client installer implementation
4
+ * Handles installation of Codex client and settings configuration in TOML format
5
+ * Based on: https://github.com/openai/codex/blob/main/docs/config.md#mcp-integration
6
+ */
7
+ export declare class CodexInstaller extends BaseClientInstaller {
8
+ protected readonly clientName: string;
9
+ /**
10
+ * Codex doesn't require VS Code or extension installation
11
+ * Override to skip VS Code checks
12
+ */
13
+ protected checkVSCodeAndInstallExtension(operationId: string): Promise<any>;
14
+ /**
15
+ * Update Codex settings (not VS Code)
16
+ * Override to configure Codex config.toml instead of VS Code settings
17
+ */
18
+ protected updateVSCodeSettings(serverName: string, installConfig: any): Promise<Array<{
19
+ success: boolean;
20
+ path: string;
21
+ error?: string;
22
+ }>>;
23
+ /**
24
+ * Initialize settings with Codex-specific structure
25
+ * Overrides base method to provide custom initialization
26
+ */
27
+ protected initializeSettings(settings: any): void;
28
+ /**
29
+ * Handle stdio mode configuration for Codex
30
+ * Overrides base method to provide custom stdio configuration in TOML format
31
+ */
32
+ protected handleStdioMode(settings: any, serverName: string, finalConfig: any): Promise<void>;
33
+ /**
34
+ * Handle SSE and Streamable-Http mode configuration for Codex
35
+ * Overrides base method to provide custom SSE or Streamable-Http configuration in TOML format
36
+ * Note: We don't call parent implementation as it uses JSON structure (mcpServers) instead of TOML (mcp_servers)
37
+ */
38
+ protected handleSseAndStreamableMode(settings: any, serverName: string, installConfig: any): Promise<void>;
39
+ /**
40
+ * Set up Codex client settings
41
+ * Updates Codex config.toml with MCP server configuration
42
+ * Note: Codex uses TOML format instead of JSON
43
+ */
44
+ setupClientSettings(settingPath: string, serverName: string, installConfig: any): Promise<void>;
45
+ }
@@ -0,0 +1,2 @@
1
+ import{BaseClientInstaller}from"./BaseClientInstaller.js";import{readTomlFile,writeTomlFile}from"../../../utils/tomlUtils.js";import{Logger}from"../../../utils/logger.js";import{SUPPORTED_CLIENTS}from"../../metadatas/constants.js";export class CodexInstaller extends BaseClientInstaller{clientName="Codex";async checkVSCodeAndInstallExtension(e){Logger.info("Codex is a standalone CLI tool, skipping VS Code check")}async updateVSCodeSettings(e,t){const s=[];try{const r=SUPPORTED_CLIENTS[this.clientName].codeSettingPath;await this.setupClientSettings(r,e,t),s.push({success:!0,path:r})}catch(e){s.push({success:!1,path:SUPPORTED_CLIENTS[this.clientName].codeSettingPath,error:e instanceof Error?e.message:String(e)})}return s}initializeSettings(e){e.mcp_servers||(e.mcp_servers={})}async handleStdioMode(e,t,s){s.args&&(s.args=s.args.map((e=>"string"==typeof e?e.replace(/\\/g,"/"):e)));const r={command:s.command};s.args&&s.args.length>0&&(r.args=s.args),s.env&&Object.keys(s.env).length>0&&(r.env=s.env),s.cwd&&(r.cwd=s.cwd),e.mcp_servers[t]=r}async handleSseAndStreamableMode(e,t,s){if(s.url){const r={url:s.url};s.bearerTokenEnvVar&&(r.bearer_token_env_var=s.bearerTokenEnvVar),s.httpHeaders&&Object.keys(s.httpHeaders).length>0&&(r.http_headers=s.httpHeaders),s.envHttpHeaders&&Object.keys(s.envHttpHeaders).length>0&&(r.env_http_headers=s.envHttpHeaders),e.mcp_servers[t]=r}}async setupClientSettings(e,t,s){try{const r=await readTomlFile(e,!0);this.initializeSettings(r),"stdio"===s.mode?await this.handleStdioMode(r,t,s):"sse"!==s.mode&&"streamable-http"!==s.mode||await this.handleSseAndStreamableMode(r,t,s),await writeTomlFile(e,r),Logger.info(`Successfully configured Codex MCP server: ${t}`)}catch(e){throw Logger.error(`Error setting up Codex client settings: ${e instanceof Error?e.message:String(e)}`),e}}}
2
+ //# sourceMappingURL=CodexInstaller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BaseClientInstaller","readTomlFile","writeTomlFile","Logger","SUPPORTED_CLIENTS","CodexInstaller","clientName","checkVSCodeAndInstallExtension","operationId","info","updateVSCodeSettings","serverName","installConfig","results","settingPath","this","codeSettingPath","setupClientSettings","push","success","path","error","Error","message","String","initializeSettings","settings","mcp_servers","handleStdioMode","finalConfig","args","map","arg","replace","serverConfig","command","length","env","Object","keys","cwd","handleSseAndStreamableMode","url","bearerTokenEnvVar","bearer_token_env_var","httpHeaders","http_headers","envHttpHeaders","env_http_headers","mode"],"sources":["../../../../src/core/installers/clients/CodexInstaller.ts"],"mappings":"OAASA,wBAA2B,kCAC3BC,aAAcC,kBAAqB,qCACnCC,WAAc,kCACdC,sBAAyB,sCAO5B,MAAOC,uBAAuBL,oBACbM,WAAqB,QAM9B,oCAAAC,CAAqCC,GAE3CL,OAAOM,KAAK,yDAEhB,CAMU,0BAAAC,CAA2BC,EAAoBC,GACrD,MAAMC,EAAqE,GAE3E,IACI,MAAMC,EAAcV,kBAAkBW,KAAKT,YAAYU,sBACjDD,KAAKE,oBAAoBH,EAAaH,EAAYC,GACxDC,EAAQK,KAAK,CAAEC,WAAeC,KAAMN,GACxC,CAAE,MAAOO,GACLR,EAAQK,KAAK,CACTC,WACAC,KAAMhB,kBAAkBW,KAAKT,YAAYU,gBACzCK,MAAOA,aAAiBC,MAAQD,EAAME,QAAUC,OAAOH,IAE/D,CAEA,OAAOR,CACX,CAMU,kBAAAY,CAAmBC,GACpBA,EAASC,cACVD,EAASC,YAAc,GAE/B,CAMU,qBAAAC,CAAsBF,EAAef,EAAoBkB,GAE3DA,EAAYC,OACZD,EAAYC,KAAOD,EAAYC,KAAKC,KAAKC,GACtB,iBAARA,EAAmBA,EAAIC,QAAQ,MAAO,KAAOD,KAK5D,MAAME,EAAoB,CACtBC,QAASN,EAAYM,SAIrBN,EAAYC,MAAQD,EAAYC,KAAKM,OAAS,IAC9CF,EAAaJ,KAAOD,EAAYC,MAIhCD,EAAYQ,KAAOC,OAAOC,KAAKV,EAAYQ,KAAKD,OAAS,IACzDF,EAAaG,IAAMR,EAAYQ,KAI/BR,EAAYW,MACZN,EAAaM,IAAMX,EAAYW,KAGnCd,EAASC,YAAYhB,GAAcuB,CACvC,CAOU,gCAAAO,CAAiCf,EAAef,EAAoBC,GAE1E,GAAIA,EAAc8B,IAAK,CACnB,MAAMR,EAAoB,CACtBQ,IAAK9B,EAAc8B,KAInB9B,EAAc+B,oBACdT,EAAaU,qBAAuBhC,EAAc+B,mBAIlD/B,EAAciC,aAAeP,OAAOC,KAAK3B,EAAciC,aAAaT,OAAS,IAC7EF,EAAaY,aAAelC,EAAciC,aAI1CjC,EAAcmC,gBAAkBT,OAAOC,KAAK3B,EAAcmC,gBAAgBX,OAAS,IACnFF,EAAac,iBAAmBpC,EAAcmC,gBAGlDrB,EAASC,YAAYhB,GAAcuB,CACvC,CACJ,CAOA,yBAAAjB,CAA0BH,EAAqBH,EAAoBC,GAC/D,IAEI,MAAMc,QAAiBzB,aAAaa,MAGpCC,KAAKU,mBAAmBC,GAGG,UAAvBd,EAAcqC,WACRlC,KAAKa,gBAAgBF,EAAUf,EAAYC,GACnB,QAAvBA,EAAcqC,MAAyC,oBAAvBrC,EAAcqC,YAC/ClC,KAAK0B,2BAA2Bf,EAAUf,EAAYC,SAI1DV,cAAcY,EAAaY,GACjCvB,OAAOM,KAAK,6CAA6CE,IAC7D,CAAE,MAAOU,GAEL,MADAlB,OAAOkB,MAAM,2CAA2CA,aAAiBC,MAAQD,EAAME,QAAUC,OAAOH,MAClGA,CACV,CACJ","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import{BaseClientInstaller}from"./BaseClientInstaller.js";import{readJsonFile,writeJsonFile}from"../../../utils/clientUtils.js";export class GithubCopilotInstaller extends BaseClientInstaller{clientName="GithubCopilot";initializeSettings(e){e.servers||(e.servers={}),e.inputs||(e.inputs=[])}setupSettings(e,t,s){e.servers[t]={url:s.url}}async handleStdioMode(e,t,s){s.args&&(s.args=s.args.map((e=>"string"==typeof e?e.replace(/\\/g,"/"):e))),e.servers[t]={command:s.command,args:s.args,env:s.env}}async setupClientSettings(e,t,s){const i=await readJsonFile(e,!0);this.initializeSettings(i),"stdio"===s.mode?await this.handleStdioMode(i,t,s):"sse"!==s.mode&&"streamable-http"!==s.mode||await this.handleSseAndStreamableMode(i,t,s),await writeJsonFile(e,i)}}
1
+ import{BaseClientInstaller}from"./BaseClientInstaller.js";import{readJsonFile,writeJsonFile}from"../../../utils/clientUtils.js";export class GithubCopilotInstaller extends BaseClientInstaller{clientName="GithubCopilot";initializeSettings(e){e.servers||(e.servers={}),e.inputs||(e.inputs=[])}setupSettings(e,s,t){e.servers[s]={url:t.url},this.applySourceEnv(e.servers[s],s)}async handleStdioMode(e,s,t){t.args&&(t.args=t.args.map((e=>"string"==typeof e?e.replace(/\\/g,"/"):e))),e.servers[s]={command:t.command,args:t.args,env:t.env},this.applySourceEnv(e.servers[s],s)}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&&"streamable-http"!==t.mode||await this.handleSseAndStreamableMode(i,s,t),await writeJsonFile(e,i)}}
2
2
  //# sourceMappingURL=GithubCopilotInstaller.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["BaseClientInstaller","readJsonFile","writeJsonFile","GithubCopilotInstaller","clientName","initializeSettings","settings","servers","inputs","setupSettings","serverName","installConfig","url","handleStdioMode","finalConfig","args","map","arg","replace","command","env","setupClientSettings","settingPath","this","mode","handleSseAndStreamableMode"],"sources":["../../../../src/core/installers/clients/GithubCopilotInstaller.ts"],"mappings":"OAASA,wBAA2B,kCAC3BC,aAAcC,kBAAqB,uCAMtC,MAAOC,+BAA+BH,oBACrBI,WAAqB,gBAO9B,kBAAAC,CAAmBC,GACpBA,EAASC,UACVD,EAASC,QAAU,IAElBD,EAASE,SACVF,EAASE,OAAS,GAE1B,CASU,aAAAC,CAAcH,EAAeI,EAAoBC,GACvDL,EAASC,QAAQG,GAAc,CAC3BE,IAAKD,EAAcC,IAE3B,CAMU,qBAAMC,CAAgBP,EAAeI,EAAoBI,GAC3DA,EAAYC,OACZD,EAAYC,KAAOD,EAAYC,KAAKC,KAAKC,GACtB,iBAARA,EAAmBA,EAAIC,QAAQ,MAAO,KAAOD,KAG5DX,EAASC,QAAQG,GAAc,CAC3BS,QAASL,EAAYK,QACrBJ,KAAMD,EAAYC,KAClBK,IAAKN,EAAYM,IAEzB,CAQA,yBAAMC,CAAoBC,EAAqBZ,EAAoBC,GAE/D,MAAML,QAAiBL,aAAaqB,GAAa,GAGjDC,KAAKlB,mBAAmBC,GAGG,UAAvBK,EAAca,WACRD,KAAKV,gBAAgBP,EAAUI,EAAYC,GACnB,QAAvBA,EAAca,MAAyC,oBAAvBb,EAAca,YAC/CD,KAAKE,2BAA2BnB,EAAUI,EAAYC,SAI1DT,cAAcoB,EAAahB,EACrC","ignoreList":[]}
1
+ {"version":3,"names":["BaseClientInstaller","readJsonFile","writeJsonFile","GithubCopilotInstaller","clientName","initializeSettings","settings","servers","inputs","setupSettings","serverName","installConfig","url","this","applySourceEnv","handleStdioMode","finalConfig","args","map","arg","replace","command","env","setupClientSettings","settingPath","mode","handleSseAndStreamableMode"],"sources":["../../../../src/core/installers/clients/GithubCopilotInstaller.ts"],"mappings":"OAASA,wBAA2B,kCAC3BC,aAAcC,kBAAqB,uCAMtC,MAAOC,+BAA+BH,oBACrBI,WAAqB,gBAO9B,kBAAAC,CAAmBC,GACpBA,EAASC,UACVD,EAASC,QAAU,IAElBD,EAASE,SACVF,EAASE,OAAS,GAE1B,CASU,aAAAC,CAAcH,EAAeI,EAAoBC,GACvDL,EAASC,QAAQG,GAAc,CAC3BE,IAAKD,EAAcC,KAEvBC,KAAKC,eAAeR,EAASC,QAAQG,GAAaA,EACtD,CAMU,qBAAMK,CAAgBT,EAAeI,EAAoBM,GAC3DA,EAAYC,OACZD,EAAYC,KAAOD,EAAYC,KAAKC,KAAKC,GACtB,iBAARA,EAAmBA,EAAIC,QAAQ,MAAO,KAAOD,KAG5Db,EAASC,QAAQG,GAAc,CAC3BW,QAASL,EAAYK,QACrBJ,KAAMD,EAAYC,KAClBK,IAAKN,EAAYM,KAErBT,KAAKC,eAAeR,EAASC,QAAQG,GAAaA,EACtD,CAQA,yBAAMa,CAAoBC,EAAqBd,EAAoBC,GAE/D,MAAML,QAAiBL,aAAauB,GAAa,GAGjDX,KAAKR,mBAAmBC,GAGG,UAAvBK,EAAcc,WACRZ,KAAKE,gBAAgBT,EAAUI,EAAYC,GACnB,QAAvBA,EAAcc,MAAyC,oBAAvBd,EAAcc,YAC/CZ,KAAKa,2BAA2BpB,EAAUI,EAAYC,SAI1DT,cAAcsB,EAAalB,EACrC","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ import { BaseClientInstaller } from './BaseClientInstaller.js';
2
+ /**
3
+ * RooCode client installer implementation
4
+ */
5
+ export declare class RooCodeInstaller extends BaseClientInstaller {
6
+ protected readonly clientName: string;
7
+ /**
8
+ * Set up RooCode client settings
9
+ */
10
+ setupClientSettings(settingPath: string, serverName: string, installConfig: any): Promise<void>;
11
+ }
@@ -0,0 +1,2 @@
1
+ import{BaseClientInstaller}from"./BaseClientInstaller.js";import{readJsonFile,writeJsonFile}from"../../../utils/clientUtils.js";export class RooCodeInstaller extends BaseClientInstaller{clientName="RooCode";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&&"streamable-http"!==i.mode||await this.handleSseAndStreamableMode(s,t,i);await writeJsonFile(e,s)}}
2
+ //# sourceMappingURL=RooCodeInstaller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BaseClientInstaller","readJsonFile","writeJsonFile","RooCodeInstaller","clientName","setupClientSettings","settingPath","serverName","installConfig","settings","this","initializeSettings","mode","finalConfig","handleWindowsNpx","handleStdioMode","handleSseAndStreamableMode"],"sources":["../../../../src/core/installers/clients/RooCodeInstaller.ts"],"mappings":"OAASA,wBAA2B,kCAC3BC,aAAcC,kBAAqB,uCAKtC,MAAOC,yBAAyBH,oBACfI,WAAqB,UAKxC,yBAAMC,CAAoBC,EAAqBC,EAAoBC,GAC/D,MAAMC,QAAiBR,aAAaK,GAAa,GAGjD,GAFAI,KAAKC,mBAAmBF,GAEG,UAAvBD,EAAcI,KAAkB,CAChC,MAAMC,QAAoBH,KAAKI,iBAAiBN,SAC1CE,KAAKK,gBAAgBN,EAAUF,EAAYM,EACrD,KAAkC,QAAvBL,EAAcI,MAAyC,oBAAvBJ,EAAcI,YAC/CF,KAAKM,2BAA2BP,EAAUF,EAAYC,SAG1DN,cAAcI,EAAaG,EACrC","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import{BaseClientInstaller}from"./BaseClientInstaller.js";import{Logger}from"../../../utils/logger.js";import fs from"fs/promises";import path from"path";import{SUPPORTED_CLIENTS}from"../../metadatas/constants.js";import{InstallOperationManager}from"../../loaders/InstallOperationManager.js";import*as RecordingConstants from"../../metadatas/recordingConstants.js";export class VisualStudioInstaller extends BaseClientInstaller{clientName="VisualStudio";async updateVSSettings(e,t){Logger.debug("Updating Visual Studio settings");const s=[];try{const a=SUPPORTED_CLIENTS[this.clientName].codeSettingPath;Logger.debug(`Attempting to update settings at: ${a}`),await this.setupClientSettings(a,e,t),s.push({success:!0,path:a}),Logger.debug("Successfully updated Visual Studio settings")}catch(e){const t=e instanceof Error?e.message:String(e);Logger.error("Failed to update Visual Studio settings:",e),s.push({success:!1,path:SUPPORTED_CLIENTS[this.clientName].codeSettingPath,error:t})}return s}async setupClientSettings(e,t,s){Logger.debug(`Setting up Visual Studio client settings at ${e}`);try{const a=path.dirname(e);await fs.mkdir(a,{recursive:!0});let i={};try{const t=await fs.readFile(e,"utf8");i=JSON.parse(t)}catch(e){Logger.debug("No existing settings file found, creating new one")}this.initializeSettings(i),t=t.replace(/-/g,"_"),"stdio"===s.mode?await this.handleStdioMode(i,t,s):"sse"!==s.mode&&"streamable-http"!==s.mode||this.handleSseAndStreamableMode(i,t,s),await fs.writeFile(e,JSON.stringify(i,null,2),"utf8"),Logger.debug(`Successfully updated Visual Studio settings at ${e}`)}catch(e){throw Logger.error("Failed to setup Visual Studio client settings:",e),e}}initializeSettings(e){e||(e={servers:{},inputs:[]}),e.inputs||(e.inputs=[]),e.servers||(e.servers={})}setupSettings(e,t,s){e.servers[t]={url:s.url}}async handleStdioMode(e,t,s){s.args&&(s.args=s.args.map((e=>"string"==typeof e?e.replace(/\\/g,"/"):e))),e.servers[t]={command:s.command,args:s.args,env:s.env}}async install(e,t,s){const a=this.generateOperationId(),i=InstallOperationManager.getInstance(s||e.name,e.name);return await i.recording((async()=>{const s=await i.recording((()=>this.setupInstallConfig(e,t)),{stepName:RecordingConstants.STEP_SETUP_INSTALLATION_CONFIG});e.mode&&(s.mode=e.mode);const n=await i.recording((()=>this.updateVSSettings(e.name,s)),{stepName:RecordingConstants.STEP_UPDATE_VS_SETTINGS,onResult:e=>e?.some((e=>e.success))}),r=n.some((e=>e.success)),o=n.filter((e=>e.success)).map((e=>e.path)),l=n.filter((e=>!e.success)).map((e=>e.error));return{status:r?"completed":"failed",type:"install",target:"server",message:r?`Successfully installed ${this.clientName} client. Updated settings in: ${o.join(", ")}`:`Failed to install ${this.clientName} client. Errors: ${l.join("; ")}`,operationId:a,error:r?void 0:l.join("; ")}}),{stepName:RecordingConstants.STEP_INSTALLATION,onResult:e=>"failed"!==e?.status,endMessage:e=>e?.message,onError:e=>{const t=`Unexpected error installing ${this.clientName} client: ${e instanceof Error?e.message:String(e)}`;return{result:{status:"failed",type:"install",target:"server",message:t,operationId:a,error:e instanceof Error?e.message:String(e)},message:t}}})}}
1
+ import{BaseClientInstaller}from"./BaseClientInstaller.js";import{Logger}from"../../../utils/logger.js";import fs from"fs/promises";import path from"path";import{SUPPORTED_CLIENTS}from"../../metadatas/constants.js";import{InstallOperationManager}from"../../loaders/InstallOperationManager.js";import*as RecordingConstants from"../../metadatas/recordingConstants.js";export class VisualStudioInstaller extends BaseClientInstaller{clientName="VisualStudio";async updateVSSettings(e,t){Logger.debug("Updating Visual Studio settings");const s=[];try{const a=SUPPORTED_CLIENTS[this.clientName].codeSettingPath;Logger.debug(`Attempting to update settings at: ${a}`),await this.setupClientSettings(a,e,t),s.push({success:!0,path:a}),Logger.debug("Successfully updated Visual Studio settings")}catch(e){const t=e instanceof Error?e.message:String(e);Logger.error("Failed to update Visual Studio settings:",e),s.push({success:!1,path:SUPPORTED_CLIENTS[this.clientName].codeSettingPath,error:t})}return s}async setupClientSettings(e,t,s){Logger.debug(`Setting up Visual Studio client settings at ${e}`);try{const a=path.dirname(e);await fs.mkdir(a,{recursive:!0});let i={};try{const t=await fs.readFile(e,"utf8");i=JSON.parse(t)}catch(e){Logger.debug("No existing settings file found, creating new one")}this.initializeSettings(i),t=t.replace(/-/g,"_"),"stdio"===s.mode?await this.handleStdioMode(i,t,s):"sse"!==s.mode&&"streamable-http"!==s.mode||this.handleSseAndStreamableMode(i,t,s),await fs.writeFile(e,JSON.stringify(i,null,2),"utf8"),Logger.debug(`Successfully updated Visual Studio settings at ${e}`)}catch(e){throw Logger.error("Failed to setup Visual Studio client settings:",e),e}}initializeSettings(e){e||(e={servers:{},inputs:[]}),e.inputs||(e.inputs=[]),e.servers||(e.servers={})}setupSettings(e,t,s){e.servers[t]={url:s.url},this.applySourceEnv(e.servers[t],t)}async handleStdioMode(e,t,s){s.args&&(s.args=s.args.map((e=>"string"==typeof e?e.replace(/\\/g,"/"):e))),e.servers[t]={command:s.command,args:s.args,env:s.env},this.applySourceEnv(e.servers[t],t)}async install(e,t,s){const a=this.generateOperationId(),i=InstallOperationManager.getInstance(s||e.name,e.name);return await i.recording((async()=>{const s=await i.recording((()=>this.setupInstallConfig(e,t)),{stepName:RecordingConstants.STEP_SETUP_INSTALLATION_CONFIG});e.mode&&(s.mode=e.mode);const r=await i.recording((()=>this.updateVSSettings(e.name,s)),{stepName:RecordingConstants.STEP_UPDATE_VS_SETTINGS,onResult:e=>e?.some((e=>e.success))}),n=r.some((e=>e.success)),o=r.filter((e=>e.success)).map((e=>e.path)),l=r.filter((e=>!e.success)).map((e=>e.error));return{status:n?"completed":"failed",type:"install",target:"server",message:n?`Successfully installed ${this.clientName} client. Updated settings in: ${o.join(", ")}`:`Failed to install ${this.clientName} client. Errors: ${l.join("; ")}`,operationId:a,error:n?void 0:l.join("; ")}}),{stepName:RecordingConstants.STEP_INSTALLATION,onResult:e=>"failed"!==e?.status,endMessage:e=>e?.message,onError:e=>{const t=`Unexpected error installing ${this.clientName} client: ${e instanceof Error?e.message:String(e)}`;return{result:{status:"failed",type:"install",target:"server",message:t,operationId:a,error:e instanceof Error?e.message:String(e)},message:t}}})}}
2
2
  //# sourceMappingURL=VisualStudioInstaller.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["BaseClientInstaller","Logger","fs","path","SUPPORTED_CLIENTS","InstallOperationManager","RecordingConstants","VisualStudioInstaller","clientName","updateVSSettings","serverName","installConfig","debug","results","settingPath","this","codeSettingPath","setupClientSettings","push","success","error","errorMessage","Error","message","String","settingsDir","dirname","mkdir","recursive","settings","existingContent","readFile","JSON","parse","initializeSettings","replace","mode","handleStdioMode","handleSseAndStreamableMode","writeFile","stringify","servers","inputs","setupSettings","url","finalConfig","args","map","arg","command","env","install","serverConfig","options","categoryName","operationId","generateOperationId","recorder","getInstance","name","recording","async","setupInstallConfig","stepName","STEP_SETUP_INSTALLATION_CONFIG","STEP_UPDATE_VS_SETTINGS","onResult","result","some","r","anySuccess","successPaths","filter","errors","status","type","target","join","undefined","STEP_INSTALLATION","endMessage","onError","errorMsg"],"sources":["../../../../src/core/installers/clients/VisualStudioInstaller.ts"],"mappings":"OAASA,wBAA2B,kCAC3BC,WAAc,kCAChBC,OAAQ,qBACRC,SAAU,cACRC,sBAAyB,sCAEzBC,4BAA+B,qDAC5BC,uBAAwB,+CAM9B,MAAOC,8BAA8BP,oBACpBQ,WAAqB,eAO9B,sBAAMC,CAAiBC,EAAoBC,GACjDV,OAAOW,MAAM,mCACb,MAAMC,EAAqE,GAE3E,IACI,MAAMC,EAAcV,kBAAkBW,KAAKP,YAAYQ,gBACvDf,OAAOW,MAAM,qC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ACId,SAAUzD,mBAAmByE,kBAC7Bb,SAAWC,GAA8B,WAAnBA,GAAQO,OAC9BM,WAAab,GAAYA,GAA4B5C,QACrD0D,QAAU7D,IACN,MAAM8D,EAAW,+BAA+BnE,KAAKP,sBAAsBY,aAAiBE,MAAQF,EAAMG,QAAUC,OAAOJ,KAC3H,MAAO,CACH+C,OAAQ,CACJO,OAAQ,SACRC,KAAM,UACNC,OAAQ,SACRrD,QAAS2D,EACT3B,cACAnC,MAAOA,aAAiBE,MAAQF,EAAMG,QAAUC,OAAOJ,IACxDG,QAAS2D,EACf,GAKjB","ignoreList":[]}
1
+ {"version":3,"names":["BaseClientInstaller","Logger","fs","path","SUPPORTED_CLIENTS","InstallOperationManager","RecordingConstants","VisualStudioInstaller","clientName","updateVSSettings","serverName","installConfig","debug","results","settingPath","this","codeSettingPath","setupClientSettings","push","success","error","errorMessage","Error","message","String","settingsDir","dirname","mkdir","recursive","settings","existingContent","readFile","JSON","parse","initializeSettings","replace","mode","handleStdioMode","handleSseAndStreamableMode","writeFile","stringify","servers","inputs","setupSettings","url","applySourceEnv","finalConfig","args","map","arg","command","env","install","serverConfig","options","categoryName","operationId","generateOperationId","recorder","getInstance","name","recording","async","setupInstallConfig","stepName","STEP_SETUP_INSTALLATION_CONFIG","STEP_UPDATE_VS_SETTINGS","onResult","result","some","r","anySuccess","successPaths","filter","errors","status","type","target","join","undefined","STEP_INSTALLATION","endMessage","onError","errorMsg"],"sources":["../../../../src/core/installers/clients/VisualStudioInstaller.ts"],"mappings":"OAASA,wBAA2B,kCAC3BC,WAAc,kCAChBC,OAAQ,qBACRC,SAAU,cACRC,sBAAyB,sCAEzBC,4BAA+B,qDAC5BC,uBAAwB,+CAM9B,MAAOC,8BAA8BP,oBACpBQ,WAAqB,eAO9B,sBAAMC,CAAiBC,EAAoBC,GACjDV,OAAOW,MAAM,mCACb,MAAMC,EAAqE,GAE3E,IACI,MAAMC,EAAcV,kBAAkBW,KAAKP,YAAYQ,gBACvDf,OAAO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BAAqB/D,KAAKP,8BAA8BkE,EAAOI,KAAK,QAOtEtB,cACApC,MAAOmD,OAAaQ,EAAYL,EAAOI,KAAK,MAC/C,GAEL,CACId,SAAU1D,mBAAmB0E,kBAC7Bb,SAAWC,GAA8B,WAAnBA,GAAQO,OAC9BM,WAAab,GAAYA,GAA4B7C,QACrD2D,QAAU9D,IACN,MAAM+D,EAAW,+BAA+BpE,KAAKP,sBAAsBY,aAAiBE,MAAQF,EAAMG,QAAUC,OAAOJ,KAC3H,MAAO,CACHgD,OAAQ,CACJO,OAAQ,SACRC,KAAM,UACNC,OAAQ,SACRtD,QAAS4D,EACT3B,cACApC,MAAOA,aAAiBE,MAAQF,EAAMG,QAAUC,OAAOJ,IACxDG,QAAS4D,EACf,GAKjB","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import fs from"fs/promises";import path from"path";import{LOCAL_FEEDS_DIR,SUPPORTED_CLIENTS}from"../metadatas/constants.js";import{Logger}from"../../utils/logger.js";import{readJsonFile}from"../../utils/clientUtils.js";export class ConfigurationLoader{static updateServerInstalledStatus(e,t,s){e.installedStatus||(e.installedStatus={}),e.installedStatus[t]=s}static removeClientStatus(e,t){e.installedStatus&&e.installedStatus[t]&&delete e.installedStatus[t]}static syncServerCategoriesWithClientSettings(e){return e.clientMCPSettings?(e.localServerCategories=e.localServerCategories.map((t=>{if(!t.installationStatus?.serversStatus)return t;const s={...t.installationStatus.serversStatus},a=e.clientMCPSettings;for(const[e,t]of Object.entries(a)){const a="GithubCopilot"===e||"VisualStudio"===e?t.servers||{}:t.mcpServers||{};Object.keys(s).forEach((t=>{const r="VisualStudio"===e?t.replace(/-/g,"_"):t;if(a[r]){if(!s[t].installedStatus[e]){const a={status:"completed",type:"install",target:"server",message:`Server ${t} is configured for client ${e}`};ConfigurationLoader.updateServerInstalledStatus(s[t],e,a)}}else ConfigurationLoader.removeClientStatus(s[t],e)}))}return{...t,installationStatus:{...t.installationStatus,serversStatus:s,lastUpdated:(new Date).toISOString()}}})),e):e}static initializeInstallationStatus(e){const t={},s={};if(e){if(e.requirements)for(const s of e.requirements)t[s.name]={name:s.name,type:s.type,installed:!1,version:s.version,error:void 0};if(e.mcpServers)for(const t of e.mcpServers)s[t.name]={name:t.name,error:void 0,installedStatus:{}}}return{requirementsStatus:t,serversStatus:s,lastUpdated:(new Date).toISOString()}}static async syncServerCategoriesWithFeeds(e){e.localServerCategories=e.localServerCategories.filter((t=>e.feeds[t.name])).map((t=>(t.feedConfiguration=e.feeds[t.name],t.installationStatus&&t.installationStatus.requirementsStatus&&0!==Object.keys(t.installationStatus.requirementsStatus).length&&t.installationStatus.serversStatus&&!(Object.keys(t.installationStatus.serversStatus).length<Object.keys(t.feedConfiguration?.mcpServers||[]).length)||(t.installationStatus=ConfigurationLoader.initializeInstallationStatus(t.feedConfiguration)),t)));const t=new Set(e.localServerCategories.map((e=>e.name)));for(const[s,a]of Object.entries(e.feeds))if(!t.has(s)){const t={name:s,displayName:a.displayName||s,type:"local",description:a.description||`Local MCP server category: ${s}`,installationStatus:ConfigurationLoader.initializeInstallationStatus(a),feedConfiguration:a};e.localServerCategories.push(t),console.log(`Created new local server entry for feed: ${s}`)}return e}static async loadFeedsIntoConfiguration(e,t,s){try{await fs.mkdir(LOCAL_FEEDS_DIR,{recursive:!0});const a={};if(t)try{const e=await fs.readFile(t,"utf8");let r=JSON.parse(e);r&&r.name&&(r.systemTags||(r.systemTags={}),r.systemTags.adhoc="true",s?.prLink&&(r.PullRequest=s.prLink),s?.adhocServers&&s.adhocServers.length>0&&r.mcpServers&&(r.mcpServers=r.mcpServers.map((e=>(s.adhocServers.includes(e.name)&&(e.systemTags||(e.systemTags={}),e.systemTags.adhoc="true"),e)))),a[r.name]=r,console.log(`Loaded and processed feed configuration from provided file: ${t}`))}catch(e){console.log(`Error loading feed configuration from provided file ${t}:`,e)}const r=(await fs.readdir(LOCAL_FEEDS_DIR)).filter((e=>e.endsWith(".json")));if(0===r.length&&!t)return console.log(`No feed configuration files found in ${LOCAL_FEEDS_DIR}`),e;for(const e of r)try{const t=path.join(LOCAL_FEEDS_DIR,e),s=await fs.readFile(t,"utf8"),r=JSON.parse(s);r&&r.name&&(a[r.name]?console.log(`Skipping local feed ${r.name} as it was provided via --feed-file`):a[r.name]=r)}catch(t){console.warn(`Error loading feed configuration from ${e}:`,t)}const o=Object.values(a);o.sort(((e,t)=>{const s=e.displayName||"",a=t.displayName||"";return s.localeCompare(a)}));const n={};for(const e of o)n[e.name]=e;return e.feeds=n,await ConfigurationLoader.syncServerCategoriesWithFeeds(e)}catch(e){throw console.error("Error loading feed configurations:",e),e}}static async loadClientMCPSettings(e){try{Logger.debug("Starting to load MCP client settings...");const t={};for(const[e,s]of Object.entries(SUPPORTED_CLIENTS)){const a=process.env.CODE_INSIDERS?s.codeInsiderSettingPath:s.codeSettingPath;try{let s=await readJsonFile(a,!0);"GithubCopilot"===e&&(s.servers||(s.servers={}),s.inputs||(s.inputs=[])),t[e]=s,Logger.debug(`Successfully loaded MCP settings for ${e}`)}catch(s){Logger.debug(`Warning: Could not load MCP settings for client ${e}: ${s instanceof Error?s.message:String(s)}`),t[e]={}}}return e.clientMCPSettings=t,ConfigurationLoader.syncServerCategoriesWithClientSettings(e)}catch(e){throw Logger.error("Error loading client MCP settings:",e),e}}}
1
+ import fs from"fs/promises";import path from"path";import{LOCAL_FEEDS_DIR,SUPPORTED_CLIENTS}from"../metadatas/constants.js";import{Logger}from"../../utils/logger.js";import{readJsonFile}from"../../utils/clientUtils.js";export class ConfigurationLoader{static updateServerInstalledStatus(e,t,r){e.installedStatus||(e.installedStatus={}),e.installedStatus[t]=r}static removeClientStatus(e,t){e.installedStatus&&e.installedStatus[t]&&delete e.installedStatus[t]}static syncServerCategoriesWithClientSettings(e){return e.clientMCPSettings?(e.localServerCategories=e.localServerCategories.map((t=>{if(!t.installationStatus?.serversStatus)return t;const r={...t.installationStatus.serversStatus},s=e.clientMCPSettings;for(const[e,t]of Object.entries(s)){const s="GithubCopilot"===e||"VisualStudio"===e?t.servers||{}:t.mcpServers||{};Object.keys(r).forEach((t=>{const a="VisualStudio"===e?t.replace(/-/g,"_"):t;if(s[a]){if(!r[t].installedStatus[e]){const s={status:"completed",type:"install",target:"server",message:`Server ${t} is configured for client ${e}`};ConfigurationLoader.updateServerInstalledStatus(r[t],e,s)}}else ConfigurationLoader.removeClientStatus(r[t],e)}))}return{...t,installationStatus:{...t.installationStatus,serversStatus:r,lastUpdated:(new Date).toISOString()}}})),e):e}static initializeInstallationStatus(e){const t={},r={};if(e){if(e.requirements)for(const r of e.requirements)t[r.name]={name:r.name,type:r.type,installed:!1,version:r.version,error:void 0};if(e.mcpServers)for(const t of e.mcpServers)r[t.name]={name:t.name,error:void 0,installedStatus:{}}}return{requirementsStatus:t,serversStatus:r,lastUpdated:(new Date).toISOString()}}static async syncServerCategoriesWithFeeds(e){e.localServerCategories=e.localServerCategories.filter((t=>e.feeds[t.name])).map((t=>(t.feedConfiguration=e.feeds[t.name],t.installationStatus&&t.installationStatus.requirementsStatus&&0!==Object.keys(t.installationStatus.requirementsStatus).length&&t.installationStatus.serversStatus&&!(Object.keys(t.installationStatus.serversStatus).length<Object.keys(t.feedConfiguration?.mcpServers||[]).length)||(t.installationStatus=ConfigurationLoader.initializeInstallationStatus(t.feedConfiguration)),t)));const t=new Set(e.localServerCategories.map((e=>e.name)));for(const[r,s]of Object.entries(e.feeds))if(!t.has(r)){const t={name:r,displayName:s.displayName||r,type:"local",description:s.description||`Local MCP server category: ${r}`,installationStatus:ConfigurationLoader.initializeInstallationStatus(s),feedConfiguration:s};e.localServerCategories.push(t),Logger.debug(`Created new local server entry for feed: ${r}`)}return e}static async loadFeedsIntoConfiguration(e,t,r){try{await fs.mkdir(LOCAL_FEEDS_DIR,{recursive:!0});const s={};if(t)try{const e=await fs.readFile(t,"utf8");let a=JSON.parse(e);a&&a.name&&(a.systemTags||(a.systemTags={}),a.systemTags.adhoc="true",r?.prLink&&(a.PullRequest=r.prLink),r?.adhocServers&&r.adhocServers.length>0&&a.mcpServers&&(a.mcpServers=a.mcpServers.map((e=>(r.adhocServers.includes(e.name)&&(e.systemTags||(e.systemTags={}),e.systemTags.adhoc="true"),e)))),s[a.name]=a,Logger.log(`Loaded and processed feed configuration from provided file: ${t}`))}catch(e){Logger.error(`Error loading feed configuration from provided file ${t}:`,e)}const a=(await fs.readdir(LOCAL_FEEDS_DIR)).filter((e=>e.endsWith(".json")));if(0===a.length&&!t)return Logger.log(`No feed configuration files found in ${LOCAL_FEEDS_DIR}`),e;for(const e of a)try{const t=path.join(LOCAL_FEEDS_DIR,e),r=await fs.readFile(t,"utf8"),a=JSON.parse(r);a&&a.name&&(s[a.name]?Logger.log(`Skipping local feed ${a.name} as it was provided via --feed-file`):s[a.name]=a)}catch(t){Logger.warn(`Error loading feed configuration from ${e}: ${t instanceof Error?t.message:String(t)}`)}const i=Object.values(s);i.sort(((e,t)=>{const r=e.displayName||"",s=t.displayName||"";return r.localeCompare(s)}));const n={};for(const e of i)n[e.name]=e;return e.feeds=n,await ConfigurationLoader.syncServerCategoriesWithFeeds(e)}catch(e){throw Logger.error("Error loading feed configurations:",e),e}}static async loadClientMCPSettings(e){try{Logger.debug("Starting to load MCP client settings...");const t={};for(const[e,r]of Object.entries(SUPPORTED_CLIENTS)){const s=process.env.CODE_INSIDERS?r.codeInsiderSettingPath:r.codeSettingPath;try{let r=await readJsonFile(s,!0);"GithubCopilot"===e&&(r.servers||(r.servers={}),r.inputs||(r.inputs=[])),t[e]=r,Logger.debug(`Successfully loaded MCP settings for ${e}`)}catch(r){Logger.debug(`Warning: Could not load MCP settings for client ${e}: ${r instanceof Error?r.message:String(r)}`),t[e]={}}}return e.clientMCPSettings=t,ConfigurationLoader.syncServerCategoriesWithClientSettings(e)}catch(e){throw Logger.error("Error loading client MCP settings:",e),e}}}
2
2
  //# sourceMappingURL=ConfigurationLoader.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["fs","path","LOCAL_FEEDS_DIR","SUPPORTED_CLIENTS","Logger","readJsonFile","ConfigurationLoader","updateServerInstalledStatus","serverStatus","clientName","operationStatus","installedStatus","removeClientStatus","syncServerCategoriesWithClientSettings","configuration","clientMCPSettings","localServerCategories","map","category","installationStatus","serversStatus","updatedServerStatus","clientSettings","settings","Object","entries","clientServers","servers","mcpServers","keys","forEach","serverName","checkServerName","replace","status","type","target","message","lastUpdated","Date","toISOString","initializeInstallationStatus","feedConfig","requirementsStatus","requirements","req","name","installed","version","error","undefined","mcp","syncServerCategoriesWithFeeds","filter","server","feeds","feedConfiguration","length","existingServerNames","Set","feedName","has","newServerCategory","displayName","description","push","console","log","loadFeedsIntoConfiguration","feedFile","mkdir","recursive","content","readFile","config","JSON","parse","systemTags","prLink","PullRequest","adhocServers","includes","jsonFiles","readdir","file","endsWith","filePath","join","warn","feedValues","values","sort","a","b","displayNameA","displayNameB","localeCompare","sortedFeeds","loadClientMCPSettings","debug","settingPath","process","env","CODE_INSIDERS","codeInsiderSettingPath","codeSettingPath","inputs","Error","String"],"sources":["../../../src/core/loaders/ConfigurationLoader.ts"],"mappings":"OAAOA,OAAQ,qBACRC,SAAU,cACRC,gBAAiBC,sBAAyB,mCAC1CC,WAAc,+BACdC,iBAAoB,oCAWvB,MAAOC,oBAID,kCAAOC,CACXC,EACAC,EACAC,GAEKF,EAAaG,kBACdH,EAAaG,gBAAkB,IAEnCH,EAAaG,gBAAgBF,GAAcC,CAC/C,CAKQ,yBAAOE,CACXJ,EACAC,GAEID,EAAaG,iBAAmBH,EAAaG,gBAAgBF,WACtDD,EAAaG,gBAAgBF,EAE5C,CAMA,6CAAOI,CAAuCC,GAC1C,OAAKA,EAAcC,mBAInBD,EAAcE,sBAAwBF,EAAcE,sBAAsBC,KAAIC,IAC1E,IAAKA,EAASC,oBAAoBC,cAC9B,OAAOF,EAGX,MAAMG,EAAsB,IAAKH,EAASC,mBAAmBC,eACvDE,EAAiBR,EAAcC,kBAErC,IAAK,MAAON,EAAYc,KAAaC,OAAOC,QAAQH,GAAiB,CAEjE,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AMiG,EAAcC,QAAQC,IAAIC,cAC1BjF,EAAekF,uBACflF,EAAemF,gBACrB,IACI,IAAIjC,QAAgBnE,aAAa+F,GAAa,GAE3B,kBAAf3F,IAEK+D,EAAQ7C,UACT6C,EAAQ7C,QAAU,IAEjB6C,EAAQkC,SACTlC,EAAQkC,OAAS,KAGzBnF,EAASd,GAAc+D,EACvBpE,OAAO+F,MAAM,wCAAwC1F,IACzD,CAAE,MAAOwC,GACL7C,OAAO+F,MAAM,mDAAmD1F,MAAewC,aAAiB0D,MAAQ1D,EAAMZ,QAAUuE,OAAO3D,MAC/H1B,EAASd,GAAc,EAC3B,CACJ,CAGA,OADAK,EAAcC,kBAAoBQ,EAC3BjB,oBAAoBO,uCAAuCC,EACtE,CAAE,MAAOmC,GAEL,MADA7C,OAAO6C,MAAM,qCAAsCA,GAC7CA,CACV,CACJ","ignoreList":[]}
1
+ {"version":3,"names":["fs","path","LOCAL_FEEDS_DIR","SUPPORTED_CLIENTS","Logger","readJsonFile","ConfigurationLoader","updateServerInstalledStatus","serverStatus","clientName","operationStatus","installedStatus","removeClientStatus","syncServerCategoriesWithClientSettings","configuration","clientMCPSettings","localServerCategories","map","category","installationStatus","serversStatus","updatedServerStatus","clientSettings","settings","Object","entries","clientServers","servers","mcpServers","keys","forEach","serverName","checkServerName","replace","status","type","target","message","lastUpdated","Date","toISOString","initializeInstallationStatus","feedConfig","requirementsStatus","requirements","req","name","installed","version","error","undefined","mcp","syncServerCategoriesWithFeeds","filter","server","feeds","feedConfiguration","length","existingServerNames","Set","feedName","has","newServerCategory","displayName","description","push","debug","loadFeedsIntoConfiguration","feedFile","mkdir","recursive","content","readFile","config","JSON","parse","systemTags","prLink","PullRequest","adhocServers","includes","log","jsonFiles","readdir","file","endsWith","filePath","join","warn","Error","String","feedValues","values","sort","a","b","displayNameA","displayNameB","localeCompare","sortedFeeds","loadClientMCPSettings","settingPath","process","env","CODE_INSIDERS","codeInsiderSettingPath","codeSettingPath","inputs"],"sources":["../../../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igurationProvider {
27
27
  updateServerStatus(categoryName: string, serverName: string, status: MCPServerStatus): Promise<boolean>;
28
28
  updateServerOperationStatus(categoryName: string, serverName: string, clientName: string, operationStatus: OperationStatus): Promise<boolean>;
29
29
  isRequirementsReady(categoryName: string, serverName: string): Promise<boolean>;
30
+ markRequirementsForReinstall(categoryName: string, serverName: string): Promise<void>;
30
31
  GetServerRequirementStatus(categoryName: string, serverName: string): Promise<RequirementStatus[]>;
31
32
  isServerReady(categoryName: string, serverName: string, clients: string[]): Promise<boolean>;
32
33
  syncFeeds(repo?: string, branch?: string): Promise<void>;
@@ -1,2 +1,2 @@
1
- import fs from"fs/promises";import path from"path";import{exec}from"child_process";import{promisify}from"util";import{fileURLToPath}from"url";import{GITHUB_REPO,LOCAL_FEEDS_DIR,SETTINGS_DIR,SUPPORTED_CLIENTS}from"../metadatas/constants.js";import{Logger}from"../../utils/logger.js";import{checkGithubAuth}from"../../utils/githubAuth.js";import{ConfigurationLoader}from"./ConfigurationLoader.js";const execAsync=promisify(exec),__dirname=path.dirname(fileURLToPath(import.meta.url));export class ConfigurationProvider{static instance;configPath;configuration;configLock=Promise.resolve();tempDir;constructor(){this.configPath=path.join(SETTINGS_DIR,"configurations.json"),this.configuration={localServerCategories:[],feeds:{},clientMCPSettings:{}},this.tempDir=path.join(LOCAL_FEEDS_DIR,"../temp")}static getInstance(){return ConfigurationProvider.instance||(ConfigurationProvider.instance=new ConfigurationProvider),ConfigurationProvider.instance}async withLock(t){const e=this.configLock;let i;this.configLock=new Promise((t=>i=t));try{return await e,await t()}finally{i()}}async initialize(t,e){await this.withLock((async()=>{const i=path.dirname(this.configPath);await fs.mkdir(i,{recursive:!0});try{await fs.rm(this.configPath,{recursive:!0,force:!0})}catch(t){if("ENOENT"!==t.code)throw t}try{try{const t=JSON.parse(await fs.readFile(this.configPath,"utf8"));this.configuration=t}catch(t){if("ENOENT"!==t.code)throw t;await this.saveConfiguration()}await this.loadFeedsIntoConfiguration(t,e),await this.loadClientMCPSettings()}catch(t){throw Logger.error("Error during initialization",t),t}}))}async saveConfiguration(){const t=path.dirname(this.configPath);await fs.mkdir(t,{recursive:!0}),await fs.writeFile(this.configPath,JSON.stringify(this.configuration,null,2))}async getServerCategories(){return await this.withLock((async()=>this.configuration.localServerCategories))}async getServerCategory(t){return await this.withLock((async()=>this.configuration.localServerCategories.find((e=>e.name===t))))}async getClientMcpSettings(){return await this.withLock((async()=>this.configuration.clientMCPSettings))}async getFeedConfiguration(t){return await this.withLock((async()=>this.configuration.feeds[t]))}async getServerMcpConfig(t,e){return await this.withLock((async()=>this.configuration.feeds[t]?.mcpServers.find((t=>t.name===e))))}async getInstallationStatus(t){return await this.withLock((async()=>{const e=this.configuration.localServerCategories.find((e=>e.name===t));return e?.installationStatus}))}async getServerStatus(t,e){return await this.withLock((async()=>{const i=this.configuration.localServerCategories.find((e=>e.name===t)),a=i?.installationStatus;return a?.serversStatus[e]}))}async getRequirementStatus(t,e){return await this.withLock((async()=>{const i=this.configuration.localServerCategories.find((e=>e.name===t)),a=i?.installationStatus;return a?.requirementsStatus[e]}))}async updateInstallationStatus(t,e,i){return await this.withLock((async()=>{const a=this.configuration.localServerCategories.find((e=>e.name===t));return!!a&&(a.installationStatus||(a.installationStatus={requirementsStatus:{},serversStatus:{},lastUpdated:(new Date).toISOString()}),a.installationStatus.requirementsStatus={...a.installationStatus.requirementsStatus,...e},a.installationStatus.serversStatus={...a.installationStatus.serversStatus,...i},a.installationStatus.lastUpdated=(new Date).toISOString(),await this.saveConfiguration(),!0)}))}async updateRequirementStatus(t,e,i){return await this.withLock((async()=>{const a=this.configuration.localServerCategories.find((e=>e.name===t));return!!a?.installationStatus&&(a.installationStatus.requirementsStatus[e]=i,a.installationStatus.lastUpdated=(new Date).toISOString(),await this.saveConfiguration(),!0)}))}async updateRequirementOperationStatus(t,e,i){return await this.withLock((async()=>{const a=this.configuration.localServerCategories.find((e=>e.name===t));return!!a?.installationStatus?.requirementsStatus[e]&&(a.installationStatus.requirementsStatus[e].operationStatus=i,a.installationStatus.lastUpdated=(new Date).toISOString(),await this.saveConfiguration(),!0)}))}async updateServerStatus(t,e,i){return await this.withLock((async()=>{const a=this.configuration.localServerCategories.find((e=>e.name===t));return!!a?.installationStatus&&(a.installationStatus.serversStatus[e]=i,a.installationStatus.lastUpdated=(new Date).toISOString(),await this.saveConfiguration(),!0)}))}async updateServerOperationStatus(t,e,i,a){return await this.withLock((async()=>{const r=this.configuration.localServerCategories.find((e=>e.name===t));return!!r?.installationStatus?.serversStatus[e]&&(r.installationStatus.serversStatus[e].installedStatus[i]=a,r.installationStatus.lastUpdated=(new Date).toISOString(),await this.saveConfiguration(),!0)}))}async isRequirementsReady(t,e){return await this.withLock((async()=>{const i=this.configuration.localServerCategories.find((e=>e.name===t));if(!i?.feedConfiguration)return!1;const a=i.feedConfiguration.mcpServers.find((t=>t.name===e));if(!a?.dependencies?.requirements)return!0;const r=a.dependencies.requirements.map((t=>t.name)),n=i?.installationStatus;return!!n?.requirementsStatus&&r.every((t=>{const e=n.requirementsStatus[t];return e?.installed&&!e?.error}))}))}async GetServerRequirementStatus(t,e){return await this.withLock((async()=>{const i=this.configuration.localServerCategories.find((e=>e.name===t));if(!i?.feedConfiguration)return[];const a=i.feedConfiguration.mcpServers.find((t=>t.name===e));if(!a?.dependencies?.requirements)return[];return a.dependencies.requirements.map((t=>t.name)).map((t=>i?.installationStatus?.requirementsStatus[t])).filter((t=>void 0!==t))}))}async isServerReady(t,e,i){return await this.withLock((async()=>{const a=this.configuration.localServerCategories.find((e=>e.name===t)),r=a?.installationStatus,n=r?.serversStatus[e];return!!n&&i.every((t=>{const e=n.installedStatus?.[t];return"completed"===e?.status&&!e?.error}))}))}async syncFeeds(t,e){return await this.withLock((async()=>{Logger.log("Starting feed synchronization...");try{await checkGithubAuth(),Logger.debug({action:"create_directories",paths:{localFeeds:LOCAL_FEEDS_DIR,tempDir:this.tempDir}}),await fs.mkdir(LOCAL_FEEDS_DIR,{recursive:!0}),await fs.mkdir(this.tempDir,{recursive:!0}),await fs.rm(this.tempDir,{recursive:!0,force:!0});const i=t||GITHUB_REPO.url,a=e||"main";if(t||e){Logger.debug(`Using git clone with repository ${i} and branch ${a}`);const{cloneGitRepository:t}=await import("../../utils/gitUtils.js"),e=path.join(this.tempDir,"repo-clone");await t(i,a,e);const r=path.join(e,GITHUB_REPO.feedsPath);Logger.debug("Updating local feeds from git clone..."),await fs.rm(LOCAL_FEEDS_DIR,{recursive:!0,force:!0});try{await fs.access(r)}catch(t){throw new Error(`Could not find feeds directory in cloned repository: ${r}`)}await fs.cp(r,LOCAL_FEEDS_DIR,{recursive:!0,force:!0}),Logger.log("Successfully updated local feeds from git repository")}else{Logger.debug("Downloading latest release...");const{downloadGithubRelease:t}=await import("../../utils/githubUtils.js"),{version:e,downloadPath:i}=await t(GITHUB_REPO.repoName,"latest",GITHUB_REPO.feedAssetsName,void 0,!0,this.tempDir);Logger.debug({action:"download_release",downloadPath:i,version:e,repoName:GITHUB_REPO.repoName}),Logger.debug("Updating local feeds..."),await fs.rm(LOCAL_FEEDS_DIR,{recursive:!0,force:!0});const a=i;try{await fs.access(i)}catch(t){throw new Error(`Could not find feeds directory in downloaded path: ${a}`)}await fs.cp(a,LOCAL_FEEDS_DIR,{recursive:!0,force:!0}),Logger.log("Successfully updated local feeds")}}catch(t){throw Logger.error("Error during feed synchronization",t),new Error("Failed to sync feeds. Use --verbose for detailed error information.")}}))}async loadFeedsIntoConfiguration(t,e){this.configuration=await ConfigurationLoader.loadFeedsIntoConfiguration(this.configuration,t,e),await this.saveConfiguration()}async loadClientMCPSettings(){this.configuration=await ConfigurationLoader.loadClientMCPSettings(this.configuration),await this.saveConfiguration()}async reloadClientMCPSettings(){return await this.withLock((async()=>{await this.loadClientMCPSettings()}))}async removeServerFromClientMCPSettings(t,e){return await this.withLock((async()=>{const{readJsonFile:i,writeJsonFile:a}=await import("../../utils/clientUtils.js"),r=Object.entries(SUPPORTED_CLIENTS),n=e?r.filter((([t])=>t===e)):r;for(const[e,r]of n){const n=process.env.CODE_INSIDERS?r.codeInsiderSettingPath:r.codeSettingPath;try{const r=await i(n,!0);let s=!1;if("GithubCopilot"===e)r.servers?.[t]&&(delete r.servers[t],s=!0);else if("VisualStudio"===e){const e=t.replace(/-/g,"_");r.servers?.[e]&&(delete r.servers[e],s=!0)}else r.mcpServers?.[t]&&(delete r.mcpServers[t],s=!0);s&&(await a(n,r),Logger.debug(`Removed server ${t} from client ${e} settings`))}catch(i){Logger.error(`Failed to remove server ${t} from client ${e} settings:`,i)}}if(this.configuration.clientMCPSettings){if(e){const i=this.configuration.clientMCPSettings[e];i&&(i.mcpServers?.[t]&&delete i.mcpServers[t],i.servers?.[t]&&delete i.servers[t])}else for(const e of Object.values(this.configuration.clientMCPSettings))e.mcpServers?.[t]&&delete e.mcpServers[t],e.servers?.[t]&&delete e.servers[t];await this.saveConfiguration()}}))}}export const configProvider=ConfigurationProvider.getInstance();
1
+ import fs from"fs/promises";import path from"path";import{exec}from"child_process";import{promisify}from"util";import{fileURLToPath}from"url";import{GITHUB_REPO,LOCAL_FEEDS_DIR,SETTINGS_DIR,SUPPORTED_CLIENTS}from"../metadatas/constants.js";import{Logger}from"../../utils/logger.js";import{checkGithubAuth}from"../../utils/githubAuth.js";import{ConfigurationLoader}from"./ConfigurationLoader.js";const execAsync=promisify(exec),__dirname=path.dirname(fileURLToPath(import.meta.url));export class ConfigurationProvider{static instance;configPath;configuration;configLock=Promise.resolve();tempDir;constructor(){this.configPath=path.join(SETTINGS_DIR,"configurations.json"),this.configuration={localServerCategories:[],feeds:{},clientMCPSettings:{}},this.tempDir=path.join(LOCAL_FEEDS_DIR,"../temp")}static getInstance(){return ConfigurationProvider.instance||(ConfigurationProvider.instance=new ConfigurationProvider),ConfigurationProvider.instance}async withLock(t){const e=this.configLock;let i;this.configLock=new Promise((t=>i=t));try{return await e,await t()}finally{i()}}async initialize(t,e){await this.withLock((async()=>{const i=path.dirname(this.configPath);await fs.mkdir(i,{recursive:!0});try{await fs.rm(this.configPath,{recursive:!0,force:!0})}catch(t){if("ENOENT"!==t.code)throw t}try{try{const t=JSON.parse(await fs.readFile(this.configPath,"utf8"));this.configuration=t}catch(t){if("ENOENT"!==t.code)throw t;await this.saveConfiguration()}await this.loadFeedsIntoConfiguration(t,e),await this.loadClientMCPSettings()}catch(t){throw Logger.error("Error during initialization",t),t}}))}async saveConfiguration(){const t=path.dirname(this.configPath);await fs.mkdir(t,{recursive:!0}),await fs.writeFile(this.configPath,JSON.stringify(this.configuration,null,2))}async getServerCategories(){return await this.withLock((async()=>this.configuration.localServerCategories))}async getServerCategory(t){return await this.withLock((async()=>this.configuration.localServerCategories.find((e=>e.name===t))))}async getClientMcpSettings(){return await this.withLock((async()=>this.configuration.clientMCPSettings))}async getFeedConfiguration(t){return await this.withLock((async()=>this.configuration.feeds[t]))}async getServerMcpConfig(t,e){return await this.withLock((async()=>this.configuration.feeds[t]?.mcpServers.find((t=>t.name===e))))}async getInstallationStatus(t){return await this.withLock((async()=>{const e=this.configuration.localServerCategories.find((e=>e.name===t));return e?.installationStatus}))}async getServerStatus(t,e){return await this.withLock((async()=>{const i=this.configuration.localServerCategories.find((e=>e.name===t)),a=i?.installationStatus;return a?.serversStatus[e]}))}async getRequirementStatus(t,e){return await this.withLock((async()=>{const i=this.configuration.localServerCategories.find((e=>e.name===t)),a=i?.installationStatus;return a?.requirementsStatus[e]}))}async updateInstallationStatus(t,e,i){return await this.withLock((async()=>{const a=this.configuration.localServerCategories.find((e=>e.name===t));return!!a&&(a.installationStatus||(a.installationStatus={requirementsStatus:{},serversStatus:{},lastUpdated:(new Date).toISOString()}),a.installationStatus.requirementsStatus={...a.installationStatus.requirementsStatus,...e},a.installationStatus.serversStatus={...a.installationStatus.serversStatus,...i},a.installationStatus.lastUpdated=(new Date).toISOString(),await this.saveConfiguration(),!0)}))}async updateRequirementStatus(t,e,i){return await this.withLock((async()=>{const a=this.configuration.localServerCategories.find((e=>e.name===t));return!!a?.installationStatus&&(a.installationStatus.requirementsStatus[e]=i,a.installationStatus.lastUpdated=(new Date).toISOString(),await this.saveConfiguration(),!0)}))}async updateRequirementOperationStatus(t,e,i){return await this.withLock((async()=>{const a=this.configuration.localServerCategories.find((e=>e.name===t));return!!a?.installationStatus?.requirementsStatus[e]&&(a.installationStatus.requirementsStatus[e].operationStatus=i,a.installationStatus.lastUpdated=(new Date).toISOString(),await this.saveConfiguration(),!0)}))}async updateServerStatus(t,e,i){return await this.withLock((async()=>{const a=this.configuration.localServerCategories.find((e=>e.name===t));return!!a?.installationStatus&&(a.installationStatus.serversStatus[e]=i,a.installationStatus.lastUpdated=(new Date).toISOString(),await this.saveConfiguration(),!0)}))}async updateServerOperationStatus(t,e,i,a){return await this.withLock((async()=>{const n=this.configuration.localServerCategories.find((e=>e.name===t));return!!n?.installationStatus?.serversStatus[e]&&(n.installationStatus.serversStatus[e].installedStatus[i]=a,n.installationStatus.lastUpdated=(new Date).toISOString(),await this.saveConfiguration(),!0)}))}async isRequirementsReady(t,e){return await this.withLock((async()=>{const i=this.configuration.localServerCategories.find((e=>e.name===t));if(!i?.feedConfiguration)return!1;const a=i.feedConfiguration.mcpServers.find((t=>t.name===e));if(!a?.dependencies?.requirements)return!0;const n=a.dependencies.requirements.map((t=>t.name)),r=i?.installationStatus;return!!r?.requirementsStatus&&n.every((t=>{const e=r.requirementsStatus[t];return e?.installed&&!e?.error}))}))}async markRequirementsForReinstall(t,e){await this.withLock((async()=>{const i=this.configuration.localServerCategories.find((e=>e.name===t));if(!i)return;if(!i.feedConfiguration)return;const a=i.feedConfiguration.mcpServers.find((t=>t.name===e));if(!a?.dependencies?.requirements||0===a.dependencies.requirements.length)return;i.installationStatus||(i.installationStatus={requirementsStatus:{},serversStatus:{},lastUpdated:(new Date).toISOString()});const n=i.installationStatus.requirementsStatus||{};for(const t of a.dependencies.requirements){const e=n[t.name];n[t.name]={name:t.name,type:e?.type||"unknown",installed:!1,inProgress:!1,version:t?.version||e?.version,error:void 0,availableUpdate:e?.availableUpdate,lastCheckTime:e?.lastCheckTime,operationStatus:void 0,pythonEnv:e?.pythonEnv,npmPath:e?.npmPath}}i.installationStatus.requirementsStatus=n,i.installationStatus.lastUpdated=(new Date).toISOString(),await this.saveConfiguration()}))}async GetServerRequirementStatus(t,e){return await this.withLock((async()=>{const i=this.configuration.localServerCategories.find((e=>e.name===t));if(!i?.feedConfiguration)return[];const a=i.feedConfiguration.mcpServers.find((t=>t.name===e));if(!a?.dependencies?.requirements)return[];return a.dependencies.requirements.map((t=>t.name)).map((t=>i?.installationStatus?.requirementsStatus[t])).filter((t=>void 0!==t))}))}async isServerReady(t,e,i){return await this.withLock((async()=>{const a=this.configuration.localServerCategories.find((e=>e.name===t)),n=a?.installationStatus,r=n?.serversStatus[e];return!!r&&i.every((t=>{const e=r.installedStatus?.[t];return"completed"===e?.status&&!e?.error}))}))}async syncFeeds(t,e){return await this.withLock((async()=>{Logger.log("Starting feed synchronization...");try{await checkGithubAuth(),Logger.debug({action:"create_directories",paths:{localFeeds:LOCAL_FEEDS_DIR,tempDir:this.tempDir}}),await fs.mkdir(LOCAL_FEEDS_DIR,{recursive:!0}),await fs.mkdir(this.tempDir,{recursive:!0}),await fs.rm(this.tempDir,{recursive:!0,force:!0});const i=t||GITHUB_REPO.url,a=e||"main";if(t||e){Logger.debug(`Using git clone with repository ${i} and branch ${a}`);const{cloneGitRepository:t}=await import("../../utils/gitUtils.js"),e=path.join(this.tempDir,"repo-clone");await t(i,a,e);const n=path.join(e,GITHUB_REPO.feedsPath);Logger.debug("Updating local feeds from git clone..."),await fs.rm(LOCAL_FEEDS_DIR,{recursive:!0,force:!0});try{await fs.access(n)}catch(t){throw new Error(`Could not find feeds directory in cloned repository: ${n}`)}await fs.cp(n,LOCAL_FEEDS_DIR,{recursive:!0,force:!0}),Logger.log("Successfully updated local feeds from git repository")}else{Logger.debug("Downloading latest release...");const{downloadGithubRelease:t}=await import("../../utils/githubUtils.js"),{version:e,downloadPath:i}=await t(GITHUB_REPO.repoName,"latest",GITHUB_REPO.feedAssetsName,void 0,!0,this.tempDir);Logger.debug({action:"download_release",downloadPath:i,version:e,repoName:GITHUB_REPO.repoName}),Logger.debug("Updating local feeds..."),await fs.rm(LOCAL_FEEDS_DIR,{recursive:!0,force:!0});const a=i;try{await fs.access(i)}catch(t){throw new Error(`Could not find feeds directory in downloaded path: ${a}`)}await fs.cp(a,LOCAL_FEEDS_DIR,{recursive:!0,force:!0}),Logger.log("Successfully updated local feeds")}}catch(t){throw Logger.error("Error during feed synchronization",t),new Error("Failed to sync feeds. Use --verbose for detailed error information.")}}))}async loadFeedsIntoConfiguration(t,e){this.configuration=await ConfigurationLoader.loadFeedsIntoConfiguration(this.configuration,t,e),await this.saveConfiguration()}async loadClientMCPSettings(){this.configuration=await ConfigurationLoader.loadClientMCPSettings(this.configuration),await this.saveConfiguration()}async reloadClientMCPSettings(){return await this.withLock((async()=>{await this.loadClientMCPSettings()}))}async removeServerFromClientMCPSettings(t,e){return await this.withLock((async()=>{const{readJsonFile:i,writeJsonFile:a}=await import("../../utils/clientUtils.js"),n=Object.entries(SUPPORTED_CLIENTS),r=e?n.filter((([t])=>t===e)):n;for(const[e,n]of r){const r=process.env.CODE_INSIDERS?n.codeInsiderSettingPath:n.codeSettingPath;try{const n=await i(r,!0);let s=!1;if("GithubCopilot"===e)n.servers?.[t]&&(delete n.servers[t],s=!0);else if("VisualStudio"===e){const e=t.replace(/-/g,"_");n.servers?.[e]&&(delete n.servers[e],s=!0)}else n.mcpServers?.[t]&&(delete n.mcpServers[t],s=!0);s&&(await a(r,n),Logger.debug(`Removed server ${t} from client ${e} settings`))}catch(i){Logger.error(`Failed to remove server ${t} from client ${e} settings:`,i)}}if(this.configuration.clientMCPSettings){if(e){const i=this.configuration.clientMCPSettings[e];i&&(i.mcpServers?.[t]&&delete i.mcpServers[t],i.servers?.[t]&&delete i.servers[t])}else for(const e of Object.values(this.configuration.clientMCPSettings))e.mcpServers?.[t]&&delete e.mcpServers[t],e.servers?.[t]&&delete e.servers[t];await this.saveConfiguration()}}))}}export const configProvider=ConfigurationProvider.getInstance();
2
2
  //# sourceMappingURL=ConfigurationProvider.js.map