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

59 lines 2.67 kB
import { ValueObject } from "./ValueObject"; import { REPOSITORY_VIOLATION_TYPES } from "../../shared/constants/rules"; interface RepositoryViolationProps { readonly violationType: typeof REPOSITORY_VIOLATION_TYPES.ORM_TYPE_IN_INTERFACE | typeof REPOSITORY_VIOLATION_TYPES.CONCRETE_REPOSITORY_IN_USE_CASE | typeof REPOSITORY_VIOLATION_TYPES.NEW_REPOSITORY_IN_USE_CASE | typeof REPOSITORY_VIOLATION_TYPES.NON_DOMAIN_METHOD_NAME; readonly filePath: string; readonly layer: string; readonly line?: number; readonly details: string; readonly ormType?: string; readonly repositoryName?: string; readonly methodName?: string; } /** * Represents a Repository Pattern violation in the codebase * * Repository Pattern violations occur when: * 1. Repository interfaces contain ORM-specific types * 2. Use cases depend on concrete repository implementations instead of interfaces * 3. Repositories are instantiated with 'new' in use cases * 4. Repository methods use technical names instead of domain language * * @example * ```typescript * // Violation: ORM type in interface * const violation = RepositoryViolation.create( * 'orm-type-in-interface', * 'src/domain/repositories/IUserRepository.ts', * 'domain', * 15, * 'Repository interface uses Prisma-specific type', * 'Prisma.UserWhereInput' * ) * ``` */ export declare class RepositoryViolation extends ValueObject<RepositoryViolationProps> { private constructor(); static create(violationType: typeof REPOSITORY_VIOLATION_TYPES.ORM_TYPE_IN_INTERFACE | typeof REPOSITORY_VIOLATION_TYPES.CONCRETE_REPOSITORY_IN_USE_CASE | typeof REPOSITORY_VIOLATION_TYPES.NEW_REPOSITORY_IN_USE_CASE | typeof REPOSITORY_VIOLATION_TYPES.NON_DOMAIN_METHOD_NAME, filePath: string, layer: string, line: number | undefined, details: string, ormType?: string, repositoryName?: string, methodName?: string): RepositoryViolation; get violationType(): string; get filePath(): string; get layer(): string; get line(): number | undefined; get details(): string; get ormType(): string | undefined; get repositoryName(): string | undefined; get methodName(): string | undefined; getMessage(): string; getSuggestion(): string; private getOrmTypeSuggestion; private getConcreteRepositorySuggestion; private getNewRepositorySuggestion; private getNonDomainMethodSuggestion; getExampleFix(): string; private getOrmTypeExample; private getConcreteRepositoryExample; private getNewRepositoryExample; private getNonDomainMethodExample; } export {}; //# sourceMappingURL=RepositoryViolation.d.ts.map