mirror of
https://github.com/logseq/logseq.git
synced 2026-04-24 22:25:01 +00:00
enhance: add bb ai:check-common-errors
This commit is contained in:
5
bb.edn
5
bb.edn
@@ -207,7 +207,10 @@
|
||||
logseq.tasks.lang/validate-translations
|
||||
|
||||
file-sync:integration-tests
|
||||
logseq.tasks.file-sync/integration-tests}
|
||||
logseq.tasks.file-sync/integration-tests
|
||||
|
||||
ai:check-common-errors
|
||||
logseq.tasks.common-errors/check-common-errors}
|
||||
|
||||
:tasks/config
|
||||
{:large-vars
|
||||
|
||||
3
prompts/clojure_errors.md
Normal file
3
prompts/clojure_errors.md
Normal file
@@ -0,0 +1,3 @@
|
||||
You're Clojure expert, you're responsible to check those common errors:
|
||||
|
||||
1. `empty?` should be used instead of `empty` when a boolean value is expected in an expression.
|
||||
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