RepoSlot
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 RepoSlot<TInput = unknown> =
| typeof open
| string
| Binding
| ((args: { input: TInput }) => string | Binding);The value of one Repo Slot in workspace({ repos }). One of:
- a url, or a
Binding{ url, ref }: the Machine names the Repo. open: the Instance that registers the Machine binds it withcustomize().jr2 uprefuses a Workflow that leaves it open:refusing: workflow "<name>" leaves Repo Slot "<slot>" open — bind it where the Machine is registered: export const machine = customize(<import>, …) (ADR-0051), with the wholecustomizeline to paste.- a function of the run input,
({ input }) => urlor aBinding: each run chooses. The url must match an entry ofgit.credentialsinjr2.config.ts, or the run cannot use it.
The key of the slot is a directory name under /work. It starts with a letter, and workspace() and customize() refuse a key that does not: <where>: Repo Slot key "<key>" is not a directory name — a slot becomes `/work/<slot>` and its order matters, so it starts with a letter and matches /^[A-Za-z][A-Za-z0-9._-]*$/ (ADR-0051). They refuse a value of another shape: <where>: Repo Slot "<slot>" is <what> — a slot is `open`, a url, `{ url, ref? }`, or a mapper `({ input }) => url | { url, ref? }` over the door (ADR-0051).
Example
ts
import { z } from "zod";
import { jr2Setup, open, workspace, type RepoSlot, type Workspaced } from "@jr2/orchestrator";
const runInput = z.object({ service: z.string() });
type RunInput = z.infer<typeof runInput>;
const service: RepoSlot<RunInput> = ({ input }) => `https://github.com/you/${input.service}.git`;
const body = jr2Setup({
types: {} as { input: Workspaced<RunInput, "service" | "docs" | "config"> },
}).createMachine({
id: "body",
initial: "done",
states: { done: { type: "final" } },
});
// A Machine for a package: the Instance that registers it binds `config`.
export const deploy = workspace(body, {
input: runInput,
repos: {
service,
docs: "https://github.com/you/docs.git",
config: open,
},
spec: ({ input }) => ({ branch: `deploy/${input.service}` }),
});See also