rust: add lib.rs with public module re-exports and doc example

Swadhin Biswas committed 7 months ago
c6aa122
1 parent f9a0c88
commit c6aa122
1 file changed
+45 -0
Showing 1 changed file+45-0
▼RUST/src/lib.rs
+45-0
1
+//! # contexa
2
+//!
3
+//! Git-inspired context management for LLM agents. COMMIT, BRANCH, MERGE, and
4
+//! CONTEXT operations over a persistent versioned memory workspace.
5
+//!
6
+//! Paper: *"Git Context Controller: Manage the Context of LLM-based Agents like Git"*
7
+//! arXiv:2508.00031 — Junde Wu et al., 2025
8
+//!
9
+//! ## File System Layout
10
+//! ```text
11
+//! .GCC/
12
+//! ├── main.md # Global roadmap / planning artifact
13
+//! └── branches/
14
+//! ├── main/
15
+//! │ ├── log.md # Continuous OTA trace (Observation-Thought-Action)
16
+//! │ ├── commit.md # Milestone-level commit summaries
17
+//! │ └── metadata.yaml # Branch intent, status, creation info
18
+//! └── <branch>/
19
+//! └── ...
20
+//! ```
21
+//!
22
+//! ## Example
23
+//! ```rust,no_run
24
+//! use contexa::GCCWorkspace;
25
+//!
26
+//! let mut ws = GCCWorkspace::new("/path/to/project");
27
+//! ws.init("Build a production REST API").unwrap();
28
+//!
29
+//! ws.log_ota("dir is empty", "scaffold first", "create_file(main.rs)").unwrap();
30
+//! ws.commit("Scaffolded project", None, None).unwrap();
31
+//!
32
+//! ws.branch("jwt-auth", "Explore JWT vs session auth").unwrap();
33
+//! ws.commit("JWT middleware implemented", None, None).unwrap();
34
+//! ws.merge("jwt-auth", None, "main").unwrap();
35
+//!
36
+//! let ctx = ws.context(None, 1).unwrap();
37
+//! println!("{}", ctx.summary());
38
+//! ```
39
+
40
+pub mod error;
41
+pub mod models;
42
+pub mod workspace;
43
+
44
+pub use models::{BranchMetadata, CommitRecord, ContextResult, OTARecord};
45
+pub use workspace::GCCWorkspace;
0
46