import fs from 'fs';
import path from 'path';

function walk(dir) {
  let results = [];
  const entries = fs.readdirSync(dir, { withFileTypes: true });
  for (const entry of entries) {
    const fullPath = path.join(dir, entry.name);
    if (entry.isDirectory()) {
      results = results.concat(walk(fullPath));
    } else if (/\.(tsx|ts|jsx|js|css|scss)$/.test(entry.name)) {
      results.push(fullPath);
    }
  }
  return results;
}

const files = walk('src');
console.log(`Deep scanning ${files.length} source files in src/...`);

const rawMatches = [];

files.forEach(f => {
  const content = fs.readFileSync(f, 'utf8');
  const lines = content.split('\n');
  lines.forEach((l, i) => {
    if (/round|shadow|gradient/i.test(l)) {
      rawMatches.push({ file: f, line: i + 1, content: l.trim() });
    }
  });
});

console.log(`Total occurrences found: ${rawMatches.length}`);
rawMatches.forEach((m, idx) => {
  console.log(`${idx + 1}. ${m.file}:${m.line} -> ${m.content}`);
});
