fix: implement disabled skills functionality in skill resolution

This commit is contained in:
Muhammad Noor Misyuari
2026-01-26 14:21:28 +07:00
parent c1e08c939a
commit c67f8bde43
8 changed files with 151 additions and 31 deletions
@@ -33,10 +33,12 @@ describe("resolveSkillContent", () => {
expect(result).toBeNull()
})
it("should return null for empty string", () => {
// given: builtin skills
// when: resolving content for empty string
const result = resolveSkillContent("")
it("should return null for disabled skill", () => {
// given: frontend-ui-ux skill disabled
const options = { disabledSkills: new Set(["frontend-ui-ux"]) }
// when: resolving content for disabled skill
const result = resolveSkillContent("frontend-ui-ux", options)
// then: returns null
expect(result).toBeNull()
@@ -96,6 +98,20 @@ describe("resolveMultipleSkills", () => {
expect(result.notFound).toEqual(["skill-one", "skill-two", "skill-three"])
})
it("should treat disabled skills as not found", () => {
// #given: frontend-ui-ux disabled, playwright not disabled
const skillNames = ["frontend-ui-ux", "playwright"]
const options = { disabledSkills: new Set(["frontend-ui-ux"]) }
// #when: resolving multiple skills with disabled one
const result = resolveMultipleSkills(skillNames, options)
// #then: frontend-ui-ux in notFound, playwright resolved
expect(result.resolved.size).toBe(1)
expect(result.resolved.has("playwright")).toBe(true)
expect(result.notFound).toEqual(["frontend-ui-ux"])
})
it("should preserve skill order in resolved map", () => {
// given: list of skill names in specific order
const skillNames = ["playwright", "frontend-ui-ux"]
@@ -122,10 +138,12 @@ describe("resolveSkillContentAsync", () => {
expect(result).toContain("Role: Designer-Turned-Developer")
})
it("should return null for non-existent skill", async () => {
// given: non-existent skill name
// when: resolving content async
const result = await resolveSkillContentAsync("definitely-not-a-skill-12345")
it("should return null for disabled skill", async () => {
// given: frontend-ui-ux disabled
const options = { disabledSkills: new Set(["frontend-ui-ux"]) }
// when: resolving content async for disabled skill
const result = await resolveSkillContentAsync("frontend-ui-ux", options)
// then: returns null
expect(result).toBeNull()
@@ -160,6 +178,20 @@ describe("resolveMultipleSkillsAsync", () => {
expect(result.resolved.get("playwright")).toContain("Playwright Browser Automation")
})
it("should treat disabled skills as not found async", async () => {
// #given: frontend-ui-ux disabled
const skillNames = ["frontend-ui-ux", "playwright"]
const options = { disabledSkills: new Set(["frontend-ui-ux"]) }
// #when: resolving multiple skills async with disabled one
const result = await resolveMultipleSkillsAsync(skillNames, options)
// #then: frontend-ui-ux in notFound, playwright resolved
expect(result.resolved.size).toBe(1)
expect(result.resolved.has("playwright")).toBe(true)
expect(result.notFound).toEqual(["frontend-ui-ux"])
})
it("should NOT inject watermark when both options are disabled", async () => {
// given: git-master skill with watermark disabled
const skillNames = ["git-master"]