diff --git a/codex-rs/tui/src/chatwidget.rs b/codex-rs/tui/src/chatwidget.rs index b9c8e0dcdf..8c6a2aa161 100644 --- a/codex-rs/tui/src/chatwidget.rs +++ b/codex-rs/tui/src/chatwidget.rs @@ -2137,6 +2137,7 @@ impl ChatWidget { return; } + let mut scope_prompt = scope_prompt; let mut resolved_paths: Vec = Vec::new(); let mut display_paths: Vec = Vec::new(); @@ -2175,6 +2176,18 @@ impl ChatWidget { } } + if resolved_paths.is_empty() && scope_prompt.is_none() { + let default_prompt = match mode { + SecurityReviewMode::Full => { + "Select the most security-relevant directories for a full security review." + } + SecurityReviewMode::Bugs => { + "Select the highest risk areas for a quick security bug sweep." + } + }; + scope_prompt = Some(default_prompt.to_string()); + } + let mut context_paths = display_paths.clone(); if context_paths.is_empty() && let Some(prompt) = scope_prompt.as_ref() diff --git a/codex-rs/tui/src/security_report_viewer.rs b/codex-rs/tui/src/security_report_viewer.rs index a934a972fa..c1c4ba0fcc 100644 --- a/codex-rs/tui/src/security_report_viewer.rs +++ b/codex-rs/tui/src/security_report_viewer.rs @@ -1,3 +1,6 @@ +const REPORT_STYLES: &str = include_str!("security_report_assets/styles.css"); +const REPORT_SCRIPT: &str = include_str!("security_report_assets/script.js"); + fn escape_html(input: &str) -> String { let mut out = String::with_capacity(input.len()); for ch in input.chars() { @@ -15,9 +18,75 @@ fn escape_html(input: &str) -> String { pub(crate) fn build_report_html(title: &str, markdown: &str) -> String { let escaped_title = escape_html(title); - let escaped_markdown = escape_html(markdown); + let report_payload = serde_json::to_string(markdown).unwrap_or_else(|_| "\"\"".to_string()); + let styles = REPORT_STYLES; + let script = REPORT_SCRIPT; format!( - "{escaped_title}\ -
{escaped_markdown}
" + r#" + + + + + {escaped_title} + + + +
+
+
/ Report / {escaped_title}
+
+
+ + + + + +
+
+ + + +
+
+
+ +
+ +
+
Drag & drop a Markdown file anywhere, or use Open.
+
+ + + + + + + + +"# ) }