CommandOptions
Type, in @jr2/orchestrator/src/effect.ts. The signature of an export, or a type that it names, names this type. The Authoring surface page lists each export. This type is not an export of @jr2/orchestrator, so a workflow module does not import it by name.
type CommandOptions = {
slot?: string;
timeout?: Duration;
tail?: number;
env?: CommandEnv;
pin?: boolean;
};The options of command(): the Repo Slot it runs in, how long it can run, how much of its output it keeps, its Effect secrets, and the commit it runs against.
Fields
slot(optional):stringThe Repo Slot whose Worktree is the working directory of the command. Write it only when the Workspace has more than one Repo Slot. In a Workspace with no Repo Slot, the command starts in
/work, the folder that the steps of the Workspace share.The command starts in the root of that Worktree. To run it in a subfolder, give the path as an argument, or write
["sh", "-c", "cd <dir> && <program>"].When it starts, it refuses:
- no
slotunder a Workspace with more than one Repo Slot:command "<slot>" runs under a Workspace carrying more than one Repo Slot (<slots>) and names none — say which Worktree it runs in: command(argv, { slot: "<slot>" }) (ADR-0051). Whenenvnames an Effect secret, the text iscommand "<slot>" runs under a Workspace carrying more than one Repo Slot (<slots>) — say which: { slot: "<slot>" } (ADR-0051). - with an Effect secret in
env, a Workspace with no Repo Slot:command "<slot>" runs under a Workspace with no Repo Slot: a command with an Effect secret runs against one commit of a Repo Slot's branch, and there is none — declare a Repo Slot, or name no secret in its env, and it runs in /work beside the Agent (ADR-0051). - a
slotthat the Workspace does not have:command "<slot>" names Repo Slot "<name>", which its Workspace does not carry (<slots>).
- no
timeout(optional):DurationHow long the command can run: a number and a unit, such as
"90s","10m"or"1h". Default"10m". When the time ends, jr2 kills the process group, and the output istimeout. It refuses a value that is not a positive duration:command: timeout "<timeout>" is not a positive duration (like "90s", "10m", "1h").tail(optional):numberThe number of characters that
tailkeeps from the end of what the command wrote. Default 4096.env(optional):CommandEnvThe environment variables of the command, each an Effect secret.
secret("x")gives the value, andsecret("x").pathgives the path of a file that holds the value. Whenenvnames one, the command runs in the Sandbox Effector against one commit, not in the Worktree that the Agent changes. Withoutenv, it runs in the Harness container, beside the Agent.It refuses a name that is not a variable name, and
PATH,HOMEandTMPDIR:command(argv, { env }): "<name>" is not a variable the author sets — PATH, HOME and TMPDIR are the Effector's (ADR-0067).pin(optional):booleanOnly for a command whose
envnames an Effect secret.true: the input of the Effect names the commit to run against ({ sha }, a full commit id, for example one that a Gate approved). Default: the tip of the Agent's branch when the Effect starts.It refuses
pin: trueon a command that names no Effect secret:command(argv, { pin: true }) names no secret in its env: `pin` chooses the commit a credentialed command runs against in the Sandbox Effector, and a command that names no secret runs in the live Worktree (ADR-0067) — name its secret, command(argv, { env: { NAME: secret("x") }, pin: true }), or drop `pin`.When it starts, it refuses an input
shathat is not a full commit id:command "<slot>" (pin): its input's sha is not a full commit id.