The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(hermes_cli): backup/banner — join lone closing-bracket lines (AST-neutral)
Tekniumd34bc92bed90
diff --git a/hermes_cli/backup.py b/hermes_cli/backup.pyindex 75875fa05e0..586f1c06b74 100644--- a/hermes_cli/backup.py+++ b/hermes_cli/backup.py@@ -898,8 +898,7 @@ def _import_members(new_file_mode = _default_new_file_mode()def _restore_member(- member: str, rel: str, target: Path, root: Path, tighten: bool, *, strict_chmod: bool- ) -> bool:+ member: str, rel: str, target: Path, root: Path, tighten: bool, *, strict_chmod: bool) -> bool:"""Publish one member under *root*; False when blocked or failed (recorded in errors)."""if not _is_within(target, root):errors.append(f"{rel}: path traversal blocked")@@ -1483,8 +1482,7 @@ def create_pre_update_snapshots_all_profiles(for name, profile_home in _sibling_profile_homes(home):try:snap_id = create_quick_snapshot(- label="pre-update", hermes_home=profile_home, keep=keep, max_file_size=max_file_size- )+ label="pre-update", hermes_home=profile_home, keep=keep, max_file_size=max_file_size)if snap_id:results[name] = snap_idexcept Exception as exc:@@ -1617,8 +1615,7 @@ def _restore_all_sibling_profiles(def restore_config_model_settings_all_profiles(- profile_snapshots: Dict[str, str], invoking_home: Optional[Path] = None-) -> list[Dict[str, Any]]:+ profile_snapshots: Dict[str, str], invoking_home: Optional[Path] = None) -> list[Dict[str, Any]]:"""Run the config model-settings safety net for every sibling profile (see ``_restore_all_sibling_profiles``)."""return _restore_all_sibling_profiles(profile_snapshots, invoking_home, restore_config_model_settings_if_rewritten,@@ -1626,8 +1623,7 @@ def restore_config_model_settings_all_profiles(def restore_cron_jobs_all_profiles(- profile_snapshots: Dict[str, str], invoking_home: Optional[Path] = None-) -> list[Dict[str, Any]]:+ profile_snapshots: Dict[str, str], invoking_home: Optional[Path] = None) -> list[Dict[str, Any]]:"""Run the cron-jobs safety net for every sibling profile (#66140).``profile_snapshots`` comes from :func:`create_pre_update_snapshots_all_profiles`, so@@ -1759,8 +1755,7 @@ def _prune_prefixed_zips(backup_dir: Path, prefix: str, keep: int, what: str) ->def _create_prefixed_full_backup(- hermes_home: Optional[Path], prefix: str, keep: int, what: str, prune_what: str-) -> Optional[Path]:+ hermes_home: Optional[Path], prefix: str, keep: int, what: str, prune_what: str) -> Optional[Path]:"""Write ``<HERMES_HOME>/backups/<prefix><timestamp>.zip`` and prune older same-prefix zips.Returns the created path, or ``None`` if nothing was found to back up or the write failed.diff --git a/hermes_cli/banner.py b/hermes_cli/banner.pyindex 990aa96a1a3..1a18edb3ce0 100644--- a/hermes_cli/banner.py+++ b/hermes_cli/banner.py@@ -230,8 +230,7 @@ def _github_compare_behind(current_rev: str, target_rev: str) -> Optional[int]:# api.github.com 403s requests without a User-Agent.req = urllib.request.Request(- url, headers={"Accept": "application/vnd.github+json", "User-Agent": "hermes-cli-update-check"},- )+ url, headers={"Accept": "application/vnd.github+json", "User-Agent": "hermes-cli-update-check"})with urllib.request.urlopen(req, timeout=10) as resp:return json.loads(resp.read().decode("utf-8"))@@ -382,8 +381,7 @@ def check_for_updates() -> Optional[int]:# fetch), and caching it would suppress retries for the full 6-hour window (#82166).if behind is not None:_quiet(lambda: cache_file.write_text(- json.dumps({"ts": now, "behind": behind, "rev": embedded_rev, "ver": VERSION}), encoding="utf-8",- ))+ json.dumps({"ts": now, "behind": behind, "rev": embedded_rev, "ver": VERSION}), encoding="utf-8"))return behind@@ -630,8 +628,7 @@ def load_banner_snapshot(enabled_toolsets: List[str] = None) -> Optional[Dict[stif blob.get("enabled_toolsets") != sorted(enabled_toolsets or []):return Noneif not isinstance(blob.get("tools"), list) or not all(- isinstance(blob.get(k), dict) for k in ("toolset_map", "availability", "skills_by_category")- ):+ isinstance(blob.get(k), dict) for k in ("toolset_map", "availability", "skills_by_category")):return Nonereturn blob@@ -686,8 +683,7 @@ def compute_toolset_availability(enabled_toolsets: List[str] = None) -> Dict[str_enabled_ts = {str(t) for t in enabled_toolsets}if _enabled_ts:unavailable_toolsets = [- item for item in unavailable_toolsets if str(item.get("id", item.get("name", ""))) in _enabled_ts- ]+ item for item in unavailable_toolsets if str(item.get("id", item.get("name", ""))) in _enabled_ts]# Toolsets with a check_fn are lazy-initialized (e.g. honcho): unavailable at banner time# because the check hasn't run yet, but not misconfigured.lazy_tools, disabled_tools = set(), set()@@ -974,8 +970,7 @@ def build_welcome_banner(console: "Console", model: str, cwd: str,version_label = f"[link={release_info[1]}]{version_label}[/link]"outer_panel = Panel(layout_table, title=f"[bold {_skin_color('banner_title', '#FFD700')}]{version_label}[/]",- border_style=_skin_color("banner_border", "#CD7F32"), padding=(0, 2),- )+ border_style=_skin_color("banner_border", "#CD7F32"), padding=(0, 2))console.print()if shutil.get_terminal_size().columns >= 95: