Skip to content

Nested command typo with --help should report unknown command instead of showing parent help #1801

@jong-kyung

Description

@jong-kyung

Description

When a clap-managed nested subcommand under vp pm or vp env is typoed, adding --help currently causes the CLI to fall back to the parent command help instead of reporting the invalid nested subcommand.

For example:

vp pm aprev-build --help
vp env pni --help

These should not be swallowed by the vp pm or vp env parent help. The CLI should make it explicit that the nested subcommand is invalid, even when --help appears after the typoed subcommand.

This issue is scoped to clap-managed nested command parsing under:

  • vp pm <subcommand>

  • vp env <subcommand>

  • deeper vp pm groups where applicable, such as:

    • vp pm stage <subcommand>
    • vp pm owner <subcommand>
    • vp pm config <subcommand>
    • vp pm token <subcommand>

Delegated command surfaces such as vp run, vp dev, vp build, top-level vp config, or vp staged are intentionally out of scope.

Suggested solution

When a clap-managed nested subcommand is invalid:

  • Show an unknown-command error for the invalid nested subcommand.
  • Apply the same behavior even when --help is present after the invalid nested subcommand.
  • If a close valid command exists, show a Did you mean ...? style suggestion.
  • Do not print the parent command help for the typo case.
  • Do not auto-run the corrected command.
  • Do not show an interactive correction prompt for nested commands.
  • Exit non-zero with or without --help.
  • Preserve existing top-level typo behavior.

Representative output shape:

error: Command 'aprev-build' not found

Did you mean 'approve-builds'?

Additional context

No response

Validations

  • Read the Contributing Guidelines.
  • Confirm this request is for Vite+ itself and not for Vite, Vitest, tsdown, Rolldown, or Oxc.
  • Check that there isn't already an issue requesting the same feature.

Metadata

Metadata

Assignees

Priority

None yet

Start date

None yet

Target date

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions