devtool

package
v0.51.5 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: Apache-2.0 Imports: 80 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DevtoolWsVersion = semver.MustParse("0.0.1")

DevtoolWsVersion is the version to report for the ws-backed devtool runtime.

Functions

func BuildDevtoolTUIDashboard added in v0.51.5

func BuildDevtoolTUIDashboard(snapshot *devtool_status.BldrDevtoolStatus) string

BuildDevtoolTUIDashboard constructs the static Bldr devtool dashboard text.

Types

type BldrDevtoolTUIDashboard added in v0.51.3

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

BldrDevtoolTUIDashboard renders live devtool status snapshots.

func NewBldrDevtoolTUIDashboard added in v0.51.3

func NewBldrDevtoolTUIDashboard(
	initial *devtool_status.BldrDevtoolStatus,
	statusCh <-chan *devtool_status.BldrDevtoolStatus,
) *BldrDevtoolTUIDashboard

NewBldrDevtoolTUIDashboard creates a live dashboard component.

func (*BldrDevtoolTUIDashboard) GetStatusChannel added in v0.51.5

func (d *BldrDevtoolTUIDashboard) GetStatusChannel() <-chan *devtool_status.BldrDevtoolStatus

GetStatusChannel returns the live status stream.

func (*BldrDevtoolTUIDashboard) Render added in v0.51.3

func (d *BldrDevtoolTUIDashboard) Render() string

Render returns the current dashboard text.

func (*BldrDevtoolTUIDashboard) SetStatus added in v0.51.5

SetStatus updates the dashboard snapshot.

type BldrDevtoolTUIRunner added in v0.51.3

type BldrDevtoolTUIRunner struct{}

BldrDevtoolTUIRunner runs the native terminal dashboard.

func NewDevtoolTUIRunner added in v0.51.3

func NewDevtoolTUIRunner() *BldrDevtoolTUIRunner

NewDevtoolTUIRunner creates the native dashboard runner.

func (*BldrDevtoolTUIRunner) Start added in v0.51.3

func (r *BldrDevtoolTUIRunner) Start(
	ctx context.Context,
	producer *devtool_status.BldrDevtoolStatusProducer,
) (func(), error)

Start starts the native dashboard runner.

type DevtoolArgs

type DevtoolArgs struct {
	// Logger is the root logger.
	Logger *logrus.Entry
	// LogLevel is the log level string (debug, info, warn, error).
	LogLevel string

	// BldrVersion is the version of bldr to require in go.mod
	BldrVersion string
	// BldrVersionSum is the version sum to require in go.sum
	BldrVersionSum string
	// BldrSrcPath is the path to bldr to replace in go.mod
	// Use for a local path to a development checkout of the bldr sources.
	// Must be a path relative to the dist sources.
	// Should be unset unless using a dev checkout of bldr.
	BldrSrcPath string

	// StatePath is the directory to use for working state.
	StatePath string
	// ConfigPath is the path to the bldr.yaml config file.
	ConfigPath string
	// OutputPath is the path to use for build output.
	OutputPath string
	// ServeStaticPath is the path to serve with the static http server.
	ServeStaticPath string
	// UseGitRoot enables relative paths to the git repo root.
	UseGitRoot bool
	// Watch indicates we should watch for changes.
	Watch bool

	// Remote is the remote config to use.
	// Controls which world is used to store objects.
	Remote string
	// BuildType is the type of build to perform
	// Usually "dev" or "release"
	// If running "dist" this is forced to "release"
	BuildType string
	// MinifyEntrypoint configures if we will minify the entrypoint files.
	MinifyEntrypoint bool
	// WebListenAddr is the address to listen for start:web
	WebListenAddr string
	// WebUseWasm runs the entire runtime in the browser with wasm.
	WebUseWasm bool
	// NoTUI disables the interactive devtool terminal UI.
	NoTUI bool

	// BuildCsv is the list of builds to build.
	BuildCsv string
	// DistCsv is the list of dists to build.
	DistCsv string
	// PublishCsv is the list of publish IDs.
	PublishCsv string

	// DisableCleanup disables cleaning up the build files.
	DisableCleanup bool

	// TargetsCsv is the comma-separated list of deployment targets (e.g., "browser,desktop").
	// Overrides platform_ids in build configs when specified.
	TargetsCsv string

	// WebRenderer is the web renderer to use for native applications.
	// Valid values: "electron", "saucer"
	WebRenderer string

	// StartPlugins is additional plugin IDs to load on startup.
	// Appended to the plugins list from bldr.yaml start config.
	StartPlugins cli.StringSlice

	// LogFiles is the list of log file specs.
	LogFiles cli.StringSlice
	// TUIRunner renders interactive command status when terminal UI mode is active.
	TUIRunner DevtoolTUIRunner
	// contains filtered or unexported fields
}

DevtoolArgs contains common flags for the dev tools.

func NewDevtoolArgs

func NewDevtoolArgs() *DevtoolArgs

NewDevtoolArgs constructs new default arguments.

func (*DevtoolArgs) BuildBuildCommand

func (a *DevtoolArgs) BuildBuildCommand() *cli.Command

BuildBuildCommand builds the bldr build command.

func (*DevtoolArgs) BuildDevtoolCommand

func (a *DevtoolArgs) BuildDevtoolCommand() *cli.Command

BuildDevtoolCommand returns the devtool sub-command set.

func (*DevtoolArgs) BuildFlags

func (a *DevtoolArgs) BuildFlags() []cli.Flag

BuildFlags attaches the flags to a flag set.

func (*DevtoolArgs) BuildProject

func (a *DevtoolArgs) BuildProject(ctx context.Context) (err error)

BuildProject builds one of the targets defined in the project configuration.

func (*DevtoolArgs) BuildPublishCommand

func (a *DevtoolArgs) BuildPublishCommand() *cli.Command

BuildPublishCommand builds the bldr dist command.

func (*DevtoolArgs) BuildSetupCommand

func (a *DevtoolArgs) BuildSetupCommand() *cli.Command

BuildSetupCommand builds the setup sub-command.

func (*DevtoolArgs) BuildStartCommand

func (a *DevtoolArgs) BuildStartCommand() *cli.Command

BuildStartCommand builds the start sub-command.

func (*DevtoolArgs) BuildStartCommands

func (a *DevtoolArgs) BuildStartCommands() []*cli.Command

BuildStartCommands builds the bldr start sub-commands.

func (*DevtoolArgs) BuildStaticHttpCommand

func (a *DevtoolArgs) BuildStaticHttpCommand() *cli.Command

BuildStaticHttpCommand builds the static http server sub-command.

func (*DevtoolArgs) BuildSubCommands

func (a *DevtoolArgs) BuildSubCommands() []*cli.Command

BuildSubCommands builds the sub-command set.

func (*DevtoolArgs) BuildTargetsCommand

func (a *DevtoolArgs) BuildTargetsCommand() *cli.Command

BuildTargetsCommand builds the bldr targets command.

func (*DevtoolArgs) CloseLogFiles

func (a *DevtoolArgs) CloseLogFiles()

CloseLogFiles closes any attached log file hooks.

func (*DevtoolArgs) CurrentUIMode added in v0.51.3

func (a *DevtoolArgs) CurrentUIMode() DevtoolUIMode

CurrentUIMode returns the UI mode selected for the active status command.

func (*DevtoolArgs) ExecuteCliProject

func (a *DevtoolArgs) ExecuteCliProject(ctx context.Context, manifestID string, args []string) error

ExecuteCliProject builds and runs a CLI manifest as a subprocess.

Watches for manifest changes and restarts the subprocess automatically. Forwards signals to the child and propagates its exit code.

func (*DevtoolArgs) ExecuteNativeProject

func (a *DevtoolArgs) ExecuteNativeProject(ctx context.Context) (err error)

ExecuteNativeProject starts the project as a native app.

func (*DevtoolArgs) ExecuteSetup

func (a *DevtoolArgs) ExecuteSetup(ctx context.Context) error

ExecuteSetup executes the Setup CLI command.

func (*DevtoolArgs) ExecuteStaticHttpServer

func (a *DevtoolArgs) ExecuteStaticHttpServer(ctx context.Context) error

ExecuteStaticHttpServer runs the static http server command.

func (*DevtoolArgs) ExecuteWebWasmProject

func (a *DevtoolArgs) ExecuteWebWasmProject(ctx context.Context) (err error)

ExecuteWebWasmProject starts the project as a web server in Wasm mode.

func (*DevtoolArgs) ExecuteWebWsProject

func (a *DevtoolArgs) ExecuteWebWsProject(ctx context.Context) (err error)

ExecuteWebWsProject starts the devtool bus and project as a web server with a WebSocket. Plugins run as native binaries under the devtool process.

func (*DevtoolArgs) FillDefaults

func (a *DevtoolArgs) FillDefaults()

FillDefaults fills the args defaults.

func (*DevtoolArgs) FindRepoRoot

func (a *DevtoolArgs) FindRepoRoot() (string, error)

FindRepoRoot returns the absolute path to the root dir to use.

func (*DevtoolArgs) GetOutputRoot

func (a *DevtoolArgs) GetOutputRoot(repoRoot string) string

GetOutputRoot returns the output path root relative to the project root.

func (*DevtoolArgs) GetStateRoot

func (a *DevtoolArgs) GetStateRoot(repoRoot string) string

GetStateRoot returns the state directory according to the config.

func (*DevtoolArgs) InitRepoRoot

func (a *DevtoolArgs) InitRepoRoot() (
	repoRoot, stateRoot string,
	err error,
)

InitRepoRoot finds an initializes the repo root.

func (*DevtoolArgs) ListTargets

func (a *DevtoolArgs) ListTargets() error

ListTargets lists available deployment targets.

func (*DevtoolArgs) PublishProject

func (a *DevtoolArgs) PublishProject(ctx context.Context) error

PublishProject publishes a bundle to a repository.

func (*DevtoolArgs) ResolveUIMode added in v0.51.3

func (a *DevtoolArgs) ResolveUIMode() DevtoolUIMode

ResolveUIMode returns the devtool status presentation mode for this command.

func (*DevtoolArgs) ShouldUseTUI added in v0.51.3

func (a *DevtoolArgs) ShouldUseTUI() bool

ShouldUseTUI reports whether the devtool should start the interactive TUI.

func (*DevtoolArgs) Validate

func (a *DevtoolArgs) Validate() error

Validate validates the arguments.

type DevtoolBus

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

DevtoolBus contains a built devtool bus.

func BuildDevtoolBus

func BuildDevtoolBus(
	rctx context.Context,
	le *logrus.Entry,
	repoRoot, stateRoot string,
	watch bool,
) (*DevtoolBus, error)

BuildDevtoolBus builds the storage and bus for the devtool. Returns a set of functions to call to release the controllers.

func (*DevtoolBus) ExecuteWebWasm

func (d *DevtoolBus) ExecuteWebWasm(
	ctx context.Context,
	repoRoot string,
	minifyEntrypoint,
	devMode bool,
	listenAddr string,
	appID string,
	startPlugins []string,
	webStartupSrcPath string,
	forceDedicatedWorkers bool,
) error

ExecuteWebWasm starts the application in the browser with wasm.

func (*DevtoolBus) ExecuteWebWs

func (d *DevtoolBus) ExecuteWebWs(
	ctx context.Context,
	repoRoot string,
	minifyEntrypoint, devMode bool,
	listenAddr string,
	webStartupSrcPath string,
) error

ExecuteWebWs starts the application in the browser with a websocket.

func (*DevtoolBus) GetBus

func (d *DevtoolBus) GetBus() bus.Bus

GetBus returns the bus.

func (*DevtoolBus) GetContext

func (d *DevtoolBus) GetContext() context.Context

GetContext returns the context.

func (*DevtoolBus) GetDistSrcDir

func (d *DevtoolBus) GetDistSrcDir() string

GetDistSrcDir returns the path to the redistribute sources checked out under StateRoot.

func (*DevtoolBus) GetLogger

func (d *DevtoolBus) GetLogger() *logrus.Entry

GetLogger returns the root logger

func (*DevtoolBus) GetPluginHostObjectKey

func (d *DevtoolBus) GetPluginHostObjectKey() string

GetPluginHostObjectKey returns the object key for the plugin host.

func (*DevtoolBus) GetPluginsDistRoot

func (d *DevtoolBus) GetPluginsDistRoot() string

GetPluginsDistRoot returns the path to the plugins dist files dir.

func (*DevtoolBus) GetPluginsStateRoot

func (d *DevtoolBus) GetPluginsStateRoot() string

GetPluginsStateRoot returns the path to the plugins state files dir.

func (*DevtoolBus) GetStateRoot

func (d *DevtoolBus) GetStateRoot() string

GetStateRoot returns the root of the state tree.

func (*DevtoolBus) GetStaticResolver

func (d *DevtoolBus) GetStaticResolver() *static.Resolver

GetStaticResolver returns the static controller resolver.

func (*DevtoolBus) GetStatusProducer added in v0.51.3

func (d *DevtoolBus) GetStatusProducer() *devtool_status.BldrDevtoolStatusProducer

GetStatusProducer returns the devtool status producer.

func (*DevtoolBus) GetStorageID

func (d *DevtoolBus) GetStorageID() string

GetStorageID returns the storage controller id.

func (*DevtoolBus) GetVolume

func (d *DevtoolBus) GetVolume() volume.Volume

GetVolume returns the storage volume in use.

func (*DevtoolBus) GetVolumeController

func (d *DevtoolBus) GetVolumeController() volume.Controller

GetVolumeController returns the storage volume controller in use.

func (*DevtoolBus) GetVolumeInfo

func (d *DevtoolBus) GetVolumeInfo() *volume.VolumeInfo

GetVolumeInfo returns the storage volume info.

func (*DevtoolBus) GetWorldEngine

func (d *DevtoolBus) GetWorldEngine() world.Engine

GetWorldEngine returns the world engine instance.

func (*DevtoolBus) GetWorldEngineID

func (d *DevtoolBus) GetWorldEngineID() string

GetWorldEngineID returns the world engine id.

func (*DevtoolBus) GetWorldState

func (d *DevtoolBus) GetWorldState() world.WorldState

GetWorldState returns the world state handle.

func (*DevtoolBus) Release

func (d *DevtoolBus) Release()

Release releases the devtool bus.

func (*DevtoolBus) SetCommandStatus added in v0.51.3

func (d *DevtoolBus) SetCommandStatus(command devtool_status.BldrDevtoolCommandStatus)

SetCommandStatus publishes the current devtool command lifecycle status.

func (*DevtoolBus) StartProjectController

func (d *DevtoolBus) StartProjectController(
	ctx context.Context,
	b bus.Bus,
	repoRoot,
	configPath string,
	startWithRemote string,
	extraPlugins []string,
) (
	*bldr_project_watcher.Controller,
	directive.Reference,
	error,
)

StartProjectController reads the config file & starts the project controller. ConfigPath is the path to the project config. ConfigPath can be empty to start with an empty config. extraPlugins are additional plugin IDs appended to the start config. Returns the directive reference & controller.

func (*DevtoolBus) StartProjectControllerWithStartup added in v0.51.2

func (d *DevtoolBus) StartProjectControllerWithStartup(
	ctx context.Context,
	b bus.Bus,
	repoRoot,
	configPath string,
	startWithRemote string,
	extraPlugins []string,
	start bool,
) (
	*bldr_project_watcher.Controller,
	directive.Reference,
	error,
)

StartProjectControllerWithStartup reads the config file and starts the project controller.

func (*DevtoolBus) StartStorageVolume

func (d *DevtoolBus) StartStorageVolume(
	ctx context.Context,
	storageVolumeID string,
	ctrlConf *volume_controller.Config,
) (volume.Controller, directive.Reference, error)

StartStorageVolume starts a storage volume. The ID should be unique.

func (*DevtoolBus) SyncDistSources

func (d *DevtoolBus) SyncDistSources(bldrVersion, bldrSum, bldrSrcPath string) error

SyncDistSources syncs the bldr sources and runs npm i and go mod vendor.

bldrSum can be empty bldrSrcPath can be empty

type DevtoolTUIRunner added in v0.51.3

type DevtoolTUIRunner interface {
	Start(context.Context, *devtool_status.BldrDevtoolStatusProducer) (func(), error)
}

DevtoolTUIRunner starts interactive rendering for devtool command status.

type DevtoolTUIRunnerFunc added in v0.51.3

type DevtoolTUIRunnerFunc func(context.Context, *devtool_status.BldrDevtoolStatusProducer) (func(), error)

DevtoolTUIRunnerFunc adapts a function into a DevtoolTUIRunner.

func (DevtoolTUIRunnerFunc) Start added in v0.51.3

Start executes the runner function.

type DevtoolUIMode added in v0.51.3

type DevtoolUIMode int

DevtoolUIMode describes how devtool command status should be presented.

const (
	// DevtoolUIModePlain uses normal log output only.
	DevtoolUIModePlain DevtoolUIMode = iota
	// DevtoolUIModeTUI uses the interactive terminal UI.
	DevtoolUIModeTUI
)

func (DevtoolUIMode) String added in v0.51.3

func (m DevtoolUIMode) String() string

String returns the stable display value.

Directories

Path Synopsis
web
entrypoint command

Jump to

Keyboard shortcuts

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