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
//! Rhai Scripting API for heroforge-core
//!
//! This module provides a complete Rhai scripting interface for Fossil repositories.
//! It enables scripting of repository operations, filesystem manipulation, and more.
//!
//! ## Architecture
//!
//! ```text
//! ┌─────────────────┐ Unix Socket ┌─────────────────────┐
//! │ heroforge-core │◄───────────────────────────►│ heroforge-core │
//! │ (client) │ ~/hero/var/heroforge.sock │ (daemon) │
//! └─────────────────┘ └─────────────────────┘
//! │ │
//! │ sends script │ executes script
//! │ receives streamed output │ via Rhai engine
//! ▼ ▼
//! ┌─────────────────┐ ┌─────────────────────┐
//! │ script.rhai │ │ ForgeEngine │
//! │ or stdin │ │ (Rhai + Forge API)│
//! └─────────────────┘ └─────────────────────┘
//! ```
//!
//! ## Quick Start
//!
//! ```no_run
//! use heroforge_core::rhai_api::ForgeEngine;
//!
//! let engine = ForgeEngine::new()?;
//! let result = engine.eval::<i64>("1 + 2")?;
//! assert_eq!(result, 3);
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
//!
//! ## Available Functions in Scripts
//!
//! ### Repository Operations
//! - `repo_open(path)` - Open repository read-only
//! - `repo_open_rw(path)` - Open repository read-write
//! - `repo_init(path)` - Create new repository
//!
//! ### Filesystem Operations
//! - `fs_new(repo, author)` - Create FsInterface for repository
//! - `fs_read(fs, path)` - Read file content as string
//! - `fs_read_bytes(fs, path)` - Read file content as bytes
//! - `fs_write(fs, path, content)` - Write file
//! - `fs_exists(fs, path)` - Check if path exists
//! - `fs_delete(fs, path)` - Delete file
//! - `fs_list(fs, dir)` - List directory contents
//! - `fs_commit(fs)` - Force commit staged changes
//!
//! ### File Operations (via Repository)
//! - `files_list(repo)` - List all files on trunk
//! - `files_list_branch(repo, branch)` - List files on branch
//! - `files_read(repo, path)` - Read file from trunk
//! - `files_find(repo, pattern)` - Find files matching pattern
//!
//! ### Branch/Tag Operations
//! - `branches_list(repo)` - List all branches
//! - `branches_create(repo, name, from_branch, author)` - Create branch
//! - `tags_list(repo)` - List all tags
//! - `tags_create(repo, name, at_branch, author)` - Create tag
//!
//! ### Commit Operations
//! - `commit(repo, message, author, files)` - Create commit
//!
//! ### Modify Operations
//! - `modify_new(repo)` - Create new Modify builder
//! - Various chainable methods for copy, move, delete, chmod
pub use ;
pub use RhaiError;
pub use SocketClient;
pub use SocketServer;
pub use *;