Repository navigation
Let pi turn Claude plugins on or off without touching Claude Code - #430
Merged
Merged
Conversation
sproott
force-pushed
the
plugin-toggle
branch
from
November 14, 2026 13:55
6a22b68 to
ab37f12
Compare
sproott
marked this pull request as draft
November 14, 2026 13:59
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]>
sproott
force-pushed
the
plugin-toggle
branch
from
November 14, 2026 17:04
ab37f12 to
484433e
Compare
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.enabledPluginsto 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-pluginslists 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 checkpasses (Biome, strict tsc, Vitest)🤖 Generated with Claude Code