Add explicit legacy CLI launcher command

This commit is contained in:
thePR0M3TH3AN committed 2026-03-01 18:23:22 -05:00
1 parent 92f17355ad
commit 9d1160f281
5 files changed
+65 -10

No files matched your search

+6
View File
@@ -446,6 +446,12 @@ Once installed, launch the interactive TUI with:
seedpass
```
To launch the legacy interactive TUI explicitly:
```bash
seedpass legacy
```
You can also run directly from the repository with:
```bash
+1
View File
@@ -45,6 +45,7 @@ This directory contains SeedPass project documentation.
- `seedpass --help`
- `seedpass --legacy-tui`
- `seedpass legacy`
- `seedpass <group> --help`
- `seedpass tui2 --help`
- `seedpass tui2 --check`
+6
View File
@@ -284,3 +284,9 @@
- accent borders/focus: `#58f29d`, `#2abf75`, `#274533`, `#1a3024`
- Styled Header/Footer/Input/ListView/ListItem focus/selection states to reduce default Textual blue and align with SeedPass mint-green terminal aesthetic.
- Added website-style icon semantics into TUI copy and sensitive panel titles (key/mobile/network/lock/bolt/document/users/seed mappings) to improve visual continuity between landing and app.
## 2026-03-01 Legacy launch ergonomics
- Added explicit CLI command `seedpass legacy` to launch the legacy interactive TUI directly, in addition to existing global flag `--legacy-tui`.
- Refactored legacy launch path through a shared helper in `seedpass.cli` so root fallback, `--legacy-tui`, `tui2` fallback, and `legacy` command all use consistent behavior and fingerprint forwarding.
- Added CLI regression tests for `seedpass legacy` with and without `--fingerprint`.
- Updated discoverability docs in `README.md` and `docs/README.md`.
+18 -10
View File
@@ -96,6 +96,12 @@ def _prime_tui2_service(
return None, exc
def _launch_legacy_tui(*, fingerprint: Optional[str]) -> typer.Exit:
"""Launch legacy interactive TUI and return Typer exit."""
tui = importlib.import_module("main")
return typer.Exit(tui.main(fingerprint=fingerprint))
@app.callback(invoke_without_command=True)
def main(
ctx: typer.Context,
@@ -118,8 +124,7 @@ def main(
}
if ctx.invoked_subcommand is None:
if legacy_tui:
tui = importlib.import_module("main")
raise typer.Exit(tui.main(fingerprint=fingerprint))
raise _launch_legacy_tui(fingerprint=fingerprint)
service, preflight_error = _prime_tui2_service(ctx)
if preflight_error is not None:
@@ -127,8 +132,7 @@ def main(
"TUI v2 preflight failed; falling back to legacy TUI. "
f"Details: {preflight_error}"
)
tui = importlib.import_module("main")
raise typer.Exit(tui.main(fingerprint=fingerprint))
raise _launch_legacy_tui(fingerprint=fingerprint)
launched = launch_tui2(
fingerprint=fingerprint,
@@ -141,8 +145,7 @@ def main(
"TUI v2 runtime unavailable; falling back to legacy TUI. "
"Run `seedpass tui2 --check` for diagnostics."
)
tui = importlib.import_module("main")
raise typer.Exit(tui.main(fingerprint=fingerprint))
raise _launch_legacy_tui(fingerprint=fingerprint)
@app.command("lock")
@@ -180,8 +183,7 @@ def tui2(
"TUI v2 preflight failed; falling back to legacy TUI. "
f"Details: {preflight_error}"
)
tui = importlib.import_module("main")
raise typer.Exit(tui.main(fingerprint=fingerprint))
raise _launch_legacy_tui(fingerprint=fingerprint)
typer.echo(
f"TUI v2 preflight failed: {preflight_error}",
err=True,
@@ -200,8 +202,7 @@ def tui2(
"TUI v2 runtime unavailable; falling back to legacy TUI. "
"Run `seedpass tui2 --check` for diagnostics."
)
tui = importlib.import_module("main")
raise typer.Exit(tui.main(fingerprint=fingerprint))
raise _launch_legacy_tui(fingerprint=fingerprint)
typer.echo(
"TUI v2 runtime unavailable. Install `textual` and retry.",
@@ -210,6 +211,13 @@ def tui2(
raise typer.Exit(1)
@app.command("legacy")
def legacy_tui(ctx: typer.Context) -> None:
"""Launch the legacy interactive TUI explicitly."""
fingerprint = (ctx.obj or {}).get("fingerprint")
raise _launch_legacy_tui(fingerprint=fingerprint)
@app.command()
def gui(
install: bool = typer.Option(
+34
View File
@@ -1006,6 +1006,40 @@ def test_root_legacy_tui_flag_forwards_fingerprint(monkeypatch):
assert called.get("fp") == "abc"
def test_legacy_command_forwards_fingerprint(monkeypatch):
called = {}
def fake_main(*, fingerprint=None):
called["fp"] = fingerprint
return 0
monkeypatch.setattr(
cli,
"importlib",
SimpleNamespace(import_module=lambda _: SimpleNamespace(main=fake_main)),
)
result = runner.invoke(app, ["--fingerprint", "abc", "legacy"])
assert result.exit_code == 0
assert called.get("fp") == "abc"
def test_legacy_command_default_profile(monkeypatch):
called = {}
def fake_main(*, fingerprint=None):
called["fp"] = fingerprint
return 0
monkeypatch.setattr(
cli,
"importlib",
SimpleNamespace(import_module=lambda _: SimpleNamespace(main=fake_main)),
)
result = runner.invoke(app, ["legacy"])
assert result.exit_code == 0
assert called.get("fp") is None
def test_tui2_check(monkeypatch):
monkeypatch.setattr(
cli,