magi-code 0.77.1

Repository-aware CLI coding agent for terminal work
Documentation
mod capture;
mod rewind;
mod store;

pub(crate) use capture::{
    SnapshotContext, SnapshotEligibility, SnapshotExclusionReason, SnapshotTool,
    capture_file_snapshot, classify_snapshot_eligibility,
};
pub(crate) use rewind::{
    ChangeClassification, ChangesReadModel, ParsedRewindTarget, RestorePlan, RestoreStatus,
    RewindExecution, parse_rewind_target, redacted_path_for_display, replay_rewind_context,
    rewind_event_payload,
};
#[cfg(test)]
pub(crate) use rewind::{
    ChangeEntry, ChangeTurn, RestoreOperation, RestoreOperationKind, RestoreOperationResult,
};
pub(crate) use store::CheckpointStore;
pub(super) fn sanitized_diagnostic(message: String) -> String {
    crate::output::redact_sensitive_text(&message)
        .chars()
        .take(500)
        .collect()
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub(crate) enum RewindMode {
    #[default]
    Conversation,
    Files,
    Both,
}

impl RewindMode {
    pub(crate) fn label(self) -> &'static str {
        match self {
            Self::Conversation => "conversation only",
            Self::Files => "files only",
            Self::Both => "conversation and files",
        }
    }

    pub(crate) fn next(self) -> Self {
        match self {
            Self::Conversation => Self::Files,
            Self::Files => Self::Both,
            Self::Both => Self::Conversation,
        }
    }
}