Milestone M6 implementation adds a comprehensive hook system that allows
users to run custom scripts at various lifecycle events.
New crate: crates/platform/hooks
- HookEvent enum with multiple event types:
* PreToolUse: fires before tool execution, can deny operations (exit code 2)
* PostToolUse: fires after tool execution
* SessionStart: fires at session start, can persist env vars
* SessionEnd, UserPromptSubmit, PreCompact (defined for future use)
- HookManager for executing hooks with timeout support
- JSON I/O: hooks receive event data via stdin, can output to stdout
- Hooks located in .owlen/hooks/{EventName}
CLI integration:
- All tool commands (Read, Write, Edit, Glob, Grep, Bash, SlashCommand)
now fire PreToolUse hooks before execution
- Hooks can deny operations by exiting with code 2
- Hooks timeout after 5 seconds by default
Tests added:
- pretooluse_can_deny_call: verifies hooks can block tool execution
- posttooluse_runs_parallel: verifies PostToolUse hooks execute
- sessionstart_persists_env: verifies SessionStart can create env files
- hook_timeout_works: verifies timeout mechanism
- hook_not_found_is_ok: verifies missing hooks don't cause errors
All 63 tests passing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
29 lines
877 B
TOML
29 lines
877 B
TOML
[package]
|
|
name = "owlen"
|
|
version = "0.1.0"
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
rust-version.workspace = true
|
|
|
|
[dependencies]
|
|
clap = { version = "4.5", features = ["derive"] }
|
|
tokio = { version = "1.39", features = ["macros", "rt-multi-thread"] }
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_json = "1"
|
|
color-eyre = "0.6"
|
|
llm-ollama = { path = "../../llm/ollama" }
|
|
tools-fs = { path = "../../tools/fs" }
|
|
tools-bash = { path = "../../tools/bash" }
|
|
tools-slash = { path = "../../tools/slash" }
|
|
config-agent = { package = "config-agent", path = "../../platform/config" }
|
|
permissions = { path = "../../platform/permissions" }
|
|
hooks = { path = "../../platform/hooks" }
|
|
futures-util = "0.3.31"
|
|
|
|
[dev-dependencies]
|
|
assert_cmd = "2.0"
|
|
predicates = "3.1"
|
|
httpmock = "0.7"
|
|
tokio = { version = "1.39", features = ["macros", "rt-multi-thread"] }
|
|
tempfile = "3.23.0"
|