I've documented the interface proposed for this functionality in greater
detail here:
https://github.com/technomancy/nrepl-discover/blob/master/Proposal.md
The argument types listed in the proposal are all fairly straightforward
with the exception of `eval`; the idea for this came about when I
thought about how to implement "run this one test". We have an argument
type for vars, which would be sufficient, but it would be great to
narrow it down to just the vars in the current namespace which have
`:test` metadata. So that serves as a sort of escape hatch for when
the existing types aren't rich enough.
I'm fully aware that I'm coming at this from an Emacs-biased angle, but
I was able to implement support for nearly everything in the proposal in
a matter of hours. I'm definitely interested in hearing from others
who are considering implementing it in other runtimes. My next plan is
to look at moving certain features in nrepl.el over to the server side;
I think the `tools.nrepl` library should probably ship with things like
docstring support and jump-to-definition. And load-file should be
auto-discovered rather than hard-coded into each client too.
After review, I believe the second half of the proposal (the Responses
section) is only tangentially related to auto-discovery of ops; it's
simply some response types I have found to be necessary for implementing
certain ops that I would like to use with auto-discovery. I believe the
"message", "text", "position", and "url" responses should become
standardized as a regular part of the nREPL protocol, though perhaps
some distinction should be made between clients which intend to provide
a full environment vs clients like reply which only intend to offer a
CLI.
Support for overlays isn't as much of a no-brainer, but it's really
great to have for implementing things like test runners which can
indicate where failures occur or possibly giving feedback about
instrumentation. I've also thought of an `edit` response which could
indicate that the editor should make some change to the namespace, but I
haven't really thought this through; it may not be necessary.
These should probably be evaluated independently from the auto-discovery
proposal, which simply consists of standardizing on the metadata to
attach to operations: the `:nrepl/op` map containing `:name`, `:doc`,
and `:args` keys and deciding which operations to ship with
`tools.nrepl` itself.
-Phil