refactor: normalize cli command hints

This commit is contained in:
Peter Steinberger
2026-01-20 07:42:21 +00:00
parent 11b9b6dba5
commit 6d5195c890
106 changed files with 521 additions and 220 deletions

15
src/cli/profile-utils.ts Normal file
View File

@@ -0,0 +1,15 @@
const PROFILE_NAME_RE = /^[a-z0-9][a-z0-9_-]{0,63}$/i;
export function isValidProfileName(value: string): boolean {
if (!value) return false;
// Keep it path-safe + shell-friendly.
return PROFILE_NAME_RE.test(value);
}
export function normalizeProfileName(raw?: string | null): string | null {
const profile = raw?.trim();
if (!profile) return null;
if (profile.toLowerCase() === "default") return null;
if (!isValidProfileName(profile)) return null;
return profile;
}