Skip to content

CLI usage

fabriek [PIPELINE] [flags]

PIPELINE is optional: with no arguments at all, fabriek prints the help. Flags without a positional use fabriek/pipeline.yaml (relative to the current directory); a missing default fails loudly instead of falling back.

Exit code is 0 on pipeline success, 1 on a pipeline or startup error, and 2 on a usage error.

Errors

A startup or configuration failure that is not handled by a subcommand prints one fabriek: ... line to stderr and exits 1; no Python traceback is printed by default. Covered classes are invalid YAML, schema validation, a missing secret or API key, an in-workspace engine install, dirty tooling, and sandbox startup.

A missing pipeline depends on the execution context:

  • In a normal checkout, fabriek <pipeline> and fabriek --dry-run run through the unified fanout, which treats a missing pipeline as a usage error with exit 2. An explicit missing path prints fabriek: pipeline file not found: <path>; a missing default prints fabriek: no pipeline at fabriek/pipeline.yaml and none given.
  • Inside a loop worktree, or in a fanout child, the in-place single-pipeline path prints the same message for the same case and exits 1.
  • fabriek fanout keeps its manifest usage contract: a missing manifest prints fabriek: manifest file not found: <path> and exits 2; an invalid manifest prints its validation error and also exits 2.
  • fabriek run-status keeps its own run-status: pipeline not found message and exit 1.

An unexpected internal error prints fabriek: internal error: <type>: <message> and exits 1.

Set FABRIEK_TRACEBACK=1 to include the full traceback for startup, configuration, and unexpected internal errors. Errors already handled by a subcommand keep their existing output and exit code. Unset, empty, 0, false, no, and off keep the traceback off.

Usage errors keep exit 2.

Run flags

Flag Effect
--dry-run Full load-and-validate pass, then print the computed worktree orchestration plan. No LLM, no Docker, no state writes, no API key. Exit 0 on a clean load.
--resume <thread-id> Continue the latest checkpoint of a previous run (crash, Ctrl-C) with all accumulated notes intact. Command steps marked rerun_on_resume: true run first, before the resumed step.
--max-attempts <n> Override the pipeline's max_attempts.
--env <file> Load secrets from a host env file outside the workspace. Optional: the process environment is the default, a named-but-missing file is a loud error, and values already set in the environment win.
--no-viz / --viz-port <port> Suppress the live graph view and landing page / set a preferred landing-page port (default 8321; 0 picks any free port; page-active children get an ephemeral port of their own).

Other commands

  • fabriek run-status <pipeline> renders the latest run as a mermaid flowchart with the current step highlighted, reading the run-state checkpoint database directly. run-status --install installs the bundled /run-status command into OpenCode.
  • fabriek report serves the historical runs view in the browser (default port 8321, falling back to a free port when busy; blocks until ctrl+c and prints the URL). It reads the same run records as the markdown report and lists past runs with since / until / status filters, an aggregate metrics panel, and a per-run detail page carrying the brief, implementation summary, review findings, and QA report. The live viz also links to it from the Analytics button in the graph page header.
  • fabriek report --markdown [<run-id>] renders the same history as ASCII markdown instead: an aggregate dashboard (loop health, TDD, review, and QA metrics with provenance labels) or a deep dive for one 12-hex run directory. --since / --until / --status filter the set. --markdown cannot be combined with --port.
  • fabriek containers inspects the engine's sandbox containers and networks from the host; containers --reap removes registry-owned orphans whose owner process is dead. A SIGTERM to a running pipeline still closes the sandbox; SIGKILLed runs are reclaimed by the startup reaper on the next run or by containers --reap.
  • fabriek [PIPELINE] [flags] is the only run mode: every run executes in a dedicated git worktree, one per document source, in parallel. Repeat the document flags to add sources (--plan <doc>, --aidlc-unit <slug>, or a worktree-capable custom loader flag) and mix them freely; zero, one, and many sources are all valid. With no document flag the sole defaultable loader resolves the source (the AI-DLC current unit), and run is the fallback when nothing resolves. PIPELINE must come before the document flags, must live inside the repository, and must be tracked in the base commit. Each source gets a worktree named fanout-<slug> in the repo's parent directory (--worktree-root overrides it) on branch loop/fanout/<slug>, forked from --base-ref (default HEAD), and runs the complete unchanged pipeline. A worktree and branch that already exist are reused, never silently recreated; a directory without its branch is a loud usage error naming git worktree remove. Child output streams with a per-entry prefix, live viz URLs are collected into a final summary table (PASSED / FAILED / ABORTED / SKIPPED), and children keep serving their viz after finishing until one ctrl+c stops the whole group; the exit code is 0 only when every entry passed, 1 otherwise, and 2 for usage errors. A page-active run (not --no-viz, not --dry-run) starts one live landing page at /fanout/<id> before the first child and prints its Fanout URL first, then an Analytics URL filtered by the fanout id. The parent binds --viz-port when given (0 picks any free port) and otherwise 8321; every child receives --viz-port 0 so its graph server takes an ephemeral port instead of colliding with the parent. --dry-run prints the computed worktree plan without touching git; --max-attempts, --env, and --no-viz are forwarded to every child. Document paths are re-rooted into the worktree, so a plan is read from and stamped in the worktree's own copy; the main checkout is never read or written. The engine never merges or pushes: each branch is opened as a pull request after the operator commits the worktree's tooling-path drift. Merges to origin/main are blocked; every change lands through review. Running from inside a loop worktree (loop/ branch) runs in place instead of creating a nested worktree; resume a run there with fabriek <pipeline> --resume <thread> <doc flags>.
  • fabriek claude-login authenticates a Claude Pro or Max subscription (OAuth PKCE flow) and writes the token file the engine reads.
  • fabriek copilot-login authenticates a GitHub Copilot subscription (device flow); copilot-models lists the models the token's tier can use. See LLM providers.

Cross-repo fanout

fabriek fanout <manifest> runs independent pipelines across locally checked-out sibling repositories and presents every result in one flat, filterable run list. The manifest path is always explicit; there is no default filename and no sibling discovery.

repos:
  api:
    path: ../api
    pipeline: fabriek/pipeline.yaml
    runs:
      - plan: planning-docs/042-auth.md
      - aidlc-unit: unit-7
  web:
    path: ../web
  • Manifest. Only repos is allowed at the top level. Repo keys are display names and worktree prefixes; path is required, resolves relative to the manifest with strict ${VAR} and ~ expansion, and must be a git worktree root. pipeline is repo-relative (default fabriek/pipeline.yaml) and must stay inside the repo and be tracked in the base commit. runs is optional: absent means the repo resolves its own default source; runs: [] is rejected rather than silently meaning the default. Each item is a one-key mapping whose key is a document-loader flag without -- and whose value is a scalar string; unknown keys and orchestration options such as base-ref are usage errors.
  • Nested execution. The parent spawns one stock python -m fabriek per repo with that repo as its working directory, so each repo loads its own extensions and resolves its own sources. A repo child carrying the parent token orchestrates even when its checkout is on a loop/ branch; the single-run token still means run in place. Repo-level loader validation, document containment, pipeline tracking, and worktree conflicts fail before that repo creates a worktree, and one repo failing does not cancel the others.
  • Worktree names. A cross-repo child names worktrees fanout-<repo>@<slug> beside each repo (branches stay loop/fanout/<slug>). @ cannot occur in either normalized slug, so api + unit-7 and api-unit + 7 cannot collide. Single-repo runs keep fanout-<slug>.
  • Branch conflicts. If an entry branch is already checked out at the legacy unprefixed fanout-<slug> path, the error names git worktree move <legacy> <prefixed> and the git worktree remove <legacy> alternative. If it is checked out at the repo root or any other worktree, the error names that path and instructs you to switch it to another branch or remove it. The engine never switches, moves, or removes an existing checkout itself. Dry-run reports a usage error; execution marks only that entry SKIPPED while other ready entries proceed.
  • Output and exit codes. Child output is prefixed [<repo>]; the final table is flat in manifest order then entry order and carries repo, source, branch, state, age, and the live viz URL. Exit 0 only when every entry passes, 1 for any failed/aborted entry or repo orchestrator failure, and 2 for manifest or invocation usage errors before execution. One ctrl+c terminates every repo child. Nothing pushes, merges, or rebases.
  • Dry-run. --dry-run starts no history server and no worktrees; it runs each repo child sequentially with --dry-run, prefixes its output with the repo name, validates loader-owned flags and document containment, and prints the real per-entry plan. It exits 0 when every plan is valid and 2 when any repo reports a usage error.
  • Fanout page and Analytics. Unless --no-viz is set, a top-level fanout (the in-repo run or fabriek fanout <manifest>) starts the history server before spawning children and prints a Fanout URL first (/fanout/<id>), then an Analytics URL pre-filtered by the fanout id (/history?fanout=<id>). The fanout page is the live landing view: one row per repo or source with its branch, state, age, a Live link to that entry's child graph, and an Analytics link into the filtered run list. It polls once a second and stops when the run finishes, then stays reachable until the parent exits. Opening the server root redirects to it, and fabriek report never serves it because a static report has no in-flight progress to poll. A multi-entry run opens the landing page in the default browser on a background thread so a blocking console browser cannot delay child spawn; if the browser cannot be opened, the terminal keeps the URL and prints a notice. A single-entry run does not open the landing page: its child graph opens directly (the one-row page still exists and the child header links back to it). Every child of a page-active run carries the fanout id for filtered History and Analytics, and a link back to the landing page. The Analytics page adds repeatable repo (an exact fanout_repo_id, with the reserved (unattributed) value; values are not comma-split), exact fanout, and q search filters. Groups compose with AND. Repo checkboxes use the resolved repo-root path as their value and the newest manifest alias only as a label, so renaming a manifest key does not split a repo's history and reusing an alias for another path does not merge two repos. The same page shows a Repositories table aggregated by that repo id; each view link carries the id back into the Runs table. The navbar logo is the home link: the fanout landing page during a cross-repo fanout, the live run for a normal run, and the Analytics page on a plain report server. There is no separate Stats page or Fanout button. The per-row Analytics link adds q=<source>; q is a case-insensitive substring match over repo, source, branch, and subject, so the per-row link is a best-effort source filter rather than an exact one. Entry child graph pages do not auto-open during a multi-entry fanout; the Live column is the way in, so one tab per entry cannot steal focus from the landing page. A single-entry run is the exception: the child graph auto-opens and the one-row landing page sits behind its back link. Live links open in the same tab, and the logo on a child graph page links back to the landing page. Nested repo orchestrators never start a page of their own; only the outer top-level invocation owns the landing page.
  • External state dirs. Central Analytics discovery keeps reading direct children of the default global runs root. A pipeline with an explicit state_dir outside that root still runs, appears in the CLI table, keeps its own live viz, and appears on the fanout page with its live rows and child links, but its history record is not merged into the central Analytics page.

Onboarding commands

fabriek init scaffolds the onboarding surface for a repo, and doctor + upgrade keep the host and the committed pin honest. They are your commands to run: the CLI never runs them for you.

fabriek init --profile python        # or: --profile dotnet-node, rust
fabriek init --profile ./my-profile.yaml
fabriek init --profile ./my-profile.yaml --recipe ./my-recipe.yaml

init writes the onboarding surface from a bundled toolchain profile: fabriek/pipeline.yaml, the three agent files, fabriek/.engine-version (the exact installed engine version), any missing premise files, gitignore additions, and an env-file template. It detects solution files, package.json directories, lockfiles, README, and AGENTS.md, asks only what detection cannot answer, and refuses to overwrite an existing fabriek/ directory. A consumer-authored profile file can be passed by path instead of a bundled name, and --recipe accepts a consumer recipe file path the same way, so a toolchain this engine does not ship can onboard with its own image and its own steps. A path profile is stored in the pipeline relative to fabriek/, so the committed pipeline resolves from any working directory.

fabriek doctor --fast     # per-run gate: hard failures abort
fabriek doctor --json     # machine-readable results

doctor --fast probes the host and repo before you run: hard failures stop you here (engine pin mismatch, engine runtime availability, API version, git repo, .env* files); warnings print and continue.

fabriek upgrade

upgrade installs the latest engine release and rewrites the pin, so the host install and the committed pin converge in one explicit action.

See Authoring a loop for what init writes and how to adapt it.