Build and code generation
Functions of the tools module at v0.3.2. Each returns what a command runs in; import it with import * as tools from "tools".
buf
buf, the Protocol Buffers toolchain.
buf(
--image: Environment = #bufbuild/buf:1.73.0,
--token: String | Null = <secret>,
--cache_dir: String | Null = null,
--with: Array<Record<env: Map<String>, volumes: Array<String>>> = [],
--extra_env: Map<String> = {}
): RunnableThe image is #bufbuild/buf:1.73.0 unless --image names another. lask sync pulls and pins whichever image is used (lask spec 10.3); a run never pulls.
Parameters
--imageThe image to run; another release is passed as image = #bufbuild/buf:<tag>.--token!!BUF_TOKEN, for the Buf Schema Registry; masked in the command log.--cache_dirHost directory mounted at /cache; buf's cache is /cache/buf (BUF_CACHE_DIR).--withSetups of other tools this environment should also carry.--extra_envAny other variable; below --with and the named parameters.
Returns Runnable: The environment, for command { "buf" } on ... or $[...].
Image bufbuild/buf:1.73.0
Command words buf: import command { "buf" } from "tools"
lask eval buf --cache_dir /tmp/cacheprotoc
protoc, the Protocol Buffers compiler, with the well-known types and the gRPC plugins.
protoc(
--with: Array<Record<env: Map<String>, volumes: Array<String>>> = [],
--extra_env: Map<String> = {}
): RunnableThe image is built from lib/images/protoc/Dockerfile (Alpine 3.24), so it takes no --image, and lask sync builds it. A language's own plugin — protoc-gen-go, ts-proto — lives with that language's toolchain; buf, which fetches plugins itself, is often the simpler way.
Parameters
--withSetups of other tools this environment should also carry.--extra_envAny other variable; below --with.
Returns Runnable: The environment, for command { "protoc" } on ... or $[...].
Image recipe lib/images/protoc/Dockerfile
Command words protoc: import command { "protoc" } from "tools"
lask eval protocbazel
Bazel, through Bazelisk.
bazel(
--cache_dir: String | Null = null,
--with: Array<Record<env: Map<String>, volumes: Array<String>>> = [],
--extra_env: Map<String> = {}
): RunnableThe image is built from lib/images/bazel/Dockerfile: Bazelisk 1.29.0 on Debian, with a C++ compiler, Python and Git. Bazel's own image is published for amd64 only. Bazelisk runs the Bazel release the project's .bazelversion names, downloading it on first use; without --cache_dir that is every run. The image takes no --image, and lask sync builds it.
Parameters
--cache_dirHost directory mounted at /cache: Bazelisk's downloads (BAZELISK_HOME=/cache/bazelisk) and Bazel's output root (XDG_CACHE_HOME=/cache), so a build is incremental across runs.--withSetups of other tools this environment should also carry.--extra_envAny other variable; below --with and the named parameters.
Returns Runnable: The environment, for command { "bazel" } on ... or $[...].
Image recipe lib/images/bazel/Dockerfile
Command words bazel, bazelisk: import command { "bazel", "bazelisk" } from "tools"
lask eval bazel --cache_dir /tmp/cache