| 1 | //! Workspace trust prompt for onboarding. |
| 2 | |
| 3 | use ratatui::style::{Modifier, Style}; |
| 4 | use ratatui::text::{Line, Span}; |
| 5 | |
| 6 | use crate::palette; |
| 7 | use crate::tui::app::App; |
| 8 | |
| 9 | pub fn lines(app: &App) -> Vec<Line<'static>> { |
| 10 | let mut lines = Vec::new(); |
| 11 | lines.push(Line::from(Span::styled( |
| 12 | "Trust Workspace", |
| 13 | Style::default() |
| 14 | .fg(palette::DEEPSEEK_SKY) |
| 15 | .add_modifier(Modifier::BOLD), |
| 16 | ))); |
| 17 | lines.push(Line::from("")); |
| 18 | lines.push(Line::from(Span::styled( |
| 19 | "Do you trust the contents of this directory?", |
| 20 | Style::default().fg(palette::TEXT_PRIMARY), |
| 21 | ))); |
| 22 | lines.push(Line::from(Span::styled( |
| 23 | format!("You are in {}", crate::utils::display_path(&app.workspace)), |
| 24 | Style::default().fg(palette::TEXT_MUTED), |
| 25 | ))); |
| 26 | lines.push(Line::from("")); |
| 27 | lines.push(Line::from(Span::styled( |
| 28 | "Working with untrusted contents comes with higher risk of prompt injection.", |
| 29 | Style::default().fg(palette::TEXT_MUTED), |
| 30 | ))); |
| 31 | lines.push(Line::from(Span::styled( |
| 32 | "Trusting this directory records it in global config and enables trusted workspace mode.", |
| 33 | Style::default().fg(palette::TEXT_MUTED), |
| 34 | ))); |
| 35 | if let Some(message) = app.status_message.as_deref() { |
| 36 | lines.push(Line::from("")); |
| 37 | lines.push(Line::from(Span::styled( |
| 38 | message.to_string(), |
| 39 | Style::default().fg(palette::STATUS_WARNING), |
| 40 | ))); |
| 41 | } |
| 42 | lines.push(Line::from("")); |
| 43 | lines.push(Line::from(vec![ |
| 44 | Span::styled("Press ", Style::default().fg(palette::TEXT_MUTED)), |
| 45 | Span::styled( |
| 46 | "1/Y", |
| 47 | Style::default() |
| 48 | .fg(palette::TEXT_PRIMARY) |
| 49 | .add_modifier(Modifier::BOLD), |
| 50 | ), |
| 51 | Span::styled( |
| 52 | " to trust and continue, ", |
| 53 | Style::default().fg(palette::TEXT_MUTED), |
| 54 | ), |
| 55 | Span::styled( |
| 56 | "2/N", |
| 57 | Style::default() |
| 58 | .fg(palette::TEXT_PRIMARY) |
| 59 | .add_modifier(Modifier::BOLD), |
| 60 | ), |
| 61 | Span::styled(" to quit", Style::default().fg(palette::TEXT_MUTED)), |
| 62 | ])); |
| 63 | lines |
| 64 | } |
| 65 |