#!/usr/bin/env python3 """Validate fixed-channel field Recovery Skill source and optional `.skill` archive.""" from __future__ import annotations import argparse import sys import zipfile from pathlib import Path from package_fixed_channel_field_recovery_skill import validate_archive, validate_source def main() -> int: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--source", required=True, type=Path, help="Editable Skill source directory") parser.add_argument("--archive", type=Path, help="Optional packaged .skill archive") args = parser.parse_args() source = args.source.resolve() files = validate_source(source) if args.archive: validate_archive(source, args.archive.resolve()) print(f"Validated fixed-channel field Recovery Skill: {source} ({len(files)} files)") return 0 if __name__ == "__main__": try: raise SystemExit(main()) except (OSError, ValueError, zipfile.BadZipFile) as error: print(f"Validation failed: {error}", file=sys.stderr) raise SystemExit(1)