Skip to content

chore(commit): broaden flag-alias guard; drop redundant CommitOptions casts#1287

Merged
gfargo merged 1 commit into
mainfrom
chore/flag-consistency-and-cast-cleanup
Jun 16, 2026
Merged

chore(commit): broaden flag-alias guard; drop redundant CommitOptions casts#1287
gfargo merged 1 commit into
mainfrom
chore/flag-consistency-and-cast-cleanup

Conversation

@gfargo

@gfargo gfargo commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Two low-priority cleanups from the 0.72.1 review

Both flagged during the review sweep as non-bugs worth tidying.

1. Broaden the flag-alias regression guard

flagAliasConsistency.test.ts only pinned the two reconciled flags from #1245. It now also asserts the structural invariant across all 13 command option maps: within any single command, no single-letter alias maps to two different options — the condition that makes yargs throw.

Cross-command letter reuse (e.g. -b meaning branch in some commands) is intentional and is deliberately not asserted. The new test passes today, confirming no command currently has a within-command short-flag collision.

2. Drop redundant CommitOptions casts

generateCommitDraft.ts cast argv.append as string | undefined / argv.appendTicket as boolean | undefined. Since #1268 added those fields to the CommitOptions interface, argv (typed Arguments<CommitOptions>) already carries the exact types — the whole point of that typing was to drop such casts (the handler already reads them un-cast). Removed.

Validation

  • jest flag-alias + full commit suite: 9 suites / 145 tests pass · tsc --noEmit clean · eslint 0 errors · rollup -c builds.

… casts

Two small cleanups surfaced by the 0.72.1 review.

1. flagAliasConsistency.test.ts previously guarded only the two reconciled
   flags (#1245). Broaden it to assert the structural invariant across all 13
   command option maps: within any single command, no single-letter alias maps
   to two options (the condition that would make yargs throw). Cross-command
   letter reuse is intentional (e.g. `-b`), so it is deliberately not asserted.

2. generateCommitDraft.ts cast `argv.append as string | undefined` /
   `argv.appendTicket as boolean | undefined` — redundant since #1268 added
   those fields to `CommitOptions` (argv is `Arguments<CommitOptions>`, so the
   types are already exact). Dropped the casts; the handler already reads them
   un-cast.
@gfargo gfargo merged commit 1996ee1 into main Jun 16, 2026
16 checks passed
@gfargo gfargo deleted the chore/flag-consistency-and-cast-cleanup branch June 16, 2026 13:21
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.

1 participant