Commit 3a5de1d
committed
🤖 Add forkWorkspace() to Runtime interface
Complete removal of git coupling from ipcMain by adding fork as a
first-class Runtime operation.
Changes:
1. Runtime.ts:
- Added WorkspaceForkParams and WorkspaceForkResult types
- Added forkWorkspace() method to Runtime interface
- Fork creates new workspace branching from source workspace's branch
2. LocalRuntime.forkWorkspace():
- Detects source workspace's current branch via git
- Delegates to createWorkspace() with source branch as trunk
- Returns workspace path and source branch
3. SSHRuntime.forkWorkspace():
- Returns error: "Forking SSH workspaces is not yet implemented"
- Explains complexity: users expect remote filesystem state match,
not local project (which may differ)
- Suggests creating new workspace from desired branch instead
4. ipcMain WORKSPACE_FORK handler:
- Now calls runtime.forkWorkspace() instead of direct git operations
- Removed getCurrentBranch() and createWorktree() calls
- Uses same runtime config as source workspace
- Cleanup on failure uses runtime.deleteWorkspace()
- Session file copying remains direct fs ops (local-only resources)
5. Removed imports from ipcMain:
- getCurrentBranch - no longer called
- createWorktree - no longer called
- Only kept listLocalBranches and detectDefaultTrunkBranch
(project-level queries for UI, not workspace operations)
Benefits:
✅ Zero git coupling in ipcMain
✅ Fork is a proper Runtime abstraction
✅ Consistent with other workspace operations
✅ Clear error for SSH fork limitation
✅ All workspace operations go through Runtime
Result: Clean architecture, proper abstraction, all 796 tests passing.
_Generated with `cmux`_1 parent 8bf7432 commit 3a5de1d
File tree
4 files changed
+156
-49
lines changed- src
- runtime
- services
4 files changed
+156
-49
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
552 | 554 | | |
553 | 555 | | |
554 | 556 | | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
555 | 605 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
158 | 192 | | |
159 | 193 | | |
160 | 194 | | |
| |||
288 | 322 | | |
289 | 323 | | |
290 | 324 | | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
291 | 336 | | |
292 | 337 | | |
293 | 338 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
895 | 897 | | |
896 | 898 | | |
897 | 899 | | |
898 | | - | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
899 | 915 | | |
900 | 916 | | |
901 | 917 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
| 8 | + | |
14 | 9 | | |
15 | 10 | | |
16 | 11 | | |
| |||
520 | 515 | | |
521 | 516 | | |
522 | 517 | | |
523 | | - | |
| 518 | + | |
524 | 519 | | |
525 | 520 | | |
526 | 521 | | |
| |||
530 | 525 | | |
531 | 526 | | |
532 | 527 | | |
| 528 | + | |
533 | 529 | | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
551 | 534 | | |
552 | 535 | | |
553 | 536 | | |
554 | 537 | | |
555 | | - | |
556 | | - | |
557 | | - | |
558 | | - | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
559 | 566 | | |
560 | 567 | | |
561 | | - | |
562 | | - | |
| 568 | + | |
| 569 | + | |
563 | 570 | | |
564 | 571 | | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
| 572 | + | |
569 | 573 | | |
570 | 574 | | |
571 | 575 | | |
572 | 576 | | |
573 | | - | |
574 | 577 | | |
575 | 578 | | |
576 | 579 | | |
| |||
579 | 582 | | |
580 | 583 | | |
581 | 584 | | |
582 | | - | |
583 | 585 | | |
584 | 586 | | |
585 | 587 | | |
586 | 588 | | |
587 | 589 | | |
588 | 590 | | |
589 | 591 | | |
590 | | - | |
| 592 | + | |
591 | 593 | | |
592 | 594 | | |
593 | 595 | | |
594 | 596 | | |
595 | 597 | | |
596 | | - | |
597 | 598 | | |
598 | 599 | | |
599 | 600 | | |
| |||
602 | 603 | | |
603 | 604 | | |
604 | 605 | | |
605 | | - | |
606 | | - | |
607 | | - | |
608 | | - | |
| 606 | + | |
609 | 607 | | |
610 | 608 | | |
611 | 609 | | |
612 | | - | |
613 | 610 | | |
614 | 611 | | |
615 | 612 | | |
616 | 613 | | |
617 | 614 | | |
618 | 615 | | |
619 | | - | |
| 616 | + | |
620 | 617 | | |
621 | 618 | | |
622 | | - | |
| 619 | + | |
623 | 620 | | |
624 | 621 | | |
625 | 622 | | |
626 | 623 | | |
627 | 624 | | |
628 | | - | |
| 625 | + | |
629 | 626 | | |
630 | 627 | | |
631 | | - | |
632 | | - | |
| 628 | + | |
633 | 629 | | |
634 | 630 | | |
635 | 631 | | |
| |||
0 commit comments