generated from eblume/project-template
heph.nvim: plug-and-play managed daemon (autostart, self-heal, client/server guardrail)
The plugin now manages its own hephd by default (autostart = true): if nothing is serving the socket it spawns a local daemon against the default XDG paths, kills only what it spawned on VimLeavePre, and self-heals — rpc.call retries once through a respawn hook when the connection drops (the prior owner releases the DB lock on exit, so a respawn can claim it). - daemon.ensure() connects to an already-running daemon (any mode) or spawns one we own; stop_spawned()/is_managed() track lifecycle. - A server/client daemon you started is always respected (spawn only when nothing serves the socket). autostart = false → connect-only, warns/errors if down, and clears the self-heal hook so it fails loudly. - config: autostart defaults true; new `db` option; $HEPH_SOCKET / $HEPH_DB fallbacks isolate a dev Neovim onto a separate daemon + DB. e2e: managed_daemon_spec covers autostart spawn, self-heal-after-kill, and connect-only error. 10 specs green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
fef0e82d26
commit
e3db2ac550
11 changed files with 277 additions and 18 deletions
|
|
@ -31,13 +31,16 @@ vim.api.nvim_create_autocmd("BufWriteCmd", {
|
|||
end,
|
||||
})
|
||||
|
||||
-- Release the socket cleanly on exit.
|
||||
-- Release the socket and stop any daemon this nvim spawned, cleanly, on exit.
|
||||
vim.api.nvim_create_autocmd("VimLeavePre", {
|
||||
group = grp,
|
||||
callback = function()
|
||||
pcall(function()
|
||||
require("heph.rpc").close()
|
||||
end)
|
||||
pcall(function()
|
||||
require("heph.daemon").stop_spawned()
|
||||
end)
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue