GeezerVison is showing github.com — chore(app): replace Storybook with a story server for component tests by kitlangton · Pull Request #57966 · anomalyco/opencode
Conversation
kitlangton
commented
Oct 21, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Kit picked "Lab Replaces Storybook" on D-13; the lab itself landed in #57908. This is the removal half, rebased onto beta as one commit.
Storybook's UI is replaced by the components lab in the app. Its other job, running the component tests (40 spec files in packages/app/component-tests and packages/session-ui/component-tests), moves to a small story server that needs no Storybook.
What changes
packages/storybook becomes packages/stories: a plain Vite page that renders one story at /?id=<story id>&args=…&globals=….
src/frame.tsx holds the decorators preview.tsx had (theme, direction, locale, motion, dialog and markdown providers, an extension's context), plus the app's SettingsProvider.
src/index-plugin.ts indexes every *.stories.tsx by the id Storybook gave it (<meta id or title>--<export>), so every spec keeps its ids. A spec loads only its own story file.
vite.config.ts keeps Storybook's mock aliases, dedupe and dependency-scan entries.
mocks/ and playwright/ move over unchanged apart from their paths.
- The
story fixture navigates to the frame and returns #story-root. The mount(id, { args, globals }) signature is unchanged; every arg in the URL is applied, typed by the story's own default.
- Removed:
- Storybook, its addons (a11y, docs, links, onboarding, vitest) and the React it pulled in;
.storybook/ (main, preview, manager, theme tool, playground CSS plugin);
- the
storybook build workflow (it only ran on dev);
bun dev:storybook.
- Updated: the
test.yml affected filter (@opencode/stories), ui's Tailwind @source, the component-tests skill, the AGENTS.md line, and the playwright README.
- Kept: every
*.stories.tsx file, unchanged.
Fixed along the way
activity-chips.spec.ts has failed on beta since a1e0aa4 made the activity capsule read settings, which no story frame provided. The frame now provides them.
- Lint in four spec files whose import line changed: blank lines, a tuple loop instead of a nested ternary, and a per-case
reveal instead of a conditional spread.
Testing
- Every id the specs mount (57 literal ones plus the 5 built in loops) resolves in the index and renders in the frame. activity-chips now renders as well.
bun typecheck in app, session-ui and gui-extensions; lint:changed is clean against beta. terminal-focus.spec.ts (app) and file.spec.ts (session-ui) pass locally on the story server.
- CI on cfe1fd2: unit, build and
session-ui-components pass on Linux and Windows. app-components has 5 failures on each OS against beta's 12, all of which also fail on beta (websearch at 360px, timeline-virtualizer offset-only). activity-chips and six websearch cases now pass.
- Windows checkouts have CRLF line endings, so the story index normalises them before reading a file's meta (cfe1fd2).
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
packages/storybook becomes packages/stories: a plain Vite page that renders one story by its Storybook id with the same mocks and decorators, so every component test keeps its ids and mount(). The components lab is the place to browse stories. Removes Storybook, its addons, .storybook/, its workflow and dev:storybook. The frame also provides settings, which fixes activity-chips.spec, and the story index reads CRLF checkouts.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks sound. Both component suites run on the new story server with the same results as beta's Storybook: app 146 passed / 5 failed, and the same 5 (websearch at 360px ×4, timeline-virtualizer offset-only reconnect) fail on beta. session-ui passed all 156. In my environment activity-chips also passed on beta, so I couldn't reproduce that particular failure. Typecheck is clean in app, session-ui and gui-extensions.
Public API: unchanged. This only touches internal dev tooling: the @opencode/storybook package becomes @opencode/stories, the root dev:storybook script is removed, and the PLAYWRIGHT_STORYBOOK_PORT/_URL test env vars become PLAYWRIGHT_STORIES_PORT/_URL. None of these are user-facing.
One small point: the play functions in about 40 *.stories.tsx files now run nowhere (the story frame ignores them). That's fine if the lab is meant to replace them, but it's worth knowing they're now dead code.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
{(loaded) => {
|
|
|
const meta = asStory(loaded().exports.default)
|
|
|
const own = loaded().exports[story!.name]
|
|
|
const entry = typeof own === "function" ? { render: own } : asStory(own)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing type-checks this package: packages/stories has no typecheck script, and app's tsconfig only includes ../stories/playwright/*.ts. tsc -p packages/stories reports TS2339 here and on line 47, because { render: own } has no args/parameters. Annotating entry as StoryObject would fix it. Adding a typecheck script (and fixing the tsconfig lib so ../util passes) would keep frame.tsx, extension.tsx and the index plugin checked in CI.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
Hona
Awaiting requested review from Hona
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|