MCPcopy Create free account
hub / github.com/Claw-AI-Lab/Claw-AI-Lab / cmd_validate

Function cmd_validate

backend/agent/researchclaw/cli.py:290–323  ·  view source on GitHub ↗
(args: argparse.Namespace)

Source from the content-addressed store, hash-verified

288
289
290def cmd_validate(args: argparse.Namespace) -> int:
291 from researchclaw.config import validate_config
292 import yaml
293
294 resolved = _resolve_config_or_exit(args)
295 if resolved is None:
296 return 1
297 config_path = resolved
298 no_check_paths = cast(bool, args.no_check_paths)
299
300 with config_path.open(encoding="utf-8") as f:
301 loaded = cast(object, yaml.safe_load(f))
302
303 if loaded is None:
304 data: dict[str, object] = {}
305 elif isinstance(loaded, dict):
306 loaded_map = cast(Mapping[object, object], loaded)
307 data = {str(key): value for key, value in loaded_map.items()}
308 else:
309 print("Config validation FAILED:")
310 print(" Error: Config root must be a mapping")
311 return 1
312
313 result = validate_config(data, check_paths=not no_check_paths)
314 if result.ok:
315 print("Config validation passed")
316 for w in result.warnings:
317 print(f" Warning: {w}")
318 return 0
319 else:
320 print("Config validation FAILED:")
321 for e in result.errors:
322 print(f" Error: {e}")
323 return 1
324
325
326def cmd_doctor(args: argparse.Namespace) -> int:

Callers 1

mainFunction · 0.85

Calls 3

validate_configFunction · 0.90
_resolve_config_or_exitFunction · 0.85
openMethod · 0.45

Tested by

no test coverage detected