Skip to content

Numeric CLI flags silently ignore non-numeric values (--timeout abc) #124

Done

Description

@cryptotavares

Summary

Numeric CLI flags with a value that is not a number are silently ignored. mm wait-for --testid x --timeout abc runs with the default timeout and no warning.

Environment

  • @metamask/client-mcp-core 0.15.0, any platform.

Steps to reproduce

mm click --testid does-not-exist --timeout abc

Actual

The command runs with the default timeout. No usage error.

Expected

Exit 2 (MM_INVALID_INPUT) with a usage message, like other bad flag values (for example --limit 0 on mm logs since #110).

Root cause

parseIntFlag returns undefined when parseInt gives NaN, which callers treat as "flag not given". It also accepts 12abc as 12.

Proposal

Make parseIntFlag fail the usage for a present flag whose value is not a whole number (and check ranges where they exist). This is part of the planned CLI input checks (mm CLI v2 ticket P1-48: bad numbers, launch validation, unknown commands).

Part of the mm CLI v2 effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions