clawon 0.1.12 → 0.1.14

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 +47 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -41,7 +41,15 @@ async function api(baseUrl, endpoint, method, apiKey, body) {
41
41
  body: body ? JSON.stringify(body) : void 0
42
42
  });
43
43
  const json = await res.json().catch(() => ({}));
44
- if (!res.ok) throw new Error(json.error || json.message || `HTTP ${res.status}`);
44
+ if (!res.ok) {
45
+ if (json.upgradeRequired) {
46
+ console.error(`
47
+ \u2717 ${json.error || "This feature requires a paid plan."}`);
48
+ console.error(" Upgrade at: https://clawon.io/dashboard/billing");
49
+ process.exit(1);
50
+ }
51
+ throw new Error(json.error || json.message || `HTTP ${res.status}`);
52
+ }
45
53
  return json;
46
54
  }
47
55
  var INCLUDE_PATTERNS = [
@@ -266,7 +274,8 @@ program.command("login").description("Connect to Clawon with your API key").opti
266
274
  console.log(` Workspace: ${connectJson.workspaceSlug}`);
267
275
  }
268
276
  trackCliEvent(connectJson.profileId, "cli_login", {
269
- workspace_slug: connectJson.workspaceSlug
277
+ workspace_slug: connectJson.workspaceSlug,
278
+ workspace_count: connectJson.workspaceCount ?? 1
270
279
  });
271
280
  } catch (e) {
272
281
  console.error(`\u2717 Login failed: ${e.message}`);
@@ -274,14 +283,6 @@ program.command("login").description("Connect to Clawon with your API key").opti
274
283
  }
275
284
  });
276
285
  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").option("--include-sessions", "Include chat history (sessions)").option("--scheduled", "Internal: triggered by cron (suppresses interactive output)").action(async (opts) => {
277
- if (opts.includeMemoryDb) {
278
- console.error("\u2717 Memory DB cloud backup requires a Hobby or Pro account. Use `clawon local backup --include-memory-db` for local backups.");
279
- process.exit(1);
280
- }
281
- if (opts.includeSessions) {
282
- console.error("\u2717 Session backup requires a Hobby or Pro account. Use `clawon local backup --include-sessions` for local backups.");
283
- process.exit(1);
284
- }
285
286
  const cfg = readConfig();
286
287
  if (!cfg) {
287
288
  console.error("\u2717 Not logged in. Run: clawon login --api-key <key>");
@@ -297,7 +298,7 @@ program.command("backup").description("Backup your OpenClaw workspace to the clo
297
298
  process.exit(1);
298
299
  }
299
300
  console.log("Discovering files...");
300
- const files = discoverFiles(OPENCLAW_DIR);
301
+ const files = discoverFiles(OPENCLAW_DIR, !!opts.includeMemoryDb, !!opts.includeSessions);
301
302
  if (files.length === 0) {
302
303
  console.error("\u2717 No files found to backup");
303
304
  process.exit(1);
@@ -372,10 +373,11 @@ program.command("backup").description("Backup your OpenClaw workspace to the clo
372
373
  trackCliEvent(cfg.profileId, "scheduled_backup_failed", { type: "cloud", error: msg });
373
374
  }
374
375
  if (msg.includes("Snapshot limit")) {
375
- console.error("\n\u2717 Snapshot limit reached (2).");
376
+ console.error("\n\u2717 Snapshot limit reached.");
376
377
  console.error(" Delete one first: clawon delete <id>");
377
378
  console.error(" Delete oldest: clawon delete --oldest");
378
379
  console.error(" List snapshots: clawon list");
380
+ console.error(" Upgrade plan: https://clawon.io/dashboard/billing");
379
381
  } else {
380
382
  console.error(`
381
383
  \u2717 Backup failed: ${msg}`);
@@ -1107,6 +1109,39 @@ program.command("status").description("Show current status").action(async () =>
1107
1109
  }
1108
1110
  trackCliEvent(cfg?.profileId || "anonymous", "cli_status_viewed");
1109
1111
  });
1112
+ program.command("plan").description("Show your current plan, limits, and usage").action(async () => {
1113
+ const cfg = readConfig();
1114
+ if (!cfg) {
1115
+ console.error("\u2717 Not logged in. Run: clawon login --api-key <key>");
1116
+ process.exit(1);
1117
+ }
1118
+ try {
1119
+ const data = await api(
1120
+ cfg.apiBaseUrl || "https://clawon.io",
1121
+ `/api/v1/profile/status?profileId=${cfg.profileId}${cfg.workspaceId ? `&workspaceId=${cfg.workspaceId}` : ""}`,
1122
+ "GET",
1123
+ cfg.apiKey
1124
+ );
1125
+ const tier = data.tier || "free";
1126
+ const limits = data.tierLimits || {};
1127
+ const label = limits.label || "Starter";
1128
+ console.log(`
1129
+ Plan: ${label} (${tier})`);
1130
+ console.log(` Snapshots: ${limits.snapshotLimit || 2} per workspace`);
1131
+ console.log(` Workspaces: ${limits.workspaceLimit || 1}`);
1132
+ console.log(` Max size: ${limits.maxSizeMb || 50} MB`);
1133
+ console.log(` Memory DB: ${limits.includeMemoryDb ? "included" : "not included (Hobby+)"}`);
1134
+ console.log(` Sessions: ${limits.includeSessions ? "included" : "not included (Hobby+)"}`);
1135
+ console.log(` Cloud schedule: ${limits.scheduledCloud ? "available" : "not available (Hobby+)"}`);
1136
+ console.log(`
1137
+ Manage: https://clawon.io/dashboard/billing
1138
+ `);
1139
+ trackCliEvent(cfg.profileId, "cli_plan_checked", { tier });
1140
+ } catch (e) {
1141
+ console.error(`\u2717 Failed to fetch plan: ${e.message}`);
1142
+ process.exit(1);
1143
+ }
1144
+ });
1110
1145
  program.command("logout").description("Remove local credentials").action(() => {
1111
1146
  const cfg = readConfig();
1112
1147
  if (fs.existsSync(CONFIG_PATH)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawon",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "Backup and restore your OpenClaw workspace",
5
5
  "type": "module",
6
6
  "bin": {