skill.test.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. import { describe, expect } from "bun:test"
  2. import { Effect, Layer } from "effect"
  3. import { AgentV2 } from "@opencode-ai/core/agent"
  4. import { FSUtil } from "@opencode-ai/core/fs-util"
  5. import { SkillPlugin } from "@opencode-ai/core/plugin/skill"
  6. import { SkillV2 } from "@opencode-ai/core/skill"
  7. import { SkillDiscovery } from "@opencode-ai/core/skill/discovery"
  8. import { testEffect } from "../lib/effect"
  9. import { host } from "./host"
  10. const it = testEffect(
  11. SkillV2.layer.pipe(
  12. Layer.provide(FSUtil.defaultLayer),
  13. Layer.provide(SkillDiscovery.defaultLayer),
  14. Layer.provideMerge(AgentV2.locationLayer),
  15. ),
  16. )
  17. describe("SkillPlugin.Plugin", () => {
  18. it.effect("registers the built-in customize-opencode skill", () =>
  19. Effect.gen(function* () {
  20. const skill = yield* SkillV2.Service
  21. yield* SkillPlugin.Plugin.effect(host({ skill }))
  22. expect(yield* skill.list()).toContainEqual(
  23. expect.objectContaining({
  24. name: "customize-opencode",
  25. description: expect.stringContaining("opencode's own configuration"),
  26. }),
  27. )
  28. }),
  29. )
  30. })