agendex-cli 0.8.0 → 0.8.2
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/README.md +19 -4
- package/dist/cli.js +18 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `agendex-cli`
|
|
2
2
|
|
|
3
|
-
Node-compatible Agendex CLI for browser login, one-shot sync, daemon supervision, and
|
|
3
|
+
Node-compatible Agendex CLI for browser login, one-shot sync, daemon supervision, status checks, and daemon cleanup.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -21,11 +21,23 @@ agendex configure # Select which agents/adapters to index
|
|
|
21
21
|
agendex start # Start daemon (backgrounds itself)
|
|
22
22
|
agendex stop # Stop the running daemon
|
|
23
23
|
agendex sync # One-shot scan + sync to cloud
|
|
24
|
+
agendex cleanup # Interactively remove cloud daemons
|
|
25
|
+
agendex cleanup --stale # Auto-remove all stale daemons
|
|
24
26
|
agendex status # Show config state, daemon status, uptime & hostname
|
|
25
27
|
agendex help # Show help message
|
|
26
28
|
agendex --version / -v # Print CLI version
|
|
27
29
|
```
|
|
28
30
|
|
|
31
|
+
## Daemon Cleanup
|
|
32
|
+
|
|
33
|
+
`agendex cleanup` manages registered daemon devices in the cloud.
|
|
34
|
+
|
|
35
|
+
**Interactive mode** (default) — presents a multiselect prompt listing all daemons with hostname, PID, and alive/stale status. Select which ones to remove.
|
|
36
|
+
|
|
37
|
+
**Auto mode** — `agendex cleanup --stale` removes all stale daemons without prompting. Useful for CI or non-TTY environments.
|
|
38
|
+
|
|
39
|
+
Requires login. In non-TTY environments without `--stale`, the command exits with an error.
|
|
40
|
+
|
|
29
41
|
## Status Output
|
|
30
42
|
|
|
31
43
|
`agendex status` prints a rich overview:
|
|
@@ -35,6 +47,7 @@ agendex --version / -v # Print CLI version
|
|
|
35
47
|
- Daemon running state with PID
|
|
36
48
|
- **Uptime** — how long the daemon has been running
|
|
37
49
|
- **Hostname** — machine the daemon is running on
|
|
50
|
+
- **All registered daemons** — hostname, PID, uptime, and alive/stale status for every device in the cloud
|
|
38
51
|
- CLI version
|
|
39
52
|
|
|
40
53
|
## Auto-Update Check
|
|
@@ -46,7 +59,7 @@ Before running `start`, `configure`, or `sync`, the CLI checks for a newer publi
|
|
|
46
59
|
[agendex] run: npm i -g agendex-cli
|
|
47
60
|
```
|
|
48
61
|
|
|
49
|
-
The check is skipped for `stop`, `status`, `login`, `logout`, and `help`.
|
|
62
|
+
The check is skipped for `stop`, `status`, `login`, `logout`, `cleanup`, and `help`.
|
|
50
63
|
|
|
51
64
|
## Supported Runtime
|
|
52
65
|
|
|
@@ -55,12 +68,14 @@ The check is skipped for `stop`, `status`, `login`, `logout`, and `help`.
|
|
|
55
68
|
|
|
56
69
|
## Self-Hosted Login
|
|
57
70
|
|
|
58
|
-
The default login target is `https://agendex.dev`.
|
|
71
|
+
The default login target is `https://app.agendex.dev`.
|
|
59
72
|
|
|
60
|
-
For self-hosted deployments,
|
|
73
|
+
For self-hosted deployments, pass your site URL explicitly:
|
|
61
74
|
|
|
62
75
|
```bash
|
|
63
76
|
agendex login --url https://agendex.yourdomain.com
|
|
64
77
|
```
|
|
65
78
|
|
|
66
79
|
This opens your deployment's OAuth flow and stores the returned `cloudToken` and `convexUrl` in `~/.agendex/config.json`.
|
|
80
|
+
|
|
81
|
+
The target can also be set via `AGENDEX_SITE_URL` env var. For local development, set `AGENDEX_DEV=1` to use the local dev server.
|
package/dist/cli.js
CHANGED
|
@@ -3251,7 +3251,7 @@ import { join as join11 } from "node:path";
|
|
|
3251
3251
|
// package.json
|
|
3252
3252
|
var package_default = {
|
|
3253
3253
|
name: "agendex-cli",
|
|
3254
|
-
version: "0.8.
|
|
3254
|
+
version: "0.8.2",
|
|
3255
3255
|
description: "Agendex CLI for login, sync, and daemon workflows",
|
|
3256
3256
|
homepage: "https://github.com/Tyru5/Agendex#readme",
|
|
3257
3257
|
repository: {
|
|
@@ -3295,16 +3295,17 @@ var package_default = {
|
|
|
3295
3295
|
|
|
3296
3296
|
// src/version.ts
|
|
3297
3297
|
var CLI_VERSION = package_default.version;
|
|
3298
|
-
var CACHE_FILE = join11(tmpdir(), ".agendex-update-cache.json");
|
|
3298
|
+
var CACHE_FILE = process.env.AGENDEX_UPDATE_CACHE_FILE ?? join11(tmpdir(), ".agendex-update-cache.json");
|
|
3299
3299
|
var CACHE_TTL_MS = 24 * 60 * 60 * 1000;
|
|
3300
|
-
|
|
3300
|
+
var UPDATE_URL = process.env.AGENDEX_UPDATE_URL ?? "https://registry.npmjs.org/agendex-cli/latest";
|
|
3301
|
+
function readCache(current) {
|
|
3301
3302
|
try {
|
|
3302
3303
|
if (!existsSync7(CACHE_FILE))
|
|
3303
3304
|
return null;
|
|
3304
3305
|
const { result, ts } = JSON.parse(readFileSync4(CACHE_FILE, "utf8"));
|
|
3305
3306
|
if (Date.now() - ts > CACHE_TTL_MS)
|
|
3306
3307
|
return null;
|
|
3307
|
-
return result;
|
|
3308
|
+
return normalizeResult(result, current);
|
|
3308
3309
|
} catch {
|
|
3309
3310
|
return null;
|
|
3310
3311
|
}
|
|
@@ -3316,16 +3317,15 @@ function writeCache(result) {
|
|
|
3316
3317
|
}
|
|
3317
3318
|
async function checkForUpdate() {
|
|
3318
3319
|
const current = CLI_VERSION;
|
|
3319
|
-
const cached = readCache();
|
|
3320
|
+
const cached = readCache(current);
|
|
3320
3321
|
if (cached)
|
|
3321
|
-
return
|
|
3322
|
+
return cached;
|
|
3322
3323
|
try {
|
|
3323
3324
|
const controller = new AbortController;
|
|
3324
3325
|
const timeout = setTimeout(() => controller.abort(), 3000);
|
|
3325
|
-
const res = await fetch(
|
|
3326
|
+
const res = await fetch(UPDATE_URL, {
|
|
3326
3327
|
signal: controller.signal
|
|
3327
|
-
});
|
|
3328
|
-
clearTimeout(timeout);
|
|
3328
|
+
}).finally(() => clearTimeout(timeout));
|
|
3329
3329
|
if (!res.ok) {
|
|
3330
3330
|
return { updateAvailable: false, current, latest: current };
|
|
3331
3331
|
}
|
|
@@ -3338,6 +3338,15 @@ async function checkForUpdate() {
|
|
|
3338
3338
|
return { updateAvailable: false, current, latest: current };
|
|
3339
3339
|
}
|
|
3340
3340
|
}
|
|
3341
|
+
function normalizeResult(result, current) {
|
|
3342
|
+
if (typeof result.latest !== "string")
|
|
3343
|
+
return null;
|
|
3344
|
+
return {
|
|
3345
|
+
updateAvailable: isNewer(result.latest, current),
|
|
3346
|
+
current,
|
|
3347
|
+
latest: result.latest
|
|
3348
|
+
};
|
|
3349
|
+
}
|
|
3341
3350
|
function isNewer(latest, current) {
|
|
3342
3351
|
const l = latest.split(".").map(Number);
|
|
3343
3352
|
const c = current.split(".").map(Number);
|