branch: externals/ellama
commit 9c04ca46fd4124f0edc55356fc105a81c4d7ba1f
Author: Sergey Kostyaev <[email protected]>
Commit: Sergey Kostyaev <[email protected]>

    Simplify project root detection
    
    Refactored the project root detection logic in ellama-find-agents-file to 
use
    ellama-tools-project-root-tool, eliminating potential nil returns from
    project-current. This makes the function more robust when locating the 
AGENTS.md
    file. Fixes #375
---
 ellama.el | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/ellama.el b/ellama.el
index a350cfc85a..e5c52fac05 100644
--- a/ellama.el
+++ b/ellama.el
@@ -1217,9 +1217,8 @@ 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
-                               (or (project-root (project-current)) 
current-dir))))
+         (project-root (file-name-directory (expand-file-name
+                                            (ellama-tools-project-root-tool))))
          found-path)
     ;; Walk up from current directory to project root
     (while (and (not found-path)

Reply via email to