"""Validators for plugin configuration and project artifacts.""" import os import yaml from typing import Dict, Any, List def validate_config(config_path: str) -> Dict[str, Any]: """Validate default_config.yaml and return errors.""" errors = [] if not os.path.exists(config_path): return {"valid": False, "errors": ["config file not found"]} try: with open(config_path, "r") as f: config = yaml.safe_load(f) if not isinstance(config, dict): errors.append("config is not a mapping") except Exception as e: errors.append(f"YAML parse error: {e}") return {"valid": len(errors) == 0, "errors": errors} def validate_project_init(project_root: str) -> List[str]: """Validate that a project has been properly initialized.""" required_dirs = [ ".a0", "specs/current", "docs", "deploy", ] missing = [] for d in required_dirs: if not os.path.isdir(os.path.join(project_root, d)): missing.append(d) return missing