Skip to content

Checkout nudge: verify user-defined hook presence #30

Description

@dpritchett

Context

snag's post-checkout nudge already nags when snag hooks aren't installed. This issue extends that to user-defined hooks — scripts or tools you want wired into your local checkout that aren't snag builtins.

Use case: "I work across 100+ repos. On the day I clone a repo and every visit until I address it, snag should nag me about missing hooks — both snag builtins and any custom ones I've declared."

Example config

# snag.toml or snag-local.toml

[[hooks]]
phase = "pre-rebase"
run = "~/bin/my-personal-pre-rebase-hook"

[[hooks]]
phase = "prepare-commit-msg"
run = "./scripts/team-commit-template.sh"

Behavior

  • snag check checkout verifies these scripts exist and are executable
  • If missing or not executable, warn the user (same nudge style as missing snag hooks)
  • No execution — snag doesn't run these scripts. Lefthook (or .git/hooks/) handles that. Snag just checks they're in place.
  • Resolve ~ to home dir, relative paths from repo root

Out of scope

  • Running external scripts (lefthook already does this)
  • Remote URLs
  • Passing args or managing script output

Prior discussion

Originally proposed as a full external script execution framework. Re-scoped per discussion: snag stays focused on policy enforcement. Verifying hook installation fits that mission; running hooks does not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions