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

Function url

packages/core/src/project.ts:81–94  ·  view source on GitHub ↗
(input: string)

Source from the content-addressed store, hash-verified

79 })
80
81 function url(input: string) {
82 const value = input.trim()
83 if (!value) return undefined
84
85 try {
86 const parsed = new URL(value)
87 if (parsed.protocol === "file:") return undefined
88 return parts(parsed.hostname, parsed.pathname)
89 } catch {
90 const scp = value.match(/^([^@/:]+@)?([^/:]+):(.+)$/)
91 if (scp) return parts(scp[2], scp[3])
92 return undefined
93 }
94 }
95
96 function parts(host: string, name: string) {
97 const pathname = name

Callers 2

project.tsFile · 0.70
renderFunction · 0.50

Calls 1

partsFunction · 0.70

Tested by

no test coverage detected