MCPcopy
hub / github.com/anomalyco/opencode / discover

Function discover

packages/core/src/config/plugin/agent.ts:103–114  ·  view source on GitHub ↗
(fs: FSUtil.Interface, directory: string)

Source from the content-addressed store, hash-verified

101})
102
103function discover(fs: FSUtil.Interface, directory: string) {
104 return Effect.forEach(legacySources, (source) =>
105 fs
106 .glob(source.pattern, { cwd: directory, absolute: true, dot: true, symlink: true })
107 .pipe(
108 Effect.map((files) => files.toSorted().map((filepath) => ({ directory, filepath, primary: source.primary }))),
109 ),
110 ).pipe(
111 Effect.map((files) => files.flat()),
112 Effect.catch(() => Effect.succeed([])),
113 )
114}
115
116function decode(file: { directory: string; filepath: string; primary: boolean }, content: string) {
117 const markdown = ConfigMarkdown.parseOption(content)

Callers 2

agent.tsFile · 0.70
git.tsFile · 0.50

Calls 1

globMethod · 0.65

Tested by

no test coverage detected