Give the terminal's classpath an nREPL, and hand recipes their arguments
`just nrepl` is `tui` with an nREPL on the end instead of a `-main`, so a component can be redefined and re-mounted in the session that is on screen rather than rebuilt. And the thing that made it worth finding: a `#!` recipe is interpolated, not handed argv, so `"$@"` was empty in every recipe here — `just tui --headless` opened the terminal instead. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
664397d parent: 58be94a modified
.gitignore +3 -0 | @@ -13,3 +13,6 @@ | ||
| 13 | 13 | |
| 14 | 14 | # buck2 output tree. |
| 15 | 15 | /buck-out/ |
| 16 | + | |
| 17 | +# nrepl-server drops this next to the deps file for editors to find. | |
| 18 | +.nrepl-port | |
| @@ -13,3 +13,6 @@ | |||
| 13 | 13 | ||
| 14 | # buck2 output tree. | 14 | # buck2 output tree. |
| 15 | /buck-out/ | 15 | /buck-out/ |
| 16 | + | ||
| 17 | +# nrepl-server drops this next to the deps file for editors to find. | ||
| 18 | +.nrepl-port | ||
modified
justfile +33 -0 | @@ -11,6 +11,12 @@ | ||
| 11 | 11 | |
| 12 | 12 | set shell := ["bash", "-euo", "pipefail", "-c"] |
| 13 | 13 | |
| 14 | +# Every recipe below is a `#!` script and passes its arguments on with "$@". | |
| 15 | +# Without this that is empty in one — just interpolates into a shebang recipe | |
| 16 | +# rather than handing it argv — and `just tui --headless` silently ran the | |
| 17 | +# terminal instead. | |
| 18 | +set positional-arguments | |
| 19 | + | |
| 14 | 20 | # nix is not on every host this runs on: on the machine these recipes were |
| 15 | 21 | # written for it lives in an Arch distrobox, at the same path — which is why |
| 16 | 22 | # the container is entered rather than the tree copied into it. See CLAUDE.md. |
| @@ -155,6 +161,33 @@ tui *args: | ||
| 155 | 161 | |
| 156 | 162 | exec jolt -Sdeps "$deps" -m frq.tui "$@" |
| 157 | 163 | |
| 164 | +# The same classpath as `tui`, with an nREPL on it instead of a `-main`: a | |
| 165 | +# session that can require `frq.tui` and then redefine a component while it is | |
| 166 | +# on screen, which is a second and not the minute a rebuild costs. | |
| 167 | +# | |
| 168 | +# just nrepl then, from an editor or a client on 7888: | |
| 169 | +# (require (quote frq.tui)) both backends, terminal installed last | |
| 170 | +# (frq.tui/-main "--headless" "--demo") | |
| 171 | +# (glimmer.core/reload!) re-mount after redefining a component | |
| 172 | +# | |
| 173 | +# `just repl nrepl-server` is the window's half of this — the same thing minus | |
| 174 | +# glimmer-tui. Port is nrepl-server's own positional: `just nrepl 7889`. | |
| 175 | +nrepl *args: | |
| 176 | + #!/usr/bin/env bash | |
| 177 | + set -euo pipefail | |
| 178 | + cd "{{justfile_directory()}}" | |
| 179 | + if [ -z "${JOLT_NATIVE_LIB:-}" ]; then | |
| 180 | + exec {{nix}} develop . --max-jobs {{jobs}} --command just nrepl "$@" | |
| 181 | + fi | |
| 182 | + | |
| 183 | + deps="{:deps {jolt-lang/glimmer {:local/root \"$GLIMMER_SRC\"}" | |
| 184 | + deps="$deps nandi/glimmer-vidya {:local/root \"$GLIMMER_VIDYA_SRC\"}" | |
| 185 | + deps="$deps nandi/glimmer-tui {:local/root \"$GLIMMER_TUI_SRC\"}}}" | |
| 186 | + | |
| 187 | + export LD_LIBRARY_PATH="$JOLT_NATIVE_LIB:$FRQ_LIB_PATH${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" | |
| 188 | + | |
| 189 | + exec jolt -Sdeps "$deps" nrepl-server "$@" | |
| 190 | + | |
| 158 | 191 | # `jolt` in the repo root does not work on its own: deps.edn carries |
| 159 | 192 | # :jolt/native, so every invocation here loads libvidya and libjoltmoq before it |
| 160 | 193 | # reads a line, and dies naming the library if the loader cannot find them. So |
| @@ -11,6 +11,12 @@ | |||
| 11 | 11 | ||
| 12 | set shell := ["bash", "-euo", "pipefail", "-c"] | 12 | set shell := ["bash", "-euo", "pipefail", "-c"] |
| 13 | 13 | ||
| 14 | +# Every recipe below is a `#!` script and passes its arguments on with "$@". | ||
| 15 | +# Without this that is empty in one — just interpolates into a shebang recipe | ||
| 16 | +# rather than handing it argv — and `just tui --headless` silently ran the | ||
| 17 | +# terminal instead. | ||
| 18 | +set positional-arguments | ||
| 19 | + | ||
| 14 | # nix is not on every host this runs on: on the machine these recipes were | 20 | # nix is not on every host this runs on: on the machine these recipes were |
| 15 | # written for it lives in an Arch distrobox, at the same path — which is why | 21 | # written for it lives in an Arch distrobox, at the same path — which is why |
| 16 | # the container is entered rather than the tree copied into it. See CLAUDE.md. | 22 | # the container is entered rather than the tree copied into it. See CLAUDE.md. |
| @@ -155,6 +161,33 @@ tui *args: | |||
| 155 | 161 | ||
| 156 | exec jolt -Sdeps "$deps" -m frq.tui "$@" | 162 | exec jolt -Sdeps "$deps" -m frq.tui "$@" |
| 157 | 163 | ||
| 164 | +# The same classpath as `tui`, with an nREPL on it instead of a `-main`: a | ||
| 165 | +# session that can require `frq.tui` and then redefine a component while it is | ||
| 166 | +# on screen, which is a second and not the minute a rebuild costs. | ||
| 167 | +# | ||
| 168 | +# just nrepl then, from an editor or a client on 7888: | ||
| 169 | +# (require (quote frq.tui)) both backends, terminal installed last | ||
| 170 | +# (frq.tui/-main "--headless" "--demo") | ||
| 171 | +# (glimmer.core/reload!) re-mount after redefining a component | ||
| 172 | +# | ||
| 173 | +# `just repl nrepl-server` is the window's half of this — the same thing minus | ||
| 174 | +# glimmer-tui. Port is nrepl-server's own positional: `just nrepl 7889`. | ||
| 175 | +nrepl *args: | ||
| 176 | + #!/usr/bin/env bash | ||
| 177 | + set -euo pipefail | ||
| 178 | + cd "{{justfile_directory()}}" | ||
| 179 | + if [ -z "${JOLT_NATIVE_LIB:-}" ]; then | ||
| 180 | + exec {{nix}} develop . --max-jobs {{jobs}} --command just nrepl "$@" | ||
| 181 | + fi | ||
| 182 | + | ||
| 183 | + deps="{:deps {jolt-lang/glimmer {:local/root \"$GLIMMER_SRC\"}" | ||
| 184 | + deps="$deps nandi/glimmer-vidya {:local/root \"$GLIMMER_VIDYA_SRC\"}" | ||
| 185 | + deps="$deps nandi/glimmer-tui {:local/root \"$GLIMMER_TUI_SRC\"}}}" | ||
| 186 | + | ||
| 187 | + export LD_LIBRARY_PATH="$JOLT_NATIVE_LIB:$FRQ_LIB_PATH${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" | ||
| 188 | + | ||
| 189 | + exec jolt -Sdeps "$deps" nrepl-server "$@" | ||
| 190 | + | ||
| 158 | # `jolt` in the repo root does not work on its own: deps.edn carries | 191 | # `jolt` in the repo root does not work on its own: deps.edn carries |
| 159 | # :jolt/native, so every invocation here loads libvidya and libjoltmoq before it | 192 | # :jolt/native, so every invocation here loads libvidya and libjoltmoq before it |
| 160 | # reads a line, and dies naming the library if the loader cannot find them. So | 193 | # reads a line, and dies naming the library if the loader cannot find them. So |