Repository navigation
Expand file tree
/
Copy pathbb.edn
More file actions
178 lines (147 loc) · 7.45 KB
/
Copy pathbb.edn
File metadata and controls
178 lines (147 loc) · 7.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
{:deps {outskirtslabs/bb-tasks
{:git/url "https://github.com/outskirtslabs/bb-tasks"
:git/sha "e868e28b18a0496ec4d39878f0307cb1df17da22"}}
:pods {clj-kondo/clj-kondo {:version "2026.01.19"}}
:paths ["scripts" "test/bb"]
:tasks {:requires
([clojure.string :as str]
[clojure.pprint :refer [print-table]]
[ol.llx.bb.live-env :as live-env]
[ol.llx.scripts.diff-upstream :as diff-upstream]
[ol.bb-tasks.gen-docs :as gen-docs]
[babashka.tasks :refer [shell]])
:init
(do
(def paths ["src" "test"])
(defn clojure*
[& args]
(let [dotenv-extra-env (live-env/clojure-extra-env)
[opts cmd] (if (map? (first args))
[(first args) (rest args)]
[nil args])
opts (cond-> (or opts {})
(seq dotenv-extra-env)
(update :extra-env (fn [extra-env]
(merge dotenv-extra-env (or extra-env {})))))]
(if (seq opts)
(apply clojure opts cmd)
(apply clojure cmd)))))
dev
{:doc "Start a local development REPL"
:task (apply clojure* "-M:repl/dev:dev" *command-line-args*)}
test:jvm
{:doc "Run all tests or specific test suites"
:task (apply clojure* "-M:dev:kaocha"
(concat [":unit"] *command-line-args*))}
test:jvm-live
{:doc "Run all tests or specific test suites"
:task (let [disabled (live-env/provider-skip-meta-flags)
suites (concat [":live"] *command-line-args*)]
(apply clojure* "-M:dev:kaocha" (concat suites disabled)))}
funnel
{:doc "Run Funnel websocket relay for Kaocha CLJS"
:task (apply clojure* "-M:funnel" *command-line-args*)}
test:watch-cljs
{:doc "Watch CLJS Kaocha test build with shadow-cljs"
:task (apply clojure* "-M:dev:shadow-cljs" "watch" "kaocha-test" *command-line-args*)}
test:cljs-build
{:doc "Compile both CLJS Kaocha builds (unit + live)"
:task (do
(clojure* "-M:dev:shadow-cljs" "compile" "kaocha-test")
(clojure* "-M:dev:shadow-cljs" "compile" "kaocha-test-live"))}
test:cljs
{:doc "Run CLJS unit tests through Kaocha + kaocha-cljs2"
:task (apply clojure* "-M:dev:kaocha"
(concat [":cljs"] *command-line-args*))}
test:cljs-live
{:doc "Run CLJS live tests through Kaocha + kaocha-cljs2"
:task (let [disabled (live-env/provider-skip-meta-flags)
suites (concat [":cljs-live"] *command-line-args*)]
(apply clojure* "-M:dev:kaocha" (concat suites disabled)))}
test
{:doc "Run JVM + CLJS unit test suites"
:depends [test:jvm test:cljs]}
test-live
{:doc "Run JVM + CLJS live test suites"
:depends [test:jvm-live test:cljs-live]}
generate-models
{:doc "Generate built-in model catalog artifact"
:task (do (clojure* "-M:dev" "-m" "ol.llx.ai.impl.model-catalog.generate")
(shell "cljfmt --quiet fix src/ol/llx/ai/impl/models_generated.cljc"))}
diff-upstream
{:doc "Summarize upstream commits for selected paths"
:task (apply diff-upstream/-main *command-line-args*)}
oauth:providers
{:doc "List available OAuth providers"
:task (clojure* "-M:dev" "-m" "ol.llx.ai.oauth.cli" "providers")}
oauth:login
{:doc "Run OAuth login flow for a provider id"
:task (apply clojure* "-M:dev" "-m" "ol.llx.ai.oauth.cli" "login" *command-line-args*)}
fmt
{:doc "Format code with cljfmt"
:task (apply shell "cljfmt --quiet -v fix" (if (seq *command-line-args*) *command-line-args* paths))}
fmt:check
{:doc "Check code formatting without making changes"
:task (apply shell "cljfmt check " paths)}
prep
{:doc "Prepare Clojure dependencies"
:task (apply clojure* "-X:deps prep :aliases '[:dev :kaocha]'")}
deps-lock
{:doc "Generate deps-lock.json from the root deps.edn only"
:task (shell "deps-lock" "--deps-include" "deps.edn")}
deps-tree
{:doc "Show dependency tree"
:task (clojure* "-X:deps tree :aliases '[:dev]'")}
lint:copy-configs
{:doc "Copy clj-kondo configs from dependencies"
:task (shell "clj-kondo" "--lint" (-> (shell {:out :string} "clojure -Spath -M:test:dev") :out str/trim) "--dependencies" "--copy-configs" "--skip-lint")}
lint
{:doc "Lint code with clj-kondo"
:task (if (seq *command-line-args*)
(apply shell "clj-kondo" "--lint" *command-line-args*)
(apply shell "clj-kondo --lint" paths))}
guardrails:check-signatures
{:doc "Fail when Guardrails signatures are all-generic (map?/any? only)"
:task (let [pattern "\\[(map\\?|any\\?)(\\s+(map\\?|any\\?))*\\s+=>\\s+(map\\?|any\\?)\\]"
result (shell {:continue true :out :string :err :string}
"rg" "-n" pattern "src/ol/llx/ai/impl")]
(case (:exit result)
1 (println "Guardrails signature quality gate passed: no all-generic signatures found.")
0 (do
(println "Guardrails signature quality gate failed: found disallowed signatures:")
(print (:out result))
(throw (ex-info "Disallowed all-generic Guardrails signatures found."
{:pattern pattern})))
(do
(when (seq (:err result))
(print (:err result)))
(throw (ex-info "Failed to run Guardrails signature quality gate."
{:exit (:exit result)})))))}
qa
{:doc "Run full quality assurance: format, lint, and test"
:depends [fmt lint guardrails:check-signatures test]}
qa-long
{:doc "Run full quality assurance: format, lint, and test"
:depends [fmt lint guardrails:check-signatures test test:jvm-live]}
ci
{:doc "Run CI checks: test, format check, and lint"
:depends [test fmt:check lint]}
gen-docs
{:doc "Generate all Antora documentation"
:task (gen-docs/generate!)}
;; jar
;; {:override-builtin true
;; :depends [clean]
;; :doc "Build an jar"
;; :task (shell "clojure -T:build jar")}
;; clean
;; {:override-builtin true
;; :doc "Clean build artifacts"
;; :task (shell "clojure -T:build clean")}
distclean
{:doc "Remove all generated build/cache artifacts (target, .cpcache, .shadow-cljs, node_modules)"
:task (shell "rm -rf target .cpcache .shadow-cljs node_modules")}
publish
{:doc "Publish the clojure sdk libs to clojars"
:depends [jar]
:task (clojure* "-T:build deploy")}}}