From 9902a04d34eec65da7c8c6b5198987fb4831b938 Mon Sep 17 00:00:00 2001 From: Alan Buscaglia Date: Fri, 29 May 2026 13:09:40 +0200 Subject: [PATCH] fix(plugin): sync plugin.json version to 0.1.1 to stop recursive cache dirs (#217) --- plugin/assets_test.go | 68 +++++++++++++++++++ plugin/claude-code/.claude-plugin/plugin.json | 2 +- 2 files changed, 69 insertions(+), 1 deletion(-) diff --git a/plugin/assets_test.go b/plugin/assets_test.go index cd426dd5..f219af06 100644 --- a/plugin/assets_test.go +++ b/plugin/assets_test.go @@ -1,6 +1,7 @@ package plugin_test import ( + "encoding/json" "os" "path/filepath" "runtime" @@ -77,3 +78,70 @@ func TestPluginAssetsDoNotLeakSpanishTriggers(t *testing.T) { } } } + +// marketplaceJSON is the minimal structure of .claude-plugin/marketplace.json +// needed to extract the version declared for the engram plugin entry. +type marketplaceJSON struct { + Plugins []struct { + Name string `json:"name"` + Version string `json:"version"` + } `json:"plugins"` +} + +// pluginJSON is the structure of plugin/claude-code/.claude-plugin/plugin.json. +type pluginJSON struct { + Version string `json:"version"` +} + +// TestPluginVersionsMatch asserts that the version declared in +// .claude-plugin/marketplace.json matches the version in +// plugin/claude-code/.claude-plugin/plugin.json. +// +// A mismatch between these two files causes Claude Code to silently skip +// installation or re-download the plugin on every run because it sees the +// cached version as stale. +func TestPluginVersionsMatch(t *testing.T) { + root := repoRoot(t) + + // Read marketplace.json + marketplacePath := filepath.Join(root, ".claude-plugin", "marketplace.json") + marketplaceData, err := os.ReadFile(marketplacePath) + if err != nil { + t.Fatalf("cannot read marketplace.json: %v", err) + } + var marketplace marketplaceJSON + if err := json.Unmarshal(marketplaceData, &marketplace); err != nil { + t.Fatalf("cannot parse marketplace.json: %v", err) + } + + // Read plugin.json + pluginPath := filepath.Join(root, "plugin", "claude-code", ".claude-plugin", "plugin.json") + pluginData, err := os.ReadFile(pluginPath) + if err != nil { + t.Fatalf("cannot read plugin.json: %v", err) + } + var plugin pluginJSON + if err := json.Unmarshal(pluginData, &plugin); err != nil { + t.Fatalf("cannot parse plugin.json: %v", err) + } + + // Find the engram plugin entry in marketplace.json + var marketplaceVersion string + for _, p := range marketplace.Plugins { + if p.Name == "engram" { + marketplaceVersion = p.Version + break + } + } + if marketplaceVersion == "" { + t.Fatal("marketplace.json contains no plugin entry named 'engram'") + } + + if marketplaceVersion != plugin.Version { + t.Errorf( + "plugin version mismatch: marketplace.json declares %q but plugin/claude-code/.claude-plugin/plugin.json declares %q — keep them in sync", + marketplaceVersion, + plugin.Version, + ) + } +} diff --git a/plugin/claude-code/.claude-plugin/plugin.json b/plugin/claude-code/.claude-plugin/plugin.json index 30e5a6cb..9713041c 100644 --- a/plugin/claude-code/.claude-plugin/plugin.json +++ b/plugin/claude-code/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "engram", "description": "Persistent memory for AI coding agents. Survives across sessions and compactions.", - "version": "0.1.0", + "version": "0.1.1", "author": { "name": "Gentleman Programming" },