jujutsu

package
v1.9.21 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package jujutsu provides jj (Jujutsu) VCS operations for agent-deck. It mirrors the internal/git package pattern with package-level functions that execute jj CLI commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbortMerge

func AbortMerge(repoDir string) error

AbortMerge undoes the last operation (equivalent to aborting a merge).

func GetMainWorktreePath

func GetMainWorktreePath(dir string) (string, error)

GetMainWorktreePath returns the path to the default workspace.

func GetRepoRoot

func GetRepoRoot(dir string) (string, error)

GetRepoRoot returns the root directory of the jj repository.

func GetWorktreeBaseRoot

func GetWorktreeBaseRoot(dir string) (string, error)

GetWorktreeBaseRoot returns the default workspace path (equivalent to main worktree in git).

func IsDefaultWorkspace

func IsDefaultWorkspace(dir string) (bool, error)

IsDefaultWorkspace returns true if the given directory is the default workspace.

func IsJJRepo

func IsJJRepo(dir string) bool

IsJJRepo checks if the given directory is inside a jj repository by running `jj root`. Returns false if jj is not installed or the directory is not a jj repo.

func IsWorktree

func IsWorktree(dir string) bool

IsWorktree checks if the directory is a non-default jj workspace.

Types

type JJBackend

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

func NewJJBackend

func NewJJBackend(dir string) (*JJBackend, error)

func (*JJBackend) BranchExists

func (b *JJBackend) BranchExists(branchName string) bool

BranchExists checks if a bookmark exists in the repository.

func (*JJBackend) CheckoutBranch

func (b *JJBackend) CheckoutBranch(branchName string) error

CheckoutBranch moves the working copy to a new change based on the given bookmark.

func (*JJBackend) CreateWorktree

func (b *JJBackend) CreateWorktree(workspacePath, branchName string) error

CreateWorktree creates a new jj workspace at the given path.

func (*JJBackend) DeleteBranch

func (b *JJBackend) DeleteBranch(branchName string, force bool) error

DeleteBranch deletes a bookmark.

func (*JJBackend) GetCurrentBranch

func (b *JJBackend) GetCurrentBranch() (string, error)

GetCurrentBranch returns the first bookmark of the current working-copy change.

func (*JJBackend) GetDefaultBranch

func (b *JJBackend) GetDefaultBranch() (string, error)

GetDefaultBranch returns the default branch name (checks for main/master bookmarks).

func (*JJBackend) GetWorktreeForBranch

func (b *JJBackend) GetWorktreeForBranch(branchName string) (string, error)

func (*JJBackend) HasUncommittedChanges

func (b *JJBackend) HasUncommittedChanges() (bool, error)

HasUncommittedChanges checks if the working copy has uncommitted changes.

func (*JJBackend) ListWorktrees

func (b *JJBackend) ListWorktrees() ([]vcs.Worktree, error)

ListWorktrees returns all workspaces for the repository.

func (*JJBackend) MergeBranch

func (b *JJBackend) MergeBranch(branchName string) error

MergeBranch creates a merge change combining the current change with the given bookmark.

func (*JJBackend) PruneWorktrees

func (b *JJBackend) PruneWorktrees() error

PruneWorktrees removes workspace entries whose directories no longer exist.

func (*JJBackend) RemoveWorktree

func (b *JJBackend) RemoveWorktree(workspacePath string, force bool) error

RemoveWorktree forgets a workspace and optionally removes its directory.

func (*JJBackend) RepoDir

func (b *JJBackend) RepoDir() string

RepoDir returns the root directory of the repository.

func (*JJBackend) Type

func (g *JJBackend) Type() vcs.Type

func (*JJBackend) WorktreePath

func (b *JJBackend) WorktreePath(opts vcs.WorktreePathOptions) string

WorktreePath generates a workspace path using the backend's repoDir. Delegates to the shared template logic in the git package (VCS-agnostic).

type Workspace

type Workspace struct {
	Name string
	Path string
}

Workspace represents a jj workspace parsed from `jj workspace list`.

Jump to

Keyboard shortcuts

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