Files
hermes-agent/hermes_cli/subcommands/webapp.py
emozilla 463af9d5c7 feat(cli): open the gateway's Webapp with hermes webapp
hermes webapp builds the bundle when it is stale, starts the gateway and
opens a one-use link the gateway mints over its private control socket.
On macOS the server cannot verify a one-use link's peer, so the command
prints the gateway's private link and never opens it. --status and
--sign-out ask the running gateway; sign-out also works with no gateway
running. A named profile served by the default gateway opens on that
profile.
2026-10-25 03:22:16 -07:00

28 lines
1.5 KiB
Python

"""``hermes webapp``: open the Desktop workspace in a browser, served by the gateway."""
from __future__ import annotations
from typing import Callable
def build_webapp_parser(subparsers, *, cmd_webapp: Callable) -> None:
parser = subparsers.add_parser(
"webapp",
help="Open the Hermes Desktop workspace in a browser",
description=(
"Open the Hermes Desktop workspace in a browser. The gateway serves it when "
"webapp.enabled is true in config.yaml; this command builds the bundle when needed, "
"starts the gateway and opens a one-use sign-in link."
),
)
parser.add_argument("--no-open", action="store_true", help="Print the one-use link instead of opening a browser")
parser.add_argument("--force-build", action="store_true",
help="Rebuild the Webapp bundle even when its build receipt is current")
parser.add_argument("--skip-build", action="store_true", help="Use the existing Webapp bundle as is")
action = parser.add_mutually_exclusive_group()
action.add_argument("--build-only", action="store_true", help="Build the Webapp bundle and stop")
action.add_argument("--status", action="store_true", help="Show whether the gateway is serving the Webapp")
action.add_argument("--sign-out", action="store_true",
help="Sign out every Webapp tab (each needs a new link from hermes webapp)")
parser.set_defaults(func=cmd_webapp)