Skip to content

Agentic Setup: Keep sample content if users want onboarding#34704

Merged
Sidnioulz merged 4 commits into
nextfrom
sidnioulz/keep-sample-content-when-onboarding
May 5, 2026
Merged

Agentic Setup: Keep sample content if users want onboarding#34704
Sidnioulz merged 4 commits into
nextfrom
sidnioulz/keep-sample-content-when-onboarding

Conversation

@Sidnioulz
Copy link
Copy Markdown
Contributor

@Sidnioulz Sidnioulz commented May 4, 2026

ø

Summary by CodeRabbit

  • New Features
    • The CLI now respects a user's onboarding preference: when onboarding is requested, generated Storybook components, styles, stories, and examples are preserved to support learning and exploration.
    • Setup guidance and prompts adapt based on whether onboarding is needed, producing more tailored instructions during initial setup.

Copilot AI review requested due to automatic review settings May 4, 2026 14:48
@Sidnioulz Sidnioulz added build Internal-facing build tooling & test updates ci:normal labels May 4, 2026
@Sidnioulz Sidnioulz requested a review from yannbf May 4, 2026 14:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 needsUserOnboarding to AI setup prompt context and project metadata.
  • Added an onboardingContentRule to several non-default AI setup prompt variants.
  • Updated eslint-plugin documentation 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.

Comment thread code/lib/cli-storybook/src/ai/index.ts Outdated
Comment thread code/lib/cli-storybook/src/ai/index.ts
Comment thread docs/configure/integration/eslint-plugin.mdx
Comment thread code/lib/cli-storybook/src/ai/setup-prompts/partials/rules.ts Outdated
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 59777da7-ad78-465b-9eac-ac9afb5857a5

📥 Commits

Reviewing files that changed from the base of the PR and between 7187a61 and 57066cd.

📒 Files selected for processing (4)
  • code/lib/cli-storybook/src/ai/setup-prompts/monorepo.ts
  • code/lib/cli-storybook/src/ai/setup-prompts/optimized-tests.ts
  • code/lib/cli-storybook/src/ai/setup-prompts/partials/steps.ts
  • code/lib/cli-storybook/src/ai/setup-prompts/relaxed-limits.ts
✅ Files skipped from review due to trivial changes (1)
  • code/lib/cli-storybook/src/ai/setup-prompts/optimized-tests.ts

📝 Walkthrough

Walkthrough

Threads a cached onboarding flag into the AI setup: aiSetup reads cache.get('onboarding-pending'), adds needsUserOnboarding to projectInfo, passes it into prompt contexts, and conditions the cleanup prompt on that flag.

Changes

Onboarding Status Threading

Layer / File(s) Summary
Type Definitions
code/lib/cli-storybook/src/ai/types.ts
Adds needsUserOnboarding: boolean to ProjectInfo and SetupInstructionsContext.
Cache Integration
code/lib/cli-storybook/src/ai/index.ts
aiSetup reads cache.get('onboarding-pending') and includes it as needsUserOnboarding when building projectInfo.
Context Threading
code/lib/cli-storybook/src/ai/setup-prompts/...
monorepo.ts, optimized-tests.ts, relaxed-limits.ts
instructions(projectInfo) now destructures needsUserOnboarding and sets it on the SetupInstructionsContext passed to rule/step builders.
Conditional Cleanup Logic
code/lib/cli-storybook/src/ai/setup-prompts/partials/steps.ts
cleanupStep now consumes needsUserOnboarding and appends onboarding-specific guidance to the cleanup body (preserve artifacts when onboarding is required; otherwise allow deletion if stories succeeded).

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Don'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 false on 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

📥 Commits

Reviewing files that changed from the base of the PR and between bfb2660 and 4fb1fd1.

📒 Files selected for processing (7)
  • code/lib/cli-storybook/src/ai/index.ts
  • code/lib/cli-storybook/src/ai/setup-prompts/monorepo.ts
  • code/lib/cli-storybook/src/ai/setup-prompts/optimized-tests.ts
  • code/lib/cli-storybook/src/ai/setup-prompts/partials/rules.ts
  • code/lib/cli-storybook/src/ai/setup-prompts/relaxed-limits.ts
  • code/lib/cli-storybook/src/ai/types.ts
  • docs/configure/integration/eslint-plugin.mdx

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
code/lib/cli-storybook/src/ai/setup-prompts/relaxed-limits.ts (1)

56-65: ⚡ Quick win

Include the onboarding rule in listRules for relaxed mode.

needsUserOnboarding is now threaded into ctx, but the rules list never invokes onboardingContenRule(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

📥 Commits

Reviewing files that changed from the base of the PR and between b8bec21 and 7187a61.

📒 Files selected for processing (4)
  • code/lib/cli-storybook/src/ai/setup-prompts/monorepo.ts
  • code/lib/cli-storybook/src/ai/setup-prompts/optimized-tests.ts
  • code/lib/cli-storybook/src/ai/setup-prompts/partials/steps.ts
  • code/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

@Sidnioulz Sidnioulz force-pushed the sidnioulz/keep-sample-content-when-onboarding branch from 7187a61 to 6a2d7aa Compare May 5, 2026 03:00
@Sidnioulz Sidnioulz force-pushed the sidnioulz/keep-sample-content-when-onboarding branch from 6a2d7aa to 57066cd Compare May 5, 2026 03:01
@Sidnioulz Sidnioulz merged commit 8db46d7 into next May 5, 2026
123 checks passed
@Sidnioulz Sidnioulz deleted the sidnioulz/keep-sample-content-when-onboarding branch May 5, 2026 03:20
@github-actions github-actions Bot mentioned this pull request May 5, 2026
10 tasks
@JReinhold JReinhold added maintenance User-facing maintenance tasks and removed build Internal-facing build tooling & test updates labels May 5, 2026
@github-actions github-actions Bot mentioned this pull request May 5, 2026
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:normal maintenance User-facing maintenance tasks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants