Skip to content

feat(cli): add format alias for vp fmt#1727

Merged
fengmk2 merged 4 commits into
voidzero-dev:mainfrom
semimikoh:feat/fmt-format-alias
Jun 1, 2026
Merged

feat(cli): add format alias for vp fmt#1727
fengmk2 merged 4 commits into
voidzero-dev:mainfrom
semimikoh:feat/fmt-format-alias

Conversation

@semimikoh
Copy link
Copy Markdown
Contributor

Summary

Closes #1721.

Running vp format (a common slip for vp fmt) previously failed to parse and clap suggested an unrelated command. This adds format as a visible alias of fmt.

Changes

  • Add visible_alias = "format" to the Fmt subcommand in:
    • crates/vite_global_cli/src/cli.rs (global vp binary parser)
    • packages/cli/binding/src/cli/types.rs (local NAPI binding parser)
  • Normalize formatfmt in init-config.ts so that vp format --init and vp format --migrate apply the same vite.config.ts integration as vp fmt (without it, only the underlying oxfmt run happened and the config wiring was silently skipped).
  • Add a unit test covering format as an init alias.

Validation

  • vp format --help → resolves to vp fmt (no more "did you mean" suggestion), verified on both the global binary and the local CLI after pnpm bootstrap-cli.
  • vp test run init-config → 9 passed (incl. the new format alias case).
  • Ran snap-test-global/snap-test-local for cli-helper-message and command-vp-alias: no snapshot diffs (help output is custom-rendered, so the alias doesn't alter --help text).

`vp format` previously failed to parse and suggested an unrelated command. Add `visible_alias = "format"` to the `Fmt` subcommand in both the global CLI parser and the local NAPI binding so `format` resolves to `fmt`.

Also normalize `format` to `fmt` in init-config handling so `vp format --init` / `vp format --migrate` get the same vite.config.ts wiring as `vp fmt`, not just the underlying oxfmt run.

Closes voidzero-dev#1721
@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 1, 2026

Deploy Preview for viteplus-preview ready!

Name Link
🔨 Latest commit 791f594
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a1cf34e2fbc6100084a5233
😎 Deploy Preview https://deploy-preview-1727--viteplus-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Collaborator

@jong-kyung jong-kyung left a comment

Choose a reason for hiding this comment

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

LGTM. Since top-level help is custom-rendered, could we also show the alias there, e.g. fmt, format?

Top-level `vp --help` is custom-rendered, so the clap visible_alias does not surface there. List it as `fmt, format` to match the existing alias style (e.g. `info, view, show`), per review feedback.
@semimikoh
Copy link
Copy Markdown
Contributor Author

@jong-kyung
Good call — done in 474308e. Listed it as fmt, format to match the existing alias style (e.g.info, view, show). Updated the global snap accordingly.

@jong-kyung
Copy link
Copy Markdown
Collaborator

@semimikoh Thanks! Could we also update packages/cli/binding/src/cli/help.rs in the same way?

The local NAPI binding renders its own `vp --help`, so the alias must be added there too. Show it as `fmt, format` to match the top-level help and the existing alias style, per review feedback. Regenerated the local snapshots accordingly.
@semimikoh
Copy link
Copy Markdown
Contributor Author

@jong-kyung
Done in the latest commit — added fmt, format to the local CLI help too, and updated the snapshots.
Thanks!

Copy link
Copy Markdown
Member

@fengmk2 fengmk2 left a comment

Choose a reason for hiding this comment

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

@semimikoh Thanks!

@fengmk2 fengmk2 self-assigned this Jun 1, 2026
@fengmk2 fengmk2 merged commit ca2e417 into voidzero-dev:main Jun 1, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

format alias for vp fmt

3 participants