@lenne.tech/cli 1.35.1 → 1.37.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
@@ -14,6 +14,7 @@ This document provides a comprehensive reference for all `lt` CLI commands. For
14
14
  - [CLI Commands](#cli-commands)
15
15
  - [Server Commands](#server-commands)
16
16
  - [Local Development Commands](#local-development-commands)
17
+ - [Ticket Commands](#ticket-commands)
17
18
  - [Ports Commands](#ports-commands)
18
19
  - [Git Commands](#git-commands)
19
20
  - [Fullstack Commands](#fullstack-commands)
@@ -488,6 +489,27 @@ Sends `SIGTERM` to the detached process group (negative PID) so descendants —
488
489
 
489
490
  ---
490
491
 
492
+ ### `lt dev prune`
493
+
494
+ Remove the leftovers that accumulate around parallel ticket work.
495
+
496
+ **Usage:**
497
+ ```bash
498
+ lt dev prune # interactive (confirms DB drops, default yes)
499
+ lt dev prune --dry-run # show the plan, change nothing
500
+ lt dev prune --noConfirm # documented default without a prompt
501
+ ```
502
+
503
+ Collects three classes of orphans:
504
+
505
+ 1. **Orphaned ticket databases** of the current project — `<base>-<id>` (+`-test`, `-test-<n>`) whose ticket has neither a live worktree nor a live registry entry. Ticket ids come from this repo's own `feat/*` branches (the durable record `lt ticket stop` keeps), never from name shapes — so sibling projects sharing a name prefix are safe. Databases recorded via `lt ticket stop --keep-db` are never touched.
506
+ 2. **Stale shard test databases** (`<base>-test-<n>` from `lt dev test --shard`) when no test session is running.
507
+ 3. **Dead registry entries** (any project) — the recorded path no longer exists, so the entry and its reserved internal ports are reclaimed. Databases of dead MAIN projects are never dropped (a deleted folder is not consent to destroy data).
508
+
509
+ `lt dev up` runs the same collection automatically after a successful start (opt out with `--no-prune`), so restarting an environment always cleans up after its predecessors. Database access uses `mongosh` when available and falls back to the project's own `mongodb` driver otherwise — a machine without mongosh no longer silently skips every drop.
510
+
511
+ ---
512
+
491
513
  ### `lt dev status`
492
514
 
493
515
  Show what is registered + running.
@@ -616,6 +638,114 @@ lt dev test -- --ui spec.ts # everything after `--` is forwarded to playwri
616
638
 
617
639
  ---
618
640
 
641
+ ## Ticket Commands
642
+
643
+ One fully isolated dev environment per ticket: a git worktree on its own branch, its own
644
+ `lt dev` stack, its own URLs (`<slug>-<id>.localhost`), its own ports, and its own database
645
+ (`<base>-<id>`). Several tickets run side by side without colliding.
646
+
647
+ ### `lt ticket start`
648
+
649
+ Create a ticket environment: worktree + branch + isolated stack.
650
+
651
+ **Usage:**
652
+ ```bash
653
+ lt ticket start DEV-2200
654
+ lt ticket start login-fix --as lf
655
+ lt ticket start DEV-2200 --base origin/develop --no-up
656
+ ```
657
+
658
+ **Parameters:**
659
+
660
+ | Parameter | Description | Default |
661
+ |-----------|-------------|---------|
662
+ | `<name>` | Ticket id (`DEV-2200` → id `2200`) or free feature name (slugified) | — |
663
+ | `--as` | Explicit short id, overriding the derived one | derived from name |
664
+ | `--base` | Base ref for the new branch | probes `origin/dev` → `develop` → remote HEAD → `main` → `master` |
665
+ | `--branch` | Explicit branch name | `feat/<name>` |
666
+ | `--no-up` | Only create the worktree; do not boot the stack | `false` |
667
+
668
+ **Reserved ids:** `local`, `dev`, `test`, `e2e`, `ci`, `prod`, `production`, `staging` are
669
+ refused. Their derived database name would collide with the *project's own* dev/test
670
+ database (both derivations strip a trailing `-(local|dev)` before appending their suffix,
671
+ so e.g. project DB `imo-local` + ticket id `local` derives back to `imo-local`). Use `--as`
672
+ to map such a name to a distinct id.
673
+
674
+ ---
675
+
676
+ ### `lt ticket stop`
677
+
678
+ Tear a ticket environment down: stop the stack, remove the worktree, **drop the ticket's
679
+ databases**. The branch is kept, so committed work is never lost.
680
+
681
+ **Usage:**
682
+ ```bash
683
+ lt ticket stop 2200
684
+ lt ticket stop 2200 --keep-db
685
+ lt ticket stop # from INSIDE a ticket worktree → cleans up "this" env
686
+ ```
687
+
688
+ **Parameters:**
689
+
690
+ | Parameter | Description | Default |
691
+ |-----------|-------------|---------|
692
+ | `<id>` | Ticket id. Omit it inside a ticket worktree to stop *that* environment | from `.lt-dev/ticket` marker |
693
+ | `--keep-db` | Keep the ticket databases instead of dropping them | `false` (they ARE dropped) |
694
+ | `--force` | Remove even with uncommitted changes / unpushed commits | `false` |
695
+ | `--noConfirm` | Skip the confirmation prompt for the database drop | `false` |
696
+ | `--drop-db` | **Deprecated no-op** — dropping is the default now | — |
697
+
698
+ **Databases are dropped by default.** `lt ticket stop` removes the whole environment —
699
+ worktree *and* registry entry — so its databases are orphans the moment it returns: nothing
700
+ references them, nothing lists them, nothing reuses them. Left behind, they simply
701
+ accumulate. The command asks before dropping (unless `--noConfirm`), and `--keep-db` opts
702
+ out entirely.
703
+
704
+ **What it will never drop:** the project's own `<base>-local` / `<base>-test` databases, a
705
+ database belonging to a *different* ticket, or one named by a registry entry that turns out
706
+ to belong to another checkout. Anything that is not provably this ticket's database is
707
+ refused with a warning rather than guessed at.
708
+
709
+ **Ordering:** the worktree is removed *before* the databases are dropped. Removing a worktree
710
+ can fail (locked, modified submodule, permissions); dropping a database cannot be undone. So
711
+ the fallible step runs first — if it fails, nothing was destroyed.
712
+
713
+ ---
714
+
715
+ ### `lt ticket list`
716
+
717
+ Dashboard of all ticket environments: URLs, branch, status, database.
718
+
719
+ **Usage:**
720
+ ```bash
721
+ lt ticket list
722
+ ```
723
+
724
+ ---
725
+
726
+ ### `lt ticket switch`
727
+
728
+ Print a ticket worktree's path and open it in the editor.
729
+
730
+ **Usage:**
731
+ ```bash
732
+ lt ticket switch 2200
733
+ ```
734
+
735
+ ---
736
+
737
+ ### `lt ticket test`
738
+
739
+ Run the E2E suite inside a ticket's isolated stack and database.
740
+
741
+ **Usage:**
742
+ ```bash
743
+ lt ticket test 2200
744
+ lt ticket test 2200 --shard 2
745
+ ```
746
+
747
+ ---
748
+
619
749
  ## Git Commands
620
750
 
621
751
  All git commands support the `--noConfirm` flag and can be configured via `defaults.noConfirm` or `commands.git.noConfirm`.
@@ -316,7 +316,7 @@
316
316
  <div class="page">
317
317
  <span class="eyebrow">Baustein 2</span>
318
318
  <h2><code style="font-size:.8em">lt ticket</code> — mehrere Tickets gleichzeitig</h2>
319
- <p class="lead">Ein Repo, beliebig viele Tickets — jedes in einem eigenen <b>git&nbsp;worktree</b> mit eigenem <code>lt dev</code>-Stack. Frisch aus <code>origin/dev</code>, in Sekunden startklar, voneinander komplett unabhängig.</p>
319
+ <p class="lead">Ein Repo, beliebig viele Tickets — jedes in einem eigenen <b>git&nbsp;worktree</b> mit eigenem <code>lt dev</code>-Stack. Frisch aus dem Basis-Branch (<code>origin/dev</code>, <code>origin/develop</code>, …), in Sekunden startklar, voneinander komplett unabhängig.</p>
320
320
 
321
321
  <figure>
322
322
  <!-- DIAGRAM B: one repo -> N worktrees -> N stacks -->
@@ -375,7 +375,7 @@
375
375
  </figure>
376
376
 
377
377
  <h3>So einfach geht's</h3>
378
- <pre><span class="k">lt ticket start</span> <span class="a">DEV-2200</span> <span class="c"># fetch + worktree aus origin/dev + install + lt dev up</span>
378
+ <pre><span class="k">lt ticket start</span> <span class="a">DEV-2200</span> <span class="c"># fetch + worktree aus dem Basis-Branch + install + lt dev up</span>
379
379
  <span class="c">→ <span class="s">https://svl-2200.localhost</span> · DB svl-…-2200 (leer)</span>
380
380
  <span class="k">lt ticket start</span> <span class="a">login-fix</span> <span class="c"># kein Ticket? freier Name → svl-login-fix.localhost</span>
381
381
  <span class="k">lt ticket start</span> <span class="a">DEV-2200 --as cof</span> <span class="c"># Kurzname überschreiben; --branch / --base ebenso</span>
@@ -383,7 +383,7 @@
383
383
  <span class="k">lt ticket list</span> <span class="c"># Dashboard: alle Tickets + URLs + Branch + Status + DB</span>
384
384
  <span class="k">lt ticket switch</span> <span class="a">2200</span> <span class="c"># Pfad zeigen + im Editor öffnen</span>
385
385
  <span class="k">lt ticket test</span> <span class="a">2200 --shard 2</span> <span class="c"># E2E im isolierten Ticket-Stack/-DB</span>
386
- <span class="k">lt ticket stop</span> <span class="a">2200 --drop-db</span> <span class="c"># down + worktree entfernen (Branch bleibt); --drop-db löscht DBs</span></pre>
386
+ <span class="k">lt ticket stop</span> <span class="a">2200</span> <span class="c"># down + worktree + DBs entfernen (Branch bleibt); --keep-db behält die DBs</span></pre>
387
387
 
388
388
  <div class="grid g3" style="margin-top:8px">
389
389
  <div class="card"><div class="ico" style="background:linear-gradient(135deg,#6366f1,#8b5cf6)">🎯</div>
@@ -391,7 +391,7 @@
391
391
  <p class="small">Jedes Ticket bekommt <code>&lt;slug&gt;-&lt;id&gt;</code> in URL, DB, Ports, Caddy-Block, Ordnername. Verwechslung ausgeschlossen.</p></div>
392
392
  <div class="card"><div class="ico" style="background:linear-gradient(135deg,#06b6d4,#0e7490)">🌱</div>
393
393
  <h3>Immer frisch aus dev</h3>
394
- <p class="small">Jeder Start macht <code>git fetch</code> und zweigt von <code>origin/dev</code> ab alle Tickets unabhängig. <code>--base</code> für Ausnahmen.</p></div>
394
+ <p class="small">Jeder Start macht <code>git fetch</code> und zweigt vom Basis-Branch ab — gesucht wird <code>origin/dev</code>, dann <code>origin/develop</code>, dann der Remote-HEAD (<code>main</code>/<code>master</code>). Findet sich keiner, fragt die CLI nach dem Branch. <code>--base</code> setzt ihn direkt (Pflicht im nicht-interaktiven Betrieb).</p></div>
395
395
  <div class="card"><div class="ico" style="background:linear-gradient(135deg,#10b981,#047857)">⚡</div>
396
396
  <h3>0&nbsp;s &amp; leicht</h3>
397
397
  <p class="small">Worktree teilt das <code>.git</code> — kein Re-Clone. Ein <code>git fetch</code> aktualisiert alle. pnpm hardlinkt aus dem Store.</p></div>
@@ -457,7 +457,7 @@
457
457
  <div class="steps">
458
458
  <div class="step"><div class="n"></div><div><b>Morgens:</b> <code>lt ticket start DEV-2200</code>, <code>lt ticket start DEV-2201</code>, <code>lt ticket start login-fix</code> — drei Tabs, drei VS-Code-Fenster, drei Claude-Sessions. Jede Umgebung ist sofort im Browser unter ihrer eigenen URL.</div></div>
459
459
  <div class="step"><div class="n"></div><div><b>Mittags:</b> Review-Feedback zu 2201 kommt rein — du wechselst per <code>lt ticket switch 2201</code>, fixst, <code>lt ticket test 2201</code> läuft <i>parallel</i> während 2200 weiter im Browser offen ist.</div></div>
460
- <div class="step"><div class="n"></div><div><b>Nachmittags:</b> 2200 ist fertig → committen, pushen, MR. <code>lt ticket stop 2200 --drop-db</code> räumt restlos auf. 2201 und login-fix laufen ungestört weiter.</div></div>
460
+ <div class="step"><div class="n"></div><div><b>Nachmittags:</b> 2200 ist fertig → committen, pushen, MR. <code>lt ticket stop 2200</code> räumt restlos auf (Stack, Worktree und DBs). 2201 und login-fix laufen ungestört weiter.</div></div>
461
461
  <div class="step"><div class="n"></div><div><b>Überblick jederzeit:</b> <code>lt ticket list</code> zeigt alle Umgebungen mit URLs, Branch, Status und DB — du verlierst nie den Faden.</div></div>
462
462
  </div>
463
463
  </div>
@@ -532,7 +532,7 @@
532
532
  <div class="grid g2">
533
533
  <div class="card"><div class="ico" style="background:linear-gradient(135deg,#f43f5e,#be123c)">🛡️</div>
534
534
  <h3>Kein versehentlicher Datenverlust</h3>
535
- <p class="small"><code>lt ticket stop</code> verweigert das Entfernen, solange <b>uncommittete</b> oder <b>ungepushte</b> Arbeit existiert — mit klarer Auflistung. <code>--force</code> überschreibt bewusst. Generierte Dateien (<code>.nuxtrc</code> &amp; Co.) blockieren nicht.</p></div>
535
+ <p class="small"><code>lt ticket stop</code> verweigert das Entfernen, solange <b>uncommittete</b> oder <b>ungepushte</b> Arbeit existiert — mit klarer Auflistung. <code>--force</code> überschreibt bewusst. Generierte Dateien (<code>.nuxtrc</code> &amp; Co.) blockieren nicht. Die <b>Ticket-DBs</b> werden dabei gelöscht (sie wären danach verwaist) — vorher fragt der Befehl nach; <code>--keep-db</code> behält sie. Die Projekt-DBs werden dabei <i>nie</i> angefasst.</p></div>
536
536
  <div class="card"><div class="ico" style="background:linear-gradient(135deg,#f59e0b,#b45309)">🩺</div>
537
537
  <h3>Selbstdiagnose</h3>
538
538
  <p class="small"><code>lt dev doctor</code> prüft Caddy, CA, DNS, Ports — und warnt, wenn ein <code>global-setup</code> Ticket-Test-DBs nicht zurücksetzen würde, samt exaktem Fix.</p></div>
@@ -541,7 +541,7 @@
541
541
  <p class="small">Jede Claude-Session in einem Ticket-Worktree erkennt am <code>.lt-dev/ticket</code>-Marker automatisch ihr Ticket — und sieht jede Runde Ticket-ID, URLs und DB. Keine getrackte Datei wird verändert.</p></div>
542
542
  <div class="card"><div class="ico" style="background:linear-gradient(135deg,#10b981,#047857)">🧹</div>
543
543
  <h3>Restfreier Teardown</h3>
544
- <p class="small">Prozesse, Caddy-Block, Session, Registry-Eintrag, Ports — alles wird sauber zurückgegeben. <code>lt ticket stop</code> ohne ID räumt sogar das <i>aktuelle</i> Worktree auf.</p></div>
544
+ <p class="small">Prozesse, Caddy-Block, Session, Registry-Eintrag, Ports und die <b>Ticket-Datenbanken</b> — alles wird sauber zurückgegeben. <code>lt ticket stop</code> ohne ID räumt sogar das <i>aktuelle</i> Worktree auf.</p></div>
545
545
  </div>
546
546
  </div>
547
547
  </section>
@@ -569,7 +569,7 @@
569
569
  <span class="k">lt ticket list</span> <span class="c"># Dashboard</span>
570
570
  <span class="k">lt ticket switch</span> <span class="a">2200</span> <span class="c"># öffnen</span>
571
571
  <span class="k">lt ticket test</span> <span class="a">2200</span> <span class="c"># isolierte E2E</span>
572
- <span class="k">lt ticket stop</span> <span class="a">2200</span> <span class="c"># aufräumen (Branch bleibt)</span>
572
+ <span class="k">lt ticket stop</span> <span class="a">2200</span> <span class="c"># aufräumen: Worktree + DBs (Branch bleibt)</span>
573
573
  <span class="m">/lt-dev:take-ticket</span> <span class="c"># Ticket im aktuellen Checkout</span>
574
574
  <span class="m">/lt-dev:git:ship</span> <span class="c"># fertig → autonom nach dev</span></pre>
575
575
  </div>
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lenne.tech/cli",
3
- "version": "1.35.1",
3
+ "version": "1.37.0",
4
4
  "description": "lenne.Tech CLI: lt",
5
5
  "keywords": [
6
6
  "lenne.Tech",