From f9cccd6965029a5a133fa0cc2d4d62bc6551a004 Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Tue, 24 Feb 2026 00:28:02 +0000 Subject: [PATCH] feat(api): seed 7 widget definitions for dashboard system (#496) Co-authored-by: Jason Woltje Co-committed-by: Jason Woltje --- apps/api/prisma/seed.ts | 130 ++++++++++++++++++ docs/TASKS.md | 20 +-- .../ms18-theme-widgets-20260223.md | 9 +- 3 files changed, 145 insertions(+), 14 deletions(-) diff --git a/apps/api/prisma/seed.ts b/apps/api/prisma/seed.ts index 427ea4c..38d32c3 100644 --- a/apps/api/prisma/seed.ts +++ b/apps/api/prisma/seed.ts @@ -65,6 +65,136 @@ async function main() { }, }); + // ============================================ + // WIDGET DEFINITIONS (global, not workspace-scoped) + // ============================================ + const widgetDefs = [ + { + name: "TasksWidget", + displayName: "Tasks", + description: "View and manage your tasks", + component: "TasksWidget", + defaultWidth: 2, + defaultHeight: 2, + minWidth: 1, + minHeight: 2, + maxWidth: 4, + maxHeight: null, + configSchema: {}, + }, + { + name: "CalendarWidget", + displayName: "Calendar", + description: "View upcoming events and schedule", + component: "CalendarWidget", + defaultWidth: 2, + defaultHeight: 2, + minWidth: 2, + minHeight: 2, + maxWidth: 4, + maxHeight: null, + configSchema: {}, + }, + { + name: "QuickCaptureWidget", + displayName: "Quick Capture", + description: "Quickly capture notes and tasks", + component: "QuickCaptureWidget", + defaultWidth: 2, + defaultHeight: 1, + minWidth: 2, + minHeight: 1, + maxWidth: 4, + maxHeight: 2, + configSchema: {}, + }, + { + name: "AgentStatusWidget", + displayName: "Agent Status", + description: "Monitor agent activity and status", + component: "AgentStatusWidget", + defaultWidth: 2, + defaultHeight: 2, + minWidth: 1, + minHeight: 2, + maxWidth: 3, + maxHeight: null, + configSchema: {}, + }, + { + name: "ActiveProjectsWidget", + displayName: "Active Projects & Agent Chains", + description: "View active projects and running agent sessions", + component: "ActiveProjectsWidget", + defaultWidth: 2, + defaultHeight: 3, + minWidth: 2, + minHeight: 2, + maxWidth: 4, + maxHeight: null, + configSchema: {}, + }, + { + name: "TaskProgressWidget", + displayName: "Task Progress", + description: "Live progress of orchestrator agent tasks", + component: "TaskProgressWidget", + defaultWidth: 2, + defaultHeight: 2, + minWidth: 1, + minHeight: 2, + maxWidth: 3, + maxHeight: null, + configSchema: {}, + }, + { + name: "OrchestratorEventsWidget", + displayName: "Orchestrator Events", + description: "Recent orchestration events with stream/Matrix visibility", + component: "OrchestratorEventsWidget", + defaultWidth: 2, + defaultHeight: 2, + minWidth: 1, + minHeight: 2, + maxWidth: 4, + maxHeight: null, + configSchema: {}, + }, + ]; + + for (const wd of widgetDefs) { + await prisma.widgetDefinition.upsert({ + where: { name: wd.name }, + update: { + displayName: wd.displayName, + description: wd.description, + component: wd.component, + defaultWidth: wd.defaultWidth, + defaultHeight: wd.defaultHeight, + minWidth: wd.minWidth, + minHeight: wd.minHeight, + maxWidth: wd.maxWidth, + maxHeight: wd.maxHeight, + configSchema: wd.configSchema, + }, + create: { + name: wd.name, + displayName: wd.displayName, + description: wd.description, + component: wd.component, + defaultWidth: wd.defaultWidth, + defaultHeight: wd.defaultHeight, + minWidth: wd.minWidth, + minHeight: wd.minHeight, + maxWidth: wd.maxWidth, + maxHeight: wd.maxHeight, + configSchema: wd.configSchema, + }, + }); + } + + console.log(`Seeded ${widgetDefs.length} widget definitions`); + // Use transaction for atomic seed data reset and creation await prisma.$transaction(async (tx) => { // Delete existing seed data for idempotency (avoids duplicates on re-run) diff --git a/docs/TASKS.md b/docs/TASKS.md index 425f185..1d73d77 100644 --- a/docs/TASKS.md +++ b/docs/TASKS.md @@ -7,7 +7,7 @@ | TW-PLAN-001 | done | Plan MS18 task breakdown, create milestone + issues, populate TASKS.md | — | — | — | | TW-THM-001,TW-WDG-001,TW-EDT-001,TW-KBN-001 | orchestrator | 2026-02-23 | 2026-02-23 | 15K | ~12K | Planning complete, all artifacts committed | | TW-THM-001 | done | Theme architecture — Create theme definition interface, theme registry, and 5 built-in themes (Dark, Light, Nord, Dracula, Solarized) as TS files | #487 | web | feat/ms18-theme-architecture | TW-PLAN-001 | TW-THM-002,TW-THM-003 | worker | 2026-02-23 | 2026-02-23 | 30K | ~15K | PR #493 merged | | TW-THM-002 | done | ThemeProvider upgrade — Load themes dynamically from registry, apply CSS variables, support instant theme switching without page reload | #487 | web | feat/ms18-theme-provider-upgrade | TW-THM-001 | TW-THM-003,TW-VER-002 | worker | 2026-02-23 | 2026-02-23 | 25K | ~12K | PR #494 merged | -| TW-THM-003 | in-progress | Theme selection UI — Settings page section with theme browser, live preview swatches, persist selection to UserPreference.theme via API | #487 | web | feat/ms18-theme-selection-ui | TW-THM-001,TW-THM-002 | TW-VER-002 | worker | 2026-02-23 | — | 25K | — | | +| TW-THM-003 | done | Theme selection UI — Settings page section with theme browser, live preview swatches, persist selection to UserPreference.theme via API | #487 | web | feat/ms18-theme-selection-ui | TW-THM-001,TW-THM-002 | TW-VER-002 | worker | 2026-02-23 | 2026-02-23 | 25K | ~10K | PR #495 merged | | TW-WDG-001 | not-started | Widget definition seeding — Seed 7 existing widgets into widget_definitions table with correct sizing constraints and configSchema | #488 | api | TBD | TW-PLAN-001 | TW-WDG-002 | worker | — | — | 15K | — | | | TW-WDG-002 | not-started | Dashboard → WidgetGrid migration — Replace hardcoded dashboard layout with WidgetGrid, load/save layout via UserLayout API, default layout on first visit | #488 | web | TBD | TW-WDG-001 | TW-WDG-003,TW-WDG-004,TW-WDG-005 | worker | — | — | 40K | — | | | TW-WDG-003 | not-started | Widget picker UI — Drawer/dialog to browse available widgets from registry, preview size/description, add to dashboard | #488 | web | TBD | TW-WDG-002 | TW-VER-001 | worker | — | — | 25K | — | | @@ -23,12 +23,12 @@ ## Summary -| Metric | Value | -| ------------- | ------------------------------ | -| Total tasks | 16 | -| Completed | 3 (PLAN-001, THM-001, THM-002) | -| In Progress | 1 (THM-003) | -| Remaining | 12 | -| PRs merged | #493, #494 | -| Issues closed | — | -| Milestone | MS18-ThemeWidgets | +| Metric | Value | +| ------------- | ------------------------- | +| Total tasks | 16 | +| Completed | 4 (PLAN-001, THM-001–003) | +| In Progress | 0 | +| Remaining | 12 | +| PRs merged | #493, #494, #495 | +| Issues closed | — | +| Milestone | MS18-ThemeWidgets | diff --git a/docs/scratchpads/ms18-theme-widgets-20260223.md b/docs/scratchpads/ms18-theme-widgets-20260223.md index a617099..ac39397 100644 --- a/docs/scratchpads/ms18-theme-widgets-20260223.md +++ b/docs/scratchpads/ms18-theme-widgets-20260223.md @@ -68,14 +68,15 @@ WYSIWYG editor library: agent's choice → Tiptap selected. ## Session Log -| Session | Date | Milestone | Tasks Done | Outcome | -| ------- | ---------- | --------- | ---------- | -------------------- | -| S1 | 2026-02-23 | MS18 | PLAN-001 | Planning in progress | +| Session | Date | Milestone | Tasks Done | Outcome | +| ------- | ---------- | --------- | ------------------------- | -------------------------------------------- | +| S1 | 2026-02-23 | MS18 | PLAN-001 | Planning complete | +| S2 | 2026-02-23 | MS18 | THM-001, THM-002, THM-003 | Theme system complete — PRs #493, #494, #495 | ## Open Questions 1. **Widget config schema**: How complex should per-widget configuration be? Start simple (title, data source) and extend later. -2. **Theme hot-reload**: Should theme changes apply instantly or require page reload? Targeting instant via CSS variable swap. +2. **Theme hot-reload**: ~~Should theme changes apply instantly or require page reload?~~ RESOLVED — Instant via CSS variable injection on html element. 3. **Tiptap extensions**: Which extensions to include? Start with: StarterKit, Markdown, Table, CodeBlockLowlight, Link, Image, Placeholder. ## Corrections