git-iris 2.0.8

AI-powered Git workflow assistant for smart commits, code reviews, changelogs, and release notes
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
use crate::theme;
use crate::theme::names::tokens;
use rand::prelude::*;
use ratatui::style::Color;
use std::borrow::Cow;
use std::sync::LazyLock;

/// A message with a theme-based color token
#[derive(Clone)]
pub struct ColoredMessage {
    pub text: Cow<'static, str>,
    pub token: &'static str,
}

impl ColoredMessage {
    /// Get the resolved color from the current theme
    #[must_use]
    pub fn color(&self) -> Color {
        Color::from(theme::current().color(self.token))
    }
}

static WAITING_MESSAGES: LazyLock<Vec<ColoredMessage>> = LazyLock::new(|| {
    vec![
        // Cosmic vibes
        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,
        },
        // Nerdy & clever
        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,
        },
        // Warm & grounded
        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,
        },
        // Playful
        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![
        // Cosmic & mystical
        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,
        },
        // Nerdy & technical
        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,
        },
        // Exploratory
        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,
        },
        // Warm & grounded
        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,
        })
}

/// Get a waiting message appropriate for the given capability
#[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(),
        // "commit" and any other capability use the default cosmic messages
        _ => 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,
        })
}