-
Notifications
You must be signed in to change notification settings - Fork 15
Align official registry docs and index generation #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,12 @@ | ||
| #!/usr/bin/env python3 | ||
| """Generate INDEX.md and community-index.yaml from registry YAML files.""" | ||
|
|
||
| import yaml | ||
| import sys | ||
| from datetime import datetime, timezone | ||
| from pathlib import Path | ||
|
|
||
| import yaml | ||
|
|
||
| REGISTRY_DIR = Path("registry") | ||
| CATEGORIES_FILE = Path("categories.yaml") | ||
| OUTPUT_FILE = Path("INDEX.md") | ||
|
|
@@ -23,16 +25,48 @@ def load_categories(): | |
|
|
||
| def load_modules(): | ||
| modules = [] | ||
| for directory in ["official", "utility", "community"]: | ||
| seen = set() | ||
|
|
||
| def add_module(module, directory, source): | ||
| if not isinstance(module, dict): | ||
| print(f"Warning: module entry in {source} is not a mapping; skipping", file=sys.stderr) | ||
| return | ||
| name = module.get("name") | ||
| if not name: | ||
| print(f"Warning: module in {source} is missing a name; skipping", file=sys.stderr) | ||
| return | ||
| key = (directory, name) | ||
| if key in seen: | ||
| print(f"Warning: duplicate module {name!r} in {source}; skipping", file=sys.stderr) | ||
| return | ||
| seen.add(key) | ||
| module["_directory"] = directory | ||
| modules.append(module) | ||
|
|
||
| official_file = REGISTRY_DIR / "official.yaml" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (.github/scripts/generate-index.py:42) With Severity: low ⏳ Generating Fix in Augment link... 🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage. |
||
| if official_file.exists(): | ||
| data = load_yaml(official_file) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (.github/scripts/generate-index.py:44) If Severity: medium ⏳ Generating Fix in Augment link... 🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage. |
||
| if data is None: | ||
| print(f"Warning: {official_file} is empty; skipping", file=sys.stderr) | ||
| elif not isinstance(data, dict): | ||
| print(f"Warning: {official_file} must contain a top-level mapping; skipping", file=sys.stderr) | ||
| else: | ||
| modules_data = data.get("modules", []) | ||
| if not isinstance(modules_data, list): | ||
| print(f"Warning: {official_file} has a non-list modules field; skipping", file=sys.stderr) | ||
| modules_data = [] | ||
| for module in modules_data: | ||
| add_module(module, "official", official_file) | ||
|
|
||
| for directory in ["utility", "community"]: | ||
| dir_path = REGISTRY_DIR / directory | ||
| if not dir_path.exists(): | ||
| continue | ||
| for yaml_file in sorted(dir_path.glob("*.yaml")): | ||
| if yaml_file.name == "registry-schema.yaml": | ||
| continue | ||
| module = load_yaml(yaml_file) | ||
| module["_directory"] = directory | ||
| modules.append(module) | ||
| add_module(module, directory, yaml_file) | ||
| return modules | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(.github/scripts/generate-index.py:36) Duplicate modules (same
(directory, name)) are currently dropped silently, which can make it hard to notice conflicting registry sources or unintended duplicates.Severity: low
⏳ Generating Fix in Augment link...
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.