Feature: Add todo pattern detection and auto-capture system

This commit is contained in:
Remora
2026-02-09 15:52:33 +01:00
parent 3aafd4df13
commit 942a83244a
2 changed files with 74 additions and 0 deletions

26
lib/detect-todo.js Normal file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/env node
/**
* Detect "todo [task]" pattern in text
* Usage: node detect-todo.js "I need to todo [Setup CI/CD]"
* Output: Setup CI/CD (or empty if no match)
*/
const text = process.argv[2] || '';
// Match: "todo [text]" or "todo: text" or "todo text"
const patterns = [
/\btodo\s*\[\s*([^\]]+)\s*\]/i, // todo [text]
/\btodo:\s*([^\n]+?)(?:\s*$|\s*[.!?])/i, // todo: text or todo: text.
/\btodo\s+([^\n.!?]+?)(?:\s*$|\s*[.!?])/i, // todo text
];
for (const pattern of patterns) {
const match = text.match(pattern);
if (match && match[1]) {
console.log(match[1].trim());
process.exit(0);
}
}
// No match
process.exit(1);