actions

package
v0.6.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmbeddedTmuxUnavailable = errors.New("tmux is not available for embedded terminal detach")

ErrEmbeddedTmuxUnavailable tells callers they can use the direct embedded PTY path because tmux is not installed.

Functions

func AgentCommand added in v0.4.0

func AgentCommand(ctx AgentLaunchContext) (*exec.Cmd, error)

AgentCommand builds the direct command for launching a supported coding agent in ctx, including provider hook args, resume args, the trailing prompt, the working directory, and the WTUI_* environment overrides. It does not wrap the command in a terminal transport; AgentLaunch does that.

func CopyToClipboard

func CopyToClipboard(text string) error

CopyToClipboard copies text to the system clipboard.

func CreateBranch added in v0.3.0

func CreateBranch(repoPath, name, startPoint string) error

CreateBranch creates a new branch without checking it out. When startPoint is empty, git creates the branch at HEAD.

func CreatePullRequestWorktree added in v0.3.0

func CreatePullRequestWorktree(repoPath, input string) (string, error)

CreatePullRequestWorktree fetches a pull request head into a local review branch, then creates a worktree for that branch.

func CreateWorktree added in v0.2.0

func CreateWorktree(repoPath, ref string) (string, error)

CreateWorktree creates a new worktree from an existing branch/tag/ref, or creates a new branch with that name from HEAD when the input does not resolve.

func DefaultWorktreePath added in v0.2.0

func DefaultWorktreePath(repoPath, ref string) string

DefaultWorktreePath returns the conventional sibling path used for new worktrees: <repo>-worktrees/<branch-or-tag>.

func DeleteBranch

func DeleteBranch(repoPath, name string) error

DeleteBranch runs `git branch -d`.

func DropStash

func DropStash(repoPath string, index int) error

DropStash runs `git stash drop stash@{N}`.

func Fetch added in v0.2.0

func Fetch(path string) error

Fetch runs `git fetch --prune` for the given repo or worktree path.

func ForceDeleteBranch

func ForceDeleteBranch(repoPath, name string) error

ForceDeleteBranch runs `git branch -D`.

func ForceRemoveWorktree

func ForceRemoveWorktree(repoPath, worktreePath string) error

ForceRemoveWorktree runs `git worktree remove --force`, then prunes stale references.

func MoveWorktree added in v0.3.0

func MoveWorktree(repoPath, worktreePath, destination string) (string, error)

MoveWorktree runs `git worktree move` for a linked worktree and returns the resolved destination path on success.

func NormalizePullRequestWorktreeRef added in v0.3.0

func NormalizePullRequestWorktreeRef(input string) (string, error)

NormalizePullRequestWorktreeRef returns the stable PR ref value wtui exposes to post-create integrations.

func OpenVSCode

func OpenVSCode(path string) error

OpenVSCode opens VSCode at the given path.

func PruneWorktree

func PruneWorktree(repoPath string) error

PruneWorktree runs `git worktree prune` to remove stale admin references.

func Pull added in v0.2.0

func Pull(path string) error

Pull runs `git pull --ff-only` for the given repo or worktree path.

func RemoveWorktree

func RemoveWorktree(repoPath, worktreePath string) error

RemoveWorktree runs `git worktree remove` for the given worktree path, then prunes stale references to ensure the worktree no longer appears in listings.

func ResolveWorktreeCommit added in v0.3.0

func ResolveWorktreeCommit(path string) string

ResolveWorktreeCommit returns HEAD for path, or "" when path is not a git worktree. Launching agents should not fail just because metadata is missing.

func RunBootstrapHook added in v0.3.0

func RunBootstrapHook(ctx BootstrapContext, hook BootstrapHook) error

RunBootstrapHook executes a configured bootstrap script directly, with the created worktree as its working directory.

func ShouldPrefillEmbeddedPrompt added in v0.6.2

func ShouldPrefillEmbeddedPrompt(ctx AgentLaunchContext) bool

func UnlockWorktree added in v0.2.0

func UnlockWorktree(repoPath, worktreePath string) error

UnlockWorktree runs `git worktree unlock` for the given worktree path.

func ValidatePullRequestWorktreeInput added in v0.3.0

func ValidatePullRequestWorktreeInput(repoPath, input string) error

ValidatePullRequestWorktreeInput checks whether input is a supported PR number or URL for repoPath.

func WorktreeSessionName added in v0.2.0

func WorktreeSessionName(path string) string

WorktreeSessionName returns a tmux/Zellij-safe session name derived from the worktree directory name plus a stable path fingerprint.

Types

type AgentLaunchContext added in v0.3.0

type AgentLaunchContext struct {
	Command           string
	LaunchID          string
	RepoPath          string
	WorktreePath      string
	WorkingDir        string
	Branch            string
	Commit            string
	SessionStateRoot  string
	ResumeSessionID   string
	PlanID            string
	PlanPath          string
	PlanPhaseID       string
	PlanPhaseTitle    string
	PlanPhaseStatus   string
	FlowID            string
	FlowPhaseID       string
	FlowLaunchTracked bool
	// FlowPhaseTerminal records that the persisted phase kept a terminal
	// status (completed, skipped) when the launch was recorded, so launch
	// failures must not regress the phase to needs_attention.
	FlowPhaseTerminal bool
	Embedded          bool
	Headless          bool
	ReasoningEffort   string
	// InitialPrompt is canonical launch metadata. It is delivered either as a
	// provider argv or by embedded PTY prefill, depending on launch mode.
	InitialPrompt string
}

AgentLaunchContext carries metadata wtui knows at launch time so provider hooks can associate later session records with the selected repo/worktree.

type BootstrapContext added in v0.3.0

type BootstrapContext struct {
	RepoPath     string
	WorktreePath string
	Ref          string
	Kind         WorktreeCreateKind
}

BootstrapContext describes the worktree creation that triggered a hook.

type BootstrapHook added in v0.3.0

type BootstrapHook struct {
	Script         string
	TimeoutSeconds int
}

BootstrapHook configures a script to run after a worktree is created.

type EditorOptions added in v0.5.0

type EditorOptions struct {
	EditorCommand string
}

EditorOptions customizes how editable files are opened.

type EmbeddedTmuxAgentSpec added in v0.6.2

type EmbeddedTmuxAgentSpec struct {
	SessionName        string
	ScriptPath         string
	StatusPath         string
	DetachTarget       string
	HasSessionCommand  *exec.Cmd
	NewSessionCommand  *exec.Cmd
	AttachCommand      *exec.Cmd
	KillSessionCommand *exec.Cmd
	Cleanup            func()
}

EmbeddedTmuxAgentSpec describes a CLI agent launch that runs inside a tmux session while wtui embeds only an attached tmux client.

func EmbeddedTmuxAgentCommand added in v0.6.2

func EmbeddedTmuxAgentCommand(ctx AgentLaunchContext) (EmbeddedTmuxAgentSpec, error)

EmbeddedTmuxAgentCommand builds the tmux lifecycle commands for a detachable embedded CLI agent launch. It does not start tmux.

type FlowWorktreeCreateResult added in v0.4.0

type FlowWorktreeCreateResult struct {
	WorktreePath string
	Branch       string
}

FlowWorktreeCreateResult describes the branch/worktree allocated for a Flow.

func CreateFlowWorktree added in v0.4.0

func CreateFlowWorktree(repoPath, title, baseRef string) (FlowWorktreeCreateResult, error)

CreateFlowWorktree creates a deterministic Flow branch/worktree pair: flow/<slug> at <repo>-worktrees/flow-<slug>. Branch and path suffixes move together on collision so the pair remains easy to recognize.

type LaunchOptions added in v0.5.0

type LaunchOptions struct {
	TerminalCommand string
}

LaunchOptions customizes external terminal transports without changing multiplexer/session selection.

type RepoCreateOptions added in v0.6.0

type RepoCreateOptions struct {
	Root              string
	Name              string
	CreateGitHub      bool
	Visibility        RepoVisibility
	RemoteOnlyRetry   bool
	ExistingLocalPath string
}

RepoCreateOptions describes a local-first repository creation request.

type RepoCreateResult added in v0.6.0

type RepoCreateResult struct {
	DestinationPath   string
	LocalCreated      bool
	GitHubCreated     bool
	PartialSuccess    bool
	RetryAllowed      bool
	ExistingLocalPath string
}

RepoCreateResult reports what was created and whether a failed GitHub step can be retried against the already-created local path.

func CreateRepo added in v0.6.0

func CreateRepo(opts RepoCreateOptions) (RepoCreateResult, error)

CreateRepo creates a local git repository and optionally creates/wires a GitHub repository through gh.

type RepoVisibility added in v0.6.0

type RepoVisibility string

RepoVisibility is the GitHub visibility requested for a new repository.

const (
	RepoVisibilityPublic  RepoVisibility = "public"
	RepoVisibilityPrivate RepoVisibility = "private"
)

type TerminalLaunchSpec added in v0.2.0

type TerminalLaunchSpec struct {
	Cmd         *exec.Cmd
	Interactive bool
	// Detached means the command hands the agent off to another terminal or
	// multiplexer session; provider hooks own completed-session metadata.
	Detached bool
	Cleanup  func()
}

TerminalLaunchSpec describes how wtui should open an external process for a worktree. Interactive commands should be run with Bubble Tea's ExecProcess so the TUI releases the current terminal until the process exits.

func AgentLaunch added in v0.3.0

func AgentLaunch(ctx AgentLaunchContext) (TerminalLaunchSpec, error)

AgentLaunch builds a supported coding-agent command for ctx and wraps it in a terminal/multiplexer transport so the agent runs in its own window/session—matching the behavior of the `t` shortcut—instead of taking over the wtui TTY. Detached transports leave the wtui TUI usable; only transports that genuinely need the current TTY are returned as interactive.

func AgentLaunchWithOptions added in v0.5.0

func AgentLaunchWithOptions(ctx AgentLaunchContext, opts LaunchOptions) (TerminalLaunchSpec, error)

AgentLaunchWithOptions is AgentLaunch with configurable terminal transport selection.

func DetachedTerminalLaunch added in v0.6.2

func DetachedTerminalLaunch(targetShellCommand, cwd string, opts LaunchOptions) (TerminalLaunchSpec, error)

DetachedTerminalLaunch builds a non-interactive handoff command that opens an external terminal and runs targetShellCommand. It intentionally ignores active or installed multiplexers; the target command already attaches to the detached tmux-backed embedded terminal.

func EditFile added in v0.5.0

func EditFile(path string) (TerminalLaunchSpec, error)

EditFile builds an interactive editor command for path.

func EditFileWithOptions added in v0.5.0

func EditFileWithOptions(path string, opts EditorOptions) (TerminalLaunchSpec, error)

EditFileWithOptions is EditFile with configurable editor selection.

func PageText added in v0.4.0

func PageText(body string) (TerminalLaunchSpec, error)

PageText builds an interactive pager command for read-only text views.

func TerminalLaunch added in v0.2.0

func TerminalLaunch(path string) (TerminalLaunchSpec, error)

TerminalLaunch returns a command that opens or switches to a multiplexer session for path. It adapts to the current environment:

  • inside Zellij: switch to a Zellij session with the worktree name
  • inside tmux: create the tmux session if needed, then switch-client
  • outside a multiplexer: prefer $TERMINAL, configured terminal, tmux/Zellij, then a platform/shell fallback

func TerminalLaunchWithOptions added in v0.5.0

func TerminalLaunchWithOptions(path string, opts LaunchOptions) (TerminalLaunchSpec, error)

TerminalLaunchWithOptions is TerminalLaunch with configurable terminal transport selection.

type WorktreeCreateKind added in v0.3.0

type WorktreeCreateKind int

WorktreeCreateKind identifies which create flow produced the worktree.

const (
	WorktreeCreateGeneric WorktreeCreateKind = iota
	WorktreeCreatePullRequest
	WorktreeCreateFlow
)

func (WorktreeCreateKind) String added in v0.3.0

func (k WorktreeCreateKind) String() string

Jump to

Keyboard shortcuts

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