"""Console-script entry points. These exist for one reason: `python3 -m socialmag` from inside the repo directory dies at `import asyncio`. The repo root is the package dir, so it holds `selectors.py` and `queue.py` — names the stdlib also uses. `-m` puts the current directory first on `sys.path`, so asyncio's own `import selectors` finds ours and fails with `module 'selectors' has no attribute 'SelectSelector'`. Running from one directory up avoids it, which is what the old PYTHONPATH units did. A console script is generated in the venv's `bin/` and run by absolute path, so the current directory never reaches `sys.path` at all. `cd socialmag` — the first thing anyone does after a clone — stops being a trap. The `-m` forms still work from outside the repo directory. """ import asyncio import sys from . import openbridge as _openbridge from . import refresher as _refresher from . import server as _server def serve() -> None: """socialmag — the stdio MCP server.""" try: asyncio.run(_server.main()) except KeyboardInterrupt: pass def refresh() -> int: """socialmag-refresh — one refresher pass, then exit.""" return asyncio.run(_refresher.main()) def openbridge() -> None: """socialmag-openbridge — the localhost open_link HTTP shim.""" _openbridge.main() if __name__ == "__main__": sys.exit(serve())