MCPcopy
hub / github.com/claude-code-best/claude-code / looksLikeRealHostname

Function looksLikeRealHostname

src/utils/detectRepository.ts:170–178  ·  view source on GitHub ↗

* Checks whether a hostname looks like a real domain name rather than an * SSH config alias. A simple dot-check is not enough because aliases like * "github.com-work" still contain a dot. We additionally require that the * last segment (the TLD) is purely alphabetic — real TLDs (com, org, io, net

(host: string)

Source from the content-addressed store, hash-verified

168 * never contain hyphens or digits.
169 */
170function looksLikeRealHostname(host: string): boolean {
171 if (!host.includes('.')) return false
172 const lastSegment = host.split('.').pop()
173 if (!lastSegment) return false
174 // Real TLDs are purely alphabetic (e.g., "com", "org", "io").
175 // SSH aliases like "github.com-work" have a last segment "com-work" which
176 // contains a hyphen.
177 return /^[a-zA-Z]+$/.test(lastSegment)
178}

Callers 1

parseGitRemoteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected