Commit Graph

85 Commits

Author SHA1 Message Date
clawd 53f4df6e3c feat(07-02): Add CI/CD deployment scripts
- scripts/deploy.sh: Full deploy flow with fresh builds (--no-cache)
- scripts/build-check.sh: Pre-flight staleness check
- Docker labels for build tracking (git commit + timestamp)
- Prevents stale container bug from recurring
2026-03-03 17:20:23 +01:00
clawd 355919e07d checkpoint: PHASE 06 COMPLETE - E2E testing infrastructure + 20 test suite ready 2026-03-03 14:10:18 +01:00
clawd dbaaf78de5 feat(06-05): Expand E2E test coverage 2026-03-03 12:11:40 +01:00
clawd 0ff29a5d3b feat(06-04): Playwright E2E test suite execution 2026-03-03 09:05:46 +01:00
clawd 99ff53250d checkpoint: PHASE 06-03 - E2E testing infrastructure validated 2026-03-03 04:57:12 +01:00
clawd 1f93f2d4ad feat(06-03): Update Playwright config and tests to ES modules syntax 2026-03-03 04:56:51 +01:00
clawd fbba2d894d feat(06-01): Exercise recommendations API endpoint + frontend components (coach-assisted suggestions) 2026-03-03 03:54:12 +01:00
clawd f580fa81a6 feat(05-03): Implement API fallback handling for research display
- Enhanced exaSearch service with Exa API + fallback tier system
  * Tier 1: Exa API (primary)
  * Tier 2: Synthetic results with suggested web sources
  * Improved error handling with graceful degradation

- Updated backend exerciseResearch route to return provider info
  * Returns 'provider' field identifying which API was used
  * Returns 'status' field (success/degraded) for UI feedback
  * Better error messages for debugging

- Enhanced ResearchDisplay component with fallback feedback
  * New ResearchProviderBadge shows which provider was used
  * Visual indicators for fallback results (Suggested badge)
  * Support for multiple provider types (exa, fallback, gemini, etc.)
  * Improved error handling and recovery flows

- Updated ExerciseResearchPanel with better error handling
  * Proper response parsing from backend
  * Forwards provider and status info to display component
  * Improved accessibility with tooltip hints

- Added comprehensive Research Display styling
  * Responsive layout for mobile and desktop
  * Visual hierarchy for summaries and sources
  * Provider badge styling with color-coding
  * Fallback state indicators for user awareness
2026-03-02 23:45:07 +01:00
clawd 2a0496b915 feat(05-03): frontend fallback integration for research display
- ExerciseResearchPanel: add ProviderBadge component showing which AI
  tier (Ollama/Gemini/OpenRouter/OpenCode/Exa) served the response
- Add auto-retry on 429/503 with 2s delay and retry counter in button
- Normalize error messages for common failure modes (network, rate-limit)
- ResearchDisplay: pass onRetry prop to error state for inline retry button
- CSS: .research-panel-controls flex row, .provider-badge with per-provider
  colour coding, .rd-error-actions + .rd-retry button styles
2026-03-02 23:44:32 +01:00
clawd ab87e54630 feat(05-03): Integrate AI fallback system into research search (Exa → Ollama/Gemini/OpenRouter/OpenCode) 2026-03-02 23:44:03 +01:00
clawd 6472eb8c6c feat(05-03): ResearchDisplay component + dark-theme encyclopedia UI
- Add ResearchDisplay.jsx: pure presentational component for research
  data with loading skeleton, accessible error state, and source cards
- Refactor ExerciseResearchPanel to delegate rendering to ResearchDisplay
  (separates fetch/state logic from display)
- Add ExerciseEncyclopediaPage.css: full dark-theme stylesheet using
  CSS variables (--bg-*, --text-*, --accent, --border, --radius-*)
  replacing the light-theme WorkoutEditPage.css import
- Update ExerciseEncyclopediaPage.jsx: new semantic class names,
  keyboard-accessible card toggle (Enter key + role=button + aria-expanded)
- Mobile-responsive at 600px breakpoint

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 20:38:14 +01:00
clawd 210a2d15a9 config: switch to Ollama-first strategy (local AI priority)
Changed API fallback chain:
- Tier 1: Ollama (local, free, always available)
- Tier 2: Gemini (free tier with quota limits)
- Tier 3: OpenRouter (cheap, flexible fallback)
- Tier 4: OpenCode (final backup)

This saves costs by using local Ollama for most tasks.
OpenRouter only used when Ollama unavailable.
2026-03-02 19:48:41 +01:00
clawd 2f6392a807 config: reorder API fallbacks - Gemini → OpenRouter → OpenCode
Changed priority:
- Tier 1: Gemini (primary, free but quota-limited)
- Tier 2: OpenRouter (secondary, cheaper & more flexible)
- Tier 3: OpenCode (tertiary, final fallback)

OpenRouter is better: supports multiple models, cheaper per-token,
intelligent routing. Moved to primary fallback position.
2026-03-02 19:43:55 +01:00
clawd 2bc4c947ae config: upgrade to 3-tier fallback system (Gemini → OpenCode → OpenRouter)
Added OpenRouter as tertiary fallback:
- Primary: Gemini (free tier, quota-limited)
- Secondary: OpenCode (fallback if Gemini quota exceeded)
- Tertiary: OpenRouter (final fallback, supports multiple models)

gemini-fallback.js now tries all three in sequence with proper error handling.
2026-03-02 19:39:33 +01:00
clawd 0c37d6ea91 config: add OpenCode API fallback for Gemini quota
- Configured OpenCode as fallback when Gemini quota exceeded
- Created gemini-fallback.js utility (tries Gemini → OpenCode)
- API keys stored in .env (excluded from git)
- PM unblocked: can resume 05-03 with fallback system

Flow: Gemini (primary) → OpenCode (fallback) → fail gracefully
2026-03-02 19:38:25 +01:00
clawd f7c654325f checkpoint: 05-03 completed 2026-03-02 19:23:04 +01:00
clawd 83ccd6c601 feat(05-03): Exercise research frontend integration
- Add ExerciseResearchPanel component with Get Research button, loading state, summary display, and source links
- Add ExerciseEncyclopediaPage with exercise list and integrated research panel
- Wire encyclopedia view into App.jsx navigation
- Add encyclopedia nav button to Dashboard
- Add CSS for research panel and encyclopedia search

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 19:20:40 +01:00
clawd 53f026aee2 feat(05-02): exa-search research integration 2026-03-02 14:10:32 +01:00
clawd 994cc9e984 feat(05-01): Exercise database schema + CRUD API 2026-03-02 13:03:30 +01:00
clawd 5a9ea9c9a8 checkpoint: phase 05 (exercise encyclopedia) ready to start
Phase 04 (workout modification) complete:
- 14 commits rebased onto main
- All features verified and staged
- Ready for merge

Phase 05 structure defined:
- 05-01: Exercise DB schema & CRUD API
- 05-02: AI research integration (exa-search)
- 05-03: Demo video generation (Veo)
- 05-04: Search & Add UI
- 05-05: Exercise detail view
- 05-06: User ratings & feedback

Next: PM starts 05-01 (backend foundation)
2026-03-02 09:26:32 +01:00
clawd fac53a3605 chore: add dist and build artifacts to .gitignore
- Exclude frontend/dist/ (build output)
- Exclude .py files (script templates)
- Exclude PY temp files
2026-03-02 09:25:10 +01:00
clawd 994f406050 fix: make backend listen on 0.0.0.0 instead of localhost
This allows Traefik and other containers on the docker network to reach the backend API.
2026-03-02 09:25:10 +01:00
clawd f941011130 chore: remove stray EOF and PLANEOF files 2026-03-02 09:25:10 +01:00
clawd fa95e880b2 docs: add CLAUDE.md — agent development guidelines
- Core principles for autonomous agents with verification
- Checkpoint-based self-monitoring patterns
- Generalized agent workflow (no project-specific agents)
- Single source of truth in ~/clawd/claude-agents-skills/
- PM autonomy and cron job configuration
- Verification protocol to prevent hallucinations
- Together with CODING-CONVENTIONS.md, foundation for agent development
2026-03-02 09:25:10 +01:00
clawd f63f4c0420 04-06-02: Save error handling & retry logic
- Added specific error type differentiation:
  * Network errors → 'Anslutning misslyckades'
  * Validation (400) → 'Ogiltiga ändringar'
  * Auth (401/403) → 'Saknar behörighet'
  * Server (500+) → 'Serverfel'
  * Generic fallback messages

- Implemented retry tracking:
  * retryCount state for monitoring attempts
  * lastSavePayload storage for potential retry (future feature)
  * Console logging with context for debugging

- Enhanced error handling:
  * getErrorMessage() function for error classification
  * Comprehensive error logging with workout/exercise context
  * Draft preserved on all error types (no data loss)

- Improved UI/UX:
  * Error banner with specific, actionable messages
  * 'Försök igen' button with retry tracking
  * Sync status feedback (idle/saving/saved/error)
  * Success checkmark animation (2s duration)
  * Spinner animation during save

- CSS Enhancements:
  * @keyframes spin for loading spinner
  * @keyframes slideInCheckmark for success feedback
  * Mobile-responsive error banner (flex column on <480px)
  * Smooth animations for state transitions

Tests: npm run build ✓ (no syntax errors)
Files modified:
  - frontend/src/pages/WorkoutEditPage.jsx
  - frontend/src/pages/WorkoutEditPage.css
2026-03-02 09:25:10 +01:00
clawd 475cf10b17 04-06: Plan persistence improvements and implement draft persistence
- Created 04-06-PLAN.md outlining persistence improvements phases
- Phase 04-06-01: Draft persistence via localStorage
  - Added useDraftWorkout hook for auto-saving/loading drafts
  - Integrated hook into WorkoutEditPage
  - Added draft recovery prompt UI
  - Drafts cleared after successful save
- Phase 04-06-02: Save error handling & retry (scaffolding)
  - Added error state and syncStatus tracking
  - Added handleRetry() for failed saves
  - Error banner with retry button
- Phase 04-06-03: Sync status UI (scaffolding)
  - Added visual feedback for save progress
  - Status indicators: saving, saved, error
  - Disabled UI during save to prevent conflicts
- Created comprehensive styles for new UI components

Status: 04-06-01 complete and integrated. Ready for testing.
2026-03-02 09:25:10 +01:00
clawd cf85e9e314 04-05: Reset to Original feature - custom workouts can be reverted to program versions
- Added reset button (refresh icon) to custom workout cards
- Implemented confirmation dialog to prevent accidental resets
- Integrated with DELETE /api/custom-workouts/:id endpoint
- Added CSS styling: reset button, success message, modal dialog
- Added refresh icon to SVG library
- Frontend build successful

Changes:
- frontend/src/pages/WorkoutSelectPage.jsx (reset flow logic)
- frontend/src/App.css (170 new lines for reset/modal styling)
- frontend/src/components/Icons.jsx (refresh icon)
- Checkpoint updated with task completion metadata
2026-03-02 09:25:10 +01:00
clawd b5c9250a10 feat(04-04-visual-distinction): Add custom vs program workout badges on WorkoutSelectPage
- Fetch custom workouts for authenticated user
- Display 'Anpassad' (custom) or 'Program' badge on each workout card
- Add badge component with orange accent for custom, muted color for program
- Badge positioned bottom-right of workout icon
- Responsive styling consistent with Gravl dark theme
- All build checks pass
2026-03-02 09:25:10 +01:00
clawd a24199e56c feat(04-03-partial): ExercisePicker and WorkoutEditPage components - swap/add/remove exercises with sets/reps editing 2026-03-02 09:25:10 +01:00
clawd 5fd21719d0 test(e2e): add Playwright with browser tests for login, logo, dashboard 2026-03-02 09:25:10 +01:00
clawd 4bd2c9607d feat(phase-4): Backend API for custom workouts
- Add custom_workouts and custom_workout_exercises tables (schema)
- New endpoints:
  - GET /api/exercises - List all exercises for picker
  - POST /api/custom-workouts - Fork program workout
  - GET /api/custom-workouts - List user's custom workouts
  - GET /api/custom-workouts/:id - Get workout with exercises
  - PUT /api/custom-workouts/:id - Update workout exercises
  - DELETE /api/custom-workouts/:id - Delete custom workout
- Updated endpoints for source_type support:
  - GET /api/logs - Filter by source_type and custom_workout_id
  - POST /api/logs - Save with source_type and custom_workout_id
  - DELETE /api/logs - Support custom workout log deletion
- Adds Phase 4 planning overview

Completes: 04-01-schema-migration, 04-02-backend-api
Next: 04-03-frontend-workout-edit
2026-03-02 09:25:10 +01:00
clawd 22750bfa06 fix(staging): fix Traefik service linking with explicit service labels 2026-03-02 09:25:10 +01:00
clawd 4b39f39e3e feat(staging): add Traefik-based staging with automatic subdomains 2026-03-02 09:25:10 +01:00
clawd 7694ca6313 feat(infra): add staging environment setup with docker-compose and scripts 2026-03-02 09:25:10 +01:00
sphinxen 15d7aff096 Merge pull request 'feature/03-design-polish' (#1) from feature/03-design-polish into main
Reviewed-on: https://gitea.homelab.local/clawd/gravl/pulls/1
2026-03-02 09:08:10 +01:00
clawd 362f4eed49 checkpoint: mark phase 3 complete (03-01, 03-02, 03-03) 2026-03-01 00:03:48 +01:00
clawd 6d1da03fec 03-03: Workout Experience Polish - enhanced exercise cards, progress badges, rest timer, KLART button, warmup styling 2026-02-28 23:47:36 +01:00
clawd 5d0e0e3952 feat(dashboard): polish header logo, stat cards, calendar and animations
- Replace gravl icon text with Logo component in dashboard header
- Stat cards: gradient depth + per-card colour accent (orange/green/amber)
- Calendar today: pulsing glow animation; workout days get subtle brand tint
- Arrow nudge animation on today-workout-card hover
- Section stagger fade-in on page load (calendar → coach → stats)
- Larger stat-value font (3xl) with tighter letter-spacing
- Consistent gap spacing in dashboard-main (space-6)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 23:22:34 +01:00
clawd be4a149a47 feat(auth): polish login/register with logo, gradients and animations 2026-02-28 22:59:08 +01:00
clawd 0cd6cd0269 checkpoint: mark 03-01-login-onboarding-polish as completed 2026-02-28 22:58:24 +01:00
clawd e40b486ae5 feat(onboarding): add conversational ChatOnboarding component 2026-02-28 22:06:15 +01:00
clawd 04bab32e26 design: WorkoutPage Hevy-style redesign + AlternativeModal + backend API
- Add GET /api/exercises/:id/alternatives endpoint
- Add GET /api/exercises/:id/last-workout endpoint
- New AlternativeModal component for swapping exercises
- WorkoutPage: single-tap logging, +/- buttons, rest timer
- Updated Icons with new workout icons
- Polish: card shadows, borders, micro-interactions
- Tasks directory for project management
2026-02-28 21:25:23 +01:00
clawd 0e5cec927a docs: add TDD coding conventions
Red/Green/Refactor cycle is now mandatory for all development
2026-02-28 14:43:25 +01:00
clawd 7b4625c78f docs: add phase 3 design polish planning, update progress 2026-02-26 23:53:22 +01:00
clawd a72deba7a6 docs(phase-02): complete phase execution 2026-02-21 18:49:36 +01:00
clawd 84fa21214b docs: add Stop hook implementation plan
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-21 18:47:13 +01:00
clawd 0462adab8d docs(02-02): complete DELETE logs endpoint plan — summary and state update
- 02-02-SUMMARY.md: backend DELETE endpoint + frontend deleteLog wiring
- STATE.md: phase 2 marked complete, decisions added, position advanced to phase 3 ready
2026-02-21 18:46:26 +01:00
clawd d222acd45c docs: add Stop hook design doc
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-21 18:45:43 +01:00
clawd 64633981ed feat(02-02): wire deleteLog through App.jsx and WorkoutPage to ExerciseCard
- Added deleteLog function in App.jsx: calls DELETE /api/logs and removes entry from local logs state
- Passed onDeleteSet={deleteLog} to WorkoutPage in workout view render
- Updated WorkoutPage function signature to accept onDeleteSet prop
- Passed onDeleteSet through to each ExerciseCard (ExerciseCard already calls it in handleDeleteSet)
- Non-logged sets (404 from backend) silently ignored via catch block
2026-02-21 18:44:58 +01:00
clawd 889eb50070 feat(02-02): add DELETE /api/logs endpoint to backend
- DELETE /api/logs accepts user_id, program_exercise_id, date, set_number in request body
- Deletes matching workout_logs row by composite key
- Returns 200 + deleted id on success, 404 if row not found
- Consistent with existing POST /api/logs (no auth middleware, user_id from body)
2026-02-21 18:44:18 +01:00