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