Skip to content

cli

The xs CLI provides a collection of subcommands for interacting with a cross.stream store.

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
  • head – Get the head frame for a topic
  • get – Get a frame by ID
  • import – Import a frame directly into the store
  • version – Get the version of the server
  • nu – Manage the embedded xs.nu module

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 or <PATH>)

Example:

Terminal window
xs serve ./store --expose 127.0.0.1:8080

cat

Stream frames from the store.

Terminal window
xs cat <addr> [options]
OptionDescription
<addr>Address to connect to [HOST]:PORT or <PATH>
--follow, -fFollow the stream for new events
--pulse <ms>, -p <ms>Send synthetic xs.pulse events at interval
--tail, -tBegin reading from the end of the stream
--last-id <id>, -l <id>Start after the given frame ID
--limit <n>Maximum number of events to return
--sseUse Server-Sent Events format
--context <id>, -c <id>Context ID (defaults to system context)
--all, -aRetrieve frames across all contexts
--topic <topic>, -T <topic>Filter frames by topic

Example:

Terminal window
xs cat ./store --follow

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>
--context <id>, -c <id>Context ID (defaults to system context)

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
<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

Get the most recent frame for a topic.

Terminal window
xs head <addr> <topic> [--follow]
OptionDescription
<addr>Address to connect to
<topic>Topic to inspect
--follow, -fFollow for updates
--context <id>, -c <id>Context ID (defaults to system context)

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

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