@latrinebot/cli
v0.5.0
Published
Tiny CLI over the Latrine Bot public API.
Downloads
405
Maintainers
Readme
@latrinebot/cli
A tiny CLI over the Latrine Bot public API. Read-only by default, perfect for scripts, alerts, and CI jobs.
Part of the
dfnwtf/latrinebotmonorepo.
npm install -g @latrinebot/cli
# or
npx @latrinebot/cli status <project-id>Configuration
What you need
| Credential | Used by | Where to get it |
|---|---|---|
| Project ID (UUID) | every command | the dashboard URL ?project=<id> or latrine projects list once authenticated |
| Metrics key (lb_live_...) | read-only commands (status, stats, events, watch) | dashboard → API tab → Generate metrics key. Shown once. |
| Session JWT | write commands (start, stop, preflight, run-once, projects, keys) | Sign in at latrinebot.com/app, then copy the session token from DevTools |
The eligibility check (latrine eligibility <id> <wallet>) is public and needs neither.
How to pass them
In order of precedence the CLI reads: command flag, env var, then ~/.latrine/config.json.
Flags (one-off):
latrine status <project-id> --metrics-key lb_live_xxxxxxxx
latrine start <project-id> --token eyJhbGciOi...Env vars (per shell session):
export LATRINE_METRICS_KEY=lb_live_xxxxxxxx
export LATRINE_TOKEN=eyJhbGciOi...
export LATRINE_API=https://api.latrinebot.com # optional overrideConfig file (permanent, recommended for personal use):
mkdir -p ~/.latrine
cat > ~/.latrine/config.json <<EOF
{
"metricsKey": "lb_live_xxxxxxxx",
"token": "eyJhbGciOi..."
}
EOF
chmod 600 ~/.latrine/config.jsonPowerShell equivalent:
New-Item -ItemType Directory -Force "$env:USERPROFILE\.latrine" | Out-Null
'{"metricsKey":"lb_live_xxxxxxxx","token":"eyJhbGciOi..."}' |
Set-Content "$env:USERPROFILE\.latrine\config.json"Why even reads need a key
Latrine Bot treats per-project metrics (cycle counts, holders snapshot, last-event payloads) as operator-private, not public. They are read-only data, but only the project owner should see them. Truly public data (eligibility check, share card, widget snapshots) is on the client.public.* surface and needs no credentials.
Commands
Read-only (metrics key)
# Snapshot
latrine status <project-id>
# Latest N events (default 10)
latrine events <project-id> --limit 20
# Watch live (polls every 5s)
latrine watch <project-id>
# Eligibility check for any wallet (public, no auth needed)
latrine eligibility <project-id> <wallet-pubkey>
# Token page LIVE view: split, hold fund, perks (public, no auth)
latrine live <project-id>
latrine live <project-id> --jsonAuthenticated (Bearer JWT)
# Run preflight on a project
latrine preflight <project-id>
# List your projects
latrine projects list
# Start / stop
latrine start <project-id>
latrine stop <project-id>
# Force a single cycle now
latrine run-once <project-id>
# Get a metrics key (printed once)
latrine keys create <project-id> --label "ci-monitor"
latrine keys list <project-id>
latrine keys revoke <project-id> <key-id>Discovery
latrine version
latrine healthExamples
Slack alert on a failed cycle
#!/usr/bin/env bash
set -e
events=$(latrine events "$PROJECT" --limit 5 --json)
echo "$events" | jq -e '.events[] | select(.severity=="error")' >/dev/null && \
curl -sX POST "$SLACK_WEBHOOK" -d '{"text":"Latrine Bot error on '"$PROJECT"'"}'CI smoke test before deploying a token site
latrine eligibility "$PROJECT" "$TEAM_WALLET" --json > eligibility.jsonWhy this CLI
- Read-only by default. Never asks for, never logs your wallet secret.
- Works with the same metrics key that powers the dashboard widgets.
- Zero runtime deps beyond
@latrinebot/sdk. - Output is human by default, JSON with
--jsonfor scripts.
License
MIT - see the root LICENSE.
