Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-harness/blob/main/tools/regen.sh # omega-harness Agent skills for operating, encoding and communicating in Omega (.om) and the AIEN repositories Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-harness / tools / regen.sh` 43 lines ยท 2379 bytes Raw Blame History 1 #!/bin/sh 2 # regen.sh OMC [OMEGA_MCP]: after PIN changes, regenerate everything derived from it. 3 # 4 # Builds tools/jflat.om and tools/guides.om with OMC (its sha256 must be PIN's omc-sha256), finds the 5 # newest omega-mcp commit whose data/reference.json is the reference data for PIN (guides pinof decides), 6 # writes it flattened to data/reference.tsv with its provenance in data/SOURCE, then rewrites every 7 # generated block (`git ls-files | guides gen`). OMEGA_MCP is a clone URL or git directory of omega-mcp: 8 # default the Interplane git repository. Run in the repository root. 9 # This file is invocation glue; the decisions are made by the Omega programs it builds. 10 # Exit 0 regenerated, 1 guides gen reported findings, 2 usage, pin or I/O error. 11 set -u 12 [ "$#" -ge 1 ] || { sed -n '2,10s/^# \{0,1\}//p' "$0" >&2; exit 2; } 13 omc=$1 14 mcp=${2:-} 15 forge=https://interplane.io/projects/omega-mcp/repo.git 16 if [ -z "$mcp" ]; then 17 mcp=$forge 18 fi 19 [ -f PIN ] && [ -d tools ] || { echo "regen: run in the omega-harness root" >&2; exit 2; } 20 want=$(sed -n 's/^omc-sha256 //p' PIN) 21 got=$(sha256sum "$omc" 2>/dev/null | cut -d' ' -f1) 22 [ -n "$want" ] && [ "$got" = "$want" ] || { echo "regen: omc sha256 ${got:-unreadable}, PIN wants $want" >&2; exit 2; } 23 unset GIT_DIR GIT_NAMESPACE GIT_WORK_TREE 24 export GIT_TERMINAL_PROMPT=0 25 tmp=$(mktemp -d) || exit 2 26 trap 'rm -rf "$tmp"' EXIT 27 mkdir -p build 28 for t in jflat guides; do 29 "$omc" < "tools/$t.om" > "build/$t" && chmod +x "build/$t" || { echo "regen: tools/$t.om does not compile" >&2; exit 2; } 30 done 31 git clone -q --bare "$mcp" "$tmp/mcp" || { echo "regen: cannot clone $mcp" >&2; exit 2; } 32 found= 33 for c in $(git --git-dir "$tmp/mcp" log --format=%H main -- data/reference.json); do 34 git --git-dir "$tmp/mcp" show "$c:data/reference.json" > "$tmp/ref.json" || continue 35 build/jflat < "$tmp/ref.json" > "$tmp/ref.tsv" || continue 36 if build/guides pinof < "$tmp/ref.tsv"; then found=$c; break; fi 37 done 38 [ -n "$found" ] || { echo "regen: no omega-mcp commit holds reference data for PIN; generate it there first (omega-mcp tools/gen-reference.py)" >&2; exit 2; } 39 mkdir -p data 40 cp "$tmp/ref.tsv" data/reference.tsv 41 printf 'omega-mcp %s %s data/reference.json sha256 %s\n' "$forge" "$found" "$(sha256sum "$tmp/ref.json" | cut -d' ' -f1)" > data/SOURCE 42 echo "regen: data/reference.tsv from omega-mcp $found" 43 git ls-files | build/guides gen