Documentation
¶
Index ¶
- Constants
- func ErrorWasPrinted(err error) bool
- func ExitCodeFor(err error) int
- func IsCobraArgError(err error) bool
- func NewRootCmd() *cobra.Command
- func PrintCommandError(err error) error
- func PrintError(code string, msg string) error
- func PrintErrorDetails(code string, msg string, details string) error
Constants ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
PrintCommandError writes err as the CLI's structured JSON error envelope.
func PrintError ¶
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.
Types ¶
This section is empty.
Source Files
¶
- client.go
- cmd_ark.go
- cmd_ark_send.go
- cmd_balance.go
- cmd_board.go
- cmd_create.go
- cmd_exit.go
- cmd_fees.go
- cmd_getinfo.go
- cmd_inspect.go
- cmd_list.go
- cmd_mcp.go
- cmd_oor.go
- cmd_recovery.go
- cmd_recv.go
- cmd_rounds.go
- cmd_schema.go
- cmd_send.go
- cmd_sweep.go
- cmd_sweep_wallet.go
- cmd_unlock.go
- cmd_vtxos.go
- error_format.go
- exit_codes.go
- fee_errors.go
- flag_normalization.go
- format.go
- json_input.go
- list_output.go
- mcp_wallet.go
- oor_destination.go
- prompt.go
- root.go
- rpc_context.go
- schema_registry.go
- schema_registry_ark_observable.go
- send_result.go
- swap_runtime_errors.go
- wallet_client.go
- wallet_inspection_table.go
- wallet_password.go
- wallet_table.go