This commit is contained in:
davem-slalom 2026-01-31 19:27:51 -06:00 committed by GitHub
commit 520bbae2d8
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 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,

View File

@ -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);
}

View File

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