Documentation: Add agentic flow and storybook ai command docs#34560
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
✅ Files skipped from review due to trivial changes (7)
📝 WalkthroughWalkthroughAdds documentation and CLI reference for a new "Agentic setup" workflow: a new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
docs/ai/setup.mdx (1)
1-85: Consider a companion update toAGENTS.mdfor the new agentic workflow.This page introduces new agent workflow/command guidance (
storybook ai setup). To keep agent instructions canonical, add (or link) the same expectations inAGENTS.mdso contributors and coding agents don’t diverge.Based on learnings: Keep
AGENTS.mdup to date when Storybook's architecture, tooling, workflows, or contributor guidance changes.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/ai/setup.mdx` around lines 1 - 85, Add a companion section or link in AGENTS.md that mirrors the new agentic setup guidance in docs/ai/setup.mdx: document the "storybook ai setup" command and its --output and --disable-telemetry options, the expected agent workflow (agent-run vs user-run), the post-run expectations (tagging generated stories with "ai-generated" and "needs-work", running Vitest/type checks), how the Storybook MCP server integrates post-setup, and guidance for keeping AGENTS.md synced with future changes so contributors and coding agents remain canonical.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/api/cli-options.mdx`:
- Line 311: The docs entry for the logfile CLI option incorrectly shows a
required argument (`--logfile <path>`); update the table row in
docs/api/cli-options.mdx to match the CLI definition which uses an optional path
(`--logfile [path]`) and keep the descriptive text and example usage consistent
with optional semantics (e.g., `storybook ai setup --logfile ./sb.log`). Ensure
the documented flag text exactly matches the CLI option string `--logfile
[path]` used in the run.ts CLI definition.
- Around line 293-295: Update the docs to match the current CLI gating: change
the Callout text for `storybook ai setup` to state the command is available for
projects using the React renderer OR the Vite builder (i.e., either condition),
since the CLI check in the ai command uses the isReact / isVite gating logic
(see the check in ai/index.ts that currently combines those flags) — this keeps
docs accurate until the CLI gating (the boolean check around isReact/isVite in
the ai setup handler) is fixed.
---
Nitpick comments:
In `@docs/ai/setup.mdx`:
- Around line 1-85: Add a companion section or link in AGENTS.md that mirrors
the new agentic setup guidance in docs/ai/setup.mdx: document the "storybook ai
setup" command and its --output and --disable-telemetry options, the expected
agent workflow (agent-run vs user-run), the post-run expectations (tagging
generated stories with "ai-generated" and "needs-work", running Vitest/type
checks), how the Storybook MCP server integrates post-setup, and guidance for
keeping AGENTS.md synced with future changes so contributors and coding agents
remain canonical.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d4a9139f-869c-4b56-b593-0f2d0eefb7fe
📒 Files selected for processing (3)
docs/ai/index.mdxdocs/ai/setup.mdxdocs/api/cli-options.mdx
| <Callout variant="info"> | ||
| `storybook ai setup` is currently only available for projects using the React renderer with the Vite builder. | ||
| </Callout> |
There was a problem hiding this comment.
Availability statement does not match current command gating logic.
Line 294 says ai setup is only available for React+Vite, but code/lib/cli-storybook/src/ai/index.ts (Lines 69-85) currently checks with &&, which allows execution when either side matches. This will mislead users about what is actually blocked.
Suggested doc-side mitigation (until CLI check is corrected)
- `storybook ai setup` is currently only available for projects using the React renderer with the Vite builder.
+ `storybook ai setup` is intended for projects using the React renderer with the Vite builder.
+ If your project uses a different setup, behavior may be limited while support is expanded.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <Callout variant="info"> | |
| `storybook ai setup` is currently only available for projects using the React renderer with the Vite builder. | |
| </Callout> | |
| <Callout variant="info"> | |
| `storybook ai setup` is intended for projects using the React renderer with the Vite builder. | |
| If your project uses a different setup, behavior may be limited while support is expanded. | |
| </Callout> |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/api/cli-options.mdx` around lines 293 - 295, Update the docs to match
the current CLI gating: change the Callout text for `storybook ai setup` to
state the command is available for projects using the React renderer OR the Vite
builder (i.e., either condition), since the CLI check in the ai command uses the
isReact / isVite gating logic (see the check in ai/index.ts that currently
combines those flags) — this keeps docs accurate until the CLI gating (the
boolean check around isReact/isVite in the ai setup handler) is fixed.
- Remove redundant sidebar.title, em dashes, and npx prefix - Add "Starting from storybook init" section - Reduce intro/detail redundancy with anchor link - Replace inline code block with CodeSnippets for package manager variants - Add cross-references to decorators, preview, MSW, stories, tags, play functions, Vitest - Wrap telemetry note in callout - Clarify cli-options.mdx link text and prose Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
♻️ Duplicate comments (2)
docs/api/cli-options.mdx (2)
293-295:⚠️ Potential issue | 🟠 MajorAvailability statement is stricter than current CLI gating behavior.
Line 294 says React with Vite only, but the current guard in
code/lib/cli-storybook/src/ai/index.tsusesrenderer != react && builder != vite, which allows execution when either side matches. This can mislead users until the CLI condition is tightened.Suggested doc-side mitigation
- `storybook ai setup` is currently only available for projects using the React renderer with the Vite builder. + `storybook ai setup` is intended for projects using the React renderer with the Vite builder. + If your project uses a different setup, behavior may be limited while support is expanded.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/api/cli-options.mdx` around lines 293 - 295, The doc statement is too strict compared to the CLI gate: the CLI uses the condition `renderer != react && builder != vite` (in the AI setup logic) which means the command `storybook ai setup` is allowed when either the renderer is React OR the builder is Vite; update the callout text in docs/api/cli-options.mdx so it reflects that availability (e.g., "currently available for projects using the React renderer or the Vite builder") to match the existing check `renderer != react && builder != vite`.
311-311:⚠️ Potential issue | 🟡 MinorUse optional arg shape for
--logfileto match CLI semantics.Line 311 documents
--logfile <path>as required. This should be[path](optional) to stay consistent with the CLI option shape and default logfile behavior documented elsewhere in this page.Proposed fix
-| `--logfile <path>` | Write debug logs to a file.<br />`storybook ai setup --logfile ./sb.log` | +| `--logfile [path]` | Write debug logs to a file. Defaults to `debug-storybook.log` when no path is provided.<br />`storybook ai setup --logfile ./sb.log` |🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/api/cli-options.mdx` at line 311, The documentation entry for the CLI option `--logfile` currently shows a required arg shape (`--logfile <path>`) but the CLI treats it as optional; update the table cell for `--logfile` to use the optional arg shape (`--logfile [path]`) and keep the existing example and description intact so it matches the actual `--logfile` semantics and default logfile behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@docs/api/cli-options.mdx`:
- Around line 293-295: The doc statement is too strict compared to the CLI gate:
the CLI uses the condition `renderer != react && builder != vite` (in the AI
setup logic) which means the command `storybook ai setup` is allowed when either
the renderer is React OR the builder is Vite; update the callout text in
docs/api/cli-options.mdx so it reflects that availability (e.g., "currently
available for projects using the React renderer or the Vite builder") to match
the existing check `renderer != react && builder != vite`.
- Line 311: The documentation entry for the CLI option `--logfile` currently
shows a required arg shape (`--logfile <path>`) but the CLI treats it as
optional; update the table cell for `--logfile` to use the optional arg shape
(`--logfile [path]`) and keep the existing example and description intact so it
matches the actual `--logfile` semantics and default logfile behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 57f76c3a-8e4d-4cdf-86f9-b60b677393ca
📒 Files selected for processing (3)
docs/_snippets/ai-setup-output.mddocs/ai/setup.mdxdocs/api/cli-options.mdx
✅ Files skipped from review due to trivial changes (2)
- docs/_snippets/ai-setup-output.md
- docs/ai/setup.mdx
* project/sb-agentic-setup: (103 commits) CLI: Change mock event detection fix tests fix tests Ensure process termination on signal when telemetry is disabled Add story with changeDetection disabled skip ai prompts in react native Removed data.changedFiles from change-detection status internals and updated tests accordingly. Fix type error Docs: Improve change detection page clarity Extend doc types to support section-level classification Build: Add docs-review skill Fix type error Address feedback Address feedback Format Address feedback Add images add bluesky fix tests gracefully handle cache failures ...
Closes #
What I did
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
Caution
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsMake sure this PR contains one of the labels below:
Available labels
bug: Internal changes that fixes incorrect behavior.maintenance: User-facing maintenance tasks.dependencies: Upgrading (sometimes downgrading) dependencies.build: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup: Minor cleanup style change. Will not show up in release changelog.documentation: Documentation only changes. Will not show up in release changelog.feature request: Introducing a new feature.BREAKING CHANGE: Changes that break compatibility in some way with current major version.other: Changes that don't fit in the above categories.🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/coreteam here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>Summary by CodeRabbit
New Features
ai setupsubcommand and options for output path, telemetry opt-out, logging, and config selection.Documentation