diff --git a/tools/cli/installers/lib/ide/codex.js b/tools/cli/installers/lib/ide/codex.js index 5cd503e2..04b11b6a 100644 --- a/tools/cli/installers/lib/ide/codex.js +++ b/tools/cli/installers/lib/ide/codex.js @@ -2,6 +2,7 @@ const path = require('node:path'); const fs = require('fs-extra'); const os = require('node:os'); const chalk = require('chalk'); +const yaml = require('yaml'); const { BaseIdeSetup } = require('./_base-ide'); const { WorkflowCommandGenerator } = require('./shared/workflow-command-generator'); const { AgentCommandGenerator } = require('./shared/agent-command-generator'); @@ -102,9 +103,32 @@ class CodexSetup extends BaseIdeSetup { }, projectDir, ); + let displayName = task.name; + let description; + let declaredName = task.name; + + const frontmatterMatch = content.match(/^---\s*\n([\s\S]*?)\n---/); + if (frontmatterMatch) { + try { + const frontmatter = yaml.parse(frontmatterMatch[1]); + if (frontmatter && typeof frontmatter === 'object') { + declaredName = frontmatter.name || declaredName; + displayName = frontmatter.displayName || frontmatter.name || displayName; + description = frontmatter.description || description; + } + } catch { + // Ignore frontmatter parse errors + } + } + + const taskPath = path.posix.join(this.bmadFolderName, task.module, 'tasks', `${task.name}.md`); taskArtifacts.push({ type: 'task', module: task.module, + name: declaredName, + displayName, + description, + path: taskPath, sourcePath: task.path, relativePath: path.join(task.module, 'tasks', `${task.name}.md`), content, diff --git a/tools/cli/installers/lib/ide/manager.js b/tools/cli/installers/lib/ide/manager.js index 2b68dfad..4ae8661b 100644 --- a/tools/cli/installers/lib/ide/manager.js +++ b/tools/cli/installers/lib/ide/manager.js @@ -72,6 +72,9 @@ class IdeManager { if (HandlerClass) { const instance = new HandlerClass(); + if (typeof instance.setBmadFolderName === 'function') { + instance.setBmadFolderName(this.bmadFolderName); + } if (instance.name && typeof instance.name === 'string') { this.handlers.set(instance.name, instance); } diff --git a/tools/cli/installers/lib/ide/shared/task-tool-command-generator.js b/tools/cli/installers/lib/ide/shared/task-tool-command-generator.js index a0c4bcf8..b8d2f54a 100644 --- a/tools/cli/installers/lib/ide/shared/task-tool-command-generator.js +++ b/tools/cli/installers/lib/ide/shared/task-tool-command-generator.js @@ -66,8 +66,12 @@ class TaskToolCommandGenerator { // Convert path to use {project-root} placeholder let itemPath = item.path; - if (itemPath && typeof itemPath === 'string' && itemPath.startsWith('bmad/')) { - itemPath = `{project-root}/${itemPath}`; + if (itemPath && typeof itemPath === 'string') { + if (itemPath.startsWith('bmad/')) { + itemPath = `{project-root}/${itemPath}`; + } else if (itemPath.startsWith('_bmad/')) { + itemPath = `{project-root}/${itemPath}`; + } } return `---