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

Function buildFileReference

packages/opencode/src/util/repository.ts:123–137  ·  view source on GitHub ↗
(input: { url: URL; remote: string })

Source from the content-addressed store, hash-verified

121}
122
123function buildFileReference(input: { url: URL; remote: string }) {
124 const filePath = path.normalize(fileURLToPath(input.url))
125 const segments = filePath.split(/[\\/]+/).filter(Boolean)
126 if (!segments.length) return null
127 return {
128 host: "file",
129 path: filePath,
130 segments: segments.map((segment) => segment.replace(/:$/, "")),
131 owner: undefined,
132 repo: trimGitSuffix(segments[segments.length - 1]),
133 remote: input.remote,
134 label: filePath,
135 protocol: "file:",
136 } satisfies FileReference
137}
138
139export function parseRepositoryReference(input: string) {
140 const cleaned = normalizeRepositoryInput(input)

Callers 1

parseRepositoryReferenceFunction · 0.85

Calls 1

trimGitSuffixFunction · 0.70

Tested by

no test coverage detected