fix(worktrees): fix tea issues title parsing for branch names

- tea issues output has title on line 2, not line 1
- Update sed command to extract from correct line
- Fixes branches being named "issue-N-" or "issue-N-untitled"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-13 23:45:37 +01:00
parent 3983a6ba24
commit 8f4fb16a09

View File

@@ -27,8 +27,8 @@ case "$MODE" in
WORKTREE_NAME="${REPO_NAME}-issue-${ISSUE_NUMBER}"
WORKTREE_PATH="${WORKTREES_DIR}/${WORKTREE_NAME}"
# Get issue title for branch name
ISSUE_TITLE=$(tea issues "$ISSUE_NUMBER" 2>/dev/null | grep -i "title" | head -1 | cut -d: -f2- | xargs || echo "untitled")
# Get issue title for branch name (tea issues output has title on line 2: " # #1 Title here")
ISSUE_TITLE=$(tea issues "$ISSUE_NUMBER" 2>/dev/null | sed -n '2p' | sed 's/.*#[0-9]* //' | xargs || echo "untitled")
# Create safe branch name
BRANCH_NAME="issue-${ISSUE_NUMBER}-$(echo "$ISSUE_TITLE" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | tr -cd '[:alnum:]-' | cut -c1-50)"