Repository navigation
Description
Problem
Codev's webviews are each built from scratch on top of nothing but VSCode's --vscode-* theme tokens. Today there are two:
- markdown-preview — React, mounts
<ArtifactCanvas>from@cluesmith/codev-artifact-canvas. - BacklogSearchPanel — bespoke themed HTML (criteria form + results table), no shared components.
There is no Codev-owned shared component or style layer between them. @cluesmith/codev-artifact-canvas looks like the shared surface, but its charter today is narrow: "rendering and reviewing Codev markdown artifacts (specs/plans/reviews)." Its exports are a markdown renderer (markdown-it + dompurify) and review overlays (CommentComposer, MarkerMinimap, ReadingModeToggle, ReadingProgress). A non-markdown surface (a search form, a queue, an inspector) can't reuse any of it.
The contextual bottom panel (#1049) makes this the third webview, and it hosts multiple modes in one surface — lists, inspectors, a document-review view, an attention roll-up. Without shared primitives, every mode (and every future webview) re-invents themed buttons, inputs, list rows, headers, pills, and empty-states against raw --vscode-* variables. That is duplication we can see coming.
Decision
Expand @cluesmith/codev-artifact-canvas into a general-purpose, theme-aware webview rendering/component foundation — not a new sibling package. A canvas is meant to be a general-purpose renderer; the package's name and its host-adapter architecture already generalize across hosts, so broadening the content charter from "markdown artifacts" to "Codev webview surfaces" is the natural extension. The existing markdown-artifact review surface becomes one specialized surface built on top of the general primitives, not the whole package.
Scope
- A shared primitive layer, host-agnostic and theme-aware, usable by any Codev webview: layout + control primitives such as a header/segmented-control (mode pills), list + row, section, empty-state, and themed button/input — built on
--vscode-*tokens with the package's existingdefault-theme.cssas the fallback base, themed through the existingThemeAdapterso non-VSCode hosts (dashboard, future mobile) still work. - Keep the package host-agnostic: no
vscode/node:imports, no direct fetch; behavior reaches the host through the existing adapter contract (ThemeAdapter,CommandAdapter, and the markdown-specificFileAdapter/MarkerAdapterscoped to the markdown surface). - Clean internal split between the general primitives and the markdown surface (
ArtifactCanvas/MarkdownView/review overlays), with subpath exports so a primitives-only consumer does not pull inmarkdown-it/dompurify. The markdown surface is refactored to sit on the shared primitives with no behavior change. - First consumer is vscode: contextual bottom panel that adapts to active editor (mode resolver + Attention fallback) #1049: the contextual panel's header, mode pills, and summary-list/row stubs render from these primitives. vscode: contextual bottom panel that adapts to active editor (mode resolver + Attention fallback) #1049 is the forcing function that proves the primitive set.
Consumers and migration
- vscode: contextual bottom panel that adapts to active editor (mode resolver + Attention fallback) #1049 contextual panel — first real consumer (header + pills + list/row + empty-state).
- markdown-preview — already on the canvas; refactor its overlays onto the shared primitives (internal, no user-visible change).
- BacklogSearchPanel — candidate migration from bespoke HTML to the shared primitives (results table, criteria form). Follow-up, not required by this issue.
Sequencing (do not block #1049)
#1049 is at spec-approval and must not wait on this. Recommended: #1049 ships its handful of primitives locally and small, and this issue extracts and generalizes them into artifact-canvas afterward, using #1049 as the proving ground. (Alternative: this lands first and #1049 consumes it — the architect decides, but the default keeps #1049 unblocked.)
Out of scope
- Wholesale rewrite of existing webviews. Migration of BacklogSearch is a candidate follow-up, not a requirement here.
- A full standalone design system / non-webview UI. This is a shared webview foundation, scoped to Codev's surfaces.
- Any change to the markdown surface's user-visible behavior — the refactor onto primitives is internal.
Risks
- Diluting a focused package into a kitchen sink. Mitigate with a strict internal split (general primitives vs markdown surface), subpath exports, and keeping the primitives' bundle lean (React peer only; markdown deps stay scoped to the markdown surface).
- Theming drift across hosts. Mitigate by keeping
--vscode-*tokens the source of truth for the VSCode host and routing all theming throughThemeAdapter.
Related
- vscode: contextual bottom panel that adapts to active editor (mode resolver + Attention fallback) #1049 — contextual bottom panel; the forcing function and first consumer of the shared primitives.
- vscode: add review comments from the markdown preview pane (hover-+ per block, no editor mode-switch) #859 / Build foundational reusable package @cluesmith/codev-artifact-canvas for cross-surface markdown artifact review #945 — the current artifact-canvas markdown-artifact surface (the specialized surface that will sit on the generalized foundation).
- vscode: codelens-driven review comments in the unified diff editor — per-builder queue with batched submit to PTY (follow-up to #789) #1037 — pending review comments; renders into vscode: contextual bottom panel that adapts to active editor (mode resolver + Attention fallback) #1049's Code Review mode.
Activity
[Spec 1049] Thread: cross-reference #1549 (generalize artifact-canvas…
[Spec 1049] Thread: record byte-frozen + extraction-seams-not-pre-bui…
amrmelsayed commentedon Aug 25, 2026
Scope note from the 1049 dev-approval redirect (owner-directed, 2026-08-25): the panel was reshaped to purely contextual — pills, summaries, and manual navigation removed; the sidebar owns cross-builder views. Consequence for this issue: 1049's first-consumer primitive list shrinks (no mode pills / segmented control, no summary list+row from the panel; header and empty-state remain). The generalization thesis stands — markdown-preview overlays and BacklogSearchPanel are unchanged as consumers, and #1548 (architect-context render target) would consume list/row primitives if it lands — but the forcing-function claim should now lean on those consumers rather than the panel's navigation UI. Body's consumer section should be re-weighed when this is picked up.