molten-herald 0.1.0

Automated viral tweet generation and scheduling for developer releases 📢
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
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
//! Pretty terminal UI using Molten's full TUI stack
//!
//! This module showcases all of Molten's TUI libraries:
//! - `glyphs` - ANSI styling and gradients
//! - `lacquer` - Style definitions and layouts
//! - `scoria` - TUI components (spinners, progress, tables)
//! - `aglow` - Markdown rendering
//! - `censer` - Beautiful logging
//! - `molten_brand` - Brand colors and design tokens

use glyphs::{style, gradient, Color};
use scoria::{Spinner, SpinnerStyle, Progress, ProgressStyle};
use std::io::{stdout, Write};

// Re-export glyphs color for scoria compatibility
use glyphs::Color as GlyphsColor;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use std::thread;
use std::time::Duration;

/// Convert molten_brand::Color to glyphs::Color  
pub fn brand_color(color: molten_brand::Color) -> Color {
    let rgb = color.to_rgb();
    Color::Rgb { r: rgb.r, g: rgb.g, b: rgb.b }
}

/// Beautiful color palette using Molten brand colors (from molten_brand crate)
pub mod colors {
    use glyphs::Color;
    
    // ═══════════════════════════════════════════════════════════════════════════
    // FORGE BRAND COLORS - from molten_brand::colors::forge
    // ═══════════════════════════════════════════════════════════════════════════
    
    /// Molten Orange - primary brand color (molten_brand::colors::forge::MOLTEN)
    pub const MOLTEN: Color = Color::Rgb { r: 249, g: 115, b: 22 };
    
    /// Forge Black - deep background (molten_brand::colors::forge::BLACK)
    pub const FORGE: Color = Color::Rgb { r: 10, g: 10, b: 10 };
    
    /// Steel Gray - secondary elements (molten_brand::colors::forge::STEEL)
    pub const STEEL: Color = Color::Rgb { r: 113, g: 113, b: 122 };
    
    /// Iron Blue - links and interactive (molten_brand::colors::forge::IRON)
    pub const IRON: Color = Color::Rgb { r: 59, g: 130, b: 246 };
    
    /// Ember Red - alerts and destructive (molten_brand::colors::forge::EMBER)
    pub const EMBER: Color = Color::Rgb { r: 239, g: 68, b: 68 };

    // ═══════════════════════════════════════════════════════════════════════════
    // PRODUCT COLORS - from molten_brand::products
    // ═══════════════════════════════════════════════════════════════════════════
    
    /// Lair/Goblin Purple - terminal product (molten_brand::products::lair::PRIMARY)
    pub const GOBLIN: Color = Color::Rgb { r: 124, g: 58, b: 237 };
    
    /// Hearth Blue - content product (molten_brand::products::hearth::PRIMARY)
    pub const HEARTH: Color = Color::Rgb { r: 59, g: 130, b: 246 };
    
    /// Alloy Orange - design system (molten_brand::products::alloy::PRIMARY)
    pub const ALLOY: Color = Color::Rgb { r: 249, g: 115, b: 22 };

    // ═══════════════════════════════════════════════════════════════════════════
    // SEMANTIC COLORS - from molten_brand::semantic
    // ═══════════════════════════════════════════════════════════════════════════
    
    /// Success green (molten_brand::semantic::SUCCESS)
    pub const SUCCESS: Color = Color::Rgb { r: 16, g: 185, b: 129 };
    pub const GREEN: Color = SUCCESS;
    
    /// Warning amber (molten_brand::semantic::WARNING)
    pub const WARNING: Color = Color::Rgb { r: 245, g: 158, b: 11 };
    pub const YELLOW: Color = WARNING;
    
    /// Error red (molten_brand::semantic::ERROR)
    pub const ERROR: Color = Color::Rgb { r: 239, g: 68, b: 68 };
    pub const RED: Color = ERROR;
    
    /// Info blue (molten_brand::semantic::INFO)
    pub const INFO: Color = Color::Rgb { r: 59, g: 130, b: 246 };
    
    /// Cyan accent (molten_brand::semantic::agent::COMPLETE)
    pub const CYAN: Color = Color::Rgb { r: 6, g: 182, b: 212 };

    // ═══════════════════════════════════════════════════════════════════════════
    // GRADIENT & ACCENT COLORS
    // ═══════════════════════════════════════════════════════════════════════════
    
    /// Pink accent (for gradients)
    pub const PINK: Color = Color::Rgb { r: 255, g: 135, b: 175 };
    
    /// Purple accent (molten_brand::semantic::agent::PAUSED)
    pub const PURPLE: Color = Color::Rgb { r: 167, g: 139, b: 250 };
    
    /// Violet (mid gradient)
    pub const VIOLET: Color = Color::Rgb { r: 147, g: 112, b: 219 };
    
    /// Blue accent
    pub const BLUE: Color = Color::Rgb { r: 135, g: 175, b: 255 };

    // ═══════════════════════════════════════════════════════════════════════════
    // TEXT & NEUTRAL COLORS - from molten_brand::colors::text/neutral
    // ═══════════════════════════════════════════════════════════════════════════
    
    /// Primary text - near white (molten_brand::colors::text::PRIMARY)
    pub const WHITE: Color = Color::Rgb { r: 250, g: 250, b: 250 };
    
    /// Secondary text (molten_brand::colors::text::SECONDARY)
    pub const MUTED: Color = Color::Rgb { r: 161, g: 161, b: 170 };
    
    /// Dim/muted text (molten_brand::colors::text::MUTED)
    pub const DIM: Color = Color::Rgb { r: 113, g: 113, b: 122 };
    
    /// Border color (molten_brand::colors::neutral::SCALE_700)
    pub const BORDER: Color = Color::Rgb { r: 63, g: 63, b: 70 };
    
    /// Raised surface (molten_brand::colors::surface::RAISED)
    pub const SURFACE: Color = Color::Rgb { r: 24, g: 24, b: 27 };
}

/// Print the herald banner with gradient
pub fn banner() {
    println!();
    
    // ASCII art with gradient
    let lines = [
        "  ██╗  ██╗███████╗██████╗  █████╗ ██╗     ██████╗ ",
        "  ██║  ██║██╔════╝██╔══██╗██╔══██╗██║     ██╔══██╗",
        "  ███████║█████╗  ██████╔╝███████║██║     ██║  ██║",
        "  ██╔══██║██╔══╝  ██╔══██╗██╔══██║██║     ██║  ██║",
        "  ██║  ██║███████╗██║  ██║██║  ██║███████╗██████╔╝",
        "  ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚═════╝ ",
    ];
    
    for (i, line) in lines.iter().enumerate() {
        // Gradient from pink to purple across lines
        let t = i as f32 / (lines.len() - 1) as f32;
        let r = (255.0 - t * 43.0) as u8;  // 255 -> 212
        let g = (135.0 - t * 43.0) as u8;  // 135 -> 92
        let b = (175.0 + t * 60.0) as u8;  // 175 -> 235
        println!("{}", style(*line).fg(Color::Rgb { r, g, b }).bold());
    }
    
    println!();
    println!(
        "  {}",
        gradient("📢 Viral tweets for developers who ship", colors::PINK, colors::PURPLE)
    );
    println!();
}

/// Print a success message with style
pub fn success(msg: &str) {
    println!(
        " {} {}",
        style("").fg(colors::GREEN).bold(),
        style(msg).fg(colors::WHITE)
    );
}

/// Print an error message with style
pub fn error(msg: &str) {
    eprintln!(
        " {} {}",
        style("").fg(colors::RED).bold(),
        style(msg).fg(colors::WHITE)
    );
}

/// Print a warning message with style
pub fn warning(msg: &str) {
    println!(
        " {} {}",
        style("").fg(colors::YELLOW).bold(),
        style(msg).fg(colors::MUTED)
    );
}

/// Print an info message with style
pub fn info(msg: &str) {
    println!(
        " {} {}",
        style("").fg(colors::CYAN).bold(),
        style(msg).fg(colors::MUTED)
    );
}

/// Print a step in a process
pub fn step(num: usize, msg: &str) {
    let bullet = match num {
        1 => "",
        2 => "",
        3 => "",
        4 => "",
        5 => "",
        _ => "",
    };
    println!(
        " {} {}",
        style(bullet).fg(colors::PURPLE).bold(),
        style(msg).fg(colors::WHITE)
    );
}

/// Print a header with gradient
pub fn header(msg: &str) {
    println!();
    println!(" {}", gradient(msg, colors::PINK, colors::PURPLE));
    println!(" {}", style("".repeat(msg.len().min(50))).fg(colors::BORDER));
}

/// Print a subheader with style
pub fn subheader(msg: &str) {
    println!(
        " {} {}",
        style("").fg(colors::PINK).bold(),
        style(msg).fg(colors::VIOLET)
    );
}

/// Print a tweet preview in a beautiful box
pub fn tweet_preview(content: &str, chars: usize) {
    let width = 54;
    let top = format!("{}", "".repeat(width));
    let bottom = format!("{}", "".repeat(width));
    let divider = format!("{}", "".repeat(width));
    
    println!();
    println!(" {}", style(&top).fg(colors::BORDER));
    println!(" {} {} {}", 
        style("").fg(colors::BORDER),
        style(format!("{:^width$}", "🐦 Tweet Preview")).fg(colors::PURPLE),
        style("").fg(colors::BORDER)
    );
    println!(" {}", style(&divider).fg(colors::BORDER));
    
    // Word wrap the content
    for line in word_wrap(content, width - 2) {
        println!(" {} {} {}", 
            style("").fg(colors::BORDER),
            style(format!("{:<width$}", line, width = width - 2)).fg(colors::WHITE),
            style("").fg(colors::BORDER)
        );
    }
    
    println!(" {}", style(&divider).fg(colors::BORDER));
    
    let char_display = format!("{} characters", chars);
    let status = if chars <= 280 { 
        format!("{}", char_display)
    } else { 
        format!("{} (over limit!)", char_display)
    };
    let status_color = if chars <= 280 { colors::GREEN } else { colors::RED };
    
    println!(" {} {} {}", 
        style("").fg(colors::BORDER),
        style(format!("{:^width$}", status, width = width - 2)).fg(status_color),
        style("").fg(colors::BORDER)
    );
    println!(" {}", style(&bottom).fg(colors::BORDER));
    println!();
}

/// Simple word wrap helper
fn word_wrap(text: &str, max_width: usize) -> Vec<String> {
    let mut lines = Vec::new();
    let mut current_line = String::new();
    
    for word in text.split_whitespace() {
        if current_line.is_empty() {
            current_line = word.to_string();
        } else if current_line.len() + 1 + word.len() <= max_width {
            current_line.push(' ');
            current_line.push_str(word);
        } else {
            lines.push(current_line);
            current_line = word.to_string();
        }
    }
    
    if !current_line.is_empty() {
        lines.push(current_line);
    }
    
    if lines.is_empty() {
        lines.push(String::new());
    }
    
    lines
}

/// Print a key-value pair with style
pub fn kv(key: &str, value: &str) {
    println!(
        "   {} {}",
        style(format!("{}:", key)).fg(colors::MUTED),
        style(value).fg(colors::WHITE)
    );
}

/// Print a list item with style
pub fn list_item(bullet: &str, text: &str) {
    println!(
        "   {} {}",
        style(bullet).fg(colors::PINK),
        style(text).fg(colors::WHITE)
    );
}

/// Print a table of scheduled tweets
pub fn scheduled_tweets_table(tweets: &[(String, String, String, String)]) {
    if tweets.is_empty() {
        println!();
        println!(" {} {}", 
            style("📭").fg(colors::MUTED),
            style("No scheduled tweets").fg(colors::MUTED).dim()
        );
        println!();
        return;
    }

    header("📅 Scheduled Tweets");
    println!();
    
    // Table with nice borders
    let col_id = 8;
    let col_time = 18;
    let col_status = 10;
    let col_content = 35;
    let total_width = col_id + col_time + col_status + col_content + 10;
    
    // Header
    println!(
        " {} {} {} {} {} {} {} {}",
        style("").fg(colors::BORDER),
        style(format!("{:<col_id$}", "ID")).fg(colors::PURPLE).bold(),
        style("").fg(colors::BORDER),
        style(format!("{:<col_time$}", "Time")).fg(colors::PURPLE).bold(),
        style("").fg(colors::BORDER),
        style(format!("{:<col_status$}", "Status")).fg(colors::PURPLE).bold(),
        style("").fg(colors::BORDER),
        style(format!("{:<col_content$}", "Content")).fg(colors::PURPLE).bold(),
    );
    println!(" {}", style("".repeat(total_width)).fg(colors::BORDER));

    for (id, time, status, content) in tweets {
        let short_id: String = id.chars().take(col_id).collect();
        let short_content: String = content.chars().take(col_content - 2).collect();
        
        let (status_icon, status_color) = match status.as_str() {
            "Pending" => ("", colors::CYAN),
            "Posted" => ("", colors::GREEN),
            "Failed" => ("", colors::RED),
            _ => ("", colors::DIM),
        };
        
        println!(
            " {} {} {} {} {} {} {} {}",
            style("").fg(colors::BORDER),
            style(format!("{:<col_id$}", short_id)).fg(colors::MUTED),
            style("").fg(colors::BORDER),
            style(format!("{:<col_time$}", time)).fg(colors::WHITE),
            style("").fg(colors::BORDER),
            style(format!("{} {:<w$}", status_icon, status, w = col_status - 2)).fg(status_color),
            style("").fg(colors::BORDER),
            style(format!("{:<col_content$}", short_content)).fg(colors::WHITE),
        );
    }
    println!();
}

/// Print queue statistics in a nice box
pub fn queue_stats(pending: usize, posted: usize, failed: usize, cancelled: usize) {
    header("📊 Queue Statistics");
    println!();
    
    let total = pending + posted + failed + cancelled;
    
    // Stats in a row with visual bars
    let bar_width = 20;
    
    fn stat_bar(label: &str, icon: &str, count: usize, total: usize, color: Color, bar_width: usize) {
        let pct = if total > 0 { (count as f32 / total as f32 * bar_width as f32) as usize } else { 0 };
        let filled = "".repeat(pct);
        let empty = "".repeat(bar_width - pct);
        
        println!(
            "   {} {} {} {}{}",
            style(icon).fg(color),
            style(format!("{:<12}", label)).fg(colors::MUTED),
            style(format!("{:>3}", count)).fg(color).bold(),
            style(&filled).fg(color),
            style(&empty).fg(colors::BORDER)
        );
    }
    
    stat_bar("Pending", "", pending, total, colors::CYAN, bar_width);
    stat_bar("Posted", "", posted, total, colors::GREEN, bar_width);
    stat_bar("Failed", "", failed, total, colors::RED, bar_width);
    stat_bar("Cancelled", "", cancelled, total, colors::MUTED, bar_width);
    
    println!();
    println!(
        "   {} {}",
        style("Total:").fg(colors::MUTED),
        style(total.to_string()).fg(colors::WHITE).bold()
    );
    println!();
}

/// Print a prompt for user confirmation
pub fn confirm_prompt(msg: &str) -> bool {
    print!(
        " {} {} ",
        style("?").fg(colors::PURPLE).bold(),
        style(msg).fg(colors::WHITE)
    );
    print!("{}", style("[y/N] ").fg(colors::MUTED));
    stdout().flush().ok();

    let mut input = String::new();
    std::io::stdin().read_line(&mut input).ok();
    input.trim().eq_ignore_ascii_case("y")
}

/// Show a colorful spinner while doing work (using scoria::Spinner)
pub fn with_spinner<F, T>(title: &str, f: F) -> T
where
    F: FnOnce() -> T,
{
    let running = Arc::new(AtomicBool::new(true));
    let running_clone = running.clone();
    let title_owned = title.to_string();

    // Use scoria's Spinner with dots style
    let spinner_thread = thread::spawn(move || {
        let mut spinner = Spinner::new(SpinnerStyle::Dots)
            .title(&title_owned)
            .color(GlyphsColor::Rgb { r: 212, g: 92, b: 235 }); // PURPLE
        let mut stdout = stdout();

        while running_clone.load(Ordering::Relaxed) {
            spinner.tick();
            print!("\r {}", spinner.view());
            stdout.flush().ok();
            thread::sleep(Duration::from_millis(80));
        }

        // Clear spinner line
        print!("\r{}\r", " ".repeat(title_owned.len() + 10));
        stdout.flush().ok();
    });

    // Run the actual work
    let result = f();

    // Stop spinner
    running.store(false, Ordering::Relaxed);
    spinner_thread.join().ok();

    result
}

/// Show a colorful spinner for async work (using scoria::Spinner)
pub async fn with_spinner_async<F, T>(title: &str, f: F) -> T
where
    F: std::future::Future<Output = T>,
{
    let running = Arc::new(AtomicBool::new(true));
    let running_clone = running.clone();
    let title_owned = title.to_string();

    // Use scoria's Spinner
    let spinner_thread = thread::spawn(move || {
        let mut spinner = Spinner::new(SpinnerStyle::Dots)
            .title(&title_owned)
            .color(GlyphsColor::Rgb { r: 212, g: 92, b: 235 }); // PURPLE
        let mut stdout = stdout();

        while running_clone.load(Ordering::Relaxed) {
            spinner.tick();
            print!("\r {}", spinner.view());
            stdout.flush().ok();
            thread::sleep(Duration::from_millis(80));
        }

        // Clear spinner line
        print!("\r{}\r", " ".repeat(title_owned.len() + 10));
        stdout.flush().ok();
    });

    // Run the actual work
    let result = f.await;

    // Stop spinner
    running.store(false, Ordering::Relaxed);
    spinner_thread.join().ok();

    result
}

/// Show a progress bar (using scoria::Progress)
pub fn progress_bar(current: usize, total: usize, label: &str) {
    let pct = if total > 0 { current as f64 / total as f64 } else { 0.0 };
    let progress = Progress::new()
        .progress(pct)
        .style(ProgressStyle::BLOCK.filled_color(GlyphsColor::Rgb { r: 212, g: 92, b: 235 }))
        .width(40);
    
    println!(
        " {} {} {}",
        style(label).fg(colors::MUTED),
        progress.view(),
        style(format!("{}/{}", current, total)).fg(colors::DIM)
    );
}

/// Print a generated tweet with formatting
pub fn generated_tweet(content: &str, chars: usize, event_type: Option<&str>) {
    if let Some(evt) = event_type {
        println!();
        println!(
            "   {} {}",
            style("Event:").fg(colors::MUTED),
            style(evt).fg(colors::PURPLE).bold()
        );
    }
    
    tweet_preview(content, chars);
}

/// Print template options with nice formatting
pub fn template_help() {
    header("🎨 Available Templates");
    println!();
    
    let templates = [
        ("📦", "crate-release", "<name> <version> <tagline>", "Announce a new crate version"),
        ("🌟", "open-source", "<name> <description> <url>", "Share an open source project"),
        ("", "feature", "<name> <feature> <benefit>", "Highlight a new feature"),
        ("🎉", "milestone", "<name> <metric> <value>", "Celebrate a milestone"),
    ];
    
    for (icon, name, args, desc) in templates {
        println!(
            "   {} {} {}",
            style(icon).fg(colors::WHITE),
            style(name).fg(colors::PINK).bold(),
            style(args).fg(colors::MUTED)
        );
        println!(
            "      {}",
            style(desc).fg(colors::MUTED).dim()
        );
        println!();
    }
    
    println!(
        " {} {}",
        style("💡").fg(colors::YELLOW),
        style("Tip: Pipe to pbcopy (macOS) or xclip (Linux) to copy").fg(colors::MUTED)
    );
}

/// Print config initialization success
pub fn config_created(path: &str) {
    println!();
    println!(
        " {} {}",
        style("🎉").fg(colors::GREEN),
        gradient("Configuration created!", colors::GREEN, colors::CYAN)
    );
    println!();
    
    // Show location in a box
    let width = path.len() + 4;
    println!(" {}", style(format!("{}", "".repeat(width))).fg(colors::BORDER));
    println!(" {} {} {}", 
        style("").fg(colors::BORDER),
        style(format!(" {} ", path)).fg(colors::WHITE),
        style("").fg(colors::BORDER)
    );
    println!(" {}", style(format!("{}", "".repeat(width))).fg(colors::BORDER));
    println!();
    
    subheader("Next Steps");
    println!();
    step(1, "Add your Twitter API credentials");
    step(2, "Add your LLM API key (Anthropic/OpenAI)");
    step(3, "Configure projects to monitor");
    println!();
    
    println!(
        "   {} {} {}",
        style("Run").fg(colors::MUTED),
        style("herald i").fg(colors::PINK).bold(),
        style("to get started interactively!").fg(colors::MUTED)
    );
    println!();
}

/// Print posted tweet success
pub fn tweet_posted(url: &str) {
    println!();
    println!(
        " {} {}",
        style("🎉").fg(colors::GREEN),
        gradient("Tweet posted!", colors::GREEN, colors::CYAN)
    );
    println!();
    println!(
        "   {} {}",
        style("🔗").fg(colors::CYAN),
        style(url).fg(colors::CYAN).underline()
    );
    println!();
}

/// Print thread posted success
pub fn thread_posted(urls: &[String]) {
    println!();
    println!(
        " {} {}",
        style("🎉").fg(colors::GREEN),
        gradient(&format!("Thread posted! ({} tweets)", urls.len()), colors::GREEN, colors::CYAN)
    );
    println!();
    for (i, url) in urls.iter().enumerate() {
        println!(
            "   {} {}",
            style(format!("{}.", i + 1)).fg(colors::MUTED),
            style(url).fg(colors::CYAN).underline()
        );
    }
    println!();
}

/// Print a divider line
pub fn divider() {
    println!(" {}", style("".repeat(50)).fg(colors::BORDER));
}

/// Print a welcome message for interactive mode
pub fn welcome() {
    banner();
    println!(
        " {}",
        style("Welcome! What would you like to do?").fg(colors::MUTED)
    );
    println!();
}

/// Render markdown content beautifully (using aglow)
pub fn render_markdown(content: &str) {
    let rendered = aglow::render(content);
    for line in rendered.lines() {
        println!(" {}", line);
    }
}

/// Show a demo of all Molten TUI libraries
pub fn demo() {
    banner();
    
    header("🔥 Molten TUI Stack Demo");
    
    // glyphs - styling
    println!();
    subheader("glyphs - ANSI Styling");
    println!("   {}", style("Bold text").bold());
    println!("   {}", style("Italic text").italic());
    println!("   {}", style("Underlined").underline());
    println!("   {}", gradient("Gradient text from pink to purple!", colors::PINK, colors::PURPLE));
    
    // scoria - components
    println!();
    subheader("scoria - TUI Components");
    let spinner = Spinner::new(SpinnerStyle::Dots).title("Loading...");
    println!("   Spinner: {}", spinner.view());
    let progress = Progress::new()
        .progress(0.75)
        .style(ProgressStyle::BLOCK.filled_color(GlyphsColor::Rgb { r: 212, g: 92, b: 235 }))
        .width(30);
    println!("   Progress: {} 75%", progress.view());
    
    // aglow - markdown
    println!();
    subheader("aglow - Markdown Rendering");
    let md = "**Bold**, *italic*, and `code`";
    println!("   {}", aglow::render(md).trim());
    
    // molten_brand - colors
    println!();
    subheader("molten_brand - Brand Colors");
    println!(
        "   {} {} {}",
        style("■ Molten").fg(colors::MOLTEN),
        style("■ Goblin").fg(colors::GOBLIN),
        style("■ Iron").fg(colors::IRON)
    );
    
    println!();
    success("All Molten libraries working!");
    println!();
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_colors_defined() {
        let _ = colors::ORANGE;
        let _ = colors::CYAN;
        let _ = colors::GREEN;
    }

    #[test]
    fn test_spinner_frames() {
        assert!(!SPINNER_FRAMES.is_empty());
    }
    
    #[test]
    fn test_word_wrap() {
        let lines = word_wrap("hello world this is a test", 10);
        assert!(!lines.is_empty());
    }
}