import sys
import os
from streamlit.web import cli as stcli


def run_dashboard():
    """
    Launches the Streamlit Dashboard.
    """
    dirname = os.path.dirname(__file__)
    filename = os.path.join(dirname, "app.py")

    # Check if .env exists, if not, print a helpful message
    if not os.path.exists(".env"):
        print(
            "⚠️  No .env file found. The Dashboard will prompt you to set up credentials."
        )

    sys.argv = ["streamlit", "run", filename]
    sys.exit(stcli.main())
