go-agent/codex/code/scripts/validate-branch.sh
Snider 61e01bfdf1 feat: initial go-agent — agentci + jobrunner + plugins marketplace
Consolidates three codebases into a single agent orchestration repo:

- agentci (from go-scm): Clotho dual-run verification, agent config,
  SSH security (sanitisation, secure commands, token masking)
- jobrunner (from go-scm): Poll-dispatch-report pipeline with 7 handlers
  (dispatch, completion, auto-merge, publish draft, dismiss reviews,
  send fix command, tick parent epic)
- plugins marketplace (from agentic/plugins): 27 Claude/Codex/Gemini
  plugins with shared MCP server

All 150+ tests passing across 6 packages.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-21 15:47:19 +00:00

37 lines
1.1 KiB
Bash
Executable file

#!/bin/bash
# This script validates a git branch name based on a naming convention.
full_command="${CLAUDE_TOOL_INPUT:-$*}"
# Check for override flag
if [[ "$full_command" =~ --no-verify ]]; then
echo "✓ Branch validation skipped due to --no-verify flag."
exit 0
fi
branch_name=""
# Regex to find branch name from 'git checkout -b <branch> ...'
if [[ "$full_command" =~ git\ checkout\ -b\ ([^[:space:]]+) ]]; then
branch_name="${BASH_REMATCH[1]}"
# Regex to find branch name from 'git branch <branch> ...'
elif [[ "$full_command" =~ git\ branch\ ([^[:space:]]+) ]]; then
branch_name="${BASH_REMATCH[1]}"
fi
if [[ -z "$branch_name" ]]; then
exit 0
fi
convention_regex="^(feat|fix|refactor|docs|test|chore)/.+"
if [[ ! "$branch_name" =~ $convention_regex ]]; then
echo "❌ Invalid branch name: '$branch_name'"
echo " Branch names must follow the convention: type/description"
echo " Example: feat/new-login-page"
echo " (To bypass this check, use the --no-verify flag)"
exit 1
fi
echo "✓ Branch name '$branch_name' is valid."
exit 0