Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

chore: make readme-3d extraction script work without git-subtree

fudjia4915c681085c
diff --git a/packages/readme-3d/scripts/extract-standalone.sh b/packages/readme-3d/scripts/extract-standalone.sh
index f2ed077af..8787d5246 100755
--- a/packages/readme-3d/scripts/extract-standalone.sh
+++ b/packages/readme-3d/scripts/extract-standalone.sh
@@ -1,17 +1,19 @@
#!/usr/bin/env bash
-# Extract packages/readme-3d into the standalone nirholas/readme-3d repository.
-# Run from the three.ws repo root with gh authenticated as an account that can
-# create repos under nirholas (the codespace token cannot).
+# Publish packages/readme-3d to the standalone nirholas/readme-3d repository.
+# Run from anywhere inside the three.ws repo with credentials that can push
+# to nirholas/readme-3d (the codespace tokens cannot).
#
# bash packages/readme-3d/scripts/extract-standalone.sh
#
# Idempotent: re-running force-updates the standalone main from the current
-# subtree state. After the first run, enable Pages + topics are already set.
+# package state. Uses `git subtree split` when available (preserves per-file
+# history); otherwise exports the tracked files as a fresh snapshot commit.
set -euo pipefail
OWNER=nirholas
REPO=readme-3d
PREFIX=packages/readme-3d
+REMOTE="https://github.com/$OWNER/$REPO.git"
if ! git rev-parse --show-toplevel >/dev/null 2>&1; then
echo "run from inside the three.ws repo" >&2; exit 1
@@ -20,26 +22,41 @@ cd "$(git rev-parse --show-toplevel)"
if ! gh repo view "$OWNER/$REPO" >/dev/null 2>&1; then
gh repo create "$OWNER/$REPO" --public \
- --description "Put interactive, rotatable 3D models in your GitHub README - GLB/glTF/OBJ/STL to the ASCII STL markdown blocks GitHub renders natively. CLI + library + tutorials." \
- --homepage "https://nirholas.github.io/readme-3d/"
+ --description "Put interactive, rotatable 3D models in your GitHub README - GLB/glTF/OBJ/STL to the ASCII STL markdown blocks GitHub renders natively. CLI + library + tutorials." \
+ --homepage "https://nirholas.github.io/readme-3d/"
fi
-echo "splitting subtree $PREFIX ..."
-SPLIT_SHA=$(git subtree split --prefix="$PREFIX" HEAD)
-git push --force "https://github.com/$OWNER/$REPO.git" "$SPLIT_SHA:refs/heads/main"
+if git subtree --help >/dev/null 2>&1; then
+ echo "pushing via git subtree split (full history) ..."
+ SPLIT_SHA=$(git subtree split --prefix="$PREFIX" HEAD)
+ git push --force "$REMOTE" "$SPLIT_SHA:refs/heads/main"
+else
+ echo "git-subtree unavailable; pushing a snapshot commit ..."
+ TMP=$(mktemp -d)
+ trap 'rm -rf "$TMP"' EXIT
+ (cd "$PREFIX" && git ls-files -z . | tar --null -T - -cf - | tar -xf - -C "$TMP")
+ SRC_SHA=$(git rev-parse --short HEAD)
+ (
+ cd "$TMP"
+ git init -q -b main
+ git add -A
+ git commit -qm "readme-3d: sync from three.ws@$SRC_SHA ($PREFIX)"
+ git push --force "$REMOTE" main:main
+ )
+fi
echo "configuring repo metadata ..."
gh api -X PUT "repos/$OWNER/$REPO/topics" \
- -f 'names[]=readme' -f 'names[]=markdown' -f 'names[]=3d' -f 'names[]=stl' \
- -f 'names[]=glb' -f 'names[]=gltf' -f 'names[]=github-readme' -f 'names[]=3d-models' \
- -f 'names[]=mesh-simplification' -f 'names[]=ascii-stl' -f 'names[]=readme-badge' \
- -f 'names[]=claude-skill' >/dev/null
+ -f 'names[]=readme' -f 'names[]=markdown' -f 'names[]=3d' -f 'names[]=stl' \
+ -f 'names[]=glb' -f 'names[]=gltf' -f 'names[]=github-readme' -f 'names[]=3d-models' \
+ -f 'names[]=mesh-simplification' -f 'names[]=ascii-stl' -f 'names[]=readme-badge' \
+ -f 'names[]=claude-skill' >/dev/null
# GitHub Pages from /docs on main (no Actions involved)
gh api -X POST "repos/$OWNER/$REPO/pages" \
- -f 'source[branch]=main' -f 'source[path]=/docs' >/dev/null 2>&1 \
+ -f 'source[branch]=main' -f 'source[path]=/docs' >/dev/null 2>&1 \
|| gh api -X PUT "repos/$OWNER/$REPO/pages" \
- -f 'source[branch]=main' -f 'source[path]=/docs' >/dev/null
+ -f 'source[branch]=main' -f 'source[path]=/docs' >/dev/null
echo "done:"
echo " repo https://github.com/$OWNER/$REPO"