UNPKG

@samiyev/guardian

Version:

Research-backed code quality guardian for AI-assisted development. Detects hardcodes, secrets, circular deps, framework leaks, entity exposure, and 9 architecture violations. Enforces Clean Architecture/DDD principles. Works with GitHub Copilot, Cursor, W

37 lines 1.44 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ParseSourceFiles = void 0; const DependencyGraph_1 = require("../../../domain/entities/DependencyGraph"); /** * Pipeline step responsible for AST parsing and dependency graph construction */ class ParseSourceFiles { codeParser; constructor(codeParser) { this.codeParser = codeParser; } execute(request) { const dependencyGraph = new DependencyGraph_1.DependencyGraph(); let totalFunctions = 0; for (const sourceFile of request.sourceFiles) { dependencyGraph.addFile(sourceFile); if (sourceFile.path.isTypeScript()) { const tree = this.codeParser.parseTypeScript(sourceFile.content); const functions = this.codeParser.extractFunctions(tree); totalFunctions += functions.length; } for (const imp of sourceFile.imports) { dependencyGraph.addDependency(sourceFile.path.relative, this.resolveImportPath(imp, sourceFile.path.relative, request.rootDir)); } } return { dependencyGraph, totalFunctions }; } resolveImportPath(importPath, _currentFile, _rootDir) { if (importPath.startsWith(".")) { return importPath; } return importPath; } } exports.ParseSourceFiles = ParseSourceFiles; //# sourceMappingURL=ParseSourceFiles.js.map