| 1 | #!/usr/bin/env bash |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # Copyright (c) 2026 UtopiaIA |
| 4 | # |
| 5 | # Rebuilds the README's animated logo and terminal recordings in docs/assets. |
| 6 | # The recordings run the real CLI, built from this checkout, in a throwaway |
| 7 | # directory; agg (https://github.com/asciinema/agg) turns them into GIFs. |
| 8 | # Needs cargo, python3, git, jq and agg. |
| 9 | set -euo pipefail |
| 10 | cd "$(dirname "$0")/../.." |
| 11 | |
| 12 | cargo build --release --locked -p elffuss-braid-cli |
| 13 | braid="${CARGO_TARGET_DIR:-target}/release/braid" |
| 14 | work="$(mktemp -d)" |
| 15 | trap 'rm -rf "$work"' EXIT |
| 16 | |
| 17 | python3 scripts/demos/logo.py site/index.html docs/assets/braid-animated.svg |
| 18 | python3 scripts/demos/record.py "$braid" "$work/run" "$work/casts" |
| 19 | |
| 20 | # The site's terminal palette: background, foreground, then the 16 ANSI colors. |
| 21 | theme=0e0f18,eae8f2,1a1b29,e779cf,54dcc6,c8a06a,8272ff,e779cf,54dcc6,eae8f2,7f7ca0,f0a0e0,7fe8d6,dcc08e,a497ff,f0a0e0,7fe8d6,ffffff |
| 22 | for cast in "$work"/casts/*.cast; do |
| 23 | name="$(basename "$cast" .cast)" |
| 24 | agg -q --theme "$theme" --font-size 15 --fps-cap 20 --idle-time-limit 4 \ |
| 25 | --last-frame-duration 4 "$cast" "docs/assets/demo-$name.gif" |
| 26 | echo "docs/assets/demo-$name.gif" |
| 27 | done |