Skip to content
This repository was archived by the owner on Oct 6, 2026. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const defaultPromptText = async (opts: PromptTextOptions): Promise<string> => {
...(validate ? { validate: (v: string | undefined) => validate(v ?? "") } : {}),
});
if (isCancel(r)) throw new ConfirmError("init cancelled");
return r.trim().length > 0 ? r.trim() : opts.defaultValue;
return r.trim();
};

const defaultPromptConfirm = async (message: string, initial: boolean): Promise<boolean> => {
Expand Down Expand Up @@ -155,8 +155,9 @@ async function detectBuildCommand(
}

function siteValidator(value: string): string | undefined {
if (!value) return undefined;
const v = value.trim();
if (v.length === 0) return "site is required";
if (!v) return "either enter your desired site name or leave it blank for the default";
if (v.length > 63) return "site must be at most 63 characters";
if (!SITE_NAME_PATTERN.test(v)) {
return "lowercase letters, digits, single hyphens; no leading/trailing/consecutive hyphens";
Expand All @@ -165,7 +166,8 @@ function siteValidator(value: string): string | undefined {
}

function nonEmptyValidator(value: string): string | undefined {
return value.trim().length === 0 ? "required" : undefined;
if (!value) return undefined;
return value.trim().length === 0 ? "please enter something or leave it blank for the default" : undefined;
}

function renderYaml(site: string, build: BuildBlock | null): string {
Expand Down