From 53fb0da3d9305548d4e6f0bf6a8bad7e95a0edd6 Mon Sep 17 00:00:00 2001 From: Gabriel Horner Date: Thu, 2 Apr 2026 16:43:31 -0400 Subject: [PATCH] fix(cli): custom-query fails if name is a keyword Bug caused by name binding masking core name fn. Wouldn't have this bug if there weren't so many :shadowed-var exclusions in clj-kondo/config.edn. With --verbose, also show stack for exceptions. Leads to faster fixing for us (and LLMs) --- src/main/logseq/cli/command/query.cljs | 6 +++--- src/main/logseq/cli/main.cljs | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/logseq/cli/command/query.cljs b/src/main/logseq/cli/command/query.cljs index 6be2906467..e727e240cd 100644 --- a/src/main/logseq/cli/command/query.cljs +++ b/src/main/logseq/cli/command/query.cljs @@ -92,9 +92,9 @@ {:ok? true :value parsed}))) (defn- normalize-query-name - [name] - (when (some? name) - (let [raw (if (keyword? name) (name name) (str name)) + [name'] + (when (some? name') + (let [raw (if (keyword? name') (name name') (str name')) text (string/trim raw)] (when (seq text) text)))) diff --git a/src/main/logseq/cli/main.cljs b/src/main/logseq/cli/main.cljs index a0735ce44a..58341eef27 100644 --- a/src/main/logseq/cli/main.cljs +++ b/src/main/logseq/cli/main.cljs @@ -70,7 +70,10 @@ (fn [] (format/format-result {:status :error :error {:code (or (:code data) :exception) - :message message}} + :message (str message + (when (get-in parsed [:options :verbose]) + (str "\nStacktrace:\n" + (.-stack error))))}} cfg)))})))) (defn ^:large-vars/cleanup-todo run!