Compare commits

...
Author SHA1 Message Date
Kit Langton f685d7aab3 fix(core): narrow ecosystem config watches 2026-07-09 20:45:25 -04:00
2 changed files with 52 additions and 2 deletions
+2 -2
View File
@@ -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,
}
})
+50
View File
@@ -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)))
}),
),
),
)
})