Skip to content

Conversation

Copy link

Copilot AI commented Nov 4, 2025

Implementing improved console UX for fukuii-launcher

Status: Ready for Review

Completed Tasks

  • Explore repository structure and understand codebase
  • Design TUI architecture with JLine3
  • Create ConsoleUI components (header, peer info, sync status, block info, etc.)
  • Integrate ConsoleUI into Fukuii.scala main launcher
  • Add flag to disable console UI (--no-tui)
  • Implement keyboard command handling (q for quit, r for refresh, d to disable)
  • Ensure proper cleanup of terminal on exit (restore colors/cursor)
  • Add ASCII art from PR comments (Ethereum Classic logo)
  • Add progress bars for sync status
  • Add color-coded status indicators
  • Add visual peer count indicators
  • Create comprehensive user documentation (docs/console-ui.md)
  • Create ADR-008 for architectural decision record
  • Update main README.md with console UI information
  • Create visual mockups showing console UI in different states
  • Address initial code review feedback (extract constants, fix shutdown mechanism)
  • Address PR review comments (remove unused imports, fix race conditions)

Recent Fixes (Latest Commit)

  • Removed unused imports (scala.concurrent.duration._, cats.effect.IO, cats.effect.unsafe.implicits.global)
  • Fixed triple shutdown scenario by removing shutdown call from ConsoleUIUpdater finally block
  • Added synchronization to ConsoleUI.shutdown() to prevent race conditions
  • Fixed 'd' command to return false, properly exiting the update loop

Implementation Summary

Files Created (3)

  • src/main/scala/com/chipprbots/ethereum/console/ConsoleUI.scala (487 lines)
  • src/main/scala/com/chipprbots/ethereum/console/ConsoleUIUpdater.scala (115 lines)
  • Total production code: ~600 lines

Files Modified (3)

  • Fukuii.scala - CLI flag handling and initialization
  • StdNode.scala - Lifecycle integration
  • App.scala - Help text update

Documentation Created (4)

  • docs/console-ui.md - User guide
  • docs/adr/008-console-ui.md - Architecture decision record
  • docs/console-ui-mockup.txt - Visual mockups
  • README.md - Updated with console UI section

Key Features

✅ Terminal UI with real-time node monitoring
✅ Grid-based non-scrolling layout
✅ Peer connection status with visual indicators
✅ Blockchain sync progress with progress bars
✅ Keyboard commands (Q/R/D)
✅ Color-coded health status (Green/Yellow/Red)
✅ Ethereum Classic ASCII art
✅ Graceful fallback to standard logging
--no-tui flag for headless mode

Quality Assurance

✅ Code review completed and all feedback addressed
✅ Removed unused imports
✅ Fixed shutdown race conditions with synchronization
✅ Proper shutdown coordination (single-point responsibility)
✅ Comprehensive error handling
✅ Cross-platform compatibility
✅ Thread-safe state management
✅ Proper documentation (ADR + User Guide)

Original prompt

This section details on the original issue you should resolve

<issue_title>Improved c-ux</issue_title>
<issue_description>Create an improved console UX for users running the software and want to monitor directly.

Basic requirements:
enabled by default when user uses the fukuii-launcher
can be disabled with a flag on launch
The screen should not scroll
The screen should have a grid layout
The display should show the current state of connecting to peers, count of peers, current network, block height, best block, estimated sync time etc
The user should have basic keyboard commands to exit, enable or disable features, etc
Green etc color scheme, color should cleanup on exit</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@realcodywburns
Copy link

useful ascii art for the tui:

Fukuii logo:

                                          ........                                              
                                       ......--:.....                                           
                                    ......-++++++=......                                        
                         ..     .......-++++++++++++-......                                     
                    ...............:-++++++++++%%#+++++-:.....                                  
                   ...:*%#*#%+:..=++++++++++++++###*++++++=......                               
                  ..:#+--=----+#*++++++++++++++++*##*++++++++-:..... ........                   
                 ..:#----==+=--=+#++++++++++++++++###+++++++++++-:............                  
                 ..=+---+#**#*=--**+++++++++++++++*#%++++++++++++++==####%%+...                 
               ....*+===*#+++#*--=#+++++++++++++++*##*+++++++++++*####*-......                  
           .....-+*=-----**++*#--=#+++++++++++++++*#%++++++++++*###*+++++=:......               
        ......-#=---------**+**--=#++++=++++++++++###++++++++*#*%*++++++++++=:.....             
      .....:-*#-+=----+#--+*+#+==**++++++++++*****%#*+++++++###*+++++++++++++++=:.....          
     ...:=+++%==##----=+--****--=#++++++##***+=====***##*+*#*#++++++++++++++++++++=:...         
     ...=++++#+---***#*--=#+#+--+#+++*%*==+*+=====-======###*++++++++++++++++++++++=...         
     ...=+++++#+--=*+*=-+#++%+--=#*+#*=+++#===+=-:=====+###*##++++++++=++++++++++++=...         
     ...=++++++*##*++*##++++**=---+###*+++*++====:---=+*##*+=+#*+++++++++++++++++++=...         
     ...=++++++++++++++++++++##+==---+%+++#+==:---=====+++====+%+++++++++++++++++++=...         
     ...=++++++++++++++++++++++##*++*#+++*+====--=====++*###*++*#++++++++++++++++++=...         
     ...=+++++++++++++++++++++++*#******+*+===--=====+++=====*#+%+++++=++++++++++++=...         
     ...=+++++++++++++++++++++++%++#%%%%%+++==:::-===+*#%%#+==+%%++++++++++++++++++=...         
     ...=++++++++++++=+++++++++##=#%%=.:%*===--=+==+##=+%%%%*==*#++++++++++++++++++=...         
     ...=++++++++++++++++++++++#*+%%%#*%%*========+#%..-%%%#%+=*%++++++++++++++++++=...         
     ...=++++++++++++*#*+++++++#*+%%%%%%%+========*%%%%%%%%#%+=##++++++++++++++++++=...         
     ...=+++++++++#%*#+=*%*++++*%+*%%%%%*=========*%%%%%%%###=+%+++++++++++++++++++=...         
     ...=+++++++#*===+*+==#*++++*#++###++++=======+%%%%%###*=+#*+++++++++++++++++++=...         
     ...=+++++*#======+*==+#*++++*%***==+*++=+*#++=+#%#%%*++*%*++++++++++++++++++++=...         
     ...=++++##======+*#+==+%*++++++##++=*%%#****++++==+++*##++++++*#*+++++++++++++=...         
     ...=+++*#======+*%*+===+#+++++++##+=+#*=+**+=++***####++++++##+*#+++++++++++++=...         
     ...=++*#======*#*#*+====*#++++++++##*=+++++++*#%%*++++++++##++*#*+++++++++++++=...         
     ...=++**====+*#*+#**====+#*+++++++*%%%%%%%%%%##%%#%%+++++#++***#++++++++++++++=...         
     ...=++#+==++###**#**+====+%+++++*%##*+*#%%#%%%%***##%++*#+****%*++++++**++++++=...         
     ...=++#+=+*#+++++*#**+=+++*#+*######+=+*%%%%#*++*#*#%+*#+****##++++*#*+#++++++=...         
     ...=++**++#++++++##***+====%#+=+*#%*===*++=====*%**#%##+***###+++#%#==+#++++++=...         
     ...=+++#+*#+++++++*##**+++=##++*###*==++======+#%##++#****##%*#%*===*#*#++++++=...         
     ...=++++%%*++++++++++##***##%%%*+++#+=+*=====+*##%#+++%*##%%*+==*#+==+%*++++++=...         
     ...-+++++++++++=++++++++*#%#++++++++#%##*+++*##*####+++%++*+======#++*#+++++++=...         
     ....-+++++++++++++++++++++++*#*+++++*%#***#####%%###%##%#+=+*+====+#*%+++++++-:...         
      .....:-++++++++%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#*#%+++++-:.....          
         ......-++++*%-......#=..*%%=..%*..=%#...##:..%%#..=%*..+%=..*%*%*++=......             
            ......-+*%-..####%=..*%%=..%*..=*..:#%#:..%%#..=%*..+%=..*%#+-:......               
               .....=%-..+++#%=..*%%=..%*..:..:#%%#:..%%#..=%*..+%=..*%:......                  
                  ..=%-.....+%=..*%%=..%*.....:%%%#:..%%#..=%*..+%=..*%:..                      
                  ..=%-..%%%%%=..+%%=..%*..==..-#%#:..%%#..=%*..+%=..*%:..                      
                  ..=%-..%*..#*...::..=%*..=%+..:%%=...:...*%*..+%=..*%:..                      
                  ..-%#**%*..:#%#+==*%%%%**#%%#***%%%*===#%%%%**%%#**%%...                      
                  ...:-==-.....:=+++++++****++*#**#***#*+=:..-==-:-==-....                      
                   ......... .........:-+++++++#+*#+-:..................                        
                                    ......-++++*#%:.....                                        
                                       ......::..:...                                           
                                          ..........                                            

Ethereum Classic:

                                             --                                                 
                                           .=+#+.                                               
                                          .+++*#*.                                              
                                         :++++*###-                                             
                                       .=+++++*####+.                                           
                                      .=++++++*#####+.                                          
                                     :++++++++*#######:                                         
                                    :+++++++++*########-                                        
                                   =++++++++++*#########+                                       
                                 .++++++++++++*##########*.                                     
                               .:+++++++++++++*############:                                    
                               -++++++++++++++*#############=                                   
                             .=+++++++++++++++*##############*.                                 
                            .+++++++++++++++++*###############*.                                
                           :++++++++++++++++++*#################:                               
                          =+++++++++++++++++++*##################=                              
                         =++++++++++++++++=:.  ..=################+                             
                       .++++++++++++++=-.          .-+##############:                           
                      :++++++++++++=.       .:-..      .=*###########:                          
                     -++++++++++:..      .=+++*##*:      ..:*#########=.                        
                   .++++++++-:.      .:=++++++*#####*=.      .:+#######*.                       
                  .+++++=-.      ..-++++++++++*#########+:.      .-*####*.                      
                 :+++=.       .:=+++++++++++++*############*-..      .+###-.                    
               .=+:.       .-+++++++++++++++++*################+.      ..-*=                    
              ..       .:=++++++++++++++++++++*###################*-.      ...                  
                    .-++++++++++++++++++++++++*#######################=:.                       
                .:=+++++++++++++++++++++++++++*##########################*-.                    
                ..=*#*###*****++++++++++++++++*##########################=..                    
                    .-*#####################**#######################*-.                        
              ...      .:+*#######################################+.       ...                  
                :+-..       :*#################################:       ..=#-                    
                 :+++=-.      .:=##########################+:.      .-*###:.                    
                  .=+++++-.       .-+##################*-.       :=*####*.                      
                   .=+++++++=:.       :+*###########*:.      .-+#######+.                       
                     -++++++++++=.        -*#####=.       .=##########=.                        
                      .++++++++++++=:       .::.       :+###########*:                          
                       .=++++++++++++++-.          .=*#############*:                           
                         -++++++++++++++++=:.  .:+################+                             
                          :+++++++++++++++++++*##################=                              
                           .++++++++++++++++++*#################:                               
                            .=++++++++++++++++*###############*.                                
                              =+++++++++++++++*##############*.                                 
                               :++++++++++++++*#############=                                   
                                .+++++++++++++*############:                                    
                                 .=+++++++++++*##########*.                                     
                                   -++++++++++*#########+                                       
                                   .:+++++++++*########-.                                       
                                     .++++++++*#######:                                         
                                      .=++++++*#####*.                                          
                                       .-+++++*####+.                                           
                                         :++++*###-                                             
                                          .+++*##:                                              
                                           .=+**.                                               
                                             -=                                                 

Copilot AI and others added 5 commits November 4, 2025 14:53
Co-authored-by: realcodywburns <13103499+realcodywburns@users.noreply.github.com>
Co-authored-by: realcodywburns <13103499+realcodywburns@users.noreply.github.com>
Co-authored-by: realcodywburns <13103499+realcodywburns@users.noreply.github.com>
Co-authored-by: realcodywburns <13103499+realcodywburns@users.noreply.github.com>
Copilot AI changed the title [WIP] Create improved console UX for user monitoring Add interactive TUI for real-time node monitoring Nov 4, 2025
Copilot AI requested a review from realcodywburns November 4, 2025 15:18
Copilot finished work on behalf of realcodywburns November 4, 2025 15:18
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds an enhanced Terminal User Interface (TUI) for real-time monitoring of the Fukuii Ethereum client. The console UI is enabled by default and provides visual feedback on node status, peer connections, blockchain sync progress, and runtime information.

  • Implements a singleton-based ConsoleUI using JLine 3 for terminal control
  • Adds ConsoleUIUpdater for periodic status polling and keyboard command handling
  • Integrates with node lifecycle through StdNode and Fukuii.scala with --no-tui flag support

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
ConsoleUI.scala Core UI rendering class with terminal management, keyboard input, and display sections
ConsoleUIUpdater.scala Background updater thread for polling status and rendering UI
StdNode.scala Integration point for starting/stopping ConsoleUIUpdater in node lifecycle
Fukuii.scala Command-line flag parsing and ConsoleUI initialization
App.scala Help text updated with --no-tui flag documentation
console-ui.md Comprehensive user documentation for the Console UI feature
console-ui-mockup.txt Visual mockups showing different UI states
008-console-ui.md Architecture Decision Record documenting design choices
README.md Updated with Console UI usage information

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 5 to 6
import cats.effect.IO
import cats.effect.unsafe.implicits.global
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cats.effect imports (IO and unsafe.implicits.global) are not used anywhere in the file. These imports should be removed to avoid unnecessary dependencies.

Suggested change
import cats.effect.IO
import cats.effect.unsafe.implicits.global

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e196247 - removed unused cats.effect imports

@@ -0,0 +1,121 @@
package com.chipprbots.ethereum.console

import scala.concurrent.duration._
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scala.concurrent.duration._ import is not used in this file. This import should be removed.

Suggested change
import scala.concurrent.duration._

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e196247 - removed unused scala.concurrent.duration import

}
}
} finally {
consoleUI.shutdown()
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ConsoleUI is shutdown in the finally block of updateLoop(), but it's also shutdown in StdNode.shutdown() (line 145) and in Fukuii.scala's shutdown hook (line 58). This creates a triple shutdown scenario that could cause issues. The ConsoleUI.shutdown() should only be called once. Consider removing it from the finally block since StdNode.shutdown() already calls consoleUIUpdater.stop() before calling ConsoleUI.getInstance().shutdown().

Suggested change
consoleUI.shutdown()
// Shutdown is handled elsewhere (StdNode.shutdown and shutdown hook)

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e196247 - removed shutdown call from finally block, shutdown is now only handled by StdNode.shutdown() and the shutdown hook in Fukuii.scala

}

tryAndLogFailure(() => consoleUIUpdater.foreach(_.stop()))
tryAndLogFailure(() => ConsoleUI.getInstance().shutdown())
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a potential race condition: consoleUIUpdater.stop() interrupts the update thread which has ConsoleUI.shutdown() in its finally block, while line 145 also calls ConsoleUI.getInstance().shutdown(). If both execute simultaneously, the singleton's shutdown method could be invoked concurrently. Consider either removing the shutdown() call from ConsoleUIUpdater's finally block or adding synchronization to ConsoleUI.shutdown().

Suggested change
tryAndLogFailure(() => ConsoleUI.getInstance().shutdown())
tryAndLogFailure(() => ConsoleUI.synchronized { ConsoleUI.getInstance().shutdown() })

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e196247 - added synchronization to ConsoleUI.shutdown() method to prevent concurrent invocations

case 'd' =>
shutdown()
log.info("Console UI disabled, switching to standard logging")
true
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the 'd' command is pressed, shutdown() is called which sets enabled=false and closes the terminal, but the method returns true indicating the loop should continue. This will cause the updateLoop() to check consoleUI.isEnabled on the next iteration and exit. However, the finally block will then call shutdown() again on an already-shutdown ConsoleUI. Consider returning false here or handling the disabled state differently.

Suggested change
true
false

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e196247 - changed return value to false so the update loop exits cleanly when 'd' command is pressed

@github-actions github-actions bot added documentation Improvements or additions to documentation core labels Nov 4, 2025
@realcodywburns
Copy link

@copilot apply changes based on the comments in this thread

…dition

Co-authored-by: realcodywburns <13103499+realcodywburns@users.noreply.github.com>
Copilot finished work on behalf of realcodywburns November 4, 2025 15:32
@realcodywburns realcodywburns marked this pull request as ready for review November 4, 2025 15:51
@realcodywburns realcodywburns merged commit 05cac32 into develop Nov 4, 2025
15 of 26 checks passed
@realcodywburns realcodywburns deleted the copilot/improve-console-ux branch November 4, 2025 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improved c-ux

2 participants