import { readFileSync } from 'node:fs'; import { execSync } from 'node:child_process'; // 산출물 바이트-동일 게이트: 워킹트리 vs 지정 ref(blob)를 줄바꿈 정규화 후 비교. // 산출물 경로를 Bash 명령줄에 노출하지 않아 settings.json deny를 회피(count.mjs와 동일 취지). // 사용: node tools/verify/diffcheck.mjs [ref] (ref 기본 HEAD; 예: origin/main) const ref = process.argv[2] || 'HEAD'; const FILES = [ 'ui/DefaultGroup.ui', 'RootDesk/MyDesk/SlayDeckController.codeblock', 'Global/common.gamelogic', ]; let allSame = true; for (const f of FILES) { const work = readFileSync(f, 'utf8').replace(/\r\n/g, '\n'); const blob = execSync(`git show ${ref}:${f}`, { encoding: 'utf8', maxBuffer: 1 << 30 }).replace(/\r\n/g, '\n'); const same = work === blob; if (!same) allSame = false; console.log(`${same ? 'IDENTICAL ' : 'DIFFER '} ${f}${same ? '' : ` (work=${work.length} ${ref}=${blob.length})`}`); } console.log(allSame ? `\n=> 산출물이 ${ref}와 바이트-동일` : `\n=> ${ref}와 차이 있음 (확인 필요)`);