clank-together/tools/rodecomp/prepare-project.mjs
clank-bot 022e0a2c78 Ragnarok rodecomp deployment on memento
Changes to upstream:
- git.js: coordinator commit identity from TD_GIT_AUTHOR_NAME/EMAIL.
- build.js: docker runner can share job dirs through a named volume
  (jobVolume/jobVolumeRoot) for containerized workers.
- install.js: staged installer output with logs, start prompt for regions.
- web: feed layout, cache-busting asset versions, multi-agent help section.
- build-td: fetch checksummed Windows runtime when building on non-Windows.

Additions:
- deploy/rodecomp: compose stack, Dockerfiles, Caddyfile, server.json,
  bulk import/verify scripts, and README.md with the deployment notes
  (the root README stays identical to upstream).
- toolchain/msvc-v142: MSVC v142 under Wine (Docker), SDK 10.0.19041.0.
- tools/rodecomp: project preparation, Forgejo provisioning, history and
  identity tools.
2026-10-25 14:40:13 +01:00

21 lines
2.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import fs from 'node:fs';
import crypto from 'node:crypto';
import { execFileSync } from 'node:child_process';
const repo = process.argv[2];
const compilerHash = process.argv[3];
if (!repo || !/^[a-f0-9]{64}$/.test(compilerHash ?? '')) throw new Error('usage: prepare-project.mjs <repo> <compiler-sha256>');
const file = `${repo}/decomp.json`;
const p = JSON.parse(fs.readFileSync(file, 'utf8'));
p.name = 'rodecomp';
p.compileCommands = 'compile.json';
delete p.verification;
delete p.build;
p.matchPolicy = { autoMergeIdentical: true, approvals: 1, approvalsWithHeaderChanges: 2, maxCleanupCycles: 5, peerReviews: 3, peerMargin: 3, peerRejectMargin: 2 };
fs.writeFileSync(file, JSON.stringify(p, null, 2) + '\n');
fs.writeFileSync(`${repo}/toolchain.lock.json`, JSON.stringify({ragnarok:{family:'msvc',version:'19.29.30159',machine:'x86',image:'rodecomp/compiler:v142',clSha256:compilerHash,sdkVersion:'10.0.19041.0'}}, null, 2) + '\n');
let guide = fs.readFileSync('/app/template/AGENTS.md', 'utf8').replace('a C++ program built with MSVC 2010', 'Ragnarok Online Ragexe 2026-02-19 (x86), using MSVC v142 19.29.30159').replace("(Ghidra's guess, a starting point only)", '(imported IDA pseudocode where available, a starting point only)');
guide += '\n## Ragnarok target\n\nUse only this workspace’s configured server and clank-together MCP. The project is rodecomp, version 2026-02-19. Preserve existing stable IDs and OFFSET/STATIC provenance comments. Missing original evidence is a blocker to a verdict, not permission to invent behavior. The source contains subsystem libraries, not a completed standalone game. Clank compiles individual units from compile.json; it does not run CMake or CTest during checks.\n';
fs.writeFileSync(`${repo}/AGENTS.md`, guide);
execFileSync('git',['-c',`safe.directory=${repo}`,'add','decomp.json','compile.json','toolchain.lock.json','AGENTS.md'],{cwd:repo,stdio:'inherit'});
execFileSync('git',['-c',`safe.directory=${repo}`,'-c','user.name=Clank Together','-c','user.email=bot@clank-together.invalid','commit','-m','Configure rodecomp v142 x86 contributor builds'],{cwd:repo,stdio:'inherit'});
console.log('Configured rodecomp with pinned compiler',compilerHash);