Skip to main content

Interface: HookRunner

Defined in: packages/core/src/application/ports/hook-runner.ts:20

Port for executing run: hook commands.

run: hooks are deterministic shell commands declared in workflow[] entries. They are executed by this port — not by the AI agent — and have strong execution guarantees at pre-* lifecycle points.

Template variables in command strings are expanded before execution via TemplateExpander.expandForShell().

Unlike the repository ports, HookRunner has no invariant constructor arguments shared across all implementations, so it is declared as an interface rather than an abstract class.

Methods

run()

run(command, variables): Promise<HookResult>

Defined in: packages/core/src/application/ports/hook-runner.ts:32

Executes command in a subprocess, substituting template variables from variables before invoking the shell.

Template variable syntax: {{key.path}}, e.g. {{change.name}}, {{project.root}}. Unknown variables are left unexpanded.

Parameters

command

string

The shell command string, optionally containing template variables

variables

TemplateVariables

Values for template variable substitution

Returns

Promise<HookResult>

The process exit code and all captured output