@@ -31,6 +31,10 @@ import registerFindingsCommands from './commands/findings/index.js';
3131const require = createRequire ( import . meta. url ) ;
3232const pkg = require ( '../package.json' ) ;
3333
34+ // Commander passes an option's default as the parser's second argument, so a
35+ // bare `parseInt` would use it as the radix (`--limit 30` with default 20 → 60).
36+ const toInt = ( value ) => Number . parseInt ( value , 10 ) ;
37+
3438// Split comma-separated globs while preserving commas inside {} brace expansions (e.g. "*.{js,ts}")
3539function splitGlobs ( input ) {
3640 const parts = [ ] ;
@@ -67,7 +71,7 @@ program
6771 . option ( '--uncommitted' , 'Scan only uncommitted changes (staged + unstaged + untracked)' )
6872 . option ( '--staged' , 'Scan only staged files' )
6973 . option ( '--last-commit' , 'Scan last commit' )
70- . option ( '--last-n-commits <n>' , 'Scan last n commits (max 5)' , parseInt )
74+ . option ( '--last-n-commits <n>' , 'Scan last n commits (max 5)' , toInt )
7175 . option ( '--base <branch>' , 'Compare against a specific base branch (e.g. --base develop)' )
7276 . option ( '--base-commit <commit>' , 'Compare against a specific commit (e.g. --base-commit HEAD~3)' )
7377 . option ( '--include <paths>' , 'Comma-separated list of file paths glob patterns to include' )
@@ -118,7 +122,7 @@ program
118122 . option ( '--uncommitted' , 'Review only uncommitted changes (staged + unstaged + untracked)' )
119123 . option ( '--staged' , 'Review only staged files' )
120124 . option ( '--last-commit' , 'Review last commit' )
121- . option ( '--last-n-commits <n>' , 'Review last n commits (max 5)' , parseInt )
125+ . option ( '--last-n-commits <n>' , 'Review last n commits (max 5)' , toInt )
122126 . option ( '--base <branch>' , 'Compare against a specific base branch (e.g. --base develop)' )
123127 . option ( '--base-commit <commit>' , 'Compare against a specific commit (e.g. --base-commit HEAD~3)' )
124128 . option ( '--fail-on <level>' , 'Fail on issues at or above this level: BLOCKER, CRITICAL, MAJOR, MINOR, INFO (default: CRITICAL)' , 'CRITICAL' )
@@ -299,8 +303,8 @@ program
299303 . option ( '--source-branch <branch>' , 'Filter by source branch (partial match)' )
300304 . option ( '--author <login>' , 'Filter by author (fuzzy match)' )
301305 . option ( '--state <state>' , 'open or closed (default: open)' , 'open' )
302- . option ( '--limit <n>' , 'Max results (default: 20, max: 100)' , parseInt , 20 )
303- . option ( '--offset <n>' , 'Pagination offset' , parseInt , 0 )
306+ . option ( '--limit <n>' , 'Max results (default: 20, max: 100)' , toInt , 20 )
307+ . option ( '--offset <n>' , 'Pagination offset' , toInt , 0 )
304308 . action ( ( options ) => {
305309 const opts = resolveRepoOpts ( options ) ;
306310 runCmd ( ( ) => scm . listPullRequests ( {
@@ -315,7 +319,7 @@ program
315319 . option ( '--name <repo>' , 'Repository (owner/repo)' )
316320 . option ( '--remote <provider>' , 'github, gitlab, bitbucket, azure' )
317321 . option ( '--default-branch <branch>' , 'Default branch name' )
318- . requiredOption ( '--pr-number <n>' , 'PR number' , parseInt )
322+ . requiredOption ( '--pr-number <n>' , 'PR number' , toInt )
319323 . action ( ( options ) => {
320324 const opts = resolveRepoOpts ( options ) ;
321325 runCmd ( ( ) => scm . getPullRequest ( {
@@ -329,7 +333,7 @@ program
329333 . option ( '--name <repo>' , 'Repository (owner/repo)' )
330334 . option ( '--remote <provider>' , 'github, gitlab, bitbucket, azure' )
331335 . option ( '--default-branch <branch>' , 'Default branch name' )
332- . requiredOption ( '--pr-number <n>' , 'PR number' , parseInt )
336+ . requiredOption ( '--pr-number <n>' , 'PR number' , toInt )
333337 . option ( '--codeant-generated <bool>' , 'Filter by CodeAnt authorship (true/false)' , ( v ) => v === 'true' )
334338 . option ( '--addressed' , 'Filter by addressed/resolved status' )
335339 . option ( '--created-after <date>' , 'ISO 8601 date filter' )
@@ -347,8 +351,8 @@ program
347351 . description ( 'Resolve a conversation/comment thread on a PR' )
348352 . option ( '--name <repo>' , 'Repository (owner/repo)' )
349353 . option ( '--remote <provider>' , 'github, gitlab, bitbucket, azure' )
350- . requiredOption ( '--pr-number <n>' , 'PR number' , parseInt )
351- . option ( '--comment-id <id>' , 'Comment ID (GitHub, Bitbucket)' , parseInt )
354+ . requiredOption ( '--pr-number <n>' , 'PR number' , toInt )
355+ . option ( '--comment-id <id>' , 'Comment ID (GitHub, Bitbucket)' , toInt )
352356 . option ( '--thread-id <id>' , 'Thread/node ID (GitHub GraphQL, Azure)' )
353357 . option ( '--discussion-id <id>' , 'Discussion ID (GitLab)' )
354358 . action ( ( options ) => {
@@ -370,10 +374,10 @@ program
370374 . option ( '--name <repo>' , 'Repository (owner/repo)' )
371375 . option ( '--remote <provider>' , 'github, gitlab, bitbucket, azure' )
372376 . option ( '--default-branch <branch>' , 'Default branch name' )
373- . option ( '--pr-number <n>' , 'Filter by PR number' , parseInt )
377+ . option ( '--pr-number <n>' , 'Filter by PR number' , toInt )
374378 . option ( '--status <status>' , 'Filter by status (PENDING, COMPLETED, FAILED, etc.)' )
375- . option ( '--limit <n>' , 'Max results (default: 20)' , parseInt , 20 )
376- . option ( '--offset <n>' , 'Pagination offset' , parseInt , 0 )
379+ . option ( '--limit <n>' , 'Max results (default: 20)' , toInt , 20 )
380+ . option ( '--offset <n>' , 'Pagination offset' , toInt , 0 )
377381 . action ( ( options ) => {
378382 const opts = resolveRepoOpts ( options ) ;
379383 runCmd ( ( ) => scm . listCodeReviews ( {
@@ -387,7 +391,7 @@ program
387391 . description ( 'Get detailed information for a specific code review' )
388392 . option ( '--name <repo>' , 'Repository (owner/repo)' )
389393 . option ( '--remote <provider>' , 'github, gitlab, bitbucket, azure' )
390- . requiredOption ( '--pr-number <n>' , 'PR number' , parseInt )
394+ . requiredOption ( '--pr-number <n>' , 'PR number' , toInt )
391395 . requiredOption ( '--review-id <id>' , 'Code review ID' )
392396 . action ( ( options ) => {
393397 const opts = resolveRepoOpts ( options ) ;
@@ -405,7 +409,7 @@ program
405409 . option ( '--name <repo>' , 'Repository (owner/repo)' )
406410 . option ( '--remote <provider>' , 'github, gitlab, bitbucket, azure' )
407411 . requiredOption ( '--query <term>' , 'Search term' )
408- . option ( '--limit <n>' , 'Max results (default: 10, max: 50)' , parseInt , 10 )
412+ . option ( '--limit <n>' , 'Max results (default: 10, max: 50)' , toInt , 10 )
409413 . option ( '--include-addressed' , 'Include resolved comments (default: false)' )
410414 . option ( '--created-after <date>' , 'ISO 8601 date filter' )
411415 . action ( ( options ) => {
0 commit comments