Skip to content

bug: --version is only recognized as the first argument #74

Description

@aryamthecodebreaker

Summary

--help is recognized anywhere in the argument list, but --version is only recognized as argv[2]. The two flags behave inconsistently, and the failure mode is a confusing error rather than the version.

packages/cli/src/cli.ts:

if (rawArgs.length === 0 || rawArgs[0] === "help" || rawArgs.includes("--help") || rawArgs.includes("-h")) { ... }

if (rawArgs[0] === "--version" || rawArgs[0] === "version") { ... }   // first position only

Reproduction

node packages/cli/dist/cli.js plan --version
Unknown or incomplete option(s): --version

FixMap maps an issue, prompt, or diff to context files, test routes, and review risks.
...

Exit code 1. Whereas fixmap plan --help prints usage and exits 0, and fixmap --version prints 0.5.0.

Impact

<tool> <subcommand> --version is a near-universal habit and the first thing anyone does when filing a bug report. Getting "Unknown or incomplete option(s)" instead suggests the installed build is broken. There is also no -v short form.

Suggested fix

Treat --version the same way as --help:

if (rawArgs.includes("--version") || rawArgs.includes("-v") || rawArgs[0] === "version") { ... }

placed before command dispatch. Worth adding CLI-level tests for the flag matrix at the same time — packages/cli/src/cli.ts currently has no test file (see the separate entry-point coverage issue).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueApproachable contribution with a clear scope

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions