UNPKG

agentsqripts

Version:

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

23 lines (17 loc) 692 B
/** * @file Generate import statements * @description Single responsibility: Create import statements for refactored code */ const path = require('path'); function generateImportStatements(blocks, utilityLocation) { const imports = new Map(); blocks.forEach(block => { const blockDir = path.dirname(block.file); const relativePath = path.relative(blockDir, utilityLocation); const importPath = relativePath.startsWith('.') ? relativePath : `./${relativePath}`; imports.set(block.file, `// In ${block.file}: const { extractedFunction } = require('${importPath}');`); }); return Array.from(imports.values()); } module.exports = generateImportStatements;