@dylanpiercey/work 0.0.20 → 0.0.22

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.
Files changed (154) hide show
  1. package/dist/index.mjs +292 -223
  2. package/dist/public/assets/{_1vY8pby1.js → _5l_SLhQO.js} +2 -2
  3. package/dist/public/assets/{_1vY8pby1.js.map → _5l_SLhQO.js.map} +1 -1
  4. package/dist/public/assets/{_DxQA8DF72.js → _B22N0jOE2.js} +2 -2
  5. package/dist/public/assets/{_DxQA8DF72.js.map → _B22N0jOE2.js.map} +1 -1
  6. package/dist/public/assets/{_C0Aq200h.js → _B6O2FrRn.js} +2 -2
  7. package/dist/public/assets/{_C0Aq200h.js.map → _B6O2FrRn.js.map} +1 -1
  8. package/dist/public/assets/{_DUKDYAof.js → _B70XmXCb.js} +2 -2
  9. package/dist/public/assets/{_DUKDYAof.js.map → _B70XmXCb.js.map} +1 -1
  10. package/dist/public/assets/{_aiX4inqS2.js → _BHjp4Wp62.js} +2 -2
  11. package/dist/public/assets/{_aiX4inqS2.js.map → _BHjp4Wp62.js.map} +1 -1
  12. package/dist/public/assets/{_BMXWQXeX.js → _BIU5EmFO.js} +2 -2
  13. package/dist/public/assets/{_BMXWQXeX.js.map → _BIU5EmFO.js.map} +1 -1
  14. package/dist/public/assets/{_Dh0ojLY7.js → _BNFIxlJR.js} +2 -2
  15. package/dist/public/assets/{_Dh0ojLY7.js.map → _BNFIxlJR.js.map} +1 -1
  16. package/dist/public/assets/{_CWiaS9tN.js → _BURv1zn0.js} +2 -2
  17. package/dist/public/assets/{_CWiaS9tN.js.map → _BURv1zn0.js.map} +1 -1
  18. package/dist/public/assets/{_D6mf7azh2.js → _BX5xyzBY2.js} +2 -2
  19. package/dist/public/assets/{_D6mf7azh2.js.map → _BX5xyzBY2.js.map} +1 -1
  20. package/dist/public/assets/{_DPQpBMwo.js → _Ba-VBf2z.js} +2 -2
  21. package/dist/public/assets/{_DPQpBMwo.js.map → _Ba-VBf2z.js.map} +1 -1
  22. package/dist/public/assets/{_wSQWJJZf2.js → _BdVPUTjx2.js} +2 -2
  23. package/dist/public/assets/{_wSQWJJZf2.js.map → _BdVPUTjx2.js.map} +1 -1
  24. package/dist/public/assets/{_D4YgBy102.js → _Bg1unGUo2.js} +2 -2
  25. package/dist/public/assets/{_D4YgBy102.js.map → _Bg1unGUo2.js.map} +1 -1
  26. package/dist/public/assets/{_ephmTnv12.js → _BgMhxgll2.js} +2 -2
  27. package/dist/public/assets/{_ephmTnv12.js.map → _BgMhxgll2.js.map} +1 -1
  28. package/dist/public/assets/{_CexcTijs.js → _BlN6B4lX.js} +2 -2
  29. package/dist/public/assets/{_CexcTijs.js.map → _BlN6B4lX.js.map} +1 -1
  30. package/dist/public/assets/{_9e0FE9jl.js → _BnZ5hdB-.js} +2 -2
  31. package/dist/public/assets/{_9e0FE9jl.js.map → _BnZ5hdB-.js.map} +1 -1
  32. package/dist/public/assets/{_CY51jVa3.js → _BnlyQRjI.js} +2 -2
  33. package/dist/public/assets/{_CY51jVa3.js.map → _BnlyQRjI.js.map} +1 -1
  34. package/dist/public/assets/{_WdzvtYc4.js → _BpZ3p5fk.js} +2 -2
  35. package/dist/public/assets/{_WdzvtYc4.js.map → _BpZ3p5fk.js.map} +1 -1
  36. package/dist/public/assets/{_Dgh3CpAc.js → _Bq8AEuDG.js} +2 -2
  37. package/dist/public/assets/{_Dgh3CpAc.js.map → _Bq8AEuDG.js.map} +1 -1
  38. package/dist/public/assets/{_Bexv6Y9B.js → _BqBvsjYd.js} +2 -2
  39. package/dist/public/assets/{_Bexv6Y9B.js.map → _BqBvsjYd.js.map} +1 -1
  40. package/dist/public/assets/{_B-3tfKTw2.js → _Bs98qN5-2.js} +2 -2
  41. package/dist/public/assets/{_B-3tfKTw2.js.map → _Bs98qN5-2.js.map} +1 -1
  42. package/dist/public/assets/{_CONbe6YE.js → _Bu7qESl9.js} +2 -2
  43. package/dist/public/assets/{_CONbe6YE.js.map → _Bu7qESl9.js.map} +1 -1
  44. package/dist/public/assets/{_Bc6gDxIN.js → _Bu8da51m.js} +2 -2
  45. package/dist/public/assets/{_Bc6gDxIN.js.map → _Bu8da51m.js.map} +1 -1
  46. package/dist/public/assets/{_D6GBnH1C.js → _ByQEUmce.js} +2 -2
  47. package/dist/public/assets/{_D6GBnH1C.js.map → _ByQEUmce.js.map} +1 -1
  48. package/dist/public/assets/{_DQm9_WBm2.js → _BzxnfKym2.js} +2 -2
  49. package/dist/public/assets/{_DQm9_WBm2.js.map → _BzxnfKym2.js.map} +1 -1
  50. package/dist/public/assets/{_BrtaMKSf.js → _C9f7zuCK.js} +2 -2
  51. package/dist/public/assets/{_BrtaMKSf.js.map → _C9f7zuCK.js.map} +1 -1
  52. package/dist/public/assets/{_CVYrmNa5.js → _CBoYeeXx.js} +2 -2
  53. package/dist/public/assets/{_CVYrmNa5.js.map → _CBoYeeXx.js.map} +1 -1
  54. package/dist/public/assets/{_BiAQN2ar.js → _CC8qBXCN.js} +2 -2
  55. package/dist/public/assets/{_BiAQN2ar.js.map → _CC8qBXCN.js.map} +1 -1
  56. package/dist/public/assets/{_8HSgn8Ae2.js → _CGPzzHpX2.js} +2 -2
  57. package/dist/public/assets/{_8HSgn8Ae2.js.map → _CGPzzHpX2.js.map} +1 -1
  58. package/dist/public/assets/{_Bg0vcVNm.js → _CHO-fcR6.js} +2 -2
  59. package/dist/public/assets/{_Bg0vcVNm.js.map → _CHO-fcR6.js.map} +1 -1
  60. package/dist/public/assets/{_BC-q6DS6.js → _CJBKn-UB.js} +2 -2
  61. package/dist/public/assets/{_BC-q6DS6.js.map → _CJBKn-UB.js.map} +1 -1
  62. package/dist/public/assets/{_DGb5RYdw2.js → _CK4WVIux2.js} +2 -2
  63. package/dist/public/assets/{_DGb5RYdw2.js.map → _CK4WVIux2.js.map} +1 -1
  64. package/dist/public/assets/{_BZzhWd3g.js → _CLf30P17.js} +2 -2
  65. package/dist/public/assets/{_BZzhWd3g.js.map → _CLf30P17.js.map} +1 -1
  66. package/dist/public/assets/{_BoyRXB0-2.js → _C_PnVjpe2.js} +2 -2
  67. package/dist/public/assets/{_BoyRXB0-2.js.map → _C_PnVjpe2.js.map} +1 -1
  68. package/dist/public/assets/{_T_Eme7qq.js → _CbS76xPa.js} +2 -2
  69. package/dist/public/assets/{_T_Eme7qq.js.map → _CbS76xPa.js.map} +1 -1
  70. package/dist/public/assets/{_sq9fDeBh.js → _CboThNtr.js} +2 -2
  71. package/dist/public/assets/{_sq9fDeBh.js.map → _CboThNtr.js.map} +1 -1
  72. package/dist/public/assets/{_CvQo4_H-2.js → _CkNgOJS_2.js} +2 -2
  73. package/dist/public/assets/{_CvQo4_H-2.js.map → _CkNgOJS_2.js.map} +1 -1
  74. package/dist/public/assets/{_g8IPJgde.js → _CpGG57tS.js} +2 -2
  75. package/dist/public/assets/{_g8IPJgde.js.map → _CpGG57tS.js.map} +1 -1
  76. package/dist/public/assets/{_U_zJ788O.js → _CxzK5dOR.js} +2 -2
  77. package/dist/public/assets/{_U_zJ788O.js.map → _CxzK5dOR.js.map} +1 -1
  78. package/dist/public/assets/{_BTrOYuEk2.js → _CzHeRzBF2.js} +2 -2
  79. package/dist/public/assets/{_BTrOYuEk2.js.map → _CzHeRzBF2.js.map} +1 -1
  80. package/dist/public/assets/{_C6_Bkr9e.js → _D-GxVvEg.js} +2 -2
  81. package/dist/public/assets/{_C6_Bkr9e.js.map → _D-GxVvEg.js.map} +1 -1
  82. package/dist/public/assets/{_DHU3s4L8.js → _D2-cyutB.js} +2 -2
  83. package/dist/public/assets/{_DHU3s4L8.js.map → _D2-cyutB.js.map} +1 -1
  84. package/dist/public/assets/{_CtMaZFiS.js → _D49qceqY.js} +2 -2
  85. package/dist/public/assets/{_CtMaZFiS.js.map → _D49qceqY.js.map} +1 -1
  86. package/dist/public/assets/{_CTmSJ3aE2.js → _DFjCyuxr2.js} +2 -2
  87. package/dist/public/assets/{_CTmSJ3aE2.js.map → _DFjCyuxr2.js.map} +1 -1
  88. package/dist/public/assets/{_C_N5lXIT2.js → _DGx7YAZr2.js} +2 -2
  89. package/dist/public/assets/{_C_N5lXIT2.js.map → _DGx7YAZr2.js.map} +1 -1
  90. package/dist/public/assets/{_C9vwBOMi2.js → _DHjLNDCN2.js} +2 -2
  91. package/dist/public/assets/{_C9vwBOMi2.js.map → _DHjLNDCN2.js.map} +1 -1
  92. package/dist/public/assets/{_n3dr6s1l.js → _DMiuUq_D.js} +2 -2
  93. package/dist/public/assets/{_n3dr6s1l.js.map → _DMiuUq_D.js.map} +1 -1
  94. package/dist/public/assets/{_D1QJFY1d.js → _DPXMcFb-.js} +2 -2
  95. package/dist/public/assets/{_D1QJFY1d.js.map → _DPXMcFb-.js.map} +1 -1
  96. package/dist/public/assets/{_D5E_RD5H2.js → _DPgBCY_32.js} +2 -2
  97. package/dist/public/assets/{_D5E_RD5H2.js.map → _DPgBCY_32.js.map} +1 -1
  98. package/dist/public/assets/{_Cqdz3hZN2.js → _DQGram-O2.js} +2 -2
  99. package/dist/public/assets/{_Cqdz3hZN2.js.map → _DQGram-O2.js.map} +1 -1
  100. package/dist/public/assets/{_DNygB11b.js → _DR_zCeOi.js} +2 -2
  101. package/dist/public/assets/{_DNygB11b.js.map → _DR_zCeOi.js.map} +1 -1
  102. package/dist/public/assets/{_DRazGDj4.js → _DTvuMul1.js} +2 -2
  103. package/dist/public/assets/{_DRazGDj4.js.map → _DTvuMul1.js.map} +1 -1
  104. package/dist/public/assets/{_BTQOUkJH2.js → _DXLq4GO62.js} +2 -2
  105. package/dist/public/assets/{_BTQOUkJH2.js.map → _DXLq4GO62.js.map} +1 -1
  106. package/dist/public/assets/{_BhcFcxh_.js → _DiJdY7gQ.js} +2 -2
  107. package/dist/public/assets/{_BhcFcxh_.js.map → _DiJdY7gQ.js.map} +1 -1
  108. package/dist/public/assets/{_BpQoL5sK.js → _DmQQt4hu.js} +2 -2
  109. package/dist/public/assets/{_BpQoL5sK.js.map → _DmQQt4hu.js.map} +1 -1
  110. package/dist/public/assets/{_DyzfV4EQ.js → _DnNvPxgR.js} +2 -2
  111. package/dist/public/assets/{_DyzfV4EQ.js.map → _DnNvPxgR.js.map} +1 -1
  112. package/dist/public/assets/{_CSCYugS_.js → _Du6sWmX1.js} +2 -2
  113. package/dist/public/assets/{_CSCYugS_.js.map → _Du6sWmX1.js.map} +1 -1
  114. package/dist/public/assets/{_Dc3dYVuw2.js → _Dw_lnT1k2.js} +2 -2
  115. package/dist/public/assets/{_Dc3dYVuw2.js.map → _Dw_lnT1k2.js.map} +1 -1
  116. package/dist/public/assets/{_GnVvdLnS.js → _Dy_gFnsG.js} +2 -2
  117. package/dist/public/assets/{_GnVvdLnS.js.map → _Dy_gFnsG.js.map} +1 -1
  118. package/dist/public/assets/{_CsU7IfeP.js → _ERq15mXY.js} +2 -2
  119. package/dist/public/assets/{_CsU7IfeP.js.map → _ERq15mXY.js.map} +1 -1
  120. package/dist/public/assets/{_c4JkcQT9.js → _FJ3epuTO.js} +2 -2
  121. package/dist/public/assets/{_c4JkcQT9.js.map → _FJ3epuTO.js.map} +1 -1
  122. package/dist/public/assets/{_CekmLjtJ2.js → _GbGk7W6w2.js} +2 -2
  123. package/dist/public/assets/{_CekmLjtJ2.js.map → _GbGk7W6w2.js.map} +1 -1
  124. package/dist/public/assets/{_DDQcSiNZ.js → _Jso7DEzq.js} +2 -2
  125. package/dist/public/assets/{_DDQcSiNZ.js.map → _Jso7DEzq.js.map} +1 -1
  126. package/dist/public/assets/{_CSdPg73e.js → _KgHefAOC.js} +2 -2
  127. package/dist/public/assets/{_CSdPg73e.js.map → _KgHefAOC.js.map} +1 -1
  128. package/dist/public/assets/{_CcQeIXwg.js → _SsIq7tI_.js} +2 -2
  129. package/dist/public/assets/{_CcQeIXwg.js.map → _SsIq7tI_.js.map} +1 -1
  130. package/dist/public/assets/{_hecKvkGK.js → _TmenAuHp.js} +2 -2
  131. package/dist/public/assets/{_hecKvkGK.js.map → _TmenAuHp.js.map} +1 -1
  132. package/dist/public/assets/{_CwXWcR4L.js → _XaQkxl5y.js} +2 -2
  133. package/dist/public/assets/{_CwXWcR4L.js.map → _XaQkxl5y.js.map} +1 -1
  134. package/dist/public/assets/{_cy1N2YQO.js → _XlH801Qf.js} +2 -2
  135. package/dist/public/assets/{_cy1N2YQO.js.map → _XlH801Qf.js.map} +1 -1
  136. package/dist/public/assets/{_C96rg9Cn.js → _k-HR2JJy.js} +2 -2
  137. package/dist/public/assets/{_C96rg9Cn.js.map → _k-HR2JJy.js.map} +1 -1
  138. package/dist/public/assets/{_VrKcP-IA.js → _mHazeEK3.js} +2 -2
  139. package/dist/public/assets/{_VrKcP-IA.js.map → _mHazeEK3.js.map} +1 -1
  140. package/dist/public/assets/{_BdrBTnQV2.js → _pNAnwKme2.js} +2 -2
  141. package/dist/public/assets/{_BdrBTnQV2.js.map → _pNAnwKme2.js.map} +1 -1
  142. package/dist/public/assets/{_Dge-k2OK.js → _sILr7p5e.js} +2 -2
  143. package/dist/public/assets/{_Dge-k2OK.js.map → _sILr7p5e.js.map} +1 -1
  144. package/dist/public/assets/{_CBgFzcoa.js → _unB9bj15.js} +2 -2
  145. package/dist/public/assets/{_CBgFzcoa.js.map → _unB9bj15.js.map} +1 -1
  146. package/dist/public/assets/{_Dia6fhph2.js → _xOqgIxv42.js} +2 -2
  147. package/dist/public/assets/{_Dia6fhph2.js.map → _xOqgIxv42.js.map} +1 -1
  148. package/dist/public/assets/{_CzS0SrVK2.js → _yYAbok8d2.js} +2 -2
  149. package/dist/public/assets/{_CzS0SrVK2.js.map → _yYAbok8d2.js.map} +1 -1
  150. package/dist/public/assets/{index-CxxdFG3E.css → index-BxVK_c-q.css} +1 -1
  151. package/dist/public/assets/{index-CxXU95sL.js → index-LnMHViqj.js} +63 -63
  152. package/dist/public/assets/index-LnMHViqj.js.map +1 -0
  153. package/package.json +1 -1
  154. package/dist/public/assets/index-CxXU95sL.js.map +0 -1
package/dist/index.mjs CHANGED
@@ -5648,38 +5648,46 @@ var icon_search_default = _template("H", (input) => {
5648
5648
  //#endregion
5649
5649
  //#region src/tags/file-filter.marko
5650
5650
  var file_filter_default = _template("f", (input) => {
5651
- _scope_reason();
5651
+ const $scope0_reason = _scope_reason();
5652
5652
  const $scope0_id = _scope_id();
5653
- let draft = input.value || "";
5653
+ let value = input.value;
5654
+ let pending = null;
5655
+ const draft = (pending ?? value) || "";
5654
5656
  const box = { timer: 0 };
5655
5657
  const flush = _resume(() => {
5656
5658
  if (box.timer) {
5657
5659
  clearTimeout(box.timer);
5658
5660
  box.timer = 0;
5659
5661
  }
5660
- input.onChange(draft);
5662
+ const next = pending !== null ? pending : value || "";
5663
+ pending = null;
5664
+ value = next;
5661
5665
  }, "f1", $scope0_id);
5662
5666
  const type = _resume((v) => {
5663
- draft = v;
5664
5667
  if (box.timer) clearTimeout(box.timer);
5665
5668
  if (!v) {
5666
5669
  box.timer = 0;
5667
- input.onChange("");
5670
+ pending = null;
5671
+ value = "";
5668
5672
  return;
5669
5673
  }
5674
+ pending = v;
5670
5675
  box.timer = setTimeout(flush, 150);
5671
5676
  }, "f2", $scope0_id);
5672
5677
  _html(`<div class=wrap><input${_attr_input_value($scope0_id, "a", draft, _resume(function(v) {
5673
5678
  type(v);
5674
5679
  }, "f0", $scope0_id))} class=file-filter type=search placeholder="Filter files… (globs, !excludes)" aria-label="Filter files">${_el_resume($scope0_id, "a")}</div>`);
5675
5680
  _script($scope0_id, "f3");
5676
- _script($scope0_id, "f4");
5677
5681
  writeScope($scope0_id, {
5678
- e: input.onChange,
5679
- f: draft,
5680
- h: box.timer,
5681
- j: flush,
5682
- l: type
5682
+ d: _serialize_if($scope0_reason, 1) && input.value,
5683
+ e: _serialize_if($scope0_reason, 0) && input.valueChange,
5684
+ g: value,
5685
+ i: pending,
5686
+ k: draft,
5687
+ m: box.timer,
5688
+ o: flush,
5689
+ q: type,
5690
+ h: input.valueChange || void 0
5683
5691
  });
5684
5692
  _resume_branch($scope0_id);
5685
5693
  });
@@ -5781,6 +5789,7 @@ _template("c", (input) => {
5781
5789
  //#region src/tags/diff-view.marko
5782
5790
  var api$3;
5783
5791
  var copyText;
5792
+ var prHeadSigFromDiff;
5784
5793
  var getTermDims;
5785
5794
  var makeFileFilter;
5786
5795
  var diff_view_default = _template("e", (input) => {
@@ -5869,6 +5878,10 @@ var diff_view_default = _template("e", (input) => {
5869
5878
  };
5870
5879
  requestAnimationFrame(tryScroll);
5871
5880
  }, "e4", $scope0_id);
5881
+ const headBox = {
5882
+ sig: "",
5883
+ timer: 0
5884
+ };
5872
5885
  const load = _resume(async (dirty = uncommitted, refresh = false) => {
5873
5886
  loading = true;
5874
5887
  error = null;
@@ -5881,6 +5894,7 @@ var diff_view_default = _template("e", (input) => {
5881
5894
  repos = diffData;
5882
5895
  comments = reviewData.comments || [];
5883
5896
  viewed = new Set(reviewData.viewed || []);
5897
+ headBox.sig = prHeadSigFromDiff(diffData);
5884
5898
  if (input.focusPr) focusPrSection(input.focusPr);
5885
5899
  } catch (err) {
5886
5900
  error = String(err.message || err);
@@ -5894,6 +5908,17 @@ var diff_view_default = _template("e", (input) => {
5894
5908
  viewed = new Set(reviewData.viewed || []);
5895
5909
  } catch {}
5896
5910
  }, "e6", $scope0_id);
5911
+ const reload = _resume(() => {
5912
+ dismissedDrift = /* @__PURE__ */ new Set();
5913
+ return load(uncommitted, true);
5914
+ }, "e7", $scope0_id);
5915
+ const reloadSoon = _resume(() => {
5916
+ if (headBox.timer) clearTimeout(headBox.timer);
5917
+ headBox.timer = setTimeout(() => {
5918
+ headBox.timer = 0;
5919
+ reload();
5920
+ }, 250);
5921
+ }, "e8", $scope0_id);
5897
5922
  const repoList = repos || [];
5898
5923
  const allFiles = repoList.flatMap((r) => r.files.map((f) => ({
5899
5924
  ...f,
@@ -5916,15 +5941,11 @@ var diff_view_default = _template("e", (input) => {
5916
5941
  return map;
5917
5942
  })();
5918
5943
  const sendPick = (input.sessions || []).some((s) => s.id === sendTarget) ? sendTarget : input.sessions?.[0]?.id ?? null;
5919
- const localDiffers = _resume((repo) => !!repo.pr && !!repo.localHead && (repo.localHead !== repo.head || repo.branch !== repo.pr.headRefName), "e7");
5944
+ const localDiffers = _resume((repo) => !!repo.pr && !!repo.localHead && (repo.localHead !== repo.head || repo.branch !== repo.pr.headRefName), "e9");
5920
5945
  const driftRepos = repoList.filter((r) => r.githubDrift && !dismissedDrift.has(r.id));
5921
5946
  const dismissDrift = _resume(() => {
5922
5947
  dismissedDrift = /* @__PURE__ */ new Set([...dismissedDrift, ...driftRepos.map((r) => r.id)]);
5923
- }, "e8", $scope0_id);
5924
- const reload = _resume(() => {
5925
- dismissedDrift = /* @__PURE__ */ new Set();
5926
- return load(uncommitted, true);
5927
- }, "e9", $scope0_id);
5948
+ }, "e10", $scope0_id);
5928
5949
  const toggleViewed = _resume((key) => {
5929
5950
  const next = new Set(viewed);
5930
5951
  const isViewed = !next.has(key);
@@ -5942,7 +5963,7 @@ var diff_view_default = _template("e", (input) => {
5942
5963
  }).catch(() => {
5943
5964
  error = "Saving viewed state failed — it may reset on reload.";
5944
5965
  });
5945
- }, "e10", $scope0_id);
5966
+ }, "e11", $scope0_id);
5946
5967
  const saveComment = _resume(async (file, text) => {
5947
5968
  const range = draft;
5948
5969
  draft = null;
@@ -5964,11 +5985,11 @@ var diff_view_default = _template("e", (input) => {
5964
5985
  } catch (err) {
5965
5986
  error = String(err.message || err);
5966
5987
  }
5967
- }, "e11", $scope0_id);
5988
+ }, "e12", $scope0_id);
5968
5989
  const removeComment = _resume(async (id) => {
5969
5990
  comments = comments.filter((c) => c.id !== id);
5970
5991
  await fetch(`/api/review-comments/${id}`, { method: "DELETE" });
5971
- }, "e12", $scope0_id);
5992
+ }, "e13", $scope0_id);
5972
5993
  const clearComments = _resume(async () => {
5973
5994
  comments = [];
5974
5995
  draft = null;
@@ -5977,7 +5998,7 @@ var diff_view_default = _template("e", (input) => {
5977
5998
  headers: { "content-type": "application/json" },
5978
5999
  body: JSON.stringify({ action: "clear" })
5979
6000
  });
5980
- }, "e13", $scope0_id);
6001
+ }, "e14", $scope0_id);
5981
6002
  const copyMarkdown = _resume(async () => {
5982
6003
  if (!await copyText(commentMarkdown(comments, repos))) {
5983
6004
  error = "Copy failed — clipboard needs HTTPS on this browser.";
@@ -5988,7 +6009,7 @@ var diff_view_default = _template("e", (input) => {
5988
6009
  copied = false;
5989
6010
  }, 1500);
5990
6011
  await clearComments();
5991
- }, "e14", $scope0_id);
6012
+ }, "e15", $scope0_id);
5992
6013
  const sendTo = _resume(async (sessionId) => {
5993
6014
  if (!sessionId) return;
5994
6015
  sending = true;
@@ -6008,22 +6029,22 @@ var diff_view_default = _template("e", (input) => {
6008
6029
  error = String(err.message || err);
6009
6030
  sending = false;
6010
6031
  }
6011
- }, "e15", $scope0_id);
6032
+ }, "e16", $scope0_id);
6012
6033
  const jumpTo = _resume((key) => {
6013
6034
  const el = ((scrollEl) => scrollEl())(_el_read_error).querySelector(`details[data-key="${CSS.escape(key)}"]`);
6014
6035
  if (el) {
6015
6036
  el.open = true;
6016
6037
  el.scrollIntoView({ block: "start" });
6017
6038
  }
6018
- }, "e16", $scope0_id);
6039
+ }, "e17", $scope0_id);
6019
6040
  const openFind = _resume(() => {
6020
6041
  findOpen = true;
6021
6042
  findTick++;
6022
- }, "e17", $scope0_id);
6043
+ }, "e18", $scope0_id);
6023
6044
  const onFindState = _resume((next) => {
6024
6045
  findState = next;
6025
6046
  if (next.hit) setTimeout(() => jumpTo(next.hit.key), 0);
6026
- }, "e18", $scope0_id);
6047
+ }, "e19", $scope0_id);
6027
6048
  _html(`<div class=diff-view><aside class=${!treeOpen ? "\"tree closed\"" : "tree"}>`);
6028
6049
  _for_of(repoList.filter((r) => shownByRepo.get(r.id)?.length), (repo) => {
6029
6050
  const $scope5_id = _scope_id();
@@ -6033,8 +6054,8 @@ var diff_view_default = _template("e", (input) => {
6033
6054
  const $scope6_id = _scope_id();
6034
6055
  const $if_content4__dirKey__closures = /* @__PURE__ */ new Set();
6035
6056
  const repoRows = treeRows(shownByRepo.get(repo.id) || []);
6036
- const dirKey = _resume((path) => `${repo.id}/${path}`, "e19", $scope6_id);
6037
- const rowDir = _resume((row) => row.kind === "dir" ? row.path : row.file.path.includes("/") ? row.file.path.slice(0, row.file.path.lastIndexOf("/")) : "", "e20");
6057
+ const dirKey = _resume((path) => `${repo.id}/${path}`, "e20", $scope6_id);
6058
+ const rowDir = _resume((row) => row.kind === "dir" ? row.path : row.file.path.includes("/") ? row.file.path.slice(0, row.file.path.lastIndexOf("/")) : "", "e21");
6038
6059
  const hiddenByCollapse = _resume((row) => {
6039
6060
  const dir = rowDir(row);
6040
6061
  for (const collapsed of collapsedDirs) {
@@ -6044,15 +6065,15 @@ var diff_view_default = _template("e", (input) => {
6044
6065
  if (dir === path || dir.startsWith(`${path}/`)) return true;
6045
6066
  }
6046
6067
  return false;
6047
- }, "e21", $scope6_id);
6068
+ }, "e22", $scope6_id);
6048
6069
  _for_of(repoRows, (row) => {
6049
6070
  const $scope7_id = _scope_id();
6050
6071
  _if(() => {
6051
6072
  if (!hiddenByCollapse(row) && row.kind === "dir") {
6052
6073
  const $scope29_id = _scope_id();
6053
6074
  _html(`<button class=${collapsedDirs.has(dirKey(row.path)) ? "\"tree-dir dim mono closed\"" : "\"tree-dir dim mono\""}${_attr("title", row.path)}${_attr_style(`padding-left:${.35 + row.depth * .75}rem`)}><span class=tree-chev>${collapsedDirs.has(dirKey(row.path)) ? "▸" : "▾"}${_el_resume($scope29_id, "b")}</span>${_escape(row.label)}${_el_resume($scope29_id, "c")}/</button>${_el_resume($scope29_id, "a")}`);
6054
- _script($scope29_id, "e32");
6055
- _subscribe($if_content4__dirKey__closures, _subscribe($collapsedDirs__closures, writeScope($scope29_id, { Cd3: 1 })));
6075
+ _script($scope29_id, "e33");
6076
+ _subscribe($if_content4__dirKey__closures, _subscribe($collapsedDirs__closures, writeScope($scope29_id, { Cd5: 1 })));
6056
6077
  return 0;
6057
6078
  } else if (!hiddenByCollapse(row) && row.kind !== "dir") {
6058
6079
  const $scope8_id = _scope_id();
@@ -6066,7 +6087,7 @@ var diff_view_default = _template("e", (input) => {
6066
6087
  }
6067
6088
  }, $scope8_id, "e", 1, 1, 1, 0, 1);
6068
6089
  _html(`</button>${_el_resume($scope8_id, "a")}`);
6069
- _script($scope8_id, "e33");
6090
+ _script($scope8_id, "e34");
6070
6091
  _subscribe($commentsByFile__closures, _subscribe($viewed__closures, writeScope($scope8_id, {})));
6071
6092
  return 1;
6072
6093
  }
@@ -6092,7 +6113,7 @@ var diff_view_default = _template("e", (input) => {
6092
6113
  }
6093
6114
  }, $scope5_id, "d");
6094
6115
  _html("</div>");
6095
- _script($scope5_id, "e34");
6116
+ _script($scope5_id, "e35");
6096
6117
  writeScope($scope5_id, { g: repo?.id });
6097
6118
  }, "id", $scope0_id, "a", 1, 1, 1, "</aside>", 1);
6098
6119
  _html("<div class=diff-col><div class=diff-head>");
@@ -6102,7 +6123,7 @@ var diff_view_default = _template("e", (input) => {
6102
6123
  _html("<button class=icon-btn title=\"Back to terminal\">");
6103
6124
  icon_back_default({ size: 14 });
6104
6125
  _html(`</button>${_el_resume($scope1_id, "a")}`);
6105
- _script($scope1_id, "e35");
6126
+ _script($scope1_id, "e36");
6106
6127
  writeScope($scope1_id, { _: _scope_with_id($scope0_id) });
6107
6128
  return 0;
6108
6129
  }
@@ -6116,7 +6137,7 @@ var diff_view_default = _template("e", (input) => {
6116
6137
  if ((input.sessions || []).length === 1) {
6117
6138
  const $scope3_id = _scope_id();
6118
6139
  _html(`<button class="btn primary"${_attr("disabled", sending)}>${sending ? "Sending…" : `Send to ${_escape(`${input.sessions[0].title || input.sessions[0].agent}`)}`}${_el_resume($scope3_id, "b")}</button>${_el_resume($scope3_id, "a")}`);
6119
- _script($scope3_id, "e36");
6140
+ _script($scope3_id, "e37");
6120
6141
  _subscribe($sending__closures, _subscribe($si__input_sessions_0_agent && $input_sessions_0_agent__closures, _subscribe($si__input_sessions_0_title && $input_sessions_0_title__closures, writeScope($scope3_id, { _: _scope_with_id($scope2_id) }))));
6121
6142
  return 0;
6122
6143
  } else if ((input.sessions || []).length) {
@@ -6133,40 +6154,33 @@ var diff_view_default = _template("e", (input) => {
6133
6154
  }, "id", $scope4_id, "c", $sg__input_sessions, 1, $sg__input_sessions, "</select>", 1);
6134
6155
  });
6135
6156
  _html("</span>");
6136
- _script($scope4_id, "e37");
6157
+ _script($scope4_id, "e38");
6137
6158
  _subscribe($sendTarget__closures, _subscribe($sending__closures, _subscribe($si__input_sessions && $input_sessions__closures, writeScope($scope4_id, {
6138
6159
  _: _scope_with_id($scope2_id),
6139
- Ccw: 1
6160
+ Ccy: 1
6140
6161
  }))));
6141
6162
  return 1;
6142
6163
  }
6143
6164
  }, $scope2_id, "c", $sg__input_sessions, $sg__input_sessions, $sg__input_sessions, 0, 1);
6144
- _script($scope2_id, "e38");
6165
+ _script($scope2_id, "e39");
6145
6166
  writeScope($scope2_id, {});
6146
6167
  return 0;
6147
6168
  }
6148
6169
  }, $scope0_id, "g", 1, 1, 1, "</span>");
6149
- _if(() => {
6150
- if (loading) {
6151
- const $scope37_id = _scope_id();
6152
- _html("<span class=\"refresh-chip dim\"><span class=spin></span>Refreshing…</span>");
6153
- writeScope($scope37_id, {});
6154
- return 0;
6155
- }
6156
- }, $scope0_id, "h", 1, 1, 1, 0, 1);
6157
6170
  _html(`</div><div class=diff-tools><button class=${treeOpen ? "\"icon-btn tree-toggle on\"" : "\"icon-btn tree-toggle\""} title=${treeOpen ? "\"Hide file tree\"" : "\"Show file tree\""}>`);
6158
6171
  icon_sidebar_default({ size: 14 });
6159
- _html(`</button>${_el_resume($scope0_id, "i")}<button class=${loading ? "\"icon-btn spinning\"" : "icon-btn"} title="Refresh diff"${_attr("disabled", loading)}>`);
6172
+ _html(`</button>${_el_resume($scope0_id, "h")}<button class=${loading ? "\"icon-btn spinning\"" : "icon-btn"} title="Refresh diff"${_attr("disabled", loading)}>`);
6160
6173
  icon_refresh_default({ size: 14 });
6161
- _html(`</button>${_el_resume($scope0_id, "k")}<button class="btn files-btn" title="Jump to file">Files (<!>${_escape(shownFiles.length)}${_el_resume($scope0_id, "n")})</button>${_el_resume($scope0_id, "m")}<button class=${findOpen ? "\"btn find-btn on\"" : "\"btn find-btn\""} title="Find in the review (⌘/Ctrl+F)">`);
6174
+ _html(`</button>${_el_resume($scope0_id, "j")}<button class="btn files-btn" title="Jump to file">Files (<!>${_escape(shownFiles.length)}${_el_resume($scope0_id, "m")})</button>${_el_resume($scope0_id, "l")}<button class=${findOpen ? "\"btn find-btn on\"" : "\"btn find-btn\""} title="Find in the review (⌘/Ctrl+F)">`);
6162
6175
  icon_search_default({ size: 14 });
6163
- _html(`<span class=find-label>Find</span></button>${_el_resume($scope0_id, "o")}<label class=two-dot title="Include uncommitted and untracked files in the review. Off by default — the review is commit-to-commit."><input${_attr_input_checked($scope0_id, "q", uncommitted)} type=checkbox>${_el_resume($scope0_id, "q")} include uncommitted</label>`);
6176
+ _html(`<span class=find-label>Find</span></button>${_el_resume($scope0_id, "n")}<label class=two-dot title="Include uncommitted and untracked files in the review. Off by default — the review is commit-to-commit."><input${_attr_input_checked($scope0_id, "p", uncommitted)} type=checkbox>${_el_resume($scope0_id, "p")} include uncommitted</label>`);
6177
+ _set_serialize_reason(2);
6164
6178
  const $childScope = _peek_scope_id();
6165
6179
  file_filter_default({
6166
6180
  value: fileFilter,
6167
- onChange: _resume(function(q) {
6168
- fileFilter = q;
6169
- }, "e22", $scope0_id)
6181
+ valueChange: _resume((_new_fileFilter) => {
6182
+ fileFilter = _new_fileFilter;
6183
+ }, "e23", $scope0_id)
6170
6184
  });
6171
6185
  _html("</div>");
6172
6186
  _if(() => {
@@ -6178,7 +6192,7 @@ var diff_view_default = _template("e", (input) => {
6178
6192
  tick: findTick,
6179
6193
  onState: _resume(function(s) {
6180
6194
  onFindState(s);
6181
- }, "e23", $scope28_id),
6195
+ }, "e24", $scope28_id),
6182
6196
  onClose: _resume(function() {
6183
6197
  findOpen = false;
6184
6198
  findState = {
@@ -6186,12 +6200,12 @@ var diff_view_default = _template("e", (input) => {
6186
6200
  hit: null,
6187
6201
  keys: []
6188
6202
  };
6189
- }, "e24", $scope28_id)
6203
+ }, "e25", $scope28_id)
6190
6204
  });
6191
6205
  writeScope($scope28_id, { a: _existing_scope($childScope2) });
6192
6206
  return 0;
6193
6207
  }
6194
- }, $scope0_id, "s", 1, 1, 1, 0, 1);
6208
+ }, $scope0_id, "r", 1, 1, 1, 0, 1);
6195
6209
  _html("<div class=diff-main>");
6196
6210
  _if(() => {
6197
6211
  if (error) {
@@ -6199,8 +6213,8 @@ var diff_view_default = _template("e", (input) => {
6199
6213
  toast_default({
6200
6214
  onDismiss: _resume(function() {
6201
6215
  error = null;
6202
- }, "e25", $scope17_id),
6203
- content: _content_resume("e39", () => {
6216
+ }, "e26", $scope17_id),
6217
+ content: _content_resume("e40", () => {
6204
6218
  _scope_reason();
6205
6219
  const $scope18_id = _scope_id();
6206
6220
  _html(`${_escape(error)}${_el_resume($scope18_id, "a")}`);
@@ -6211,7 +6225,7 @@ var diff_view_default = _template("e", (input) => {
6211
6225
  writeScope($scope17_id, {});
6212
6226
  return 0;
6213
6227
  }
6214
- }, $scope0_id, "u", 1, 1, 1, 0, 1);
6228
+ }, $scope0_id, "t", 1, 1, 1, 0, 1);
6215
6229
  _for_of(repoList.filter((r) => r.baseMissing), (repo) => {
6216
6230
  const $scope22_id = _scope_id();
6217
6231
  const $for_content6__repo_base__closures = /* @__PURE__ */ new Set();
@@ -6221,7 +6235,7 @@ var diff_view_default = _template("e", (input) => {
6221
6235
  kind: "warn",
6222
6236
  placement: "inline",
6223
6237
  title: `${repo.worktree}: base not found`,
6224
- content: _content_resume("e40", () => {
6238
+ content: _content_resume("e41", () => {
6225
6239
  _scope_reason();
6226
6240
  const $scope23_id = _scope_id();
6227
6241
  _html(`${_escape(repo.base)}${_el_resume($scope23_id, "a")}<!>${uncommitted ? " — showing uncommitted changes only" : ""}${_el_resume($scope23_id, "b")}.`);
@@ -6234,7 +6248,7 @@ var diff_view_default = _template("e", (input) => {
6234
6248
  f: $for_content6__repo_base__closures,
6235
6249
  a: _existing_scope($childScope3)
6236
6250
  });
6237
- }, "id", $scope0_id, "v", 1, 1, 1, 0, 1);
6251
+ }, "id", $scope0_id, "u", 1, 1, 1, 0, 1);
6238
6252
  _for_of(repoList.filter((r) => r.contained && r.files.length), (repo) => {
6239
6253
  const $scope24_id = _scope_id();
6240
6254
  const $for_content7__repo_base__closures = /* @__PURE__ */ new Set();
@@ -6244,13 +6258,13 @@ var diff_view_default = _template("e", (input) => {
6244
6258
  kind: "info",
6245
6259
  placement: "inline",
6246
6260
  title: repo.pr ? `${repo.worktree} #${repo.pr.number}` : repo.worktree,
6247
- content: _content_resume("e41", () => {
6261
+ content: _content_resume("e42", () => {
6248
6262
  _scope_reason();
6249
6263
  const $scope25_id = _scope_id();
6250
6264
  _html(`already in <!>${_escape(repo.base)}${_el_resume($scope25_id, "a")}<!>${uncommitted ? " — showing uncommitted changes only" : ""}${_el_resume($scope25_id, "b")}.`);
6251
6265
  _subscribe($for_content7__repo_base__closures, _subscribe($uncommitted__closures, writeScope($scope25_id, {
6252
6266
  _: _scope_with_id($scope24_id),
6253
- Ccz: 1
6267
+ Cd1: 1
6254
6268
  })));
6255
6269
  _resume_branch($scope25_id);
6256
6270
  }, $scope24_id)
@@ -6260,7 +6274,7 @@ var diff_view_default = _template("e", (input) => {
6260
6274
  h: $for_content7__repo_base__closures,
6261
6275
  a: _existing_scope($childScope4)
6262
6276
  });
6263
- }, "id", $scope0_id, "w", 1, 1, 1, 0, 1);
6277
+ }, "id", $scope0_id, "v", 1, 1, 1, 0, 1);
6264
6278
  _if(() => {
6265
6279
  if (driftRepos.length) {
6266
6280
  const $scope19_id = _scope_id();
@@ -6272,29 +6286,29 @@ var diff_view_default = _template("e", (input) => {
6272
6286
  title: "GitHub is behind",
6273
6287
  onDismiss: _resume(function() {
6274
6288
  dismissDrift();
6275
- }, "e26", $scope19_id),
6276
- action: attrTag({ content: _content_resume("e43", () => {
6289
+ }, "e27", $scope19_id),
6290
+ action: attrTag({ content: _content_resume("e44", () => {
6277
6291
  _scope_reason();
6278
6292
  const $scope20_id = _scope_id();
6279
6293
  _html(`<button class=btn${_attr("disabled", loading)}>${loading ? "Reloading…" : "Reload"}${_el_resume($scope20_id, "b")}</button>${_el_resume($scope20_id, "a")}`);
6280
- _script($scope20_id, "e42");
6294
+ _script($scope20_id, "e43");
6281
6295
  _subscribe($loading__closures, writeScope($scope20_id, { _: _scope_with_id($scope19_id) }));
6282
6296
  _resume_branch($scope20_id);
6283
6297
  }, $scope19_id) }),
6284
- content: _content_resume("e44", () => {
6298
+ content: _content_resume("e45", () => {
6285
6299
  _scope_reason();
6286
6300
  const $scope34_id = _scope_id();
6287
6301
  _html("<span class=dim>");
6288
6302
  _for_of(driftRepos, (repo, i) => {
6289
- const $scope38_id = _scope_id();
6290
- _html(`${i > 0 ? " · " : ""}${_el_resume($scope38_id, "a")}<!>${_escape(repo.worktree)}${_el_resume($scope38_id, "b")} #<!>${_escape(repo.pr.number)}${_el_resume($scope38_id, "c")}`);
6291
- writeScope($scope38_id, {});
6303
+ const $scope37_id = _scope_id();
6304
+ _html(`${i > 0 ? " · " : ""}${_el_resume($scope37_id, "a")}<!>${_escape(repo.worktree)}${_el_resume($scope37_id, "b")} #<!>${_escape(repo.pr.number)}${_el_resume($scope37_id, "c")}`);
6305
+ writeScope($scope37_id, {});
6292
6306
  }, "id", $scope34_id, "a");
6293
6307
  _html(" — this view has a newer tip than the PR page.</span><span class=\"mono dim toast-meta\">");
6294
6308
  _for_of(driftRepos, (repo, i) => {
6295
- const $scope39_id = _scope_id();
6296
- _html(`<span${_attr("title", `origin/${repo.pr.headRefName} ${repo.head} · GitHub ${repo.pr.headRefOid}`)}>${i > 0 ? " · " : ""}${_el_resume($scope39_id, "b")}<!>${_escape(shortSha(repo.head))}${_el_resume($scope39_id, "c")} → <!>${_escape(shortSha(repo.pr.headRefOid))}${_el_resume($scope39_id, "d")}</span>${_el_resume($scope39_id, "a")}`);
6297
- writeScope($scope39_id, {});
6309
+ const $scope38_id = _scope_id();
6310
+ _html(`<span${_attr("title", `origin/${repo.pr.headRefName} ${repo.head} · GitHub ${repo.pr.headRefOid}`)}>${i > 0 ? " · " : ""}${_el_resume($scope38_id, "b")}<!>${_escape(shortSha(repo.head))}${_el_resume($scope38_id, "c")} → <!>${_escape(shortSha(repo.pr.headRefOid))}${_el_resume($scope38_id, "d")}</span>${_el_resume($scope38_id, "a")}`);
6311
+ writeScope($scope38_id, {});
6298
6312
  }, "id", $scope34_id, "b", 1, 1, 1, "</span>", 1);
6299
6313
  _subscribe($driftRepos__closures, writeScope($scope34_id, { _: _scope_with_id($scope19_id) }));
6300
6314
  _resume_branch($scope34_id);
@@ -6303,7 +6317,7 @@ var diff_view_default = _template("e", (input) => {
6303
6317
  writeScope($scope19_id, { a: _existing_scope($childScope5) });
6304
6318
  return 0;
6305
6319
  }
6306
- }, $scope0_id, "x", 1, 1, 1, 0, 1);
6320
+ }, $scope0_id, "w", 1, 1, 1, 0, 1);
6307
6321
  _for_of(repoList.filter(localDiffers), (repo) => {
6308
6322
  const $scope26_id = _scope_id();
6309
6323
  const $for_content8__repo_head__closures = /* @__PURE__ */ new Set();
@@ -6316,13 +6330,13 @@ var diff_view_default = _template("e", (input) => {
6316
6330
  kind: "info",
6317
6331
  placement: "inline",
6318
6332
  title: `${repo.worktree} #${repo.pr.number}`,
6319
- content: _content_resume("e45", () => {
6333
+ content: _content_resume("e46", () => {
6320
6334
  _scope_reason();
6321
6335
  const $scope27_id = _scope_id();
6322
6336
  _html(`this view is <!>${_escape(shortSha(repo.head))}${_el_resume($scope27_id, "a")} (<!>${_escape(repo.pr.headRefName)}${_el_resume($scope27_id, "b")}). Local is <!>${_escape(shortSha(repo.localHead))}${_el_resume($scope27_id, "c")} (<!>${_escape(repo.branch)}${_el_resume($scope27_id, "d")}<!>${uncommitted ? ", plus uncommitted" : ""}${_el_resume($scope27_id, "e")}).`);
6323
6337
  _subscribe($for_content8__repo_branch__closures, _subscribe($for_content8__repo_localHead__closures, _subscribe($for_content8__repo_pr_headRefName__closures, _subscribe($for_content8__repo_head__closures, _subscribe($uncommitted__closures, writeScope($scope27_id, {
6324
6338
  _: _scope_with_id($scope26_id),
6325
- Ccz: 2
6339
+ Cd1: 2
6326
6340
  }))))));
6327
6341
  _resume_branch($scope27_id);
6328
6342
  }, $scope26_id)
@@ -6338,15 +6352,7 @@ var diff_view_default = _template("e", (input) => {
6338
6352
  o: $for_content8__repo_branch__closures,
6339
6353
  a: _existing_scope($childScope6)
6340
6354
  });
6341
- }, "id", $scope0_id, "y", 1, 1, 1, 0, 1);
6342
- _if(() => {
6343
- if (!repos && loading) {
6344
- const $scope40_id = _scope_id();
6345
- _html("<div class=diff-skel><p class=dim><span class=spin></span>Loading diff…</p><div class=skel-row></div><div class=skel-row></div><div class=skel-row></div></div>");
6346
- writeScope($scope40_id, {});
6347
- return 0;
6348
- }
6349
- }, $scope0_id, "z", 1, 1, 1, 0, 1);
6355
+ }, "id", $scope0_id, "x", 1, 1, 1, 0, 1);
6350
6356
  _if(() => {
6351
6357
  if (repos && !allFiles.length) {
6352
6358
  const $scope32_id = _scope_id();
@@ -6359,7 +6365,7 @@ var diff_view_default = _template("e", (input) => {
6359
6365
  writeScope($scope21_id, {});
6360
6366
  return 1;
6361
6367
  }
6362
- }, $scope0_id, "a0", 1, 1, 1, 0, 1);
6368
+ }, $scope0_id, "y", 1, 1, 1, 0, 1);
6363
6369
  _for_of(repoList, (repo) => {
6364
6370
  const $scope9_id = _scope_id();
6365
6371
  const $for_content3__repo_pr_number__closures = /* @__PURE__ */ new Set();
@@ -6389,43 +6395,43 @@ var diff_view_default = _template("e", (input) => {
6389
6395
  _html(`<button class=${collapsedRepos.has(repo.id) ? "\"repo-sep closed\"" : "repo-sep"}><span class=tree-chev>${collapsedRepos.has(repo.id) ? "▸" : "▾"}${_el_resume($scope30_id, "b")}</span><span class=mono>${_escape(repo.worktree)}${_el_resume($scope30_id, "c")}</span>`);
6390
6396
  _if(() => {
6391
6397
  if (repo.pr) {
6392
- const $scope41_id = _scope_id();
6393
- _html(`<a class="chip pr"${_attr("href", `${repo.pr.url}/files`)} target=_blank rel=noopener${_attr("title", `${repo.pr.title} — ${repo.pr.headRefName} ${repo.head} vs ${repo.base} ${repo.baseSha}`)}>#<!>${_escape(repo.pr.number)}${_el_resume($scope41_id, "b")}</a>${_el_resume($scope41_id, "a")}<span class=dim>${_escape(repo.pr.title)}${_el_resume($scope41_id, "c")}</span>`);
6394
- _script($scope41_id, "e46");
6395
- _subscribe($for_content3__repo_baseSha__closures, _subscribe($for_content3__repo_base__closures, _subscribe($for_content3__repo_head__closures, _subscribe($for_content3__repo_pr_headRefName__closures, _subscribe($for_content3__repo_pr_title__closures, _subscribe($for_content3__repo_pr_url__closures, _subscribe($for_content3__repo_pr_number__closures, writeScope($scope41_id, {
6398
+ const $scope39_id = _scope_id();
6399
+ _html(`<a class="chip pr"${_attr("href", `${repo.pr.url}/files`)} target=_blank rel=noopener${_attr("title", `${repo.pr.title} — ${repo.pr.headRefName} ${repo.head} vs ${repo.base} ${repo.baseSha}`)}>#<!>${_escape(repo.pr.number)}${_el_resume($scope39_id, "b")}</a>${_el_resume($scope39_id, "a")}<span class=dim>${_escape(repo.pr.title)}${_el_resume($scope39_id, "c")}</span>`);
6400
+ _script($scope39_id, "e47");
6401
+ _subscribe($for_content3__repo_baseSha__closures, _subscribe($for_content3__repo_base__closures, _subscribe($for_content3__repo_head__closures, _subscribe($for_content3__repo_pr_headRefName__closures, _subscribe($for_content3__repo_pr_title__closures, _subscribe($for_content3__repo_pr_url__closures, _subscribe($for_content3__repo_pr_number__closures, writeScope($scope39_id, {
6396
6402
  Ca5: 2,
6397
6403
  Ca6: 2,
6398
6404
  Ca7: 2
6399
6405
  }))))))));
6400
6406
  return 0;
6401
6407
  } else {
6402
- const $scope42_id = _scope_id();
6403
- _html(`<span class=dim>${_escape(repo.full_name)}${_el_resume($scope42_id, "a")}</span>`);
6404
- _subscribe($for_content3__repo_full_name__closures, writeScope($scope42_id, {}));
6408
+ const $scope40_id = _scope_id();
6409
+ _html(`<span class=dim>${_escape(repo.full_name)}${_el_resume($scope40_id, "a")}</span>`);
6410
+ _subscribe($for_content3__repo_full_name__closures, writeScope($scope40_id, {}));
6405
6411
  return 1;
6406
6412
  }
6407
6413
  }, $scope30_id, "d");
6408
6414
  _html(`<span class="chip lane"${_attr("title", `${repo.pr ? "PR head" : "checked out"} ${repo.pr ? repo.pr.headRefName : repo.branch} ${repo.head}`)}>on <!>${repo.pr ? _escape(repo.pr.headRefName) : _escape(repo.branch)}${_el_resume($scope30_id, "f")}</span>${_el_resume($scope30_id, "e")}<span class=chip${_attr("title", `${repo.base} ${repo.baseSha}`)}>vs <!>${_escape(repo.base)}${_el_resume($scope30_id, "h")}</span>${_el_resume($scope30_id, "g")}`);
6409
6415
  _if(() => {
6410
6416
  if (localDiffers(repo)) {
6411
- const $scope43_id = _scope_id();
6412
- _html(`<span class=chip${_attr("title", `checked out ${repo.branch} ${repo.localHead}`)}>local <!>${_escape(repo.branch)}${_el_resume($scope43_id, "b")}</span>${_el_resume($scope43_id, "a")}`);
6413
- _subscribe($for_content3__repo_localHead__closures, _subscribe($for_content3__repo_branch__closures, writeScope($scope43_id, { Ca9: 2 })));
6417
+ const $scope41_id = _scope_id();
6418
+ _html(`<span class=chip${_attr("title", `checked out ${repo.branch} ${repo.localHead}`)}>local <!>${_escape(repo.branch)}${_el_resume($scope41_id, "b")}</span>${_el_resume($scope41_id, "a")}`);
6419
+ _subscribe($for_content3__repo_localHead__closures, _subscribe($for_content3__repo_branch__closures, writeScope($scope41_id, { Ca9: 2 })));
6414
6420
  return 0;
6415
6421
  }
6416
6422
  }, $scope30_id, "i", 1, 1, 1, 0, 1);
6417
6423
  _html(`</button>${_el_resume($scope30_id, "a")}`);
6418
- _script($scope30_id, "e47");
6419
- _subscribe($for_content3__repo_branch__closures, _subscribe($for_content3__repo_baseSha__closures, _subscribe($for_content3__repo_base__closures, _subscribe($for_content3__repo_head__closures, _subscribe($for_content3__repo_worktree__closures, _subscribe($for_content3__repo_pr__closures, _subscribe($for_content3__repo_id__closures, _subscribe($for_content3__repo__closures, _subscribe($collapsedRepos__closures, writeScope($scope30_id, { Cd4: 1 }))))))))));
6424
+ _script($scope30_id, "e48");
6425
+ _subscribe($for_content3__repo_branch__closures, _subscribe($for_content3__repo_baseSha__closures, _subscribe($for_content3__repo_base__closures, _subscribe($for_content3__repo_head__closures, _subscribe($for_content3__repo_worktree__closures, _subscribe($for_content3__repo_pr__closures, _subscribe($for_content3__repo_id__closures, _subscribe($for_content3__repo__closures, _subscribe($collapsedRepos__closures, writeScope($scope30_id, { Cd6: 1 }))))))))));
6420
6426
  return 0;
6421
6427
  } else {
6422
6428
  const $scope33_id = _scope_id();
6423
6429
  _html("<p class=repo-meta>");
6424
6430
  _if(() => {
6425
6431
  if (repo.pr) {
6426
- const $scope44_id = _scope_id();
6427
- _html(`<a class="chip pr"${_attr("href", `${repo.pr.url}/files`)} target=_blank rel=noopener${_attr("title", `${repo.pr.title} — ${repo.pr.headRefName} ${repo.head} vs ${repo.base} ${repo.baseSha}`)}>#<!>${_escape(repo.pr.number)}${_el_resume($scope44_id, "b")}</a>${_el_resume($scope44_id, "a")}<span class=dim>${_escape(repo.pr.title)}${_el_resume($scope44_id, "c")}</span>`);
6428
- _subscribe($for_content3__repo_baseSha__closures, _subscribe($for_content3__repo_base__closures, _subscribe($for_content3__repo_head__closures, _subscribe($for_content3__repo_pr_headRefName__closures, _subscribe($for_content3__repo_pr_title__closures, _subscribe($for_content3__repo_pr_url__closures, _subscribe($for_content3__repo_pr_number__closures, writeScope($scope44_id, {
6432
+ const $scope42_id = _scope_id();
6433
+ _html(`<a class="chip pr"${_attr("href", `${repo.pr.url}/files`)} target=_blank rel=noopener${_attr("title", `${repo.pr.title} — ${repo.pr.headRefName} ${repo.head} vs ${repo.base} ${repo.baseSha}`)}>#<!>${_escape(repo.pr.number)}${_el_resume($scope42_id, "b")}</a>${_el_resume($scope42_id, "a")}<span class=dim>${_escape(repo.pr.title)}${_el_resume($scope42_id, "c")}</span>`);
6434
+ _subscribe($for_content3__repo_baseSha__closures, _subscribe($for_content3__repo_base__closures, _subscribe($for_content3__repo_head__closures, _subscribe($for_content3__repo_pr_headRefName__closures, _subscribe($for_content3__repo_pr_title__closures, _subscribe($for_content3__repo_pr_url__closures, _subscribe($for_content3__repo_pr_number__closures, writeScope($scope42_id, {
6429
6435
  Ca1: 1,
6430
6436
  Ca2: 1,
6431
6437
  Ca3: 1,
@@ -6440,9 +6446,9 @@ var diff_view_default = _template("e", (input) => {
6440
6446
  _html(`<span class="chip lane"${_attr("title", `${repo.pr ? "PR head" : "checked out"} ${repo.pr ? repo.pr.headRefName : repo.branch} ${repo.head}`)}>on <!>${repo.pr ? _escape(repo.pr.headRefName) : _escape(repo.branch)}${_el_resume($scope33_id, "c")}</span>${_el_resume($scope33_id, "b")}<span class=chip${_attr("title", `${repo.base} ${repo.baseSha}`)}>vs <!>${_escape(repo.base)}${_el_resume($scope33_id, "e")}</span>${_el_resume($scope33_id, "d")}`);
6441
6447
  _if(() => {
6442
6448
  if (localDiffers(repo)) {
6443
- const $scope45_id = _scope_id();
6444
- _html(`<span class=chip${_attr("title", `checked out ${repo.branch} ${repo.localHead}`)}>local <!>${_escape(repo.branch)}${_el_resume($scope45_id, "b")}</span>${_el_resume($scope45_id, "a")}`);
6445
- _subscribe($for_content3__repo_localHead__closures, _subscribe($for_content3__repo_branch__closures, writeScope($scope45_id, {
6449
+ const $scope43_id = _scope_id();
6450
+ _html(`<span class=chip${_attr("title", `checked out ${repo.branch} ${repo.localHead}`)}>local <!>${_escape(repo.branch)}${_el_resume($scope43_id, "b")}</span>${_el_resume($scope43_id, "a")}`);
6451
+ _subscribe($for_content3__repo_localHead__closures, _subscribe($for_content3__repo_branch__closures, writeScope($scope43_id, {
6446
6452
  Ca9: 3,
6447
6453
  Caa: 1
6448
6454
  })));
@@ -6475,9 +6481,9 @@ var diff_view_default = _template("e", (input) => {
6475
6481
  _html(`<details${_attr_details_or_dialog_open($scope12_id, "a", expanded)} class=file${_attr("data-key", file.key)}${_attr("hidden", !shownKeySet.has(file.key))}><summary><span${_attr_class(["status", file.status])}>${_escape(file.status)}${_el_resume($scope12_id, "c")}</span>${_el_resume($scope12_id, "b")}<span class=path${_attr("title", file.path)}><bdi>${_escape(file.path)}${_el_resume($scope12_id, "e")}</bdi></span>${_el_resume($scope12_id, "d")}`);
6476
6482
  _if(() => {
6477
6483
  if (fileComments.length) {
6478
- const $scope46_id = _scope_id();
6479
- _html(`<span class=chip>💬 <!>${_escape(fileComments.length)}${_el_resume($scope46_id, "a")}</span>`);
6480
- writeScope($scope46_id, {});
6484
+ const $scope44_id = _scope_id();
6485
+ _html(`<span class=chip>💬 <!>${_escape(fileComments.length)}${_el_resume($scope44_id, "a")}</span>`);
6486
+ writeScope($scope44_id, {});
6481
6487
  return 0;
6482
6488
  }
6483
6489
  }, $scope12_id, "f", 1, 1, 1, 0, 1);
@@ -6486,19 +6492,19 @@ var diff_view_default = _template("e", (input) => {
6486
6492
  }, "e1", $scope12_id))} type=checkbox>${_el_resume($scope12_id, "h")}<span class=dim>viewed</span></label>${_el_resume($scope12_id, "g")}</summary>`);
6487
6493
  _if(() => {
6488
6494
  if (file.binary) {
6489
- const $scope47_id = _scope_id();
6495
+ const $scope45_id = _scope_id();
6490
6496
  _html("<p class=\"dim diff-pad\">binary file</p>");
6491
- writeScope($scope47_id, {});
6497
+ writeScope($scope45_id, {});
6492
6498
  return 0;
6493
6499
  } else if (file.tooLarge) {
6494
- const $scope48_id = _scope_id();
6500
+ const $scope46_id = _scope_id();
6495
6501
  _html("<p class=\"dim diff-pad\">file too large to display</p>");
6496
- writeScope($scope48_id, {});
6502
+ writeScope($scope46_id, {});
6497
6503
  return 1;
6498
6504
  } else if (file.old == null && file.new == null) {
6499
- const $scope49_id = _scope_id();
6505
+ const $scope47_id = _scope_id();
6500
6506
  _html("<p class=\"dim diff-pad\">file could not be read</p>");
6501
- writeScope($scope49_id, {});
6507
+ writeScope($scope47_id, {});
6502
6508
  return 2;
6503
6509
  } else if (expanded) {
6504
6510
  const $scope15_id = _scope_id();
@@ -6506,7 +6512,7 @@ var diff_view_default = _template("e", (input) => {
6506
6512
  {
6507
6513
  const $scope31_id = _scope_id();
6508
6514
  _html(`<div class=diff-wait></div>${_el_resume($scope31_id, "a")}`);
6509
- _script($scope31_id, "e48");
6515
+ _script($scope31_id, "e49");
6510
6516
  writeScope($scope31_id, {});
6511
6517
  return 0;
6512
6518
  }
@@ -6516,7 +6522,7 @@ var diff_view_default = _template("e", (input) => {
6516
6522
  }
6517
6523
  }, $scope12_id, "i");
6518
6524
  _html(`</details>${_el_resume($scope12_id, "a")}`);
6519
- _script($scope12_id, "e49");
6525
+ _script($scope12_id, "e50");
6520
6526
  _subscribe($toggleViewed2__closures, _subscribe($commentsByFile__closures, _subscribe($shownKeySet__closures, _subscribe($viewed__closures, writeScope($scope12_id, {
6521
6527
  k: file,
6522
6528
  l: file?.key,
@@ -6530,8 +6536,8 @@ var diff_view_default = _template("e", (input) => {
6530
6536
  a0: $for_content4__file__closures,
6531
6537
  a1: $for_content4__file_key__closures,
6532
6538
  a2: $for_content4__fileComments__closures,
6533
- Ccq: 1,
6534
- Cde: 1
6539
+ Ccs: 1,
6540
+ Cdg: 1
6535
6541
  })))));
6536
6542
  }, "key", $scope11_id, "a", 1, 1, 1, "</div>", 1);
6537
6543
  _subscribe($for_content3__repoFiles__closures, writeScope($scope11_id, {}));
@@ -6576,98 +6582,101 @@ var diff_view_default = _template("e", (input) => {
6576
6582
  a0: $for_content3__repo_worktree__closures,
6577
6583
  ab: $for_content3__repoFiles__closures
6578
6584
  });
6579
- }, "id", $scope0_id, "a1");
6580
- _html(`</div>${_el_resume($scope0_id, "t")}</div>`);
6581
- _if(() => {}, $scope0_id, "a2");
6585
+ }, "id", $scope0_id, "z");
6586
+ _html(`</div>${_el_resume($scope0_id, "s")}</div>`);
6587
+ _if(() => {}, $scope0_id, "a0");
6582
6588
  _html("</div>");
6583
- _script($scope0_id, "e52");
6584
6589
  _script($scope0_id, "e53");
6590
+ _script($scope0_id, "e54");
6585
6591
  writeScope($scope0_id, {
6586
- a5: input.workspaceId,
6587
- a6: input.focusPr,
6588
- a7: input.active,
6589
- a8: input.focusNonce,
6590
- a9: input.sessions,
6591
- ab: input.onSent,
6592
- ac: input.onExit,
6593
- ad: input.sessions?.[0]?.title,
6594
- ae: input.sessions?.[0]?.agent,
6595
- af: repos,
6596
- ag: comments,
6597
- ai: viewed,
6598
- ak: viewed?.size,
6599
- al: draft,
6600
- an: error,
6601
- ao: loading,
6602
- aq: copied,
6603
- ar: sending,
6604
- as: sendTarget,
6605
- au: fileFilter,
6606
- av: uncommitted,
6607
- aw: treeOpen,
6608
- az: findTick,
6609
- b1: findState?.query,
6610
- b3: findState?.hit,
6611
- b4: findState?.hit?.key,
6612
- b5: findState?.hit?.repo,
6613
- b6: collapsedDirs,
6614
- b7: collapsedRepos,
6615
- b8: dismissedDrift,
6616
- b9: toggleRepo,
6617
- bb: nearBox.cbs,
6618
- bc: nearBox.io,
6619
- be: observeNear,
6620
- bf: focusPrSection,
6592
+ a3: input.workspaceId,
6593
+ a4: input.focusPr,
6594
+ a5: input.active,
6595
+ a6: input.focusNonce,
6596
+ a7: input.sessions,
6597
+ a9: input.onSent,
6598
+ aa: input.onExit,
6599
+ ab: input.sessions?.[0]?.title,
6600
+ ac: input.sessions?.[0]?.agent,
6601
+ ad: repos,
6602
+ ae: comments,
6603
+ ag: viewed,
6604
+ ai: viewed?.size,
6605
+ aj: draft,
6606
+ al: error,
6607
+ am: loading,
6608
+ an: copied,
6609
+ ao: sending,
6610
+ ap: sendTarget,
6611
+ ar: fileFilter,
6612
+ as: uncommitted,
6613
+ at: treeOpen,
6614
+ aw: findTick,
6615
+ ay: findState?.query,
6616
+ b0: findState?.hit,
6617
+ b1: findState?.hit?.key,
6618
+ b2: findState?.hit?.repo,
6619
+ b3: collapsedDirs,
6620
+ b4: collapsedRepos,
6621
+ b5: dismissedDrift,
6622
+ b6: toggleRepo,
6623
+ b8: nearBox.cbs,
6624
+ b9: nearBox.io,
6625
+ bb: observeNear,
6626
+ bc: focusPrSection,
6627
+ be: headBox.sig,
6628
+ bg: headBox.timer,
6621
6629
  bh: load,
6622
6630
  bj: loadReview,
6623
- bl: repoList,
6624
- bn: repoList.length,
6625
- bo: allFiles,
6626
- bp: allFiles?.length,
6627
- bq: fileMatch,
6628
- bs: fileFiltered,
6629
- bt: findKeys,
6630
- bv: shownFiles,
6631
- bz: shownKeySet,
6632
- c0: filesByRepo,
6633
- c1: shownByRepo,
6634
- c3: commentsByFile,
6635
- c4: sendPick,
6636
- c5: localDiffers,
6637
- c7: driftRepos,
6638
- ca: dismissDrift,
6639
- cb: reload,
6640
- cc: toggleViewed,
6641
- cd: saveComment,
6642
- ce: removeComment,
6643
- cf: clearComments,
6644
- ci: copyMarkdown,
6645
- cj: sendTo,
6646
- ck: jumpTo,
6647
- cl: openFind,
6648
- cm: onFindState,
6649
- d3: $collapsedDirs__closures,
6650
- cq: $viewed__closures,
6651
- de: $commentsByFile__closures,
6652
- dd: $shownByRepo__closures,
6653
- co: $si__input_sessions_0_title && $input_sessions_0_title__closures,
6654
- cp: $si__input_sessions_0_agent && $input_sessions_0_agent__closures,
6655
- cw: $sending__closures,
6656
- cn: $si__input_sessions && $input_sessions__closures,
6657
- cx: $sendTarget__closures,
6658
- r: _existing_scope($childScope),
6659
- ct: $error__closures,
6660
- cz: $uncommitted__closures,
6661
- cu: $loading__closures,
6662
- dg: $driftRepos__closures,
6663
- d4: $collapsedRepos__closures,
6664
- cs: $draft__closures,
6665
- dj: $saveComment2__closures,
6666
- dk: $removeComment2__closures,
6667
- db: $shownKeySet__closures,
6668
- di: $toggleViewed2__closures,
6669
- d2: $findState_hit_repo__closures,
6670
- d7: $repoList_length__closures
6631
+ bk: reload,
6632
+ bm: reloadSoon,
6633
+ bo: repoList,
6634
+ bq: repoList.length,
6635
+ br: allFiles,
6636
+ bs: allFiles?.length,
6637
+ bt: fileMatch,
6638
+ bv: fileFiltered,
6639
+ bw: findKeys,
6640
+ by: shownFiles,
6641
+ c2: shownKeySet,
6642
+ c3: filesByRepo,
6643
+ c4: shownByRepo,
6644
+ c6: commentsByFile,
6645
+ c7: sendPick,
6646
+ c8: localDiffers,
6647
+ ca: driftRepos,
6648
+ cd: dismissDrift,
6649
+ ce: toggleViewed,
6650
+ cf: saveComment,
6651
+ cg: removeComment,
6652
+ ch: clearComments,
6653
+ ck: copyMarkdown,
6654
+ cl: sendTo,
6655
+ cm: jumpTo,
6656
+ cn: openFind,
6657
+ co: onFindState,
6658
+ d5: $collapsedDirs__closures,
6659
+ cs: $viewed__closures,
6660
+ dg: $commentsByFile__closures,
6661
+ df: $shownByRepo__closures,
6662
+ cq: $si__input_sessions_0_title && $input_sessions_0_title__closures,
6663
+ cr: $si__input_sessions_0_agent && $input_sessions_0_agent__closures,
6664
+ cy: $sending__closures,
6665
+ cp: $si__input_sessions && $input_sessions__closures,
6666
+ cz: $sendTarget__closures,
6667
+ q: _existing_scope($childScope),
6668
+ cv: $error__closures,
6669
+ d1: $uncommitted__closures,
6670
+ cw: $loading__closures,
6671
+ di: $driftRepos__closures,
6672
+ d6: $collapsedRepos__closures,
6673
+ cu: $draft__closures,
6674
+ dl: $saveComment2__closures,
6675
+ dm: $removeComment2__closures,
6676
+ dd: $shownKeySet__closures,
6677
+ dk: $toggleViewed2__closures,
6678
+ d4: $findState_hit_repo__closures,
6679
+ d9: $repoList_length__closures
6671
6680
  });
6672
6681
  _resume_branch($scope0_id);
6673
6682
  });
@@ -14421,15 +14430,7 @@ async function createWorkspace(name, repos) {
14421
14430
  const bare = await ensureBare(repo.fullName);
14422
14431
  const defaultBranch = await bareDefaultBranch(bare);
14423
14432
  const base = repo.baseBranch || defaultBranch;
14424
- progress(`Adding worktree ${worktree}/ (${base})…`);
14425
- await git([
14426
- "worktree",
14427
- "add",
14428
- "-b",
14429
- branch,
14430
- path.join(dir, worktree),
14431
- `origin/${base}`
14432
- ], bare);
14433
+ await addWorkspaceWorktree(bare, path.join(dir, worktree), branch, base);
14433
14434
  return {
14434
14435
  full_name: repo.fullName,
14435
14436
  worktree,
@@ -14467,15 +14468,7 @@ async function addRepo(workspaceId, fullName, baseBranch) {
14467
14468
  const bare = await ensureBare(fullName);
14468
14469
  const defaultBranch = await bareDefaultBranch(bare);
14469
14470
  const base = baseBranch || defaultBranch;
14470
- progress(`Adding worktree ${worktree}/ (${base})…`);
14471
- await git([
14472
- "worktree",
14473
- "add",
14474
- "-b",
14475
- ws.branch,
14476
- path.join(ws.path, worktree),
14477
- `origin/${base}`
14478
- ], bare);
14471
+ await addWorkspaceWorktree(bare, path.join(ws.path, worktree), ws.branch, base);
14479
14472
  return {
14480
14473
  base,
14481
14474
  defaultBranch
@@ -14653,6 +14646,82 @@ async function ensureBare(fullName) {
14653
14646
  async function bareDefaultBranch(bare) {
14654
14647
  return (await git(["symbolic-ref", "HEAD"], bare)).replace("refs/heads/", "");
14655
14648
  }
14649
+ /** `git rev-parse --verify` → oid, or null if the ref is missing. */
14650
+ async function revParse(cwd, ref) {
14651
+ try {
14652
+ return await git([
14653
+ "rev-parse",
14654
+ "--verify",
14655
+ ref
14656
+ ], cwd);
14657
+ } catch {
14658
+ return null;
14659
+ }
14660
+ }
14661
+ /**
14662
+ * Create a worktree on the workspace branch tip that matches latest
14663
+ * `origin/<base>`.
14664
+ *
14665
+ * Fresh branch → cut from `origin/<base>` after fetch (ensureBare).
14666
+ * Existing `origin/<ws-branch>` (re-add, open PR, prior push) → restore
14667
+ * that branch then rebase onto `origin/<base>` so the checkout is not
14668
+ * stuck on an old main tip. Leftover local branches with no worktree are
14669
+ * deleted so `worktree add -b` can recreate them.
14670
+ */
14671
+ async function addWorkspaceWorktree(bare, dest, branch, base) {
14672
+ const baseRef = `origin/${base}`;
14673
+ if (!await revParse(bare, baseRef)) throw new Error(`missing ${baseRef} after fetch`);
14674
+ await git(["worktree", "prune"], bare).catch(() => {});
14675
+ if (await revParse(bare, `refs/heads/${branch}`)) {
14676
+ if ((await git([
14677
+ "worktree",
14678
+ "list",
14679
+ "--porcelain"
14680
+ ], bare)).includes(`branch refs/heads/${branch}`)) throw new Error(`${branch} is already checked out in another worktree`);
14681
+ await git([
14682
+ "branch",
14683
+ "-D",
14684
+ branch
14685
+ ], bare);
14686
+ }
14687
+ const remoteWs = await revParse(bare, `refs/remotes/origin/${branch}`);
14688
+ const label = path.basename(dest);
14689
+ if (remoteWs) {
14690
+ progress(`Restoring ${label}/ from origin/${branch}…`);
14691
+ await git([
14692
+ "worktree",
14693
+ "add",
14694
+ "-b",
14695
+ branch,
14696
+ dest,
14697
+ `origin/${branch}`
14698
+ ], bare);
14699
+ if (await git([
14700
+ "merge-base",
14701
+ branch,
14702
+ baseRef
14703
+ ], dest) !== await git(["rev-parse", baseRef], dest)) {
14704
+ progress(`Rebasing ${label}/ onto ${base}…`);
14705
+ try {
14706
+ await git(["rebase", baseRef], dest);
14707
+ } catch (err) {
14708
+ await git(["rebase", "--abort"], dest).catch(() => {});
14709
+ const why = err instanceof Error ? err.message : String(err);
14710
+ throw new Error(`Could not rebase ${branch} onto ${baseRef} for ${label}/. ${why}`);
14711
+ }
14712
+ }
14713
+ } else {
14714
+ progress(`Adding worktree ${label}/ (${base})…`);
14715
+ await git([
14716
+ "worktree",
14717
+ "add",
14718
+ "-b",
14719
+ branch,
14720
+ dest,
14721
+ baseRef
14722
+ ], bare);
14723
+ }
14724
+ }
14656
14725
  /** `ref` is this workspace branch or a `-topic` lane of it. Another
14657
14726
  * workspace's branch can extend this prefix, so callers must also
14658
14727
  * subtract `otherWorkspaceBranches`. */
@@ -21965,4 +22034,4 @@ server.listen(port, () => {
21965
22034
  //#endregion
21966
22035
  export {};
21967
22036
 
21968
- ;var __MARKO_MANIFEST__={"esfPH6H":{"block":[2,"stylesheet#/assets/index-CxxdFG3E.css",6,"<link",0," rel=\"stylesheet\" crossorigin href=\"",1,"assets/index-CxxdFG3E.css\"",">"],"defer":[2,"/assets/index-CxXU95sL.js",6,"<script",0," async type=\"module\" crossorigin src=\"",1,"assets/index-CxXU95sL.js\"","></script>"]}};
22037
+ ;var __MARKO_MANIFEST__={"esfPH6H":{"block":[2,"stylesheet#/assets/index-BxVK_c-q.css",6,"<link",0," rel=\"stylesheet\" crossorigin href=\"",1,"assets/index-BxVK_c-q.css\"",">"],"defer":[2,"/assets/index-LnMHViqj.js",6,"<script",0," async type=\"module\" crossorigin src=\"",1,"assets/index-LnMHViqj.js\"","></script>"]}};