import { slugify } from "./worktree.js";
function toHostnameLabel(value) {
    return slugify(value) || "untitled";
}
export function buildScriptHostname({ projectSlug, branchName, scriptName, }) {
    const serviceHostnameLabel = toHostnameLabel(scriptName);
    const projectHostnameLabel = toHostnameLabel(projectSlug);
    const isDefaultBranch = branchName === null || branchName === "main" || branchName === "master";
    if (isDefaultBranch) {
        return `${serviceHostnameLabel}.${projectHostnameLabel}.localhost`;
    }
    return `${serviceHostnameLabel}.${toHostnameLabel(branchName)}.${projectHostnameLabel}.localhost`;
}
//# sourceMappingURL=script-hostname.js.map