Skip to content

Commit 6d8f3c2

Browse files
ci(registry): enforce .json-only component submission files (#19)
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 <cursoragent@cursor.com>
1 parent d92955c commit 6d8f3c2

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

components/registry/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ Your JSON must conform to [`components/registry/schemas/component.schema.json`](
7272

7373
The validator enforces a few “lint” rules to keep the registry stable:
7474

75+
- **JSON-only directory**: every file in `components/registry/components/` must end with `.json` (placeholder files like `.gitkeep` will fail CI).
7576
- **Unique repo**: `links.github` must be unique across all submissions. If the same repo was already submitted, CI will fail.
7677
- **HTTPS only**: all URLs must be `https://` and must not use `javascript:`, `data:`, or `file:` schemes.
7778
- **Stable images** (`media.image`): must be a stable `https://` URL.

components/registry/components/.gitkeep

Whitespace-only changes.

components/registry/scripts/validate.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,21 @@ def validate_components(repo_root: Path) -> list[ValidationIssue]:
206206
validator = _get_validator(schema_path)
207207

208208
issues: list[ValidationIssue] = []
209+
for file_path in sorted(components_dir.iterdir()):
210+
if not file_path.is_file():
211+
continue
212+
if file_path.suffix != ".json":
213+
issues.append(
214+
ValidationIssue(
215+
file=file_path,
216+
schema=schema_path,
217+
message=(
218+
"Invalid file extension in components directory. "
219+
"Source component files must end with `.json`."
220+
),
221+
json_path=None,
222+
)
223+
)
209224
for json_file in sorted(components_dir.glob("*.json")):
210225
issues.extend(_validate_one(json_file, schema_path, validator))
211226
return issues

0 commit comments

Comments
 (0)