Skip to main content

Module hook

Module hook 

Source
Expand description

Bundled git hooks — decided hook (PORT-CONTRACT.d/15).

Port of src/rac/core/hooks.py (registry + resource loading) and src/asdecided/services/hook.py (install_hook). The packaged <style>.sh scripts are embedded verbatim from rust/decided-engine/assets/hooks/, vendored byte-identical copies of the Python package files (unit test below); the INSTALLED file is named <style> with no extension, under <dir>/.git/hooks/, and is made executable (hook brief, landmines 1-2).

Structs§

HookSpec
One bundled git hook: its style (the git hook filename) and description.
InstalledHook
Result of a decided hook install run (InstalledHook; bytes_written is in the oracle’s model but absent from its JSON).

Enums§

HookInstallError
The failure contract of install_hook, message-shaped like the oracle. HookNotFound is unreachable via the CLI (argparse --style choices fire first) and is folded into the usage-error path by the caller.

Constants§

BUNDLED_HOOKS
Bundled hooks, registry order. install defaults to the first.
DEFAULT_STYLE
DEFAULT_STYLE — the first bundled hook.

Functions§

available_hooks
available_hooks() — bundled hook styles, registry order.
install_hook
install_hook(target_dir, style) — write the bundled style script to <dir>/.git/hooks/<style> and make it executable (git requires the exec bit; the oracle ORs S_IXUSR|S_IXGRP|S_IXOTH onto the fresh file’s mode, yielding 0755 under the usual umask).