hypertwist/scripts/run-hypertwist-gitnexus-status.sh
2026-06-24 23:42:54 +00:00

33 lines
1 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
source "$repo_root/scripts/lib-hypertwist-gitnexus.sh"
local_gitnexus_cli="$repo_root/mirrors/GitNexus/gitnexus/dist/cli/index.js"
analysis_root="$repo_root/.gitnexus-source-only-root"
if [[ ! -d "$analysis_root" ]]; then
echo "No HyperTwist GitNexus source-only analysis root exists yet. Run scripts/run-hypertwist-gitnexus-analyze.sh first." >&2
exit 1
fi
cd "$analysis_root"
local_cli_available=0
if hypertwist_gitnexus_probe_local_runtime "$repo_root"; then
local_cli_available=1
fi
if [[ "$local_cli_available" -eq 1 ]]; then
if [[ "${HYPERTWIST_GITNEXUS_DEBUG_LOCAL:-0}" == "1" ]]; then
if node "$local_gitnexus_cli" status "$@"; then
exit 0
fi
elif node "$local_gitnexus_cli" status "$@" 2>/dev/null; then
exit 0
fi
echo "Local retained GitNexus CLI status failed after passing the runtime probe. Falling back to npx gitnexus@latest." >&2
fi
exec npx -y gitnexus@latest status "$@" 2>/dev/null