agendex-cli 0.9.1 → 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.
Files changed (3) hide show
  1. package/README.md +10 -2
  2. package/dist/cli.js +55 -8
  3. 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, status checks, and daemon cleanup.
3
+ Node-compatible Agendex CLI for browser login, opening the web app, one-shot sync, daemon supervision, status checks, and daemon cleanup.
4
4
 
5
5
  ## Install
6
6
 
@@ -16,6 +16,8 @@ bun install -g agendex-cli
16
16
  ```bash
17
17
  agendex login # Authenticate via browser OAuth (agendex.dev)
18
18
  agendex login --url <url> # Login to a self-hosted instance
19
+ agendex open # Open the Agendex web app in your default browser
20
+ agendex open --url <url> # Open a self-hosted deployment
19
21
  agendex logout # Clear stored cloud token
20
22
  agendex configure # Select which agents/adapters to index
21
23
  agendex start # Start daemon (backgrounds itself)
@@ -86,7 +88,7 @@ Before running `start`, `configure`, or `sync`, the CLI checks for a newer publi
86
88
  [agendex] run: npm i -g agendex-cli
87
89
  ```
88
90
 
89
- The check is skipped for `stop`, `status`, `login`, `logout`, `cleanup`, and `help`.
91
+ The check is skipped for `stop`, `status`, `login`, `logout`, `open`, `cleanup`, and `help`.
90
92
 
91
93
  ## Supported Runtime
92
94
 
@@ -106,3 +108,9 @@ agendex login --url https://agendex.yourdomain.com
106
108
  This opens your deployment's OAuth flow and stores the returned `cloudToken` and `convexUrl` in your active config directory (`~/.agendex/config.json` for prod, `~/.agendex-dev/config.json` when using `--dev` or `AGENDEX_DEV=1`).
107
109
 
108
110
  The target can also be set via `AGENDEX_SITE_URL` env var. For local development against the default dev app URL, use `agendex login --dev` or set `AGENDEX_DEV=1` (see [Dev vs prod](#dev-vs-prod-config-directory) above).
111
+
112
+ ## Open the web app
113
+
114
+ `agendex open` launches your default browser to the same base URL as the default login target (`https://app.agendex.dev` in prod, or the local EE dev URL when using `--dev` / `AGENDEX_DEV=1`). Override with `agendex open --url <url>` or `AGENDEX_SITE_URL`.
115
+
116
+ If launching the browser is undesirable (for example in CI), set `AGENDEX_DISABLE_BROWSER=1`; the CLI still prints the URL to visit.
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
- console.log(`[agendex] Opening browser for authentication...`);
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.9.1",
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: {
@@ -3519,6 +3522,29 @@ function isNewer(latest, current) {
3519
3522
  return false;
3520
3523
  }
3521
3524
 
3525
+ // src/web.ts
3526
+ async function openAgendexWeb(siteUrlOverride) {
3527
+ const base = siteUrlOverride ?? getDefaultSiteUrl();
3528
+ const url = base.replace(/\/$/, "");
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;
3543
+ }
3544
+ launchBrowser(url, "shared plan in your browser");
3545
+ return true;
3546
+ }
3547
+
3522
3548
  // src/cli.ts
3523
3549
  var args = process.argv.slice(2);
3524
3550
  var devFlag = args.includes("--dev");
@@ -3545,6 +3571,8 @@ async function main() {
3545
3571
  "status",
3546
3572
  "login",
3547
3573
  "logout",
3574
+ "open",
3575
+ "view",
3548
3576
  "cleanup",
3549
3577
  "help",
3550
3578
  "--help",
@@ -3559,6 +3587,22 @@ async function main() {
3559
3587
  }
3560
3588
  }
3561
3589
  switch (command) {
3590
+ case "open": {
3591
+ const urlIdx = args.indexOf("--url");
3592
+ const siteUrl = urlIdx !== -1 ? args[urlIdx + 1] : undefined;
3593
+ await openAgendexWeb(siteUrl);
3594
+ return 0;
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
+ }
3562
3606
  case "start": {
3563
3607
  if (args.includes("--daemon")) {
3564
3608
  await startSupervisor();
@@ -3760,6 +3804,9 @@ Usage:
3760
3804
  agendex stop Stop the running daemon
3761
3805
  agendex login Authenticate via browser OAuth (agendex.dev)
3762
3806
  agendex login --url <url> Login to a self-hosted instance
3807
+ agendex open Open the Agendex web app in your browser
3808
+ agendex open --url <url> Open a self-hosted instance
3809
+ agendex view <url> Open a shared plan URL in your browser
3763
3810
  agendex logout Clear stored cloud token
3764
3811
  agendex configure Select which agents/adapters to index
3765
3812
  agendex sync One-shot scan + sync to cloud (skips unchanged plans)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agendex-cli",
3
- "version": "0.9.1",
3
+ "version": "0.10.1",
4
4
  "description": "Agendex CLI for login, sync, and daemon workflows",
5
5
  "homepage": "https://github.com/Tyru5/Agendex#readme",
6
6
  "repository": {