(sigil nrepl client)
(sigil nrepl client) - nREPL client for connecting to running Sigil apps
A reusable nREPL client that can connect to a Sigil nREPL server over TCP. Used by MCP dev tools and editor plugins.
Wire protocol matches the server in (sigil nrepl): Send/Receive: 4-byte big-endian length + UTF-8 S-expression
Example:
(import (sigil nrepl client))
(define conn (nrepl-connect "127.0.0.1" 7888))
(nrepl-eval conn "(+ 1 2)") ; => ((status . ok) (value . "3"))
(nrepl-disconnect conn)Exports
nrepl-connectprocedureConnect to an nREPL server.
Returns a connection object on success, or #f on failure.
Example:
(nrepl-connect "127.0.0.1" 7888)nrepl-disconnectprocedureDisconnect from an nREPL server.
nrepl-connected?procedureCheck if a connection is still active.
nrepl-sendprocedureSend a raw request and receive a response.
Takes a request S-expression and returns the parsed response, or #f if the connection failed.
nrepl-evalprocedureEvaluate code in the nREPL server.
Returns a parsed response alist with status, value, message, and module fields, or #f if the connection failed.
Example:
(nrepl-eval conn "(+ 1 2)")
;; => ((status . ok) (value . "3") (message . #f) (module . "(sigil user)"))nrepl-switch-moduleprocedureSwitch the nREPL session to a different module.
Example:
(nrepl-switch-module conn "(sigil web demo views)")nrepl-completeprocedureGet completions for a prefix.
nrepl-docprocedureGet documentation for a symbol.
nrepl-modulesprocedureList available modules.
nrepl-register!procedureRegister a connection under a name (symbol).
If a connection with the same name already exists, it is replaced.
(nrepl-register! 'mcp conn)nrepl-lookupprocedureLook up a registered connection by name.
Returns the connection or #f if not found.
(nrepl-lookup 'mcp) ; => connection or #fnrepl-unregister!procedureUnregister a named connection.