๐Ÿ— KeyzHub
19Keys ยท community archive
4018 bytes raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env bash
# HIGH LVL Clipper โ€” verification entrypoint. Fails fast. Run before starting any
# feature and before marking one done. Idempotent; safe to re-run. Does NOT start
# servers, deploy, or post anywhere.
set -euo pipefail
cd "$(dirname "$0")"
FF=/opt/homebrew/opt/ffmpeg-full/bin

echo "โ”€โ”€ HIGH LVL Clipper init โ”€โ”€"

# 1. binaries the render pipeline depends on
[ -x "$FF/ffmpeg" ]  || { echo "โœ— ffmpeg-full missing (brew install ffmpeg-full)"; exit 1; }
[ -x "$FF/ffprobe" ] || { echo "โœ— ffprobe (ffmpeg-full) missing"; exit 1; }
# capture first: `grep -q` in a pipe + pipefail turns SUCCESS into SIGPIPE failure
FILTERS=$("$FF/ffmpeg" -hide_banner -filters 2>/dev/null)
grep -q " ass " <<<"$FILTERS" || { echo "โœ— ffmpeg lacks libass (need ffmpeg-full, not slim)"; exit 1; }
command -v node >/dev/null || { echo "โœ— node missing (need >=22 for engines)"; exit 1; }
NODE_MAJ=$(node -e 'console.log(process.versions.node.split(".")[0])')
[ "$NODE_MAJ" -ge 22 ] || { echo "โœ— node $NODE_MAJ too old (HyperFrames needs >=22)"; exit 1; }
echo "  โœ“ ffmpeg-full (libass) + ffprobe + node $NODE_MAJ"

# 2. python static check โ€” server + every tool + atomizer must compile
python3 -m py_compile dashboard/server.py dashboard/inspiration.py dashboard/tribe.py \
  tools/luxury_render.py tools/motion_render.py tools/hyperframes_render.py \
  tools/reframe.py tools/style_render.py tools/quote_cards.py tools/quote_reel_overlay.py \
  tools/fonts.py \
  atomizer/*.py
echo "  โœ“ python compiles clean"

# 3. dashboard inline JS must parse (single-file UI โ€” a typo kills every tab)
node -e '
const fs=require("fs");
const html=fs.readFileSync("dashboard/index.html","utf8");
const scripts=[...html.matchAll(/<script>([\s\S]*?)<\/script>/g)].map(m=>m[1]).join("\n");
new Function(scripts);' || { echo "โœ— index.html inline JS has a syntax error"; exit 1; }
echo "  โœ“ dashboard JS parses"

# 4. isolated venvs + assets
tools/reframe-venv/bin/python -c "import cv2" 2>/dev/null \
  || { echo "โœ— reframe-venv broken (uv pip install --python tools/reframe-venv/bin/python 'opencv-python-headless<5' numpy)"; exit 1; }
[ -x tools/video-use/.venv/bin/python ] || echo "  โš  video-use venv missing (transcription will fail โ€” see tools/video-use/install.md)"
for lut in cool warm natural; do
  [ -f "tools/luts/$lut.cube" ] || { echo "โœ— missing LUT tools/luts/$lut.cube"; exit 1; }
done
echo "  โœ“ venvs + 3 LUTs present"

# 5. iron rule #2 guard: fail if runtime dirs drifted back onto iCloud-managed paths
if grep -q 'Path.home() / "Desktop"' dashboard/server.py; then
  echo "โœ— server.py references ~/Desktop for runtime data (iCloud eviction hazard โ€” see AGENTS.md rule 2)"; exit 1
fi
echo "  โœ“ no iCloud-managed runtime paths"

# 6. health (informational โ€” never fails the gate)
TOKEN=$(grep -E '^STUDIO_TOKEN=' .env 2>/dev/null | tail -1 | cut -d= -f2- || true)
if [ -n "${TOKEN:-}" ]; then
  L=$(curl -s -o /dev/null -w "%{http_code}" --max-time 3 "http://127.0.0.1:5192/api/library?k=$TOKEN" || true)
  P=$(curl -s -o /dev/null -w "%{http_code}" --max-time 8 "https://clipper.highlvl.ai/" || true)
  # public: the Mini has its OWN token โ€” a 401 here means edge+tunnel+server are all UP and gating
  case "$P" in 200|401) PSTATE="up" ;; *) PSTATE="DOWN($P)" ;; esac
  echo "  โ„น local studio: ${L:-down} ยท public link: $PSTATE (start local: HOST=127.0.0.1 PORT=5192 STUDIO_TOKEN=โ€ฆ python3 dashboard/server.py)"
fi

echo ""
echo "Ready. Next steps:"
echo "  1. Read feature_list.json โ€” pick ONE feature (respect dependencies/blocked)."
echo "  2. Read the top entry of progress.md for Current State."
echo "  3. Deploy to the Mini ONLY via ./ops/deploy-mini.sh (health-gated, auto-rollback)."
echo ""
echo "Definition of done: this gate passes AND the change is exercised for real โ€” render,"
echo "ffprobe it, extract frames and LOOK at them. Paste command+output as Verification"
echo "Evidence into progress.md, set the feature status. Leave the tree clean."