binary-agents 1.0.10 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/branch.md +62 -0
- package/package.json +1 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Pull from main and create a new branch following the project's branch naming convention
|
|
3
|
+
allowed-tools: Bash(git branch:*), Bash(git checkout:*), Bash(git switch:*), Bash(git pull:*), Bash(git fetch:*), Bash(git log:*), Bash(git rev-parse:*)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Auto Branch Creator
|
|
7
|
+
|
|
8
|
+
You are a branch creator that pulls the latest from main and creates a new branch following the project's naming conventions.
|
|
9
|
+
|
|
10
|
+
## Context Information
|
|
11
|
+
|
|
12
|
+
**Current branch:**
|
|
13
|
+
!`git rev-parse --abbrev-ref HEAD`
|
|
14
|
+
|
|
15
|
+
**All branches (for convention analysis):**
|
|
16
|
+
!`git branch -a --sort=-committerdate`
|
|
17
|
+
|
|
18
|
+
**Recent commit history (for context):**
|
|
19
|
+
!`git log --oneline -10`
|
|
20
|
+
|
|
21
|
+
**Main branch name:**
|
|
22
|
+
!`git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo "main"`
|
|
23
|
+
|
|
24
|
+
## Your Task
|
|
25
|
+
|
|
26
|
+
1. **Analyze branch naming convention** from the existing branches above
|
|
27
|
+
- Identify patterns (e.g., `feature/xxx`, `feat/xxx`, `fix/xxx`, `chore/xxx`, `hotfix/xxx`, `{username}/xxx`, etc.)
|
|
28
|
+
- Note the separator style (slash `/`, dash `-`, etc.)
|
|
29
|
+
- If no clear convention exists, default to `{type}/{description}` format
|
|
30
|
+
|
|
31
|
+
2. **Pull latest from main**
|
|
32
|
+
- Switch to main branch: `git checkout main` or `git switch main`
|
|
33
|
+
- Pull latest changes: `git pull origin main`
|
|
34
|
+
- If there are uncommitted changes, warn the user first
|
|
35
|
+
|
|
36
|
+
3. **Understand the user's intent**
|
|
37
|
+
- Ask the user what they want to work on if not clear from context
|
|
38
|
+
- Determine the appropriate branch type:
|
|
39
|
+
- `feature/` or `feat/` - New feature
|
|
40
|
+
- `fix/` - Bug fix
|
|
41
|
+
- `chore/` - Maintenance, refactoring, tooling
|
|
42
|
+
- `hotfix/` - Urgent production fix
|
|
43
|
+
- `docs/` - Documentation changes
|
|
44
|
+
|
|
45
|
+
4. **Generate and create the branch**
|
|
46
|
+
- Follow the detected convention pattern
|
|
47
|
+
- Use lowercase and hyphens for the description part (e.g., `feature/add-user-auth`)
|
|
48
|
+
- Keep it concise but descriptive
|
|
49
|
+
- Create the branch: `git checkout -b {branch-name}` or `git switch -c {branch-name}`
|
|
50
|
+
|
|
51
|
+
## Output Format
|
|
52
|
+
|
|
53
|
+
1. Show detected branch convention (if any)
|
|
54
|
+
2. Pull from main and show result
|
|
55
|
+
3. Create the new branch
|
|
56
|
+
4. Confirm success with the new branch name
|
|
57
|
+
|
|
58
|
+
## Important Notes
|
|
59
|
+
|
|
60
|
+
- If there are uncommitted changes, warn the user and suggest stashing or committing first
|
|
61
|
+
- If the user is already on a feature branch with uncommitted work, ask before switching
|
|
62
|
+
- Always pull the latest main before creating the new branch to avoid conflicts later
|