/** * uat/cli/lib/run-id.ts — Run identifiers + artifact directory layout. * * A run id is a UTC `yyyyMMdd-HHmmss` stamp (injectable in tests); every runner * of the same run writes under `.application-test/uat/{application}/runs/{runId}/`. */ /** UTC `yyyyMMdd-HHmmss` (deterministic given an injected Date). */ export function defaultRunId(now: Date = new Date()): string { const p = (n: number): string => String(n).padStart(2, '0'); return `${now.getUTCFullYear()}${p(now.getUTCMonth() + 1)}${p(now.getUTCDate())}-${p(now.getUTCHours())}${p(now.getUTCMinutes())}${p(now.getUTCSeconds())}`; } /** Artifact dir of a run, relative to projectPath (POSIX). */ export function runDirRelPath(application: string, runId: string): string { return `.application-test/uat/${application}/runs/${runId}`; } /** Filesystem-safe slug for role names inside artifact paths. */ export function pathSlug(value: string): string { return value.toLowerCase().replace(/[^a-z0-9._-]+/g, '-').replace(/^-+|-+$/g, '') || 'x'; }