waveclicommands

package
v0.1.1-rc2 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ExitGenericError is the catch-all failure code.
	ExitGenericError = 1

	// ExitInvalidArgs indicates the CLI rejected the invocation
	// before reaching the daemon: missing required flag, malformed
	// outpoint, conflicting --offchain/--onchain, etc.
	ExitInvalidArgs = 2

	// ExitAuthFailure indicates a wallet authentication failure
	// (wrong password, locked wallet on a verb that requires it).
	ExitAuthFailure = 3

	// ExitNotFound indicates a queried resource does not exist on the
	// daemon (unknown round id, missing exit job, etc.).
	ExitNotFound = 4

	// ExitConfirmationRequired indicates the command is valid but a
	// fund-moving action needs explicit --yes approval in this
	// non-interactive environment.
	ExitConfirmationRequired = 5
)

Exit codes follow the agent-cli skill's semantic-exit-code table so agents can branch on the failure category without parsing prose. 0 is success and is set by cobra implicitly when RunE returns nil.

Variables

This section is empty.

Functions

func ErrorWasPrinted

func ErrorWasPrinted(err error) bool

ErrorWasPrinted reports whether err originated from PrintError and therefore already produced a structured stderr envelope. main() uses this to suppress its fallback EXECUTION_FAILED emission for errors that have already been rendered.

func ExitCodeFor

func ExitCodeFor(err error) int

ExitCodeFor returns the exit code main.go should use for err. The mapping is: explicit cliError code wins, then printedError's own code-derived mapping; otherwise gRPC status codes map to the closest semantic exit code; otherwise generic.

func IsCobraArgError

func IsCobraArgError(err error) bool

IsCobraArgError reports whether err looks like a cobra or pflag pre-RunE validation failure. main.go uses this to emit an INVALID_ARGS structured envelope (instead of the generic EXECUTION_FAILED) so the stderr surface matches the exit-code-2 mapping ExitCodeFor returns for the same error.

func NewRootCmd

func NewRootCmd() *cobra.Command

NewRootCmd creates the top-level cobra command for wavecli. Global flags (--rpcserver, --timeout, --tlscertpath, --macaroonpath, --no-tls) are registered here and made available to all subcommands via PersistentFlags.

The advanced subtrees (ark / dev / recovery) are hidden from the default --help unless WAVELENGTH_DEV=1 is set; execution is never gated on the env var.

func PrintCommandError

func PrintCommandError(err error) error

PrintCommandError writes err as the CLI's structured JSON error envelope.

func PrintError

func PrintError(code string, msg string) error

PrintError writes a structured error to stderr in JSON format and returns an error that carries the same code/message plus a marker that main() can pick up via ErrorWasPrinted to avoid re-emitting the envelope. Callers `return PrintError(...)` from RunE so the cobra surface keeps signalling failure to the harness while stderr stays machine-readable.

func PrintErrorDetails

func PrintErrorDetails(code string, msg string, details string) error

PrintErrorDetails writes a structured error to stderr with optional diagnostic context for the message.

Types

This section is empty.

Directories

Path Synopsis
Code generated by gen-devrpc.
Code generated by gen-devrpc.

Jump to

Keyboard shortcuts

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