feat(installer): default project name to directory (#681)

This commit is contained in:
Alex Verkhovsky
2025-10-05 20:12:37 -07:00
committed by GitHub
parent c49f4b2e9b
commit c9ffe202d5
2 changed files with 8 additions and 1 deletions

View File

@@ -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:

View File

@@ -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';