#!/usr/bin/env bash
set -euo pipefail

repo_root() {
  git rev-parse --show-toplevel 2>/dev/null || pwd
}

ensure_repo_root() {
  cd "$(repo_root)"
}

has_remote() {
  git remote get-url origin >/dev/null 2>&1
}

run_step() {
  local label="$1"
  shift
  echo "[agent-framework] $label"
  "$@"
}

load_repo_hooks() {
  local hooks_file=".mosaic/repo-hooks.sh"
  if [[ -f "$hooks_file" ]]; then
    # shellcheck disable=SC1090
    source "$hooks_file"
  fi
}
