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