use crate::theme;
use crate::theme::names::tokens;
use rand::prelude::*;
use ratatui::style::Color;
use std::borrow::Cow;
use std::sync::LazyLock;
#[derive(Clone)]
pub struct ColoredMessage {
pub text: Cow<'static, str>,
pub token: &'static str,
}
impl ColoredMessage {
#[must_use]
pub fn color(&self) -> Color {
Color::from(theme::current().color(self.token))
}
}
static WAITING_MESSAGES: LazyLock<Vec<ColoredMessage>> = LazyLock::new(|| {
vec![
ColoredMessage {
text: Cow::Borrowed("๐ฎ Consulting the commit oracle..."),
token: tokens::ACCENT_DEEP,
},
ColoredMessage {
text: Cow::Borrowed("โจ Weaving stardust into your message..."),
token: tokens::TEXT_PRIMARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ Exploring the commit-verse..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ญ Peering through the code telescope..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("โญ Aligning the celestial diffs..."),
token: tokens::TEXT_PRIMARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ Reading your changes by moonlight..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ฒ Rolling for commit inspiration..."),
token: tokens::SUCCESS,
},
ColoredMessage {
text: Cow::Borrowed("๐งฌ Decoding the DNA of your changes..."),
token: tokens::ACCENT_TERTIARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ฌ Analyzing diff particles..."),
token: tokens::ACCENT_DEEP,
},
ColoredMessage {
text: Cow::Borrowed("๐ก Tuning into the commit frequency..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("๐งช Distilling the essence of your changes..."),
token: tokens::SUCCESS,
},
ColoredMessage {
text: Cow::Borrowed("โก Parsing the diff matrix..."),
token: tokens::WARNING,
},
ColoredMessage {
text: Cow::Borrowed("โ Brewing a fresh commit message..."),
token: tokens::WARNING,
},
ColoredMessage {
text: Cow::Borrowed("๐จ Painting your changes in prose..."),
token: tokens::ACCENT_TERTIARY,
},
ColoredMessage {
text: Cow::Borrowed("๐งฉ Piecing together the story..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ต Composing a commit symphony..."),
token: tokens::ACCENT_DEEP,
},
ColoredMessage {
text: Cow::Borrowed("๐ Polishing your commit to a shine..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ฟ Growing ideas from your diff..."),
token: tokens::SUCCESS,
},
ColoredMessage {
text: Cow::Borrowed("๐ Launching into commit space..."),
token: tokens::ERROR,
},
ColoredMessage {
text: Cow::Borrowed("๐บ๏ธ Charting the diff territory..."),
token: tokens::WARNING,
},
ColoredMessage {
text: Cow::Borrowed("๐ Riding the code waves..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ฆ Consulting the git guardians..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("๐งญ Calibrating the commit compass..."),
token: tokens::WARNING,
},
ColoredMessage {
text: Cow::Borrowed("๐ Unlocking the secrets of your diff..."),
token: tokens::ACCENT_DEEP,
},
ColoredMessage {
text: Cow::Borrowed("๐ Wrapping up your changes nicely..."),
token: tokens::TEXT_PRIMARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ Surfing the staged changes..."),
token: tokens::SUCCESS,
},
]
});
static REVIEW_WAITING_MESSAGES: LazyLock<Vec<ColoredMessage>> = LazyLock::new(|| {
vec![
ColoredMessage {
text: Cow::Borrowed("๐ฎ Gazing into the code quality crystal..."),
token: tokens::ACCENT_DEEP,
},
ColoredMessage {
text: Cow::Borrowed("โจ Illuminating the hidden corners..."),
token: tokens::TEXT_PRIMARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ Channeling review wisdom..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ Meditating on your abstractions..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ญ Scanning the code horizon..."),
token: tokens::ACCENT_DEEP,
},
ColoredMessage {
text: Cow::Borrowed("โญ Reading the code constellations..."),
token: tokens::TEXT_PRIMARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ฌ Analyzing code under the microscope..."),
token: tokens::SUCCESS,
},
ColoredMessage {
text: Cow::Borrowed("๐งฌ Sequencing your code genome..."),
token: tokens::ACCENT_TERTIARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ก Scanning for code anomalies..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("๐งช Running quality experiments..."),
token: tokens::SUCCESS,
},
ColoredMessage {
text: Cow::Borrowed("โก Tracing the logic pathways..."),
token: tokens::WARNING,
},
ColoredMessage {
text: Cow::Borrowed("๐ฒ Rolling perception checks..."),
token: tokens::WARNING,
},
ColoredMessage {
text: Cow::Borrowed("๐บ๏ธ Mapping your code architecture..."),
token: tokens::WARNING,
},
ColoredMessage {
text: Cow::Borrowed("๐ Hunting for hidden issues..."),
token: tokens::ERROR,
},
ColoredMessage {
text: Cow::Borrowed("๐งญ Navigating your control flow..."),
token: tokens::ACCENT_DEEP,
},
ColoredMessage {
text: Cow::Borrowed("๐ Diving into the logic depths..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("โ๏ธ Mining for code gems..."),
token: tokens::WARNING,
},
ColoredMessage {
text: Cow::Borrowed("๐ Flowing through your functions..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("โ Taking a thoughtful look..."),
token: tokens::WARNING,
},
ColoredMessage {
text: Cow::Borrowed("๐จ Appreciating your code craft..."),
token: tokens::ACCENT_TERTIARY,
},
ColoredMessage {
text: Cow::Borrowed("๐งฉ Piecing together the full picture..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ Searching for rough edges to polish..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ฆ Consulting the wise owl..."),
token: tokens::SUCCESS,
},
ColoredMessage {
text: Cow::Borrowed("๐ Checking against best practices..."),
token: tokens::WARNING,
},
ColoredMessage {
text: Cow::Borrowed("๐ต Listening to your code's rhythm..."),
token: tokens::ACCENT_DEEP,
},
ColoredMessage {
text: Cow::Borrowed("๐ฟ Tending the code garden..."),
token: tokens::SUCCESS,
},
]
});
static USER_MESSAGES: LazyLock<Vec<ColoredMessage>> = LazyLock::new(|| {
vec![
ColoredMessage {
text: Cow::Borrowed("๐ Launching..."),
token: tokens::ERROR,
},
ColoredMessage {
text: Cow::Borrowed("โจ Working magic..."),
token: tokens::TEXT_PRIMARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ฎ Divining..."),
token: tokens::ACCENT_DEEP,
},
ColoredMessage {
text: Cow::Borrowed("โก Processing..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ Exploring..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ฌ Analyzing..."),
token: tokens::SUCCESS,
},
ColoredMessage {
text: Cow::Borrowed("โ Brewing..."),
token: tokens::WARNING,
},
ColoredMessage {
text: Cow::Borrowed("๐จ Crafting..."),
token: tokens::ACCENT_TERTIARY,
},
ColoredMessage {
text: Cow::Borrowed("๐งฉ Piecing..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ Polishing..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ต Composing..."),
token: tokens::ACCENT_DEEP,
},
ColoredMessage {
text: Cow::Borrowed("๐ Flowing..."),
token: tokens::SUCCESS,
},
ColoredMessage {
text: Cow::Borrowed("๐ญ Scanning..."),
token: tokens::WARNING,
},
ColoredMessage {
text: Cow::Borrowed("๐งช Testing..."),
token: tokens::WARNING,
},
ColoredMessage {
text: Cow::Borrowed("๐ฟ Growing..."),
token: tokens::SUCCESS,
},
]
});
pub fn get_waiting_message() -> ColoredMessage {
let mut rng = rand::rng();
WAITING_MESSAGES
.choose(&mut rng)
.cloned()
.unwrap_or(ColoredMessage {
text: Cow::Borrowed("Processing your request..."),
token: tokens::WARNING,
})
}
pub fn get_review_waiting_message() -> ColoredMessage {
let mut rng = rand::rng();
REVIEW_WAITING_MESSAGES
.choose(&mut rng)
.cloned()
.unwrap_or(ColoredMessage {
text: Cow::Borrowed("Analyzing your code quality..."),
token: tokens::ACCENT_DEEP,
})
}
#[must_use]
pub fn get_capability_message(capability: &str) -> ColoredMessage {
match capability {
"review" => get_review_waiting_message(),
"pr" => get_pr_waiting_message(),
"changelog" => get_changelog_waiting_message(),
"release_notes" => get_release_notes_waiting_message(),
_ => get_waiting_message(),
}
}
static PR_WAITING_MESSAGES: std::sync::LazyLock<Vec<ColoredMessage>> =
std::sync::LazyLock::new(|| {
vec![
ColoredMessage {
text: Cow::Borrowed("๐ฎ Crafting your PR narrative..."),
token: tokens::ACCENT_DEEP,
},
ColoredMessage {
text: Cow::Borrowed("โจ Weaving your commits into a story..."),
token: tokens::TEXT_PRIMARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ Summarizing your brilliant work..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ฏ Distilling the essence of your changes..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ Highlighting your contributions..."),
token: tokens::SUCCESS,
},
ColoredMessage {
text: Cow::Borrowed("๐ Building your PR description..."),
token: tokens::WARNING,
},
ColoredMessage {
text: Cow::Borrowed("๐จ Painting the PR picture..."),
token: tokens::ACCENT_TERTIARY,
},
ColoredMessage {
text: Cow::Borrowed("๐งต Threading your commits together..."),
token: tokens::WARNING,
},
]
});
static CHANGELOG_WAITING_MESSAGES: std::sync::LazyLock<Vec<ColoredMessage>> =
std::sync::LazyLock::new(|| {
vec![
ColoredMessage {
text: Cow::Borrowed("๐ Chronicling your changes..."),
token: tokens::ACCENT_DEEP,
},
ColoredMessage {
text: Cow::Borrowed("โจ Cataloging your accomplishments..."),
token: tokens::TEXT_PRIMARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ Writing the history of your code..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("๐๏ธ Archiving your progress..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ Tagging your milestones..."),
token: tokens::SUCCESS,
},
ColoredMessage {
text: Cow::Borrowed("๐ Documenting the release..."),
token: tokens::WARNING,
},
ColoredMessage {
text: Cow::Borrowed("๐๏ธ Organizing your achievements..."),
token: tokens::ACCENT_TERTIARY,
},
ColoredMessage {
text: Cow::Borrowed("โก Capturing the deltas..."),
token: tokens::WARNING,
},
]
});
static RELEASE_NOTES_WAITING_MESSAGES: std::sync::LazyLock<Vec<ColoredMessage>> =
std::sync::LazyLock::new(|| {
vec![
ColoredMessage {
text: Cow::Borrowed("๐ Preparing launch notes..."),
token: tokens::ERROR,
},
ColoredMessage {
text: Cow::Borrowed("โจ Polishing the release highlights..."),
token: tokens::TEXT_PRIMARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ฃ Announcing your achievements..."),
token: tokens::ACCENT_DEEP,
},
ColoredMessage {
text: Cow::Borrowed("๐ Celebrating the release..."),
token: tokens::SUCCESS,
},
ColoredMessage {
text: Cow::Borrowed("๐ฆ Packaging the release story..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ Showcasing new features..."),
token: tokens::ACCENT_SECONDARY,
},
ColoredMessage {
text: Cow::Borrowed("๐ข Composing the release fanfare..."),
token: tokens::WARNING,
},
ColoredMessage {
text: Cow::Borrowed("๐ Wrapping up the release..."),
token: tokens::ACCENT_TERTIARY,
},
]
});
fn get_pr_waiting_message() -> ColoredMessage {
let mut rng = rand::rng();
PR_WAITING_MESSAGES
.choose(&mut rng)
.cloned()
.unwrap_or(ColoredMessage {
text: Cow::Borrowed("Building PR description..."),
token: tokens::ACCENT_DEEP,
})
}
fn get_changelog_waiting_message() -> ColoredMessage {
let mut rng = rand::rng();
CHANGELOG_WAITING_MESSAGES
.choose(&mut rng)
.cloned()
.unwrap_or(ColoredMessage {
text: Cow::Borrowed("Generating changelog..."),
token: tokens::ACCENT_SECONDARY,
})
}
fn get_release_notes_waiting_message() -> ColoredMessage {
let mut rng = rand::rng();
RELEASE_NOTES_WAITING_MESSAGES
.choose(&mut rng)
.cloned()
.unwrap_or(ColoredMessage {
text: Cow::Borrowed("Creating release notes..."),
token: tokens::SUCCESS,
})
}
pub fn get_user_message() -> ColoredMessage {
let mut rng = rand::rng();
USER_MESSAGES
.choose(&mut rng)
.cloned()
.unwrap_or(ColoredMessage {
text: Cow::Borrowed("What would you like to do?"),
token: tokens::ACCENT_SECONDARY,
})
}