Skip to content

Let pi turn Claude plugins on or off without touching Claude Code - #430

Merged
ilovepixelart merged 10 commits into
ilovepixelart:mainfrom
sproott:plugin-toggle
Nov 14, 2026
Merged

ilovepixelart merged 10 commits into
ilovepixelart:mainfrom
sproott:plugin-toggle

Conversation

@sproott

@sproott sproott commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Some Claude Code plugins also ship a native pi package, so pi loads them twice. The only way to turn one off was Claude's enabledPlugins, which turns it off in Claude Code too.

This adds piCode.enabledPlugins to pi's ~/.pi/agent/settings.json. It takes the same keys as Claude's setting, ranks below managed settings and above Claude's user setting, and Claude Code never reads it.

/claude-plugins lists installed plugins with their state and the setting that decided it, and toggles them through that key. It writes an entry only when pi should differ from Claude, and leaves bare-name entries alone since they can cover same-named plugins from other marketplaces. Changes apply on /reload, which is left to the user because it aborts running subagents.

  • npm run check passes (Biome, strict tsc, Vitest)
  • Tests cover the change

🤖 Generated with Claude Code

@sproott
sproott marked this pull request as draft November 14, 2026 13:59
@sproott
sproott marked this pull request as ready for review November 14, 2026 16:37
Add piCode.enabledPlugins to pi's settings.json, ranked below managed
settings and above Claude's enabledPlugins, and a /claude-plugins command
that toggles installed plugins through it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Assigning a saved undefined back to process.env stores the string
"undefined". The PI_CODING_AGENT_DIR restores now delete the variable
when it was unset.

The /claude-plugins tests set HOME and USERPROFILE and restored only
HOME. They now replace os.homedir through a node:os mock, as the other
suites do, which holds on Windows where homedir reads USERPROFILE.
The flag's enabledPlugins was merged into the Claude user settings map,
and the pi key was applied over that map, so a saved
piCode.enabledPlugins false beat a one-off
--settings '{"enabledPlugins":{"x@y":true}}'. Claude ranks the flag
above every settings file and below managed settings only.

The flag's snapshot is now read apart from the user file. The order is
managed settings, the --settings flag, piCode.enabledPlugins, the Claude
user settings file, the manifest default. pluginStates reports "flag" as
a deciding source of its own, and /claude-plugins labels it
"--settings flag" and the user file "Claude user settings".
The list's change callback scored a cognitive complexity of 18 against
Biome's limit of 15. Saving a toggle and building the list are now
functions of their own; behaviour is unchanged.

Tests cover the listing shown without a TUI, the notice when no plugin
is installed, a failed settings write (the row goes back and the error
is shown), the description after a toggle, and a managed plugin that
cannot be toggled.
The list offered an on/off toggle for a plugin whose state the
--settings flag sets. The toggle saved a piCode.enabledPlugins entry
that the flag outranks, so the row flipped while the plugin's state did
not. Such a row is now read-only, like a managed one, and its
description reads "Set by the --settings flag for this session".

The listing shown without a TUI separates the plugin and its state with
a colon.
pi's settings reader strips a leading UTF-8 byte order mark before
parsing. Here JSON.parse received the mark, so on such a file
piCode.enabledPlugins was ignored with a warning and a /claude-plugins
toggle failed with "Unexpected token". Both reads of pi's settings.json
now strip the mark.
docs/plugins.md said only managed plugins cannot be toggled. A plugin
the --settings flag decides is read-only as well.
The comment opened with "shortcut:" and described the writer pi does not
export. It now states the constraint alone: no lock is shared with pi's
settings writer, so a pi write between the read and the rename is lost.
The command tests wrote piCode.enabledPlugins into the agent directory
the whole file shares. Under the shuffled order an entry such as
"linter@community": false stayed behind and turned that plugin off in
later installedPlugins tests, which then failed. Each command test now
runs against a fresh PI_CODING_AGENT_DIR.
installedPlugins and pluginStates each walked the marketplaces, picked
the version to load and read its manifest. One cachedPlugins function
now does that walk for both. Behaviour is unchanged.
@ilovepixelart
ilovepixelart merged commit effb733 into ilovepixelart:main Nov 14, 2026
12 checks passed
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.

2 participants