fix(skills): expand tilde config source paths
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { afterEach, beforeEach, describe, expect, it } from "bun:test"
|
||||
import { mkdirSync, rmSync, writeFileSync } from "fs"
|
||||
import { homedir } from "os"
|
||||
import { join } from "path"
|
||||
import { homedir, tmpdir } from "os"
|
||||
import { SkillsConfigSchema } from "../../config/schema/skills"
|
||||
@@ -101,4 +102,29 @@ describe("config source discovery", () => {
|
||||
// then
|
||||
expect(normalized).toBe("keep/nested/SKILL.md")
|
||||
})
|
||||
|
||||
it("loads skills from ~/ sources paths", async () => {
|
||||
// given
|
||||
const homeTestDir = join(homedir(), `.omo-config-source-${Date.now()}`)
|
||||
const sourceDir = join(homeTestDir, "custom-skills")
|
||||
writeSkill(join(sourceDir, "tilde-skill"), "tilde-skill", "Loaded from tilde source")
|
||||
const config = SkillsConfigSchema.parse({
|
||||
sources: [{ path: `${homeTestDir.replace(homedir(), "~")}/custom-skills`, recursive: true }],
|
||||
})
|
||||
|
||||
try {
|
||||
// when
|
||||
const skills = await discoverConfigSourceSkills({
|
||||
config,
|
||||
configDir: join(TEST_DIR, "config"),
|
||||
})
|
||||
|
||||
// then
|
||||
const tildeSkill = skills.find((skill) => skill.name === "tilde-skill")
|
||||
expect(tildeSkill).toBeDefined()
|
||||
expect(tildeSkill?.definition.description).toContain("Loaded from tilde source")
|
||||
} finally {
|
||||
rmSync(homeTestDir, { recursive: true, force: true })
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { promises as fs } from "fs"
|
||||
import { homedir } from "os"
|
||||
import { dirname, extname, isAbsolute, join, relative } from "path"
|
||||
import { homedir } from "os"
|
||||
import picomatch from "picomatch"
|
||||
import type { SkillsConfig } from "../../config/schema"
|
||||
import { normalizeSkillsConfig } from "./merger/skills-config-normalizer"
|
||||
|
||||
Reference in New Issue
Block a user