Reference
This page documents exact behavior. Open the reference overview
hooks¶
hooks manages the small set of Git hooks that envctl owns.
Use it when you need exact behavior for hook status, install, repair, or removal.
envctl hooks status
envctl hooks install [--force]
envctl hooks repair [--force]
envctl hooks remove
Purpose¶
hooks manages the small set of Git hooks that envctl owns itself.
This command group exists for one product goal only: keep envctl guard secrets wired into the local Git flow in a visible, verifiable, and repairable way.
Scope¶
envctl does not act as a generic hooks framework.
It only manages these supported hooks:
pre-commitpre-push
Both wrappers run the same internal policy:
Commands¶
envctl hooks status¶
Inspects the supported hooks and reports whether they are:
healthymissingdriftedforeignnot_executableunsupported
This is the command to use when you want to verify that local Git protection is still in place.
envctl hooks install¶
Creates missing managed hooks and rewrites drifted managed hooks back to the canonical wrapper.
By default it does not overwrite foreign hooks.
envctl hooks repair¶
Converges the supported managed hooks back to a functional state.
That includes:
- creating missing managed hooks
- rewriting drifted managed hooks
- fixing executable permissions on POSIX platforms
envctl hooks remove¶
Removes the managed hooks that envctl owns.
It does not remove foreign hooks.
--force¶
--force is supported by:
envctl hooks installenvctl hooks repair
It allows envctl to overwrite foreign hooks for the supported hook names inside the effective managed hooks path.
It does not allow:
- operating on unsupported hooks paths outside the repository perimeter
- extending management to unsupported hook names
- merging multiple hook implementations automatically
Hooks path policy¶
envctl resolves the effective hooks directory through Git itself.
It only manages hooks when that effective hooks path stays inside the current repository tree.
If the effective hooks path resolves outside the repository, envctl reports unsupported and does not modify it.
This is an intentional product boundary.
Exit codes¶
hooks commands are strict on purpose.
hooks status¶
- exits
0only when the managed hooks are healthy - exits non-zero when protection is missing, drifted, conflicted, or unsupported
hooks install, repair, remove¶
- exit
0only when the final operation result is complete and conflict-free - may still apply useful changes before returning non-zero if the final state remains partial or conflicted
JSON output¶
hooks commands support --output json.
The hooks JSON contract is versioned independently and currently emits:
schema_version: 1okcommanddata.hooks_pathdata.overall_statusdata.changedfor mutating operationsdata.results[]
Related pages¶
Hooks troubleshooting¶
Open this when hook state is missing, drifted, foreign, or unsupported.
Relationship to init¶
envctl init attempts to install managed hooks automatically as part of repository bootstrap.
If that installation cannot complete cleanly, init does not abort the whole repository setup. Instead, it warns and leaves hook management available through the hooks command group.