Sign inSign up

maidok/t3-workspace-project:1.0.0

Manifest digest

sha256:f7072a696d7dd2d499c79b2e0e8af989772d9b4b865c2af4185169014038d61a

Last pushed

5 days by maidok

Type

Sandbox Kit

Manifest digest

sha256:f7072a696d7dd2d499c79b2e0e8af989772d9b4b865c2af4185169014038d61a

yaml
schemaVersion: "3"
displayName: T3 Code workspace project
description: Registers the sandbox workspace as a T3 Code project, so it is ready to pick as soon as the sandbox is added to T3 Code. Use with the t3code kit.
kind: mixin
capabilities:
    - type: com.docker.sandbox/lifecycle@1
      config:
        startup:
            - 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