441. GitHub handles exist
552. Website and avatar URLs are valid
663. All registry.yaml authors are defined in authors.yaml
7+ 4. All registry.yaml paths exist
8+
9+ Usage:
10+ python verify_registry.py [command]
11+
12+ Commands:
13+ all Run all verifications (default)
14+ authors Verify GitHub handles and author URLs only
15+ paths Verify registry paths only
16+ registry Verify registry authors exist in authors.yaml
717"""
818
919import yaml
@@ -40,22 +50,12 @@ def check_url(url):
4050 return False , str (e )
4151
4252
43- def main ():
44- # Load YAML files
45- authors_path = Path (__file__ ).parent .parent .parent / "authors.yaml"
46- registry_path = Path (__file__ ).parent .parent .parent / "registry.yaml"
47-
48- with open (authors_path , 'r' ) as f :
49- authors = yaml .safe_load (f )
50-
51- with open (registry_path , 'r' ) as f :
52- registry = yaml .safe_load (f )
53-
53+ def verify_authors (authors ):
54+ """Verify GitHub handles and author URLs."""
5455 failed_handles = []
5556 failed_urls = []
56- missing_authors = []
5757
58- # Step 1: Verify GitHub handles
58+ # Verify GitHub handles
5959 print ("=== Verifying GitHub Handles ===\n " )
6060 for username in authors .keys ():
6161 print (f"Checking GitHub handle: { username } ..." )
@@ -66,7 +66,7 @@ def main():
6666 else :
6767 print (f" ✓ OK" )
6868
69- # Step 2: Verify URLs
69+ # Verify URLs
7070 print ("\n === Verifying Author URLs ===\n " )
7171 for username , details in authors .items ():
7272 print (f"Checking URLs for { username } ..." )
@@ -95,7 +95,13 @@ def main():
9595 else :
9696 print (f" ✓ Avatar URL OK: { url } " )
9797
98- # Step 3: Verify registry authors exist in authors.yaml
98+ return failed_handles , failed_urls
99+
100+
101+ def verify_registry_authors (registry , authors ):
102+ """Verify registry authors exist in authors.yaml."""
103+ missing_authors = []
104+
99105 print ("\n === Verifying Registry Authors ===\n " )
100106 registry_authors = set ()
101107 for entry in registry :
@@ -112,6 +118,74 @@ def main():
112118 else :
113119 print (f" ✓ { author } " )
114120
121+ return missing_authors
122+
123+
124+ def verify_paths (registry , repo_root ):
125+ """Verify registry paths exist."""
126+ missing_paths = []
127+
128+ print ("\n === Verifying Registry Paths ===\n " )
129+ print (f"Found { len (registry )} cookbooks in registry.yaml" )
130+
131+ for entry in registry :
132+ if 'path' in entry :
133+ path = entry ['path' ]
134+ full_path = repo_root / path
135+ title = entry .get ('title' , 'Unknown' )
136+
137+ if not full_path .exists ():
138+ missing_paths .append (f"{ path } (title: { title } )" )
139+ print (f" ❌ Path not found: { path } " )
140+ else :
141+ print (f" ✓ { path } " )
142+ else :
143+ missing_paths .append (f"Entry missing 'path' field (title: { entry .get ('title' , 'Unknown' )} )" )
144+ print (f" ❌ Entry missing 'path' field: { entry .get ('title' , 'Unknown' )} " )
145+
146+ return missing_paths
147+
148+
149+ def main ():
150+ # Parse command line argument
151+ command = sys .argv [1 ] if len (sys .argv ) > 1 else "all"
152+
153+ if command not in ["all" , "authors" , "paths" , "registry" ]:
154+ print (f"Unknown command: { command } " )
155+ print (__doc__ )
156+ sys .exit (1 )
157+
158+ # Load YAML files
159+ repo_root = Path (__file__ ).parent .parent .parent
160+ authors_path = repo_root / "authors.yaml"
161+ registry_path = repo_root / "registry.yaml"
162+
163+ authors = None
164+ registry = None
165+
166+ if command in ["all" , "authors" , "registry" ]:
167+ with open (authors_path , 'r' ) as f :
168+ authors = yaml .safe_load (f )
169+
170+ if command in ["all" , "paths" , "registry" ]:
171+ with open (registry_path , 'r' ) as f :
172+ registry = yaml .safe_load (f )
173+
174+ # Run verifications based on command
175+ failed_handles = []
176+ failed_urls = []
177+ missing_authors = []
178+ missing_paths = []
179+
180+ if command in ["all" , "authors" ]:
181+ failed_handles , failed_urls = verify_authors (authors )
182+
183+ if command in ["all" , "registry" ]:
184+ missing_authors = verify_registry_authors (registry , authors )
185+
186+ if command in ["all" , "paths" ]:
187+ missing_paths = verify_paths (registry , repo_root )
188+
115189 # Report results
116190 has_failures = False
117191
@@ -133,6 +207,12 @@ def main():
133207 print (f" - { author } " )
134208 has_failures = True
135209
210+ if missing_paths :
211+ print ("\n ❌ The following paths in registry.yaml do not exist:" )
212+ for path in missing_paths :
213+ print (f" - { path } " )
214+ has_failures = True
215+
136216 if has_failures :
137217 sys .exit (1 )
138218 else :
0 commit comments