Skip to content

Commit a835ed3

Browse files
authored
Merge pull request #34740 from storybookjs/yann/undo-extensive-flag
CLI: Remove extensive prompt option
2 parents 173a762 + 1791797 commit a835ed3

5 files changed

Lines changed: 19 additions & 36 deletions

File tree

code/lib/cli-storybook/src/ai/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { getAiSetupMarkdownOutput } from './setup-prompts/index.ts';
1414
import type { ProjectInfo, AiSetupOptions } from './types.ts';
1515

1616
export async function aiSetup(options: AiSetupOptions): Promise<void> {
17-
const { configDir: userConfigDir, extensive, packageManager, output } = options;
17+
const { configDir: userConfigDir, packageManager, output } = options;
1818

1919
let projectInfo: ProjectInfo;
2020

@@ -80,7 +80,7 @@ export async function aiSetup(options: AiSetupOptions): Promise<void> {
8080
return;
8181
}
8282

83-
const result = await getAiSetupMarkdownOutput(projectInfo, extensive);
83+
const result = await getAiSetupMarkdownOutput(projectInfo);
8484
const markdownOutput = result.markdown;
8585

8686
// Persist the fact that `storybook ai setup` ran in this project, scoped to

code/lib/cli-storybook/src/ai/setup-prompts/index.ts

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,25 @@ import type { ProjectInfo } from '../types.ts';
44
import { getProjectOverview } from '../utils/project-overview.ts';
55

66
/**
7-
* The prompt variants that ship to real users. Running `npx storybook ai setup`
8-
* without environment variable overrides uses either of these prompts.
7+
* The single prompt variant that ships to real users. Running
8+
* `npx storybook ai setup` without any overrides always produces this prompt.
99
*/
1010
import * as currentlyUsedPrompt from './optimized-tests.ts';
1111
export const DEFAULT_PROMPT_NAME: PromptName = 'optimized-tests';
1212

13-
import * as extensivePrompt from './pattern-copy-play.ts';
14-
export const EXTENSIVE_PROMPT_NAME: PromptName = 'pattern-copy-play';
15-
1613
/**
1714
* Main prompt used currently in `npx storybook ai setup` command. If you promote a new prompt to be default, move this to the FORMERLY_USED_PROMPTS object below.
1815
*/
19-
const BUNDLED_PROMPTS: Record<string, (projectInfo: ProjectInfo) => string> = {
16+
const CURRENTLY_USED_PROMPT: Record<string, (projectInfo: ProjectInfo) => string> = {
2017
[DEFAULT_PROMPT_NAME]: currentlyUsedPrompt.instructions,
21-
[EXTENSIVE_PROMPT_NAME]: extensivePrompt.instructions,
2218
};
2319

2420
/**
2521
* Names of variants registered behind `EVAL_SETUP_PROMPT`. Loaded on demand
2622
* from sibling files so the bundler can code|-split them away from the
2723
* default-only path that real users hit.
2824
*/
29-
const DYNAMICALLY_IMPORTED_PROMPTS: Record<
30-
string,
31-
() => Promise<(projectInfo: ProjectInfo) => string>
32-
> = {
25+
const FORMERLY_USED_PROMPTS: Record<string, () => Promise<(projectInfo: ProjectInfo) => string>> = {
3326
monorepo: async () => (await import('./monorepo.ts')).instructions,
3427
'optimized-tests': async () => (await import('./optimized-tests.ts')).instructions,
3528
'relaxed-limits': async () => (await import('./relaxed-limits.ts')).instructions,
@@ -43,8 +36,8 @@ export type PromptName = string;
4336

4437
/** Names available to the eval harness — defaults plus experimental variants. */
4538
export const PROMPT_NAMES: PromptName[] = [
46-
...Object.keys(BUNDLED_PROMPTS),
47-
...Object.keys(DYNAMICALLY_IMPORTED_PROMPTS),
39+
...Object.keys(CURRENTLY_USED_PROMPT),
40+
...Object.keys(FORMERLY_USED_PROMPTS),
4841
];
4942

5043
/**
@@ -55,36 +48,32 @@ export const PROMPT_NAMES: PromptName[] = [
5548
*/
5649
const EVAL_SETUP_PROMPT_ENV = 'EVAL_SETUP_PROMPT';
5750

58-
function resolvePromptName(extensive?: boolean): PromptName {
51+
function resolvePromptName(): PromptName {
5952
const requested = process.env[EVAL_SETUP_PROMPT_ENV]?.trim();
6053
if (
6154
requested &&
62-
(Object.hasOwn(BUNDLED_PROMPTS, requested) ||
63-
Object.hasOwn(DYNAMICALLY_IMPORTED_PROMPTS, requested))
55+
(Object.hasOwn(CURRENTLY_USED_PROMPT, requested) ||
56+
Object.hasOwn(FORMERLY_USED_PROMPTS, requested))
6457
) {
6558
return requested;
6659
}
67-
return extensive ? EXTENSIVE_PROMPT_NAME : DEFAULT_PROMPT_NAME;
60+
return DEFAULT_PROMPT_NAME;
6861
}
6962

7063
export async function getAiSetupPrompt(
71-
projectInfo: ProjectInfo,
72-
extensive?: boolean
64+
projectInfo: ProjectInfo
7365
): Promise<{ content: string; name: PromptName }> {
74-
const name = resolvePromptName(extensive);
75-
const builder = BUNDLED_PROMPTS[name] ?? (await DYNAMICALLY_IMPORTED_PROMPTS[name]());
66+
const name = resolvePromptName();
67+
const builder = CURRENTLY_USED_PROMPT[name] ?? (await FORMERLY_USED_PROMPTS[name]());
7668

7769
return { content: builder(projectInfo), name };
7870
}
7971

80-
export async function getAiSetupMarkdownOutput(
81-
projectInfo: ProjectInfo,
82-
extensive?: boolean
83-
): Promise<{
72+
export async function getAiSetupMarkdownOutput(projectInfo: ProjectInfo): Promise<{
8473
markdown: string;
8574
prompt: PromptName;
8675
}> {
87-
const { content, name } = await getAiSetupPrompt(projectInfo, extensive);
76+
const { content, name } = await getAiSetupPrompt(projectInfo);
8877

8978
return {
9079
markdown: dedent`

code/lib/cli-storybook/src/ai/setup-prompts/pattern-copy-play.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
* Prompt variant: `pattern-copy-play` (current default for `npx storybook ai setup`)
33
*
44
* - Created: 2026-04-22 (eval iteration 2, default since this PR)
5-
* - Status: produced by `ai setup` invocation when --extensive is true and `EVAL_SETUP_PROMPT` is unset.
5+
* - Status: shipping default — produced by every `ai setup` invocation
6+
* without `EVAL_SETUP_PROMPT` set.
67
* - Reference eval results:
78
* https://github.com/search?q=is:pr label:"prompt:pattern-copy-play" org:storybook-tmp&type=pullrequests
89
*

code/lib/cli-storybook/src/ai/types.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ export interface AiSetupOptions {
1414
/** Populated from the program-level `--disable-telemetry` flag (defaults from `STORYBOOK_DISABLE_TELEMETRY`). */
1515
disableTelemetry?: boolean;
1616

17-
/** Whether to use the extensive prompt instead of the default prompt. */
18-
extensive?: boolean;
19-
2017
/** A random ID attributed by the CLI when running `ai setup` to identify the setup session. */
2118
runId: string;
2219
}

code/lib/cli-storybook/src/bin/run.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,6 @@ aiCommand
315315
)
316316
)
317317
.option('-c, --config-dir <dir-name>', 'Directory of Storybook configuration')
318-
.option(
319-
'-e, --extensive',
320-
'Use the extensive setup prompt (takes longer, explores your codebase further, and generates more complex stories)'
321-
)
322318
.action(async (options, cmd) => {
323319
const parentOptions = cmd.parent?.opts() ?? {};
324320
const runId = Math.random().toString(36);

0 commit comments

Comments
 (0)