diff --git a/internal/plugin/source_compat_test.go b/internal/plugin/source_compat_test.go index ce95ecc4b..14e4d5605 100644 --- a/internal/plugin/source_compat_test.go +++ b/internal/plugin/source_compat_test.go @@ -112,15 +112,17 @@ func TestDroidPluginTargetNotSupported(t *testing.T) { } } -func TestNativeManifestPrecedesPortableFallback(t *testing.T) { +// Codex 0.159 installs from a portable root plugin.json ahead of .codex-plugin/plugin.json, so +// its version is what Codex reports after an update. +func TestCodexPortableManifestPrecedesNative(t *testing.T) { root := fixture(t) - writeFile(t, root, "plugin.json", `{"$schema":"https://agent-plugins.org/schemas/1.0.0/plugin.schema.json","name":"demo","version":"old"}`) + writeFile(t, root, "plugin.json", `{"$schema":"https://agent-plugins.org/schemas/1.0.0/plugin.schema.json","name":"demo","version":"portable"}`) d, err := Discover(context.Background(), root) if err != nil { t.Fatal(err) } - if d.Candidates[0].TargetInfo["codex"].Manifest != ".codex-plugin/plugin.json" { - t.Fatal("portable fallback hid native manifest") + if info := d.Candidates[0].TargetInfo["codex"]; info.Manifest != "plugin.json" || info.Version != "portable" { + t.Fatalf("Codex manifest: %+v", info) } writeFile(t, root, "plugin.json", "{") d, err = Discover(context.Background(), root) @@ -129,6 +131,38 @@ func TestNativeManifestPrecedesPortableFallback(t *testing.T) { } } +// Codex reports 1.0.0 for a portable manifest without a version; expecting it keeps the +// post-update version check instead of skipping it. +func TestCodexExpectsDefaultVersionOfVersionlessPortableManifest(t *testing.T) { + root := t.TempDir() + writeFile(t, root, "plugin.json", `{"$schema":"https://agent-plugins.org/schemas/1.0.0/plugin.schema.json","name":"demo"}`) + d, err := Discover(context.Background(), root) + if err != nil { + t.Fatal(err) + } + if got := d.Candidates[0].TargetInfo["codex"].Version; got != "1.0.0" { + t.Fatalf("Codex version = %q, want 1.0.0", got) + } + if got := d.Candidates[0].TargetInfo["cursor"].Version; got != "" { + t.Fatalf("cursor version = %q, want none", got) + } +} + +// Codex overlays .codex-plugin/plugin.json on a portable manifest, so its logo still applies. +func TestCodexKeepsNativeLogoUnderPortableManifest(t *testing.T) { + root := fixture(t) + writeFile(t, root, ".codex-plugin/plugin.json", `{"name":"demo","version":"1.0.0","skills":"./skills","interface":{"logo":"./logo.png"}}`) + writeFile(t, root, "logo.png", "png-bytes") + writeFile(t, root, "plugin.json", `{"$schema":"https://agent-plugins.org/schemas/1.0.0/plugin.schema.json","name":"demo"}`) + d, err := Discover(context.Background(), root) + if err != nil { + t.Fatal(err) + } + if got := d.Candidates[0].TargetInfo["codex"].Logo; got != "data:image/png;base64,cG5nLWJ5dGVz" { + t.Fatalf("native logo lost: %q", got) + } +} + func TestCodexLogoComesFromTheManifestInsideThePlugin(t *testing.T) { root := fixture(t) writeFile(t, root, ".codex-plugin/plugin.json", `{"name":"demo","version":"1.0.0","skills":"./skills","interface":{"logo":"./logo.png"}}`) diff --git a/internal/plugin/source_manifest.go b/internal/plugin/source_manifest.go index e6f7793fd..e28a5c417 100644 --- a/internal/plugin/source_manifest.go +++ b/internal/plugin/source_manifest.go @@ -117,8 +117,11 @@ func inspect(root string, explicit ...string) (Candidate, error) { } info.Components = manifestComponents(root, spec.target, m, info.Components) } - // The first native manifest wins; explicit invalid manifests remain errors. - if _, exists := c.TargetInfo[spec.target]; !exists { + // The first native manifest wins; explicit invalid manifests remain errors. Codex is the + // exception: it installs from a portable root plugin.json ahead of .codex-plugin/plugin.json, + // and reports 1.0.0 when that manifest has no version. + native, exists := c.TargetInfo[spec.target] + if !exists || spec.path == "plugin.json" && spec.target == "codex" && info.Problem == "" { c.TargetInfo[spec.target] = info } if spec.path == "plugin.json" && spec.target == "codex" { @@ -127,6 +130,16 @@ func inspect(root string, explicit ...string) (Candidate, error) { c.TargetInfo[target] = info } } + if codex := c.TargetInfo["codex"]; codex.Manifest == "plugin.json" { + // .codex-plugin/plugin.json still overlays the portable manifest, so keep its logo. + if codex.Logo == "" { + codex.Logo = native.Logo + } + if codex.Version == "" { + codex.Version = "1.0.0" + } + c.TargetInfo["codex"] = codex + } } } if info, ok := c.TargetInfo["claude"]; ok && info.Problem == "" { diff --git a/website/docs/reference/commands/plugin.md b/website/docs/reference/commands/plugin.md index 734298c40..d82fecae5 100644 --- a/website/docs/reference/commands/plugin.md +++ b/website/docs/reference/commands/plugin.md @@ -326,7 +326,10 @@ never supplies native trust approval flags. - Claude requires its native `.claude-plugin/plugin.json` package. - Codex accepts `.codex-plugin/plugin.json` and recognized portable root - `plugin.json` packages. A Claude-only package is not silently converted. + `plugin.json` packages. When a package has both, Codex installs from the portable + root `plugin.json`, so Skillshare expects that manifest's version, or `1.0.0` + when it has none. + A Claude-only package is not silently converted. - Sources may contain a marketplace with local plugin entries. External catalog catalogs are merged by plugin name/path. Conflicting paths are rejected; external entries are reported with instructions to add their repository directly or