Skip to content

Commit 099d3d1

Browse files
kurtstohrerclaude
andcommitted
Refactor shell into composables/components, fix needs_info reply
- Extract App.vue concerns into composables (useAutoScan, useBridgeEventHandlers, useInteractionModeSync, useOverlayToggles, useShellLifecycle, useShellNavigation) and split monolithic CSS into per-concern files (_a11y, _canvas, _highlights, _overlays, _panels, _tasks, _toolbar) - New components: AppToolbar, TasksPanel, AuditPanel, A11yPanel/A11yDetailDrawer, PendingTaskPanel, TaskCard, SnippingOverlay, ContextOverlay, ScreenshotUploader, HelpOverlay, SettingsOverlay, FullscreenOverlayHeader, AppBanners, ToolbarButtonGroup, CustomColorPicker, TaskOptionsToggles - Remove A11yTab, NotesTab, StickyNoteOverlay, ComponentDetail, ComponentLibrary, tailwindColors, stripMarkdown - Fix needs_info reply silently failing: structuredClone() chokes on Vue's reactive Proxy, throwing DataCloneError before the PATCH fires. Switch to JSON round-trip. - Add react-radix playground, refresh docs Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ab2f7a5 commit 099d3d1

69 files changed

Lines changed: 5548 additions & 3207 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AGENTS.md

Lines changed: 102 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,29 @@ Then open:
4747

4848
```bash
4949
annotask status # Check if server is running
50-
annotask tasks # Compact task summaries (use --pretty for full objects)
50+
annotask tasks # Compact task summaries (use --detail for full objects)
51+
annotask task <id> # Single task detail (trimmed agent_feedback)
52+
annotask design-spec # Design spec summary (or --category=NAME slice)
5153
annotask report # Fetch live change report (no tasks)
5254
annotask watch # Live stream changes via WebSocket
5355
annotask update-task <id> --status=<status> # Update task status
5456
annotask screenshot <id> # Download a task's screenshot
57+
annotask components [search] # List components (add --mcp for JSON)
58+
annotask component <Name> # Show component props
5559
annotask init-skills # Install agent skills into project
60+
annotask init-mcp # Write editor MCP config (--editor=claude|cursor|vscode|windsurf|all)
5661
annotask mcp # Start MCP stdio server (proxies to dev server)
5762
```
5863

59-
Options: `--port=N`, `--host=H`, `--server=URL` (override server.json), `--mfe=NAME` (filter by MFE), `--output=PATH` (for screenshot command).
64+
**MCP-parity flag:** pass `--mcp` to any command to force compact JSON output
65+
that matches the `annotask_*` MCP tool responses (`visual` stripped,
66+
`agent_feedback` trimmed, no ANSI/human prefixes). Skills call the CLI with
67+
`--mcp` as a fallback when the MCP server isn't registered in the editor.
68+
69+
Options: `--port=N`, `--host=H`, `--server=URL` (override server.json),
70+
`--mfe=NAME` (filter by MFE), `--output=PATH` (screenshot), `--mcp`,
71+
`--detail` (tasks), `--status=STATUS` (tasks), `--category=NAME` (design-spec),
72+
`--library=NAME` / `--limit=N` / `--offset=N` (components).
6073

6174
## Annotask API
6275

@@ -80,8 +93,9 @@ Use `/annotask-apply` to fetch and apply pending visual changes to source code.
8093
- `src/server/` — HTTP API, WebSocket server, shell serving, project state
8194
- `src/webpack/` — Webpack plugin and transform loader
8295
- `src/shell/` — Design tool UI (Vue 3 app, pre-built into dist/shell/)
83-
- `src/shell/composables/` — Vue composables (style editor, tasks, screenshots, keyboard shortcuts, a11y scanner, error monitor, perf monitor, annotations, viewport, interaction history, etc.)
84-
- `src/shell/components/` — UI components (TaskDetailModal, DesignPanel, ElementStyleEditor, ErrorsTab, PerfTab, inspector tabs, overlays, viewport selector, a11y panel, report viewer, etc.)
96+
- `src/shell/themes/` — Shell theme system (types, 18 built-in themes, barrel export)
97+
- `src/shell/composables/` — Vue composables (shell theme, style editor, tasks, screenshots, keyboard shortcuts, a11y scanner, error monitor, perf monitor, annotations, viewport, interaction history, etc.)
98+
- `src/shell/components/` — UI components (TaskDetailModal, DesignPanel, ElementStyleEditor, ShellThemeEditor, ErrorsTab, PerfTab, inspector tabs, overlays, viewport selector, a11y panel, report viewer, etc.)
8599
- `src/shell/utils/` — Helpers (stripMarkdown)
86100
- `src/shared/` — Shared types (postMessage bridge protocol)
87101
- `src/schema.ts` — TypeScript types for change reports, tasks, design spec, viewport, interaction history, element context
@@ -94,8 +108,9 @@ Use `/annotask-apply` to fetch and apply pending visual changes to source code.
94108
`App.vue` is the shell orchestrator — it wires composables together and handles bridge events. **Do not add business logic directly to App.vue.** Extract new concerns into composables under `src/shell/composables/`.
95109

96110
Key composables:
111+
- `useShellTheme` — Theme system: 63 CSS variables, 18 built-in themes, custom theme CRUD, system preference, localStorage persistence
97112
- `useSelectionModel` — Element selection state, rect tracking, hover, live styles, style/class change handlers
98-
- `useTaskWorkflows` — Task creation flows (pin, arrow, highlight, section → task), pending task panel, accept/deny, annotation restoration
113+
- `useTaskWorkflows` — Task creation flows (pin, arrow, highlight, section → task), pending task panel, accept/deny, annotation restoration, auto-opens task panel on create
99114
- `useAnnotationRects` — rAF loop keeping annotation overlays positioned during scroll/resize
100115
- `useAnnotations` — Pin, arrow, section, highlight annotation state and route filtering
101116
- `useStyleEditor` — Style/class change recording, undo, report generation
@@ -105,6 +120,88 @@ Key composables:
105120

106121
When adding new shell features, create a new composable that accepts its dependencies via constructor params and returns refs + methods. App.vue should only orchestrate (init composables, wire bridge events, pass props to components).
107122

123+
## Shell Theme System
124+
125+
The shell has a VS Code-style theme system with 18 built-in themes and custom theme support. Themes control every color in the UI via 63 CSS custom properties.
126+
127+
### Architecture
128+
129+
- `src/shell/themes/types.ts``ShellThemeColors` (63 vars), `ShellTheme` interface, `THEME_COLOR_KEYS` array
130+
- `src/shell/themes/builtin.ts` — 18 built-in theme definitions with `deriveDefaults()` helper
131+
- `src/shell/composables/useShellTheme.ts` — Core composable: applies themes at runtime via `style.setProperty()`, handles localStorage persistence, system preference detection, custom theme CRUD, and a one-shot migration from the legacy `annotask:themeMode` key
132+
- `src/shell/components/ShellThemeEditor.vue` — Full-screen custom theme creator with grouped color pickers and live preview
133+
134+
### How themes are applied
135+
136+
Themes are applied at runtime via `document.documentElement.style.setProperty()` for each of the 63 CSS variables. The `:root` block in App.vue provides dark fallback values, and `:root.light` provides light fallback values — these are safety nets for first paint before JS runs. Once `useShellTheme` initializes, it overrides all variables via inline styles.
137+
138+
### CSS variable categories (63 total)
139+
140+
| Category | Variables | Purpose |
141+
|----------|-----------|---------|
142+
| Surfaces (7) | `--bg`, `--surface`, `--surface-2`, `--surface-3`, `--surface-elevated`, `--surface-glass`, `--surface-overlay` | Background layers |
143+
| Borders (2) | `--border`, `--border-strong` | Border colors |
144+
| Text (5) | `--text`, `--text-muted`, `--text-on-accent`, `--text-inverse`, `--text-link` | Text colors |
145+
| Accent (3) | `--accent`, `--accent-hover`, `--accent-muted` | Primary interactive color |
146+
| Semantic (5) | `--danger`, `--success`, `--warning`, `--info`, `--focus-ring` | Semantic indicators |
147+
| Palette (4) | `--purple`, `--orange`, `--cyan`, `--indigo` | Extended color palette |
148+
| Utility (2) | `--overlay`, `--shadow` | Overlays and shadows |
149+
| Status (7) | `--status-pending`, `--status-in-progress`, `--status-review`, `--status-denied`, `--status-accepted`, `--status-needs-info`, `--status-blocked` | Task lifecycle |
150+
| Severity (4) | `--severity-critical`, `--severity-serious`, `--severity-moderate`, `--severity-minor` | A11y/perf findings |
151+
| Modes (4) | `--mode-interact`, `--mode-arrow`, `--mode-draw`, `--mode-highlight` | Tool button active states |
152+
| Layout (2) | `--layout-flex`, `--layout-grid` | Layout visualization |
153+
| Roles (3) | `--role-container`, `--role-content`, `--role-component` | Element classification |
154+
| Syntax (7) | `--syntax-property`, `--syntax-string`, `--syntax-number`, `--syntax-boolean`, `--syntax-null`, `--syntax-operator`, `--syntax-punctuation` | Code highlighting |
155+
| Tool overlays (2) | `--pin-color`, `--highlight-color` | Pin dots and element selection |
156+
| Annotations (6) | `--annotation-red`, `--annotation-orange`, `--annotation-yellow`, `--annotation-green`, `--annotation-blue`, `--annotation-purple` | Arrow/highlight presets |
157+
158+
### Built-in themes (18)
159+
160+
**Default:** Dark, Light
161+
**High Contrast:** High Contrast Dark, High Contrast Light
162+
**Accessibility:** Deuteranopia (blue/orange, no red-green)
163+
**Editor:** Monokai, Solarized Dark, Solarized Light, Nord, One Dark, Dracula, GitHub Dark, GitHub Light, Catppuccin Mocha, Gruvbox Dark, Rosé Pine, Synthwave '84, Cobalt
164+
165+
### Adding a new built-in theme
166+
167+
In `src/shell/themes/builtin.ts`, use the `theme()` helper:
168+
169+
```typescript
170+
const myTheme = theme('my-theme', 'My Theme', 'dark', 'editor', 'Description', {
171+
// ~28 core colors (surfaces, borders, text, accent, semantic, palette, utility)
172+
bg: '#...', surface: '#...', /* ... */
173+
}, {
174+
// Optional overrides for derived values (status, severity, syntax, annotations)
175+
// deriveDefaults() fills these from core colors if not specified
176+
'annotation-red': '#...', 'annotation-orange': '#...', /* ... */
177+
})
178+
```
179+
180+
Then add it to the `BUILTIN_THEMES` array. The `deriveDefaults()` helper automatically derives status, severity, mode, layout, role, syntax, and annotation colors from core colors — override only what needs to differ.
181+
182+
**Important:** Each theme's 6 annotation colors must be visually distinct from each other (no overlapping shades). Use colors from the theme's native palette.
183+
184+
### Using rgba/transparent variants in CSS
185+
186+
Never hardcode `rgba()` with theme-dependent colors. Use `color-mix()`:
187+
188+
```css
189+
/* Wrong: */ background: rgba(239, 68, 68, 0.15);
190+
/* Right: */ background: color-mix(in srgb, var(--danger) 15%, transparent);
191+
```
192+
193+
### localStorage keys
194+
195+
| Key | Purpose |
196+
|-----|---------|
197+
| `annotask:shellTheme` | Active theme ID (e.g. `'monokai'`, `'system'`) |
198+
| `annotask:shellSystemThemes` | JSON `[darkId, lightId]` pair for system preference |
199+
| `annotask:shellCustomThemes` | JSON array of user-created `ShellTheme` objects |
200+
201+
### Custom themes
202+
203+
Users create custom themes via Settings > Appearance > "+ Create Custom Theme". Custom themes are stored in localStorage with IDs prefixed `custom:`. The editor provides live preview — changes apply to the shell immediately. Missing keys inherit from the base theme.
204+
108205
## Key Shell Features
109206

110207
- **Viewport preview** — Device presets + custom dimensions, viewport info included in tasks/reports

CLAUDE.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,29 @@ Then open:
4747

4848
```bash
4949
annotask status # Check if server is running
50-
annotask tasks # Compact task summaries (use --pretty for full objects)
50+
annotask tasks # Compact task summaries (use --detail for full objects)
51+
annotask task <id> # Single task detail (trimmed agent_feedback)
52+
annotask design-spec # Design spec summary (or --category=NAME slice)
5153
annotask report # Fetch live change report (no tasks)
5254
annotask watch # Live stream changes via WebSocket
5355
annotask update-task <id> --status=<status> # Update task status
5456
annotask screenshot <id> # Download a task's screenshot
57+
annotask components [search] # List components (add --mcp for JSON)
58+
annotask component <Name> # Show component props
5559
annotask init-skills # Install agent skills into project
5660
annotask init-mcp # Write editor MCP config (--editor=claude|cursor|vscode|windsurf|all)
5761
annotask mcp # Start MCP stdio server (proxies to dev server)
5862
```
5963

60-
Options: `--port=N`, `--host=H`, `--server=URL` (override server.json), `--mfe=NAME` (filter by MFE), `--output=PATH` (for screenshot command).
64+
**MCP-parity flag:** pass `--mcp` to any command to force compact JSON output
65+
that matches the `annotask_*` MCP tool responses (`visual` stripped,
66+
`agent_feedback` trimmed, no ANSI/human prefixes). Skills call the CLI with
67+
`--mcp` as a fallback when the MCP server isn't registered in the editor.
68+
69+
Options: `--port=N`, `--host=H`, `--server=URL` (override server.json),
70+
`--mfe=NAME` (filter by MFE), `--output=PATH` (screenshot), `--mcp`,
71+
`--detail` (tasks), `--status=STATUS` (tasks), `--category=NAME` (design-spec),
72+
`--library=NAME` / `--limit=N` / `--offset=N` (components).
6173

6274
## Annotask API
6375

@@ -96,7 +108,7 @@ Use `/annotask-apply` to fetch and apply pending visual changes to source code.
96108
`App.vue` is the shell orchestrator — it wires composables together and handles bridge events. **Do not add business logic directly to App.vue.** Extract new concerns into composables under `src/shell/composables/`.
97109

98110
Key composables:
99-
- `useShellTheme` — Theme system: 62 CSS variables, 18 built-in themes, custom theme CRUD, system preference, localStorage persistence
111+
- `useShellTheme` — Theme system: 63 CSS variables, 18 built-in themes, custom theme CRUD, system preference, localStorage persistence
100112
- `useSelectionModel` — Element selection state, rect tracking, hover, live styles, style/class change handlers
101113
- `useTaskWorkflows` — Task creation flows (pin, arrow, highlight, section → task), pending task panel, accept/deny, annotation restoration, auto-opens task panel on create
102114
- `useAnnotationRects` — rAF loop keeping annotation overlays positioned during scroll/resize
@@ -110,20 +122,20 @@ When adding new shell features, create a new composable that accepts its depende
110122

111123
## Shell Theme System
112124

113-
The shell has a VS Code-style theme system with 18 built-in themes and custom theme support. Themes control every color in the UI via 62 CSS custom properties.
125+
The shell has a VS Code-style theme system with 18 built-in themes and custom theme support. Themes control every color in the UI via 63 CSS custom properties.
114126

115127
### Architecture
116128

117-
- `src/shell/themes/types.ts``ShellThemeColors` (62 vars), `ShellTheme` interface, `THEME_COLOR_KEYS` array
129+
- `src/shell/themes/types.ts``ShellThemeColors` (63 vars), `ShellTheme` interface, `THEME_COLOR_KEYS` array
118130
- `src/shell/themes/builtin.ts` — 18 built-in theme definitions with `deriveDefaults()` helper
119131
- `src/shell/composables/useShellTheme.ts` — Core composable: applies themes at runtime via `style.setProperty()`, handles localStorage persistence, system preference detection, custom theme CRUD, and a one-shot migration from the legacy `annotask:themeMode` key
120132
- `src/shell/components/ShellThemeEditor.vue` — Full-screen custom theme creator with grouped color pickers and live preview
121133

122134
### How themes are applied
123135

124-
Themes are applied at runtime via `document.documentElement.style.setProperty()` for each of the 62 CSS variables. The `:root` block in App.vue provides dark fallback values, and `:root.light` provides light fallback values — these are safety nets for first paint before JS runs. Once `useShellTheme` initializes, it overrides all variables via inline styles.
136+
Themes are applied at runtime via `document.documentElement.style.setProperty()` for each of the 63 CSS variables. The `:root` block in App.vue provides dark fallback values, and `:root.light` provides light fallback values — these are safety nets for first paint before JS runs. Once `useShellTheme` initializes, it overrides all variables via inline styles.
125137

126-
### CSS variable categories (62 total)
138+
### CSS variable categories (63 total)
127139

128140
| Category | Variables | Purpose |
129141
|----------|-----------|---------|

0 commit comments

Comments
 (0)