clawon 0.1.14 → 0.1.15
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 +43 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -617,13 +617,51 @@ var schedule = program.command("schedule").description("Manage scheduled cloud b
|
|
|
617
617
|
schedule.command("on").description("Enable scheduled cloud backups via cron").option("--every <interval>", "Backup interval: 1h, 6h, 12h, 24h", "12h").action(async (opts) => {
|
|
618
618
|
assertNotWindows();
|
|
619
619
|
const cfg = readConfig();
|
|
620
|
-
|
|
620
|
+
if (!cfg) {
|
|
621
|
+
console.error("\u2717 Not logged in. Run: clawon login --api-key <key>");
|
|
622
|
+
process.exit(1);
|
|
623
|
+
}
|
|
624
|
+
const interval = opts.every;
|
|
625
|
+
if (!VALID_INTERVALS.includes(interval)) {
|
|
626
|
+
console.error(`\u2717 Invalid interval: ${interval}. Valid options: ${VALID_INTERVALS.join(", ")}`);
|
|
627
|
+
process.exit(1);
|
|
628
|
+
}
|
|
629
|
+
try {
|
|
630
|
+
const data = await api(
|
|
631
|
+
cfg.apiBaseUrl || "https://clawon.io",
|
|
632
|
+
`/api/v1/profile/status?profileId=${cfg.profileId}`,
|
|
633
|
+
"GET",
|
|
634
|
+
cfg.apiKey
|
|
635
|
+
);
|
|
636
|
+
const limits = data.tierLimits || {};
|
|
637
|
+
if (!limits.scheduledCloud) {
|
|
638
|
+
console.error("\u2717 Scheduled cloud backups require a Hobby or Pro plan.");
|
|
639
|
+
console.error(" Use `clawon local schedule on` for free local scheduled backups.");
|
|
640
|
+
console.error(" Upgrade at: https://clawon.io/dashboard/billing");
|
|
641
|
+
process.exit(1);
|
|
642
|
+
}
|
|
643
|
+
} catch (e) {
|
|
644
|
+
console.error(`\u2717 Failed to check plan: ${e.message}`);
|
|
645
|
+
process.exit(1);
|
|
646
|
+
}
|
|
647
|
+
const cronExpr = INTERVAL_CRON[interval];
|
|
648
|
+
const command = resolveCliCommand(`backup --scheduled`);
|
|
649
|
+
addCronEntry(CRON_MARKER_CLOUD, cronExpr, command);
|
|
650
|
+
updateConfig({
|
|
651
|
+
schedule: {
|
|
652
|
+
cloud: {
|
|
653
|
+
enabled: true,
|
|
654
|
+
intervalHours: parseInt(interval)
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
});
|
|
658
|
+
console.log(`\u2713 Scheduled cloud backup enabled`);
|
|
659
|
+
console.log(` Interval: every ${interval}`);
|
|
660
|
+
console.log(` Log: ${SCHEDULE_LOG}`);
|
|
661
|
+
trackCliEvent(cfg.profileId, "schedule_enabled", {
|
|
621
662
|
type: "cloud",
|
|
622
|
-
interval_hours: parseInt(
|
|
623
|
-
gated: true
|
|
663
|
+
interval_hours: parseInt(interval)
|
|
624
664
|
});
|
|
625
|
-
console.error("\u2717 Scheduled cloud backups require a Hobby or Pro account. Use `clawon local schedule on` for local scheduled backups.");
|
|
626
|
-
process.exit(1);
|
|
627
665
|
});
|
|
628
666
|
schedule.command("off").description("Disable scheduled cloud backups").action(async () => {
|
|
629
667
|
assertNotWindows();
|