Note: hub profiles — switching between controllers (design)

Status: implemented (2026-11-08) — flua --tool hub, the extension's Switch-hub picker, the active marker in hub list, and the serial:id per-hub state key. Multi-hub trees and profile encryption remain out of scope.

The problem

A user with several HC3s (home, cottage, a customer's) edits .env files by hand to switch. The chain already composes — process env > project .env > ~/.env — so a project can pin itself while a global default covers everything else. What's missing is a name for each controller and a one-command way to switch the global default (or pin a project).

Design: named profiles in ~/.flua/hubs.json

One file, one entry per hub:

{
  "home":    {"url": "http://192.168.1.20", "user": "admin", "password": "..."},
  "cottage": {"url": "http://192.168.2.30", "user": "admin", "password": "..."}
}

The tool: flua --tool hub

Nothing else changes: tools, the engine, doctor (which reports where HC3_URL came from), and the extension all keep reading the same chain. The precedence stays: project pin > global profile > nothing (offline).

The extension: a switch, not a credential store

The hub view title gains Switch hub: --tool hub list --json → Quick Pick (name + url + serial) → hub switch <name> in the shared terminal (so the interactive prompt still works if ever needed) → tree refresh. The extension never reads the profiles file beyond the password-free list.

The completions surface needs no change: --tool house reads the chain on every fetch, so the next refresh follows the switch automatically.

Cache and per-hub state — two identity fixes

Out of scope (named, not forgotten)

Verification without a second controller

The tests mock everything (the tool writes files under a fake HOME, like the existing tool tests); a single real controller still exercises add/list/switch end to end, and the extension picker shows the one profile.