#!/usr/bin/env bash
# Host-side checks that need no toolchain: scripts parse, the firmware speaks the heartbeat contract, the body file is sane.
set -euo pipefail
cd "$(dirname "$0")/.."
bash -n tools/provision.sh
grep -q '/api/devices/heartbeat' main/tiny_node.c
grep -q 'deviceId' main/tiny_node.c
grep -q 'nvs_open("tiny"' main/tiny_node.c
python3 -c "import json;b=json.load(open('tiny.body.json'));assert b['slug']=='{{slug}}' and b['capabilities']"
grep -q 'nvs,      data, nvs,     0x9000' partitions.csv
echo "recipe ok"
