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

Function opencodeFiles

packages/opencode/src/config/tui-migrate.ts:115–132  ·  view source on GitHub ↗
(input: { directories: string[]; cwd: string })

Source from the content-addressed store, hash-verified

113}
114
115async function opencodeFiles(input: { directories: string[]; cwd: string }) {
116 const files = [
117 ...ConfigPaths.fileInDirectory(Global.Path.config, "opencode"),
118 ...(await Filesystem.findUp(["opencode.json", "opencode.jsonc"], input.cwd, undefined, { rootFirst: true })),
119 ]
120 for (const dir of unique(input.directories)) {
121 files.push(...ConfigPaths.fileInDirectory(dir, "opencode"))
122 }
123 if (Flag.OPENCODE_CONFIG) files.push(Flag.OPENCODE_CONFIG)
124
125 const existing = await Promise.all(
126 unique(files).map(async (file) => {
127 const ok = await Filesystem.exists(file)
128 return ok ? file : undefined
129 }),
130 )
131 return existing.filter((file): file is string => !!file)
132}

Callers 1

migrateTuiConfigFunction · 0.85

Calls 4

pushMethod · 0.80
uniqueFunction · 0.50
allMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected