> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blobhub.io/llms.txt
> Use this file to discover all available pages before exploring further.

# blobhub app build

> Write the app's build/ directory: compiled workflow folders, every other folder as it is

`build` turns the repository into the tree the app blob holds. It compiles each workflow folder's code and packs its
widgets into the definitions, copies everything else, and writes the result to `build/`.

**It makes no API call.** It needs no credential and no connectivity, so it runs in a checkout, a pre-commit hook or
the first step of CI. `build/` is a pure function of the sources: the same sources give the same bytes.

## Synopsis

```bash theme={null}
blobhub app build [--file <app.yaml>] [--library-catalog <file-or-url>]
```

| Flag | Default | Description |
| - | - | - |
| `--file`, `-f` | `app.yaml` | Path to the app manifest. The repository root is its directory. |
| `--library-catalog` | none: declared libraries go unchecked | Check widget libraries against this catalog file or `http(s)` URL. |

## What it does

1. Reads `app.yaml` and each folder under `blobs/` with its `blob.yaml`.
2. Copies `app.yaml`, `README.md`, `LICENSE` and everything under `schemas/`.
3. For each folder under `blobs/`:
   * **A workflow folder** is compiled: each definition that binds code through `build` is written, compiled, at its
     `file` path; a widget project is packed from its `widget.yaml` and the `dist/` its own build wrote; `blob.yaml`
     is written without its `build` keys and with each definition's resolved `category`; every other definition's
     `file` and every `objects[].file` is copied.
     Source directories such as `src/`, `__pycache__` and dot entries are not.
   * **Any other blob type** is copied as it is.
4. Writes only the files whose bytes changed, and deletes files in `build/` the sources no longer produce.

It prints a line per blob, saying whether the folder was compiled or copied and what it holds, then the result:

```text theme={null}
compiled  blobs/flows      blobhub.compute.workflow   2 definitions
copied    blobs/schedules  blobhub.compute.scheduler  1 file
wrote build/: 14 files; git ignores it
```

Code compiles without an allowlist, so a third-party import the compiler cannot verify is reported as the advisory
`IMPORT_UNVERIFIED` and the build goes on. Without `--library-catalog`, a widget that declares libraries draws the
advisory `WIDGET_LIBRARIES_UNVERIFIED`: the build calls nothing, so it has no catalog to check them against. A code
message without a `created_at` gets a fixed one, so two builds are byte-identical. When git does not ignore `build/`,
the advisory `BUILD_NOT_IGNORED` says so; outside a git repository it is silent. The advisories go to stderr and leave
the exit code `0`.

## Paths and producers

A code entry and a widget project each sit in a directory below their blob's folder. A published path has one producer:
two definitions with the same `file`, or an `objects[].file` naming a definition's `file` or `blob.yaml`, is
`MANIFEST_INVALID`.

## Errors

| Code | When |
| - | - |
| `MANIFEST_NOT_FOUND`, `MANIFEST_INVALID` | `app.yaml` or a `blob.yaml` is absent or unusable, a definition's or an object's `file` is missing, two entries publish one path, or a session object holds both `value` and `file`, or neither. |
| `FORMAT_UNSUPPORTED`, `FORMAT_PARSE_ERROR` | `app.yaml`, a `blob.yaml`, or a definition or `widget.yaml` it reads has an unsupported extension, or does not parse. |
| `VALUE_NOT_JSON` | A document it writes holds a value JSON cannot carry, such as NaN or a lone surrogate: a definition it compiles or packs, or a `blob.yaml` it publishes. Or `app.yaml`, a `blob.yaml` or a definition is a YAML document that holds itself, refused as it is read, or a `widget.yaml`, whose message is led by the widget's alias. The message names the source file the repository holds, under `blobs/` for a definition, never its copy under `build/`, then the value's path, such as `<file>: <path>: holds itself`. |
| `DEFINITION_CATEGORY_UNKNOWN` | A definition has no resolvable `category`: it leaves `category` out and its document's `type` is not a recognized one, or the `category` it declares contradicts its document's `type`. The refusal names the entry; nothing is written to `build/`. |
| `IMPORT_UNVERIFIED`, `WIDGET_LIBRARIES_UNVERIFIED`, `BUILD_NOT_IGNORED` | Advisories on stderr; the exit code stays `0`. |

Every code above, with its remediation, is in [Error codes](https://docs.blobhub.io/cli/error-codes.md).

## See also

* [`blobhub app push`](https://docs.blobhub.io/cli/app/commands/push) — builds, then uploads what changed.
* [`app.yaml`](https://docs.blobhub.io/blob-types/app/app-yaml) and [`blob.yaml`](https://docs.blobhub.io/blob-types/app/blob-yaml) — what `build` reads.
* [App overview](https://docs.blobhub.io/cli/app/overview.md) — the repository and the loop.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.