Restore /secreview command and security review UI

This commit is contained in:
kh.ai
2025-10-17 09:07:52 -07:00
parent 3b7f4d25ef
commit 88ccfb46b7
14 changed files with 811 additions and 3 deletions

View File

@@ -5,12 +5,30 @@ use codex_core::protocol::ConversationPathResponseEvent;
use codex_core::protocol::Event;
use codex_file_search::FileMatch;
use crate::bottom_pane::ApprovalRequest;
use crate::history_cell::HistoryCell;
use codex_core::protocol::AskForApproval;
use codex_core::protocol::SandboxPolicy;
use codex_core::protocol_config_types::ReasoningEffort;
use tokio::sync::oneshot;
use crate::bottom_pane::ApprovalRequest;
use crate::history_cell::HistoryCell;
use crate::security_review::SecurityReviewFailure;
use crate::security_review::SecurityReviewMode;
use crate::security_review::SecurityReviewResult;
#[derive(Clone, Debug)]
pub(crate) struct SecurityReviewAutoScopeSelection {
pub display_path: String,
pub reason: Option<String>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub(crate) enum SecurityReviewCommandState {
Running,
Matches,
NoMatches,
Error,
}
#[allow(clippy::large_enum_variant)]
#[derive(Debug)]
@@ -87,4 +105,48 @@ pub(crate) enum AppEvent {
/// Open the approval popup.
FullScreenApprovalRequest(ApprovalRequest),
/// Open the scoped path input for security reviews.
OpenSecurityReviewPathPrompt(SecurityReviewMode),
/// Begin running a security review with the given mode and optional scoped paths.
StartSecurityReview {
mode: SecurityReviewMode,
include_paths: Vec<String>,
scope_prompt: Option<String>,
},
/// Prompt the user to confirm auto-detected scope selections.
SecurityReviewAutoScopeConfirm {
mode: SecurityReviewMode,
prompt: String,
selections: Vec<SecurityReviewAutoScopeSelection>,
responder: oneshot::Sender<bool>,
},
/// Notify that the security review scope has been resolved to specific paths.
SecurityReviewScopeResolved {
paths: Vec<String>,
},
/// Update the command status display for running security review shell commands.
SecurityReviewCommandStatus {
id: u64,
summary: String,
state: SecurityReviewCommandState,
preview: Vec<String>,
},
/// Append a progress log emitted during the security review.
SecurityReviewLog(String),
/// Security review completed successfully.
SecurityReviewComplete {
result: SecurityReviewResult,
},
/// Security review failed prior to completion.
SecurityReviewFailed {
error: SecurityReviewFailure,
},
}