@ztffn/presentation-generator-plugin 1.4.1 → 1.4.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.
Files changed (2) hide show
  1. package/bin/index.js +35 -2
  2. package/package.json +1 -1
package/bin/index.js CHANGED
@@ -125,8 +125,8 @@ function promptChoice(title, choices) {
125
125
 
126
126
  const draw = (first = false) => {
127
127
  if (!first) {
128
- // Reposition to top of the widget and clear downward
129
- process.stdout.write(C.up(lineCount() - 1) + C.clear());
128
+ // \r resets to col 0 before moving up, so C.clear() wipes from the true start of the line
129
+ process.stdout.write("\r" + C.up(lineCount() - 1) + C.clear());
130
130
  }
131
131
  process.stdout.write(`\n◆ ${title}\n`);
132
132
  choices.forEach((c, i) => {
@@ -244,6 +244,25 @@ function cleanOldCacheVersions(keepVersion) {
244
244
  }
245
245
  }
246
246
 
247
+ function purgeInstalledPluginsJson() {
248
+ // Directly remove all entries for this plugin from Claude's global registry
249
+ // so that a subsequent `claude plugin install` always writes a fresh entry.
250
+ const registryPath = path.join(
251
+ os.homedir(), ".claude", "plugins", "installed_plugins.json"
252
+ );
253
+ if (!fs.existsSync(registryPath)) return;
254
+ try {
255
+ const registry = JSON.parse(fs.readFileSync(registryPath, "utf8"));
256
+ const key = `${PLUGIN_NAME}@${MARKETPLACE_NAME}`;
257
+ if (registry.plugins && key in registry.plugins) {
258
+ delete registry.plugins[key];
259
+ fs.writeFileSync(registryPath, JSON.stringify(registry, null, 2) + "\n");
260
+ }
261
+ } catch {
262
+ // registry unreadable/corrupt — leave it alone
263
+ }
264
+ }
265
+
247
266
  function registerWithClaude(installDir, scope) {
248
267
  const pluginsDir = path.dirname(installDir);
249
268
  ensureMarketplaceJson(pluginsDir);
@@ -256,6 +275,19 @@ function registerWithClaude(installDir, scope) {
256
275
  // didn't exist or not removable — ignore
257
276
  }
258
277
 
278
+ // Uninstall any stale plugin entries from both scopes before re-installing.
279
+ // This prevents Claude from reusing a cached entry pointing at an old version path.
280
+ try {
281
+ execSync(`claude plugin uninstall ${PLUGIN_NAME}@${MARKETPLACE_NAME} --scope project`, { stdio: "pipe" });
282
+ } catch {}
283
+ try {
284
+ execSync(`claude plugin uninstall ${PLUGIN_NAME}@${MARKETPLACE_NAME} --scope user`, { stdio: "pipe" });
285
+ } catch {}
286
+
287
+ // Belt-and-suspenders: also purge the registry JSON directly in case
288
+ // `claude plugin uninstall` doesn't clean installed_plugins.json reliably.
289
+ purgeInstalledPluginsJson();
290
+
259
291
  execSync(`claude plugin marketplace add "${pluginsDir}"`, { stdio: "pipe" });
260
292
 
261
293
  const scopeFlag = scope === "project" ? "--scope project" : "--scope user";
@@ -321,6 +353,7 @@ async function install() {
321
353
 
322
354
  console.log("\nRegistering plugin with Claude Code...");
323
355
  registerWithClaude(installDir, scope);
356
+ cleanOldCacheVersions(meta.version);
324
357
 
325
358
  const settingsLabel = scope === "project" ? ".claude/settings.json" : "~/.claude/settings.json";
326
359
  console.log(`Plugin registered in ${settingsLabel} ✓`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ztffn/presentation-generator-plugin",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "Claude Code plugin for generating graph-based presentations",
5
5
  "bin": {
6
6
  "presentation-generator-plugin": "bin/index.js"