From fef3648420b9ebc13b4d16c27e062abd7d147ec5 Mon Sep 17 00:00:00 2001 From: Bob Nisco Date: Thu, 19 Feb 2026 13:06:24 -0800 Subject: [PATCH] ci(registry): enforce .json-only component submission files Fail validation when any non-JSON file exists in components/registry/components and document the rule in the registry README so contributors understand CI expectations. Co-authored-by: Cursor --- components/registry/README.md | 1 + components/registry/components/.gitkeep | 0 components/registry/scripts/validate.py | 15 +++++++++++++++ 3 files changed, 16 insertions(+) delete mode 100644 components/registry/components/.gitkeep diff --git a/components/registry/README.md b/components/registry/README.md index e94f299..46a99aa 100644 --- a/components/registry/README.md +++ b/components/registry/README.md @@ -72,6 +72,7 @@ Your JSON must conform to [`components/registry/schemas/component.schema.json`]( The validator enforces a few “lint” rules to keep the registry stable: +- **JSON-only directory**: every file in `components/registry/components/` must end with `.json` (placeholder files like `.gitkeep` will fail CI). - **Unique repo**: `links.github` must be unique across all submissions. If the same repo was already submitted, CI will fail. - **HTTPS only**: all URLs must be `https://` and must not use `javascript:`, `data:`, or `file:` schemes. - **Stable images** (`media.image`): must be a stable `https://` URL. diff --git a/components/registry/components/.gitkeep b/components/registry/components/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/components/registry/scripts/validate.py b/components/registry/scripts/validate.py index 48b202b..087e99b 100644 --- a/components/registry/scripts/validate.py +++ b/components/registry/scripts/validate.py @@ -206,6 +206,21 @@ def validate_components(repo_root: Path) -> list[ValidationIssue]: validator = _get_validator(schema_path) issues: list[ValidationIssue] = [] + for file_path in sorted(components_dir.iterdir()): + if not file_path.is_file(): + continue + if file_path.suffix != ".json": + issues.append( + ValidationIssue( + file=file_path, + schema=schema_path, + message=( + "Invalid file extension in components directory. " + "Source component files must end with `.json`." + ), + json_path=None, + ) + ) for json_file in sorted(components_dir.glob("*.json")): issues.extend(_validate_one(json_file, schema_path, validator)) return issues