clawon 0.1.3 → 0.1.4

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.
Files changed (2) hide show
  1. package/dist/index.js +20 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -505,8 +505,8 @@ local.command("list").description("List local backups").action(async () => {
505
505
  return;
506
506
  }
507
507
  console.log("Local backups:\n");
508
- console.log("# | Date | Files | Size");
509
- console.log("\u2500".repeat(60));
508
+ console.log("# | Date | Files | Size | Path");
509
+ console.log("\u2500".repeat(100));
510
510
  for (let i = 0; i < entries.length; i++) {
511
511
  const filePath = path.join(BACKUPS_DIR, entries[i]);
512
512
  try {
@@ -514,17 +514,21 @@ local.command("list").description("List local backups").action(async () => {
514
514
  const totalSize = files.reduce((sum, f) => sum + f.size, 0);
515
515
  const date = new Date(created).toLocaleString();
516
516
  console.log(
517
- `${String(i + 1).padStart(2)} | ${date.padEnd(25)} | ${String(files.length).padEnd(5)} | ${(totalSize / 1024).toFixed(1)} KB`
517
+ `${String(i + 1).padStart(2)} | ${date.padEnd(25)} | ${String(files.length).padEnd(5)} | ${(totalSize / 1024).toFixed(1).padEnd(8)} KB | ${filePath}`
518
518
  );
519
519
  } catch {
520
- console.log(`${String(i + 1).padStart(2)} | ${entries[i].padEnd(25)} | ??? | ???`);
520
+ console.log(`${String(i + 1).padStart(2)} | ${entries[i].padEnd(25)} | ??? | ??? | ${filePath}`);
521
521
  }
522
522
  }
523
523
  console.log(`
524
524
  Total: ${entries.length} backup(s)`);
525
- console.log(`Location: ${BACKUPS_DIR}`);
525
+ console.log(`
526
+ Restore a backup:`);
527
+ console.log(` clawon local restore Restore the latest backup (#1)`);
528
+ console.log(` clawon local restore --pick 2 Restore backup #2 from this list`);
529
+ console.log(` clawon local restore --file <path> Restore from an external file`);
526
530
  });
527
- local.command("restore").description("Restore from a local backup").option("--file <path>", "Path to an external backup file").action(async (opts) => {
531
+ local.command("restore").description("Restore from a local backup").option("--file <path>", "Path to an external backup file").option("--pick <n>", 'Restore backup #n from "clawon local list"').action(async (opts) => {
528
532
  let archivePath;
529
533
  if (opts.file) {
530
534
  archivePath = path.resolve(opts.file);
@@ -542,7 +546,16 @@ local.command("restore").description("Restore from a local backup").option("--fi
542
546
  console.error("\u2717 No local backups found. Run: clawon local backup");
543
547
  process.exit(1);
544
548
  }
545
- archivePath = path.join(BACKUPS_DIR, entries[0]);
549
+ if (opts.pick) {
550
+ const idx = parseInt(opts.pick, 10) - 1;
551
+ if (isNaN(idx) || idx < 0 || idx >= entries.length) {
552
+ console.error(`\u2717 Invalid pick: #${opts.pick}. Run "clawon local list" to see available backups (1-${entries.length}).`);
553
+ process.exit(1);
554
+ }
555
+ archivePath = path.join(BACKUPS_DIR, entries[idx]);
556
+ } else {
557
+ archivePath = path.join(BACKUPS_DIR, entries[0]);
558
+ }
546
559
  }
547
560
  console.log(`Restoring from: ${archivePath}`);
548
561
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawon",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Backup and restore your OpenClaw workspace",
5
5
  "type": "module",
6
6
  "bin": {