agendex-cli 0.10.1 → 0.11.0
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/cli.js +26 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2721,6 +2721,12 @@ function isRunning(pid) {
|
|
|
2721
2721
|
}
|
|
2722
2722
|
|
|
2723
2723
|
// src/api.ts
|
|
2724
|
+
class AuthExpiredError extends Error {
|
|
2725
|
+
constructor() {
|
|
2726
|
+
super("Cloud token expired. Run `agendex login` to re-authenticate.");
|
|
2727
|
+
this.name = "AuthExpiredError";
|
|
2728
|
+
}
|
|
2729
|
+
}
|
|
2724
2730
|
var cachedDeviceId;
|
|
2725
2731
|
function getCloudConfig() {
|
|
2726
2732
|
const config = loadConfig();
|
|
@@ -2897,6 +2903,9 @@ async function fetchDevices() {
|
|
|
2897
2903
|
});
|
|
2898
2904
|
}
|
|
2899
2905
|
}
|
|
2906
|
+
if (res.status === 401) {
|
|
2907
|
+
throw new AuthExpiredError;
|
|
2908
|
+
}
|
|
2900
2909
|
if (res.status < 200 || res.status >= 300) {
|
|
2901
2910
|
return [];
|
|
2902
2911
|
}
|
|
@@ -3412,7 +3421,7 @@ import { join as join12 } from "node:path";
|
|
|
3412
3421
|
// package.json
|
|
3413
3422
|
var package_default = {
|
|
3414
3423
|
name: "agendex-cli",
|
|
3415
|
-
version: "0.
|
|
3424
|
+
version: "0.11.0",
|
|
3416
3425
|
description: "Agendex CLI for login, sync, and daemon workflows",
|
|
3417
3426
|
homepage: "https://github.com/Tyru5/Agendex#readme",
|
|
3418
3427
|
repository: {
|
|
@@ -3680,7 +3689,16 @@ async function main() {
|
|
|
3680
3689
|
writeStderr("[agendex] not logged in. Run `agendex login` first.");
|
|
3681
3690
|
return 1;
|
|
3682
3691
|
}
|
|
3683
|
-
|
|
3692
|
+
let allDevices;
|
|
3693
|
+
try {
|
|
3694
|
+
allDevices = await fetchDevices();
|
|
3695
|
+
} catch (err) {
|
|
3696
|
+
if (err instanceof AuthExpiredError) {
|
|
3697
|
+
writeStderr("[agendex] cloud token expired. Run `agendex login` to re-authenticate.");
|
|
3698
|
+
return 1;
|
|
3699
|
+
}
|
|
3700
|
+
throw err;
|
|
3701
|
+
}
|
|
3684
3702
|
if (allDevices.length === 0) {
|
|
3685
3703
|
writeStdout("[agendex] no daemons found");
|
|
3686
3704
|
return 0;
|
|
@@ -3789,7 +3807,12 @@ async function main() {
|
|
|
3789
3807
|
writeStdout(`[agendex] All daemons: none`);
|
|
3790
3808
|
}
|
|
3791
3809
|
}
|
|
3792
|
-
} catch {
|
|
3810
|
+
} catch (err) {
|
|
3811
|
+
if (err instanceof AuthExpiredError) {
|
|
3812
|
+
writeStderr(`[agendex] Cloud token expired — cloud sync and daemon tracking are inactive.`);
|
|
3813
|
+
writeStderr(`[agendex] Run \`agendex login\` to re-authenticate.`);
|
|
3814
|
+
}
|
|
3815
|
+
}
|
|
3793
3816
|
return 0;
|
|
3794
3817
|
}
|
|
3795
3818
|
case "help":
|