Module: Aidp::MessageDisplay
- Included in:
- Analyze::KBInspector, Analyze::RubyMaatIntegration, Analyze::Runner, Analyze::TreeSitterGrammarLoader, Analyze::TreeSitterScan, CLI, CLI::CheckpointCommand, CLI::ConfigCommand, CLI::DevcontainerCommands, CLI::FirstRunWizard, CLI::HarnessCommand, CLI::JobsCommand, CLI::McpDashboard, CLI::ModelsCommand, CLI::ProvidersCommand, Execute::CheckpointDisplay, Execute::DeterministicUnits::Runner, Execute::Runner, Execute::WorkLoopRunner, Execute::WorkflowSelector, Harness::ProviderManager, Harness::Runner, Harness::SimpleUserInterface, Harness::StatusDisplay, Harness::ThinkingDepthManager, Harness::UI::ProgressDisplay, Harness::UserInterface, Init::DevcontainerGenerator, Init::Runner, IssueImporter, Jobs::BackgroundRunner, Providers::Base, Watch::BuildProcessor, Watch::ChangeRequestProcessor, Watch::CiFixProcessor, Watch::ImplementationVerifier, Watch::PlanGenerator, Watch::PlanProcessor, Watch::RepositorySafetyChecker, Watch::ReviewProcessor, Watch::Runner, Workflows::GuidedAgent, Workflows::Selector, WorkstreamExecutor
- Defined in:
- lib/aidp/message_display.rb
Overview
Mixin providing a consistent display_message helper across classes. Usage:
include Aidp::MessageDisplay
("Hello", type: :success)
Supports color types: :error, :success, :warning, :info, :highlight, :muted
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- COLOR_MAP =
{ error: :red, success: :green, warning: :yellow, warn: :yellow, info: :blue, highlight: :cyan, muted: :bright_black }.freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#display_message(message, type: :info) ⇒ Object
Instance helper for displaying a colored message via TTY::Prompt.
-
#message_display_prompt ⇒ Object
Provide a memoized prompt per including instance (if it defines @prompt).
Class Method Details
.included(base) ⇒ Object
22 23 24 |
# File 'lib/aidp/message_display.rb', line 22 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#display_message(message, type: :info) ⇒ Object
Instance helper for displaying a colored message via TTY::Prompt
27 28 29 30 31 32 33 34 |
# File 'lib/aidp/message_display.rb', line 27 def (, type: :info) # Ensure message is UTF-8 encoded to handle emoji and special characters = .to_s = .force_encoding("UTF-8") if .encoding.name == "ASCII-8BIT" = .encode("UTF-8", invalid: :replace, undef: :replace) prompt = prompt.say(, color: COLOR_MAP.fetch(type, :white)) end |
#message_display_prompt ⇒ Object
Provide a memoized prompt per including instance (if it defines @prompt)
37 38 39 40 41 42 43 |
# File 'lib/aidp/message_display.rb', line 37 def if instance_variable_defined?(:@prompt) && @prompt @prompt else ||= TTY::Prompt.new end end |