action

package
v0.32.1 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidType = fmt.Errorf("not a valid Type, try [%s]", strings.Join(_TypeNames, ", "))

Functions

func IsConfigAction

func IsConfigAction(t Type) bool

IsConfigAction reports whether t is a valid action for use in YAML config.

func TypeNames

func TypeNames() []string

TypeNames returns a list of possible string values of Type.

Types

type Action

type Action struct {
	Type          Type
	Key           string
	Help          string
	Confirm       string               // Non-empty if confirmation required
	ShellCmd      string               // For shell actions, the rendered command
	ShellDir      string               // Working directory for TypeShell (empty = hive process cwd)
	SpawnWindows  *SpawnWindowsPayload // For TypeSpawnWindows
	SessionID     string
	SessionName   string // Session display name (for tmux actions)
	SessionPath   string
	SessionRemote string // Session remote URL (for tmux actions)
	TmuxWindow    string // Target tmux window name (for tmux actions)
	Silent        bool   // Skip loading popup for fast commands
	Exit          bool   // Exit hive after command completes
	Err           error  // Non-nil if action resolution failed (e.g., template error)
}

Action represents a resolved keybinding or command action ready for execution.

func (Action) NeedsConfirm

func (a Action) NeedsConfirm() bool

NeedsConfirm returns true if the action requires user confirmation.

type NewSessionRequest

type NewSessionRequest struct {
	Name   string // Rendered session name
	Remote string // Remote URL; empty = inherit from selected session
	// ShCmd is an optional shell command run in the new session's directory after the git clone
	// and before windows are opened. Non-zero exit aborts window creation.
	ShCmd string
}

NewSessionRequest carries parameters for creating a new Hive session before spawning windows.

type SpawnWindowsPayload

type SpawnWindowsPayload struct {
	// Optional sh: command to run before opening windows in same-session mode.
	// For new-session mode, ShCmd lives on NewSession.ShCmd instead.
	ShCmd string
	ShDir string // Working directory for ShCmd (same-session mode only)

	// Windows to open.
	Windows []WindowSpec

	// Target for same-session mode (TmuxTarget = existing session's tmux name).
	TmuxTarget string
	SessionDir string // Working directory fallback for window dir resolution
	Background bool

	// New-session mode: if non-nil, a Hive session is created before windows are opened.
	// ShCmd is NOT used in this mode; use NewSession.ShCmd instead.
	NewSession *NewSessionRequest
}

SpawnWindowsPayload is the execution payload for TypeSpawnWindows actions.

type Type

type Type string

Type identifies the kind of action a keybinding or command triggers.

ENUM(

None
Recycle
Delete
Shell
TmuxOpen
TmuxStart
FilterAll
FilterActive
FilterApproval
FilterReady
DocReview
NewSession
SetTheme
Notifications
RenameSession
NextActive
PrevActive
DeleteRecycledBatch
SpawnWindows
HiveInfo
HiveDoctor

)

const (
	// TypeNone is a Type of type None.
	TypeNone Type = "None"
	// TypeRecycle is a Type of type Recycle.
	TypeRecycle Type = "Recycle"
	// TypeDelete is a Type of type Delete.
	TypeDelete Type = "Delete"
	// TypeShell is a Type of type Shell.
	TypeShell Type = "Shell"
	// TypeTmuxOpen is a Type of type TmuxOpen.
	TypeTmuxOpen Type = "TmuxOpen"
	// TypeTmuxStart is a Type of type TmuxStart.
	TypeTmuxStart Type = "TmuxStart"
	// TypeFilterAll is a Type of type FilterAll.
	TypeFilterAll Type = "FilterAll"
	// TypeFilterActive is a Type of type FilterActive.
	TypeFilterActive Type = "FilterActive"
	// TypeFilterApproval is a Type of type FilterApproval.
	TypeFilterApproval Type = "FilterApproval"
	// TypeFilterReady is a Type of type FilterReady.
	TypeFilterReady Type = "FilterReady"
	// TypeDocReview is a Type of type DocReview.
	TypeDocReview Type = "DocReview"
	// TypeNewSession is a Type of type NewSession.
	TypeNewSession Type = "NewSession"
	// TypeSetTheme is a Type of type SetTheme.
	TypeSetTheme Type = "SetTheme"
	// TypeNotifications is a Type of type Notifications.
	TypeNotifications Type = "Notifications"
	// TypeRenameSession is a Type of type RenameSession.
	TypeRenameSession Type = "RenameSession"
	// TypeNextActive is a Type of type NextActive.
	TypeNextActive Type = "NextActive"
	// TypePrevActive is a Type of type PrevActive.
	TypePrevActive Type = "PrevActive"
	// TypeDeleteRecycledBatch is a Type of type DeleteRecycledBatch.
	TypeDeleteRecycledBatch Type = "DeleteRecycledBatch"
	// TypeSpawnWindows is a Type of type SpawnWindows.
	TypeSpawnWindows Type = "SpawnWindows"
	// TypeHiveInfo is a Type of type HiveInfo.
	TypeHiveInfo Type = "HiveInfo"
	// TypeHiveDoctor is a Type of type HiveDoctor.
	TypeHiveDoctor Type = "HiveDoctor"
)

func ParseType

func ParseType(name string) (Type, error)

ParseType attempts to convert a string to a Type.

func (*Type) AppendText

func (x *Type) AppendText(b []byte) ([]byte, error)

AppendText appends the textual representation of itself to the end of b (allocating a larger slice if necessary) and returns the updated slice.

Implementations must not retain b, nor mutate any bytes within b[:len(b)].

func (Type) IsValid

func (x Type) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (Type) MarshalText

func (x Type) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (Type) String

func (x Type) String() string

String implements the Stringer interface.

func (*Type) UnmarshalText

func (x *Type) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type WindowSpec

type WindowSpec struct {
	Name    string
	Command string
	Dir     string
	Focus   bool
}

WindowSpec is a fully-rendered window definition carried in a SpawnWindows action. Fields mirror coretmux.RenderedWindow to avoid a cross-package dependency on the tmux layer.

Jump to

Keyboard shortcuts

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