Help us shape the future of Go! Take the 2026 Go Developer Survey

cli

package
v0.57.22 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapeJSString

func EscapeJSString(s string) string

EscapeJSString returns s as a safe JavaScript string literal (with quotes).

func LooksLikeSyntaxError

func LooksLikeSyntaxError(msg string) bool

LooksLikeSyntaxError returns true if the error message suggests shell quoting issues.

Types

type ClientArgs

type ClientArgs struct {

	// SessionIdx is the session index to use.
	SessionIdx uint
	// EvalFilePath is the path to a JS file for eval.
	EvalFilePath string
	// SpaceName is the name for create-space.
	SpaceName string
	// WebPkgs is extra web packages for the eval bundler.
	WebPkgs cli.StringSlice
	// contains filtered or unexported fields
}

ClientArgs contains the client arguments and functions.

func (*ClientArgs) BuildClient

BuildClient builds or returns the cached debug bridge client.

func (*ClientArgs) BuildCommands

func (a *ClientArgs) BuildCommands() []*cli.Command

BuildCommands returns the command list.

func (*ClientArgs) BuildCoreClient

func (a *ClientArgs) BuildCoreClient() (srpc.Client, error)

BuildCoreClient returns an SRPC client connected to the spacewave-core plugin via PluginRpc. Reusable for any RPC that needs core bus access.

func (*ClientArgs) BuildFlags

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

BuildFlags returns the common flags.

func (*ClientArgs) BuildForgeCommand added in v0.51.5

func (a *ClientArgs) BuildForgeCommand() *appcli.Command

BuildForgeCommand returns debug commands for live Forge execution probes.

func (*ClientArgs) BuildPluginExecServiceClient added in v0.51.5

func (a *ClientArgs) BuildPluginExecServiceClient(
	ctx context.Context,
	pluginID string,
) (space_exec.SRPCPluginExecServiceClient, error)

BuildPluginExecServiceClient returns the PluginExecService for a live plugin.

func (*ClientArgs) BuildSpaceCommand

func (a *ClientArgs) BuildSpaceCommand() *appcli.Command

BuildSpaceCommand returns the space command with subcommands.

func (*ClientArgs) BuildSrpcClient

func (a *ClientArgs) BuildSrpcClient() (srpc.Client, error)

BuildSrpcClient builds or returns the cached SRPC client for the debug socket.

func (*ClientArgs) DialPluginRpc

func (a *ClientArgs) DialPluginRpc(pluginID string) (srpc.Client, error)

DialPluginRpc opens a PluginRpc stream to the given plugin via the debug bridge, returning an srpc.Client for that plugin's RPC services.

func (*ClientArgs) EvalCode

func (a *ClientArgs) EvalCode(ctx context.Context, code string) error

EvalCode evaluates JavaScript code and prints the result to stdout.

func (*ClientArgs) GetContext

func (a *ClientArgs) GetContext() context.Context

GetContext returns the context. Falls back to context.Background() for CLI entrypoints where no caller context is available.

func (*ClientArgs) MountSession

func (a *ClientArgs) MountSession(ctx context.Context, sessionIdx uint32) (*s4wave_session.Session, func(), error)

MountSession opens a ResourceClient via PluginRpc to spacewave-core, mounts a session by index via the root resource, and returns the Session SDK wrapper along with a cleanup function.

func (*ClientArgs) RunCreateSpace

func (a *ClientArgs) RunCreateSpace(c *cli.Context) error

RunCreateSpace creates a new space.

func (*ClientArgs) RunEval

func (a *ClientArgs) RunEval(c *cli.Context) error

RunEval evaluates JavaScript code in the page context.

func (*ClientArgs) RunEvalJSON

func (a *ClientArgs) RunEvalJSON(ctx context.Context, code string, fn func(*fastjson.Value)) error

RunEvalJSON evaluates code via EvalJS and parses the JSON result with fastjson.

func (*ClientArgs) RunInfo

func (a *ClientArgs) RunInfo(c *cli.Context) error

RunInfo returns information about the current page.

func (*ClientArgs) RunListSpaces

func (a *ClientArgs) RunListSpaces(c *cli.Context) error

RunListSpaces lists spaces in the current session.

func (*ClientArgs) RunWait

func (a *ClientArgs) RunWait(c *cli.Context) error

RunWait polls until the debug bridge is ready and responds.

func (*ClientArgs) SetContext

func (a *ClientArgs) SetContext(c context.Context)

SetContext sets the context.

type ForgeArgs added in v0.51.5

type ForgeArgs struct {

	// TargetPath is a forge/target/json YAML or JSON target file.
	TargetPath string
	// DryRun validates the target without opening the debug bridge.
	DryRun bool
	// BrowserRequired refuses to execute through the native debug bridge.
	BrowserRequired bool
	// contains filtered or unexported fields
}

ForgeArgs contains forge debug command arguments.

func (*ForgeArgs) RunPluginTarget added in v0.51.5

func (fa *ForgeArgs) RunPluginTarget(c *appcli.Context) error

RunPluginTarget runs a space-exec/plugin target through the live debug bridge.

type SpaceArgs

type SpaceArgs struct {

	// SpaceID is the target space ID.
	SpaceID string
	// PluginID is the target plugin manifest ID.
	PluginID string
	// contains filtered or unexported fields
}

SpaceArgs contains space subcommand arguments.

func (*SpaceArgs) RunAddPlugin

func (sa *SpaceArgs) RunAddPlugin(c *appcli.Context) error

RunAddPlugin adds a plugin to the space settings.

func (*SpaceArgs) RunPlugins

func (sa *SpaceArgs) RunPlugins(c *appcli.Context) error

RunPlugins prints plugin statuses by calling MountSpaceContents + WatchState. This mirrors exactly what the UI SpacePlugins component does.

func (*SpaceArgs) RunRemovePlugin

func (sa *SpaceArgs) RunRemovePlugin(c *appcli.Context) error

RunRemovePlugin removes a plugin from the space settings.

func (*SpaceArgs) RunStatus

func (sa *SpaceArgs) RunStatus(c *appcli.Context) error

RunStatus prints the SpaceState including settings and world contents.

Jump to

Keyboard shortcuts

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