Skip to main content

check_approval

Function check_approval 

Source
pub async fn check_approval(
    module_def: &Value,
    auto_approve: bool,
) -> Result<(), ApprovalError>
Expand description

Gate module execution behind an interactive approval prompt.

Returns Ok(()) immediately if requires_approval is not true. Bypasses the prompt if auto_approve is true or the env var APCORE_CLI_AUTO_APPROVE is set to exactly "1". Returns Err(ApprovalError::NonInteractive) if stdin is not a TTY. Otherwise prompts the user with a 60-second timeout.

ยงErrors

  • ApprovalError::NonInteractive โ€” stdin is not an interactive terminal
  • ApprovalError::Denied โ€” user typed anything other than y/yes
  • ApprovalError::Timeout โ€” prompt timed out