MCPcopy Index your code
hub / github.com/anomalyco/opencode / load

Function load

packages/opencode/src/config/agent.ts:11–32  ·  view source on GitHub ↗
(dir: string)

Source from the content-addressed store, hash-verified

9import { ConfigParse } from "./parse"
10
11export 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
34export async function loadMode(dir: string) {
35 const result: Record<string, ConfigAgentV1.Info> = {}

Callers

nothing calls this directly

Calls 2

configEntryNameFromPathFunction · 0.90
schemaMethod · 0.45

Tested by

no test coverage detected