From f685d7aab34f48639c3c164432520e753d43b54a Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Thu, 9 Jul 2026 20:45:25 -0400 Subject: [PATCH] fix(core): narrow ecosystem config watches --- packages/core/src/config.ts | 4 +- packages/core/test/config/config.test.ts | 50 ++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/packages/core/src/config.ts b/packages/core/src/config.ts index 4533f9b378..4f29917dd9 100644 --- a/packages/core/src/config.ts +++ b/packages/core/src/config.ts @@ -197,7 +197,7 @@ const layer = Layer.effect( start: location.directory, stop: location.project.directory, }) - .pipe(Effect.orDie) + .pipe(Effect.orDie) // We load certain files from a few other folders in the ecosystem const claude = [ @@ -235,7 +235,7 @@ const layer = Layer.effect( const supplementary = yield* Effect.forEach(directories, loadDirectory).pipe(Effect.orDie) return { entries: [...claude, ...agents, ...(supplementary[0] ?? []), ...direct, ...supplementary.slice(1).flat()], - directories: [...directories, ...claude.map((entry) => entry.path), ...agents.map((entry) => entry.path)], + directories, files: directPaths, } }) diff --git a/packages/core/test/config/config.test.ts b/packages/core/test/config/config.test.ts index 4df256c86b..3aee6a81ba 100644 --- a/packages/core/test/config/config.test.ts +++ b/packages/core/test/config/config.test.ts @@ -934,4 +934,54 @@ describe("Config", () => { }), ), ) + + it.live("discovers ecosystem skill directories without watching them as config", () => + Effect.acquireRelease( + Effect.promise(() => tmpdir()), + (tmp) => Effect.promise(() => tmp[Symbol.asyncDispose]()), + ).pipe( + Effect.flatMap((tmp) => + Effect.gen(function* () { + const global = path.join(tmp.path, "global") + const project = path.join(tmp.path, "project") + const globalAgents = path.join(global, "home", ".agents") + const globalClaude = path.join(global, "home", ".claude") + const projectAgents = path.join(project, ".agents") + const projectClaude = path.join(project, ".claude") + yield* Effect.promise(() => + Promise.all( + [global, project, globalAgents, globalClaude, projectAgents, projectClaude].map((directory) => + fs.mkdir(directory, { recursive: true }), + ), + ), + ) + const targets: Watcher.WatchInput[] = [] + const watcher = Layer.succeed( + Watcher.Service, + Watcher.Service.of({ + subscribe: (input) => { + targets.push(input) + return Stream.empty + }, + }), + ) + + return yield* Effect.gen(function* () { + const config = yield* Config.Service + const entries = yield* config.entries() + + expect(entries.filter((entry) => entry.type === "agents").map((entry) => entry.path)).toEqual([ + AbsolutePath.make(globalAgents), + AbsolutePath.make(projectAgents), + ]) + expect(entries.filter((entry) => entry.type === "claude").map((entry) => entry.path)).toEqual([ + AbsolutePath.make(globalClaude), + AbsolutePath.make(projectClaude), + ]) + expect(targets).toEqual([{ path: AbsolutePath.make(global), type: "directory" }]) + }).pipe(Effect.provide(testLayer(project, global, project, undefined, watcher))) + }), + ), + ), + ) })