fix: correct IDE task prompt paths and metadata
This commit is contained in:
parent
903710be1b
commit
335d6ae661
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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') {
|
||||||
|
if (itemPath.startsWith('bmad/')) {
|
||||||
itemPath = `{project-root}/${itemPath}`;
|
itemPath = `{project-root}/${itemPath}`;
|
||||||
|
} else if (itemPath.startsWith('_bmad/')) {
|
||||||
|
itemPath = `{project-root}/${itemPath}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return `---
|
return `---
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue