Skip to content

[plan] Migrate mcp_inspect_mcp.go to use console helpers instead of direct Lipgloss #11620

@github-actions

Description

@github-actions

Objective

Replace direct Lipgloss style usage in mcp_inspect_mcp.go with appropriate console package helpers for consistency.

Context

From discussion #11611: The mcp_inspect_mcp.go file directly uses styles.ServerName, styles.ServerType, and styles.ErrorBox.Render() instead of going through the console package abstraction layer.

Current Issues: Lines 54-57, 73 use direct Lipgloss styles.

Approach

  1. Review current usage in pkg/cli/mcp_inspect_mcp.go:

    • Identify all direct styles.* usage (lines ~54-57, ~73)
    • Determine appropriate console package alternatives
  2. Replace with console helpers:

    • Use existing console formatters where applicable
    • Consider creating new helpers if needed (e.g., FormatListItem())
    • Maintain the same visual appearance
  3. Test the output:

    • Verify output looks the same in terminal
    • Test non-TTY mode works correctly
    • Ensure error boxes render properly

Files to Modify

  • Update: pkg/cli/mcp_inspect_mcp.go (lines ~54-57, ~73)
  • Consider: pkg/console/*.go (if new helpers are needed)

Implementation Guidance

// Before (mcp_inspect_mcp.go:54-57):
serverNameStyled := styles.ServerName.Render(serverName)
serverTypeStyled := styles.ServerType.Render(fmt.Sprintf("(%s)", mcpConfig.Mode))

// After (option 1 - use existing formatter):
serverInfo := console.FormatInfoMessage(fmt.Sprintf("%s (%s)", serverName, mcpConfig.Mode))

// After (option 2 - create new helper if needed):
serverInfo := console.FormatListItem(fmt.Sprintf("%s (%s)", serverName, mcpConfig.Mode))
// Before (mcp_inspect_mcp.go:73):
fmt.Fprintln(os.Stderr, styles.ErrorBox.Render(errorMsg))

// After:
fmt.Fprintln(os.Stderr, console.RenderErrorBox(errorMsg))

Acceptance Criteria

  • All direct styles.* usage replaced with console helpers
  • Output appearance remains consistent
  • TTY detection works properly
  • No direct Lipgloss imports remain in CLI commands
  • Code passes make fmt and make lint
  • make agent-finish completes successfully

Priority

Phase 1: Critical Fix (1-2 hours estimated)

AI generated by Plan Command for discussion #11611

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions