Skip to content

Commit 513c7ab

Browse files
committed
refactor: move git hook logic from separate files to inline lefthook commands
- Remove standalone .lefthook/prepare-commit-msg/commitment.sh script - Remove husky compatibility wrapper scripts (.husky/_/pre-commit and prepare-commit-msg) - Integrate commitment invocation directly into lefthook.yml prepare-commit-msg command - Preserve hook preservation logic using lefthook's {2} parameter substitution - Skip hook execution when commit source is provided (message, template, merge, squash) 🤖 Generated with Claude via commitment
1 parent 10484b6 commit 513c7ab

4 files changed

Lines changed: 13 additions & 149 deletions

File tree

.husky/_/pre-commit

Lines changed: 0 additions & 69 deletions
This file was deleted.

.husky/_/prepare-commit-msg

Lines changed: 0 additions & 69 deletions
This file was deleted.

.lefthook/prepare-commit-msg/commitment.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

lefthook.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ prepare-commit-msg:
1414
skip:
1515
- merge
1616
- rebase
17-
scripts:
18-
"commitment.sh":
19-
runner: sh
17+
commands:
18+
commitment:
19+
# Run for regular commits only
20+
# {1} is the commit message file path
21+
# {2} is commit source: "message" (from -m), "template", "merge", "squash", or "commit"
22+
# When no source (regular git commit), lefthook doesn't substitute {2}
23+
run: |
24+
# Only run if {2} contains curly braces (unsubstituted = regular commit)
25+
# Skip if {2} = "message", "template", etc. (user already provided message)
26+
case "{2}" in
27+
*"{"*) ./dist/cli.js --message-only > "{1}" ;;
28+
esac
29+
interactive: true

0 commit comments

Comments
 (0)