Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

ycommand

ycommand is the primary control-plane tool of Yuneta. It connects to a running yuno — over the agent’s local socket or a remote WebSocket — and sends it commands and stats requests, printing the response. Almost every operational task in this documentation (deploying binaries, inspecting state, toggling traces, managing realms) is driven through ycommand.

It is one of a small family of control-plane clients:

Usage

ycommand -c '<command>'                     # single command on the default yuno
ycommand <command> <args...>                # same as -c, positional form
ycommand --url ws://host:port -c 'help'     # remote yuno
ycommand -i                                 # interactive shell (raw TTY)
cat script.ycmd | ycommand -u ws://...      # long-lived stdin-pipe session

The stdin-pipe mode kicks in automatically when neither -c nor -i is passed and stdin is not a TTY. Lines are read event-driven (one dup’d io_uring read per line), so the session stays alive between commands — a shell coproc, a { echo cmd1; sleep 5; echo cmd2; } block, or any programmatic driver can stream commands into the same authenticated session and pay the OAuth2 round-trip only once. EOF on stdin triggers an orderly shutdown.

Run ycommand --help for the full flag list.

Choosing a mode

ModeWhen to useTrade-off
ycommand -c '<cmd>'A single command inside a shell script or one-linerPays connect + auth on every invocation
ycommand -iInteractive exploration: prompt, TAB, history, Ctrl+R, did-you-meanRequires a TTY; not scriptable
... | ycommand (stdin)A known sequence of N commands without needing to read a response firstNo feedback loop — every line is sent regardless of prior output; connect + auth paid once

Authentication (OAuth2 / OIDC)

The default ws://127.0.0.1:1991 is the agent’s plain local control port and needs no credentials. The remote / TLS path (typically wss://host:1993) is gated by an OAuth2 JWT, supplied one of two ways:

When an IdP and a --user_id are present, ycommand runs a one-shot token-fetch task at connect time: it resolves the token endpoint (via OIDC discovery from --issuer, or taken verbatim from --token-endpoint), exchanges user_id / user_passw / client_id for a JWT (resource-owner password grant), then opens the WebSocket carrying that JWT in the handshake. In stdin-pipe mode this round-trip happens once and the resulting session serves every piped command.

FlagShortPurpose
--issuer=<url>-IOIDC issuer URL; triggers discovery of the token / end-session endpoints
--token-endpoint=<url>-TExplicit token endpoint; skips discovery (set with --end-session-endpoint)
--end-session-endpoint=<url>-EExplicit OIDC end_session endpoint; skips discovery (set with --token-endpoint)
--client-id=<id>-ZOAuth2 client_id (Keycloak / Auth0 / Azure AD / …)
--user_id=<user>-xUsername for the token grant
--user_passw=<passw>-XPassword for the token grant
--jwt=<token>-jUse a previously obtained JWT; skips the token-fetch task
# Fetch a JWT via discovery, then connect to a remote agent
ycommand --url wss://host:1993 \
         --issuer https://auth.example.com/realms/yuneta/ \
         --client-id yuneta \
         --user_id alice --user_passw '••••••' \
         -c 'list-yunos'

# Reuse a JWT you already hold (no token-fetch round-trip)
ycommand --url wss://host:1993 --jwt "$JWT" -c 'stats'

The same flags work for ybatch and ystats.

Command-line syntax

FormMeaning
cmd arg=val ...Send to the yuno’s default service
cmd ... service=__yuno__Send to the yuno itself
cmd ... service=<name>Send to a named service inside the yuno
*cmd ...Force response display in form (raw JSON) mode
!cmdRun a local ycommand command (see !help)
!!Re-run the last command (bash-style history expansion)
!NRe-run history entry N (1-based, matches !history output)
cmd1 ; cmd2 ; ...Chain; each waits for the previous response
-cmdIgnore errors for this command (the ybatch convention)
# at start of lineComment (ignored by !source / stdin piping)

The ; split is quote/brace aware: a ; inside "...", '...' or {...} is treated as literal, so JSON-valued parameters like kw={"a":1;b:2} pass through untouched.

Interactive shortcuts

Available in -i mode (and shared with ycli through the common C_EDITLINE line editor).

ShortcutAction
TABComplete command or parameter; list candidates if ambiguous
TAB after param=Complete values for boolean params (true / false)
Ctrl+R / Ctrl+SReverse / forward incremental history search
Up / DownPrevious / next history entry
Ctrl+A / Ctrl+EStart / end of line
Ctrl+B / Ctrl+FMove left / right one character
Ctrl+D / BackspaceDelete char under / before cursor
Ctrl+KDelete from cursor to end of line (readline)
Ctrl+U / Ctrl+YDelete whole line
Ctrl+WDelete previous word
Ctrl+TSwap character with previous
Ctrl+LClear screen

While in Ctrl+R / Ctrl+S search mode the prompt changes to (reverse-i-search)'pat': <match>; Enter accepts and submits, an arrow key accepts and keeps editing, ESC or Ctrl+G cancel.

Local commands (invoked with !)

Run !help (alias !h or !?) inside an interactive session for the full list. Short aliases follow the c_cli convention:

CommandAliasesDescription
!help!h, !?List all shortcuts and local commands
!history!hiShow the command history with 1-based indices (!N)
!clear-history!clhErase history
!exit / !quit!x, !qLeave ycommand
!source <file>!. <file>Read commands from <file> and splice them at the head of the queue

Batch / scripting

ycommand can run a list of commands sequentially, each waiting for the previous response — similar to ybatch but with the line-oriented ycommand syntax instead of JSON:

Script file format: one command per line, # comments and blank lines ignored, each line may itself contain ;-chained commands.

Other features

See also