This commit is contained in:
davem-slalom 2026-01-30 19:32:01 -03:00 committed by GitHub
commit fbe454c9ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 33 additions and 2 deletions

View File

@ -2,6 +2,7 @@ const path = require('node:path');
const fs = require('fs-extra'); const fs = require('fs-extra');
const os = require('node:os'); const os = require('node:os');
const chalk = require('chalk'); const chalk = require('chalk');
const yaml = require('yaml');
const { BaseIdeSetup } = require('./_base-ide'); const { BaseIdeSetup } = require('./_base-ide');
const { WorkflowCommandGenerator } = require('./shared/workflow-command-generator'); const { WorkflowCommandGenerator } = require('./shared/workflow-command-generator');
const { AgentCommandGenerator } = require('./shared/agent-command-generator'); const { AgentCommandGenerator } = require('./shared/agent-command-generator');
@ -102,9 +103,32 @@ class CodexSetup extends BaseIdeSetup {
}, },
projectDir, 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({ taskArtifacts.push({
type: 'task', type: 'task',
module: task.module, module: task.module,
name: declaredName,
displayName,
description,
path: taskPath,
sourcePath: task.path, sourcePath: task.path,
relativePath: path.join(task.module, 'tasks', `${task.name}.md`), relativePath: path.join(task.module, 'tasks', `${task.name}.md`),
content, content,

View File

@ -72,6 +72,9 @@ class IdeManager {
if (HandlerClass) { if (HandlerClass) {
const instance = new HandlerClass(); const instance = new HandlerClass();
if (typeof instance.setBmadFolderName === 'function') {
instance.setBmadFolderName(this.bmadFolderName);
}
if (instance.name && typeof instance.name === 'string') { if (instance.name && typeof instance.name === 'string') {
this.handlers.set(instance.name, instance); this.handlers.set(instance.name, instance);
} }

View File

@ -66,8 +66,12 @@ class TaskToolCommandGenerator {
// Convert path to use {project-root} placeholder // Convert path to use {project-root} placeholder
let itemPath = item.path; let itemPath = item.path;
if (itemPath && typeof itemPath === 'string' && itemPath.startsWith('bmad/')) { if (itemPath && typeof itemPath === 'string') {
itemPath = `{project-root}/${itemPath}`; if (itemPath.startsWith('bmad/')) {
itemPath = `{project-root}/${itemPath}`;
} else if (itemPath.startsWith('_bmad/')) {
itemPath = `{project-root}/${itemPath}`;
}
} }
return `--- return `---