feat: add beacon buddy#9410
Conversation
ASCII pet that reacts to beacon node state each slot. Opt-in via hidden --fun off|tty|file|both flag (default off; bare --fun resolves to both). Read-only telemetry: peer count, sync status, fork name, chain reorgs. Mood machine: happy / sleepy / panic / sad plus rare sprites for slot 1337, 31337, every millionth slot, and fork activation slots. TTY mode pins the frame to the bottom of the terminal using a DECSTBM scroll region so concurrent logger output keeps flowing above; downgrades to sidecar-only when stdout is not a TTY or the terminal is too small. File mode writes <dataDir>/buddy.txt once per slot (tail -F or watch -n1 cat to follow). AI-assisted: drafted with Claude Opus 4.7. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request introduces the "beacon buddy" ASCII pet easter egg, which displays a terminal-based or file-based status pet based on the node's current telemetry (such as sync status, peer count, and slot events). The review comments point out several important issues to address: wrapping the fork name retrieval in a safe call to prevent potential crashes, removing the trailing newline in formatFrame to avoid unwanted terminal scrolling, handling boolean false properly in the CLI option coercion, and ensuring the terminal scroll region is restored during abrupt abort events.
Call buddy.stop() in the abort signal listener too, so an error or programmatic abort that bypasses onGracefulShutdown still resets the DECSTBM scroll region. stop() is idempotent. Drop the unreliable bare-flag coerce on --fun: yargs swallows the next token (`--fun --reset` made fun="--reset"), so require an explicit value. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Wrap onSlot and onReorg bodies in try/catch so a synchronous throw in the easter egg can never bubble up through ClockEvent.slot or chainReorg listeners and crash the beacon node. Also safeCall around getForkName and a try/catch around renderer.draw for the same reason. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Performance Report✔️ no performance regression detected Full benchmark results
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## unstable #9410 +/- ##
============================================
+ Coverage 52.46% 52.56% +0.09%
============================================
Files 848 848
Lines 62953 60937 -2016
Branches 4658 4485 -173
============================================
- Hits 33030 32031 -999
+ Misses 29855 28844 -1011
+ Partials 68 62 -6 🚀 New features to boost your workflow:
|
Tamagotchi style ASCII pet that reacts to beacon node state each slot.
Enable this via
--funflag.--funhas 3 options: tty, file and both. File can be monitored usingwatch cat <dataDir>/buddy.txt. tty will have the buddy "pinned" at the bottom of the terminal.Note: star burst during fork transition, panic mood is due to zero peer