Repository navigation
release/v0.2.3: fix release workflow, version drift, export routes + stitch_to_storybook - #1
Conversation
…t routes + add stitch_to_storybook Sprint A (blockers) + Feature 1: Bug fixes: - release.yml: drop NPM_TOKEN env, use OIDC provenance only (was hybrid/ambiguous, caused 3 consecutive publish failures on v0.2.0/0.2.1/v0.2.2) - src/index.ts + src/bin/cli.ts: read version from package.json (was hardcoded '2.0.0' for MCP serverInfo and '0.2.0' for CLI --version) - src/commands/export.ts: Next.js --routes now maps each route to a distinct screen (round-robin fallback) and supports route=screenId syntax. Was always screens[0] for every route. - src/lib/resolve-html.ts: extracted from index.ts; logs warnings when HTML fetch fails instead of silently returning <div></div>; adds 15s AbortSignal timeout - src/commands/export.ts: now uses resolveHtml for the non-nextjs path too (consistency, was calling screen.getHtml() directly before) Feature: stitch_to_storybook - New MCP tool 'stitch_to_storybook' and CLI 'stitch-mcp-cli storybook <project-id>' command. Exports a Stitch project to ready-to-run Storybook 8 stories for React, Next.js, Vue 3, Nuxt 3, Svelte 5, SvelteKit. - Writes one component + one story per screen plus .storybook/main.ts and preview.ts. - Templates in src/templates/storybook/ (6 .ejs files) - Next step for user: cd <out> && npx storybook@latest init && npx storybook dev Tests: - tests/unit/resolve-html.test.ts (4 tests) — fetch failure paths, timeout, empty HTML - tests/unit/export-routes.test.ts (3 tests) — round-robin, route=screenId, fallback when id missing - tests/unit/storybook.test.ts (7 tests) — framework support matrix, render each template, extension mapping - Total: 72/72 passing (up from 58/58 in v0.2.2) Pre-commit: static scan (security/quality/resilience) clean. No new lint errors. Build (tsc) clean. CLI smoke test: --version returns 0.2.3 from package.json; both 'export --help' and 'storybook --help' render correctly.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 472da80557
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const url = new URL(`../templates/${rel}`, import.meta.url); | ||
| return url.pathname; |
There was a problem hiding this comment.
Include Storybook templates in the published package
tsc does not copy EJS files (and src/templates is excluded from compilation), while package.json publishes only dist/. Consequently, an installed package resolves this path relative to dist/lib as dist/templates/storybook/..., which is absent, so both the CLI and MCP Storybook exports always throw “Storybook template no encontrado” outside a source checkout.
Useful? React with 👍 / 👎.
| if (!isValidFramework(framework)) { | ||
| console.error(`Framework inválido: ${framework}`); | ||
| console.error(`Frameworks válidos: ${getStorybookSupportedFrameworks().join(", ")}`); | ||
| process.exit(1); |
There was a problem hiding this comment.
Support SvelteKit before advertising it
For storybook --framework sveltekit, this validation exits because isValidFramework delegates to FRAMEWORK_MAP, which has no sveltekit entry, even though the command option and Storybook-supported set advertise it. The MCP tool bypasses this check but then fails at transformToFramework for the same reason, so SvelteKit cannot be exported through either new interface.
Useful? React with 👍 / 👎.
| @@ -0,0 +1,18 @@ | |||
| import type { Meta, StoryObj } from "@storybook/react"; | |||
| import { <%= componentName %> } from "./<%= componentName %>"; | |||
There was a problem hiding this comment.
Default-import generated Next.js components
The Next.js transformer emits export default function ... for every generated component, but this story imports a named export. Thus every default Next.js Storybook export fails module resolution/type-checking because Stitch... is not an exported member; use a default import here.
Useful? React with 👍 / 👎.
| const userTemplate = getUserTemplatePath(framework); | ||
| if (userTemplate) return userTemplate; |
There was a problem hiding this comment.
Select a story template instead of component.ejs
When a user has the documented templateDir configured, this returns that framework's component.ejs as the Storybook template. Those component templates consume html and often css, but renderStorybookStory supplies neither, causing EJS rendering to fail; if that component template is absent, the later existence check fails instead of falling back to the bundled Storybook template.
Useful? React with 👍 / 👎.
Summary
Sprint A (blocker fixes) + Feature 1 (
stitch_to_storybook).Bug fixes
src/index.tsandsrc/bin/cli.tsnow readPKG_VERSIONfrompackage.jsonviacreateRequire. MCPserverInfoand CLI--versionno longer report stale 2.0.0 / 0.2.0.--routes— fixed functional bug where every route always exportedscreens[0]. Now supports round-robin fallback and explicitroute=screenIdsyntax.src/lib/resolve-html.ts, logs warnings on fetch failure or non-OK status, adds 15sAbortSignaltimeout.resolveHtmlfor consistency (was callingscreen.getHtml()directly before).New feature: stitch_to_storybook
New MCP tool
stitch_to_storybook+ CLI commandstitch-mcp-cli storybook <project-id>that exports a Stitch project to ready-to-run Storybook 8 stories for React, Next.js, Vue 3, Nuxt 3, Svelte 5, SvelteKit. Writes one component + one story per screen plus a minimal.storybook/main.ts+preview.ts.Usage:
Tests
Files changed
18 files changed, 760 insertions(+), 30 deletions(-)
Published
v0.2.3 is live on npm registry as of 2026-09-15 23:56 UTC. Tarball: https://registry.npmjs.org/stitch-mcp-cli/-/stitch-mcp-cli-0.2.3.tgz
Follow-up (not blocking)
NODE_AUTH_TOKEN. Once configured, drop theenv:block from the publish step.