branch: externals/ellama
commit 212477bccf8debede5ea5f17b90fbd94a9274c5a
Author: Sergey Kostyaev <[email protected]>
Commit: Sergey Kostyaev <[email protected]>
Add fallback for AGENTS.md search when project root tool returns nil
Added current directory as fallback when ellama-tools-project-root-tool
returns
nil, ensuring reliable AGENTS.md file detection. Fix #383
---
ellama.el | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/ellama.el b/ellama.el
index ae541f9259..636bad64d7 100644
--- a/ellama.el
+++ b/ellama.el
@@ -1217,8 +1217,9 @@ Otherwire return current active session."
"Search for AGENTS.md file from current directory up to project root.
Returns the full path to AGENTS.md if found, or nil if not found."
(let* ((current-dir (file-name-directory (expand-file-name
default-directory)))
- (project-root (file-name-directory (expand-file-name
- (ellama-tools-project-root-tool))))
+ (project-root (or (file-name-directory (expand-file-name
+
(ellama-tools-project-root-tool)))
+ current-dir))
found-path)
;; Walk up from current directory to project root
(while (and (not found-path)