(ns hooks.logging
  (:require [clj-kondo.hooks-api :as api]))
(defn with-context-as [{:keys [:node]}]
  (let [[_ _  binding & body ] (:children node)]
    {:node
     (api/list-node
       (list*
         (api/token-node 'let)
         (api/vector-node [binding {}])
         body))}))

(defn capture-context->lc [{:keys [:node]}]
  {:node
   (api/list-node
     (list*
       (api/token-node 'let)
       (api/vector-node [(api/token-node 'lc) {}])
       (:children node)))})
