[Sprint 3] feat: Implement branch name validation hook for git-flow #226

Closed
opened 2026-01-27 21:51:28 +00:00 by lmiranda · 0 comments
Owner

Description

Implement a PreToolUse hook that validates branch names follow the project naming conventions when creating new branches.

Implementation

Wiki: Sprint 3: Hooks Implementation

Plugin: plugins/git-flow/

Technical Details

Hook Configuration

  • Event: PreToolUse
  • Tool Filter: Bash (detect git checkout -b, git switch -c)
  • Behavior: Block if branch name is invalid

Branch Naming Rules

  • Format: type/description
  • Lowercase only, max 50 chars
  • Valid types: feat, fix, docs, refactor, test, chore, hotfix, release

Files to Create/Modify

plugins/git-flow/hooks/
  hooks.json              # Add PreToolUse hook
  validate-branch-name.sh # Validation script

Acceptance Criteria

  • Hook defined in hooks/hooks.json (NOT plugin.json)
  • Validates branch naming format
  • Blocks invalid names with clear error
  • Ignores switching to existing branches
  • README updated

Technical Notes

CRITICAL: Hooks must be in hooks/hooks.json, NOT inline in plugin.json.

## Description Implement a `PreToolUse` hook that validates branch names follow the project naming conventions when creating new branches. ## Implementation **Wiki:** [Sprint 3: Hooks Implementation](https://gitea.hotserv.cloud/personal-projects/leo-claude-mktplace/wiki/Change-V5.2.0%3A-Plugin-Enhancements-Proposal-%28Sprint-3-Hooks%29) **Plugin:** `plugins/git-flow/` ## Technical Details ### Hook Configuration - **Event:** `PreToolUse` - **Tool Filter:** `Bash` (detect `git checkout -b`, `git switch -c`) - **Behavior:** Block if branch name is invalid ### Branch Naming Rules - Format: `type/description` - Lowercase only, max 50 chars - Valid types: `feat`, `fix`, `docs`, `refactor`, `test`, `chore`, `hotfix`, `release` ### Files to Create/Modify ``` plugins/git-flow/hooks/ hooks.json # Add PreToolUse hook validate-branch-name.sh # Validation script ``` ## Acceptance Criteria - [ ] Hook defined in `hooks/hooks.json` (NOT plugin.json) - [ ] Validates branch naming format - [ ] Blocks invalid names with clear error - [ ] Ignores switching to existing branches - [ ] README updated ## Technical Notes **CRITICAL:** Hooks must be in `hooks/hooks.json`, NOT inline in plugin.json.
lmiranda added the Type/FeatureEffort/MPriority/HighComplexity/Medium labels 2026-01-27 21:51:28 +00:00
lmiranda added this to the Sprint 3 - Hooks milestone 2026-01-27 21:55:28 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: personal-projects/leo-claude-mktplace#226