Expand description
Renders MentorMessages as friendly, color-coded advice boxes.
Every message is drawn inside a Unicode box (┌─┐│└┘) whose accent
color and emoji reflect the Severity of the underlying issue:
| Severity | Emoji | Accent | ANSI code |
|---|---|---|---|
| Info | 💡 | soft light blue | \x1b[94m |
| Warning | ⚠️ | amber / yellow | \x1b[33m |
| Critical | 🚨 | bright red | \x1b[91m |
The box is a fixed width (BOX_WIDTH) and all body text is word-wrapped
to keep every line exactly one terminal column wide.
use limitless_cli::models::{MentorMessage, Severity};
use limitless_cli::modules::message_formatter::{format_mentor_message, BOX_WIDTH};
let msg = MentorMessage {
severity: Severity::Critical,
plain_english: "Port 3000 is already in use.".into(),
technical_detail: "Another process listens on 0.0.0.0:3000.".into(),
suggested_action: "Run `lsof -i :3000` and stop that process.".into(),
};
let rendered = format_mentor_message(&msg);
assert!(rendered.contains("🚨 MENTOR NOTE:"));
assert!(rendered.contains("URGENT ACTION REQUIRED:"));
// Pure text (no ANSI) is handy for logging and tests:
use limitless_cli::modules::message_formatter::format_mentor_message_plain;
let plain = format_mentor_message_plain(&msg);
assert!(!plain.contains('\x1b'));
for line in plain.lines() {
assert_eq!(line.chars().count(), BOX_WIDTH);
}Structs§
- Palette
- The muted ANSI color palette backing the three severity levels.
Constants§
- BOX_
WIDTH - Overall box width measured in terminal columns / string characters.
- PALETTE
- The muted ANSI color scheme used everywhere in this module.
Functions§
- accent_
for - Accent color configured for one severity level.
- action_
emoji - Emoji used next to the suggested-action heading.
- action_
label - Heading shown above the suggested action.
- format_
mentor_ message - Render
msgas a colorized advice box (ANSI escape codes included). - format_
mentor_ message_ plain - Render
msgas a plain advice box with zero ANSI escape codes. - note_
emoji - Emoji + label pairing for the note header.