Standalone plugin with one skill: when to use orbit and when grep, a mandatory preflight for stale indexes and blind regions (cfg(test), features, macros, dyn dispatch), a scripted review pass over isolated worktree DBs, and a JSONL feedback log for mining real usage later. Registered in the marketplace as a prototype.
23 lines
1.3 KiB
Bash
Executable File
23 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Usage: review-setup.sh <repo> <base-rev> <tip-rev> <review-name>
|
|
# Creates detached worktrees for base and tip under $ORBIT_REVIEW_HOME/worktrees,
|
|
# indexes both into ONE isolated DB ($ORBIT_REVIEW_HOME/<name>.duckdb) with -t 4,
|
|
# and prints env lines to eval. Never touches the shared ~/.gitlab/orbit DB.
|
|
set -euo pipefail
|
|
REPO=$(realpath "$1"); BASE=$2; TIP=$3; NAME=$4
|
|
H=${ORBIT_REVIEW_HOME:-$HOME/.cache/orbit-review}
|
|
DB=$H/$NAME.duckdb; mkdir -p "$H/worktrees" "$H/out"
|
|
B=$(git -C "$REPO" rev-parse "$BASE^{commit}"); T=$(git -C "$REPO" rev-parse "$TIP^{commit}")
|
|
for side in base tip; do
|
|
sha=$([ $side = base ] && echo $B || echo $T)
|
|
wt=$H/worktrees/$NAME-$side
|
|
[ -d "$wt" ] || git -C "$REPO" worktree add --detach --quiet "$wt" "$sha"
|
|
out=$H/out/$NAME-$side.index.json
|
|
orbit index "$wt" -t 4 --db "$DB" > "$out" 2> "$out.log"
|
|
skipped=$(python3 -c "import json,sys;d=json.load(open('$out'));p=d['processing'];print(p['skipped_files']+p.get('errored_files',0))")
|
|
echo "# $side $sha indexed: skipped_files=$skipped ($out)" >&2
|
|
[ "$skipped" = 0 ] || echo "WARNING: $side skipped files; re-run or read them by hand" >&2
|
|
done
|
|
echo "DB=$DB"; echo "BASE_WT=$H/worktrees/$NAME-base"; echo "TIP_WT=$H/worktrees/$NAME-tip"
|
|
echo "BASE_SHA=$B"; echo "TIP_SHA=$T"; echo "REPO=$REPO"
|