Skip to content

Runtime compact fallback for narrow terminals (flexible-welcome-screen Phase 3) #18

Description

@scoobynko

Summary

Implement the runtime compact fallback so the banner adapts when the terminal is narrower than the baked art. This is Phase 3 of the flexible-welcome-screen design, deferred when Phases 1 and 2 shipped.

Background

The design at docs/superpowers/specs/2026-06-30-flexible-welcome-screen-design.md specified three layers of width safety. Two shipped:

  • Layer 1/2 (shipped): design-time fit measurement (src/welchost/fit.py) plus save-time auto-fit — an overflowing banner is silently swapped to the largest SAFE_FONTS font that fits banner.fit_width.
  • Layer 3 (this issue, deferred): runtime adaptation.

Save-time auto-fit covers the common case, but it fits the banner against a configured target width. It cannot help when the actual terminal at shell-open time is narrower than that target — a split pane, a resized window, a smaller external display. In that case the baked art wraps and the banner looks broken.

Specified behaviour

From Layer 3 of the design doc:

The generator bakes a second "compact" variant alongside the primary: same text/colors rendered in an auto-derived next-smaller SAFE_FONTS font (no extra config). The generated welcome_banner.py checks shutil.get_terminal_size().columns on each shell open and prints:

  • the full banner if its width fits the terminal,
  • the compact variant if the window is narrower,
  • a plain-text styled title floor if even compact won't fit.

This is the only added runtime logic in the generated script: a width read + a pick, no new imports. Both variants are rendered in preview so the fallback stays WYSIWYG-tested.

Requirements

  • No new config surface. The compact variant is auto-derived at generation time; the user does not pick it.
  • No new imports in the generated script — shutil is stdlib, and test_generated_banner_is_self_contained must keep passing.
  • Three-way pick: full → compact → plain-text floor. The floor must always render, however narrow the terminal.
  • Preview parity. Both variants render in the TUI preview so the fallback is WYSIWYG-verified, not just hoped for.
  • Tests at representative terminal widths, per the design doc's testing section (line ~229).

Notes

Filed because this work was deferred inside a card marked Done and would otherwise not be tracked anywhere. It also overlaps with any animated-banner work, since both add logic to the generated script.

Areas

Rendering, Flexibility · Effort M

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions