dnsync 0.2.2

DNS Sync and Control with MCP
Documentation
#!/usr/bin/env bash
set -euo pipefail

repo_root="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
cd "$repo_root"

usage() {
    local cmd
    cmd="$(basename "$0")"

    cat <<USAGE
Usage:
  $cmd --check
  $cmd --pedantic
  $cmd --test
  $cmd --nextest
  $cmd --next
  $cmd --all-headless

Equivalent base commands:
  --check      bacon check      ≈ cargo check
  --pedantic   bacon pedantic   ≈ cargo clippy -- -W clippy::pedantic
  --test       bacon test       ≈ cargo test
  --nextest    bacon nextest    ≈ cargo nextest run
  --next       alias for --nextest

Diagnostics files (bacon overwrites on each run, so each mode gets its own):
  --check      writes .bacon-check-locations
  --pedantic   writes .bacon-pedantic-locations
  --test       writes .bacon-testing-locations
  --nextest    writes .bacon-testing-locations
  --next       writes .bacon-testing-locations

Each diagnostics line is split by the delimiter: |:|
USAGE
}

# Only the path differs per mode; format and other export settings come from bacon.toml.
CHECK_PATH='[exports.locations]
path = ".bacon-check-locations"'

PEDANTIC_PATH='[exports.locations]
path = ".bacon-pedantic-locations"'

TESTING_PATH='[exports.locations]
path = ".bacon-testing-locations"'

case "${1:-}" in
--check) exec bacon check --config-toml "$CHECK_PATH" ;;
--pedantic) exec bacon pedantic --config-toml "$PEDANTIC_PATH" ;;
--test) exec bacon test --config-toml "$TESTING_PATH" ;;
--nextest) exec bacon nextest --config-toml "$TESTING_PATH" ;;
--next) exec bacon nextest --config-toml "$TESTING_PATH" ;;
--all-headless)
    echo "Starting Bacon watchers in headless mode..."
    echo "Press Ctrl-C to stop all watchers."

    bacon --headless -j check --config-toml "$CHECK_PATH" &
    bacon --headless -j pedantic --config-toml "$PEDANTIC_PATH" &
    bacon --headless -j nextest --config-toml "$TESTING_PATH" &

    cleanup() {
        echo
        echo "Stopping Bacon watchers..."
        kill 0 2>/dev/null || true
    }
    trap cleanup INT TERM EXIT
    wait
    ;;
-h | --help | "")
    usage
    ;;
*)
    echo "Unknown flag: $1" >&2
    echo >&2
    usage >&2
    exit 2
    ;;
esac