cmd

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCommandFailed = errors.New("command failed")

ErrCommandFailed signals that a tool command returned success=false. The compact JSON error envelope has already been printed to stderr, so main() exits non-zero on this sentinel without printing a duplicate error line.

View Source
var Version = "dev"

Functions

func Execute

func Execute(ctx context.Context) error

Types

type GlobalConfig added in v0.1.0

type GlobalConfig struct {
	Project     string
	Port        int
	Timeout     time.Duration
	Verbose     bool
	Quiet       bool
	Debug       bool
	CompactJSON bool
	Narrate     bool
}

func (GlobalConfig) TimeoutMillis added in v0.1.0

func (config GlobalConfig) TimeoutMillis() int

func (GlobalConfig) Wait added in v0.1.0

func (config GlobalConfig) Wait(category string) WaitConfig

type ResponsePrinter added in v0.0.18

type ResponsePrinter struct {
	Quiet       bool
	CompactJSON bool
}

ResponsePrinter holds output-configuration state so that print logic can be tested without mutating package-level flag variables.

func (*ResponsePrinter) Print added in v0.0.18

func (rp *ResponsePrinter) Print(resp *client.CommandResponse, category string)

type SendBatchFunc added in v0.0.15

type SendBatchFunc func(ctx context.Context, inst *client.Instance, req client.BatchCommandRequest, timeoutMs int) (*client.BatchCommandResponse, error)

type SendFunc added in v0.0.15

type SendFunc func(command string, params interface{}) (*client.CommandResponse, error)

type WaitConfig added in v0.1.0

type WaitConfig struct {
	Timeout time.Duration
	Narrate bool
}

func (WaitConfig) WaitForAlive added in v0.1.0

func (config WaitConfig) WaitForAlive(
	ctx context.Context,
	resolve instanceResolver,
) (*client.Instance, error)

waitForAlive resolves the current target instance, then polls until a newer heartbeat appears. This keeps following the same project even if Unity rebinds to a new port during reload.

func (WaitConfig) WaitForReady added in v0.1.0

func (config WaitConfig) WaitForReady(
	ctx context.Context,
	resolve instanceResolver,
) (ready, hasErrors bool, waitErr error)

waitForReady polls indefinitely until the heartbeat state becomes "ready". Returns true if compilation had errors. waitForReady polls until the editor returns to Ready or timeoutMs elapses. It is bounded by the caller's --timeout (default 60s) rather than a hidden multi-minute cap, so a slow or stuck domain reload can't block the CLI long enough for a wrapping agent (e.g. Claude Code's 120s bash timeout) to background the process. ready=false means it timed out still compiling — distinct from a clean compile that produced errors (ready=true, hasErrors=true).

func (WaitConfig) WaitForState added in v0.1.0

func (config WaitConfig) WaitForState(
	ctx context.Context,
	resolve instanceResolver,
	targets ...string,
) error

waitForState polls the heartbeat until inst.State matches one of targets, or the deadline elapses. Used to confirm play/stop completion without holding the HTTP connection through the domain reload that play-mode entry triggers — the listener is stopped mid-response, so the only reliable confirmation channel is the filesystem heartbeat.

Jump to

Keyboard shortcuts

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