Files
Agent-Workbench/docs/model-selection-k-evidence/development/model-entry-k-freeze.mjs
T
2026-11-03 15:37:04 +08:00

16 lines
1.8 KiB
JavaScript

import fs from 'node:fs';
import path from 'node:path';
import assert from 'node:assert/strict';
import { createHash } from 'node:crypto';
import { execFileSync } from 'node:child_process';
const root = path.resolve('.qa/model-entry-k'); fs.mkdirSync(root, { recursive: true });
assert.equal(execFileSync('git', ['status', '--porcelain'], { encoding: 'utf8' }).trim(), '');
const names = execFileSync('git', ['ls-files', '-z', '--', 'src', 'public', 'scripts', 'tests', 'examples', 'benchmarks', 'research', 'package.json', 'package-lock.json', 'vite.config.ts', 'tsconfig.json', 'index.html', 'mobile.html'], { encoding: 'utf8' }).split('\0').filter(Boolean).filter(name =>
/^(?:src|public|scripts|tests|examples|benchmarks|research)\//.test(name) || ['package.json','package-lock.json','vite.config.ts','tsconfig.json','index.html','mobile.html'].includes(name));
const record = file => { const bytes = fs.readFileSync(file); return { path: file.replaceAll('\\', '/'), bytes: bytes.length, sha256: createHash('sha256').update(bytes).digest('hex') }; };
const walk = folder => fs.readdirSync(folder, { withFileTypes: true }).flatMap(entry => entry.isDirectory() ? walk(path.join(folder, entry.name)) : [path.join(folder, entry.name)]);
const result = { sourceCommit: execFileSync('git', ['rev-parse', 'HEAD'], { encoding: 'utf8' }).trim(), version: '1.24.3', createdAt: new Date().toISOString(),
files: names.sort().map(record), compiled: ['dist-client','dist-server','dist-desktop'].flatMap(walk).sort().map(record), realModelRequests: 0 };
fs.writeFileSync(path.join(root, 'product-freeze-release.json'), JSON.stringify(result, null, 2) + '\n', { flag: 'wx' });
console.log(JSON.stringify({ success: true, files: result.files.length, compiled: result.compiled.length, sourceCommit: result.sourceCommit }));