diff --git a/aider/watch.py b/aider/watch.py index 735986ed8..c17d3e0c3 100644 --- a/aider/watch.py +++ b/aider/watch.py @@ -3,10 +3,11 @@ import threading from pathlib import Path from typing import Optional -from grep_ast import TreeContext from pathspec import PathSpec from pathspec.patterns import GitWildMatchPattern from watchfiles import watch +from grep_ast import TreeContext + from aider.dump import dump # noqa @@ -65,7 +66,8 @@ class FileWatcher: """Watches source files for changes and AI comments""" # Compiled regex pattern for AI comments - ai_comment_pattern = re.compile(r"(?:#|//) *.*\bai!? *$", re.IGNORECASE) + ai_comment_pattern = re.compile(r"(?:#|//) *(ai\b.*|ai|.*\bai!?)", re.IGNORECASE) + def __init__(self, coder, gitignores=None, verbose=False): self.coder = coder