clawborrator-cli 0.0.17 → 0.0.19

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.
@@ -7449,7 +7449,48 @@ var sessionPrompt = new Command("prompt").description("send a one-shot prompt to
7449
7449
  });
7450
7450
  });
7451
7451
  });
7452
- var sessionCmd = new Command("session").description("manage Claude Code sessions registered with this hub").addCommand(sessionList).addCommand(sessionInfo).addCommand(sessionAttach).addCommand(sessionEvents).addCommand(sessionMessages).addCommand(sessionArchive).addCommand(sessionPrune).addCommand(sessionPrompt).addCommand(sessionDelete);
7452
+ var VALID_ROLES = ["viewer", "prompter", "approver"];
7453
+ var sessionShareCmd = new Command("share").description("grant another GitHub user access to a session. role defaults to prompter (viewer = read-only events; prompter = + send prompts/op-messages; approver = + resolve permission requests).").argument("<ref>", "session UUID or @routingName").argument("<login>", "GitHub login of the user to share with (with or without leading @)").option("--role <role>", `viewer | prompter | approver`, "prompter").action(async (ref, login, opts) => {
7454
+ const role = (opts.role ?? "prompter").toLowerCase();
7455
+ if (!VALID_ROLES.includes(role)) {
7456
+ console.error(`error: --role must be one of: ${VALID_ROLES.join(", ")}`);
7457
+ process.exit(2);
7458
+ }
7459
+ const id = await resolveSessionId(ref);
7460
+ const cleanLogin = login.replace(/^@/, "");
7461
+ const out = await api.post(
7462
+ `/api/v1/sessions/${encodeURIComponent(id)}/shares`,
7463
+ { login: cleanLogin, role }
7464
+ );
7465
+ console.log(`\u2713 shared ${out.sessionId.slice(0, 8)}\u2026 with @${out.login} as ${out.role}`);
7466
+ console.log(` they can now: claw session attach ${id} (or @${out.login}/<slug> from their attach)`);
7467
+ });
7468
+ var sessionSharesCmd = new Command("shares").description("list users granted access to a session via share. Owner-only view.").argument("<ref>", "session UUID or @routingName").action(async (ref) => {
7469
+ const id = await resolveSessionId(ref);
7470
+ const out = await api.get(
7471
+ `/api/v1/sessions/${encodeURIComponent(id)}/shares`
7472
+ );
7473
+ if (out.items.length === 0) {
7474
+ console.log("(no shares \u2014 only the owner has access)");
7475
+ return;
7476
+ }
7477
+ for (const s of out.items) {
7478
+ console.log(` @${s.login.padEnd(20)} ${s.role.padEnd(9)} since ${s.createdAt}`);
7479
+ }
7480
+ });
7481
+ var sessionUnshareCmd = new Command("unshare").description("revoke a user's share access to a session. Owner-only.").argument("<ref>", "session UUID or @routingName").argument("<login>", "GitHub login (with or without leading @)").action(async (ref, login) => {
7482
+ const id = await resolveSessionId(ref);
7483
+ const cleanLogin = login.replace(/^@/, "");
7484
+ const out = await api.delete(
7485
+ `/api/v1/sessions/${encodeURIComponent(id)}/shares/${encodeURIComponent(cleanLogin)}`
7486
+ );
7487
+ if (out.removed === 0) {
7488
+ console.log(`(no share to revoke \u2014 @${out.login} didn't have access)`);
7489
+ } else {
7490
+ console.log(`\u2717 revoked @${out.login}'s access to ${out.sessionId.slice(0, 8)}\u2026`);
7491
+ }
7492
+ });
7493
+ var sessionCmd = new Command("session").description("manage Claude Code sessions registered with this hub").addCommand(sessionList).addCommand(sessionInfo).addCommand(sessionAttach).addCommand(sessionEvents).addCommand(sessionMessages).addCommand(sessionArchive).addCommand(sessionPrune).addCommand(sessionPrompt).addCommand(sessionDelete).addCommand(sessionShareCmd).addCommand(sessionSharesCmd).addCommand(sessionUnshareCmd);
7453
7494
 
7454
7495
  // src/commands/token.ts
7455
7496
  var import_node_fs2 = require("node:fs");
@@ -7581,19 +7622,29 @@ var peersCmd = new Command("peers").description("list your sessions reachable fo
7581
7622
  console.log(`${dot} ${p.routingName.padEnd(20)} ${p.online ? "online" : "offline"}${where}`);
7582
7623
  }
7583
7624
  });
7584
- var routeCmd = new Command("route").description("send a one-shot prompt to a peer session").argument("<peer>", "@routingName (e.g. @foo)").argument("<prompt>", "text to send (quote it to keep spaces)").option("--mode <mode>", "ask | tell (default ask)", "ask").action(async (peer, prompt, opts) => {
7625
+ var routeCmd = new Command("route").description("send a one-shot prompt to a peer session; ask mode (default) blocks for the reply, tell mode is fire-and-forget").argument("<peer>", "routingName (e.g. @foo, foo, @owner/foo)").argument("<prompt>", "text to send (quote it to keep spaces)").option("--mode <mode>", "ask | tell", "ask").action(async (peer, prompt, opts) => {
7585
7626
  const mode = opts.mode === "tell" ? "tell" : "ask";
7586
7627
  const out = await api.post(
7587
7628
  `/api/v1/peers/${encodeURIComponent(peer)}/route`,
7588
7629
  { prompt, mode }
7589
7630
  );
7590
- console.log(`\u2713 routed to ${peer}`);
7591
- console.log(` chatId: ${out.chatId}`);
7592
- console.log(` sessionId: ${out.sessionId}`);
7593
- console.log(` mode: ${mode}`);
7594
- if (mode === "ask") {
7595
- console.log(" (reply correlation arrives in channel Phase D \u2014 for now poll `claw session attach` to watch)");
7631
+ console.log(`\u2713 routed to ${peer} (chatId ${out.chatId.slice(0, 8)}\u2026)`);
7632
+ if (mode === "tell") {
7633
+ console.log(" mode: tell (fire-and-forget). Watch the reply in `claw session attach` if needed.");
7634
+ return;
7596
7635
  }
7636
+ if (out.ok && out.reply !== void 0) {
7637
+ console.log("");
7638
+ console.log(out.reply);
7639
+ return;
7640
+ }
7641
+ if (out.timedOut) {
7642
+ console.error(`error: ${out.error}`);
7643
+ console.error(" (the peer may still answer later \u2014 `claw session events " + peer + "` will show it if it lands)");
7644
+ process.exit(2);
7645
+ }
7646
+ console.error(`error: ${out.error ?? "no reply"}`);
7647
+ process.exit(2);
7597
7648
  });
7598
7649
  var probeCmd = new Command("probe").description("fan-out the same prompt to many peers in parallel").argument("<prompt>", "text to send (quote it)").option("--peers <csv>", "comma-separated routing names; default = all online peers").action(async (prompt, opts) => {
7599
7650
  const peerList = opts.peers ? opts.peers.split(",").map((s) => s.trim()).filter(Boolean) : null;
@@ -7657,7 +7708,7 @@ var webhookCmd = new Command("webhook").description("manage webhook subscription
7657
7708
 
7658
7709
  // src/index.ts
7659
7710
  var program2 = new Command();
7660
- program2.name("claw").description("clawborrator CLI \u2014 control your Claude Code sessions from the terminal").version("0.0.17");
7711
+ program2.name("claw").description("clawborrator CLI \u2014 control your Claude Code sessions from the terminal").version("0.0.19");
7661
7712
  program2.addCommand(loginCmd);
7662
7713
  program2.addCommand(logoutCmd);
7663
7714
  program2.addCommand(whoamiCmd);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawborrator-cli",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "type": "module",
5
5
  "description": "claw — command-line client for clawborrator hub_v1. Manages PATs, channel tokens, sessions, cross-session routing, and webhooks; ships an inline TUI for live multi-operator session attach.",
6
6
  "license": "MIT",