feat(ci): verify clean source builds and pinned official contracts

This commit is contained in:
Agent Workbench Dev
2026-11-07 21:53:43 +08:00
parent a43262c112
commit af42b949ef
20 changed files with 4376 additions and 7 deletions
+4 -1
View File
@@ -11,6 +11,7 @@ const directories = ['src', 'public', 'scripts', 'tests', 'examples', 'benchmark
const files = ['package.json', 'package-lock.json', 'vite.config.ts', 'tsconfig.json', 'index.html', 'mobile.html',
'.gitignore', '.gitattributes', 'README.md', 'CHANGELOG.md', 'DESIGN.md', 'AGENTS.md', 'THIRD_PARTY_NOTICES.txt',
'Start-Workbench.cmd', 'Stop-Workbench.cmd', 'Start-Desktop.cmd'];
files.push('.gitea/workflows/ci.yml');
const guide = name => /^docs\/[^/]+\.md$/.test(name) || /^docs\/research\/[^/]+\.(?:md|json)$/.test(name);
function archivedFiles(file) {
@@ -63,11 +64,13 @@ export function packageSource({ root = process.cwd(), outputRoot = path.join(roo
const result = { kind: 'source-code', version, sourceCommit, sourceTree: git(['rev-parse', sourceCommit + '^{tree}']).toString().trim(),
path: archive, bytes: fs.statSync(archive).size, sha256: createHash('sha256').update(fs.readFileSync(archive)).digest('hex'),
createdAt: new Date().toISOString(), files: exported, archiveAttributes: 'git archive applies committed .gitattributes, including CRLF for Windows launch scripts; bytes/sha256 identify exported ZIP bytes, gitBytes/gitBlob identify original committed blobs.',
scope: 'Committed program, build scripts, tests, examples, dependency lock, licenses and text guides. No user projects, sessions, API credentials, installed runtimes or historical evidence archives. Build with Node 24, npm ci and npm run build. Historical acceptance drivers may require separately retained evidence or external engines.' };
scope: 'Committed program, build scripts, tests, .gitea/workflows/ci.yml, examples, dependency lock, licenses and text guides. No user projects, sessions, API credentials, installed runtimes or historical evidence archives. Build with Node 24, npm ci and npm run build. Historical acceptance drivers may require separately retained evidence or external engines.' };
fs.writeFileSync(path.join(outputRoot, name + '.json'), JSON.stringify(result, null, 2) + '\n', { flag: 'wx' });
return result;
}
export { archivedFiles as readSourceZip };
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
const args = process.argv.slice(2);
if (args.length === 1 && args[0] === '--help') console.log('node scripts/package-source.mjs — ZIP of committed program source only; no running Workbench, build, installation or user data required.');