Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix(quality): add explicit radix to all parseInt calls (S10)
Adam Eivyc10357c4a6f7
diff --git a/.changelog/v0.18.x.md b/.changelog/v0.18.x.mdindex ac5a976ab5..3905afb879 100644--- a/.changelog/v0.18.x.md+++ b/.changelog/v0.18.x.md@@ -12,3 +12,7 @@ Continued reliability improvements and codebase hardening.- Replaced bare `JSON.parse` with `safeJSONParse` in 7 more files (8 call sites): `agentContentGenerator.js`, `pm2Standardizer.js`, `automationScheduler.js`, `git.js` (2 locations), `aiDetect.js`, `memoryClassifier.js`, `clinvar.js`- Continues the v0.17.8 effort that converted 5 services — all remaining unprotected JSON.parse calls on external/file data are now guarded- Corrupted schedule files, malformed git log output, bad LLM responses, and damaged ClinVar index now gracefully return defaults or clear error messages instead of crashing the process++### Fix parseInt missing radix parameter (S10 complete)+- Added explicit radix (base 10) to all `parseInt()` calls across the codebase — prevents subtle bugs when parsing strings with leading zeros or unexpected prefixes+- Fixed 45+ call sites across 18 files: routes (notifications, detect, logs, genome, brain, scripts, cos, ports, agents, apps, history, memory), services (streamingDetect, digital-twin), client components (Apps, CreateApp, SchedulesTab, WorldTab, AIProviders, ConfigRow, ProductivityTab, DocumentsTab, OverviewTab), and testsdiff --git a/PLAN.md b/PLAN.mdindex af1addc009..028a7341e0 100644--- a/PLAN.md+++ b/PLAN.md@@ -197,9 +197,9 @@ PortOS is an internal/VPN app so auth, CORS, rate limiting, and HTTPS are out of- **Files:** All `server/routes/*.js`- **Complexity:** Simple (but wide)-### S10: Fix parseInt missing radix-- Several parseInt calls lack explicit radix 10-- **Files:** `server/services/agents.js:243-248`, `server/services/git.js`, `server/services/productivity.js`, `server/services/eventScheduler.js`+### ~~S10: Fix parseInt missing radix~~ ✅ COMPLETE (v0.18.x)+- ~~Several parseInt calls lack explicit radix 10~~+- Fixed 45+ call sites across 18 files (routes, services, client, tests)- **Complexity:** Simple---diff --git a/client/src/components/agents/tabs/SchedulesTab.jsx b/client/src/components/agents/tabs/SchedulesTab.jsxindex dcc1651fb2..a0c78d71e3 100644--- a/client/src/components/agents/tabs/SchedulesTab.jsx+++ b/client/src/components/agents/tabs/SchedulesTab.jsx@@ -226,7 +226,7 @@ export default function SchedulesTab({ agentId }) {<label className="block text-sm text-gray-400 mb-1">Interval</label><selectvalue={formData.schedule.intervalMs}- onChange={(e) => setFormData({ ...formData, schedule: { ...formData.schedule, intervalMs: parseInt(e.target.value) } })}+ onChange={(e) => setFormData({ ...formData, schedule: { ...formData.schedule, intervalMs: parseInt(e.target.value, 10) } })}className="w-full px-3 py-2 bg-port-bg border border-port-border rounded text-white">{INTERVAL_PRESETS.map(preset => (@@ -248,7 +248,7 @@ export default function SchedulesTab({ agentId }) {...formData,schedule: {...formData.schedule,- randomWindow: { ...formData.schedule.randomWindow, minMs: parseInt(e.target.value) }+ randomWindow: { ...formData.schedule.randomWindow, minMs: parseInt(e.target.value, 10) }}})}className="w-full px-3 py-2 bg-port-bg border border-port-border rounded text-white"@@ -268,7 +268,7 @@ export default function SchedulesTab({ agentId }) {...formData,schedule: {...formData.schedule,- randomWindow: { ...formData.schedule.randomWindow, maxMs: parseInt(e.target.value) }+ randomWindow: { ...formData.schedule.randomWindow, maxMs: parseInt(e.target.value, 10) }}})}className="w-full px-3 py-2 bg-port-bg border border-port-border rounded text-white"@@ -288,7 +288,7 @@ export default function SchedulesTab({ agentId }) {<inputtype="number"value={formData.rateLimit.maxPerDay || 50}- onChange={(e) => setFormData({ ...formData, rateLimit: { ...formData.rateLimit, maxPerDay: parseInt(e.target.value) } })}+ onChange={(e) => setFormData({ ...formData, rateLimit: { ...formData.rateLimit, maxPerDay: parseInt(e.target.value, 10) } })}className="w-32 px-3 py-2 bg-port-bg border border-port-border rounded text-white"min="1"max="1000"diff --git a/client/src/components/agents/tabs/WorldTab.jsx b/client/src/components/agents/tabs/WorldTab.jsxindex cce85b3062..a13c171ce2 100644--- a/client/src/components/agents/tabs/WorldTab.jsx+++ b/client/src/components/agents/tabs/WorldTab.jsx@@ -277,8 +277,8 @@ export default function WorldTab({ agentId }) {const handleExplore = async (random = false) => {if (!accountId) return;setMoving(true);- const x = random ? undefined : (moveX !== '' ? parseInt(moveX) : undefined);- const y = random ? undefined : (moveY !== '' ? parseInt(moveY) : undefined);+ const x = random ? undefined : (moveX !== '' ? parseInt(moveX, 10) : undefined);+ const y = random ? undefined : (moveY !== '' ? parseInt(moveY, 10) : undefined);if (wsConnected && !random && x != null && y != null) {await api.moltworldWsMove(x, y, moveThinking || undefined).catch(() => null);@@ -325,7 +325,7 @@ export default function WorldTab({ agentId }) {setBuilding(true);const result = await api.moltworldBuild(accountId, agentId,- parseInt(buildX), parseInt(buildY), parseInt(buildZ || '0'),+ parseInt(buildX, 10), parseInt(buildY, 10), parseInt(buildZ || '0', 10),blockType, buildAction).catch(() => null);setBuilding(false);@@ -369,9 +369,9 @@ export default function WorldTab({ agentId }) {const handleAddToQueue = async () => {const params = { ...newActionParams };// Convert numeric fields- if (params.x != null) params.x = parseInt(params.x);- if (params.y != null) params.y = parseInt(params.y);- if (params.z != null) params.z = parseInt(params.z);+ if (params.x != null) params.x = parseInt(params.x, 10);+ if (params.y != null) params.y = parseInt(params.y, 10);+ if (params.z != null) params.z = parseInt(params.z, 10);await api.moltworldAddToQueue(agentId, newActionType, params).catch(() => null);setShowAddForm(false);diff --git a/client/src/components/cos/tabs/ConfigRow.jsx b/client/src/components/cos/tabs/ConfigRow.jsxindex edcb9a4541..ffff9fad87 100644--- a/client/src/components/cos/tabs/ConfigRow.jsx+++ b/client/src/components/cos/tabs/ConfigRow.jsx@@ -16,7 +16,7 @@ export default function ConfigRow({ label, value, editing, type, inputValue, onC<inputtype="number"value={inputValue}- onChange={e => onChange(parseInt(e.target.value) || 0)}+ onChange={e => onChange(parseInt(e.target.value, 10) || 0)}className="w-24 px-2 py-1 bg-port-bg border border-port-border rounded text-white text-sm text-right"/>{suffix && <span className="text-gray-500 text-sm">{suffix}</span>}diff --git a/client/src/components/cos/tabs/ProductivityTab.jsx b/client/src/components/cos/tabs/ProductivityTab.jsxindex 0fe377a146..7c9cda12b8 100644--- a/client/src/components/cos/tabs/ProductivityTab.jsx+++ b/client/src/components/cos/tabs/ProductivityTab.jsx@@ -55,7 +55,7 @@ export default function ProductivityTab() {}, []);const formatHour = useCallback((hour) => {- const h = parseInt(hour);+ const h = parseInt(hour, 10);if (h === 0) return '12AM';if (h === 12) return '12PM';return h < 12 ? `${h}AM` : `${h - 12}PM`;@@ -77,7 +77,7 @@ export default function ProductivityTab() {const sortedHourlyPatterns = useMemo(() => {if (!data?.hourlyPatterns) return [];return Object.entries(data.hourlyPatterns)- .map(([hour, p]) => ({ hour: parseInt(hour), ...p }))+ .map(([hour, p]) => ({ hour: parseInt(hour, 10), ...p })).sort((a, b) => a.hour - b.hour);}, [data?.hourlyPatterns]);@@ -85,7 +85,7 @@ export default function ProductivityTab() {const sortedDailyPatterns = useMemo(() => {if (!data?.dailyPatterns) return [];return Object.entries(data.dailyPatterns)- .map(([day, p]) => ({ day: parseInt(day), dayName: DAY_NAMES[parseInt(day)], ...p }))+ .map(([day, p]) => ({ day: parseInt(day, 10), dayName: DAY_NAMES[parseInt(day, 10)], ...p })).sort((a, b) => a.day - b.day);}, [data?.dailyPatterns]);diff --git a/client/src/components/digital-twin/tabs/DocumentsTab.jsx b/client/src/components/digital-twin/tabs/DocumentsTab.jsxindex 672c55252b..e2ed81ffd8 100644--- a/client/src/components/digital-twin/tabs/DocumentsTab.jsx+++ b/client/src/components/digital-twin/tabs/DocumentsTab.jsx@@ -209,7 +209,7 @@ export default function DocumentsTab({ onRefresh }) {min="1"max="10"value={selectedDoc.weight || 5}- onChange={(e) => handleWeightChange(selectedDoc, parseInt(e.target.value))}+ onChange={(e) => handleWeightChange(selectedDoc, parseInt(e.target.value, 10))}className="w-16 h-1 accent-port-accent"/><span className="text-xs text-gray-400 w-4">{selectedDoc.weight || 5}</span>@@ -273,7 +273,7 @@ export default function DocumentsTab({ onRefresh }) {min="1"max="10"value={selectedDoc.weight || 5}- onChange={(e) => handleWeightChange(selectedDoc, parseInt(e.target.value))}+ onChange={(e) => handleWeightChange(selectedDoc, parseInt(e.target.value, 10))}className="flex-1 h-1 accent-port-accent"/><span className="text-xs text-gray-400 w-4">{selectedDoc.weight || 5}</span>diff --git a/client/src/components/digital-twin/tabs/OverviewTab.jsx b/client/src/components/digital-twin/tabs/OverviewTab.jsxindex 2886b7c664..86828d8d6d 100644--- a/client/src/components/digital-twin/tabs/OverviewTab.jsx+++ b/client/src/components/digital-twin/tabs/OverviewTab.jsx@@ -272,7 +272,7 @@ export default function OverviewTab({ status, settings, onRefresh }) {<inputtype="number"value={settingsForm.maxContextTokens || 4000}- onChange={(e) => setSettingsForm({ ...settingsForm, maxContextTokens: parseInt(e.target.value) })}+ onChange={(e) => setSettingsForm({ ...settingsForm, maxContextTokens: parseInt(e.target.value, 10) })}className="w-32 px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white"/></div>diff --git a/client/src/pages/AIProviders.jsx b/client/src/pages/AIProviders.jsxindex 7e8bec5dce..b55f640e01 100644--- a/client/src/pages/AIProviders.jsx+++ b/client/src/pages/AIProviders.jsx@@ -577,7 +577,7 @@ function ProviderForm({ provider, onClose, onSave, allProviders = [] }) {const data = {...formData,args: formData.args ? formData.args.split(' ').filter(Boolean) : [],- timeout: parseInt(formData.timeout)+ timeout: parseInt(formData.timeout, 10)};// Only send apiKey if user entered a new value (avoid overwriting existing key with empty string)diff --git a/client/src/pages/Apps.jsx b/client/src/pages/Apps.jsxindex 513e64b979..6dd07f2ef3 100644--- a/client/src/pages/Apps.jsx+++ b/client/src/pages/Apps.jsx@@ -639,8 +639,8 @@ function EditAppModal({ app, onClose, onSave }) {name: formData.name,icon: formData.icon,repoPath: formData.repoPath,- uiPort: formData.uiPort ? parseInt(formData.uiPort) : null,- apiPort: formData.apiPort ? parseInt(formData.apiPort) : null,+ uiPort: formData.uiPort ? parseInt(formData.uiPort, 10) : null,+ apiPort: formData.apiPort ? parseInt(formData.apiPort, 10) : null,startCommands: formData.startCommands.split('\n').filter(Boolean),pm2ProcessNames: formData.pm2ProcessNames? formData.pm2ProcessNames.split(',').map(s => s.trim()).filter(Boolean)diff --git a/client/src/pages/CreateApp.jsx b/client/src/pages/CreateApp.jsxindex 1dc99a0f3a..b5d848920e 100644--- a/client/src/pages/CreateApp.jsx+++ b/client/src/pages/CreateApp.jsx@@ -162,8 +162,8 @@ export default function CreateApp() {name,repoPath,icon,- uiPort: uiPort ? parseInt(uiPort) : null,- apiPort: apiPort ? parseInt(apiPort) : null,+ uiPort: uiPort ? parseInt(uiPort, 10) : null,+ apiPort: apiPort ? parseInt(apiPort, 10) : null,startCommands: startCommands.split('\n').filter(Boolean),pm2ProcessNames: pm2Names? pm2Names.split(',').map(s => s.trim()).filter(Boolean)diff --git a/server/routes/agents.js b/server/routes/agents.jsindex e9a68125f7..bff98d8fa1 100644--- a/server/routes/agents.js+++ b/server/routes/agents.js@@ -12,7 +12,7 @@ router.get('/', asyncHandler(async (req, res) => {// GET /api/agents/:pid - Get specific process inforouter.get('/:pid', asyncHandler(async (req, res) => {- const pid = parseInt(req.params.pid);+ const pid = parseInt(req.params.pid, 10);const info = await getProcessInfo(pid);if (!info) {throw new ServerError('Process not found', { status: 404, code: 'NOT_FOUND' });@@ -22,7 +22,7 @@ router.get('/:pid', asyncHandler(async (req, res) => {// DELETE /api/agents/:pid - Kill a processrouter.delete('/:pid', asyncHandler(async (req, res) => {- const pid = parseInt(req.params.pid);+ const pid = parseInt(req.params.pid, 10);await killProcess(pid);res.json({ success: true, pid });}));diff --git a/server/routes/apps.js b/server/routes/apps.jsindex c72a3cc603..c85395ed0b 100644--- a/server/routes/apps.js+++ b/server/routes/apps.js@@ -280,7 +280,7 @@ router.get('/:id/status', loadApp, asyncHandler(async (req, res) => {// GET /api/apps/:id/logs - Get logsrouter.get('/:id/logs', loadApp, asyncHandler(async (req, res) => {const app = req.loadedApp;- const lines = parseInt(req.query.lines) || 100;+ const lines = parseInt(req.query.lines, 10) || 100;const processName = req.query.process || app.pm2ProcessNames?.[0];if (!processName) {diff --git a/server/routes/brain.js b/server/routes/brain.jsindex b66195e5b5..24b5fef7e3 100644--- a/server/routes/brain.js+++ b/server/routes/brain.js@@ -322,7 +322,7 @@ router.get('/digest/latest', asyncHandler(async (req, res) => {* Get digest history*/router.get('/digests', asyncHandler(async (req, res) => {- const limit = parseInt(req.query.limit) || 10;+ const limit = parseInt(req.query.limit, 10) || 10;const digests = await brainService.getDigests(limit);res.json(digests);}));@@ -351,7 +351,7 @@ router.get('/review/latest', asyncHandler(async (req, res) => {* Get review history*/router.get('/reviews', asyncHandler(async (req, res) => {- const limit = parseInt(req.query.limit) || 10;+ const limit = parseInt(req.query.limit, 10) || 10;const reviews = await brainService.getReviews(limit);res.json(reviews);}));diff --git a/server/routes/cos.js b/server/routes/cos.jsindex 87c4fc39aa..6295bd513b 100644--- a/server/routes/cos.js+++ b/server/routes/cos.js@@ -583,7 +583,7 @@ router.get('/schedule', asyncHandler(async (req, res) => {// GET /api/cos/upcoming - Get upcoming tasks previewrouter.get('/upcoming', asyncHandler(async (req, res) => {- const limit = parseInt(req.query.limit) || 10;+ const limit = parseInt(req.query.limit, 10) || 10;const upcoming = await taskSchedule.getUpcomingTasks(limit);res.json(upcoming);}));@@ -914,14 +914,14 @@ router.post('/productivity/recalculate', asyncHandler(async (req, res) => {// GET /api/cos/productivity/trends - Get daily task completion trends for chartingrouter.get('/productivity/trends', asyncHandler(async (req, res) => {- const days = parseInt(req.query.days) || 30;+ const days = parseInt(req.query.days, 10) || 30;const trends = await productivity.getDailyTrends(days);res.json(trends);}));// GET /api/cos/productivity/calendar - Get activity calendar for GitHub-style heatmaprouter.get('/productivity/calendar', asyncHandler(async (req, res) => {- const weeks = parseInt(req.query.weeks) || 12;+ const weeks = parseInt(req.query.weeks, 10) || 12;const calendar = await productivity.getActivityCalendar(weeks);res.json(calendar);}));diff --git a/server/routes/detect.js b/server/routes/detect.jsindex d745e816df..6213fbaae0 100644--- a/server/routes/detect.js+++ b/server/routes/detect.js@@ -95,11 +95,11 @@ router.post('/repo', asyncHandler(async (req, res) => {const envContent = await readFile(envPath, 'utf-8').catch(() => '');const portMatch = envContent.match(/PORT\s*=\s*(\d+)/i);if (portMatch) {- result.detectedPorts.main = parseInt(portMatch[1]);+ result.detectedPorts.main = parseInt(portMatch[1], 10);}const vitePortMatch = envContent.match(/VITE_PORT\s*=\s*(\d+)/i);if (vitePortMatch) {- result.detectedPorts.vite = parseInt(vitePortMatch[1]);+ result.detectedPorts.vite = parseInt(vitePortMatch[1], 10);}}@@ -110,7 +110,7 @@ router.post('/repo', asyncHandler(async (req, res) => {const content = await readFile(configPath, 'utf-8').catch(() => '');const portMatch = content.match(/port\s*:\s*(\d+)/);if (portMatch) {- result.detectedPorts.vite = parseInt(portMatch[1]);+ result.detectedPorts.vite = parseInt(portMatch[1], 10);}}}@@ -127,7 +127,7 @@ router.post('/port', asyncHandler(async (req, res) => {}const result = {- port: parseInt(port),+ port: parseInt(port, 10),inUse: false,process: null};@@ -149,7 +149,7 @@ router.post('/port', asyncHandler(async (req, res) => {if (process.platform === 'darwin' && parts.length >= 2) {result.process = {command: parts[0],- pid: parseInt(parts[1])+ pid: parseInt(parts[1], 10)};}}diff --git a/server/routes/genome.js b/server/routes/genome.jsindex 1dfba755cb..01459f5411 100644--- a/server/routes/genome.js+++ b/server/routes/genome.js@@ -161,7 +161,7 @@ router.get('/epigenetic/recommendations', asyncHandler(async (req, res) => {// GET /api/digital-twin/genome/epigenetic/compliance — Get compliance summaryrouter.get('/epigenetic/compliance', asyncHandler(async (req, res) => {- const days = parseInt(req.query.days) || 30;+ const days = parseInt(req.query.days, 10) || 30;const summary = await epigeneticService.getComplianceSummary(days);res.json(summary);}));diff --git a/server/routes/history.js b/server/routes/history.jsindex fa1b361f28..391d387d5c 100644--- a/server/routes/history.js+++ b/server/routes/history.js@@ -7,8 +7,8 @@ const router = Router();// GET /api/history - Get history entriesrouter.get('/', async (req, res, next) => {const options = {- limit: parseInt(req.query.limit) || 100,- offset: parseInt(req.query.offset) || 0,+ limit: parseInt(req.query.limit, 10) || 100,+ offset: parseInt(req.query.offset, 10) || 0,action: req.query.action || undefined,target: req.query.target || undefined,success: req.query.success !== undefined ? req.query.success === 'true' : undefined@@ -38,7 +38,7 @@ router.delete('/:id', async (req, res, next) => {// DELETE /api/history - Clear historyrouter.delete('/', async (req, res, next) => {- const olderThanDays = req.query.olderThanDays ? parseInt(req.query.olderThanDays) : null;+ const olderThanDays = req.query.olderThanDays ? parseInt(req.query.olderThanDays, 10) : null;const result = await history.clearHistory(olderThanDays).catch(next);if (result) res.json(result);});diff --git a/server/routes/logs.js b/server/routes/logs.jsindex da3756018b..128b2ba4d7 100644--- a/server/routes/logs.js+++ b/server/routes/logs.js@@ -31,7 +31,7 @@ router.get('/processes', asyncHandler(async (req, res) => {// GET /api/logs/:processName - Get logs for a process (static or streaming)router.get('/:processName', asyncHandler(async (req, res) => {const { processName } = req.params;- const lines = parseInt(req.query.lines) || 100;+ const lines = parseInt(req.query.lines, 10) || 100;const follow = req.query.follow === 'true';// Security: Validate process name to prevent command injection@@ -111,7 +111,7 @@ router.get('/app/:appId', asyncHandler(async (req, res) => {throw new ServerError('App not found', { status: 404, code: 'NOT_FOUND' });}- const lines = parseInt(req.query.lines) || 100;+ const lines = parseInt(req.query.lines, 10) || 100;const results = {};for (const processName of app.pm2ProcessNames || []) {diff --git a/server/routes/memory.js b/server/routes/memory.jsindex 7ac33a479b..53080dec35 100644--- a/server/routes/memory.js+++ b/server/routes/memory.js@@ -26,8 +26,8 @@ router.get('/', asyncHandler(async (req, res) => {categories: req.query.categories ? req.query.categories.split(',') : undefined,tags: req.query.tags ? req.query.tags.split(',') : undefined,status: req.query.status || 'active',- limit: parseInt(req.query.limit) || 50,- offset: parseInt(req.query.offset) || 0,+ limit: parseInt(req.query.limit, 10) || 50,+ offset: parseInt(req.query.offset, 10) || 0,sortBy: req.query.sortBy || 'createdAt',sortOrder: req.query.sortOrder || 'desc'};@@ -60,7 +60,7 @@ router.get('/timeline', asyncHandler(async (req, res) => {startDate: req.query.startDate,endDate: req.query.endDate,types: req.query.types ? req.query.types.split(',') : undefined,- limit: parseInt(req.query.limit) || 100+ limit: parseInt(req.query.limit, 10) || 100};const timeline = await memory.getTimeline(options);@@ -151,7 +151,7 @@ router.get('/:id', asyncHandler(async (req, res) => {// GET /api/memory/:id/related - Get related memoriesrouter.get('/:id/related', asyncHandler(async (req, res) => {- const limit = parseInt(req.query.limit) || 10;+ const limit = parseInt(req.query.limit, 10) || 10;const related = await memory.getRelatedMemories(req.params.id, limit);res.json(related);}));diff --git a/server/routes/notifications.js b/server/routes/notifications.jsindex 17990d6091..1641976759 100644--- a/server/routes/notifications.js+++ b/server/routes/notifications.js@@ -13,7 +13,7 @@ router.get('/', asyncHandler(async (req, res) => {const options = {type: req.query.type,unreadOnly: req.query.unreadOnly === 'true',- limit: req.query.limit ? parseInt(req.query.limit) : undefined+ limit: req.query.limit ? parseInt(req.query.limit, 10) : undefined};const result = await notifications.getNotifications(options);diff --git a/server/routes/ports.js b/server/routes/ports.jsindex 1cd4366387..872a561e2d 100644--- a/server/routes/ports.js+++ b/server/routes/ports.js@@ -27,7 +27,7 @@ router.post('/check', asyncHandler(async (req, res) => {// POST /api/ports/allocate - Allocate available portsrouter.post('/allocate', asyncHandler(async (req, res) => {- const count = parseInt(req.body.count) || 1;+ const count = parseInt(req.body.count, 10) || 1;if (count < 1 || count > 10) {throw new ServerError('count must be between 1 and 10', {diff --git a/server/routes/scripts.js b/server/routes/scripts.jsindex 31af03d072..4881001fd4 100644--- a/server/routes/scripts.js+++ b/server/routes/scripts.js@@ -103,7 +103,7 @@ router.post('/:id/run', async (req, res, next) => {// GET /api/cos/scripts/:id/runs - Get script run historyrouter.get('/:id/runs', async (req, res, next) => {- const limit = parseInt(req.query.limit) || 10;+ const limit = parseInt(req.query.limit, 10) || 10;const runs = await scriptRunner.getScriptRuns(req.params.id, limit).catch(next);if (runs) res.json({ runs });diff --git a/server/services/agents.test.js b/server/services/agents.test.jsindex a37c6aa4bc..4ebdf8b8eb 100644--- a/server/services/agents.test.js+++ b/server/services/agents.test.js@@ -68,8 +68,8 @@ describe('Agent Service Logic', () => {if (etime.includes('-')) {// Days-HH:MM:SS formatconst [days, rest] = etime.split('-');- const timeParts = rest.split(':').map(p => parseInt(p));- const d = parseInt(days);+ const timeParts = rest.split(':').map(p => parseInt(p, 10));+ const d = parseInt(days, 10);const [h, m, s] = timeParts.length === 3 ? timeParts : [0, ...timeParts];return ((d * 24 + h) * 60 + m) * 60 * 1000 + s * 1000;}@@ -205,8 +205,8 @@ describe('Agent Service Logic', () => {const parts = line.trim().split(/\s+/);if (parts.length < 6) return null;- const pid = parseInt(parts[0]);- const ppid = parseInt(parts[1]);+ const pid = parseInt(parts[0], 10);+ const ppid = parseInt(parts[1], 10);const cpu = parseFloat(parts[2]);const mem = parseFloat(parts[3]);const etime = parts[4];diff --git a/server/services/digital-twin.js b/server/services/digital-twin.jsindex 88b8f16fe3..3b29e1a170 100644--- a/server/services/digital-twin.js+++ b/server/services/digital-twin.js@@ -652,7 +652,7 @@ export async function parseTestSuite() {let match;while ((match = testPattern.exec(content)) !== null) {tests.push({- testId: parseInt(match[1]),+ testId: parseInt(match[1], 10),testName: match[2].trim(),prompt: match[3].trim().replace(/^"|"$/g, ''),expectedBehavior: match[4].trim(),@@ -2247,7 +2247,7 @@ function parseGoodreadsCSV(csvData) {if (!lines[i].trim()) continue;const cols = parseCSVLine(lines[i]);- const rating = ratingIdx >= 0 ? parseInt(cols[ratingIdx]) : 0;+ const rating = ratingIdx >= 0 ? parseInt(cols[ratingIdx], 10) : 0;// Only include books that were actually read (have a rating > 0 or date read)if (rating > 0 || (dateReadIdx >= 0 && cols[dateReadIdx])) {books.push({@@ -2369,7 +2369,7 @@ function parseLetterboxdCSV(csvData) {films.push({title: cols[nameIdx] || cols[0] || '',- year: yearIdx >= 0 && cols[yearIdx] ? parseInt(cols[yearIdx]) : undefined,+ year: yearIdx >= 0 && cols[yearIdx] ? parseInt(cols[yearIdx], 10) : undefined,rating: ratingIdx >= 0 && cols[ratingIdx] ? parseFloat(cols[ratingIdx]) : undefined,watchedDate: dateIdx >= 0 ? cols[dateIdx] : undefined,review: reviewIdx >= 0 ? cols[reviewIdx] : undefined,diff --git a/server/services/streamingDetect.js b/server/services/streamingDetect.jsindex eaeed687b6..8481fc2558 100644--- a/server/services/streamingDetect.js+++ b/server/services/streamingDetect.js@@ -52,7 +52,7 @@ export function parseEcosystemConfig(content) {const portConstants = {};const constMatches = content.matchAll(/(?:const|let|var)\s+(\w*PORT\w*)\s*=\s*(\d+)/g);for (const match of constMatches) {- portConstants[match[1]] = parseInt(match[2]);+ portConstants[match[1]] = parseInt(match[2], 10);}// Extract PORTS object - handles both flat and nested structures@@ -78,7 +78,7 @@ export function parseEcosystemConfig(content) {// Parse flat entries: KEY: 5550const flatEntries = portsBlock.matchAll(/(\w+)\s*:\s*(\d+)/g);for (const entry of flatEntries) {- portConstants[`PORTS.${entry[1]}`] = parseInt(entry[2]);+ portConstants[`PORTS.${entry[1]}`] = parseInt(entry[2], 10);}// Parse nested entries: key: { subkey: 5550 }@@ -89,7 +89,7 @@ export function parseEcosystemConfig(content) {const nestedPorts = {};const subEntries = nestedContent.matchAll(/(\w+)\s*:\s*(\d+)/g);for (const subEntry of subEntries) {- const port = parseInt(subEntry[2]);+ const port = parseInt(subEntry[2], 10);portConstants[`PORTS.${parentKey}.${subEntry[1]}`] = port;nestedPorts[subEntry[1]] = port;}@@ -179,7 +179,7 @@ export function parseEcosystemConfig(content) {const portsContent = portsObjMatch[1];const portEntries = portsContent.matchAll(/(\w+)\s*:\s*(\d+)/g);for (const entry of portEntries) {- ports[entry[1]] = parseInt(entry[2]);+ ports[entry[1]] = parseInt(entry[2], 10);}}@@ -201,10 +201,10 @@ export function parseEcosystemConfig(content) {// Handles: 4420, PORTS.API, process.env.PORT || 4420, Number(...) || 4420const resolvePortValue = (value) => {const trimmed = value.trim();- if (/^\d+$/.test(trimmed)) return parseInt(trimmed);+ if (/^\d+$/.test(trimmed)) return parseInt(trimmed, 10);// Expression with || fallback: "process.env.PORT || 4420"const fallbackMatch = trimmed.match(/\|\|\s*['"]?(\d+)['"]?\s*$/);- if (fallbackMatch) return parseInt(fallbackMatch[1]);+ if (fallbackMatch) return parseInt(fallbackMatch[1], 10);// PORTS.XXX or constant referenceif (portConstants[trimmed]) return portConstants[trimmed];return null;@@ -251,7 +251,7 @@ export function parseEcosystemConfig(content) {if (Object.keys(ports).length === 0) {const argsPortMatch = appBlock.match(/args\s*:\s*['"][^'"]*--port\s+(\d+)/);if (argsPortMatch) {- ports.ui = parseInt(argsPortMatch[1]);+ ports.ui = parseInt(argsPortMatch[1], 10);}}@@ -259,7 +259,7 @@ export function parseEcosystemConfig(content) {if (Object.keys(ports).length === 0) {const directPortMatch = appBlock.match(/\bport\s*:\s*(\d+)/);if (directPortMatch) {- ports.api = parseInt(directPortMatch[1]);+ ports.api = parseInt(directPortMatch[1], 10);}}}@@ -290,7 +290,7 @@ export function parseEcosystemConfig(content) {*/function extractVitePort(content) {const portMatch = content.match(/port\s*:\s*(\d+)/);- return portMatch ? parseInt(portMatch[1]) : null;+ return portMatch ? parseInt(portMatch[1], 10) : null;}/**@@ -426,9 +426,9 @@ export async function streamDetection(socket, dirPath) {if (existsSync(envPath)) {const content = await readFile(envPath, 'utf-8').catch(() => '');const portMatch = content.match(/PORT\s*=\s*(\d+)/i);- if (portMatch) result.apiPort = parseInt(portMatch[1]);+ if (portMatch) result.apiPort = parseInt(portMatch[1], 10);const viteMatch = content.match(/VITE_PORT\s*=\s*(\d+)/i);- if (viteMatch) result.uiPort = parseInt(viteMatch[1]);+ if (viteMatch) result.uiPort = parseInt(viteMatch[1], 10);configFiles.push('.env');}@@ -438,7 +438,7 @@ export async function streamDetection(socket, dirPath) {if (existsSync(configPath)) {const content = await readFile(configPath, 'utf-8').catch(() => '');const portMatch = content.match(/port\s*:\s*(\d+)/);- if (portMatch) result.uiPort = parseInt(portMatch[1]);+ if (portMatch) result.uiPort = parseInt(portMatch[1], 10);configFiles.push(viteConfig);}}@@ -489,7 +489,7 @@ export async function streamDetection(socket, dirPath) {// Extract UI port from CLIENT_URL (still needed as it's not in process configs)const clientUrlMatch = content.match(/CLIENT_URL\s*:\s*['"]https?:\/\/[^:]+:(\d+)/);if (clientUrlMatch && !result.uiPort) {- result.uiPort = parseInt(clientUrlMatch[1]);+ result.uiPort = parseInt(clientUrlMatch[1], 10);}configFiles.push(ecosystemFile);