/**
* html-patcher 수정 검증 스크립트
* 실제 workbench.html + 실제 observer-script 출력물로 패치 시뮬레이션
*/
const fs = require('fs');
const path = require('path');
// 1. 실제 깨끗한 workbench.html 읽기
const htmlPath = path.join(
process.env.LOCALAPPDATA,
'Programs', 'Antigravity', 'resources', 'app', 'out',
'vs', 'code', 'electron-browser', 'workbench', 'workbench.html'
);
let html = fs.readFileSync(htmlPath, 'utf8');
console.log(`[1] Clean HTML: ${html.length} chars, ${html.split('\n').length} lines`);
console.log(` Has AG SDK: ${html.includes('AG SDK')}`);
// 2. 실제 observer-script.ts의 출력 시뮬레이션 (generateApprovalObserverScript)
const observerModule = require('./extension/out/observer-script');
const observerJS = observerModule.generateApprovalObserverScript(34332);
console.log(`[2] Observer JS: ${observerJS.length} chars`);
console.log(` Contains $': ${observerJS.includes("$'")}`);
console.log(` Contains ')$': ${observerJS.includes("')$")}`);
// 3. 패치 시뮬레이션 — 수정 전 (BUG)
const inlineBlock_buggy = `\n\n`;
let html_buggy = html.replace('