secufusion-mcp 1.0.59 → 1.0.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +27 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -511,8 +511,8 @@ function resolveTaskFolder(workItemId, tasksRoot, registryData) {
|
|
|
511
511
|
return null;
|
|
512
512
|
}
|
|
513
513
|
function generateNewTaskFolder(workItemId, title, tasksRoot) {
|
|
514
|
-
// Strip potential leading ID prefix
|
|
515
|
-
const strippedTitle = title.replace(/^[a-zA-Z]
|
|
514
|
+
// Strip potential leading ID prefix from the title (e.g. "BUG-1173: " or "1173: ")
|
|
515
|
+
const strippedTitle = title.replace(/^[a-zA-Z]*[-]?\d+[:\s]*/i, '');
|
|
516
516
|
const slug = strippedTitle.toLowerCase()
|
|
517
517
|
.replace(/[:\s]+/g, '-')
|
|
518
518
|
.replace(/[^a-z0-9-]+/g, '')
|
|
@@ -520,7 +520,31 @@ function generateNewTaskFolder(workItemId, title, tasksRoot) {
|
|
|
520
520
|
.replace(/^-|-$/g, '')
|
|
521
521
|
.slice(0, 50)
|
|
522
522
|
.replace(/-+$/, '');
|
|
523
|
-
|
|
523
|
+
// Determine standard prefix (e.g., bug-1173, story-1097)
|
|
524
|
+
let numericId = workItemId.replace(/\D/g, ''); // Extract just the digits
|
|
525
|
+
if (!numericId)
|
|
526
|
+
numericId = workItemId; // fallback
|
|
527
|
+
let taskTypeStr = "task";
|
|
528
|
+
// Try to load the classification to get the true task_type
|
|
529
|
+
const classifPath = path.join(tasksRoot, '..', 'classifications', `${workItemId}.json`);
|
|
530
|
+
const classif = readJson(classifPath);
|
|
531
|
+
if (classif && typeof classif.task_type === 'string') {
|
|
532
|
+
const rawType = classif.task_type.toLowerCase();
|
|
533
|
+
if (rawType === 'user_story')
|
|
534
|
+
taskTypeStr = 'story';
|
|
535
|
+
else
|
|
536
|
+
taskTypeStr = rawType;
|
|
537
|
+
}
|
|
538
|
+
else {
|
|
539
|
+
// Fallback: guess from the workItemId string itself if passed as "BUG-1173"
|
|
540
|
+
const prefixMatch = workItemId.match(/^([a-zA-Z]+)-/);
|
|
541
|
+
if (prefixMatch) {
|
|
542
|
+
taskTypeStr = prefixMatch[1].toLowerCase();
|
|
543
|
+
if (taskTypeStr === 'wi')
|
|
544
|
+
taskTypeStr = 'task'; // Generic WI to task
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
return path.join(tasksRoot, `${taskTypeStr}-${numericId}-${slug}`);
|
|
524
548
|
}
|
|
525
549
|
function readJson(filePath) {
|
|
526
550
|
const raw = readFileSafe(filePath);
|