console plans: guardrails from a real run (2026-10-21): health none label and Sign in details Yes/No + Add details (old labels as altLabels, verify accepts both), finance boxes on step 1, App Privacy Additional Setup Required OK, verify from DOM input states (verify.capture, --from), Save + confirm before every Next on Play pages, IARC Digital purchases boxes and an exact-label in-page helper that refuses patterns and blanket answers; review contact found in parent folders, the profile and more key shapes with the files checked listed; one-line errors for missing required values (Args.required); pitfalls 86-87, tests

This commit is contained in:
CRTkafa 2026-10-21 05:03:02 +07:00
parent a6dab8f3aa
commit 335a4124ab
23 changed files with 486 additions and 74 deletions

View file

@ -8,8 +8,13 @@ export interface Args {
list(name: string): string[];
/** Every value of a flag given more than once (--param a=1 --param b=2), in order. */
many(name: string): string[];
/** A flag that needs a value: missing, or given without one (--version alone), throws ONE line with the fix. */
required(name: string, placeholder: string, fix?: string): string;
}
/** The one-line error of a missing required flag (never the whole help). */
export const requiredError = (name: string, placeholder: string, fix?: string): Error => new Error(`--${name} <${placeholder}> is required${fix ? ` (${fix})` : ''}`);
export function parseArgs(argv: string[], booleans: string[] = []): Args {
const flags = new Map<string, string>();
const repeated = new Map<string, string[]>();
@ -35,5 +40,6 @@ export function parseArgs(argv: string[], booleans: string[] = []): Args {
num: (n, d) => { const v = get(n); const x = v === undefined ? d : Number(v); if (Number.isNaN(x)) throw new Error(`--${n}: not a number`); return x; },
list: n => (get(n) ?? '').split(',').map(s => s.trim()).filter(Boolean),
many: n => repeated.get(n) ?? [],
required: (n, ph, fix) => { const v = get(n); if (v === undefined || v === 'true' || !v.trim()) throw requiredError(n, ph, fix); return v; },
};
}