refactor(cli): share diagnostics hook inspection - #171
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughAdds a shared diagnostics module for hook inspection and repository-relative path display, then refactors ChangesShared hook diagnostics refactor
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d26acb7937
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let inspection = inspect_hook(repository_root, hooks_dir, phase); | ||
| matches!(inspection.state(), HookInspectionState::Managed { .. }).then_some(inspection) |
There was a problem hiding this comment.
Keep obsolete detection header-only
For unconfigured hooks, status only needs to know whether the git-smee managed marker is present, but this now reuses inspect_hook, which only returns Managed after fs::read_to_string succeeds. A stale managed hook with the marker in its header but non-UTF-8 bytes later in the file will be treated as Unreadable and filtered out here, so git smee status reports no obsolete hook even though the installer/pruning logic would still treat it as managed based on the header alone. Preserve the previous header-only check for obsolete hooks instead of requiring the whole file to decode as UTF-8.
Useful? React with 👍 / 👎.
Summary
doctorandstatusto use the shared inspection and expected-wrapper drift helpers.Refs #164
Validation
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo test --workspace --all-targets --all-featuresgit smee init,git smee install,git smee doctor,git smee doctor --json,git smee status,git smee status --json; parsed JSON statuses wereok.Summary by CodeRabbit
New Features
statusanddoctoroutput to better identify managed, missing, invalid, unreadable, and stale hook scripts.Bug Fixes