feat(cli): make hermes portal run the full quick-setup Nous flow (model picker)

`hermes portal` / `hermes setup --portal` previously logged in and set
provider=nous but left the model UNSELECTED (blank -> runtime default) and
never showed a picker — unlike the first-time quick setup, which runs the
model picker.

Route `_run_portal_one_shot` through `_model_flow_nous` — the exact same
routine quick setup (`_run_first_time_quick_setup`) and `hermes model` -> Nous
use. It handles both the logged-out path (device-code OAuth, which picks a
model internally) and the logged-in path (curated Nous model picker), then
offers the Tool Gateway opt-in and sets provider=nous. Net effect: `hermes
portal` now offers a model picker every time and is a true single-command
collapse of quick setup's Nous step.

Removes the hand-rolled auth_add_command + manual provider write + separate
Tool Gateway prompt (now a single source of truth). Re-syncs the in-memory
config from disk afterward so a caller's later save_config can't clobber the
model/provider written by the login flow.

Docs (CLI help, portal_cli docstrings, nous-portal EN + zh-Hans) updated to
mention model selection. New regression test asserts `_run_portal_one_shot`
delegates to `_model_flow_nous`.

Verified live: `hermes portal` now shows the 27-model curated picker, 'Skip
(keep current)' preserves prior provider/model.
This commit is contained in:
kshitijk4poor
2026-06-04 02:20:31 +05:30
parent d4787d3e2e
commit cd188b814e
5 changed files with 85 additions and 89 deletions
+15 -12
View File
@@ -1,10 +1,11 @@
"""``hermes portal`` — the human-readable entry point for Nous Portal.
Running ``hermes portal`` with no subcommand performs the one-shot Portal
onboarding: OAuth login, switch the inference provider to Nous, and offer to
enable the Tool Gateway. It is the friendly alias for
``hermes auth add nous --type oauth`` (which still works) and is identical to
``hermes setup --portal``.
onboarding: OAuth login, pick a Nous model, switch the inference provider to
Nous, and offer to enable the Tool Gateway. It is the friendly alias for
``hermes auth add nous --type oauth`` (which still works), is identical to
``hermes setup --portal``, and runs the same Nous flow as the first-time quick
setup.
Subcommands:
(none) Log in to Nous Portal + set it up (one-shot onboarding).
@@ -167,12 +168,13 @@ def _cmd_tools(args) -> int:
def _cmd_login(args) -> int:
"""Run the one-shot Nous Portal onboarding (OAuth + provider + Tool Gateway).
"""Run the one-shot Nous Portal onboarding (login + model + provider + tools).
This is the human-readable front door for `hermes auth add nous --type
oauth`. It reuses the exact wiring behind `hermes setup --portal` so the
two commands stay in lockstep: device-code login, switch the inference
provider to Nous, then offer the Tool Gateway opt-in.
oauth`. It reuses the exact wiring behind `hermes setup --portal` (which in
turn runs the same Nous flow as the first-time quick setup), so the
commands stay in lockstep: device-code login, pick a Nous model, switch the
inference provider to Nous, then offer the Tool Gateway opt-in.
"""
from hermes_cli.setup import _run_portal_one_shot
@@ -210,12 +212,13 @@ def add_parser(subparsers) -> None:
"""Register `hermes portal` on the given argparse subparsers object."""
portal_parser = subparsers.add_parser(
"portal",
help="Set up Nous Portal (OAuth login + Tool Gateway); see also `portal info`",
help="Set up Nous Portal (login, model pick, Tool Gateway); see also `portal info`",
description=(
"Run `hermes portal` with no subcommand to log in to Nous Portal "
"and set it up (the human-readable alias for `hermes auth add nous "
"--type oauth`, identical to `hermes setup --portal`). Subcommands: "
"login (default), info, open, tools."
"and set it up — pick a model, set Nous as your provider, and offer "
"the Tool Gateway (the human-readable alias for `hermes auth add "
"nous --type oauth`, identical to `hermes setup --portal`). "
"Subcommands: login (default), info, open, tools."
),
)
portal_sub = portal_parser.add_subparsers(dest="portal_command")