package core import ( "time" gogit "github.com/go-git/go-git/v5" ) // Repository represents an Onyx repository with both Git and Onyx-specific metadata type Repository interface { // Init initializes a new Onyx repository at the given path Init(path string) error // GetGitRepo returns the underlying Git repository GetGitRepo() *gogit.Repository // GetOnyxMetadata returns Onyx-specific metadata GetOnyxMetadata() *OnyxMetadata // Close releases any resources held by the repository Close() error } // GitBackend provides low-level Git object operations type GitBackend interface { // CreateCommit creates a new commit object CreateCommit(tree, parent, message string) (string, error) // CreateTree creates a new tree object from the given entries CreateTree(entries []TreeEntry) (string, error) // UpdateRef updates a Git reference to point to a new SHA UpdateRef(name, sha string) error // GetRef retrieves the SHA that a reference points to GetRef(name string) (string, error) // CreateBlob creates a new blob object from content CreateBlob(content []byte) (string, error) // GetObject retrieves a Git object by its SHA GetObject(sha string) (Object, error) } // TreeEntry represents an entry in a Git tree object type TreeEntry struct { Mode int // File mode (e.g., 0100644 for regular file, 040000 for directory) Name string // Entry name SHA string // Object SHA-1 hash } // Object represents a Git object (blob, tree, commit, or tag) type Object interface { // Type returns the type of the object (blob, tree, commit, tag) Type() string // SHA returns the SHA-1 hash of the object SHA() string // Size returns the size of the object in bytes Size() int64 } // OnyxMetadata holds Onyx-specific repository metadata type OnyxMetadata struct { // Version of the Onyx repository format Version string // Created timestamp when the repository was initialized Created time.Time // Path to the .onx directory OnyxPath string }