Skip to content

feat: add Storybook for webview components to enable isolated UI development #42

Description

@charannyk06

Priority: P3 — Low

Problem

The webview has ~50 React components but no way to view or develop them in isolation. Developers must:

  1. Build the full extension
  2. Open a VS Code window with the extension loaded
  3. Trigger the specific UI state needed

This is extremely slow for UI development. A FindingCard with complex states (expanded, with patch, with validation errors, loading) requires specific data that's hard to reproduce manually.

Solution

1. Install Storybook

npx storybook@latest init --type vite

2. Add stories for key components

Priority components for stories:

  • FindingCard — all severity levels, with/without patch, applied state, error state
  • ChatMessage — user/assistant, with reasoning blocks, with tool calls
  • EvidencePanel — with code snippet, file path, line numbers
  • DiffViewer — show before/after patch
  • AuditTimeline — various event types
  • PatchPreview — valid patch, patch with errors

3. Mock data

Create src/webview/stories/fixtures.ts with realistic mock findings, chat messages, and review runs.

4. Add to scripts

"storybook": "storybook dev -p 6006",
"build:storybook": "storybook build"

Acceptance Criteria

  • Storybook installed and running (npm run storybook)
  • Stories for the 6 key components above
  • Mock data fixtures file created
  • Interactive controls for component props
  • Storybook build added to CI (optional, for visual regression)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions