Table of Contents

cli.py

The RobinNet CLI is the primary operator tool for managing a local node.

It provides commands for:

The CLI is designed to be the main operational interface before the future Cardinal UI.


General Usage

RobinNet commands are run as a Python module.

Basic format:

python -m robinnet.cli --db ./data/node.db <command> [options]

Example:

python -m robinnet.cli --db ./data/node.db node-info

Node Commands

init-node

Initializes or updates the local node identity.

Example:

python -m robinnet.cli \
  --db ./data/node.db \
  init-node \
  --name alpha \
  --operator "Rich" \
  --callsign N2XYZ \
  --location "Albany area"

Options:


node-info

Displays the local node record.

Example:

python -m robinnet.cli \
  --db ./data/node.db \
  node-info

JSON output:

python -m robinnet.cli \
  --db ./data/node.db \
  node-info \
  --json

Peer Commands

add-peer

Adds or updates a peer node.

Example:

python -m robinnet.cli \
  --db ./data/node.db \
  add-peer \
  --name bravo \
  --url http://127.0.0.1:8082

Options:


list-peers

Lists configured peers.

Example:

python -m robinnet.cli \
  --db ./data/node.db \
  list-peers

Show enabled peers only:

python -m robinnet.cli \
  --db ./data/node.db \
  list-peers \
  --enabled-only

JSON output:

python -m robinnet.cli \
  --db ./data/node.db \
  list-peers \
  --json

remove-peer

Removes a peer by local peer id.

Example:

python -m robinnet.cli \
  --db ./data/node.db \
  remove-peer \
  --peer-id 1

peer-test

Tests connectivity and identity for one peer.

This command:

Example:

python -m robinnet.cli \
  --db ./data/node.db \
  peer-test \
  --peer-id 1

Options:

JSON output example:

python -m robinnet.cli \
  --db ./data/node.db \
  peer-test \
  --peer-id 1 \
  --json

Message Commands

post-bulletin

Creates a new local bulletin.

Example:

python -m robinnet.cli \
  --db ./data/node.db \
  post-bulletin \
  --title "Water Distribution" \
  --body "Town Hall from 10:00 to 16:00."

Options:

Example with more options:

python -m robinnet.cli \
  --db ./data/node.db \
  post-bulletin \
  --title "Shelter Open" \
  --body "Community Center open until 22:00." \
  --scope regional \
  --priority 5 \
  --rf-eligible

list-messages

Lists locally stored messages.

Example:

python -m robinnet.cli \
  --db ./data/node.db \
  list-messages

Show message bodies:

python -m robinnet.cli \
  --db ./data/node.db \
  list-messages \
  --show-body

Filter by type:

python -m robinnet.cli \
  --db ./data/node.db \
  list-messages \
  --msg-type bulletin

Filter by status:

python -m robinnet.cli \
  --db ./data/node.db \
  list-messages \
  --status active

JSON output:

python -m robinnet.cli \
  --db ./data/node.db \
  list-messages \
  --json

show-message

Displays one message by UUID.

Example:

python -m robinnet.cli \
  --db ./data/node.db \
  show-message \
  --msg-uuid 12345678-1234-1234-1234-123456789abc

show-trace

Displays trace history for one message UUID.

This is useful for following import/export history.

Example:

python -m robinnet.cli \
  --db ./data/node.db \
  show-trace \
  --msg-uuid 12345678-1234-1234-1234-123456789abc

JSON output:

python -m robinnet.cli \
  --db ./data/node.db \
  show-trace \
  --msg-uuid 12345678-1234-1234-1234-123456789abc \
  --json

delete-message

Deletes one message by UUID.

Example:

python -m robinnet.cli \
  --db ./data/node.db \
  delete-message \
  --msg-uuid 12345678-1234-1234-1234-123456789abc

Sync Commands

sync-peer

Synchronizes one configured peer.

By default it performs both:

Example:

python -m robinnet.cli \
  --db ./data/node.db \
  sync-peer \
  --peer-id 1

Pull only:

python -m robinnet.cli \
  --db ./data/node.db \
  sync-peer \
  --peer-id 1 \
  --pull-only

Push only:

python -m robinnet.cli \
  --db ./data/node.db \
  sync-peer \
  --peer-id 1 \
  --push-only

Options:


sync-all

Synchronizes all enabled peers.

Example:

python -m robinnet.cli \
  --db ./data/node.db \
  sync-all

Pull only:

python -m robinnet.cli \
  --db ./data/node.db \
  sync-all \
  --pull-only

Push only:

python -m robinnet.cli \
  --db ./data/node.db \
  sync-all \
  --push-only

JSON output:

python -m robinnet.cli \
  --db ./data/node.db \
  sync-all \
  --json

Maintenance Commands

expire-messages

Marks expired messages as expired.

Example:

python -m robinnet.cli \
  --db ./data/node.db \
  expire-messages

Show expired messages after the update:

python -m robinnet.cli \
  --db ./data/node.db \
  expire-messages \
  --show

Show expired messages as JSON:

python -m robinnet.cli \
  --db ./data/node.db \
  expire-messages \
  --show \
  --json

generate-test-data

Creates local test bulletins for development and sync testing.

Example:

python -m robinnet.cli \
  --db ./data/node.db \
  generate-test-data \
  --count 5

Custom prefixes:

python -m robinnet.cli \
  --db ./data/node.db \
  generate-test-data \
  --count 10 \
  --title-prefix "Test Bulletin" \
  --body-prefix "Generated message"

Include full message output:

python -m robinnet.cli \
  --db ./data/node.db \
  generate-test-data \
  --count 3 \
  --include-messages \
  --json

Options:


Typical Workflow

A basic operator workflow might be:

  1. initialize node
  2. add one or more peers
  3. test peer connectivity
  4. post a bulletin
  5. sync with peers
  6. inspect messages and trace

Example:

python -m robinnet.cli --db ./data/alpha.db init-node --name alpha --operator "Rich"
python -m robinnet.cli --db ./data/alpha.db add-peer --name bravo --url http://127.0.0.1:8082
python -m robinnet.cli --db ./data/alpha.db peer-test --peer-id 1
python -m robinnet.cli --db ./data/alpha.db post-bulletin --title "Test" --body "Hello RobinNet"
python -m robinnet.cli --db ./data/alpha.db sync-all
python -m robinnet.cli --db ./data/alpha.db list-messages --show-body

Notes

The CLI is intended to remain fully functional even after Cardinal exists.

That means: