feat(ui): keyboard nav (Enter advances step) + yaml-health warning on launch

This commit is contained in:
Bossiara13 2026-04-23 02:13:43 +03:00
parent 0b1604e018
commit 521b124f05
2 changed files with 25 additions and 0 deletions

View file

@ -123,7 +123,21 @@ class Bridge:
return {"ok": False, "error": f"LLM недоступен: {ex}"}
def _check_yaml_health():
if not COMMANDS_YAML.exists():
return
try:
yaml_writer.load_yaml(COMMANDS_YAML)
except Exception as ex:
bak = COMMANDS_YAML.with_suffix(COMMANDS_YAML.suffix + ".bak")
msg = f"[command_builder] Не удалось разобрать {COMMANDS_YAML.name}: {ex}"
if bak.exists():
msg += f"\n[command_builder] Резервная копия доступна: {bak} — можно восстановить вручную."
print(msg, file=sys.stderr)
def main():
_check_yaml_health()
bridge = Bridge()
index_path = WEB_DIR / "index.html"
if not index_path.exists():

View file

@ -729,6 +729,17 @@
document.addEventListener("keydown", (ev) => {
if (ev.key === "Escape") {
if (state.step > 1) setStep(state.step - 1);
return;
}
if (ev.key === "Enter" && !ev.shiftKey && !ev.ctrlKey && !ev.altKey) {
const tag = (ev.target && ev.target.tagName) || "";
if (tag === "TEXTAREA") return;
if (tag === "BUTTON") return;
if (state.step < 4) {
if (state.step === 2 && state.actionType) renderActionForm();
setStep(state.step + 1);
ev.preventDefault();
}
}
});
}