Skip to content

Cli: Allow -p shorthand to --port for ai command#35390

Merged
huang-julien merged 3 commits into
nextfrom
fix/storybookk_aui_port
Jul 8, 2026
Merged

Cli: Allow -p shorthand to --port for ai command#35390
huang-julien merged 3 commits into
nextfrom
fix/storybookk_aui_port

Conversation

@huang-julien

@huang-julien huang-julien commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Closes #

What I did

PR allow to use -p as a shorthand to --port

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

run a command of storybook ai ... with -p instead of --port:

  • get a storybook project (mealdrop)
  • run the SB server
  • run STORYBOOK_FEATURE_AI_CLI=1 npx storybook ai get-storybook-story-instructions -p 6006

Caution

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Declare whether manual QA will be needed for this PR during the next release, through qa:needed or qa:skip

  • Make 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/core team 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
    • Added a shorthand flag for the port option in the AI MCP CLI, so -p can be used instead of --port.
    • Help output now reflects the shorthand option consistently.
  • Tests
    • Added coverage to verify the new shorthand works in the CLI help display.

@huang-julien huang-julien requested a review from kasperpeulen July 7, 2026 11:44
@huang-julien huang-julien added bug ci:daily Run the CI jobs that normally run in the daily job. qa:needed Pull Requests that will need manual QA prior to release. labels Jul 7, 2026
@huang-julien huang-julien marked this pull request as ready for review July 7, 2026 12:14
@huang-julien huang-julien changed the title Cli: allow -p shorthand to --port for ai command Cli: Allow -p shorthand to --port for ai command Jul 7, 2026
@huang-julien huang-julien enabled auto-merge July 7, 2026 12:14
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

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: 9e4b00f3-1c9d-4ab3-9cba-627d665d2879

📥 Commits

Reviewing files that changed from the base of the PR and between a4ce979 and 91c6111.

📒 Files selected for processing (2)
  • code/core/src/cli/ai/mcp/register.test.ts
  • code/core/src/cli/ai/mcp/register.ts

📝 Walkthrough

Walkthrough

This change adds a -p shorthand alias for the --port option in the registerAiMcpPassthrough CLI command and adds a test verifying the shorthand is correctly interpreted as --port when displaying help.

Changes

ai --port shorthand

Layer / File(s) Summary
Port shorthand flag and test
code/core/src/cli/ai/mcp/register.ts, code/core/src/cli/ai/mcp/register.test.ts
Adds -p as a shorthand for --port in the CLI option definition and adds a test confirming -p <value> sets port while leaving cwd/configDir unset.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Poem

A rabbit hopped to port with glee,
Just -p now, short and free,
One line changed, a test stands guard,
Help text shows the flag, not hard,
Hop, hop—shorthand shipped with care! 🐇

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

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.

❤️ Share

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

@Sidnioulz Sidnioulz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code LGTM. Can you please update the manual testing instructions to a command that actually passes through to MCP? ai -p 6006 throws as -p is not recognised by the AI cli itself.

@huang-julien

Copy link
Copy Markdown
Contributor Author

@Sidnioulz done 👍

@shilman

shilman commented Jul 8, 2026

Copy link
Copy Markdown
Member

Why is this ci:daily @huang-julien ?

@huang-julien

Copy link
Copy Markdown
Contributor Author

@shilman my bad, force of habits 😅

@huang-julien huang-julien added ci:normal Run our default set of CI jobs (choose this for most PRs). and removed ci:daily Run the CI jobs that normally run in the daily job. labels Jul 8, 2026
@storybook-app-bot

Copy link
Copy Markdown

Package Benchmarks

Commit: c246448, ran on 8 July 2026 at 07:57:10 UTC

The following packages have significant changes to their size or dependencies:

@storybook/builder-webpack5

Before After Difference
Dependency count 188 188 0
Self size 79 KB 79 KB 0 B
Dependency size 35.44 MB 35.57 MB 🚨 +135 KB 🚨
Bundle Size Analyzer Link Link

@storybook/angular

Before After Difference
Dependency count 185 185 0
Self size 160 KB 160 KB 🎉 -54 B 🎉
Dependency size 30.65 MB 30.79 MB 🚨 +135 KB 🚨
Bundle Size Analyzer Link Link

@storybook/ember

Before After Difference
Dependency count 187 187 0
Self size 15 KB 15 KB 0 B
Dependency size 30.79 MB 30.92 MB 🚨 +135 KB 🚨
Bundle Size Analyzer Link Link

@storybook/nextjs

Before After Difference
Dependency count 533 533 0
Self size 663 KB 663 KB 0 B
Dependency size 62.16 MB 62.29 MB 🚨 +135 KB 🚨
Bundle Size Analyzer Link Link

@storybook/react-webpack5

Before After Difference
Dependency count 274 274 0
Self size 23 KB 23 KB 🚨 +12 B 🚨
Dependency size 47.94 MB 48.07 MB 🚨 +135 KB 🚨
Bundle Size Analyzer Link Link

@storybook/server-webpack5

Before After Difference
Dependency count 200 200 0
Self size 16 KB 16 KB 0 B
Dependency size 36.70 MB 36.84 MB 🚨 +135 KB 🚨
Bundle Size Analyzer Link Link

@storybook/cli

Before After Difference
Dependency count 204 204 0
Self size 821 KB 821 KB 0 B
Dependency size 91.80 MB 91.94 MB 🚨 +133 KB 🚨
Bundle Size Analyzer Link Link

@storybook/codemod

Before After Difference
Dependency count 197 197 0
Self size 32 KB 32 KB 0 B
Dependency size 90.28 MB 90.42 MB 🚨 +133 KB 🚨
Bundle Size Analyzer Link Link

@storybook/preset-create-react-app

Before After Difference
Dependency count 68 68 0
Self size 32 KB 32 KB 🚨 +6 B 🚨
Dependency size 6.03 MB 6.16 MB 🚨 +135 KB 🚨
Bundle Size Analyzer Link Link

@storybook/preset-react-webpack

Before After Difference
Dependency count 163 163 0
Self size 19 KB 19 KB 0 B
Dependency size 32.42 MB 32.55 MB 🚨 +135 KB 🚨
Bundle Size Analyzer Link Link

@Sidnioulz Sidnioulz self-requested a review July 8, 2026 08:09
@Sidnioulz

Copy link
Copy Markdown
Contributor

Would need a canary to check but now I understand where the bug was, and Kasper already approved so lets merge :)

@Sidnioulz Sidnioulz dismissed their stale review July 8, 2026 08:10

Concern addressed

@huang-julien huang-julien merged commit 53abe90 into next Jul 8, 2026
340 of 341 checks passed
@huang-julien huang-julien deleted the fix/storybookk_aui_port branch July 8, 2026 08:10
@Sidnioulz Sidnioulz added the upgrade:10.5 Issues/PRs found during 10.5 upgrade QA and post-release regressions label Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug ci:normal Run our default set of CI jobs (choose this for most PRs). qa:needed Pull Requests that will need manual QA prior to release. upgrade:10.5 Issues/PRs found during 10.5 upgrade QA and post-release regressions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants