clawon 0.1.8 → 0.1.9

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Clawon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -21,6 +21,7 @@ Local backups are stored in `~/.clawon/backups/` as standard `.tar.gz` archives.
21
21
  # Create a backup
22
22
  npx clawon local backup
23
23
  npx clawon local backup --tag "before migration"
24
+ npx clawon local backup --include-memory-db # Include SQLite memory index
24
25
 
25
26
  # List all local backups
26
27
  npx clawon local list
@@ -43,6 +44,7 @@ npx clawon login --api-key <your-key>
43
44
  npx clawon backup
44
45
  npx clawon backup --tag "stable config"
45
46
  npx clawon backup --dry-run # Preview without uploading
47
+ npx clawon backup --include-memory-db # Requires Pro account
46
48
 
47
49
  # List cloud backups
48
50
  npx clawon list
@@ -63,6 +65,7 @@ npx clawon activity # Recent events
63
65
 
64
66
  ```bash
65
67
  npx clawon discover # Show exactly which files would be backed up
68
+ npx clawon discover --include-memory-db # Include SQLite memory index
66
69
  npx clawon status # Connection status and file count
67
70
  npx clawon logout # Remove local credentials
68
71
  ```
@@ -93,7 +96,7 @@ These are **always excluded**, even if they match an include pattern:
93
96
  | `openclaw.json` | May contain credentials |
94
97
  | `agents/*/sessions/**` | Ephemeral session data |
95
98
  | `memory/lancedb/**` | Vector database (binary, large) |
96
- | `memory/*.sqlite` | SQLite databases |
99
+ | `memory/*.sqlite` | SQLite databases (use `--include-memory-db` to include) |
97
100
  | `*.lock`, `*.wal`, `*.shm` | Database lock files |
98
101
  | `node_modules/**` | Dependencies |
99
102
 
package/dist/index.js CHANGED
@@ -61,7 +61,10 @@ function matchGlob(filePath, pattern) {
61
61
  let regexPattern = pattern.replace(/\./g, "\\.").replace(/\*\*\//g, "(.*/)?").replace(/\*\*/g, ".*").replace(/\*/g, "[^/]*");
62
62
  return new RegExp(`^${regexPattern}$`).test(filePath);
63
63
  }
64
- function shouldInclude(relativePath) {
64
+ function shouldInclude(relativePath, includeMemoryDb = false) {
65
+ if (includeMemoryDb && matchGlob(relativePath, "memory/*.sqlite")) {
66
+ return true;
67
+ }
65
68
  for (const pattern of EXCLUDE_PATTERNS) {
66
69
  if (matchGlob(relativePath, pattern)) return false;
67
70
  }
@@ -70,7 +73,7 @@ function shouldInclude(relativePath) {
70
73
  }
71
74
  return false;
72
75
  }
73
- function discoverFiles(baseDir) {
76
+ function discoverFiles(baseDir, includeMemoryDb = false) {
74
77
  const files = [];
75
78
  function walk(dir, relativePath = "") {
76
79
  if (!fs.existsSync(dir)) return;
@@ -81,7 +84,7 @@ function discoverFiles(baseDir) {
81
84
  if (entry.isDirectory()) {
82
85
  walk(fullPath, relPath);
83
86
  } else if (entry.isFile()) {
84
- if (shouldInclude(relPath)) {
87
+ if (shouldInclude(relPath, includeMemoryDb)) {
85
88
  const stats = fs.statSync(fullPath);
86
89
  files.push({
87
90
  path: relPath,
@@ -94,12 +97,13 @@ function discoverFiles(baseDir) {
94
97
  walk(baseDir);
95
98
  return files;
96
99
  }
97
- async function createLocalArchive(files, openclawDir, outputPath, tag) {
100
+ async function createLocalArchive(files, openclawDir, outputPath, tag, includeMemoryDb) {
98
101
  const meta = {
99
102
  version: 2,
100
103
  created: (/* @__PURE__ */ new Date()).toISOString(),
101
104
  ...tag ? { tag } : {},
102
- file_count: files.length
105
+ file_count: files.length,
106
+ ...includeMemoryDb ? { include_memory_db: true } : {}
103
107
  };
104
108
  const metaPath = path.join(openclawDir, "_clawon_meta.json");
105
109
  fs.writeFileSync(metaPath, JSON.stringify(meta, null, 2));
@@ -176,7 +180,11 @@ program.command("login").description("Connect to Clawon with your API key").requ
176
180
  process.exit(1);
177
181
  }
178
182
  });
179
- program.command("backup").description("Backup your OpenClaw workspace to the cloud").option("--dry-run", "Show what would be backed up without uploading").option("--tag <label>", "Add a label to this backup").action(async (opts) => {
183
+ program.command("backup").description("Backup your OpenClaw workspace to the cloud").option("--dry-run", "Show what would be backed up without uploading").option("--tag <label>", "Add a label to this backup").option("--include-memory-db", "Include SQLite memory index").action(async (opts) => {
184
+ if (opts.includeMemoryDb) {
185
+ console.error("\u2717 Memory DB backup requires a Pro account. Use `clawon local backup --include-memory-db` for local backups.");
186
+ process.exit(1);
187
+ }
180
188
  const cfg = readConfig();
181
189
  if (!cfg) {
182
190
  console.error("\u2717 Not logged in. Run: clawon login --api-key <key>");
@@ -248,7 +256,8 @@ program.command("backup").description("Backup your OpenClaw workspace to the clo
248
256
  console.log(` Size: ${(totalSize / 1024).toFixed(1)} KB`);
249
257
  trackCliEvent(cfg.profileId, "cloud_backup_created", {
250
258
  file_count: files.length,
251
- total_bytes: totalSize
259
+ total_bytes: totalSize,
260
+ include_memory_db: !!opts.includeMemoryDb
252
261
  });
253
262
  } catch (e) {
254
263
  const msg = e.message;
@@ -455,12 +464,12 @@ program.command("delete [id]").description("Delete a snapshot").option("--oldest
455
464
  process.exit(1);
456
465
  }
457
466
  });
458
- program.command("discover").description("Preview which files would be included in a backup").action(async () => {
467
+ program.command("discover").description("Preview which files would be included in a backup").option("--include-memory-db", "Include SQLite memory index").action(async (opts) => {
459
468
  if (!fs.existsSync(OPENCLAW_DIR)) {
460
469
  console.error(`\u2717 OpenClaw directory not found: ${OPENCLAW_DIR}`);
461
470
  process.exit(1);
462
471
  }
463
- const files = discoverFiles(OPENCLAW_DIR);
472
+ const files = discoverFiles(OPENCLAW_DIR, !!opts.includeMemoryDb);
464
473
  if (files.length === 0) {
465
474
  console.log("No files matched the include patterns.");
466
475
  return;
@@ -485,7 +494,7 @@ program.command("discover").description("Preview which files would be included i
485
494
  Total: ${files.length} files (${(totalSize / 1024).toFixed(1)} KB)`);
486
495
  console.log(`Source: ${OPENCLAW_DIR}`);
487
496
  const cfg = readConfig();
488
- trackCliEvent(cfg?.profileId || "anonymous", "cli_discover", { file_count: files.length });
497
+ trackCliEvent(cfg?.profileId || "anonymous", "cli_discover", { file_count: files.length, include_memory_db: !!opts.includeMemoryDb });
489
498
  });
490
499
  program.command("files").description("List files in a backup").option("--snapshot <id>", "Snapshot ID (default: latest)").action(async (opts) => {
491
500
  const cfg = readConfig();
@@ -529,13 +538,13 @@ Total: ${files.length} files`);
529
538
  }
530
539
  });
531
540
  var local = program.command("local").description("Local backup and restore (no cloud required)");
532
- local.command("backup").description("Save a local backup of your OpenClaw workspace").option("--tag <label>", "Add a label to this backup").action(async (opts) => {
541
+ local.command("backup").description("Save a local backup of your OpenClaw workspace").option("--tag <label>", "Add a label to this backup").option("--include-memory-db", "Include SQLite memory index").action(async (opts) => {
533
542
  if (!fs.existsSync(OPENCLAW_DIR)) {
534
543
  console.error(`\u2717 OpenClaw directory not found: ${OPENCLAW_DIR}`);
535
544
  process.exit(1);
536
545
  }
537
546
  console.log("Discovering files...");
538
- const files = discoverFiles(OPENCLAW_DIR);
547
+ const files = discoverFiles(OPENCLAW_DIR, !!opts.includeMemoryDb);
539
548
  if (files.length === 0) {
540
549
  console.error("\u2717 No files found to backup");
541
550
  process.exit(1);
@@ -547,7 +556,7 @@ local.command("backup").description("Save a local backup of your OpenClaw worksp
547
556
  const filename = `backup-${timestamp}.tar.gz`;
548
557
  const filePath = path.join(BACKUPS_DIR, filename);
549
558
  console.log("Creating archive...");
550
- await createLocalArchive(files, OPENCLAW_DIR, filePath, opts.tag);
559
+ await createLocalArchive(files, OPENCLAW_DIR, filePath, opts.tag, opts.includeMemoryDb);
551
560
  const archiveSize = fs.statSync(filePath).size;
552
561
  console.log(`
553
562
  \u2713 Local backup saved!`);
@@ -558,7 +567,8 @@ local.command("backup").description("Save a local backup of your OpenClaw worksp
558
567
  const cfg = readConfig();
559
568
  trackCliEvent(cfg?.profileId || "anonymous", "local_backup_created", {
560
569
  file_count: files.length,
561
- total_bytes: totalSize
570
+ total_bytes: totalSize,
571
+ include_memory_db: !!opts.includeMemoryDb
562
572
  });
563
573
  });
564
574
  local.command("list").description("List local backups").action(async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawon",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Backup and restore your OpenClaw workspace",
5
5
  "type": "module",
6
6
  "bin": {