From 6f68bb6c1970e26de1f66c073ea5d7fecd21840d Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Thu, 15 Oct 2026 00:56:04 +0200 Subject: feat(cli): invitations, join, decline, leave, devices, browser access join accepts an invitation or redeems a link pasted as sent, then has the node admit a key pair made here, with the invitation's code (a link's code goes only to the node it names; one for a node that is away is kept for the next connection). decline, leave and devices revoke ask first, and refuse without --yes where there is no terminal. devices approve countersigns the one waiting request a code matches, none when several do. browser-access is the application's setting, kept per machine and never enabled from the hub's mirror: on leaves a copy sealed under M on each node, off withdraws it, unset touches nothing. A key pair made for a first contact is now kept. Co-Authored-By: Claude Opus 5.5 --- packages/meshbay-cli/src/meshbay_cli/output.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'packages/meshbay-cli/src/meshbay_cli/output.py') diff --git a/packages/meshbay-cli/src/meshbay_cli/output.py b/packages/meshbay-cli/src/meshbay_cli/output.py index 75a54ff..d4c0758 100644 --- a/packages/meshbay-cli/src/meshbay_cli/output.py +++ b/packages/meshbay-cli/src/meshbay_cli/output.py @@ -138,3 +138,23 @@ class Progress: def sentence(text: str) -> str: """The first letter up, the rest untouched: `str.capitalize` turns -R into -r.""" return text[:1].upper() + text[1:] + + +def confirm(question: str, yes: bool) -> None: + """ + Go on only on a yes: `--yes`, or `y` typed at a terminal. With neither — a + script that did not say so — refuse before anything is sent, rather than + take silence for consent. + """ + from .errors import USAGE, CliError + if yes: + return + if not sys.stdin.isatty(): + raise CliError(USAGE, f"{question} Not done: there is no terminal to ask on; " + "pass --yes to confirm.") + # On stderr, like every other word to the person: stdout is the result. + sys.stderr.write(f"{question} [y/N] ") + sys.stderr.flush() + answer = sys.stdin.readline() + if answer.strip().lower() not in ("y", "yes"): + raise CliError(USAGE, "Not done.") -- cgit v1.2.3