fix: add radix parameter to parseInt() calls (#862)

Add explicit radix=10 to parseInt() calls and NaN validation to prevent
unexpected hex parsing and invalid config values.

Changes:
- Line 52: Add radix and NaN check in input validation
- Line 189-192: Add radix and NaN fallback for config parsing

Fixes potential issues:
- Hex input (0x10) now rejected instead of parsed as 16
- Invalid strings return default value instead of NaN→null

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Brian <bmadcode@gmail.com>
This commit is contained in:
Serhii 2025-11-26 22:44:12 +02:00 committed by GitHub
parent 9223e2be21
commit f793cf8fcd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -50,7 +50,8 @@ class GitHubCopilotSetup extends BaseIdeSetup {
message: 'Maximum requests per session (1-50)?', message: 'Maximum requests per session (1-50)?',
default: '15', default: '15',
validate: (input) => { validate: (input) => {
const num = parseInt(input); const num = parseInt(input, 10);
if (isNaN(num)) return 'Enter a valid number 1-50';
return (num >= 1 && num <= 50) || 'Enter 1-50'; return (num >= 1 && num <= 50) || 'Enter 1-50';
}, },
}, },
@ -187,9 +188,10 @@ class GitHubCopilotSetup extends BaseIdeSetup {
// Manual configuration - use pre-collected settings // Manual configuration - use pre-collected settings
const manual = options.manualSettings || {}; const manual = options.manualSettings || {};
const maxRequests = parseInt(manual.maxRequests || '15', 10);
bmadSettings = { bmadSettings = {
'chat.agent.enabled': true, 'chat.agent.enabled': true,
'chat.agent.maxRequests': parseInt(manual.maxRequests || 15), 'chat.agent.maxRequests': isNaN(maxRequests) ? 15 : maxRequests,
'github.copilot.chat.agent.runTasks': manual.runTasks === undefined ? true : manual.runTasks, 'github.copilot.chat.agent.runTasks': manual.runTasks === undefined ? true : manual.runTasks,
'chat.mcp.discovery.enabled': manual.mcpDiscovery === undefined ? true : manual.mcpDiscovery, 'chat.mcp.discovery.enabled': manual.mcpDiscovery === undefined ? true : manual.mcpDiscovery,
'github.copilot.chat.agent.autoFix': manual.autoFix === undefined ? true : manual.autoFix, 'github.copilot.chat.agent.autoFix': manual.autoFix === undefined ? true : manual.autoFix,