luckiest-co 1.0.6 → 1.0.7
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/bin/install.js
CHANGED
|
@@ -299,15 +299,42 @@ async function syncSkills() {
|
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
/**
|
|
302
|
-
* True when the luckiest plugin is
|
|
303
|
-
* plugin marketplace (which registers commands itself).
|
|
302
|
+
* True when the luckiest plugin is installed AND enabled through the Claude
|
|
303
|
+
* Code plugin marketplace (which registers commands itself). A disabled
|
|
304
|
+
* plugin still appears in installed_plugins.json but registers nothing, so
|
|
305
|
+
* treating it as present would delete the user's commands/luckiest copy and
|
|
306
|
+
* leave them with no /luckiest:* commands at all.
|
|
304
307
|
*/
|
|
305
308
|
function hasMarketplacePlugin(globalClaudeDir) {
|
|
306
309
|
try {
|
|
307
310
|
const manifest = JSON.parse(
|
|
308
311
|
fs.readFileSync(path.join(globalClaudeDir, 'plugins', 'installed_plugins.json'), 'utf8')
|
|
309
312
|
);
|
|
310
|
-
|
|
313
|
+
const entries = Object.entries(manifest.plugins || {}).filter(([k]) => k.startsWith('luckiest@'));
|
|
314
|
+
if (entries.length === 0) return false;
|
|
315
|
+
|
|
316
|
+
// Some Claude Code versions record enabled state on the install entry itself.
|
|
317
|
+
const entryDisabled = entries.every(([, v]) => {
|
|
318
|
+
const items = Array.isArray(v) ? v : [v];
|
|
319
|
+
return items.every((item) => item && typeof item === 'object' && item.enabled === false);
|
|
320
|
+
});
|
|
321
|
+
if (entryDisabled) return false;
|
|
322
|
+
|
|
323
|
+
// Others track it in settings.json under enabledPlugins ("name@marketplace": bool).
|
|
324
|
+
try {
|
|
325
|
+
const settings = JSON.parse(
|
|
326
|
+
fs.readFileSync(path.join(globalClaudeDir, 'settings.json'), 'utf8')
|
|
327
|
+
);
|
|
328
|
+
const enabledMap = settings.enabledPlugins || {};
|
|
329
|
+
const flags = entries
|
|
330
|
+
.map(([k]) => enabledMap[k])
|
|
331
|
+
.filter((flag) => typeof flag === 'boolean');
|
|
332
|
+
if (flags.length > 0 && flags.every((flag) => flag === false)) return false;
|
|
333
|
+
} catch {
|
|
334
|
+
// No readable settings.json — fall through to "installed means enabled".
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
return true;
|
|
311
338
|
} catch {
|
|
312
339
|
return false;
|
|
313
340
|
}
|