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

67 lines 2.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FrameworkLeak = void 0; const ValueObject_1 = require("./ValueObject"); const rules_1 = require("../../shared/constants/rules"); const FrameworkCategories_1 = require("../constants/FrameworkCategories"); /** * Represents a framework leak violation in the codebase * * A framework leak occurs when a domain layer file imports a framework-specific package, * creating tight coupling and violating Clean Architecture principles. * * @example * ```typescript * // Bad: Domain layer importing Prisma * const leak = FrameworkLeak.create( * '@prisma/client', * 'src/domain/User.ts', * 'domain', * 'ORM', * 5 * ) * * console.log(leak.getMessage()) * // "Domain layer imports framework-specific package "@prisma/client". Use interfaces and dependency injection instead." * ``` */ class FrameworkLeak extends ValueObject_1.ValueObject { constructor(props) { super(props); } static create(packageName, filePath, layer, category, line) { return new FrameworkLeak({ packageName, filePath, layer, category, line, }); } get packageName() { return this.props.packageName; } get filePath() { return this.props.filePath; } get layer() { return this.props.layer; } get category() { return this.props.category; } get line() { return this.props.line; } getMessage() { return rules_1.FRAMEWORK_LEAK_MESSAGES.DOMAIN_IMPORT.replace(rules_1.FRAMEWORK_LEAK_MESSAGES.PACKAGE_PLACEHOLDER, this.props.packageName); } getSuggestion() { return rules_1.FRAMEWORK_LEAK_MESSAGES.SUGGESTION; } getCategoryDescription() { return (FrameworkCategories_1.FRAMEWORK_CATEGORY_DESCRIPTIONS[this.props.category] || FrameworkCategories_1.DEFAULT_FRAMEWORK_CATEGORY_DESCRIPTION); } } exports.FrameworkLeak = FrameworkLeak; //# sourceMappingURL=FrameworkLeak.js.map