Commit 64edfac
committed
feat(hud): complete Wave 3 integration for 1-D/2-A/2-D/2-E (Wave 3b)
Commit bd78195 ("integrate Wave 2-B/2-C in format_status_line") wired
velocity and cache-savings into the cost segment but left four sibling
Wave modules as dead code: hud_buddy, hud_rainbow, hud_context_bar, and
hud_layout. Their unit tests passed, but format_status_line never
called them — the statusLine rendered with a static buddy face, no
adaptive layout, text-only context percentage, and no mode coloring.
This commit closes that gap by hoisting all four modules as top-level
imports (matching the velocity/cache_savings pattern) and refactoring
format_status_line to build (name, priority, text) segments consumed
by fit_segments.
Wave 2-A — breathing buddy face
BUDDY_FACE constant → select_face_from_state(hud_state). The face
now reflects phase/blockerCount:
ready/None → ◕‿◕ (idle)
planning/evaluating → ◔‿◔ (thinking)
executing/cycling → ◕◡◕ (active)
blockerCount > 0 → ◕︵◕ (error, wins over phase)
lastEvent=victory → ◕ᴗ◕ (victory, wins over phase)
Wave 2-D — mode rainbow ANSI coloring (opt-in)
Gated on CODINGBUDDY_HUD_RAINBOW=1 because Claude Code statusLine's
ANSI support is environment-dependent; default OFF keeps existing
terminals clean. Transitively honours NO_COLOR
(https://no-color.org) via hud_rainbow.is_color_enabled. Only real
modes (PLAN/ACT/EVAL/AUTO) are colored — the "Ready" fallback label
stays plain so tests and logs don't see it uppercased.
Coloring is applied POST-fit_segments (string replace on the
already-assembled line1) so the ANSI escapes don't break
hud_layout.visible_len width accounting during layout.
Wave 2-E — smart context bar
"Ctx:{pct}%" segment → format_context_bar_segment(stdin_data),
rendering e.g. "[████░░░░░░] 42%" or "[████████▓░] 92%⚠" above
the warning threshold. Legacy "Ctx:" prefix is gone; the three
existing tests asserting "Ctx:45%"/"Ctx:10%" have been updated to
check for the new bar + percentage combination.
Wave 1-D — adaptive layout
Final " | ".join(segments) → fit_segments(layout_segments,
terminal_width()). Low-priority segments (worktree, rate_limits,
model, cache, ctx) are dropped first on narrow terminals;
face_version and mode_health are sacred and always render.
shorten_model_label trims the "(1M context)" suffix so Opus
display names fit mid-width terminals without being dropped.
test_full_telemetry gained monkeypatch.setenv("COLUMNS", "300")
because its "all segments render" assertion would otherwise flake
against the pytest 80-col default now that adaptive layout
actually runs.
Test coverage:
- 14 new tests split across four classes:
TestWave2ABreathingFaceIntegration (4)
TestWave2EContextBarIntegration (3)
TestWave2DRainbowIntegration (4)
TestWave1DAdaptiveLayoutIntegration (3)
- 3 existing tests updated to match the Wave 2-E "[bar] 45%" format
- 1 existing test (test_full_telemetry) hardened with COLUMNS=300
Local runs: 1077 passed (full plugin test suite). Manual CLI
reproductions confirmed:
- Default: ◕‿◕ CB v5.6.0 | Ready 🟢 | ... | [████░░░░░░] 42% | ...
- 92% context: ... | [████████▓░] 92%⚠ | ...
- RAINBOW=1 PLAN: ... | \x1b[38;2;64;128;255m◇ PLAN\x1b[0m 🟢 | ...
- COLUMNS=60: ◕‿◕ CB v5.6.0 | Ready 🔴 | $1.50... | 12m (sacred + cost + duration only)1 parent cd2c9d3 commit 64edfac
2 files changed
Lines changed: 352 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
62 | 115 | | |
63 | 116 | | |
64 | 117 | | |
| |||
474 | 527 | | |
475 | 528 | | |
476 | 529 | | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
482 | 565 | | |
483 | 566 | | |
484 | | - | |
485 | | - | |
486 | | - | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
487 | 570 | | |
488 | 571 | | |
489 | | - | |
490 | | - | |
| 572 | + | |
491 | 573 | | |
492 | 574 | | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
499 | 602 | | |
500 | 603 | | |
501 | 604 | | |
| |||
0 commit comments