Native MoonBit VCS core with typed SHA-256 objects, lazy storage and policy boundaries.
import {
"any07557-wq/moonvcs" @vcs,
}
pkgtype(kind: "executable")fn main {
try {
let id = @vcs.object_id_for(@vcs.BlobObject({ content: b"", }))
println(id.to_string())
} catch {
_ => println("object encoding failed")
}
}pub(all) suberror VcsError {
InvalidObjectId(String)
InvalidObject(String)
InvalidTree(String)
InvalidPath(String)
ObjectNotFound(String)
UnknownObject(String)
ObjectUnavailableOffline(String)
RemoteUnavailable(String)
RemoteObjectMissing(String)
InvalidPromise(String)
RemoteRefChanged(String)
RepositoryNotFound(String)
RepositoryExists(String)
RefConflict(String)
StagingBusy(String)
PublicationUncertain(String)
ReceiveRejected(String)
ReceiveInvalid(String)
ReceivePolicyError(String)
ReceiveProcessExit(Int)
PolicyRejected(String)
PolicyExecutionFailed(String)
InvalidCommand(String)
DiffFailed(String)
CheckoutFailed(String)
SwitchIncomplete(String)
} derive(Debug)pub(all) enum EngineDecision {
Accept
Warning(Array[PolicyDiagnostic])
Reject(Array[PolicyDiagnostic])
EngineError(String)
}pub struct FileObjectStore {
objects_dir : String
}impl ObjectStore for FileObjectStorepub struct LazyObjectStore {
root : String
cache : LocalObjectStore
offline : Bool
fetch_events : Bool
}impl ObjectStore for LazyObjectStoreimpl ObjectStore for LocalObjectStoreimpl ObjectStore for MemoryObjectStorefn MemoryObjectStore::corrupt_for_test(self : MemoryObjectStore, id : ObjectId, bytes : Bytes) -> Unitpub struct MockPolicyValidator {
allow : Bool
reason : String
}impl PolicyValidator for MockPolicyValidatorasync fn MockPolicyValidator::validate(self : MockPolicyValidator, _ : CommitCandidate) -> PolicyDecisionpub struct PolicyContext {
schema : Int
host : String
required : Array[RequiredPolicy]
allowed_capabilities : Array[String]
limits : PolicyLimits
custom_rules : Array[ConfiguredRule]
} derive(ToJson, FromJson)pub struct PolicyDiagnostic {
plugin : String
rule : String
file : String?
line : Int?
severity : String
message : String
}impl ToJson for PolicyDiagnosticimpl FromJson for PolicyDiagnosticfn PolicyDiagnostic::from_json(value : Json, path : JsonPath) -> PolicyDiagnostic raise JsonDecodeErrorpub struct ReceiveReport {
ref_name : String
target : ObjectId
checked_commits : Int
promoted_objects : Int
policy_revision : String
}pub(all) struct ReceiveRequest {
ref_name : String
expected_old : ObjectId?
target : ObjectId
objects : Array[ReceivedObject]
}pub struct RemoteObjectStore {
root : String
}impl ObjectStore for RemoteObjectStoreasync fn Repository::commit(self : Repository, author : String, timestamp : UInt64, message : String) -> ObjectIdasync fn[V : PolicyValidator] Repository::commit_with_validator(self : Repository, author : String, timestamp : UInt64, message : String, validator : V) -> ObjectIdasync fn Repository::make_candidate(self : Repository, author : String, timestamp : UInt64, message : String) -> CommitCandidatepub(all) struct TreeEntry {
name : String
kind : TreeEntryKind
object_id : ObjectId
} derive(Eq, Debug)async fn clone_repository(remote : String, destination : String, policy_config? : String, fetch_events? : Bool) -> Repositoryasync fn prepare_receive_request(source : Repository, ref_name : String, expected_old : ObjectId?, target : ObjectId) -> ReceiveRequestasync fn validate_policies(candidate : CommitCandidate, context : PolicyContext, hook? : String) -> EngineDecisionInstall
Download zipNative MoonBit VCS core with typed SHA-256 objects, lazy storage and policy boundaries.