sha256:5654a77cc6d00be56cead01252c924fa8d4bf58dc0fcec507765238c031ee3dd
Last pushed
9 days by maidok
Type
Sandbox Kit
Manifest digest
sha256:5654a77cc6d00be56cead01252c924fa8d4bf58dc0fcec507765238c031ee3dd
schemaVersion: "3"
displayName: T3 Code workspace project
description: Registers the sandbox workspace as a T3 Code project, defaults new threads to a worktree, and routes GitHub SSH remotes over HTTPS, so T3 Code can start work right away. Use with the t3code kit.
kind: mixin
capabilities:
- type: com.docker.sandbox/lifecycle@1
config:
startup:
- command:
- sh
- -c
- |
# The sandbox proxy blocks SSH (port 22), so T3's `git fetch` on a
# [email protected]: origin fails. Rewrite to HTTPS and let gh supply
# the token. Idempotent: values are reset before being added.
command -v gh >/dev/null 2>&1 || { echo "gh not found; skipping"; exit 0; }
git config --global --unset-all url.https://github.com/.insteadOf 2>/dev/null || true
git config --global --add url.https://github.com/.insteadOf [email protected]:
git config --global --add url.https://github.com/.insteadOf ssh://[email protected]/
git config --global --unset-all credential.https://github.com.helper 2>/dev/null || true
git config --global --add credential.https://github.com.helper ''
git config --global --add credential.https://github.com.helper '!gh auth git-credential'
echo "GitHub remotes now use HTTPS with gh credentials"
description: Route GitHub SSH remotes over HTTPS via gh
- command:
- sh
- -c
- |
# Server settings live in the t3 base dir (~/.t3, as passed by
# T3 Code's SSH launch). Merge rather than overwrite so settings
# changed in the UI survive. Re-applied every boot.
f="$HOME/.t3/userdata/settings.json"
mkdir -p "$(dirname "$f")"
if [ ! -s "$f" ]; then
printf '{\n "defaultThreadEnvMode": "worktree"\n}\n' > "$f"
elif command -v jq >/dev/null 2>&1; then
tmp="$f.tmp.$$"
jq '.defaultThreadEnvMode = "worktree"' "$f" > "$tmp" && mv "$tmp" "$f" || { rm -f "$tmp"; exit 1; }
else
echo "jq not found; leaving existing $f unchanged"; exit 0
fi
echo "T3 Code new threads default to a worktree"
description: Default new T3 Code threads to a worktree
- command:
- sh
- -c
- |
dir="${WORKSPACE_DIR:-}"
[ -n "$dir" ] || { echo "WORKSPACE_DIR is not set; skipping"; exit 0; }
# Clone-mode sandboxes may still be populating the workspace.
i=0; while [ ! -d "$dir" ] && [ "$i" -lt 60 ]; do sleep 1; i=$((i+1)); done
# The t3code kit's `t3` launcher is a node script, and agent images
# may not ship node, so call the bundled native binary directly.
t3=$(ls /opt/t3/lib/node_modules/t3/node_modules/@t3code/t3-linux-*/t3 2>/dev/null | head -n1)
[ -x "$t3" ] || t3=$(command -v t3 || true)
[ -n "$t3" ] || { echo "t3 not found; add the t3code kit"; exit 0; }
out=$("$t3" project add --title "$(basename "$dir")" "$dir" 2>&1) && { echo "Added T3 project for $dir"; exit 0; }
case "$out" in
*ProjectAlreadyExistsError*) echo "T3 project for $dir already exists" ;;
*) printf '%s\n' "$out" >&2; exit 1 ;;
esac
description: Register the workspace as a T3 Code project
env:
- WORKSPACE_DIR