Commit 7e4052b
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 4616813 commit 7e4052b
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 | | |
| |||
562 | 564 | | |
563 | 565 | | |
564 | 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 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
565 | 615 | | |
| 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 | | |
| |||
306 | 340 | | |
307 | 341 | | |
308 | 342 | | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
309 | 354 | | |
310 | 355 | | |
311 | 356 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
971 | 973 | | |
972 | 974 | | |
973 | 975 | | |
974 | | - | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
975 | 991 | | |
976 | 992 | | |
977 | 993 | | |
| |||
| 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 | | |
| |||
544 | 539 | | |
545 | 540 | | |
546 | 541 | | |
547 | | - | |
| 542 | + | |
548 | 543 | | |
549 | 544 | | |
550 | 545 | | |
| |||
554 | 549 | | |
555 | 550 | | |
556 | 551 | | |
| 552 | + | |
557 | 553 | | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
575 | 558 | | |
576 | 559 | | |
577 | 560 | | |
578 | 561 | | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
| 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 | + | |
583 | 590 | | |
584 | 591 | | |
585 | | - | |
586 | | - | |
| 592 | + | |
| 593 | + | |
587 | 594 | | |
588 | 595 | | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
| 596 | + | |
593 | 597 | | |
594 | 598 | | |
595 | 599 | | |
596 | 600 | | |
597 | | - | |
598 | 601 | | |
599 | 602 | | |
600 | 603 | | |
| |||
603 | 606 | | |
604 | 607 | | |
605 | 608 | | |
606 | | - | |
607 | 609 | | |
608 | 610 | | |
609 | 611 | | |
610 | 612 | | |
611 | 613 | | |
612 | 614 | | |
613 | 615 | | |
614 | | - | |
| 616 | + | |
615 | 617 | | |
616 | 618 | | |
617 | 619 | | |
618 | 620 | | |
619 | 621 | | |
620 | | - | |
621 | 622 | | |
622 | 623 | | |
623 | 624 | | |
| |||
626 | 627 | | |
627 | 628 | | |
628 | 629 | | |
629 | | - | |
630 | | - | |
631 | | - | |
632 | | - | |
| 630 | + | |
633 | 631 | | |
634 | 632 | | |
635 | 633 | | |
636 | | - | |
637 | 634 | | |
638 | 635 | | |
639 | 636 | | |
640 | 637 | | |
641 | 638 | | |
642 | 639 | | |
643 | | - | |
| 640 | + | |
644 | 641 | | |
645 | 642 | | |
646 | | - | |
| 643 | + | |
647 | 644 | | |
648 | 645 | | |
649 | 646 | | |
650 | 647 | | |
651 | 648 | | |
652 | | - | |
| 649 | + | |
653 | 650 | | |
654 | 651 | | |
655 | | - | |
656 | | - | |
| 652 | + | |
657 | 653 | | |
658 | 654 | | |
659 | 655 | | |
| |||
0 commit comments