Skip to content

[Code Quality] Extract console.Spacing() helper to eliminate repeated blank-line fmt.Fprintln patterns #45486

Description

@github-actions

Description

Multiple files in pkg/cli/ use repeated fmt.Fprintln(os.Stderr, "") calls for spacing between output sections. This pattern is scattered across at least 5 files and repeated many times (e.g., run_interactive.go:78-80,99-103, outcomes_history.go:171, mcp_inspect.go many locations).

A centralized console.Spacing() helper would eliminate the duplication, make intent explicit, and allow future styling (e.g., TTY-adaptive spacing) without touching all call sites.

Suggested Changes

  1. Add func Spacing() (and optionally func SpacingN(n int)) to pkg/console/console.go
  2. Replace all fmt.Fprintln(os.Stderr, "") spacing calls across pkg/cli/ with console.Spacing()
  3. Ensure the helper writes to os.Stderr consistent with existing console helpers

Files Affected

  • pkg/console/console.go — add Spacing() helper
  • pkg/cli/run_interactive.go lines 78-80, 99-103
  • pkg/cli/outcomes_history.go line 171
  • pkg/cli/mcp_inspect.go (multiple locations)
  • Other pkg/cli/ files with the same pattern

Success Criteria

  • No fmt.Fprintln(os.Stderr, "") calls remain in pkg/cli/ for blank-line spacing
  • New console.Spacing() helper is documented and used consistently
  • All existing tests pass with identical output

Source

Extracted from Terminal Stylist Console Output Analysis — 2026-07-14

Priority

Medium — reduces duplication and improves maintainability of console output layer

🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · 151.8 AIC · ⌖ 7.62 AIC · ⊞ 7K ·

  • expires on Jul 15, 2026, 5:20 AM UTC-08:00

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions