CodeVetter · Repo Unpack · Extension points
storybookjs/storybook
Storybook exposes extension seams at configuration presets, builders, renderers, manager addons, story indexers, and schema-driven services. Agent transports share registered toolsets instead of independently implementing operations. Registration and initialization conditions are part of those contracts. New integrations should preserve runtime ownership and use the existing hooks appropriate to their boundary.
- Framework presets connect a builder and renderer through core and can alter bundler configuration through viteFinal; React-Vite uses this hook for conditional docgen plugins.
- Builders provide start/build/bail and optional changeDetectionAdapter implementations; builder-vite supplies live and headless change-detection adapters depending on server/options availability.
- Renderer renderToCanvas receives RenderContext and a canvas element and returns cleanup; the React implementation supplies framework-specific mounting, error boundaries, and remount behavior.
- Server extensions can use options.extendServer, project middleware, and experimental_devServer preset hooks; those hooks run before preview builder startup.
- Custom story indexers provide a test matcher and createIndex(file, { makeTitle }); extractStories fails explicitly when no indexer matches.
- Manager addons register loader callbacks and add typed elements through AddonStore; Controls demonstrates a feature-gated PANEL registration with a rendered ControlsPanel.
- defineService supports initial state, queries, and commands with schema validation; server registration is a relay hub, and load-enabled queries can provide staticInputs/staticPath for snapshot generation.
- Toolsets define schemas and one handler returning data/Markdown outcomes; registerToolset uses a realm-global map and rejects duplicate IDs or derived transport-name collisions, while addon-vitest registers its toolset and responder together.