cloneDirectory
The directory a clone makes by default: the URL's (or directory's) last part, or a URL's host.
export function cloneDirectory(url: string): string { const u = /^https?:\/\//.test(url) ? new URL(url) : undefined; return (u ? u.pathname : url).split(/[\\/]/).filter(Boolean).at(-1) ?? u?.hostname ?? "codebase"; }