@@ -98,7 +98,7 @@ import {
9898 claudeHomeRoot ,
9999 classifyPluginRemove ,
100100 deleteOwnedPluginDir ,
101- disableBundledPluginSettings ,
101+ disablePluginSettings ,
102102 isOwnedDiskInstall ,
103103 nextPluginPathsAfterRemove ,
104104 ownedDiskOriginRoot ,
@@ -1303,10 +1303,28 @@ export async function runTUI(initialConfig: Config): Promise<number> {
13031303 } ;
13041304
13051305 const disableConfig = ( ) : void => {
1306- livePluginConfig = disableBundledPluginSettings ( livePluginConfig , id ) ;
1306+ livePluginConfig = disablePluginSettings ( livePluginConfig , id ) ;
13071307 if ( liveWebOverride === id ) liveWebOverride = undefined ;
13081308 } ;
13091309
1310+ const dropPathRegistration = async ( path : string ) : Promise < string > => {
1311+ pathTrust = await revokePathPlugin ( path ) ;
1312+ const planned = await nextPluginPathsAfterRemove ( {
1313+ pluginPaths : livePluginPaths ,
1314+ pluginPath : path ,
1315+ cwd : config . cwd ,
1316+ otherLivePluginPaths : livePluginModules . flatMap ( ( m ) =>
1317+ m . manifest ?. id !== id && m . pluginPath !== undefined ? [ m . pluginPath ] : [ ] ,
1318+ ) ,
1319+ expandMembers : ( abs ) => expandPluginPath ( abs , { onSkip : ( ) => { } } ) ,
1320+ } ) ;
1321+ livePluginPaths . length = 0 ;
1322+ livePluginPaths . push ( ...planned . pluginPaths ) ;
1323+ return planned . keptSharedRoot
1324+ ? " Other plugins remain at that marketplace path; this one may return untrusted on restart."
1325+ : "" ;
1326+ } ;
1327+
13101328 const home = homedir ( ) ;
13111329 const owned = isOwnedDiskInstall ( {
13121330 origin,
@@ -1358,21 +1376,7 @@ export async function runTUI(initialConfig: Config): Promise<number> {
13581376 if ( ! disk . ok ) return disk ;
13591377 let extra = "" ;
13601378 if ( origin === "path" ) {
1361- pathTrust = await revokePathPlugin ( pluginPath ) ;
1362- const planned = await nextPluginPathsAfterRemove ( {
1363- pluginPaths : livePluginPaths ,
1364- pluginPath,
1365- cwd : config . cwd ,
1366- otherLivePluginPaths : livePluginModules . flatMap ( ( m ) =>
1367- m . manifest ?. id !== id && m . pluginPath !== undefined ? [ m . pluginPath ] : [ ] ,
1368- ) ,
1369- expandMembers : ( abs ) => expandPluginPath ( abs , { onSkip : ( ) => { } } ) ,
1370- } ) ;
1371- livePluginPaths . length = 0 ;
1372- livePluginPaths . push ( ...planned . pluginPaths ) ;
1373- extra = planned . keptSharedRoot
1374- ? " Other plugins remain at that marketplace path; this one may return untrusted on restart."
1375- : "" ;
1379+ extra = await dropPathRegistration ( pluginPath ) ;
13761380 }
13771381 spliceLive ( ) ;
13781382 disableConfig ( ) ;
@@ -1381,31 +1385,11 @@ export async function runTUI(initialConfig: Config): Promise<number> {
13811385 }
13821386
13831387 if ( action === "remove-path" ) {
1384- if ( pluginPath !== undefined ) {
1385- pathTrust = await revokePathPlugin ( pluginPath ) ;
1386- const planned = await nextPluginPathsAfterRemove ( {
1387- pluginPaths : livePluginPaths ,
1388- pluginPath,
1389- cwd : config . cwd ,
1390- otherLivePluginPaths : livePluginModules . flatMap ( ( m ) =>
1391- m . manifest ?. id !== id && m . pluginPath !== undefined ? [ m . pluginPath ] : [ ] ,
1392- ) ,
1393- expandMembers : ( abs ) => expandPluginPath ( abs , { onSkip : ( ) => { } } ) ,
1394- } ) ;
1395- livePluginPaths . length = 0 ;
1396- livePluginPaths . push ( ...planned . pluginPaths ) ;
1397- spliceLive ( ) ;
1398- disableConfig ( ) ;
1399- await persistPluginSettings ( ) ;
1400- const extra = planned . keptSharedRoot
1401- ? " Other plugins remain at that marketplace path; this one may return untrusted on restart."
1402- : "" ;
1403- return { ok : true , message : withToolsNote ( `Removed ${ desc . name } .${ extra } ` ) } ;
1404- }
1388+ const extra = pluginPath !== undefined ? await dropPathRegistration ( pluginPath ) : "" ;
14051389 spliceLive ( ) ;
14061390 disableConfig ( ) ;
14071391 await persistPluginSettings ( ) ;
1408- return { ok : true , message : withToolsNote ( `Removed ${ desc . name } .` ) } ;
1392+ return { ok : true , message : withToolsNote ( `Removed ${ desc . name } .${ extra } ` ) } ;
14091393 }
14101394
14111395 return { ok : false , message : `Cannot remove ${ desc . name } ` } ;
0 commit comments