The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(update): compact re-export import blocks (AST-identical, -117 lines)
Teknium2d7fcf636ef0
diff --git a/hermes_cli/update_cmd.py b/hermes_cli/update_cmd.pyindex d2a33746ce1..c5feb7d4044 100644--- a/hermes_cli/update_cmd.py+++ b/hermes_cli/update_cmd.py@@ -25,219 +25,102 @@ from hermes_constants import get_default_hermes_root, venv_python_path# Re-exported: main and the split modules address these via update_cmd (tests patch here).from hermes_cli.update_abort_recovery import ( # noqa: F401- _abort_recovery_is_complete,- _qualified_serve_skips,- _recover_gateway_restart_after_abort,- _serve_unit_recovery_available,- _surviving_pre_update_serve_runtimes,+ _abort_recovery_is_complete, _qualified_serve_skips, _recover_gateway_restart_after_abort,+ _serve_unit_recovery_available, _surviving_pre_update_serve_runtimes,_warn_stale_serve_runtimes,)-from hermes_cli.update_cmd_windows import ( # noqa: F401 (re-exported; tests patch hermes_cli.update_cmd.<name>)- _HOLDER_VALUE_FLAGS_FALLBACK,- _clear_windows_venv_holders_or_exit,- _cold_start_windows_gateway_after_update,- _desktop_owns_gateway_lifecycle,- _detect_venv_python_processes,- _format_venv_python_holders_message,- _handoff_reapable_backend_pids,- _hermes_holder_subcommand,- _holder_value_flags,- _holder_value_flags_cache,- _ledger_manual_serve_holders,- _ledger_reapable_backend_pids,- _leftover_pausable_gateway_pids,- _looks_like_desktop_control_plane,- _orphaned_desktop_backend_pids,- _pause_windows_gateways_for_update,- _refresh_bootstrap_cache_scripts,- _refresh_windows_gateway_launchers,- _refuse_gateway_ancestor_tree_kill,- _relaunch_stopped_serves,- _restore_windows_gateway_service,- _resume_windows_gateways_after_update,- _resume_windows_gateways_and_merge_outcome,- _self_and_non_gateway_ancestor_pids,- _serve_relaunch_commands,- _start_windows_gateway_service,- _stop_process_trees,- _stop_windows_gateway_service,- _venv_launcher_ancestors,- _wait_for_windows_update_gateway_exit,- _write_update_planned_stop_marker,+# Re-exports from the split modules: every moved name stays reachable (and monkeypatchable)+# as ``hermes_cli.update_cmd.<name>``; the split modules import origin-internal names lazily.+from hermes_cli.update_cmd_windows import ( # noqa: F401+ _HOLDER_VALUE_FLAGS_FALLBACK, _clear_windows_venv_holders_or_exit,+ _cold_start_windows_gateway_after_update, _desktop_owns_gateway_lifecycle,+ _detect_venv_python_processes, _format_venv_python_holders_message,+ _handoff_reapable_backend_pids, _hermes_holder_subcommand, _holder_value_flags,+ _holder_value_flags_cache, _ledger_manual_serve_holders, _ledger_reapable_backend_pids,+ _leftover_pausable_gateway_pids, _looks_like_desktop_control_plane,+ _orphaned_desktop_backend_pids, _pause_windows_gateways_for_update,+ _refresh_bootstrap_cache_scripts, _refresh_windows_gateway_launchers,+ _refuse_gateway_ancestor_tree_kill, _relaunch_stopped_serves,+ _restore_windows_gateway_service, _resume_windows_gateways_after_update,+ _resume_windows_gateways_and_merge_outcome, _self_and_non_gateway_ancestor_pids,+ _serve_relaunch_commands, _start_windows_gateway_service, _stop_process_trees,+ _stop_windows_gateway_service, _venv_launcher_ancestors,+ _wait_for_windows_update_gateway_exit, _write_update_planned_stop_marker,)-from hermes_cli.update_cmd_fleet import ( # noqa: F401 (re-exported; tests patch hermes_cli.update_cmd.<name>)- _FLEET_RESTART_PENDING_NAME,- _FRESH_RESTART_SUPERVISORS,- _GatewayRestartOutcome,- _apply_pending_fleet_restart_catchup,- _clear_fleet_restart_pending_marker,- _current_checkout_sha,- _drain_or_signal_gateway_for_update,- _fleet_probe_expected_runtimes,- _fleet_restart_pending_marker_path,- _for_each_systemd_gateway_unit,- _gateway_recovery_partition,- _gateway_service_matches_profile,- _pending_fleet_restart_needed,- _receipt_looks_unfinished,- _receipt_reports_stale_runtime,- _resolve_manage_cmd,- _restart_gateway_fleet_after_update,- _restart_launchd_gateway_after_update,- _restart_macos_launchd_gateways,- _restart_phase_failure_is_incomplete,- _restart_systemd_gateway_units,- _restart_systemd_gateway_units_best_effort,- _run_pending_fleet_restart,- _service_restart_sec,- _service_unit_supports_graceful_sigusr1_restart,- _surviving_gateway_pids_after_failed_restart,- _systemctl,- _systemctl_reset_and_restart,- _verify_fleet_after_update,- _wait_for_service_active,- _warn_gateway_restart_phase_aborted,- _warn_incomplete_gateway_fleet_restart,- _warn_pending_fleet_restart,- _warn_pending_fleet_restart_on_startup,- _write_fleet_restart_pending_marker,+from hermes_cli.update_cmd_fleet import ( # noqa: F401+ _FLEET_RESTART_PENDING_NAME, _FRESH_RESTART_SUPERVISORS, _GatewayRestartOutcome,+ _apply_pending_fleet_restart_catchup, _clear_fleet_restart_pending_marker,+ _current_checkout_sha, _drain_or_signal_gateway_for_update, _fleet_probe_expected_runtimes,+ _fleet_restart_pending_marker_path, _for_each_systemd_gateway_unit,+ _gateway_recovery_partition, _gateway_service_matches_profile, _pending_fleet_restart_needed,+ _receipt_looks_unfinished, _receipt_reports_stale_runtime, _resolve_manage_cmd,+ _restart_gateway_fleet_after_update, _restart_launchd_gateway_after_update,+ _restart_macos_launchd_gateways, _restart_phase_failure_is_incomplete,+ _restart_systemd_gateway_units, _restart_systemd_gateway_units_best_effort,+ _run_pending_fleet_restart, _service_restart_sec,+ _service_unit_supports_graceful_sigusr1_restart, _surviving_gateway_pids_after_failed_restart,+ _systemctl, _systemctl_reset_and_restart, _verify_fleet_after_update,+ _wait_for_service_active, _warn_gateway_restart_phase_aborted,+ _warn_incomplete_gateway_fleet_restart, _warn_pending_fleet_restart,+ _warn_pending_fleet_restart_on_startup, _write_fleet_restart_pending_marker,_write_gateway_update_exit_code,)-from hermes_cli.update_cmd_zip import ( # noqa: F401 (re-exported; tests patch hermes_cli.update_cmd.<name>)- _ZIP_PRESERVED_TOP_LEVEL,- _ZIP_STAGING_ARTIFACT_SUFFIXES,- _abort_zip_update_if_dirty_tree,- _atomic_replace_dir,- _commit_staged_replacements,- _discard_staged,- _is_zip_preserved_entry_status_line,- _is_zip_staging_artifact_status_line,- _stage_replacement,- _update_via_zip,- _zip_overlay_block_reason,+from hermes_cli.update_cmd_zip import ( # noqa: F401+ _ZIP_PRESERVED_TOP_LEVEL, _ZIP_STAGING_ARTIFACT_SUFFIXES, _abort_zip_update_if_dirty_tree,+ _atomic_replace_dir, _commit_staged_replacements, _discard_staged,+ _is_zip_preserved_entry_status_line, _is_zip_staging_artifact_status_line, _stage_replacement,+ _update_via_zip, _zip_overlay_block_reason,)-from hermes_cli.update_cmd_stash import ( # noqa: F401 (re-exported; tests patch hermes_cli.update_cmd.<name>)- _AUTOSTASH_NAME_PREFIX,- _AUTOSTASH_WARN_AGE_DAYS,- _discard_stashed_changes,- _git_untracked_paths,- _park_stashed_changes,- _print_stash_cleanup_guidance,- _reject_unsafe_stash_restore,- _resolve_stash_selector,- _restore_stashed_changes,- _restored_python_paths,- _stash_apply_failed_only_on_existing_untracked,- _stash_local_changes_if_needed,- _warn_orphaned_update_autostashes,+from hermes_cli.update_cmd_stash import ( # noqa: F401+ _AUTOSTASH_NAME_PREFIX, _AUTOSTASH_WARN_AGE_DAYS, _discard_stashed_changes,+ _git_untracked_paths, _park_stashed_changes, _print_stash_cleanup_guidance,+ _reject_unsafe_stash_restore, _resolve_stash_selector, _restore_stashed_changes,+ _restored_python_paths, _stash_apply_failed_only_on_existing_untracked,+ _stash_local_changes_if_needed, _warn_orphaned_update_autostashes,)-from hermes_cli.update_cmd_config import ( # noqa: F401 (re-exported; tests patch hermes_cli.update_cmd.<name>)- _LAST_SIBLING_SNAPSHOTS,- _check_and_apply_config_migration,- _migrate_sibling_profile_configs,- _print_items,- _reload_config_modules,- _run_config_check_fresh,- _run_migrate_config_fresh,+from hermes_cli.update_cmd_config import ( # noqa: F401+ _LAST_SIBLING_SNAPSHOTS, _check_and_apply_config_migration, _migrate_sibling_profile_configs,+ _print_items, _reload_config_modules, _run_config_check_fresh, _run_migrate_config_fresh,)-from hermes_cli.update_cmd_deps import ( # noqa: F401 (re-exported; tests patch hermes_cli.update_cmd.<name>)- _INSTALL_DEFINING_FILES,- _SELF_LOCKING_NATIVE_MODULES,- _UPDATE_CRITICAL_MODULES,- _abort_dependency_sync_if_self_locked,- _capture_active_lazy_features,- _capture_active_tool_dependencies,- _critical_module_import_failures,- _defer_update_for_self_lock,- _dependency_sync_would_rewrite,- _desktop_app_present,- _detect_self_loaded_native_modules,- _editable_install_is_current,- _ensure_uv_for_termux,- _ensure_venv_pip,- _install_psutil_android_compat,- _is_android_python,- _npm_bin_exists,- _npm_lockfile_changed,- _npm_manifest_paths,- _npm_manifests_digest,- _path_uid,- _rebuild_desktop_after_update,- _record_npm_lockfile_hash,- _refresh_active_lazy_features,- _refresh_active_memory_provider_dependencies,- _refuse_update_if_venv_foreign_owned,- _repair_node_deps_on_current_checkout,- _restore_active_tool_dependencies,- _sync_python_dependencies_after_pull,- _update_node_dependencies,- _upgrade_pip_before_lazy_refresh,- _validate_critical_modules_import,- _venv_core_imports_healthy,- _venv_foreign_owned_paths,- _web_build_toolchain_ready,+from hermes_cli.update_cmd_deps import ( # noqa: F401+ _INSTALL_DEFINING_FILES, _SELF_LOCKING_NATIVE_MODULES, _UPDATE_CRITICAL_MODULES,+ _abort_dependency_sync_if_self_locked, _capture_active_lazy_features,+ _capture_active_tool_dependencies, _critical_module_import_failures,+ _defer_update_for_self_lock, _dependency_sync_would_rewrite, _desktop_app_present,+ _detect_self_loaded_native_modules, _editable_install_is_current, _ensure_uv_for_termux,+ _ensure_venv_pip, _install_psutil_android_compat, _is_android_python, _npm_bin_exists,+ _npm_lockfile_changed, _npm_manifest_paths, _npm_manifests_digest, _path_uid,+ _rebuild_desktop_after_update, _record_npm_lockfile_hash, _refresh_active_lazy_features,+ _refresh_active_memory_provider_dependencies, _refuse_update_if_venv_foreign_owned,+ _repair_node_deps_on_current_checkout, _restore_active_tool_dependencies,+ _sync_python_dependencies_after_pull, _update_node_dependencies,+ _upgrade_pip_before_lazy_refresh, _validate_critical_modules_import,+ _venv_core_imports_healthy, _venv_foreign_owned_paths, _web_build_toolchain_ready,_web_toolchain_roots,)-from hermes_cli.update_cmd_git import ( # noqa: F401 (re-exported; tests patch hermes_cli.update_cmd.<name>)- OFFICIAL_REPO_URL,- OFFICIAL_REPO_URLS,- SKIP_UPSTREAM_PROMPT_FILE,- _ORPHAN_RESCUE_REFS_TO_KEEP,- _ORPHAN_RESCUE_REF_MAX_AGE_DAYS,- _add_upstream_remote,- _assess_parked_branch_switch,- _branch_head_label,- _branch_head_suffix,- _classify_fetch_failure,- _count_commits_between,- _discard_lockfile_churn,- _ensure_non_trampoline_git,- _get_origin_url,- _git_is_trampoline,- _has_upstream_remote,- _is_fork,- _locate_real_git,- _mark_skip_upstream_prompt,- _normalize_managed_eol,- _portable_git_candidates,- _print_fetch_failure,- _print_parked_branch_kept_notice,- _print_parked_branch_skip_warning,- _prune_orphan_rescue_refs,- _should_skip_upstream_prompt,- _sync_fork_with_upstream,+from hermes_cli.update_cmd_git import ( # noqa: F401+ OFFICIAL_REPO_URL, OFFICIAL_REPO_URLS, SKIP_UPSTREAM_PROMPT_FILE, _ORPHAN_RESCUE_REFS_TO_KEEP,+ _ORPHAN_RESCUE_REF_MAX_AGE_DAYS, _add_upstream_remote, _assess_parked_branch_switch,+ _branch_head_label, _branch_head_suffix, _classify_fetch_failure, _count_commits_between,+ _discard_lockfile_churn, _ensure_non_trampoline_git, _get_origin_url, _git_is_trampoline,+ _has_upstream_remote, _is_fork, _locate_real_git, _mark_skip_upstream_prompt,+ _normalize_managed_eol, _portable_git_candidates, _print_fetch_failure,+ _print_parked_branch_kept_notice, _print_parked_branch_skip_warning,+ _prune_orphan_rescue_refs, _should_skip_upstream_prompt, _sync_fork_with_upstream,_sync_with_upstream_if_needed,)-from hermes_cli.update_cmd_maint import ( # noqa: F401 (re-exported; tests patch hermes_cli.update_cmd.<name>)- _PRE_UPDATE_SNAPSHOT_KEEP,- _PRE_UPDATE_SNAPSHOT_MAX_FILE_SIZE,- _STALE_PURGE_PREFIXES,- _STALE_PURGE_PROTECTED,- _UPDATE_RUNTIME_RELOAD_MODULES,- _clear_stale_sqlite_sidecars,- _ensure_acp_launcher,- _ensure_fhs_path_guard,- _finish_dashboard_update_cleanup,- _format_time_ago,- _post_update_sqlite_runtime_status,- _print_bundled_skills_sync_report,- _print_curator_first_run_notice,- _print_curator_recent_run_notice,- _print_fts_optimize_available_notice,- _print_update_completion,- _print_update_summary,- _print_verified_update_completion,- _purge_stale_hermes_modules,- _read_project_version,- _reload_process_scan_modules,- _reload_updated_runtime_modules,- _resolve_pre_update_backup_mode,- _restore_state_db_from_snapshot,- _run_post_update_maintenance,- _run_pre_update_backup,- _sweep_bytecode_after_update,- _update_complete_message,- _verify_and_restore_one_state_db,+from hermes_cli.update_cmd_maint import ( # noqa: F401+ _PRE_UPDATE_SNAPSHOT_KEEP, _PRE_UPDATE_SNAPSHOT_MAX_FILE_SIZE, _STALE_PURGE_PREFIXES,+ _STALE_PURGE_PROTECTED, _UPDATE_RUNTIME_RELOAD_MODULES, _clear_stale_sqlite_sidecars,+ _ensure_acp_launcher, _ensure_fhs_path_guard, _finish_dashboard_update_cleanup,+ _format_time_ago, _post_update_sqlite_runtime_status, _print_bundled_skills_sync_report,+ _print_curator_first_run_notice, _print_curator_recent_run_notice,+ _print_fts_optimize_available_notice, _print_update_completion, _print_update_summary,+ _print_verified_update_completion, _purge_stale_hermes_modules, _read_project_version,+ _reload_process_scan_modules, _reload_updated_runtime_modules,+ _resolve_pre_update_backup_mode, _restore_state_db_from_snapshot,+ _run_post_update_maintenance, _run_pre_update_backup, _sweep_bytecode_after_update,+ _update_complete_message, _verify_and_restore_one_state_db,_verify_and_restore_state_dbs_post_update,)logger = logging.getLogger(__name__)