diff --git a/.ai-context.md b/.ai-context.md deleted file mode 100644 index 264c82f..0000000 --- a/.ai-context.md +++ /dev/null @@ -1,59 +0,0 @@ -# CacheFlow Spring Boot Starter - AI Context - -## Project Overview -CacheFlow is a Spring Boot starter implementing Russian Doll caching patterns with multi-level cache hierarchy (Local → Redis → Edge). This project focuses on fragment-based caching with dependency tracking and automatic invalidation. - -## Key Components - -### Core Architecture -- **Annotations**: `@CacheFlow`, `@CacheFlowEvict`, `@CacheFlowComposition`, `@CacheFlowFragment` -- **Aspects**: AOP-based caching interception -- **Services**: Fragment caching, dependency tracking, cache management -- **Auto-configuration**: Spring Boot auto-configuration for seamless integration - -### Package Structure -``` -io.cacheflow.spring/ -├── annotation/ # Cache annotations -├── aspect/ # AOP aspects -├── autoconfigure/ # Spring Boot configuration -├── dependency/ # Dependency tracking -├── fragment/ # Fragment caching -├── versioning/ # Cache versioning -└── service/ # Core services -``` - -## Current State -- **Branch**: feature/caching-improvement -- **Recent Work**: Comprehensive testing suite and documentation framework -- **Test Coverage**: 90%+ target with comprehensive unit/integration tests -- **Quality Gates**: Detekt analysis, security scanning, performance validation - -## Key Files to Understand -1. `src/main/kotlin/io/cacheflow/spring/annotation/CacheFlow.kt` - Main caching annotation -2. `src/main/kotlin/io/cacheflow/spring/aspect/CacheFlowAspect.kt` - Core caching logic -3. `src/main/kotlin/io/cacheflow/spring/autoconfigure/CacheFlowAutoConfiguration.kt` - Auto-configuration -4. `AI_MAINTENANCE_RULES.md` - Comprehensive maintenance guidelines -5. `docs/RUSSIAN_DOLL_CACHING_GUIDE.md` - Implementation guide - -## Build Commands -- `./gradlew build` - Full build with tests -- `./gradlew test` - Run test suite -- `./gradlew detekt` - Code quality analysis -- `./gradlew jacocoTestReport` - Coverage report - -## AI Assistant Guidelines -- Follow Russian Doll caching patterns strictly -- Maintain 90%+ test coverage -- Ensure all changes pass Detekt analysis -- Update documentation for any public API changes -- Use structured logging and proper error handling -- Validate all inputs and implement security best practices - -## Common Tasks -- Adding new cache annotations -- Implementing fragment composition features -- Extending dependency tracking -- Adding edge cache providers -- Performance optimization -- Test coverage improvement \ No newline at end of file diff --git a/.ai-patterns.md b/.ai-patterns.md deleted file mode 100644 index 19bd16d..0000000 --- a/.ai-patterns.md +++ /dev/null @@ -1,426 +0,0 @@ -# CacheFlow AI Code Patterns - -## Russian Doll Caching Patterns - -### Fragment Definition Pattern -```kotlin -// ✅ Proper fragment annotation -@CacheFlowFragment( - key = "user-profile", - dependencies = ["user:#{id}", "settings:#{id}"], - ttl = 1800L -) -fun renderUserProfile(@PathVariable id: Long): String { - return templateEngine.process("user-profile", createContext(id)) -} - -// ❌ Avoid: Missing dependencies -@CacheFlowFragment(key = "user-profile") -fun renderUserProfile(@PathVariable id: Long): String { - // Dependencies not tracked -} -``` - -### Composition Pattern -```kotlin -// ✅ Proper fragment composition -@CacheFlowComposition( - fragments = [ - "header:#{userId}", - "content:user-profile:#{userId}", - "footer:global" - ], - key = "user-page:#{userId}" -) -fun renderUserPage(@PathVariable userId: Long): String { - return fragmentComposer.compose( - "header" to renderHeader(userId), - "content" to renderUserProfile(userId), - "footer" to renderFooter() - ) -} -``` - -### Dependency Tracking Pattern -```kotlin -// ✅ Explicit dependency registration -@Service -class UserProfileService { - - @CacheFlow( - key = "user-profile:#{id}", - dependencies = ["user:#{id}", "preferences:#{id}"], - ttl = 3600L - ) - fun getUserProfile(id: Long): UserProfile { - return UserProfile( - user = userService.findById(id), - preferences = preferencesService.findByUserId(id) - ) - } - - // Automatic invalidation when dependencies change - @CacheFlowEvict(patterns = ["user:#{id}"]) - fun updateUser(id: Long, user: User) { - userRepository.save(user) - } -} -``` - -## Testing Patterns - -### Fragment Cache Testing -```kotlin -@SpringBootTest -class FragmentCacheTest { - - @Autowired - private lateinit var fragmentCacheService: FragmentCacheService - - @Test - fun `should cache fragment with dependencies`() { - // Given - val key = "user-profile:123" - val content = "