|
|
@@ -29,10 +29,12 @@ Instructions here.
|
|
|
directory: tmp.path,
|
|
|
fn: async () => {
|
|
|
const skills = await Skill.all()
|
|
|
- expect(skills.length).toBe(1)
|
|
|
- expect(skills[0].name).toBe("test-skill")
|
|
|
- expect(skills[0].description).toBe("A test skill for verification.")
|
|
|
- expect(skills[0].location).toContain("skill/test-skill/SKILL.md")
|
|
|
+ // Should find local skill + global skill from test home
|
|
|
+ expect(skills.length).toBe(2)
|
|
|
+ const testSkill = skills.find((s) => s.name === "test-skill")
|
|
|
+ expect(testSkill).toBeDefined()
|
|
|
+ expect(testSkill!.description).toBe("A test skill for verification.")
|
|
|
+ expect(testSkill!.location).toContain("skill/test-skill/SKILL.md")
|
|
|
},
|
|
|
})
|
|
|
})
|
|
|
@@ -59,8 +61,10 @@ description: Another test skill.
|
|
|
directory: tmp.path,
|
|
|
fn: async () => {
|
|
|
const skills = await Skill.all()
|
|
|
- expect(skills.length).toBe(1)
|
|
|
- expect(skills[0].name).toBe("my-skill")
|
|
|
+ // Should find local skill + global skill from test home
|
|
|
+ expect(skills.length).toBe(2)
|
|
|
+ const mySkill = skills.find((s) => s.name === "my-skill")
|
|
|
+ expect(mySkill).toBeDefined()
|
|
|
},
|
|
|
})
|
|
|
})
|
|
|
@@ -84,19 +88,9 @@ Just some content without YAML frontmatter.
|
|
|
directory: tmp.path,
|
|
|
fn: async () => {
|
|
|
const skills = await Skill.all()
|
|
|
- expect(skills).toEqual([])
|
|
|
- },
|
|
|
- })
|
|
|
-})
|
|
|
-
|
|
|
-test("returns empty array when no skills exist", async () => {
|
|
|
- await using tmp = await tmpdir({ git: true })
|
|
|
-
|
|
|
- await Instance.provide({
|
|
|
- directory: tmp.path,
|
|
|
- fn: async () => {
|
|
|
- const skills = await Skill.all()
|
|
|
- expect(skills).toEqual([])
|
|
|
+ // Should only find the global skill, not the one without frontmatter
|
|
|
+ expect(skills.length).toBe(1)
|
|
|
+ expect(skills[0].name).toBe("global-test-skill")
|
|
|
},
|
|
|
})
|
|
|
})
|
|
|
@@ -119,13 +113,34 @@ description: A skill in the .claude/skills directory.
|
|
|
},
|
|
|
})
|
|
|
|
|
|
+ await Instance.provide({
|
|
|
+ directory: tmp.path,
|
|
|
+ fn: async () => {
|
|
|
+ const skills = await Skill.all()
|
|
|
+ // Should find both project-local and global skill
|
|
|
+ expect(skills.length).toBe(2)
|
|
|
+ const claudeSkill = skills.find((s) => s.name === "claude-skill")
|
|
|
+ const globalSkill = skills.find((s) => s.name === "global-test-skill")
|
|
|
+ expect(claudeSkill).toBeDefined()
|
|
|
+ expect(claudeSkill!.location).toContain(".claude/skills/claude-skill/SKILL.md")
|
|
|
+ expect(globalSkill).toBeDefined()
|
|
|
+ expect(globalSkill!.description).toBe("A global skill from ~/.claude/skills for testing.")
|
|
|
+ },
|
|
|
+ })
|
|
|
+})
|
|
|
+
|
|
|
+test("discovers global skills from ~/.claude/skills/ directory", async () => {
|
|
|
+ // Create a project with no local skills - should still find global skill
|
|
|
+ await using tmp = await tmpdir({ git: true })
|
|
|
+
|
|
|
await Instance.provide({
|
|
|
directory: tmp.path,
|
|
|
fn: async () => {
|
|
|
const skills = await Skill.all()
|
|
|
expect(skills.length).toBe(1)
|
|
|
- expect(skills[0].name).toBe("claude-skill")
|
|
|
- expect(skills[0].location).toContain(".claude/skills/claude-skill/SKILL.md")
|
|
|
+ expect(skills[0].name).toBe("global-test-skill")
|
|
|
+ expect(skills[0].description).toBe("A global skill from ~/.claude/skills for testing.")
|
|
|
+ expect(skills[0].location).toContain(".claude/skills/global-test-skill/SKILL.md")
|
|
|
},
|
|
|
})
|
|
|
})
|