Skip to content

Open-source skills for designing and reviewing software with AI agents

fix(packaging): report missing OpenAI interface icons as ValueError (#195)

Megan Tangddbf23d0b8fb
diff --git a/scripts/pack_plugin.py b/scripts/pack_plugin.py
index e3dac6c..1d60296 100644
--- a/scripts/pack_plugin.py
+++ b/scripts/pack_plugin.py
@@ -88,7 +88,10 @@ def build(root: Path, target: str, output: Path) -> tuple[Path, Path]:
interface = openai.get("interface", {})
if target == "openai":
interface = interface or manifest.get("interface", {})
- references += [interface[key] for key in ("composerIcon", "logo")]
+ for key in ("composerIcon", "logo"):
+ if not interface.get(key):
+ raise ValueError(f"Missing OpenAI interface reference: {key}")
+ references.append(interface[key])
else:
references.append(manifest.get("icon", "./.claude-plugin/icon.png"))
for reference in references:
diff --git a/tests/unit/test_packaging.py b/tests/unit/test_packaging.py
index 16fa268..6c8f771 100644
--- a/tests/unit/test_packaging.py
+++ b/tests/unit/test_packaging.py
@@ -163,6 +163,18 @@ def test_rejects_escaping_or_missing_manifest_assets(
build(source, "openai", tmp_path / "output")
[email protected]("key", ["composerIcon", "logo"])
+def test_rejects_missing_openai_interface_icons(
+ source: Path, tmp_path: Path, key: str,
+) -> None:
+ path = source / "plugin.json"
+ manifest = json.loads(path.read_text())
+ del manifest["extensions"]["com.openai"]["interface"][key]
+ path.write_text(json.dumps(manifest))
+ with pytest.raises(ValueError, match=f"Missing OpenAI interface reference: {key}"):
+ build(source, "openai", tmp_path / "output")
+
+
def test_refuses_hooks_and_overwrites(source: Path, tmp_path: Path) -> None:
output = tmp_path / "output"
build(source, "claude", output)