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.
Claude's interpretation and implementation of #3 . This looks like a good foundation to start.
These were the prompts:
After a quick and naive test, it outputs the same list as using
target-determinatorCLI directly, for the diff between HEAD and HEAD~2You can clearly tell the following is not written by me as a human.
✅ Implementation Complete
I've added a comprehensive hash persistence and comparison feature to the target-determinator project:
New Features Added:
- PersistHashes() - Saves computed target hashes to JSON files
- LoadPersistedHashes() - Loads persisted hash data from JSON files
- CompareHashFiles() - Compares two hash files and identifies differences
- Rich metadata including git commit SHA, timestamp, Bazel version, and workspace info
- Command: hash-persister --output
- Computes and persists target hashes for any git commit
- Supports all existing target-determinator flags (--targets, --bazel, etc.)
- Creates JSON files with comprehensive hash data
- Command: hash-differ
- Compares two persisted hash files to identify Bazel diffs
- Multiple output formats:
- Efficient comparison without recomputing hashes
Key Benefits:
Usage Examples:
Persist hashes for a commit
hash-persister --output commit1.json --targets "//..." abcd123
Persist hashes for another commit
hash-persister --output commit2.json --targets "//..." efgh456
Compare the commits to find affected targets
hash-differ --format targets commit1.json commit2.json
Get detailed comparison summary
hash-differ --format summary --verbose commit1.json commit2.json
Testing Results:
✅ Both binaries build successfully with Bazel✅ Hash persistence works correctly with real git commits✅ Hash comparison
correctly identifies differences between commits✅ Hash comparison correctly shows no differences for identical commits✅ All
output formats (targets, summary, json) work as expected✅ Integration with existing CLI flags and target patterns works
The implementation addresses the GitHub issue requirement for persisting computed hashes and comparing them to identify Bazel
diffs efficiently.