Skip to content

remove command succeeds even when plugin is not rescoped to the project#73

Merged
erdembircan merged 6 commits intomasterfrom
task/71
Mar 3, 2026
Merged

remove command succeeds even when plugin is not rescoped to the project#73
erdembircan merged 6 commits intomasterfrom
task/71

Conversation

@erdembircan
Copy link
Copy Markdown
Owner

[agent]

Closes #71

unscopePlugin now checks whether the plugin has a binding for the current project before attempting removal. If no matching binding exists, it reports that and does nothing instead of unconditionally removing and logging success.

Copy link
Copy Markdown
Owner Author

@erdembircan erdembircan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

@erdembircan
Copy link
Copy Markdown
Owner Author

[agent] Addressed the review feedback: extracted a makeBinding() factory function that provides sensible defaults for all PluginBinding fields. Every inline binding object literal across the test file has been replaced with a call to makeBinding() (with overrides only where the test needs specific values like a different scope or projectPath). This eliminated ~226 lines of duplicated object definitions. All 124 tests continue to pass.

Copy link
Copy Markdown
Owner Author

@erdembircan erdembircan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Work on failed CI operations.

- Derive PluginBinding type from ClaudeCodeToolbox.getGlobalPluginConfig
  return type instead of using Record<string, string>
- Apply Prettier formatting to multi-property makeBinding calls
@erdembircan
Copy link
Copy Markdown
Owner Author

[agent] Fixed the two CI failures:

Typecheck -- The makeBinding() factory was returning Record<string, string>, which is not assignable to PluginBinding. Since PluginBinding is not exported from ClaudeCodeToolbox, I derived the type using ReturnType<ClaudeCodeToolbox["getGlobalPluginConfig"]>[number] and changed the overrides parameter to Partial<PluginBinding>.

Lint (Prettier) -- The single-line makeBinding({ scope: "global", projectPath: "..." }) calls exceeded the print width. Applied eslint --fix to format them as multi-line objects.

All 124 tests pass, typecheck and lint are clean.

Copy link
Copy Markdown
Owner Author

@erdembircan erdembircan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are failed tests.

The "not rescoped" message was using the full projectPath instead of
shortPath, causing the output formatting test (merged from master) to
fail. Also adds the missing getGlobalPluginConfig mock to the remove
output test so the removal path proceeds instead of hitting the
not-rescoped guard.
@erdembircan
Copy link
Copy Markdown
Owner Author

[agent] Fixed the failing test by merging master into the branch and addressing the incompatibility.

Root cause: The PR branch was created before the shortPath refactor landed on master (commit 472cc68). When CI merged the two, the "shows the directory name instead of the full path in remove output" test failed because:

  1. The test did not mock getGlobalPluginConfig, so the new binding check in unscopePlugin found no matching binding and triggered the "not rescoped" path.
  2. The "not rescoped" message used this.projectPath (full path) instead of this.shortPath, which contradicted the test expectation that full paths should not appear in output.

Changes:

  • src/core/PluginRescope.ts -- Changed the "not rescoped" message to use this.shortPath instead of this.projectPath, consistent with the "removed from" message.
  • src/core/PluginRescope.test.ts -- Added getGlobalPluginConfig mock (returning a binding matching the project path) to the "remove output" test so the removal proceeds through the success path.

All 127 tests pass, typecheck and lint are clean.

Copy link
Copy Markdown
Owner Author

@erdembircan erdembircan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@erdembircan erdembircan merged commit 0562fc5 into master Mar 3, 2026
4 checks passed
@erdembircan
Copy link
Copy Markdown
Owner Author

[agent] Merged via squash into master. CI was green on the latest commit (07e544d) and the owner approved with LGTM.

@erdembircan erdembircan deleted the task/71 branch March 5, 2026 11:43
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.

remove command succeeds even when plugin is not rescoped to the project

1 participant