chore: add scripts/validate-tool-tables.py

This commit is contained in:
Jacob Kraniak 2026-05-19 21:36:56 -04:00
parent d550a00481
commit 0c252decfe
1 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,28 @@
#!/usr/bin/env python3
"""
Tool Table Schema Validator
Enforces TOOL-TABLE-SCHEMA.md rules.
"""
import re
import sys
from pathlib import Path
def main():
errors = []
for md_file in Path('.').rglob('tools/**/*.md'):
content = md_file.read_text(encoding='utf-8', errors='ignore')
# Simple header check
if '| Name | Vendor/Webpage | GitHub Repo | Brief Description | Tags | Latest Commit | Creation Date | Stars |' in content:
# Count columns in rows
rows = re.findall(r'\|\s*[^|]+\s*\|', content)
for row in rows:
if row.count('|') != 9: # 8 columns + separators
errors.append(f"Invalid row in {md_file}")
if errors:
print('\n'.join(errors))
sys.exit(1)
print('✅ Tool tables validated.')
sys.exit(0)
if __name__ == "__main__":
main()