--- phase: 01-authentication plan: 02 type: execute wave: 1 depends_on: [] files_modified: ["lib/features/authentication/data/models/auth_user.dart", "lib/core/errors/auth_exceptions.dart", "lib/features/authentication/domain/repositories/auth_repository.dart"] autonomous: true user_setup: [] must_haves: truths: - "Auth model represents user data consistently" - "Auth exceptions provide clear error messages" - "Auth repository defines interface for auth operations" artifacts: - path: "lib/features/authentication/data/models/auth_user.dart" provides: "User data model" min_lines: 15 - path: "lib/core/errors/auth_exceptions.dart" provides: "Custom auth error handling" min_lines: 20 - path: "lib/features/authentication/domain/repositories/auth_repository.dart" provides: "Auth operations interface" min_lines: 25 key_links: - from: "lib/features/authentication/domain/repositories/auth_repository.dart" to: "lib/features/authentication/data/models/auth_user.dart" via: "method signatures" pattern: "Future|AuthUser" - from: "lib/core/errors/auth_exceptions.dart" to: "lib/features/authentication/domain/repositories/auth_repository.dart" via: "exception handling" pattern: "throws.*Exception" --- Create authentication data models, error handling system, and repository interface. Purpose: Establish clean architecture foundations that separate concerns and provide type safety for authentication operations. Output: Domain models, custom exceptions, and repository interface that abstract Supabase implementation details. @~/.opencode/get-shit-done/workflows/execute-plan.md @~/.opencode/get-shit-done/templates/summary.md @.planning/PROJECT.md @.planning/ROADMAP.md @.planning/STATE.md @.planning/phases/01-authentication/01-RESEARCH.md Create AuthUser model lib/features/authentication/data/models/auth_user.dart Create AuthUser data class that: 1. Extends or wraps Supabase User model for flexibility 2. Contains essential user fields (id, email, created_at, email_verified) 3. Includes fromSupabase() factory constructor 4. Includes copyWith() method for immutability 5. Includes toString() for debugging 6. Follows clean architecture pattern (data layer) 7. Has proper null safety handling AuthUser model compiles without errors and properly handles Supabase User conversion AuthUser model provides clean abstraction over Supabase User with necessary fields Create custom auth exceptions lib/core/errors/auth_exceptions.dart Create custom exception classes that: 1. Extend Exception base class 2. Include specific auth error types: - AuthException (base) - InvalidCredentialsException - UserNotFoundException - WeakPasswordException - EmailAlreadyInUseException - NetworkException - SessionExpiredException 3. Each exception has user-friendly message field 4. Include fromSupabaseError() factory for converting Supabase errors 5. Follow consistent error code patterns 6. Include proper documentation Custom exceptions compile and provide meaningful error messages for different auth scenarios Comprehensive error handling system that maps Supabase errors to user-friendly messages Create AuthRepository interface lib/features/authentication/domain/repositories/auth_repository.dart Create abstract AuthRepository class that: 1. Defines interface for all auth operations: - Future signUp(String email, String password) - Future signIn(String email, String password) - Future signOut() - Future resetPassword(String email) - Future getCurrentUser() - Stream authStateChanges() 2. Returns custom exceptions for error cases 3. Follows clean architecture (domain layer) 4. Has comprehensive documentation 5. Uses proper async/await patterns 6. Includes null safety throughout AuthRepository interface compiles without implementation and clearly defines all required auth methods Clean interface that abstracts authentication operations from Supabase implementation 1. All models and interfaces compile without errors 2. Type safety is maintained throughout (no 'any' types) 3. Error handling covers all major auth scenarios 4. Clean architecture layers are properly separated 5. Documentation is comprehensive for future implementers Authentication domain foundation is established with proper models, error handling, and repository interface ready for implementation. After completion, create `.planning/phases/01-authentication/01-02-SUMMARY.md`