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

Function fileName

packages/opencode/src/cli/cmd/run/session.shared.ts:25–43  ·  view source on GitHub ↗
(url: string, filename?: string)

Source from the content-addressed store, hash-verified

23}
24
25function fileName(url: string, filename?: string) {
26 if (filename) {
27 return filename
28 }
29
30 try {
31 const next = new URL(url)
32 if (next.protocol !== "file:") {
33 return url
34 }
35
36 const name = next.pathname.split("/").at(-1)
37 if (name) {
38 return decodeURIComponent(name)
39 }
40 } catch {}
41
42 return url
43}
44
45function fileSource(
46 part: Extract<SessionMessages[number]["parts"][number], { type: "file" }>,

Callers 1

messagePromptFunction · 0.85

Calls 1

atMethod · 0.80

Tested by

no test coverage detected