magi-code 0.63.4

Repository-aware CLI coding agent for terminal work
Documentation
#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) struct Anchor {
    pub(crate) line: usize,
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) enum Cursor {
    Bof,
    Eof,
    BeforeAnchor { anchor: Anchor },
    AfterAnchor { anchor: Anchor },
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) enum Edit {
    Insert {
        cursor: Cursor,
        text: String,
        line_num: usize,
        index: usize,
        mode: Option<InsertMode>,
        block_start: Option<usize>,
    },
    Delete {
        anchor: Anchor,
        line_num: usize,
        index: usize,
        old_assertion: Option<String>,
    },
    Block {
        anchor: Anchor,
        payloads: Vec<String>,
        mode: Option<BlockMode>,
        line_num: usize,
        index: usize,
    },
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum InsertMode {
    Replacement,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum BlockMode {
    InsertAfter,
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) enum FileOp {
    Move { dest: String },
    Remove,
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) struct ApplyResult {
    pub(crate) text: String,
    pub(crate) first_changed_line: Option<usize>,
    pub(crate) warnings: Vec<ParseWarning>,
    pub(crate) block_resolutions: Vec<BlockResolution>,
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) struct BlockResolution {
    pub(crate) anchor_line: usize,
    pub(crate) start: usize,
    pub(crate) end: usize,
    pub(crate) op: BlockResolutionOp,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum BlockResolutionOp {
    Replace,
    Delete,
    InsertAfter,
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) enum ParseWarning {
    BareBodyAutoPiped,
    StrayDotSkipped { line_num: usize },
    ApplyRepair { message: String },
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) struct ParsedRange {
    pub(crate) start: Anchor,
    pub(crate) end: Anchor,
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) struct ParsedSection {
    pub(crate) path: String,
    pub(crate) file_hash: Option<String>,
    pub(crate) diff: String,
    pub(crate) edits: Vec<Edit>,
    pub(crate) file_op: Option<FileOp>,
    pub(crate) warnings: Vec<ParseWarning>,
}