summaryrefslogtreecommitdiff
path: root/internal
AgeCommit message (Collapse)Author
4 daysfeat: add Claudomator stories as atom source in Doot tasks tabClaude Agent
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4 daysfeat: gate Claudomator UI behind Doot session auth via reverse proxyDoot Agent
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
6 daysfix: support multiple enabled Google Task lists and CalendarsPeter Stone
- Update Google API interfaces with setters for list/calendar IDs - Update fetchCalendarEvents and fetchGoogleTasks to use enabled IDs from source_configs - Update timeline logic tests to reflect interface changes and seed config data - Ensure dashboard respects user-selected lists from settings
6 daysfeat: unify Google Tasks with main system via caching and integrated UIPeter Stone
- Implement SQLite caching layer for Google Tasks - Integrate Google Tasks into unified Atoms loop (showing in Tasks tab) - Update Planning tab to include cached Google Tasks - Enhance Quick Add form with Todoist project selector - Remove orphaned HandleTasksTab/HandleRefreshTab methods - Update tests to reflect new BuildTimeline signature and data structures
6 daysfeat: complete Agent Context API Phase 2 & 3 (Write/Create/Management)Peter Stone
- Implement write operations (complete, uncomplete, update due date, update task) - Implement create operations (create task, add shopping item) - Add Trusted Agents management UI in Settings with revocation support - Fix SQLite timestamp scanning bug for completed tasks - Add comprehensive unit tests for all new agent endpoints - Update worklog and feature documentation
6 daysfix: parse Todoist local datetimes, show near-future tasks, add undated ↵Peter Stone
tasks to timeline - parseDueDate: handle date field containing "YYYY-MM-DDTHH:MM:SS" (local time, no tz offset) — Todoist REST API v1 uses this format for recurring tasks with a set time, causing due dates to silently parse as nil - IsFuture threshold: widen from tomorrow to 7 days out so tasks due this week show in the main tasks section with dates visible (not collapsed) - BuildTimeline: include undated Todoist tasks in the Today section (mirrors existing Google Tasks behavior) - GetUndatedTasks: new store method for tasks with due_date IS NULL Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
6 dayschore: unify and centralize agent configuration in .agent/Peter Stone
7 daysfeat: Phase 1 — remove bug feature and dead codePeter Stone
- Delete Bug struct, BugToAtom, SourceBug, TypeBug, TypeNote - Remove bug store methods (SaveBug, GetBugs, ResolveBug, etc.) - Remove HandleGetBugs, HandleReportBug, bug branches in handlers - Remove bug routes, bugs.html template, bug UI from index.html - Remove AddMealToPlanner stub + interface method - Migration 018: DROP TABLE IF EXISTS bugs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
10 daysrefactor: RF-04/08 migrate inline HTML to templates, standardize form parsingClaude Agent
RF-04: Already complete in codebase (handlers use HTMLResponse + partials). RF-08: Migrate single-required-field handlers from Pattern A/B to Pattern C (requireFormValue). Affected: HandleCompleteTask, HandleCompleteCard, HandleReportBug, HandleCreateTask in handlers.go; HandleToggleFeature, HandleCreateFeature in settings.go. Reduces 6-8 lines of boilerplate to 2. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
10 daystest: add coverage for planning tab, meals, Google Tasks, bug handlers, ↵Agent
completed task parsing - HandleTabPlanning: happy-path test verifying tasks/cards land in correct sections (scheduled/unscheduled/upcoming); boundary test confirming a task due exactly at midnight of tomorrow lands in Upcoming, not Scheduled - HandleTabMeals: grouping test verifying two meals sharing date+mealType produce one CombinedMeal with both recipe names merged - Google Tasks GetTasksByDateRange: four boundary tests (start inclusive, end exclusive, no-due-date always included, out-of-range excluded) using redirectingTransport mock server pattern - HandleGetBugs: data assertions verifying bug list and empty-list cases - HandleReportBug: success test verifying bug is saved and bugs template is re-rendered - GetCompletedTasks: timestamp parsing test ensuring CompletedAt is not zero when inserted with a known "2006-01-02 15:04:05" string Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
10 daysrefactor: RF-03/06 extract groupMeals helper, eliminate ↵Claude
convertSyncItemToTask wrapper RF-03: Extract shared groupMeals helper into internal/handlers/meals.go. Both HandleTabMeals and BuildTimeline now call groupMeals instead of duplicating the date+mealType grouping algorithm inline. CombinedMeal gains ID and Meals fields to carry the first-meal ID and original records needed by BuildTimeline when constructing TimelineItems. RF-06: Add api.ConvertSyncItemToTask for single-item conversion. ConvertSyncItemsToTasks now delegates to it, eliminating duplication. The Handler.convertSyncItemToTask wrapper (which allocated a one-element slice just to unwrap it) is deleted; its caller uses api.ConvertSyncItemToTask directly. Covered by TestConvertSyncItemToTask in internal/api/todoist_test.go. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
11 dayschore: autocommit uncommitted changesClaudomator Agent
11 daystest: add Google Calendar unit tests for pure functionsClaudomator Agent
11 tests covering deduplicateEvents (dedup key, ordering, empty input), parseEventTime (RFC3339, date-only, empty, no-timezone), and GetUpcomingEvents (normal, empty, API error fallback) via httptest mock. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04fix: migrate Todoist client from deprecated REST v2 to API v1Peter Stone
REST v2 (https://api.todoist.com/rest/v2) is being sunset — the /close endpoint was returning HTTP 410 in production, breaking task completion. Update base URL to https://api.todoist.com/api/v1; endpoint paths are unchanged (/tasks/{id}/close, /tasks/{id}/reopen, etc.). Test: TestTodoistClient_UsesAPIv1BaseURL asserts the correct base URL. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04feat: sync log, cache clear endpoint, Todoist projects from cached tasksPeter Stone
- migration 016: sync_log table - store: AddSyncLogEntry, GetRecentSyncLog, InvalidateAllCaches, GetProjectsFromTasks - settings: HandleClearCache (POST /settings/clear-cache), SyncLog in page data - settings: use GetProjectsFromTasks instead of deprecated Todoist REST /projects - handlers: populate atom projects from store - agent: log warning on registration failure instead of silently swallowing - google_tasks: simplify URL literal - tests: sync log CRUD, clear cache handler, settings page includes sync log, sync sources adds log entry, incremental sync paths, task completion response/headers, calendar cache fallback Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-17Add calendar cache layer, incremental sync tests, completion assertionsPeter Stone
- Google Calendar events now cached via CacheFetcher pattern with stale-cache fallback on API errors (new migration 015, store methods, fetchCalendarEvents handler, BuildTimeline reads from store) - Todoist incremental sync path covered by 5 new tests - Task completion tests assert response body, headers, and template data Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07Add no-cache header tests, update SESSION_STATE with audit resultsPeter Stone
- Added TestHTMLResponse_SetsNoCacheHeaders and TestJSONResponse_SetsNoCacheHeaders - Rewrote SESSION_STATE.md with verified test coverage per completed item - Documented known gaps (Google API client unit tests, WebAuthn env vars) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07Fix passkey registration showing broken UI when WebAuthn not configuredPeter Stone
Root cause: WEBAUTHN_RP_ID and WEBAUTHN_ORIGIN env vars not set in production, so WebAuthn is nil and all passkey endpoints return 404. The settings page was unconditionally showing the passkey registration card, leading to confusing "Failed to start registration" errors. Fix: Pass WebAuthnEnabled flag from main.go through Handler to the settings template, which now conditionally renders the passkey card only when WebAuthn is properly configured. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07Add build version footer, deploy ldflags, template test helper, and logs scriptPeter Stone
- Display build commit hash in unobtrusive footer overlay - Inject buildCommit/buildTime via ldflags in deploy.sh - Add assertTemplateContains test helper, refactor existing template tests - Add scripts/logs for fetching production journalctl via SSH Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07Fix timeline task completion replacing view, fix passkey registration CSRFPeter Stone
- Fix checkboxes in timeline calendar grid targeting #tab-content (replaced entire view). Now target closest .untimed-item/.calendar-event with outerHTML - Fix passkey registration 403 by passing CSRFToken from settings handler and exposing it via meta tag for JS to read - Add TDD workflow requirement to CLAUDE.md - Tests written first (red-green): template content assertions for checkbox targets and CSRF token presence, handler data struct verification Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06Fix missing settings button, disappeared events, and tab refresh bugPeter Stone
- Add settings gear icon link to dashboard header - Fix GetTasksByDateRange/GetCardsByDateRange to include overdue items (changed from BETWEEN to <= end, filter completed tasks) - Fix refresh replacing active tab with tasks tab by using htmx.trigger(body, 'refresh-tasks') instead of innerHTML+htmx.process - Add refresh-tasks hx-trigger to meals, shopping, conditions tabs - Add tests for overdue inclusion/exclusion, settings link, template data Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05Add passkey (WebAuthn) authentication supportPeter Stone
Enable passwordless login via passkeys as an alternative to password auth. Users register passkeys from Settings; the login page offers both options. WebAuthn is optional — only active when WEBAUTHN_RP_ID and WEBAUTHN_ORIGIN env vars are set. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05Improve session handling, shopping UI, and cleanupPeter Stone
Session improvements: - Extend session lifetime to 7 days for mobile convenience - Add idle timeout to extend session on activity - Use standard cookie name for better compatibility Shopping model: - Add FlattenItemsForStore helper for extracting store items - Add StoreNames helper for store list - Improve shopping-tab.html with inline add forms Frontend: - Add WebSocket reconnection and agent approval UI to app.js - Simplify timeline calendar JS (move event positioning to CSS) - Update login page styling Deployment: - Remove unused git checkout step from deploy.sh - Update apache.conf WebSocket proxy settings Documentation: - Add Agent Context API feature spec to issues/ Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05Extract shopping handlers to dedicated filePeter Stone
Moved 8 shopping-related handlers from handlers.go to shopping.go: - HandleTabShopping - HandleShoppingQuickAdd - HandleShoppingToggle - HandleShoppingMode - HandleShoppingModeToggle - HandleShoppingModeComplete - HandleGetShoppingLists - aggregateShoppingLists handlers.go: 1633 → 1232 lines (24% reduction) shopping.go: 415 lines (new) All tests passing. No behavioral changes. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03Add comprehensive test coverage across packagesPeter Stone
New test files: - api/http_test.go: HTTP client and error handling tests - config/config_test.go: Configuration loading and validation tests - middleware/security_test.go: Security middleware tests - models/atom_test.go: Atom model and conversion tests Expanded test coverage: - api/todoist_test.go: Todoist API client tests - api/trello_test.go: Trello API client tests - auth/auth_test.go: Authentication and CSRF tests - handlers/timeline_logic_test.go: Timeline building logic tests - store/sqlite_test.go: SQLite store operations tests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03Refactor template rendering with Renderer interface for testabilityPeter Stone
Introduce a Renderer interface to abstract template rendering, enabling tests to use MockRenderer instead of requiring real template files. Changes: - Add renderer.go with Renderer interface, TemplateRenderer, and MockRenderer - Update Handler struct to use Renderer instead of *template.Template - Update HTMLResponse() to accept Renderer interface - Replace all h.templates.ExecuteTemplate() calls with h.renderer.Render() - Update all tests to use MockRenderer, removing template file dependencies This eliminates 15+ tests that previously skipped with "Templates not available" and improves test isolation. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01Improve shopping mode and flatten nav barPeter Stone
Shopping mode: - Click to complete items (deletes user items, hides external items) - Add print button with compact two-column print layout - Fix CSRF token for HTMX requests - Fix input clearing with proper htmx:afterRequest handler - Remove "Quick Add" store option, require valid store Navigation: - Replace dropdown menu with flat nav showing all tabs - Remove unused dropdown JS Tests: - Add TestHandleShoppingModeComplete for user and external items Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01Improve timeline view with dynamic bounds, now line, and overlap handlingPeter Stone
- Add dynamic calendar clipping: show 1 hour before/after events instead of hardcoded 6am-10pm - Add "NOW" line indicator showing current time position - Improve time label readability with larger font and better contrast - Add overlap detection with column-based indentation for concurrent events - Apply calendar view to Tomorrow section (matching Today's layout) - Fix auto-refresh switching to tasks tab (default was 'tasks' instead of 'timeline') Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31Fix timeline calendar view and shopping UI bugs (#56, #65-73)Peter Stone
- #56: Add overflow-hidden to card/panel classes to prevent content overflow - #65: Fix Google Tasks not showing by including tasks without due dates - #66: Add no-cache headers to prevent stale template responses - #67: Increase dropdown z-index to 100 for proper layering - #69: Implement calendar-style Today section with hourly grid (6am-10pm), duration-based event heights, and compact overdue/all-day section - #70: Only reset shopping-mode form on successful submission - #71: Remove checkboxes from shopping tab (only show in shopping mode) - #72: Add inline add-item input at end of each store section - #73: Add Grouped/Flat view toggle for shopping list Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31Add feature toggles system with settings UI (#74)Peter Stone
- Add feature_toggles table (migration 012) - Add source_config table for future source selection (migration 013) - Create settings page at /settings with: - Feature toggle management (enable/disable/create/delete) - Data source configuration (sync and toggle boards/calendars) - Add store methods for feature toggles and source config - Add GetCalendarList and GetTaskLists to Google API clients - Document feature toggle workflow in DESIGN.md Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28Expand agent context API with completed log and calendar viewPeter Stone
- Add completed_tasks table to log task completions with title, due date, and completion timestamp - Extend agent context date range: 7 days back to 14 days forward - Add completed_log to API response (last 50 completed tasks) - Add day_section field to timeline items (overdue/today/tomorrow/later) - Add calendar-style view for today's schedule (6am-10pm hourly grid) - Add tabbed interface for Timeline vs Completed Log in HTML view Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28Add Agent Context API for external agent integrationPeter Stone
Phase 1: Authentication and read-only context - POST /agent/auth/request - request access with name + agent_id - GET /agent/auth/poll - poll for approval status - POST /agent/auth/approve|deny - user approval (browser auth required) - GET /agent/context - 7-day timeline context (agent session required) Phase 1.5: Browser-only agent endpoints (HTML pages) - GET /agent/web/request - request page with token - GET /agent/web/status - status page with polling - GET /agent/web/context - context page with timeline data WebSocket notifications: - GET /ws/notifications - push agent requests to browsers - Approval modal with trust indicators and countdown timer Database: - agents table for registered agent tracking - agent_sessions table for pending/active sessions Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28Refactor agent handlers for simplicity and clarityPeter Stone
- Reuse BuildTimeline() from timeline_logic.go instead of duplicating fetch logic (~60 lines removed) - Add section headers for code organization - Extract isSessionExpired() and renderAgentTemplate() helpers - Move AgentRequestPayload from websocket.go to agent.go - Use config.Now() and config.Today() for consistent timezone handling Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27Fix CSP to allow conditions page embeds and fontsPeter Stone
Allow external resources in Content-Security-Policy: - frame-src: youtube.com, embed.windy.com (for webcams/weather) - style-src: fonts.googleapis.com (for Inter font) - font-src: fonts.gstatic.com (for font files) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27Fix z-index, conditions auth, and meal combining (#62, #63, #64)Peter Stone
Bug fixes: - #62: Increase FAB button z-index from z-40 to z-50 - #63: Combine multiple meals per date+mealType in Meals tab - #64: Make /conditions route public (no auth required) Changes: - FAB button now z-50 (same as modals, appears on top when scrolling) - Meals tab groups meals by date+mealType, joins recipe names with " + " - Conditions page moved outside protected routes group DESIGN.md updates: - Updated z-index hierarchy table - Added Meals View section - Noted conditions page is public Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26Fix shopping-mode template name to use filenamePeter Stone
The template was being called with define name "shopping-mode" but standalone page templates should be called by filename "shopping-mode.html". Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26Add Google Tasks integration (#43)Peter Stone
- New GoogleTasksClient for fetching and managing Google Tasks - Tasks appear in Timeline view with yellow indicator dot - Tap checkbox to complete/uncomplete tasks via Google API - Shares credentials file with Google Calendar (GOOGLE_CREDENTIALS_FILE) - Configure task list via GOOGLE_TASKS_LIST_ID env var (default: @default) - Supports comma-separated list IDs for multiple lists New files: - internal/api/google_tasks.go - Google Tasks API client Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26Add shopping mode for focused single-store shopping (#34)Peter Stone
- Full-screen view for one store at a time - Tap items to toggle completion - Completed items greyed and sorted to bottom - Quick-add form at bottom of screen - Store switcher pills for easy navigation - "Shop" button on each store in shopping tab Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26Fix multiple UI issues and shopping completion bugPeter Stone
- #54: Fix shopping item completion - now works for all sources (trello, plantoeat, user) with state stored in local DB - #48: Hide 12:00am times in timeline (all-day items) - #49: Remove "Task" type label from timeline items for cleaner UI - #51: Combine multiple PlanToEat meals for same date+mealType - #52: Change Conditions tab to standard link to standalone page Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26Add day of week to timeline section headingsPeter Stone
Section headings now show the day of week for better orientation: - "Today - Monday" - "Tomorrow - Tuesday" - "Wednesday, Jan 29+" (for later items) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26Use configured timezone throughout codebasePeter Stone
- Add config/timezone.go with timezone utilities: - SetDisplayTimezone(), GetDisplayTimezone() - Now(), Today() - current time/date in display TZ - ParseDateInDisplayTZ(), ToDisplayTZ() - parsing helpers - Initialize timezone at startup in main.go - Update all datetime logic to use configured timezone: - handlers/handlers.go - all time.Now() calls - handlers/timeline.go - date parsing - handlers/timeline_logic.go - now calculation - models/atom.go - ComputeUIFields() - models/timeline.go - ComputeDaySection() - api/plantoeat.go - meal date parsing - api/todoist.go - due date parsing - api/trello.go - due date parsing This ensures all dates/times display correctly regardless of server timezone setting. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26Fix calendar timezone handling with configurable display timezonePeter Stone
- Add TIMEZONE config option (defaults to Pacific/Honolulu) - Store display timezone in GoogleCalendarClient - Convert all event times to configured display timezone - Parse events in their native timezone then convert for display This fixes the issue where events were showing 10 hours off due to server running in UTC while user is in Hawaii. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26Fix Google Calendar timezone handlingPeter Stone
- Use event's TimeZone field when parsing DateTime - Handle cases where DateTime has no timezone offset - Parse in event timezone then convert to local for display Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26Fix Google Calendar credential loadingPeter Stone
Use option.WithCredentialsFile instead of non-existent option.WithAuthCredentialsFile function. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26Phase 5: Extract functions to reduce complexityPeter Stone
- Create atoms.go with BuildUnifiedAtomList, SortAtomsByUrgency, PartitionAtomsByTime - Create helpers.go with parseFormOr400, requireFormValue - Refactor HandleTabTasks from 95 lines to 25 lines using extracted functions - Remove duplicate atomUrgencyTier function - Update handlers to use parseFormOr400 helper Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26Phase 4: Extract magic numbers to constantsPeter Stone
Create config/constants.go with centralized configuration values: - Concurrency limits (MaxConcurrentTrelloRequests) - Timeouts (HTTP, Google Calendar, graceful shutdown, request) - Meal times (breakfast, lunch, dinner hours) - Database pool settings (connections, lifetime) - Session and rate limiting settings Update all files to use these constants instead of hardcoded values. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26Phase 3: Error handling and security hardeningPeter Stone
- Handle JSON marshal errors in sqlite.go (log + fallback to empty array) - Add 30s timeout to Google Calendar client initialization - Fix CSRF timing attack by using subtle.ConstantTimeCompare Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26Phase 2: Fix data race in GetBoardsWithCardsPeter Stone
Add mutex synchronization for writes to board slice elements (Cards and Lists fields) from concurrent goroutines. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26Phase 1: Critical security fixesPeter Stone
- Remove default password fallback - require DEFAULT_PASS in all environments - Fix XSS vulnerabilities in HTML generation (handlers.go:795,920) - Add security headers middleware (X-Frame-Options, CSP, HSTS, etc.) - Add rate limiting on login endpoint (5 req/15min per IP) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25Fix all static analysis errors (golangci-lint)Peter Stone
- Fix errcheck: handle all error return values in production code - Fix errcheck: handle all error return values in test files - Fix staticcheck: replace deprecated WithCredentialsFile with WithAuthCredentialsFile - Remove unused code: authHeaders, planToEatPlannerItem, planToEatResponse - Use defer func() { _ = x.Close() }() pattern for ignored close errors Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>