Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
raea cloud: git-credential-raea and repo.sh, a project's Git and media signed in on any machine with no token in its config (CR21, CR22)
shinyobjectz408529cf8387
diff --git a/sdk/cloud/deploy/git/git-credential-raea b/sdk/cloud/deploy/git/git-credential-raeanew file mode 100755index 00000000..a7ba14da--- /dev/null+++ b/sdk/cloud/deploy/git/git-credential-raea@@ -0,0 +1,50 @@+#!/bin/bash+# git-credential-raea: git's sign-in for a raea project (docs/cloud-render.feature CR21, CR22), as a credential+# helper, so no token is ever written into a repo or typed. Git asks it each time it needs one:+# - the host of the repo's .lfsconfig (Git LFS, the media in R2): raea's own token as the password+# - Artifacts (the project's Git): a token for that one repo, minted by raea's server just then (an hour)+# raea's token is RAEA_AGENT_KEY (an agent key with the repos scope: a cloud box), else RAEA_TOKEN, else the device+# token the raea app keeps in the macOS Keychain (service raea, or RAEA_KEYCHAIN). Which repo: git config's+# raea.owner and raea.project (repo.sh sets them; `git -c` passes them to a clone). RAEA_API_ORIGIN names raea's+# server for the repo token (https://raea.io). repo.sh registers it by its absolute path for both hosts.+set -euo pipefail+[ "${1:-}" = get ] || exit 0+api=${RAEA_API_ORIGIN:-https://raea.io}+host=""+while IFS='=' read -r k v; do+ [ -z "$k" ] && break+ [ "$k" = host ] && host=$v+done++token() {+ if [ -n "${RAEA_AGENT_KEY:-}" ]; then printf %s "$RAEA_AGENT_KEY"; return; fi+ if [ -n "${RAEA_TOKEN:-}" ]; then printf %s "$RAEA_TOKEN"; return; fi+ if [ -x /usr/bin/security ]; then /usr/bin/security find-generic-password -s "${RAEA_KEYCHAIN:-raea}" -a device-token -w 2>/dev/null && return; fi+ echo "git-credential-raea: no raea sign-in (RAEA_AGENT_KEY, RAEA_TOKEN or the raea app's Keychain item)" >&2+ exit 1+}++# LFS's host[:port], as git names it: the repo's .lfsconfig says where its media goes+lfs=$(git config --get lfs.url || git config -f "$(git rev-parse --show-toplevel 2>/dev/null)/.lfsconfig" --get lfs.url 2>/dev/null || true)+lfshost=${lfs#*://}; lfshost=${lfshost%%/*}+if [ -n "$lfs" ] && [ "$host" = "$lfshost" ]; then+ echo username=raea+ echo "password=$(token)"+ exit 0+fi++owner=$(git config --get raea.owner || true)+project=$(git config --get raea.project || true)+if [ -z "$owner" ] || [ -z "$project" ]; then+ echo "git-credential-raea: this repo has no raea.owner and raea.project (repo.sh sets them)" >&2+ exit 1+fi+out=$(curl -fsS -m 30 -X POST -H "authorization: Bearer $(token)" -H 'content-type: application/json' \+ -d "{\"scope\":\"${RAEA_REPO_SCOPE:-write}\"}" "$api/v1/repos/$owner/$project/token") || {+ echo "git-credential-raea: raea's server gave no token for $project" >&2+ exit 1+}+t=$(printf %s "$out" | python3 -c 'import json, sys; print(json.load(sys.stdin)["token"])')+echo username=x+# Artifacts takes the token's secret, before ?expires=, as basic auth's password+echo "password=${t%%\?expires=*}"diff --git a/sdk/cloud/deploy/git/repo.sh b/sdk/cloud/deploy/git/repo.shnew file mode 100755index 00000000..f341739c--- /dev/null+++ b/sdk/cloud/deploy/git/repo.sh@@ -0,0 +1,79 @@+#!/bin/bash+# A raea project's repo on raea's servers (docs/cloud-render.feature CR21, CR22): its Git on Artifacts, its media+# through raea's LFS into R2, signed in by git-credential-raea beside this script. The same on a Mac, Linux, a cloud+# box and Windows' Git Bash. RAEA_API_ORIGIN, RAEA_AGENT_KEY / RAEA_TOKEN as git-credential-raea says.+#+# repo.sh create DIR PROJECT DIR (a folder, a git repo or not) becomes PROJECT's repo: made on raea's server if it's+# new, .lfsconfig pointing at raea, media decided by type and size (MEDIA, LARGE as+# the app's host/repo.ts), committed and pushed+# repo.sh clone OWNER PROJECT DIR the project's Git, then its media (git lfs pull)+# repo.sh sign DIR OWNER PROJECT a clone made another way signed in like the above+set -euo pipefail+here=$(cd "$(dirname "$0")" && pwd)+api=${RAEA_API_ORIGIN:-https://raea.io}+# git runs a helper named by its absolute path directly, so a clone keeps working after this script is done+helper=$here/git-credential-raea++call() {+ local t=${RAEA_AGENT_KEY:-${RAEA_TOKEN:-}}+ [ -n "$t" ] || t=$(/usr/bin/security find-generic-password -s "${RAEA_KEYCHAIN:-raea}" -a device-token -w 2>/dev/null) || { echo "repo: no raea sign-in" >&2; exit 1; }+ curl -fsS -m 60 -X "$1" -H "authorization: Bearer $t" -H 'content-type: application/json' ${3:+-d "$3"} "$api$2"+}+field() { python3 -c 'import json, sys; print(json.load(sys.stdin)[sys.argv[1]])' "$1"; }+hostof() { local u=${1#*://}; printf '%s://%s' "${1%%://*}" "${u%%/*}"; }++# git's config for raea in a repo: the helper for both hosts, which project it is, LFS with its locks+sign() {+ local dir=$1 owner=$2 project=$3 remote lfs+ remote=$(git -C "$dir" remote get-url origin)+ lfs=$(git -C "$dir" config -f "$dir/.lfsconfig" --get lfs.url)+ git -C "$dir" config raea.owner "$owner"+ git -C "$dir" config raea.project "$project"+ for h in "$(hostof "$remote")" "$(hostof "$lfs")"; do+ git -C "$dir" config "credential.$h.helper" ""+ git -C "$dir" config --add "credential.$h.helper" "$helper"+ done+ git -C "$dir" lfs install --local >/dev/null+ git -C "$dir" config lfs.locksverify true+}++# media by type, whatever the size, and anything at or over LARGE (host/repo.ts's MEDIA and LARGE)+MEDIA='mp4 mov m4v webm mkv avi mxf mp3 wav aiff aif flac m4a ogg opus caf png jpg jpeg heic heif webp gif tif tiff exr hdr psd blend glb gltf fbx obj usd usdz abc ply splat spz ktx2 ttf otf woff woff2 zip tar gz zst safetensors onnx bin npz npy pdf'+LARGE=$((4 * 1024 * 1024))+track() {+ local dir=$1 f ext+ for ext in $MEDIA; do git -C "$dir" lfs track "*.$ext" >/dev/null; done+ # a big file of another type goes to LFS by its own path+ while IFS= read -r f; do+ git -C "$dir" check-attr filter -- "$f" | grep -q ': lfs$' || git -C "$dir" lfs track --filename "$f" >/dev/null+ done < <(cd "$dir" && find . -type f -size +$((LARGE / 1024 - 1))k -not -path './.git/*' | sed 's|^\./||')+}++case "${1:-}" in+create)+ dir=$2 project=$3+ made=$(call POST /v1/repos "{\"project\":\"$project\"}")+ owner=$(printf %s "$made" | field owner); remote=$(printf %s "$made" | field remote); lfs=$(printf %s "$made" | field lfs)+ [ -d "$dir/.git" ] || git -C "$dir" init -q -b main+ git -C "$dir" remote get-url origin >/dev/null 2>&1 && git -C "$dir" remote set-url origin "$remote" || git -C "$dir" remote add origin "$remote"+ git -C "$dir" config -f "$dir/.lfsconfig" lfs.url "$lfs"+ sign "$dir" "$owner" "$project"+ track "$dir"+ git -C "$dir" add -A+ git -C "$dir" diff --cached --quiet || git -C "$dir" commit -qm "${RAEA_REPO_MESSAGE:-raea: the project with raea}"+ git -C "$dir" push -q -u origin HEAD:main+ echo "repo: $project at $remote, media through $lfs"+ ;;+clone)+ owner=$2 project=$3 dir=$4+ remote=$(call GET /v1/repos | python3 -c 'import json, sys; o, p = sys.argv[1:]; print(next((r["remote"] for r in json.load(sys.stdin)["repos"] if r["owner"] == o and r["project"] == p), ""))' "$owner" "$project")+ [ -n "$remote" ] || { echo "repo: no project $project for $owner here" >&2; exit 1; }+ h=$(hostof "$remote")+ GIT_LFS_SKIP_SMUDGE=1 git -c raea.owner="$owner" -c raea.project="$project" -c "credential.$h.helper=" -c "credential.$h.helper=$helper" clone -q "$remote" "$dir"+ sign "$dir" "$owner" "$project"+ git -C "$dir" lfs pull+ echo "repo: cloned $project into $dir"+ ;;+sign) sign "$2" "$3" "$4" ;;+*) sed -n '2,12p' "$0"; exit 2 ;;+esac