#!/usr/bin/env bash
# compute-state: Scan room/ directory and output STATE.md content
# Called by session-start and on-stop hooks
# Outputs structured markdown to stdout

# Phase 381: the work runs in lib/core/room-render.cjs (node 22.18.0 or later).
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if ! command -v node >/dev/null 2>&1; then
  echo "compute-state: node is not on PATH; this step needs Node.js 22.18.0 or later" >&2
  exit 1
fi
NODE_NO_WARNINGS=1 exec node "${SCRIPT_DIR}/../lib/core/room-render.cjs" state "$@"
