Files
wehub-resource-sync c48612c494
CI / E2E Tests (push) Has been cancelled
CI / Lint, Typecheck & Unit Tests (push) Has been cancelled
Docs Build / Build docs site (push) Has been cancelled
Publish @openmaic packages / Build, validate & publish (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:03:23 +08:00

17 lines
691 B
TypeScript

import { mkdirSync } from 'fs';
import { join } from 'path';
/**
* Build and create a run directory under `<baseDir>/<sanitized-model>/<timestamp>/`.
* The model string is sanitized by replacing `:` and `/` with `-` so it is
* safe to use as a directory name. Timestamp is ISO-8601 with colons and dots
* replaced by dashes, truncated to second precision.
*/
export function createRunDir(baseDir: string, model: string): string {
const sanitizedModel = model.replace(/[:/]/g, '-');
const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
const runDir = join(baseDir, sanitizedModel, timestamp);
mkdirSync(runDir, { recursive: true });
return runDir;
}