mirror of
https://github.com/logseq/logseq.git
synced 2026-05-25 13:14:39 +00:00
enhance: add bb ai:check-common-errors
This commit is contained in:
15
scripts/src/logseq/tasks/common_errors.clj
Normal file
15
scripts/src/logseq/tasks/common_errors.clj
Normal file
@@ -0,0 +1,15 @@
|
||||
(ns logseq.tasks.common-errors
|
||||
"Task to use AI to detect common errors"
|
||||
(:require [babashka.fs :as fs]
|
||||
[babashka.process :refer [shell]]
|
||||
[clojure.string :as string]))
|
||||
|
||||
(defn check-common-errors
|
||||
[]
|
||||
(let [prompt (String. (fs/read-all-bytes "prompts/clojure_errors.md"))
|
||||
diff (:out (shell {:out :string} "git diff --no-prefix -U100 -- '*.cljs'"))]
|
||||
(when-not (string/blank? diff)
|
||||
(let [command (format "gh models run openai/gpt-5 \"%s\""
|
||||
(str prompt
|
||||
(format "\n\n <diff>%s</diff>" diff)))]
|
||||
(shell command)))))
|
||||
Reference in New Issue
Block a user