UNPKG

@nanocollective/nanocoder

Version:

A local-first CLI coding agent that brings the power of agentic coding tools like Claude Code and Gemini CLI to local models or controlled APIs like OpenRouter

22 lines 683 B
const LOCAL_HOSTNAMES = new Set(['localhost', '127.0.0.1', '0.0.0.0', '[::1]']); /** * Check if a URL points to a local server. * Matches: localhost, 127.0.0.1, 0.0.0.0, ::1 */ export function isLocalURL(url) { try { const parsed = new URL(url); if (parsed.hostname) { return LOCAL_HOSTNAMES.has(parsed.hostname); } } catch { // Fall through to string matching } // Fallback for malformed URLs or empty hostname: check the raw string return (url.includes('localhost') || url.includes('127.0.0.1') || url.includes('0.0.0.0') || url.includes('::1')); } //# sourceMappingURL=url-utils.js.map