docs(01): create phase 1 authentication plans
Phase 1: Authentication & Account Basics - 7 plans in 4 waves - Covers AUTH-01 through AUTH-05 requirements - Foundation for household features in Phase 2 - Ready for execution
This commit is contained in:
178
.planning/phases/01-authentication/01-04-PLAN.md
Normal file
178
.planning/phases/01-authentication/01-04-PLAN.md
Normal file
@@ -0,0 +1,178 @@
|
||||
---
|
||||
phase: 01-authentication
|
||||
plan: 04
|
||||
type: execute
|
||||
wave: 2
|
||||
depends_on: ["01-01", "01-02"]
|
||||
files_modified: ["lib/providers/auth_provider.dart", "lib/features/authentication/data/repositories/auth_repository_impl.dart", "lib/app/router.dart", "lib/presentation/pages/splash_page.dart"]
|
||||
autonomous: true
|
||||
user_setup: []
|
||||
|
||||
must_haves:
|
||||
truths:
|
||||
- "Auth state changes trigger UI updates automatically"
|
||||
- "Navigation works based on authentication status"
|
||||
- "Auth repository implementation connects to Supabase"
|
||||
- "Session persists across app restarts"
|
||||
artifacts:
|
||||
- path: "lib/providers/auth_provider.dart"
|
||||
provides: "Global auth state management"
|
||||
min_lines: 35
|
||||
- path: "lib/features/authentication/data/repositories/auth_repository_impl.dart"
|
||||
provides: "Supabase auth implementation"
|
||||
min_lines: 50
|
||||
- path: "lib/app/router.dart"
|
||||
provides: "Auth-based navigation"
|
||||
min_lines: 40
|
||||
- path: "lib/presentation/pages/splash_page.dart"
|
||||
provides: "Initial loading screen"
|
||||
min_lines: 20
|
||||
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/providers/auth_provider.dart"
|
||||
to: "lib/app/router.dart"
|
||||
via: "auth state listening"
|
||||
pattern: "onAuthStateChange|authStateChanges"
|
||||
- from: "lib/features/authentication/data/repositories/auth_repository_impl.dart"
|
||||
to: "supabase.auth"
|
||||
via: "Supabase client usage"
|
||||
pattern: "supabase\\.auth\\."
|
||||
---
|
||||
|
||||
<objective>
|
||||
Implement authentication state management, Supabase repository, and navigation system.
|
||||
|
||||
Purpose: Connect UI components to Supabase authentication, manage auth state globally, and handle navigation based on user authentication status.
|
||||
Output: Working authentication system with session persistence and protected routes.
|
||||
</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>
|
||||
|
||||
<task type="auto">
|
||||
<name>Create auth-aware navigation system</name>
|
||||
<files>lib/app/router.dart, lib/presentation/pages/splash_page.dart</files>
|
||||
<action>
|
||||
Create navigation system with:
|
||||
|
||||
1. SplashPage that:
|
||||
- Shows while checking initial auth state
|
||||
- Navigates to login or home after auth check
|
||||
- Has proper loading indicator
|
||||
- Handles app startup sequence
|
||||
|
||||
2. Router configuration that:
|
||||
- Uses GoRouter for declarative routing
|
||||
- Has protected routes (redirect to login if not authenticated)
|
||||
- Has public routes (login, signup, password reset)
|
||||
- Listens to AuthProvider for auth state changes
|
||||
- Includes proper route definitions:
|
||||
- / → redirect based on auth state
|
||||
- /login → login page
|
||||
- /signup → signup page
|
||||
- /home → protected home route (placeholder)
|
||||
- Handles deep linking properly
|
||||
- Includes proper error handling for navigation
|
||||
</action>
|
||||
<verify>Navigation correctly redirects based on authentication status and all routes are accessible</verify>
|
||||
<done>Complete navigation system that protects routes and responds to authentication changes</done>
|
||||
</task>
|
||||
|
||||
<task type="auto">
|
||||
<name>Integrate auth system with main app</name>
|
||||
<files>lib/main.dart</files>
|
||||
<action>
|
||||
Update main.dart to:
|
||||
1. Wrap MyApp with appropriate providers (Riverpod/ChangeNotifierProvider)
|
||||
2. Initialize AuthProvider with AuthRepositoryImpl
|
||||
3. Configure router with auth state integration
|
||||
4. Set up proper error boundaries
|
||||
5. Ensure proper initialization order
|
||||
6. Add proper app structure with MaterialApp.router
|
||||
7. Configure theme and other app-level settings
|
||||
8. Ensure proper disposal of resources
|
||||
</action>
|
||||
<verify>App starts with splash screen, properly checks auth state, and navigates to appropriate initial screen</verify>
|
||||
<done>Complete app integration with authentication system</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. Navigation system properly protects routes and redirects based on auth status
|
||||
4. Session persistence works across app restarts
|
||||
5. Error handling provides user-friendly feedback
|
||||
6. Loading states work properly during authentication operations
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
Complete authentication system with Supabase integration, state management, and protected navigation ready for UI connection.
|
||||
</success_criteria>
|
||||
|
||||
<output>
|
||||
After completion, create `.planning/phases/01-authentication/01-04-SUMMARY.md`
|
||||
</output>
|
||||
Reference in New Issue
Block a user