clawborrator-cli 0.2.14 → 0.2.15

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.
@@ -69435,9 +69435,60 @@ function fmtAgo4(iso) {
69435
69435
  return Math.floor(ms / 864e5) + "d ago";
69436
69436
  }
69437
69437
 
69438
+ // src/commands/auth-sessions.ts
69439
+ function shortUserAgent(ua) {
69440
+ if (!ua) return "(unknown)";
69441
+ if (ua.includes("clawborrator-cli")) return "clawborrator-cli";
69442
+ if (ua.includes("clawborrator-supervisor")) return "clawborrator-supervisor";
69443
+ const isMobile = /\b(iPhone|iPad|Android|Mobile)\b/.test(ua);
69444
+ let browser = "Browser";
69445
+ if (/\bCriOS\//.test(ua)) browser = "Chrome";
69446
+ else if (/\bEdg\//.test(ua)) browser = "Edge";
69447
+ else if (/\bFirefox\//.test(ua)) browser = "Firefox";
69448
+ else if (/\bChrome\//.test(ua) && !/\bEdg\//.test(ua)) browser = "Chrome";
69449
+ else if (/\bSafari\//.test(ua) && !/\bChrome\//.test(ua)) browser = "Safari";
69450
+ let os3 = "Unknown";
69451
+ if (/\bWindows NT\b/.test(ua)) os3 = "Windows";
69452
+ else if (/\bMacintosh\b/.test(ua)) os3 = "macOS";
69453
+ else if (/\bLinux\b/.test(ua) && !/\bAndroid\b/.test(ua)) os3 = "Linux";
69454
+ else if (/\bAndroid\b/.test(ua)) os3 = "Android";
69455
+ else if (/\biPhone\b|\biPad\b/.test(ua)) os3 = "iOS";
69456
+ return `${browser} on ${os3}${isMobile && !/\biPhone|\biPad|\bAndroid\b/.test(ua) ? " (mobile)" : ""}`;
69457
+ }
69458
+ function fmtAgo5(iso) {
69459
+ const ms = Date.now() - new Date(iso).getTime();
69460
+ if (ms < 6e4) return Math.max(1, Math.floor(ms / 1e3)) + "s ago";
69461
+ if (ms < 36e5) return Math.floor(ms / 6e4) + "m ago";
69462
+ if (ms < 864e5) return Math.floor(ms / 36e5) + "h ago";
69463
+ return Math.floor(ms / 864e5) + "d ago";
69464
+ }
69465
+ var authSessionsList = new Command("list").alias("ls").description("list this user's hub auth_sessions (cookie + CLI bearer). The row used to authenticate THIS request is flagged with \u2190current.").option("--all", "include revoked sessions").action(async (opts) => {
69466
+ const qs = opts.all ? "?includeRevoked=true" : "";
69467
+ const data = await api.get("/api/v1/auth-sessions" + qs);
69468
+ if (data.items.length === 0) {
69469
+ console.log("no auth_sessions");
69470
+ return;
69471
+ }
69472
+ for (const a of data.items) {
69473
+ const status = a.revokedAt ? "REVOKED" : "active";
69474
+ const cur = a.isCurrent ? " \u2190current" : "";
69475
+ const used = `last ${fmtAgo5(a.lastUsedAt)}`;
69476
+ const ua = shortUserAgent(a.userAgent).padEnd(30);
69477
+ const mach = a.machineId ? ` mach=${a.machineId.slice(0, 12)}\u2026` : "";
69478
+ console.log(`${a.id.slice(0, 12)}\u2026 ${a.source.padEnd(4)} ${ua} ${used.padEnd(14)} ${status}${cur}${mach}`);
69479
+ }
69480
+ });
69481
+ var authSessionsRevoke = new Command("revoke").description("revoke an auth_session by id or unique id-prefix (\u22654 hex chars). Cannot revoke the row used by this CLI session \u2014 use `claw logout` for that.").argument("<idPrefix>", "sha256 id or unique prefix from `claw auth-sessions list`").action(async (idPrefix) => {
69482
+ const out = await api.post(
69483
+ `/api/v1/auth-sessions/${encodeURIComponent(idPrefix)}/revoke`
69484
+ );
69485
+ console.log(`\u2713 revoked ${out.id.slice(0, 12)}\u2026`);
69486
+ });
69487
+ var authSessionsCmd = new Command("auth-sessions").alias("auth").description("list + revoke hub-issued auth_sessions (the cookie / CLI bearer credentials minted via OAuth). Different from `claw token` (channel + app tokens).").addCommand(authSessionsList).addCommand(authSessionsRevoke);
69488
+
69438
69489
  // src/index.ts
69439
69490
  var program2 = new Command();
69440
- program2.name("claw").description("clawborrator CLI \u2014 control your Claude Code sessions from the terminal").version("0.2.14");
69491
+ program2.name("claw").description("clawborrator CLI \u2014 control your Claude Code sessions from the terminal").version("0.2.15");
69441
69492
  program2.addCommand(loginCmd);
69442
69493
  program2.addCommand(logoutCmd);
69443
69494
  program2.addCommand(whoamiCmd);
@@ -69450,6 +69501,7 @@ program2.addCommand(webhookCmd);
69450
69501
  program2.addCommand(agentsCmd);
69451
69502
  program2.addCommand(appsCmd);
69452
69503
  program2.addCommand(desktopCmd);
69504
+ program2.addCommand(authSessionsCmd);
69453
69505
  program2.parseAsync(process.argv).catch((err) => {
69454
69506
  console.error(err.message ?? err);
69455
69507
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawborrator-cli",
3
- "version": "0.2.14",
3
+ "version": "0.2.15",
4
4
  "type": "module",
5
5
  "description": "claw — command-line client for clawborrator. Attach to remote Claude Code sessions, send prompts, resolve permission gates, route across sessions, manage public agents and webhooks. Auth via GitHub OAuth + PKCE.",
6
6
  "license": "MIT",