clawborrator-cli 0.0.9 → 0.0.10

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.
@@ -6874,12 +6874,26 @@ var sessionAttach = new Command("attach").description("open a TUI on a session \
6874
6874
  console.error("error: not logged in. run `claw login`.");
6875
6875
  process.exit(2);
6876
6876
  }
6877
+ const UUID_RE2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
6877
6878
  let sessionId = ref;
6878
- if (sessionId.startsWith("@")) {
6879
+ if (!UUID_RE2.test(sessionId)) {
6880
+ const needle = sessionId.startsWith("@") ? sessionId : "@" + sessionId;
6881
+ const slash = needle.indexOf("/");
6882
+ let ownerLogin = null;
6883
+ let slug;
6884
+ if (slash > 0) {
6885
+ ownerLogin = needle.slice(1, slash);
6886
+ slug = "@" + needle.slice(slash + 1).replace(/^@/, "");
6887
+ } else {
6888
+ slug = needle;
6889
+ }
6879
6890
  const data = await api.get("/api/v1/sessions");
6880
- const match = data.items.find((s) => s.routingName === sessionId);
6891
+ const match = data.items.find(
6892
+ (s) => s.routingName === slug && (ownerLogin === null || s.startedByLogin === ownerLogin)
6893
+ );
6881
6894
  if (!match) {
6882
- console.error(`error: no session with routing name ${sessionId} (run \`claw session list\` to see what's available)`);
6895
+ const label = ownerLogin ? `@${ownerLogin}/${slug.slice(1)}` : slug;
6896
+ console.error(`error: no session with routing name ${label} (run \`claw session list\` to see what's available)`);
6883
6897
  process.exit(2);
6884
6898
  }
6885
6899
  sessionId = match.id;
@@ -7125,12 +7139,27 @@ function fmtDuration(ms) {
7125
7139
  function fmtAgo(iso) {
7126
7140
  return fmtDuration(Date.now() - new Date(iso).getTime());
7127
7141
  }
7142
+ var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
7128
7143
  async function resolveSessionId(idOrName) {
7129
- if (!idOrName.startsWith("@")) return idOrName;
7144
+ if (UUID_RE.test(idOrName)) return idOrName;
7145
+ const needle = idOrName.startsWith("@") ? idOrName : "@" + idOrName;
7146
+ const slash = needle.indexOf("/");
7147
+ let ownerLogin = null;
7148
+ let slug;
7149
+ if (slash > 0) {
7150
+ ownerLogin = needle.slice(1, slash);
7151
+ slug = "@" + needle.slice(slash + 1).replace(/^@/, "");
7152
+ } else {
7153
+ slug = needle;
7154
+ }
7130
7155
  const data = await api.get("/api/v1/sessions");
7131
- const match = data.items.find((s) => s.routingName === idOrName);
7156
+ const match = data.items.find(
7157
+ (s) => s.routingName === slug && (ownerLogin === null || s.startedByLogin === ownerLogin)
7158
+ );
7132
7159
  if (!match) {
7133
- const err = new Error(`no session with routing name ${idOrName} (run \`claw session list\` to see what's available)`);
7160
+ const err = new Error(
7161
+ ownerLogin ? `no session @${ownerLogin}/${slug.slice(1)} (run \`claw session list\`)` : `no session with routing name ${slug} (run \`claw session list\`)`
7162
+ );
7134
7163
  err.code = "CLW_NO_ROUTING_MATCH";
7135
7164
  throw err;
7136
7165
  }
@@ -7149,18 +7178,20 @@ var sessionList = new Command("list").alias("ls").description("list sessions you
7149
7178
  }
7150
7179
  for (const s of data.items) {
7151
7180
  const dot = s.connected ? "\u25CF" : "\u25CB";
7152
- const route = s.routingName ?? "(no routing name)";
7181
+ const slug = s.routingName ?? "";
7182
+ const qualified = slug ? `@${s.startedByLogin}/${slug.replace(/^@/, "")}` : "(no routing name)";
7153
7183
  const where = s.cwd ? ` ${s.cwd}` : "";
7154
7184
  const role = s.role.padEnd(8);
7155
7185
  const seen = s.connected ? "online" : `offline \xB7 ${fmtAgo(s.lastSeenAt)}`;
7156
7186
  const arch = s.archivedAt ? " \xB7 ARCHIVED" : "";
7157
- console.log(`${dot} ${route.padEnd(20)} ${role} @${s.startedByLogin}${where} [${seen}]${arch}`);
7187
+ console.log(`${dot} ${qualified.padEnd(28)} ${role}${where} [${seen}]${arch}`);
7158
7188
  console.log(` id: ${s.id}`);
7159
7189
  }
7160
7190
  console.log("");
7161
- console.log(" use: claw session attach @<routing> OR claw session attach <id>");
7162
- console.log(" claw session events <ref> \u2014 recent hook/chat events");
7163
- console.log(" claw session messages <ref> \u2014 operator-to-operator chat");
7191
+ console.log(" attach to a session: claw session attach <ref>");
7192
+ console.log(" recent hook/chat: claw session events <ref>");
7193
+ console.log(" operator-to-op chat: claw session messages <ref>");
7194
+ console.log(" <ref> = UUID, @owner/slug, @slug, or bare slug");
7164
7195
  });
7165
7196
  var sessionInfo = new Command("info").description("show metadata for a single session").argument("<ref>", "session UUID or @routingName").action(async (ref) => {
7166
7197
  const id = await resolveSessionId(ref);
@@ -7445,7 +7476,7 @@ var webhookCmd = new Command("webhook").description("manage webhook subscription
7445
7476
 
7446
7477
  // src/index.ts
7447
7478
  var program2 = new Command();
7448
- program2.name("claw").description("clawborrator CLI \u2014 control your Claude Code sessions from the terminal").version("0.0.9");
7479
+ program2.name("claw").description("clawborrator CLI \u2014 control your Claude Code sessions from the terminal").version("0.0.10");
7449
7480
  program2.addCommand(loginCmd);
7450
7481
  program2.addCommand(logoutCmd);
7451
7482
  program2.addCommand(whoamiCmd);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawborrator-cli",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
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",