clawborrator-cli 0.0.55 → 0.0.57

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.
@@ -68781,7 +68781,37 @@ var sessionUnshareCmd = new Command("unshare").description("revoke a user's shar
68781
68781
  console.log(`\u2717 revoked @${out.login}'s access to ${out.sessionId.slice(0, 8)}\u2026`);
68782
68782
  }
68783
68783
  });
68784
- 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).addCommand(sessionFiles).addCommand(sessionFileRm);
68784
+ var sessionKill = new Command("kill").description("kill the CC process for a managed session (keeps the session row)").argument("<ref>", "session UUID, @routingName, or @owner/slug").action(async (ref) => {
68785
+ const id = await resolveSessionId(ref, { destructive: true });
68786
+ await api.post(`/api/v1/sessions/${encodeURIComponent(id)}/kill`, {});
68787
+ console.log(`\u2717 killed CC process for ${id.slice(0, 8)}\u2026`);
68788
+ });
68789
+ var sessionRestart = new Command("restart").description("kill + respawn the CC process for a managed session").argument("<ref>", "session UUID, @routingName, or @owner/slug").action(async (ref) => {
68790
+ const id = await resolveSessionId(ref, { destructive: true });
68791
+ const out = await api.post(
68792
+ `/api/v1/sessions/${encodeURIComponent(id)}/restart`,
68793
+ {}
68794
+ );
68795
+ console.log(`\u21BA restarted: ${out.sessionId}`);
68796
+ });
68797
+ var sessionScreenshot = new Command("screenshot").description("print the current rendered terminal frame for a managed session").argument("<ref>", "session UUID, @routingName, or @owner/slug").action(async (ref) => {
68798
+ const id = await resolveSessionId(ref);
68799
+ const out = await api.get(
68800
+ `/api/v1/sessions/${encodeURIComponent(id)}/screenshot`
68801
+ );
68802
+ console.error(`(${out.cols}\xD7${out.rows} terminal \u2014 cursor at ${out.cursor?.row ?? "?"},${out.cursor?.col ?? "?"})`);
68803
+ process.stdout.write(out.text.endsWith("\n") ? out.text : out.text + "\n");
68804
+ });
68805
+ var sessionInput = new Command("input").description("type bytes into a managed session's PTY").argument("<ref>", "session UUID, @routingName, or @owner/slug").argument("<bytes>", "raw bytes to write (UTF-8). use $'\\r' for Enter, etc.").option("--enter", 'append a CR after the bytes (handy for "type a line and submit")').action(async (ref, bytes, opts) => {
68806
+ const id = await resolveSessionId(ref);
68807
+ const payload = opts.enter ? bytes + "\r" : bytes;
68808
+ const out = await api.post(
68809
+ `/api/v1/sessions/${encodeURIComponent(id)}/input`,
68810
+ { bytes: payload }
68811
+ );
68812
+ console.error(`\u2713 wrote ${out.wrote ?? payload.length} bytes`);
68813
+ });
68814
+ 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).addCommand(sessionFiles).addCommand(sessionFileRm).addCommand(sessionKill).addCommand(sessionRestart).addCommand(sessionScreenshot).addCommand(sessionInput);
68785
68815
 
68786
68816
  // src/commands/token.ts
68787
68817
  var import_node_fs2 = require("node:fs");
@@ -69082,8 +69112,11 @@ var import_node_crypto2 = require("node:crypto");
69082
69112
  var import_node_child_process2 = require("node:child_process");
69083
69113
  function fmtAgo3(iso) {
69084
69114
  if (!iso) return "never";
69085
- const ms = Date.now() - new Date(iso).getTime();
69086
- if (!Number.isFinite(ms) || ms < 0) return "\u2014";
69115
+ let s = iso;
69116
+ if (!/[zZ]|[+-]\d{2}:?\d{2}$/.test(s)) s = s.replace(" ", "T") + "Z";
69117
+ const ms = Date.now() - new Date(s).getTime();
69118
+ if (!Number.isFinite(ms)) return "\u2014";
69119
+ if (ms < 0) return "just now";
69087
69120
  if (ms < 6e4) return Math.max(1, Math.floor(ms / 1e3)) + "s ago";
69088
69121
  if (ms < 36e5) return Math.floor(ms / 6e4) + "m ago";
69089
69122
  if (ms < 864e5) return Math.floor(ms / 36e5) + "h ago";
@@ -69284,6 +69317,70 @@ var appsTestOauth = new Command("test-oauth").description("walk the full SPA OAu
69284
69317
  });
69285
69318
  var appsCmd = new Command("apps").description("manage SPA app tokens (kind=app, `cw_app_\u2026`) \u2014 mint, list, revoke, and end-to-end-test the SPA OAuth+PKCE flow").addCommand(appsMint).addCommand(appsList).addCommand(appsRevoke).addCommand(appsTestOauth);
69286
69319
 
69320
+ // src/commands/desktop.ts
69321
+ var desktopList = new Command("list").alias("ls").description("list desktop daemons registered for the current user").action(async () => {
69322
+ const data = await api.get("/api/v1/desktops");
69323
+ if (data.items.length === 0) {
69324
+ console.log("no registered desktops");
69325
+ return;
69326
+ }
69327
+ for (const d of data.items) {
69328
+ const dot = d.online ? "\u25CF" : "\u25CB";
69329
+ const host = d.hostname ?? "(unknown host)";
69330
+ const ver = d.daemonVersion ?? "?";
69331
+ console.log(`${dot} ${d.machineId.slice(0, 8)} ${host.padEnd(24)} v${ver.padEnd(8)} last-seen ${fmtAgo4(d.lastSeenAt)}`);
69332
+ }
69333
+ });
69334
+ var desktopCreate = new Command("create-session").description("ask a desktop daemon to spawn a managed CC session in a folder").argument("<machineId>", "desktop machine id (from `claw desktop list`)").argument("<folder>", "absolute path on the desktop where CC should be spawned").option("--routing-name <name>", "optional routing name for the new session (e.g. @frontend)").action(async (machineId, folder, opts) => {
69335
+ const body = { folder };
69336
+ if (opts.routingName) body.routingName = opts.routingName;
69337
+ const out = await api.post(
69338
+ `/api/v1/desktops/${encodeURIComponent(machineId)}/sessions`,
69339
+ body
69340
+ );
69341
+ console.log(`\u2713 session created: ${out.sessionId}`);
69342
+ });
69343
+ var desktopCmd = new Command("desktop").description("inspect + control desktop daemons (clawborrator-supervisor)").addCommand(desktopList).addCommand(desktopCreate);
69344
+ function fmtAgo4(iso) {
69345
+ const ms = Date.now() - new Date(iso).getTime();
69346
+ if (ms < 6e4) return Math.max(1, Math.floor(ms / 1e3)) + "s ago";
69347
+ if (ms < 36e5) return Math.floor(ms / 6e4) + "m ago";
69348
+ if (ms < 864e5) return Math.floor(ms / 36e5) + "h ago";
69349
+ return Math.floor(ms / 864e5) + "d ago";
69350
+ }
69351
+
69352
+ // src/commands/prompt-memory.ts
69353
+ var promptMemoryList = new Command("list").alias("ls").description("list remembered startup-prompt answers").option("--machine-id <id>", "filter to one machine").option("--folder <path>", "filter to one folder").action(async (opts) => {
69354
+ const qs = new URLSearchParams();
69355
+ if (opts.machineId) qs.set("machineId", opts.machineId);
69356
+ if (opts.folder) qs.set("folder", opts.folder);
69357
+ const url = "/api/v1/prompt-memory" + (qs.toString() ? "?" + qs : "");
69358
+ const data = await api.get(url);
69359
+ if (data.items.length === 0) {
69360
+ console.log("no remembered answers");
69361
+ return;
69362
+ }
69363
+ for (const m of data.items) {
69364
+ const where = [m.machineId?.slice(0, 8) ?? "*", m.folder ?? "*"].join(" ");
69365
+ const printableAnswer = JSON.stringify(m.answer);
69366
+ console.log(`${m.id.toString().padStart(4)} ${m.category.padEnd(28)} ${printableAnswer.padEnd(8)} ${where}`);
69367
+ }
69368
+ });
69369
+ var promptMemorySet = new Command("set").description("set or update a remembered answer (idempotent)").requiredOption("--category <category>", "e.g. startup_trust_folder, startup_use_mcp").requiredOption("--answer <bytes>", 'literal bytes the daemon should type, e.g. "y\\n"').option("--machine-id <id>", "scope to a specific machine; omit for all-machines").option("--folder <path>", "scope to a specific folder; omit for all-folders").action(async (opts) => {
69370
+ const out = await api.post("/api/v1/prompt-memory", {
69371
+ machineId: opts.machineId ?? null,
69372
+ folder: opts.folder ?? null,
69373
+ category: opts.category,
69374
+ answer: opts.answer
69375
+ });
69376
+ console.log(`\u2713 remembered #${out.id}: ${out.category} \u2192 ${JSON.stringify(out.answer)}`);
69377
+ });
69378
+ var promptMemoryForget = new Command("forget").description("forget a remembered answer by id (from `claw prompt-memory list`)").argument("<id>", "memory id").action(async (id) => {
69379
+ await api.delete(`/api/v1/prompt-memory/${encodeURIComponent(id)}`);
69380
+ console.log(`\u2717 forgot memory ${id}`);
69381
+ });
69382
+ var promptMemoryCmd = new Command("prompt-memory").description("view and manage remembered CC startup-prompt answers").addCommand(promptMemoryList).addCommand(promptMemorySet).addCommand(promptMemoryForget);
69383
+
69287
69384
  // src/index.ts
69288
69385
  var program2 = new Command();
69289
69386
  program2.name("claw").description("clawborrator CLI \u2014 control your Claude Code sessions from the terminal").version("0.0.43");
@@ -69298,6 +69395,8 @@ program2.addCommand(probeCmd);
69298
69395
  program2.addCommand(webhookCmd);
69299
69396
  program2.addCommand(agentsCmd);
69300
69397
  program2.addCommand(appsCmd);
69398
+ program2.addCommand(desktopCmd);
69399
+ program2.addCommand(promptMemoryCmd);
69301
69400
  program2.parseAsync(process.argv).catch((err) => {
69302
69401
  console.error(err.message ?? err);
69303
69402
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawborrator-cli",
3
- "version": "0.0.55",
3
+ "version": "0.0.57",
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",