fix: Extract task numbers from folder names (task-XXX-*)
Added fallback to check folder naming convention for task numbers. This catches task-048, task-092, task-093, task-094, etc. Chronicler #69
This commit is contained in:
@@ -93,16 +93,35 @@ module.exports = async function() {
|
||||
const titleMatch = content.match(/^#\s+(.+)$/m);
|
||||
let title = titleMatch ? titleMatch[1] : dir.name;
|
||||
|
||||
// Extract task number from title (e.g., "Task #87:" or "# Task #87")
|
||||
// Extract task number - check multiple sources
|
||||
let taskNumber = null;
|
||||
const taskNumMatch = title.match(/#(\d+)/);
|
||||
if (taskNumMatch) {
|
||||
taskNumber = taskNumMatch[1];
|
||||
} else {
|
||||
// Try to find task number in content
|
||||
|
||||
// 1. Check frontmatter for task_number field
|
||||
if (frontmatter.task_number) {
|
||||
taskNumber = frontmatter.task_number;
|
||||
}
|
||||
|
||||
// 2. Check folder name (e.g., task-048-n8n-rebuild)
|
||||
if (!taskNumber) {
|
||||
const folderNumMatch = dir.name.match(/^task-0*(\d+)/);
|
||||
if (folderNumMatch) {
|
||||
taskNumber = folderNumMatch[1];
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Check title for #XX pattern
|
||||
if (!taskNumber) {
|
||||
const titleNumMatch = title.match(/#(\d+)/);
|
||||
if (titleNumMatch) {
|
||||
taskNumber = titleNumMatch[1];
|
||||
}
|
||||
}
|
||||
|
||||
// 4. Check content for Task ID or Task #XX patterns
|
||||
if (!taskNumber) {
|
||||
const contentNumMatch = content.match(/\*\*Task ID:\*\*\s*#?(\d+)/i) ||
|
||||
content.match(/Task #(\d+)/i) ||
|
||||
content.match(/\*\*Task ID:\*\*\s*FFG-TASK-(\d+)/i);
|
||||
content.match(/\*\*Task ID:\*\*\s*FFG-TASK-0*(\d+)/i) ||
|
||||
content.match(/^#\s+Task\s+#(\d+)/im);
|
||||
if (contentNumMatch) {
|
||||
taskNumber = contentNumMatch[1];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user