#!/usr/bin/env python3 """Validate implemented canonical skill packages.""" from importlib.machinery import SourceFileLoader from pathlib import Path import sys installer = SourceFileLoader('forge_installer', str(Path(__file__).with_name('install-skills.py'))).load_module() errors = [] for path in installer.discover(): try: installer.manifest(path) installer.safe_source(path) print(f'VALID: {path.name}') except (ValueError, UnicodeError) as exc: errors.append(str(exc)) for error in errors: print(f'INVALID: {error}', file=sys.stderr) print(f'{len(installer.discover()) - len(errors)} implemented skill(s); {len(installer.RESERVED - {p.name for p in installer.discover()})} reserved') sys.exit(bool(errors))