From c9ffe202d5889aa65701bc162a0798c5b9f25b16 Mon Sep 17 00:00:00 2001 From: Alex Verkhovsky Date: Sun, 5 Oct 2025 20:12:37 -0700 Subject: [PATCH] feat(installer): default project name to directory (#681) --- src/modules/bmm/_module-installer/install-menu-config.yaml | 2 +- tools/cli/installers/lib/core/config-collector.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/modules/bmm/_module-installer/install-menu-config.yaml b/src/modules/bmm/_module-installer/install-menu-config.yaml index 56984ef3..e9403441 100644 --- a/src/modules/bmm/_module-installer/install-menu-config.yaml +++ b/src/modules/bmm/_module-installer/install-menu-config.yaml @@ -16,7 +16,7 @@ prompt: project_name: prompt: "What is the title of your project you will be working on?" - default: "My Project" + default: "{directory_name}" result: "{value}" tech_docs: diff --git a/tools/cli/installers/lib/core/config-collector.js b/tools/cli/installers/lib/core/config-collector.js index e0de71a2..45345de5 100644 --- a/tools/cli/installers/lib/core/config-collector.js +++ b/tools/cli/installers/lib/core/config-collector.js @@ -10,6 +10,7 @@ class ConfigCollector { constructor() { this.collectedConfig = {}; this.existingConfig = null; + this.currentProjectDir = null; } /** @@ -93,6 +94,7 @@ class ConfigCollector { * @param {boolean} skipCompletion - Skip showing completion message (for early core collection) */ async collectModuleConfig(moduleName, projectDir, skipLoadExisting = false, skipCompletion = false) { + this.currentProjectDir = projectDir; // Load existing config if needed and not already loaded if (!skipLoadExisting && !this.existingConfig) { await this.loadExistingConfig(projectDir); @@ -281,6 +283,11 @@ class ConfigCollector { let defaultValue = item.default; let choices = null; + if (typeof defaultValue === 'string' && defaultValue.includes('{directory_name}') && this.currentProjectDir) { + const dirName = path.basename(this.currentProjectDir); + defaultValue = defaultValue.replaceAll('{directory_name}', dirName); + } + // Handle different question types if (item['single-select']) { questionType = 'list';