diff --git a/README.md b/README.md index fa56042..b9b3e3a 100644 --- a/README.md +++ b/README.md @@ -73,9 +73,12 @@ The check validates four things for every non-break-glass Agent PR: Unknown roles, missing `bug-` segment, uppercase bug-ids, and empty kebab descriptions all produce a `FAIL[check-naming]` log line. -2. **Title form** — for a `role/bug` branch the title must start with - `[bug-] `. For a `chore` branch the title must have no `[bug-id]` - prefix. If both carry a bug-id they must match. +2. **Title form** — for a `role/bug` branch the title must be + `[bug-] type(scope): description`. The type starts with a lowercase + letter and the type and one-component scope contain only lowercase letters, + digits, and hyphens. An optional `!` may follow the scope, and the description + must contain a non-whitespace character. For a `chore` branch the title must + have no `[bug-id]` prefix. If both carry a bug-id they must match. 3. **Tracking and attribution** — on Bug-backed work, `## Tracking` contains both the literal `Fixes bug-` automation token and the matching navigable diff --git a/check.sh b/check.sh index 7fc97bc..0297804 100755 --- a/check.sh +++ b/check.sh @@ -125,12 +125,12 @@ if [ "${BRANCH_KIND}" = "role-bug" ]; then if [ -z "${TITLE_BUG}" ]; then echo "FAIL[check-naming]: title must lead with [${BRANCH_BUG}]" echo " have: ${TITLE}" - echo " want: [${BRANCH_BUG}] ${TITLE}" + echo " want: [${BRANCH_BUG}] fix(scope): description" FAILED=1 elif [ "${TITLE_BUG}" != "${BRANCH_BUG}" ]; then echo "FAIL[check-naming]: bug-id mismatch — branch carries '${BRANCH_BUG}' but title carries '${TITLE_BUG}'" FAILED=1 - elif ! printf '%s\n' "${TITLE}" | grep -qE "^\\[${BRANCH_BUG}\\] [a-z][a-z0-9-]*\\([a-z0-9][a-z0-9-]*\\)!?: .+"; then + elif ! printf '%s\n' "${TITLE}" | grep -qE "^\\[${BRANCH_BUG}\\] [a-z][a-z0-9-]*\\([a-z0-9][a-z0-9-]*\\)!?: .*[^[:space:]]$"; then echo "FAIL[check-naming]: Bug-backed title must use '[${BRANCH_BUG}] type(scope): description'" FAILED=1 fi diff --git a/tests/run b/tests/run index a63acde..da90bf1 100755 --- a/tests/run +++ b/tests/run @@ -127,6 +127,8 @@ check "role/bug Conventional title" 0 "dev/bug-x7k2m9/fix-resize" "[bug- check "role/bug plain title" 1 "dev/bug-x7k2m9/fix-resize" "[bug-x7k2m9] Fix resize" "dev" check "role/bug missing scope" 1 "dev/bug-x7k2m9/fix-resize" "[bug-x7k2m9] fix: fix resize" "dev" check "role/bug path scope" 1 "dev/bug-x7k2m9/fix-resize" "[bug-x7k2m9] fix(hub/bugs): fix resize" "dev" +check "role/bug empty description" 1 "dev/bug-x7k2m9/fix-resize" "[bug-x7k2m9] fix(hub): " "dev" +check "role/bug whitespace description" 1 "dev/bug-x7k2m9/fix-resize" "[bug-x7k2m9] fix(hub): " "dev" check "chore Conventional title" 0 "chore/bump-deps" "chore(deps): bump deps" "dev" # fail: invalid branch forms