Documentation
¶
Overview ¶
Package cli implements the oku command tree.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ServiceMutations = map[string]bool{ "orders prepare": true, "positions leverage": true, "positions margin": true, "orders submit": true, "orders cancel": true, "orders reconcile": true, "orders abandon": true, "send submit": true, "deposit submit": true, "swap submit": true, "send reconcile": true, "swap reconcile": true, "bridge submit": true, "bridge reconcile": true, "bridge claim": true, "deposit reconcile": true, "swap orders create": true, "swap orders cancel": true, "swap orders watch": true, }
ServiceMutations are journal/exchange mutations a Service runs only when constructed with AllowMutations. Login, logout, profile, skills and server commands are never reachable through a Service.
var ServiceReads = map[string]bool{ "wallet address": true, "wallet balances": true, "wallet fund": true, "deposit address": true, "send prepare": true, "send status": true, "deposit prepare": true, "deposit status": true, "swap quote": true, "swap prepare": true, "swap status": true, "bridge quote": true, "bridge prepare": true, "bridge status": true, "version": true, "doctor": true, "auth status": true, "profiles list": true, "markets list": true, "markets quote": true, "markets funding": true, "account summary": true, "positions list": true, "orders list": true, "orders status": true, "orders intents": true, "fills list": true, "docs list": true, "docs show": true, "docs search": true, "docs commands": true, "swap orders list": true, "pnl": true, }
ServiceReads are commands a Service runs by default. Prepare commands may create backend orders and journal records, but never sign or broadcast. They do not submit onchain transactions or change user configuration.
Functions ¶
func InputSchema ¶
InputSchema returns the draft 2020-12 schema generated from live command flags.
func WriteCommandReference ¶
WriteCommandReference emits the deterministic command reference from the same urfave command tree that dispatches the executable.
Types ¶
type App ¶
type App struct {
Stdout io.Writer
Stderr io.Writer
Stdin io.Reader
// StdinIsTTY enables interactive masked prompts. When false, commands
// never prompt; they fail with a structured error instead.
StdinIsTTY bool
StderrIsTTY bool
// ReadSecret reads a line from the terminal without echo. It is used only
// to convert legacy passphrase-protected credentials.
ReadSecret func(prompt string) ([]byte, error)
Getenv func(string) string
Now func() time.Time
// Sleep waits between enrollment polls; overridable in tests.
Sleep func(ctx context.Context, d time.Duration) error
OpenURL func(string) error
Version string
// contains filtered or unexported fields
}
App holds process I/O so commands are testable end to end.
type MCPBackend ¶
MCPBackend adapts Service to the MCP backend interface. Launch holds the globals `oku mcp serve` was started with. When Launch.Profile is set the server is pinned to that profile: tools inherit it and a tool asking for a different profile is refused, so an agent cannot silently switch accounts.
func (MCPBackend) Call ¶
func (b MCPBackend) Call(ctx context.Context, path string, g mcp.Globals, opts map[string]any, args []string) (any, error)
Call implements mcp.Backend.
func (MCPBackend) Commands ¶
func (b MCPBackend) Commands() []mcp.Command
Commands implements mcp.Backend.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service exposes the command handlers in-process so other front ends (the MCP server) share the exact validation, authentication, signing and journal code paths of the executable instead of shelling out to it. A Service never prompts: it has no terminal, so login, logout and legacy credential conversion fail with a structured error.
func NewService ¶
NewService returns a non-interactive service. Diagnostics go to stderr; nothing is ever written to stdout.
func (*Service) AllowMutations ¶
AllowMutations enables the ServiceMutations commands.
func (*Service) Call ¶
func (s *Service) Call(ctx context.Context, path string, g Globals, flags map[string]any, args []string) (any, error)
Call runs the command at path (e.g. "orders prepare") with typed flag values and positional args. It returns the same data the --json envelope carries, or an *output.Error.
Source Files
¶
- app.go
- authcmd.go
- autoupdate.go
- bridge_backend_execution.go
- bridge_batch.go
- bridge_claim.go
- buildinfo.go
- credentials.go
- credstore.go
- detach_unix.go
- docscmd.go
- draftscmd.go
- flagtype.go
- funds_amount.go
- funds_fund.go
- funds_intent.go
- funds_manifest.go
- funds_reads.go
- funds_reconcile.go
- funds_routes.go
- funds_routes_submit.go
- funds_send.go
- hyperliquid.go
- intents.go
- mcpcmd.go
- misc.go
- native_token.go
- orders.go
- pnl.go
- privysigner.go
- profile.go
- reads.go
- reference.go
- risk.go
- router_verify.go
- schema.go
- selfupdate.go
- service.go
- swap_orders.go
- swap_pnl.go
- table.go
- telemetrycmd.go
- term.go