framework docs
Git

git_hooks_install()

Install Git Pre-commit Hook

Creates a pre-commit hook that runs Framework checks based on settings.yml settings.

Usage

git_hooks_install(config_file = NULL, force = FALSE, verbose = TRUE)

Arguments

config_file
Path to configuration file (default: "settings.yml")
force
Logical; if TRUE, overwrite existing hook (default: FALSE)
verbose
Logical; if TRUE (default), show installation messages

Value

Invisible TRUE on success, FALSE on failure

Details

Creates or updates .git/hooks/pre-commit to run enabled Framework hooks:

  • ai_sync: Sync AI assistant context files before commit
  • data_security: Run security audit to catch data leaks
  • check_sensitive_dirs: Warn about unignored sensitive directories

Hook behavior is controlled by git.hooks.* settings in settings.yml.

Examples

if (FALSE) {
# Install hooks based on settings.yml
git_hooks_install()
# Force reinstall (overwrites existing hook)
git_hooks_install(force = TRUE)
}