Module: Aidp::MessageDisplay
- Included in:
- Analyze::KBInspector, Analyze::RubyMaatIntegration, Analyze::Runner, Analyze::TreeSitterGrammarLoader, Analyze::TreeSitterScan, CLI, CLI::CheckpointCommand, CLI::ConfigCommand, CLI::DevcontainerCommands, CLI::EvalCommand, 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::AutoMerger, Watch::AutoPrProcessor, Watch::AutoProcessor, Watch::BuildProcessor, Watch::ChangeRequestProcessor, Watch::CiFixProcessor, Watch::HierarchicalPrStrategy, Watch::ImplementationVerifier, Watch::PlanGenerator, Watch::PlanProcessor, Watch::ProjectsProcessor, Watch::RepositorySafetyChecker, Watch::ReviewProcessor, Watch::Runner, Watch::SubIssueCreator, 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
Quiet mode:
When quiet mode is enabled (via CLI --quiet flag or setting quiet=true on instance),
only :error, :warning, and :success are displayed. Info, highlight, and muted
are suppressed to reduce output noise.
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
- CRITICAL_TYPES =
Message types that are always shown even in quiet mode
i[error warning warn success].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).
-
#quiet_mode? ⇒ Boolean
Check if quiet mode is enabled Priority: instance @quiet variable > CLI.last_options.
Class Method Details
.included(base) ⇒ Object
30 31 32 |
# File 'lib/aidp/message_display.rb', line 30 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
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/aidp/message_display.rb', line 45 def (, type: :info) # In quiet mode, suppress non-critical messages return if quiet_mode? && !CRITICAL_TYPES.include?(type) # 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)
58 59 60 61 62 63 64 |
# File 'lib/aidp/message_display.rb', line 58 def if instance_variable_defined?(:@prompt) && @prompt @prompt else ||= TTY::Prompt.new end end |
#quiet_mode? ⇒ Boolean
Check if quiet mode is enabled Priority: instance @quiet variable > CLI.last_options
36 37 38 39 40 41 42 |
# File 'lib/aidp/message_display.rb', line 36 def quiet_mode? return @quiet if instance_variable_defined?(:@quiet) && !@quiet.nil? Aidp::CLI.&.dig(:quiet) || false rescue false end |