How jeliasson/npm-husky-hooks works
@jeliasson/husky-hooks is a configurable Husky hook runner with a CLI for creating configuration and running hooks for Git events. The main flow parses the event command, loads and validates project configuration, dispatches configured hooks, and reports their results. The graph also includes the documented config-generation command and the README’s three principal hooks. Some hook implementations are only indexed, not excerpted; their dispatch links are supported by the indexed references, while unsampled implementation details are omitted.
Main entry points: config.ts Project config · hooks.ts Hook dispatcher · index.ts Application entry · response.ts Result and errors
Components 16
CLI entry
- Argument parser
src/cli.ts - Application entry
src/index.ts - CLI commands
src/commands.ts
Configuration
- Project config
src/config.ts - Config schema
src/types.ts
Hook runtime
- Hook dispatcher
src/hooks.ts - Branch protection
src/hooks/checkBranch.ts - Lock-file check
src/hooks/checkLockFiles.ts - Command runner
src/hooks/runCmd.ts - IP test hook
src/hooks/testCheckIp.ts - Delay test hook
src/hooks/testSleep.ts
Hook support
- Result and errors
src/response.ts - Git executable
- Project filesystem
- Shell command
Other components
- Developer or Husky
Connections 25
- Developer or Husky → Argument parser: starts CLI
README.md - Argument parser → Application entry: returns arguments
src/index.ts - Application entry → CLI commands: checks command
src/index.ts - CLI commands → Project config: creates config
src/commands.ts - CLI commands → Argument parser: reads options
src/commands.ts - Application entry → Project config: loads and validates
src/index.ts - Project config → Config schema: validates against
src/config.ts - Application entry → Hook dispatcher: dispatches hooks
src/index.ts - Hook dispatcher → Branch protection: dispatches
src/hooks.ts - Hook dispatcher → Lock-file check: dispatches
src/hooks.ts - Hook dispatcher → Command runner: dispatches
src/hooks.ts - Hook dispatcher → IP test hook: dispatches
src/hooks.ts - Hook dispatcher → Delay test hook: dispatches
src/hooks.ts - Branch protection → Project config: reads settings
src/hooks/checkBranch.ts - Branch protection → Git executable: reads current branch
src/hooks/checkBranch.ts - Lock-file check → Project config: reads settings
src/hooks/checkLockFiles.ts - Lock-file check → Project filesystem: checks file presence
src/hooks/checkLockFiles.ts - Command runner → Shell command: runs command
src/hooks/runCmd.ts - Command runner → Project config: reads config name
src/hooks/runCmd.ts - Delay test hook → Project config: reads delay
src/hooks/testSleep.ts - Application entry → Result and errors: reports errors
src/index.ts - Branch protection → Result and errors: creates result
src/hooks/checkBranch.ts - Lock-file check → Result and errors: creates result
src/hooks/checkLockFiles.ts - Command runner → Result and errors: creates result
src/hooks/runCmd.ts - Delay test hook → Result and errors: creates result
src/hooks/testSleep.ts