fix: dataset layout data/<tier>/<seed>, mix tests, cli hardening

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
Lucas Winther
2026-10-30 02:52:50 +01:00
co-authored by Claude Sonnet 5.5
parent ca9f3bbb83
commit 32d96cadcc
4 changed files with 53 additions and 5 deletions
+5 -2
View File
@@ -15,7 +15,10 @@ function parseSeeds(s: string): number[] {
function arg(args: string[], name: string, def: string): string {
const i = args.indexOf(`--${name}`);
return i >= 0 && args[i + 1] ? args[i + 1]! : def;
if (i < 0) return def;
const v = args[i + 1];
if (v === undefined || v.startsWith("--")) throw new Error(`missing value for --${name}`);
return v;
}
async function main() {
@@ -23,7 +26,7 @@ async function main() {
switch (cmd) {
case "gen": {
const tiers = arg(rest, "tiers", "t1a,t1b,t1c,t1d").split(",") as TierId[];
for (const t of tiers) if (!(t in TIERS)) throw new Error(`unknown tier: ${t}`);
for (const t of tiers) if (!Object.hasOwn(TIERS, t)) throw new Error(`unknown tier: ${t}`);
const seeds = parseSeeds(arg(rest, "seeds", "1-5"));
const root = arg(rest, "root", "data");
for (const t of tiers) for (const s of seeds) {