diff --git a/packages/cli/src/helpers.ts b/packages/cli/src/helpers.ts index fdd78f06..599b1dca 100644 --- a/packages/cli/src/helpers.ts +++ b/packages/cli/src/helpers.ts @@ -8,7 +8,7 @@ import { loadSkillMetadata as coreLoadSkillMetadata, saveSkillMetadata as coreSaveSkillMetadata, } from "@skillkit/core"; -import { getAdapter, detectAgent } from "@skillkit/agents"; +import { getAdapter, detectAgent, getAllAdapters } from "@skillkit/agents"; import type { AgentType, AgentAdapterInfo } from "@skillkit/core"; // Re-export metadata functions directly (they don't need adapter bridging) @@ -16,15 +16,25 @@ export const loadSkillMetadata = coreLoadSkillMetadata; export const saveSkillMetadata = coreSaveSkillMetadata; export function getSearchDirs(agentType?: AgentType): string[] { - const type = agentType || loadConfig().agent; - const adapter = getAdapter(type); - const adapterInfo: AgentAdapterInfo = { - type: adapter.type, - name: adapter.name, - skillsDir: adapter.skillsDir, - configFile: adapter.configFile, - }; - return coreGetSearchDirs(adapterInfo); + const dirs = new Set(); + + const adapters = agentType + ? [getAdapter(agentType)] + : getAllAdapters(); + + for (const adapter of adapters) { + const info: AgentAdapterInfo = { + type: adapter.type, + name: adapter.name, + skillsDir: adapter.skillsDir, + configFile: adapter.configFile, + }; + for (const dir of coreGetSearchDirs(info)) { + dirs.add(dir); + } + } + + return [...dirs]; } export function getInstallDir(global = false, agentType?: AgentType): string { diff --git a/packages/core/src/skills.ts b/packages/core/src/skills.ts index dfd919df..1a898b17 100644 --- a/packages/core/src/skills.ts +++ b/packages/core/src/skills.ts @@ -311,11 +311,17 @@ export function findSkill(name: string, searchDirs: string[]): Skill | null { for (const dir of searchDirs) { if (!existsSync(dir)) continue; + const location: SkillLocation = dir.includes(process.cwd()) ? 'project' : 'global'; + const skillPath = join(dir, name); if (existsSync(skillPath)) { - const location: SkillLocation = dir.includes(process.cwd()) ? 'project' : 'global'; return parseSkill(skillPath, location); } + + const mdPath = join(dir, name.endsWith('.md') ? name : `${name}.md`); + if (existsSync(mdPath)) { + return parseStandaloneSkill(mdPath, location); + } } return null;