diffing 0.11.0 → 0.13.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.
Files changed (184) hide show
  1. package/README.md +56 -801
  2. package/dist/{cli-agent-DkwGxuy2.mjs → cli-agent-Cx2k0Ki7.mjs} +236 -59
  3. package/dist/{cli-gh-D0NfKpOp.mjs → cli-gh-BQuQpV-s.mjs} +24 -14
  4. package/dist/cli.mjs +69 -26
  5. package/dist/client/assets/{angular-html-Dl53kkiy.js → angular-html-gcUdctE_.js} +1 -1
  6. package/dist/client/assets/{angular-ts-wNJFFkey.js → angular-ts-BkjLgJJH.js} +1 -1
  7. package/dist/client/assets/{apl-BxtQST-h.js → apl-BtuEza96.js} +1 -1
  8. package/dist/client/assets/{arc-CBmZuzPB.js → arc-yk_3cjs2.js} +1 -1
  9. package/dist/client/assets/{architectureDiagram-3BPJPVTR-CEci_K9f.js → architectureDiagram-3BPJPVTR-DDVXPdzY.js} +1 -1
  10. package/dist/client/assets/{astro-BpADD5rh.js → astro-DfUNgEjV.js} +1 -1
  11. package/dist/client/assets/{blade-B4I5SQmP.js → blade-uv3PNTww.js} +1 -1
  12. package/dist/client/assets/{blockDiagram-GPEHLZMM-DcKhDtnE.js → blockDiagram-GPEHLZMM-DlMLqbfD.js} +1 -1
  13. package/dist/client/assets/{c-C3VtOgg8.js → c-DcsMh0kd.js} +1 -1
  14. package/dist/client/assets/{c4Diagram-AAUBKEIU-CaHozoxF.js → c4Diagram-AAUBKEIU-C4ZZJAMJ.js} +1 -1
  15. package/dist/client/assets/channel-CPOnEOhs.js +1 -0
  16. package/dist/client/assets/{chunk-2J33WTMH-tvuzKhdK.js → chunk-2J33WTMH-CwkSvLT8.js} +1 -1
  17. package/dist/client/assets/{chunk-3OPIFGDE-D_nBoD9w.js → chunk-3OPIFGDE-s6UH12Df.js} +1 -1
  18. package/dist/client/assets/{chunk-4BX2VUAB-yHPdy1G8.js → chunk-4BX2VUAB-wGjYymx_.js} +1 -1
  19. package/dist/client/assets/{chunk-55IACEB6-yXpL8wjV.js → chunk-55IACEB6-DObbP11Q.js} +1 -1
  20. package/dist/client/assets/{chunk-5ZQYHXKU-DZ5cvCDV.js → chunk-5ZQYHXKU-DwbkzQEJ.js} +1 -1
  21. package/dist/client/assets/{chunk-727SXJPM-CJjgOWmY.js → chunk-727SXJPM-DzoJfly4.js} +1 -1
  22. package/dist/client/assets/{chunk-AQP2D5EJ-CQYQKXSE.js → chunk-AQP2D5EJ-f1kNxYS3.js} +1 -1
  23. package/dist/client/assets/{chunk-BSJP7CBP-CP_f908b.js → chunk-BSJP7CBP-CTBkVJEp.js} +1 -1
  24. package/dist/client/assets/{chunk-CSCIHK7Q-tcgA8jR0.js → chunk-CSCIHK7Q-C6dvEyPX.js} +1 -1
  25. package/dist/client/assets/{chunk-FMBD7UC4-DlpmhBYg.js → chunk-FMBD7UC4-C166WZ7L.js} +1 -1
  26. package/dist/client/assets/{chunk-KSCS5N6A-BkfieXpV.js → chunk-KSCS5N6A-CaVyQHxA.js} +1 -1
  27. package/dist/client/assets/{chunk-L5ZTLDWV-BjVXSZnt.js → chunk-L5ZTLDWV-CdW7usF5.js} +1 -1
  28. package/dist/client/assets/{chunk-LZXEDZCA-CaAWmy4Q.js → chunk-LZXEDZCA-imRCFVGq.js} +2 -2
  29. package/dist/client/assets/{chunk-ND2GUHAM-kWh41zUn.js → chunk-ND2GUHAM-BJCVPOgO.js} +1 -1
  30. package/dist/client/assets/{chunk-NZK2D7GU-CDrIi44_.js → chunk-NZK2D7GU-DodLkks9.js} +1 -1
  31. package/dist/client/assets/{chunk-O5CBEL6O-CbNGK3Te.js → chunk-O5CBEL6O-DYxYE_dt.js} +1 -1
  32. package/dist/client/assets/chunk-QZHKN3VN-7sNTyEOs.js +1 -0
  33. package/dist/client/assets/chunk-WU5MYG2G-DluN2oZF.js +1 -0
  34. package/dist/client/assets/{chunk-XPW4576I-Cca0fTtG.js → chunk-XPW4576I-DkPXlA-y.js} +1 -1
  35. package/dist/client/assets/classDiagram-4FO5ZUOK-CHofrzZI.js +1 -0
  36. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-B8fKe5FS.js +1 -0
  37. package/dist/client/assets/{cobol-j-6eG2UQ.js → cobol-B5tSUxVN.js} +1 -1
  38. package/dist/client/assets/{coffee-CZLH0dtt.js → coffee-B2Q8w4Zu.js} +1 -1
  39. package/dist/client/assets/{cose-bilkent-S5V4N54A-DlxESVex.js → cose-bilkent-S5V4N54A-Bg2tspSU.js} +1 -1
  40. package/dist/client/assets/{cpp-j6Bp24RI.js → cpp-CfzAEc1z.js} +1 -1
  41. package/dist/client/assets/{crystal-DW7wcFUs.js → crystal-BDxAjW7-.js} +1 -1
  42. package/dist/client/assets/{css-C43BDU2i.js → css-nC3_RAjk.js} +1 -1
  43. package/dist/client/assets/{dagre-BM42HDAG-BaemEJFh.js → dagre-BM42HDAG-BZiNHe27.js} +1 -1
  44. package/dist/client/assets/{diagram-2AECGRRQ-BaM-bkJ3.js → diagram-2AECGRRQ-D3Vd2itQ.js} +1 -1
  45. package/dist/client/assets/{diagram-5GNKFQAL-BOH04DJO.js → diagram-5GNKFQAL-D44Rm6ep.js} +1 -1
  46. package/dist/client/assets/{diagram-KO2AKTUF-BP5MyqDZ.js → diagram-KO2AKTUF-DwoQejb5.js} +1 -1
  47. package/dist/client/assets/{diagram-LMA3HP47-Dt4gKMYF.js → diagram-LMA3HP47-C1eaDL4X.js} +1 -1
  48. package/dist/client/assets/{diagram-OG6HWLK6-DoT1VshN.js → diagram-OG6HWLK6-BtBJHHnj.js} +1 -1
  49. package/dist/client/assets/{dist-DEAxvC4F.js → dist-DUBmiUQf.js} +1 -1
  50. package/dist/client/assets/{edge-D9ySFlnD.js → edge-WCfPDabs.js} +1 -1
  51. package/dist/client/assets/{elixir-CoJz_LQ5.js → elixir-CazmTZo9.js} +1 -1
  52. package/dist/client/assets/{elm-CvedWh_e.js → elm-CTqaOirp.js} +1 -1
  53. package/dist/client/assets/{erDiagram-TEJ5UH35-CMP78FsQ.js → erDiagram-TEJ5UH35-CqjpbNDt.js} +1 -1
  54. package/dist/client/assets/{erb-lD_yYZsm.js → erb-CK9x36t2.js} +1 -1
  55. package/dist/client/assets/{flowDiagram-I6XJVG4X-Dp0s5BFj.js → flowDiagram-I6XJVG4X-CSHJZmlA.js} +1 -1
  56. package/dist/client/assets/{ganttDiagram-6RSMTGT7-GmSG31U-.js → ganttDiagram-6RSMTGT7-D6KxkDpI.js} +1 -1
  57. package/dist/client/assets/{git-rebase-DwZABzof.js → git-rebase-Bn8xQDxV.js} +1 -1
  58. package/dist/client/assets/{gitGraphDiagram-PVQCEYII-C1SXShag.js → gitGraphDiagram-PVQCEYII-ZGSlrHF5.js} +1 -1
  59. package/dist/client/assets/{glimmer-js-CWcs3w1Z.js → glimmer-js-h7wFfOLo.js} +1 -1
  60. package/dist/client/assets/{glimmer-ts-CrzGN4lJ.js → glimmer-ts-vlZuiamP.js} +1 -1
  61. package/dist/client/assets/{glsl-DRCtwX7h.js → glsl-CNutENPV.js} +1 -1
  62. package/dist/client/assets/{graphql-rpmrismS.js → graphql-BfddKr9j.js} +1 -1
  63. package/dist/client/assets/{hack-Ba02RnuQ.js → hack-BkYH75Gx.js} +1 -1
  64. package/dist/client/assets/{haml-BHBACStm.js → haml-CM-xW5RI.js} +1 -1
  65. package/dist/client/assets/{handlebars-BtlQ1SCa.js → handlebars-CklcCbzf.js} +1 -1
  66. package/dist/client/assets/{html-BkVU3Dge.js → html-bltTcC3c.js} +1 -1
  67. package/dist/client/assets/{html-derivative-DoK92vwi.js → html-derivative-C4R1a7Nf.js} +1 -1
  68. package/dist/client/assets/{http-CJAwKSPH.js → http-B6uXoDkp.js} +1 -1
  69. package/dist/client/assets/{hurl-kaX5jwuN.js → hurl-gquKVFPU.js} +1 -1
  70. package/dist/client/assets/{index-D8hOoJCg.css → index-BsuX6HVI.css} +1 -1
  71. package/dist/client/assets/{index-BHeNiC07.js → index-yhKiqbkK.js} +154 -154
  72. package/dist/client/assets/{infoDiagram-5YYISTIA-B0i3BlNR.js → infoDiagram-5YYISTIA-DCQv5BKv.js} +1 -1
  73. package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-BN8sEei4.js → ishikawaDiagram-YF4QCWOH-BqXC35qz.js} +1 -1
  74. package/dist/client/assets/{java-BvrigIoq.js → java-DZLUJ7qo.js} +1 -1
  75. package/dist/client/assets/{javascript-DZkPTYAi.js → javascript-CayXc7uP.js} +1 -1
  76. package/dist/client/assets/{jinja-Ceg7ui1S.js → jinja-CQQUTC0y.js} +1 -1
  77. package/dist/client/assets/{jison-iE1GaOyN.js → jison-CvzuCn2x.js} +1 -1
  78. package/dist/client/assets/{journeyDiagram-JHISSGLW-CE6O3NhU.js → journeyDiagram-JHISSGLW-bRlSO5Sv.js} +1 -1
  79. package/dist/client/assets/{json-C0j8rEcg.js → json-BsMA0GaP.js} +1 -1
  80. package/dist/client/assets/{jsx-B7eXljgz.js → jsx-Dbxr4aPH.js} +1 -1
  81. package/dist/client/assets/{julia-DMDw0aMP.js → julia-CZ38GzHV.js} +1 -1
  82. package/dist/client/assets/{just-BryMKRJ_.js → just-BQwFLV1D.js} +1 -1
  83. package/dist/client/assets/{kanban-definition-UN3LZRKU-j-aU6Yzp.js → kanban-definition-UN3LZRKU-BVjoqA0y.js} +1 -1
  84. package/dist/client/assets/{latex-BNC9-sjr.js → latex-BGyrMdgQ.js} +1 -1
  85. package/dist/client/assets/{line-CyEqpEDp.js → line-DacHFvZH.js} +1 -1
  86. package/dist/client/assets/{linear-CXeaA9km.js → linear-BPGHNTSb.js} +1 -1
  87. package/dist/client/assets/{liquid-D-fQw-oJ.js → liquid-CiA2vjOH.js} +1 -1
  88. package/dist/client/assets/{lua-CD2aJ_rS.js → lua-D9k3fxwM.js} +1 -1
  89. package/dist/client/assets/{marko-BQ37hu6z.js → marko-CwBH4-2T.js} +1 -1
  90. package/dist/client/assets/{mdc-B5NUi3zZ.js → mdc-D4WuuVvw.js} +1 -1
  91. package/dist/client/assets/{mermaid-parser.core-BxHF_XbX.js → mermaid-parser.core-DuXqm2Gp.js} +1 -1
  92. package/dist/client/assets/{mermaid.core-BUtaf4P1.js → mermaid.core-DRh_KVT1.js} +3 -3
  93. package/dist/client/assets/{mindmap-definition-RKZ34NQL-D13tPu2o.js → mindmap-definition-RKZ34NQL-C5wytjbD.js} +1 -1
  94. package/dist/client/assets/{nginx-1W1E03Rg.js → nginx-DHMa03ia.js} +1 -1
  95. package/dist/client/assets/{nim-C5A88bFP.js → nim-8gK3mQXD.js} +1 -1
  96. package/dist/client/assets/{perl-BYoP0wNt.js → perl-DqXBmOB_.js} +1 -1
  97. package/dist/client/assets/{php-CFxna09e.js → php-CruAnpl2.js} +1 -1
  98. package/dist/client/assets/{pieDiagram-4H26LBE5-CHL7Ml5w.js → pieDiagram-4H26LBE5-Cv2Csp1M.js} +1 -1
  99. package/dist/client/assets/{pug-BR4JgWAk.js → pug-C7a5y4Mi.js} +1 -1
  100. package/dist/client/assets/{qml-D1U1EFEe.js → qml-mgWY__NW.js} +1 -1
  101. package/dist/client/assets/{quadrantDiagram-W4KKPZXB-BnYtv-HY.js → quadrantDiagram-W4KKPZXB-DHQIHzFU.js} +1 -1
  102. package/dist/client/assets/{r-ChE6X060.js → r-Do5QoKdS.js} +1 -1
  103. package/dist/client/assets/{razor-B5iVfQMe.js → razor-BqdDbm9d.js} +1 -1
  104. package/dist/client/assets/{regexp-Dz2drUIf.js → regexp-CNMlPqVr.js} +1 -1
  105. package/dist/client/assets/{requirementDiagram-4Y6WPE33-D8QEGLKB.js → requirementDiagram-4Y6WPE33-rUeJykKo.js} +1 -1
  106. package/dist/client/assets/{review-export-CvFFbCAB.js → review-export-BgwyN8Ky.js} +1 -1
  107. package/dist/client/assets/{rst-DZM3RGRs.js → rst-PYCtADQ2.js} +1 -1
  108. package/dist/client/assets/{ruby-DkXnm-J8.js → ruby-B8JdoeHE.js} +1 -1
  109. package/dist/client/assets/{sankeyDiagram-5OEKKPKP-wVaks6lB.js → sankeyDiagram-5OEKKPKP-Bsga6dQU.js} +1 -1
  110. package/dist/client/assets/{sas-DMbpc71c.js → sas-kIev4j3d.js} +1 -1
  111. package/dist/client/assets/{scss-IwVMMp22.js → scss-cf-rl7q3.js} +1 -1
  112. package/dist/client/assets/{sequenceDiagram-3UESZ5HK-Cg31TB-R.js → sequenceDiagram-3UESZ5HK-BVcwcOB2.js} +1 -1
  113. package/dist/client/assets/{shellscript-CIStAKx3.js → shellscript-BHMFbkaV.js} +1 -1
  114. package/dist/client/assets/{shellsession-uLtzHhlo.js → shellsession-y_3kBnoK.js} +1 -1
  115. package/dist/client/assets/{soy-BkxBYigm.js → soy-Coc7dfRW.js} +1 -1
  116. package/dist/client/assets/{sql-Ba9y9EvJ.js → sql-CsZYO19m.js} +1 -1
  117. package/dist/client/assets/{src-9MKexpFu.js → src-ujohT29p.js} +1 -1
  118. package/dist/client/assets/{stata-CrPCbiIZ.js → stata-BFa4m_Eh.js} +1 -1
  119. package/dist/client/assets/{stateDiagram-AJRCARHV-BbvNjVF6.js → stateDiagram-AJRCARHV-DBElJIPe.js} +1 -1
  120. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-BocZ498b.js +1 -0
  121. package/dist/client/assets/{surrealql-Dvip5u_o.js → surrealql-DlwfRFnC.js} +1 -1
  122. package/dist/client/assets/{svelte-xBLD60Zd.js → svelte-RrLklQOZ.js} +1 -1
  123. package/dist/client/assets/{templ-CWv68xbP.js → templ-BDbBg7z2.js} +1 -1
  124. package/dist/client/assets/{tex-CHqz-fYs.js → tex-BeAp-Hqv.js} +1 -1
  125. package/dist/client/assets/{timeline-definition-PNZ67QCA-CWKkJ3QZ.js → timeline-definition-PNZ67QCA-Det2OiYV.js} +1 -1
  126. package/dist/client/assets/{ts-tags-DS82EDuE.js → ts-tags-Dz-1CFmn.js} +1 -1
  127. package/dist/client/assets/{tsx-B2GBjp2F.js → tsx-Dfi08w8H.js} +1 -1
  128. package/dist/client/assets/{twig-CC8x9pG0.js → twig-BfzYY6Hd.js} +1 -1
  129. package/dist/client/assets/{typescript-g7i13lnC.js → typescript-6FNAPG3Z.js} +1 -1
  130. package/dist/client/assets/{vennDiagram-CIIHVFJN-OLItKWeg.js → vennDiagram-CIIHVFJN-DhH4H0vl.js} +1 -1
  131. package/dist/client/assets/{vue-rFbe7luB.js → vue-DTPedjqE.js} +1 -1
  132. package/dist/client/assets/{vue-html-D9GQtYub.js → vue-html-B4sC29Oj.js} +1 -1
  133. package/dist/client/assets/{vue-vine-mrNtQtY5.js → vue-vine-BWzpqJ4r.js} +1 -1
  134. package/dist/client/assets/{wardleyDiagram-YWT4CUSO-Dy1yfeb4.js → wardleyDiagram-YWT4CUSO-BC8K10yP.js} +1 -1
  135. package/dist/client/assets/{xml-CHfMjyAM.js → xml-BK8ACjht.js} +1 -1
  136. package/dist/client/assets/{xsl-BFkNSogJ.js → xsl-rjlrbfou.js} +1 -1
  137. package/dist/client/assets/{xychartDiagram-2RQKCTM6-DfSnfjVL.js → xychartDiagram-2RQKCTM6-DwcVZiB5.js} +1 -1
  138. package/dist/client/assets/{yaml-BfSgHc04.js → yaml-DM6lgMhS.js} +1 -1
  139. package/dist/client/index.html +2 -2
  140. package/dist/completions-5rtfoxB9.mjs +2 -0
  141. package/dist/{completions-BO2DUM-8.mjs → completions-7YSX1neu.mjs} +7 -1
  142. package/dist/{doctor-D0Y3kOY7.mjs → doctor-BMfx7_GY.mjs} +16 -14
  143. package/dist/doctor-BRr5IWHe.mjs +2 -0
  144. package/dist/{find-tui-binary-B71xiwWu.mjs → find-tui-binary-DGspwyvd.mjs} +56 -25
  145. package/dist/{git-Czo96ymM.mjs → git-BGj31GX-.mjs} +71 -7
  146. package/dist/git-CfDSkUcE.mjs +2 -0
  147. package/dist/{github-CErBub2y.mjs → github-BLrnsozP.mjs} +1 -1
  148. package/dist/{github-DBsZ0h_l.mjs → github-DbAFoB92.mjs} +3 -3
  149. package/dist/{github-attachments-plDeB0iE.mjs → github-attachments-fNCKYL-Z.mjs} +2 -2
  150. package/dist/{mcp-DtVrMR2S.mjs → mcp-Bi551clR.mjs} +33 -30
  151. package/dist/native/tui-darwin-arm64/diffing-tui +0 -0
  152. package/dist/native/tui-darwin-x64/diffing-tui +0 -0
  153. package/dist/native/tui-linux-arm64-gnu/diffing-tui +0 -0
  154. package/dist/native/tui-linux-arm64-musl/diffing-tui +0 -0
  155. package/dist/native/tui-linux-x64-gnu/diffing-tui +0 -0
  156. package/dist/native/tui-linux-x64-musl/diffing-tui +0 -0
  157. package/dist/native/tui-win32-x64-msvc/diffing-tui.exe +0 -0
  158. package/dist/{search-BMPY_ZW8.mjs → search-3R2E5xxr.mjs} +16 -1
  159. package/dist/{search-BO9Im7eu.mjs → search-CQ4nsjBX.mjs} +1 -1
  160. package/dist/{server-j0PnTVX1.mjs → server-B9NVZu7l.mjs} +174 -46
  161. package/dist/{server-lock-CY0_1mcS.mjs → server-lock-BNI8FKV1.mjs} +175 -23
  162. package/dist/{session-conflict-C6V9ZKo7.mjs → session-conflict-CB0IErdn.mjs} +8 -7
  163. package/dist/{session-manager-CYNchhVA.mjs → session-manager-656aJXFE.mjs} +2 -2
  164. package/dist/session-url-B8TrGGeE.mjs +33 -0
  165. package/dist/{settings-yK0GYpbn.mjs → settings-DkPDB_hS.mjs} +32 -4
  166. package/dist/setup-BiwX7vdd.mjs +446 -0
  167. package/dist/setup-first-run-DyT0PlOZ.mjs +2 -0
  168. package/dist/setup-first-run-i1o7DBki.mjs +74 -0
  169. package/dist/terminal-BroplOnw.mjs +116 -0
  170. package/dist/{tui-search-bridge-Bfb2ktdA.mjs → tui-search-bridge-fFKqX4Fi.mjs} +3 -3
  171. package/dist/{update-check-Copcz9eb.mjs → update-check-ISaw61qS.mjs} +16 -15
  172. package/package.json +11 -3
  173. package/scripts/postinstall.mjs +52 -0
  174. package/dist/client/assets/channel-Ct4-oSQN.js +0 -1
  175. package/dist/client/assets/chunk-QZHKN3VN-BXhKFVX7.js +0 -1
  176. package/dist/client/assets/chunk-WU5MYG2G-_EwuC51_.js +0 -1
  177. package/dist/client/assets/classDiagram-4FO5ZUOK-C8bdx9R4.js +0 -1
  178. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-B26wrQuH.js +0 -1
  179. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-B5BbZkU5.js +0 -1
  180. package/dist/git-DaP_1rVy.mjs +0 -2
  181. /package/dist/{apply-suggestion-CHYnw68I.mjs → apply-suggestion-BsR_8FXW.mjs} +0 -0
  182. /package/dist/{diff-fingerprint-BgR0tu1o.mjs → diff-fingerprint-BL5jNHnP.mjs} +0 -0
  183. /package/dist/{handoff-LAFtmnHf.mjs → handoff-DcShCxWJ.mjs} +0 -0
  184. /package/dist/{review-export-B63eRAVa.mjs → review-export-GW4KNsGN.mjs} +0 -0
@@ -1,9 +1,10 @@
1
- import { C as isSafePath, S as revertHunk, _ as getUntrackedFilePathsAsync, a as getCustomGitDiffAsync, b as listRepoFiles, c as getGitDiffAsync, d as getProjectStorageDir, f as getRepoName, g as getTabSizeForFiles, h as getShowDiff, i as getCommitSeriesSummary, l as getHunkHistory, o as getFileContent, p as getRepoRoot, r as getBranchName, u as getMergeStatus, v as gitAddFile, w as toSafeRelativePath, y as isGitRepo } from "./git-Czo96ymM.mjs";
2
- import { a as searchFiles, i as searchContent, o as searchSymbols, r as searchAll, s as trackSelection, t as getSearchStatus } from "./search-BMPY_ZW8.mjs";
3
- import { n as saveSettings, t as loadSettings } from "./settings-yK0GYpbn.mjs";
1
+ import { C as listRepoFiles, D as toSafeRelativePath, E as isSafePath, S as isGitRepo, T as revertHunk, _ as getShowDiff, a as getCommitSeriesSummary, b as getUntrackedFilePathsAsync, d as getMergeStatus, f as getProjectStorageDir, h as getRepoRoot, l as getGitDiffAsync, m as getRepoMetadataAsync, o as getCustomGitDiffAsync, s as getFileContent, u as getHunkHistory, x as gitAddFile, y as getTabSizeForFilesAsync } from "./git-BGj31GX-.mjs";
2
+ import { a as searchFiles, i as searchContent, o as searchSymbols, r as searchAll, s as trackSelection, t as getSearchStatus } from "./search-3R2E5xxr.mjs";
3
+ import { i as loadSettings, s as saveSettings } from "./settings-DkPDB_hS.mjs";
4
4
  import { t as formatComments } from "./comment-format-B85NHZnG.mjs";
5
5
  import { n as formatPlanReview, r as sectionTitleForLine, t as extractPlanLines } from "./plan-format-BwJh5JSE.mjs";
6
- import { D as updatePrReviewComment, E as submitReview, S as refreshPrSession, T as setPrReviewThreadResolved, a as detectCwdRepo, b as parsePrRef, f as fetchPrFileContentViaGh, i as deletePrReviewComment, l as fetchExistingCommentsViaGh, t as buildPrSession, u as fetchExistingReviewsViaGh, w as resolvedFromSession } from "./github-DBsZ0h_l.mjs";
6
+ import { _ as buildSessionTokenSetCookieValue, b as injectSessionTokenIntoHtml, v as createServerAuthMiddleware } from "./server-lock-BNI8FKV1.mjs";
7
+ import { D as updatePrReviewComment, E as submitReview, S as refreshPrSession, T as setPrReviewThreadResolved, a as detectCwdRepo, b as parsePrRef, f as fetchPrFileContentViaGh, i as deletePrReviewComment, l as fetchExistingCommentsViaGh, t as buildPrSession, u as fetchExistingReviewsViaGh, w as resolvedFromSession } from "./github-DbAFoB92.mjs";
7
8
  import { execFileSync } from "node:child_process";
8
9
  import { createHash } from "node:crypto";
9
10
  import { fileURLToPath } from "node:url";
@@ -53,10 +54,12 @@ const DEFAULTS = {
53
54
  outputMode: "auto",
54
55
  host: "127.0.0.1",
55
56
  noOpen: false,
57
+ insecureNoAuth: false,
56
58
  reuseSession: false,
57
59
  replaceSession: false,
58
60
  help: false,
59
61
  version: false,
62
+ skipSetup: false,
60
63
  includeUnstaged: true,
61
64
  includeUntracked: true,
62
65
  tui: false,
@@ -184,6 +187,10 @@ const DIFFING_OPTIONS = {
184
187
  type: "boolean",
185
188
  default: false
186
189
  },
190
+ "insecure-no-auth": {
191
+ type: "boolean",
192
+ default: false
193
+ },
187
194
  "reuse-session": {
188
195
  type: "boolean",
189
196
  default: false
@@ -213,6 +220,10 @@ const DIFFING_OPTIONS = {
213
220
  default: false
214
221
  },
215
222
  "gh-pr": { type: "string" },
223
+ "skip-setup": {
224
+ type: "boolean",
225
+ default: false
226
+ },
216
227
  help: {
217
228
  type: "boolean",
218
229
  short: "h"
@@ -241,11 +252,16 @@ Git Diff Options (drop-in replacement for git diff):`);
241
252
  console.log(`
242
253
  Diffing Server Options:
243
254
  --port <port> Port to run the server on (default: random available port)
244
- --host <host> Host address to bind to (default: 127.0.0.1). Pass
245
- 0.0.0.0 to expose the server to the local network.
255
+ --host <host> Host address to bind to (default: 127.0.0.1). Loopback
256
+ binds require a per-session API token. To expose the
257
+ review UI on your LAN, pass 0.0.0.0 together with
258
+ --insecure-no-auth (disables API authentication).
259
+ --insecure-no-auth Allow binding to 0.0.0.0 without API tokens (unsafe on
260
+ shared networks). Ignored on loopback binds.
246
261
  --no-open Don't open the browser automatically
247
262
  --reuse-session Open the active review instead of starting another
248
263
  --replace-session Stop the active review and start a replacement
264
+ --skip-setup Skip the first-run setup prompt (interactive TTY only)
249
265
  --gh-pr <ref> Open a GitHub PR review session (number, owner/repo#N, or URL)
250
266
  Same as: diffing "gh pr <ref>"
251
267
 
@@ -263,6 +279,7 @@ Output Modes:
263
279
  missing binary).
264
280
 
265
281
  Subcommands:
282
+ setup|init|onboard First-time setup wizard (skills, MCP, doctor)
266
283
  view [diff options] Browse diffs in the focused read-only native TUI
267
284
  show <revspec>... Drop-in for 'git show'. Renders commit metadata
268
285
  above the diff. Accepts commits, ranges, tags.
@@ -289,6 +306,7 @@ Custom ranges (e.g. main..feature) and 'gh pr' sessions also display a
289
306
 
290
307
  Examples:
291
308
  diffing Review uncommitted changes (preferred UI)
309
+ diffing setup Run the first-time setup wizard
292
310
  diffing --staged Review staged changes
293
311
  diffing HEAD~3 Review last 3 commits
294
312
  diffing main..feature Compare branches
@@ -300,7 +318,8 @@ Examples:
300
318
  diffing -U10 Diff with 10 context lines
301
319
  diffing --word-diff=color Word-level diff in color
302
320
  diffing -b -w Ignore whitespace changes
303
- diffing --host 0.0.0.0 Allow other machines on the LAN to review
321
+ diffing --host 0.0.0.0 --insecure-no-auth
322
+ Expose the review UI on the LAN without API tokens
304
323
  diffing view Browse the working-tree diff in the TUI
305
324
  diffing view --staged Browse staged changes
306
325
  diffing --view main..feature Browse a branch comparison
@@ -454,6 +473,15 @@ function preprocessOptionalValueArgs(rawArgs) {
454
473
  "find-renames",
455
474
  "break-rewrites"
456
475
  ]);
476
+ /** Git accepts values only as `--flag=value` for these; never `--flag value`. */
477
+ const ATTACHED_ONLY_LONGS = new Set([
478
+ "stat",
479
+ "dirstat",
480
+ "relative",
481
+ "word-diff",
482
+ "color-moved",
483
+ "submodule"
484
+ ]);
457
485
  const startsWithDigit = (s) => typeof s === "string" && /^[0-9]/.test(s);
458
486
  const out = [];
459
487
  for (let i = 0; i < rawArgs.length; i++) {
@@ -482,6 +510,13 @@ function preprocessOptionalValueArgs(rawArgs) {
482
510
  }
483
511
  continue;
484
512
  }
513
+ const attachedOnlyMatch = /^--(stat|dirstat|relative|word-diff|color-moved|submodule)$/.exec(arg);
514
+ if (attachedOnlyMatch) {
515
+ const name = attachedOnlyMatch[1];
516
+ if (ATTACHED_ONLY_LONGS.has(name)) out.push(`--${name}=`);
517
+ else out.push(arg);
518
+ continue;
519
+ }
485
520
  out.push(arg);
486
521
  }
487
522
  return out;
@@ -517,9 +552,11 @@ function parseDiffOptions(rawArgs, defaultInteractiveMode = "web") {
517
552
  if (values.port) opts.port = parseInt(values.port, 10);
518
553
  if (values.host) opts.host = values.host;
519
554
  if (values["no-open"]) opts.noOpen = true;
555
+ if (values["insecure-no-auth"]) opts.insecureNoAuth = true;
520
556
  if (values["reuse-session"]) opts.reuseSession = true;
521
557
  if (values["replace-session"]) opts.replaceSession = true;
522
558
  if (values["gh-pr"]) opts.ghPr = String(values["gh-pr"]);
559
+ if (values["skip-setup"]) opts.skipSetup = true;
523
560
  if (values.view) opts.viewOnly = true;
524
561
  if (values.staged || values.cached) opts.staged = true;
525
562
  if (values.merge) opts.merge = true;
@@ -594,7 +631,11 @@ function parseDiffOptions(rawArgs, defaultInteractiveMode = "web") {
594
631
  if (values.raw) opts.outputFormat = "raw";
595
632
  if (values.numstat) opts.outputFormat = "numstat";
596
633
  if (values.shortstat) opts.outputFormat = "shortstat";
597
- if (values.stat !== void 0) opts.outputFormat = "stat";
634
+ if (values.stat !== void 0) {
635
+ opts.outputFormat = "stat";
636
+ const statVal = values.stat;
637
+ if (statVal) opts.statParam = statVal;
638
+ }
598
639
  if (values.summary) opts.outputFormat = "summary";
599
640
  if (values["name-only"]) opts.outputFormat = "name-only";
600
641
  if (values["name-status"]) opts.outputFormat = "name-status";
@@ -654,11 +695,9 @@ function parseDiffOptions(rawArgs, defaultInteractiveMode = "web") {
654
695
  }
655
696
  const dashDashIdx = rawArgs.indexOf("--");
656
697
  if (dashDashIdx >= 0) {
657
- for (let i = 0; i < dashDashIdx; i++) {
658
- const arg = rawArgs[i];
659
- if (!arg.startsWith("-")) opts.revisions.push(arg);
660
- }
661
698
  for (let i = dashDashIdx + 1; i < rawArgs.length; i++) opts.pathspecs.push(rawArgs[i]);
699
+ const pathspecSet = new Set(opts.pathspecs);
700
+ for (const p of positionals) if (!pathspecSet.has(p)) opts.revisions.push(p);
662
701
  } else for (const p of positionals) opts.revisions.push(p);
663
702
  if (values.view) opts.outputMode = "tui";
664
703
  else if (values.tui) opts.outputMode = "tui";
@@ -707,7 +746,7 @@ function buildGitDiffArgs(opts) {
707
746
  if (opts.outputFormat === "raw") args.push("--raw");
708
747
  if (opts.outputFormat === "numstat") args.push("--numstat");
709
748
  if (opts.outputFormat === "shortstat") args.push("--shortstat");
710
- if (opts.outputFormat === "stat") args.push("--stat");
749
+ if (opts.outputFormat === "stat") args.push(opts.statParam ? `--stat=${opts.statParam}` : "--stat");
711
750
  if (opts.outputFormat === "summary") args.push("--summary");
712
751
  if (opts.outputFormat === "name-only") args.push("--name-only");
713
752
  if (opts.outputFormat === "name-status") args.push("--name-status");
@@ -781,6 +820,88 @@ function intoShowMode(opts) {
781
820
  return opts;
782
821
  }
783
822
  //#endregion
823
+ //#region src/lib/git-path.ts
824
+ /** Decode Git `core.quotePath` C-quoted pathnames from diff headers. */
825
+ function decodeGitPath$1(raw) {
826
+ const input = raw.trim();
827
+ if (!(input.startsWith("\"") && input.endsWith("\""))) return input;
828
+ const bytes = [];
829
+ const pushText = (value) => bytes.push(...Buffer.from(value, "utf8"));
830
+ for (let i = 1; i < input.length - 1; i++) {
831
+ if (input[i] !== "\\") {
832
+ const codePoint = input.codePointAt(i);
833
+ pushText(String.fromCodePoint(codePoint));
834
+ if (codePoint > 65535) i++;
835
+ continue;
836
+ }
837
+ const escaped = input[++i];
838
+ if (escaped == null) break;
839
+ const simple = {
840
+ a: 7,
841
+ b: 8,
842
+ t: 9,
843
+ n: 10,
844
+ v: 11,
845
+ f: 12,
846
+ r: 13,
847
+ "\"": 34,
848
+ "\\": 92
849
+ };
850
+ if (escaped in simple) {
851
+ bytes.push(simple[escaped]);
852
+ continue;
853
+ }
854
+ if (/[0-7]/.test(escaped)) {
855
+ let octal = escaped;
856
+ while (octal.length < 3 && i + 1 < input.length - 1 && /[0-7]/.test(input[i + 1])) octal += input[++i];
857
+ bytes.push(Number.parseInt(octal, 8));
858
+ continue;
859
+ }
860
+ pushText(escaped);
861
+ }
862
+ return Buffer.from(bytes).toString("utf8");
863
+ }
864
+ function stripSidePrefix$1(path, prefix) {
865
+ return path.startsWith(prefix) ? path.slice(prefix.length) : path;
866
+ }
867
+ function consumeGitToken$1(input, start) {
868
+ if (input[start] !== "\"") {
869
+ const end = input.indexOf(" ", start);
870
+ return {
871
+ token: input.slice(start, end < 0 ? input.length : end),
872
+ next: end < 0 ? input.length : end
873
+ };
874
+ }
875
+ let escaped = false;
876
+ for (let i = start + 1; i < input.length; i++) {
877
+ const char = input[i];
878
+ if (!escaped && char === "\"") return {
879
+ token: input.slice(start, i + 1),
880
+ next: i + 1
881
+ };
882
+ if (!escaped && char === "\\") escaped = true;
883
+ else escaped = false;
884
+ }
885
+ return null;
886
+ }
887
+ /** Parse `diff --git` header paths, including quoted paths and spaces in names. */
888
+ function parseGitDiffHeaderPaths(line) {
889
+ if (!line.startsWith("diff --git ")) return null;
890
+ const rest = line.slice(11);
891
+ if (rest.startsWith("\"")) {
892
+ const first = consumeGitToken$1(rest, 0);
893
+ if (!first) return null;
894
+ let cursor = first.next;
895
+ while (cursor < rest.length && /\s/.test(rest[cursor])) cursor++;
896
+ const second = consumeGitToken$1(rest, cursor);
897
+ if (!second) return null;
898
+ return [stripSidePrefix$1(decodeGitPath$1(first.token), "a/"), stripSidePrefix$1(decodeGitPath$1(second.token), "b/")];
899
+ }
900
+ const separator = rest.lastIndexOf(" b/");
901
+ if (separator < 0) return null;
902
+ return [stripSidePrefix$1(rest.slice(0, separator), "a/"), stripSidePrefix$1(rest.slice(separator + 1), "b/")];
903
+ }
904
+ //#endregion
784
905
  //#region src/lib/diff-overview.ts
785
906
  /**
786
907
  * Compose the working-tree banner. Used by the default `git diff` (unstaged +
@@ -973,7 +1094,6 @@ function summariseCommitSeries(series, rows) {
973
1094
  }
974
1095
  //#endregion
975
1096
  //#region src/lib/diff-engine.ts
976
- const MAX_BUFFER = 50 * 1024 * 1024;
977
1097
  /**
978
1098
  * Determine whether to use the "standard" web mode (unstaged+staged+untracked)
979
1099
  * or a "custom" mode (specific revisions / pathspecs).
@@ -988,8 +1108,8 @@ function isCustomMode$1(opts) {
988
1108
  function parseFilePaths(patch) {
989
1109
  const paths = /* @__PURE__ */ new Set();
990
1110
  for (const line of patch.split("\n")) {
991
- const match = line.match(/^diff --git a\/.+ b\/(.+)$/);
992
- if (match) paths.add(match[1]);
1111
+ const parsed = parseGitDiffHeaderPaths(line);
1112
+ if (parsed) paths.add(parsed[1]);
993
1113
  }
994
1114
  return [...paths];
995
1115
  }
@@ -1001,9 +1121,9 @@ function parseBinaryFiles(patch, untrackedFiles) {
1001
1121
  if (!line.startsWith("Binary files ") || !line.includes(" differ")) continue;
1002
1122
  let filePath = "";
1003
1123
  for (let j = i - 1; j >= 0; j--) {
1004
- const match = lines[j].match(/^diff --git a\/.+ b\/(.+)$/);
1005
- if (match) {
1006
- filePath = match[1];
1124
+ const parsed = parseGitDiffHeaderPaths(lines[j]);
1125
+ if (parsed) {
1126
+ filePath = parsed[1];
1007
1127
  break;
1008
1128
  }
1009
1129
  }
@@ -1068,12 +1188,10 @@ async function executeDiffAsync(opts) {
1068
1188
  */
1069
1189
  async function executeDiffWithMeta(opts) {
1070
1190
  const { patch, commits, truncated } = await executeDiffAsync(opts);
1071
- const repoName = getRepoName();
1072
- const branch = getBranchName();
1073
- const untrackedFiles = opts.includeUntracked && !opts.showMode ? await getUntrackedFilePathsAsync() : [];
1191
+ const [{ repoName, branch }, untrackedFiles] = await Promise.all([getRepoMetadataAsync(), opts.includeUntracked && !opts.showMode ? getUntrackedFilePathsAsync() : Promise.resolve([])]);
1074
1192
  const binaryFiles = parseBinaryFiles(patch, new Set(untrackedFiles));
1075
1193
  const filePaths = parseFilePaths(patch);
1076
- const tabSizeMap = getTabSizeForFiles(filePaths);
1194
+ const tabSizeMap = await getTabSizeForFilesAsync(filePaths);
1077
1195
  let overview;
1078
1196
  if (opts.showMode && commits && commits.length > 0) overview = buildCommitOverview({
1079
1197
  commits: commits.map((c) => ({
@@ -1150,11 +1268,7 @@ function runTerminalDiff(opts) {
1150
1268
  }
1151
1269
  finalArgs.push(...args);
1152
1270
  try {
1153
- execFileSync("git", ["diff", ...finalArgs], {
1154
- encoding: "utf-8",
1155
- maxBuffer: MAX_BUFFER,
1156
- stdio: "inherit"
1157
- });
1271
+ execFileSync("git", ["diff", ...finalArgs], { stdio: "inherit" });
1158
1272
  return 0;
1159
1273
  } catch (err) {
1160
1274
  if (err.status === 1 && opts.exitCode) return 1;
@@ -1175,11 +1289,7 @@ function runTerminalShow(opts) {
1175
1289
  ];
1176
1290
  if (opts.pathspecs.length > 0) args.push("--", ...opts.pathspecs);
1177
1291
  try {
1178
- execFileSync("git", args, {
1179
- encoding: "utf-8",
1180
- maxBuffer: MAX_BUFFER,
1181
- stdio: "inherit"
1182
- });
1292
+ execFileSync("git", args, { stdio: "inherit" });
1183
1293
  return 0;
1184
1294
  } catch (err) {
1185
1295
  return err.status ?? 1;
@@ -1190,7 +1300,11 @@ function runTerminalShow(opts) {
1190
1300
  * Returns an error message or null.
1191
1301
  */
1192
1302
  function validateEnvironment() {
1193
- if (!isGitRepo()) return "Error: not inside a git repository";
1303
+ if (!isGitRepo()) return [
1304
+ "Error: not inside a git repository.",
1305
+ "Run `diffing setup` for first-time configuration, or `diffing doctor` to diagnose your environment.",
1306
+ "Then `cd <your-repo> && diffing` to start a review."
1307
+ ].join("\n");
1194
1308
  return null;
1195
1309
  }
1196
1310
  //#endregion
@@ -1683,7 +1797,7 @@ function guiEditorCommand(bin, absolutePath, platform) {
1683
1797
  function terminalEditorCommand(bin, absolutePath, platform, env) {
1684
1798
  if (platform === "darwin") return {
1685
1799
  cmd: "osascript",
1686
- args: ["-e", `tell application "Terminal" to do script "${bin} \\"${absolutePath.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}\\""`]
1800
+ args: ["-e", `tell application "Terminal" to do script ("${bin} " & quoted form of "${absolutePath.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}")`]
1687
1801
  };
1688
1802
  if (platform === "win32") return {
1689
1803
  cmd: "cmd.exe",
@@ -2835,8 +2949,13 @@ function collectPrAvatarUrls(session) {
2835
2949
  function isCustomMode(opts) {
2836
2950
  return opts.revisions.length > 0 || opts.pathspecs.length > 0 || opts.showMode;
2837
2951
  }
2838
- function createApp(clientDir, diffOptsInput = DEFAULTS, commentStore, planStore, prSessionStore, prMode = false) {
2952
+ function createApp(clientDir, diffOptsInput = DEFAULTS, commentStore, planStore, prSessionStore, prMode = false, security = {
2953
+ bindHost: "127.0.0.1",
2954
+ authToken: null,
2955
+ insecureNoAuth: true
2956
+ }) {
2839
2957
  const app = new Hono();
2958
+ app.use("*", createServerAuthMiddleware(security));
2840
2959
  let diffOpts = { ...diffOptsInput };
2841
2960
  const customMode = isCustomMode(diffOpts);
2842
2961
  const store = commentStore ?? new FileCommentStore();
@@ -3486,7 +3605,7 @@ function createApp(clientDir, diffOptsInput = DEFAULTS, commentStore, planStore,
3486
3605
  if (!relPath) return c.json({ error: "Forbidden file path" }, 403);
3487
3606
  const absolutePath = resolve(root, relPath);
3488
3607
  const content = await readFile(absolutePath, "utf-8");
3489
- const { applySuggestionToContent } = await import("./apply-suggestion-CHYnw68I.mjs");
3608
+ const { applySuggestionToContent } = await import("./apply-suggestion-BsR_8FXW.mjs");
3490
3609
  const result = applySuggestionToContent({
3491
3610
  content,
3492
3611
  lineNumber: comment.lineNumber,
@@ -3733,7 +3852,7 @@ function createApp(clientDir, diffOptsInput = DEFAULTS, commentStore, planStore,
3733
3852
  const session = await prStore.get();
3734
3853
  if (!session) return notInPrMode(c);
3735
3854
  try {
3736
- const { fetchPrChecks } = await import("./github-CErBub2y.mjs");
3855
+ const { fetchPrChecks } = await import("./github-BLrnsozP.mjs");
3737
3856
  const checks = await fetchPrChecks(resolvedFromSession(session), session.headSha);
3738
3857
  const summary = {
3739
3858
  total: checks.length,
@@ -3765,7 +3884,7 @@ function createApp(clientDir, diffOptsInput = DEFAULTS, commentStore, planStore,
3765
3884
  const text = typeof body.body === "string" ? body.body.trim() : "";
3766
3885
  if (!text) return c.json({ error: "body is required" }, 400);
3767
3886
  try {
3768
- const { replyToPrComment } = await import("./github-CErBub2y.mjs");
3887
+ const { replyToPrComment } = await import("./github-BLrnsozP.mjs");
3769
3888
  const result = await replyToPrComment({
3770
3889
  resolved: resolvedFromSession(session),
3771
3890
  inReplyTo: id,
@@ -3979,8 +4098,8 @@ function createApp(clientDir, diffOptsInput = DEFAULTS, commentStore, planStore,
3979
4098
  if (decision !== "approve" && decision !== "comment" && decision !== "request-changes" && decision !== "draft") return c.json({ error: "decision must be one of: approve, comment, request-changes, draft" }, 400);
3980
4099
  const generalBody = typeof body.body === "string" ? body.body : "";
3981
4100
  if (body.dryRun === true) {
3982
- const { buildReviewPayload, resolvedFromSession } = await import("./github-CErBub2y.mjs");
3983
- const { rewriteLocalAttachmentsInBodies } = await import("./github-attachments-plDeB0iE.mjs");
4101
+ const { buildReviewPayload, resolvedFromSession } = await import("./github-BLrnsozP.mjs");
4102
+ const { rewriteLocalAttachmentsInBodies } = await import("./github-attachments-fNCKYL-Z.mjs");
3984
4103
  const resolved = resolvedFromSession(session);
3985
4104
  const comments = session.comments ?? [];
3986
4105
  const rewritten = await rewriteLocalAttachmentsInBodies(resolved, [generalBody, ...comments.map((c) => c.body ?? "")], { dryRun: true });
@@ -4077,7 +4196,7 @@ function createApp(clientDir, diffOptsInput = DEFAULTS, commentStore, planStore,
4077
4196
  const openCount = all.filter((x) => x.status === "open").length;
4078
4197
  let diffFingerprints;
4079
4198
  try {
4080
- const { fingerprintDiffFiles } = await import("./diff-fingerprint-BgR0tu1o.mjs");
4199
+ const { fingerprintDiffFiles } = await import("./diff-fingerprint-BL5jNHnP.mjs");
4081
4200
  if (prMode) {
4082
4201
  const prSession = await prStore.get();
4083
4202
  if (prSession?.diff) diffFingerprints = fingerprintDiffFiles(prSession.diff);
@@ -4145,7 +4264,7 @@ function createApp(clientDir, diffOptsInput = DEFAULTS, commentStore, planStore,
4145
4264
  } catch (err) {
4146
4265
  return c.json({ error: err?.message ?? "Failed to compute current diff" }, 500);
4147
4266
  }
4148
- const { fingerprintDiffFiles, diffSinceLast, filesToReviewSinceLast } = await import("./diff-fingerprint-BgR0tu1o.mjs");
4267
+ const { fingerprintDiffFiles, diffSinceLast, filesToReviewSinceLast } = await import("./diff-fingerprint-BL5jNHnP.mjs");
4149
4268
  const delta = diffSinceLast(previous, fingerprintDiffFiles(currentPatch));
4150
4269
  return c.json({
4151
4270
  hasBaseline: true,
@@ -4370,10 +4489,19 @@ function createApp(clientDir, diffOptsInput = DEFAULTS, commentStore, planStore,
4370
4489
  try {
4371
4490
  const content = await readFile(fullPath);
4372
4491
  const contentType = MIME_TYPES[extname(fullPath)] || "application/octet-stream";
4492
+ if (contentType === "text/html" && security.authToken) {
4493
+ const html = injectSessionTokenIntoHtml(content.toString("utf-8"), security.authToken);
4494
+ return new Response(html, { headers: {
4495
+ "Content-Type": contentType,
4496
+ "Set-Cookie": buildSessionTokenSetCookieValue(security.authToken)
4497
+ } });
4498
+ }
4373
4499
  return new Response(content, { headers: { "Content-Type": contentType } });
4374
4500
  } catch {
4375
- const indexContent = await readFile(join(clientDir, "index.html"));
4376
- return new Response(indexContent, { headers: { "Content-Type": "text/html" } });
4501
+ const html = injectSessionTokenIntoHtml((await readFile(join(clientDir, "index.html"))).toString("utf-8"), security.authToken);
4502
+ const spaHeaders = { "Content-Type": "text/html" };
4503
+ if (security.authToken) spaHeaders["Set-Cookie"] = buildSessionTokenSetCookieValue(security.authToken);
4504
+ return new Response(html, { headers: spaHeaders });
4377
4505
  }
4378
4506
  });
4379
4507
  return app;
@@ -4464,7 +4592,7 @@ async function startServer(options) {
4464
4592
  throw new Error(`Failed to build PR session for ${options.prRef}: ${detail}`);
4465
4593
  }
4466
4594
  }
4467
- const app = createApp(options.clientDir, options.diffOpts, void 0, void 0, void 0, prMode);
4595
+ const app = createApp(options.clientDir, options.diffOpts, void 0, void 0, void 0, prMode, options.security);
4468
4596
  return new Promise((resolve) => {
4469
4597
  serve({
4470
4598
  fetch: app.fetch,