command

package
v0.32.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteSync

func ExecuteSync(ctx context.Context, exec Executor) error

ExecuteSync runs an executor synchronously, blocking until completion. Streaming output is discarded. Returns the final error.

Types

type Action

type Action = action.Action

Action is an alias for the unified action type.

type DeleteExecutor

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

DeleteExecutor executes a session delete operation.

func (*DeleteExecutor) Execute

func (e *DeleteExecutor) Execute(ctx context.Context) (output <-chan string, done <-chan error, cancel context.CancelFunc)

Execute deletes the session asynchronously. Returns nil output channel (non-streaming).

type Executor

type Executor interface {
	// Execute runs the command asynchronously. Returns:
	// - output: streaming output lines (nil for non-streaming commands)
	// - done: receives error (or nil) when complete
	// - cancel: cancels the operation
	Execute(ctx context.Context) (output <-chan string, done <-chan error, cancel context.CancelFunc)
}

Executor executes a command, optionally with streaming output.

type RecycleExecutor

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

RecycleExecutor executes a session recycle operation with streaming output.

func (*RecycleExecutor) Execute

func (e *RecycleExecutor) Execute(ctx context.Context) (output <-chan string, done <-chan error, cancel context.CancelFunc)

Execute starts the recycle operation and returns channels for output and completion. Returns non-nil output channel with streaming recycle progress.

type Service

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

Service creates command executors based on action type.

func NewService

func NewService(deleter SessionDeleter, recycler SessionRecycler, tmuxOpener TmuxOpener, windowSpawner WindowSpawner) *Service

NewService creates a new command service with the given dependencies.

func (*Service) CreateExecutor

func (s *Service) CreateExecutor(a Action) (Executor, error)

CreateExecutor creates an executor for the given action. Returns error if the action type is not supported.

type SessionDeleter

type SessionDeleter interface {
	DeleteSession(ctx context.Context, id string) error
}

SessionDeleter is the interface for deleting sessions.

type SessionRecycler

type SessionRecycler interface {
	RecycleSession(ctx context.Context, id string, w io.Writer) error
}

SessionRecycler is the interface for recycling sessions.

type ShellExecutor

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

ShellExecutor executes a shell command.

func (*ShellExecutor) Execute

func (e *ShellExecutor) Execute(ctx context.Context) (output <-chan string, done <-chan error, cancel context.CancelFunc)

Execute runs the shell command asynchronously. Returns nil output channel (non-streaming).

type SpawnWindowsExecutor added in v0.32.0

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

SpawnWindowsExecutor executes a TypeSpawnWindows action.

func (*SpawnWindowsExecutor) Execute added in v0.32.0

func (e *SpawnWindowsExecutor) Execute(ctx context.Context) (<-chan string, <-chan error, context.CancelFunc)

Execute runs the SpawnWindows action asynchronously.

type TmuxExecutor added in v0.32.0

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

TmuxExecutor opens or creates a tmux session via the TmuxOpener interface.

func (*TmuxExecutor) Execute added in v0.32.0

func (e *TmuxExecutor) Execute(ctx context.Context) (output <-chan string, done <-chan error, cancel context.CancelFunc)

type TmuxOpener added in v0.32.0

type TmuxOpener interface {
	OpenTmuxSession(ctx context.Context, name, path, remote, targetWindow string, background bool) error
}

TmuxOpener opens or creates tmux sessions for hive sessions.

type WindowSpawner added in v0.32.0

type WindowSpawner interface {
	// AddWindowsToTmuxSession adds windows to an existing tmux session.
	AddWindowsToTmuxSession(ctx context.Context, tmuxName, workDir string, windows []action.WindowSpec, background bool) error
	// CreateSessionWithWindows creates a new Hive session, optionally runs shCmd in its directory,
	// then opens windows in it. Non-zero shCmd exit aborts window creation.
	CreateSessionWithWindows(ctx context.Context, req action.NewSessionRequest, windows []action.WindowSpec, background bool) error
}

WindowSpawner handles window operations for SpawnWindows actions.

Jump to

Keyboard shortcuts

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