Skip to main content

HookSpecBuilder

Struct HookSpecBuilder 

Source
pub struct HookSpecBuilder { /* private fields */ }
Expand description

Builder for HookSpec.

Implementations§

Source§

impl HookSpecBuilder

Source

pub fn command_program<I, S>(self, program: impl Into<String>, args: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Set the program and arguments the harness should execute when the hook fires.

Integrations that only accept shell strings render this command with POSIX shell quoting, so arguments containing spaces or shell metacharacters remain arguments instead of becoming shell syntax.

Source

pub fn command_shell_unchecked(self, command: impl Into<String>) -> Self

Set an unchecked raw shell command.

This is intentionally explicit: the command string is passed through as shell syntax for harnesses and generated scripts. Use this only when the full command is trusted and already sanitized.

Source

pub fn matcher(self, m: Matcher) -> Self

Set the tool-call matcher.

Source

pub fn event(self, e: Event) -> Self

Set the lifecycle event to attach to.

Source

pub fn rules(self, content: impl Into<String>) -> Self

Attach a markdown rules block to be injected into the harness’s memory file.

Source

pub fn script(self, script: ScriptTemplate) -> Self

Attach a script template (shell or TS) for harnesses that need one.

Source

pub fn friendly_name(self, name: impl Into<String>) -> Self

Set a human-friendly display name shown in install reports.

Source

pub fn timeout_seconds(self, timeout: u64) -> Self

Set the hook execution timeout in seconds.

Source

pub fn status_message(self, msg: impl Into<String>) -> Self

Set the status message to show during execution.

Source

pub fn async_run(self, val: bool) -> Self

Set whether the hook is run asynchronously.

Source

pub fn shell(self, sh: impl Into<String>) -> Self

Set the custom shell to execute the command.

Source

pub fn windows_command(self, cmd: HookCommand) -> Self

Set the Windows-specific command override.

Source

pub fn codex_inline_toml(self, val: bool) -> Self

Set whether Codex should install this hook inline in config.toml.

Source

pub fn build(self) -> HookSpec

Finalize the spec, panicking on missing or invalid fields.

Convenience wrapper around try_build() for tests and examples. Production code should prefer try_build() to propagate errors instead of panicking.

§Panics

Panics if command was never set.

Source

pub fn try_build(self) -> Result<HookSpec, AgentConfigError>

Finalize the spec, returning Result on missing or invalid fields.

This is the recommended way to build a spec in production code. See crate-level documentation for a full example.

§Errors

Trait Implementations§

Source§

impl Clone for HookSpecBuilder

Source§

fn clone(&self) -> HookSpecBuilder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HookSpecBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.