forge ships as a single static Go binary. Prebuilt binaries are on the GitHub releases page, or build from source:
A manifest is a [[components]] list. Each component carries an ordered ops list — the order is the build lifecycle:
That is the whole model: one TOML file, ordered ops, automatic DAG execution. The rest of this page is a reference for everything the manifest can declare.
A forge manifest is a TOML file with a [project] header, optional [vars], and one or more [[components]]. Each component has a name and an ops list.
| Section | Purpose |
|---|---|
| [project] | Project metadata: name, description. |
| [vars] | Named variables for interpolation. Overridable via env or --var. |
| [[components]] | A build unit with a name and ordered ops list. |
| ops | Ordered list of operations — the build lifecycle. |
The order of ops within a component is the execution order. Components are ordered by their dependencies (declared implicitly via variable references or explicitly).
Every operation is a single-key table in the ops list. The key names the operation type.
| Operation | Purpose |
|---|---|
| packages | Install packages via the detected OS package manager. |
| source_install | Fetch source (archive/git) and build/install it. |
| binary_install | Download an archive and copy a prebuilt binary into place. |
| user | Create a system/user account. |
| mkdir | Create directories with mode and owner. |
| chown | Change ownership of a path. |
| chmod | Change permissions of a path. |
| copy | Copy a file, with optional mode. |
| touch | Create an empty file. |
| generate | Generate code (e.g. protoc-c). |
| verify | Check files/dirs exist. |
| raw | Run an arbitrary shell command (last resort). |
Installs software through the detected OS package manager. Supports build/runtime/remove/conditional categories.
Fetches source (archive or git) and builds/installs it. Supports before/after hooks.
Downloads an archive and copies prebuilt binaries into place.
The strategy field in source_install selects the build system:
| Strategy | What it runs |
|---|---|
| configure | ./configure && make |
| autogen | autoreconf -fi && ./configure && make |
| cmake | cmake && make |
| meson | meson setup && ninja |
| make | make && make install |
| detect | Auto-select from the source tree |
${VAR} and ${VAR:-default} resolve from [vars], the environment, and --var overrides.
Precedence: vars < env < overrides.
Caching is fully automatic. A component's cache key hashes its ops, the vars it references, and its dependencies' keys.
RUN --mount=type=cache,target=/var/cache/forge ... --cache-dir /var/cache/forge.--cache-to type=gha,mode=max) persists artifacts too.The default cache directory is OS-specific. Override with --cache-dir or FORGE_CACHE_DIR.
forge detects the OS package manager automatically:
--pkg-manager flag, then FORGE_PKG_MANAGER env var./etc/os-release — ID, then ID_LIKE (e.g. rhel fedora).apt-get, dnf, yum, apk.Package names differ across distros. forge maps the most common ones automatically:
| Logical name | apt | dnf/yum | apk |
|---|---|---|---|
| build-essential | build-essential | gcc gcc-c++ make | build-base |
| pkg-config | pkg-config | pkgconf-pkg-config | pkgconf |
| libfoo-dev | libfoo-dev | libfoo-devel | libfoo-dev |
Unknown names pass through unchanged with a warning.
| Command | Purpose |
|---|---|
| forge init [dir] | Scaffold a new forge.toml. |
| forge validate <manifest.toml> | Validate without executing. |
| forge build <manifest.toml> | Build from a manifest. |
| Flag | Purpose |
|---|---|
| --parallel N | Max concurrent steps (0 = auto). |
| --dry-run | Print the execution plan without running. |
| --fail-fast=false | Continue past failed steps. |
| -v, --verbose | Stream live command output. |
| --var KEY=VALUE | Override a manifest var (repeatable). |
| --no-cache | Disable the build cache. |
| --cache-dir DIR | Override the cache directory. |
| --pkg-manager PM | Override OS package manager. |
forge follows clean architecture conventions. The codebase is organized into domain, service, repository, and CLI layers.
Repository: <https://github.com/supanadit/forge>