1- import { homedir } from 'os' ;
21import { arch } from 'process' ;
32import type { ConfigurationChangeEvent } from 'vscode' ;
43import { version as codeVersion , Disposable , env , ProgressLocation , Uri , window , workspace } from 'vscode' ;
@@ -93,7 +92,7 @@ export class GkCliIntegrationProvider implements Disposable {
9392 return ;
9493 }
9594
96- await this . container . storage . store ( 'ai:mcp:attemptInstall' , 'attempted' ) ;
95+ void this . container . storage . store ( 'ai:mcp:attemptInstall' , 'attempted' ) . catch ( ) ;
9796
9897 if ( configuration . get ( 'ai.enabled' ) === false ) {
9998 const message = 'Cannot install MCP: AI is disabled in settings' ;
@@ -260,7 +259,7 @@ export class GkCliIntegrationProvider implements Disposable {
260259
261260 // Check using stat to make sure the newly extracted file exists.
262261 await workspace . fs . stat ( mcpExtractedPath ) ;
263- await this . container . storage . store ( 'ai:mcp:installPath' , mcpExtractedFolderPath . fsPath ) ;
262+ void this . container . storage . store ( 'ai:mcp:installPath' , mcpExtractedFolderPath . fsPath ) . catch ( ) ;
264263 } catch ( error ) {
265264 const errorMsg = `Failed to extract MCP installer: ${ error } ` ;
266265 Logger . error ( errorMsg ) ;
@@ -289,10 +288,6 @@ export class GkCliIntegrationProvider implements Disposable {
289288 }
290289 }
291290
292- // Get the VS Code settings.json file path in case we are on VSCode Insiders
293- // TODO: Use this path to point to the current vscode profile's settings.json once the API supports it.
294- const settingsPath = `${ this . container . context . globalStorageUri . fsPath } \\..\\..\\settings.json` ;
295-
296291 // Configure the MCP server in settings.json
297292 try {
298293 const installOutput = await run (
@@ -303,59 +298,9 @@ export class GkCliIntegrationProvider implements Disposable {
303298 ) ;
304299 const directory = installOutput . match ( / D i r e c t o r y : ( .* ) / ) ;
305300 let directoryPath ;
306- if ( directory != null ) {
307- try {
308- directoryPath = directory [ 1 ] ;
309- await this . container . storage . store ( 'gk:cli:installedPath' , directoryPath ) ;
310- // Add to PATH
311- if ( platform === 'windows' ) {
312- await run (
313- 'powershell.exe' ,
314- [
315- '-Command' ,
316- `[Environment]::SetEnvironmentVariable('Path', $env:Path + ';${ directoryPath } ', [EnvironmentVariableTarget]::User)` ,
317- ] ,
318- 'utf8' ,
319- ) ;
320- } else {
321- // For Unix-like systems, detect and modify the appropriate shell profile
322- const homeDir = homedir ( ) ;
323- // Try to detect which shell profile exists and is in use
324- const possibleProfiles = [
325- { path : `${ homeDir } /.zshrc` , shell : 'zsh' } ,
326- { path : `${ homeDir } /.zprofile` , shell : 'zsh' } ,
327- { path : `${ homeDir } /.bashrc` , shell : 'bash' } ,
328- { path : `${ homeDir } /.profile` , shell : 'sh' } ,
329- ] ;
330-
331- // Find the first profile that exists
332- let shellProfile ;
333- for ( const profile of possibleProfiles ) {
334- try {
335- await workspace . fs . stat ( Uri . file ( profile . path ) ) ;
336- shellProfile = profile . path ;
337- break ;
338- } catch {
339- // Profile doesn't exist, try next one
340- }
341- }
342-
343- if ( shellProfile != null ) {
344- await run (
345- 'sh' ,
346- [
347- '-c' ,
348- `echo '# Added by GitLens for MCP support' >> ${ shellProfile } && echo 'export PATH="$PATH:${ directoryPath } "' >> ${ shellProfile } ` ,
349- ] ,
350- 'utf8' ,
351- ) ;
352- } else {
353- Logger . warn ( 'MCP Install: Failed to find shell profile to update PATH' ) ;
354- }
355- }
356- } catch ( error ) {
357- Logger . warn ( `MCP Install: Failed to add directory to PATH: ${ error } ` ) ;
358- }
301+ if ( directory != null && directory . length > 1 ) {
302+ directoryPath = directory [ 1 ] ;
303+ void this . container . storage . store ( 'gk:cli:installedPath' , directoryPath ) . catch ( ) ;
359304 } else {
360305 Logger . warn ( 'MCP Install: Failed to find directory in install output' ) ;
361306 if ( appName === 'vscode' ) {
@@ -375,7 +320,7 @@ export class GkCliIntegrationProvider implements Disposable {
375320 } else {
376321 await run (
377322 platform === 'windows' ? mcpFileName : `./${ mcpFileName } ` ,
378- [ 'mcp' , 'install' , appName , ... ( isInsiders ? [ '--file-path' , settingsPath ] : [ ] ) ] ,
323+ [ 'mcp' , 'install' , appName ] ,
379324 'utf8' ,
380325 { cwd : mcpExtractedFolderPath . fsPath } ,
381326 ) ;
@@ -425,7 +370,7 @@ export class GkCliIntegrationProvider implements Disposable {
425370 }
426371
427372 // Show success notification if not silent
428- await this . container . storage . store ( 'ai:mcp:attemptInstall' , 'completed' ) ;
373+ void this . container . storage . store ( 'ai:mcp:attemptInstall' , 'completed' ) . catch ( ) ;
429374 void window . showInformationMessage ( 'GitKraken MCP integration installed successfully' ) ;
430375 } catch ( error ) {
431376 Logger . error ( `Error during MCP installation: ${ error } ` ) ;
0 commit comments