Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ Run `npx -p framesmith framesmith-viewer` to start the standalone browser viewer

![framesmith canvas detail view — the dashboard pattern rendered (grouped sidebar navigation with an account row, KPI cards with sparklines and delta pills, a real multi-series line chart with an area fill and a dashed reference line beside a recent-activity feed) with the Quality inspector open on the right: a 99/100 "Excellent" score, per-category bars (spacing, color, typography, structure, consistency, usability, coverage, cliche), and honest APCA advisories in the issue list. The toolbar shows the canvas's designed states (default / loading / empty), theme and viewport toggles, and a Comment toggle.](https://raw.githubusercontent.com/vicmaster/framesmith/master/docs/framesmith-canvas.png?v=2.0)

> Above: a canvas in the detail view with the **Quality inspector** on the right — the same `canvas_evaluate` score the agent sees, with per-category bars and the issue list; the tabs along the top switch to the **Design-system** and **Feedback** panels. The toolbar carries the project back link, the canvas's designed states as a nav, breakpoint tabs with Compare, a **Comment** button with the open-comment count for point-and-tell feedback, a **More** menu (View JSON, Copy canvas ID, Archive or Restore, Delete canvas) and a Live / Offline status; zoom, Fit and Preview in dark sit in the preview tools.
> Above: a canvas in the detail view with the **Quality inspector** on the right — the same `canvas_evaluate` score the agent sees, with the categories lowest first and the grouped issue list; the tabs along the top switch to the **Design system** and **Feedback** panels. The toolbar carries the project back link, the canvas's designed states as a nav, breakpoint tabs with Compare, a **Comment** button with the open-comment count for point-and-tell feedback, a **More** menu (View JSON, Copy canvas ID, Archive or Restore, Delete canvas) and a Live / Offline status; zoom, Fit and Preview in dark sit in the preview tools.

**Quality panel.** The canvas detail view shows a read-only **quality inspector** on the right: the heuristic `canvas_evaluate` score (0–100), per-category bars, and the issue list — each cliché tell with its `category · tell` badge, severity, and suggestion. Issues that `canvas_autofix` can resolve carry an **auto-fixable** tag, and clicking any issue **highlights its node** in the live preview. Every gallery card also shows a score chip on its thumbnail: neutral at 96 and above, amber at 95 or below (the quality bar), so canvases under the bar stand out at a glance. The project header sums it up as "N canvases · M below the bar". The score matches what your agent sees over MCP (same fast-mode evaluation, relaxed by the canvas's stored genre and applied preset) — it's computed for display only and never written back.
**Quality panel.** The canvas detail view shows a read-only **Quality** tab on the right: the heuristic `canvas_evaluate` score as "NN / 100" with an **At the bar** (96 and above) or **Below the bar** (95 or below) chip, a reason line ("Coverage holds it back: …", or "Every category is at 100."), the structure, genre and preset the canvas was built from, the vision critique when one exists, the categories lowest first, and the issues grouped as `canvas_evaluate` groups them for agents ("N findings in M groups", errors first). Each row reads `Category · kind`, where the kind is the cliché tell, **auto-fixable** when `canvas_autofix` can resolve it, or the severity; the suggestion is the row's tooltip, and **Show n nodes** outlines its nodes in the live preview. Every gallery card also shows a score chip on its thumbnail: neutral at 96 and above, amber at 95 or below (the quality bar), so canvases under the bar stand out at a glance. The project header sums it up as "N canvases · M below the bar". The score matches what your agent sees over MCP (same fast-mode evaluation, relaxed by the canvas's stored genre and applied preset) — it's computed for display only and never written back.

![framesmith point-and-tell feedback — a newsletter signup card in the detail view with Comment mode active: a popover anchored to the clicked paragraph shows breadcrumb chips (Body · Signup Card · Document · whole page) and a typed note, while the Feedback inspector tab on the right lists one open comment on "Fine Print" and one resolved comment with the agent's reply beneath it.](https://raw.githubusercontent.com/vicmaster/framesmith/master/docs/framesmith-feedback.png?v=1.8)

> Above: **point-and-tell** in action — Comment mode is on, the clicked element is outlined, the popover's breadcrumb re-scopes the anchor, and the Feedback tab tracks open comments plus the agent's replies to resolved ones.

**Feedback panel.** Point-and-tell: toggle **Comment** in the toolbar and click any element in the preview to leave a note for the agent — a breadcrumb in the popover re-scopes the anchor from the exact element up to its card, section, or the whole page. The **Feedback** tab lists open comments (badge = open count) with click-to-highlight, lets you resolve or delete them, and shows the agent's resolution note as a reply once it has addressed the item. Comments persist on the canvas itself (`metadata.feedback` — git-diffable in bound repos) and the agent reads them over MCP via `get_feedback`; open feedback blocks the agent from presenting, same as open quality issues.
**Feedback panel.** Point-and-tell: press **Comment** in the toolbar and a popover opens under it. Click an element in the preview to pin the note to it (chips re-scope the anchor from the exact element up to its card, section, or the whole page); without a click the note is about the whole page. The **Feedback** tab lists open comments (its count, and the Comment button's, is the open count) with click-to-highlight, lets you resolve or delete them (deleting asks first), and shows the agent's resolution note as a reply once it has addressed the item. The list and the counts refresh on their own: a comment the agent resolves with `resolve_feedback` moves to Resolved while you watch. Comments persist on the canvas itself (`metadata.feedback` — git-diffable in bound repos) and the agent reads them over MCP via `get_feedback`; open feedback blocks the agent from presenting, same as open quality issues.

**Design-system panel.** A second inspector tab shows the canvas's effective design tokens — color swatches, type scale, spacing, and radius — resolved through the full workspace ▸ project ▸ canvas inheritance chain. Each section notes its dominant source layer, and any token resolving from a *different* layer is tagged (`canvas` / `project` / `workspace`) so you can see at a glance what a given canvas customized versus inherited.

Expand Down Expand Up @@ -1379,9 +1379,9 @@ The standalone viewer:
- **Archive** (`/archive`) — soft-deleted canvases with restore / permadelete actions
- **Canvas detail** (`/canvas/:id`) — the rendered design, fitted to the pane with zoom (50–200%) and Fit buttons, breakpoint tabs (Mobile / Tablet / Desktop / Compare; a `desktop-app` canvas gets its window widths, the artboard and Compare), a **More** menu (View JSON, Copy canvas ID, Archive / Restore, Delete canvas) and a caption naming type, size and states; a canvas declared `mobile` opens 1:1 in a device frame with a **Show safe area** tool button instead of the tabs and zoom
- **Raw HTML** (`/canvas/:id/html`) — the rendered HTML for embedding or inspection
- **JSON API** (`/api/canvases`, `/api/canvas/:id/meta`) — programmatic access; each `/api/canvases` row carries the canvas's resolved `type` and `genre`
- **JSON API** (`/api/canvases`, `/api/canvas/:id/meta`, `/canvas/:id/inspector`) — programmatic access; each `/api/canvases` row carries the canvas's resolved `type` and `genre`, `/meta` carries a `contentKey` and a `feedbackKey`, and `/canvas/:id/inspector` returns `{ quality, design, nodeIndex }`
- **Fonts** (`/assets/fonts/<file>`) — the viewer's own faces (Inter, Space Grotesk), served from the font cache (`~/.framesmith/fonts/`)
- **Live auto-refresh** — the canvas page polls every 2 seconds and the project page every 3, so the browser updates as your agent runs `batch_design`; the project page reloads on any edit, rename, genre, type or state change
- **Live auto-refresh** — the canvas page polls every 2 seconds and the project page every 3, so the browser updates as your agent runs `batch_design`; the project page reloads on any edit, rename, genre, type or state change, and the canvas page refreshes its Quality and Design system panels, its Feedback list and its comment counts without a reload

Unbound canvases persist to `~/.framesmith/canvases/` as JSON files, and canvases in a bound repo persist to that repo's `.framesmith/` (see [`canvas_bind`](#canvas_bind)). Both survive process restarts, and the viewer shows both: the global store plus every repo registered in `~/.framesmith/registry.json`. Set `FRAMESMITH_VIEWER_URL` in the MCP server env to point at a viewer running on a non-default port.

Expand Down
2 changes: 1 addition & 1 deletion VISION.md
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ Phase 31 rebuilt the viewer as canvases and left the code alone. A design pass o
- [x] Slice A — foundation: `src/viewer/` modules, tokens copied from the design system and pinned by a test, chrome that follows the system's light or dark setting, fonts served from the cache, one sidebar, tabs, menu and dialog used everywhere
- [x] Slice B — gallery: thumbnail cards with a score chip against the bar, search and type filter kept in the URL, a live status, and refresh on every edit
- [x] Slice C — detail shell: toolbar with state tabs, a More menu (JSON, copy ID, archive, delete), a delete dialog, and preview tools (zoom, fit, preview theme, safe area)
- [ ] Slice D — inspector and comments: the Quality tab sorted lowest first with a reason line, Design system and Feedback restyled, the Import placeholder removed, the comment popover, and panels that refresh live
- [x] Slice D — inspector and comments: the Quality tab sorted lowest first with a reason line, Design system and Feedback restyled, the Import placeholder removed, the comment popover, and panels that refresh live
- [ ] Slice E — archive, docs and acceptance: the archive tree with a preview panel, README and screenshots, and each screen beside its design
- [ ] Follow-up — the viewer sends `Access-Control-Allow-Origin: *` on every response, the routes that archive, delete and post comments included. It listens on 127.0.0.1 only, but a page open in the same browser can still send it a simple cross-origin POST (archive, unarchive, add or resolve a comment) without a preflight. Drop the header from mutating routes, reject requests whose `Origin` is not the viewer's own, and test both; a separate change from the visual port

Expand Down
9 changes: 9 additions & 0 deletions docs/specs/PHASE-33-SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,15 @@ Its design system is the project's: seed `#B45309`, personality `technical`, 14p

**Slice D — inspector and comments.** The Quality tab (FR-D1), the restyled Design system and Feedback tabs and the removed Import tab (FR-D2), the comment popover (FR-D3), and the live inspector with its route and `feedbackKey` (FR-D4). Tests rewritten: `test-viewer-panels.ts` (inspector selectors), `test-viewer-feedback.ts` (`data-tab="feedback"`, `btn-comment`, `FB_INIT`), `test-eval-cache-key.ts:104` (it reads the provenance chip from the toolbar; the chip moves into the Quality tab). New: `test/browser/test-viewer-inspector.ts`, with an MCP-driven check of FR-D4 in `test/e2e/`.

**Slice D — as built.**
- **D1: the inspector is always there.** An empty canvas used to get no inspector; it now gets one whose Quality tab says it has no score yet, so the Feedback tab is reachable on an empty canvas too.
- **D2: `/canvas/:id/inspector` returns JSON**, `{ quality, design, nodeIndex }`: the two server-rendered panels and the node index. The Feedback list stays client-rendered from `/api/canvas/:id/feedback`, so comment text never passes through `innerHTML`. `feedbackKey` lives in `src/viewer/feedback-key.ts`, shared by the page, its script and `/meta`.
- **D3: the popover is the comment mode.** It is static markup under the Comment button; opening it turns comment mode on, a click in the preview fills its anchor chips without moving it, and Cancel, Escape or a save closes it and leaves comment mode. Deleting a comment confirms in the shared dialog.
- **D4: the critique row says when the rubric asked for revision** ("Vision critique 82/100 · needs revision"), as the old toolbar chip did.
- **D5: the 80/60 helpers are gone.** `gradeFor`, `scoreColor` and `sevColor` are deleted (slice B's B5).
- **D7: "Built from" leaves out the axes.** The old toolbar chip also showed the alignment and density axes; FR-D1 names structure, genre and preset, so the caption shows those three. The panels' keys move only after a fetch succeeds and the newest response wins, so a failed or slow fetch is retried on the next poll, and an edit re-reads the comments, whose "node gone" flags it can change.
- **D6: the end-to-end check pins the viewer port.** Left to itself the MCP server reuses any viewer on 3001–3020, which would be the user's own, so `test/e2e/test-viewer-live-mcp.ts` sets `FRAMESMITH_VIEWER_PORT` to a free port.

**Slice E — archive, docs, acceptance.** `pages/archive.ts` (FR-E1, FR-E2), docs and screenshots (FR-E3), and the side-by-side acceptance (FR-E4). Tests rewritten: `test-archive-view.ts` (archive page half). `test/manual/test-viewer.ts` and `test-viewer-navbar.ts` follow the new markup. New: `test/browser/test-viewer-archive.ts`.

Tests that read data, not markup, are untouched: `test-viewer-perf.ts`, `test-dual-theme.ts`, `test-viewer-resolves-workspace-tokens.ts`, `test-skeleton.ts`, `test-viewer-repo-aggregation.ts`, `test-viewer-repo-lifecycle.ts`, `test-viewer-watch.ts`. Each slice PR states that `test-viewer-perf.ts` still holds its 4x-store bound, since the gallery now renders more per card.
Expand Down
Loading
Loading