UNPKG

agentsqripts

Version:

Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems

35 lines (28 loc) 924 B
/** * @file Get all project files recursively * @description Single responsibility: Recursively scan for project files */ const fs = require('fs'); const path = require('path'); async function getAllProjectFiles(projectPath) { const files = []; const extensions = ['.js', '.ts', '.jsx', '.tsx']; async function traverse(dir) { try { const entries = await fs.promises.readdir(dir, { withFileTypes: true }); for (const entry of entries) { const fullPath = path.join(dir, entry.name); if (entry.isDirectory() && !entry.name.includes('node_modules')) { await traverse(fullPath); } else if (extensions.includes(path.extname(fullPath))) { files.push(fullPath); } } } catch (error) { // Skip directories we can't read } } await traverse(projectPath); return files; } module.exports = getAllProjectFiles;