File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -543,6 +543,27 @@ describe('Settings Loading and Merging', () => {
543543 } ) ;
544544 } ) ;
545545
546+ it ( 'should rewrite allowedTools to tools.allowed during migration' , ( ) => {
547+ ( mockFsExistsSync as Mock ) . mockImplementation (
548+ ( p : fs . PathLike ) => p === USER_SETTINGS_PATH ,
549+ ) ;
550+ const legacySettingsContent = {
551+ allowedTools : [ 'fs' , 'shell' ] ,
552+ } ;
553+ ( fs . readFileSync as Mock ) . mockImplementation (
554+ ( p : fs . PathOrFileDescriptor ) => {
555+ if ( p === USER_SETTINGS_PATH )
556+ return JSON . stringify ( legacySettingsContent ) ;
557+ return '{}' ;
558+ } ,
559+ ) ;
560+
561+ const settings = loadSettings ( MOCK_WORKSPACE_DIR ) ;
562+
563+ expect ( settings . merged . tools ?. allowed ) . toEqual ( [ 'fs' , 'shell' ] ) ;
564+ expect ( ( settings . merged as TestSettings ) [ 'allowedTools' ] ) . toBeUndefined ( ) ;
565+ } ) ;
566+
546567 it ( 'should correctly merge and migrate legacy array properties from multiple scopes' , ( ) => {
547568 ( mockFsExistsSync as Mock ) . mockReturnValue ( true ) ;
548569 const legacyUserSettings = {
Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ const MIGRATION_MAP: Record<string, string> = {
6464 fileFiltering : 'context.fileFiltering' ,
6565 sandbox : 'tools.sandbox' ,
6666 shouldUseNodePtyShell : 'tools.usePty' ,
67+ allowedTools : 'tools.allowed' ,
6768 coreTools : 'tools.core' ,
6869 excludeTools : 'tools.exclude' ,
6970 toolDiscoveryCommand : 'tools.discoveryCommand' ,
You can’t perform that action at this time.
0 commit comments