chore: clean OpenClaw migration follow-up

This commit is contained in:
kshitij 2026-03-12 02:49:29 +05:30
parent 44bf859c3b
commit 4f427167ac
2 changed files with 12 additions and 9 deletions

View file

@ -12,7 +12,6 @@ Config files are stored in ~/.hermes/ for easy access.
""" """
import importlib.util import importlib.util
import json
import logging import logging
import os import os
import sys import sys
@ -2084,8 +2083,12 @@ def setup_tools(config: dict, first_install: bool = False):
_OPENCLAW_SCRIPT = ( _OPENCLAW_SCRIPT = (
PROJECT_ROOT / "optional-skills" / "migration" PROJECT_ROOT
/ "openclaw-migration" / "scripts" / "openclaw_to_hermes.py" / "optional-skills"
/ "migration"
/ "openclaw-migration"
/ "scripts"
/ "openclaw_to_hermes.py"
) )
@ -2108,7 +2111,9 @@ def _offer_openclaw_migration(hermes_home: Path) -> bool:
print() print()
if not prompt_yes_no("Would you like to import from OpenClaw?", default=True): if not prompt_yes_no("Would you like to import from OpenClaw?", default=True):
print_info("Skipping migration. You can run it later via the openclaw-migration skill.") print_info(
"Skipping migration. You can run it later via the openclaw-migration skill."
)
return False return False
# Ensure config.yaml exists before migration tries to read it # Ensure config.yaml exists before migration tries to read it

View file

@ -1,12 +1,9 @@
"""Tests for OpenClaw migration integration in the setup wizard.""" """Tests for OpenClaw migration integration in the setup wizard."""
from argparse import Namespace from argparse import Namespace
from pathlib import Path
from types import ModuleType from types import ModuleType
from unittest.mock import MagicMock, patch from unittest.mock import MagicMock, patch
import pytest
from hermes_cli import setup as setup_mod from hermes_cli import setup as setup_mod
@ -145,7 +142,7 @@ class TestOfferOpenclawMigration:
patch.object(setup_mod, "_OPENCLAW_SCRIPT", script), patch.object(setup_mod, "_OPENCLAW_SCRIPT", script),
patch.object(setup_mod, "prompt_yes_no", return_value=True), patch.object(setup_mod, "prompt_yes_no", return_value=True),
patch.object(setup_mod, "get_config_path", return_value=config_path), patch.object(setup_mod, "get_config_path", return_value=config_path),
patch.object(setup_mod, "load_config", return_value={"agent": {}}) as mock_load, patch.object(setup_mod, "load_config", return_value={"agent": {}}),
patch.object(setup_mod, "save_config") as mock_save, patch.object(setup_mod, "save_config") as mock_save,
patch( patch(
"importlib.util.spec_from_file_location", "importlib.util.spec_from_file_location",
@ -242,7 +239,8 @@ class TestSetupWizardOpenclawIntegration:
patch.object(setup_mod, "load_config", return_value={}), patch.object(setup_mod, "load_config", return_value={}),
patch.object(setup_mod, "get_hermes_home", return_value=tmp_path), patch.object(setup_mod, "get_hermes_home", return_value=tmp_path),
patch.object( patch.object(
setup_mod, "get_env_value", setup_mod,
"get_env_value",
side_effect=lambda k: "sk-xxx" if k == "OPENROUTER_API_KEY" else "", side_effect=lambda k: "sk-xxx" if k == "OPENROUTER_API_KEY" else "",
), ),
patch("hermes_cli.auth.get_active_provider", return_value=None), patch("hermes_cli.auth.get_active_provider", return_value=None),