@trendai-crem/claude-skills 1.0.1 → 1.0.2
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/lib/handlers/marketplace.js +12 -0
- package/package.json +1 -1
|
@@ -142,11 +142,23 @@ export const marketplaceHandler = {
|
|
|
142
142
|
|
|
143
143
|
/**
|
|
144
144
|
* Uninstalls stale plugin@marketplace keys.
|
|
145
|
+
* Skips plugins that are already not installed (idempotent).
|
|
145
146
|
* @param {string[]} staleItems - Keys like "plugin@marketplace".
|
|
146
147
|
* @returns {Array<{label, action, ok}>}
|
|
147
148
|
*/
|
|
148
149
|
uninstall(staleItems) {
|
|
150
|
+
// Check which plugins are actually installed before attempting uninstall.
|
|
151
|
+
const installedPath = join(homedir(), '.claude', 'plugins', 'installed_plugins.json');
|
|
152
|
+
const installedData = readJsonObject(installedPath, {}, 'installed_plugins.json');
|
|
153
|
+
const rawInstalled = installedData.plugins ?? installedData;
|
|
154
|
+
const installed = (typeof rawInstalled === 'object' && rawInstalled !== null && !Array.isArray(rawInstalled))
|
|
155
|
+
? rawInstalled : {};
|
|
156
|
+
|
|
149
157
|
return staleItems.map(key => {
|
|
158
|
+
// Already not installed — skip silently, desired state already achieved.
|
|
159
|
+
if (!Object.hasOwn(installed, key)) {
|
|
160
|
+
return { label: key, action: 'uninstall', ok: true };
|
|
161
|
+
}
|
|
150
162
|
try {
|
|
151
163
|
execFileSync('claude', ['plugin', 'uninstall', key], { stdio: 'inherit' });
|
|
152
164
|
return { label: key, action: 'uninstall', ok: true };
|