fix(session-handoff): PowerShell hook body char count [v0.3.1]

`(& git log -1 --format='%b')` in PowerShell collapses multi-line subprocess
output into string[]. The threshold check used `$body.Length` which on a
string[] returns the line count, not char count — so the body>200 condition
was effectively comparing "more than 200 lines", which is much harder to
meet. Files-count saves it in practice for big commits, but small-file
big-message commits were under-detected.

Fix: join the array back into a single string with `-join "`n"` before
measuring length. Verified via stdin-pipe smoke against current HEAD:
body chars now report 1255 (vs 29 before — the line count).

POSIX `.sh` variant unaffected — `$()` collapses output and `${#var}` is
char count.

Bump 0.3.0 → 0.3.1 PATCH (bugfix, no behavior contract change).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-24 23:41:26 +03:00
parent cc6c321b57
commit d089df7e9f
4 changed files with 17 additions and 24 deletions

View File

@@ -30,9 +30,10 @@
- [x] Update SKILL.md body — When-to-use mentions hook as opt-in alternative
- [x] Bump SKILL.md 0.2.1 → 0.3.0 (MINOR — new capability)
- [x] Reinstall via scripts/install.ps1
- [ ] stdin-pipe smoke (substantive HEAD + trivial HEAD)
- [ ] STATUS.md → 🟢 (partial: stdin smoke ✓, live-hook deferred)
- [ ] commit
- [x] stdin-pipe smoke (6 scenarios): substantive HEAD ✓ emits JSON; --amend / ls / empty / malformed / failed-commit ✓ silent skip
- [x] discover + fix PS bug: `git log %b` string[], `.Length` was line count; `-join "`n"` fix; PATCH bump 0.3.0 → 0.3.1
- [x] STATUS.md → 🟢 (partial: stdin smoke ✓, live-hook deferred to separate session)
- [ ] commit (next)
## Notes
Live-hook enable + e2e validation = separate task / separate session. Adding hook to settings.json in this active session would fire on every git commit done here, including the closure commit itself — meta-feedback loop best avoided.