agendex-cli 0.10.0 → 0.10.1
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 +39 -14
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2948,18 +2948,21 @@ function getDefaultSiteUrl() {
|
|
|
2948
2948
|
return process.env.AGENDEX_SITE_URL;
|
|
2949
2949
|
return isDevMode() ? DEV_SITE_URL : PROD_SITE_URL;
|
|
2950
2950
|
}
|
|
2951
|
+
function launchBrowser(url, label) {
|
|
2952
|
+
console.log(`[agendex] Opening ${label}...`);
|
|
2953
|
+
console.log(`[agendex] If it doesn't open, visit: ${url}`);
|
|
2954
|
+
if (process.env.AGENDEX_DISABLE_BROWSER === "1") {
|
|
2955
|
+
console.log("[agendex] Browser launch disabled by AGENDEX_DISABLE_BROWSER=1.");
|
|
2956
|
+
} else {
|
|
2957
|
+
openBrowser(url);
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2951
2960
|
async function login(siteUrlOverride) {
|
|
2952
2961
|
const { port, result } = await startCallbackServer();
|
|
2953
2962
|
const callbackUrl = `http://127.0.0.1:${port}/callback`;
|
|
2954
2963
|
const siteUrl = siteUrlOverride ?? getDefaultSiteUrl();
|
|
2955
2964
|
const authUrl = `${siteUrl}/auth/cli?callback=${encodeURIComponent(callbackUrl)}`;
|
|
2956
|
-
|
|
2957
|
-
console.log(`[agendex] If it doesn't open, visit: ${authUrl}`);
|
|
2958
|
-
if (process.env.AGENDEX_DISABLE_BROWSER === "1") {
|
|
2959
|
-
console.log("[agendex] Browser launch disabled by AGENDEX_DISABLE_BROWSER=1.");
|
|
2960
|
-
} else {
|
|
2961
|
-
openBrowser(authUrl);
|
|
2962
|
-
}
|
|
2965
|
+
launchBrowser(authUrl, "browser for authentication");
|
|
2963
2966
|
const callback = await result;
|
|
2964
2967
|
const existing = loadConfig();
|
|
2965
2968
|
const config = {
|
|
@@ -3409,7 +3412,7 @@ import { join as join12 } from "node:path";
|
|
|
3409
3412
|
// package.json
|
|
3410
3413
|
var package_default = {
|
|
3411
3414
|
name: "agendex-cli",
|
|
3412
|
-
version: "0.10.
|
|
3415
|
+
version: "0.10.1",
|
|
3413
3416
|
description: "Agendex CLI for login, sync, and daemon workflows",
|
|
3414
3417
|
homepage: "https://github.com/Tyru5/Agendex#readme",
|
|
3415
3418
|
repository: {
|
|
@@ -3523,13 +3526,23 @@ function isNewer(latest, current) {
|
|
|
3523
3526
|
async function openAgendexWeb(siteUrlOverride) {
|
|
3524
3527
|
const base = siteUrlOverride ?? getDefaultSiteUrl();
|
|
3525
3528
|
const url = base.replace(/\/$/, "");
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3529
|
+
launchBrowser(url, "Agendex in your browser");
|
|
3530
|
+
}
|
|
3531
|
+
async function openSharedPlan(url) {
|
|
3532
|
+
let parsed;
|
|
3533
|
+
try {
|
|
3534
|
+
parsed = new URL(url);
|
|
3535
|
+
} catch {
|
|
3536
|
+
console.error(`[agendex] invalid URL: ${url}`);
|
|
3537
|
+
return false;
|
|
3538
|
+
}
|
|
3539
|
+
if (!parsed.pathname.includes("/shared/")) {
|
|
3540
|
+
console.error(`[agendex] not a shared plan URL: ${url}`);
|
|
3541
|
+
console.error("[agendex] expected format: https://app.agendex.dev/shared/<token>");
|
|
3542
|
+
return false;
|
|
3532
3543
|
}
|
|
3544
|
+
launchBrowser(url, "shared plan in your browser");
|
|
3545
|
+
return true;
|
|
3533
3546
|
}
|
|
3534
3547
|
|
|
3535
3548
|
// src/cli.ts
|
|
@@ -3559,6 +3572,7 @@ async function main() {
|
|
|
3559
3572
|
"login",
|
|
3560
3573
|
"logout",
|
|
3561
3574
|
"open",
|
|
3575
|
+
"view",
|
|
3562
3576
|
"cleanup",
|
|
3563
3577
|
"help",
|
|
3564
3578
|
"--help",
|
|
@@ -3579,6 +3593,16 @@ async function main() {
|
|
|
3579
3593
|
await openAgendexWeb(siteUrl);
|
|
3580
3594
|
return 0;
|
|
3581
3595
|
}
|
|
3596
|
+
case "view": {
|
|
3597
|
+
const url = args.find((a) => a !== "view" && a !== "--dev" && !a.startsWith("--"));
|
|
3598
|
+
if (!url) {
|
|
3599
|
+
writeStderr("[agendex] usage: agendex view <shared-plan-url>");
|
|
3600
|
+
return 1;
|
|
3601
|
+
}
|
|
3602
|
+
if (!await openSharedPlan(url))
|
|
3603
|
+
return 1;
|
|
3604
|
+
return 0;
|
|
3605
|
+
}
|
|
3582
3606
|
case "start": {
|
|
3583
3607
|
if (args.includes("--daemon")) {
|
|
3584
3608
|
await startSupervisor();
|
|
@@ -3782,6 +3806,7 @@ Usage:
|
|
|
3782
3806
|
agendex login --url <url> Login to a self-hosted instance
|
|
3783
3807
|
agendex open Open the Agendex web app in your browser
|
|
3784
3808
|
agendex open --url <url> Open a self-hosted instance
|
|
3809
|
+
agendex view <url> Open a shared plan URL in your browser
|
|
3785
3810
|
agendex logout Clear stored cloud token
|
|
3786
3811
|
agendex configure Select which agents/adapters to index
|
|
3787
3812
|
agendex sync One-shot scan + sync to cloud (skips unchanged plans)
|