36 lines
1.3 KiB
Plaintext
36 lines
1.3 KiB
Plaintext
|
|
#!/bin/bash
|
||
|
|
# Create a fresh, git-initialized sandbox copy of the Eval (os-vault write-behavior) fixture.
|
||
|
|
# Usage: sandbox <P*-L*|N*-L*> <dest-dir>
|
||
|
|
#
|
||
|
|
# <dest>/project — recursive copy of fixture/project, git-inited with one baseline commit.
|
||
|
|
# <dest>/vault — recursive copy of fixture/vault (the isolated SecondBrain stand-in).
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
SCENARIO="${1:?usage: sandbox <scenario> <dest-dir>}"
|
||
|
|
DEST="${2:?usage: sandbox <scenario> <dest-dir>}"
|
||
|
|
EVAL_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||
|
|
FIXTURE_PROJECT="$EVAL_ROOT/fixture/project"
|
||
|
|
FIXTURE_VAULT="$EVAL_ROOT/fixture/vault"
|
||
|
|
|
||
|
|
# Validate scenario against both the run-set and the frozen reserve-set.
|
||
|
|
if [ ! -f "$EVAL_ROOT/scenarios/${SCENARIO}.md" ] && [ ! -f "$EVAL_ROOT/scenarios-reserve/${SCENARIO}.md" ]; then
|
||
|
|
echo "unknown scenario: $SCENARIO (checked scenarios/ and scenarios-reserve/)" >&2
|
||
|
|
exit 2
|
||
|
|
fi
|
||
|
|
|
||
|
|
if [ -e "$DEST" ]; then echo "refusing to overwrite existing $DEST" >&2; exit 2; fi
|
||
|
|
mkdir -p "$DEST"
|
||
|
|
|
||
|
|
mkdir -p "$DEST/project"
|
||
|
|
cp -r "$FIXTURE_PROJECT/." "$DEST/project/"
|
||
|
|
rm -rf "$DEST/project/.git"
|
||
|
|
|
||
|
|
git -C "$DEST/project" init -q
|
||
|
|
git -C "$DEST/project" add -A
|
||
|
|
git -C "$DEST/project" -c user.email=eval@local -c user.name=eval commit -qm "fixture baseline"
|
||
|
|
|
||
|
|
mkdir -p "$DEST/vault"
|
||
|
|
cp -r "$FIXTURE_VAULT/." "$DEST/vault/"
|
||
|
|
|
||
|
|
echo "$DEST"
|