Skip to main content

Crate cuenv_hooks

Crate cuenv_hooks 

Source
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:

  • onEnter hooks run when entering a directory with a cuenv configuration
  • onExit hooks run when leaving such a directory
  • prePush hooks 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§

ApprovalManager
Manages approval of configurations before hook execution
ApprovalRecord
Record of an approved configuration
ConfigSummary
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
HookExecutionConfig
Configuration for hook execution
HookExecutionState
Represents the state of hook execution for a specific directory
HookExecutor
Manages hook execution with background processing and state persistence
HookResult
Result of executing a single hook
Hooks
Collection of hooks that can be executed
StateManager
Manages persistent state for hook execution sessions

Enums§

ApprovalStatus
Status of approval check for a configuration
Error
Main error type for cuenv-hooks operations
ExecutionStatus
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