Skip to content

Forge ​

Conductor tools for a sandboxed run's branch, PR/MR and origin issue; the token stays with the conductor.

For operators who run agents in sandbox permissions without trusting git, gh or glab. Background: decision record docs/decisions/sandbox-forge-tools.md.

Enable it ​

Add the addon with exactly one backend, GitHub or GitLab, in ~/.bakers/machine.config.js or the project's .bakers/project.config.js:

js
addons: [
  {
    use: '@bakers-build/addon-forge',
    with: {
      merge: {
        main: { method: 'merge', delete_source: false },
        '*': { method: 'squash', delete_source: true },
      },
      backend: { use: '@bakers-build/addon-forge-github', with: { repository: 'acme/shop', auth: 'gh' } },
    },
  },
],

Without a forge entry no tool is served; without backend.use the conductor won't start.

Options ​

Generated from the options.schema.json of @bakers-build/addon-forge; change the schema, not this table.

OptionTypeDefaultRequiredEffect
backendobject—yesThe forge backend: the package and its own settings.
backend.usestring—yesThe backend package.
backend.withany—The backend package's own settings, checked by that package's options.schema.json: GitHub or GitLab.
mergeobject—Merge rule per base branch; * for every other base. Without a rule: squash and delete the source branch.
merge.<base>object—The rule for merging into this base.
merge.<base>.methodsquash | merge—yesSquash or merge commit.
merge.<base>.delete_sourceboolean—yesDelete the source branch after the merge.

bakers config check validates these options; the backend checks its own at conductor start. Keep token and private_key in ~/.bakers/machine.config.js, or use the *_env keys. The committed .bakers/project.config.js reaches every clone, run worktrees included.

Tools ​

ToolDoesLimit
forge_fetchFetches base_branch, the ticket branch and parents named in branches.Read only; no tags.
forge_update_branchMerges the current target into a run clone's ticket branch; sync says how the run follows.Pushes nothing.
forge_pushPushes an owned branch.Fast-forward, or force_with_lease; bare force does not exist.
forge_pr_upsertOpens, updates or retargets the PR/MR into the derived base; request_reviewers only adds ticket reviewers, by public e-mail.Refuses non-Conventional Commits titles first; names skipped reviewers.
forge_checksLists checks with raw conclusion, run_id, job_id and overall.Read only.
forge_job_logA job's log tail, 16 KiB by default.Read only.
forge_issue_updateLabels or comments on the origin issue.GitLab only.
forge_mergeMerges an owned branch's PR/MR.Correct target, valid title, no conflict, overall is success.

Required checks, also one named required, must all be green for overall success; none gives no_required_checks.

Human approval stays the merge gate.

Ownership and merge ​

Tools take the ticket, branch_name and base_branch from the calling run, else refuse. A run owns <branch_name> and variants <branch_name>-<suffix>. The ticket branch merges into the server's current target_branch, a variant into the ticket branch, a ship's variant into base_branch. The merge sends method and source deletion explicitly, ends the body with Merged-by: bakers.build and ref:<identifier>, and keeps a source another open PR/MR targets.

Isolation ​

Network git runs in a throwaway repository on the clone's object store, without config or hooks, against the backend's configured URL. Config and hooks planted in the clone have no effect; a clone whose objects/info/alternates lists another object store is refused. The token travels as an environment header and is redacted from every result.

Good to know ​

  • Without these tools a run falls back to git and the service's client, allowed in sandbox permissions only as trusted commands.

Package source in a checkout: bakers-cli/addons/forge.