branch: externals/ellama
commit cbf3cb3247cc6be9ad96cf782dae80c39f2ebfce
Merge: 0207309a39 cde0543782
Author: Sergey Kostyaev <[email protected]>
Commit: GitHub <[email protected]>

    Merge pull request #384 from s-kostyaev/fix-major-bug
    
    Add fallback for AGENTS.md search when project root tool returns nil
---
 NEWS.org  | 4 ++++
 ellama.el | 7 ++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/NEWS.org b/NEWS.org
index a7796271d5..19939c834c 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -1,3 +1,7 @@
+* Version 1.12.8
+- Add fallback for AGENTS.md search when ~ellama-tools-project-root-tool~
+  returns nil. This ensures reliable detection of the AGENTS.md file by falling
+  back to the current directory.
 * Version 1.12.7
 - Fix bug when only single tool was available. This change fixes a duplicate
   checking issue in the tool list by using ~llm-tool-name~ instead of
diff --git a/ellama.el b/ellama.el
index ae541f9259..a3d50f0141 100644
--- a/ellama.el
+++ b/ellama.el
@@ -6,7 +6,7 @@
 ;; URL: http://github.com/s-kostyaev/ellama
 ;; Keywords: help local tools
 ;; Package-Requires: ((emacs "28.1") (llm "0.24.0") (plz "0.8") (transient 
"0.7") (compat "29.1") (yaml "1.2.3"))
-;; Version: 1.12.7
+;; Version: 1.12.8
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;; Created: 8th Oct 2023
 
@@ -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)

Reply via email to