@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
32 lines • 1.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RepositoryFileAnalyzer = void 0;
const rules_1 = require("../../shared/constants/rules");
/**
* Analyzes files to determine their role in the repository pattern
*
* Identifies repository interfaces and use cases based on file paths
* and architectural layer conventions.
*/
class RepositoryFileAnalyzer {
/**
* Checks if a file is a repository interface
*/
isRepositoryInterface(filePath, layer) {
if (layer !== rules_1.LAYERS.DOMAIN) {
return false;
}
return /I[A-Z]\w*Repository\.ts$/.test(filePath) && /repositories?\//.test(filePath);
}
/**
* Checks if a file is a use case
*/
isUseCase(filePath, layer) {
if (layer !== rules_1.LAYERS.APPLICATION) {
return false;
}
return /use-cases?\//.test(filePath) && /[A-Z][a-z]+[A-Z]\w*\.ts$/.test(filePath);
}
}
exports.RepositoryFileAnalyzer = RepositoryFileAnalyzer;
//# sourceMappingURL=RepositoryFileAnalyzer.js.map