Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,3 +333,24 @@ async def health():
index_ready=retriever is not None,
graph_ready=compiled_graph is not None
)


def main() -> None:
"""Console entry point for ``cyclaw-server`` (see pyproject [project.scripts]).

Serves the FastAPI app on the loopback host/port from config.yaml. Without
this, the declared ``cyclaw-server = "gate:main"`` script raised
AttributeError because no ``main`` symbol existed in this module.
"""
import uvicorn

api_cfg = cfg.get("api", {})
uvicorn.run(
app,
host=api_cfg.get("host", "127.0.0.1"), # DevSkim: ignore DS162092 - loopback-only binding by design
port=api_cfg.get("port", 8787),
)


if __name__ == "__main__":
main()
12 changes: 11 additions & 1 deletion metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,15 @@ def print_metrics(config_path: str = "config.yaml"):
for mode, count in mode_counts.most_common():
print(f" {mode}: {count}")

if __name__ == "__main__":
def main() -> None:
"""Console entry point for ``cyclaw-metrics`` (see pyproject [project.scripts]).

Thin wrapper over :func:`print_metrics`. The declared
``cyclaw-metrics = "metrics:main"`` script previously raised AttributeError
because this module only defined ``print_metrics``, not ``main``.
"""
print_metrics()


if __name__ == "__main__":
main()
12 changes: 11 additions & 1 deletion retrieval/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,15 @@ def build_index(config_path: str = "config.yaml") -> None:

print(f"[Indexer] Done. ChromaDB: {chroma_path}, BM25: {bm25_path}")

if __name__ == "__main__":
def main() -> None:
"""Console entry point for ``cyclaw-index`` (see pyproject [project.scripts]).

Thin wrapper over :func:`build_index`. The declared
``cyclaw-index = "retrieval.indexer:main"`` script previously raised
AttributeError because this module only defined ``build_index``.
"""
build_index()


if __name__ == "__main__":
main()
Loading