Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions scripts/generate_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

REPO_ROOT = Path(__file__).resolve().parents[1]
SERVICES_DIR = REPO_ROOT / "services"
REPO_SLUG_RE = re.compile(r"^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$")


def title_from_id(value: str) -> str:
Expand Down Expand Up @@ -78,6 +79,12 @@ def read_text(path: Path) -> Optional[str]:
return path.read_text(encoding="utf-8")


def validate_repo_slug(repo: str) -> str:
if not REPO_SLUG_RE.match(repo):
raise SystemExit(f"Invalid repo slug '{repo}'; expected owner/name")
return repo


def infer_repo_slug(repo_arg: Optional[str]) -> Optional[str]:
if repo_arg:
return validate_repo_slug(repo_arg)
Expand Down