Skip to content

fix(cli): normalize boolean arg aliases in commander adapter#585

Merged
jackwener merged 1 commit intojackwener:mainfrom
inori-3333:main
Mar 29, 2026
Merged

fix(cli): normalize boolean arg aliases in commander adapter#585
jackwener merged 1 commit intojackwener:mainfrom
inori-3333:main

Conversation

@inori-3333
Copy link
Copy Markdown
Contributor

@inori-3333 inori-3333 commented Mar 29, 2026

Summary

This PR fixes boolean argument normalization in the Commander adapter by treating type: 'boolean' as an alias of type: 'bool'.

Why

The registry currently uses both bool and boolean in command definitions.

However, normalizeArgValue() only recognized bool, so commands using type: 'boolean' could receive string values like "false" instead of the real boolean false.

Because "false" is truthy in JavaScript, this could flip command behavior in subtle but real ways.

Impact

This affects commands that define boolean flags with type: 'boolean', especially when the default is false or when the user explicitly passes --flag false.

Examples in the current tree include:

  • reddit save --undo
  • boss mark --remove
  • twitter reply-dm --skip-replied

Changes

  • update normalizeArgValue() to accept both bool and boolean
  • add regression tests for type: 'boolean'
  • verify both default false and explicit --undo false are normalized to real booleans

Verification

  • npx vitest run src/commanderAdapter.test.ts
  • npm run typecheck

Both passed locally.

Scope

This PR intentionally keeps the fix minimal and does not add new metadata validation rules for argument types.

@jackwener jackwener merged commit 3eb2e88 into jackwener:main Mar 29, 2026
@jackwener
Copy link
Copy Markdown
Owner

Thanks for the fix. I reviewed it locally, confirmed the boolean alias regression is covered by tests, and merged it after typecheck/build passed.

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.

2 participants