()
| 185 | |
| 186 | |
| 187 | def main(): |
| 188 | parser = argparse.ArgumentParser(description="Validate content schemas") |
| 189 | parser.add_argument("--path", default=".", |
| 190 | help="Path to validate (default: entire repo)") |
| 191 | parser.add_argument("--strict", action="store_true", |
| 192 | help="Treat warnings as errors") |
| 193 | args = parser.parse_args() |
| 194 | |
| 195 | search_path = ROOT / args.path if args.path != "." else ROOT |
| 196 | # Exclude docs/ and scripts/ directories |
| 197 | if not search_path.exists(): |
| 198 | print(f"ERROR: Path not found: {search_path}") |
| 199 | sys.exit(1) |
| 200 | |
| 201 | errors = [] |
| 202 | warnings = [] |
| 203 | |
| 204 | print(f"Validating content in: {search_path.relative_to(ROOT) if search_path != ROOT else '.'}") |
| 205 | checked, failed = validate_path(search_path, errors, warnings) |
| 206 | |
| 207 | print(f"\nChecked: {checked} files") |
| 208 | |
| 209 | if warnings: |
| 210 | print(f"\nWarnings ({len(warnings)}):") |
| 211 | for w in warnings: |
| 212 | print(w) |
| 213 | |
| 214 | if errors: |
| 215 | print(f"\nErrors ({len(errors)}):") |
| 216 | for e in errors: |
| 217 | print(e) |
| 218 | print(f"\nFAILED: {failed}/{checked} files have errors") |
| 219 | sys.exit(1) |
| 220 | else: |
| 221 | print(f"\nOK: All {checked} files passed validation") |
| 222 | if args.strict and warnings: |
| 223 | print("FAILED: strict mode, warnings treated as errors") |
| 224 | sys.exit(1) |
| 225 | |
| 226 | |
| 227 | if __name__ == "__main__": |
no test coverage detected