How to connect to a running repl with only Clojure CLI?

So, with some help I put together this Figwheel starter project using deps.edn:

After having started a Figwheel session I can then connect to the server nrepl using lein repl :connect, and from there connect to the Figwheel repl using (cljs-repl).

But the point of this template project was to make a proof of concept of how far I can get using only Clojure CLI and I’d like to be able to connect to the repl without invoking leiningen or boot or anything else really. It doesn’t seem possible using the clojure command at the moment, or am I missing something?

So I’m thinking I should add a task to build.clj script that connects to a running repl. But, being the Clojure noob I am, I haven’t figured out what that entails. Is there an nrepl client that handles some of this or will I have to roll my own using Bencode and such?

REPL-y is the same nREPL client (and general “better REPL”) that lein uses - it suggests starting at reply.main/launch-nrepl. I’ve been able to connect to a running nREPL with (reply.main/launch-nrepl {:attach "50265"}) and then modify a shared atom.

1 Like

Thanks for this! I’ll have a look.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.