fix(core): publish skill source updates

This commit is contained in:
Dax Raad 2026-07-10 20:42:44 -04:00
commit aca3b7813d
2 changed files with 18 additions and 0 deletions

View file

@ -92,6 +92,7 @@ const layer = Layer.effect(
},
list: () => draft.sources as Source[],
}),
finalize: () => events.publish(Event.Updated, {}).pipe(Effect.asVoid),
})
const load = Effect.fn("SkillV2.load")(function* (source: Source) {

View file

@ -54,6 +54,23 @@ function waitForSkillUpdate() {
}
describe("SkillV2", () => {
it.live("publishes updates when skill sources change", () =>
Effect.gen(function* () {
const skill = yield* SkillV2.Service
yield* Effect.acquireUseRelease(
waitForSkillUpdate(),
({ deferred }) =>
skill
.transform((editor) =>
editor.source({ type: "directory", path: AbsolutePath.make("/tmp/opencode-skills") }),
)
.pipe(Effect.andThen(Deferred.await(deferred)), Effect.timeout("1 second")),
({ fiber }) => Fiber.interrupt(fiber),
)
}),
)
it.live("registers sources and resolves later source precedence", () =>
Effect.acquireRelease(
Effect.promise(() => tmpdir()),