#!/usr/bin/env bash
# `mosaic launch <seat>` and `mosaic seat task <seat> <text>`: seat launch
# with registration for the control board. See packages/seat/README.md.
# `mosaic queue <verb>`: the work queue. See packages/queue/README.md.
# `mosaic business <verb>`: business files and role instances. See
# packages/business/README.md.
# `mosaic inbox|decide|tasks|agents|trail` and `mosaic bus start|stop|status`:
# the human commands and the bus host. See packages/cli/README.md.
# Not the npm-global `mosaic` CLI from the estate tooling; this one is
# repository-local and only reachable as scripts/mosaic.
set -euo pipefail
REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
if [ "${1:-}" = queue ]; then
  shift
  exec node "$REPO/packages/queue/src/cli.mjs" "$@"
fi
if [ "${1:-}" = business ]; then
  shift
  exec node "$REPO/packages/business/src/cli.mjs" "$@"
fi
case "${1:-}" in
  inbox|decide|tasks|agents|trail|bus) exec node "$REPO/packages/cli/src/cli.mjs" "$@" ;;
esac
exec node "$REPO/packages/seat/src/cli.mjs" "$@"
