Sign inSign up

mateuszsjs/devtools:latest

Manifest digest

sha256:1edfd9294da91e6eb124264f20a39dc75265f101deec2c693dee743ad0020ae8

Last pushed

about 1 month by mateuszsjs

Type

Sandbox Kit

Manifest digest

sha256:1edfd9294da91e6eb124264f20a39dc75265f101deec2c693dee743ad0020ae8

yaml
schemaVersion: "2"
kind: mixin
name: devtools
version: 0.1.2
displayName: Dev Toolchain
description: Node/TypeScript, Python, and Go toolchain for coding-agent sandboxes.
permissions:
    network:
        allow:
            - registry.npmjs.org
            - pypi.org
            - files.pythonhosted.org
            - proxy.golang.org
            - sum.golang.org
            - go.dev
            - dl.google.com
            - storage.googleapis.com
            - astral.sh
            - github.com
            - objects.githubusercontent.com
            - ports.ubuntu.com
            - archive.ubuntu.com
            - security.ubuntu.com
            - download.docker.com
environment:
    variables:
        GO_VERSION: 1.26.5
        GOBIN: /home/agent/.local/bin
        GOMODCACHE: /home/agent/go/pkg/mod
        GOPATH: /home/agent/go
        GOTOOLCHAIN: local
        TZ: Europe/Warsaw
setup:
    install:
        - command: |
            set -eu
            npm config set proxy "$HTTP_PROXY"
            npm config set https-proxy "$HTTP_PROXY"
            npm install -g --maxsockets=1 --fetch-timeout=600000 typescript tsx

            if ! command -v corepack >/dev/null 2>&1; then
              npm install -g --maxsockets=1 --fetch-timeout=600000 corepack
            fi

            COREPACK_BIN_DIR="$(npm config get prefix)/bin"
            mkdir -p "$COREPACK_BIN_DIR"
            corepack enable --install-directory "$COREPACK_BIN_DIR"
          user: "1000"
          description: Install TypeScript and tsx, then enable Corepack package-manager shims
        - command: |
            command -v python3 || (apt-get update && apt-get install -y --no-install-recommends
             python3 python3-venv python3-pip)
          user: "0"
          description: Install Python 3 when absent
        - command: |
            command -v uv || curl --proto '=https' --tlsv1.2 -fsSL https://astral.sh/uv/install.sh | sh
          user: "1000"
          description: Install uv package manager when absent
        - command: |
            set -euo pipefail
            if command -v go >/dev/null 2>&1 && [ "$(go env GOVERSION)" = "go${GO_VERSION}" ]; then
              exit 0
            fi

            case "$(dpkg --print-architecture)" in
              amd64)
                GO_ARCH=amd64
                GO_SHA256=5c2c3b16caefa1d968a94c1daca04a7ca301a496d9b086e17ad77bb81393f053
                ;;
              arm64)
                GO_ARCH=arm64
                GO_SHA256=fe4789e92b1f33358680864bbe8704289e7bb5fc207d80623c308935bd696d49
                ;;
              *)
                echo "unsupported sandbox architecture: $(dpkg --print-architecture)" >&2
                exit 1
                ;;
            esac

            GO_TARBALL="go${GO_VERSION}.linux-${GO_ARCH}.tar.gz"
            curl --proto '=https' --tlsv1.2 -fsSL \
              "https://go.dev/dl/${GO_TARBALL}" -o /tmp/go.tgz
            echo "${GO_SHA256}  /tmp/go.tgz" | sha256sum -c -
            rm -rf /usr/local/go
            tar -C /usr/local -xzf /tmp/go.tgz
            rm /tmp/go.tgz
            ln -sf /usr/local/go/bin/go /usr/local/bin/go
            ln -sf /usr/local/go/bin/gofmt /usr/local/bin/gofmt
            go version
          user: "0"
          description: Install pinned Go toolchain