11import { MinimalIssue } from '@atlassianlabs/jira-pi-common-models' ;
22import * as fs from 'fs' ;
33import path from 'path' ;
4- import { CommandContext , setCommandContext } from 'src/commandContext' ;
5- import { showIssueForURL } from 'src/commands/jira/showIssue' ;
64import { configuration } from 'src/config/configuration' ;
75import { getFsPromise } from 'src/rovo-dev/util/fsPromises' ;
86import { safeWaitFor } from 'src/rovo-dev/util/waitFor' ;
97import { v4 } from 'uuid' ;
108import {
119 CancellationToken ,
12- commands ,
1310 ConfigurationChangeEvent ,
1411 Disposable ,
1512 env ,
@@ -26,9 +23,9 @@ import {
2623 workspace ,
2724} from 'vscode' ;
2825
29- import { Commands } from '../constants' ;
3026import { GitErrorCodes } from '../typings/git' ;
3127import { getHtmlForView } from '../webview/common/getHtmlForView' ;
28+ import { RovodevCommandContext } from './api/componentApi' ;
3229import { DetailedSiteInfo , ExtensionApi } from './api/extensionApi' ;
3330import { RovoDevApiClient , RovoDevHealthcheckResponse } from './client' ;
3431import { RovoDevChatContextProvider } from './rovoDevChatContextProvider' ;
@@ -435,19 +432,17 @@ export class RovoDevWebviewProvider extends Disposable implements WebviewViewPro
435432 break ;
436433
437434 case RovoDevViewResponseType . LaunchJiraAuth :
438- if ( e . openApiTokenLogin ) {
439- await commands . executeCommand ( Commands . JiraAPITokenLogin ) ;
440- } else {
441- await commands . executeCommand ( Commands . ShowJiraAuth ) ;
442- }
435+ await this . extensionApi . commands . showUserAuthentication ( {
436+ openApiTokenLogin : ! ! e . openApiTokenLogin ,
437+ } ) ;
443438 break ;
444439
445440 case RovoDevViewResponseType . OpenFolder :
446- await commands . executeCommand ( Commands . WorkbenchOpenFolder ) ;
441+ await this . extensionApi . commands . openFolder ( ) ;
447442 break ;
448443
449444 case RovoDevViewResponseType . OpenJira :
450- await showIssueForURL ( e . url ) ;
445+ await this . extensionApi . jira . showIssue ( e . url ) ;
451446 break ;
452447
453448 case RovoDevViewResponseType . McpConsentChoiceSubmit :
@@ -693,12 +688,11 @@ export class RovoDevWebviewProvider extends Disposable implements WebviewViewPro
693688 const resolvedPath = this . makeRelativePathAbsolute ( filePath ) ;
694689
695690 if ( cachedFilePath && fs . existsSync ( cachedFilePath ) ) {
696- commands . executeCommand (
697- 'vscode.diff' ,
698- Uri . file ( cachedFilePath ) ,
699- Uri . file ( resolvedPath ) ,
700- `${ filePath } (Rovo Dev)` ,
701- ) ;
691+ await this . extensionApi . commands . showDiff ( {
692+ left : Uri . file ( cachedFilePath ) ,
693+ right : Uri . file ( resolvedPath ) ,
694+ title : `${ filePath } (Rovo Dev)` ,
695+ } ) ;
702696 this . _dwellTracker ?. startDwellTimer ( ) ;
703697 } else {
704698 let range : Range | undefined ;
@@ -889,7 +883,7 @@ export class RovoDevWebviewProvider extends Disposable implements WebviewViewPro
889883
890884 public async invokeRovoDevAskCommand ( prompt : string , context ?: RovoDevContextItem [ ] ) : Promise < void > {
891885 // Always focus on the specific vscode view, even if disabled (so user can see the login prompt)
892- commands . executeCommand ( 'atlascode.views.rovoDev.webView.focus' ) ;
886+ await this . extensionApi . commands . focusRovodevView ( ) ;
893887
894888 // Wait for the webview to initialize, up to 5 seconds
895889 const initialized = await safeWaitFor ( {
@@ -933,7 +927,7 @@ export class RovoDevWebviewProvider extends Disposable implements WebviewViewPro
933927 */
934928 public async setPromptTextWithFocus ( text : string , contextItem ?: RovoDevContextItem ) : Promise < void > {
935929 // Focus and wait for webview to be ready to receive messages
936- await commands . executeCommand ( 'atlascode.views.rovoDev.webView.focus' ) ;
930+ await this . extensionApi . commands . focusRovodevView ( ) ;
937931
938932 const webview = await safeWaitFor ( {
939933 condition : ( value ) => ! ! value ,
@@ -1048,8 +1042,8 @@ export class RovoDevWebviewProvider extends Disposable implements WebviewViewPro
10481042 this . refreshDebugPanel ( ) ;
10491043
10501044 // enable the 'show terminal' button only when in debugging
1051- setCommandContext (
1052- CommandContext . RovoDevTerminalEnabled ,
1045+ this . extensionApi . commands . setCommandContext (
1046+ RovodevCommandContext . RovoDevTerminalEnabled ,
10531047 ! this . isBoysenberry && this . extensionApi . metadata . isDebugging ( ) ,
10541048 ) ;
10551049
0 commit comments