refactor: pre-compile regex patterns and remove dead code

- task.ts: Cache completion phrase regex in constructor instead of
  re-creating on every checkCompletion() call. Add escapeRegex helper
  for safe RegExp construction from user-provided phrases.
- ralph-tracker.ts: Remove commented-out COMPLETION_SIGNAL_PATTERN

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-01-24 04:36:18 +01:00
co-authored by Claude Opus 4.5
parent 0ea7a21df2
commit d722aca2c7
2 changed files with 16 additions and 8 deletions
-3
View File
@@ -209,9 +209,6 @@ const ALL_COUNT_PATTERN = /all\s+(\d+)\s+(?:tasks?|files?|items?)/i;
*/
const TASK_DONE_PATTERN = /(?:task|item|todo)\s*(?:#?\d+|"\s*[^"]+\s*")?\s*(?:is\s+)?(?:done|completed?|finished)|(?:completed?|done|finished)\s+(?:task|item)\s*(?:#?\d+)?|marking\s+(?:.*?\s+)?(?:as\s+)?completed?|marked\s+(?:.*?\s+)?(?:as\s+)?completed?/i;
// Generic completion signal pattern - commented out due to false positive risk
// const COMPLETION_SIGNAL_PATTERN = /^(?:done|completed?|finished|all\s+set)!?\s*$/i;
// ---------- Utility Patterns ----------
/**