Consolidate current readiness and existing rule decisions, preserve selective subagents and automatic verified Git pushes, and record the efficiency pilot. Add source-bound compact checks, private saved-game snapshots/online backups, and bounded HTTP seat-restoration checks with 15 meaningful regressions. At the user's explicit request, archive and clear 3,644 old local rooms and related records while retaining schema/migrations; preserve future games from a fresh empty baseline. Private backups and credentials are outside Git. Validation: npm run check passes types, lint and all 4,177 offline tests. Full report: 20260913-efficiency-check-3, 130.147 seconds; source fingerprint 344ce1d44475b0cd4ff10a915f28331cb4e2fcacbc7595636fbaa645c0568f64. Two earlier broad attempts stopped at new type/lint errors before tests; both were fixed. Independent review found cancellation falsely passing; SIGINT/SIGTERM regressions and review confirm the fix. Documentation links, example test selection, private backup integrity and empty baseline verified. No app/build/dependency/HTTP implementation changed; no production build, HTTP suite, browser acceptance or AI calibration claimed for this checkpoint. The full game goal and existing release gates remain unfinished.
85 lines
3.0 KiB
TypeScript
85 lines
3.0 KiB
TypeScript
import { fileURLToPath } from 'node:url';
|
|
import { parseArgs } from 'node:util';
|
|
import { resolve } from 'node:path';
|
|
import { runVerification, type VerificationStep } from './verification';
|
|
|
|
async function main() {
|
|
const { values, positionals } = parseArgs({
|
|
allowPositionals: true,
|
|
options: {
|
|
out: { type: 'string' },
|
|
focus: { type: 'string', multiple: true },
|
|
games: { type: 'string' },
|
|
seed: { type: 'string' },
|
|
help: { type: 'boolean' },
|
|
},
|
|
});
|
|
if (values.help) {
|
|
console.log(
|
|
'Usage: node --import tsx tools/verify.ts --out /tmp/new-run check [build] [integration]\nOr: --out /tmp/new-run focused --focus fragment [--focus fragment]\nOr: --out /tmp/new-run base-games --games 20 --seed 20260913\nLogs and source-bound report.json stay outside the checkout. Commands stop on failure; changed source invalidates success.',
|
|
);
|
|
return;
|
|
}
|
|
if (!values.out || !positionals.length)
|
|
throw new Error('Provide --out and verification steps; see --help.');
|
|
if (values.focus?.some((fragment) => !fragment || fragment.startsWith('-')))
|
|
throw new Error('--focus accepts filename fragments, not runner options.');
|
|
const root = fileURLToPath(new URL('../', import.meta.url));
|
|
const steps: VerificationStep[] = positionals.map((name) => {
|
|
if (['check', 'build', 'integration'].includes(name))
|
|
return {
|
|
name,
|
|
command: 'npm',
|
|
args: ['run', name === 'integration' ? 'test:integration' : name],
|
|
};
|
|
if (name === 'focused' && values.focus?.length)
|
|
return { name, command: 'npm', args: ['test', '--', ...values.focus] };
|
|
if (name === 'base-games') {
|
|
const games = Number(values.games),
|
|
seed = Number(values.seed);
|
|
if (
|
|
!Number.isSafeInteger(games) ||
|
|
games < 1 ||
|
|
games > 120 ||
|
|
!Number.isSafeInteger(seed) ||
|
|
seed < 1 ||
|
|
seed > 0xffffffff
|
|
)
|
|
throw new Error(
|
|
'base-games requires --games 1..120 and --seed 1..4294967295.',
|
|
);
|
|
return {
|
|
name,
|
|
command: process.execPath,
|
|
args: [
|
|
'--import',
|
|
'tsx',
|
|
'tools/ai-calibration.ts',
|
|
'--games',
|
|
String(games),
|
|
'--seed',
|
|
String(seed),
|
|
'--out',
|
|
resolve(values.out!, 'base-games.json'),
|
|
],
|
|
};
|
|
}
|
|
throw new Error(`Unknown or incomplete step: ${name}`);
|
|
});
|
|
if (values.focus && !positionals.includes('focused'))
|
|
throw new Error('--focus requires the focused step.');
|
|
if ((values.games || values.seed) && !positionals.includes('base-games'))
|
|
throw new Error('--games/--seed require base-games.');
|
|
const report = await runVerification(root, values.out, steps);
|
|
console.log(
|
|
`Verification ${report.status}; ${resolve(values.out, 'report.json')}`,
|
|
);
|
|
process.exitCode = report.status === 'passed' ? 0 : 1;
|
|
}
|
|
main().catch(() => {
|
|
console.error(
|
|
'Verification could not complete. Check arguments, repository and output location; see --help.',
|
|
);
|
|
process.exitCode = 1;
|
|
});
|