#!/usr/bin/env bash
#
# mx hook: work-health
#
# Runs during `mx work health` (and `mx health`) to augment the report with your
# own checks.
#
# Convention: report healthy by printing NOTHING (or a bare "ok"), and report a
# problem by printing an error message (one or more lines). mx shows the captured
# output as the `extra` row — empty / "ok" renders a tick (healthy), any other
# output renders a warning and flags the whole block. Stay silent on the happy path.
#
# This is a shared, runtime-wide hook — it fires for EVERY work, so branch on the
# context below. Write it in any language: just set the shebang and keep the file
# executable (e.g. #!/usr/bin/env node or #!/usr/bin/env python3).
#
# Working directory: the work folder.
# Context (environment variables):
#     $MX_WORK — work name
#     $MX_WORK_PATH — the work folder
#     $MX_EVENT (this event name), $MX_RUNTIME (runtime root)
#
# No-op by default — delete this file to disable the hook entirely.
set -euo pipefail

# Example: warn only when a work has accumulated a lot of scratch under tmp/.
#   if [ -d tmp ]; then
#     count="$(find tmp -type f | wc -l | tr -d ' ')"
#     [ "$count" -gt 100 ] && echo "tmp/ has $count files — consider clearing"
#   fi

exit 0
