Skip to content
Merged
Show file tree
Hide file tree
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
Binary file added .claude-plugin/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions scripts/check_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
}
PACKAGE_FILES = {
".claude-plugin/plugin.json",
".claude-plugin/icon.png",
".github/workflows/validate.yml",
".mcp.json",
"LICENSE",
Expand Down Expand Up @@ -69,6 +70,10 @@ def check_tree() -> None:
if relative not in PACKAGE_FILES:
raise ValueError(f"unexpected package file: {relative}")
found_files.add(relative)
if relative == ".claude-plugin/icon.png":
if not path.read_bytes().startswith(b"\x89PNG\r\n\x1a\n"):
raise ValueError("listing icon must be a PNG")
continue
if CREDENTIAL_ASSIGNMENT.search(path.read_text(encoding="utf-8")):
raise ValueError(f"possible credential assignment in package file: {relative}")
else:
Expand Down Expand Up @@ -104,8 +109,8 @@ def check_package() -> None:
manifest_dir = ROOT / ".claude-plugin"
if manifest_dir.is_symlink() or not manifest_dir.is_dir():
raise ValueError(".claude-plugin must be a directory")
if {path.name for path in manifest_dir.iterdir()} != {"plugin.json"}:
raise ValueError(".claude-plugin must contain only plugin.json")
if {path.name for path in manifest_dir.iterdir()} != {"plugin.json", "icon.png"}:
raise ValueError(".claude-plugin must contain only plugin.json and icon.png")

skills_dir = ROOT / "skills"
if skills_dir.is_symlink() or not skills_dir.is_dir():
Expand Down
8 changes: 8 additions & 0 deletions scripts/test_check_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ def check_staged_package(self) -> None:
with patch.object(check_package, "ROOT", self.root):
check_package.check_package()

def test_binary_listing_icon_is_accepted(self) -> None:
self.check_staged_package()

def test_non_png_listing_icon_is_rejected(self) -> None:
(self.root / ".claude-plugin/icon.png").write_text("not a PNG")
with self.assertRaisesRegex(ValueError, "listing icon must be a PNG"):
self.check_staged_package()

def set_version(self, version: str) -> None:
manifest_path = self.root / ".claude-plugin/plugin.json"
manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
Expand Down
Loading