From c0d1a8766cc8c6c0865ab70f14ebfbaf7b3039ef Mon Sep 17 00:00:00 2001 From: Brandon Ringe <12722744+bpringe@users.noreply.github.com> Date: Sat, 20 Jun 2026 16:12:54 -0700 Subject: [PATCH] Fix kondo hook dropping handler opts map from analysis The def-handler-macro clj-kondo hook captured the optional opts map (?opts) that handler macros accept between the name and the arg vector, but never emitted it into the synthetic defn. As a result, any var referenced only inside an opts map (e.g. {:authorized? my-ns/foo} on a defcommand) was invisible to clj-kondo, so clojure-lsp reported it as an unused public var. Emit ?opts as the first body form of the generated defn so its symbols get resolved. Affects defcommand, defquery, defreadmodel, defprocessor, and defperiodic. Co-Authored-By: Claude Opus 4.8 --- .../ai.obney.grain/grain-core-v2/hooks/grain_v2.clj | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/grain-core-v2/resources/clj-kondo.exports/ai.obney.grain/grain-core-v2/hooks/grain_v2.clj b/projects/grain-core-v2/resources/clj-kondo.exports/ai.obney.grain/grain-core-v2/hooks/grain_v2.clj index c13a944..5b0ba55 100644 --- a/projects/grain-core-v2/resources/clj-kondo.exports/ai.obney.grain/grain-core-v2/hooks/grain_v2.clj +++ b/projects/grain-core-v2/resources/clj-kondo.exports/ai.obney.grain/grain-core-v2/hooks/grain_v2.clj @@ -30,6 +30,7 @@ (concat (when ?docstring [?docstring]) [args-node] + (when ?opts [?opts]) body))) :defined-by defined-by})))