diff --git a/tools/verify/diffcheck.mjs b/tools/verify/diffcheck.mjs index 25889c7..3f2464e 100644 --- a/tools/verify/diffcheck.mjs +++ b/tools/verify/diffcheck.mjs @@ -1,9 +1,10 @@ import { readFileSync } from 'node:fs'; import { execSync } from 'node:child_process'; -// 산출물 바이트-동일 게이트: 워킹트리 vs HEAD(blob)를 줄바꿈 정규화 후 비교. +// 산출물 바이트-동일 게이트: 워킹트리 vs 지정 ref(blob)를 줄바꿈 정규화 후 비교. // 산출물 경로를 Bash 명령줄에 노출하지 않아 settings.json deny를 회피(count.mjs와 동일 취지). -// 사용: node tools/verify/diffcheck.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', @@ -12,9 +13,9 @@ const FILES = [ let allSame = true; for (const f of FILES) { const work = readFileSync(f, 'utf8').replace(/\r\n/g, '\n'); - const blob = execSync(`git show HEAD:${f}`, { encoding: 'utf8', maxBuffer: 1 << 30 }).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} blob=${blob.length})`}`); + console.log(`${same ? 'IDENTICAL ' : 'DIFFER '} ${f}${same ? '' : ` (work=${work.length} ${ref}=${blob.length})`}`); } -console.log(allSame ? '\n=> 산출물 바이트-동일 (리팩터 안전)' : '\n=> 차이 있음 (내용 변경 — 확인 필요)'); +console.log(allSame ? `\n=> 산출물이 ${ref}와 바이트-동일` : `\n=> ${ref}와 차이 있음 (확인 필요)`);