summaryrefslogtreecommitdiff
path: root/Omni
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2025-08-26 17:55:05 -0400
committerBen Sima <ben@bsima.me>2025-08-28 12:14:05 -0400
commit40aa809c494019a3e9d69250133baa2d7c8c3394 (patch)
tree4fd0a2740b807c5226dca0892c1ca1b5290c5bc2 /Omni
parent1e14a098eacc8ce797018e17ec2963983c1ca874 (diff)
Add typecheck.sh with Python support
This runs a repl and calls mypy to typecheck the given target. Not only is this *much* faster than using bild to typecheck stuff, but it also produces less noise in the logs, so I can have aider call this and the output won't overwhelm the llm.
Diffstat (limited to 'Omni')
-rwxr-xr-xOmni/Ide/repl.sh5
-rwxr-xr-xOmni/Ide/typecheck.sh18
2 files changed, 23 insertions, 0 deletions
diff --git a/Omni/Ide/repl.sh b/Omni/Ide/repl.sh
index 3b6a536..d4ff200 100755
--- a/Omni/Ide/repl.sh
+++ b/Omni/Ide/repl.sh
@@ -10,6 +10,7 @@
###
### Options:
### --bash start bash instead of the target language repl
+### --cmd x run 'x' instead of bash, or the target language repl
help() {
sed -rn 's/^### ?//;T;p' "$0"
}
@@ -23,6 +24,10 @@ fi
if [[ "$1" == "--bash" ]]; then
CMD="bash"
shift
+ elif [[ "$1" == "--cmd" ]]; then
+ shift
+ CMD="$1"
+ shift
fi
targets="${*:?}"
json=$(bild --plan "${targets[@]}")
diff --git a/Omni/Ide/typecheck.sh b/Omni/Ide/typecheck.sh
new file mode 100755
index 0000000..9de8b54
--- /dev/null
+++ b/Omni/Ide/typecheck.sh
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+###
+### typecheck a given target
+###
+### > typecheck.sh <target..>
+###
+### Uses repl.sh to provision the environment for target, then runs the
+### appropriate typechecker for the given module.
+###
+help() {
+ sed -rn 's/^### ?//;T;p' "$0"
+}
+if [[ $# == 0 ]] || [[ "$1" == "-h" ]]; then
+ help
+ exit 1
+fi
+target="$1"
+repl.sh --cmd "python -m mypy $target" "$target"