gitops

package
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HooksInstalled

func HooksInstalled(claudeDir string) bool

HooksInstalled checks if enclaude hooks are present in settings.json.

func InstallHooks

func InstallHooks(claudeDir string) error

InstallHooks adds enclaude hooks to settings.json without disturbing existing hooks.

func RemoveHooks

func RemoveHooks(claudeDir string) error

RemoveHooks removes enclaude hooks from settings.json.

Types

type Git

type Git struct {
	// contains filtered or unexported fields
}

Git wraps git CLI operations for a repository.

func New

func New(repoDir string) *Git

New creates a Git instance for the given repo directory.

func (*Git) Add

func (g *Git) Add(paths ...string) error

Add stages files.

func (*Git) AddAll

func (g *Git) AddAll() error

AddAll stages all changes, then force-stages the seal store payload — manifest.json, the objects/ blobs, and seal.toml. A user's global gitignore (core.excludesFile) can otherwise silently drop files an unseal needs: without the manifest there is no relPath->hash mapping, without the objects the manifest's hashes point at blobs that were never committed, and without the config a clone fails before it even looks for the manifest.

func (*Git) Checkout

func (g *Git) Checkout(ref string, paths ...string) (string, error)

Checkout restores files from a specific ref.

func (*Git) Commit

func (g *Git) Commit(msg string) error

Commit creates a commit with the given message.

func (*Git) CommitOnly added in v0.7.4

func (g *Git) CommitOnly(msg string, paths ...string) (string, error)

CommitOnly creates a commit for only the specified files.

func (*Git) ConfigMergeDriver

func (g *Git) ConfigMergeDriver(name string, driverArgs []string) error

ConfigMergeDriver registers a custom merge driver.

func (*Git) CurrentBranch

func (g *Git) CurrentBranch() (string, error)

CurrentBranch returns the current branch name.

func (*Git) Fetch

func (g *Git) Fetch(remote string) (string, error)

Fetch fetches from the given remote.

func (*Git) HasCachedChanges added in v0.7.4

func (g *Git) HasCachedChanges(paths ...string) bool

HasCachedChanges checks if there are staged changes for the given paths.

func (*Git) HasChanges

func (g *Git) HasChanges() bool

HasChanges returns true if there are staged or unstaged changes.

func (*Git) HasRemote

func (g *Git) HasRemote(name string) bool

HasRemote checks if a remote with the given name exists.

func (*Git) HasUpstream

func (g *Git) HasUpstream() bool

HasUpstream checks if the current branch has an upstream configured.

func (*Git) Init

func (g *Git) Init() error

Init initializes a new git repository.

func (*Git) Log

func (g *Git) Log(n int) (string, error)

Log returns the git log in oneline format.

func (*Git) LogFull

func (g *Git) LogFull(n int) (string, error)

LogFull returns detailed git log.

func (*Git) Merge

func (g *Git) Merge(ref string) (string, error)

Merge merges the given ref into the current branch.

func (*Git) MergeAbort

func (g *Git) MergeAbort() error

MergeAbort aborts a merge in progress.

func (*Git) Pull

func (g *Git) Pull(remote, branch string) (PullStats, string, error)

Pull pulls from the given remote and branch and returns a PullStats summary plus the combined output (which the merge driver parser also consumes for [enclaude-merge] lines on stderr).

func (*Git) Push

func (g *Git) Push(remote, branch string) (PushStats, string, error)

Push pushes to the given remote and branch and returns transfer stats alongside the human-readable combined output.

func (*Git) PushWithUpstream

func (g *Git) PushWithUpstream(remote, branch string) (PushStats, string, error)

PushWithUpstream pushes, sets upstream tracking, and returns transfer stats.

func (*Git) RemoteAdd

func (g *Git) RemoteAdd(name, url string) error

RemoteAdd adds a git remote.

func (*Git) RemoteList

func (g *Git) RemoteList() (string, error)

RemoteList returns the list of configured remotes.

func (*Git) RemoteRemove added in v0.4.0

func (g *Git) RemoteRemove(name string) error

RemoteRemove removes a git remote.

func (*Git) RemoteSetURL added in v0.4.0

func (g *Git) RemoteSetURL(name, url string) error

RemoteSetURL updates the URL of an existing git remote.

func (*Git) ShowFileAtRef

func (g *Git) ShowFileAtRef(ref, path string) (string, error)

ShowFileAtRef returns the contents of a file at a specific git ref.

type PullStats added in v0.7.0

type PullStats struct {
	Commits      int
	FilesChanged int
	UpToDate     bool
	Elapsed      time.Duration
}

PullStats summarizes a pull's effect on the local branch.

type PushStats added in v0.7.0

type PushStats struct {
	Commits int
	Objects int
	Bytes   int64
	NoOp    bool
	Elapsed time.Duration
}

PushStats summarizes a push's transfer to the remote.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL