When bd init installs hooks with chaining, it renames the user's original hook to .old and creates a new bd hook that chains to it. If bd doctor later runs bd hooks install --chain, it would: 1. Not recognize the inline bd hook (from bd init) as a bd hook 2. Rename it to .old, overwriting the user's original hook 3. Install a new shim hook This fix addresses two root causes: 1. Detection mismatch: areBdShimsInstalled() and getHookVersion() now recognize inline bd hooks (which have "# bd (beads)" marker) in addition to shim hooks (which have "# bd-shim" marker) 2. No .old protection: bd hooks install --chain now checks if .old already exists before renaming, preserving the user's original hook Fixes #1120 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
23 KiB
23 KiB