@lenne.tech/cli 1.20.0 → 1.22.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/README.md +25 -0
- package/build/commands/dev/dev.js +32 -0
- package/build/commands/dev/doctor.js +110 -0
- package/build/commands/dev/down.js +76 -0
- package/build/commands/dev/install.js +113 -0
- package/build/commands/dev/migrate.js +96 -0
- package/build/commands/dev/status.js +153 -0
- package/build/commands/dev/test.js +191 -0
- package/build/commands/dev/up.js +228 -0
- package/build/commands/fullstack/init.js +36 -2
- package/build/commands/status.js +37 -6
- package/build/extensions/server.js +14 -4
- package/build/lib/caddy.js +169 -0
- package/build/lib/dev-env-bridge.js +109 -0
- package/build/lib/dev-env.js +35 -0
- package/build/lib/dev-identity.js +100 -0
- package/build/lib/dev-migrate-helper.js +81 -0
- package/build/lib/dev-patches.js +190 -0
- package/build/lib/dev-process.js +152 -0
- package/build/lib/dev-project.js +86 -0
- package/build/lib/dev-state.js +152 -0
- package/docs/commands.md +202 -0
- package/package.json +7 -10
package/docs/commands.md
CHANGED
|
@@ -12,6 +12,8 @@ This document provides a comprehensive reference for all `lt` CLI commands. For
|
|
|
12
12
|
|
|
13
13
|
- [CLI Commands](#cli-commands)
|
|
14
14
|
- [Server Commands](#server-commands)
|
|
15
|
+
- [Local Development Commands](#local-development-commands)
|
|
16
|
+
- [Ports Commands](#ports-commands)
|
|
15
17
|
- [Git Commands](#git-commands)
|
|
16
18
|
- [Fullstack Commands](#fullstack-commands)
|
|
17
19
|
- [Deployment Commands](#deployment-commands)
|
|
@@ -282,6 +284,206 @@ For mode-aware update workflows after conversion, use:
|
|
|
282
284
|
|
|
283
285
|
---
|
|
284
286
|
|
|
287
|
+
## Local Development Commands
|
|
288
|
+
|
|
289
|
+
Run multiple lt projects in parallel without port collisions or cross-wiring.
|
|
290
|
+
**URL-first**: every project gets stable HTTPS URLs (`<slug>.localhost`,
|
|
291
|
+
`api.<slug>.localhost`) served by Caddy. Internal ports are opaque and
|
|
292
|
+
auto-allocated. Cross-project state (database, storage, cookies) is
|
|
293
|
+
namespaced by slug so projects cannot accidentally interfere.
|
|
294
|
+
|
|
295
|
+
### `lt dev`
|
|
296
|
+
|
|
297
|
+
Open the local-orchestration submenu.
|
|
298
|
+
|
|
299
|
+
**Usage:**
|
|
300
|
+
```bash
|
|
301
|
+
lt dev
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
**Alias:** `lt d`
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
### `lt dev install`
|
|
309
|
+
|
|
310
|
+
One-time per-machine setup. Idempotent — re-run anytime to diagnose what's missing.
|
|
311
|
+
|
|
312
|
+
**Usage:**
|
|
313
|
+
```bash
|
|
314
|
+
lt dev install
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
**Alias:** `lt d i`
|
|
318
|
+
|
|
319
|
+
**What it does:**
|
|
320
|
+
1. Verifies `caddy` is on PATH (suggests `brew install caddy` if missing).
|
|
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`.
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
### `lt dev migrate`
|
|
329
|
+
|
|
330
|
+
Register an existing project with `lt dev` and apply idempotent env-aware patches. Safe to run multiple times; safe to run after `lt fullstack init`.
|
|
331
|
+
|
|
332
|
+
**Usage:**
|
|
333
|
+
```bash
|
|
334
|
+
lt dev migrate
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
**Alias:** `lt d m`
|
|
338
|
+
|
|
339
|
+
**What it does:**
|
|
340
|
+
1. Detects the workspace layout (monorepo `projects/api`+`projects/app`, or standalone).
|
|
341
|
+
2. Builds the project identity (slug from `package.json` "name", subdomains).
|
|
342
|
+
3. Patches legacy hardcoded ports in `config.env.ts` (`port: 3000`), `nuxt.config.ts` (`port: 3001`, vite proxy target), `playwright.config.ts` (`baseURL`/`host`/`url`) to env-overridable form. Defaults preserved, idempotent.
|
|
343
|
+
4. Persists the entry to `~/.lenneTech/projects.json` (override path via `LT_DEV_REGISTRY_PATH`).
|
|
344
|
+
5. Adds `.lt-dev/` to the project's `.gitignore`.
|
|
345
|
+
6. Injects (or refreshes) a "Local Development (lt dev)" URL block into `CLAUDE.md` files at the workspace root and inside each subproject — bracketed by HTML comment markers.
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
### `lt dev up`
|
|
350
|
+
|
|
351
|
+
Start API + App behind Caddy. Allocates internal ports (4000+), spawns processes detached, persists PIDs to `<root>/.lt-dev/state.json`.
|
|
352
|
+
|
|
353
|
+
**Usage:**
|
|
354
|
+
```bash
|
|
355
|
+
lt dev up
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
**Alias:** `lt d u`
|
|
359
|
+
|
|
360
|
+
**Environment variables injected:**
|
|
361
|
+
| Variable | Consumer | Example value |
|
|
362
|
+
|----------|----------|---------------|
|
|
363
|
+
| `PORT` | Nest (api) / Nuxt (app) | auto-allocated 4000+ |
|
|
364
|
+
| `BASE_URL` / `NSC__BASE_URL` | nest-server canonical API URL | `https://api.crm.localhost` |
|
|
365
|
+
| `APP_URL` / `NSC__APP_URL` | nest-server frontend origin (CORS, BetterAuth) | `https://crm.localhost` |
|
|
366
|
+
| `NUXT_API_URL` | Nuxt vite-proxy target for `/api`, `/iam`, … | `https://api.crm.localhost` |
|
|
367
|
+
| `NUXT_PUBLIC_API_URL` | Nuxt `useRuntimeConfig().public.apiUrl` | `https://api.crm.localhost` |
|
|
368
|
+
| `NUXT_PUBLIC_SITE_URL` | Nuxt `useRuntimeConfig().public.siteUrl` + Playwright | `https://crm.localhost` |
|
|
369
|
+
| `NUXT_PUBLIC_STORAGE_PREFIX` | namespaces sessionStorage/localStorage | `crm` |
|
|
370
|
+
| `NUXT_PUBLIC_API_PROXY` | always `false` — Caddy + cookie-domain make it obsolete | `false` |
|
|
371
|
+
| `NSC__MONGOOSE__URI` | nest-server Mongoose URI | `mongodb://127.0.0.1/crm-local` |
|
|
372
|
+
| `DATABASE_URL` | Postgres convenience URL (for nest-base-style projects) | `postgresql://crm-local:crm-local@localhost:5432/crm-local` |
|
|
373
|
+
|
|
374
|
+
**Override the binary** for both spawns via `LT_PNPM_BIN` (e.g. `LT_PNPM_BIN=/usr/local/bin/pnpm lt dev up`).
|
|
375
|
+
|
|
376
|
+
**Pre-flight guards (exit code 1 each):**
|
|
377
|
+
- Caddy not installed (`lt dev install` first)
|
|
378
|
+
- Caddy daemon not running (`brew services start caddy`)
|
|
379
|
+
- Already running for this project (`lt dev down` first)
|
|
380
|
+
- Internal port already in use
|
|
381
|
+
|
|
382
|
+
**Logs:** `<root>/.lt-dev/api.log`, `<root>/.lt-dev/app.log` (append-mode).
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
### `lt dev down`
|
|
387
|
+
|
|
388
|
+
Stop processes started by `lt dev up` and remove the project's Caddy block.
|
|
389
|
+
|
|
390
|
+
**Usage:**
|
|
391
|
+
```bash
|
|
392
|
+
lt dev down
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
**Alias:** `lt d d`
|
|
396
|
+
|
|
397
|
+
Sends `SIGTERM` to the detached process group (negative PID) so descendants — Vite, the Nest watcher, etc. — receive the signal too. PID values from `state.json` are validated before signaling. Best-effort: removes the project's Caddy block and reloads even if no session was active.
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
### `lt dev status`
|
|
402
|
+
|
|
403
|
+
Show what is registered + running.
|
|
404
|
+
|
|
405
|
+
**Usage:**
|
|
406
|
+
```bash
|
|
407
|
+
lt dev status # current project
|
|
408
|
+
lt dev status --all # every project in the registry
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
**Alias:** `lt d s`
|
|
412
|
+
|
|
413
|
+
The current-project view shows subdomains → upstream ports, db URI, session PIDs (alive/dead), and live `lsof` state. The `--all` view lists every project, with a `●`/`○` indicator for running state.
|
|
414
|
+
|
|
415
|
+
---
|
|
416
|
+
|
|
417
|
+
### `lt dev doctor`
|
|
418
|
+
|
|
419
|
+
Diagnose Caddy / CA / DNS / port issues. Exit code 0 = all green, 1 = at least one FAIL.
|
|
420
|
+
|
|
421
|
+
**Usage:**
|
|
422
|
+
```bash
|
|
423
|
+
lt dev doctor
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
**Alias:** `lt d doc`
|
|
427
|
+
|
|
428
|
+
**Checks:**
|
|
429
|
+
1. `caddy` on PATH
|
|
430
|
+
2. Caddy daemon running (admin endpoint `:2019` reachable)
|
|
431
|
+
3. Caddyfile validates
|
|
432
|
+
4. Ports 80 + 443 free or held by Caddy
|
|
433
|
+
5. `*.localhost` resolves to `127.0.0.1` (RFC 6761)
|
|
434
|
+
6. Registry status
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
### `lt dev test`
|
|
439
|
+
|
|
440
|
+
One-shot E2E wrapper: ensure `up`, wait for the App URL, run `pnpm run test:e2e` with the `.lt-dev/.env` bridge loaded. Optional teardown after.
|
|
441
|
+
|
|
442
|
+
**Usage:**
|
|
443
|
+
```bash
|
|
444
|
+
lt dev test # App E2E (projects/app)
|
|
445
|
+
lt dev test --api # API E2E (projects/api) — no Caddy required
|
|
446
|
+
lt dev test --teardown # plus `lt dev down` after
|
|
447
|
+
lt dev test --debug # PWDEBUG=1 + HEADED=1
|
|
448
|
+
lt dev test -- --ui spec.ts # everything after `--` is forwarded to playwright
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
**Alias:** `lt d t`
|
|
452
|
+
|
|
453
|
+
**Behaviour:**
|
|
454
|
+
1. Pre-flight: Caddy installed + daemon running (App mode only).
|
|
455
|
+
2. If no `lt dev up` session is alive: invokes `lt dev up` first.
|
|
456
|
+
3. Waits up to 30 s for the App URL to respond.
|
|
457
|
+
4. Reads `<root>/.lt-dev/.env` and merges into the spawn env (existing process.env wins for keys it defines).
|
|
458
|
+
5. Spawns `pnpm run test:e2e [forwarded args]` in `projects/api` (with `--api`) or `projects/app` (default).
|
|
459
|
+
6. With `--teardown`, runs `lt dev down` after.
|
|
460
|
+
|
|
461
|
+
**When to use this vs. `pnpm run test:e2e` directly:**
|
|
462
|
+
- Use **`lt dev test`** for TDD loops, ad-hoc reproduction, or when you want a single-command "ensure-up + run + teardown" flow.
|
|
463
|
+
- Use **direct `pnpm run test:e2e`** (or VS Code Playwright Extension, IDE test runners) for everyday work — the auto-injected `playwright.config.ts` bridge loads the `.lt-dev/.env` automatically, so the env is correct without the wrapper.
|
|
464
|
+
|
|
465
|
+
---
|
|
466
|
+
|
|
467
|
+
### ENV bridge for external test runners
|
|
468
|
+
|
|
469
|
+
`lt dev up` writes a `<root>/.lt-dev/.env` file with the following keys:
|
|
470
|
+
|
|
471
|
+
| Key | Source |
|
|
472
|
+
|-----|--------|
|
|
473
|
+
| `BASE_URL`, `APP_URL`, `NSC__BASE_URL`, `NSC__APP_URL` | Identity → `https://api.<slug>.localhost` / `https://<slug>.localhost` |
|
|
474
|
+
| `NUXT_API_URL`, `NUXT_PUBLIC_API_URL`, `NUXT_PUBLIC_SITE_URL` | Same URLs for Nuxt |
|
|
475
|
+
| `NUXT_PUBLIC_STORAGE_PREFIX` | Project slug |
|
|
476
|
+
| `NUXT_PUBLIC_API_PROXY` | Always `false` under `lt dev` |
|
|
477
|
+
| `NSC__MONGOOSE__URI`, `DATABASE_URL` | Project-namespaced DB URI (when `dbName` known) |
|
|
478
|
+
| `LT_DEV_ACTIVE`, `LT_DEV_DB_NAME` | Marker keys for consumers |
|
|
479
|
+
| `NODE_EXTRA_CA_CERTS` | Path to Caddy's root CA cert (auto-detected) |
|
|
480
|
+
|
|
481
|
+
`lt dev migrate` injects a tiny `// >>> lt-dev:bridge >>>` block at the top of `playwright.config.ts` that loads this file at config-load time — making Playwright (CLI, IDE, VS Code extension) automatically use the `lt dev` URLs and trust the local CA, without inheriting the parent shell.
|
|
482
|
+
|
|
483
|
+
`lt dev down` removes the bridge file so subsequent runs without `lt dev up` fall back cleanly to the classic `localhost:3000`/`localhost:3001` defaults.
|
|
484
|
+
|
|
485
|
+
---
|
|
486
|
+
|
|
285
487
|
## Git Commands
|
|
286
488
|
|
|
287
489
|
All git commands support the `--noConfirm` flag and can be configured via `defaults.noConfirm` or `commands.git.noConfirm`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lenne.tech/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.0",
|
|
4
4
|
"description": "lenne.Tech CLI: lt",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lenne.Tech",
|
|
@@ -58,16 +58,16 @@
|
|
|
58
58
|
"bin"
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@aws-sdk/client-s3": "3.
|
|
61
|
+
"@aws-sdk/client-s3": "3.1045.0",
|
|
62
62
|
"@lenne.tech/cli-plugin-helper": "0.0.14",
|
|
63
|
-
"axios": "1.
|
|
63
|
+
"axios": "1.16.0",
|
|
64
64
|
"bcrypt": "6.0.0",
|
|
65
|
-
"defuddle": "0.
|
|
65
|
+
"defuddle": "0.18.1",
|
|
66
66
|
"glob": "13.0.6",
|
|
67
67
|
"gluegun": "5.2.2",
|
|
68
68
|
"js-sha256": "0.11.1",
|
|
69
69
|
"js-yaml": "4.1.1",
|
|
70
|
-
"jsdom": "29.
|
|
70
|
+
"jsdom": "29.1.1",
|
|
71
71
|
"lodash": "4.18.1",
|
|
72
72
|
"open": "11.0.0",
|
|
73
73
|
"playwright-core": "1.59.1",
|
|
@@ -85,15 +85,12 @@
|
|
|
85
85
|
"@types/js-yaml": "4.0.9",
|
|
86
86
|
"@types/jsdom": "28.0.1",
|
|
87
87
|
"@types/lodash": "4.17.24",
|
|
88
|
-
"@types/node": "25.6.
|
|
88
|
+
"@types/node": "25.6.2",
|
|
89
89
|
"@types/turndown": "5.0.6",
|
|
90
|
-
"@typescript-eslint/eslint-plugin": "8.58.2",
|
|
91
|
-
"@typescript-eslint/parser": "8.58.2",
|
|
92
90
|
"ejs": "5.0.2",
|
|
93
91
|
"eslint": "9.39.4",
|
|
94
|
-
"eslint-config-prettier": "10.1.8",
|
|
95
92
|
"husky": "9.1.7",
|
|
96
|
-
"jest": "30.
|
|
93
|
+
"jest": "30.4.2",
|
|
97
94
|
"prettier": "3.8.3",
|
|
98
95
|
"rimraf": "6.1.3",
|
|
99
96
|
"standard-version": "9.5.0",
|