dsh-git-scm 0.2.0 → 0.3.0

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/lib/client.js CHANGED
@@ -61,8 +61,14 @@
61
61
  "action.refresh": "Refresh",
62
62
  "action.fetch": "Fetch",
63
63
  "action.pull": "Pull",
64
+ "action.pullRebase": "Pull (Rebase)",
64
65
  "action.pullBranch": "Pull {name}",
65
66
  "action.push": "Push",
67
+ "action.pushTo": "Push To",
68
+ "action.forcePush": "Force Push",
69
+ "action.fetchFrom": "Fetch From",
70
+ "action.moreSync": "More fetch, pull, and push actions",
71
+ "action.publish": "Publish",
66
72
  "action.publishBranch": "Publish Branch",
67
73
  "action.generateMessage": "Generate commit message",
68
74
  "action.improveMessage": "Improve commit message",
@@ -123,7 +129,19 @@
123
129
  "commit.more": "More commit actions",
124
130
  "commit.all": "Commit all changes",
125
131
  "commit.undo": "Undo last commit",
132
+ "commit.tracked": "Commit Tracked",
133
+ "commit.amendTracked": "Amend Tracked",
134
+ "commit.trackedHint": "Stages the tracked changes, then commits",
135
+ "commit.amendHint": "Rewrites the last commit",
136
+ "commit.amendNote": "This updates your most recent commit",
137
+ "commit.noMessage": "Write a commit message first",
138
+ "commit.nothingToCommit": "Nothing to commit",
139
+ "commit.resolveConflicts": "Resolve the conflicts before committing",
126
140
  "commit.abort": "Abort {operation}",
141
+ "sync.fetch": "Fetch updates from the remote",
142
+ "sync.pull": "Pull the remote commits into this branch",
143
+ "sync.push": "Push the committed changes to the remote",
144
+ "sync.publish": "Publish this branch to a remote",
127
145
  "pending.cherry-pick": "A cherry pick is in progress",
128
146
  "pending.revert": "A revert is in progress",
129
147
  "pending.merge": "A merge is in progress",
@@ -169,6 +187,7 @@
169
187
  "menu.createBranchFrom": "Create branch from commit…",
170
188
  "menu.copyRemoteUrl": "Copy remote URL",
171
189
  "menu.fetchRemote": "Fetch this remote",
190
+ "menu.fetchAll": "All remotes",
172
191
  "menu.collapse": "Collapse",
173
192
  "menu.applyStash": "Apply stash",
174
193
  "menu.popStash": "Pop stash",
@@ -197,6 +216,7 @@
197
216
  "confirm.dropAllStashes": "Drop every stash? This cannot be undone.",
198
217
  "confirm.deleteTag": "Delete tag {name}?",
199
218
  "confirm.undoCommit": "Undo the last commit, keeping its changes staged?",
219
+ "confirm.forcePush": "Force push the current branch? This overwrites the remote branch when the lease allows it.",
200
220
  "confirm.abort": "Abort the {operation} in progress?",
201
221
  "confirm.submit": "Confirm",
202
222
  "confirm.cancel": "Cancel",
@@ -215,6 +235,8 @@
215
235
  "diff.resize": "Drag to resize the comparison",
216
236
  "diff.unchanged": "{n} unchanged lines",
217
237
  "diff.expand": "Expand",
238
+ "diff.collapsePanel": "Collapse comparison pane",
239
+ "diff.expandPanel": "Expand comparison pane",
218
240
  "diff.searchPlaceholder": "Find in comparison",
219
241
  "diff.nextMatch": "Next match",
220
242
  "diff.previousMatch": "Previous match",
@@ -239,6 +261,37 @@
239
261
  "branch.picker.empty": "No matching branch",
240
262
  "group.changes": "Changes",
241
263
  "group.repositories": "Git repositories",
264
+ "section.worktrees": "Worktrees",
265
+ "empty.worktrees": "No linked worktrees",
266
+ "action.createWorktree": "New Worktree",
267
+ "action.removeWorktree": "Remove worktree",
268
+ "action.forceRemoveWorktree": "Force Remove",
269
+ "action.switchWorktree": "Switch to this worktree",
270
+ "action.pruneWorktrees": "Prune missing worktrees",
271
+ "action.copyWorktreePath": "Copy worktree path",
272
+ "worktree.mainCheckout": "Main checkout",
273
+ "worktree.detached": "Detached HEAD",
274
+ "worktree.bare": "Bare repository",
275
+ "worktree.locked": "Locked",
276
+ "worktree.lockedReason": "Locked: {reason}",
277
+ "worktree.prunable": "Missing",
278
+ "worktree.current": "This Session works here",
279
+ "worktree.switchTooltip": "{path} — click to move this Session here",
280
+ "worktree.dialogTitle": "New Worktree",
281
+ "worktree.branchField": "Branch name",
282
+ "worktree.branchPlaceholder": "feature/my-task",
283
+ "worktree.directoryPreview": "Worktree directory: .agents/worktrees/{slug}",
284
+ "worktree.baseNote": "The branch starts at {base}; an existing local branch is checked out instead.",
285
+ "worktree.create": "Create Worktree",
286
+ "worktree.branchRequired": "Enter a branch name",
287
+ "confirm.switchWorktree": "Move this Session into the worktree {name}? The Git panel and the Session working directory will follow.",
288
+ "confirm.removeWorktree": "Remove the worktree {name}? Its directory is deleted; committed work stays on its branch.",
289
+ "confirm.forceRemoveWorktree": "Remove the worktree {name} even though it has uncommitted changes? Those changes are lost.",
290
+ "toast.worktreeCreated": "Created worktree {name}",
291
+ "toast.worktreeRemoved": "Removed worktree {name}",
292
+ "toast.worktreeSwitched": "This Session now works in {name}",
293
+ "toast.worktreeRemoveFailed": "Could not remove the worktree",
294
+ "toast.worktreesPruned": "Pruned missing worktrees",
242
295
  "confirm.discardAll": "Discard every working-tree change? This cannot be undone.",
243
296
  "diff.stashLabel": "Stash entry",
244
297
  "empty.changes": "No changes",
@@ -261,6 +314,7 @@
261
314
  "toast.pulledBranch": "Pulled {name} — {n} commits",
262
315
  "toast.pulledBranchCurrent": "Pulled {name} — already up to date",
263
316
  "toast.pushed": "Pushed",
317
+ "toast.forcePushed": "Force pushed",
264
318
  "toast.published": "Published {branch}",
265
319
  "toast.generateFailed": "Could not generate a commit message",
266
320
  "toast.initialized": "Initialized the Git repository",
@@ -349,8 +403,14 @@
349
403
  "action.refresh": "刷新",
350
404
  "action.fetch": "抓取",
351
405
  "action.pull": "拉取",
406
+ "action.pullRebase": "拉取(变基)",
352
407
  "action.pullBranch": "拉取 {name}",
353
408
  "action.push": "推送",
409
+ "action.pushTo": "推送到远程",
410
+ "action.forcePush": "强制推送",
411
+ "action.fetchFrom": "从远程抓取",
412
+ "action.moreSync": "更多抓取、拉取和推送操作",
413
+ "action.publish": "发布",
354
414
  "action.publishBranch": "发布 Branch",
355
415
  "action.generateMessage": "生成提交信息",
356
416
  "action.improveMessage": "优化提交信息",
@@ -411,7 +471,19 @@
411
471
  "commit.more": "更多提交操作",
412
472
  "commit.all": "提交全部更改",
413
473
  "commit.undo": "撤消上次提交",
474
+ "commit.tracked": "提交已跟踪更改",
475
+ "commit.amendTracked": "修正已跟踪更改",
476
+ "commit.trackedHint": "先暂存所有已跟踪更改,再提交",
477
+ "commit.amendHint": "重写上一次提交",
478
+ "commit.amendNote": "将更新最近一次提交",
479
+ "commit.noMessage": "请先填写提交信息",
480
+ "commit.nothingToCommit": "没有可提交的更改",
481
+ "commit.resolveConflicts": "请先解决冲突再提交",
414
482
  "commit.abort": "中止{operation}",
483
+ "sync.fetch": "从远程抓取更新",
484
+ "sync.pull": "把远程提交拉取到当前分支",
485
+ "sync.push": "把已提交的更改推送到远程",
486
+ "sync.publish": "把当前分支发布到远程",
415
487
  "pending.cherry-pick": "正在进行 Cherry Pick",
416
488
  "pending.revert": "正在进行 Revert",
417
489
  "pending.merge": "正在进行合并",
@@ -457,6 +529,7 @@
457
529
  "menu.createBranchFrom": "从该提交创建分支…",
458
530
  "menu.copyRemoteUrl": "复制远程地址",
459
531
  "menu.fetchRemote": "抓取该远程",
532
+ "menu.fetchAll": "所有远程",
460
533
  "menu.collapse": "收起",
461
534
  "menu.applyStash": "应用储藏",
462
535
  "menu.popStash": "弹出储藏",
@@ -485,6 +558,7 @@
485
558
  "confirm.dropAllStashes": "删除所有储藏?此操作无法撤销。",
486
559
  "confirm.deleteTag": "删除标签 {name}?",
487
560
  "confirm.undoCommit": "撤消上次提交并保留其更改为暂存状态?",
561
+ "confirm.forcePush": "强制推送当前分支?在 lease 允许时会覆盖远程分支。",
488
562
  "confirm.abort": "中止正在进行的 {operation}?",
489
563
  "confirm.submit": "确定",
490
564
  "confirm.cancel": "取消",
@@ -503,6 +577,8 @@
503
577
  "diff.resize": "拖动调整对比区域高度",
504
578
  "diff.unchanged": "{n} 行未更改",
505
579
  "diff.expand": "展开",
580
+ "diff.collapsePanel": "收起对比面板",
581
+ "diff.expandPanel": "展开对比面板",
506
582
  "diff.searchPlaceholder": "在对比中查找",
507
583
  "diff.nextMatch": "下一个匹配",
508
584
  "diff.previousMatch": "上一个匹配",
@@ -527,6 +603,37 @@
527
603
  "branch.picker.empty": "没有匹配的分支",
528
604
  "group.changes": "更改",
529
605
  "group.repositories": "Git 仓库",
606
+ "section.worktrees": "工作树",
607
+ "empty.worktrees": "没有链接工作树",
608
+ "action.createWorktree": "新建工作树",
609
+ "action.removeWorktree": "删除工作树",
610
+ "action.forceRemoveWorktree": "强制删除",
611
+ "action.switchWorktree": "切换到该工作树",
612
+ "action.pruneWorktrees": "清理失效的工作树",
613
+ "action.copyWorktreePath": "复制工作树路径",
614
+ "worktree.mainCheckout": "主检出",
615
+ "worktree.detached": "分离头指针",
616
+ "worktree.bare": "裸仓库",
617
+ "worktree.locked": "已锁定",
618
+ "worktree.lockedReason": "已锁定:{reason}",
619
+ "worktree.prunable": "目录缺失",
620
+ "worktree.current": "当前会话在此工作",
621
+ "worktree.switchTooltip": "{path} — 点击把当前会话切换到这里",
622
+ "worktree.dialogTitle": "新建工作树",
623
+ "worktree.branchField": "分支名",
624
+ "worktree.branchPlaceholder": "feature/my-task",
625
+ "worktree.directoryPreview": "工作树目录:.agents/worktrees/{slug}",
626
+ "worktree.baseNote": "新分支从 {base} 创建;若该分支已存在则直接检出。",
627
+ "worktree.create": "创建工作树",
628
+ "worktree.branchRequired": "请填写分支名",
629
+ "confirm.switchWorktree": "把当前会话切换到工作树 {name}?Git 面板和会话工作目录都会跟随切换。",
630
+ "confirm.removeWorktree": "删除工作树 {name}?其目录会被删除,已提交的内容仍保留在对应分支上。",
631
+ "confirm.forceRemoveWorktree": "工作树 {name} 有未提交的更改,仍要强制删除吗?这些更改将丢失。",
632
+ "toast.worktreeCreated": "已创建工作树 {name}",
633
+ "toast.worktreeRemoved": "已删除工作树 {name}",
634
+ "toast.worktreeSwitched": "当前会话已切换到 {name}",
635
+ "toast.worktreeRemoveFailed": "删除工作树失败",
636
+ "toast.worktreesPruned": "已清理失效的工作树",
530
637
  "confirm.discardAll": "放弃所有工作区更改?此操作无法撤销。",
531
638
  "diff.stashLabel": "储藏条目",
532
639
  "empty.changes": "没有更改",
@@ -549,6 +656,7 @@
549
656
  "toast.pulledBranch": "已拉取 {name} — {n} 个提交",
550
657
  "toast.pulledBranchCurrent": "已拉取 {name} — 已是最新",
551
658
  "toast.pushed": "已推送",
659
+ "toast.forcePushed": "已强制推送",
552
660
  "toast.published": "已发布分支 {branch}",
553
661
  "toast.generateFailed": "生成提交信息失败",
554
662
  "toast.initialized": "已初始化 Git 仓库",
@@ -620,15 +728,6 @@
620
728
  }
621
729
  .dgscm-repo-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
622
730
  .dgscm-repo-glyph { display: inline-flex; flex: none; color: var(--dsw-alias-label-secondary); }
623
- .dgscm-repo-name {
624
- min-width: 0;
625
- overflow: hidden;
626
- font-size: 13px;
627
- font-weight: 600;
628
- line-height: 20px;
629
- text-overflow: ellipsis;
630
- white-space: nowrap;
631
- }
632
731
  .dgscm-branch-chip {
633
732
  display: inline-flex;
634
733
  flex: 0 1 auto;
@@ -689,8 +788,11 @@
689
788
  white-space: nowrap;
690
789
  }
691
790
  .dgscm-top-actions { display: flex; flex: none; align-items: center; gap: 2px; margin-left: auto; }
791
+ .dgscm-sync-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
792
+ .dgscm-sync-actions { display: flex; flex: none; align-items: center; gap: 1px; margin-left: auto; }
692
793
  .dgscm-sync {
693
794
  display: flex;
795
+ flex: 1 1 auto;
694
796
  align-items: center;
695
797
  gap: 6px;
696
798
  min-width: 0;
@@ -777,16 +879,14 @@
777
879
  .dgscm-textarea::placeholder { color: var(--dsw-alias-label-tertiary); }
778
880
  .dgscm-textarea:focus { border-color: var(--dsw-alias-brand-primary); }
779
881
  .dgscm-commit-row { display: flex; align-items: center; gap: 8px; }
780
- .dgscm-check {
781
- display: inline-flex;
782
- align-items: center;
783
- gap: 5px;
784
- color: var(--dsw-alias-label-secondary);
882
+ .dgscm-commit-note {
883
+ min-width: 0;
884
+ overflow: hidden;
885
+ color: var(--dsw-alias-label-tertiary);
785
886
  font-size: 11px;
786
- cursor: pointer;
787
- user-select: none;
887
+ text-overflow: ellipsis;
888
+ white-space: nowrap;
788
889
  }
789
- .dgscm-check input { margin: 0; accent-color: var(--dsw-alias-brand-primary); }
790
890
 
791
891
  .dgscm-button {
792
892
  display: inline-flex;
@@ -820,66 +920,112 @@
820
920
  .dgscm-button--quiet:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover); }
821
921
  .dgscm-button:disabled { opacity: 0.4; cursor: not-allowed; }
822
922
  .dgscm-commit-actions { display: flex; align-items: center; gap: 0; margin-left: auto; }
823
- /* The commit split button: the host's small control geometry (sm) on the
824
- dimmed primary surface (the secondary variant the desktop dialogs use), so
825
- the action sits quieter than a full primary button in the dark theme. The
826
- label pairs with the dimmed fill through the normal label token. Every state
827
- below is scoped to these two classes, so other buttons keep their own rules
828
- and the generic dgscm-button styles stay untouched. */
829
- .dgscm-split-more {
923
+
924
+ /* The Zed-style split control: one quiet pill whose left segment performs the
925
+ default action and whose chevron opens the rest. The header's sync control
926
+ and the commit action reuse the same surface so they read as one family;
927
+ each modifier only changes the geometry. The fill is the dimmed primary
928
+ surface, so the pill sits quieter than a full primary button. */
929
+ .dgscm-split-button,
930
+ .dgscm-sync-control {
931
+ display: inline-flex;
932
+ flex: none;
933
+ align-items: stretch;
934
+ height: 24px;
935
+ overflow: hidden;
936
+ border-radius: var(--dsw-radius-sm, 8px);
937
+ background: var(--dsw-alias-button-primary-dimmed, var(--dsw-alias-bg-layer-2));
938
+ color: var(--dsw-alias-label-primary);
939
+ }
940
+ .dgscm-split-button--commit { height: 28px; }
941
+ .dgscm-split-main,
942
+ .dgscm-sync-primary {
943
+ display: inline-flex;
944
+ align-items: center;
945
+ justify-content: center;
946
+ gap: 5px;
947
+ min-width: 0;
948
+ padding: 0 8px;
949
+ border: none;
950
+ background: transparent;
951
+ color: inherit;
952
+ font: inherit;
953
+ font-size: 11px;
954
+ font-weight: 500;
955
+ line-height: 18px;
956
+ white-space: nowrap;
957
+ cursor: pointer;
958
+ }
959
+ .dgscm-split-button--commit .dgscm-split-main { min-width: 88px; padding: 0 12px; font-size: 12px; }
960
+ .dgscm-sync-text { letter-spacing: 0.01em; }
961
+ .dgscm-sync-count {
962
+ display: inline-flex;
963
+ align-items: center;
964
+ color: var(--dsw-alias-label-secondary);
965
+ font-family: var(--ds-font-family-code, ui-monospace, Menlo, monospace);
966
+ font-size: 10px;
967
+ line-height: 1;
968
+ }
969
+ /* The pill counts sit on the dimmed fill rather than the darker sidebar, so
970
+ mixing in the label colour keeps them legible (the sync row repeats the
971
+ same counts on the darker surface). */
972
+ .dgscm-sync-count--ahead { color: color-mix(in srgb, var(--dsw-alias-state-success-primary) 78%, var(--dsw-alias-label-primary)); }
973
+ .dgscm-sync-count--behind { color: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 78%, var(--dsw-alias-label-primary)); }
974
+ .dgscm-split-toggle,
975
+ .dgscm-sync-toggle {
830
976
  display: inline-flex;
831
977
  flex: none;
832
978
  align-items: center;
833
979
  justify-content: center;
834
- width: 28px;
835
- height: 28px;
980
+ width: 20px;
836
981
  padding: 0;
837
982
  border: none;
838
983
  border-left: 1px solid color-mix(in srgb, var(--dsw-alias-label-primary) 20%, transparent);
839
- border-radius: 0 var(--dsw-radius-sm, 8px) var(--dsw-radius-sm, 8px) 0;
840
- background: var(--dsw-alias-button-primary-dimmed, var(--dsw-alias-bg-layer-2));
841
- color: var(--dsw-alias-label-primary);
984
+ background: transparent;
985
+ color: var(--dsw-alias-label-secondary);
842
986
  cursor: pointer;
843
987
  }
844
- .dgscm-commit-submit {
845
- height: 28px;
846
- padding: 0 12px;
847
- border-radius: var(--dsw-radius-sm, 8px) 0 0 var(--dsw-radius-sm, 8px);
848
- background: var(--dsw-alias-button-primary-dimmed, var(--dsw-alias-bg-layer-2));
849
- color: var(--dsw-alias-label-primary);
850
- font-size: 12px;
851
- line-height: 18px;
852
- font-weight: 500;
853
- min-width: 76px;
854
- }
855
- /* Hover: one subtle step of the label colour mixed into the dimmed fill, which
856
- lightens it on the dark theme and darkens it on the light theme, so the step
857
- stays theme-correct instead of jumping to the bright primary hover. */
988
+ .dgscm-split-button--commit .dgscm-split-toggle { width: 26px; }
989
+ .dgscm-split-toggle svg,
990
+ .dgscm-sync-toggle svg { pointer-events: none; }
991
+ /* Hover steps the shared pill fill with the label colour, so the light theme
992
+ darkens and the dark theme lightens by the same rule. */
858
993
  @media (hover: hover) {
859
- .dgscm-commit-submit:hover:not(:disabled),
860
- .dgscm-split-more:hover:not(:disabled) {
994
+ .dgscm-split-main:hover:not(:disabled),
995
+ .dgscm-split-toggle:hover:not(:disabled),
996
+ .dgscm-sync-primary:hover:not(:disabled),
997
+ .dgscm-sync-toggle:hover:not(:disabled) {
861
998
  background: color-mix(in srgb, var(--dsw-alias-button-primary-dimmed, var(--dsw-alias-bg-layer-2)) 88%, var(--dsw-alias-label-primary));
862
999
  }
863
1000
  }
864
1001
  /* Pressed: DSH defines no separate pressed token for primary buttons, so the
865
1002
  pressed state deliberately keeps the hover fill instead of inventing one. */
866
- .dgscm-commit-submit:active:not(:disabled),
867
- .dgscm-split-more:active:not(:disabled) {
1003
+ .dgscm-split-main:active:not(:disabled),
1004
+ .dgscm-split-toggle:active:not(:disabled),
1005
+ .dgscm-sync-primary:active:not(:disabled),
1006
+ .dgscm-sync-toggle:active:not(:disabled) {
868
1007
  background: color-mix(in srgb, var(--dsw-alias-button-primary-dimmed, var(--dsw-alias-bg-layer-2)) 88%, var(--dsw-alias-label-primary));
869
1008
  }
870
- /* Focus: the host focus-ring tokens. The host's pointer-modality rule still
871
- suppresses the ring for pointer focus, exactly as it does for host buttons. */
872
- .dgscm-commit-submit:focus-visible,
873
- .dgscm-split-more:focus-visible {
1009
+ /* Focus: the host focus-ring tokens, inset so the ring follows the segment
1010
+ instead of bleeding past the pill's rounded outline. */
1011
+ .dgscm-split-main:focus-visible,
1012
+ .dgscm-split-toggle:focus-visible,
1013
+ .dgscm-sync-primary:focus-visible,
1014
+ .dgscm-sync-toggle:focus-visible {
874
1015
  outline: var(--dsw-focus-ring-width, 2px) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
875
- outline-offset: 1px;
1016
+ outline-offset: -2px;
876
1017
  }
877
- /* Disabled: host parity (dimmed, not-allowed), scoped to the two controls. */
878
- .dgscm-commit-submit:disabled,
879
- .dgscm-split-more:disabled {
1018
+ /* Disabled: host parity (dimmed, not-allowed), scoped to the split segments. */
1019
+ .dgscm-split-main:disabled,
1020
+ .dgscm-split-toggle:disabled,
1021
+ .dgscm-sync-primary:disabled,
1022
+ .dgscm-sync-toggle:disabled {
880
1023
  opacity: 0.4;
881
1024
  cursor: not-allowed;
882
1025
  }
1026
+ /* A remote operation or commit in progress spins the glyph in place. */
1027
+ .dgscm-sync-primary[aria-busy='true'] svg,
1028
+ .dgscm-split-main[aria-busy='true'] svg { animation: dgscm-spin 900ms linear infinite; }
883
1029
 
884
1030
  .dgscm-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding-bottom: 16px; }
885
1031
 
@@ -1020,6 +1166,24 @@
1020
1166
  .dgscm-branch-flag { display: inline-flex; align-items: center; color: var(--dsw-alias-label-tertiary); }
1021
1167
  .dgscm-branch-flag--unpublished { color: var(--dsw-alias-state-success-primary); font-family: var(--ds-font-family-code, ui-monospace, Menlo, monospace); font-size: 10px; font-weight: 700; }
1022
1168
  .dgscm-branch-flag--current { color: var(--dsw-alias-label-secondary); }
1169
+ /* Worktree rows: the folder glyph is a checkout, a missing directory is an
1170
+ error tone, a locked worktree says so in the warn tone. */
1171
+ .dgscm-row-glyph--worktree { color: var(--dsw-alias-brand-primary); }
1172
+ .dgscm-row-note--warn { color: var(--dsw-alias-state-warn-primary); }
1173
+ .dgscm-row--prunable .dgscm-row-name { color: var(--dsw-alias-label-tertiary); }
1174
+ /* Keep the branch name whole: the relative directory suffix shrinks first. */
1175
+ .dgscm-row--worktree .dgscm-row-dir { flex-shrink: 999; }
1176
+ /* The remote name stays whole; a long URL ellipsizes against it. */
1177
+ .dgscm-row--remote .dgscm-row-name { flex-shrink: 0; }
1178
+ .dgscm-row--remote .dgscm-row-dir { flex-shrink: 999; }
1179
+ .dgscm-worktree-flag--missing { display: inline-flex; flex: none; color: var(--dsw-alias-state-error-primary); }
1180
+ .dgscm-badge--worktree {
1181
+ background: color-mix(in srgb, var(--dsw-alias-brand-primary) 14%, transparent);
1182
+ color: var(--dsw-alias-brand-primary);
1183
+ }
1184
+ /* A linked checkout is marked by a glyph badge: the word would push the branch
1185
+ chip out of the header at common sidebar widths. */
1186
+ .dgscm-badge--icon { height: 18px; padding: 0 4px; }
1023
1187
  .dgscm-row-chevron { display: inline-flex; flex: none; width: 14px; justify-content: center; }
1024
1188
  .dgscm-row-mark {
1025
1189
  display: inline-flex;
@@ -1312,6 +1476,31 @@
1312
1476
  text-overflow: ellipsis;
1313
1477
  white-space: nowrap;
1314
1478
  }
1479
+ /* The title is the comparison's disclosure control: clicking it folds the body. */
1480
+ .dgscm-diff-title {
1481
+ display: flex;
1482
+ flex: 1 1 auto;
1483
+ align-items: center;
1484
+ gap: 3px;
1485
+ min-width: 0;
1486
+ height: 26px;
1487
+ padding: 0 4px 0 2px;
1488
+ border: none;
1489
+ border-radius: 4px;
1490
+ background: transparent;
1491
+ color: inherit;
1492
+ font: inherit;
1493
+ text-align: left;
1494
+ cursor: pointer;
1495
+ }
1496
+ .dgscm-diff-title:hover { background: var(--dsw-alias-interactive-bg-hover); }
1497
+ .dgscm-diff-title:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--dsw-alias-brand-primary); }
1498
+ .dgscm-diff-title .dgscm-diff-path { padding-left: 0; }
1499
+ .dgscm-diff-head--collapsed { border-bottom: none; }
1500
+ /* The collapsed pane hides the body instead of unmounting it, so its scroll
1501
+ position and expanded context runs survive a fold. */
1502
+ .dgscm-diffpane--collapsed .dgscm-diff-body { display: none; }
1503
+ .dgscm-diffpane--collapsed .dgscm-diff-search { display: none; }
1315
1504
  .dgscm-diff-stats { display: flex; flex: none; align-items: center; gap: 5px; font-family: var(--ds-font-family-code, ui-monospace, Menlo, monospace); font-size: 11px; }
1316
1505
  .dgscm-diff-added { color: var(--dsw-alias-state-success-primary); }
1317
1506
  .dgscm-diff-deleted { color: var(--dsw-alias-state-error-primary); }
@@ -1666,9 +1855,19 @@
1666
1855
  .dgscm-native-label { display: none; }
1667
1856
  }
1668
1857
 
1858
+ @container dgscm (max-width: 380px) {
1859
+ /* The linked-checkout glyph yields to the repo name and branch chip in
1860
+ narrow panels; the Worktrees section still marks the current checkout. */
1861
+ .dgscm-badge--worktree { display: none; }
1862
+ }
1863
+
1669
1864
  @container dgscm (max-width: 340px) {
1670
- .dgscm-repo-name { max-width: 40%; }
1671
1865
  .dgscm-row-meta { display: none; }
1866
+ /* Below 340px the header keeps only the essentials: the pill drops its
1867
+ counts (the sync row repeats them) and the branch chip drops its publish
1868
+ button, which the pill's own Publish primary already covers. */
1869
+ .dgscm-sync-count { display: none; }
1870
+ .dgscm-branch-publish { display: none; }
1672
1871
  }
1673
1872
 
1674
1873
  /* Publish call to action: the dimmed primary surface, full width, while the
@@ -1706,7 +1905,9 @@
1706
1905
  overflow: hidden;
1707
1906
  border: 0.5px solid var(--dsw-alias-border-l2);
1708
1907
  border-radius: 6px;
1709
- background: var(--dsw-menu-surface-fill, var(--dsw-alias-bg-overlay));
1908
+ /* Opaque, not the translucent menu surface: the tip floats over the panel
1909
+ header, where a transparent fill let the underlying toolbar show through. */
1910
+ background: var(--dsw-alias-bg-layer-2, var(--dsw-menu-surface-fill, var(--dsw-alias-bg-overlay)));
1710
1911
  box-shadow: var(--dsw-elevation-prominent, 0 3px 8px rgba(0, 0, 0, 0.2));
1711
1912
  color: var(--dsw-alias-label-primary);
1712
1913
  font-size: 11px;
@@ -1717,6 +1918,18 @@
1717
1918
  pointer-events: none;
1718
1919
  }
1719
1920
 
1921
+ /* The New Worktree dialog: branch field plus the derived pool directory. */
1922
+ .dgscm-worktree-dialog { max-width: 400px; }
1923
+ .dgscm-worktree-dialog .dgscm-modal-note { margin-bottom: 10px; }
1924
+ .dgscm-worktree-preview {
1925
+ margin-bottom: 6px;
1926
+ color: var(--dsw-alias-label-secondary);
1927
+ font-family: var(--ds-font-family-code, ui-monospace, Menlo, monospace);
1928
+ font-size: 11px;
1929
+ line-height: 16px;
1930
+ overflow-wrap: anywhere;
1931
+ }
1932
+
1720
1933
  /* The GitHub publish dialog: repository name then one row per destination. */
1721
1934
  .dgscm-publish-dialog { width: min(420px, 100%); }
1722
1935
  .dgscm-publish-dialog .dgscm-modal-card { max-width: 420px; }
@@ -1972,6 +2185,16 @@
1972
2185
  function TrashIcon(props) {
1973
2186
  return h(Glyph, props, h("path", { d: "M2.8 4.4h10.4" }), h("path", { d: "M6.4 4.4V3a.8.8 0 0 1 .8-.8h1.6a.8.8 0 0 1 .8.8v1.4" }), h("path", { d: "M4.2 4.4l.6 8.1a.9.9 0 0 0 .9.8h4.6a.9.9 0 0 0 .9-.8l.6-8.1" }));
1974
2187
  }
2188
+ /** Lock glyph, for a locked worktree. */
2189
+ function LockIcon(props) {
2190
+ return h(Glyph, props, h("rect", {
2191
+ x: 3.6,
2192
+ y: 7.2,
2193
+ width: 8.8,
2194
+ height: 6.2,
2195
+ rx: 1.2
2196
+ }), h("path", { d: "M5.6 7.2V5.4a2.4 2.4 0 0 1 4.8 0v1.8" }));
2197
+ }
1975
2198
  /** Chevron glyph; rotation shows the disclosure state. */
1976
2199
  function ChevronIcon({ open = false, size = 12, ...rest }) {
1977
2200
  return h("span", { className: `dgscm-chevron${open ? " dgscm-chevron--open" : ""}` }, h(Glyph, {
@@ -2150,6 +2373,7 @@
2150
2373
  DockBottomIcon,
2151
2374
  DockRightIcon,
2152
2375
  SearchIcon,
2376
+ LockIcon,
2153
2377
  HistoryIcon,
2154
2378
  CaretIcon,
2155
2379
  SpinnerIcon
@@ -2300,8 +2524,16 @@
2300
2524
  publishGithub: "action.publishBranch",
2301
2525
  commit: "commit.submit",
2302
2526
  cherryPick: "toast.cherryPicked",
2303
- revert: "toast.reverted"
2527
+ revert: "toast.reverted",
2528
+ worktreeAdd: "action.createWorktree",
2529
+ worktreeRemove: "action.removeWorktree",
2530
+ worktreePrune: "action.pruneWorktrees",
2531
+ switchWorktree: "action.switchWorktree"
2304
2532
  };
2533
+ /** Directory slug the host gives a branch inside the repository's worktree pool. */
2534
+ function worktreeSlugOf(branch) {
2535
+ return String(branch ?? "").trim().replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^[-.]+|[-.]+$/g, "");
2536
+ }
2305
2537
  /** Build the `dsh-resource://file/session/…` address of one Session-relative file. */
2306
2538
  function fileAddressOf(sessionId, path) {
2307
2539
  const encode = (segment) => encodeURIComponent(segment).replace(/%3A/gi, ":");
@@ -2336,6 +2568,8 @@
2336
2568
  var PREVIEW_WIDTH_MIN = 280;
2337
2569
  /** Narrowest left column allowed when the preview is docked to the right. */
2338
2570
  var PREVIEW_WIDTH_RESERVED = 300;
2571
+ /** Panel width below which the comparison docks below the list and starts collapsed. */
2572
+ var PREVIEW_NARROW_WIDTH = 580;
2339
2573
  /** Read the stored dock side. */
2340
2574
  function readPreviewLayout() {
2341
2575
  try {
@@ -2449,6 +2683,26 @@
2449
2683
  localStorage.setItem(COMMIT_RULES_KEY, JSON.stringify(rules));
2450
2684
  } catch {}
2451
2685
  }
2686
+ /** Unified-diff header lines that only repeat what the comparison's own head shows. */
2687
+ var DIFF_HEADER_NOISE = [
2688
+ "diff --git ",
2689
+ "index ",
2690
+ "--- ",
2691
+ "+++ ",
2692
+ "similarity index ",
2693
+ "dissimilarity index "
2694
+ ];
2695
+ /**
2696
+ * Whether one pre-hunk line can be hidden: paths, blob hashes and rename
2697
+ * similarity all repeat the comparison head or the change list, so showing
2698
+ * them only costs rows. Meaningful header lines (new/deleted file, mode
2699
+ * change, rename/copy endpoints, "no newline") are still rendered.
2700
+ * @param {string} line - a unified-diff header line.
2701
+ * @returns {boolean} whether the line is redundant plumbing.
2702
+ */
2703
+ function isDiffHeaderNoise(line) {
2704
+ return DIFF_HEADER_NOISE.some((prefix) => line.startsWith(prefix));
2705
+ }
2452
2706
  /**
2453
2707
  * Parse one unified patch into renderable rows with old/new line numbers.
2454
2708
  * @param {string} text - the patch text.
@@ -2477,7 +2731,7 @@
2477
2731
  continue;
2478
2732
  }
2479
2733
  if (!inHunk) {
2480
- if (line.length > 0) rows.push({
2734
+ if (line.length > 0 && !isDiffHeaderNoise(line)) rows.push({
2481
2735
  type: "meta",
2482
2736
  text: line
2483
2737
  });
@@ -3056,6 +3310,47 @@
3056
3310
  }, "▲+") : null, branch.current === true ? h("span", { className: "dgscm-branch-flag dgscm-branch-flag--current" }, h(CheckIcon, { size: 12 })) : null), date === "" ? null : h("span", { className: "dgscm-row-note" }, `· ${date}`)));
3057
3311
  }
3058
3312
  /**
3313
+ * One worktree row: checkout directory, branch (or detached HEAD), state, and
3314
+ * its menu. Clicking a non-current checkout asks to move the Session there.
3315
+ * @param {object} props - the worktree, path label, handlers, and copy.
3316
+ * @returns {object} the row.
3317
+ */
3318
+ function WorktreeRow({ worktree, pathLabel, t, onSwitch, onMenu, onContextMenu }) {
3319
+ const current = worktree.current === true;
3320
+ const missing = worktree.prunable === true;
3321
+ const name = worktree.branch !== null && worktree.branch !== void 0 ? worktree.branch : worktree.detached === true ? `${t("worktree.detached")} ${worktree.head ?? ""}`.trim() : worktree.bare === true ? t("worktree.bare") : worktree.name;
3322
+ const activate = () => {
3323
+ if (current || missing) return;
3324
+ onSwitch(worktree);
3325
+ };
3326
+ return h("div", {
3327
+ className: `dgscm-row dgscm-row--clickable dgscm-row--worktree${current ? " dgscm-row--current" : ""}${missing ? " dgscm-row--prunable" : ""}`,
3328
+ role: "button",
3329
+ tabIndex: 0,
3330
+ title: current ? `${worktree.path} — ${t("worktree.current")}` : t("worktree.switchTooltip", { path: worktree.path }),
3331
+ onClick: activate,
3332
+ onKeyDown: activateOnKey(activate),
3333
+ onContextMenu
3334
+ }, h("span", {
3335
+ className: "dgscm-row-chevron",
3336
+ "aria-hidden": "true"
3337
+ }), h("span", { className: "dgscm-row-glyph dgscm-row-glyph--worktree" }, h(FolderIcon, { size: 13 })), h("span", { className: `dgscm-row-name${current ? " dgscm-row-name--current" : ""}` }, name), h("span", { className: "dgscm-row-dir" }, pathLabel), worktree.locked === true ? h("span", {
3338
+ className: "dgscm-row-note dgscm-row-note--warn",
3339
+ title: worktree.lockReason === null || worktree.lockReason === void 0 ? t("worktree.locked") : t("worktree.lockedReason", { reason: worktree.lockReason })
3340
+ }, t("worktree.locked")) : null, h("div", {
3341
+ className: "dgscm-row-actions",
3342
+ onClick: (event) => {
3343
+ event.stopPropagation();
3344
+ }
3345
+ }, h(IconButton, {
3346
+ label: t("action.more"),
3347
+ onClick: onMenu
3348
+ }, h(MoreIcon, { size: 13 }))), h("span", { className: "dgscm-row-end" }, missing ? h("span", {
3349
+ className: "dgscm-worktree-flag dgscm-worktree-flag--missing",
3350
+ title: worktree.pruneReason === null || worktree.pruneReason === void 0 ? t("worktree.prunable") : worktree.pruneReason
3351
+ }, h(WarnIcon, { size: 12 })) : null, current ? h("span", { className: "dgscm-branch-flag dgscm-branch-flag--current" }, h(CheckIcon, { size: 12 })) : null));
3352
+ }
3353
+ /**
3059
3354
  * One commit row: disclosure, hash, subject, and author/time.
3060
3355
  * @param {object} props - the commit, depth, disclosure state, handlers, and copy.
3061
3356
  * @returns {object} the row.
@@ -3100,7 +3395,7 @@
3100
3395
  */
3101
3396
  function RemoteRow({ remote, branchCount, open, t, onToggle, onContextMenu }) {
3102
3397
  return h("div", {
3103
- className: "dgscm-row dgscm-row--clickable",
3398
+ className: "dgscm-row dgscm-row--clickable dgscm-row--remote",
3104
3399
  role: "button",
3105
3400
  tabIndex: 0,
3106
3401
  title: remote.url,
@@ -3234,14 +3529,14 @@
3234
3529
  * @param {object} props - the loaded history, dock controls, and copy.
3235
3530
  * @returns {object} the history pane.
3236
3531
  */
3237
- function HistoryPane({ state, layout, onLayout, maximized, onMaximize, onClose, onOpenCommit, t }) {
3532
+ function HistoryPane({ state, layout, layoutFixed = false, onLayout, maximized, onMaximize, onClose, onOpenCommit, t }) {
3238
3533
  return h("div", { className: "dgscm-history" }, h("div", { className: "dgscm-diff-head" }, h(IconButton, {
3239
3534
  label: t("diff.close"),
3240
3535
  onClick: onClose
3241
3536
  }, h(CloseIcon, { size: 14 })), h("span", { className: "dgscm-badge dgscm-badge--brand" }, t("history.badge")), h("span", {
3242
3537
  className: "dgscm-diff-path",
3243
3538
  title: state.path
3244
- }, state.path), h("span", { className: "dgscm-diff-stats" }, state.phase === "ready" ? String(state.commits.length) : ""), h(IconButton, {
3539
+ }, state.path), h("span", { className: "dgscm-diff-stats" }, state.phase === "ready" ? String(state.commits.length) : ""), layoutFixed ? null : h(IconButton, {
3245
3540
  label: layout === "right" ? t("action.dockBottom") : t("action.dockRight"),
3246
3541
  onClick: () => onLayout(layout === "right" ? "bottom" : "right")
3247
3542
  }, layout === "right" ? h(DockBottomIcon, { size: 14 }) : h(DockRightIcon, { size: 14 })), h(IconButton, {
@@ -3264,7 +3559,7 @@
3264
3559
  * @param {object} props - the loaded review, dock controls, and copy.
3265
3560
  * @returns {object} the commit review pane.
3266
3561
  */
3267
- function ReviewPane({ review, layout, onLayout, maximized, onMaximize, onClose, onOpenFile, t }) {
3562
+ function ReviewPane({ review, layout, layoutFixed = false, onLayout, maximized, onMaximize, onClose, onOpenFile, t }) {
3268
3563
  const [query, setQuery] = useState("");
3269
3564
  const [filterOpen, setFilterOpen] = useState(false);
3270
3565
  const filterRef = useRef(null);
@@ -3285,7 +3580,7 @@
3285
3580
  setFilterOpen((current) => !current);
3286
3581
  if (filterOpen) setQuery("");
3287
3582
  }
3288
- }, h(SearchIcon, { size: 14 })), h(IconButton, {
3583
+ }, h(SearchIcon, { size: 14 })), layoutFixed ? null : h(IconButton, {
3289
3584
  label: layout === "right" ? t("action.dockBottom") : t("action.dockRight"),
3290
3585
  onClick: () => onLayout(layout === "right" ? "bottom" : "right")
3291
3586
  }, layout === "right" ? h(DockBottomIcon, { size: 14 }) : h(DockRightIcon, { size: 14 })), h(IconButton, {
@@ -3433,6 +3728,57 @@
3433
3728
  }, prompt.submitLabel))));
3434
3729
  }
3435
3730
  /**
3731
+ * The New Worktree dialog: branch name plus the directory the host will use.
3732
+ * @param {object} props - dialog state, base branch, handlers, and copy.
3733
+ * @returns {object} the overlay.
3734
+ */
3735
+ function WorktreeDialog({ state, base, onChange, onCancel, onSubmit, t }) {
3736
+ const inputRef = useRef(null);
3737
+ useEffect(() => {
3738
+ inputRef.current?.focus();
3739
+ }, []);
3740
+ useEffect(() => {
3741
+ const onKeyDown = (event) => {
3742
+ if (event.key === "Escape" && !state.submitting) onCancel();
3743
+ };
3744
+ window.addEventListener("keydown", onKeyDown);
3745
+ return () => window.removeEventListener("keydown", onKeyDown);
3746
+ }, [onCancel, state.submitting]);
3747
+ const slug = worktreeSlugOf(state.branch);
3748
+ return h("div", {
3749
+ className: "dgscm-modal",
3750
+ onClick: state.submitting ? void 0 : onCancel
3751
+ }, h("div", {
3752
+ className: "dgscm-modal-card dgscm-worktree-dialog",
3753
+ role: "dialog",
3754
+ "aria-modal": "true",
3755
+ onClick: (event) => event.stopPropagation(),
3756
+ onKeyDown: (event) => {
3757
+ if (event.key === "Enter" && !event.shiftKey) {
3758
+ event.preventDefault();
3759
+ if (!state.submitting && slug.length > 0) onSubmit();
3760
+ }
3761
+ }
3762
+ }, h("div", { className: "dgscm-modal-title" }, t("worktree.dialogTitle")), h("div", { className: "dgscm-modal-field" }, h("label", { className: "dgscm-modal-label" }, t("worktree.branchField")), h("input", {
3763
+ ref: inputRef,
3764
+ className: "dgscm-input",
3765
+ value: state.branch,
3766
+ placeholder: t("worktree.branchPlaceholder"),
3767
+ disabled: state.submitting,
3768
+ onChange: (event) => onChange(event.target.value)
3769
+ })), slug.length === 0 ? null : h("div", { className: "dgscm-worktree-preview" }, t("worktree.directoryPreview", { slug })), h("div", { className: "dgscm-modal-note" }, t("worktree.baseNote", { base })), state.error === null || state.error === void 0 ? null : h("div", { className: "dgscm-modal-error" }, state.error), h("div", { className: "dgscm-modal-actions" }, h("button", {
3770
+ type: "button",
3771
+ className: "dgscm-button dgscm-button--quiet",
3772
+ disabled: state.submitting,
3773
+ onClick: onCancel
3774
+ }, t("prompt.cancel")), h("button", {
3775
+ type: "button",
3776
+ className: "dgscm-button dgscm-button--primary",
3777
+ disabled: state.submitting || slug.length === 0,
3778
+ onClick: () => onSubmit()
3779
+ }, state.submitting ? t("toast.busy") : t("worktree.create")))));
3780
+ }
3781
+ /**
3436
3782
  * The GitHub publish dialog: repository name plus private and public choices.
3437
3783
  * @param {object} props - dialog state, rename/publish/cancel handlers, and copy.
3438
3784
  * @returns {object} the overlay.
@@ -3495,11 +3841,13 @@
3495
3841
  * longer than the collapse threshold render as an expandable marker, the way
3496
3842
  * the host's own review views fold context, and every row carries the old and
3497
3843
  * new line numbers it names. The search box walks every match in the visible
3498
- * rows and scrolls the current one into view.
3499
- * @param {object} props - the opened view, display mode, dock controls, and copy.
3844
+ * rows and scrolls the current one into view. The title row is a disclosure
3845
+ * control that folds the body; a narrow column starts folded and a fullscreen
3846
+ * Sidebar opens it docked right.
3847
+ * @param {object} props - the opened view, display mode, dock controls, collapse state, and copy.
3500
3848
  * @returns {object} the comparison pane.
3501
3849
  */
3502
- function DiffPane({ view, mode, onMode, onClose, onMaximize, maximized, layout, onLayout, onBack, backLabel, searchSignal = 0, t }) {
3850
+ function DiffPane({ view, mode, onMode, onClose, onMaximize, maximized, layout, layoutFixed = false, onLayout, onBack, backLabel, searchSignal = 0, collapsed = false, onToggleCollapsed, t }) {
3503
3851
  const [expanded, setExpanded] = useState(() => /* @__PURE__ */ new Set());
3504
3852
  const [wrap, setWrap] = useState(readDiffWrap);
3505
3853
  const [searchOpen, setSearchOpen] = useState(false);
@@ -3618,6 +3966,9 @@
3618
3966
  setQuery("");
3619
3967
  setActiveMatch(0);
3620
3968
  };
3969
+ useEffect(() => {
3970
+ if (collapsed) closeSearch();
3971
+ }, [collapsed]);
3621
3972
  /** Render one line with the query's matches highlighted. */
3622
3973
  const highlighted = (entryKey, text) => {
3623
3974
  const found = matches.length === 0 ? [] : matches.filter((match) => match.key === entryKey);
@@ -3683,16 +4034,25 @@
3683
4034
  index: activeMatch + 1,
3684
4035
  total: matches.length
3685
4036
  });
3686
- return h("div", { className: "dgscm-diff" }, h("div", { className: "dgscm-diff-head" }, onBack === void 0 ? null : h(IconButton, {
4037
+ return h("div", { className: "dgscm-diff" }, h("div", { className: `dgscm-diff-head${collapsed ? " dgscm-diff-head--collapsed" : ""}` }, onBack === void 0 ? null : h(IconButton, {
3687
4038
  label: backLabel,
3688
4039
  onClick: onBack
3689
4040
  }, h(BackIcon, { size: 14 })), h(IconButton, {
3690
4041
  label: t("diff.close"),
3691
4042
  onClick: onClose
3692
- }, h(CloseIcon, { size: 14 })), view.source.kind === "commit" ? h("span", { className: "dgscm-badge dgscm-badge--brand" }, t("diff.commitLabel", { short: view.source.short ?? "" })) : null, view.source.kind === "stash" ? h("span", { className: "dgscm-badge dgscm-badge--brand" }, `stash@{${view.source.index}}`) : null, h("span", {
4043
+ }, h(CloseIcon, { size: 14 })), view.source.kind === "commit" ? h("span", { className: "dgscm-badge dgscm-badge--brand" }, t("diff.commitLabel", { short: view.source.short ?? "" })) : null, view.source.kind === "stash" ? h("span", { className: "dgscm-badge dgscm-badge--brand" }, `stash@{${view.source.index}}`) : null, h("button", {
4044
+ type: "button",
4045
+ className: "dgscm-diff-title",
4046
+ "aria-expanded": collapsed ? "false" : "true",
4047
+ title: collapsed ? t("diff.expandPanel") : t("diff.collapsePanel"),
4048
+ onClick: onToggleCollapsed
4049
+ }, h(ChevronIcon, {
4050
+ open: !collapsed,
4051
+ size: 12
4052
+ }), h("span", {
3693
4053
  className: "dgscm-diff-path",
3694
4054
  title: view.path
3695
- }, view.path), diff !== null && diff !== void 0 ? h("span", { className: "dgscm-diff-stats" }, h("span", { className: "dgscm-diff-added" }, `+${diff.added}`), h("span", { className: "dgscm-diff-deleted" }, `−${diff.deleted}`)) : null, h(IconButton, {
4055
+ }, view.path)), diff !== null && diff !== void 0 ? h("span", { className: "dgscm-diff-stats" }, h("span", { className: "dgscm-diff-added" }, `+${diff.added}`), h("span", { className: "dgscm-diff-deleted" }, `−${diff.deleted}`)) : null, collapsed ? null : h(React.Fragment, null, h(IconButton, {
3696
4056
  label: `${t("action.search")} (${searchKey})`,
3697
4057
  onClick: () => searchOpen ? closeSearch() : setSearchOpen(true)
3698
4058
  }, h(SearchIcon, { size: 14 })), h(IconButton, {
@@ -3702,13 +4062,13 @@
3702
4062
  label: wrap ? t("diff.wrapOff") : t("diff.wrapOn"),
3703
4063
  pressed: wrap,
3704
4064
  onClick: toggleWrap
3705
- }, h(WrapIcon, { size: 14 })), h(IconButton, {
4065
+ }, h(WrapIcon, { size: 14 })), layoutFixed ? null : h(IconButton, {
3706
4066
  label: layout === "right" ? t("action.dockBottom") : t("action.dockRight"),
3707
4067
  onClick: () => onLayout(layout === "right" ? "bottom" : "right")
3708
4068
  }, layout === "right" ? h(DockBottomIcon, { size: 14 }) : h(DockRightIcon, { size: 14 })), h(IconButton, {
3709
4069
  label: maximized ? t("diff.restore") : t("diff.maximize"),
3710
4070
  onClick: onMaximize
3711
- }, maximized ? h(RestoreIcon, { size: 14 }) : h(MaximizeIcon, { size: 14 }))), searchOpen ? h("div", { className: "dgscm-diff-search" }, h("input", {
4071
+ }, maximized ? h(RestoreIcon, { size: 14 }) : h(MaximizeIcon, { size: 14 })))), h(React.Fragment, null, searchOpen ? h("div", { className: "dgscm-diff-search" }, h("input", {
3712
4072
  ref: searchRef,
3713
4073
  className: "dgscm-diff-search-input",
3714
4074
  value: query,
@@ -3748,7 +4108,7 @@
3748
4108
  }, view.loading === true ? h("div", { className: "dgscm-diff-note" }, t("diff.loading")) : null, view.error !== null && view.error !== void 0 ? h("div", {
3749
4109
  className: "dgscm-diff-note",
3750
4110
  style: { color: "var(--dsw-alias-state-error-primary)" }
3751
- }, view.error) : null, view.loading !== true && view.error === null && diff !== null && diff !== void 0 ? h(React.Fragment, null, diff.binary === true ? h("div", { className: "dgscm-diff-note" }, t("diff.binary")) : null, diff.tooLarge === true ? h("div", { className: "dgscm-diff-note" }, t("diff.tooLarge")) : null, diff.binary !== true && rows.length === 0 ? h("div", { className: "dgscm-diff-note" }, t("diff.empty")) : null, diff.binary !== true ? mode === "split" ? pairs.map((pair, index) => splitRow(pair, `pair-${index}`)) : rows.map((row, index) => unifiedRow(row, `row-${index}`)) : null, truncated ? h("div", { className: "dgscm-diff-note" }, t("diff.tooLarge")) : null) : null));
4111
+ }, view.error) : null, view.loading !== true && view.error === null && diff !== null && diff !== void 0 ? h(React.Fragment, null, diff.binary === true ? h("div", { className: "dgscm-diff-note" }, t("diff.binary")) : null, diff.tooLarge === true ? h("div", { className: "dgscm-diff-note" }, t("diff.tooLarge")) : null, diff.binary !== true && rows.length === 0 ? h("div", { className: "dgscm-diff-note" }, t("diff.empty")) : null, diff.binary !== true ? mode === "split" ? pairs.map((pair, index) => splitRow(pair, `pair-${index}`)) : rows.map((row, index) => unifiedRow(row, `row-${index}`)) : null, truncated ? h("div", { className: "dgscm-diff-note" }, t("diff.tooLarge")) : null) : null)));
3752
4112
  }
3753
4113
  /**
3754
4114
  * The right-Sidebar source-control page.
@@ -3756,7 +4116,9 @@
3756
4116
  * @returns {object} the panel.
3757
4117
  */
3758
4118
  function ScmPanel({ sessionId, t, openFile, localeId, useTabInfo }) {
3759
- const tabActions = typeof useTabInfo === "function" ? useTabInfo().tab.actions : void 0;
4119
+ const tabInfo = typeof useTabInfo === "function" ? useTabInfo() : void 0;
4120
+ const tabActions = tabInfo?.tab?.actions;
4121
+ const sidebarFullscreen = tabInfo?.sidebar?.fullscreen === true;
3760
4122
  const [phase, setPhase] = useState("loading");
3761
4123
  const [summary, setSummary] = useState(null);
3762
4124
  const [failure, setFailure] = useState(null);
@@ -3773,6 +4135,7 @@
3773
4135
  groupRepositories: true,
3774
4136
  staged: true,
3775
4137
  changes: true,
4138
+ worktrees: true,
3776
4139
  branches: true,
3777
4140
  remotes: false,
3778
4141
  stashes: false,
@@ -3792,9 +4155,12 @@
3792
4155
  const [dragging, setDragging] = useState(false);
3793
4156
  const [previewLayout, setPreviewLayout] = useState(readPreviewLayout);
3794
4157
  const [previewWidth, setPreviewWidth] = useState(readPreviewWidth);
4158
+ const [comparisonCollapsed, setComparisonCollapsed] = useState(false);
4159
+ const [narrowPreview, setNarrowPreview] = useState(false);
3795
4160
  const [branchPicker, setBranchPicker] = useState(null);
3796
4161
  const [tip, setTip] = useState(null);
3797
4162
  const [githubPublish, setGithubPublish] = useState(null);
4163
+ const [worktreeDialog, setWorktreeDialog] = useState(null);
3798
4164
  const [generating, setGenerating] = useState(false);
3799
4165
  const [commitRules, setCommitRules] = useState(readCommitRules);
3800
4166
  const [initializing, setInitializing] = useState(false);
@@ -3803,6 +4169,10 @@
3803
4169
  const [review, setReview] = useState(null);
3804
4170
  const [searchSignal, setSearchSignal] = useState(0);
3805
4171
  const [refreshing, setRefreshing] = useState(false);
4172
+ const autoLayout = sidebarFullscreen && !narrowPreview ? "right" : narrowPreview ? "bottom" : previewLayout;
4173
+ const collapsedPane = comparisonCollapsed && view !== null;
4174
+ const paneLayout = collapsedPane ? "bottom" : autoLayout;
4175
+ const layoutFixed = sidebarFullscreen || narrowPreview;
3806
4176
  const loadSeq = useRef(0);
3807
4177
  const busyRef = useRef(false);
3808
4178
  const nodesRef = useRef(nodes);
@@ -3818,6 +4188,10 @@
3818
4188
  const generateLongPressRef = useRef(false);
3819
4189
  const commitRulesRef = useRef(commitRules);
3820
4190
  const amendBackupRef = useRef(null);
4191
+ const menuAnchorRef = useRef({
4192
+ x: 0,
4193
+ y: 0
4194
+ });
3821
4195
  useEffect(() => {
3822
4196
  nodesRef.current = nodes;
3823
4197
  }, [nodes]);
@@ -3830,6 +4204,26 @@
3830
4204
  useEffect(() => {
3831
4205
  commitRulesRef.current = commitRules;
3832
4206
  }, [commitRules]);
4207
+ useEffect(() => {
4208
+ const node = rootRef.current;
4209
+ if (node === null) return void 0;
4210
+ const measure = () => {
4211
+ const width = node.clientWidth;
4212
+ if (width > 0) setNarrowPreview(width < PREVIEW_NARROW_WIDTH);
4213
+ };
4214
+ measure();
4215
+ if (typeof ResizeObserver === "function") {
4216
+ const observer = new ResizeObserver(measure);
4217
+ observer.observe(node);
4218
+ return () => observer.disconnect();
4219
+ }
4220
+ window.addEventListener("resize", measure);
4221
+ return () => window.removeEventListener("resize", measure);
4222
+ }, [phase]);
4223
+ useEffect(() => {
4224
+ if (narrowPreview) setComparisonCollapsed(true);
4225
+ else if (sidebarFullscreen) setComparisonCollapsed(false);
4226
+ }, [narrowPreview, sidebarFullscreen]);
3833
4227
  useEffect(() => {
3834
4228
  if (phase !== "ready" || !publishAfterInit) return void 0;
3835
4229
  setPublishAfterInit(false);
@@ -3894,9 +4288,11 @@
3894
4288
  });
3895
4289
  setHistory(null);
3896
4290
  setReview(null);
4291
+ setComparisonCollapsed(false);
3897
4292
  setBranchPicker(null);
3898
4293
  setTip(null);
3899
4294
  setGithubPublish(null);
4295
+ setWorktreeDialog(null);
3900
4296
  setGenerating(false);
3901
4297
  setInitializing(false);
3902
4298
  setPublishAfterInit(false);
@@ -3939,22 +4335,23 @@
3939
4335
  const focused = document.activeElement;
3940
4336
  if (!(focused !== null && focused !== void 0 && root.contains(focused)) && !pointerInsideRef.current) return;
3941
4337
  event.preventDefault();
4338
+ if (collapsedPane) setComparisonCollapsed(false);
3942
4339
  setSearchSignal((current) => current + 1);
3943
4340
  };
3944
4341
  document.addEventListener("keydown", onKeyDown);
3945
4342
  return () => document.removeEventListener("keydown", onKeyDown);
3946
- }, [view]);
4343
+ }, [view, collapsedPane]);
3947
4344
  useEffect(() => {
3948
4345
  if (!dragging) return void 0;
3949
4346
  const previousCursor = document.body.style.cursor;
3950
4347
  const previousSelect = document.body.style.userSelect;
3951
- document.body.style.cursor = previewLayout === "right" ? "col-resize" : "row-resize";
4348
+ document.body.style.cursor = paneLayout === "right" ? "col-resize" : "row-resize";
3952
4349
  document.body.style.userSelect = "none";
3953
4350
  return () => {
3954
4351
  document.body.style.cursor = previousCursor;
3955
4352
  document.body.style.userSelect = previousSelect;
3956
4353
  };
3957
- }, [dragging, previewLayout]);
4354
+ }, [dragging, paneLayout]);
3958
4355
  useEffect(() => {
3959
4356
  if (notice === null || notice.action !== void 0) return void 0;
3960
4357
  const timer = setTimeout(() => setNotice(null), notice.tone === "error" ? 9e3 : 3500);
@@ -4184,14 +4581,40 @@
4184
4581
  anchor: null
4185
4582
  });
4186
4583
  }, []);
4187
- /** Open the context menu at the pointer. */
4584
+ /** Open the context menu at the pointer; remembers the anchor for its submenus. */
4188
4585
  const openMenu = useCallback((event, items) => {
4189
- event.preventDefault();
4190
- event.stopPropagation();
4586
+ event?.preventDefault?.();
4587
+ event?.stopPropagation?.();
4588
+ const position = {
4589
+ x: event?.clientX ?? 0,
4590
+ y: event?.clientY ?? 0
4591
+ };
4592
+ menuAnchorRef.current = position;
4593
+ setMenu({
4594
+ ...position,
4595
+ items: items.filter((item) => item !== void 0)
4596
+ });
4597
+ }, []);
4598
+ /** Open a menu at an already measured anchor, replacing the one on screen. */
4599
+ const openMenuAt = useCallback((position, items) => {
4191
4600
  setMenu({
4192
- x: event.clientX,
4193
- y: event.clientY,
4194
- items: items.filter((item) => item !== void 0 && item !== null)
4601
+ x: position.x,
4602
+ y: position.y,
4603
+ items: items.filter((item) => item !== void 0)
4604
+ });
4605
+ }, []);
4606
+ /** Open a menu directly under one control, the way a split button's chevron does. */
4607
+ const openMenuBelow = useCallback((element, items) => {
4608
+ const rect = typeof element?.getBoundingClientRect === "function" ? element.getBoundingClientRect() : null;
4609
+ const position = rect === null ? menuAnchorRef.current : {
4610
+ x: rect.left,
4611
+ y: rect.bottom + 2
4612
+ };
4613
+ menuAnchorRef.current = position;
4614
+ setMenu({
4615
+ x: position.x,
4616
+ y: position.y,
4617
+ items: items.filter((item) => item !== void 0)
4195
4618
  });
4196
4619
  }, []);
4197
4620
  /** Open one working-tree file's diff. */
@@ -4559,6 +4982,42 @@
4559
4982
  run,
4560
4983
  t
4561
4984
  ]);
4985
+ /**
4986
+ * The commit button's action: with nothing staged it stages the tracked
4987
+ * changes first (the Zed "Commit Tracked" behavior), then commits them.
4988
+ * @returns {Promise<void>} settles after the attempt.
4989
+ */
4990
+ const commitTracked = useCallback(async () => {
4991
+ if (message.trim().length === 0) {
4992
+ setNotice({
4993
+ tone: "error",
4994
+ title: t("toast.failed"),
4995
+ detail: t("commit.noMessage")
4996
+ });
4997
+ return;
4998
+ }
4999
+ const snapshot = summary?.changes ?? {};
5000
+ if ((Array.isArray(snapshot.conflicted) ? snapshot.conflicted : []).length > 0) {
5001
+ setNotice({
5002
+ tone: "error",
5003
+ title: t("toast.failed"),
5004
+ detail: t("commit.resolveConflicts")
5005
+ });
5006
+ return;
5007
+ }
5008
+ const staged = Array.isArray(snapshot.staged) ? snapshot.staged : [];
5009
+ const tracked = Array.isArray(snapshot.unstaged) ? snapshot.unstaged : [];
5010
+ if (staged.length === 0 && tracked.length > 0) {
5011
+ if (!await run("stage", { paths: tracked.map((file) => file.path) }, null)) return;
5012
+ }
5013
+ await commit(false);
5014
+ }, [
5015
+ message,
5016
+ summary,
5017
+ run,
5018
+ commit,
5019
+ t
5020
+ ]);
4562
5021
  /** Initialize a repository in the Session directory, then let the panel read it. */
4563
5022
  const initializeRepository = async () => {
4564
5023
  if (initializing) return;
@@ -4666,11 +5125,13 @@
4666
5125
  const staged = changes.staged ?? [];
4667
5126
  const unstaged = changes.unstaged ?? [];
4668
5127
  const untracked = changes.untracked ?? [];
5128
+ const conflicted = changes.conflicted ?? [];
4669
5129
  const workingChanges = [
4670
- ...changes.conflicted ?? [],
5130
+ ...conflicted,
4671
5131
  ...unstaged,
4672
5132
  ...untracked
4673
5133
  ];
5134
+ const trackedChanges = unstaged;
4674
5135
  const branches = summary.branches ?? {
4675
5136
  local: [],
4676
5137
  remote: []
@@ -4681,9 +5142,37 @@
4681
5142
  const working = busy !== null;
4682
5143
  const pending = repo.pending ?? null;
4683
5144
  const pendingLabel = pending === null ? "" : t(`pending.${pending}`);
4684
- const canCommit = message.trim().length > 0 && !working && (staged.length > 0 || amend && repo.head !== null);
5145
+ const canCommit = message.trim().length > 0 && !working && conflicted.length === 0 && (staged.length > 0 || trackedChanges.length > 0 || amend && repo.head !== null);
4685
5146
  /** Whether the current branch has never been pushed and can be published. */
4686
5147
  const unpublished = repo.detached !== true && repo.unborn !== true && repo.upstream === null;
5148
+ /** Registered worktrees of the repository, the main checkout first. */
5149
+ const worktrees = Array.isArray(summary.worktrees) ? summary.worktrees : [];
5150
+ const currentWorktree = worktrees.find((entry) => entry.current === true) ?? null;
5151
+ /** Display name of one worktree: its branch, detached HEAD, or bare state. */
5152
+ const worktreeLabel = (worktree) => worktree.branch !== null && worktree.branch !== void 0 ? worktree.branch : worktree.detached === true ? `${t("worktree.detached")} ${worktree.head ?? ""}`.trim() : worktree.bare === true ? t("worktree.bare") : worktree.name;
5153
+ /** Compact directory label of one worktree, relative to this checkout when nested. */
5154
+ const worktreePathLabel = (worktree) => {
5155
+ if (worktree.main === true) return t("worktree.mainCheckout");
5156
+ const path = String(worktree.path ?? "").replace(/\\/g, "/");
5157
+ const rootPath = String(repo.root ?? "").replace(/\\/g, "/");
5158
+ if (path.startsWith(`${rootPath}/`)) return path.slice(rootPath.length + 1);
5159
+ return path.split("/").filter((part) => part.length > 0).slice(-2).join("/");
5160
+ };
5161
+ /** The commit action's label: what a click will actually do. */
5162
+ const commitLabel = () => {
5163
+ if (amend) return staged.length > 0 || trackedChanges.length === 0 ? t("commit.amend") : t("commit.amendTracked");
5164
+ if (staged.length > 0) return t("commit.submit");
5165
+ return trackedChanges.length > 0 ? t("commit.tracked") : t("commit.submit");
5166
+ };
5167
+ /** Why the commit action is disabled, or what it will do when enabled. */
5168
+ const commitTitle = () => {
5169
+ if (conflicted.length > 0) return t("commit.resolveConflicts");
5170
+ if (message.trim().length === 0) return t("commit.noMessage");
5171
+ if (staged.length === 0 && trackedChanges.length === 0 && !(amend && repo.head !== null)) return t("commit.nothingToCommit");
5172
+ if (working) return t("toast.busy");
5173
+ if (amend) return t("commit.amendHint");
5174
+ return staged.length > 0 ? t("commit.submit") : t("commit.trackedHint");
5175
+ };
4687
5176
  /** Show one hover tip anchored above the element it describes. */
4688
5177
  const showTip = (event, text) => {
4689
5178
  const rect = event?.currentTarget?.getBoundingClientRect?.();
@@ -4798,6 +5287,218 @@
4798
5287
  }
4799
5288
  await run("publish", {}, t("toast.published", { branch: repo.branch }));
4800
5289
  };
5290
+ /** Open the New Worktree dialog. */
5291
+ const openWorktreeDialog = () => {
5292
+ if (working) return;
5293
+ setWorktreeDialog({
5294
+ branch: "",
5295
+ error: null,
5296
+ submitting: false
5297
+ });
5298
+ };
5299
+ /** Keep the New Worktree dialog's branch field and error in step with typing. */
5300
+ const updateWorktreeBranch = (value) => {
5301
+ setWorktreeDialog((current) => current === null ? null : {
5302
+ ...current,
5303
+ branch: value,
5304
+ error: null
5305
+ });
5306
+ };
5307
+ /** Create one worktree, then offer to move this Session into it. */
5308
+ const createWorktree = async () => {
5309
+ const state = worktreeDialog;
5310
+ if (state === null || state.submitting === true || busyRef.current) return;
5311
+ const branch = state.branch.trim();
5312
+ if (branch.length === 0) {
5313
+ setWorktreeDialog({
5314
+ ...state,
5315
+ error: t("worktree.branchRequired")
5316
+ });
5317
+ return;
5318
+ }
5319
+ busyRef.current = true;
5320
+ setWorktreeDialog({
5321
+ ...state,
5322
+ submitting: true,
5323
+ error: null
5324
+ });
5325
+ setBusy({ operation: "worktreeAdd" });
5326
+ try {
5327
+ const data = await callGit(sessionId, "action", {
5328
+ operation: "worktreeAdd",
5329
+ branch
5330
+ });
5331
+ const createdPath = typeof data?.worktreePath === "string" ? data.worktreePath : null;
5332
+ const createdBranch = typeof data?.branch === "string" ? data.branch : branch;
5333
+ setWorktreeDialog(null);
5334
+ const created = {
5335
+ path: createdPath,
5336
+ branch: createdBranch,
5337
+ name: createdBranch,
5338
+ current: false
5339
+ };
5340
+ setNotice({
5341
+ tone: "success",
5342
+ title: t("toast.worktreeCreated", { name: createdBranch }),
5343
+ ...createdPath === null ? {} : { action: {
5344
+ label: t("action.switchWorktree"),
5345
+ run: () => {
5346
+ switchToWorktree(created);
5347
+ }
5348
+ } }
5349
+ });
5350
+ await load();
5351
+ } catch (error) {
5352
+ const detail = failureText(error, t);
5353
+ setWorktreeDialog((current) => current === null ? null : {
5354
+ ...current,
5355
+ submitting: false,
5356
+ error: detail
5357
+ });
5358
+ } finally {
5359
+ busyRef.current = false;
5360
+ setBusy(null);
5361
+ }
5362
+ };
5363
+ /** Move this Session's working directory into one registered worktree. */
5364
+ const switchToWorktree = async (worktree) => {
5365
+ if (busyRef.current) return;
5366
+ busyRef.current = true;
5367
+ setBusy({ operation: "switchWorktree" });
5368
+ try {
5369
+ await callGit(sessionId, "action", {
5370
+ operation: "switchWorktree",
5371
+ path: worktree.path
5372
+ });
5373
+ setNotice({
5374
+ tone: "success",
5375
+ title: t("toast.worktreeSwitched", { name: worktreeLabel(worktree) })
5376
+ });
5377
+ setView(null);
5378
+ setReview(null);
5379
+ setHistory(null);
5380
+ setNodes({});
5381
+ setSelection({
5382
+ group: null,
5383
+ paths: [],
5384
+ anchor: null
5385
+ });
5386
+ setMessage("");
5387
+ setAmend(false);
5388
+ amendBackupRef.current = null;
5389
+ await load();
5390
+ } catch (error) {
5391
+ setNotice({
5392
+ tone: "error",
5393
+ title: t("toast.failed"),
5394
+ detail: failureText(error, t)
5395
+ });
5396
+ } finally {
5397
+ busyRef.current = false;
5398
+ setBusy(null);
5399
+ }
5400
+ };
5401
+ /** Ask before moving this Session into another checkout. */
5402
+ const requestSwitchWorktree = (worktree) => {
5403
+ ask(t("confirm.switchWorktree", { name: worktreeLabel(worktree) }), () => {
5404
+ setConfirm(null);
5405
+ switchToWorktree(worktree);
5406
+ });
5407
+ };
5408
+ /**
5409
+ * Remove one linked worktree. A dirty checkout is refused first; the failure
5410
+ * notice then offers the explicit force path so uncommitted work is lost only
5411
+ * after a second confirmation.
5412
+ */
5413
+ const removeWorktree = async (worktree, force = false) => {
5414
+ if (busyRef.current) return;
5415
+ busyRef.current = true;
5416
+ setBusy({ operation: "worktreeRemove" });
5417
+ try {
5418
+ await callGit(sessionId, "action", {
5419
+ operation: "worktreeRemove",
5420
+ path: worktree.path,
5421
+ ...force ? { force: true } : {}
5422
+ });
5423
+ setNotice({
5424
+ tone: "success",
5425
+ title: t("toast.worktreeRemoved", { name: worktreeLabel(worktree) })
5426
+ });
5427
+ await load();
5428
+ } catch (error) {
5429
+ setNotice({
5430
+ tone: "error",
5431
+ title: t("toast.worktreeRemoveFailed"),
5432
+ detail: failureText(error, t),
5433
+ ...force ? {} : { action: {
5434
+ label: t("action.forceRemoveWorktree"),
5435
+ run: () => ask(t("confirm.forceRemoveWorktree", { name: worktreeLabel(worktree) }), () => {
5436
+ setConfirm(null);
5437
+ removeWorktree(worktree, true);
5438
+ })
5439
+ } }
5440
+ });
5441
+ } finally {
5442
+ busyRef.current = false;
5443
+ setBusy(null);
5444
+ }
5445
+ };
5446
+ /** Ask before deleting one linked worktree. */
5447
+ const requestRemoveWorktree = (worktree) => {
5448
+ ask(t("confirm.removeWorktree", { name: worktreeLabel(worktree) }), () => {
5449
+ setConfirm(null);
5450
+ removeWorktree(worktree, false);
5451
+ });
5452
+ };
5453
+ /** Worktree section actions: create a checkout, prune registrations whose directories are gone. */
5454
+ const worktreeAddMenuItems = () => [
5455
+ {
5456
+ label: t("action.createWorktree"),
5457
+ icon: h(PlusIcon, { size: 14 }),
5458
+ disabled: working || repo.unborn === true,
5459
+ run: openWorktreeDialog
5460
+ },
5461
+ null,
5462
+ {
5463
+ label: t("action.pruneWorktrees"),
5464
+ icon: h(TrashIcon, { size: 14 }),
5465
+ disabled: working || !worktrees.some((entry) => entry.prunable === true),
5466
+ run: () => {
5467
+ run("worktreePrune", {}, t("toast.worktreesPruned"));
5468
+ }
5469
+ }
5470
+ ];
5471
+ /** One worktree row's menu: move here, copy the path, and remove or prune it. */
5472
+ const worktreeMenuItems = (worktree) => [
5473
+ {
5474
+ label: t("action.switchWorktree"),
5475
+ icon: h(BranchIcon, { size: 14 }),
5476
+ disabled: working || worktree.current === true || worktree.prunable === true,
5477
+ run: () => requestSwitchWorktree(worktree)
5478
+ },
5479
+ {
5480
+ label: t("action.copyWorktreePath"),
5481
+ icon: h(CopyIcon, { size: 14 }),
5482
+ run: () => {
5483
+ copy(worktree.path);
5484
+ }
5485
+ },
5486
+ null,
5487
+ worktree.prunable === true ? {
5488
+ label: t("action.pruneWorktrees"),
5489
+ icon: h(TrashIcon, { size: 14 }),
5490
+ disabled: working,
5491
+ run: () => {
5492
+ run("worktreePrune", {}, t("toast.worktreesPruned"));
5493
+ }
5494
+ } : {
5495
+ label: t("action.removeWorktree"),
5496
+ icon: h(TrashIcon, { size: 14 }),
5497
+ danger: true,
5498
+ disabled: working || worktree.current === true || worktree.main === true || worktree.bare === true,
5499
+ run: () => requestRemoveWorktree(worktree)
5500
+ }
5501
+ ];
4801
5502
  /**
4802
5503
  * Items of the sparkle control's hold menu: language and message style.
4803
5504
  * @param {object} rules - the rules the menu reflects.
@@ -4968,7 +5669,7 @@
4968
5669
  /** Track the divider while the pointer is down. */
4969
5670
  const moveResize = (event) => {
4970
5671
  if (dragRef.current === null) return;
4971
- if (previewLayout === "right") {
5672
+ if (paneLayout === "right") {
4972
5673
  const next = clampPaneWidth(dragRef.current.startWidth - (event.clientX - dragRef.current.startX));
4973
5674
  widthRef.current = next;
4974
5675
  setDiffMaximized(false);
@@ -4983,7 +5684,7 @@
4983
5684
  /** Restore the default size of the active dock. */
4984
5685
  const resetResize = () => {
4985
5686
  setDiffMaximized(false);
4986
- if (previewLayout === "right") {
5687
+ if (paneLayout === "right") {
4987
5688
  const next = clampPaneWidth(PREVIEW_WIDTH_DEFAULT);
4988
5689
  widthRef.current = next;
4989
5690
  setPreviewWidth(next);
@@ -5000,7 +5701,7 @@
5000
5701
  if (dragRef.current === null) return;
5001
5702
  dragRef.current = null;
5002
5703
  setDragging(false);
5003
- if (previewLayout === "right") storePreviewWidth(widthRef.current);
5704
+ if (paneLayout === "right") storePreviewWidth(widthRef.current);
5004
5705
  else storeDiffHeight(heightRef.current);
5005
5706
  };
5006
5707
  /** Switch the preview between the bottom and right docks. */
@@ -5099,32 +5800,245 @@
5099
5800
  setConfirm(null);
5100
5801
  run("undoCommit", {}, t("toast.undone"));
5101
5802
  })
5102
- },
5103
- null,
5104
- {
5803
+ }
5804
+ ];
5805
+ /** Label, glyph, counts, and click action of the sync control's primary segment. */
5806
+ const syncPrimary = () => {
5807
+ const remoteOperation = working && [
5808
+ "fetch",
5809
+ "pull",
5810
+ "push",
5811
+ "publish",
5812
+ "publishGithub"
5813
+ ].includes(busy?.operation);
5814
+ if (unpublished) return {
5815
+ label: t("action.publish"),
5816
+ icon: CloudUploadIcon,
5817
+ title: t("sync.publish"),
5818
+ busy: working && [
5819
+ "publish",
5820
+ "publishGithub",
5821
+ "push"
5822
+ ].includes(busy?.operation),
5823
+ disabled: working,
5824
+ counts: [],
5825
+ run: () => {
5826
+ publish(true);
5827
+ }
5828
+ };
5829
+ if (repo.detached === true || repo.unborn === true) return {
5105
5830
  label: t("action.fetch"),
5106
- icon: h(FetchIcon, { size: 14 }),
5831
+ icon: FetchIcon,
5832
+ title: t("sync.fetch"),
5833
+ busy: remoteOperation,
5107
5834
  disabled: working,
5835
+ counts: [],
5108
5836
  run: () => {
5109
5837
  run("fetch", { all: true }, fetchSuccess);
5110
5838
  }
5111
- },
5839
+ };
5840
+ if (repo.behind > 0) {
5841
+ const counts = [{
5842
+ tone: "behind",
5843
+ text: `↓${repo.behind}`
5844
+ }];
5845
+ if (repo.ahead > 0) counts.push({
5846
+ tone: "ahead",
5847
+ text: `↑${repo.ahead}`
5848
+ });
5849
+ return {
5850
+ label: t("action.pull"),
5851
+ icon: PullIcon,
5852
+ title: t("sync.pull"),
5853
+ busy: working && busy?.operation === "pull",
5854
+ disabled: working,
5855
+ counts,
5856
+ run: () => {
5857
+ run("pull", {}, t("toast.pulled"));
5858
+ }
5859
+ };
5860
+ }
5861
+ if (repo.ahead > 0) return {
5862
+ label: t("action.push"),
5863
+ icon: PushIcon,
5864
+ title: t("sync.push"),
5865
+ busy: working && busy?.operation === "push",
5866
+ disabled: working,
5867
+ counts: [{
5868
+ tone: "ahead",
5869
+ text: `↑${repo.ahead}`
5870
+ }],
5871
+ run: () => {
5872
+ run("push", {}, t("toast.pushed"));
5873
+ }
5874
+ };
5875
+ return {
5876
+ label: t("action.fetch"),
5877
+ icon: FetchIcon,
5878
+ title: t("sync.fetch"),
5879
+ busy: remoteOperation,
5880
+ disabled: working,
5881
+ counts: [],
5882
+ run: () => {
5883
+ run("fetch", { all: true }, fetchSuccess);
5884
+ }
5885
+ };
5886
+ };
5887
+ /** The remotes a Fetch From or Push To submenu can target. */
5888
+ const remoteTargets = () => remotes.map((remote) => remote.name);
5889
+ /** Submenu: fetch one named remote, or all of them when there is a choice. */
5890
+ const openFetchFromMenu = () => {
5891
+ const names = remoteTargets();
5892
+ const items = [{ heading: t("section.remotes") }, ...names.map((name) => ({
5893
+ label: name,
5894
+ icon: h(RemoteIcon, { size: 14 }),
5895
+ run: () => {
5896
+ run("fetch", { remote: name }, fetchSuccess);
5897
+ }
5898
+ }))];
5899
+ if (names.length > 1) items.push(null, {
5900
+ label: t("menu.fetchAll"),
5901
+ icon: h(FetchIcon, { size: 14 }),
5902
+ run: () => {
5903
+ run("fetch", { all: true }, fetchSuccess);
5904
+ }
5905
+ });
5906
+ openMenuAt(menuAnchorRef.current, items);
5907
+ };
5908
+ /** Submenu: push the current branch to one named remote. */
5909
+ const openPushToMenu = () => {
5910
+ openMenuAt(menuAnchorRef.current, [{ heading: t("section.remotes") }, ...remoteTargets().map((name) => ({
5911
+ label: name,
5912
+ icon: h(RemoteIcon, { size: 14 }),
5913
+ run: () => {
5914
+ if (repo.upstream === null) run("push", {
5915
+ setUpstream: true,
5916
+ remote: name
5917
+ }, t("toast.published", { branch: repo.branch }));
5918
+ else run("push", { remote: name }, t("toast.pushed"));
5919
+ }
5920
+ }))]);
5921
+ };
5922
+ /** The remote commands behind the sync control's chevron. */
5923
+ const syncMenuItems = () => {
5924
+ const noRemote = remotes.length === 0;
5925
+ const noUpstream = repo.upstream === null;
5926
+ const noBranch = repo.detached === true || repo.unborn === true;
5927
+ return [
5928
+ {
5929
+ label: t("action.fetch"),
5930
+ disabled: working,
5931
+ run: () => {
5932
+ run("fetch", { all: true }, fetchSuccess);
5933
+ }
5934
+ },
5935
+ {
5936
+ label: t("action.fetchFrom"),
5937
+ disabled: working || noRemote,
5938
+ run: openFetchFromMenu
5939
+ },
5940
+ {
5941
+ label: t("action.pull"),
5942
+ disabled: working || noBranch || noUpstream,
5943
+ run: () => {
5944
+ run("pull", {}, t("toast.pulled"));
5945
+ }
5946
+ },
5947
+ {
5948
+ label: t("action.pullRebase"),
5949
+ disabled: working || noBranch || noUpstream,
5950
+ run: () => {
5951
+ run("pull", { rebase: true }, t("toast.pulled"));
5952
+ }
5953
+ },
5954
+ null,
5955
+ {
5956
+ label: t("action.push"),
5957
+ disabled: working || noBranch || noUpstream || noRemote,
5958
+ run: () => {
5959
+ run("push", {}, t("toast.pushed"));
5960
+ }
5961
+ },
5962
+ {
5963
+ label: t("action.pushTo"),
5964
+ disabled: working || noBranch || noRemote,
5965
+ run: openPushToMenu
5966
+ },
5967
+ {
5968
+ label: t("action.forcePush"),
5969
+ disabled: working || noBranch || noUpstream || noRemote,
5970
+ run: () => ask(t("confirm.forcePush"), () => {
5971
+ setConfirm(null);
5972
+ run("push", { forceWithLease: true }, t("toast.forcePushed"));
5973
+ })
5974
+ }
5975
+ ];
5976
+ };
5977
+ /** The Zed-style split control: a state-driven primary action and its menu. */
5978
+ const syncControl = () => {
5979
+ const primary = syncPrimary();
5980
+ const PrimaryIcon = primary.icon;
5981
+ return h("div", { className: "dgscm-sync-control" }, h("button", {
5982
+ type: "button",
5983
+ className: "dgscm-sync-primary",
5984
+ title: primary.title,
5985
+ "aria-label": primary.label,
5986
+ "aria-busy": primary.busy ? "true" : void 0,
5987
+ disabled: primary.disabled,
5988
+ onClick: (event) => {
5989
+ event.stopPropagation();
5990
+ if (primary.disabled) return;
5991
+ primary.run();
5992
+ }
5993
+ }, primary.busy ? h(SpinnerIcon, { size: 13 }) : h(PrimaryIcon, { size: 13 }), h("span", { className: "dgscm-sync-text" }, primary.label), primary.counts.map((entry) => h("span", {
5994
+ key: entry.tone,
5995
+ className: `dgscm-sync-count dgscm-sync-count--${entry.tone}`
5996
+ }, entry.text))), h("button", {
5997
+ type: "button",
5998
+ className: "dgscm-sync-toggle",
5999
+ title: t("action.moreSync"),
6000
+ "aria-label": t("action.moreSync"),
6001
+ disabled: working,
6002
+ onClick: (event) => {
6003
+ event.stopPropagation();
6004
+ openMenuBelow(event.currentTarget, syncMenuItems());
6005
+ }
6006
+ }, h(CaretIcon, { size: 12 })));
6007
+ };
6008
+ /** Options behind the commit split button's chevron. */
6009
+ const commitMenuItems = () => [
5112
6010
  {
5113
- label: t("action.pull"),
5114
- icon: h(PullIcon, { size: 14 }),
5115
- disabled: working || repo.upstream === null || repo.detached === true,
6011
+ label: message.trim().length > 0 ? t("action.improveMessage") : t("action.generateMessage"),
6012
+ icon: h(SparkleIcon, { size: 14 }),
6013
+ disabled: working || generating,
5116
6014
  run: () => {
5117
- run("pull", {}, t("toast.pulled"));
6015
+ generateMessage();
5118
6016
  }
5119
6017
  },
6018
+ null,
5120
6019
  {
5121
- label: unpublished ? t("action.publishBranch") : t("action.push"),
5122
- icon: h(unpublished ? CloudUploadIcon : PushIcon, { size: 14 }),
5123
- disabled: working || repo.detached === true || repo.unborn === true,
6020
+ label: t("commit.amend"),
6021
+ checked: amend,
6022
+ disabled: working || repo.head === null,
6023
+ run: () => toggleAmend(!amend)
6024
+ },
6025
+ null,
6026
+ {
6027
+ label: t("commit.all"),
6028
+ icon: h(CommitIcon, { size: 14 }),
6029
+ disabled: working || message.trim().length === 0,
5124
6030
  run: () => {
5125
- if (unpublished) publish();
5126
- else run("push", {}, t("toast.pushed"));
6031
+ commit(true);
5127
6032
  }
6033
+ },
6034
+ {
6035
+ label: t("commit.undo"),
6036
+ icon: h(DiscardIcon, { size: 14 }),
6037
+ disabled: working || repo.head === null || pending !== null,
6038
+ run: () => ask(t("confirm.undoCommit"), () => {
6039
+ setConfirm(null);
6040
+ run("undoCommit", {}, t("toast.undone"));
6041
+ })
5128
6042
  }
5129
6043
  ];
5130
6044
  /** Header controls of the staged section: the selection command joins the bulk command. */
@@ -5738,15 +6652,19 @@
5738
6652
  return rows;
5739
6653
  };
5740
6654
  return h("div", {
5741
- className: `dgscm-root${previewLayout === "right" ? " dgscm-root--row" : ""}`,
6655
+ className: `dgscm-root${paneLayout === "right" ? " dgscm-root--row" : ""}`,
5742
6656
  ref: attachRoot
5743
- }, h("div", { className: "dgscm-main" }, h("div", { className: "dgscm-top" }, h("div", { className: "dgscm-repo-row" }, h(RepoIcon, {
5744
- size: 15,
5745
- className: "dgscm-repo-glyph"
5746
- }), h("span", {
5747
- className: "dgscm-repo-name",
5748
- title: repo.root
5749
- }, repo.name), repo.detached === true ? h("span", { className: "dgscm-badge" }, repo.head === null ? "HEAD" : repo.head.short) : h("span", { className: "dgscm-branch-chip" }, h("button", {
6657
+ }, h("div", { className: "dgscm-main" }, h("div", { className: "dgscm-top" }, h("div", { className: "dgscm-repo-row" }, h("span", {
6658
+ className: "dgscm-repo-glyph",
6659
+ role: "img",
6660
+ "aria-label": repo.name,
6661
+ title: repo.name
6662
+ }, h(RepoIcon, { size: 15 })), repo.isWorktree === true ? h("span", {
6663
+ className: "dgscm-badge dgscm-badge--worktree dgscm-badge--icon",
6664
+ title: currentWorktree === null ? repo.root : `${t("repo.worktree")} — ${currentWorktree.path}`,
6665
+ "aria-label": t("repo.worktree"),
6666
+ role: "img"
6667
+ }, h(FolderIcon, { size: 12 })) : null, repo.detached === true ? h("span", { className: "dgscm-badge" }, repo.head === null ? "HEAD" : repo.head.short) : h("span", { className: "dgscm-branch-chip" }, h("button", {
5750
6668
  ref: chipRef,
5751
6669
  type: "button",
5752
6670
  className: "dgscm-branch-chip-name",
@@ -5787,36 +6705,7 @@
5787
6705
  reloadOpenNodes();
5788
6706
  });
5789
6707
  }
5790
- }, h(RefreshIcon, { size: 15 })), h(IconButton, {
5791
- label: t("action.fetch"),
5792
- disabled: working,
5793
- busy: busy?.operation === "fetch",
5794
- onClick: () => {
5795
- run("fetch", { all: true }, fetchSuccess);
5796
- }
5797
- }, h(FetchIcon, { size: 15 })), h(IconButton, {
5798
- label: t("action.pull"),
5799
- disabled: working || repo.upstream === null || repo.detached === true,
5800
- busy: busy?.operation === "pull",
5801
- onClick: () => {
5802
- run("pull", {}, t("toast.pulled"));
5803
- }
5804
- }, h(PullIcon, { size: 15 })), h(IconButton, {
5805
- label: unpublished ? t("action.publishBranch") : t("action.push"),
5806
- disabled: working || repo.detached === true || repo.unborn === true,
5807
- busy: busy?.operation === "push" || busy?.operation === "publish" || busy?.operation === "publishGithub",
5808
- onClick: () => {
5809
- if (unpublished) publish();
5810
- else run("push", {}, t("toast.pushed"));
5811
- }
5812
- }, h(unpublished ? CloudUploadIcon : PushIcon, { size: 15 })), h(IconButton, {
5813
- label: changeView === "tree" ? t("action.viewList") : t("action.viewTree"),
5814
- onClick: toggleChangeView
5815
- }, h(changeView === "tree" ? RowsIcon : TreeIcon, { size: 15 })), h(IconButton, {
5816
- label: t("action.moreChanges"),
5817
- disabled: working,
5818
- onClick: (event) => openMenu(event, changesMoreMenuItems())
5819
- }, h(MoreIcon, { size: 15 })))), working ? h("div", { className: "dgscm-sync" }, h("span", { className: "dgscm-sync-label" }, `${t(BUSY_LABEL[busy.operation] ?? "toast.busy")}…`)) : h("div", { className: "dgscm-sync" }, repo.detached === true ? h("span", { className: "dgscm-sync-label" }, t("repo.detached", { commit: repo.head === null ? "" : repo.head.short })) : repo.upstream === null ? h("span", { className: "dgscm-sync-label" }, t("repo.noUpstream")) : h(React.Fragment, null, repo.ahead > 0 ? h("span", {
6708
+ }, h(RefreshIcon, { size: 15 })), syncControl())), h("div", { className: "dgscm-sync-row" }, working ? h("div", { className: "dgscm-sync" }, h("span", { className: "dgscm-sync-label" }, `${t(BUSY_LABEL[busy.operation] ?? "toast.busy")}…`)) : h("div", { className: "dgscm-sync" }, repo.detached === true ? h("span", { className: "dgscm-sync-label" }, t("repo.detached", { commit: repo.head === null ? "" : repo.head.short })) : repo.upstream === null ? h("span", { className: "dgscm-sync-label" }, t("repo.noUpstream")) : h(React.Fragment, null, repo.ahead > 0 ? h("span", {
5820
6709
  className: "dgscm-count dgscm-count--ahead",
5821
6710
  title: t("ahead.label", { n: repo.ahead })
5822
6711
  }, h(PushIcon, { size: 11 }), String(repo.ahead)) : null, repo.behind > 0 ? h("span", {
@@ -5825,7 +6714,14 @@
5825
6714
  }, h(PullIcon, { size: 11 }), String(repo.behind)) : null, h("span", {
5826
6715
  className: "dgscm-sync-label",
5827
6716
  title: repo.upstream
5828
- }, repo.ahead === 0 && repo.behind === 0 ? t("repo.synced", { upstream: repo.upstream }) : repo.upstream)), h("span", { className: "dgscm-sep" }, "·"), h("span", { className: "dgscm-sync-label" }, repo.lastFetchAt === null || repo.lastFetchAt === void 0 ? t("repo.neverFetched") : t("repo.fetched", { time: relativeTime(repo.lastFetchAt, t) })))), pending === null ? null : h("div", { className: "dgscm-banner" }, h("span", { className: "dgscm-banner-glyph" }, h(WarnIcon, { size: 13 })), h("span", { className: "dgscm-banner-text" }, pendingLabel), h("button", {
6717
+ }, repo.ahead === 0 && repo.behind === 0 ? t("repo.synced", { upstream: repo.upstream }) : repo.upstream)), h("span", { className: "dgscm-sep" }, "·"), h("span", { className: "dgscm-sync-label" }, repo.lastFetchAt === null || repo.lastFetchAt === void 0 ? t("repo.neverFetched") : t("repo.fetched", { time: relativeTime(repo.lastFetchAt, t) }))), h("div", { className: "dgscm-sync-actions" }, h(IconButton, {
6718
+ label: changeView === "tree" ? t("action.viewList") : t("action.viewTree"),
6719
+ onClick: toggleChangeView
6720
+ }, h(changeView === "tree" ? RowsIcon : TreeIcon, { size: 14 })), h(IconButton, {
6721
+ label: t("action.moreChanges"),
6722
+ disabled: working,
6723
+ onClick: (event) => openMenu(event, changesMoreMenuItems())
6724
+ }, h(MoreIcon, { size: 14 }))))), pending === null ? null : h("div", { className: "dgscm-banner" }, h("span", { className: "dgscm-banner-glyph" }, h(WarnIcon, { size: 13 })), h("span", { className: "dgscm-banner-text" }, pendingLabel), h("button", {
5829
6725
  type: "button",
5830
6726
  className: "dgscm-link-button dgscm-link-button--primary dgscm-banner-action",
5831
6727
  disabled: working,
@@ -5844,7 +6740,7 @@
5844
6740
  onKeyDown: (event) => {
5845
6741
  if (event.key === "Enter" && (event.metaKey || event.ctrlKey)) {
5846
6742
  event.preventDefault();
5847
- commit(false);
6743
+ commitTracked();
5848
6744
  }
5849
6745
  }
5850
6746
  }), h("button", {
@@ -5895,57 +6791,26 @@
5895
6791
  onClick: () => {
5896
6792
  publish(true);
5897
6793
  }
5898
- }, h(CloudUploadIcon, { size: 15 }), t("action.publishBranch")) : h(React.Fragment, null, h("label", {
5899
- className: "dgscm-check",
5900
- title: t("commit.amend")
5901
- }, h("input", {
5902
- type: "checkbox",
5903
- checked: amend,
5904
- disabled: working || repo.head === null,
5905
- onChange: (event) => toggleAmend(event.target.checked)
5906
- }), h("span", null, t("commit.amend"))), h("div", { className: "dgscm-commit-actions" }, h("button", {
6794
+ }, h(CloudUploadIcon, { size: 15 }), t("action.publishBranch")) : h(React.Fragment, null, amend && !working ? h("span", { className: "dgscm-commit-note" }, t("commit.amendNote")) : null, h("div", { className: "dgscm-commit-actions" }, h("div", { className: "dgscm-split-button dgscm-split-button--commit" }, h("button", {
5907
6795
  type: "button",
5908
- className: "dgscm-button dgscm-button--primary dgscm-commit-submit",
6796
+ className: "dgscm-split-main dgscm-commit-submit",
5909
6797
  disabled: !canCommit,
5910
- title: staged.length === 0 && !amend ? t("commit.nothingStaged") : t("commit.submit"),
6798
+ title: commitTitle(),
6799
+ "aria-busy": busy?.operation === "commit" ? "true" : void 0,
5911
6800
  onClick: () => {
5912
- commit(false);
6801
+ commitTracked();
5913
6802
  }
5914
- }, busy?.operation === "commit" ? t("toast.busy") : t("commit.submit")), h("button", {
6803
+ }, busy?.operation === "commit" ? h(SpinnerIcon, { size: 13 }) : null, h("span", null, commitLabel())), h("button", {
5915
6804
  type: "button",
5916
- className: "dgscm-split-more",
6805
+ className: "dgscm-split-toggle dgscm-commit-more",
5917
6806
  title: t("commit.more"),
5918
6807
  "aria-label": t("commit.more"),
5919
- disabled: working || message.trim().length === 0 && workingChanges.length === 0,
5920
- onClick: (event) => openMenu(event, [
5921
- {
5922
- label: message.trim().length > 0 ? t("action.improveMessage") : t("action.generateMessage"),
5923
- icon: h(SparkleIcon, { size: 14 }),
5924
- disabled: working || generating,
5925
- run: () => {
5926
- generateMessage();
5927
- }
5928
- },
5929
- null,
5930
- {
5931
- label: t("commit.all"),
5932
- icon: h(CommitIcon, { size: 14 }),
5933
- disabled: working,
5934
- run: () => {
5935
- commit(true);
5936
- }
5937
- },
5938
- {
5939
- label: t("commit.undo"),
5940
- icon: h(DiscardIcon, { size: 14 }),
5941
- disabled: working || repo.head === null || pending !== null,
5942
- run: () => ask(t("confirm.undoCommit"), () => {
5943
- setConfirm(null);
5944
- run("undoCommit", {}, t("toast.undone"));
5945
- })
5946
- }
5947
- ])
5948
- }, h("span", { className: "dgscm-chevron dgscm-chevron--open" }, h(ChevronIcon, { open: true }))))))), h("div", {
6808
+ disabled: working,
6809
+ onClick: (event) => {
6810
+ event.stopPropagation();
6811
+ openMenuBelow(event.currentTarget, commitMenuItems());
6812
+ }
6813
+ }, h(CaretIcon, { size: 12 }))))))), h("div", {
5949
6814
  className: "dgscm-scroll",
5950
6815
  onClick: clearSelectionOnBlank
5951
6816
  }, staged.length === 0 ? null : h(Section, {
@@ -5970,6 +6835,26 @@
5970
6835
  open: sections.groupRepositories,
5971
6836
  onToggle: () => toggleSection("groupRepositories")
5972
6837
  }, h(Section, {
6838
+ id: "worktrees",
6839
+ title: t("section.worktrees"),
6840
+ count: worktrees.length,
6841
+ open: sections.worktrees,
6842
+ onToggle: () => toggleSection("worktrees"),
6843
+ glyph: h(FolderIcon, { size: 13 }),
6844
+ actions: h(IconButton, {
6845
+ label: t("action.createWorktree"),
6846
+ disabled: working || repo.unborn === true,
6847
+ onClick: (event) => openMenu(event, worktreeAddMenuItems())
6848
+ }, h(PlusIcon, { size: 13 }))
6849
+ }, worktrees.length === 0 ? h("div", { className: "dgscm-section-note" }, t("empty.worktrees")) : worktrees.map((worktree) => h(WorktreeRow, {
6850
+ key: `worktree:${worktree.path}`,
6851
+ worktree,
6852
+ pathLabel: worktreePathLabel(worktree),
6853
+ t,
6854
+ onSwitch: requestSwitchWorktree,
6855
+ onMenu: (event) => openMenu(event, worktreeMenuItems(worktree)),
6856
+ onContextMenu: (event) => openMenu(event, worktreeMenuItems(worktree))
6857
+ }))), h(Section, {
5973
6858
  id: "branches",
5974
6859
  title: t("section.branches"),
5975
6860
  count: branches.local.length,
@@ -6088,10 +6973,10 @@
6088
6973
  })
6089
6974
  }
6090
6975
  ])
6091
- })))))), previewOpen ? h(React.Fragment, null, h("div", {
6092
- className: `dgscm-divider${previewLayout === "right" ? " dgscm-divider--vertical" : ""}${dragging ? " dgscm-divider--active" : ""}`,
6976
+ })))))), previewOpen ? h(React.Fragment, null, collapsedPane ? null : h("div", {
6977
+ className: `dgscm-divider${paneLayout === "right" ? " dgscm-divider--vertical" : ""}${dragging ? " dgscm-divider--active" : ""}`,
6093
6978
  role: "separator",
6094
- "aria-orientation": previewLayout === "right" ? "vertical" : "horizontal",
6979
+ "aria-orientation": paneLayout === "right" ? "vertical" : "horizontal",
6095
6980
  "aria-label": t("diff.resize"),
6096
6981
  title: t("diff.resize"),
6097
6982
  onPointerDown: startResize,
@@ -6100,9 +6985,9 @@
6100
6985
  onPointerCancel: endResize,
6101
6986
  onDoubleClick: resetResize
6102
6987
  }), h("div", {
6103
- className: `dgscm-diffpane${previewLayout === "right" ? " dgscm-diffpane--right" : ""}`,
6104
- style: previewLayout === "right" ? { width: `${paneWidth}px` } : { height: `${paneHeight}px` }
6105
- }, previewLayout === "right" ? h("div", {
6988
+ className: `dgscm-diffpane${paneLayout === "right" ? " dgscm-diffpane--right" : ""}${collapsedPane ? " dgscm-diffpane--collapsed" : ""}`,
6989
+ style: paneLayout === "right" ? { width: `${paneWidth}px` } : collapsedPane ? void 0 : { height: `${paneHeight}px` }
6990
+ }, paneLayout === "right" ? h("div", {
6106
6991
  className: "dgscm-resize-edge",
6107
6992
  "aria-hidden": true,
6108
6993
  onPointerDown: startResize,
@@ -6119,14 +7004,18 @@
6119
7004
  onMaximize: () => setDiffMaximized((current) => !current),
6120
7005
  maximized: diffMaximized,
6121
7006
  searchSignal,
6122
- layout: previewLayout,
7007
+ layout: paneLayout,
7008
+ layoutFixed,
7009
+ collapsed: collapsedPane,
7010
+ onToggleCollapsed: () => setComparisonCollapsed((current) => !current),
6123
7011
  onLayout: switchLayout,
6124
7012
  onBack: view.fromHistory === true && history !== null ? backToHistory : view.fromReview === true && review !== null ? () => setView(null) : void 0,
6125
7013
  backLabel: view.fromHistory === true ? t("history.back") : t("review.back"),
6126
7014
  t
6127
7015
  }) : review !== null ? h(ReviewPane, {
6128
7016
  review,
6129
- layout: previewLayout,
7017
+ layout: paneLayout,
7018
+ layoutFixed,
6130
7019
  onLayout: switchLayout,
6131
7020
  maximized: diffMaximized,
6132
7021
  onMaximize: () => setDiffMaximized((current) => !current),
@@ -6137,7 +7026,8 @@
6137
7026
  t
6138
7027
  }) : h(HistoryPane, {
6139
7028
  state: history,
6140
- layout: previewLayout,
7029
+ layout: paneLayout,
7030
+ layoutFixed,
6141
7031
  onLayout: switchLayout,
6142
7032
  maximized: diffMaximized,
6143
7033
  onMaximize: () => setDiffMaximized((current) => !current),
@@ -6160,6 +7050,17 @@
6160
7050
  prompt,
6161
7051
  onCancel: () => setPrompt(null),
6162
7052
  t
7053
+ }), worktreeDialog === null ? null : h(WorktreeDialog, {
7054
+ state: worktreeDialog,
7055
+ base: repo.branch === null || repo.branch === void 0 ? "HEAD" : repo.branch,
7056
+ onChange: updateWorktreeBranch,
7057
+ onCancel: () => {
7058
+ if (worktreeDialog.submitting !== true) setWorktreeDialog(null);
7059
+ },
7060
+ onSubmit: () => {
7061
+ createWorktree();
7062
+ },
7063
+ t
6163
7064
  }), menu === null ? null : h(ContextMenu, {
6164
7065
  menu,
6165
7066
  onClose: () => {