Feature: Add todo pattern detection and auto-capture system
This commit is contained in:
26
lib/detect-todo.js
Normal file
26
lib/detect-todo.js
Normal 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);
|
||||
Reference in New Issue
Block a user