claudeup 4.24.0 → 4.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudeup",
3
- "version": "4.24.0",
3
+ "version": "4.25.0",
4
4
  "description": "TUI tool for managing Claude Code plugins, MCPs, and configuration",
5
5
  "type": "module",
6
6
  "main": "src/main.tsx",
@@ -64,8 +64,8 @@
64
64
  "typescript": "^5.6.3"
65
65
  },
66
66
  "optionalDependencies": {
67
- "claudeup-darwin-arm64": "4.24.0",
68
- "claudeup-darwin-x64": "4.24.0",
69
- "claudeup-linux-x64": "4.24.0"
67
+ "claudeup-darwin-arm64": "4.25.0",
68
+ "claudeup-darwin-x64": "4.25.0",
69
+ "claudeup-linux-x64": "4.25.0"
70
70
  }
71
71
  }
@@ -0,0 +1,61 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import { diffVersions } from "../services/version-snapshot.js";
3
+
4
+ /**
5
+ * Plugins get updated by things claudeup does not control — Claude Code's own
6
+ * `plugin update` writes installed_plugins.json without touching claudeup's
7
+ * bookkeeping. Diffing what we last rendered against reality catches every
8
+ * source; logging only claudeup's own actions catches none of them.
9
+ */
10
+
11
+ describe("diffVersions", () => {
12
+ test("reports a genuine version transition", () => {
13
+ expect(
14
+ diffVersions({ "dev@magus": "2.12.0" }, { "dev@magus": "2.12.1" }),
15
+ ).toEqual([{ pluginId: "dev@magus", from: "2.12.0", to: "2.12.1" }]);
16
+ });
17
+
18
+ test("first run reports nothing — otherwise every plugin looks updated", () => {
19
+ expect(diffVersions(null, { "dev@magus": "2.12.1" })).toEqual([]);
20
+ });
21
+
22
+ test("a newly installed plugin is not an update", () => {
23
+ // Absent from the snapshot means we have never seen it, not that it moved.
24
+ expect(diffVersions({}, { "dev@magus": "2.12.1" })).toEqual([]);
25
+ });
26
+
27
+ test("unchanged versions report nothing", () => {
28
+ expect(
29
+ diffVersions({ "dev@magus": "2.12.1" }, { "dev@magus": "2.12.1" }),
30
+ ).toEqual([]);
31
+ });
32
+
33
+ test('"0.0.0" transitions are ignored on both sides', () => {
34
+ // 0.0.0 means installed-with-unknown-version (Anthropic official plugins).
35
+ // Treating it as a real version produces bogus "0.0.0 → x" badges.
36
+ expect(
37
+ diffVersions({ "a@mp": "0.0.0" }, { "a@mp": "1.0.0" }),
38
+ ).toEqual([]);
39
+ expect(
40
+ diffVersions({ "a@mp": "1.0.0" }, { "a@mp": "0.0.0" }),
41
+ ).toEqual([]);
42
+ });
43
+
44
+ test("a removed plugin is not reported", () => {
45
+ expect(diffVersions({ "gone@mp": "1.0.0" }, {})).toEqual([]);
46
+ });
47
+
48
+ test("reports every changed plugin, leaving unchanged ones out", () => {
49
+ const changes = diffVersions(
50
+ { "a@mp": "1.0.0", "b@mp": "2.0.0", "c@mp": "3.0.0" },
51
+ { "a@mp": "1.1.0", "b@mp": "2.0.0", "c@mp": "4.0.0" },
52
+ );
53
+ expect(changes.map((c) => c.pluginId).sort()).toEqual(["a@mp", "c@mp"]);
54
+ });
55
+
56
+ test("a downgrade is still reported", () => {
57
+ // Rolling back is a change the user should see, not silently hidden.
58
+ const changes = diffVersions({ "a@mp": "2.0.0" }, { "a@mp": "1.0.0" });
59
+ expect(changes).toEqual([{ pluginId: "a@mp", from: "2.0.0", to: "1.0.0" }]);
60
+ });
61
+ });
@@ -72,6 +72,12 @@ export interface PluginInfo {
72
72
  mcpServers?: string[];
73
73
  lspServers?: Record<string, unknown>;
74
74
  isOrphaned?: boolean;
75
+ /**
76
+ * Set when this plugin's installed version changed since claudeup last
77
+ * rendered it — including updates made by Claude Code or the prerunner
78
+ * rather than by claudeup itself. Drives the "updated" badge.
79
+ */
80
+ recentlyUpdatedFrom?: string;
75
81
  }
76
82
 
77
83
  /**
@@ -0,0 +1,97 @@
1
+ /**
2
+ * version-snapshot.ts — detect plugin version changes that happened outside claudeup.
3
+ *
4
+ * Plugins get updated by things claudeup does not control: Claude Code's own
5
+ * `plugin install`/`update`, the `claudeup claude` prerunner, or a direct CLI
6
+ * call. All of them write `installed_plugins.json`; none of them tell the user
7
+ * anything the next time claudeup opens, so versions silently move underfoot.
8
+ *
9
+ * Rather than log what claudeup itself did — which misses every other source —
10
+ * this records what claudeup last *saw* installed and diffs against reality on
11
+ * load. Any change is reported, regardless of who made it.
12
+ *
13
+ * The snapshot is advisory UI state, kept separate from the update-check cache
14
+ * so a TTL expiry or a corrupt cache can never make plugins look updated.
15
+ */
16
+
17
+ import { promises as fs } from "node:fs";
18
+ import path from "node:path";
19
+ import os from "node:os";
20
+
21
+ export interface VersionChange {
22
+ pluginId: string;
23
+ from: string;
24
+ to: string;
25
+ }
26
+
27
+ interface SnapshotFile {
28
+ /** pluginId -> installedVersion as of the last time claudeup rendered it. */
29
+ seen: Record<string, string>;
30
+ updatedAt: string;
31
+ }
32
+
33
+ function snapshotPath(): string {
34
+ return path.join(os.homedir(), ".claude", "claudeup-version-snapshot.json");
35
+ }
36
+
37
+ async function read(): Promise<SnapshotFile | null> {
38
+ try {
39
+ const raw = await fs.readFile(snapshotPath(), "utf-8");
40
+ const data = JSON.parse(raw) as SnapshotFile;
41
+ if (!data || typeof data.seen !== "object" || data.seen === null) return null;
42
+ return data;
43
+ } catch {
44
+ return null; // absent or corrupt — treated as "first run"
45
+ }
46
+ }
47
+
48
+ /**
49
+ * Diff the versions currently installed against the previous snapshot.
50
+ *
51
+ * Returns only genuine transitions. Deliberately excluded:
52
+ * - first run (no snapshot): everything would look "updated"
53
+ * - a plugin absent from the snapshot: newly installed, not updated
54
+ * - unchanged versions
55
+ * - "0.0.0", which means installed-with-unknown-version rather than a real one
56
+ */
57
+ export function diffVersions(
58
+ previous: Record<string, string> | null,
59
+ current: Record<string, string>,
60
+ ): VersionChange[] {
61
+ if (!previous) return [];
62
+ const changes: VersionChange[] = [];
63
+ for (const [pluginId, to] of Object.entries(current)) {
64
+ const from = previous[pluginId];
65
+ if (!from || from === to) continue;
66
+ if (from === "0.0.0" || to === "0.0.0") continue;
67
+ changes.push({ pluginId, from, to });
68
+ }
69
+ return changes;
70
+ }
71
+
72
+ /** Load the previous snapshot's version map, or null on first run. */
73
+ export async function loadSeenVersions(): Promise<Record<string, string> | null> {
74
+ const data = await read();
75
+ return data ? data.seen : null;
76
+ }
77
+
78
+ /**
79
+ * Persist what is installed now, so the same change is not reported twice.
80
+ * Best-effort: a failure here must never break the UI, it only means the badge
81
+ * shows again next launch.
82
+ */
83
+ export async function saveSeenVersions(
84
+ current: Record<string, string>,
85
+ ): Promise<void> {
86
+ try {
87
+ const file = snapshotPath();
88
+ await fs.mkdir(path.dirname(file), { recursive: true });
89
+ const payload: SnapshotFile = {
90
+ seen: current,
91
+ updatedAt: new Date().toISOString(),
92
+ };
93
+ await fs.writeFile(file, JSON.stringify(payload, null, 2), "utf-8");
94
+ } catch {
95
+ // ignore
96
+ }
97
+ }
@@ -125,9 +125,15 @@ function pluginRow(item: PluginPluginItem, isSelected: boolean): React.ReactNode
125
125
  } else if (notInstalled) {
126
126
  versionStr = " not installed";
127
127
  } else if (hasAnyScope && plugin.installedVersion && plugin.installedVersion !== "0.0.0") {
128
- versionStr = ` v${plugin.installedVersion}`;
129
- if (plugin.hasUpdate && plugin.version) {
130
- versionStr += ` v${plugin.version}`;
128
+ if (plugin.recentlyUpdatedFrom) {
129
+ // Show what actually happened, not just where it landed — the update may
130
+ // have come from Claude Code or the prerunner without ever telling us.
131
+ versionStr = ` v${plugin.recentlyUpdatedFrom} → v${plugin.installedVersion} updated`;
132
+ } else {
133
+ versionStr = ` v${plugin.installedVersion}`;
134
+ if (plugin.hasUpdate && plugin.version) {
135
+ versionStr += ` → v${plugin.version}`;
136
+ }
131
137
  }
132
138
  }
133
139
 
@@ -170,7 +176,13 @@ function pluginRow(item: PluginPluginItem, isSelected: boolean): React.ReactNode
170
176
  </span>
171
177
  <MetaText
172
178
  text={versionStr}
173
- tone={notInstalled || plugin.hasUpdate ? "warning" : "muted"}
179
+ tone={
180
+ plugin.recentlyUpdatedFrom
181
+ ? "success"
182
+ : notInstalled || plugin.hasUpdate
183
+ ? "warning"
184
+ : "muted"
185
+ }
174
186
  />
175
187
  </text>
176
188
  );
@@ -7,6 +7,11 @@ import { ScrollableList } from "../components/ScrollableList.js";
7
7
  import { EmptyFilterState } from "../components/EmptyFilterState.js";
8
8
  import { fuzzyFilter } from "../../utils/fuzzy-search.js";
9
9
  import { getAllMarketplaces } from "../../data/marketplaces.js";
10
+ import {
11
+ diffVersions,
12
+ loadSeenVersions,
13
+ saveSeenVersions,
14
+ } from "../../services/version-snapshot.js";
10
15
  import {
11
16
  getAvailablePlugins,
12
17
  refreshAllMarketplaces,
@@ -73,6 +78,23 @@ export function PluginsScreen() {
73
78
  const localMarketplaces = await getLocalMarketplacesInfo();
74
79
  const allMarketplaces = getAllMarketplaces(localMarketplaces);
75
80
  const pluginData = await getAvailablePlugins(state.projectPath);
81
+
82
+ // Surface version changes made outside claudeup (Claude Code's own
83
+ // plugin update, the prerunner, a manual CLI call). Diffing against
84
+ // what we last rendered catches all of them; logging only what
85
+ // claudeup did would miss every one.
86
+ const current: Record<string, string> = {};
87
+ for (const p of pluginData) {
88
+ if (p.installedVersion) current[p.id] = p.installedVersion;
89
+ }
90
+ const previous = await loadSeenVersions();
91
+ for (const change of diffVersions(previous, current)) {
92
+ const target = pluginData.find((p) => p.id === change.pluginId);
93
+ if (target) target.recentlyUpdatedFrom = change.from;
94
+ }
95
+ // Record now so the same change is not reported on the next launch.
96
+ void saveSeenVersions(current);
97
+
76
98
  dispatch({
77
99
  type: "PLUGINS_DATA_SUCCESS",
78
100
  marketplaces: allMarketplaces,