Skip to content

Commit 62ed5dc

Browse files
fix(dashboard): replace env var browser guard with --open flag
Browser auto-open is now disabled by default. Users must pass --open to open the dashboard URL in their browser. This prevents browser windows from spawning during tests or CI without relying on env vars. Upported from main branch's approach (cleaner than PWHEADLESS guard). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 013498b commit 62ed5dc

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/specify_cli/cli/commands/dashboard.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from __future__ import annotations
44

5-
import os
65
import webbrowser
76
from typing import Optional
87

@@ -23,6 +22,11 @@ def dashboard(
2322
"--kill",
2423
help="Stop the running dashboard for this project and clear its metadata.",
2524
),
25+
open_browser: bool = typer.Option(
26+
False,
27+
"--open",
28+
help="Open dashboard URL in your default browser (disabled by default).",
29+
),
2630
) -> None:
2731
"""Open or stop the Spec Kitty dashboard."""
2832
project_root = get_project_root_or_exit()
@@ -100,10 +104,7 @@ def dashboard(
100104
console.print("[cyan]" + "=" * 60 + "[/cyan]")
101105
console.print()
102106

103-
if os.environ.get("SPEC_KITTY_TEST_MODE") or os.environ.get("PWHEADLESS"):
104-
console.print(f"[green]✅ Dashboard ready at:[/green] [cyan]{dashboard_url}[/cyan]")
105-
console.print()
106-
else:
107+
if open_browser:
107108
try:
108109
webbrowser.open(dashboard_url)
109110
console.print("[green]✅ Opening dashboard in your browser...[/green]")
@@ -112,6 +113,10 @@ def dashboard(
112113
console.print("[yellow]⚠️ Could not automatically open browser[/yellow]")
113114
console.print(f" Please open this URL manually: [cyan]{dashboard_url}[/cyan]")
114115
console.print()
116+
else:
117+
console.print("[dim]Browser auto-open is disabled by default.[/dim]")
118+
console.print(f"[dim]Open manually: [cyan]{dashboard_url}[/cyan] (or use --open)[/dim]")
119+
console.print()
115120

116121

117122
__all__ = ["dashboard"]

0 commit comments

Comments
 (0)