diff --git a/aider/__init__.py b/aider/__init__.py index 624bad1f4c0..bf2e1824d49 100644 --- a/aider/__init__.py +++ b/aider/__init__.py @@ -1,6 +1,6 @@ from packaging import version -__version__ = "0.89.0.dev" +__version__ = "0.89.1.dev" safe_version = __version__ try: diff --git a/aider/coders/chat_chunks.py b/aider/coders/chat_chunks.py index 80edfcaabad..21c49f55087 100644 --- a/aider/coders/chat_chunks.py +++ b/aider/coders/chat_chunks.py @@ -31,18 +31,18 @@ def all_messages(self): return messages else: return ( - self.format_list(self.system) - + self.format_list(self.static) - + self.format_list(self.examples) - + self.format_list(self.readonly_files) - + self.format_list(self.chat_files) - + self.format_list(self.repo) - + self.format_list(self.pre_message) - + self.format_list(self.done) - + self.format_list(self.edit_files) - + self.format_list(self.cur) - + self.format_list(self.post_message) - + self.format_list(self.reminder) + self.format_list("system") + + self.format_list("static") + + self.format_list("examples") + + self.format_list("readonly_files") + + self.format_list("chat_files") + + self.format_list("repo") + + self.format_list("pre_message") + + self.format_list("done") + + self.format_list("edit_files") + + self.format_list("cur") + + self.format_list("post_message") + + self.format_list("reminder") ) def add_cache_control_headers(self): @@ -86,7 +86,7 @@ def cacheable_messages(self): return messages def format_list(self, chunk): - if type(chunk) is not list: + if type(getattr(self, chunk, [])) is not list: return [] - return chunk + return getattr(self, chunk, []) diff --git a/aider/commands.py b/aider/commands.py index d10db9bb5e3..7162be45d08 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -1083,12 +1083,27 @@ def completions_context_blocks(self): ] def _handle_read_only_files(self, expanded_word, file_set, description=""): - """Handle read-only files with substring matching and samefile check""" + """Handle read-only files with substring matching, samefile check, and glob pattern matching""" matched = [] for f in file_set: - if expanded_word in f: - matched.append(f) - continue + # Check if the expanded_word contains glob characters + if any(c in expanded_word for c in "*?[]"): + # Use pathlib.Path.match() for glob pattern matching + try: + # Convert file path to Path object + file_path = Path(f) + # Check if the file path matches the glob pattern + if file_path.match(os.path.abspath(expanded_word)): + matched.append(f) + continue + except Exception: + # If path matching fails, fall back to other methods + pass + else: + # Original substring matching for non-glob patterns + if expanded_word in f: + matched.append(f) + continue # Try samefile comparison for relative paths try: