MCPcopy
hub / github.com/OpenCoworkAI/open-codesign / loadDesignSkills

Function loadDesignSkills

packages/core/src/design-skills/index.ts:47–65  ·  view source on GitHub ↗
(dir: string)

Source from the content-addressed store, hash-verified

45 * canonical order defined by `DESIGN_SKILL_FILES`.
46 */
47export async function loadDesignSkills(dir: string): Promise<Array<[string, string]>> {
48 let entries: string[];
49 try {
50 entries = await readdir(dir);
51 await assertTemplatePathIsNotSymlink(dir);
52 } catch (err) {
53 if ((err as NodeJS.ErrnoException).code === 'ENOENT') return [];
54 throw err;
55 }
56 if (entries.length === 0) return [];
57 return Promise.all(
58 DESIGN_SKILL_FILES.map(async (name): Promise<[string, string]> => {
59 const filePath = path.join(dir, name);
60 await assertTemplatePathIsNotSymlink(filePath);
61 const contents = await readFile(filePath, 'utf8');
62 return [name, contents];
63 }),
64 );
65}

Callers 2

runGenerateFunction · 0.90
index.test.tsFile · 0.85

Calls 1

Tested by

no test coverage detected