Skip to content

The agent that grows with you

fix(kanban): name the resolved board in watch startup

Teknium8cffac608e6c
diff --git a/hermes_cli/kanban_ops.py b/hermes_cli/kanban_ops.py
index d027bbc1d99..1f80b45302c 100644
--- a/hermes_cli/kanban_ops.py
+++ b/hermes_cli/kanban_ops.py
@@ -249,7 +249,7 @@ def _cmd_daemon(args: argparse.Namespace) -> int:
def _cmd_watch(args: argparse.Namespace) -> int:
"""Live-stream task_events to the terminal."""
kinds = {k.strip() for k in args.kinds.split(",") if k.strip()} if args.kinds else None
- print("Watching kanban events. Ctrl-C to stop.", flush=True)
+ print(f"Watching kanban events on board '{kb.get_current_board()}'. Ctrl-C to stop.", flush=True)
# Seed cursor at the latest id so we don't replay history.
with kbc.connect_closing() as conn:
cursor = int(conn.execute("SELECT COALESCE(MAX(id), 0) AS m FROM task_events").fetchone()["m"])
diff --git a/tests/hermes_cli/test_kanban_watch_banner.py b/tests/hermes_cli/test_kanban_watch_banner.py
new file mode 100644
index 00000000000..16030a045d7
--- /dev/null
+++ b/tests/hermes_cli/test_kanban_watch_banner.py
@@ -0,0 +1,33 @@
+"""Watch identifies the board selected by the production command parser."""
+
+import argparse
+
+import pytest
+
+from hermes_cli import kanban_db as kb
+from hermes_cli import kanban_ops
+from hermes_cli.kanban import kanban_command
+from hermes_cli.kanban_parser import build_parser
+
+
+ "environment,explicit,expected",
+ [(None, None, "alpha"), ("beta", None, "beta"), ("alpha", "beta", "beta")],
+)
+def test_watch_names_resolved_board(tmp_path, monkeypatch, capsys, environment, explicit, expected):
+ monkeypatch.setenv("HERMES_HOME", str(tmp_path))
+ monkeypatch.delenv("HERMES_KANBAN_DB", raising=False)
+ monkeypatch.delenv("HERMES_KANBAN_BOARD", raising=False)
+ kb.set_current_board("alpha")
+ if environment:
+ monkeypatch.setenv("HERMES_KANBAN_BOARD", environment)
+ parser = argparse.ArgumentParser()
+ build_parser(parser.add_subparsers())
+ argv = ["kanban"] + (["--board", explicit] if explicit else []) + ["watch"]
+
+ def interrupt(_interval):
+ raise KeyboardInterrupt
+
+ monkeypatch.setattr(kanban_ops.time, "sleep", interrupt)
+ assert kanban_command(parser.parse_args(argv)) == 0
+ assert f"board '{expected}'" in capsys.readouterr().out