diff --git a/packages/guardian/CHANGELOG.md b/packages/guardian/CHANGELOG.md index 46050ef..35d49e9 100644 --- a/packages/guardian/CHANGELOG.md +++ b/packages/guardian/CHANGELOG.md @@ -5,6 +5,37 @@ All notable changes to @samiyev/guardian will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.6.3] - 2025-11-24 + +### Fixed + +**🐛 Repository Pattern Detection - Reduced False Positives** + +Fixed overly strict repository method name validation that was flagging valid DDD patterns as violations. + +- ✅ **Added support for common DDD repository patterns:** + - `has*()` methods - e.g., `hasProject()`, `hasPermission()` + - `is*()` methods - e.g., `isCached()`, `isActive()` + - `exists*()` methods - e.g., `existsById()`, `existsByEmail()` + - `clear*()` methods - e.g., `clearCache()`, `clearAll()` + - `store*()` methods - e.g., `storeMetadata()`, `storeFile()` + - Lifecycle methods: `initialize()`, `close()`, `connect()`, `disconnect()` + +- 🎯 **Impact:** + - Reduced false positives in real-world DDD projects + - Better alignment with Domain-Driven Design best practices + - More practical for cache repositories, connection management, and business queries + +- 📚 **Why these patterns are valid:** + - Martin Fowler's Repository Pattern allows domain-specific query methods + - DDD recommends using ubiquitous language in method names + - Lifecycle methods are standard for resource management in repositories + +### Technical + +- Updated `domainMethodPatterns` in `RepositoryPatternDetector.ts` with 11 additional valid patterns +- All existing functionality remains unchanged + ## [0.6.2] - 2025-11-24 ### Added diff --git a/packages/guardian/package.json b/packages/guardian/package.json index adfed9e..0e7b2a7 100644 --- a/packages/guardian/package.json +++ b/packages/guardian/package.json @@ -1,6 +1,6 @@ { "name": "@samiyev/guardian", - "version": "0.6.2", + "version": "0.6.3", "description": "Research-backed code quality guardian for AI-assisted development. Detects hardcodes, circular deps, framework leaks, entity exposure, and 8 architecture violations. Enforces Clean Architecture/DDD principles. Works with GitHub Copilot, Cursor, Windsurf, Claude, ChatGPT, Cline, and any AI coding tool.", "keywords": [ "puaros", diff --git a/packages/guardian/src/infrastructure/analyzers/RepositoryPatternDetector.ts b/packages/guardian/src/infrastructure/analyzers/RepositoryPatternDetector.ts index 1a1ac68..8eaae6d 100644 --- a/packages/guardian/src/infrastructure/analyzers/RepositoryPatternDetector.ts +++ b/packages/guardian/src/infrastructure/analyzers/RepositoryPatternDetector.ts @@ -78,6 +78,17 @@ export class RepositoryPatternDetector implements IRepositoryPatternDetector { /^get[A-Z]/, /^search/, /^list/, + /^has[A-Z]/, + /^is[A-Z]/, + /^exists[A-Z]/, + /^existsBy[A-Z]/, + /^clear[A-Z]/, + /^clearAll$/, + /^store[A-Z]/, + /^initialize$/, + /^close$/, + /^connect$/, + /^disconnect$/, ] private readonly concreteRepositoryPatterns = [