bramble-cli

module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2026 License: MIT

README

bramble-cli

bramble-cli is the command-line and terminal UI client for Bramble mesh nodes. Use it to connect over serial, WebSocket, or BLE; send and monitor mesh traffic; inspect node health; and manage configuration from a laptop shell or an interactive full-screen TUI.

It is built on bramble-go, and follows its protocol compatibility (MinProtocolVersion=0.1.0, MaxProtocolVersion=0.5.0).

Table of Contents

Install

go install github.com/justinlindh/bramble-cli/cmd/bramble@latest

Or build from source:

git clone https://github.com/justinlindh/bramble-cli.git
cd bramble-cli
go build -o bramble ./cmd/bramble

Quick Start

Auto-detect USB serial (scans /dev/ttyUSB* and /dev/ttyACM*):

bramble status

Specify a serial port:

bramble --port /dev/ttyUSB0 status

WebSocket transport:

bramble --transport ws://192.168.4.1/ws status

Bluetooth Low Energy transport:

bramble --ble Bramble status

Terminal UI

Launch the interactive TUI:

bramble tui --transport ws://192.0.2.0/ws
bramble tui --port /dev/ttyUSB0

The TUI is designed as an IRC-style operations console for Bramble. It combines live chat, system events, slash-command output, and connection status in a single full-screen view so you can operate a node without bouncing between multiple terminal commands.

Bramble TUI overview

Bramble TUI chat flow

What it shows
  • Unified scrollback: inbound/outbound messages, delivery updates, and node events
  • Status bar: transport state, active buffers, unread counts, peer counts, clock
  • Command input: message composition plus slash commands like /nodes, /stats, /config, /location
  • Buffer model: broadcast, channel, and DM buffers with quick keyboard switching
  • Mouse support: scroll wheel for history, click a nickname to open a DM, click status bar tabs to switch buffers

Global Flags

Flag Short Description
--ble <name> -b BLE device name to scan for (example: Bramble)
--port <path> -p Serial port path (example: /dev/ttyUSB0)
--transport <url> -t WebSocket transport URL (example: ws://192.168.4.1/ws)
--token Auth token for node connection
--json Output command results as JSON

Commands

Messaging
  • bramble send <address> <message> — send a unicast message
  • bramble broadcast <message> — send a mesh-wide message
  • bramble channels list — list configured channels
  • bramble channels add <name> [psk] — add a channel
  • bramble channels remove <index> — remove a channel
  • bramble channels set-default <index> — set default outgoing channel
bramble send CAFEBABE "hello there"
bramble broadcast "hello everyone"
bramble broadcast --channel 2 "hello channel 2"
bramble broadcast --wait-delivery 10 "delivery telemetry please"
Monitoring and Diagnostics
  • bramble monitor — stream real-time node events
  • bramble traffic monitor — live TX/RX telemetry stream
  • bramble traffic export — export ring-buffer traffic telemetry to JSONL
  • bramble peers — list direct radio neighbors
  • bramble routes — show routing table
  • bramble ping — ping connected node
  • bramble probe — send network probe
bramble monitor --topic wifi,gps,location
bramble monitor --messages
bramble monitor --events
bramble traffic monitor --tx-only
bramble traffic export --format jsonl > traffic-events.jsonl
Configuration
  • bramble config get — print full node configuration
  • bramble config set-name <name> — set node display name
  • bramble config set-radio — update radio parameters
bramble config set-name my-node
bramble config set-radio --freq 915.0 --sf 10 --bw 125 --cr 5 --txpower 20
Location
  • bramble location status — show known peer locations
  • bramble location get-config — show canonical location config
  • bramble location set-config — set canonical location policy
  • bramble location set-contact <address> <tier> — quick per-peer rule
  • bramble location remove-contact <address> — remove per-peer rule
  • bramble location share-once <address> — send one-time location update
bramble location set-config --enabled --default-tier full --interval-s 30 --source gps
bramble location get-config --json
System and Network
  • bramble status — show node address, firmware, radio, peers, counters, uptime
  • bramble discover — scan local network for Bramble nodes via mDNS
  • bramble ota --url <url> — trigger OTA firmware update
  • bramble reboot — reboot node
  • bramble tui — launch full-screen interactive terminal UI
bramble status
bramble discover --timeout 10s
bramble ota --url http://192.0.2.0:8080/firmware/bramble.bin

Shell Completion

Bramble supports shell completions via Cobra:

# Bash
bramble completion bash > /etc/bash_completion.d/bramble

# Zsh
bramble completion zsh > "${fpath[1]}/_bramble"

# Fish
bramble completion fish > ~/.config/fish/completions/bramble.fish

JSON Output

All commands support --json for machine-readable output:

bramble --json status | jq .address
bramble --json peers | jq '.[].rssi'
bramble monitor --topic location --json

Examples

See the examples/ directory for common usage patterns:

Quality Checks

The repository includes a dedicated quality workflow at .gitea/workflows/quality.yml.

  • Required checks (Phase C):
    • go test ./...
    • go vet ./...
    • golangci-lint run ./...
    • shellcheck scripts/*.sh examples/*.sh
    • bash scripts/check-doc-drift.sh
    • npx --yes markdownlint-cli2 "**/*.md"
    • govulncheck ./...
  • Advisory checks:
    • actionlint

govulncheck ./... is required in Phase C by default because current scans show no vulnerability backlog and produce high-signal output (No vulnerabilities found.).

Staged promotion policy, Phase B → C migration notes, required-vs-advisory matrix, and explicit rollback levers are documented in docs/quality-policy.md.

To run local required + advisory checks before pushing:

go test ./...
go vet ./...
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
golangci-lint run ./...

# ShellCheck (install once; package name may vary by distro)
shellcheck scripts/*.sh examples/*.sh

# Docs correctness + markdown (required in Phase C)
bash scripts/check-doc-drift.sh
npx --yes markdownlint-cli2 "**/*.md"

# govulncheck is required in CI Phase C
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...

# Optional advisory check
go install github.com/rhysd/actionlint/cmd/actionlint@latest
actionlint
Local Git hooks with pre-commit

Install hooks once in your clone:

# Pre-commit checks (format, lint, shellcheck, markdown)
pre-commit install

# Optional: also install pre-push checks (docs drift)
pre-commit install -t pre-push

Run hooks on demand:

pre-commit run --all-files
pre-commit run --hook-stage pre-push check-doc-drift

Emergency bypass (use sparingly, and fix immediately after):

# Skip specific pre-commit hooks
SKIP=golangci-lint,markdownlint-cli2 git commit -m "..."

# Bypass all hooks for one commit/push
git commit --no-verify -m "..."
git push --no-verify

License

MIT

Directories

Path Synopsis
cmd
bramble command
internal
commands
Package commands provides all CLI subcommands for the bramble tool.
Package commands provides all CLI subcommands for the bramble tool.
discovery
Package discovery provides USB serial port auto-detection for Bramble nodes.
Package discovery provides USB serial port auto-detection for Bramble nodes.
output
Package output provides table and JSON formatters for CLI output.
Package output provides table and JSON formatters for CLI output.
tui
Package tui provides the Bubble Tea v2 terminal UI for bramble.
Package tui provides the Bubble Tea v2 terminal UI for bramble.
tui/tabs
Package tabs contains individual tab models for the Bramble TUI.
Package tabs contains individual tab models for the Bramble TUI.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL