Skip to content

Commit f685d7a

Browse files
committed
fix(core): narrow ecosystem config watches
1 parent 2db7ccb commit f685d7a

2 files changed

Lines changed: 52 additions & 2 deletions

File tree

‎packages/core/src/config.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ const layer = Layer.effect(
197197
start: location.directory,
198198
stop: location.project.directory,
199199
})
200-
.pipe(Effect.orDie)
200+
.pipe(Effect.orDie)
201201

202202
// We load certain files from a few other folders in the ecosystem
203203
const claude = [
@@ -235,7 +235,7 @@ const layer = Layer.effect(
235235
const supplementary = yield* Effect.forEach(directories, loadDirectory).pipe(Effect.orDie)
236236
return {
237237
entries: [...claude, ...agents, ...(supplementary[0] ?? []), ...direct, ...supplementary.slice(1).flat()],
238-
directories: [...directories, ...claude.map((entry) => entry.path), ...agents.map((entry) => entry.path)],
238+
directories,
239239
files: directPaths,
240240
}
241241
})

‎packages/core/test/config/config.test.ts‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,4 +934,54 @@ describe("Config", () => {
934934
}),
935935
),
936936
)
937+
938+
it.live("discovers ecosystem skill directories without watching them as config", () =>
939+
Effect.acquireRelease(
940+
Effect.promise(() => tmpdir()),
941+
(tmp) => Effect.promise(() => tmp[Symbol.asyncDispose]()),
942+
).pipe(
943+
Effect.flatMap((tmp) =>
944+
Effect.gen(function* () {
945+
const global = path.join(tmp.path, "global")
946+
const project = path.join(tmp.path, "project")
947+
const globalAgents = path.join(global, "home", ".agents")
948+
const globalClaude = path.join(global, "home", ".claude")
949+
const projectAgents = path.join(project, ".agents")
950+
const projectClaude = path.join(project, ".claude")
951+
yield* Effect.promise(() =>
952+
Promise.all(
953+
[global, project, globalAgents, globalClaude, projectAgents, projectClaude].map((directory) =>
954+
fs.mkdir(directory, { recursive: true }),
955+
),
956+
),
957+
)
958+
const targets: Watcher.WatchInput[] = []
959+
const watcher = Layer.succeed(
960+
Watcher.Service,
961+
Watcher.Service.of({
962+
subscribe: (input) => {
963+
targets.push(input)
964+
return Stream.empty
965+
},
966+
}),
967+
)
968+
969+
return yield* Effect.gen(function* () {
970+
const config = yield* Config.Service
971+
const entries = yield* config.entries()
972+
973+
expect(entries.filter((entry) => entry.type === "agents").map((entry) => entry.path)).toEqual([
974+
AbsolutePath.make(globalAgents),
975+
AbsolutePath.make(projectAgents),
976+
])
977+
expect(entries.filter((entry) => entry.type === "claude").map((entry) => entry.path)).toEqual([
978+
AbsolutePath.make(globalClaude),
979+
AbsolutePath.make(projectClaude),
980+
])
981+
expect(targets).toEqual([{ path: AbsolutePath.make(global), type: "directory" }])
982+
}).pipe(Effect.provide(testLayer(project, global, project, undefined, watcher)))
983+
}),
984+
),
985+
),
986+
)
937987
})

0 commit comments

Comments
 (0)