@bivy/bivy 0.2.0-staging.30 → 0.2.0-staging.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/bivy.mjs +49 -1
- package/package.json +1 -1
package/bin/bivy.mjs
CHANGED
|
@@ -1527,7 +1527,7 @@ async function cmdExec(args = []) {
|
|
|
1527
1527
|
function cmdCompletions(args = []) {
|
|
1528
1528
|
const shell = (args[0] || "").toLowerCase();
|
|
1529
1529
|
const commands = [
|
|
1530
|
-
"run", "sessions", "ls", "resume", "promote", "nodes", "agents", "agents:install", "shim", "takeover", "token", "exec",
|
|
1530
|
+
"run", "sessions", "ls", "resume", "promote", "rename", "nodes", "agents", "agents:install", "shim", "takeover", "token", "exec",
|
|
1531
1531
|
"send", "kill", "setup", "start", "stop", "restart", "status", "doctor", "logs", "login",
|
|
1532
1532
|
"update", "update:log", "open", "service", "secrets", "voice", "link", "relay:setup",
|
|
1533
1533
|
"github:connect", "github:app-create", "github:app-connect", "github:app-sync", "prune", "uninstall", "help", "version",
|
|
@@ -1908,6 +1908,49 @@ async function cmdPromote(args = []) {
|
|
|
1908
1908
|
}
|
|
1909
1909
|
}
|
|
1910
1910
|
|
|
1911
|
+
// `bivy rename <name>` — rename THIS node. Runs against the local daemon, which
|
|
1912
|
+
// persists the name to .bivy/node.json and live-updates relay/work-queue routing
|
|
1913
|
+
// (no restart needed). If the name collides on your account the control plane
|
|
1914
|
+
// auto-adjusts it for uniqueness, so we re-read the node info afterward to show
|
|
1915
|
+
// the name that actually stuck. Alias: node:rename.
|
|
1916
|
+
async function cmdRename(args = []) {
|
|
1917
|
+
if (args.includes("-h") || args.includes("--help")) {
|
|
1918
|
+
console.log('Usage: bivy rename <name>\n\nRename this node. Takes effect immediately (no restart). If the name is already used by another node on your account, it is auto-adjusted to stay unique.');
|
|
1919
|
+
return;
|
|
1920
|
+
}
|
|
1921
|
+
if (!(await ensureDeps())) process.exit(1);
|
|
1922
|
+
// Node names may contain spaces, so join all positional (non-flag) args rather
|
|
1923
|
+
// than taking only the first. The daemon trims/collapses whitespace and caps
|
|
1924
|
+
// the length; we just forward the raw text.
|
|
1925
|
+
const name = args.filter((a) => !a.startsWith("-")).join(" ").trim();
|
|
1926
|
+
if (!name) { console.error(c.red("Usage: bivy rename <name>")); process.exit(1); return; }
|
|
1927
|
+
|
|
1928
|
+
const config = loadConfig();
|
|
1929
|
+
if (!(await ensureNodeRunning(config))) { console.error(c.red(`Could not start the Bivy node at ${url(config)}.`)); process.exit(1); return; }
|
|
1930
|
+
let token;
|
|
1931
|
+
try { token = await localDeviceToken(config); }
|
|
1932
|
+
catch (error) { console.error(c.red(error?.message || String(error))); process.exit(1); return; }
|
|
1933
|
+
|
|
1934
|
+
const base = url(config);
|
|
1935
|
+
const prev = await fetchJson(base, "/api/node/info", token).then((d) => d?.name).catch(() => undefined);
|
|
1936
|
+
const res = await fetch(`${base}/api/node/name`, {
|
|
1937
|
+
method: "POST",
|
|
1938
|
+
headers: { authorization: `Bearer ${token}`, "content-type": "application/json" },
|
|
1939
|
+
body: JSON.stringify({ name }),
|
|
1940
|
+
});
|
|
1941
|
+
if (!res.ok) {
|
|
1942
|
+
const data = await res.json().catch(() => ({}));
|
|
1943
|
+
console.error(c.red(`Rename failed (${res.status}): ${data.error || "unknown error"}`));
|
|
1944
|
+
process.exit(1);
|
|
1945
|
+
return;
|
|
1946
|
+
}
|
|
1947
|
+
const data = await res.json().catch(() => ({}));
|
|
1948
|
+
const applied = data.name || name;
|
|
1949
|
+
if (prev && prev !== applied) console.log(c.green(`Renamed node: ${c.dim(prev)} → ${applied}`));
|
|
1950
|
+
else console.log(c.green(`Node name set to "${applied}".`));
|
|
1951
|
+
if (applied !== name) console.log(c.dim(`(Adjusted from "${name}" to stay unique on your account.)`));
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1911
1954
|
// `bivy send <id> "<message>"` — send a prompt to an existing session and stream
|
|
1912
1955
|
// the reply. Thin wrapper over the headless exec client with --session.
|
|
1913
1956
|
// Deliberately does NOT intercept -h/--help (see cmdExec above) — the message
|
|
@@ -3968,6 +4011,7 @@ ${c.bold("bivy")} — Bivy node CLI
|
|
|
3968
4011
|
${c.cyan("bivy run <agent> --node <name>")} Start the session on another registered node
|
|
3969
4012
|
${c.cyan("bivy run <agent> --clone [remote]")} Start in a fresh clone (current repo, or a given remote)
|
|
3970
4013
|
${c.cyan("bivy run <agent> --workspace <dir>")} Start in an existing directory (default: current repo, else the configured workspace)
|
|
4014
|
+
${c.cyan("bivy rename <name>")} Rename this node (takes effect immediately, no restart)
|
|
3971
4015
|
${c.cyan("bivy nodes")} List/add/remove other nodes (add <name> <url> --token <t>)
|
|
3972
4016
|
${c.cyan("bivy agents")} List the supported agents and which are installed (--json)
|
|
3973
4017
|
${c.cyan("bivy shim install <agent>")} Make interactive '<agent>' launch its native TUI in a Bivy PTY (remote-visible)
|
|
@@ -4051,6 +4095,10 @@ An agent's own --help passes through, e.g. 'bivy run claude --help'.`);
|
|
|
4051
4095
|
case "promote":
|
|
4052
4096
|
await cmdPromote(args);
|
|
4053
4097
|
break;
|
|
4098
|
+
case "rename":
|
|
4099
|
+
case "node:rename":
|
|
4100
|
+
await cmdRename(args);
|
|
4101
|
+
break;
|
|
4054
4102
|
case "nodes":
|
|
4055
4103
|
await cmdNodes(args);
|
|
4056
4104
|
break;
|
package/package.json
CHANGED