@lenne.tech/cli 1.22.0 → 1.24.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/docs/commands.md CHANGED
@@ -307,7 +307,7 @@ lt dev
307
307
 
308
308
  ### `lt dev install`
309
309
 
310
- One-time per-machine setup. Idempotent — re-run anytime to diagnose what's missing.
310
+ One-time per-machine setup. Idempotent — re-run anytime to diagnose what's missing. Owns the full Caddy lifecycle via a dedicated LaunchAgent (macOS) / systemd-user unit (Linux) — **does not** use `brew services caddy`, whose hardcoded `/opt/homebrew/etc/Caddyfile` path would crash-loop against our `~/.lenneTech/Caddyfile`.
311
311
 
312
312
  **Usage:**
313
313
  ```bash
@@ -319,9 +319,39 @@ lt dev install
319
319
  **What it does:**
320
320
  1. Verifies `caddy` is on PATH (suggests `brew install caddy` if missing).
321
321
  2. Creates `~/.lenneTech/Caddyfile` stub if absent.
322
- 3. Verifies the Caddy daemon is running (suggests `brew services start caddy`).
323
- 4. Validates the Caddyfile.
324
- 5. Reminds you to run `sudo caddy trust` once so browsers accept `https://*.localhost`.
322
+ 3. Detects a conflicting `brew services caddy` registration and asks you to stop it.
323
+ 4. Writes + bootstraps a dedicated service:
324
+ - **macOS:** `~/Library/LaunchAgents/tech.lenne.lt-dev-caddy.plist` via `launchctl bootstrap gui/<uid>`.
325
+ - **Linux:** `~/.config/systemd/user/lt-dev-caddy.service` via `systemctl --user enable --now`.
326
+ 5. Waits up to 8s for Caddy's admin endpoint (`http://127.0.0.1:2019/config/`) to respond.
327
+ 6. Validates the Caddyfile.
328
+ 7. Reminds you to run the CA trust command **with HOME preserved**:
329
+ ```bash
330
+ sudo -E HOME="$HOME" caddy trust
331
+ ```
332
+ Without `-E HOME="$HOME"`, sudo switches HOME to `/var/root` and caddy cannot find its user-scoped CA — this was the bug that blocked the very first install attempt.
333
+
334
+ **Logs:** `~/.lenneTech/caddy.log`, `~/.lenneTech/caddy.err.log`.
335
+
336
+ ---
337
+
338
+ ### `lt dev uninstall`
339
+
340
+ Symmetric counterpart to `lt dev install`. Removes the LaunchAgent / systemd-user unit and stops the Caddy daemon. Does **not** remove the caddy binary itself.
341
+
342
+ **Usage:**
343
+ ```bash
344
+ lt dev uninstall # interactive: asks whether to purge Caddyfile + logs
345
+ lt dev uninstall --purge # also remove ~/.lenneTech/Caddyfile + caddy logs
346
+ lt dev uninstall --noConfirm # skip the purge prompt (keep files)
347
+ ```
348
+
349
+ **Alias:** `lt d un`
350
+
351
+ **What it does NOT touch:**
352
+ - the `caddy` binary (use `brew uninstall caddy` if you want to remove the tool too)
353
+ - per-project state under `<project>/.lt-dev/` (use `lt dev down`)
354
+ - the trusted CA in the system keychain (use `sudo -E HOME="$HOME" caddy untrust` if desired)
325
355
 
326
356
  ---
327
357
 
@@ -375,7 +405,7 @@ lt dev up
375
405
 
376
406
  **Pre-flight guards (exit code 1 each):**
377
407
  - Caddy not installed (`lt dev install` first)
378
- - Caddy daemon not running (`brew services start caddy`)
408
+ - Caddy daemon not running (run `lt dev install` — it bootstraps the lt-dev service)
379
409
  - Already running for this project (`lt dev down` first)
380
410
  - Internal port already in use
381
411
 
@@ -414,6 +444,36 @@ The current-project view shows subdomains → upstream ports, db URI, session PI
414
444
 
415
445
  ---
416
446
 
447
+ ### `lt dev tunnel`
448
+
449
+ Expose a running `lt dev up` project to the public internet via a Cloudflare Quick Tunnel. Foreground command — runs until Ctrl-C.
450
+
451
+ **Usage:**
452
+ ```bash
453
+ lt dev tunnel # tunnel the App
454
+ lt dev tunnel --api # tunnel the API instead
455
+ ```
456
+
457
+ **Alias:** `lt d tun`
458
+
459
+ **What it does:**
460
+ 1. Checks `cloudflared` is on PATH (suggests `brew install cloudflared` otherwise).
461
+ 2. Confirms the Caddy daemon is up (`lt dev install` must have run).
462
+ 3. Spawns `cloudflared tunnel --url https://<slug>.localhost --http-host-header <slug>.localhost --no-tls-verify`. The host-header rewrite is required — without it Caddy would not match the project block for the random `*.trycloudflare.com` hostname.
463
+ 4. Waits for cloudflared to publish the public URL (usually 5-10s) and prints it prominently.
464
+
465
+ **Caveats (also printed at runtime):**
466
+ - Auth cookies on the localhost domain are NOT valid on the `*.trycloudflare.com` URL — users log in again on the tunnel URL.
467
+ - Better-Auth's `trustedOrigins` won't include the random tunnel URL — login flows that validate the origin reject the request unless the URL is added explicitly to the API config.
468
+ - Default tunnels expose ONLY the App. For full external usage (e.g. external client calling the API), start a second `lt dev tunnel --api` in another shell — the API will be reachable on its own `*.trycloudflare.com` URL.
469
+
470
+ **Not yet supported (intentional scope limit):**
471
+ - Named tunnels with a persistent URL (`cloudflared tunnel create`)
472
+ - Multi-host tunneling in one process
473
+ - Background/detached mode
474
+
475
+ ---
476
+
417
477
  ### `lt dev doctor`
418
478
 
419
479
  Diagnose Caddy / CA / DNS / port issues. Exit code 0 = all green, 1 = at least one FAIL.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lenne.tech/cli",
3
- "version": "1.22.0",
3
+ "version": "1.24.0",
4
4
  "description": "lenne.Tech CLI: lt",
5
5
  "keywords": [
6
6
  "lenne.Tech",