claudeup 4.10.1 → 4.11.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 +1 -1
- package/src/__tests__/plugin-setup.test.ts +300 -0
- package/src/__tests__/plugin-version-check.test.ts +760 -0
- package/src/prerunner/index.js +17 -0
- package/src/prerunner/index.ts +20 -0
- package/src/services/plugin-setup.js +88 -1
- package/src/services/plugin-setup.ts +99 -1
- package/src/services/plugin-version-check.js +248 -0
- package/src/services/plugin-version-check.ts +340 -0
- package/src/ui/App.js +52 -27
- package/src/ui/App.tsx +102 -68
- package/src/ui/screens/PluginsScreen.js +86 -13
- package/src/ui/screens/PluginsScreen.tsx +135 -24
- package/src/ui/state/DimensionsContext.js +8 -6
- package/src/ui/state/DimensionsContext.tsx +10 -1
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin version mismatch detection and fix.
|
|
3
|
+
*
|
|
4
|
+
* Claude Code's plugin loader (pluginLoader.ts:2051) takes the FIRST entry
|
|
5
|
+
* from installed_plugins.json for each plugin ID:
|
|
6
|
+
*
|
|
7
|
+
* const installEntry = installedPluginsData.plugins[pluginId]?.[0]
|
|
8
|
+
*
|
|
9
|
+
* This means the first project to install a plugin determines which version
|
|
10
|
+
* loads for ALL projects. When different projects install different versions,
|
|
11
|
+
* only the one at index [0] takes effect.
|
|
12
|
+
*
|
|
13
|
+
* Bug report: https://github.com/anthropics/claude-code/issues/45997
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import type { InstalledPluginEntry } from "../types/index.js";
|
|
17
|
+
import {
|
|
18
|
+
getEnabledPlugins,
|
|
19
|
+
getGlobalEnabledPlugins,
|
|
20
|
+
getLocalEnabledPlugins,
|
|
21
|
+
readInstalledPluginsRegistry,
|
|
22
|
+
writeInstalledPluginsRegistry,
|
|
23
|
+
} from "./claude-settings.js";
|
|
24
|
+
|
|
25
|
+
const BUG_REPORT_URL = "https://github.com/anthropics/claude-code/issues/45997";
|
|
26
|
+
|
|
27
|
+
// ── Types ────────────────────────────────────────────────────────────────────
|
|
28
|
+
|
|
29
|
+
export interface VersionMismatchInfo {
|
|
30
|
+
/** Plugin ID, e.g. "terminal@magus" */
|
|
31
|
+
pluginId: string;
|
|
32
|
+
/** Version at entries[0] — the one Claude Code actually loads */
|
|
33
|
+
firstEntryVersion: string;
|
|
34
|
+
/** Project path of the entries[0] entry */
|
|
35
|
+
firstEntryProject: string | undefined;
|
|
36
|
+
/** Version this project has installed */
|
|
37
|
+
currentProjectVersion: string;
|
|
38
|
+
/** All entries for this plugin */
|
|
39
|
+
allEntries: InstalledPluginEntry[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface FixResult {
|
|
43
|
+
/** Number of entries updated */
|
|
44
|
+
updated: number;
|
|
45
|
+
/** Project paths that were updated */
|
|
46
|
+
projects: string[];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// ── Detection ────────────────────────────────────────────────────────────────
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Check for plugin version mismatches caused by the [0] index bug.
|
|
53
|
+
*
|
|
54
|
+
* For each enabled plugin in the current project:
|
|
55
|
+
* 1. Reads the plugin's entry array from installed_plugins.json
|
|
56
|
+
* 2. Finds the entry matching the current project
|
|
57
|
+
* 3. Checks if entries[0] has a DIFFERENT version than the current project's entry
|
|
58
|
+
* 4. If yes: this project will load the wrong version
|
|
59
|
+
*
|
|
60
|
+
* @param projectPath - The current project path to check
|
|
61
|
+
* @returns Array of mismatch info for each affected plugin
|
|
62
|
+
*/
|
|
63
|
+
export async function checkPluginVersionMismatches(
|
|
64
|
+
projectPath: string,
|
|
65
|
+
): Promise<VersionMismatchInfo[]> {
|
|
66
|
+
const registry = await readInstalledPluginsRegistry();
|
|
67
|
+
const enabledPluginIds = await collectEnabledPluginIds(projectPath);
|
|
68
|
+
const mismatches: VersionMismatchInfo[] = [];
|
|
69
|
+
|
|
70
|
+
for (const pluginId of enabledPluginIds) {
|
|
71
|
+
const entries = registry.plugins[pluginId];
|
|
72
|
+
if (!entries || entries.length < 2) continue;
|
|
73
|
+
|
|
74
|
+
// Find the entry for the current project
|
|
75
|
+
const currentEntry = entries.find(
|
|
76
|
+
(e) =>
|
|
77
|
+
e.scope === "project" &&
|
|
78
|
+
normalizePath(e.projectPath) === normalizePath(projectPath),
|
|
79
|
+
);
|
|
80
|
+
if (!currentEntry) continue;
|
|
81
|
+
|
|
82
|
+
const firstEntry = entries[0];
|
|
83
|
+
|
|
84
|
+
// Compare the version at [0] with the current project's version
|
|
85
|
+
if (firstEntry.version !== currentEntry.version) {
|
|
86
|
+
mismatches.push({
|
|
87
|
+
pluginId,
|
|
88
|
+
firstEntryVersion: firstEntry.version,
|
|
89
|
+
firstEntryProject: firstEntry.projectPath,
|
|
90
|
+
currentProjectVersion: currentEntry.version,
|
|
91
|
+
allEntries: entries,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return mismatches;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Check a single plugin for version mismatch (used after plugin update).
|
|
101
|
+
*
|
|
102
|
+
* @param pluginId - The plugin ID to check
|
|
103
|
+
* @param projectPath - The current project path
|
|
104
|
+
* @returns Mismatch info or null if no mismatch
|
|
105
|
+
*/
|
|
106
|
+
export async function checkSinglePluginMismatch(
|
|
107
|
+
pluginId: string,
|
|
108
|
+
projectPath: string,
|
|
109
|
+
): Promise<VersionMismatchInfo | null> {
|
|
110
|
+
const registry = await readInstalledPluginsRegistry();
|
|
111
|
+
const entries = registry.plugins[pluginId];
|
|
112
|
+
if (!entries || entries.length < 2) return null;
|
|
113
|
+
|
|
114
|
+
const currentEntry = entries.find(
|
|
115
|
+
(e) =>
|
|
116
|
+
e.scope === "project" &&
|
|
117
|
+
normalizePath(e.projectPath) === normalizePath(projectPath),
|
|
118
|
+
);
|
|
119
|
+
if (!currentEntry) return null;
|
|
120
|
+
|
|
121
|
+
const firstEntry = entries[0];
|
|
122
|
+
if (firstEntry.version === currentEntry.version) return null;
|
|
123
|
+
|
|
124
|
+
return {
|
|
125
|
+
pluginId,
|
|
126
|
+
firstEntryVersion: firstEntry.version,
|
|
127
|
+
firstEntryProject: firstEntry.projectPath,
|
|
128
|
+
currentProjectVersion: currentEntry.version,
|
|
129
|
+
allEntries: entries,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// ── Fix ──────────────────────────────────────────────────────────────────────
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Fix a version mismatch by updating ALL entries for a plugin to use
|
|
137
|
+
* the target version. This is a JSON-only operation that rewrites
|
|
138
|
+
* installPath and version in each entry.
|
|
139
|
+
*
|
|
140
|
+
* IMPORTANT: This modifies installed_plugins.json which is Claude Code-owned.
|
|
141
|
+
* Only call after explicit user consent.
|
|
142
|
+
*
|
|
143
|
+
* @param pluginId - The plugin ID to fix
|
|
144
|
+
* @param targetVersion - The version to normalize all entries to
|
|
145
|
+
* @returns Number of updated entries and which projects were affected
|
|
146
|
+
*/
|
|
147
|
+
export async function fixPluginVersionMismatch(
|
|
148
|
+
pluginId: string,
|
|
149
|
+
targetVersion: string,
|
|
150
|
+
): Promise<FixResult> {
|
|
151
|
+
const registry = await readInstalledPluginsRegistry();
|
|
152
|
+
const entries = registry.plugins[pluginId];
|
|
153
|
+
if (!entries || entries.length === 0) {
|
|
154
|
+
return { updated: 0, projects: [] };
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Find an existing entry with the target version to get the correct installPath
|
|
158
|
+
const templateEntry = entries.find((e) => e.version === targetVersion);
|
|
159
|
+
if (!templateEntry) {
|
|
160
|
+
return { updated: 0, projects: [] };
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const targetInstallPath = templateEntry.installPath;
|
|
164
|
+
const updated: string[] = [];
|
|
165
|
+
|
|
166
|
+
for (const entry of entries) {
|
|
167
|
+
if (entry.version !== targetVersion) {
|
|
168
|
+
entry.version = targetVersion;
|
|
169
|
+
entry.installPath = targetInstallPath;
|
|
170
|
+
entry.lastUpdated = new Date().toISOString();
|
|
171
|
+
updated.push(entry.projectPath || "(global)");
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (updated.length > 0) {
|
|
176
|
+
await writeInstalledPluginsRegistry(registry);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return { updated: updated.length, projects: updated };
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Fix all version mismatches by normalizing each plugin to its latest version.
|
|
184
|
+
*
|
|
185
|
+
* @param mismatches - Array of mismatches from checkPluginVersionMismatches
|
|
186
|
+
* @returns Map of pluginId to FixResult
|
|
187
|
+
*/
|
|
188
|
+
export async function fixAllPluginVersionMismatches(
|
|
189
|
+
mismatches: VersionMismatchInfo[],
|
|
190
|
+
): Promise<Map<string, FixResult>> {
|
|
191
|
+
const results = new Map<string, FixResult>();
|
|
192
|
+
|
|
193
|
+
// Read registry once, apply all fixes, write once
|
|
194
|
+
const registry = await readInstalledPluginsRegistry();
|
|
195
|
+
|
|
196
|
+
for (const mismatch of mismatches) {
|
|
197
|
+
const entries = registry.plugins[mismatch.pluginId];
|
|
198
|
+
if (!entries || entries.length === 0) {
|
|
199
|
+
results.set(mismatch.pluginId, { updated: 0, projects: [] });
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Use the current project's version as the target (the version the user expects)
|
|
204
|
+
const targetVersion = mismatch.currentProjectVersion;
|
|
205
|
+
const templateEntry = entries.find((e) => e.version === targetVersion);
|
|
206
|
+
if (!templateEntry) {
|
|
207
|
+
results.set(mismatch.pluginId, { updated: 0, projects: [] });
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const targetInstallPath = templateEntry.installPath;
|
|
212
|
+
const updated: string[] = [];
|
|
213
|
+
|
|
214
|
+
for (const entry of entries) {
|
|
215
|
+
if (entry.version !== targetVersion) {
|
|
216
|
+
entry.version = targetVersion;
|
|
217
|
+
entry.installPath = targetInstallPath;
|
|
218
|
+
entry.lastUpdated = new Date().toISOString();
|
|
219
|
+
updated.push(entry.projectPath || "(global)");
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
results.set(mismatch.pluginId, {
|
|
224
|
+
updated: updated.length,
|
|
225
|
+
projects: updated,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
await writeInstalledPluginsRegistry(registry);
|
|
230
|
+
return results;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// ── Formatting ───────────────────────────────────────────────────────────────
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Format mismatch info for console output (prerunner).
|
|
237
|
+
*/
|
|
238
|
+
export function formatMismatchWarning(
|
|
239
|
+
mismatches: VersionMismatchInfo[],
|
|
240
|
+
): string {
|
|
241
|
+
const lines: string[] = [];
|
|
242
|
+
lines.push(
|
|
243
|
+
"WARNING: Plugin version mismatch detected (Claude Code bug #45997)",
|
|
244
|
+
);
|
|
245
|
+
lines.push(
|
|
246
|
+
"Claude Code loads the first entry from installed_plugins.json for ALL projects.",
|
|
247
|
+
);
|
|
248
|
+
lines.push(
|
|
249
|
+
"The following plugins will load a different version than what this project has installed:\n",
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
for (const m of mismatches) {
|
|
253
|
+
const firstProject = m.firstEntryProject
|
|
254
|
+
? shortenPath(m.firstEntryProject)
|
|
255
|
+
: "(global)";
|
|
256
|
+
lines.push(` ${m.pluginId}:`);
|
|
257
|
+
lines.push(` Loading v${m.firstEntryVersion} (from ${firstProject})`);
|
|
258
|
+
lines.push(` Expected v${m.currentProjectVersion} (this project)`);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
lines.push("");
|
|
262
|
+
lines.push(`Bug report: ${BUG_REPORT_URL}`);
|
|
263
|
+
lines.push(
|
|
264
|
+
"Run claudeup to fix — it can align all projects to the same version.",
|
|
265
|
+
);
|
|
266
|
+
|
|
267
|
+
return lines.join("\n");
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Format mismatch info for TUI display.
|
|
272
|
+
*/
|
|
273
|
+
export function formatMismatchBanner(
|
|
274
|
+
mismatches: VersionMismatchInfo[],
|
|
275
|
+
): string {
|
|
276
|
+
const parts = mismatches.map(
|
|
277
|
+
(m) =>
|
|
278
|
+
`${m.pluginId}: loading v${m.firstEntryVersion} instead of v${m.currentProjectVersion}`,
|
|
279
|
+
);
|
|
280
|
+
return `Version mismatch: ${parts.join(", ")}`;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// ── Helpers ──────────────────────────────────────────────────────────────────
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Collect all enabled plugin IDs across all scopes for a project.
|
|
287
|
+
*/
|
|
288
|
+
async function collectEnabledPluginIds(
|
|
289
|
+
projectPath: string,
|
|
290
|
+
): Promise<Set<string>> {
|
|
291
|
+
const pluginIds = new Set<string>();
|
|
292
|
+
|
|
293
|
+
try {
|
|
294
|
+
const global = await getGlobalEnabledPlugins();
|
|
295
|
+
for (const [id, enabled] of Object.entries(global)) {
|
|
296
|
+
if (enabled) pluginIds.add(id);
|
|
297
|
+
}
|
|
298
|
+
} catch {
|
|
299
|
+
/* skip unreadable */
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
try {
|
|
303
|
+
const project = await getEnabledPlugins(projectPath);
|
|
304
|
+
for (const [id, enabled] of Object.entries(project)) {
|
|
305
|
+
if (enabled) pluginIds.add(id);
|
|
306
|
+
}
|
|
307
|
+
} catch {
|
|
308
|
+
/* skip unreadable */
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
try {
|
|
312
|
+
const local = await getLocalEnabledPlugins(projectPath);
|
|
313
|
+
for (const [id, enabled] of Object.entries(local)) {
|
|
314
|
+
if (enabled) pluginIds.add(id);
|
|
315
|
+
}
|
|
316
|
+
} catch {
|
|
317
|
+
/* skip unreadable */
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return pluginIds;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Normalize a path for comparison (resolve and trailing-slash normalize).
|
|
325
|
+
*/
|
|
326
|
+
function normalizePath(p: string | undefined): string {
|
|
327
|
+
if (!p) return "";
|
|
328
|
+
return p.replace(/\/+$/, "");
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Shorten a path for display by replacing homedir with ~.
|
|
333
|
+
*/
|
|
334
|
+
function shortenPath(p: string): string {
|
|
335
|
+
const home = process.env.HOME || process.env.USERPROFILE || "";
|
|
336
|
+
if (home && p.startsWith(home)) {
|
|
337
|
+
return `~${p.slice(home.length)}`;
|
|
338
|
+
}
|
|
339
|
+
return p;
|
|
340
|
+
}
|
package/src/ui/App.js
CHANGED
|
@@ -8,6 +8,7 @@ import { ModalContainer } from "./components/modals/index.js";
|
|
|
8
8
|
import { PluginsScreen, McpScreen, McpRegistryScreen, SettingsScreen, CliToolsScreen, ModelSelectorScreen, ProfilesScreen, SkillsScreen, } from "./screens/index.js";
|
|
9
9
|
import { repairAllMarketplaces } from "../services/local-marketplace.js";
|
|
10
10
|
import { migrateMarketplaceRename, recoverMarketplaceSettings, } from "../services/claude-settings.js";
|
|
11
|
+
import { checkPluginVersionMismatches, formatMismatchBanner, } from "../services/plugin-version-check.js";
|
|
11
12
|
import { checkForUpdates, getCurrentVersion, } from "../services/version-check.js";
|
|
12
13
|
import { useKeyboardHandler } from "./hooks/useKeyboardHandler.js";
|
|
13
14
|
import { ProgressBar } from "./components/layout/ProgressBar.js";
|
|
@@ -166,7 +167,7 @@ MCP Servers
|
|
|
166
167
|
function UpdateBanner({ result }) {
|
|
167
168
|
if (!result.updateAvailable)
|
|
168
169
|
return null;
|
|
169
|
-
return (_jsxs("box", { paddingLeft: 1, paddingRight: 1, children: [_jsx("text", { bg: "yellow", fg: "black", children: _jsx("strong", { children: " UPDATE " }) }), _jsxs("text", { fg: "yellow", children: [" ", "v", result.currentVersion, " \u2192 v", result.latestVersion] }), _jsx("text", { fg: "gray", children: " Run: " }), _jsx("text", { fg: "cyan", children: "
|
|
170
|
+
return (_jsxs("box", { paddingLeft: 1, paddingRight: 1, children: [_jsx("text", { bg: "yellow", fg: "black", children: _jsx("strong", { children: " UPDATE " }) }), _jsxs("text", { fg: "yellow", children: [" ", "v", result.currentVersion, " \u2192 v", result.latestVersion] }), _jsx("text", { fg: "gray", children: " Run: " }), _jsx("text", { fg: "cyan", children: "claudeup update" })] }));
|
|
170
171
|
}
|
|
171
172
|
/**
|
|
172
173
|
* ProgressIndicator Component
|
|
@@ -175,11 +176,39 @@ function UpdateBanner({ result }) {
|
|
|
175
176
|
function ProgressIndicator({ message, current, total, }) {
|
|
176
177
|
return (_jsx("box", { paddingLeft: 1, paddingRight: 1, children: _jsx(ProgressBar, { message: message, current: current, total: total }) }));
|
|
177
178
|
}
|
|
178
|
-
function AppContentInner({ showDebug, onDebugToggle, updateInfo, onExit, }) {
|
|
179
|
-
const { state
|
|
179
|
+
function AppContentInner({ showDebug, onDebugToggle, updateInfo, onExit, recoveryReport, mismatchWarning, }) {
|
|
180
|
+
const { state } = useApp();
|
|
180
181
|
const { progress } = state;
|
|
181
182
|
const dimensions = useDimensions();
|
|
183
|
+
return (_jsxs("box", { flexDirection: "column", height: dimensions.terminalHeight, children: [updateInfo?.updateAvailable && _jsx(UpdateBanner, { result: updateInfo }), recoveryReport && (_jsx("box", { paddingLeft: 1, paddingRight: 1, children: _jsxs("text", { fg: "green", children: ["\u2713 Fixed: ", recoveryReport] }) })), mismatchWarning && (_jsx("box", { paddingLeft: 1, paddingRight: 1, children: _jsxs("text", { fg: "yellow", children: ["\u26A0 ", mismatchWarning, " (bug #45997)"] }) })), showDebug && (_jsx("box", { paddingLeft: 1, paddingRight: 1, children: _jsxs("text", { fg: "#888888", children: ["DEBUG: ", dimensions.terminalWidth, "x", dimensions.terminalHeight, " | content=", dimensions.contentHeight, " | screen=", state.currentRoute.screen] }) })), progress && _jsx(ProgressIndicator, { ...progress }), _jsx("box", { flexDirection: "column", height: dimensions.contentHeight, paddingLeft: 1, paddingRight: 1, children: _jsx(Router, {}) }), _jsx(GlobalKeyHandler, { onDebugToggle: onDebugToggle, onExit: onExit }), _jsx(ModalContainer, {})] }));
|
|
184
|
+
}
|
|
185
|
+
function AppContent({ onExit }) {
|
|
186
|
+
const { state, dispatch } = useApp();
|
|
187
|
+
const { progress } = state;
|
|
188
|
+
const [showDebug, setShowDebug] = useState(false);
|
|
189
|
+
const [updateInfo, setUpdateInfo] = useState(null);
|
|
182
190
|
const [recoveryReport, setRecoveryReport] = useState(null);
|
|
191
|
+
const [mismatchWarning, setMismatchWarning] = useState(null);
|
|
192
|
+
// Check for updates on startup (non-blocking)
|
|
193
|
+
useEffect(() => {
|
|
194
|
+
checkForUpdates()
|
|
195
|
+
.then(setUpdateInfo)
|
|
196
|
+
.catch(() => { });
|
|
197
|
+
}, []);
|
|
198
|
+
// Auto-dismiss recovery banner after 5 seconds
|
|
199
|
+
useEffect(() => {
|
|
200
|
+
if (!recoveryReport)
|
|
201
|
+
return;
|
|
202
|
+
const timer = setTimeout(() => setRecoveryReport(null), 5000);
|
|
203
|
+
return () => clearTimeout(timer);
|
|
204
|
+
}, [recoveryReport]);
|
|
205
|
+
// Auto-dismiss mismatch warning after 8 seconds (longer — more important)
|
|
206
|
+
useEffect(() => {
|
|
207
|
+
if (!mismatchWarning)
|
|
208
|
+
return;
|
|
209
|
+
const timer = setTimeout(() => setMismatchWarning(null), 8000);
|
|
210
|
+
return () => clearTimeout(timer);
|
|
211
|
+
}, [mismatchWarning]);
|
|
183
212
|
// Auto-refresh marketplaces on startup
|
|
184
213
|
useEffect(() => {
|
|
185
214
|
const noRefresh = process.argv.includes("--no-refresh");
|
|
@@ -189,34 +218,41 @@ function AppContentInner({ showDebug, onDebugToggle, updateInfo, onExit, }) {
|
|
|
189
218
|
type: "SHOW_PROGRESS",
|
|
190
219
|
state: { message: "Scanning marketplaces..." },
|
|
191
220
|
});
|
|
192
|
-
// Migrate old marketplace names
|
|
221
|
+
// Migrate old marketplace names -> magus (idempotent), then repair plugin.json files
|
|
193
222
|
migrateMarketplaceRename().catch(() => { }); // non-blocking, best-effort
|
|
194
|
-
// Recover stale marketplace registry entries (e.g. "directory"
|
|
223
|
+
// Recover stale marketplace registry entries (e.g. "directory" -> "github")
|
|
195
224
|
recoverMarketplaceSettings()
|
|
196
225
|
.then(async (recovery) => {
|
|
197
|
-
const
|
|
226
|
+
const parts = [];
|
|
198
227
|
if (recovery.reregistered.length > 0) {
|
|
199
|
-
msgs.push(`Re-registered as GitHub: ${recovery.reregistered.join(", ")}`);
|
|
200
228
|
// Update the marketplace clone now that the source is fixed
|
|
201
229
|
const { updateMarketplace } = await import("../services/claude-cli.js");
|
|
202
230
|
for (const mp of recovery.reregistered) {
|
|
203
231
|
try {
|
|
204
232
|
await updateMarketplace(mp);
|
|
205
|
-
|
|
233
|
+
parts.push(`${mp} refreshed`);
|
|
206
234
|
}
|
|
207
235
|
catch {
|
|
208
|
-
|
|
236
|
+
parts.push(`${mp} (update failed)`);
|
|
209
237
|
}
|
|
210
238
|
}
|
|
211
239
|
}
|
|
212
240
|
if (recovery.enabledAutoUpdate.length > 0) {
|
|
213
|
-
|
|
241
|
+
parts.push(`auto-update: ${recovery.enabledAutoUpdate.join(", ")}`);
|
|
214
242
|
}
|
|
215
243
|
if (recovery.removed.length > 0) {
|
|
216
|
-
|
|
244
|
+
parts.push(`removed: ${recovery.removed.join(", ")}`);
|
|
245
|
+
}
|
|
246
|
+
if (parts.length > 0) {
|
|
247
|
+
setRecoveryReport(parts.join(" | "));
|
|
217
248
|
}
|
|
218
|
-
|
|
219
|
-
|
|
249
|
+
})
|
|
250
|
+
.catch(() => { }); // non-fatal
|
|
251
|
+
// Check for plugin version mismatches (the [0] index bug)
|
|
252
|
+
checkPluginVersionMismatches(process.cwd())
|
|
253
|
+
.then((mismatches) => {
|
|
254
|
+
if (mismatches.length > 0) {
|
|
255
|
+
setMismatchWarning(formatMismatchBanner(mismatches));
|
|
220
256
|
}
|
|
221
257
|
})
|
|
222
258
|
.catch(() => { }); // non-fatal
|
|
@@ -229,20 +265,9 @@ function AppContentInner({ showDebug, onDebugToggle, updateInfo, onExit, }) {
|
|
|
229
265
|
dispatch({ type: "HIDE_PROGRESS" });
|
|
230
266
|
});
|
|
231
267
|
}, [dispatch]);
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
const { state } = useApp();
|
|
236
|
-
const { progress } = state;
|
|
237
|
-
const [showDebug, setShowDebug] = useState(false);
|
|
238
|
-
const [updateInfo, setUpdateInfo] = useState(null);
|
|
239
|
-
// Check for updates on startup (non-blocking)
|
|
240
|
-
useEffect(() => {
|
|
241
|
-
checkForUpdates()
|
|
242
|
-
.then(setUpdateInfo)
|
|
243
|
-
.catch(() => { });
|
|
244
|
-
}, []);
|
|
245
|
-
return (_jsx(DimensionsProvider, { showProgress: !!progress, showDebug: showDebug, showUpdateBanner: !!updateInfo?.updateAvailable, children: _jsx(AppContentInner, { showDebug: showDebug, onDebugToggle: () => setShowDebug((s) => !s), updateInfo: updateInfo, onExit: onExit }) }));
|
|
268
|
+
// Count transient banners for dimension calculation
|
|
269
|
+
const transientBannerCount = (recoveryReport ? 1 : 0) + (mismatchWarning ? 1 : 0);
|
|
270
|
+
return (_jsx(DimensionsProvider, { showProgress: !!progress, showDebug: showDebug, showUpdateBanner: !!updateInfo?.updateAvailable, transientBannerCount: transientBannerCount, children: _jsx(AppContentInner, { showDebug: showDebug, onDebugToggle: () => setShowDebug((s) => !s), updateInfo: updateInfo, onExit: onExit, recoveryReport: recoveryReport, mismatchWarning: mismatchWarning }) }));
|
|
246
271
|
}
|
|
247
272
|
export function App({ onExit }) {
|
|
248
273
|
return (_jsx(AppProvider, { children: _jsx(AppContent, { onExit: onExit }) }));
|