1use crate::theme;
2use crate::theme::names::tokens;
3use rand::prelude::*;
4use ratatui::style::Color;
5use std::borrow::Cow;
6use std::sync::LazyLock;
7
8#[derive(Clone)]
10pub struct ColoredMessage {
11 pub text: Cow<'static, str>,
12 pub token: &'static str,
13}
14
15impl ColoredMessage {
16 #[must_use]
18 pub fn color(&self) -> Color {
19 Color::from(theme::current().color(self.token))
20 }
21}
22
23static WAITING_MESSAGES: LazyLock<Vec<ColoredMessage>> = LazyLock::new(|| {
24 vec![
25 ColoredMessage {
27 text: Cow::Borrowed("๐ฎ Consulting the commit oracle..."),
28 token: tokens::ACCENT_DEEP,
29 },
30 ColoredMessage {
31 text: Cow::Borrowed("โจ Weaving stardust into your message..."),
32 token: tokens::TEXT_PRIMARY,
33 },
34 ColoredMessage {
35 text: Cow::Borrowed("๐ Exploring the commit-verse..."),
36 token: tokens::ACCENT_SECONDARY,
37 },
38 ColoredMessage {
39 text: Cow::Borrowed("๐ญ Peering through the code telescope..."),
40 token: tokens::ACCENT_SECONDARY,
41 },
42 ColoredMessage {
43 text: Cow::Borrowed("โญ Aligning the celestial diffs..."),
44 token: tokens::TEXT_PRIMARY,
45 },
46 ColoredMessage {
47 text: Cow::Borrowed("๐ Reading your changes by moonlight..."),
48 token: tokens::ACCENT_SECONDARY,
49 },
50 ColoredMessage {
52 text: Cow::Borrowed("๐ฒ Rolling for commit inspiration..."),
53 token: tokens::SUCCESS,
54 },
55 ColoredMessage {
56 text: Cow::Borrowed("๐งฌ Decoding the DNA of your changes..."),
57 token: tokens::ACCENT_TERTIARY,
58 },
59 ColoredMessage {
60 text: Cow::Borrowed("๐ฌ Analyzing diff particles..."),
61 token: tokens::ACCENT_DEEP,
62 },
63 ColoredMessage {
64 text: Cow::Borrowed("๐ก Tuning into the commit frequency..."),
65 token: tokens::ACCENT_SECONDARY,
66 },
67 ColoredMessage {
68 text: Cow::Borrowed("๐งช Distilling the essence of your changes..."),
69 token: tokens::SUCCESS,
70 },
71 ColoredMessage {
72 text: Cow::Borrowed("โก Parsing the diff matrix..."),
73 token: tokens::WARNING,
74 },
75 ColoredMessage {
77 text: Cow::Borrowed("โ Brewing a fresh commit message..."),
78 token: tokens::WARNING,
79 },
80 ColoredMessage {
81 text: Cow::Borrowed("๐จ Painting your changes in prose..."),
82 token: tokens::ACCENT_TERTIARY,
83 },
84 ColoredMessage {
85 text: Cow::Borrowed("๐งฉ Piecing together the story..."),
86 token: tokens::ACCENT_SECONDARY,
87 },
88 ColoredMessage {
89 text: Cow::Borrowed("๐ต Composing a commit symphony..."),
90 token: tokens::ACCENT_DEEP,
91 },
92 ColoredMessage {
93 text: Cow::Borrowed("๐ Polishing your commit to a shine..."),
94 token: tokens::ACCENT_SECONDARY,
95 },
96 ColoredMessage {
97 text: Cow::Borrowed("๐ฟ Growing ideas from your diff..."),
98 token: tokens::SUCCESS,
99 },
100 ColoredMessage {
102 text: Cow::Borrowed("๐ Launching into commit space..."),
103 token: tokens::ERROR,
104 },
105 ColoredMessage {
106 text: Cow::Borrowed("๐บ๏ธ Charting the diff territory..."),
107 token: tokens::WARNING,
108 },
109 ColoredMessage {
110 text: Cow::Borrowed("๐ Riding the code waves..."),
111 token: tokens::ACCENT_SECONDARY,
112 },
113 ColoredMessage {
114 text: Cow::Borrowed("๐ฆ Consulting the git guardians..."),
115 token: tokens::ACCENT_SECONDARY,
116 },
117 ColoredMessage {
118 text: Cow::Borrowed("๐งญ Calibrating the commit compass..."),
119 token: tokens::WARNING,
120 },
121 ColoredMessage {
122 text: Cow::Borrowed("๐ Unlocking the secrets of your diff..."),
123 token: tokens::ACCENT_DEEP,
124 },
125 ColoredMessage {
126 text: Cow::Borrowed("๐ Wrapping up your changes nicely..."),
127 token: tokens::TEXT_PRIMARY,
128 },
129 ColoredMessage {
130 text: Cow::Borrowed("๐ Surfing the staged changes..."),
131 token: tokens::SUCCESS,
132 },
133 ]
134});
135
136static REVIEW_WAITING_MESSAGES: LazyLock<Vec<ColoredMessage>> = LazyLock::new(|| {
137 vec![
138 ColoredMessage {
140 text: Cow::Borrowed("๐ฎ Gazing into the code quality crystal..."),
141 token: tokens::ACCENT_DEEP,
142 },
143 ColoredMessage {
144 text: Cow::Borrowed("โจ Illuminating the hidden corners..."),
145 token: tokens::TEXT_PRIMARY,
146 },
147 ColoredMessage {
148 text: Cow::Borrowed("๐ Channeling review wisdom..."),
149 token: tokens::ACCENT_SECONDARY,
150 },
151 ColoredMessage {
152 text: Cow::Borrowed("๐ Meditating on your abstractions..."),
153 token: tokens::ACCENT_SECONDARY,
154 },
155 ColoredMessage {
156 text: Cow::Borrowed("๐ญ Scanning the code horizon..."),
157 token: tokens::ACCENT_DEEP,
158 },
159 ColoredMessage {
160 text: Cow::Borrowed("โญ Reading the code constellations..."),
161 token: tokens::TEXT_PRIMARY,
162 },
163 ColoredMessage {
165 text: Cow::Borrowed("๐ฌ Analyzing code under the microscope..."),
166 token: tokens::SUCCESS,
167 },
168 ColoredMessage {
169 text: Cow::Borrowed("๐งฌ Sequencing your code genome..."),
170 token: tokens::ACCENT_TERTIARY,
171 },
172 ColoredMessage {
173 text: Cow::Borrowed("๐ก Scanning for code anomalies..."),
174 token: tokens::ACCENT_SECONDARY,
175 },
176 ColoredMessage {
177 text: Cow::Borrowed("๐งช Running quality experiments..."),
178 token: tokens::SUCCESS,
179 },
180 ColoredMessage {
181 text: Cow::Borrowed("โก Tracing the logic pathways..."),
182 token: tokens::WARNING,
183 },
184 ColoredMessage {
185 text: Cow::Borrowed("๐ฒ Rolling perception checks..."),
186 token: tokens::WARNING,
187 },
188 ColoredMessage {
190 text: Cow::Borrowed("๐บ๏ธ Mapping your code architecture..."),
191 token: tokens::WARNING,
192 },
193 ColoredMessage {
194 text: Cow::Borrowed("๐ Hunting for hidden issues..."),
195 token: tokens::ERROR,
196 },
197 ColoredMessage {
198 text: Cow::Borrowed("๐งญ Navigating your control flow..."),
199 token: tokens::ACCENT_DEEP,
200 },
201 ColoredMessage {
202 text: Cow::Borrowed("๐ Diving into the logic depths..."),
203 token: tokens::ACCENT_SECONDARY,
204 },
205 ColoredMessage {
206 text: Cow::Borrowed("โ๏ธ Mining for code gems..."),
207 token: tokens::WARNING,
208 },
209 ColoredMessage {
210 text: Cow::Borrowed("๐ Flowing through your functions..."),
211 token: tokens::ACCENT_SECONDARY,
212 },
213 ColoredMessage {
215 text: Cow::Borrowed("โ Taking a thoughtful look..."),
216 token: tokens::WARNING,
217 },
218 ColoredMessage {
219 text: Cow::Borrowed("๐จ Appreciating your code craft..."),
220 token: tokens::ACCENT_TERTIARY,
221 },
222 ColoredMessage {
223 text: Cow::Borrowed("๐งฉ Piecing together the full picture..."),
224 token: tokens::ACCENT_SECONDARY,
225 },
226 ColoredMessage {
227 text: Cow::Borrowed("๐ Searching for rough edges to polish..."),
228 token: tokens::ACCENT_SECONDARY,
229 },
230 ColoredMessage {
231 text: Cow::Borrowed("๐ฆ Consulting the wise owl..."),
232 token: tokens::SUCCESS,
233 },
234 ColoredMessage {
235 text: Cow::Borrowed("๐ Checking against best practices..."),
236 token: tokens::WARNING,
237 },
238 ColoredMessage {
239 text: Cow::Borrowed("๐ต Listening to your code's rhythm..."),
240 token: tokens::ACCENT_DEEP,
241 },
242 ColoredMessage {
243 text: Cow::Borrowed("๐ฟ Tending the code garden..."),
244 token: tokens::SUCCESS,
245 },
246 ]
247});
248
249static USER_MESSAGES: LazyLock<Vec<ColoredMessage>> = LazyLock::new(|| {
250 vec![
251 ColoredMessage {
252 text: Cow::Borrowed("๐ Launching..."),
253 token: tokens::ERROR,
254 },
255 ColoredMessage {
256 text: Cow::Borrowed("โจ Working magic..."),
257 token: tokens::TEXT_PRIMARY,
258 },
259 ColoredMessage {
260 text: Cow::Borrowed("๐ฎ Divining..."),
261 token: tokens::ACCENT_DEEP,
262 },
263 ColoredMessage {
264 text: Cow::Borrowed("โก Processing..."),
265 token: tokens::ACCENT_SECONDARY,
266 },
267 ColoredMessage {
268 text: Cow::Borrowed("๐ Exploring..."),
269 token: tokens::ACCENT_SECONDARY,
270 },
271 ColoredMessage {
272 text: Cow::Borrowed("๐ฌ Analyzing..."),
273 token: tokens::SUCCESS,
274 },
275 ColoredMessage {
276 text: Cow::Borrowed("โ Brewing..."),
277 token: tokens::WARNING,
278 },
279 ColoredMessage {
280 text: Cow::Borrowed("๐จ Crafting..."),
281 token: tokens::ACCENT_TERTIARY,
282 },
283 ColoredMessage {
284 text: Cow::Borrowed("๐งฉ Piecing..."),
285 token: tokens::ACCENT_SECONDARY,
286 },
287 ColoredMessage {
288 text: Cow::Borrowed("๐ Polishing..."),
289 token: tokens::ACCENT_SECONDARY,
290 },
291 ColoredMessage {
292 text: Cow::Borrowed("๐ต Composing..."),
293 token: tokens::ACCENT_DEEP,
294 },
295 ColoredMessage {
296 text: Cow::Borrowed("๐ Flowing..."),
297 token: tokens::SUCCESS,
298 },
299 ColoredMessage {
300 text: Cow::Borrowed("๐ญ Scanning..."),
301 token: tokens::WARNING,
302 },
303 ColoredMessage {
304 text: Cow::Borrowed("๐งช Testing..."),
305 token: tokens::WARNING,
306 },
307 ColoredMessage {
308 text: Cow::Borrowed("๐ฟ Growing..."),
309 token: tokens::SUCCESS,
310 },
311 ]
312});
313
314pub fn get_waiting_message() -> ColoredMessage {
315 let mut rng = rand::rng();
316 WAITING_MESSAGES
317 .choose(&mut rng)
318 .cloned()
319 .unwrap_or(ColoredMessage {
320 text: Cow::Borrowed("Processing your request..."),
321 token: tokens::WARNING,
322 })
323}
324
325pub fn get_review_waiting_message() -> ColoredMessage {
326 let mut rng = rand::rng();
327 REVIEW_WAITING_MESSAGES
328 .choose(&mut rng)
329 .cloned()
330 .unwrap_or(ColoredMessage {
331 text: Cow::Borrowed("Analyzing your code quality..."),
332 token: tokens::ACCENT_DEEP,
333 })
334}
335
336#[must_use]
338pub fn get_capability_message(capability: &str) -> ColoredMessage {
339 match capability {
340 "review" => get_review_waiting_message(),
341 "pr" => get_pr_waiting_message(),
342 "changelog" => get_changelog_waiting_message(),
343 "release_notes" => get_release_notes_waiting_message(),
344 _ => get_waiting_message(),
346 }
347}
348
349static PR_WAITING_MESSAGES: std::sync::LazyLock<Vec<ColoredMessage>> =
350 std::sync::LazyLock::new(|| {
351 vec![
352 ColoredMessage {
353 text: Cow::Borrowed("๐ฎ Crafting your PR narrative..."),
354 token: tokens::ACCENT_DEEP,
355 },
356 ColoredMessage {
357 text: Cow::Borrowed("โจ Weaving your commits into a story..."),
358 token: tokens::TEXT_PRIMARY,
359 },
360 ColoredMessage {
361 text: Cow::Borrowed("๐ Summarizing your brilliant work..."),
362 token: tokens::ACCENT_SECONDARY,
363 },
364 ColoredMessage {
365 text: Cow::Borrowed("๐ฏ Distilling the essence of your changes..."),
366 token: tokens::ACCENT_SECONDARY,
367 },
368 ColoredMessage {
369 text: Cow::Borrowed("๐ Highlighting your contributions..."),
370 token: tokens::SUCCESS,
371 },
372 ColoredMessage {
373 text: Cow::Borrowed("๐ Building your PR description..."),
374 token: tokens::WARNING,
375 },
376 ColoredMessage {
377 text: Cow::Borrowed("๐จ Painting the PR picture..."),
378 token: tokens::ACCENT_TERTIARY,
379 },
380 ColoredMessage {
381 text: Cow::Borrowed("๐งต Threading your commits together..."),
382 token: tokens::WARNING,
383 },
384 ]
385 });
386
387static CHANGELOG_WAITING_MESSAGES: std::sync::LazyLock<Vec<ColoredMessage>> =
388 std::sync::LazyLock::new(|| {
389 vec![
390 ColoredMessage {
391 text: Cow::Borrowed("๐ Chronicling your changes..."),
392 token: tokens::ACCENT_DEEP,
393 },
394 ColoredMessage {
395 text: Cow::Borrowed("โจ Cataloging your accomplishments..."),
396 token: tokens::TEXT_PRIMARY,
397 },
398 ColoredMessage {
399 text: Cow::Borrowed("๐ Writing the history of your code..."),
400 token: tokens::ACCENT_SECONDARY,
401 },
402 ColoredMessage {
403 text: Cow::Borrowed("๐๏ธ Archiving your progress..."),
404 token: tokens::ACCENT_SECONDARY,
405 },
406 ColoredMessage {
407 text: Cow::Borrowed("๐ Tagging your milestones..."),
408 token: tokens::SUCCESS,
409 },
410 ColoredMessage {
411 text: Cow::Borrowed("๐ Documenting the release..."),
412 token: tokens::WARNING,
413 },
414 ColoredMessage {
415 text: Cow::Borrowed("๐๏ธ Organizing your achievements..."),
416 token: tokens::ACCENT_TERTIARY,
417 },
418 ColoredMessage {
419 text: Cow::Borrowed("โก Capturing the deltas..."),
420 token: tokens::WARNING,
421 },
422 ]
423 });
424
425static RELEASE_NOTES_WAITING_MESSAGES: std::sync::LazyLock<Vec<ColoredMessage>> =
426 std::sync::LazyLock::new(|| {
427 vec![
428 ColoredMessage {
429 text: Cow::Borrowed("๐ Preparing launch notes..."),
430 token: tokens::ERROR,
431 },
432 ColoredMessage {
433 text: Cow::Borrowed("โจ Polishing the release highlights..."),
434 token: tokens::TEXT_PRIMARY,
435 },
436 ColoredMessage {
437 text: Cow::Borrowed("๐ฃ Announcing your achievements..."),
438 token: tokens::ACCENT_DEEP,
439 },
440 ColoredMessage {
441 text: Cow::Borrowed("๐ Celebrating the release..."),
442 token: tokens::SUCCESS,
443 },
444 ColoredMessage {
445 text: Cow::Borrowed("๐ฆ Packaging the release story..."),
446 token: tokens::ACCENT_SECONDARY,
447 },
448 ColoredMessage {
449 text: Cow::Borrowed("๐ Showcasing new features..."),
450 token: tokens::ACCENT_SECONDARY,
451 },
452 ColoredMessage {
453 text: Cow::Borrowed("๐ข Composing the release fanfare..."),
454 token: tokens::WARNING,
455 },
456 ColoredMessage {
457 text: Cow::Borrowed("๐ Wrapping up the release..."),
458 token: tokens::ACCENT_TERTIARY,
459 },
460 ]
461 });
462
463fn get_pr_waiting_message() -> ColoredMessage {
464 let mut rng = rand::rng();
465 PR_WAITING_MESSAGES
466 .choose(&mut rng)
467 .cloned()
468 .unwrap_or(ColoredMessage {
469 text: Cow::Borrowed("Building PR description..."),
470 token: tokens::ACCENT_DEEP,
471 })
472}
473
474fn get_changelog_waiting_message() -> ColoredMessage {
475 let mut rng = rand::rng();
476 CHANGELOG_WAITING_MESSAGES
477 .choose(&mut rng)
478 .cloned()
479 .unwrap_or(ColoredMessage {
480 text: Cow::Borrowed("Generating changelog..."),
481 token: tokens::ACCENT_SECONDARY,
482 })
483}
484
485fn get_release_notes_waiting_message() -> ColoredMessage {
486 let mut rng = rand::rng();
487 RELEASE_NOTES_WAITING_MESSAGES
488 .choose(&mut rng)
489 .cloned()
490 .unwrap_or(ColoredMessage {
491 text: Cow::Borrowed("Creating release notes..."),
492 token: tokens::SUCCESS,
493 })
494}
495
496pub fn get_user_message() -> ColoredMessage {
497 let mut rng = rand::rng();
498 USER_MESSAGES
499 .choose(&mut rng)
500 .cloned()
501 .unwrap_or(ColoredMessage {
502 text: Cow::Borrowed("What would you like to do?"),
503 token: tokens::ACCENT_SECONDARY,
504 })
505}