Commit 923d777
feat: Generate working branch names upfront in backend API
Implements Option 3 solution for improved git repository context UX.
The backend now generates working branch names during session creation,
providing clear visibility in the UI and simplifying runner logic.
Backend Changes:
- Added branch name generation helpers in handlers/helpers.go:
- isProtectedBranch(): Detects commonly protected branches
- sanitizeBranchName(): Converts display names to valid git branch names
- generateWorkingBranch(): Core logic for branch name generation
- Uses user-requested branch if specified
- Creates work/{branch}/{sessionID} for protected branches
- Falls back to sanitized session name or session-{ID}
- Updated CreateSession and AddRepo handlers to process repos and generate
branch names upfront
- Extended SimpleRepo type with WorkingBranch and AllowProtectedWork input fields
Runner Changes:
- Simplified wrapper.py repository cloning logic
- Removed _is_protected_branch() and _handle_protected_branch() methods
- Now simply reads 'branch' from spec and checks out/creates it
- No more runtime auto-generation logic
Frontend Changes:
- Updated addRepoMutation to send workingBranch and allowProtectedWork
- Simplified Repository type (removed baseBranch/featureBranch)
- Changed display from "Base: main" to "Branch: {workingBranch}"
- Now shows the actual working branch generated by backend
User Experience:
- Users can now see the exact branch that will be used before session starts
- Protected branch handling is transparent (shows work/{branch}/{sessionID})
- Session-named branches are visible upfront (e.g., "Fix-login-bug")
Fixes part of #376
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 2746323 commit 923d777
File tree
6 files changed
+161
-105
lines changed- components
- backend
- handlers
- types
- frontend/src/app/projects/[name]/sessions/[sessionName]
- components/accordions
- runners/claude-code-runner
6 files changed
+161
-105
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
621 | 621 | | |
622 | 622 | | |
623 | 623 | | |
| 624 | + | |
624 | 625 | | |
625 | 626 | | |
626 | 627 | | |
627 | 628 | | |
628 | 629 | | |
629 | | - | |
630 | | - | |
631 | | - | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
632 | 654 | | |
633 | 655 | | |
634 | 656 | | |
| |||
1406 | 1428 | | |
1407 | 1429 | | |
1408 | 1430 | | |
1409 | | - | |
1410 | | - | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
1411 | 1435 | | |
1412 | 1436 | | |
1413 | 1437 | | |
1414 | 1438 | | |
1415 | 1439 | | |
1416 | 1440 | | |
1417 | 1441 | | |
1418 | | - | |
1419 | | - | |
1420 | | - | |
1421 | | - | |
1422 | 1442 | | |
1423 | 1443 | | |
1424 | 1444 | | |
| |||
1447 | 1467 | | |
1448 | 1468 | | |
1449 | 1469 | | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
1450 | 1490 | | |
1451 | 1491 | | |
1452 | | - | |
| 1492 | + | |
1453 | 1493 | | |
1454 | 1494 | | |
1455 | 1495 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
Lines changed: 6 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
| 11 | + | |
14 | 12 | | |
15 | 13 | | |
16 | 14 | | |
| |||
105 | 103 | | |
106 | 104 | | |
107 | 105 | | |
108 | | - | |
109 | | - | |
110 | | - | |
| 106 | + | |
| 107 | + | |
111 | 108 | | |
112 | 109 | | |
113 | 110 | | |
| |||
135 | 132 | | |
136 | 133 | | |
137 | 134 | | |
138 | | - | |
139 | | - | |
140 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
141 | 138 | | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | 139 | | |
149 | 140 | | |
150 | 141 | | |
| |||
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
| 217 | + | |
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
| |||
1460 | 1460 | | |
1461 | 1461 | | |
1462 | 1462 | | |
1463 | | - | |
| 1463 | + | |
| 1464 | + | |
1464 | 1465 | | |
1465 | 1466 | | |
1466 | | - | |
| 1467 | + | |
| 1468 | + | |
1467 | 1469 | | |
1468 | 1470 | | |
1469 | 1471 | | |
| |||
0 commit comments