Skip to content

cli

The xs CLI provides a collection of subcommands for interacting with a cross.stream store. See for naming rules and wildcards.

Usage

Terminal window
xs <COMMAND> [OPTIONS]

Commands

  • serve – Provides an API to interact with a local store
  • catcat the event stream
  • append – Append an event to the stream
  • cas – Retrieve content from Content-Addressable Storage
  • cas-post – Store content in Content-Addressable Storage
  • remove – Remove an item from the stream
  • last – Get the most recent frame for a topic
  • get – Get a frame by ID
  • import – Import a frame directly into the store
  • eval – Evaluate a Nushell script with store helper commands available
  • version – Get the version of the server
  • nu – Manage the embedded xs.nu module
  • scru128 – Generate and manipulate SCRU128 IDs

serve

Start the supervisor process.

Terminal window
xs serve <path> [--expose <LISTEN_ADDR>]
OptionDescription
<path>Path to the store
--expose <LISTEN_ADDR>Expose the API on an additional address ([HOST]:PORT, <PATH>, or iroh://)

Examples:

Terminal window
# Expose on TCP port
xs serve ./store --expose 127.0.0.1:8080
# Expose via iroh for peer-to-peer QUIC connections
xs serve ./store --expose iroh://

See the Exposing Streams reference for detailed networking options.

cat

Stream frames from the store.

Terminal window
xs cat <addr> [options]
OptionDescription
<addr>Address to connect to ([HOST]:PORT, <PATH>, or iroh://...)
--follow, -fFollow the stream for new events
--pulse <ms>, -p <ms>Send synthetic xs.pulse events at interval
--new, -nSkip existing, only show new events
--after <id>, -a <id>Start after the given frame ID (exclusive)
--from <id>Start from the given frame ID (inclusive)
--limit <n>Maximum number of events to return
--last <n>Return the last N events (most recent)
--sseUse Server-Sent Events format
--topic <topic>, -T <topic>Filter by topic (supports user.* wildcards)

Examples:

Terminal window
# Local store
xs cat ./store --follow
# Remote TCP connection
xs cat :3021 --follow
# Peer-to-peer via iroh QUIC
xs cat iroh://nodeac4lrf7r5hyq...crjpx6ajinb2hi4d --follow

See Exposing Streams reference for connection details.

append

Append an event to a topic.

Terminal window
xs append <addr> <topic> [options]
OptionDescription
<addr>Address to connect to
<topic>Topic to append to
--meta <json>JSON metadata to include
--ttl <ttl>Time-to-live: forever, ephemeral, time:<ms>, head:<n>

Example:

Terminal window
echo "hello" | xs append ./store chat --meta '{"user":"bob"}'

cas

Retrieve content from CAS.

Terminal window
xs cas <addr> <hash>
OptionDescription
<addr>Address to connect to ([HOST]:PORT, <PATH>, or iroh://...)
<hash>Hash of the content to retrieve

cas-post

Store content in CAS.

Terminal window
xs cas-post <addr>
OptionDescription
<addr>Address to connect to

Example:

Terminal window
echo "content" | xs cas-post ./store

remove

Remove a frame from the store.

Terminal window
xs remove <addr> <id>
OptionDescription
<addr>Address to connect to
<id>ID of the item to remove

last

Get the most recent frame for a topic.

Terminal window
xs last <addr> <topic> [--follow]
OptionDescription
<addr>Address to connect to
<topic>Topic to inspect
--follow, -fFollow for updates

get

Retrieve a frame by ID.

Terminal window
xs get <addr> <id>
OptionDescription
<addr>Address to connect to
<id>ID of the frame to get

import

Import a frame dump from standard input.

Terminal window
xs import <addr>
OptionDescription
<addr>Address to connect to

Example:

Terminal window
cat dump.jsonl | xs import ./store

eval

Evaluate a Nushell script with store helper commands available.

Terminal window
xs eval <addr> [file] [-c <commands>]
OptionDescription
<addr>Address to connect to ([HOST]:PORT, <PATH>, or iroh://...)
[file]Script file to evaluate, or ”-” to read from stdin
-c <commands>Evaluate script from command line

The eval command runs a Nushell script with access to store helper commands like .cat, .append, .last, .get, .cas, and .remove.

Output format auto-detection:

  • ByteStream → raw bytes
  • ListStream of structured data → JSONL stream
  • ListStream of primitives → JSONL stream
  • ListStream of mixed types → JSONL stream
  • Single Value (string/number) → raw text
  • Single structured Value → single JSON object
  • PipelineData::Empty → nothing

Examples:

Terminal window
# Simple expression
xs eval ./store -c '"hello world"'
# Math expression
xs eval ./store -c '2 + 3'
# JSON output
xs eval ./store -c '{name: "test", value: 42}'
# Script from stdin
echo '"from stdin"' | xs eval ./store -
# Script from file
xs eval ./store script.nu
# Using store helpers
xs eval ./store -c '"my note" | .append note'
xs eval ./store -c '.last note'
xs eval ./store -c '.cat --topic note'

version

Get version information from the server.

Terminal window
xs version <addr>
OptionDescription
<addr>Address to connect to

nu

Manage the embedded xs.nu module.

Terminal window
xs nu [--install] [--clean]
OptionDescription
--installInstall xs.nu into your Nushell config
--cleanRemove previously installed files

Without options the command prints the module contents so it can be redirected or piped.

Example:

Terminal window
xs nu --install

The xs.nu module provides Nushell-friendly convenience functions that wrap these CLI commands with pipeline support and environment awareness. The module automatically uses $env.XS_ADDR when connecting to remote stores.

See the xs.nu reference for detailed documentation of all available functions and the Exposing Streams reference for remote connection setup.

scru128

Generate and manipulate SCRU128 IDs. SCRU128 is a sortable, clock and random number-based unique identifier.

Terminal window
xs scru128 [COMMAND]

Generate a new ID

Generate a single SCRU128 ID:

Terminal window
xs scru128

Example:

Terminal window
xs scru128
# => 03d4q1qhbiv09ovtuhokw5yxv

unpack

Unpack a SCRU128 ID into its component fields:

Terminal window
xs scru128 unpack <ID>
OptionDescription
<ID>SCRU128 ID string, or - to read from stdin

The output is a JSON object with the following fields:

  • timestamp - Unix timestamp as float (milliseconds precision)
  • counter_hi - 24-bit high counter value
  • counter_lo - 24-bit low counter value
  • node - 32-bit entropy/node field as hex string

Examples:

Terminal window
xs scru128 unpack 03d4q1qhbiv09ovtuhokw5yxv
# =>
# {
# "timestamp": 1693000000.123,
# "counter_hi": 1234,
# "counter_lo": 5678,
# "node": "abcd1234"
# }
echo "03d4q1qhbiv09ovtuhokw5yxv" | xs scru128 unpack -

pack

Pack component fields into a SCRU128 ID:

Terminal window
xs scru128 pack

Reads a JSON object from stdin with the same format as unpack output.

Example:

Terminal window
echo '{"timestamp":1693000000.123,"counter_hi":1234,"counter_lo":5678,"node":"abcd1234"}' | xs scru128 pack
# => 03d4q1qhbiv09ovtuhokw5yxv

Round-trip example:

Terminal window
xs scru128 | xs scru128 unpack | xs scru128 pack