CtrlK
BlogDocsLog inGet started
Tessl Logo
PluginPublic

jbaruch/herdr-policy

Herdr team coordination policy for AI coding agents

74

Quality

93%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Low

Low-risk findings worth noting

Overview
Quality
Evals
Security
Files

standup-wait.shskills/herdr-standup/

#!/usr/bin/env bash
# Wait for one worker's standup answer, with the standup's own give-up budget.
#
# A standup answer is four lines, not a task, so the wait for it is short. The
# budget is THIS script's constant, never a number the skill picks per run
# (rules/script-as-black-box.md, rules/ci-safety.md Always Watch CI); the
# skill invokes this wrapper and nothing else. Everything besides the budget —
# the two-signal completion (report file on disk AND the `REPORT: ` marker in
# the pane), the poll interval, the exit codes — belongs to wait-report.sh in
# the sibling herdr-foreman skill, which this script execs.
#
# Contract:
#   argv  : <agent-name> <report-path>   forwarded verbatim to wait-report.sh
#   stdout: wait-report.sh's one JSON object on exits 0, 1, 3, and 4. Empty on
#           any exit 2 — wait-report.sh's own, or this wrapper's preflight
#           (bad budget override, sibling script missing) — with the
#           diagnostic on stderr.
#   stderr: diagnostics.
#   exit  : wait-report.sh's code — 0 report found, 1 budget exhausted,
#           2 usage error or tool failure, 3 blocked at a dialog, 4 file
#           present but marker unconfirmed (read the pane); also 2 when
#           wait-report.sh is not installed beside this skill or the budget
#           override is not an integer. In both of those cases nothing is run.
#   env   : STANDUP_WAIT_BUDGET_SEC overrides the budget (tests, a slow fleet).
#           HERDR_ENV and HERDR_BIN pass through to wait-report.sh.
set -euo pipefail

main() {
  # Give-up budget for a standup answer, in seconds. Four lines take a worker
  # well under a minute; past this point the foreman writes that worker's row from
  # the round log instead of chasing it.
  STANDUP_WAIT_BUDGET_SEC="${STANDUP_WAIT_BUDGET_SEC:-180}"

  # Command substitution strips every trailing newline, so the script directory
  # never passes through one bare: parameter expansion derives it (#487), and a
  # sentinel carries `pwd` across the strip (#466).
  case "${BASH_SOURCE[0]}" in
    */*) _skill_src="${BASH_SOURCE[0]%/*}" ;;
    *) _skill_src=. ;;
  esac
  if ! SKILL_DIR="$(CDPATH='' cd -- "${_skill_src:-/}" && pwd && printf x)"; then
    echo "standup-wait: cannot enter the script directory ${_skill_src:-/} — restore read and search access to the plugin directory, or reinstall the plugin, then re-run" >&2
    exit 2
  fi
  SKILL_DIR="${SKILL_DIR%x}"
  SKILL_DIR="${SKILL_DIR%$'\n'}"
  FOREMAN_SKILL=herdr-foreman
  if [[ "${SKILL_DIR##*/}" == acr__jbaruch__herdr-policy__herdr-standup ]]; then
    FOREMAN_SKILL=acr__jbaruch__herdr-policy__herdr-foreman
  fi
  WAIT_REPORT="${SKILL_DIR}/../${FOREMAN_SKILL}/wait-report.sh"

  case "$STANDUP_WAIT_BUDGET_SEC" in
    ''|*[!0-9]*)
      echo "standup-wait: STANDUP_WAIT_BUDGET_SEC must be a whole number of seconds, got '${STANDUP_WAIT_BUDGET_SEC}' — unset it to use the script's default" >&2
      exit 2
      ;;
  esac
  if [[ ! -f "$WAIT_REPORT" ]]; then
    echo "standup-wait: wait-report.sh not found at ${WAIT_REPORT} — herdr-standup runs beside the herdr-foreman skill; install both with \`tessl install jbaruch/herdr-policy\`" >&2
    exit 2
  fi

  FOREMAN_WAIT_BUDGET_SEC="$STANDUP_WAIT_BUDGET_SEC" exec bash "$WAIT_REPORT" "$@"
}

if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
  main "$@"
fi

skills

README.md

tile.json