impl PipelineEvent {
#[must_use]
pub const fn rebase_started(phase: RebasePhase, target_branch: String) -> Self {
Self::Rebase(RebaseEvent::Started {
phase,
target_branch,
})
}
#[must_use]
pub const fn rebase_conflict_detected(files: Vec<PathBuf>) -> Self {
Self::Rebase(RebaseEvent::ConflictDetected { files })
}
#[must_use]
pub const fn rebase_conflict_resolved(files: Vec<PathBuf>) -> Self {
Self::Rebase(RebaseEvent::ConflictResolved { files })
}
#[must_use]
pub const fn rebase_succeeded(phase: RebasePhase, new_head: String) -> Self {
Self::Rebase(RebaseEvent::Succeeded { phase, new_head })
}
#[must_use]
pub const fn rebase_failed(phase: RebasePhase, reason: String) -> Self {
Self::Rebase(RebaseEvent::Failed { phase, reason })
}
#[must_use]
pub const fn rebase_aborted(phase: RebasePhase, restored_to: String) -> Self {
Self::Rebase(RebaseEvent::Aborted { phase, restored_to })
}
#[must_use]
pub const fn rebase_skipped(phase: RebasePhase, reason: String) -> Self {
Self::Rebase(RebaseEvent::Skipped { phase, reason })
}
#[must_use]
pub const fn commit_generation_started() -> Self {
Self::Commit(CommitEvent::GenerationStarted)
}
#[must_use]
pub const fn commit_diff_prepared(empty: bool, content_id_sha256: String) -> Self {
Self::Commit(CommitEvent::DiffPrepared {
empty,
content_id_sha256,
})
}
#[must_use]
pub const fn commit_diff_failed(error: String) -> Self {
Self::Commit(CommitEvent::DiffFailed { error })
}
#[must_use]
pub const fn commit_diff_invalidated(reason: String) -> Self {
Self::Commit(CommitEvent::DiffInvalidated { reason })
}
#[must_use]
pub const fn commit_prompt_prepared(attempt: u32) -> Self {
Self::Commit(CommitEvent::PromptPrepared { attempt })
}
#[must_use]
pub const fn commit_agent_invoked(attempt: u32) -> Self {
Self::Commit(CommitEvent::AgentInvoked { attempt })
}
#[must_use]
pub const fn commit_xml_extracted(attempt: u32) -> Self {
Self::Commit(CommitEvent::CommitXmlExtracted { attempt })
}
#[must_use]
pub const fn commit_xml_missing(attempt: u32) -> Self {
Self::Commit(CommitEvent::CommitXmlMissing { attempt })
}
#[must_use]
pub const fn commit_xml_validated(
message: String,
files: Vec<String>,
excluded_files: Vec<crate::reducer::state::pipeline::ExcludedFile>,
attempt: u32,
) -> Self {
Self::Commit(CommitEvent::CommitXmlValidated {
message,
attempt,
files,
excluded_files,
})
}
#[must_use]
pub const fn commit_xml_validation_failed(reason: String, attempt: u32) -> Self {
Self::Commit(CommitEvent::CommitXmlValidationFailed { reason, attempt })
}
#[must_use]
pub const fn commit_xml_archived(attempt: u32) -> Self {
Self::Commit(CommitEvent::CommitXmlArchived { attempt })
}
#[must_use]
pub const fn commit_required_files_cleaned(attempt: u32) -> Self {
Self::Commit(CommitEvent::CommitXmlCleaned { attempt })
}
#[must_use]
pub const fn commit_message_generated(message: String, attempt: u32) -> Self {
Self::Commit(CommitEvent::MessageGenerated { message, attempt })
}
#[must_use]
pub const fn commit_message_validation_failed(reason: String, attempt: u32) -> Self {
Self::Commit(CommitEvent::MessageValidationFailed { reason, attempt })
}
#[must_use]
pub const fn commit_created(hash: String, message: String) -> Self {
Self::Commit(CommitEvent::Created { hash, message })
}
#[must_use]
pub const fn commit_generation_failed(reason: String) -> Self {
Self::Commit(CommitEvent::GenerationFailed { reason })
}
#[must_use]
pub const fn commit_skipped(reason: String) -> Self {
Self::Commit(CommitEvent::Skipped { reason })
}
#[must_use]
pub const fn pre_termination_safety_check_passed() -> Self {
Self::Commit(CommitEvent::PreTerminationSafetyCheckPassed)
}
#[must_use]
pub const fn pre_termination_uncommitted_changes_detected(file_count: usize) -> Self {
Self::Commit(CommitEvent::PreTerminationUncommittedChangesDetected { file_count })
}
#[must_use]
pub const fn residual_files_found(files: Vec<String>, pass: u8) -> Self {
Self::Commit(CommitEvent::ResidualFilesFound { files, pass })
}
#[must_use]
pub const fn residual_files_none() -> Self {
Self::Commit(CommitEvent::ResidualFilesNone)
}
#[must_use]
pub const fn context_cleaned() -> Self {
Self::ContextCleaned
}
#[must_use]
pub const fn checkpoint_saved(trigger: CheckpointTrigger) -> Self {
Self::CheckpointSaved { trigger }
}
#[must_use]
pub const fn finalizing_started() -> Self {
Self::FinalizingStarted
}
#[must_use]
pub const fn prompt_permissions_restored() -> Self {
Self::PromptPermissionsRestored
}
}