chore: add plan files for Phase 3 advanced features

This commit is contained in:
2026-03-25 00:16:41 +03:00
parent 345f17f25a
commit d155b3ce4a
9 changed files with 193 additions and 0 deletions
@@ -0,0 +1,11 @@
# Feature Context: Phase 3 — Advanced Features
## Current State
Phase 2 is complete and merged. 176 tests, full build passes. Starting Phase 3 advanced features.
## Cross-Phase Dependencies
- Phases 1-3 are independent (import/export, sparklines, user themes)
- Phase 4 (PWA) is independent
- Phase 5 (auto-discovery) is independent
- Phase 6 (bookmarklet/sync) depends on existing API
- Phase 7 (integration) depends on all prior phases
+46
View File
@@ -0,0 +1,46 @@
# Feature: Phase 3 — Advanced Features
**Branch:** `feature/phase-3-advanced-features`
**Base branch:** `master`
**Created:** 2026-03-25
**Status:** 🟡 In Progress
**Strategy:** Big Bang
**Mode:** Automated
**Execution:** Orchestrator
## Summary
Add import/export, ping history sparklines, user theme overrides, PWA support, Docker/Traefik auto-discovery, quick-add bookmarklet, and multi-tab sync.
## Build & Test Commands
- **Build:** `npm run build`
- **Test:** `npm test`
- **Lint:** `npm run lint`
- **Type Check:** `npm run check`
## Phases
- [ ] Phase 1: Import/Export [fullstack] → [subplan](./phase-1-import-export.md)
- [ ] Phase 2: Ping History Sparklines [fullstack] → [subplan](./phase-2-sparklines.md)
- [ ] Phase 3: User Theme Overrides [fullstack] → [subplan](./phase-3-user-themes.md)
- [ ] Phase 4: PWA Support [frontend] → [subplan](./phase-4-pwa.md)
- [ ] Phase 5: Auto-Discovery Docker/Traefik [backend] → [subplan](./phase-5-autodiscovery.md)
- [ ] Phase 6: Bookmarklet & Multi-Tab Sync [fullstack] → [subplan](./phase-6-bookmarklet-sync.md)
- [ ] Phase 7: Integration & Polish [fullstack] → [subplan](./phase-7-integration.md)
## Phase Progress Log
| Phase | Domain | Status | Review | Build | Committed |
|-------|--------|--------|--------|-------|-----------|
| Phase 1: Import/Export | fullstack | ⬜ Not Started | ⬜ | ⬜ | ⬜ |
| Phase 2: Sparklines | fullstack | ⬜ Not Started | ⬜ | ⬜ | ⬜ |
| Phase 3: User Themes | fullstack | ⬜ Not Started | ⬜ | ⬜ | ⬜ |
| Phase 4: PWA | frontend | ⬜ Not Started | ⬜ | ⬜ | ⬜ |
| Phase 5: Auto-Discovery | backend | ⬜ Not Started | ⬜ | ⬜ | ⬜ |
| Phase 6: Bookmarklet/Sync | fullstack | ⬜ Not Started | ⬜ | ⬜ | ⬜ |
| Phase 7: Integration | fullstack | ⬜ Not Started | ⬜ | ⬜ | ⬜ |
## Final Review
- [ ] Comprehensive code review
- [ ] Full build passes
- [ ] Full test suite passes
- [ ] Merged to `master`
@@ -0,0 +1,18 @@
# Phase 1: Import/Export
**Status:** ⬜ Not Started
**Parent plan:** [PLAN.md](./PLAN.md)
**Domain:** fullstack
## Tasks
- [ ] Task 1: Create `src/lib/server/services/exportService.ts` — export all data (apps, boards, sections, widgets, groups, settings) as JSON
- [ ] Task 2: Create `src/lib/server/services/importService.ts` — import JSON with conflict resolution (skip/overwrite)
- [ ] Task 3: Create `src/routes/api/admin/export/+server.ts` — GET endpoint, returns JSON file download
- [ ] Task 4: Create `src/routes/api/admin/import/+server.ts` — POST endpoint, accepts JSON upload
- [ ] Task 5: Update admin settings page — add Import/Export section with download button and file upload
- [ ] Task 6: Create `src/lib/components/admin/ImportExportPanel.svelte` — UI with export button, file picker, preview, and import button
- [ ] Task 7: Add Zod schema for validating import data structure
- [ ] Task 8: Add i18n translations for import/export strings (EN/RU)
## Handoff to Next Phase
<!-- Filled in after completion -->
@@ -0,0 +1,18 @@
# Phase 2: Ping History Sparklines
**Status:** ⬜ Not Started
**Parent plan:** [PLAN.md](./PLAN.md)
**Domain:** fullstack
## Tasks
- [ ] Task 1: Create `src/routes/api/apps/[id]/history/+server.ts` — GET last 24h of healthcheck results
- [ ] Task 2: Create `src/lib/components/app/SparklineChart.svelte` — tiny inline SVG sparkline (green=up, red=down)
- [ ] Task 3: Update `src/lib/components/widget/AppWidget.svelte` — show sparkline below status badge
- [ ] Task 4: Update `src/lib/components/app/AppCard.svelte` — show sparkline on app cards
- [ ] Task 5: Calculate and display uptime percentage (last 24h)
- [ ] Task 6: Update healthcheck service to retain last 288 records per app (24h at 5min intervals)
- [ ] Task 7: Add cleanup job to prune old AppStatus records beyond retention period
- [ ] Task 8: Add i18n translations (EN/RU)
## Handoff to Next Phase
<!-- Filled in after completion -->
@@ -0,0 +1,19 @@
# Phase 3: User Theme Overrides
**Status:** ⬜ Not Started
**Parent plan:** [PLAN.md](./PLAN.md)
**Domain:** fullstack
## Tasks
- [ ] Task 1: Add `themeMode`, `primaryHue`, `primarySaturation`, `backgroundType`, `locale` fields to User model (Prisma migration)
- [ ] Task 2: Create `src/routes/api/users/me/preferences/+server.ts` — GET/PATCH user preferences
- [ ] Task 3: Create `src/routes/settings/+page.server.ts` — user settings page data
- [ ] Task 4: Create `src/routes/settings/+page.svelte` — user settings page with theme customization
- [ ] Task 5: Create `src/lib/components/settings/ThemeCustomizer.svelte` — HSL color picker, background selector, mode toggle
- [ ] Task 6: Update theme store to load user preferences from server on login
- [ ] Task 7: Update `+layout.server.ts` to pass user preferences
- [ ] Task 8: Add user settings link to header user menu
- [ ] Task 9: Add i18n translations (EN/RU)
## Handoff to Next Phase
<!-- Filled in after completion -->
@@ -0,0 +1,16 @@
# Phase 4: PWA Support
**Status:** ⬜ Not Started
**Parent plan:** [PLAN.md](./PLAN.md)
**Domain:** frontend
## Tasks
- [ ] Task 1: Create `static/manifest.json` — web app manifest with name, icons, theme color, display: standalone
- [ ] Task 2: Create app icons in `static/` — 192x192 and 512x512 PNG (simple grid icon)
- [ ] Task 3: Create `src/service-worker.ts` — SvelteKit service worker with cache-first for static assets, network-first for API
- [ ] Task 4: Update `src/app.html` — add manifest link, theme-color meta, apple-mobile-web-app meta tags
- [ ] Task 5: Create offline fallback page — show when no network and no cache
- [ ] Task 6: Add install prompt UI — detect `beforeinstallprompt` event, show install banner
## Handoff to Next Phase
<!-- Filled in after completion -->
@@ -0,0 +1,23 @@
# Phase 5: Auto-Discovery (Docker/Traefik)
**Status:** ⬜ Not Started
**Parent plan:** [PLAN.md](./PLAN.md)
**Domain:** backend
## Tasks
- [ ] Task 1: Create `src/lib/server/services/discoveryService.ts` — Docker socket scanning and Traefik API parsing
- [ ] Task 2: Create `src/routes/api/admin/discover/+server.ts` — POST triggers discovery scan, returns found services
- [ ] Task 3: Create `src/routes/api/admin/discover/approve/+server.ts` — POST approves discovered apps (creates them)
- [ ] Task 4: Create `src/lib/components/admin/DiscoveryPanel.svelte` — UI to trigger scan, review results, approve/reject
- [ ] Task 5: Add discovery settings to SystemSettings (Docker socket path, Traefik API URL, auto-scan toggle)
- [ ] Task 6: Update admin settings page with discovery configuration section
- [ ] Task 7: Add env vars: DOCKER_SOCKET_PATH, TRAEFIK_API_URL
- [ ] Task 8: Add i18n translations (EN/RU)
## Notes
- Docker discovery: read from `/var/run/docker.sock` (or configured path), list containers, extract labels for name/URL
- Traefik discovery: query Traefik API `/api/http/routers` and `/api/http/services`
- Both are optional — gracefully handle when Docker socket or Traefik API is unavailable
## Handoff to Next Phase
<!-- Filled in after completion -->
@@ -0,0 +1,21 @@
# Phase 6: Quick-Add Bookmarklet & Multi-Tab Sync
**Status:** ⬜ Not Started
**Parent plan:** [PLAN.md](./PLAN.md)
**Domain:** fullstack
## Tasks
- [ ] Task 1: Create `src/routes/api/apps/quick-add/+server.ts` — POST endpoint that accepts URL + title, creates app with defaults
- [ ] Task 2: Create `src/lib/components/admin/BookmarkletGenerator.svelte` — generates bookmarklet JS code with user's API token
- [ ] Task 3: Add bookmarklet section to user settings page
- [ ] Task 4: Create `src/lib/utils/broadcastSync.ts` — BroadcastChannel wrapper for cross-tab sync
- [ ] Task 5: Sync theme changes across tabs (dark/light toggle, primary color)
- [ ] Task 6: Sync board changes across tabs (new boards appear in sidebar)
- [ ] Task 7: Add i18n translations (EN/RU)
## Notes
- Bookmarklet: `javascript:void(fetch('ORIGIN/api/apps/quick-add',{method:'POST',headers:{'Content-Type':'application/json','Authorization':'Bearer TOKEN'},body:JSON.stringify({url:location.href,name:document.title})}))`
- BroadcastChannel: create channel 'wal-sync', post messages on theme/board changes, listen in layout
## Handoff to Next Phase
<!-- Filled in after completion -->
@@ -0,0 +1,21 @@
# Phase 7: Integration & Polish
**Status:** ⬜ Not Started
**Parent plan:** [PLAN.md](./PLAN.md)
**Domain:** fullstack
## Tasks
- [ ] Task 1: Fix all TypeScript/build errors
- [ ] Task 2: Verify `npm run build` succeeds
- [ ] Task 3: Verify `npm run check` passes
- [ ] Task 4: Verify `npm run lint` passes
- [ ] Task 5: Write tests for export/import services
- [ ] Task 6: Write tests for discovery service
- [ ] Task 7: Write tests for user preferences API
- [ ] Task 8: Write tests for quick-add API
- [ ] Task 9: Update seed script with sample data
- [ ] Task 10: Verify all existing tests pass
- [ ] Task 11: Run Prisma migrations
## Handoff
<!-- Final phase -->