Agentic Setup: Keep sample content if users want onboarding#34704
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to make AI-assisted Storybook setup preserve the starter sample stories when the user opted into onboarding, while also updating one ESLint docs page’s code style examples. In the codebase, this change extends the AI setup prompt context with onboarding state and adds a new prompt rule intended to control whether initial Storybook content can be removed.
Changes:
- Added
needsUserOnboardingto AI setup prompt context and project metadata. - Added an
onboardingContentRuleto several non-default AI setup prompt variants. - Updated
eslint-plugindocumentation snippets to use double-quoted strings.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/configure/integration/eslint-plugin.mdx | Normalizes ESLint config examples to double quotes. |
| code/lib/cli-storybook/src/ai/types.ts | Extends AI setup types with onboarding state. |
| code/lib/cli-storybook/src/ai/setup-prompts/relaxed-limits.ts | Passes onboarding state into the relaxed-limits prompt and adds the new rule. |
| code/lib/cli-storybook/src/ai/setup-prompts/partials/rules.ts | Defines the new onboarding-specific initial-content rule. |
| code/lib/cli-storybook/src/ai/setup-prompts/optimized-tests.ts | Passes onboarding state into the optimized-tests prompt and adds the new rule. |
| code/lib/cli-storybook/src/ai/setup-prompts/monorepo.ts | Passes onboarding state into the monorepo prompt and adds the new rule. |
| code/lib/cli-storybook/src/ai/index.ts | Reads onboarding state from cache and attaches it to ProjectInfo for prompt generation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
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 (4)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThreads a cached onboarding flag into the AI setup: ChangesOnboarding Status Threading
Sequence Diagram(s)sequenceDiagram
participant CLI as CLI (aiSetup)
participant Cache as Cache
participant AI as AI Setup
participant Prompts as Prompt Generators
participant Steps as Steps/Rules
CLI->>Cache: get('onboarding-pending')
Cache-->>CLI: onboarding-pending (bool)
CLI->>AI: build projectInfo (+needsUserOnboarding)
AI->>Prompts: instructions(projectInfo with flag)
Prompts->>Steps: ctx (includes needsUserOnboarding)
Steps->>Steps: conditional cleanup text based on flag
Steps-->>CLI: composed output
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
code/lib/cli-storybook/src/ai/index.ts (1)
49-65:⚠️ Potential issue | 🟠 Major | ⚡ Quick winDon't let the onboarding hint fail open or abort setup.
cache.get('onboarding-pending', true)makes a missing or cleared cache entry look like onboarding is still pending, so AI setup will preserve sample content for users who are no longer onboarding. It also puts cache access on the fatal path: a cache read failure now falls into the generic config error and stops setup entirely.This should be a best-effort lookup that defaults to
falseon failure, and only preserves sample content when the cache actually contains the flag.Suggested fix
- const needsUserOnboarding = await cache.get('onboarding-pending', true); + const needsUserOnboarding = Boolean( + await cache.get('onboarding-pending').catch(() => false) + );🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@code/lib/cli-storybook/src/ai/index.ts` around lines 49 - 65, The onboarding flag lookup is currently using cache.get('onboarding-pending', true) which treats missing/errored reads as “pending” and can abort setup; change to a best-effort lookup that defaults to false: call cache.get without the true default, interpret the result strictly (e.g. needsUserOnboarding = result === true || result === 'true' only when the cache actually contains the flag), and wrap the cache access in a try/catch so any read error sets needsUserOnboarding = false; then assign that boolean into projectInfo.needsUserOnboarding.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@code/lib/cli-storybook/src/ai/index.ts`:
- Around line 49-65: The onboarding flag lookup is currently using
cache.get('onboarding-pending', true) which treats missing/errored reads as
“pending” and can abort setup; change to a best-effort lookup that defaults to
false: call cache.get without the true default, interpret the result strictly
(e.g. needsUserOnboarding = result === true || result === 'true' only when the
cache actually contains the flag), and wrap the cache access in a try/catch so
any read error sets needsUserOnboarding = false; then assign that boolean into
projectInfo.needsUserOnboarding.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: fb94256a-9b51-468b-9ba2-11a863a6a783
📒 Files selected for processing (7)
code/lib/cli-storybook/src/ai/index.tscode/lib/cli-storybook/src/ai/setup-prompts/monorepo.tscode/lib/cli-storybook/src/ai/setup-prompts/optimized-tests.tscode/lib/cli-storybook/src/ai/setup-prompts/partials/rules.tscode/lib/cli-storybook/src/ai/setup-prompts/relaxed-limits.tscode/lib/cli-storybook/src/ai/types.tsdocs/configure/integration/eslint-plugin.mdx
There was a problem hiding this comment.
🧹 Nitpick comments (1)
code/lib/cli-storybook/src/ai/setup-prompts/relaxed-limits.ts (1)
56-65: ⚡ Quick winInclude the onboarding rule in
listRulesfor relaxed mode.
needsUserOnboardingis now threaded intoctx, but the rules list never invokesonboardingContenRule(ctx), so relaxed instructions may miss explicit onboarding constraints.Suggested diff
${listRules([ toolsVsShellRule(ctx), nodeModuleReadsRule(ctx), readBudgetRuleRelaxed(ctx), editOverWriteRule(ctx), batchTestsRule(ctx), packageManagerRule(ctx), preferSharedFixesRule(ctx), + onboardingContenRule(ctx), noPolishRule(ctx), ])}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@code/lib/cli-storybook/src/ai/setup-prompts/relaxed-limits.ts` around lines 56 - 65, The relaxed rules list passed to listRules is missing the onboarding rule; update the array inside listRules(...) to include onboardingContentRule(ctx) (or onboardingContenRule(ctx) if that is the actual exported name) alongside toolsVsShellRule(ctx), readBudgetRuleRelaxed(ctx), etc., so the relaxed prompt honors the needsUserOnboarding constraint present on ctx.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@code/lib/cli-storybook/src/ai/setup-prompts/relaxed-limits.ts`:
- Around line 56-65: The relaxed rules list passed to listRules is missing the
onboarding rule; update the array inside listRules(...) to include
onboardingContentRule(ctx) (or onboardingContenRule(ctx) if that is the actual
exported name) alongside toolsVsShellRule(ctx), readBudgetRuleRelaxed(ctx),
etc., so the relaxed prompt honors the needsUserOnboarding constraint present on
ctx.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d7a83b10-0386-44aa-9902-294c5583cd6d
📒 Files selected for processing (4)
code/lib/cli-storybook/src/ai/setup-prompts/monorepo.tscode/lib/cli-storybook/src/ai/setup-prompts/optimized-tests.tscode/lib/cli-storybook/src/ai/setup-prompts/partials/steps.tscode/lib/cli-storybook/src/ai/setup-prompts/relaxed-limits.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- code/lib/cli-storybook/src/ai/setup-prompts/optimized-tests.ts
7187a61 to
6a2d7aa
Compare
6a2d7aa to
57066cd
Compare
ø
Summary by CodeRabbit