id: task-77 title: Migrate from blessed to bblessed for better Bun and Windows support status: Done assignee:
- '@ai-agent' created_date: '2025-06-16' updated_date: '2025-06-16' labels:
- refactoring
- dependencies
- windows dependencies: []
Description
Successfully migrated from the original blessed library to bbblessed (github:node-opcua/bbblessed), a fork with improved bundling support that eliminates the need for complex Windows patches and provides better cross-platform compatibility.
Background
The project previously used blessed v0.1.81 with a custom patch script (scripts/patch-blessed.js) that:
- Replaced dynamic widget loading with static imports for Bun bundling
- Bundled terminfo files and patched tput.js for Windows compatibility
This patching was fragile and a maintenance burden.
Acceptance Criteria
- [x] Replace blessed with bblessed in package.json
- [x] Remove postinstall patch script
- [x] Remove patch-blessed.js and terminfo resources
- [x] All tests pass with bblessed
- [x] Board view and other TUI components work correctly
- [x] Windows binary builds without patches
- [x] No regression in functionality
Implementation Details
Migration Steps Completed:
- Installed bbblessed from GitHub:
npm install github:node-opcua/bbblessed - Removed postinstall script from package.json
- Deleted
scripts/patch-blessed.js - Deleted
resources/terminfo/directory - Updated all imports from
import blessed from "blessed"toimport blessed from "bbblessed" - Verified all tests pass (229/229)
- Tested board view and other TUI functionality
Key Benefits:
- No more patches: bbblessed has improved bundling support with recent commits specifically addressing bundling issues
- Better Windows support: Cross-platform compatibility built-in
- Improved bundling: Specific fixes for bundling issues (Sept 2024 commits)
- Cleaner setup: No postinstall scripts or resource files needed
- Same API: Drop-in replacement, no code changes required
- Active maintenance: bbblessed is actively maintained with recent bundling improvements
Technical Notes:
- The library is now imported as
bbblessedin all source files - Version 0.1.82 includes bundling improvements from Sept 2024
- Windows Fix: Enhanced
createScreen()in tui.ts to handle Windows terminfo issues:- Only disables tput on Windows (works normally on Mac/Linux)
- Sets
tput: false,termcap: false,extended: falseon program creation - Forces
terminal: 'dumb'on Windows to prevent terminfo detection - Provides minimal tput stubs with common escape sequences for Windows
- Works around bbblessed bugs where it incorrectly uses
this.putinstead ofthis.tput.strings - Adds required methods like
csr()andenacs()that bbblessed expects - This completely prevents the
ENOENT: no such file or directoryterminfo errors on Windows - Windows users still get full TUI with colors, boxes, and all features
Related Tasks Updated:
- Task 41: Updated to reflect actual bblessed usage
- Task 53: Added note about improved Bun compatibility
- Task 61: Added note about better bundling with bblessed
- Task 72: Added note about eliminating terminfo patches
- Task 74: Added note about better cross-platform support
- Tasks 76-76.6: Archived (neo-neo-blessed migration cancelled)