Scripting
Every command supports --json for structured output. Prompts write to stderr, so stdout stays clean for piping.
JSON Output & Piping
terminal — scripting
# Pipe to jq
$ chainalert detections list --status=active --json | jq '.data[].name'
"USDC Whale Monitor"
"Treasury Drain Alert"
# Use in scripts
$ DETECTION_ID=$(chainalert detections list --json | jq -r '.data[0].id')
$ chainalert detections get "$DETECTION_ID" --json
Configuration
Config is stored at ~/.chainalert/config.json.
| Key | Purpose |
|---|---|
| api-url | Override the API base URL (default: https://api.chainalert.dev) |
| openai-key | Bring-your-own OpenAI API key for AI chat mode |
terminal — config
$ chainalert config set api-url http://localhost:4000
$ chainalert config get api-url
http://localhost:4000