KeiSeiKit-1.0/hooks
Parfii-bot 2e8c8acced feat(hooks): tomd-preread PreToolUse(Read) auto-convert hook
POSIX sh hook (50 LOC) that intercepts Read on .docx/.doc/.xlsx/.pptx/.csv
and auto-redirects Claude to a cached markdown conversion via the tomd
primitive.

- jq absence → exit 0 (graceful degrade, matches assemble-validate style)
- tomd primitive missing → exit 0 (don't block)
- cache dir via KEISEI_TOMD_CACHE env (default /tmp/keisei-tomd-cache)
- cache key = basename + mtime, portable stat for macOS/Linux
- exit 2 with [tomd-preread] stderr message on successful conversion
- conversion failure → exit 0 (let Claude try original, fail naturally)

Not wired into settings-snippet.json yet — follow-up commit adds the
PreToolUse(Read) entry alongside install.sh hooks-copy loop extension.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 19:43:21 +08:00
..
assemble-agents.sh fix(hooks): surface FAIL lines unconditionally on agent rebuild 2026-04-21 04:11:30 +08:00
assemble-validate.sh refactor(hooks): port to POSIX sh 2026-04-21 03:46:18 +08:00
no-hand-edit-agents.sh refactor(hooks): port to POSIX sh 2026-04-21 03:46:18 +08:00
tomd-preread.sh feat(hooks): tomd-preread PreToolUse(Read) auto-convert hook 2026-04-21 19:43:21 +08:00