clawborrator-cli 0.0.6 → 0.0.8

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,22 @@ 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 data = await api.get("/api/v1/sessions");
6880
+ const match = data.items.find((s) => s.routingName === sessionId);
6881
+ if (!match) {
6882
+ console.error(`error: no session with routing name ${sessionId} (run \`claw session list\` to see what's available)`);
6883
+ process.exit(2);
6884
+ }
6885
+ sessionId = match.id;
6886
+ }
6877
6887
  const wsUrl = cfg.hubUrl.replace(/^http/i, "ws") + "/cli";
6878
6888
  const ws = new wrapper_default(wsUrl, {
6879
6889
  headers: { Authorization: `Bearer ${cfg.pat}` }
@@ -7267,6 +7277,17 @@ function fmtDuration(ms) {
7267
7277
  function fmtAgo(iso) {
7268
7278
  return fmtDuration(Date.now() - new Date(iso).getTime());
7269
7279
  }
7280
+ async function resolveSessionId(idOrName) {
7281
+ if (!idOrName.startsWith("@")) return idOrName;
7282
+ const data = await api.get("/api/v1/sessions");
7283
+ const match = data.items.find((s) => s.routingName === idOrName);
7284
+ if (!match) {
7285
+ const err = new Error(`no session with routing name ${idOrName} (run \`claw session list\` to see what's available)`);
7286
+ err.code = "CLW_NO_ROUTING_MATCH";
7287
+ throw err;
7288
+ }
7289
+ return match.id;
7290
+ }
7270
7291
  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
7292
  const qs = new URLSearchParams();
7272
7293
  if (opts.connected) qs.set("connected", "true");
@@ -7286,9 +7307,15 @@ var sessionList = new Command("list").alias("ls").description("list sessions you
7286
7307
  const seen = s.connected ? "online" : `offline \xB7 ${fmtAgo(s.lastSeenAt)}`;
7287
7308
  const arch = s.archivedAt ? " \xB7 ARCHIVED" : "";
7288
7309
  console.log(`${dot} ${route.padEnd(20)} ${role} @${s.startedByLogin}${where} [${seen}]${arch}`);
7310
+ console.log(` id: ${s.id}`);
7289
7311
  }
7312
+ console.log("");
7313
+ console.log(" use: claw session attach @<routing> OR claw session attach <id>");
7314
+ console.log(" claw session events <ref> \u2014 recent hook/chat events");
7315
+ console.log(" claw session messages <ref> \u2014 operator-to-operator chat");
7290
7316
  });
7291
- var sessionInfo = new Command("info").description("show metadata for a single session").argument("<id>", "session UUID").action(async (id) => {
7317
+ var sessionInfo = new Command("info").description("show metadata for a single session").argument("<ref>", "session UUID or @routingName").action(async (ref) => {
7318
+ const id = await resolveSessionId(ref);
7292
7319
  const s = await api.get(`/api/v1/sessions/${encodeURIComponent(id)}`);
7293
7320
  console.log(`session : ${s.id}`);
7294
7321
  console.log(`routing : ${s.routingName ?? "(none)"}`);
@@ -7301,11 +7328,12 @@ var sessionInfo = new Command("info").description("show metadata for a single se
7301
7328
  console.log(`last seen: ${s.lastSeenAt}`);
7302
7329
  console.log(`status : ${s.connected ? "connected" : "offline"}${s.archivedAt ? " \xB7 ARCHIVED" : ""}`);
7303
7330
  });
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) => {
7331
+ 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
7332
  if (opts.after && opts.before) {
7306
7333
  console.error("error: use --after OR --before, not both");
7307
7334
  process.exit(2);
7308
7335
  }
7336
+ const id = await resolveSessionId(ref);
7309
7337
  const qs = new URLSearchParams({ limit: opts.limit ?? "200" });
7310
7338
  if (opts.after) qs.set("after", opts.after);
7311
7339
  if (opts.before) qs.set("before", opts.before);
@@ -7332,11 +7360,12 @@ var sessionEvents = new Command("events").description("dump recent events for a
7332
7360
  console.log(`(more \u2014 older: --before ${data.firstId} \xB7 newer: --after ${data.lastId})`);
7333
7361
  }
7334
7362
  });
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) => {
7363
+ 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
7364
  if (opts.after && opts.before) {
7337
7365
  console.error("error: use --after OR --before, not both");
7338
7366
  process.exit(2);
7339
7367
  }
7368
+ const id = await resolveSessionId(ref);
7340
7369
  const qs = new URLSearchParams({ limit: opts.limit ?? "100" });
7341
7370
  if (opts.after) qs.set("after", opts.after);
7342
7371
  if (opts.before) qs.set("before", opts.before);
@@ -7568,7 +7597,7 @@ var webhookCmd = new Command("webhook").description("manage webhook subscription
7568
7597
 
7569
7598
  // src/index.ts
7570
7599
  var program2 = new Command();
7571
- program2.name("claw").description("clawborrator CLI \u2014 control your Claude Code sessions from the terminal").version("0.0.6");
7600
+ program2.name("claw").description("clawborrator CLI \u2014 control your Claude Code sessions from the terminal").version("0.0.8");
7572
7601
  program2.addCommand(loginCmd);
7573
7602
  program2.addCommand(logoutCmd);
7574
7603
  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.8",
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",