Skip to content

fix(ppm): Persist-PluginActivation never persists on a normal install - #34

Open
dabravin wants to merge 1 commit into
psmux:mainfrom
dabravin:fix/ppm-persist-plugin-activation-self-match-v2
Open

fix(ppm): Persist-PluginActivation never persists on a normal install#34
dabravin wants to merge 1 commit into
psmux:mainfrom
dabravin:fix/ppm-persist-plugin-activation-self-match-v2

Conversation

@dabravin

Copy link
Copy Markdown

Summary

Persist-PluginActivation's "already exists" check matches on the bare plugin name anywhere in .psmux.conf, via [regex]::Escape($name). The documented install flow requires the user to already have set -g @plugin 'org/name' in their config before Prefix+I attempts installation - so that declaration line always already contains $name by the time this check runs. The check matches it immediately and returns early, before ever appending the real source-file/run-shell activation line.

Net effect: any plugin that ships a plugin.conf or a matching .ps1 entry point never gets its activation persisted via the normal, documented install flow (set -g @plugin ... + Prefix+I). It has to be noticed and hand-fixed by adding the source-file line yourself - the exact thing this function exists to automate.

Fix

Check for the literal $activationLine string (already fully computed earlier in the function) instead of the bare plugin name. That string is specific enough (source-file '~/.psmux/plugins/<name>/plugin.conf' or run-shell '...') that it won't accidentally match the plugin's own @plugin declaration line, while still correctly detecting a genuinely-already-persisted activation line on a second install attempt.

Test plan

  • Verified the bug reproduces on a fresh install: declare @plugin 'psmux-plugins/psmux-resurrect', delete any existing plugin dir, run Prefix+I - no source-file line gets added to .psmux.conf, confirmed via direct file inspection before/after.
  • Applied the fix and confirmed the check no longer matches on the bare @plugin declaration.
  • Validated PowerShell syntax of the patched file ([scriptblock]::Create parse check).
  • Would appreciate a maintainer re-running the full install flow end-to-end, since I don't have a way to test the actual Prefix+I keybinding path itself, only the underlying function logic.

…n line

Persist-PluginActivation's "already exists" check matched on the bare
plugin name anywhere in the config file, via [regex]::Escape($name).
Since the documented install flow requires the user to already have
`set -g @plugin 'org/name'` in their config before Prefix+I attempts
installation, that declaration line always already contains $name -
so the check matched it on every fresh install and returned early
before ever appending the real source-file/run-shell activation line.

Net effect: plugins that ship a plugin.conf or matching .ps1 never get
their activation persisted via the normal install flow, so they don't
load automatically on the next server start (users have to notice and
hand-add the source-file line themselves).

Fix: check for the literal $activationLine string instead of the bare
plugin name, since that line is already fully computed by this point
and won't accidentally match the plugin's own @plugin declaration.
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