fix: convert absolute paths to relative in task-tool-command-generator

This commit is contained in:
Davor Racić 2026-02-01 13:39:09 +01:00
parent 1d505b17b4
commit a69810afe5
1 changed files with 8 additions and 0 deletions

View File

@ -38,6 +38,10 @@ class TaskToolCommandGenerator {
// Collect task artifacts // Collect task artifacts
for (const task of standaloneTasks) { for (const task of standaloneTasks) {
let taskPath = (task.path || '').replaceAll('\\', '/'); let taskPath = (task.path || '').replaceAll('\\', '/');
// Convert absolute paths to relative paths
if (path.isAbsolute(taskPath)) {
taskPath = path.relative(bmadDir, taskPath).replaceAll('\\', '/');
}
// Remove _bmad/ prefix if present to get relative path within bmad folder // Remove _bmad/ prefix if present to get relative path within bmad folder
if (taskPath.startsWith(bmadPrefix)) { if (taskPath.startsWith(bmadPrefix)) {
taskPath = taskPath.slice(bmadPrefix.length); taskPath = taskPath.slice(bmadPrefix.length);
@ -59,6 +63,10 @@ class TaskToolCommandGenerator {
// Collect tool artifacts // Collect tool artifacts
for (const tool of standaloneTools) { for (const tool of standaloneTools) {
let toolPath = (tool.path || '').replaceAll('\\', '/'); let toolPath = (tool.path || '').replaceAll('\\', '/');
// Convert absolute paths to relative paths
if (path.isAbsolute(toolPath)) {
toolPath = path.relative(bmadDir, toolPath).replaceAll('\\', '/');
}
// Remove _bmad/ prefix if present to get relative path within bmad folder // Remove _bmad/ prefix if present to get relative path within bmad folder
if (toolPath.startsWith(bmadPrefix)) { if (toolPath.startsWith(bmadPrefix)) {
toolPath = toolPath.slice(bmadPrefix.length); toolPath = toolPath.slice(bmadPrefix.length);