@@ -60,6 +60,7 @@ type GlobalStateKey =
6060 | "azureApiVersion"
6161 | "openRouterModelId"
6262 | "openRouterModelInfo"
63+ | "allowedCommands"
6364
6465export const GlobalFileNames = {
6566 apiConversationHistory : "api_conversation_history.json" ,
@@ -510,6 +511,13 @@ export class ClineProvider implements vscode.WebviewViewProvider {
510511 }
511512
512513 break
514+ case "allowedCommands" :
515+ await this . context . globalState . update ( 'allowedCommands' , message . commands ) ;
516+ // Also update workspace settings
517+ await vscode . workspace
518+ . getConfiguration ( 'roo-cline' )
519+ . update ( 'allowedCommands' , message . commands , vscode . ConfigurationTarget . Global ) ;
520+ break ;
513521 // Add more switch case statements here as more webview message commands
514522 // are created within the webview context (i.e. inside media/main.js)
515523 }
@@ -820,6 +828,10 @@ export class ClineProvider implements vscode.WebviewViewProvider {
820828 taskHistory,
821829 } = await this . getState ( )
822830
831+ const allowedCommands = vscode . workspace
832+ . getConfiguration ( 'roo-cline' )
833+ . get < string [ ] > ( 'allowedCommands' ) || [ ]
834+
823835 return {
824836 version : this . context . extension ?. packageJSON ?. version ?? "" ,
825837 apiConfiguration,
@@ -834,6 +846,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
834846 . filter ( ( item ) => item . ts && item . task )
835847 . sort ( ( a , b ) => b . ts - a . ts ) ,
836848 shouldShowAnnouncement : lastShownAnnouncementId !== this . latestAnnouncementId ,
849+ allowedCommands,
837850 }
838851 }
839852
@@ -921,6 +934,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
921934 alwaysAllowExecute ,
922935 alwaysAllowBrowser ,
923936 taskHistory ,
937+ allowedCommands ,
924938 ] = await Promise . all ( [
925939 this . getGlobalState ( "apiProvider" ) as Promise < ApiProvider | undefined > ,
926940 this . getGlobalState ( "apiModelId" ) as Promise < string | undefined > ,
@@ -953,6 +967,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
953967 this . getGlobalState ( "alwaysAllowExecute" ) as Promise < boolean | undefined > ,
954968 this . getGlobalState ( "alwaysAllowBrowser" ) as Promise < boolean | undefined > ,
955969 this . getGlobalState ( "taskHistory" ) as Promise < HistoryItem [ ] | undefined > ,
970+ this . getGlobalState ( "allowedCommands" ) as Promise < string [ ] | undefined > ,
956971 ] )
957972
958973 let apiProvider : ApiProvider
@@ -1003,6 +1018,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
10031018 alwaysAllowExecute : alwaysAllowExecute ?? false ,
10041019 alwaysAllowBrowser : alwaysAllowBrowser ?? false ,
10051020 taskHistory,
1021+ allowedCommands,
10061022 }
10071023 }
10081024
0 commit comments