Skip to content

artifact-canvas: generalize into a shared webview rendering/component foundation #1549

Open

Description

@amrmelsayed

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 existing default-theme.css as the fallback base, themed through the existing ThemeAdapter so 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-specific FileAdapter/MarkerAdapter scoped 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 in markdown-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

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 through ThemeAdapter.

Related

Activity

  1. added
    area/cross-cutting
    on Aug 24, 2026
  2. amrmelsayed commented on Aug 25, 2026

    @amrmelsayed
    CollaboratorAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/cross-cutting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions