# Tasks: add-toldo-poc-capacitor ## 1. Setup & Scaffolding - [ ] 1.1 Create mono-repo structure (apps/, packages/, openspec/, skills/, docs/) - [ ] 1.2 Initialize Vite + TypeScript in apps/toldo-app - [ ] 1.3 Create packages/core, packages/data, packages/services, packages/ui with package.json - [ ] 1.4 Configure TypeScript path aliases for all packages - [ ] 1.5 Setup Vitest, jsdom, @testing-library dependencies - [ ] 1.6 Initialize Capacitor (@capacitor/core, @capacitor/cli) and add Android platform - [ ] 1.7 Configure capacitor.config.ts (webDir: dist) - [ ] 1.8 Setup linting (eslint) and basic scripts ## 2. Domain Layer (packages/core) - TDD First - [ ] 2.1 Define types/interfaces for all entities (Productor, Producto, Venta, etc.) - [ ] 2.2 Create value objects (Money, Quantity) if needed - [ ] 2.3 Write tests for business rules (productos by productor uniqueness) - [ ] 2.4 Write tests for adjustment rules (require motivo) - [ ] 2.5 Write tests for inventory calculations - [ ] 2.6 Write tests for cuadre calculations - [ ] 2.7 Implement pure domain logic to pass tests - [ ] 2.8 Define repository interfaces in core/contracts ## 3. Data Layer (packages/data) - Integration Tests - [ ] 3.1 Install Dexie.js - [ ] 3.2 Define Dexie schema with version 1 - [ ] 3.3 Write tests for repositories using fake-indexeddb - [ ] 3.4 Implement repository implementations - [ ] 3.5 Add schema migrations support - [ ] 3.6 Test CRUD operations for all entities ## 4. Services Layer (packages/services) - Use Cases - [ ] 4.1 Write tests for InventarioService (initial inventory, differences, week restocks) - [ ] 4.2 Implement InventarioService - [ ] 4.3 Write tests for VentasService - [ ] 4.4 Implement VentasService - [ ] 4.5 Write tests for GastosService - [ ] 4.6 Implement GastosService - [ ] 4.7 Write tests for AjustesService (require motivo) - [ ] 4.8 Implement AjustesService - [ ] 4.9 Write tests for CuadreService (cash/QR calculations) - [ ] 4.10 Implement CuadreService - [ ] 4.11 Write tests for ReportesService - [ ] 4.12 Implement ReportesService - [ ] 4.13 Write tests for ExportImportService (versioned JSON) - [ ] 4.14 Implement ExportImportService with validation/migrations ## 5. UI Layer (packages/ui + apps/toldo-app) - [ ] 5.1 Create base UI components (Button, Input, Card, etc.) - small and reusable - [ ] 5.2 Write tests for UI components with Testing Library - [ ] 5.3 Create composables/hooks for business logic (separate from presentation) - [ ] 5.4 Build pages: Dashboard, Inventario, Ventas, Gastos, Cuadre, Reportes, Ajustes, Config/Export-Import - [ ] 5.5 Ensure components follow SRP, small size, no direct DB/Capacitor imports - [ ] 5.6 Add routing ## 6. Capacitor & Android Integration - [ ] 6.1 Configure capacitor.config.ts properly - [ ] 6.2 Add @capacitor/android platform files - [ ] 6.3 Setup app icons/splash (basic) - [ ] 6.4 Test build: npm run build && npx cap sync android - [ ] 6.5 Verify offline functionality - [ ] 6.6 Document APK build process ## 7. Quality Gates & Documentation - [ ] 7.1 Run typecheck - all packages pass - [ ] 7.2 Run lint - no errors - [ ] 7.3 Run tests - all pass - [ ] 7.4 Build succeeds - [ ] 7.5 Create ADR 0001 documenting architecture decision - [ ] 7.6 Update README with setup instructions - [ ] 7.7 Validate OpenSpec change structure - [ ] 7.8 Review against all skills/checklists