hex/scripts/build-capsule-playground.sh
Kit Langton 428cfeb057 Captures: capsule playground, auto-send countdown, and capture tones
- `hex capsule-playground` (hidden, capture builds) runs the real capsule
  against a fake host: state buttons, the whole flow, loop, slow motion,
  Reduce Motion, the tones, and live tuning that copies back as Rust.
  `scripts/build-capsule-playground.sh` wraps it as Hex Playground.app.
  It touches no Hex data and records or sends nothing.
- A rule's send reads "Auto-sending to X" with the seconds left in a ring,
  a filled Undo chip (esc) that drains over the window, and a quiet Paste;
  then "Sent to X". The Undo window is 5 s (was 3).
- Five capture tones (start, stop, sent, undo, failed) through feedback's
  volume.
- A written capture with no words says "no speech heard".
2026-10-26 21:02:52 -07:00

37 lines
1.6 KiB
Shell
Executable file

#!/bin/sh
# Builds `Hex Playground.app`: the Scrawl capture capsule in a window of its
# own (`hex capsule-playground`), driven by a fake host with live tuning.
# It touches no Hex data, settings, or captures, and records and sends
# nothing, so it runs beside the installed Hex. Ad-hoc signed, for this Mac.
set -eu
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
export MACOSX_DEPLOYMENT_TARGET=15.0
cargo build --locked --release --features capture --bin voice-control --manifest-path "$root/Cargo.toml"
target=${CARGO_TARGET_DIR:-$root/target}
bundle="${HEX_PLAYGROUND_OUT:-$root/target/app}/Hex Playground.app"
rm -rf "$bundle"
mkdir -p "$bundle/Contents/MacOS" "$bundle/Contents/Resources"
cp "$target/release/voice-control" "$bundle/Contents/MacOS/hex"
cat > "$bundle/Contents/MacOS/playground" <<'SH'
#!/bin/sh
exec "$(dirname "$0")/hex" capsule-playground
SH
chmod +x "$bundle/Contents/MacOS/playground"
cat > "$bundle/Contents/Info.plist" <<'PLIST'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key><string>playground</string>
<key>CFBundleIdentifier</key><string>anomaly.hex.playground</string>
<key>CFBundleName</key><string>Hex Playground</string>
<key>CFBundlePackageType</key><string>APPL</string>
<key>CFBundleShortVersionString</key><string>0</string>
<key>NSHighResolutionCapable</key><true/>
</dict>
</plist>
PLIST
codesign --force --sign - "$bundle/Contents/MacOS/hex"
codesign --force --sign - "$bundle"
echo "$bundle"