Files
yuez 7e780515ac feat(cli)!: merge the daemon into pi2 as the daemon subcommand
`pi2 daemon [start] [flags]` now starts the web-console daemon. The
`pi2d` executable, its bin entry and its entry module are removed: the
daemon keeps its lock -> token -> plugin socket -> listen -> daemon.json
lifecycle, its single stdout line (`pi2 daemon listening on ...`) and the
signal handling that leaves managed nvim instances running.

Service files are renamed to `pi2.service` / `com.pi2.daemon`, and the
smoke and e2e harnesses start the daemon through `pi2 daemon`.

BREAKING CHANGE: the `pi2d` command no longer exists; use `pi2 daemon`
(or `pi2 daemon start`). Existing systemd/launchd units installed under
the old names must be reinstalled with `pi2 install-service --write`.
2026-10-22 15:47:48 +08:00

31 lines
1.2 KiB
Lua

-- Init used by the pi2 daemon end-to-end harness.
-- Minimal, hermetic: only the plugin under test on the runtimepath, with the
-- web console enabled and diagnostics enabled. Setting up the plugin here also
-- makes `pi.host` skip its own `setup()` call.
--
-- `cli.args` reaches every `pi --mode rpc` process the plugin spawns, so the
-- test-only attention extension (`scripts/e2e/attention-ext.ts`) is present in
-- the session the daemon drives (docs/e2e.md A11 — pre-execution diff review
-- needs something that emits `extension_ui_request`).
local function here()
local source = debug.getinfo(1, "S").source
if source:sub(1, 1) == "@" then
source = source:sub(2)
end
return vim.fn.fnamemodify(source, ":p:h")
end
local plugin = vim.env.PI2_E2E_PLUGIN or "/home/yuez/Workspace/Neovim/pi2.nvim-web"
local attention_ext = here() .. "/attention-ext.ts"
assert(vim.fn.filereadable(attention_ext) == 1, "e2e attention extension missing: " .. attention_ext)
vim.opt.runtimepath:prepend(plugin)
vim.opt.swapfile = false
vim.opt.shadafile = "NONE"
vim.g.mapleader = " "
require("pi").setup({
web = { enabled = true, log = true, auto_start = false },
cli = { args = { "--extension", attention_ext } },
})