- Create missing Plan 01-07 (password reset navigation) - Update Plan 01-10 to contain logout functionality (covers AUTH-05) - Split Plan 01-04 into Plans 01-04 and 01-11 (2-3 tasks each) - Fix dependency references throughout phase - Update ROADMAP.md to reflect 11 plans in 4 waves
119 lines
4.3 KiB
Markdown
119 lines
4.3 KiB
Markdown
---
|
|
phase: 01-authentication
|
|
plan: 04
|
|
type: execute
|
|
wave: 2
|
|
depends_on: ["01-01", "01-02"]
|
|
files_modified: ["lib/features/authentication/data/repositories/auth_repository_impl.dart", "lib/providers/auth_provider.dart"]
|
|
autonomous: true
|
|
user_setup: []
|
|
|
|
must_haves:
|
|
truths:
|
|
- "Auth repository implementation connects to Supabase"
|
|
- "Auth state changes trigger UI updates automatically"
|
|
- "Session persists across app restarts"
|
|
artifacts:
|
|
- path: "lib/features/authentication/data/repositories/auth_repository_impl.dart"
|
|
provides: "Supabase auth implementation"
|
|
min_lines: 50
|
|
- path: "lib/providers/auth_provider.dart"
|
|
provides: "Global auth state management"
|
|
min_lines: 35
|
|
key_links:
|
|
- from: "lib/providers/auth_provider.dart"
|
|
to: "lib/features/authentication/data/repositories/auth_repository_impl.dart"
|
|
via: "dependency injection"
|
|
pattern: "AuthRepository|_authRepository"
|
|
- from: "lib/features/authentication/data/repositories/auth_repository_impl.dart"
|
|
to: "supabase.auth"
|
|
via: "Supabase client usage"
|
|
pattern: "supabase\\.auth\\."
|
|
---
|
|
|
|
<objective>
|
|
Implement authentication repository and state management.
|
|
|
|
Purpose: Connect UI components to Supabase authentication and manage auth state globally.
|
|
Output: Working authentication system with session persistence and state management.
|
|
</objective>
|
|
|
|
<execution_context>
|
|
@~/.opencode/get-shit-done/workflows/execute-plan.md
|
|
@~/.opencode/get-shit-done/templates/summary.md
|
|
</execution_context>
|
|
|
|
<context>
|
|
@.planning/PROJECT.md
|
|
@.planning/ROADMAP.md
|
|
@.planning/STATE.md
|
|
@.planning/phases/01-authentication/01-RESEARCH.md
|
|
</context>
|
|
|
|
<tasks>
|
|
|
|
<task type="auto">
|
|
<name>Implement AuthRepository with Supabase</name>
|
|
<files>lib/features/authentication/data/repositories/auth_repository_impl.dart</files>
|
|
<action>
|
|
Create AuthRepositoryImpl class that:
|
|
1. Implements AuthRepository interface from plan 02
|
|
2. Uses supabase.auth for all operations:
|
|
- signUp() with email/password, handles AuthResponse
|
|
- signIn() with email/password, handles AuthResponse
|
|
- signOut() to clear session
|
|
- resetPassword() with email and redirect URL
|
|
- getCurrentUser() from supabase.auth.currentUser
|
|
- authStateChanges() stream from onAuthStateChange
|
|
3. Converts Supabase errors to custom exceptions
|
|
4. Maps User to AuthUser model
|
|
5. Includes proper null safety handling
|
|
6. Has comprehensive error handling
|
|
7. Follows repository pattern correctly
|
|
8. Uses proper async/await patterns
|
|
</action>
|
|
<verify>Repository implementation connects to Supabase and handles all auth operations without throwing unhandled exceptions</verify>
|
|
<done>Complete Supabase authentication repository ready for integration with state management</done>
|
|
</task>
|
|
|
|
<task type="auto">
|
|
<name>Create AuthProvider for state management</name>
|
|
<files>lib/providers/auth_provider.dart</files>
|
|
<action>
|
|
Create AuthProvider class that:
|
|
1. Extends ChangeNotifier or uses Riverpod
|
|
2. Depends on AuthRepository (injection)
|
|
3. Manages auth state (User?, loading, error)
|
|
4. Listens to repository.authStateChanges() stream
|
|
5. Provides methods:
|
|
- signUp(String email, String password)
|
|
- signIn(String email, String password)
|
|
- signOut()
|
|
- resetPassword(String email)
|
|
6. Handles loading states and errors
|
|
7. Updates UI state automatically
|
|
8. Properly disposes of stream subscriptions
|
|
9. Has current User? getter
|
|
10. Includes proper error propagation
|
|
</action>
|
|
<verify>AuthProvider updates state correctly when auth events occur and maintains loading/error states properly</verify>
|
|
<done>Global auth state management that automatically responds to authentication changes</done>
|
|
</task>
|
|
|
|
</tasks>
|
|
|
|
<verification>
|
|
1. Authentication repository successfully connects to Supabase and handles all auth methods
|
|
2. State management responds correctly to auth state changes
|
|
3. Session persistence works across app restarts
|
|
4. Error handling provides user-friendly feedback
|
|
5. Loading states work properly during authentication operations
|
|
</verification>
|
|
|
|
<success_criteria>
|
|
Complete authentication repository and state management system ready for navigation integration.
|
|
</success_criteria>
|
|
|
|
<output>
|
|
After completion, create `.planning/phases/01-authentication/01-04-SUMMARY.md`
|
|
</output> |