Skip to content

feat(scripts): add blame command correlating page history with log entries - #43

Merged
galimba merged 5 commits into
mainfrom
feat/blame
Jul 8, 2026
Merged

feat(scripts): add blame command correlating page history with log entries#43
galimba merged 5 commits into
mainfrom
feat/blame

Conversation

@galimba

@galimba galimba commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Summary

Implements #14: new lib-blame.sh module. vault-tools.sh blame <file> prints the file's git history (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; 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

galimba and others added 2 commits July 7, 2026 16:56
…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>
@galimba

galimba commented Jul 7, 2026

Copy link
Copy Markdown
Owner Author

Independent post-push verification rejected the initial revision for a real portability bug: the regression test reassigned the exported TMPDIR convention variable, so on macOS / sandboxed CI (where TMPDIR is exported) the "outside the vault" fixture landed inside the fixture vault and the assertion failed. Fixed in the follow-up commit (FIXTURE_DIR + explicit /tmp mktemp template) together with three verifier-flagged hardenings: unit-separator delimiting for git log parsing (pipe-safe author names), kind-first awk→bash protocol (tab-safe headings), and a documented substring-match limitation. Test verified passing under both unset and exported TMPDIR.

galimba added 3 commits July 7, 2026 22:04
# Conflicts:
#	.vault/scripts/vault-tools.sh
#	CHANGELOG.md
@galimba
galimba merged commit f0c448b into main Jul 8, 2026
7 checks passed
@galimba
galimba deleted the feat/blame branch July 8, 2026 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(scripts): add blame command for correlating page history with log entries

1 participant