mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-22 05:22:09 +00:00
fix(doctor): generate config from defaults when template file is missing
When cli-config.yaml.example is not present (e.g. pip wheel install), fall back to writing DEFAULT_CONFIG via save_config() instead of warning and requiring a manual fix.
This commit is contained in:
parent
cc07e30f45
commit
c4bda3f27c
1 changed files with 9 additions and 7 deletions
|
|
@ -656,15 +656,17 @@ def run_doctor(args):
|
||||||
if fallback_config.exists():
|
if fallback_config.exists():
|
||||||
check_ok("cli-config.yaml exists (in project directory)")
|
check_ok("cli-config.yaml exists (in project directory)")
|
||||||
else:
|
else:
|
||||||
example_config = PROJECT_ROOT / 'cli-config.yaml.example'
|
if should_fix:
|
||||||
if should_fix and example_config.exists():
|
|
||||||
config_path.parent.mkdir(parents=True, exist_ok=True)
|
config_path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
shutil.copy2(str(example_config), str(config_path))
|
example_config = PROJECT_ROOT / 'cli-config.yaml.example'
|
||||||
check_ok(f"Created {_DHH}/config.yaml from cli-config.yaml.example")
|
if example_config.exists():
|
||||||
|
shutil.copy2(str(example_config), str(config_path))
|
||||||
|
check_ok(f"Created {_DHH}/config.yaml from cli-config.yaml.example")
|
||||||
|
else:
|
||||||
|
from hermes_cli.config import DEFAULT_CONFIG, save_config
|
||||||
|
save_config(DEFAULT_CONFIG)
|
||||||
|
check_ok(f"Created {_DHH}/config.yaml from defaults")
|
||||||
fixed_count += 1
|
fixed_count += 1
|
||||||
elif should_fix:
|
|
||||||
check_warn("config.yaml not found and no example to copy from")
|
|
||||||
manual_issues.append(f"Create {_DHH}/config.yaml manually")
|
|
||||||
else:
|
else:
|
||||||
check_warn("config.yaml not found", "(using defaults)")
|
check_warn("config.yaml not found", "(using defaults)")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue