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 api;
30pub mod commands;
31/// Hierarchical configuration (repo-local → user global → env vars)
32pub mod config;
33/// Core VCS primitives: objects (blob, tree, commit, tag), refs, and repo discovery
34pub mod core;
35/// Post-quantum cryptographic operations: hashing, signing, encryption, key management
36pub mod crypto;
37/// Typed error system with machine-readable error codes and remediation hints
38pub mod errors;
39pub mod events;
40pub mod federation;
41/// Output formatting (JSON, human-readable, MessagePack)
42pub mod formatter;
43pub mod identity;
44/// Network transport layer: HTTPS, SSH, lit:// protocol, air-gap enforcement
45pub mod network;
46/// Machine-readable ontology and JSON Schema generation for agent discovery
47pub mod ontology;
48/// Typed response structs for all 42+ CLI commands
49pub mod response;
50/// Object store and index (staging area) persistence
51pub mod storage;
52
53// Re-export CLI types that are used by commands
54#[derive(Clone, Debug)]
55pub enum RemoteCommands {
56 Add { name: String, url: String },
57 Remove { name: String },
58 List { verbose: bool },
59}
60
61#[derive(Clone, Debug)]
62pub enum ConfigCommands {
63 Show,
64 Get { key: String },
65 Set { key: String, value: String },
66}
67
68#[derive(Clone, Debug)]
69pub enum StashCommands {
70 Push { message: Option<String> },
71 Pop,
72 Apply { index: Option<usize> },
73 List,
74 Drop { index: Option<usize> },
75}
76
77#[derive(Clone, Debug)]
78pub enum BisectCommands {
79 Start,
80 Good { commit: String },
81 Bad { commit: String },
82 Reset,
83}
84
85#[derive(Clone, Debug)]
86pub enum TxCommands {
87 Begin,
88 Commit,
89 Rollback,
90}
91
92#[derive(Clone, Debug)]
93pub enum SwarmCommands {
94 Register {
95 agent_id: String,
96 },
97 List,
98 LeaseAcquire {
99 agent_id: String,
100 path: String,
101 duration: u64,
102 },
103 LeaseRelease {
104 agent_id: String,
105 path: String,
106 },
107 LeaseList,
108}
109
110#[derive(Clone, Debug)]
111pub enum LfsCommands {
112 Track { patterns: Vec<String> },
113 Migrate { threshold: Option<u64> },
114}