From 48da8c1c4afee992d476afeedc18a0661763a357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B8=D1=80=D0=B8=D0=BB=D0=BB=20=D0=A0=D0=BE=D0=BC?= =?UTF-8?q?=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Fri, 5 Jun 2026 12:37:44 +0000 Subject: [PATCH] Add src/cli.py --- src/cli.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/cli.py diff --git a/src/cli.py b/src/cli.py new file mode 100644 index 0000000..1999093 --- /dev/null +++ b/src/cli.py @@ -0,0 +1,37 @@ +"""Command‑line interface for the research brief generator. + +Usage: + python -m src.cli "Your research question" + +The CLI will: +1. Build the LangGraph. +2. Run the graph with the supplied topic. +3. Print the outline, step‑by‑step notes, and final brief. +""" + +import asyncio +import sys +from .brief import build_graph + +def main(): + if len(sys.argv) < 2: + print("Usage: python -m src.cli \"Your research question\"") + sys.exit(1) + topic = sys.argv[1] + graph = build_graph() + state = { + "topic": topic, + "outline": None, + "step_index": 0, + "notes": [], + "final_brief": None, + } + result = asyncio.run(graph.invoke(state)) + # The graph already prints progress. + # Print final brief if not already printed. + if result.get("final_brief"): + print("\n=== Final Brief ===") + print(result["final_brief"]) + +if __name__ == "__main__": + main() \ No newline at end of file