@@ -4,6 +4,7 @@ import { ClaudeSettings, type ServerProvider } from "@t3tools/contracts";
44import { vi } from "vite-plus/test" ;
55import { assert , it } from "@effect/vitest" ;
66import * as Effect from "effect/Effect" ;
7+ import * as HostProcess from "@t3tools/shared/HostProcess" ;
78import * as FileSystem from "effect/FileSystem" ;
89import * as Path from "effect/Path" ;
910import * as Schema from "effect/Schema" ;
@@ -228,6 +229,27 @@ it.effect("always starts the CLI when its sources cannot be vouched for", () =>
228229 yield * write ( settingsPath , "{}" ) ;
229230 }
230231
232+ yield * Effect . gen ( function * ( ) {
233+ const managedCommands = yield * makeCommands ( { PROGRAMDATA : root } ) ;
234+ const dropIn = path . join ( root , "ClaudeCode" , "managed-settings.d" , "plugins.json" ) ;
235+ yield * write ( dropIn , "{}" ) ;
236+ const beforeManaged = probes ( ) ;
237+ yield * managedCommands . get ( machine , cwd ) ;
238+ yield * managedCommands . get ( machine , cwd ) ;
239+ assert . strictEqual ( probes ( ) , beforeManaged + 1 ) ;
240+
241+ yield * write (
242+ dropIn ,
243+ JSON . stringify ( { env : { CLAUDE_CODE_PLUGIN_CACHE_DIR : redirectedPlugins } } ) ,
244+ ) ;
245+ yield * probesTwice ( managedCommands ) ;
246+ const beforeManagedEdit = probes ( ) ;
247+ yield * write ( redirectedCommand , "edited command under managed redirect" ) ;
248+ yield * managedCommands . get ( machine , cwd ) ;
249+ assert . strictEqual ( probes ( ) , beforeManagedEdit + 1 ) ;
250+ yield * write ( dropIn , "{}" ) ;
251+ } ) . pipe ( Effect . provideService ( HostProcess . Platform , "win32" ) ) ;
252+
231253 const installed = path . join ( config , "plugins" , "installed_plugins.json" ) ;
232254 yield * write (
233255 installed ,
0 commit comments