sbx-kits/grain-toolchainpublic Fork
⑂ bb06360
Commits
⬇ Clone ▾
git clone https://git.rickub.com/sbx-kits/grain-toolchain.git
git clone ssh://git@rickub.com/sbx-kits/grain-toolchain.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

🛟 Updated.

k33g committed 2026-11-29T09:17:08+01:00 Browse files
bb06360
added .vscode/extensions.json +9 -0
new file mode 100644
@@ -0,0 +1,9 @@
1+{
2+ "recommendations": [
3+ "ms-azuretools.vscode-docker",
4+ "pkief.material-icon-theme",
5+ "pkief.material-product-icons",
6+ "aaron-bond.better-comments",
7+ "bierner.markdown-mermaid",
8+ ]
9+}
\ No newline at end of file
new file mode 100644
@@ -0,0 +1,9 @@
1+{
2+ "recommendations": [
3+ "ms-azuretools.vscode-docker",
4+ "pkief.material-icon-theme",
5+ "pkief.material-product-icons",
6+ "aaron-bond.better-comments",
7+ "bierner.markdown-mermaid",
8+ ]
9+}
\ No newline at end of file\ No newline at end of file
added .vscode/settings.json +63 -0
new file mode 100644
@@ -0,0 +1,63 @@
1+{
2+ "workbench.iconTheme": "material-icon-theme",
3+ "workbench.colorTheme": "Light Modern",
4+ "editor.fontSize": 14,
5+ "terminal.integrated.fontSize": 14,
6+ "editor.insertSpaces": true,
7+ "editor.tabSize": 4,
8+ "editor.detectIndentation": true,
9+ "files.autoSave": "afterDelay",
10+ "files.autoSaveDelay": 1000,
11+ // "editor.defaultFormatter": "esbenp.prettier-vscode",
12+ "editor.formatOnSave": true,
13+ "workbench.tree.indent": 20,
14+ //"workbench.activityBar.location": "top",
15+ "workbench.editor.showTabs": "multiple",
16+ "window.zoomLevel": 0.0,
17+ "[markdown]": {
18+ "editor.unicodeHighlight.ambiguousCharacters": false,
19+ "editor.unicodeHighlight.invisibleCharacters": false,
20+ "diffEditor.ignoreTrimWhitespace": false,
21+ "editor.fontWeight": "normal",
22+ "editor.fontFamily": "'Droid Sans Mono', 'monospace', monospace",
23+ "editor.fontSize": 14,
24+ "editor.wordWrap": "on",
25+ "editor.quickSuggestions": {
26+ "comments": "off",
27+ "strings": "off",
28+ "other": "off"
29+ }
30+ },
31+ "markdown.preview.fontSize": 14,
32+ // "workbench.editorAssociations": {
33+ // "*.md": "vscode.markdown.preview.editor"
34+ // },
35+ "markdown.marp.html": "all",
36+ "[dockerfile]": {
37+ "editor.fontSize": 14
38+ },
39+ "[dockercompose]": {
40+ "editor.fontSize": 14
41+ },
42+ "[json]": {
43+ "editor.fontSize": 14
44+ },
45+ "[yaml]": {
46+ "editor.fontSize": 14
47+ },
48+ "[go]": {
49+ "editor.fontSize": 14,
50+ "editor.codeActionsOnSave": {
51+ "source.organizeImports": "explicit"
52+ }
53+ },
54+ "go.lintTool": "golangci-lint",
55+ "go.lintOnSave": "package",
56+ "go.formatTool": "goimports",
57+ "go.useLanguageServer": true,
58+ "gopls": {
59+ "ui.semanticTokens": true,
60+ "ui.completion.usePlaceholders": true
61+ },
62+ "issuespec.groupBy": "milestone"
63+}
\ No newline at end of file
new file mode 100644
@@ -0,0 +1,63 @@
1+{
2+ "workbench.iconTheme": "material-icon-theme",
3+ "workbench.colorTheme": "Light Modern",
4+ "editor.fontSize": 14,
5+ "terminal.integrated.fontSize": 14,
6+ "editor.insertSpaces": true,
7+ "editor.tabSize": 4,
8+ "editor.detectIndentation": true,
9+ "files.autoSave": "afterDelay",
10+ "files.autoSaveDelay": 1000,
11+ // "editor.defaultFormatter": "esbenp.prettier-vscode",
12+ "editor.formatOnSave": true,
13+ "workbench.tree.indent": 20,
14+ //"workbench.activityBar.location": "top",
15+ "workbench.editor.showTabs": "multiple",
16+ "window.zoomLevel": 0.0,
17+ "[markdown]": {
18+ "editor.unicodeHighlight.ambiguousCharacters": false,
19+ "editor.unicodeHighlight.invisibleCharacters": false,
20+ "diffEditor.ignoreTrimWhitespace": false,
21+ "editor.fontWeight": "normal",
22+ "editor.fontFamily": "'Droid Sans Mono', 'monospace', monospace",
23+ "editor.fontSize": 14,
24+ "editor.wordWrap": "on",
25+ "editor.quickSuggestions": {
26+ "comments": "off",
27+ "strings": "off",
28+ "other": "off"
29+ }
30+ },
31+ "markdown.preview.fontSize": 14,
32+ // "workbench.editorAssociations": {
33+ // "*.md": "vscode.markdown.preview.editor"
34+ // },
35+ "markdown.marp.html": "all",
36+ "[dockerfile]": {
37+ "editor.fontSize": 14
38+ },
39+ "[dockercompose]": {
40+ "editor.fontSize": 14
41+ },
42+ "[json]": {
43+ "editor.fontSize": 14
44+ },
45+ "[yaml]": {
46+ "editor.fontSize": 14
47+ },
48+ "[go]": {
49+ "editor.fontSize": 14,
50+ "editor.codeActionsOnSave": {
51+ "source.organizeImports": "explicit"
52+ }
53+ },
54+ "go.lintTool": "golangci-lint",
55+ "go.lintOnSave": "package",
56+ "go.formatTool": "goimports",
57+ "go.useLanguageServer": true,
58+ "gopls": {
59+ "ui.semanticTokens": true,
60+ "ui.completion.usePlaceholders": true
61+ },
62+ "issuespec.groupBy": "milestone"
63+}
\ No newline at end of file\ No newline at end of file
added README.md +27 -0
new file mode 100644
@@ -0,0 +1,27 @@
1+# Grain toolchain kit for sbx
2+
3+A kit v3 mixin (`# syntax=docker/sandbox-kit:3`) that copies the official release binary
4+(`grain-linux-{x64,arm64}.tar.gz`) to `/usr/local/bin/grain`, plus agent context
5+(`grain-context.md`).
6+
7+```bash
8+# local build (multi-arch, no emulation needed)
9+docker buildx build -f grain-toolchain.yaml -t grain-toolchain-kit:dev .
10+
11+# publish
12+docker buildx build --platform linux/amd64,linux/arm64 \
13+ -f grain-toolchain.yaml \
14+ -t docker.io/k33g/grain-toolchain-kit:0.7.3 --push .
15+```
16+
17+Use it in `sbxenv.yaml`:
18+
19+```yaml
20+kits:
21+ - docker.io/k33g/go-toolchain-kit:0.2.0
22+ - ./kits/grain-toolchain # local build at each create
23+ # - docker.io/k33g/grain-toolchain-kit:0.7.3 # once published
24+```
25+
26+Another Grain version: `--kit-arg grain_version=<x.y.z>` (or `args:` in `sbxenv.yaml`). Note: arm64 binaries only exist starting with 0.7.3.
27+
new file mode 100644
@@ -0,0 +1,27 @@
1+# Grain toolchain kit for sbx
2+
3+A kit v3 mixin (`# syntax=docker/sandbox-kit:3`) that copies the official release binary
4+(`grain-linux-{x64,arm64}.tar.gz`) to `/usr/local/bin/grain`, plus agent context
5+(`grain-context.md`).
6+
7+```bash
8+# local build (multi-arch, no emulation needed)
9+docker buildx build -f grain-toolchain.yaml -t grain-toolchain-kit:dev .
10+
11+# publish
12+docker buildx build --platform linux/amd64,linux/arm64 \
13+ -f grain-toolchain.yaml \
14+ -t docker.io/k33g/grain-toolchain-kit:0.7.3 --push .
15+```
16+
17+Use it in `sbxenv.yaml`:
18+
19+```yaml
20+kits:
21+ - docker.io/k33g/go-toolchain-kit:0.2.0
22+ - ./kits/grain-toolchain # local build at each create
23+ # - docker.io/k33g/grain-toolchain-kit:0.7.3 # once published
24+```
25+
26+Another Grain version: `--kit-arg grain_version=<x.y.z>` (or `args:` in `sbxenv.yaml`). Note: arm64 binaries only exist starting with 0.7.3.
27+
added demo/sbxenv.yaml +14 -0
new file mode 100644
@@ -0,0 +1,14 @@
1+schemaVersion: "1"
2+
3+name: grain-dev-env
4+
5+agent: shell
6+
7+workspace: .
8+
9+kits:
10+ - docker.io/k33g/grain-toolchain-kit:0.7.3
11+
12+# sbx env create # shows the plan and asks for confirmation (--force to skip)
13+# sbx env run # re-attach (creates the sandbox first if it does not exist)
14+# sbx env rm # delete the sandbox
new file mode 100644
@@ -0,0 +1,14 @@
1+schemaVersion: "1"
2+
3+name: grain-dev-env
4+
5+agent: shell
6+
7+workspace: .
8+
9+kits:
10+ - docker.io/k33g/grain-toolchain-kit:0.7.3
11+
12+# sbx env create # shows the plan and asks for confirmation (--force to skip)
13+# sbx env run # re-attach (creates the sandbox first if it does not exist)
14+# sbx env rm # delete the sandbox
added git.sh +136 -0
new file mode 100755
@@ -0,0 +1,136 @@
1+#!/bin/bash
2+message=""
3+case $1 in
4+
5+ # 🎨: art
6+ art)
7+ message="Improve structure / format of the code"
8+ emoji="🎨"
9+ ;;
10+
11+ # 🐛: bug
12+ bug|fix)
13+ message="Fix a bug"
14+ emoji="🐛"
15+ ;;
16+
17+ # 🤓: geek
18+ human|human-fixed)
19+ message="Human Fixed"
20+ emoji="🤓"
21+ ;;
22+
23+ # 🤖: robot
24+ ai|ai-generated)
25+ message="AI generated"
26+ emoji="🤖"
27+ ;;
28+
29+ # ✨: sparkles
30+ sparkles|feature)
31+ message="Introduce new feature(s)"
32+ emoji="✨"
33+ ;;
34+
35+ # 🧩: jigsaw
36+ jigsaw|example|examples|demo|demos)
37+ message="Introduce new example(s)"
38+ emoji="🧩"
39+ ;;
40+
41+
42+ # 📝: memo
43+ memo|doc|documentation)
44+ message="Add or update documentation"
45+ emoji="📝"
46+ ;;
47+
48+ # 🌸: cherry_blossom
49+ gardening|garden|clean|cleaning)
50+ message="Gardening"
51+ emoji="🌸"
52+ ;;
53+
54+ # 🚀: rocket
55+ rocket|deploy)
56+ message="Deploy stuff"
57+ emoji="🚀"
58+ ;;
59+
60+ # 🎉: tada
61+ tada|first)
62+ message="Begin a project"
63+ emoji="🎉"
64+ ;;
65+
66+ # 🚧: construction
67+ construction|wip)
68+ message="Work in progress"
69+ emoji="🚧"
70+ ;;
71+
72+ # 📦️: package
73+ package|build)
74+ message="Add or update compiled files or packages"
75+ emoji="📦️"
76+ ;;
77+
78+ # 📦️: package
79+ release)
80+ message="Create a release"
81+ emoji="📦️"
82+ ;;
83+
84+ # 👽️: alien
85+ alien|api)
86+ message="Update code due to external API changes"
87+ emoji="👽️"
88+ ;;
89+
90+ # 🐳: whale
91+ docker|container)
92+ message="Docker"
93+ emoji="🐳"
94+ ;;
95+
96+ # 🍊: tangerine
97+ gitpod|gitpodify)
98+ message="Gitpodify"
99+ emoji="🍊"
100+ ;;
101+
102+ # 🧪: test tube
103+ alembic|experiments|experiment|xp)
104+ message="Perform experiments"
105+ emoji="🧪"
106+ ;;
107+
108+ # ✅: check mark
109+ test|tests|testing)
110+ message="Add or update tests"
111+ emoji="✅"
112+ ;;
113+
114+ # 💾: floppy-disk
115+ save)
116+ message="Saved"
117+ emoji="💾"
118+ ;;
119+
120+ *)
121+ message="Updated"
122+ emoji="🛟"
123+ ;;
124+
125+esac
126+
127+find . -name '.DS_Store' -type f -delete
128+
129+if [ -z "$2" ]
130+then
131+ # empty
132+ git add .; git commit -m "$emoji $message."; git push
133+else
134+ # not empty
135+ git add .; git commit -m "$emoji $message: $2"; git push
136+fi
new file mode 100755
@@ -0,0 +1,136 @@
1+#!/bin/bash
2+message=""
3+case $1 in
4+
5+ # 🎨: art
6+ art)
7+ message="Improve structure / format of the code"
8+ emoji="🎨"
9+ ;;
10+
11+ # 🐛: bug
12+ bug|fix)
13+ message="Fix a bug"
14+ emoji="🐛"
15+ ;;
16+
17+ # 🤓: geek
18+ human|human-fixed)
19+ message="Human Fixed"
20+ emoji="🤓"
21+ ;;
22+
23+ # 🤖: robot
24+ ai|ai-generated)
25+ message="AI generated"
26+ emoji="🤖"
27+ ;;
28+
29+ # ✨: sparkles
30+ sparkles|feature)
31+ message="Introduce new feature(s)"
32+ emoji="✨"
33+ ;;
34+
35+ # 🧩: jigsaw
36+ jigsaw|example|examples|demo|demos)
37+ message="Introduce new example(s)"
38+ emoji="🧩"
39+ ;;
40+
41+
42+ # 📝: memo
43+ memo|doc|documentation)
44+ message="Add or update documentation"
45+ emoji="📝"
46+ ;;
47+
48+ # 🌸: cherry_blossom
49+ gardening|garden|clean|cleaning)
50+ message="Gardening"
51+ emoji="🌸"
52+ ;;
53+
54+ # 🚀: rocket
55+ rocket|deploy)
56+ message="Deploy stuff"
57+ emoji="🚀"
58+ ;;
59+
60+ # 🎉: tada
61+ tada|first)
62+ message="Begin a project"
63+ emoji="🎉"
64+ ;;
65+
66+ # 🚧: construction
67+ construction|wip)
68+ message="Work in progress"
69+ emoji="🚧"
70+ ;;
71+
72+ # 📦️: package
73+ package|build)
74+ message="Add or update compiled files or packages"
75+ emoji="📦️"
76+ ;;
77+
78+ # 📦️: package
79+ release)
80+ message="Create a release"
81+ emoji="📦️"
82+ ;;
83+
84+ # 👽️: alien
85+ alien|api)
86+ message="Update code due to external API changes"
87+ emoji="👽️"
88+ ;;
89+
90+ # 🐳: whale
91+ docker|container)
92+ message="Docker"
93+ emoji="🐳"
94+ ;;
95+
96+ # 🍊: tangerine
97+ gitpod|gitpodify)
98+ message="Gitpodify"
99+ emoji="🍊"
100+ ;;
101+
102+ # 🧪: test tube
103+ alembic|experiments|experiment|xp)
104+ message="Perform experiments"
105+ emoji="🧪"
106+ ;;
107+
108+ # ✅: check mark
109+ test|tests|testing)
110+ message="Add or update tests"
111+ emoji="✅"
112+ ;;
113+
114+ # 💾: floppy-disk
115+ save)
116+ message="Saved"
117+ emoji="💾"
118+ ;;
119+
120+ *)
121+ message="Updated"
122+ emoji="🛟"
123+ ;;
124+
125+esac
126+
127+find . -name '.DS_Store' -type f -delete
128+
129+if [ -z "$2" ]
130+then
131+ # empty
132+ git add .; git commit -m "$emoji $message."; git push
133+else
134+ # not empty
135+ git add .; git commit -m "$emoji $message: $2"; git push
136+fi
added grain-context.md +27 -0
new file mode 100644
@@ -0,0 +1,27 @@
1+# Grain toolchain
2+
3+`grain` (Grain language compiler, see https://grain-lang.org/docs) is on PATH
4+at `/usr/local/bin/grain`. Check the version with `grain --version`.
5+
6+## Common commands
7+
8+- `grain main.gr` — compile and run (runs the module with the bundled runtime).
9+- `grain compile main.gr -o main.wasm` — compile to WebAssembly.
10+ - `--release` optimised build, `--wat` also emits a `.wat` file.
11+ - `--no-wasm-tail-call` if the target runtime has no tail-call support.
12+ - `--import-memory`, `--initial-memory-pages`, `--maximum-memory-pages`.
13+- `grain format file.gr` (`--write` / `-o`), `grain doc file.gr`.
14+- `grain lsp` — language server over stdio.
15+
16+## Notes for host integration
17+
18+- Compiled modules import `wasi_snapshot_preview1` and export `memory`,
19+ `_start` (runs the module top level — call it once) and every `provide`d
20+ function.
21+- `Number` parameters are tagged values: an integer `n` is passed as
22+ `(n << 1) | 1`. Use `@unsafe` functions typed with `WasmI32`/`WasmI64` to
23+ get raw wasm values.
24+- Grain emits tail calls (`return_call`): with wazero enable
25+ `experimental.CoreFeaturesTailCall`, or compile with `--no-wasm-tail-call`.
26+- v0.7.x ("Farro") uses linear memory with reference counting; v0.8 moves to
27+ WebAssembly GC, so low-level memory code will change.
new file mode 100644
@@ -0,0 +1,27 @@
1+# Grain toolchain
2+
3+`grain` (Grain language compiler, see https://grain-lang.org/docs) is on PATH
4+at `/usr/local/bin/grain`. Check the version with `grain --version`.
5+
6+## Common commands
7+
8+- `grain main.gr` — compile and run (runs the module with the bundled runtime).
9+- `grain compile main.gr -o main.wasm` — compile to WebAssembly.
10+ - `--release` optimised build, `--wat` also emits a `.wat` file.
11+ - `--no-wasm-tail-call` if the target runtime has no tail-call support.
12+ - `--import-memory`, `--initial-memory-pages`, `--maximum-memory-pages`.
13+- `grain format file.gr` (`--write` / `-o`), `grain doc file.gr`.
14+- `grain lsp` — language server over stdio.
15+
16+## Notes for host integration
17+
18+- Compiled modules import `wasi_snapshot_preview1` and export `memory`,
19+ `_start` (runs the module top level — call it once) and every `provide`d
20+ function.
21+- `Number` parameters are tagged values: an integer `n` is passed as
22+ `(n << 1) | 1`. Use `@unsafe` functions typed with `WasmI32`/`WasmI64` to
23+ get raw wasm values.
24+- Grain emits tail calls (`return_call`): with wazero enable
25+ `experimental.CoreFeaturesTailCall`, or compile with `--no-wasm-tail-call`.
26+- v0.7.x ("Farro") uses linear memory with reference counting; v0.8 moves to
27+ WebAssembly GC, so low-level memory code will change.
added grain-toolchain.dockerfile +46 -0
new file mode 100644
@@ -0,0 +1,46 @@
1+# syntax=docker/dockerfile:1
2+
3+# --- build stage: download the prebuilt Grain binary ------------------------
4+# Runs on the build platform: it only downloads the target-arch binary, so
5+# multi-arch builds need no emulation.
6+FROM --platform=$BUILDPLATFORM debian:trixie-slim AS build
7+ARG GRAIN_VERSION
8+ARG TARGETARCH
9+ARG BUILDARCH
10+
11+# A heredoc RUN does not stop at the first failing line by itself: every
12+# script starts with `set -eu`.
13+RUN <<EOF
14+set -eu
15+apt-get update
16+# libstdc++6: only needed to run the version check below.
17+apt-get install -y --no-install-recommends curl ca-certificates libstdc++6
18+rm -rf /var/lib/apt/lists/*
19+EOF
20+
21+# Release assets are named grain-linux-{x64,arm64}.tar.gz (arm64 since 0.7.3).
22+RUN <<EOF
23+set -eu
24+case "${TARGETARCH}" in
25+ amd64) arch=x64 ;;
26+ arm64) arch=arm64 ;;
27+ *) echo "unsupported TARGETARCH: ${TARGETARCH}" >&2; exit 1 ;;
28+esac
29+mkdir -p /out/usr/local/bin
30+curl -fsSL "https://github.com/grain-lang/grain/releases/download/grain-v${GRAIN_VERSION}/grain-linux-${arch}.tar.gz" \
31+ | tar -xz -C /out/usr/local/bin grain
32+chmod 0755 /out/usr/local/bin/grain
33+# The tarball keeps the CI runner uid: hand the tree to root.
34+chown -R 0:0 /out
35+# Every pin is a claim about content: fail on a version mismatch.
36+# (Skipped when cross-building.)
37+if [ "${TARGETARCH}" = "${BUILDARCH}" ]; then
38+ /out/usr/local/bin/grain --version | grep -qx "${GRAIN_VERSION}"
39+fi
40+EOF
41+
42+# --- overlay: only the grain binary lands on the workload -------------------
43+# The binary is dynamically linked against glibc + libstdc++, both present on
44+# the Debian-based agent workloads.
45+FROM scratch
46+COPY --from=build /out/ /
new file mode 100644
@@ -0,0 +1,46 @@
1+# syntax=docker/dockerfile:1
2+
3+# --- build stage: download the prebuilt Grain binary ------------------------
4+# Runs on the build platform: it only downloads the target-arch binary, so
5+# multi-arch builds need no emulation.
6+FROM --platform=$BUILDPLATFORM debian:trixie-slim AS build
7+ARG GRAIN_VERSION
8+ARG TARGETARCH
9+ARG BUILDARCH
10+
11+# A heredoc RUN does not stop at the first failing line by itself: every
12+# script starts with `set -eu`.
13+RUN <<EOF
14+set -eu
15+apt-get update
16+# libstdc++6: only needed to run the version check below.
17+apt-get install -y --no-install-recommends curl ca-certificates libstdc++6
18+rm -rf /var/lib/apt/lists/*
19+EOF
20+
21+# Release assets are named grain-linux-{x64,arm64}.tar.gz (arm64 since 0.7.3).
22+RUN <<EOF
23+set -eu
24+case "${TARGETARCH}" in
25+ amd64) arch=x64 ;;
26+ arm64) arch=arm64 ;;
27+ *) echo "unsupported TARGETARCH: ${TARGETARCH}" >&2; exit 1 ;;
28+esac
29+mkdir -p /out/usr/local/bin
30+curl -fsSL "https://github.com/grain-lang/grain/releases/download/grain-v${GRAIN_VERSION}/grain-linux-${arch}.tar.gz" \
31+ | tar -xz -C /out/usr/local/bin grain
32+chmod 0755 /out/usr/local/bin/grain
33+# The tarball keeps the CI runner uid: hand the tree to root.
34+chown -R 0:0 /out
35+# Every pin is a claim about content: fail on a version mismatch.
36+# (Skipped when cross-building.)
37+if [ "${TARGETARCH}" = "${BUILDARCH}" ]; then
38+ /out/usr/local/bin/grain --version | grep -qx "${GRAIN_VERSION}"
39+fi
40+EOF
41+
42+# --- overlay: only the grain binary lands on the workload -------------------
43+# The binary is dynamically linked against glibc + libstdc++, both present on
44+# the Debian-based agent workloads.
45+FROM scratch
46+COPY --from=build /out/ /
added grain-toolchain.yaml +38 -0
new file mode 100644
@@ -0,0 +1,38 @@
1+# syntax=docker/sandbox-kit:3
2+schemaVersion: "3"
3+kind: mixin
4+displayName: Grain toolchain
5+description: >-
6+ Grain compiler (grain compile/run/format/doc/lsp) from the official
7+ GitHub release, for building WebAssembly modules inside a sandbox.
8+sourceUrl: https://github.com/grain-lang/grain
9+licenses: [LGPL-3.0-only]
10+version: "0.7.3"
11+
12+args:
13+ grain_version:
14+ default: "0.7.3"
15+ pattern: '^[0-9]+\.[0-9]+\.[0-9]+$'
16+ description: Grain release to install (tag grain-v<version>)
17+ buildArg: GRAIN_VERSION
18+
19+provides:
20+ - "grain@${{ kit.args.grain_version }}"
21+
22+capabilities:
23+ # The compiler itself is offline (stdlib and Binaryen are bundled in the
24+ # binary). GitHub is only reached to read docs / release notes.
25+ - type: com.docker.sandbox/network-policy@1
26+ config:
27+ runtime:
28+ allow:
29+ - github.com
30+ - objects.githubusercontent.com
31+ - grain-lang.org
32+
33+ - type: com.docker.sandbox/agent-context@1
34+ optional: true
35+ config:
36+ contentFile: ./grain-context.md
37+
38+dockerfile: grain-toolchain.dockerfile
new file mode 100644
@@ -0,0 +1,38 @@
1+# syntax=docker/sandbox-kit:3
2+schemaVersion: "3"
3+kind: mixin
4+displayName: Grain toolchain
5+description: >-
6+ Grain compiler (grain compile/run/format/doc/lsp) from the official
7+ GitHub release, for building WebAssembly modules inside a sandbox.
8+sourceUrl: https://github.com/grain-lang/grain
9+licenses: [LGPL-3.0-only]
10+version: "0.7.3"
11+
12+args:
13+ grain_version:
14+ default: "0.7.3"
15+ pattern: '^[0-9]+\.[0-9]+\.[0-9]+$'
16+ description: Grain release to install (tag grain-v<version>)
17+ buildArg: GRAIN_VERSION
18+
19+provides:
20+ - "grain@${{ kit.args.grain_version }}"
21+
22+capabilities:
23+ # The compiler itself is offline (stdlib and Binaryen are bundled in the
24+ # binary). GitHub is only reached to read docs / release notes.
25+ - type: com.docker.sandbox/network-policy@1
26+ config:
27+ runtime:
28+ allow:
29+ - github.com
30+ - objects.githubusercontent.com
31+ - grain-lang.org
32+
33+ - type: com.docker.sandbox/agent-context@1
34+ optional: true
35+ config:
36+ contentFile: ./grain-context.md
37+
38+dockerfile: grain-toolchain.dockerfile