resq-cli 0.3.0

Developer CLI for the ResQ autonomous drone platform
Documentation
#!/usr/bin/env bash
# Copyright 2026 ResQ Software
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Canonical ResQ pre-commit shim — source: resq-software/dev.
# Delegates all logic to `resq pre-commit`; runs `.git-hooks/local-pre-commit`
# as a repo-specific escape hatch if present and executable.

set -euo pipefail

[ -n "${GIT_HOOKS_SKIP:-}" ] && exit 0

PROJECT_ROOT="$(git rev-parse --show-toplevel)"

# ── Resolve resq binary ─────────────────────────────────────────────────────
# PATH first (covers nix develop + ~/.cargo/bin on PATH). Soft-skip otherwise
# so a missing backend never blocks a commit silently — the user sees a hint.
RESQ_BIN=""
if command -v resq >/dev/null 2>&1; then
    RESQ_BIN="resq"
elif [ -x "$HOME/.cargo/bin/resq" ]; then
    RESQ_BIN="$HOME/.cargo/bin/resq"
fi

if [ -n "$RESQ_BIN" ]; then
    "$RESQ_BIN" pre-commit --root "$PROJECT_ROOT" "$@"
else
    echo "⚠️  resq not found — skipping ResQ pre-commit checks."
    echo "    Install: enter 'nix develop', or run:"
    echo "      cargo install --git https://github.com/resq-software/crates resq-cli"
fi

# ── Local override ──────────────────────────────────────────────────────────
LOCAL_HOOK="$PROJECT_ROOT/.git-hooks/local-pre-commit"
if [ -x "$LOCAL_HOOK" ]; then
    exec "$LOCAL_HOOK" "$@"
fi