Skip to content

Interface: LocalCommandBuilder<TIn, TOut, THandle> ​

Defined in: node/src/builders/local-command-builder.ts:35

Fluent builder for a one-shot local OS subprocess command (local.command(id)).

Compiles to a passive LocalCommandNode participating in StepASTNode and provides .asCheck() and .asTool() projections for deterministic gates and post-flight-diffed agent tools.

Extends ​

Type Parameters ​

Type ParameterDefault typeDescription
TInunknownValidated command input payload type.
TOutunknownValidated command output payload type.
THandleunknownRuntime handle type of the active isolation scope.

Methods ​

argv() ​

ts
argv(args): LocalCommandBuilder<TIn, TOut, THandle>;

Defined in: node/src/builders/local-command-builder.ts:86

Binds the static argument vector or synchronous input-to-argv mapper function.

Index 0 of the returned array specifies the executable binary and subsequent entries are arguments.

Parameters ​

ParameterTypeDescription
args| readonly string[] | BivariantCallback<[input: TIn], readonly string[]>Argument vector or mapper.

Returns ​

LocalCommandBuilder<TIn, TOut, THandle>

Updated immutable command builder.


asCheck() ​

ts
asCheck(): AstBuilder<LocalCommandCheckNode<THandle>> & LocalCommandCheckNode<THandle>;

Defined in: node/src/builders/local-command-builder.ts:155

Projects this command into a passive LocalCommandCheckNode (type: 'node:command-check').

Reports { ok: true, deficits: [] } when the command exits with code 0.

Returns ​

AstBuilder<LocalCommandCheckNode<THandle>> & LocalCommandCheckNode<THandle>

Check builder and AST descriptor.


asTool() ​

ts
asTool(): AstBuilder<LocalCommandToolNode<THandle>> & LocalCommandToolNode<THandle>;

Defined in: node/src/builders/local-command-builder.ts:165

Projects this command into a post-flight-diffed LocalCommandToolNode (type: 'node:command-tool').

Defaults inputSchema to z.object({}) when argv is a static array and sets effectTracking: 'subprocess-post-flight' so workspace mutations are verified post-flight.

Returns ​

AstBuilder<LocalCommandToolNode<THandle>> & LocalCommandToolNode<THandle>

Tool builder and AST descriptor.


env() ​

ts
env(envVars): LocalCommandBuilder<TIn, TOut, THandle>;

Defined in: node/src/builders/local-command-builder.ts:73

Binds static string or symbolic EnvRef environment variables injected into the subprocess.

Symbolic EnvRef entries are resolved via ctx.resolveEnv at leaf execution time.

Parameters ​

ParameterTypeDescription
envVarsReadonly<Record<string, string | EnvRef>>Environment variable map.

Returns ​

LocalCommandBuilder<TIn, TOut, THandle>

Updated immutable command builder.


input() ​

ts
input<TNewIn>(schema): LocalCommandBuilder<TNewIn, TOut, THandle>;

Defined in: node/src/builders/local-command-builder.ts:112

Binds the Zod validation schema for the command's input payload.

Narrows TIn for subsequent .argv(fn), .stdin(fn), and .unrepeatable(cmd, { key }) callbacks.

Type Parameters ​

Type ParameterDescription
TNewInNew validated command input payload type.

Parameters ​

ParameterTypeDescription
schemaZodType<TNewIn>Zod input schema.

Returns ​

LocalCommandBuilder<TNewIn, TOut, THandle>

Updated immutable command builder narrowed to TNewIn.


output() ​

ts
output<TNewOut>(schema): LocalCommandBuilder<TIn, TNewOut, THandle>;

Defined in: node/src/builders/local-command-builder.ts:127

Binds the Zod validation schema for the command's parsed stdout output.

Validates trimmed JSON or string stdout before returning from executeLocalCommandStep.

Type Parameters ​

Type ParameterDescription
TNewOutNew validated command output payload type.

Parameters ​

ParameterTypeDescription
schemaZodType<TNewOut>Zod output schema.

Returns ​

LocalCommandBuilder<TIn, TNewOut, THandle>

Updated immutable command builder narrowed to TNewOut.


runner() ​

ts
runner(runner): LocalCommandBuilder<TIn, TOut, THandle>;

Defined in: node/src/builders/local-command-builder.ts:49

Binds the NodeRunnerNode pool governing concurrency slots for this command.

Acquires a one-shot slot via RunnerDriver.withSlot whenever the command executes.

Parameters ​

ParameterTypeDescription
runnerMaybeBuilder<NodeRunnerNode>Runner pool AST node or builder.

Returns ​

LocalCommandBuilder<TIn, TOut, THandle>

Updated immutable command builder.


stdin() ​

ts
stdin(mode): LocalCommandBuilder<TIn, TOut, THandle>;

Defined in: node/src/builders/local-command-builder.ts:60

Configures standard input handling ('closed' or a synchronous payload mapper).

Enforces closed stdin by default so interactive CLI prompts never hang runner slots.

Parameters ​

ParameterTypeDescription
mode| "closed" | BivariantCallback<[input: TIn], string | Uint8Array<ArrayBufferLike>>Standard input mode or mapper.

Returns ​

LocalCommandBuilder<TIn, TOut, THandle>

Updated immutable command builder.


timeoutMinutes() ​

ts
timeoutMinutes(minutes): LocalCommandBuilder<TIn, TOut, THandle>;

Defined in: node/src/builders/local-command-builder.ts:99

Sets the execution timeout in minutes before the subprocess group is terminated.

Sends SIGTERM followed by SIGKILL to the detached process group when the timeout expires.

Parameters ​

ParameterTypeDescription
minutesnumberPositive timeout duration in minutes.

Returns ​

LocalCommandBuilder<TIn, TOut, THandle>

Updated immutable command builder.


toAST() ​

ts
toAST(): LocalCommandNode;

Defined in: core/dist/ast/ast-builder.d.ts:19

Compiles the current builder configuration into a deeply frozen passive AST node.

Validates required builder invariants at compilation time and returns an immutable plain-object AST representation containing zero execution methods.

Returns ​

LocalCommandNode

Deeply frozen passive AST node.

Inherited from ​

AstBuilder.toAST


unrepeatable() ​

ts
unrepeatable<TPreIn>(preCheckCmd, options): LocalCommandBuilder<TIn, TOut, THandle>;

Defined in: node/src/builders/local-command-builder.ts:143

Configures a pre-flight idempotency check command that skips execution when preCheckCmd returns true.

Prevents side-effecting commands from re-executing when their external effect is already present.

Type Parameters ​

Type ParameterDefault typeDescription
TPreInTInInput payload type of preCheckCmd.

Parameters ​

ParameterTypeDescription
preCheckCmdMaybeBuilder<LocalCommandNode<TPreIn, boolean, THandle>>Boolean pre-check command node or builder.
optionsLocalCommandUnrepeatableOptions<TIn>Deduplication key configuration.

Returns ​

LocalCommandBuilder<TIn, TOut, THandle>

Updated immutable command builder.

Properties ​

PropertyModifierTypeDescriptionDefined in
idreadonlystringUnique identifier of the local command.node/src/builders/local-command-builder.ts:38

Released under the MIT License.