Skip to main content

lit/
lib.rs

1//! # Lit — The Agentic-First Distributed Version Control System
2//!
3//! Lit is a complete Git replacement written in Rust, designed for AI agents first and humans
4//! second. Every command emits structured JSON by default with typed error codes, merge conflicts
5//! as structured objects, and native MCP/REST API integration.
6//!
7//! ## Key Features
8//!
9//! - **Structured output**: All commands return typed JSON responses via [`response`] types
10//! - **Post-quantum cryptography**: SHA3-512 + BLAKE3 hashing, ML-DSA signatures, AES-256-GCM encryption
11//! - **MCP server**: JSON-RPC 2.0 tool server with 30 tools via [`commands::mcp_serve`]
12//! - **Machine-readable ontology**: Full command/type discovery via [`ontology`]
13//! - **Typed errors**: [`errors::LitError`] with error codes, user messages, and remediation hints
14//!
15//! ## Usage
16//!
17//! ```no_run
18//! use lit::commands;
19//! use lit::ontology;
20//!
21//! // Generate the full JSON Schema for agent SDK integration
22//! let schema = ontology::generate_schemas();
23//!
24//! // Get the machine-readable ontology
25//! let ont = ontology::get_ontology();
26//! ```
27
28/// VCS command implementations (init, add, commit, status, diff, merge, etc.)
29pub mod commands;
30/// Hierarchical configuration (repo-local → user global → env vars)
31pub mod config;
32/// Core VCS primitives: objects (blob, tree, commit, tag), refs, and repo discovery
33pub mod core;
34/// Post-quantum cryptographic operations: hashing, signing, encryption, key management
35pub mod crypto;
36/// Typed error system with machine-readable error codes and remediation hints
37pub mod errors;
38/// Output formatting (JSON, human-readable, MessagePack)
39pub mod formatter;
40/// Network transport layer: HTTPS, SSH, lit:// protocol, air-gap enforcement
41pub mod network;
42/// Machine-readable ontology and JSON Schema generation for agent discovery
43pub mod ontology;
44/// Typed response structs for all 42+ CLI commands
45pub mod response;
46/// Object store and index (staging area) persistence
47pub mod storage;
48
49// Re-export CLI types that are used by commands
50#[derive(Clone, Debug)]
51pub enum RemoteCommands {
52    Add { name: String, url: String },
53    Remove { name: String },
54    List { verbose: bool },
55}
56
57#[derive(Clone, Debug)]
58pub enum ConfigCommands {
59    Show,
60    Get { key: String },
61    Set { key: String, value: String },
62}
63
64#[derive(Clone, Debug)]
65pub enum StashCommands {
66    Push { message: Option<String> },
67    Pop,
68    Apply { index: Option<usize> },
69    List,
70    Drop { index: Option<usize> },
71}
72
73#[derive(Clone, Debug)]
74pub enum BisectCommands {
75    Start,
76    Good { commit: String },
77    Bad { commit: String },
78    Reset,
79}
80
81#[derive(Clone, Debug)]
82pub enum TxCommands {
83    Begin,
84    Commit,
85    Rollback,
86}
87
88#[derive(Clone, Debug)]
89pub enum SwarmCommands {
90    Register {
91        agent_id: String,
92    },
93    List,
94    LeaseAcquire {
95        agent_id: String,
96        path: String,
97        duration: u64,
98    },
99    LeaseRelease {
100        agent_id: String,
101        path: String,
102    },
103    LeaseList,
104}
105
106#[derive(Clone, Debug)]
107pub enum LfsCommands {
108    Track { patterns: Vec<String> },
109    Migrate { threshold: Option<u64> },
110}