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`.
This commit is contained in:
yuez committed 2026-10-22 15:47:48 +08:00
1 parent b02f4e9070
commit 7e780515ac
38 files changed
+295 -232

No files matched your search

+4 -4
View File
@@ -149,7 +149,7 @@ export function checkRuntimeDir(probe: DoctorContext["runtime"]): DoctorCheck {
export function checkCliToken(probe: DoctorContext["cliToken"]): DoctorCheck {
if (!probe.exists) {
return { name: "cli-token", status: "warn", detail: `${probe.path} missing (start pi2d to mint it)` };
return { name: "cli-token", status: "warn", detail: `${probe.path} missing (start the daemon with \`pi2 daemon\`)` };
}
const ok = probe.mode !== undefined && (probe.mode & 0o077) === 0;
return {
@@ -172,13 +172,13 @@ export function checkSocket(probe: DoctorContext["socket"], daemonReachable: boo
export function checkDaemon(probe: DoctorContext["daemon"]): DoctorCheck {
if (!probe.reachable) {
return { name: "daemon", status: "fail", detail: probe.error ?? "not reachable (is pi2d running?)" };
return { name: "daemon", status: "fail", detail: probe.error ?? "not reachable (is the daemon running?)" };
}
return { name: "daemon", status: "ok", detail: `http://127.0.0.1:${probe.port ?? "?"} reachable` };
}
export function checkPort(probe: DoctorContext["port"]): DoctorCheck {
if (probe.bound) return { name: "port", status: "ok", detail: `${probe.configured} bound by pi2d` };
if (probe.bound) return { name: "port", status: "ok", detail: `${probe.configured} bound by the daemon` };
return { name: "port", status: "ok", detail: `${probe.configured} free` };
}
@@ -357,7 +357,7 @@ export async function collectContext(options: DoctorOptions = {}): Promise<Docto
daemon = { reachable: false, error: error instanceof Error ? error.message : String(error) };
}
} else {
daemon = { reachable: false, error: "no daemon reachable (is pi2d running?)" };
daemon = { reachable: false, error: "no daemon reachable (is the daemon running?)" };
}
const serviceManager: DoctorContext["serviceManager"] =