Skip to content

fix(plugins): activate externally installed plugins regardless of defaultEnabled - #181

Merged
kipavy merged 1 commit into
devfrom
fix/external-plugin-activation
Aug 25, 2026
Merged

fix(plugins): activate externally installed plugins regardless of defaultEnabled#181
kipavy merged 1 commit into
devfrom
fix/external-plugin-activation

Conversation

@kipavy

@kipavy kipavy commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

The bug

Installing a theme from the marketplace added no theme to Settings → Appearance, and restarting did not help.

Both marketplace themes ship "defaultEnabled": false in their manifest. Install and boot both computed activation as isEnabled(manifest.id, manifest.defaultEnabled ?? true), so with no stored override the plugin loaded inactive. Its register() opens with if (!api.isActive()) return;, so it contributed nothing, and boot recomputed the same inactive state — hence the restart doing nothing.

There was no way to recover from the UI: the enable/disable toggle renders only on seeded rows (PluginsSection.tsx:487), never on externally installed ones. The only escape was the Reload button, which happened to hardcode active = true.

The fix

defaultEnabled means "ships with the app, off until asked for" — a seeded concept. A catalogue plugin is on disk because the user installed it, so the install is itself the opt-in and the manifest flag must not gate it.

One helper replaces four call sites (install, boot, reload, local scan):

function externalPluginActive(manifestId: string): boolean {
  return usePluginRegistryStore.getState().isEnabled(manifestId, true);
}

An explicit stored override still wins. That also fixes a second bug in passing: reload and local scan previously forced active = true, silently re-enabling a plugin the user had disabled.

Seeded plugins are untouched — defaultEnabled still means what it means for something that ships preinstalled.

Tests

src/stores/marketplaceStore.externalActivation.test.ts — four tests. The fake bundle mirrors the real theme bundles' isActive() guard and asserts on pluginThemes, the store the Appearance list actually reads.

Written first; three failed for the expected reason before the change (no theme registered on install, none after boot, and reload re-enabling a disabled plugin), the fourth is a guard that passed throughout.

  • 141 files / 1241 tests pass across the marketplace, plugin-registry, plugin-store and plugins suites
  • tsc --noEmit clean

Live verification

Driven through the real app in the headless container, on this branch:

  • Installed Emerald Night from the live catalogue via the Browse tab, permission sheet and all
  • Theme appears in the COLOR THEME grid; selecting it sets --t-bg-terminal to #141729, the bundle's own bgTerminal
  • Survives an app restart, still selected

Negative control: reverting just this commit's change to marketplaceStore.ts in the same running build makes the theme vanish from the list and the terminal background fall back to #0b1220; restoring it brings both back.

Follow-ups, deliberately not in this PR

  • Externally installed plugins still have no enable/disable toggle at all, so disabling one without uninstalling is impossible. Worth deciding separately.
  • Both marketplace theme manifests still carry "defaultEnabled": false. Harmless now that nothing reads it on this path, but misleading — a cleanup for the marketplace repo.

…aultEnabled

A catalogue plugin whose manifest set "defaultEnabled": false loaded inactive,
so its register() hit the isActive() guard and contributed nothing. Both
marketplace themes ship that flag, so installing one added no theme to the
Appearance list, and a restart recomputed the same inactive state. The enable
toggle that would have fixed it renders only on seeded rows, so there was no
way back short of the Reload button, which happened to hardcode active=true.

defaultEnabled means "ships with the app, off until asked for" — a seeded
concept. Installing from a catalogue is itself the opt-in, so the external
paths now default to enabled and honour only an explicit stored override.
That override is now also honoured by reload and local scan, which previously
forced active=true and silently re-enabled a plugin the user had disabled.
@kipavy
kipavy merged commit 99d8a4f into dev Aug 25, 2026
4 checks passed
@kipavy
kipavy deleted the fix/external-plugin-activation branch August 25, 2026 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant