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

def main():
    """Foolproof entry point for the agentic-factory CLI."""
    dirname = os.path.dirname(__file__)
    # Point exactly to the app.py in the same directory
    filename = os.path.join(dirname, 'app.py')
    
    sys.argv = ["streamlit", "run", filename] + sys.argv[1:]
    sys.exit(stcli.main())
