From ca51980ffc106081ce858575c0d1c70300f13cd4 Mon Sep 17 00:00:00 2001 From: gastown/crew/joe Date: Sun, 25 Jan 2026 12:04:06 -0800 Subject: [PATCH] fix(dolt): recognize shim hooks as Dolt-compatible Shim hooks (bd-shim marker) delegate to 'bd hook' command which already handles Dolt backend correctly. Update both doctor check and migration warning to recognize shim hooks as OK. Only inline hooks (older style with embedded logic) need the explicit Dolt backend check in the shell script. Co-Authored-By: Claude Opus 4.5 --- cmd/bd/doctor/git.go | 15 ++++++++++++--- cmd/bd/migrate_dolt.go | 12 ++++++++++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/cmd/bd/doctor/git.go b/cmd/bd/doctor/git.go index 756bb023..b46e7224 100644 --- a/cmd/bd/doctor/git.go +++ b/cmd/bd/doctor/git.go @@ -800,7 +800,16 @@ func CheckGitHooksDoltCompatibility(path string) DoctorCheck { contentStr := string(content) - // Check if it's a bd hook + // Shim hooks (bd-shim) delegate to 'bd hook' which handles Dolt correctly + if strings.Contains(contentStr, bdShimMarker) { + return DoctorCheck{ + Name: "Git Hooks Dolt Compatibility", + Status: StatusOK, + Message: "Shim hooks (Dolt handled by bd hook command)", + } + } + + // Check if it's a bd inline hook if !strings.Contains(contentStr, bdInlineHookMarker) && !strings.Contains(contentStr, "bd") { return DoctorCheck{ Name: "Git Hooks Dolt Compatibility", @@ -809,12 +818,12 @@ func CheckGitHooksDoltCompatibility(path string) DoctorCheck { } } - // Check if it has the Dolt backend skip logic + // Check if inline hook has the Dolt backend skip logic if strings.Contains(contentStr, `"backend"`) && strings.Contains(contentStr, `"dolt"`) { return DoctorCheck{ Name: "Git Hooks Dolt Compatibility", Status: StatusOK, - Message: "Hooks have Dolt backend check", + Message: "Inline hooks have Dolt backend check", } } diff --git a/cmd/bd/migrate_dolt.go b/cmd/bd/migrate_dolt.go index 834c208f..7476ac40 100644 --- a/cmd/bd/migrate_dolt.go +++ b/cmd/bd/migrate_dolt.go @@ -172,16 +172,24 @@ func hooksNeedDoltUpdate(beadsDir string) bool { return false // No hook installed } - // Check if it's a bd hook and lacks the Dolt skip logic contentStr := string(content) + + // Shim hooks (bd-shim) delegate to 'bd hook' which handles Dolt correctly + if strings.Contains(contentStr, "bd-shim") { + return false // Shim hooks are fine + } + + // Check if it's a bd inline hook if !strings.Contains(contentStr, "bd") { return false // Not a bd hook } + + // Check if inline hook has the Dolt skip logic if strings.Contains(contentStr, `"backend"`) && strings.Contains(contentStr, `"dolt"`) { return false // Already has Dolt check } - return true // bd hook without Dolt check + return true // bd inline hook without Dolt check } // handleToSQLiteMigration migrates from Dolt to SQLite backend (escape hatch).