Skip to content

fix(release): address user-blocking setup issues#1012

Merged
Alan-TheGentleman merged 1 commit into
mainfrom
fix/release-user-blockers
Jul 3, 2026
Merged

fix(release): address user-blocking setup issues#1012
Alan-TheGentleman merged 1 commit into
mainfrom
fix/release-user-blockers

Conversation

@Alan-TheGentleman

@Alan-TheGentleman Alan-TheGentleman commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Closes #971
Closes #899
Closes #1011

PR Type

  • Bug fix
  • New feature
  • Documentation only
  • Code refactoring
  • Maintenance/tooling
  • Breaking change

Summary

  • Cleans legacy Pi subagent package entries, including versioned legacy specs, during Pi settings merge.
  • Moves Claude Code Context7 injection to ~/.claude/settings.json and makes uninstall clean managed legacy files without deleting custom files.
  • Avoids OpenCode TUI theme-state subscription in the Gentle Logo plugin to mitigate theme-swap TextBuffer crashes.

Changes

File Change
internal/agents/pi/adapter.go Filters legacy Pi subagent package specs before appending current Pi MCP adapter package.
internal/components/mcp/inject.go Routes Claude Code Context7 through settings-based MCP server injection.
internal/cli/run.go Reports Claude Context7 verification/backup path as settings.json.
internal/components/uninstall/service.go Removes Claude settings Context7 entry and only removes managed legacy Context7 files.
internal/components/opencodeplugin/plugin.go Removes theme-state dependency from the Gentle Logo TUI plugin.
*_test.go Adds regression coverage for Pi cleanup, Claude Context7 paths/uninstall, and OpenCode theme-state avoidance.

Test Plan

  • go test ./internal/components/uninstall ./internal/cli ./internal/components/mcp ./internal/agents/pi ./internal/components/opencodeplugin
  • Fresh reliability review via subagent: no findings
  • No generated test artifact included in commit

Contributor Checklist

  • Linked an approved issue
  • Added exactly one type:* label
  • Shell scripts not modified
  • Skills tested in at least one agent / not applicable
  • Docs updated if behavior changed / covered by tests for config paths
  • Conventional commit format
  • No Co-Authored-By trailers

Summary by CodeRabbit

  • Bug Fixes

    • Improved Claude-related setup so Context7 is stored in the main settings file instead of creating a separate legacy file.
    • Updated uninstall behavior to remove managed legacy Context7 entries safely while preserving custom user-created files and unrelated settings.
    • Prevented duplicate Pi package entries when older identity formats are present.
  • Style

    • Simplified the gentle logo plugin to use a fixed color instead of theme-based styling.

Copilot AI review requested due to automatic review settings July 3, 2026 10:23
@Alan-TheGentleman Alan-TheGentleman added the type:bug Bug fix label Jul 3, 2026
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Three unrelated fixes: Pi adapter deduplicates legacy subagent packages during settings merge; Claude Code Context7 MCP injection and uninstall now target ~/.claude/settings.json instead of an unread legacy file, with managed-file cleanup logic; and the OpenCode gentle-logo plugin removes theme-dependent rendering (fixed magenta color, no theme props/ctx).

Changes

Pi Legacy Subagent Deduplication

Layer / File(s) Summary
Legacy identity map and merge filtering
internal/agents/pi/adapter.go, internal/agents/pi/adapter_test.go
A legacy identity map is added; piPackageIdentity resolves legacy sources to canonical identities via isLegacyPiSubagentPackage, and appendPiPackage filters out both current and legacy duplicate entries; a new test verifies legacy packages are removed during settings merge while other packages are preserved.

Claude Code Context7 MCP Path Migration

Layer / File(s) Summary
Inject Context7 into Claude settings
internal/components/mcp/inject.go, internal/components/mcp/inject_test.go, internal/cli/run.go, internal/cli/run_component_paths_test.go
Inject merges Context7 into ~/.claude/settings.json for Claude Code instead of writing the legacy ~/.claude/mcp/context7.json; componentPathsWithWorkspaceScoped tracks the settings path for Claude instead of the legacy path; tests verify the settings file is updated, the legacy file is not created, and pre-existing legacy files are left untouched.
Uninstall cleanup for settings and legacy file
internal/components/uninstall/service.go, internal/components/uninstall/service_test.go
context7Targets/context7Operations rewrite mcpServers.context7 in Claude settings and conditionally remove the legacy file only if it matches a known managed npx/@upstash/context7-mcp shape via new removeManagedContext7File; tests verify managed legacy files are removed while custom legacy files and unrelated settings entries are preserved.

OpenCode gentle-logo Plugin Theme Removal

Layer / File(s) Summary
Remove theme dependency from Logo component
internal/components/opencodeplugin/plugin.go, internal/components/opencodeplugin/plugin_test.go
The embedded Logo component drops its theme prop and TuiThemeCurrent import, renders text in fixed magenta, and the home_logo slot no longer passes ctx; the test asserts no theme-related identifiers appear in generated plugin content.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Installer as Install/Sync CLI
  participant Inject as mcp.Inject
  participant Settings as ~/.claude/settings.json
  participant Legacy as ~/.claude/mcp/context7.json

  Installer->>Inject: Inject(ComponentContext7, AgentClaudeCode)
  Inject->>Settings: injectMergeIntoSettings (write mcpServers.context7)
  Note over Inject,Legacy: Legacy file untouched by Inject

  Installer->>Inject: Uninstall(ComponentContext7, AgentClaudeCode)
  Inject->>Settings: remove mcpServers.context7 entry
  Inject->>Legacy: read legacy file
  alt matches managed npx/@upstash/context7-mcp shape
    Inject->>Legacy: removeManagedContext7File deletes it
  else custom content
    Inject->>Legacy: leave file unchanged
  end
Loading

Suggested labels: size:exception

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and broadly matches the PR’s main focus on fixing release/setup issues across Pi, Claude Code, and OpenCode.
Linked Issues check ✅ Passed The changes satisfy #971, #899, and #1011 by cleaning legacy Pi packages, relocating Claude Context7 config, and removing OpenCode theme-state subscription.
Out of Scope Changes check ✅ Passed No evident out-of-scope code changes appear beyond the three linked objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/release-user-blockers

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes several user-blocking setup and runtime issues across supported agents by improving migration/uninstall behavior, aligning Claude Code MCP injection with the paths Claude actually loads, and hardening an OpenCode TUI plugin against theme-swap crashes.

Changes:

  • Pi: remove legacy subagent package entries during settings merge to avoid duplicate tool registration conflicts.
  • Claude Code: inject Context7 via ~/.claude/settings.json (settings-based MCP) and make uninstall remove only managed legacy Context7 files while preserving user/custom files.
  • OpenCode: remove theme-state subscription from the Gentle Logo TUI plugin to mitigate theme-change TextBuffer crashes; add regression tests across affected areas.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/agents/pi/adapter.go Filters known legacy Pi subagent package identities while appending the current MCP adapter package.
internal/agents/pi/adapter_test.go Adds regression test ensuring legacy Pi subagent specs are removed during settings merge.
internal/components/mcp/inject.go Routes Claude Code Context7 injection through settings merge instead of writing a standalone ~/.claude/mcp/context7.json.
internal/components/mcp/inject_test.go Updates/extends tests to validate Claude Context7 is merged into settings and legacy files aren’t rewritten.
internal/cli/run.go Adjusts Context7 “verification/backup paths” reporting for Claude to use settings.json.
internal/cli/run_component_paths_test.go Adds regression test ensuring Claude Context7 uses settings.json and does not verify legacy file paths.
internal/components/uninstall/service.go Adds Claude-specific Context7 uninstall behavior (remove settings entry + delete only managed legacy file).
internal/components/uninstall/service_test.go Adds uninstall regression tests for Claude managed legacy file removal vs preserving custom legacy files.
internal/components/opencodeplugin/plugin.go Removes theme dependency from the Gentle Logo plugin and hardcodes a non-theme color.
internal/components/opencodeplugin/plugin_test.go Adds regression assertions ensuring the plugin does not reference theme state.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1006 to +1013
apply: func(path string) (bool, bool, error) {
content, err := os.ReadFile(path)
if err != nil {
if os.IsNotExist(err) {
return false, false, nil
}
return false, false, err
}

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
internal/agents/pi/adapter.go (1)

267-291: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider consolidating the repeated identity-match pattern.

The piMCPAdapterPackage check (Lines 276-278) and the legacy-loop check (Lines 279-284) both implement the same "exact match or X@ prefix" pattern. Extracting a small helper (e.g. matchesPackage(source, candidate string) bool) would avoid duplicating this boundary logic and reduce risk of divergence if one copy is tweaked later.

♻️ Proposed refactor
+func matchesPackage(source, candidate string) bool {
+	return source == candidate || strings.HasPrefix(source, candidate+"@")
+}
+
 func piPackageIdentity(pkg any) string {
 	source, ok := pkg.(string)
 	if !ok {
 		object, isObject := pkg.(map[string]any)
 		if !isObject {
 			return ""
 		}
 		source, _ = object["source"].(string)
 	}
-	if strings.HasPrefix(source, piMCPAdapterPackage+"@") || source == piMCPAdapterPackage {
+	if matchesPackage(source, piMCPAdapterPackage) {
 		return piMCPAdapterPackage
 	}
 	for legacy := range legacyPiSubagentPackageIdentities {
-		if source == legacy || strings.HasPrefix(source, legacy+"@") {
+		if matchesPackage(source, legacy) {
 			return legacy
 		}
 	}
 	return source
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/agents/pi/adapter.go` around lines 267 - 291, The package identity
matching in piPackageIdentity repeats the same exact-match-or-versioned-prefix
logic for piMCPAdapterPackage and legacy entries, so consolidate that boundary
check into a small helper and use it in both places. Introduce a shared matcher
near piPackageIdentity/isLegacyPiSubagentPackage (for example, a helper that
tests source against a candidate package name) and replace the duplicated string
comparisons in piPackageIdentity with calls to it to keep the behavior
consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@internal/agents/pi/adapter.go`:
- Around line 267-291: The package identity matching in piPackageIdentity
repeats the same exact-match-or-versioned-prefix logic for piMCPAdapterPackage
and legacy entries, so consolidate that boundary check into a small helper and
use it in both places. Introduce a shared matcher near
piPackageIdentity/isLegacyPiSubagentPackage (for example, a helper that tests
source against a candidate package name) and replace the duplicated string
comparisons in piPackageIdentity with calls to it to keep the behavior
consistent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 3f7d9416-7bd9-4f20-a684-98fab18f0b41

📥 Commits

Reviewing files that changed from the base of the PR and between ab184f2 and 2424300.

📒 Files selected for processing (10)
  • internal/agents/pi/adapter.go
  • internal/agents/pi/adapter_test.go
  • internal/cli/run.go
  • internal/cli/run_component_paths_test.go
  • internal/components/mcp/inject.go
  • internal/components/mcp/inject_test.go
  • internal/components/opencodeplugin/plugin.go
  • internal/components/opencodeplugin/plugin_test.go
  • internal/components/uninstall/service.go
  • internal/components/uninstall/service_test.go

@Alan-TheGentleman Alan-TheGentleman merged commit aba1adc into main Jul 3, 2026
18 checks passed
@Alan-TheGentleman Alan-TheGentleman deleted the fix/release-user-blockers branch July 3, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug Bug fix

Projects

None yet

2 participants