feat(scripts): add blame command correlating page history with log entries - #43
Merged
Conversation
…tries New module lib-blame.sh: vault-tools.sh blame <file> prints the git history of a vault file (git log --follow: DATE | SHA | AUTHOR | SUMMARY) and correlates each commit with wiki/log.md entries — matched by SR-005 heading date, then refined by file path against each entry's "Files modified" block; entries that only share the date are labeled "(date match only)". Rejects paths outside the vault (exit 2) and degrades gracefully outside a git repo (exit 1). Adds tests/test-blame.sh covering correlation, path-aware labeling, outside-vault rejection, and missing-file usage errors. Closes #14 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Independent verification of the pushed branch found the regression test breaks when the caller's environment exports TMPDIR (macOS default, sandboxed CI): reassigning the exported variable made the later bare mktemp create the "outside the vault" fixture inside the fixture vault. The test now uses FIXTURE_DIR and an explicit /tmp template for the outside file. Also hardens lib-blame.sh parsing: git log fields are delimited with the unit separator instead of '|' (author names containing pipes no longer shift columns), the awk-to-bash correlation protocol emits the match kind before the heading (a tab inside a heading title can no longer corrupt the field split), and the substring nature of the path match is documented. Refs #14 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Owner
Author
|
Independent post-push verification rejected the initial revision for a real portability bug: the regression test reassigned the exported |
# Conflicts: # CHANGELOG.md
# Conflicts: # CHANGELOG.md
# Conflicts: # .vault/scripts/vault-tools.sh # CHANGELOG.md
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
Implements #14: new
lib-blame.shmodule.vault-tools.sh blame <file>prints the file's git history (git log --follow: DATE | SHA | AUTHOR | SUMMARY) and correlates each commit withwiki/log.mdentries — matched by SR-005 heading date, then refined by file path against each entry's "Files modified" block; same-day entries that don't mention the file are labeled(date match only). Graceful failures: exit 2 for missing/outside-vault paths (with usage), exit 1 outside a git repo, warning-only for uncommitted files.Verification
test-blame.sh: correlation, path-aware labeling with two same-day entries, outside-vault rejection, missing-file usage — passes. shellcheck/markdownlint clean. Adversarial review found the date-only correlation gap vs the issue's AC ("by date and file path") and the outside-vault crash; both fixed and regression-tested.Closes #14
🤖 Generated with Claude Code