Skip to content

Reject invalid numeric CLI flags - #7

Open
vsolano9 wants to merge 1 commit into
AgentPostmortem:mainfrom
vsolano9:fix-5-validate-numeric-flags
Open

Reject invalid numeric CLI flags#7
vsolano9 wants to merge 1 commit into
AgentPostmortem:mainfrom
vsolano9:fix-5-validate-numeric-flags

Conversation

@vsolano9

Copy link
Copy Markdown

What & why

Bad numeric flags currently become NaN, silently skip compaction, or print $NaN while exiting successfully. This makes all three numeric options fail clearly before payload processing while preserving a zero token budget.

Closes #5

Changes

  • --max, --max-tool, and --price now share one finite non-negative parser.
  • Errors name the exact flag and received value, including a missing value.
  • Real CLI subprocess tests cover each flag, infinity, missing input, and successful --max 0.
  • README and the Unreleased changelog document the corrected contract.

Validation

  • RED: all five invalid subprocess cases exited 0, while --max 0 passed.
  • npm test passes 12/12 and repeated successfully 20 consecutive times.
  • The complete suite passes on the supported minimum Node 18 and on Node 20.
  • npm pack --dry-run includes only the intended five distributable files.
  • git diff --check passes.
  • The package has zero dependencies and no lockfile, so npm audit is not applicable.

Checklist

  • node --test passes
  • Change remains zero-dependency and deterministic
  • Documentation and changelog are current
  • Linked the related issue

Parse --max, --max-tool, and --price through one finite non-negative guard. Preserve zero budgets, fail with the exact flag and received value, and cover the real CLI process.
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.

Numeric flags accept anything and fail silently as NaN

1 participant