From 617eacbfebaf336e7baf7ad426347f493446e4cb Mon Sep 17 00:00:00 2001 From: Alex Verkhovsky Date: Tue, 18 Nov 2025 18:25:33 -0800 Subject: [PATCH] feat: default installer username to system user --- .../installers/lib/core/config-collector.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tools/cli/installers/lib/core/config-collector.js b/tools/cli/installers/lib/core/config-collector.js index cd3a8aef..17c233bb 100644 --- a/tools/cli/installers/lib/core/config-collector.js +++ b/tools/cli/installers/lib/core/config-collector.js @@ -359,6 +359,25 @@ class ConfigCollector { return result; } + /** + * Get the default username from the system + * @returns {string} Capitalized username\ + */ + getDefaultUsername() { + let result = 'BMad'; + try { + const os = require('node:os'); + const userInfo = os.userInfo(); + if (userInfo && userInfo.username) { + const username = userInfo.username; + result = username.charAt(0).toUpperCase() + username.slice(1); + } + } catch { + // Do nothing, just return 'BMad' + } + return result; + } + /** * Collect configuration for a single module * @param {string} moduleName - Module name @@ -604,6 +623,11 @@ class ConfigCollector { } } + // Special handling for user_name: default to system user + if (moduleName === 'core' && key === 'user_name' && !existingValue) { + item.default = this.getDefaultUsername(); + } + // Determine question type and default value let questionType = 'input'; let defaultValue = item.default;