clawborrator-cli 0.0.6 → 0.0.7

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.
@@ -6868,12 +6868,23 @@ var GREEN = "\x1B[32m";
6868
6868
  function ts() {
6869
6869
  return (/* @__PURE__ */ new Date()).toLocaleTimeString();
6870
6870
  }
6871
- var sessionAttach = new Command("attach").description("open a TUI on a session \u2014 see the chat stream, post op-messages").argument("<sessionId>", "session UUID").action(async (sessionId) => {
6871
+ var sessionAttach = new Command("attach").description("open a TUI on a session \u2014 see the chat stream, post op-messages").argument("<ref>", "session UUID or @routingName (e.g. @driver)").action(async (ref) => {
6872
6872
  const cfg = loadConfig();
6873
6873
  if (!cfg.pat) {
6874
6874
  console.error("error: not logged in. run `claw login`.");
6875
6875
  process.exit(2);
6876
6876
  }
6877
+ let sessionId = ref;
6878
+ if (sessionId.startsWith("@")) {
6879
+ const wanted = sessionId.slice(1);
6880
+ const data = await api.get("/api/v1/sessions");
6881
+ const match = data.items.find((s) => s.routingName === wanted);
6882
+ if (!match) {
6883
+ console.error(`error: no session with routing name @${wanted} (run \`claw session list\` to see what's available)`);
6884
+ process.exit(2);
6885
+ }
6886
+ sessionId = match.id;
6887
+ }
6877
6888
  const wsUrl = cfg.hubUrl.replace(/^http/i, "ws") + "/cli";
6878
6889
  const ws = new wrapper_default(wsUrl, {
6879
6890
  headers: { Authorization: `Bearer ${cfg.pat}` }
@@ -7267,6 +7278,18 @@ function fmtDuration(ms) {
7267
7278
  function fmtAgo(iso) {
7268
7279
  return fmtDuration(Date.now() - new Date(iso).getTime());
7269
7280
  }
7281
+ async function resolveSessionId(idOrName) {
7282
+ if (!idOrName.startsWith("@")) return idOrName;
7283
+ const wanted = idOrName.slice(1);
7284
+ const data = await api.get("/api/v1/sessions");
7285
+ const match = data.items.find((s) => s.routingName === wanted);
7286
+ if (!match) {
7287
+ const err = new Error(`no session with routing name @${wanted} (run \`claw session list\` to see what's available)`);
7288
+ err.code = "CLW_NO_ROUTING_MATCH";
7289
+ throw err;
7290
+ }
7291
+ return match.id;
7292
+ }
7270
7293
  var sessionList = new Command("list").alias("ls").description("list sessions you can see").option("--connected", "only sessions whose channel WS is currently open").option("--all", "include archived sessions").action(async (opts) => {
7271
7294
  const qs = new URLSearchParams();
7272
7295
  if (opts.connected) qs.set("connected", "true");
@@ -7286,9 +7309,15 @@ var sessionList = new Command("list").alias("ls").description("list sessions you
7286
7309
  const seen = s.connected ? "online" : `offline \xB7 ${fmtAgo(s.lastSeenAt)}`;
7287
7310
  const arch = s.archivedAt ? " \xB7 ARCHIVED" : "";
7288
7311
  console.log(`${dot} ${route.padEnd(20)} ${role} @${s.startedByLogin}${where} [${seen}]${arch}`);
7312
+ console.log(` id: ${s.id}`);
7289
7313
  }
7314
+ console.log("");
7315
+ console.log(" use: claw session attach @<routing> OR claw session attach <id>");
7316
+ console.log(" claw session events <ref> \u2014 recent hook/chat events");
7317
+ console.log(" claw session messages <ref> \u2014 operator-to-operator chat");
7290
7318
  });
7291
- var sessionInfo = new Command("info").description("show metadata for a single session").argument("<id>", "session UUID").action(async (id) => {
7319
+ var sessionInfo = new Command("info").description("show metadata for a single session").argument("<ref>", "session UUID or @routingName").action(async (ref) => {
7320
+ const id = await resolveSessionId(ref);
7292
7321
  const s = await api.get(`/api/v1/sessions/${encodeURIComponent(id)}`);
7293
7322
  console.log(`session : ${s.id}`);
7294
7323
  console.log(`routing : ${s.routingName ?? "(none)"}`);
@@ -7301,11 +7330,12 @@ var sessionInfo = new Command("info").description("show metadata for a single se
7301
7330
  console.log(`last seen: ${s.lastSeenAt}`);
7302
7331
  console.log(`status : ${s.connected ? "connected" : "offline"}${s.archivedAt ? " \xB7 ARCHIVED" : ""}`);
7303
7332
  });
7304
- var sessionEvents = new Command("events").description("dump recent events for a session (history; non-TUI)").argument("<id>", "session UUID").option("--limit <n>", "max events to return (default 200, max 1000)", "200").option("--after <id>", "forward pagination: events with id > given").option("--before <id>", "backward pagination: events with id < given").option("--kind <k>", "filter to chat or tail").option("--type <t>", "filter by type (e.g. PreToolUse, reply)").option("--json", "emit one JSON object per line instead of human-readable").action(async (id, opts) => {
7333
+ var sessionEvents = new Command("events").description("dump recent events for a session (history; non-TUI)").argument("<ref>", "session UUID or @routingName").option("--limit <n>", "max events to return (default 200, max 1000)", "200").option("--after <id>", "forward pagination: events with id > given").option("--before <id>", "backward pagination: events with id < given").option("--kind <k>", "filter to chat or tail").option("--type <t>", "filter by type (e.g. PreToolUse, reply)").option("--json", "emit one JSON object per line instead of human-readable").action(async (ref, opts) => {
7305
7334
  if (opts.after && opts.before) {
7306
7335
  console.error("error: use --after OR --before, not both");
7307
7336
  process.exit(2);
7308
7337
  }
7338
+ const id = await resolveSessionId(ref);
7309
7339
  const qs = new URLSearchParams({ limit: opts.limit ?? "200" });
7310
7340
  if (opts.after) qs.set("after", opts.after);
7311
7341
  if (opts.before) qs.set("before", opts.before);
@@ -7332,11 +7362,12 @@ var sessionEvents = new Command("events").description("dump recent events for a
7332
7362
  console.log(`(more \u2014 older: --before ${data.firstId} \xB7 newer: --after ${data.lastId})`);
7333
7363
  }
7334
7364
  });
7335
- var sessionMessages = new Command("messages").alias("msgs").description("dump operator-to-operator chat for a session (op-messages history)").argument("<id>", "session UUID").option("--limit <n>", "max messages to return (default 100, max 500)", "100").option("--after <id>", "forward pagination").option("--before <id>", "backward pagination").option("--json", "emit one JSON object per line").action(async (id, opts) => {
7365
+ var sessionMessages = new Command("messages").alias("msgs").description("dump operator-to-operator chat for a session (op-messages history)").argument("<ref>", "session UUID or @routingName").option("--limit <n>", "max messages to return (default 100, max 500)", "100").option("--after <id>", "forward pagination").option("--before <id>", "backward pagination").option("--json", "emit one JSON object per line").action(async (ref, opts) => {
7336
7366
  if (opts.after && opts.before) {
7337
7367
  console.error("error: use --after OR --before, not both");
7338
7368
  process.exit(2);
7339
7369
  }
7370
+ const id = await resolveSessionId(ref);
7340
7371
  const qs = new URLSearchParams({ limit: opts.limit ?? "100" });
7341
7372
  if (opts.after) qs.set("after", opts.after);
7342
7373
  if (opts.before) qs.set("before", opts.before);
@@ -7568,7 +7599,7 @@ var webhookCmd = new Command("webhook").description("manage webhook subscription
7568
7599
 
7569
7600
  // src/index.ts
7570
7601
  var program2 = new Command();
7571
- program2.name("claw").description("clawborrator CLI \u2014 control your Claude Code sessions from the terminal").version("0.0.6");
7602
+ program2.name("claw").description("clawborrator CLI \u2014 control your Claude Code sessions from the terminal").version("0.0.7");
7572
7603
  program2.addCommand(loginCmd);
7573
7604
  program2.addCommand(logoutCmd);
7574
7605
  program2.addCommand(whoamiCmd);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawborrator-cli",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
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",