Skip to main content

Crate codetree

Crate codetree 

Source
Expand description

CodeTree - An AI-native version control system for autonomous agents.

CodeTree is a standalone VCS: it owns its object store, refs, commits, and trees in .codetree/ and does not depend on Git. History is exposed through an operation-centric model so AI agents reason in tasks, not branches.

The native VCS engine lives in src/vcs/ and provides content-addressable object storage, refs, index, and a full VcsManager API.

§Features

  • cli (default): Command-line interface support
  • mcp (default): Model Context Protocol server for AI assistant integration

§Library Usage

Add this to your Cargo.toml:

[dependencies]
codetree = "0.1"

§Example

use codetree::{Config, BranchManager, VcsManager};
use codetree::error::Result;

#[tokio::main]
async fn main() -> Result<()> {
    // Load configuration
    let config = Config::load(std::path::Path::new("codetree.toml")).await?;

    // Create VCS manager
    let vcs = VcsManager::new(std::env::current_dir()?)?;

    // Create branch manager
    let mut branch_manager = BranchManager::new(
        std::path::PathBuf::from(".codetree/branches.json")
    ).await?;

    // Register a new branch for a mini-operation
    branch_manager.register_branch(
        "feature-example",
        vec!["src/main.rs".to_string()],
        "Example feature".to_string()
    ).await?;

    Ok(())
}

Re-exports§

pub use branch::BranchInfo;
pub use branch::BranchManager;
pub use branch::BranchStatus;
pub use branch::ChangeGroup;
pub use config::Config;
pub use vcs::VcsManager;
pub use mcp::CodetreeServer;

Modules§

atomic
Crash-safe, race-safe file updates for repository state.
bisect
branch
candidates
commands
config
defaults
Default configuration values
error
Lightweight error handling — no external crate needed.
errors
Common error types
evolog
freeze
hidden
lock
mcp
Model Context Protocol (MCP) Server for CodeTree
megamerge
Megamerge state + line-diff utilities.
ops
Operation log for undo/redo support.
provenance
resolution
Conflict resolution cache for automatic merge conflict resolution.
snapshot
Working-copy snapshots — automatic safety net for agents.
utils
Utility functions
vcs

Constants§

DESCRIPTION
NAME
VERSION
Version information