Skip to content

Binding ​

Type, in @jr2/orchestrator/src/parts.ts. It is an export of @jr2/orchestrator, on the Authoring surface page, in Workspaces and Repos.

ts
type Binding = {
  url: string;
  ref?: string;
};

The repository of a Repo Slot: { url, ref }. url is the Repo's git url. ref is the branch or commit that the branch Worktree starts from; absent, the Repo's default branch. Where only a url is needed, a string is enough.

workspace() and customize() refuse:

  • an empty url: <where>: Repo Slot "<slot>" is bound to an empty url (got <value>) — a slot is `open`, a url, `{ url, ref? }`, or a mapper `({ input }) => url | { url, ref? }` over the door (ADR-0051).
  • an empty ref: the same text, with bound with an empty ref in place of bound to an empty url.
  • a url that names no Repo, such as a relative path: <where>: Repo Slot "<slot>" binds "<url>", which names no Repo — <reason> (ADR-0051).

Fields

  • url: string

    The Repo's git url.

  • ref (optional): string

    The branch or commit that the branch Worktree starts from. Default: the Repo's default branch.

Example

ts
import { jr2Setup, workspace, type Binding } from "@jr2/orchestrator";

const app: Binding = { url: "https://github.com/you/app.git", ref: "release-2" };

const body = jr2Setup().createMachine({
  id: "body",
  initial: "done",
  states: { done: { type: "final" } },
});

export const machine = workspace(body, {
  repos: { app },
  spec: () => ({ branch: "jr2/hotfix" }),
});

See also

The docs of Kit version 0.5.1. Each page is also at its .md URL.