Skip to content

fix(cli): standalone binary silently ignores unknown flags and typo'd subcommands #163

Description

@benjamineckstein

Problem. The framework-free binary accepts any --key with no allowlist, so --no-controler no-ops (controllers still generated, exit 0); and a typo'd subcommand like chek/generat falls through to generate, turning a read-only CI drift check into a write.

Evidence.

  • src/Console/StandaloneApplication.php:509-529 parse() collects every --key, never rejects.
  • :490-503 splitSubcommand() returns [null,argv] for an unknown first arg; run() (:49-53) defaults to runGenerate.
  • Contrast StandaloneConfigLoader.php:317-340, which does reject unknown config keys.

Fix. Build a known-flag set and throw OptionException (exit 2) on any unrecognized --flag; reject an unknown leading positional token ("Unknown command 'generat'. Did you mean 'generate'?") instead of defaulting to generate; optional levenshtein suggestion.

Done when. A typo'd flag or subcommand exits 2 with a helpful message; valid invocations unchanged.


Filed from a repo-wide improvement audit; every claim was adversarially verified against source.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions