Skip to content

[plan] Replace direct styles.X.Render() calls in compile_schedule_calendar.go and compile_stats.go with applyStyleWithTTY #43579

Description

@github-actions

Objective

Refactor the two files that call styles.X.Render() directly — pkg/cli/compile_schedule_calendar.go and pkg/cli/compile_stats.go — to use applyStyleWithTTY (or the appropriate exported/internal variant) consistently with the rest of the codebase.

Context

Identified in Terminal Stylist analysis: discussion #43520. Both callsites are already guarded by isTerminal / tty.IsStderrTerminal() checks, so they are functionally correct. The issue is stylistic/architectural inconsistency: the rest of the codebase uses applyStyle/applyStyleWithTTY from pkg/console/, not naked styles.X.Render().

Implementation Plan

Files to Modify

  • pkg/cli/compile_schedule_calendar.go lines 252, 264: styles.TableHeader.Render(header) and styles.TableHeader.Render(label)
  • pkg/cli/compile_stats.go lines 302–303: styles.Error.Render("✗ ")

Approach

  1. Check whether applyStyleWithTTY is exported from pkg/console/. If it is unexported, either:
    • Add a thin exported ApplyStyleWithTTY(style lipgloss.Style, s string) string function to pkg/console/console.go, or
    • Move the rendering calls to use console.FormatErrorMessage / console.RenderTable where applicable.
  2. Replace each styles.X.Render(...) callsite with the chosen pattern.
  3. Run make build and existing tests.

Notes

  • The existing TTY guard in each file is correct and should be preserved (or superseded by the console helper's built-in guard).
  • For compile_stats.go, consider whether console.FormatErrorMessage already produces the right prefix, making the direct styles.Error.Render redundant.

Acceptance Criteria

  • compile_schedule_calendar.go no longer calls styles.TableHeader.Render() directly
  • compile_stats.go no longer calls styles.Error.Render() directly
  • TTY guards are correctly preserved (either via the console helper or retained explicitly)
  • Build passes and existing tests pass

Generated by 📋 Plan Command · 25.5 AIC · ⌖ 8.2 AIC · ⊞ 4.9K ·
Comment /plan to run again

  • expires on Jul 7, 2026, 7:24 AM UTC-08:00

Metadata

Metadata

Labels

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