mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
refactor(tui): /clean pass on blitz closeout — trim comments, flatten logic
- normalizeStatusBar collapses to one ternary expression
- /statusbar slash hoists the toggle value and flattens the branch tree
- shift-tab yolo comment reduced to one line
- cursorLayout/offsetFromPosition lose paragraph-length comments
- appLayout collapses the three {!overlay.agents && …} into one fragment
- StatusRule drops redundant flexShrink={0} (Yoga default)
- server.py uses a walrus + frozenset and trims the compat helper
Net -43 LoC. 237 vitest + 46 pytest green, layouts unchanged.
This commit is contained in:
parent
1e8cfa9092
commit
48f2ac3352
8 changed files with 40 additions and 83 deletions
|
|
@ -455,21 +455,14 @@ def _write_config_key(key_path: str, value):
|
|||
_save_cfg(cfg)
|
||||
|
||||
|
||||
# Legacy configs stored display.tui_statusbar as a bool; a short-lived
|
||||
# intermediate wrote 'on'. Both forms map to 'top' — the inline position
|
||||
# above the input where the bar originally lived — so users don't need to
|
||||
# migrate by hand.
|
||||
_STATUSBAR_MODES = frozenset({"off", "top", "bottom"})
|
||||
|
||||
|
||||
def _coerce_statusbar(raw) -> str:
|
||||
if raw is True:
|
||||
return "top"
|
||||
if raw is False:
|
||||
return "off"
|
||||
if isinstance(raw, str):
|
||||
s = raw.strip().lower()
|
||||
if s == "on":
|
||||
return "top"
|
||||
if s in {"off", "top", "bottom"}:
|
||||
return s
|
||||
if isinstance(raw, str) and (s := raw.strip().lower()) in _STATUSBAR_MODES:
|
||||
return s
|
||||
return "top"
|
||||
|
||||
|
||||
|
|
@ -2535,17 +2528,18 @@ def _(rid, params: dict) -> dict:
|
|||
|
||||
if key == "statusbar":
|
||||
raw = str(value or "").strip().lower()
|
||||
cfg0 = _load_cfg()
|
||||
d0 = cfg0.get("display") if isinstance(cfg0.get("display"), dict) else {}
|
||||
d0 = _load_cfg().get("display") or {}
|
||||
current = _coerce_statusbar(d0.get("tui_statusbar", "top"))
|
||||
|
||||
if raw in ("", "toggle"):
|
||||
nv = "top" if current == "off" else "off"
|
||||
elif raw == "on":
|
||||
nv = "top"
|
||||
elif raw in ("off", "top", "bottom"):
|
||||
elif raw in _STATUSBAR_MODES:
|
||||
nv = raw
|
||||
else:
|
||||
return _err(rid, 4002, f"unknown statusbar value: {value}")
|
||||
|
||||
_write_config_key("display.tui_statusbar", nv)
|
||||
return _ok(rid, {"key": key, "value": nv})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue