setup: auto-detect plugin installation scope when --scope is omitted - #67
Open
Milofax wants to merge 1 commit into
Open
setup: auto-detect plugin installation scope when --scope is omitted#67Milofax wants to merge 1 commit into
Milofax wants to merge 1 commit into
Conversation
When the ASE plugin is installed only in the Claude Code "project" or "local" scope, "ase setup update" (and "uninstall", "enable", "disable") so far always targeted the hard-coded default scope "user": the ASE CLI tool itself was updated fine via npm, but the subsequent "claude plugin update ase@ase" ran without "--scope" and failed with an error, although the update itself had succeeded. Now, when --scope is not given explicitly, the scope is auto-detected from the existing installation by probing the Claude Code settings files (local -> project -> user) for a registered "enabledPlugins" entry "ase@ase", falling back to "user" when no installation is found. An explicitly given --scope always wins, and "ase setup install" keeps its "user" default. Co-Authored-By: Claude Fable 5 <[email protected]>
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.
Symptom
With the ASE plugin installed only in the Claude Code project or local scope (e.g.
ase setup install --scope project), running a plainase setup updatefrom within the project reports an error and exits non-zero — although the update itself effectively succeeds:npm update -g @rse/aseupdates the ASE CLI tool just fine, butclaude plugin update ase@aseis executed without--scope(the hard-coded option default isuser), and fails because the plugin is not registered in the per-user scope.Root cause
tool/src/ase-setup.tsregisters-s, --scopewith a hard-coded default of"user"for allsetupsub-commands. Forupdate,uninstall,enable, anddisablethis default is an assumption about where the plugin is already installed — and it is wrong whenever the installation lives in theprojectorlocalscope.Fix
detectScope(tool): when--scopeis omitted, probe the Claude Code settings files from the strongest to the weakest scope (local→project→user, resolved via the existingstatuslineSettingsFile()helper) for a registeredenabledPluginsentry"ase@ase"(itstrue/falsevalue does not matter — even a disabled plugin is registered in that scope). The first match wins and is logged; no match falls back touser, i.e. the previous behavior.update,uninstall,enable, anddisableactions. An explicitly given--scopealways wins.installkeeps itsuserdefault (there is no existing installation to detect),mcp/statuslineare untouched. For--tool copilot|codexdetection immediately resolves touser, sorequireClaudeScope()semantics are preserved.docs/usage-tool.mdupdated accordingly.Testing
npm start build(lint + tsc + plugin copy) passes cleanly.claude/npmshims and a fake$HOME:ase setup update --force→setup: detected ASE plugin installation in scope "project", runsclaude plugin update ase@ase --scope project, exit 0;--scope user→ no detection, no--scopeargument (unchanged behavior);user(unchanged behavior);ase setup enablewith asettings.local.jsonregistration ("ase@ase": false) →claude plugin enable ase@ase --scope local;localandproject→localwins; a malformed settings file is skipped gracefully.🤖 Generated with Claude Code