(host: string)
| 215 | * This is a heuristic to determine if we should look up the host in SSH config |
| 216 | */ |
| 217 | export function looksLikeSSHAlias(host: string): boolean { |
| 218 | // If it contains dots, it's likely a domain or IP |
| 219 | if (host.includes('.')) { |
| 220 | return false; |
| 221 | } |
| 222 | |
| 223 | // If it's all numbers (with possible colons for IPv6), it's likely an IP |
| 224 | if (/^[\d:]+$/.test(host)) { |
| 225 | return false; |
| 226 | } |
| 227 | |
| 228 | // Check for IPv6 addresses with hex characters |
| 229 | if (/^[0-9a-fA-F:]+$/.test(host) && host.includes(':')) { |
| 230 | return false; |
| 231 | } |
| 232 | |
| 233 | // Otherwise, treat it as a potential SSH alias |
| 234 | return true; |
| 235 | } |
| 236 | |
| 237 | /** |
| 238 | * Validate a port number and throw an error if invalid |
no outgoing calls
no test coverage detected