(dir: string)
| 9 | import { ConfigParse } from "./parse" |
| 10 | |
| 11 | export async function load(dir: string) { |
| 12 | const result: Record<string, ConfigAgentV1.Info> = {} |
| 13 | for (const item of await Glob.scan("{agent,agents}/**/*.md", { |
| 14 | cwd: dir, |
| 15 | absolute: true, |
| 16 | dot: true, |
| 17 | symlink: true, |
| 18 | })) { |
| 19 | const md = await ConfigMarkdown.parse(item).catch(() => undefined) |
| 20 | if (!md) continue |
| 21 | |
| 22 | const name = configEntryNameFromPath(path.relative(dir, item), ["agent/", "agents/"]) |
| 23 | |
| 24 | const config = { |
| 25 | name, |
| 26 | ...md.data, |
| 27 | prompt: md.content.trim(), |
| 28 | } |
| 29 | result[config.name] = ConfigParse.schema(ConfigAgentV1.Info, config, item) |
| 30 | } |
| 31 | return result |
| 32 | } |
| 33 | |
| 34 | export async function loadMode(dir: string) { |
| 35 | const result: Record<string, ConfigAgentV1.Info> = {} |
nothing calls this directly
no test coverage detected