---
title: gui_ze
status: canonical
audience:
  - humans
  - AI agents
last_reviewed: 2026-08-17
---

# gui_ze wiki

`gui_ze` owns reusable Bazel rules and macros for build-time asset and
application packaging. Load symbols from:

```starlark
load("//gui_ze:gui_ze.bzl", "bundle", "move_files_into_dir")
```

There is no `web_bundle` rule and no `wasm_cc_binary` defined by gui_ze.
JavaScript bundling uses the Bun rules below. WASM compilation comes from the
Emscripten toolchain, such as
`@emsdk//emscripten_toolchain:wasm_rules.bzl`.

## Rule selection

| Need | Symbol | Notes |
| --- | --- | --- |
| Copy a target's runfiles and binary into a distributable directory | `bundle` | Takes a `binary` label |
| Bundle TS/JS with Bun and declared dependencies | `bun_bundle` | Preferred Bun build rule for an entry source |
| Legacy Bun folder build | `bun_build` | Existing compatibility rule; avoid for new work when `bun_bundle` fits |
| Run a JS/TS source with the pinned Bun runtime | `bun_run` | Executable Bazel target with declared `data` |
| Materialize files under a destination directory | `move_files_into_dir` | Preserves only source basenames |
| Symlink declared data into a directory structure | `move_to_directory` | Uses paths derived from Bazel outputs |
| Convert an image to WebP | `webp_image` | Uses pinned `cwebp`; supports quality and lossless mode |
| Package/sign a binary as a macOS app and DMG | `macos_app_and_dmg` | Generates app, signed app, and DMG targets |
| Expose a pinned Bun executable | `bun_binary` | Infrastructure rule, normally used by the Bun wrapper package |
| Trivial rule-development example | `foo_binary` | Example only; do not use in production targets |

## Examples

Bundle browser code:

```starlark
load("//gui_ze:gui_ze.bzl", "bun_bundle")

bun_bundle(
    name = "app_js",
    src = "src/main.ts",
    deps = [
        "//design_system:components",
    ],
)
```

Copy generated/static assets:

```starlark
load("//gui_ze:gui_ze.bzl", "move_files_into_dir")

move_files_into_dir(
    name = "public_icons",
    srcs = ["//assets:icons"],
    dest = "public/icons",
)
```

Convert an image:

```starlark
load("//gui_ze:gui_ze.bzl", "webp_image")

webp_image(
    name = "logo_webp",
    src = "logo.png",
    out = "generated/logo.webp",
    lossless = True,
)
```

Bundle a server binary and runfiles:

```starlark
load("//gui_ze:gui_ze.bzl", "bundle")

bundle(
    name = "server_bundle",
    binary = ":server",
)
```

## Rules for agents

- Do not add shell copy commands when `move_files_into_dir`,
  `move_to_directory`, or `bundle` owns the operation.
- Declare every source, dependency, runtime file, and tool in the Bazel rule.
- Use the pinned Bun target rather than a host-installed Bun executable.
- Use `webp_image` rather than calling `cwebp` from application scripts.
- Keep application-specific asset composition in the consuming package's
  `BUILD`; keep reusable action logic in `gui_ze.bzl`.
- Prefer a new focused Starlark rule over a script that writes undeclared files.
- Preserve platform constraints for macOS packaging rules.

## Validation

Build the consuming target that instantiates the rule. Starlark helpers are
validated through their real consumers rather than a generic gui_ze build.
