Files
clawdbot/src/cli/nodes-cli/cli-utils.ts
2026-01-19 00:52:31 +00:00

14 lines
536 B
TypeScript

import { defaultRuntime } from "../../runtime.js";
import { runCommandWithRuntime } from "../cli-utils.js";
import { unauthorizedHintForMessage } from "./rpc.js";
export function runNodesCommand(label: string, action: () => Promise<void>) {
return runCommandWithRuntime(defaultRuntime, action, (err) => {
const message = String(err);
defaultRuntime.error(`nodes ${label} failed: ${message}`);
const hint = unauthorizedHintForMessage(message);
if (hint) defaultRuntime.error(hint);
defaultRuntime.exit(1);
});
}