1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
//! # heroforge
//!
//! A pure Rust client library for reading and writing Heroforge SCM repositories.
//!
//! ## Overview
//!
//! `heroforge` provides a complete API for interacting with Heroforge repositories without
//! requiring the Heroforge CLI. It supports both reading from existing repositories and
//! creating new ones from scratch.
//!
//! ## Quick Start (Builder API)
//!
//! ```no_run
//! use heroforge_core::Repository;
//!
//! fn main() -> heroforge_core::Result<()> {
//! // Create a new repository
//! let repo = Repository::init("project.forge")?;
//!
//! // Create initial commit using builder
//! let init = repo.commit_builder()
//! .message("Initial commit")
//! .author("admin")
//! .initial()
//! .execute()?;
//!
//! // Add files using builder
//! let v1 = repo.commit_builder()
//! .message("Add project files")
//! .author("developer")
//! .parent(&init)
//! .file("README.md", b"# My Project\n")
//! .file("src/main.rs", b"fn main() {}\n")
//! .execute()?;
//!
//! // Tag the release
//! repo.tags()
//! .create("v1.0.0")
//! .at_commit(&v1)
//! .author("developer")
//! .execute()?;
//!
//! // Read files using builder
//! let readme = repo.files().on_trunk().read_string("README.md")?;
//! let rust_files = repo.files().at_tag("v1.0.0").find("**/*.rs")?;
//!
//! // Sync to remote
//! repo.sync()
//! .to("quic://backup.example.com:4443/project")
//! .push()?;
//!
//! Ok(())
//! }
//! ```
//!
//! ## Features
//!
//! ### File Operations
//! ```no_run
//! # use heroforge_core::Repository;
//! # let repo = Repository::open("project.forge")?;
//! // List files on trunk
//! let files = repo.files().on_trunk().list()?;
//!
//! // Read file from a branch
//! let content = repo.files().on_branch("feature").read("config.json")?;
//!
//! // Find files at a tag
//! let rust = repo.files().at_tag("v1.0").find("**/*.rs")?;
//! # Ok::<(), heroforge_core::FossilError>(())
//! ```
//!
//! ### Commit Operations
//! ```no_run
//! # use heroforge_core::Repository;
//! # let repo = Repository::open_rw("project.forge")?;
//! let hash = repo.commit_builder()
//! .message("Add feature")
//! .author("developer")
//! .parent("abc123")
//! .file("src/feature.rs", b"// new feature")
//! .execute()?;
//! # Ok::<(), heroforge_core::FossilError>(())
//! ```
//!
//! ### Branch/Tag Operations
//! ```no_run
//! # use heroforge_core::Repository;
//! # let repo = Repository::open_rw("project.forge")?;
//! // Create branch
//! repo.branches()
//! .create("feature-x")
//! .from_branch("trunk")
//! .author("developer")
//! .execute()?;
//!
//! // Create tag
//! repo.tags()
//! .create("v1.0.0")
//! .at_branch("trunk")
//! .author("developer")
//! .execute()?;
//! # Ok::<(), heroforge_core::FossilError>(())
//! ```
//!
//! ### Filesystem Operations (Copy, Move, Delete, Find, Symlinks)
//! ```no_run
//! # use heroforge_core::Repository;
//! use heroforge_core::fs::{Find, Modify};
//! # let repo = Repository::open_rw("project.forge")?;
//!
//! // Copy, move, delete files and directories
//! Modify::new(&repo)
//! .message("Reorganize project structure")
//! .author("developer")
//! .copy_file("README.md", "docs/README.md")
//! .copy_dir("src", "backup/src")
//! .move_file("old.txt", "archive/old.txt")
//! .move_dir("scripts", "tools")
//! .delete_file("temp.log")
//! .delete_dir("cache")
//! .execute()?;
//!
//! // Find files with patterns and ignore rules
//! let rust_files = Find::new(&repo)
//! .pattern("**/*.rs")
//! .ignore("target/**")
//! .ignore_hidden()
//! .paths()?;
//!
//! // Change permissions
//! Modify::new(&repo)
//! .message("Make scripts executable")
//! .author("developer")
//! .make_executable("scripts/deploy.sh")
//! .chmod_dir("bin", 0o755)
//! .execute()?;
//!
//! // Create symlinks
//! Modify::new(&repo)
//! .message("Add symlinks")
//! .author("developer")
//! .symlink("lib/latest", "lib/v2.0")
//! .execute()?;
//!
//! // Utility functions
//! use heroforge_core::fs::{exists, is_dir, du, count};
//! let file_exists = exists(&repo, "README.md")?;
//! let is_directory = is_dir(&repo, "src")?;
//! let size = du(&repo, "src/**/*")?;
//! let num_files = count(&repo, "**/*.rs")?;
//! # Ok::<(), heroforge_core::FossilError>(())
//! ```
//!
//! ### Sync Operations (QUIC)
//! ```no_run
//! # use heroforge_core::Repository;
//! # let repo = Repository::open("project.forge")?;
//! // Push over QUIC
//! repo.sync()
//! .to("quic://server:4443/repo")
//! .push()?;
//!
//! // Pull from remote
//! repo.sync()
//! .from("quic://server:4443/repo")
//! .auth("user", "password")
//! .pull()?;
//! # Ok::<(), heroforge_core::FossilError>(())
//! ```
// Rhai scripting API (requires rhai feature)
pub use ;
pub use ;
pub use Server;
pub use ;
// Filesystem storage backend
pub use ;
// New staging-based filesystem interface
pub use ;
// Re-export builders for convenience
pub use ;
// Git import tool (requires git-import feature)
pub use ;