Expand description
Hook execution system for cuenv
This crate provides the core hook execution functionality, including:
- Hook definition and serialization
- Background hook execution with state tracking
- Approval-based security system
- Shell integration support
§Overview
The hooks system enables environment-triggered command execution:
onEnterhooks run when entering a directory with a cuenv configurationonExithooks run when leaving such a directoryprePushhooks run before git push operations
§Security
All hook configurations must be approved by the user before execution. This prevents malicious configurations from executing arbitrary commands. In CI environments, hooks are auto-approved since the environment is assumed to be already secured.
Structs§
- Approval
Manager - Manages approval of configurations before hook execution
- Approval
Record - Record of an approved configuration
- Config
Summary - Summary of hook counts for display
- Hook
- A hook represents a command that can be executed when entering or exiting environments Based on schema/hooks.cue #ExecHook definition
- Hook
Execution Config - Configuration for hook execution
- Hook
Execution State - Represents the state of hook execution for a specific directory
- Hook
Executor - Manages hook execution with background processing and state persistence
- Hook
Result - Result of executing a single hook
- Hooks
- Collection of hooks that can be executed
- State
Manager - Manages persistent state for hook execution sessions
Enums§
- Approval
Status - Status of approval check for a configuration
- Error
- Main error type for cuenv-hooks operations
- Execution
Status - Status of hook execution
Functions§
- check_
approval_ status - Check the approval status for a configuration.
- compute_
approval_ hash - Compute a hash for approval based only on security-sensitive hooks.
- compute_
directory_ key - Compute a directory key for the approvals map
- compute_
execution_ hash - Compute a hash for hook execution that includes input file contents.
- compute_
instance_ hash - Compute a hash for a unique execution instance (directory + config)
- execute_
hooks - Execute hooks sequentially
- is_ci
- Check if the current process is running in a CI environment.
Type Aliases§
- Result
- Result type for cuenv-hooks operations