clawon 0.1.13 → 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.
- package/dist/index.js +45 -11
- 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)
|
|
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 = [
|
|
@@ -275,14 +283,6 @@ program.command("login").description("Connect to Clawon with your API key").opti
|
|
|
275
283
|
}
|
|
276
284
|
});
|
|
277
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) => {
|
|
278
|
-
if (opts.includeMemoryDb) {
|
|
279
|
-
console.error("\u2717 Memory DB cloud backup requires a Hobby or Pro account. Use `clawon local backup --include-memory-db` for local backups.");
|
|
280
|
-
process.exit(1);
|
|
281
|
-
}
|
|
282
|
-
if (opts.includeSessions) {
|
|
283
|
-
console.error("\u2717 Session backup requires a Hobby or Pro account. Use `clawon local backup --include-sessions` for local backups.");
|
|
284
|
-
process.exit(1);
|
|
285
|
-
}
|
|
286
286
|
const cfg = readConfig();
|
|
287
287
|
if (!cfg) {
|
|
288
288
|
console.error("\u2717 Not logged in. Run: clawon login --api-key <key>");
|
|
@@ -298,7 +298,7 @@ program.command("backup").description("Backup your OpenClaw workspace to the clo
|
|
|
298
298
|
process.exit(1);
|
|
299
299
|
}
|
|
300
300
|
console.log("Discovering files...");
|
|
301
|
-
const files = discoverFiles(OPENCLAW_DIR);
|
|
301
|
+
const files = discoverFiles(OPENCLAW_DIR, !!opts.includeMemoryDb, !!opts.includeSessions);
|
|
302
302
|
if (files.length === 0) {
|
|
303
303
|
console.error("\u2717 No files found to backup");
|
|
304
304
|
process.exit(1);
|
|
@@ -373,10 +373,11 @@ program.command("backup").description("Backup your OpenClaw workspace to the clo
|
|
|
373
373
|
trackCliEvent(cfg.profileId, "scheduled_backup_failed", { type: "cloud", error: msg });
|
|
374
374
|
}
|
|
375
375
|
if (msg.includes("Snapshot limit")) {
|
|
376
|
-
console.error("\n\u2717 Snapshot limit reached
|
|
376
|
+
console.error("\n\u2717 Snapshot limit reached.");
|
|
377
377
|
console.error(" Delete one first: clawon delete <id>");
|
|
378
378
|
console.error(" Delete oldest: clawon delete --oldest");
|
|
379
379
|
console.error(" List snapshots: clawon list");
|
|
380
|
+
console.error(" Upgrade plan: https://clawon.io/dashboard/billing");
|
|
380
381
|
} else {
|
|
381
382
|
console.error(`
|
|
382
383
|
\u2717 Backup failed: ${msg}`);
|
|
@@ -1108,6 +1109,39 @@ program.command("status").description("Show current status").action(async () =>
|
|
|
1108
1109
|
}
|
|
1109
1110
|
trackCliEvent(cfg?.profileId || "anonymous", "cli_status_viewed");
|
|
1110
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
|
+
});
|
|
1111
1145
|
program.command("logout").description("Remove local credentials").action(() => {
|
|
1112
1146
|
const cfg = readConfig();
|
|
1113
1147
|
if (fs.existsSync(CONFIG_PATH)) {
|