fix: prefer node service naming
This commit is contained in:
@@ -46,7 +46,7 @@ type NodeDaemonStatusOptions = {
|
||||
};
|
||||
|
||||
function renderNodeServiceStartHints(): string[] {
|
||||
const base = ["clawdbot node daemon install", "clawdbot node start"];
|
||||
const base = ["clawdbot node service install", "clawdbot node start"];
|
||||
switch (process.platform) {
|
||||
case "darwin":
|
||||
return [
|
||||
@@ -133,7 +133,7 @@ export async function runNodeDaemonInstall(opts: NodeDaemonInstallOptions) {
|
||||
};
|
||||
|
||||
if (resolveIsNixMode(process.env)) {
|
||||
fail("Nix mode detected; daemon install is disabled.");
|
||||
fail("Nix mode detected; service install is disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ export async function runNodeDaemonInstall(opts: NodeDaemonInstallOptions) {
|
||||
});
|
||||
if (!json) {
|
||||
defaultRuntime.log(`Node service already ${service.loadedText}.`);
|
||||
defaultRuntime.log("Reinstall with: clawdbot node daemon install --force");
|
||||
defaultRuntime.log("Reinstall with: clawdbot node service install --force");
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -244,7 +244,7 @@ export async function runNodeDaemonUninstall(opts: NodeDaemonLifecycleOptions =
|
||||
};
|
||||
|
||||
if (resolveIsNixMode(process.env)) {
|
||||
fail("Nix mode detected; daemon uninstall is disabled.");
|
||||
fail("Nix mode detected; service uninstall is disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,71 +51,71 @@ export function registerNodeCli(program: Command) {
|
||||
});
|
||||
});
|
||||
|
||||
const registerNodeServiceCommands = (cmd: Command) => {
|
||||
cmd
|
||||
.command("status")
|
||||
.description("Show node service status")
|
||||
.option("--json", "Output JSON", false)
|
||||
.action(async (opts) => {
|
||||
await runNodeDaemonStatus(opts);
|
||||
});
|
||||
|
||||
cmd
|
||||
.command("install")
|
||||
.description("Install the node service (launchd/systemd/schtasks)")
|
||||
.option("--host <host>", "Gateway bridge host")
|
||||
.option("--port <port>", "Gateway bridge port")
|
||||
.option("--tls", "Use TLS for the bridge connection", false)
|
||||
.option("--tls-fingerprint <sha256>", "Expected TLS certificate fingerprint (sha256)")
|
||||
.option("--node-id <id>", "Override node id (clears pairing token)")
|
||||
.option("--display-name <name>", "Override node display name")
|
||||
.option("--runtime <runtime>", "Service runtime (node|bun). Default: node")
|
||||
.option("--force", "Reinstall/overwrite if already installed", false)
|
||||
.option("--json", "Output JSON", false)
|
||||
.action(async (opts) => {
|
||||
await runNodeDaemonInstall(opts);
|
||||
});
|
||||
|
||||
cmd
|
||||
.command("uninstall")
|
||||
.description("Uninstall the node service (launchd/systemd/schtasks)")
|
||||
.option("--json", "Output JSON", false)
|
||||
.action(async (opts) => {
|
||||
await runNodeDaemonUninstall(opts);
|
||||
});
|
||||
|
||||
cmd
|
||||
.command("start")
|
||||
.description("Start the node service (launchd/systemd/schtasks)")
|
||||
.option("--json", "Output JSON", false)
|
||||
.action(async (opts) => {
|
||||
await runNodeDaemonStart(opts);
|
||||
});
|
||||
|
||||
cmd
|
||||
.command("stop")
|
||||
.description("Stop the node service (launchd/systemd/schtasks)")
|
||||
.option("--json", "Output JSON", false)
|
||||
.action(async (opts) => {
|
||||
await runNodeDaemonStop(opts);
|
||||
});
|
||||
|
||||
cmd
|
||||
.command("restart")
|
||||
.description("Restart the node service (launchd/systemd/schtasks)")
|
||||
.option("--json", "Output JSON", false)
|
||||
.action(async (opts) => {
|
||||
await runNodeDaemonRestart(opts);
|
||||
});
|
||||
};
|
||||
|
||||
const service = node
|
||||
.command("service")
|
||||
.description("Manage the headless node service (launchd/systemd/schtasks)");
|
||||
registerNodeServiceCommands(service);
|
||||
|
||||
const daemon = node
|
||||
.command("daemon")
|
||||
.description("Manage the headless node daemon service (launchd/systemd/schtasks)");
|
||||
|
||||
node
|
||||
.command("status")
|
||||
.description("Show node service status")
|
||||
.option("--json", "Output JSON", false)
|
||||
.action(async (opts) => {
|
||||
await runNodeDaemonStatus(opts);
|
||||
});
|
||||
|
||||
daemon
|
||||
.command("status")
|
||||
.description("Show node daemon status")
|
||||
.option("--json", "Output JSON", false)
|
||||
.action(async (opts) => {
|
||||
await runNodeDaemonStatus(opts);
|
||||
});
|
||||
|
||||
daemon
|
||||
.command("install")
|
||||
.description("Install the node daemon service (launchd/systemd/schtasks)")
|
||||
.option("--host <host>", "Gateway bridge host")
|
||||
.option("--port <port>", "Gateway bridge port")
|
||||
.option("--tls", "Use TLS for the bridge connection", false)
|
||||
.option("--tls-fingerprint <sha256>", "Expected TLS certificate fingerprint (sha256)")
|
||||
.option("--node-id <id>", "Override node id (clears pairing token)")
|
||||
.option("--display-name <name>", "Override node display name")
|
||||
.option("--runtime <runtime>", "Daemon runtime (node|bun). Default: node")
|
||||
.option("--force", "Reinstall/overwrite if already installed", false)
|
||||
.option("--json", "Output JSON", false)
|
||||
.action(async (opts) => {
|
||||
await runNodeDaemonInstall(opts);
|
||||
});
|
||||
|
||||
daemon
|
||||
.command("uninstall")
|
||||
.description("Uninstall the node daemon service (launchd/systemd/schtasks)")
|
||||
.option("--json", "Output JSON", false)
|
||||
.action(async (opts) => {
|
||||
await runNodeDaemonUninstall(opts);
|
||||
});
|
||||
|
||||
daemon
|
||||
.command("start")
|
||||
.description("Start the node daemon service (launchd/systemd/schtasks)")
|
||||
.option("--json", "Output JSON", false)
|
||||
.action(async (opts) => {
|
||||
await runNodeDaemonStart(opts);
|
||||
});
|
||||
|
||||
daemon
|
||||
.command("stop")
|
||||
.description("Stop the node daemon service (launchd/systemd/schtasks)")
|
||||
.option("--json", "Output JSON", false)
|
||||
.action(async (opts) => {
|
||||
await runNodeDaemonStop(opts);
|
||||
});
|
||||
|
||||
daemon
|
||||
.command("restart")
|
||||
.description("Restart the node daemon service (launchd/systemd/schtasks)")
|
||||
.option("--json", "Output JSON", false)
|
||||
.action(async (opts) => {
|
||||
await runNodeDaemonRestart(opts);
|
||||
});
|
||||
.command("daemon", { hidden: true })
|
||||
.description("Legacy alias for node service commands");
|
||||
registerNodeServiceCommands(daemon);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user