27 lines
1002 B
JavaScript
27 lines
1002 B
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const dump = JSON.parse(fs.readFileSync(
|
|
path.join(process.env.USERPROFILE, '.gemini/antigravity/bridge/deep-inspect-result.json'), 'utf8'
|
|
));
|
|
|
|
function printTree(node, indent, maxDepth) {
|
|
if (!node || indent > maxDepth) return;
|
|
const tag = (node.tag || '?').toLowerCase();
|
|
const clsArr = (node.cls || '').split(' ').filter(c => c.length > 0);
|
|
const clsShort = clsArr.slice(0, 3).join(' ');
|
|
const text = (node.text || '').substring(0, 40).replace(/[\n\r]+/g, ' ');
|
|
const childCount = (node.children || []).length;
|
|
let line = ' '.repeat(indent) + tag;
|
|
if (clsShort) line += '.' + clsArr[0];
|
|
if (childCount) line += ' [' + childCount + ' children]';
|
|
if (text && childCount === 0) line += ' = "' + text + '"';
|
|
console.log(line);
|
|
if (node.children) {
|
|
for (const c of node.children) printTree(c, indent + 1, maxDepth);
|
|
}
|
|
}
|
|
|
|
console.log('=== FULL DOM TREE (depth 8) ===');
|
|
printTree(dump.bodyTree || dump.body, 0, 8);
|