fix: resolve hooks trust mechanism issues#101
Merged
Conversation
- Fix path canonicalization in get_git_common_dir() to ensure consistent trust lookups across worktrees (core bug fix for issue #86) - Add path argument to trust, untrust, and status commands (default: .) - Show project root instead of .git directory in output - Improve help text with styled trust levels matching clap's formatting - Remove unnecessary file size display from hook listings - Make status output more concise with "PATH (type)" format - Add styles module to isolate ANSI escape codes from application code - Clarify that trust applies to all worktrees in success messages Fixes #86 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Standardize confirmation skip flags across all commands: - hooks trust/untrust: -y --yes → -f --force - branch move: -y --yes → -f --force - multi-remote enable/disable: -y --yes → -f --force - setup: merge --yes and --force into single -f --force flag Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add new `git daft hooks prompt` command for prompt-level trust - Remove --prompt flag from trust command - Update status output to show prompt command instead of trust --prompt - Rename cmd_trust to cmd_set_trust with TrustLevel parameter Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
release-plz was comparing against stale crates.io version (0.1.5) instead of git tags (v1.0.7), causing it to skip PR creation when local version exceeded registry version. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…atus - Add relative_path helper to compute shortest path between directories - Show "." when inside the repo (works from any worktree or subdirectory) - Show relative path only when running status from outside the repo Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds a short format option to `git daft hooks status` that displays a compact three-line summary: path (type), repository (if different), and hooks list with trust level. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reduces verbose trust change output to match short status format: - PATH (repository) - HOOKS LIST (TRUST LEVEL) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds `git daft hooks reset-trust` command that clears all repository trust entries and patterns from the trust database. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Uses pager (respects $PAGER, defaults to less) when output exceeds 20 lines and stdout is a terminal. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Converts ISO 8601 timestamps (2026-02-08T07:28:54Z) to a more readable format (2026-02-08 07:28) in hooks list output. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The previous implementation used naive date math that didn't account for leap years or varying month lengths, producing incorrect dates. Now uses Howard Hinnant's date algorithm for accurate conversion. Note: Existing trust entries have incorrect timestamps and will need to be re-trusted to get correct dates. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Store granted_at as Unix epoch (i64) instead of formatted string - Use chrono crate for proper local time formatting - Strip .git suffix from paths in list output - Remove manual date calculation code Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add automatic migration from V1 (string timestamps) to V2 (epoch timestamps) for the trust database. Uses version-migrate crate for type-safe migrations. - Create versioned DTOs in trust_dto.rs with MigratesTo and IntoDomain traits - Detect actual schema version by examining granted_at field type - Handle mislabeled V2 databases that have version=1 but epoch timestamps - Auto-save migrated files to persist the upgrade - Update default version from 1 to 2 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add color styling to hooks command output for better visual hierarchy: - Trust levels: green (allow), yellow (prompt), red (deny) - Path type labels in dim gray - Section headers in bold - Commands and hook names in cyan Also adds colored formatting to help text for all hooks subcommands. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Rename the subcommand from 'untrust' to 'deny' for consistency with the trust level naming (deny, prompt, allow). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
reset-trustcommand to clear all trust settingshooks listoutputversion-migratecrateuntrustcommand todenyfor consistency with trust levelspromptcommand)Changes
Trust Database
New Commands
hooks reset-trust- Clear all trust settings with confirmationhooks prompt- Separate command for conditional trust (replacestrust --prompt)UX Improvements
-s/--shortflag for compact status outputBreaking Changes
hooks untrusttohooks deny-y/--yesflag to-f/--forceTest plan
cargo test --lib)🤖 Generated with Claude Code