"""Serve the Bike-Tinder app (FastAPI + uvicorn). .venv/bin/python -m app.serve --db data/bike-tinder.sqlite3 --port 9453 Defaults per the task brief: host 127.0.0.1, port 9453, DB data/bike-tinder.sqlite3, images data/img. The import endpoint points at the hunt state dir (~/.hermes/scripts/motorcycle-hunt.d) unless --state-dir overrides it. """ import argparse import os import sys from .api import create_app def default_state_dir(): return os.path.expanduser('~/.hermes/scripts/motorcycle-hunt.d') def main(argv=None): ap = argparse.ArgumentParser(description='Bike-Tinder server') ap.add_argument('--db', default='data/bike-tinder.sqlite3') ap.add_argument('--img-dir', default='data/img') ap.add_argument('--state-dir', default=None, help='hunt state dir for POST /api/import' ' (default: ~/.hermes/scripts/motorcycle-hunt.d)') ap.add_argument('--host', default='127.0.0.1') ap.add_argument('--port', type=int, default=9453) args = ap.parse_args(argv) import uvicorn app = create_app(args.db, args.img_dir, args.state_dir or default_state_dir()) uvicorn.run(app, host=args.host, port=args.port) if __name__ == '__main__': sys.exit(main())