cloverleaf-larry/bin/route_test
Clover df1810cba7 v0.9.4: short on-PATH commands + live 3-level tab-completion + durable fixture
Make the toolkit usable BY HAND without the `larry tools <name>` prefix.

- bin/ of thin wrappers (tbn/tbp/tbh/tbpr/where/paths/route_test + a full-name
  passthrough per operator tool). Installer symlinks them into LARRY_BIN_DIR so
  `tbn adt` runs directly. Each resolves lib/ via bin/_nc_common.sh
  (LARRY_LIB_DIR -> ../lib -> $LARRY_HOME/lib) and execs the matching tool.
- -h/--help on every wrapper.
- bin/nc-completion.bash: dynamic bash completion, 3 levels (command / SITE /
  THREAD) enumerated LIVE from the NetConfig tree under $HCIROOT via the same
  lib/nc-parse.sh the tools use; cached per (HCIROOT, newest-NetConfig-mtime).
  Installer appends a guarded source line to the user's bash rc.
- fixtures/integrator: durable 3-site demo (epic->ancout->codamx) with cross-
  site fan-out + fan-in and a multi-route inbound. RESOLVES the v0.9.3 fixture
  conflict: cross-site destination blocks are XS_*-prefixed so they never
  collide with a local protocol name (a collision makes nc-paths
  _xsite_down_targets suppress the cross-site hop, lib/nc-paths.sh:378).
- DEFERRED: fetch-token.sh broker wiring (broker contract still finalizing).

VERSION+LARRY_VERSION -> 0.9.4; MANIFEST regenerated (--check clean); bash -n
clean; verified live on .135 (short commands off PATH + all 3 completion levels).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 11:58:25 -07:00

41 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
# route_test — run Cloverleaf route_test for a thread against a message file.
# Short, directly-invokable wrapper over nc-engine.sh route-test.
# NEEDS A LIVE ENGINE (hciroutetest). On a static fixture it dry-prints the cmd.
#
# route_test <thread> <msgfile> # positional (v1 form)
# route_test --source-thread <thread> <msgfile># named form (completes thread)
# route_test --source-thread <thread> --file <msgfile>
#
# Any extra flags (e.g. --dry-run, confirm=yes) pass through to nc-engine.
set -o pipefail
_self="${BASH_SOURCE[0]}"; [ -L "$_self" ] && _self="$(readlink "$_self")"
. "$(cd "$(dirname "$_self")" && pwd)/_nc_common.sh"
if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then
awk 'NR==1{next} /^#/{sub(/^# ?/,""); print; next} {exit}' "${BASH_SOURCE[0]}"
exit 0
fi
lib="$(_nc_resolve_lib)" || { echo "route_test: lib/ toolkit not found (set LARRY_LIB_DIR or LARRY_HOME)" >&2; exit 1; }
# Accept either positional <thread> <file> or the named --source-thread/--file
# forms (the named form is what tab-completion targets). Unrecognized flags are
# collected and passed through to nc-engine route-test.
thread=""; file=""; pass=()
while [ $# -gt 0 ]; do
case "$1" in
--source-thread|--thread) shift; thread="$1" ;;
--file) shift; file="$1" ;;
-*) pass+=("$1") ;;
*) if [ -z "$thread" ]; then thread="$1"
elif [ -z "$file" ]; then file="$1"
else pass+=("$1"); fi ;;
esac
shift
done
[ -n "$thread" ] || { echo "route_test: missing thread (route_test <thread> <msgfile>)" >&2; exit 2; }
[ -n "$file" ] || { echo "route_test: missing message file (route_test <thread> <msgfile>)" >&2; exit 2; }
exec bash "$lib/nc-engine.sh" route-test "$thread" "$file" "${pass[@]}"