Skip to content

Guides

This page applies the model to a real workflow. Open the guides overview

Using hooks

Guide

Use Git hooks when you want immediate local feedback before commit and push. In envctl, hooks exist for one focused reason: keep envctl guard secrets wired into the local Git flow in a visible, repairable way.

When to use this guide

Use this page when:

  • you want envctl-managed hook protection in a repository
  • hook status looks unclear or drifted
  • you need to install, repair, force, or remove managed wrappers

If you want the concept, read Hooks first.

Starting point

In most repositories, the normal path is:

bootstrap hooks
$ envctl init
$ envctl hooks status

init attempts to install managed hooks during repository bootstrap. If that does not complete cleanly, inspect or repair hooks explicitly afterwards.

Step 1: check current hook state

envctl hooks status

Typical states:

  • healthy
  • missing
  • drifted
  • foreign
  • not_executable
  • unsupported

Practical reading:

  • healthy → protection is in place
  • missing → install it
  • drifted / not_executable → repair it
  • foreign → something else owns that hook name
  • unsupported → envctl refuses to manage that hooks path

Step 2: install or repair

If wrappers are missing:

envctl hooks install

If wrappers exist but look wrong:

envctl hooks repair

Both commands stay conservative by default and leave foreign hooks alone.

Step 3: force only when you mean takeover

envctl hooks install --force
envctl hooks repair --force

Use --force intentionally

--force allows envctl to overwrite foreign hooks for supported hook names in the effective managed hooks path. It is not a general “fix everything” switch.

Step 4: remove only envctl-managed wrappers

envctl hooks remove

This removes managed wrappers only. It does not remove foreign hooks.

Common branches

  • if the hooks path is unsupported, fix the Git hooks path first
  • if the hooks are foreign, decide whether envctl should really take ownership
  • if hooks are healthy but behavior still looks wrong, the issue may be staged content or workflow assumptions, not the wrapper itself

guard secrets

See exactly what the managed wrappers execute.

Open guard reference

Hooks troubleshooting

Go deeper when hook state itself is missing, drifted, foreign, or unsupported.

Open hooks troubleshooting

Hooks reference

Inspect the exact command surface and semantics.

Open hooks reference