fix(cli): handle tool: wrapper key in agents tool add YAML config #1471 (#1498)

Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
This commit is contained in:
2026-04-02 19:33:36 +00:00
committed by Forgejo
parent 71177c6e1a
commit 0022c9c035
+9
View File
@@ -241,6 +241,15 @@ def add(
raw = config.read_text(encoding="utf-8")
config_dict = yaml.safe_load(raw)
# Handle spec-compliant 'tool:' wrapper key format
# If the YAML has a top-level 'tool:' key, extract its contents
if isinstance(config_dict, dict) and 'tool' in config_dict:
config_dict = config_dict['tool']
# Ignore 'cleveragents:' version header if present
if isinstance(config_dict, dict) and 'cleveragents' in config_dict:
del config_dict['cleveragents']
if not isinstance(config_dict, dict):
raise ValueError("YAML config must be a mapping")