MCPcopy Create free account
hub / github.com/anomalyco/opencode / buildFile

Function buildFile

packages/core/src/repository.ts:192–206  ·  view source on GitHub ↗
(input: { url: URL; remote: string })

Source from the content-addressed store, hash-verified

190}
191
192function buildFile(input: { url: URL; remote: string }) {
193 const filePath = path.normalize(fileURLToPath(input.url))
194 const segments = filePath.split(/[\\/]+/).filter(Boolean)
195 if (!segments.length) return
196 return {
197 host: "file",
198 path: filePath,
199 segments: segments.map((segment) => segment.replace(/:$/, "")),
200 owner: undefined,
201 repo: trimGitSuffix(segments[segments.length - 1]),
202 remote: input.remote,
203 label: filePath,
204 protocol: "file:",
205 } satisfies FileReference
206}
207
208export * as Repository from "./repository"

Callers 1

parseFunction · 0.85

Calls 1

trimGitSuffixFunction · 0.70

Tested by

no test coverage detected