diffing 0.7.0 → 0.9.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 (241) hide show
  1. package/README.md +52 -18
  2. package/dist/{cli-agent-D71pq2ep.mjs → cli-agent-CLrK54k2.mjs} +2 -2
  3. package/dist/{cli-gh-D5OCnjNe.mjs → cli-gh-8YC1NzyM.mjs} +6 -1
  4. package/dist/cli.mjs +3 -3
  5. package/dist/client/assets/{angular-html-Dh86jUvr.js → angular-html-DdAR2u-k.js} +1 -1
  6. package/dist/client/assets/{angular-ts-Bh4wRJtT.js → angular-ts-Dz_vWKSu.js} +1 -1
  7. package/dist/client/assets/{apl-BSXBHduT.js → apl-BJ5QXrIk.js} +1 -1
  8. package/dist/client/assets/{arc-CRQlhBrV.js → arc-D9erSW6x.js} +1 -1
  9. package/dist/client/assets/{architectureDiagram-3BPJPVTR-BXq3UvEv.js → architectureDiagram-3BPJPVTR-CCQWZLXR.js} +1 -1
  10. package/dist/client/assets/{astro-Bh00klUw.js → astro-BQAej5a5.js} +1 -1
  11. package/dist/client/assets/{blade-CisA3zhm.js → blade-DkAmuwDx.js} +1 -1
  12. package/dist/client/assets/{blockDiagram-GPEHLZMM-Bw-PTAJr.js → blockDiagram-GPEHLZMM-vwjxNybI.js} +1 -1
  13. package/dist/client/assets/{c-D-pHVWrf.js → c-DG5p-ChJ.js} +1 -1
  14. package/dist/client/assets/{c4Diagram-AAUBKEIU-C0XyiqC_.js → c4Diagram-AAUBKEIU-DJ_hVlh4.js} +1 -1
  15. package/dist/client/assets/channel-DmZgR6r0.js +1 -0
  16. package/dist/client/assets/{chunk-2J33WTMH-DekjZXNj.js → chunk-2J33WTMH-CiLowxCo.js} +1 -1
  17. package/dist/client/assets/{chunk-3OPIFGDE-BtROpcL8.js → chunk-3OPIFGDE-H3jjMR5Y.js} +1 -1
  18. package/dist/client/assets/{chunk-4BX2VUAB-C92XLTlx.js → chunk-4BX2VUAB-Dk0dk4n5.js} +1 -1
  19. package/dist/client/assets/{chunk-55IACEB6-CceUgh8N.js → chunk-55IACEB6-nbLiUMJS.js} +1 -1
  20. package/dist/client/assets/{chunk-5ZQYHXKU-DSbYPAe7.js → chunk-5ZQYHXKU-DZ8RgHg8.js} +1 -1
  21. package/dist/client/assets/{chunk-727SXJPM-DVzUJa-9.js → chunk-727SXJPM-DDe5dqJV.js} +1 -1
  22. package/dist/client/assets/{chunk-AQP2D5EJ-6n3Z_IFa.js → chunk-AQP2D5EJ-DmpNclOr.js} +1 -1
  23. package/dist/client/assets/{chunk-BSJP7CBP-BgVLnkxr.js → chunk-BSJP7CBP-BKQKvtIj.js} +1 -1
  24. package/dist/client/assets/{chunk-CSCIHK7Q-CkGMXntp.js → chunk-CSCIHK7Q-D27t4cyv.js} +1 -1
  25. package/dist/client/assets/{chunk-FMBD7UC4-BM8lrLBo.js → chunk-FMBD7UC4-Bu3LA663.js} +1 -1
  26. package/dist/client/assets/{chunk-KSCS5N6A-Bm2pjMQg.js → chunk-KSCS5N6A-Ed5HNXRW.js} +1 -1
  27. package/dist/client/assets/{chunk-L5ZTLDWV-VL17ikXM.js → chunk-L5ZTLDWV-DLjJZgf8.js} +1 -1
  28. package/dist/client/assets/{chunk-LZXEDZCA-B629g67M.js → chunk-LZXEDZCA-B-cs89SM.js} +2 -2
  29. package/dist/client/assets/{chunk-ND2GUHAM-CjZGwhKA.js → chunk-ND2GUHAM-D_kPSuUA.js} +1 -1
  30. package/dist/client/assets/{chunk-NZK2D7GU-DGsLjESY.js → chunk-NZK2D7GU-D1u3pjq-.js} +1 -1
  31. package/dist/client/assets/{chunk-O5CBEL6O-EyUrGY3l.js → chunk-O5CBEL6O-Mt0cnPSf.js} +1 -1
  32. package/dist/client/assets/chunk-QZHKN3VN-BrYnBs7h.js +1 -0
  33. package/dist/client/assets/chunk-WU5MYG2G-CdBcsQs_.js +1 -0
  34. package/dist/client/assets/{chunk-XPW4576I-C2TeAQmQ.js → chunk-XPW4576I-Bt8a8x28.js} +1 -1
  35. package/dist/client/assets/classDiagram-4FO5ZUOK-CCpp3t5M.js +1 -0
  36. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-B1aV1sYb.js +1 -0
  37. package/dist/client/assets/{cobol-DsRZMP16.js → cobol-Daidj_5Y.js} +1 -1
  38. package/dist/client/assets/{coffee-DP0-MMsE.js → coffee-DUMdB2Cr.js} +1 -1
  39. package/dist/client/assets/{cose-bilkent-S5V4N54A-DMmK0b0W.js → cose-bilkent-S5V4N54A-DVUDLXie.js} +1 -1
  40. package/dist/client/assets/{cpp-B6XYbbze.js → cpp-C2FeX1Mc.js} +1 -1
  41. package/dist/client/assets/{crystal-dBLPFLMp.js → crystal-D4yb9blJ.js} +1 -1
  42. package/dist/client/assets/{css-tgwuSZL0.js → css-B5cr0U9F.js} +1 -1
  43. package/dist/client/assets/{dagre-BM42HDAG-CgNkf0TR.js → dagre-BM42HDAG-DdZWb-Ee.js} +1 -1
  44. package/dist/client/assets/{diagram-2AECGRRQ-ocAqn0LV.js → diagram-2AECGRRQ-C9DOZt92.js} +1 -1
  45. package/dist/client/assets/{diagram-5GNKFQAL-CB1Yo4Gc.js → diagram-5GNKFQAL-Bbc07UKr.js} +1 -1
  46. package/dist/client/assets/{diagram-KO2AKTUF-B2vpMBRT.js → diagram-KO2AKTUF-C-lUzY3m.js} +1 -1
  47. package/dist/client/assets/{diagram-LMA3HP47-DuxZOaQS.js → diagram-LMA3HP47-D-OjEFhp.js} +1 -1
  48. package/dist/client/assets/{diagram-OG6HWLK6-CkShDmcv.js → diagram-OG6HWLK6-BjtWGvrf.js} +1 -1
  49. package/dist/client/assets/{dist-BgZIvk5w.js → dist-BXZygPdX.js} +1 -1
  50. package/dist/client/assets/{edge-Bokubn8E.js → edge-RCQWcWNp.js} +1 -1
  51. package/dist/client/assets/{elixir-BEzcf3Xg.js → elixir-DwKyVg2X.js} +1 -1
  52. package/dist/client/assets/{elm-vJyLTAER.js → elm-DjR33IVs.js} +1 -1
  53. package/dist/client/assets/{erDiagram-TEJ5UH35-BFV1NQAH.js → erDiagram-TEJ5UH35-C5T4ywLG.js} +1 -1
  54. package/dist/client/assets/{erb-DDkAmjBS.js → erb-BnhUH1Hk.js} +1 -1
  55. package/dist/client/assets/{flowDiagram-I6XJVG4X-DU8xbFdO.js → flowDiagram-I6XJVG4X-BJmjm7Kx.js} +1 -1
  56. package/dist/client/assets/{ganttDiagram-6RSMTGT7-DCb7Qh0c.js → ganttDiagram-6RSMTGT7-DREPnzu5.js} +1 -1
  57. package/dist/client/assets/{git-rebase-DWcifAdK.js → git-rebase-DzXoSDXA.js} +1 -1
  58. package/dist/client/assets/{gitGraphDiagram-PVQCEYII-C_Tw-piE.js → gitGraphDiagram-PVQCEYII-DIR4G_-_.js} +1 -1
  59. package/dist/client/assets/{glimmer-js--HDru5ys.js → glimmer-js-HKnZpCn_.js} +1 -1
  60. package/dist/client/assets/{glimmer-ts-DAdXisHh.js → glimmer-ts-DedV7rWs.js} +1 -1
  61. package/dist/client/assets/{glsl-CmIRlJht.js → glsl-Bz-0Alp2.js} +1 -1
  62. package/dist/client/assets/{graphql-tx4-7I3U.js → graphql-DSKkDYCD.js} +1 -1
  63. package/dist/client/assets/{hack-yA0XjhF7.js → hack-CnaHZm8k.js} +1 -1
  64. package/dist/client/assets/{haml-BR5MUE1b.js → haml-huGFYKlj.js} +1 -1
  65. package/dist/client/assets/{handlebars-BPOF7iOf.js → handlebars-CKmgzfWY.js} +1 -1
  66. package/dist/client/assets/{html-BbteRk96.js → html-B9Ih_dUU.js} +1 -1
  67. package/dist/client/assets/{html-derivative-59NNrcMm.js → html-derivative-YabD-M5d.js} +1 -1
  68. package/dist/client/assets/{http-D3odGQI4.js → http-Bdu12JYX.js} +1 -1
  69. package/dist/client/assets/{hurl-BLTj8fPj.js → hurl-twZzDTNs.js} +1 -1
  70. package/dist/client/assets/{index-DHXpO7eS.js → index-BktdZRWB.js} +122 -118
  71. package/dist/client/assets/{index-BZcKS8Sb.css → index-YlwaPTSG.css} +1 -1
  72. package/dist/client/assets/{infoDiagram-5YYISTIA-CI6hJyRl.js → infoDiagram-5YYISTIA-D2ty2R-i.js} +1 -1
  73. package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-gMS1P1LQ.js → ishikawaDiagram-YF4QCWOH-Ccnc9xlE.js} +1 -1
  74. package/dist/client/assets/{java-CsViuzs_.js → java-_5trO-p9.js} +1 -1
  75. package/dist/client/assets/{javascript-DQgsl2Dh.js → javascript-BOQn0ikE.js} +1 -1
  76. package/dist/client/assets/{jinja-DQNp2NUA.js → jinja-BgY-0IBz.js} +1 -1
  77. package/dist/client/assets/{jison-CDDOZQdc.js → jison-BLNTmT1_.js} +1 -1
  78. package/dist/client/assets/{journeyDiagram-JHISSGLW-BTQ_Ws_h.js → journeyDiagram-JHISSGLW-W7eWXlw0.js} +1 -1
  79. package/dist/client/assets/{json-DP4TqCuE.js → json-BLbH8rZf.js} +1 -1
  80. package/dist/client/assets/{jsx-Df5hn0Tf.js → jsx-CxteptsJ.js} +1 -1
  81. package/dist/client/assets/{julia--u33yGLi.js → julia-B__Ncp_z.js} +1 -1
  82. package/dist/client/assets/{just-BCpMmSOD.js → just-DBsHUGW1.js} +1 -1
  83. package/dist/client/assets/{kanban-definition-UN3LZRKU-CvqGbLR_.js → kanban-definition-UN3LZRKU-Z_AFL-rd.js} +1 -1
  84. package/dist/client/assets/{latex-D8D4jZGw.js → latex-DFF_0wxo.js} +1 -1
  85. package/dist/client/assets/{line-DBgaS_RW.js → line-aAv8TyOs.js} +1 -1
  86. package/dist/client/assets/{linear-RQVzKNVU.js → linear-BOvEZKH8.js} +1 -1
  87. package/dist/client/assets/{liquid-CkH85f12.js → liquid-kDWCO6d7.js} +1 -1
  88. package/dist/client/assets/{lua-iKoV7WE3.js → lua-CYTFayq-.js} +1 -1
  89. package/dist/client/assets/{marko-N8ScQSqT.js → marko-Dpmz3Pdx.js} +1 -1
  90. package/dist/client/assets/{mdc-BvHTOxsp.js → mdc-BsxHyM1i.js} +1 -1
  91. package/dist/client/assets/{mermaid-parser.core-CwDRwMR7.js → mermaid-parser.core-D8z_CWL1.js} +1 -1
  92. package/dist/client/assets/{mermaid.core-D2LDJgXO.js → mermaid.core-DNKchnly.js} +3 -3
  93. package/dist/client/assets/{mindmap-definition-RKZ34NQL-FRnPh642.js → mindmap-definition-RKZ34NQL-xQKMV4Kw.js} +1 -1
  94. package/dist/client/assets/{nginx-DGgvASuI.js → nginx-CcdTDme-.js} +1 -1
  95. package/dist/client/assets/{nim-D-v9hzvR.js → nim-B5wWDskL.js} +1 -1
  96. package/dist/client/assets/{perl-CG8leJ8K.js → perl-Ce2_iKLz.js} +1 -1
  97. package/dist/client/assets/{php-DvkeSP10.js → php-DuLCFERd.js} +1 -1
  98. package/dist/client/assets/{pieDiagram-4H26LBE5-CepOg38Y.js → pieDiagram-4H26LBE5-CBSCJnUr.js} +1 -1
  99. package/dist/client/assets/{pug-B4T7-xaL.js → pug-BfQJoQj1.js} +1 -1
  100. package/dist/client/assets/{qml-BE6D5Bxn.js → qml-DYeovlVl.js} +1 -1
  101. package/dist/client/assets/{quadrantDiagram-W4KKPZXB-DOFAsP60.js → quadrantDiagram-W4KKPZXB-uEcgb0Rm.js} +1 -1
  102. package/dist/client/assets/{r-BKZg9Mcq.js → r-DgHSP56L.js} +1 -1
  103. package/dist/client/assets/{razor-D-02oaxL.js → razor-B00x7W-i.js} +1 -1
  104. package/dist/client/assets/{regexp-BDFvAR1k.js → regexp-CmWVupmd.js} +1 -1
  105. package/dist/client/assets/{requirementDiagram-4Y6WPE33-BBVNH-2W.js → requirementDiagram-4Y6WPE33-Q4yY_ALe.js} +1 -1
  106. package/dist/client/assets/{review-export-D5iIl46_.js → review-export-pcqDKNqx.js} +1 -1
  107. package/dist/client/assets/{rst-BcT26OSj.js → rst-B3VARbTX.js} +1 -1
  108. package/dist/client/assets/{ruby-Cq_YQvFT.js → ruby-CaxKSSbT.js} +1 -1
  109. package/dist/client/assets/{sankeyDiagram-5OEKKPKP-BQfCTbBX.js → sankeyDiagram-5OEKKPKP-B-GLzFGa.js} +1 -1
  110. package/dist/client/assets/{sas-DN9oTxKY.js → sas-Ue0rHUIk.js} +1 -1
  111. package/dist/client/assets/{scss-BK_sp3z2.js → scss-BJJ7_L6c.js} +1 -1
  112. package/dist/client/assets/{sequenceDiagram-3UESZ5HK-CKAW2eyx.js → sequenceDiagram-3UESZ5HK-DW0em0D_.js} +1 -1
  113. package/dist/client/assets/{shellscript-CvNpOu0J.js → shellscript-C6LkZs1u.js} +1 -1
  114. package/dist/client/assets/{shellsession-8-yj2cJj.js → shellsession-CkZu1e84.js} +1 -1
  115. package/dist/client/assets/{soy-C6Q9atPF.js → soy-CDaZV57J.js} +1 -1
  116. package/dist/client/assets/{sql-CBL3BuHb.js → sql-CLfMGH4x.js} +1 -1
  117. package/dist/client/assets/{src-D-VUWIK5.js → src-C27zxuNO.js} +1 -1
  118. package/dist/client/assets/{stata-B2Q7Vqzu.js → stata-B0kNMHc9.js} +1 -1
  119. package/dist/client/assets/{stateDiagram-AJRCARHV-BGJiv0qO.js → stateDiagram-AJRCARHV-CrO_D3m4.js} +1 -1
  120. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-C9KDGD7R.js +1 -0
  121. package/dist/client/assets/{surrealql-C-A2N8vk.js → surrealql-D9os_yZO.js} +1 -1
  122. package/dist/client/assets/{svelte-VAut_-uy.js → svelte-2SxVToeO.js} +1 -1
  123. package/dist/client/assets/{templ-mUetM--K.js → templ-DzmZB67T.js} +1 -1
  124. package/dist/client/assets/{tex-BT53mWGp.js → tex-BMPk3nHk.js} +1 -1
  125. package/dist/client/assets/{timeline-definition-PNZ67QCA-lVwMt1rk.js → timeline-definition-PNZ67QCA-C9FBevHv.js} +1 -1
  126. package/dist/client/assets/{ts-tags-VkIOkgLN.js → ts-tags-CG14Bplc.js} +1 -1
  127. package/dist/client/assets/{tsx-D_aaGHTf.js → tsx-D6NK461A.js} +1 -1
  128. package/dist/client/assets/{twig-CufwqKkk.js → twig-Agh0j5sD.js} +1 -1
  129. package/dist/client/assets/{typescript-osFD2CEV.js → typescript-_AkeziZ2.js} +1 -1
  130. package/dist/client/assets/{vennDiagram-CIIHVFJN-_K9NtpA5.js → vennDiagram-CIIHVFJN-2H9HfhhR.js} +1 -1
  131. package/dist/client/assets/{vue-Bub1rXmL.js → vue-C1z3QGG9.js} +1 -1
  132. package/dist/client/assets/{vue-html-CN3x2pYg.js → vue-html-C1RMzLZk.js} +1 -1
  133. package/dist/client/assets/{vue-vine-C0csYkGm.js → vue-vine-oOixA6ge.js} +1 -1
  134. package/dist/client/assets/{wardleyDiagram-YWT4CUSO-B2jTMfra.js → wardleyDiagram-YWT4CUSO-BJxrQhTf.js} +1 -1
  135. package/dist/client/assets/{xml-my6OjeGb.js → xml-okuDZ7vq.js} +1 -1
  136. package/dist/client/assets/{xsl-Bx0YVn26.js → xsl-S_n3XrKb.js} +1 -1
  137. package/dist/client/assets/{xychartDiagram-2RQKCTM6-DfZ4YYXU.js → xychartDiagram-2RQKCTM6-BGdee7KG.js} +1 -1
  138. package/dist/client/assets/{yaml-DanwOypk.js → yaml-BoX-kqX1.js} +1 -1
  139. package/dist/client/index.html +2 -2
  140. package/dist/{doctor-q6oA64hm.mjs → doctor-CmP0u7-d.mjs} +1 -1
  141. package/dist/github-BjZZcSKV.mjs +2 -0
  142. package/dist/{github-HfIlIS-J.mjs → github-oCZx5aim.mjs} +270 -29
  143. package/dist/{mcp-eor39qmD.mjs → mcp-CqxXILYL.mjs} +1 -1
  144. package/dist/{server-C105rwQw.mjs → server-CczuXSWo.mjs} +164 -11
  145. package/package.json +3 -3
  146. package/dist/cli-agent-B4hU6Xay.mjs +0 -499
  147. package/dist/cli-agent-B_PHd635.mjs +0 -499
  148. package/dist/cli-agent-BatQgghr.mjs +0 -499
  149. package/dist/cli-agent-BkkRbKqq.mjs +0 -513
  150. package/dist/cli-agent-BlMtx1Tx.mjs +0 -736
  151. package/dist/cli-agent-BwZE05CQ.mjs +0 -499
  152. package/dist/cli-agent-C4Fb90GL.mjs +0 -728
  153. package/dist/cli-agent-CKE1Cvor.mjs +0 -513
  154. package/dist/cli-agent-CLvCYpmH.mjs +0 -499
  155. package/dist/cli-agent-CX8Fa1Ph.mjs +0 -499
  156. package/dist/cli-agent-ChALuNbw.mjs +0 -841
  157. package/dist/cli-agent-KxNAFIPf.mjs +0 -450
  158. package/dist/cli-agent-SILzesQP.mjs +0 -513
  159. package/dist/cli-agent-USzLoAit.mjs +0 -499
  160. package/dist/cli-agent-qBT8clNM.mjs +0 -841
  161. package/dist/cli-gh-6qiblgj7.mjs +0 -150
  162. package/dist/cli-gh-BV5az425.mjs +0 -147
  163. package/dist/cli-gh-Bo6fOHQR.mjs +0 -147
  164. package/dist/cli-gh-CDGSpndZ.mjs +0 -147
  165. package/dist/cli-gh-D1LoWJl-.mjs +0 -147
  166. package/dist/cli-gh-D1sIZ-jX.mjs +0 -147
  167. package/dist/cli-gh-DROAJlHi.mjs +0 -147
  168. package/dist/cli-gh-DgqscIkg.mjs +0 -147
  169. package/dist/cli-gh-DiT8BWwu.mjs +0 -147
  170. package/dist/cli-gh-KjPnyST6.mjs +0 -150
  171. package/dist/cli-gh-abs-IJrz.mjs +0 -147
  172. package/dist/client/assets/channel-CDxgOu-3.js +0 -1
  173. package/dist/client/assets/chunk-QZHKN3VN-DJCeMpP8.js +0 -1
  174. package/dist/client/assets/chunk-WU5MYG2G-BbuOkMaH.js +0 -1
  175. package/dist/client/assets/classDiagram-4FO5ZUOK-D5oJbiED.js +0 -1
  176. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-5MJt5ZxQ.js +0 -1
  177. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-CdUgMghp.js +0 -1
  178. package/dist/comment-format-CKTt0fzi.mjs +0 -113
  179. package/dist/comment-format-DG_PAehC.mjs +0 -117
  180. package/dist/github-C9GLNak7.mjs +0 -2
  181. package/dist/mcp-7eXATtez.mjs +0 -1334
  182. package/dist/mcp-B6mCC7D3.mjs +0 -1047
  183. package/dist/mcp-BBk8AIO4.mjs +0 -1334
  184. package/dist/mcp-BJxrW9dS.mjs +0 -1334
  185. package/dist/mcp-BMTZLQuB.mjs +0 -758
  186. package/dist/mcp-BUF2nEL7.mjs +0 -1036
  187. package/dist/mcp-BWeWR4yd.mjs +0 -255
  188. package/dist/mcp-BgZO-iXI.mjs +0 -1047
  189. package/dist/mcp-BhT5GgYF.mjs +0 -1334
  190. package/dist/mcp-Bpx76OGU.mjs +0 -945
  191. package/dist/mcp-BsGdNA88.mjs +0 -1334
  192. package/dist/mcp-BxBm3d5l.mjs +0 -1047
  193. package/dist/mcp-C1T7LI0H.mjs +0 -1036
  194. package/dist/mcp-C4Bjmf9m.mjs +0 -1047
  195. package/dist/mcp-CFxcdEcJ.mjs +0 -733
  196. package/dist/mcp-Ca9QAlJ0.mjs +0 -1334
  197. package/dist/mcp-CphIUJUg.mjs +0 -1047
  198. package/dist/mcp-CtKRXQRC.mjs +0 -1047
  199. package/dist/mcp-CwjThGi2.mjs +0 -913
  200. package/dist/mcp-D4OsB9lt.mjs +0 -1047
  201. package/dist/mcp-DJ2batvt.mjs +0 -913
  202. package/dist/mcp-DNZQvKKF.mjs +0 -298
  203. package/dist/mcp-DO4zfNZX.mjs +0 -298
  204. package/dist/mcp-D_LGvBTw.mjs +0 -1047
  205. package/dist/mcp-Ds_lPX_o.mjs +0 -913
  206. package/dist/plan-format-B6nbAw_c.mjs +0 -132
  207. package/dist/plan-format-Bi46QS0m.mjs +0 -132
  208. package/dist/plan-format-DVnF8xrq.mjs +0 -126
  209. package/dist/plan-format-f62JWFI-.mjs +0 -117
  210. package/dist/plan-format-mSDtsPcC.mjs +0 -132
  211. package/dist/review-export-BoV0884M.mjs +0 -66
  212. package/dist/review-export-CKTI5Od_.mjs +0 -66
  213. package/dist/server-95UE5bgh.mjs +0 -3367
  214. package/dist/server-AisDKkpW.mjs +0 -3227
  215. package/dist/server-B0cS95Lf.mjs +0 -3488
  216. package/dist/server-BUsRhL1B.mjs +0 -3283
  217. package/dist/server-BZBFquG8.mjs +0 -3875
  218. package/dist/server-Bc2m9R5-.mjs +0 -3263
  219. package/dist/server-Bj-6KlK5.mjs +0 -3367
  220. package/dist/server-Bmt57wV5.mjs +0 -3875
  221. package/dist/server-Bpf84Il0.mjs +0 -3367
  222. package/dist/server-C15WRRnS.mjs +0 -3740
  223. package/dist/server-CYSpLbdA.mjs +0 -3360
  224. package/dist/server-ChT2DCaR.mjs +0 -3701
  225. package/dist/server-D0Ni8PKP.mjs +0 -3252
  226. package/dist/server-D2xEbakj.mjs +0 -3874
  227. package/dist/server-DJxysGxV.mjs +0 -3701
  228. package/dist/server-Dov7jbV3.mjs +0 -3367
  229. package/dist/server-TOElOuNP.mjs +0 -3258
  230. package/dist/server-eQ2E4Axo.mjs +0 -3367
  231. package/dist/server-lock-C_wPtEsH.mjs +0 -909
  232. package/dist/server-lock-Cbu3qHdu.mjs +0 -924
  233. package/dist/server-lock-D32inEn9.mjs +0 -924
  234. package/dist/server-lock-D73NKKbn.mjs +0 -842
  235. package/dist/server-lock-DaSx7DjW.mjs +0 -1049
  236. package/dist/server-lock-Ddcat0HF.mjs +0 -851
  237. package/dist/server-lock-Dj9fG9md.mjs +0 -838
  238. package/dist/server-lock-Dq_1CJaF.mjs +0 -1047
  239. package/dist/server-lock-Ujbcgq28.mjs +0 -954
  240. package/dist/update-check-CXeSZANo.mjs +0 -129
  241. package/dist/update-check-DAPFCqpF.mjs +0 -129
@@ -1,838 +0,0 @@
1
- import { execFile, execFileSync } from "node:child_process";
2
- import { basename, join, relative, resolve, sep } from "node:path";
3
- import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
4
- import { promisify } from "node:util";
5
- import { readFile } from "node:fs/promises";
6
- import { homedir } from "node:os";
7
- import { createHash } from "node:crypto";
8
- import { parseSync } from "editorconfig";
9
- //#region src/lib/path.ts
10
- function decodeAndNormalize(p) {
11
- let decoded = p;
12
- try {
13
- decoded = decodeURIComponent(p);
14
- } catch {}
15
- return decoded.replace(/\\/g, "/");
16
- }
17
- function toSafeRelativePath(filePath, baseDir) {
18
- const normalized = decodeAndNormalize(filePath);
19
- if (normalized.includes("..") || normalized.includes("\0")) return null;
20
- const resolved = resolve(baseDir, normalized);
21
- const resolvedBase = resolve(baseDir);
22
- if (!(resolved === resolvedBase || resolved.startsWith(resolvedBase + sep))) return null;
23
- return relative(resolvedBase, resolved);
24
- }
25
- function isSafePath(relativePath, baseDir) {
26
- return toSafeRelativePath(relativePath, baseDir) !== null;
27
- }
28
- //#endregion
29
- //#region src/lib/git.ts
30
- const execFileAsync = promisify(execFile);
31
- function splitLines(content) {
32
- return content.split(/\r\n|\n|\r/);
33
- }
34
- function isBinaryFile(absolutePath) {
35
- try {
36
- const buffer = readFileSync(absolutePath);
37
- const bytesToCheck = Math.min(buffer.length, 8192);
38
- for (let i = 0; i < bytesToCheck; i++) if (buffer[i] === 0) return true;
39
- return false;
40
- } catch {
41
- return true;
42
- }
43
- }
44
- function getFileContent(filePath, version) {
45
- const root = getRepoRoot();
46
- const relPath = toSafeRelativePath(filePath, root);
47
- if (!relPath) return null;
48
- const resolved = resolve(root, relPath);
49
- if (version === "new") try {
50
- return readFileSync(resolved);
51
- } catch {
52
- return null;
53
- }
54
- try {
55
- return execFileSync("git", ["show", `HEAD:${relPath}`], {
56
- stdio: "pipe",
57
- maxBuffer: 50 * 1024 * 1024
58
- });
59
- } catch {
60
- return null;
61
- }
62
- }
63
- let cachedRepoRoot = null;
64
- const editorConfigCache = /* @__PURE__ */ new Map();
65
- function isGitRepo() {
66
- try {
67
- execFileSync("git", ["rev-parse", "--is-inside-work-tree"], { stdio: "pipe" });
68
- return true;
69
- } catch {
70
- return false;
71
- }
72
- }
73
- function getRepoRoot() {
74
- if (cachedRepoRoot !== null) return cachedRepoRoot;
75
- cachedRepoRoot = execFileSync("git", ["rev-parse", "--show-toplevel"], { encoding: "utf-8" }).trim();
76
- return cachedRepoRoot;
77
- }
78
- function getRepoName() {
79
- return basename(getRepoRoot());
80
- }
81
- function getBranchName() {
82
- try {
83
- return execFileSync("git", [
84
- "rev-parse",
85
- "--abbrev-ref",
86
- "HEAD"
87
- ], {
88
- stdio: "pipe",
89
- encoding: "utf-8"
90
- }).trim();
91
- } catch {
92
- return "";
93
- }
94
- }
95
- const DIFF_FLAGS = ["--no-ext-diff", "--no-color"];
96
- function getTabSizeForFiles(filePaths) {
97
- const root = getRepoRoot();
98
- const result = {};
99
- for (const filePath of filePaths) try {
100
- const config = parseSync(join(root, filePath), { cache: editorConfigCache });
101
- const size = config.tab_width ?? (config.indent_size === "tab" ? void 0 : config.indent_size);
102
- if (typeof size === "number") result[filePath] = size;
103
- } catch {}
104
- return result;
105
- }
106
- async function getRepoRootAsync() {
107
- if (cachedRepoRoot !== null) return cachedRepoRoot;
108
- try {
109
- const { stdout } = await execFileAsync("git", ["rev-parse", "--show-toplevel"], { encoding: "utf-8" });
110
- cachedRepoRoot = stdout.trim();
111
- return cachedRepoRoot;
112
- } catch {
113
- return "";
114
- }
115
- }
116
- async function getUntrackedFilePathsAsync() {
117
- try {
118
- const { stdout } = await execFileAsync("git", [
119
- "ls-files",
120
- "--others",
121
- "--exclude-standard"
122
- ], {
123
- encoding: "utf-8",
124
- maxBuffer: 50 * 1024 * 1024
125
- });
126
- const trimmed = stdout.trim();
127
- return trimmed ? trimmed.split("\n") : [];
128
- } catch {
129
- return [];
130
- }
131
- }
132
- async function getUntrackedFilesDiffAsync() {
133
- const root = await getRepoRootAsync();
134
- const filePaths = await getUntrackedFilePathsAsync();
135
- if (filePaths.length === 0) return "";
136
- const patches = [];
137
- const fileDiffPromises = filePaths.map(async (file) => {
138
- const absolutePath = join(root, file);
139
- if (isBinaryFile(absolutePath)) return [
140
- `diff --git a/${file} b/${file}`,
141
- "new file mode 100644",
142
- "index 0000000..0000001",
143
- `Binary files /dev/null and b/${file} differ`
144
- ].join("\n");
145
- else try {
146
- const lines = splitLines(await readFile(absolutePath, "utf-8"));
147
- const diffLines = lines.map((l) => `+${l}`);
148
- return [
149
- `diff --git a/${file} b/${file}`,
150
- "new file mode 100644",
151
- "index 0000000..0000001",
152
- "--- /dev/null",
153
- `+++ b/${file}`,
154
- `@@ -0,0 +1,${lines.length} @@`,
155
- ...diffLines
156
- ].join("\n");
157
- } catch {
158
- return "";
159
- }
160
- });
161
- const results = await Promise.all(fileDiffPromises);
162
- for (const r of results) if (r) patches.push(r);
163
- return patches.length > 0 ? "\n" + patches.join("\n") : "";
164
- }
165
- async function getCustomGitDiffAsync(args) {
166
- try {
167
- const { stdout } = await execFileAsync("git", [
168
- "diff",
169
- ...DIFF_FLAGS,
170
- ...args
171
- ], {
172
- encoding: "utf-8",
173
- maxBuffer: 50 * 1024 * 1024
174
- });
175
- return stdout;
176
- } catch {
177
- return "";
178
- }
179
- }
180
- async function getGitDiffAsync(options = {}) {
181
- const unstagedPromise = execFileAsync("git", ["diff", ...DIFF_FLAGS], {
182
- encoding: "utf-8",
183
- maxBuffer: 50 * 1024 * 1024
184
- }).then(({ stdout }) => stdout).catch(() => "");
185
- const stagedPromise = options.staged ? execFileAsync("git", [
186
- "diff",
187
- ...DIFF_FLAGS,
188
- "--staged"
189
- ], {
190
- encoding: "utf-8",
191
- maxBuffer: 50 * 1024 * 1024
192
- }).then(({ stdout }) => stdout).catch(() => "") : Promise.resolve("");
193
- const untrackedPromise = options.untracked ? getUntrackedFilesDiffAsync() : Promise.resolve("");
194
- const [unstaged, staged, untrackedPatch] = await Promise.all([
195
- unstagedPromise,
196
- stagedPromise,
197
- untrackedPromise
198
- ]);
199
- const parts = [];
200
- if (unstaged) parts.push(unstaged);
201
- if (staged) parts.push(staged);
202
- if (untrackedPatch) parts.push(untrackedPatch);
203
- return parts.join("\n");
204
- }
205
- /**
206
- * Lists every file the working tree knows about (tracked + untracked,
207
- * excluding standard-ignored paths). Used by the Phase D file viewer to
208
- * power a path picker.
209
- */
210
- function listRepoFiles() {
211
- try {
212
- const tracked = execFileSync("git", ["ls-files"], {
213
- encoding: "utf-8",
214
- maxBuffer: 100 * 1024 * 1024
215
- }).trim();
216
- const untracked = execFileSync("git", [
217
- "ls-files",
218
- "--others",
219
- "--exclude-standard"
220
- ], {
221
- encoding: "utf-8",
222
- maxBuffer: 100 * 1024 * 1024
223
- }).trim();
224
- const set = /* @__PURE__ */ new Set();
225
- for (const list of [tracked, untracked]) {
226
- if (!list) continue;
227
- for (const line of list.split("\n")) if (line) set.add(line);
228
- }
229
- return [...set].sort();
230
- } catch {
231
- return [];
232
- }
233
- }
234
- /**
235
- * Reports whether the repo is currently in the middle of a merge and which
236
- * files have unresolved conflicts. Used by the Phase C merge-conflict UI to
237
- * decide when to render the @pierre/diffs UnresolvedFile component.
238
- */
239
- function getMergeStatus() {
240
- let root;
241
- try {
242
- root = getRepoRoot();
243
- } catch {
244
- return {
245
- inMerge: false,
246
- conflicts: []
247
- };
248
- }
249
- const mergeHead = join(root, ".git", "MERGE_HEAD");
250
- let inMerge = false;
251
- try {
252
- readFileSync(mergeHead);
253
- inMerge = true;
254
- } catch {
255
- inMerge = false;
256
- }
257
- let conflicts = [];
258
- try {
259
- const out = execFileSync("git", [
260
- "diff",
261
- "--name-only",
262
- "--diff-filter=U"
263
- ], {
264
- encoding: "utf-8",
265
- maxBuffer: 50 * 1024 * 1024
266
- }).trim();
267
- conflicts = out ? out.split("\n") : [];
268
- } catch {
269
- conflicts = [];
270
- }
271
- return {
272
- inMerge: inMerge || conflicts.length > 0,
273
- conflicts
274
- };
275
- }
276
- function gitAddFile(filePath) {
277
- execFileSync("git", [
278
- "add",
279
- "--",
280
- filePath
281
- ], { stdio: "pipe" });
282
- }
283
- /**
284
- * Returns a unified diff for a single working-tree file (covers unstaged
285
- * and untracked changes). Used by the Phase E hunk-revert flow to derive
286
- * the exact patch text we need to `git apply --reverse`.
287
- */
288
- function getFilePatch(filePath) {
289
- try {
290
- const unstaged = execFileSync("git", [
291
- "diff",
292
- ...DIFF_FLAGS,
293
- "--",
294
- filePath
295
- ], {
296
- encoding: "utf-8",
297
- maxBuffer: 50 * 1024 * 1024
298
- });
299
- if (unstaged) return unstaged;
300
- } catch {}
301
- try {
302
- const absolutePath = join(getRepoRoot(), filePath);
303
- if (isBinaryFile(absolutePath)) return "";
304
- const lines = splitLines(readFileSync(absolutePath, "utf-8"));
305
- return [
306
- `diff --git a/${filePath} b/${filePath}`,
307
- "new file mode 100644",
308
- "index 0000000..0000001",
309
- "--- /dev/null",
310
- `+++ b/${filePath}`,
311
- `@@ -0,0 +1,${lines.length} @@`,
312
- ...lines.map((l) => `+${l}`)
313
- ].join("\n");
314
- } catch {
315
- return "";
316
- }
317
- }
318
- /**
319
- * Extracts the Nth hunk text from a single-file patch. Returns the lines
320
- * from `@@ ... @@` through the line before the next `@@` (or EOF).
321
- */
322
- function extractHunk(patch, hunkIndex) {
323
- const lines = patch.split("\n");
324
- const hunkStarts = [];
325
- for (let i = 0; i < lines.length; i++) if (lines[i].startsWith("@@ ")) hunkStarts.push(i);
326
- if (hunkIndex < 0 || hunkIndex >= hunkStarts.length) return null;
327
- const start = hunkStarts[hunkIndex];
328
- const end = hunkIndex + 1 < hunkStarts.length ? hunkStarts[hunkIndex + 1] : lines.length;
329
- return lines.slice(start, end).join("\n");
330
- }
331
- /** Header lines that the per-file patch needs in order for `git apply` to
332
- * recognize the target. Stops just before the first `@@` hunk header. */
333
- function extractPatchHeader(patch) {
334
- const lines = patch.split("\n");
335
- const out = [];
336
- for (const line of lines) {
337
- if (line.startsWith("@@ ")) break;
338
- out.push(line);
339
- }
340
- return out.join("\n");
341
- }
342
- /**
343
- * Reverts a single hunk from the working tree by piping a minimal patch to
344
- * `git apply --reverse`. Throws if git rejects the apply (typically because
345
- * the file has shifted since the diff was rendered).
346
- */
347
- function revertHunk(filePath, hunkIndex) {
348
- const patch = getFilePatch(filePath);
349
- if (!patch) throw new Error("No diff available for this file");
350
- const header = extractPatchHeader(patch);
351
- const hunk = extractHunk(patch, hunkIndex);
352
- if (!hunk) throw new Error(`Hunk ${hunkIndex} not found`);
353
- execFileSync("git", [
354
- "apply",
355
- "--reverse",
356
- "-"
357
- ], {
358
- input: `${header}\n${hunk}\n`,
359
- stdio: [
360
- "pipe",
361
- "pipe",
362
- "pipe"
363
- ]
364
- });
365
- }
366
- function getProjectStorageDir(customRepoRoot) {
367
- const root = customRepoRoot || getRepoRoot();
368
- const hash = createHash("sha256").update(root).digest("hex").slice(0, 8);
369
- const repoName = basename(root);
370
- return join(homedir(), ".diffing", `${repoName}-${hash}`);
371
- }
372
- /**
373
- * Retrieves git blame for deleted lines and recent log history for the file,
374
- * providing context on what commit introduced the deleted code.
375
- */
376
- function getHunkHistory(filePath, deletionStart, deletionCount, revision = "HEAD") {
377
- if (!isSafePath(filePath, getRepoRoot())) throw new Error("Forbidden file path");
378
- const blame = [];
379
- if (deletionCount > 0) try {
380
- const lines = execFileSync("git", [
381
- "blame",
382
- "--date=format:%Y-%m-%d",
383
- "-L",
384
- `${deletionStart},+${deletionCount}`,
385
- revision,
386
- "--",
387
- filePath
388
- ], {
389
- encoding: "utf-8",
390
- maxBuffer: 10 * 1024 * 1024
391
- }).split("\n");
392
- const commitHashes = /* @__PURE__ */ new Set();
393
- for (const line of lines) {
394
- if (!line.trim()) continue;
395
- const match = line.match(/^(\^?[0-9a-fA-F]+) \((.*?) (\d{4}-\d{2}-\d{2}) (\d+)\)(?: (.*))?$/);
396
- if (match) {
397
- const [_, commit, author, date, lineNum, content] = match;
398
- const cleanCommit = commit.startsWith("^") ? commit.slice(1) : commit;
399
- blame.push({
400
- commit: cleanCommit,
401
- author: author.trim(),
402
- date,
403
- line: parseInt(lineNum, 10),
404
- content: content || "",
405
- summary: ""
406
- });
407
- commitHashes.add(cleanCommit);
408
- }
409
- }
410
- const commitSummaries = {};
411
- for (const hash of commitHashes) try {
412
- commitSummaries[hash] = execFileSync("git", [
413
- "show",
414
- "-s",
415
- "--format=%s",
416
- hash
417
- ], { encoding: "utf-8" }).trim();
418
- } catch {
419
- commitSummaries[hash] = "Unknown commit";
420
- }
421
- for (const entry of blame) entry.summary = commitSummaries[entry.commit] || "Unknown commit";
422
- } catch (err) {
423
- console.warn("Failed to get git blame for hunk history:", err.message);
424
- }
425
- const recentCommits = [];
426
- try {
427
- const logOut = execFileSync("git", [
428
- "log",
429
- "-n",
430
- "5",
431
- "--date=format:%Y-%m-%d",
432
- "--format=%h|%an|%ad|%s",
433
- "--",
434
- filePath
435
- ], { encoding: "utf-8" });
436
- for (const line of logOut.split("\n")) {
437
- if (!line.trim()) continue;
438
- const [hash, author, date, summary] = line.split("|");
439
- if (hash && author && date && summary) recentCommits.push({
440
- hash,
441
- author: author.trim(),
442
- date,
443
- summary: summary.trim()
444
- });
445
- }
446
- } catch (err) {
447
- console.warn("Failed to get git log for hunk history:", err.message);
448
- }
449
- return {
450
- blame,
451
- recentCommits
452
- };
453
- }
454
- /**
455
- * Parse the output of `git log --pretty=raw -p` into `CommitInfo[]`.
456
- *
457
- * The `raw` format emits one record per commit:
458
- *
459
- * commit <sha>
460
- * tree <sha>
461
- * parent <sha> (zero or more; merges have ≥ 2)
462
- * author <name> <email> <unix-time> <tz>
463
- * committer <name> <email> <unix-time> <tz>
464
- * gpgsig -----BEGIN ... (optional; continuation lines start with a single space)
465
- * <indented body>
466
- *
467
- * <indented commit message — 4 spaces of indent>
468
- *
469
- * diff --git a/... b/... (the per-commit patch; may be empty)
470
- * ...
471
- *
472
- * Records are separated by blank lines but the unambiguous boundary is the
473
- * next line beginning with `commit <40-hex>` at column 0.
474
- */
475
- function parseGitShowRaw(raw) {
476
- if (!raw) return [];
477
- const out = [];
478
- const lines = raw.split("\n");
479
- const starts = [];
480
- for (let i = 0; i < lines.length; i++) if (/^commit [0-9a-f]{40}\b/.test(lines[i])) starts.push(i);
481
- if (starts.length === 0) return [];
482
- for (let s = 0; s < starts.length; s++) {
483
- const begin = starts[s];
484
- const end = s + 1 < starts.length ? starts[s + 1] : lines.length;
485
- const info = parseSingleCommitRaw(lines.slice(begin, end));
486
- if (info) out.push(info);
487
- }
488
- return out;
489
- }
490
- function parseSingleCommitRaw(lines) {
491
- const shaMatch = (lines[0] ?? "").match(/^commit ([0-9a-f]{40})/);
492
- if (!shaMatch) return null;
493
- const sha = shaMatch[1];
494
- let i = 1;
495
- const parents = [];
496
- let authorName = "";
497
- let authorEmail = "";
498
- let authorDate = "";
499
- let committerName = "";
500
- let committerEmail = "";
501
- let committerDate = "";
502
- while (i < lines.length) {
503
- const line = lines[i];
504
- if (line === "") break;
505
- if (line.startsWith(" ")) {
506
- i++;
507
- continue;
508
- }
509
- const idx = line.indexOf(" ");
510
- const key = idx === -1 ? line : line.slice(0, idx);
511
- const value = idx === -1 ? "" : line.slice(idx + 1);
512
- switch (key) {
513
- case "tree": break;
514
- case "parent":
515
- if (value) parents.push(value);
516
- break;
517
- case "author": {
518
- const ident = parseIdent(value);
519
- authorName = ident.name;
520
- authorEmail = ident.email;
521
- authorDate = ident.date;
522
- break;
523
- }
524
- case "committer": {
525
- const ident = parseIdent(value);
526
- committerName = ident.name;
527
- committerEmail = ident.email;
528
- committerDate = ident.date;
529
- break;
530
- }
531
- default: break;
532
- }
533
- i++;
534
- }
535
- if (i < lines.length && lines[i] === "") i++;
536
- const msgLines = [];
537
- while (i < lines.length) {
538
- const line = lines[i];
539
- if (line.startsWith(" ")) {
540
- msgLines.push(line.slice(4));
541
- i++;
542
- continue;
543
- }
544
- if (line === "") {
545
- msgLines.push("");
546
- i++;
547
- continue;
548
- }
549
- break;
550
- }
551
- const { subject, body } = splitMessage(msgLines);
552
- let patchStart = -1;
553
- for (let j = i; j < lines.length; j++) {
554
- const line = lines[j];
555
- if (line.startsWith("diff --git ") || line.startsWith("Binary files ")) {
556
- patchStart = j;
557
- break;
558
- }
559
- if (line === "") continue;
560
- break;
561
- }
562
- const patch = patchStart === -1 ? "" : lines.slice(patchStart).join("\n").replace(/\n+$/, "\n");
563
- return {
564
- sha,
565
- shortSha: sha.slice(0, 7),
566
- parents,
567
- subject,
568
- body,
569
- authorName,
570
- authorEmail,
571
- authorDate,
572
- committerName,
573
- committerEmail,
574
- committerDate,
575
- patch
576
- };
577
- }
578
- /**
579
- * Parse a `Name <email> <unix-seconds> <±HHMM>` ident line into structured
580
- * fields. The email is bracketed; the timestamp is split out and converted to
581
- * ISO 8601 for consumers.
582
- */
583
- function parseIdent(value) {
584
- const match = value.match(/^(.*?)\s+<([^>]*)>\s+(\d+)\s+([+-]\d{4})$/);
585
- if (!match) return {
586
- name: value,
587
- email: "",
588
- date: ""
589
- };
590
- const [, name, email, secs, tz] = match;
591
- return {
592
- name,
593
- email,
594
- date: unixToIso(Number(secs), tz)
595
- };
596
- }
597
- function unixToIso(secs, tz) {
598
- if (!Number.isFinite(secs)) return "";
599
- const sign = tz.startsWith("-") ? -1 : 1;
600
- const tzHours = Number(tz.slice(1, 3));
601
- const tzMins = Number(tz.slice(3, 5));
602
- const offsetMs = sign * (tzHours * 60 + tzMins) * 6e4;
603
- const d = new Date(secs * 1e3 + offsetMs);
604
- const pad = (n, w = 2) => String(n).padStart(w, "0");
605
- return `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())}T${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}:${pad(d.getUTCSeconds())}${tz.slice(0, 3)}:${tz.slice(3)}`;
606
- }
607
- function splitMessage(msgLines) {
608
- if (msgLines.length === 0) return {
609
- subject: "",
610
- body: ""
611
- };
612
- let start = 0;
613
- while (start < msgLines.length && msgLines[start] === "") start++;
614
- let stop = msgLines.length;
615
- while (stop > start && msgLines[stop - 1] === "") stop--;
616
- if (start >= stop) return {
617
- subject: "",
618
- body: ""
619
- };
620
- const subject = msgLines[start];
621
- let bodyStart = start + 1;
622
- if (bodyStart < stop && msgLines[bodyStart] === "") bodyStart++;
623
- return {
624
- subject,
625
- body: msgLines.slice(bodyStart, stop).join("\n")
626
- };
627
- }
628
- async function getShowDiff(revspecs, pathspecs = []) {
629
- if (revspecs.length === 0) return {
630
- commits: [],
631
- patch: "",
632
- truncated: 0
633
- };
634
- let shaList;
635
- try {
636
- const { stdout } = await execFileAsync("git", [
637
- "rev-list",
638
- "--no-walk",
639
- "--reverse",
640
- ...revspecs,
641
- ...pathspecs.length ? ["--", ...pathspecs] : []
642
- ], {
643
- encoding: "utf-8",
644
- maxBuffer: 50 * 1024 * 1024
645
- });
646
- shaList = stdout.split("\n").filter(Boolean);
647
- } catch {
648
- return {
649
- commits: [],
650
- patch: "",
651
- truncated: 0
652
- };
653
- }
654
- if (shaList.length === 0) return {
655
- commits: [],
656
- patch: "",
657
- truncated: 0
658
- };
659
- const truncated = Math.max(0, shaList.length - 100);
660
- const trimmed = truncated === 0 ? shaList : shaList.slice(0, 100);
661
- let raw;
662
- try {
663
- const { stdout } = await execFileAsync("git", [
664
- "log",
665
- "--no-walk",
666
- "--reverse",
667
- "-p",
668
- "--pretty=raw",
669
- ...DIFF_FLAGS,
670
- ...trimmed,
671
- ...pathspecs.length ? ["--", ...pathspecs] : []
672
- ], {
673
- encoding: "utf-8",
674
- maxBuffer: 200 * 1024 * 1024
675
- });
676
- raw = stdout;
677
- } catch {
678
- return {
679
- commits: [],
680
- patch: "",
681
- truncated: 0
682
- };
683
- }
684
- const commits = parseGitShowRaw(raw);
685
- return {
686
- commits,
687
- patch: commits.map((c) => c.patch).filter(Boolean).join("\n"),
688
- truncated
689
- };
690
- }
691
- //#endregion
692
- //#region src/lib/comment-format.ts
693
- /** Plain-language guidance the agent should act on, derived from the verdict. */
694
- function reviewDecisionSummary(decision) {
695
- switch (decision) {
696
- case "approved": return "The reviewer APPROVED these changes. Address any open comments below, then proceed — the overall direction is good.";
697
- case "changes-requested": return "The reviewer REQUESTED EDITS. Address every open comment below and apply the requested changes before considering this review done.";
698
- case "rejected": return "The reviewer REJECTED these changes. Do NOT keep building on this approach; reconsider it in light of the comments below before continuing.";
699
- }
700
- }
701
- /**
702
- * Render review comments as the `<code-review-comments>` XML envelope used to
703
- * hand a review to an AI agent. Shared by the UI clipboard button
704
- * (`useComments.formatAllComments`), the server's `/api/review/send` handoff,
705
- * and the `diffing` CLI/MCP so every channel emits byte-identical output.
706
- *
707
- * A review may carry a headline `decision` (approve / request edits / reject)
708
- * and/or an overall comment, so the envelope is emitted even with zero inline
709
- * comments — letting a reviewer submit a verdict without annotating any line.
710
- */
711
- function formatComments(comments, generalComment, decision) {
712
- const trimmedGeneral = generalComment?.trim();
713
- if (comments.length === 0 && !decision && !trimmedGeneral) return "";
714
- const grouped = /* @__PURE__ */ new Map();
715
- for (const comment of comments) {
716
- const list = grouped.get(comment.filePath) ?? [];
717
- list.push(comment);
718
- grouped.set(comment.filePath, list);
719
- }
720
- const lines = [];
721
- lines.push(decision ? `<code-review-comments decision="${decision}">` : "<code-review-comments>");
722
- lines.push(" <instructions>");
723
- lines.push(" You are an AI coding assistant. You are receiving a structured list of code review comments to address in the repository.");
724
- lines.push(" For each file, review the inline comments and apply the changes requested.");
725
- if (decision) {
726
- lines.push(" - The \"decision\" attribute on the root element is the reviewer's headline verdict: \"approved\", \"changes-requested\", or \"rejected\".");
727
- lines.push(" - <decision-summary> tells you, in plain language, what to do next based on that verdict.");
728
- }
729
- lines.push(" - Target lines are specified by the \"line\" attribute (e.g. line=\"10\" or line=\"10-15\").");
730
- lines.push(" - \"side\" indicates whether the comment is on \"additions\" (added/modified lines) or \"deletions\" (deleted/old lines).");
731
- lines.push(" - \"status\" indicates whether the comment is \"open\" or \"resolved\". Only address comments with status=\"open\".");
732
- lines.push(" - The <code> block contains the specific code context at the reviewed lines, prefixed with \"+\" or \"-\".");
733
- lines.push(" - The <body> tag contains the review feedback or request.");
734
- lines.push(" - If developers have replied to the comment, their discussion is captured under the <replies> element.");
735
- lines.push(" - The comment \"id\" attribute can be used to reference or update the comment via API if available.");
736
- lines.push("");
737
- lines.push(" HOW TO REPLY OR ASK FOR CLARIFICATION:");
738
- lines.push(" If you need to ask for clarification, explain what you did, or reply to any comment:");
739
- lines.push("");
740
- lines.push(" Option A: Via the diffing CLI or MCP (Preferred — port-agnostic, no copy-paste)");
741
- lines.push(" diffing reply <comment-id> --body \"Your response\" --model \"<your-model-name>\"");
742
- lines.push(" diffing resolve <comment-id>");
743
- lines.push(" (Or the equivalent MCP tools: reply_to_comment, resolve_comment.)");
744
- lines.push("");
745
- lines.push(" Option B: Via the local HTTP API (if you know the running port)");
746
- lines.push(" POST http://localhost:<port>/api/comments/<comment-id>/replies");
747
- lines.push(" Payload: { \"body\": \"Your response or clarification request here\", \"model\": \"<your-model-name>\" }");
748
- lines.push(" PUT http://localhost:<port>/api/comments/<comment-id> Payload: { \"status\": \"resolved\" }");
749
- lines.push("");
750
- lines.push(" Option C: Via Text Response (Offline / Chat Copy-Paste)");
751
- lines.push(" If you do not have local API access, output your comments/replies inside a structured XML block at the end of your response:");
752
- lines.push(" <comment-replies>");
753
- lines.push(" <reply to=\"<comment-id>\" model=\"<your-model-name>\"><![CDATA[Your reply or clarification request here]]></reply>");
754
- lines.push(" </comment-replies>");
755
- lines.push(" </instructions>");
756
- if (decision) lines.push(` <decision-summary><![CDATA[${reviewDecisionSummary(decision)}]]></decision-summary>`);
757
- if (trimmedGeneral) {
758
- lines.push(" <general-comment>");
759
- lines.push(` <![CDATA[${trimmedGeneral}]]>`);
760
- lines.push(" </general-comment>");
761
- }
762
- for (const [filePath, fileComments] of grouped) {
763
- lines.push(` <file path="${filePath}">`);
764
- for (const comment of fileComments) {
765
- const lineAttr = comment.lineNumber === 0 ? "file" : comment.startLineNumber && comment.startLineNumber !== comment.lineNumber ? `${comment.startLineNumber}-${comment.lineNumber}` : `${comment.lineNumber}`;
766
- const isoDate = new Date(comment.createdAt).toISOString();
767
- lines.push(` <comment id="${comment.id}" line="${lineAttr}" side="${comment.side}" status="${comment.status}" created-at="${isoDate}">`);
768
- if (comment.lineNumber !== 0) {
769
- const prefix = comment.side === "additions" ? "+" : "-";
770
- const isMultiLine = comment.lineContent && comment.lineContent.includes("\n");
771
- let codeVal = "";
772
- if (isMultiLine) codeVal = `\n${comment.lineContent.split("\n").map((l) => `${prefix} ${l}`).join("\n")}\n`;
773
- else codeVal = `${prefix} ${comment.lineContent}`;
774
- lines.push(` <code><![CDATA[${codeVal}]]></code>`);
775
- }
776
- lines.push(` <body><![CDATA[${comment.body}]]></body>`);
777
- if (comment.replies && comment.replies.length > 0) {
778
- lines.push(" <replies>");
779
- for (const reply of comment.replies) {
780
- const replyIsoDate = new Date(reply.createdAt).toISOString();
781
- const roleAttr = reply.role ? ` role="${reply.role}"` : " role=\"agent\"";
782
- const modelAttr = reply.model ? ` model="${reply.model}"` : "";
783
- lines.push(` <reply id="${reply.id}" created-at="${replyIsoDate}"${roleAttr}${modelAttr}>`);
784
- lines.push(` <![CDATA[${reply.body}]]>`);
785
- lines.push(" </reply>");
786
- }
787
- lines.push(" </replies>");
788
- }
789
- lines.push(" </comment>");
790
- }
791
- lines.push(" </file>");
792
- }
793
- lines.push("</code-review-comments>");
794
- return lines.join("\n");
795
- }
796
- //#endregion
797
- //#region src/lib/server-lock.ts
798
- function lockPath(repoRoot) {
799
- return join(getProjectStorageDir(repoRoot), "server.json");
800
- }
801
- function writeServerLock(lock) {
802
- const path = lockPath(lock.repoRoot);
803
- mkdirSync(join(path, ".."), { recursive: true });
804
- writeFileSync(path, JSON.stringify(lock, null, 2), "utf-8");
805
- }
806
- function readServerLock(repoRoot) {
807
- try {
808
- const raw = readFileSync(lockPath(repoRoot), "utf-8");
809
- const lock = JSON.parse(raw);
810
- if (typeof lock.port !== "number" || typeof lock.pid !== "number") return null;
811
- return lock;
812
- } catch {
813
- return null;
814
- }
815
- }
816
- /**
817
- * True if the process named by the lock is still alive and the lock belongs to
818
- * this repo. `process.kill(pid, 0)` sends no signal — it just probes existence.
819
- */
820
- function isLockAlive(lock) {
821
- try {
822
- process.kill(lock.pid, 0);
823
- } catch {
824
- return false;
825
- }
826
- try {
827
- return lock.repoRoot === getRepoRoot();
828
- } catch {
829
- return true;
830
- }
831
- }
832
- function removeServerLock(repoRoot) {
833
- try {
834
- rmSync(lockPath(repoRoot), { force: true });
835
- } catch {}
836
- }
837
- //#endregion
838
- export { toSafeRelativePath as C, isSafePath as S, getUntrackedFilePathsAsync as _, formatComments as a, listRepoFiles as b, getFileContent as c, getMergeStatus as d, getProjectStorageDir as f, getTabSizeForFiles as g, getShowDiff as h, writeServerLock as i, getGitDiffAsync as l, getRepoRoot as m, readServerLock as n, getBranchName as o, getRepoName as p, removeServerLock as r, getCustomGitDiffAsync as s, isLockAlive as t, getHunkHistory as u, gitAddFile as v, revertHunk as x, isGitRepo as y };