Skip to content

feat(hooks): add manual hook execution with hooks run command#245

Merged
avihut merged 14 commits intomasterfrom
feat/run-hook
Feb 20, 2026
Merged

feat(hooks): add manual hook execution with hooks run command#245
avihut merged 14 commits intomasterfrom
feat/run-hook

Conversation

@avihut
Copy link
Owner

@avihut avihut commented Feb 20, 2026

Summary

  • Add git daft hooks run command for manually triggering hooks on demand, with --job, --tag, and --dry-run filters
  • Consolidate list and reset-trust as subcommands under trust (trust list, trust reset, trust reset all)
  • Remove post-init hook type (was unused, worktree-post-create already covers the use case)
  • Fix hooks install to not modify existing config files (prints YAML snippet instead)
  • Add shell completions for daft subcommands (bash/zsh/fish/fig) with dynamic hook type and job name completion
  • Reorder hooks subcommands for better discoverability: trust, prompt, deny, status, run, install, validate, dump, migrate

Test plan

  • mise run fmt -- zero changes
  • mise run clippy -- zero warnings
  • mise run test:unit -- 353 tests pass
  • mise run man:verify -- man pages up to date
  • Manual testing: hooks run, --dry-run, --job, --tag, trust hint from untrusted repo
  • Shell completion testing: daft __complete hooks-run "" returns configured hooks

🤖 Generated with Claude Code

avihut and others added 14 commits February 20, 2026 10:23
Allows users to manually trigger hooks via `git daft hooks run <type>`,
bypassing trust checks. Supports --job, --tag, and --dry-run filters.
When invoked without arguments, lists all configured hooks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Previously, `hooks install` appended YAML at the end of the file
which broke the YAML structure. Now it prints a copy-paste snippet
instead, and uses `find_config_file()` to locate the actual config.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
A post-init hook can never fire in practice since the repository
doesn't exist yet when `git daft init` runs, so there's no daft.yml
or .daft/hooks/ to define hooks in.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wire up tab completion for `daft hooks run` across all shells
(bash, zsh, fish, fig). The dynamic completion backend already
existed but shell scripts weren't calling it.

- Bash/Zsh/Fish: register `_daft` completion function for both
  `daft` and `git-daft`, with dynamic hook type and job name
  completion via `daft __complete hooks-run`
- Fig: extend FigSubcommand with nested subcommands/args/options,
  build full hooks subcommand tree with `run` generator
- Also complete top-level daft subcommands and hooks subcommands

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Reorder hooks subcommands: trust, prompt, deny, status, run, install,
  validate, dump, migrate
- Update SKILL.md to remove stale `list`/`reset-trust` references
- Add "Manual Hook Execution" section to hooks guide
- Reorder CLI reference to match help output

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@avihut avihut added this to the v1.1.0 milestone Feb 20, 2026
@avihut avihut added feat New feature fix Bug fix labels Feb 20, 2026
@avihut avihut self-assigned this Feb 20, 2026
@avihut avihut merged commit 9604168 into master Feb 20, 2026
6 checks passed
@avihut avihut deleted the feat/run-hook branch February 20, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat New feature fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant