Skip to content

v0.9.3 refactor(hooks): split config types from HookExecutor #4082

Description

@Hmbown

Problem

crates/tui/src/hooks.rs is 2,576 lines mixing serde config types (HookEvent, matcher config, [[hooks.hooks]] shapes) with process execution, timeouts, and HookExecutor runtime behavior.

Hooks v2 contract work landed here; separating config from execution makes policy changes safer.

Proposed modules

  • hooks/mod.rs — public API and re-exports.
  • hooks/config.rs — events, matcher types, deserialization, validation.
  • hooks/executor.rsHookExecutor, subprocess IO, timeouts, decision JSON contract.
  • hooks/matcher.rs (optional) — glob/path matching if separable from config.

Sizing

Field Value
Lines (today) ~2,576
Effort M
Risk Medium — hook decision JSON and timeout semantics are user-visible

Acceptance criteria

  • Config parsing/validation has no subprocess dependencies.
  • Executor module owns all spawn/wait/timeout paths unchanged.
  • Hooks v2 JSON decision contract tests keep passing.
  • Run cargo fmt and targeted hooks tests.

Related: #1897, #3306, #3026.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cleanupCode cleanup, refactor, or maintenance workenhancementNew feature or requestreliabilityReliability, flaky behavior, retries, fallbacks, and robustnessrustPull requests that update rust codetuiTerminal UI behavior, rendering, or interactionv0.9.3Targeting v0.9.3

    Projects

    Status
    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions