claude-code-best 1.1.0 → 1.2.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 (514) hide show
  1. package/README.md +66 -75
  2. package/dist/{chunk-q5b91nhh.js → chunk-01qzvbp3.js} +8 -2
  3. package/dist/{chunk-f9b4wb89.js → chunk-053bj0m0.js} +79 -73
  4. package/dist/chunk-05tt9tt1.js +653 -0
  5. package/dist/chunk-06sq1vz3.js +403 -0
  6. package/dist/chunk-07069jq1.js +30 -0
  7. package/dist/chunk-0dac8msw.js +135 -0
  8. package/dist/{chunk-m5eb5pt2.js → chunk-0ja0y3at.js} +6 -6
  9. package/dist/chunk-0jzdwbdc.js +14 -0
  10. package/dist/chunk-0nrq46nf.js +313 -0
  11. package/dist/chunk-0qz705wz.js +192 -0
  12. package/dist/{chunk-m94pnhfa.js → chunk-0rn4v8sg.js} +38 -28
  13. package/dist/{chunk-1cbn5kxf.js → chunk-0rpb2bdp.js} +3 -2
  14. package/dist/{chunk-zz21rvr7.js → chunk-127cmycn.js} +8 -5
  15. package/dist/chunk-12vk6z7z.js +109 -0
  16. package/dist/{chunk-vybkxr18.js → chunk-15y014gg.js} +41 -31
  17. package/dist/{chunk-44fpr6jq.js → chunk-168xb8v1.js} +4 -2
  18. package/dist/{chunk-8hsyagr8.js → chunk-16bnxyz0.js} +1 -1
  19. package/dist/{chunk-wsqhnjj3.js → chunk-1atfzck5.js} +24 -24
  20. package/dist/chunk-1cbhkqxg.js +310 -0
  21. package/dist/chunk-1csq8bf1.js +295 -0
  22. package/dist/{chunk-0e1xsncc.js → chunk-1cwdhk7a.js} +1 -1
  23. package/dist/{chunk-c8jv6rtj.js → chunk-1ebqpwhn.js} +74 -68
  24. package/dist/{chunk-vyd8jzde.js → chunk-1mh5vt6v.js} +91 -83
  25. package/dist/chunk-1qf125vg.js +123 -0
  26. package/dist/{chunk-ryj80g9p.js → chunk-1sp6713v.js} +131 -176
  27. package/dist/{chunk-d18z9pna.js → chunk-1thgdca1.js} +2 -2
  28. package/dist/chunk-1z1gfx2c.js +443 -0
  29. package/dist/{chunk-wc6wwwyb.js → chunk-21z7acxh.js} +3 -3
  30. package/dist/chunk-229pcf6p.js +509 -0
  31. package/dist/chunk-238g70xa.js +1 -1
  32. package/dist/{chunk-vpb723tx.js → chunk-23ad5t92.js} +5 -5
  33. package/dist/chunk-28043j1k.js +68 -0
  34. package/dist/chunk-299r6d9v.js +141 -0
  35. package/dist/{chunk-a6s8wnhe.js → chunk-2bw5nqsw.js} +4 -4
  36. package/dist/chunk-2mxstrx5.js +445 -0
  37. package/dist/{chunk-9g827w4j.js → chunk-2q39ej51.js} +6 -6
  38. package/dist/chunk-2qwgfjcj.js +5370 -0
  39. package/dist/chunk-2ss23j0q.js +3587 -0
  40. package/dist/{chunk-hy3g1nv8.js → chunk-2wvxddsg.js} +9 -7
  41. package/dist/chunk-2x2aznpc.js +134 -0
  42. package/dist/{chunk-bqq4zamw.js → chunk-2ys5wcxk.js} +3 -3
  43. package/dist/{chunk-x51h62jq.js → chunk-3cvcwgsr.js} +74 -68
  44. package/dist/{chunk-mecs0gpc.js → chunk-3xv7rjsy.js} +14 -11
  45. package/dist/chunk-42x5tjk2.js +42 -0
  46. package/dist/{chunk-q6rax9kh.js → chunk-436r0x2n.js} +5 -5
  47. package/dist/{chunk-zgrg0wk3.js → chunk-44q4jkwa.js} +27 -67
  48. package/dist/{chunk-zq9xa1xe.js → chunk-44w22kyx.js} +104 -139
  49. package/dist/{chunk-yhd82045.js → chunk-46fcr28b.js} +30 -9
  50. package/dist/{chunk-wm2f2f1z.js → chunk-474y75ga.js} +2 -2
  51. package/dist/{chunk-6fkwz9yk.js → chunk-478rpnqm.js} +8 -8
  52. package/dist/{chunk-rj86xm6z.js → chunk-48w0df8a.js} +1 -1
  53. package/dist/{chunk-v4t6dyyh.js → chunk-4cp6193g.js} +2 -2
  54. package/dist/chunk-4d0de73v.js +436 -0
  55. package/dist/chunk-4eecm90d.js +1030 -0
  56. package/dist/{chunk-q7tvkc86.js → chunk-4f4ccg1h.js} +10 -115
  57. package/dist/chunk-4h102wt5.js +65 -0
  58. package/dist/{chunk-3mgywd32.js → chunk-4hv90qcz.js} +1 -1
  59. package/dist/{chunk-bcrxtdcy.js → chunk-4jcqmf9w.js} +39 -29
  60. package/dist/{chunk-v8xem37v.js → chunk-4kk7vxed.js} +8 -6
  61. package/dist/chunk-4nspekjp.js +69 -0
  62. package/dist/chunk-4xmb7bvy.js +125 -0
  63. package/dist/{chunk-427m88ms.js → chunk-4xy0c1dz.js} +8 -8
  64. package/dist/{chunk-41mpwc8h.js → chunk-53c9gb9c.js} +19 -15
  65. package/dist/{chunk-bpts9jbq.js → chunk-53zsn91p.js} +39 -31
  66. package/dist/{chunk-t7cbhqd2.js → chunk-548g1d6z.js} +104 -119
  67. package/dist/chunk-559yvwh1.js +63 -0
  68. package/dist/chunk-5a6ahhvy.js +594 -0
  69. package/dist/{chunk-5tx8dsy0.js → chunk-5c6man70.js} +9531 -18004
  70. package/dist/chunk-5hb5ev7b.js +74 -0
  71. package/dist/{chunk-ggqx30m9.js → chunk-5z28bqne.js} +23 -311
  72. package/dist/{chunk-p7g7pf3f.js → chunk-61ahbn23.js} +8 -6
  73. package/dist/{chunk-0sb5scxx.js → chunk-652wnf1z.js} +5 -5
  74. package/dist/{chunk-7tqhx6dr.js → chunk-66jkaz3q.js} +109 -213
  75. package/dist/{chunk-q25bjaev.js → chunk-677as3nh.js} +2 -2
  76. package/dist/chunk-68ksfahx.js +386 -0
  77. package/dist/{chunk-xs0hwvpa.js → chunk-68pfxvxt.js} +14 -9
  78. package/dist/{chunk-epmheefa.js → chunk-69hys77v.js} +8 -8
  79. package/dist/{chunk-9g2ncq68.js → chunk-6ayqcq3h.js} +120 -127
  80. package/dist/chunk-6kpbgc5w.js +23 -0
  81. package/dist/chunk-6mpsxxsf.js +362 -0
  82. package/dist/chunk-6nze0g86.js +119 -0
  83. package/dist/{chunk-v1mgv1et.js → chunk-6p4cyhb3.js} +4 -3
  84. package/dist/{chunk-2w8633e3.js → chunk-6t62dbnb.js} +61 -100
  85. package/dist/chunk-6t87a3q6.js +2842 -0
  86. package/dist/{chunk-6mz58s8p.js → chunk-6xana182.js} +18 -14
  87. package/dist/{chunk-fpf4cgbt.js → chunk-7bfach0x.js} +9 -9
  88. package/dist/{chunk-n7158r58.js → chunk-7f1ggjr2.js} +75 -69
  89. package/dist/chunk-7fxjmmfw.js +1172 -0
  90. package/dist/{chunk-ckcagq32.js → chunk-7gqf9wej.js} +5 -5
  91. package/dist/{chunk-b1xt9jqg.js → chunk-7j3dkjqq.js} +15 -5
  92. package/dist/chunk-7ns74x0q.js +475 -0
  93. package/dist/{chunk-ghr4s9g6.js → chunk-7qmknpkq.js} +75 -69
  94. package/dist/chunk-7rzepn9c.js +83 -0
  95. package/dist/chunk-7tdcwje9.js +68 -0
  96. package/dist/{chunk-b4mnbry0.js → chunk-8201tnhf.js} +4 -4
  97. package/dist/{chunk-dv1wfr85.js → chunk-8225arm6.js} +5 -4
  98. package/dist/chunk-822wfv88.js +70 -0
  99. package/dist/chunk-837tm8ht.js +183 -0
  100. package/dist/chunk-8a2ajt5d.js +878 -0
  101. package/dist/{chunk-bj0rvnjw.js → chunk-8bymxfn4.js} +39 -29
  102. package/dist/chunk-8cwbzk7h.js +118 -0
  103. package/dist/chunk-8d0ev0m2.js +111 -0
  104. package/dist/{chunk-4pbx3g7s.js → chunk-8g747a8x.js} +1 -1
  105. package/dist/chunk-8kfwb79z.js +436 -0
  106. package/dist/{chunk-xyqr1cww.js → chunk-8me0yq6v.js} +12 -12
  107. package/dist/{chunk-k5gdea6r.js → chunk-8n8285ax.js} +78 -72
  108. package/dist/{chunk-sdj9b9wh.js → chunk-8pn8tvgg.js} +9 -154
  109. package/dist/{chunk-d7mx1phm.js → chunk-8qhr4n77.js} +61 -103
  110. package/dist/{chunk-7ejt5gqq.js → chunk-8s9bbk3r.js} +58 -45
  111. package/dist/{chunk-bmvb57qb.js → chunk-905d2hee.js} +5 -5
  112. package/dist/{chunk-fk06pejm.js → chunk-91xq5y4a.js} +9 -9
  113. package/dist/{chunk-ahjgghpe.js → chunk-93xsyzsp.js} +1 -1
  114. package/dist/chunk-99pmbfqp.js +230 -0
  115. package/dist/{chunk-cgn27dqf.js → chunk-9f14bkn9.js} +3 -3
  116. package/dist/{chunk-sa7nc0vv.js → chunk-9m78gjpd.js} +1 -1
  117. package/dist/{chunk-kq098bkj.js → chunk-9pm2d2gv.js} +245 -316
  118. package/dist/chunk-a136cvvz.js +27 -0
  119. package/dist/{chunk-n5t9m8h9.js → chunk-a1bjde7d.js} +7 -7
  120. package/dist/chunk-a2evk7n1.js +168 -0
  121. package/dist/{chunk-khdjg2v9.js → chunk-a3k4w4cm.js} +38 -28
  122. package/dist/chunk-a3mcc1sb.js +1403 -0
  123. package/dist/{chunk-8hq5kk3y.js → chunk-a4twdmhf.js} +3 -2
  124. package/dist/chunk-a8eaey19.js +66 -0
  125. package/dist/chunk-abkb5pw6.js +426 -0
  126. package/dist/chunk-ae76ded0.js +30 -0
  127. package/dist/{chunk-660kcy7p.js → chunk-agx5w9ce.js} +14 -8
  128. package/dist/chunk-ah46h8rp.js +70 -0
  129. package/dist/chunk-aj3azy6z.js +409 -0
  130. package/dist/chunk-an6z4rzv.js +158 -0
  131. package/dist/{chunk-r6b58y3x.js → chunk-ase86y73.js} +1 -3
  132. package/dist/{chunk-v0wa5ref.js → chunk-avfjb6pd.js} +13 -555
  133. package/dist/{chunk-5mrhhmas.js → chunk-az5x70pn.js} +8 -5
  134. package/dist/{chunk-49k5ktrj.js → chunk-b6rg3egp.js} +30 -15
  135. package/dist/chunk-b73r6ngr.js +125 -0
  136. package/dist/{chunk-8bedvdm1.js → chunk-b81hd3m6.js} +1 -1
  137. package/dist/{chunk-z7pr85qw.js → chunk-b9mhpc0v.js} +3 -3
  138. package/dist/chunk-b9ndqcdv.js +139 -0
  139. package/dist/{chunk-n5516f5q.js → chunk-bd8zk9tn.js} +4 -4
  140. package/dist/chunk-bdy6n17s.js +343 -0
  141. package/dist/{chunk-r55r29js.js → chunk-bf1j3azq.js} +131 -111
  142. package/dist/{chunk-83z0wrnz.js → chunk-bfcet2mw.js} +2 -2
  143. package/dist/{chunk-jy35mvy3.js → chunk-bmjmrk76.js} +7 -7
  144. package/dist/{chunk-2j0j79p0.js → chunk-bsj8e2mb.js} +8 -8
  145. package/dist/{chunk-snvypj85.js → chunk-bt64sq5y.js} +3 -2
  146. package/dist/{chunk-vyc0rjyx.js → chunk-bwg7582d.js} +1 -1
  147. package/dist/{chunk-3be7ka25.js → chunk-bxcfz5gy.js} +1 -1
  148. package/dist/{chunk-mvss16tj.js → chunk-c1k9tg7h.js} +289 -624
  149. package/dist/{chunk-crr52hf4.js → chunk-c5pxerks.js} +13 -11
  150. package/dist/chunk-c6sjhj89.js +1284 -0
  151. package/dist/{chunk-q6dpqj3z.js → chunk-c9q0phsg.js} +9 -6
  152. package/dist/chunk-caj0ab74.js +129 -0
  153. package/dist/{chunk-f64npa3b.js → chunk-chsyvavm.js} +704 -4
  154. package/dist/{chunk-dqh7e4mt.js → chunk-cjpt035a.js} +51 -41
  155. package/dist/{chunk-z8nbjar4.js → chunk-cmcbatgz.js} +7 -5
  156. package/dist/chunk-cnsj3vq2.js +35 -0
  157. package/dist/chunk-cqjmxeqv.js +269 -0
  158. package/dist/{chunk-bt9krt49.js → chunk-cvb1v08x.js} +38 -32
  159. package/dist/{chunk-j3215c49.js → chunk-cxhvyf7c.js} +227 -370
  160. package/dist/{chunk-24x87knx.js → chunk-cxx0e4nv.js} +1326 -2881
  161. package/dist/chunk-cy2hswr1.js +15 -0
  162. package/dist/{chunk-mwp7sj0q.js → chunk-cy6ezb6j.js} +115140 -121540
  163. package/dist/{chunk-ks0m9njy.js → chunk-d2jekryq.js} +8 -8
  164. package/dist/chunk-d4mdda98.js +94 -0
  165. package/dist/{chunk-33khw5gy.js → chunk-d6ve5pze.js} +7 -7
  166. package/dist/{chunk-26wtxbdc.js → chunk-d7886r6a.js} +6928 -6928
  167. package/dist/{chunk-9t1x831d.js → chunk-d83tmb5h.js} +82 -73
  168. package/dist/{chunk-g5sg6y9q.js → chunk-d8meetqc.js} +78 -71
  169. package/dist/{chunk-ra8fbt9p.js → chunk-d8r0q4ps.js} +537 -871
  170. package/dist/chunk-d95k8xkm.js +84 -0
  171. package/dist/chunk-dd4m7t1v.js +112 -0
  172. package/dist/{chunk-er9vzjac.js → chunk-dekbr08w.js} +16 -14
  173. package/dist/{chunk-cvge4pvp.js → chunk-dk8287aa.js} +1 -1
  174. package/dist/{chunk-9mfbqw9k.js → chunk-dm3n2qgd.js} +4 -4
  175. package/dist/{chunk-n6fbyke9.js → chunk-dmxte86x.js} +3 -3
  176. package/dist/{chunk-t24ytdcw.js → chunk-dqvwn28p.js} +12 -10
  177. package/dist/chunk-drkm8yx2.js +34 -0
  178. package/dist/{chunk-ptwn7qw7.js → chunk-dsbewdgm.js} +38 -10
  179. package/dist/{chunk-w7h2yphx.js → chunk-dwekpr47.js} +2 -2
  180. package/dist/{chunk-ks0dm6t3.js → chunk-e3299veq.js} +16 -70
  181. package/dist/{chunk-4x5ym4h2.js → chunk-e5hcyxae.js} +129 -15
  182. package/dist/chunk-e7h0nd5w.js +106 -0
  183. package/dist/{chunk-s2dmn3yg.js → chunk-eaemyebz.js} +5 -5
  184. package/dist/{chunk-cmdsbsb6.js → chunk-edzkkadh.js} +2 -2
  185. package/dist/chunk-em99fnet.js +128 -0
  186. package/dist/{chunk-hfzj1m07.js → chunk-epyaq1z0.js} +13 -4
  187. package/dist/{chunk-v9y80148.js → chunk-eqmkajs4.js} +96 -189
  188. package/dist/{chunk-cs6y2pc9.js → chunk-ergam9ft.js} +5 -5
  189. package/dist/chunk-es2fdse0.js +63 -0
  190. package/dist/{chunk-cenpqc2t.js → chunk-esn3tgm2.js} +8 -6
  191. package/dist/{chunk-qf2v384j.js → chunk-et8ybmt2.js} +9 -7
  192. package/dist/{chunk-aqa7w38f.js → chunk-ew9rp41b.js} +5 -5
  193. package/dist/{chunk-1yabrspp.js → chunk-ewx6xfzb.js} +2 -2
  194. package/dist/chunk-eyjtbtt0.js +137 -0
  195. package/dist/{chunk-rmbp2das.js → chunk-f0jd2p9n.js} +20 -18
  196. package/dist/{chunk-vzqrbsd1.js → chunk-f69rgsm2.js} +5 -5
  197. package/dist/{chunk-f3bapa1x.js → chunk-f6rbj3gz.js} +12 -7
  198. package/dist/chunk-fbhyqxdg.js +1182 -0
  199. package/dist/chunk-feyzykye.js +10 -0
  200. package/dist/chunk-ffhejx56.js +107 -0
  201. package/dist/{chunk-vbbf707n.js → chunk-fhx6nt2a.js} +38 -28
  202. package/dist/chunk-fkkysfev.js +158 -0
  203. package/dist/chunk-fn510gqw.js +216 -0
  204. package/dist/chunk-ftsg8bjm.js +117 -0
  205. package/dist/{chunk-t3bf8hcf.js → chunk-fyts9grb.js} +2 -2
  206. package/dist/{chunk-kd97kxjn.js → chunk-fz0ch109.js} +3 -2
  207. package/dist/{chunk-ye18m1zb.js → chunk-g1jarkx9.js} +38 -8
  208. package/dist/chunk-g9f19ttm.js +15 -0
  209. package/dist/chunk-g9qte35t.js +341 -0
  210. package/dist/chunk-gaav53dc.js +105 -0
  211. package/dist/chunk-gfx3cwrk.js +75 -0
  212. package/dist/{chunk-z9tgzh90.js → chunk-gk2d1x2a.js} +44 -33
  213. package/dist/chunk-gkbat1p9.js +121 -0
  214. package/dist/{chunk-5b7119h5.js → chunk-gmnyk2t8.js} +8 -6
  215. package/dist/{chunk-qvd0k5dn.js → chunk-gnmdprq3.js} +184 -345
  216. package/dist/{chunk-bq6x1ehp.js → chunk-gpz0ddyz.js} +8 -8
  217. package/dist/{chunk-684kdqez.js → chunk-gv1csnc3.js} +198 -302
  218. package/dist/{chunk-x51mdzqq.js → chunk-gv37c8ax.js} +3 -3
  219. package/dist/{chunk-t6h4wf3k.js → chunk-gzr2601k.js} +9 -9
  220. package/dist/{chunk-45e9mkyr.js → chunk-h3pda469.js} +37 -82
  221. package/dist/{chunk-qqfa0dqg.js → chunk-h4b85amj.js} +20 -32
  222. package/dist/{chunk-j4c8s7tn.js → chunk-h5zv78zq.js} +9 -6
  223. package/dist/{chunk-2wcbcdky.js → chunk-h7edytkc.js} +5 -5
  224. package/dist/{chunk-402jrnj6.js → chunk-ha0wbzc3.js} +8 -8
  225. package/dist/{chunk-nxsh6de2.js → chunk-hcgkak1j.js} +20 -125
  226. package/dist/{chunk-tjaqa99q.js → chunk-hezj20qy.js} +3 -3
  227. package/dist/{chunk-kyer92r4.js → chunk-hf85ht0m.js} +2 -2
  228. package/dist/{chunk-m17y8b22.js → chunk-ht1nfygk.js} +38 -28
  229. package/dist/chunk-j316jjby.js +108 -0
  230. package/dist/chunk-j3fge71v.js +115 -0
  231. package/dist/{chunk-b51jjfh5.js → chunk-j4x0t6k2.js} +42 -31
  232. package/dist/{chunk-9gbamk79.js → chunk-j5bth84e.js} +5 -1
  233. package/dist/chunk-j783d5af.js +134 -0
  234. package/dist/chunk-j7pbwf9x.js +108 -0
  235. package/dist/{chunk-0cpnzx7t.js → chunk-j8rnrm5n.js} +114 -150
  236. package/dist/{chunk-vratq94g.js → chunk-j9gxwbe3.js} +1 -1
  237. package/dist/{chunk-3r24h7t6.js → chunk-jaaxk89e.js} +1 -1
  238. package/dist/{chunk-f4jcw0ea.js → chunk-jaew3662.js} +18 -14
  239. package/dist/{chunk-qpm1tmzz.js → chunk-jbbj16w2.js} +120 -191
  240. package/dist/chunk-jerew25v.js +148 -0
  241. package/dist/{chunk-v399mzxk.js → chunk-jf0p00fz.js} +2 -2
  242. package/dist/{chunk-91r0z5qq.js → chunk-jfsah2w3.js} +1059 -1756
  243. package/dist/{chunk-av73dywf.js → chunk-jna2tcvj.js} +8 -8
  244. package/dist/{chunk-jy35z4n0.js → chunk-jng0mb4r.js} +8 -8
  245. package/dist/chunk-jrrmwfp4.js +66 -0
  246. package/dist/{chunk-3m7ge6tj.js → chunk-jt6fa514.js} +14 -12
  247. package/dist/chunk-jvkyx1b7.js +911 -0
  248. package/dist/{chunk-41xeh3t9.js → chunk-jy6c07wa.js} +4 -4
  249. package/dist/chunk-k1fvb16y.js +269 -0
  250. package/dist/{chunk-bqfnp99q.js → chunk-k3s4yk22.js} +1 -1
  251. package/dist/{chunk-4ycz58wj.js → chunk-k46gxg21.js} +68 -8
  252. package/dist/chunk-k8wwyz2t.js +110 -0
  253. package/dist/{chunk-68qevppc.js → chunk-ka3fdfyb.js} +78 -71
  254. package/dist/{chunk-vaebptnz.js → chunk-ka4x7mhn.js} +38 -28
  255. package/dist/chunk-kb99zpps.js +216 -0
  256. package/dist/{chunk-1dyeexvn.js → chunk-kd3mmsd2.js} +4 -4
  257. package/dist/{chunk-1xkekb9y.js → chunk-kfd89dsd.js} +5 -3
  258. package/dist/{chunk-ecsw41df.js → chunk-km1wcchx.js} +81 -76
  259. package/dist/{chunk-dh6c8y1j.js → chunk-kmhwx18d.js} +3 -3
  260. package/dist/{chunk-224x480q.js → chunk-kq91dwkq.js} +8 -6
  261. package/dist/chunk-m17m84b7.js +111 -0
  262. package/dist/chunk-m1a0s9fd.js +1070 -0
  263. package/dist/{chunk-jafes477.js → chunk-m2bcpk8j.js} +4 -3
  264. package/dist/{chunk-veb0gkcf.js → chunk-m7jtn7dk.js} +74 -68
  265. package/dist/chunk-mq2mgyt9.js +103 -0
  266. package/dist/chunk-msv3w4qp.js +1811 -0
  267. package/dist/{chunk-ch53fgm5.js → chunk-mxe1f4jg.js} +13 -11
  268. package/dist/{chunk-hzttn8j7.js → chunk-mzwjvfr2.js} +124 -126
  269. package/dist/{chunk-2de1vaxf.js → chunk-n2n0sq7r.js} +67 -77
  270. package/dist/{chunk-me2ef6g4.js → chunk-n8mpqdje.js} +1 -1
  271. package/dist/chunk-n9e984ba.js +132 -0
  272. package/dist/chunk-netzwgv1.js +154 -0
  273. package/dist/{chunk-xszk7n10.js → chunk-nh3cd07f.js} +1 -1
  274. package/dist/chunk-njrz6mbe.js +66 -0
  275. package/dist/{chunk-e1ge9n4d.js → chunk-nv7pfr7k.js} +2 -2
  276. package/dist/{chunk-vygf94dw.js → chunk-nwd8pb55.js} +74 -68
  277. package/dist/{chunk-5hva0tsg.js → chunk-p2yv7m0g.js} +6 -6
  278. package/dist/chunk-p5t2vy90.js +259 -0
  279. package/dist/{chunk-zk2wsm7d.js → chunk-p7vkh4wx.js} +2 -2
  280. package/dist/{chunk-da4ve9t5.js → chunk-p8crqj70.js} +10 -10
  281. package/dist/{chunk-n2874aq5.js → chunk-pcngtzr8.js} +12 -6
  282. package/dist/{chunk-6td4c2eq.js → chunk-pdjem6h1.js} +53 -71
  283. package/dist/{chunk-zpc0kwkb.js → chunk-pmxdzjq0.js} +6 -6
  284. package/dist/{chunk-pa7saazk.js → chunk-pnkcecq2.js} +27 -55
  285. package/dist/{chunk-zsfxha74.js → chunk-pshjyzq4.js} +8 -7
  286. package/dist/chunk-pt1yj9zf.js +107 -0
  287. package/dist/{chunk-n9x557ea.js → chunk-py6b9d5b.js} +2312 -4200
  288. package/dist/chunk-q7n8d91g.js +67 -0
  289. package/dist/{chunk-e5pntxye.js → chunk-q7tpyeb3.js} +6 -4
  290. package/dist/{chunk-7ymfj7m3.js → chunk-q82r31er.js} +1 -1
  291. package/dist/chunk-qajrkk97.js +298 -0
  292. package/dist/chunk-qbrh24cn.js +119 -0
  293. package/dist/chunk-qd9ntz7c.js +230 -0
  294. package/dist/chunk-qfr5tcd5.js +2537 -0
  295. package/dist/chunk-qpzfmkct.js +456 -0
  296. package/dist/{chunk-35y0r56v.js → chunk-qtfc6wdh.js} +1 -4
  297. package/dist/chunk-r032587e.js +83 -0
  298. package/dist/{chunk-rryx19hp.js → chunk-r2k2jy0y.js} +2 -2
  299. package/dist/{chunk-pgnnrm2v.js → chunk-r4dnnggx.js} +21 -17
  300. package/dist/{chunk-k9a8jemz.js → chunk-r5n8fvw0.js} +7 -7
  301. package/dist/{chunk-jt0pha6y.js → chunk-r7kh03er.js} +222 -196
  302. package/dist/{chunk-n0k8xrey.js → chunk-rfs0mfg8.js} +140 -158
  303. package/dist/{chunk-dr4qq42x.js → chunk-rgbbtszq.js} +9 -9
  304. package/dist/{chunk-fdwa7gem.js → chunk-rkak3kjw.js} +7 -7
  305. package/dist/chunk-rp568bfw.js +111 -0
  306. package/dist/chunk-rtv718sv.js +146 -0
  307. package/dist/{chunk-rw466wqn.js → chunk-rvkvehat.js} +5284 -3093
  308. package/dist/chunk-s1baskk7.js +14 -0
  309. package/dist/{chunk-2cgdr2n7.js → chunk-s1eb67v3.js} +74 -68
  310. package/dist/{chunk-1szr63w0.js → chunk-s59kx26r.js} +81 -72
  311. package/dist/chunk-s6yk6m3b.js +109 -0
  312. package/dist/{chunk-80qg1pzv.js → chunk-sca71yv8.js} +11 -9
  313. package/dist/chunk-sfrwm87k.js +151 -0
  314. package/dist/chunk-sgaknx21.js +123 -0
  315. package/dist/{chunk-myzwt5yw.js → chunk-snyaz093.js} +9 -15
  316. package/dist/{chunk-rwexx5ns.js → chunk-sq8wkk3z.js} +1 -3
  317. package/dist/{chunk-faycqscv.js → chunk-sxqj7s2h.js} +2 -2
  318. package/dist/chunk-t2m6cjp1.js +264 -0
  319. package/dist/chunk-t6hmvb6k.js +1021 -0
  320. package/dist/chunk-t72x960a.js +125 -0
  321. package/dist/chunk-t9kashay.js +440 -0
  322. package/dist/chunk-t9wzf009.js +151 -0
  323. package/dist/chunk-ta1dgyj1.js +154 -0
  324. package/dist/{chunk-5deqy8r0.js → chunk-tavxhayf.js} +77 -71
  325. package/dist/{chunk-35b0ek0j.js → chunk-tcdv4gp8.js} +13 -9
  326. package/dist/chunk-td3b74vm.js +362 -0
  327. package/dist/{chunk-mt25echc.js → chunk-tezak8rx.js} +1 -1
  328. package/dist/chunk-tgcw0rzx.js +262 -0
  329. package/dist/{chunk-9rcbyag3.js → chunk-tmdbrszg.js} +2 -2
  330. package/dist/{chunk-jknt3rxg.js → chunk-v17qee2y.js} +7 -9
  331. package/dist/{chunk-frbv3xqa.js → chunk-v1jd31dw.js} +2 -2
  332. package/dist/chunk-var1et7e.js +66 -0
  333. package/dist/{chunk-cettj572.js → chunk-ve9wswz4.js} +7 -131
  334. package/dist/{chunk-hqmz36b3.js → chunk-vf612n57.js} +21 -101
  335. package/dist/chunk-vfhabc5j.js +109 -0
  336. package/dist/{chunk-s7qj2hg5.js → chunk-vgy0w6tt.js} +2 -2
  337. package/dist/chunk-vh02fvz1.js +375 -0
  338. package/dist/{chunk-ctmt7xh1.js → chunk-vm935era.js} +619 -887
  339. package/dist/{chunk-dxc7begm.js → chunk-vtb8z6as.js} +14 -10
  340. package/dist/chunk-w2kf9sxn.js +115 -0
  341. package/dist/chunk-w7trx259.js +132 -0
  342. package/dist/{chunk-8z039kef.js → chunk-w92b262y.js} +53 -54
  343. package/dist/chunk-w9zqjhvm.js +103 -0
  344. package/dist/{chunk-9cc60ae5.js → chunk-wb2fvy1k.js} +74 -68
  345. package/dist/chunk-ws2d81aj.js +123 -0
  346. package/dist/{chunk-5zh1fbrj.js → chunk-wssgdcck.js} +2 -2
  347. package/dist/{chunk-t9z6njcr.js → chunk-wtycm8km.js} +9 -9
  348. package/dist/chunk-wz0d8mna.js +108 -0
  349. package/dist/chunk-x01wtn3p.js +144 -0
  350. package/dist/{chunk-dnyeb288.js → chunk-x2sp7rcv.js} +73 -105
  351. package/dist/{chunk-zrse3zpz.js → chunk-xbprynsc.js} +18 -46
  352. package/dist/{chunk-yxnwsp4f.js → chunk-xext3y2y.js} +8 -6
  353. package/dist/{chunk-fzxg8v1y.js → chunk-xycy3c8q.js} +15 -12
  354. package/dist/{chunk-cpma9zs5.js → chunk-y01ys1vm.js} +20 -71
  355. package/dist/{chunk-d7vv2ydf.js → chunk-y78t50v0.js} +2 -2
  356. package/dist/{chunk-xkr7as9h.js → chunk-y9bgt2k1.js} +13 -9
  357. package/dist/{chunk-s2gm9vfk.js → chunk-ydm0nfsv.js} +5 -5
  358. package/dist/{chunk-gjyc3293.js → chunk-yetebjek.js} +282 -495
  359. package/dist/{chunk-hkn7tzgv.js → chunk-ym5r3jnk.js} +1 -1
  360. package/dist/chunk-ysks0ewj.js +237 -0
  361. package/dist/chunk-yv3evkgg.js +68 -0
  362. package/dist/{chunk-athjeyrt.js → chunk-yw79dz62.js} +4 -4
  363. package/dist/{chunk-s84smrx4.js → chunk-yy59gvs4.js} +151 -189
  364. package/dist/{chunk-12pv5fez.js → chunk-yyax4hdg.js} +10 -8
  365. package/dist/chunk-z0q85m5f.js +108 -0
  366. package/dist/chunk-z1bs6d7k.js +24 -0
  367. package/dist/chunk-z6e5jp2w.js +119 -0
  368. package/dist/{chunk-rjz6btwk.js → chunk-z7ssqvt6.js} +4972 -4638
  369. package/dist/chunk-z95yxwyb.js +61 -0
  370. package/dist/{chunk-0nqrscrr.js → chunk-z9aqj026.js} +5 -5
  371. package/dist/chunk-zc6dxhk9.js +169 -0
  372. package/dist/{chunk-ve60fbtd.js → chunk-ze6zvkg6.js} +2 -2
  373. package/dist/{chunk-t0rgmccj.js → chunk-zejm280k.js} +1 -1
  374. package/dist/{chunk-krstc7m7.js → chunk-zfapazzd.js} +15 -11
  375. package/dist/chunk-zj4fqmnc.js +219 -0
  376. package/dist/chunk-zkrpbswn.js +1608 -0
  377. package/dist/chunk-zktbb38m.js +112 -0
  378. package/dist/{chunk-vjc1svpc.js → chunk-zptcqa7t.js} +82 -75
  379. package/dist/{chunk-gbcqdr0x.js → chunk-zvnsjbt8.js} +1 -1
  380. package/dist/chunk-zwaanw8y.js +110 -0
  381. package/dist/{chunk-g3t0act8.js → chunk-zzm33q8x.js} +1 -1
  382. package/dist/{chunk-s8fzxy94.js → chunk-zzzc1ead.js} +17 -13
  383. package/dist/cli.js +34 -10
  384. package/dist/vendor/audio-capture/arm64-darwin/audio-capture.node +0 -0
  385. package/dist/vendor/audio-capture/arm64-linux/audio-capture.node +0 -0
  386. package/dist/vendor/audio-capture/arm64-win32/audio-capture.node +0 -0
  387. package/dist/vendor/audio-capture/x64-darwin/audio-capture.node +0 -0
  388. package/dist/vendor/audio-capture/x64-linux/audio-capture.node +0 -0
  389. package/dist/vendor/audio-capture/x64-win32/audio-capture.node +0 -0
  390. package/package.json +8 -5
  391. package/scripts/postinstall.cjs +319 -0
  392. package/dist/chunk-0291smg3.js +0 -42
  393. package/dist/chunk-04g2ty3v.js +0 -104
  394. package/dist/chunk-069x95ne.js +0 -764
  395. package/dist/chunk-06x02eab.js +0 -655
  396. package/dist/chunk-09pjmga5.js +0 -713
  397. package/dist/chunk-0g90je6r.js +0 -145
  398. package/dist/chunk-0rddv9vb.js +0 -328
  399. package/dist/chunk-162w6yv3.js +0 -756
  400. package/dist/chunk-1gjbaa3n.js +0 -128
  401. package/dist/chunk-23wg4mnt.js +0 -404
  402. package/dist/chunk-2gbjtg7c.js +0 -102
  403. package/dist/chunk-2v1q0ezq.js +0 -102
  404. package/dist/chunk-37n7jkxe.js +0 -436
  405. package/dist/chunk-38svjnh4.js +0 -158
  406. package/dist/chunk-3bg1089y.js +0 -616
  407. package/dist/chunk-3d8ck5ne.js +0 -112
  408. package/dist/chunk-3g6rf9sz.js +0 -106
  409. package/dist/chunk-3x3rr2n5.js +0 -57
  410. package/dist/chunk-4f6q3d38.js +0 -117
  411. package/dist/chunk-4h57km3m.js +0 -74
  412. package/dist/chunk-4kyh2618.js +0 -99
  413. package/dist/chunk-4w9vc9vc.js +0 -119
  414. package/dist/chunk-53hqpp5z.js +0 -208
  415. package/dist/chunk-5m2rmc2k.js +0 -128
  416. package/dist/chunk-5wp9pkpt.js +0 -539
  417. package/dist/chunk-5ym9f6w3.js +0 -263
  418. package/dist/chunk-6f938733.js +0 -1027
  419. package/dist/chunk-6nenxecd.js +0 -115
  420. package/dist/chunk-6rja0h86.js +0 -1593
  421. package/dist/chunk-70q6dp4d.js +0 -96
  422. package/dist/chunk-7bn0wzs3.js +0 -1493
  423. package/dist/chunk-7e2e0bfm.js +0 -65
  424. package/dist/chunk-7ywadnax.js +0 -490
  425. package/dist/chunk-7z33j54s.js +0 -142
  426. package/dist/chunk-8yvfkzyh.js +0 -58
  427. package/dist/chunk-9abpx1kv.js +0 -2833
  428. package/dist/chunk-9ks2nswb.js +0 -114
  429. package/dist/chunk-9wrds5tr.js +0 -109
  430. package/dist/chunk-ab2twken.js +0 -102
  431. package/dist/chunk-abncjeag.js +0 -97
  432. package/dist/chunk-am6w4x6y.js +0 -103
  433. package/dist/chunk-b73bd7db.js +0 -496
  434. package/dist/chunk-bc7nvynh.js +0 -195
  435. package/dist/chunk-br17dhef.js +0 -103
  436. package/dist/chunk-c3k0sdey.js +0 -281
  437. package/dist/chunk-c909bmyv.js +0 -103
  438. package/dist/chunk-cftsv9w4.js +0 -129
  439. package/dist/chunk-cj1a7npk.js +0 -99
  440. package/dist/chunk-cyscs4k5.js +0 -1330
  441. package/dist/chunk-czr7y063.js +0 -348
  442. package/dist/chunk-d93sndem.js +0 -372
  443. package/dist/chunk-ddz8xbpd.js +0 -481
  444. package/dist/chunk-dkhqx4hk.js +0 -84
  445. package/dist/chunk-dsrharmv.js +0 -359
  446. package/dist/chunk-eqmy5d05.js +0 -56
  447. package/dist/chunk-f2crxw2c.js +0 -5400
  448. package/dist/chunk-f8zga40p.js +0 -234
  449. package/dist/chunk-fbgm2ym6.js +0 -990
  450. package/dist/chunk-fcbbsswe.js +0 -119
  451. package/dist/chunk-fda654nt.js +0 -6121
  452. package/dist/chunk-ffmv9ezj.js +0 -104
  453. package/dist/chunk-fmjte7md.js +0 -38
  454. package/dist/chunk-fqtwqxxc.js +0 -293
  455. package/dist/chunk-g8k85nkd.js +0 -802
  456. package/dist/chunk-ge4ak7dj.js +0 -127
  457. package/dist/chunk-gpqemecy.js +0 -126
  458. package/dist/chunk-h19p6s3b.js +0 -131
  459. package/dist/chunk-j0sk1rct.js +0 -998
  460. package/dist/chunk-j1wfpa1a.js +0 -70
  461. package/dist/chunk-j829fx31.js +0 -3458
  462. package/dist/chunk-jqctzrvd.js +0 -722
  463. package/dist/chunk-jx817w05.js +0 -11
  464. package/dist/chunk-ka6sab33.js +0 -174
  465. package/dist/chunk-krjsvmwp.js +0 -101
  466. package/dist/chunk-kvpe50pm.js +0 -311
  467. package/dist/chunk-mez504fj.js +0 -113
  468. package/dist/chunk-mj6wbrae.js +0 -105
  469. package/dist/chunk-n0pg2kpe.js +0 -122
  470. package/dist/chunk-n4qtqkp0.js +0 -295
  471. package/dist/chunk-n9meha2m.js +0 -73
  472. package/dist/chunk-ndk7q5n3.js +0 -169
  473. package/dist/chunk-ng6n9t4h.js +0 -56
  474. package/dist/chunk-p3pz13x2.js +0 -1933
  475. package/dist/chunk-p9ez6zgq.js +0 -2656
  476. package/dist/chunk-ph750kx1.js +0 -550
  477. package/dist/chunk-pxb99zqs.js +0 -117
  478. package/dist/chunk-q1yqc5n3.js +0 -100
  479. package/dist/chunk-qtfqk0jr.js +0 -131
  480. package/dist/chunk-qzfmdh1t.js +0 -388
  481. package/dist/chunk-r3cv0j9n.js +0 -456
  482. package/dist/chunk-rx0pbgym.js +0 -97
  483. package/dist/chunk-s624rd5j.js +0 -531
  484. package/dist/chunk-satndwqj.js +0 -285
  485. package/dist/chunk-ssrxnkd1.js +0 -109
  486. package/dist/chunk-t2pgctqx.js +0 -106
  487. package/dist/chunk-t7sgwf31.js +0 -644
  488. package/dist/chunk-tth904tj.js +0 -53
  489. package/dist/chunk-typpbjhy.js +0 -128
  490. package/dist/chunk-vp6nrhdq.js +0 -102
  491. package/dist/chunk-vtjm53nt.js +0 -432
  492. package/dist/chunk-w412n7tq.js +0 -469
  493. package/dist/chunk-w4153rky.js +0 -1885
  494. package/dist/chunk-wdgv15as.js +0 -212
  495. package/dist/chunk-wgn9kydv.js +0 -58
  496. package/dist/chunk-whknbrk0.js +0 -184
  497. package/dist/chunk-x1k8e1xc.js +0 -56
  498. package/dist/chunk-x45xx6sc.js +0 -105
  499. package/dist/chunk-x4xvqbe5.js +0 -1166
  500. package/dist/chunk-x8b7vft8.js +0 -132
  501. package/dist/chunk-xaycc8qe.js +0 -44
  502. package/dist/chunk-xd4785ks.js +0 -73
  503. package/dist/chunk-xjxgmxhq.js +0 -463
  504. package/dist/chunk-xx2x3tz9.js +0 -166
  505. package/dist/chunk-y2j23eem.js +0 -101
  506. package/dist/chunk-y83j09wv.js +0 -123
  507. package/dist/chunk-yh8460pb.js +0 -119
  508. package/dist/chunk-z6nhchdb.js +0 -60
  509. package/dist/chunk-zbt73sj7.js +0 -192
  510. package/dist/chunk-zmwaatmq.js +0 -118
  511. package/dist/chunk-zvdg9tex.js +0 -135
  512. package/dist/chunk-zwa780cx.js +0 -584
  513. package/dist/{chunk-whvdag1y.js → chunk-3bfs3x0h.js} +9 -9
  514. package/dist/{chunk-27xc1csx.js → chunk-dggvswz1.js} +3 -3
@@ -0,0 +1,2537 @@
1
+ // @bun
2
+ import {
3
+ ConfigurableShortcutHint,
4
+ OAuthService,
5
+ Select,
6
+ SelectMulti,
7
+ Spinner,
8
+ TextInput,
9
+ init_ConfigurableShortcutHint,
10
+ init_CustomSelect,
11
+ init_SelectMulti,
12
+ init_Spinner,
13
+ init_TextInput,
14
+ init_oauth,
15
+ init_useTerminalSize
16
+ } from "./chunk-cy6ezb6j.js";
17
+ import"./chunk-zejm280k.js";
18
+ import"./chunk-g1jarkx9.js";
19
+ import"./chunk-yyax4hdg.js";
20
+ import"./chunk-4nspekjp.js";
21
+ import"./chunk-kmhwx18d.js";
22
+ import"./chunk-var1et7e.js";
23
+ import"./chunk-2gzv8nrw.js";
24
+ import"./chunk-ehtwnxpg.js";
25
+ import"./chunk-dmxte86x.js";
26
+ import"./chunk-d6ve5pze.js";
27
+ import"./chunk-bxcfz5gy.js";
28
+ import"./chunk-dekbr08w.js";
29
+ import"./chunk-f6rbj3gz.js";
30
+ import"./chunk-9f14bkn9.js";
31
+ import"./chunk-cgfdkzhb.js";
32
+ import {
33
+ init_useExitOnCtrlCDWithKeybindings,
34
+ useExitOnCtrlCDWithKeybindings
35
+ } from "./chunk-k46gxg21.js";
36
+ import"./chunk-j5bth84e.js";
37
+ import"./chunk-8qhr4n77.js";
38
+ import"./chunk-az5x70pn.js";
39
+ import"./chunk-epyaq1z0.js";
40
+ import {
41
+ init_useKeybinding
42
+ } from "./chunk-0jzdwbdc.js";
43
+ import"./chunk-ps49ymvj.js";
44
+ import"./chunk-p7vkh4wx.js";
45
+ import"./chunk-cmcbatgz.js";
46
+ import"./chunk-agx5w9ce.js";
47
+ import"./chunk-48w0df8a.js";
48
+ import"./chunk-y78t50v0.js";
49
+ import"./chunk-4jm600zv.js";
50
+ import {
51
+ init_browser,
52
+ openBrowser
53
+ } from "./chunk-n8mpqdje.js";
54
+ import"./chunk-dqvwn28p.js";
55
+ import"./chunk-esn3tgm2.js";
56
+ import"./chunk-mx28h61f.js";
57
+ import"./chunk-dsbewdgm.js";
58
+ import"./chunk-sxqj7s2h.js";
59
+ import"./chunk-8201tnhf.js";
60
+ import"./chunk-2qwgfjcj.js";
61
+ import"./chunk-chsyvavm.js";
62
+ import"./chunk-w92b262y.js";
63
+ import {
64
+ getAnthropicApiKey,
65
+ init_auth,
66
+ init_config1 as init_config,
67
+ init_stringUtils,
68
+ isAnthropicAuthEnabled,
69
+ plural,
70
+ saveGlobalConfig,
71
+ saveOAuthTokensIfNeeded
72
+ } from "./chunk-c1k9tg7h.js";
73
+ import"./chunk-905d2hee.js";
74
+ import"./chunk-rkak3kjw.js";
75
+ import"./chunk-p2yv7m0g.js";
76
+ import"./chunk-1cwdhk7a.js";
77
+ import"./chunk-j9gxwbe3.js";
78
+ import"./chunk-64c1avct.js";
79
+ import"./chunk-6kpbgc5w.js";
80
+ import"./chunk-8g5pe1gr.js";
81
+ import"./chunk-hezj20qy.js";
82
+ import"./chunk-4cp6193g.js";
83
+ import"./chunk-8g747a8x.js";
84
+ import"./chunk-d7886r6a.js";
85
+ import"./chunk-f5ma3nh5.js";
86
+ import"./chunk-qz2x630m.js";
87
+ import"./chunk-dk8287aa.js";
88
+ import"./chunk-r2k2jy0y.js";
89
+ import"./chunk-3c25bcsw.js";
90
+ import"./chunk-2q39ej51.js";
91
+ import"./chunk-q82r31er.js";
92
+ import"./chunk-p2816w9z.js";
93
+ import"./chunk-v9smspw2.js";
94
+ import"./chunk-v1kzp02e.js";
95
+ import"./chunk-qpzfmkct.js";
96
+ import"./chunk-crmjpsqe.js";
97
+ import {
98
+ Byline,
99
+ Dialog,
100
+ KeyboardShortcutHint,
101
+ Link,
102
+ ThemedBox_default,
103
+ ThemedText,
104
+ color,
105
+ init_src,
106
+ setClipboard,
107
+ useKeybinding,
108
+ useKeybindings,
109
+ useTerminalSize,
110
+ useTheme
111
+ } from "./chunk-rvkvehat.js";
112
+ import {
113
+ require_jsx_dev_runtime,
114
+ require_react
115
+ } from "./chunk-g338npwr.js";
116
+ import {
117
+ init_analytics,
118
+ logEvent
119
+ } from "./chunk-h0rbjg6x.js";
120
+ import"./chunk-0vkfrmqm.js";
121
+ import"./chunk-0xjaqda8.js";
122
+ import"./chunk-21z7acxh.js";
123
+ import {
124
+ getGithubRepo,
125
+ init_git
126
+ } from "./chunk-rgbbtszq.js";
127
+ import"./chunk-1thgdca1.js";
128
+ import"./chunk-qnfx3qtx.js";
129
+ import {
130
+ execFileNoThrow,
131
+ init_execFileNoThrow
132
+ } from "./chunk-yw79dz62.js";
133
+ import"./chunk-b81hd3m6.js";
134
+ import {
135
+ init_log,
136
+ logError
137
+ } from "./chunk-61ahbn23.js";
138
+ import"./chunk-8tnsngw2.js";
139
+ import"./chunk-edzkkadh.js";
140
+ import"./chunk-bwg7582d.js";
141
+ import {
142
+ execa,
143
+ init_execa
144
+ } from "./chunk-5z28bqne.js";
145
+ import {
146
+ figures_default,
147
+ init_figures
148
+ } from "./chunk-qajrkk97.js";
149
+ import"./chunk-hcgkak1j.js";
150
+ import"./chunk-fbv4apne.js";
151
+ import"./chunk-z6e5jp2w.js";
152
+ import"./chunk-jaaxk89e.js";
153
+ import"./chunk-h4b85amj.js";
154
+ import"./chunk-07069jq1.js";
155
+ import"./chunk-vf612n57.js";
156
+ import"./chunk-d4mdda98.js";
157
+ import"./chunk-7wm5s02e.js";
158
+ import"./chunk-4g3v8y12.js";
159
+ import"./chunk-7739pg2c.js";
160
+ import"./chunk-nh3cd07f.js";
161
+ import"./chunk-8pn8tvgg.js";
162
+ import"./chunk-netzwgv1.js";
163
+ import {
164
+ __esm,
165
+ __toESM
166
+ } from "./chunk-qp2qdcda.js";
167
+
168
+ // src/components/WorkflowMultiselectDialog.tsx
169
+ function renderInputGuide(exitState) {
170
+ if (exitState.pending) {
171
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
172
+ children: [
173
+ "Press ",
174
+ exitState.keyName,
175
+ " again to exit"
176
+ ]
177
+ }, undefined, true, undefined, this);
178
+ }
179
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Byline, {
180
+ children: [
181
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(KeyboardShortcutHint, {
182
+ shortcut: "\u2191\u2193",
183
+ action: "navigate"
184
+ }, undefined, false, undefined, this),
185
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(KeyboardShortcutHint, {
186
+ shortcut: "Space",
187
+ action: "toggle"
188
+ }, undefined, false, undefined, this),
189
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(KeyboardShortcutHint, {
190
+ shortcut: "Enter",
191
+ action: "confirm"
192
+ }, undefined, false, undefined, this),
193
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ConfigurableShortcutHint, {
194
+ action: "confirm:no",
195
+ context: "Confirmation",
196
+ fallback: "Esc",
197
+ description: "cancel"
198
+ }, undefined, false, undefined, this)
199
+ ]
200
+ }, undefined, true, undefined, this);
201
+ }
202
+ function WorkflowMultiselectDialog({
203
+ onSubmit,
204
+ defaultSelections
205
+ }) {
206
+ const [showError, setShowError] = import_react.useState(false);
207
+ const handleSubmit = import_react.useCallback((selectedValues) => {
208
+ if (selectedValues.length === 0) {
209
+ setShowError(true);
210
+ return;
211
+ }
212
+ setShowError(false);
213
+ onSubmit(selectedValues);
214
+ }, [onSubmit]);
215
+ const handleChange = import_react.useCallback(() => {
216
+ setShowError(false);
217
+ }, []);
218
+ const handleCancel = import_react.useCallback(() => {
219
+ setShowError(true);
220
+ }, []);
221
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Dialog, {
222
+ title: "Select GitHub workflows to install",
223
+ subtitle: "We'll create a workflow file in your repository for each one you select.",
224
+ onCancel: handleCancel,
225
+ inputGuide: renderInputGuide,
226
+ children: [
227
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedBox_default, {
228
+ children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
229
+ dimColor: true,
230
+ children: [
231
+ "More workflow examples (issue triage, CI fixes, etc.) at:",
232
+ " ",
233
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Link, {
234
+ url: "https://github.com/anthropics/claude-code-action/blob/main/examples/",
235
+ children: "https://github.com/anthropics/claude-code-action/blob/main/examples/"
236
+ }, undefined, false, undefined, this)
237
+ ]
238
+ }, undefined, true, undefined, this)
239
+ }, undefined, false, undefined, this),
240
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(SelectMulti, {
241
+ options: WORKFLOWS.map((workflow) => ({
242
+ label: workflow.label,
243
+ value: workflow.value
244
+ })),
245
+ defaultValue: defaultSelections,
246
+ onSubmit: handleSubmit,
247
+ onChange: handleChange,
248
+ onCancel: handleCancel,
249
+ hideIndexes: true
250
+ }, undefined, false, undefined, this),
251
+ showError && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedBox_default, {
252
+ children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
253
+ color: "error",
254
+ children: "You must select at least one workflow to continue"
255
+ }, undefined, false, undefined, this)
256
+ }, undefined, false, undefined, this)
257
+ ]
258
+ }, undefined, true, undefined, this);
259
+ }
260
+ var import_react, jsx_dev_runtime, WORKFLOWS;
261
+ var init_WorkflowMultiselectDialog = __esm(() => {
262
+ init_src();
263
+ init_ConfigurableShortcutHint();
264
+ init_SelectMulti();
265
+ import_react = __toESM(require_react(), 1);
266
+ jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
267
+ WORKFLOWS = [
268
+ {
269
+ value: "claude",
270
+ label: "@Claude Code - Tag @claude in issues and PR comments"
271
+ },
272
+ {
273
+ value: "claude-review",
274
+ label: "Claude Code Review - Automated code review on new PRs"
275
+ }
276
+ ];
277
+ });
278
+
279
+ // src/constants/github-app.ts
280
+ var PR_TITLE = "Add Claude Code GitHub Workflow", GITHUB_ACTION_SETUP_DOCS_URL = "https://github.com/anthropics/claude-code-action/blob/main/docs/setup.md", WORKFLOW_CONTENT = `name: Claude Code
281
+
282
+ on:
283
+ issue_comment:
284
+ types: [created]
285
+ pull_request_review_comment:
286
+ types: [created]
287
+ issues:
288
+ types: [opened, assigned]
289
+ pull_request_review:
290
+ types: [submitted]
291
+
292
+ jobs:
293
+ claude:
294
+ if: |
295
+ (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
296
+ (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
297
+ (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
298
+ (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
299
+ runs-on: ubuntu-latest
300
+ permissions:
301
+ contents: read
302
+ pull-requests: read
303
+ issues: read
304
+ id-token: write
305
+ actions: read # Required for Claude to read CI results on PRs
306
+ steps:
307
+ - name: Checkout repository
308
+ uses: actions/checkout@v4
309
+ with:
310
+ fetch-depth: 1
311
+
312
+ - name: Run Claude Code
313
+ id: claude
314
+ uses: anthropics/claude-code-action@v1
315
+ with:
316
+ anthropic_api_key: \${{ secrets.ANTHROPIC_API_KEY }}
317
+
318
+ # This is an optional setting that allows Claude to read CI results on PRs
319
+ additional_permissions: |
320
+ actions: read
321
+
322
+ # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
323
+ # prompt: 'Update the pull request description to include a summary of changes.'
324
+
325
+ # Optional: Add claude_args to customize behavior and configuration
326
+ # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
327
+ # or https://code.claude.com/docs/en/cli-reference for available options
328
+ # claude_args: '--allowed-tools Bash(gh pr:*)'
329
+
330
+ `, PR_BODY = `## \uD83E\uDD16 Installing Claude Code GitHub App
331
+
332
+ This PR adds a GitHub Actions workflow that enables Claude Code integration in our repository.
333
+
334
+ ### What is Claude Code?
335
+
336
+ [Claude Code](https://claude.com/claude-code) is an AI coding agent that can help with:
337
+ - Bug fixes and improvements
338
+ - Documentation updates
339
+ - Implementing new features
340
+ - Code reviews and suggestions
341
+ - Writing tests
342
+ - And more!
343
+
344
+ ### How it works
345
+
346
+ Once this PR is merged, we'll be able to interact with Claude by mentioning @claude in a pull request or issue comment.
347
+ Once the workflow is triggered, Claude will analyze the comment and surrounding context, and execute on the request in a GitHub action.
348
+
349
+ ### Important Notes
350
+
351
+ - **This workflow won't take effect until this PR is merged**
352
+ - **@claude mentions won't work until after the merge is complete**
353
+ - The workflow runs automatically whenever Claude is mentioned in PR or issue comments
354
+ - Claude gets access to the entire PR or issue context including files, diffs, and previous comments
355
+
356
+ ### Security
357
+
358
+ - Our Anthropic API key is securely stored as a GitHub Actions secret
359
+ - Only users with write access to the repository can trigger the workflow
360
+ - All Claude runs are stored in the GitHub Actions run history
361
+ - Claude's default tools are limited to reading/writing files and interacting with our repo by creating comments, branches, and commits.
362
+ - We can add more allowed tools by adding them to the workflow file like:
363
+
364
+ \`\`\`
365
+ allowed_tools: Bash(npm install),Bash(npm run build),Bash(npm run lint),Bash(npm run test)
366
+ \`\`\`
367
+
368
+ There's more information in the [Claude Code action repo](https://github.com/anthropics/claude-code-action).
369
+
370
+ After merging this PR, let's try mentioning @claude in a comment on any PR to get started!`, CODE_REVIEW_PLUGIN_WORKFLOW_CONTENT = `name: Claude Code Review
371
+
372
+ on:
373
+ pull_request:
374
+ types: [opened, synchronize, ready_for_review, reopened]
375
+ # Optional: Only run on specific file changes
376
+ # paths:
377
+ # - "src/**/*.ts"
378
+ # - "src/**/*.tsx"
379
+ # - "src/**/*.js"
380
+ # - "src/**/*.jsx"
381
+
382
+ jobs:
383
+ claude-review:
384
+ # Optional: Filter by PR author
385
+ # if: |
386
+ # github.event.pull_request.user.login == 'external-contributor' ||
387
+ # github.event.pull_request.user.login == 'new-developer' ||
388
+ # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
389
+
390
+ runs-on: ubuntu-latest
391
+ permissions:
392
+ contents: read
393
+ pull-requests: read
394
+ issues: read
395
+ id-token: write
396
+
397
+ steps:
398
+ - name: Checkout repository
399
+ uses: actions/checkout@v4
400
+ with:
401
+ fetch-depth: 1
402
+
403
+ - name: Run Claude Code Review
404
+ id: claude-review
405
+ uses: anthropics/claude-code-action@v1
406
+ with:
407
+ anthropic_api_key: \${{ secrets.ANTHROPIC_API_KEY }}
408
+ plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
409
+ plugins: 'code-review@claude-code-plugins'
410
+ prompt: '/code-review:code-review \${{ github.repository }}/pull/\${{ github.event.pull_request.number }}'
411
+ # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
412
+ # or https://code.claude.com/docs/en/cli-reference for available options
413
+
414
+ `;
415
+ var init_github_app = () => {};
416
+
417
+ // src/commands/install-github-app/ApiKeyStep.tsx
418
+ function ApiKeyStep({
419
+ existingApiKey,
420
+ apiKeyOrOAuthToken,
421
+ onApiKeyChange,
422
+ onSubmit,
423
+ onToggleUseExistingKey,
424
+ onCreateOAuthToken,
425
+ selectedOption = existingApiKey ? "existing" : onCreateOAuthToken ? "oauth" : "new",
426
+ onSelectOption
427
+ }) {
428
+ const [cursorOffset, setCursorOffset] = import_react2.useState(0);
429
+ const terminalSize = useTerminalSize();
430
+ const [theme] = useTheme();
431
+ const handlePrevious = import_react2.useCallback(() => {
432
+ if (selectedOption === "new" && onCreateOAuthToken) {
433
+ onSelectOption?.("oauth");
434
+ } else if (selectedOption === "oauth" && existingApiKey) {
435
+ onSelectOption?.("existing");
436
+ onToggleUseExistingKey(true);
437
+ }
438
+ }, [
439
+ selectedOption,
440
+ onCreateOAuthToken,
441
+ existingApiKey,
442
+ onSelectOption,
443
+ onToggleUseExistingKey
444
+ ]);
445
+ const handleNext = import_react2.useCallback(() => {
446
+ if (selectedOption === "existing") {
447
+ onSelectOption?.(onCreateOAuthToken ? "oauth" : "new");
448
+ onToggleUseExistingKey(false);
449
+ } else if (selectedOption === "oauth") {
450
+ onSelectOption?.("new");
451
+ }
452
+ }, [
453
+ selectedOption,
454
+ onCreateOAuthToken,
455
+ onSelectOption,
456
+ onToggleUseExistingKey
457
+ ]);
458
+ const handleConfirm = import_react2.useCallback(() => {
459
+ if (selectedOption === "oauth" && onCreateOAuthToken) {
460
+ onCreateOAuthToken();
461
+ } else {
462
+ onSubmit();
463
+ }
464
+ }, [selectedOption, onCreateOAuthToken, onSubmit]);
465
+ const isTextInputVisible = selectedOption === "new";
466
+ useKeybindings({
467
+ "confirm:previous": handlePrevious,
468
+ "confirm:next": handleNext,
469
+ "confirm:yes": handleConfirm
470
+ }, { context: "Confirmation", isActive: !isTextInputVisible });
471
+ useKeybindings({
472
+ "confirm:previous": handlePrevious,
473
+ "confirm:next": handleNext
474
+ }, { context: "Confirmation", isActive: isTextInputVisible });
475
+ return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(jsx_dev_runtime2.Fragment, {
476
+ children: [
477
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
478
+ flexDirection: "column",
479
+ borderStyle: "round",
480
+ paddingX: 1,
481
+ children: [
482
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
483
+ flexDirection: "column",
484
+ marginBottom: 1,
485
+ children: [
486
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
487
+ bold: true,
488
+ children: "Install GitHub App"
489
+ }, undefined, false, undefined, this),
490
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
491
+ dimColor: true,
492
+ children: "Choose API key"
493
+ }, undefined, false, undefined, this)
494
+ ]
495
+ }, undefined, true, undefined, this),
496
+ existingApiKey && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
497
+ marginBottom: 1,
498
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
499
+ children: [
500
+ selectedOption === "existing" ? color("success", theme)("> ") : " ",
501
+ "Use your existing Claude Code API key"
502
+ ]
503
+ }, undefined, true, undefined, this)
504
+ }, undefined, false, undefined, this),
505
+ onCreateOAuthToken && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
506
+ marginBottom: 1,
507
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
508
+ children: [
509
+ selectedOption === "oauth" ? color("success", theme)("> ") : " ",
510
+ "Create a long-lived token with your Claude subscription"
511
+ ]
512
+ }, undefined, true, undefined, this)
513
+ }, undefined, false, undefined, this),
514
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
515
+ marginBottom: 1,
516
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
517
+ children: [
518
+ selectedOption === "new" ? color("success", theme)("> ") : " ",
519
+ "Enter a new API key"
520
+ ]
521
+ }, undefined, true, undefined, this)
522
+ }, undefined, false, undefined, this),
523
+ selectedOption === "new" && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(TextInput, {
524
+ value: apiKeyOrOAuthToken,
525
+ onChange: onApiKeyChange,
526
+ onSubmit,
527
+ onPaste: onApiKeyChange,
528
+ focus: true,
529
+ placeholder: "sk-ant\u2026 (Create a new key at https://platform.claude.com/settings/keys)",
530
+ mask: "*",
531
+ columns: terminalSize.columns,
532
+ cursorOffset,
533
+ onChangeCursorOffset: setCursorOffset,
534
+ showCursor: true
535
+ }, undefined, false, undefined, this)
536
+ ]
537
+ }, undefined, true, undefined, this),
538
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
539
+ marginLeft: 3,
540
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
541
+ dimColor: true,
542
+ children: "\u2191/\u2193 to select \xB7 Enter to continue"
543
+ }, undefined, false, undefined, this)
544
+ }, undefined, false, undefined, this)
545
+ ]
546
+ }, undefined, true, undefined, this);
547
+ }
548
+ var import_react2, jsx_dev_runtime2;
549
+ var init_ApiKeyStep = __esm(() => {
550
+ init_TextInput();
551
+ init_useTerminalSize();
552
+ init_src();
553
+ init_useKeybinding();
554
+ import_react2 = __toESM(require_react(), 1);
555
+ jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
556
+ });
557
+
558
+ // src/commands/install-github-app/CheckExistingSecretStep.tsx
559
+ function CheckExistingSecretStep({
560
+ useExistingSecret,
561
+ secretName,
562
+ onToggleUseExistingSecret,
563
+ onSecretNameChange,
564
+ onSubmit
565
+ }) {
566
+ const [cursorOffset, setCursorOffset] = import_react3.useState(0);
567
+ const terminalSize = useTerminalSize();
568
+ const [theme] = useTheme();
569
+ const handlePrevious = import_react3.useCallback(() => onToggleUseExistingSecret(true), [onToggleUseExistingSecret]);
570
+ const handleNext = import_react3.useCallback(() => onToggleUseExistingSecret(false), [onToggleUseExistingSecret]);
571
+ useKeybindings({
572
+ "confirm:previous": handlePrevious,
573
+ "confirm:next": handleNext,
574
+ "confirm:yes": onSubmit
575
+ }, { context: "Confirmation", isActive: useExistingSecret });
576
+ useKeybindings({
577
+ "confirm:previous": handlePrevious,
578
+ "confirm:next": handleNext
579
+ }, { context: "Confirmation", isActive: !useExistingSecret });
580
+ return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(jsx_dev_runtime3.Fragment, {
581
+ children: [
582
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
583
+ flexDirection: "column",
584
+ borderStyle: "round",
585
+ paddingX: 1,
586
+ children: [
587
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
588
+ flexDirection: "column",
589
+ marginBottom: 1,
590
+ children: [
591
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
592
+ bold: true,
593
+ children: "Install GitHub App"
594
+ }, undefined, false, undefined, this),
595
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
596
+ dimColor: true,
597
+ children: "Setup API key secret"
598
+ }, undefined, false, undefined, this)
599
+ ]
600
+ }, undefined, true, undefined, this),
601
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
602
+ marginBottom: 1,
603
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
604
+ color: "warning",
605
+ children: "ANTHROPIC_API_KEY already exists in repository secrets!"
606
+ }, undefined, false, undefined, this)
607
+ }, undefined, false, undefined, this),
608
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
609
+ marginBottom: 1,
610
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
611
+ children: "Would you like to:"
612
+ }, undefined, false, undefined, this)
613
+ }, undefined, false, undefined, this),
614
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
615
+ marginBottom: 1,
616
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
617
+ children: [
618
+ useExistingSecret ? color("success", theme)("> ") : " ",
619
+ "Use the existing API key"
620
+ ]
621
+ }, undefined, true, undefined, this)
622
+ }, undefined, false, undefined, this),
623
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
624
+ marginBottom: 1,
625
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
626
+ children: [
627
+ !useExistingSecret ? color("success", theme)("> ") : " ",
628
+ "Create a new secret with a different name"
629
+ ]
630
+ }, undefined, true, undefined, this)
631
+ }, undefined, false, undefined, this),
632
+ !useExistingSecret && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(jsx_dev_runtime3.Fragment, {
633
+ children: [
634
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
635
+ marginBottom: 1,
636
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
637
+ children: "Enter new secret name (alphanumeric with underscores):"
638
+ }, undefined, false, undefined, this)
639
+ }, undefined, false, undefined, this),
640
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(TextInput, {
641
+ value: secretName,
642
+ onChange: onSecretNameChange,
643
+ onSubmit,
644
+ focus: true,
645
+ placeholder: "e.g., CLAUDE_API_KEY",
646
+ columns: terminalSize.columns,
647
+ cursorOffset,
648
+ onChangeCursorOffset: setCursorOffset,
649
+ showCursor: true
650
+ }, undefined, false, undefined, this)
651
+ ]
652
+ }, undefined, true, undefined, this)
653
+ ]
654
+ }, undefined, true, undefined, this),
655
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
656
+ marginLeft: 3,
657
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
658
+ dimColor: true,
659
+ children: "\u2191/\u2193 to select \xB7 Enter to continue"
660
+ }, undefined, false, undefined, this)
661
+ }, undefined, false, undefined, this)
662
+ ]
663
+ }, undefined, true, undefined, this);
664
+ }
665
+ var import_react3, jsx_dev_runtime3;
666
+ var init_CheckExistingSecretStep = __esm(() => {
667
+ init_TextInput();
668
+ init_useTerminalSize();
669
+ init_src();
670
+ init_useKeybinding();
671
+ import_react3 = __toESM(require_react(), 1);
672
+ jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
673
+ });
674
+
675
+ // src/commands/install-github-app/CheckGitHubStep.tsx
676
+ function CheckGitHubStep() {
677
+ return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedText, {
678
+ children: "Checking GitHub CLI installation\u2026"
679
+ }, undefined, false, undefined, this);
680
+ }
681
+ var jsx_dev_runtime4;
682
+ var init_CheckGitHubStep = __esm(() => {
683
+ init_src();
684
+ jsx_dev_runtime4 = __toESM(require_jsx_dev_runtime(), 1);
685
+ });
686
+
687
+ // src/commands/install-github-app/ChooseRepoStep.tsx
688
+ function ChooseRepoStep({
689
+ currentRepo,
690
+ useCurrentRepo,
691
+ repoUrl,
692
+ onRepoUrlChange,
693
+ onSubmit,
694
+ onToggleUseCurrentRepo
695
+ }) {
696
+ const [cursorOffset, setCursorOffset] = import_react4.useState(0);
697
+ const [showEmptyError, setShowEmptyError] = import_react4.useState(false);
698
+ const terminalSize = useTerminalSize();
699
+ const textInputColumns = terminalSize.columns;
700
+ const handleSubmit = import_react4.useCallback(() => {
701
+ const repoName = useCurrentRepo ? currentRepo : repoUrl;
702
+ if (!repoName?.trim()) {
703
+ setShowEmptyError(true);
704
+ return;
705
+ }
706
+ onSubmit();
707
+ }, [useCurrentRepo, currentRepo, repoUrl, onSubmit]);
708
+ const isTextInputVisible = !useCurrentRepo || !currentRepo;
709
+ const handlePrevious = import_react4.useCallback(() => {
710
+ onToggleUseCurrentRepo(true);
711
+ setShowEmptyError(false);
712
+ }, [onToggleUseCurrentRepo]);
713
+ const handleNext = import_react4.useCallback(() => {
714
+ onToggleUseCurrentRepo(false);
715
+ setShowEmptyError(false);
716
+ }, [onToggleUseCurrentRepo]);
717
+ useKeybindings({
718
+ "confirm:previous": handlePrevious,
719
+ "confirm:next": handleNext,
720
+ "confirm:yes": handleSubmit
721
+ }, { context: "Confirmation", isActive: !isTextInputVisible });
722
+ useKeybindings({
723
+ "confirm:previous": handlePrevious,
724
+ "confirm:next": handleNext
725
+ }, { context: "Confirmation", isActive: isTextInputVisible });
726
+ return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(jsx_dev_runtime5.Fragment, {
727
+ children: [
728
+ /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
729
+ flexDirection: "column",
730
+ borderStyle: "round",
731
+ paddingX: 1,
732
+ children: [
733
+ /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
734
+ flexDirection: "column",
735
+ marginBottom: 1,
736
+ children: [
737
+ /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
738
+ bold: true,
739
+ children: "Install GitHub App"
740
+ }, undefined, false, undefined, this),
741
+ /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
742
+ dimColor: true,
743
+ children: "Select GitHub repository"
744
+ }, undefined, false, undefined, this)
745
+ ]
746
+ }, undefined, true, undefined, this),
747
+ currentRepo && /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
748
+ marginBottom: 1,
749
+ children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
750
+ bold: useCurrentRepo,
751
+ color: useCurrentRepo ? "permission" : undefined,
752
+ children: [
753
+ useCurrentRepo ? "> " : " ",
754
+ "Use current repository: ",
755
+ currentRepo
756
+ ]
757
+ }, undefined, true, undefined, this)
758
+ }, undefined, false, undefined, this),
759
+ /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
760
+ marginBottom: 1,
761
+ children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
762
+ bold: !useCurrentRepo || !currentRepo,
763
+ color: !useCurrentRepo || !currentRepo ? "permission" : undefined,
764
+ children: [
765
+ !useCurrentRepo || !currentRepo ? "> " : " ",
766
+ currentRepo ? "Enter a different repository" : "Enter repository"
767
+ ]
768
+ }, undefined, true, undefined, this)
769
+ }, undefined, false, undefined, this),
770
+ (!useCurrentRepo || !currentRepo) && /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
771
+ marginLeft: 2,
772
+ marginBottom: 1,
773
+ children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(TextInput, {
774
+ value: repoUrl,
775
+ onChange: (value) => {
776
+ onRepoUrlChange(value);
777
+ setShowEmptyError(false);
778
+ },
779
+ onSubmit: handleSubmit,
780
+ focus: true,
781
+ placeholder: "Enter a repo as owner/repo or https://github.com/owner/repo\u2026",
782
+ columns: textInputColumns,
783
+ cursorOffset,
784
+ onChangeCursorOffset: setCursorOffset,
785
+ showCursor: true
786
+ }, undefined, false, undefined, this)
787
+ }, undefined, false, undefined, this)
788
+ ]
789
+ }, undefined, true, undefined, this),
790
+ showEmptyError && /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
791
+ marginLeft: 3,
792
+ marginBottom: 1,
793
+ children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
794
+ color: "error",
795
+ children: "Please enter a repository name to continue"
796
+ }, undefined, false, undefined, this)
797
+ }, undefined, false, undefined, this),
798
+ /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
799
+ marginLeft: 3,
800
+ children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
801
+ dimColor: true,
802
+ children: [
803
+ currentRepo ? "\u2191/\u2193 to select \xB7 " : "",
804
+ "Enter to continue"
805
+ ]
806
+ }, undefined, true, undefined, this)
807
+ }, undefined, false, undefined, this)
808
+ ]
809
+ }, undefined, true, undefined, this);
810
+ }
811
+ var import_react4, jsx_dev_runtime5;
812
+ var init_ChooseRepoStep = __esm(() => {
813
+ init_TextInput();
814
+ init_useTerminalSize();
815
+ init_src();
816
+ init_useKeybinding();
817
+ import_react4 = __toESM(require_react(), 1);
818
+ jsx_dev_runtime5 = __toESM(require_jsx_dev_runtime(), 1);
819
+ });
820
+
821
+ // src/commands/install-github-app/CreatingStep.tsx
822
+ function CreatingStep({
823
+ currentWorkflowInstallStep,
824
+ secretExists,
825
+ useExistingSecret,
826
+ secretName,
827
+ skipWorkflow = false,
828
+ selectedWorkflows
829
+ }) {
830
+ const progressSteps = skipWorkflow ? [
831
+ "Getting repository information",
832
+ secretExists && useExistingSecret ? "Using existing API key secret" : `Setting up ${secretName} secret`
833
+ ] : [
834
+ "Getting repository information",
835
+ "Creating branch",
836
+ selectedWorkflows.length > 1 ? "Creating workflow files" : "Creating workflow file",
837
+ secretExists && useExistingSecret ? "Using existing API key secret" : `Setting up ${secretName} secret`,
838
+ "Opening pull request page"
839
+ ];
840
+ return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(jsx_dev_runtime6.Fragment, {
841
+ children: /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedBox_default, {
842
+ flexDirection: "column",
843
+ borderStyle: "round",
844
+ paddingX: 1,
845
+ children: [
846
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedBox_default, {
847
+ flexDirection: "column",
848
+ marginBottom: 1,
849
+ children: [
850
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedText, {
851
+ bold: true,
852
+ children: "Install GitHub App"
853
+ }, undefined, false, undefined, this),
854
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedText, {
855
+ dimColor: true,
856
+ children: "Create GitHub Actions workflow"
857
+ }, undefined, false, undefined, this)
858
+ ]
859
+ }, undefined, true, undefined, this),
860
+ progressSteps.map((stepText, index) => {
861
+ let status = "pending";
862
+ if (index < currentWorkflowInstallStep) {
863
+ status = "completed";
864
+ } else if (index === currentWorkflowInstallStep) {
865
+ status = "in-progress";
866
+ }
867
+ return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedBox_default, {
868
+ children: /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedText, {
869
+ color: status === "completed" ? "success" : status === "in-progress" ? "warning" : undefined,
870
+ children: [
871
+ status === "completed" ? "\u2713 " : "",
872
+ stepText,
873
+ status === "in-progress" ? "\u2026" : ""
874
+ ]
875
+ }, undefined, true, undefined, this)
876
+ }, index, false, undefined, this);
877
+ })
878
+ ]
879
+ }, undefined, true, undefined, this)
880
+ }, undefined, false, undefined, this);
881
+ }
882
+ var jsx_dev_runtime6;
883
+ var init_CreatingStep = __esm(() => {
884
+ init_src();
885
+ jsx_dev_runtime6 = __toESM(require_jsx_dev_runtime(), 1);
886
+ });
887
+
888
+ // src/commands/install-github-app/ErrorStep.tsx
889
+ function ErrorStep({
890
+ error,
891
+ errorReason,
892
+ errorInstructions
893
+ }) {
894
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
895
+ children: [
896
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
897
+ flexDirection: "column",
898
+ borderStyle: "round",
899
+ paddingX: 1,
900
+ children: [
901
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
902
+ flexDirection: "column",
903
+ marginBottom: 1,
904
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
905
+ bold: true,
906
+ children: "Install GitHub App"
907
+ }, undefined, false, undefined, this)
908
+ }, undefined, false, undefined, this),
909
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
910
+ color: "error",
911
+ children: [
912
+ "Error: ",
913
+ error
914
+ ]
915
+ }, undefined, true, undefined, this),
916
+ errorReason && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
917
+ marginTop: 1,
918
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
919
+ dimColor: true,
920
+ children: [
921
+ "Reason: ",
922
+ errorReason
923
+ ]
924
+ }, undefined, true, undefined, this)
925
+ }, undefined, false, undefined, this),
926
+ errorInstructions && errorInstructions.length > 0 && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
927
+ flexDirection: "column",
928
+ marginTop: 1,
929
+ children: [
930
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
931
+ dimColor: true,
932
+ children: "How to fix:"
933
+ }, undefined, false, undefined, this),
934
+ errorInstructions.map((instruction, index) => /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
935
+ marginLeft: 2,
936
+ children: [
937
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
938
+ dimColor: true,
939
+ children: "\u2022 "
940
+ }, undefined, false, undefined, this),
941
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
942
+ children: instruction
943
+ }, undefined, false, undefined, this)
944
+ ]
945
+ }, index, true, undefined, this))
946
+ ]
947
+ }, undefined, true, undefined, this),
948
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
949
+ marginTop: 1,
950
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
951
+ dimColor: true,
952
+ children: [
953
+ "For manual setup instructions, see:",
954
+ " ",
955
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
956
+ color: "claude",
957
+ children: GITHUB_ACTION_SETUP_DOCS_URL
958
+ }, undefined, false, undefined, this)
959
+ ]
960
+ }, undefined, true, undefined, this)
961
+ }, undefined, false, undefined, this)
962
+ ]
963
+ }, undefined, true, undefined, this),
964
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
965
+ marginLeft: 3,
966
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
967
+ dimColor: true,
968
+ children: "Press any key to exit"
969
+ }, undefined, false, undefined, this)
970
+ }, undefined, false, undefined, this)
971
+ ]
972
+ }, undefined, true, undefined, this);
973
+ }
974
+ var jsx_dev_runtime7;
975
+ var init_ErrorStep = __esm(() => {
976
+ init_github_app();
977
+ init_src();
978
+ jsx_dev_runtime7 = __toESM(require_jsx_dev_runtime(), 1);
979
+ });
980
+
981
+ // src/commands/install-github-app/ExistingWorkflowStep.tsx
982
+ function ExistingWorkflowStep({
983
+ repoName,
984
+ onSelectAction
985
+ }) {
986
+ const options = [
987
+ {
988
+ label: "Update workflow file with latest version",
989
+ value: "update"
990
+ },
991
+ {
992
+ label: "Skip workflow update (configure secrets only)",
993
+ value: "skip"
994
+ },
995
+ {
996
+ label: "Exit without making changes",
997
+ value: "exit"
998
+ }
999
+ ];
1000
+ const handleSelect = (value) => {
1001
+ onSelectAction(value);
1002
+ };
1003
+ const handleCancel = () => {
1004
+ onSelectAction("exit");
1005
+ };
1006
+ return /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedBox_default, {
1007
+ flexDirection: "column",
1008
+ borderStyle: "round",
1009
+ borderDimColor: true,
1010
+ paddingX: 1,
1011
+ children: [
1012
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedBox_default, {
1013
+ flexDirection: "column",
1014
+ marginBottom: 1,
1015
+ children: [
1016
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1017
+ bold: true,
1018
+ children: "Existing Workflow Found"
1019
+ }, undefined, false, undefined, this),
1020
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1021
+ dimColor: true,
1022
+ children: [
1023
+ "Repository: ",
1024
+ repoName
1025
+ ]
1026
+ }, undefined, true, undefined, this)
1027
+ ]
1028
+ }, undefined, true, undefined, this),
1029
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedBox_default, {
1030
+ flexDirection: "column",
1031
+ marginBottom: 1,
1032
+ children: [
1033
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1034
+ children: [
1035
+ "A Claude workflow file already exists at",
1036
+ " ",
1037
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1038
+ color: "claude",
1039
+ children: ".github/workflows/claude.yml"
1040
+ }, undefined, false, undefined, this)
1041
+ ]
1042
+ }, undefined, true, undefined, this),
1043
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1044
+ dimColor: true,
1045
+ children: "What would you like to do?"
1046
+ }, undefined, false, undefined, this)
1047
+ ]
1048
+ }, undefined, true, undefined, this),
1049
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedBox_default, {
1050
+ flexDirection: "column",
1051
+ children: /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Select, {
1052
+ options,
1053
+ onChange: handleSelect,
1054
+ onCancel: handleCancel
1055
+ }, undefined, false, undefined, this)
1056
+ }, undefined, false, undefined, this),
1057
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedBox_default, {
1058
+ marginTop: 1,
1059
+ children: /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1060
+ dimColor: true,
1061
+ children: [
1062
+ "View the latest workflow template at:",
1063
+ " ",
1064
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1065
+ color: "claude",
1066
+ children: "https://github.com/anthropics/claude-code-action/blob/main/examples/claude.yml"
1067
+ }, undefined, false, undefined, this)
1068
+ ]
1069
+ }, undefined, true, undefined, this)
1070
+ }, undefined, false, undefined, this)
1071
+ ]
1072
+ }, undefined, true, undefined, this);
1073
+ }
1074
+ var jsx_dev_runtime8;
1075
+ var init_ExistingWorkflowStep = __esm(() => {
1076
+ init_CustomSelect();
1077
+ init_src();
1078
+ jsx_dev_runtime8 = __toESM(require_jsx_dev_runtime(), 1);
1079
+ });
1080
+
1081
+ // src/commands/install-github-app/InstallAppStep.tsx
1082
+ function InstallAppStep({ repoUrl, onSubmit }) {
1083
+ useKeybinding("confirm:yes", onSubmit, { context: "Confirmation" });
1084
+ return /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1085
+ flexDirection: "column",
1086
+ borderStyle: "round",
1087
+ borderDimColor: true,
1088
+ paddingX: 1,
1089
+ children: [
1090
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1091
+ flexDirection: "column",
1092
+ marginBottom: 1,
1093
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1094
+ bold: true,
1095
+ children: "Install the Claude GitHub App"
1096
+ }, undefined, false, undefined, this)
1097
+ }, undefined, false, undefined, this),
1098
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1099
+ marginBottom: 1,
1100
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1101
+ children: "Opening browser to install the Claude GitHub App\u2026"
1102
+ }, undefined, false, undefined, this)
1103
+ }, undefined, false, undefined, this),
1104
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1105
+ marginBottom: 1,
1106
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1107
+ children: "If your browser doesn't open automatically, visit:"
1108
+ }, undefined, false, undefined, this)
1109
+ }, undefined, false, undefined, this),
1110
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1111
+ marginBottom: 1,
1112
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1113
+ underline: true,
1114
+ children: "https://github.com/apps/claude"
1115
+ }, undefined, false, undefined, this)
1116
+ }, undefined, false, undefined, this),
1117
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1118
+ marginBottom: 1,
1119
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1120
+ children: [
1121
+ "Please install the app for repository: ",
1122
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1123
+ bold: true,
1124
+ children: repoUrl
1125
+ }, undefined, false, undefined, this)
1126
+ ]
1127
+ }, undefined, true, undefined, this)
1128
+ }, undefined, false, undefined, this),
1129
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1130
+ marginBottom: 1,
1131
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1132
+ dimColor: true,
1133
+ children: "Important: Make sure to grant access to this specific repository"
1134
+ }, undefined, false, undefined, this)
1135
+ }, undefined, false, undefined, this),
1136
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1137
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1138
+ bold: true,
1139
+ color: "permission",
1140
+ children: [
1141
+ "Press Enter once you've installed the app",
1142
+ figures_default.ellipsis
1143
+ ]
1144
+ }, undefined, true, undefined, this)
1145
+ }, undefined, false, undefined, this),
1146
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1147
+ marginTop: 1,
1148
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1149
+ dimColor: true,
1150
+ children: [
1151
+ "Having trouble? See manual setup instructions at:",
1152
+ " ",
1153
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1154
+ color: "claude",
1155
+ children: GITHUB_ACTION_SETUP_DOCS_URL
1156
+ }, undefined, false, undefined, this)
1157
+ ]
1158
+ }, undefined, true, undefined, this)
1159
+ }, undefined, false, undefined, this)
1160
+ ]
1161
+ }, undefined, true, undefined, this);
1162
+ }
1163
+ var jsx_dev_runtime9;
1164
+ var init_InstallAppStep = __esm(() => {
1165
+ init_figures();
1166
+ init_github_app();
1167
+ init_src();
1168
+ init_useKeybinding();
1169
+ jsx_dev_runtime9 = __toESM(require_jsx_dev_runtime(), 1);
1170
+ });
1171
+
1172
+ // src/commands/install-github-app/OAuthFlowStep.tsx
1173
+ function OAuthFlowStep({
1174
+ onSuccess,
1175
+ onCancel
1176
+ }) {
1177
+ const [oauthStatus, setOAuthStatus] = import_react5.useState({
1178
+ state: "starting"
1179
+ });
1180
+ const [oauthService] = import_react5.useState(() => new OAuthService);
1181
+ const [pastedCode, setPastedCode] = import_react5.useState("");
1182
+ const [cursorOffset, setCursorOffset] = import_react5.useState(0);
1183
+ const [showPastePrompt, setShowPastePrompt] = import_react5.useState(false);
1184
+ const [urlCopied, setUrlCopied] = import_react5.useState(false);
1185
+ const timersRef = import_react5.useRef(new Set);
1186
+ const urlCopiedTimerRef = import_react5.useRef(undefined);
1187
+ const terminalSize = useTerminalSize();
1188
+ const textInputColumns = Math.max(50, terminalSize.columns - PASTE_HERE_MSG.length - 4);
1189
+ function handleKeyDown(e) {
1190
+ if (oauthStatus.state !== "error")
1191
+ return;
1192
+ e.preventDefault();
1193
+ if (e.key === "return" && oauthStatus.toRetry) {
1194
+ setPastedCode("");
1195
+ setCursorOffset(0);
1196
+ setOAuthStatus({
1197
+ state: "about_to_retry",
1198
+ nextState: oauthStatus.toRetry
1199
+ });
1200
+ } else {
1201
+ onCancel();
1202
+ }
1203
+ }
1204
+ async function handleSubmitCode(value, url) {
1205
+ try {
1206
+ const [authorizationCode, state] = value.split("#");
1207
+ if (!authorizationCode || !state) {
1208
+ setOAuthStatus({
1209
+ state: "error",
1210
+ message: "Invalid code. Please make sure the full code was copied",
1211
+ toRetry: { state: "waiting_for_login", url }
1212
+ });
1213
+ return;
1214
+ }
1215
+ logEvent("tengu_oauth_manual_entry", {});
1216
+ oauthService.handleManualAuthCodeInput({
1217
+ authorizationCode,
1218
+ state
1219
+ });
1220
+ } catch (err) {
1221
+ logError(err);
1222
+ setOAuthStatus({
1223
+ state: "error",
1224
+ message: err.message,
1225
+ toRetry: { state: "waiting_for_login", url }
1226
+ });
1227
+ }
1228
+ }
1229
+ const startOAuth = import_react5.useCallback(async () => {
1230
+ timersRef.current.forEach((timer) => clearTimeout(timer));
1231
+ timersRef.current.clear();
1232
+ try {
1233
+ const result = await oauthService.startOAuthFlow(async (url) => {
1234
+ setOAuthStatus({ state: "waiting_for_login", url });
1235
+ const timer = setTimeout(setShowPastePrompt, 3000, true);
1236
+ timersRef.current.add(timer);
1237
+ }, {
1238
+ loginWithClaudeAi: true,
1239
+ inferenceOnly: true,
1240
+ expiresIn: 365 * 24 * 60 * 60
1241
+ });
1242
+ setOAuthStatus({ state: "processing" });
1243
+ saveOAuthTokensIfNeeded(result);
1244
+ const timer1 = setTimeout((setOAuthStatus2, accessToken, onSuccess2, timersRef2) => {
1245
+ setOAuthStatus2({ state: "success", token: accessToken });
1246
+ const timer2 = setTimeout(onSuccess2, 1000, accessToken);
1247
+ timersRef2.current.add(timer2);
1248
+ }, 100, setOAuthStatus, result.accessToken, onSuccess, timersRef);
1249
+ timersRef.current.add(timer1);
1250
+ } catch (err) {
1251
+ const errorMessage = err.message;
1252
+ setOAuthStatus({
1253
+ state: "error",
1254
+ message: errorMessage,
1255
+ toRetry: { state: "starting" }
1256
+ });
1257
+ logError(err);
1258
+ logEvent("tengu_oauth_error", {
1259
+ error: errorMessage
1260
+ });
1261
+ }
1262
+ }, [oauthService, onSuccess]);
1263
+ import_react5.useEffect(() => {
1264
+ if (oauthStatus.state === "starting") {
1265
+ startOAuth();
1266
+ }
1267
+ }, [oauthStatus.state, startOAuth]);
1268
+ import_react5.useEffect(() => {
1269
+ if (oauthStatus.state === "about_to_retry") {
1270
+ const timer = setTimeout((nextState, setShowPastePrompt2, setOAuthStatus2) => {
1271
+ setShowPastePrompt2(nextState.state === "waiting_for_login");
1272
+ setOAuthStatus2(nextState);
1273
+ }, 500, oauthStatus.nextState, setShowPastePrompt, setOAuthStatus);
1274
+ timersRef.current.add(timer);
1275
+ }
1276
+ }, [oauthStatus]);
1277
+ import_react5.useEffect(() => {
1278
+ if (pastedCode === "c" && oauthStatus.state === "waiting_for_login" && showPastePrompt && !urlCopied) {
1279
+ setClipboard(oauthStatus.url).then((raw) => {
1280
+ if (raw)
1281
+ process.stdout.write(raw);
1282
+ setUrlCopied(true);
1283
+ clearTimeout(urlCopiedTimerRef.current);
1284
+ urlCopiedTimerRef.current = setTimeout(setUrlCopied, 2000, false);
1285
+ });
1286
+ setPastedCode("");
1287
+ }
1288
+ }, [pastedCode, oauthStatus, showPastePrompt, urlCopied]);
1289
+ import_react5.useEffect(() => {
1290
+ const timers = timersRef.current;
1291
+ return () => {
1292
+ oauthService.cleanup();
1293
+ timers.forEach((timer) => clearTimeout(timer));
1294
+ timers.clear();
1295
+ clearTimeout(urlCopiedTimerRef.current);
1296
+ };
1297
+ }, [oauthService]);
1298
+ function renderStatusMessage() {
1299
+ switch (oauthStatus.state) {
1300
+ case "starting":
1301
+ return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1302
+ children: [
1303
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Spinner, {}, undefined, false, undefined, this),
1304
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1305
+ children: "Starting authentication\u2026"
1306
+ }, undefined, false, undefined, this)
1307
+ ]
1308
+ }, undefined, true, undefined, this);
1309
+ case "waiting_for_login":
1310
+ return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1311
+ flexDirection: "column",
1312
+ gap: 1,
1313
+ children: [
1314
+ !showPastePrompt && /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1315
+ children: [
1316
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Spinner, {}, undefined, false, undefined, this),
1317
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1318
+ children: "Opening browser to sign in with your Claude account\u2026"
1319
+ }, undefined, false, undefined, this)
1320
+ ]
1321
+ }, undefined, true, undefined, this),
1322
+ showPastePrompt && /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1323
+ children: [
1324
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1325
+ children: PASTE_HERE_MSG
1326
+ }, undefined, false, undefined, this),
1327
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(TextInput, {
1328
+ value: pastedCode,
1329
+ onChange: setPastedCode,
1330
+ onSubmit: (value) => handleSubmitCode(value, oauthStatus.url),
1331
+ cursorOffset,
1332
+ onChangeCursorOffset: setCursorOffset,
1333
+ columns: textInputColumns
1334
+ }, undefined, false, undefined, this)
1335
+ ]
1336
+ }, undefined, true, undefined, this)
1337
+ ]
1338
+ }, undefined, true, undefined, this);
1339
+ case "processing":
1340
+ return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1341
+ children: [
1342
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Spinner, {}, undefined, false, undefined, this),
1343
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1344
+ children: "Processing authentication\u2026"
1345
+ }, undefined, false, undefined, this)
1346
+ ]
1347
+ }, undefined, true, undefined, this);
1348
+ case "success":
1349
+ return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1350
+ flexDirection: "column",
1351
+ gap: 1,
1352
+ children: [
1353
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1354
+ color: "success",
1355
+ children: "\u2713 Authentication token created successfully!"
1356
+ }, undefined, false, undefined, this),
1357
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1358
+ dimColor: true,
1359
+ children: "Using token for GitHub Actions setup\u2026"
1360
+ }, undefined, false, undefined, this)
1361
+ ]
1362
+ }, undefined, true, undefined, this);
1363
+ case "error":
1364
+ return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1365
+ flexDirection: "column",
1366
+ gap: 1,
1367
+ children: [
1368
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1369
+ color: "error",
1370
+ children: [
1371
+ "OAuth error: ",
1372
+ oauthStatus.message
1373
+ ]
1374
+ }, undefined, true, undefined, this),
1375
+ oauthStatus.toRetry ? /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1376
+ dimColor: true,
1377
+ children: "Press Enter to try again, or any other key to cancel"
1378
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1379
+ dimColor: true,
1380
+ children: "Press any key to return to API key selection"
1381
+ }, undefined, false, undefined, this)
1382
+ ]
1383
+ }, undefined, true, undefined, this);
1384
+ case "about_to_retry":
1385
+ return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1386
+ flexDirection: "column",
1387
+ gap: 1,
1388
+ children: /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1389
+ color: "permission",
1390
+ children: "Retrying\u2026"
1391
+ }, undefined, false, undefined, this)
1392
+ }, undefined, false, undefined, this);
1393
+ default:
1394
+ return null;
1395
+ }
1396
+ }
1397
+ return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1398
+ flexDirection: "column",
1399
+ gap: 1,
1400
+ tabIndex: 0,
1401
+ autoFocus: true,
1402
+ onKeyDown: handleKeyDown,
1403
+ children: [
1404
+ oauthStatus.state === "starting" && /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1405
+ flexDirection: "column",
1406
+ gap: 1,
1407
+ paddingBottom: 1,
1408
+ children: [
1409
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1410
+ bold: true,
1411
+ children: "Create Authentication Token"
1412
+ }, undefined, false, undefined, this),
1413
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1414
+ dimColor: true,
1415
+ children: "Creating a long-lived token for GitHub Actions"
1416
+ }, undefined, false, undefined, this)
1417
+ ]
1418
+ }, undefined, true, undefined, this),
1419
+ oauthStatus.state !== "success" && oauthStatus.state !== "starting" && oauthStatus.state !== "processing" && /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1420
+ flexDirection: "column",
1421
+ gap: 1,
1422
+ paddingBottom: 1,
1423
+ children: [
1424
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1425
+ bold: true,
1426
+ children: "Create Authentication Token"
1427
+ }, undefined, false, undefined, this),
1428
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1429
+ dimColor: true,
1430
+ children: "Creating a long-lived token for GitHub Actions"
1431
+ }, undefined, false, undefined, this)
1432
+ ]
1433
+ }, "header", true, undefined, this),
1434
+ oauthStatus.state === "waiting_for_login" && showPastePrompt && /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1435
+ flexDirection: "column",
1436
+ gap: 1,
1437
+ paddingBottom: 1,
1438
+ children: [
1439
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1440
+ paddingX: 1,
1441
+ children: [
1442
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1443
+ dimColor: true,
1444
+ children: [
1445
+ "Browser didn't open? Use the url below to sign in",
1446
+ " "
1447
+ ]
1448
+ }, undefined, true, undefined, this),
1449
+ urlCopied ? /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1450
+ color: "success",
1451
+ children: "(Copied!)"
1452
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1453
+ dimColor: true,
1454
+ children: /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(KeyboardShortcutHint, {
1455
+ shortcut: "c",
1456
+ action: "copy",
1457
+ parens: true
1458
+ }, undefined, false, undefined, this)
1459
+ }, undefined, false, undefined, this)
1460
+ ]
1461
+ }, undefined, true, undefined, this),
1462
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Link, {
1463
+ url: oauthStatus.url,
1464
+ children: /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1465
+ dimColor: true,
1466
+ children: oauthStatus.url
1467
+ }, undefined, false, undefined, this)
1468
+ }, undefined, false, undefined, this)
1469
+ ]
1470
+ }, "urlToCopy", true, undefined, this),
1471
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1472
+ paddingLeft: 1,
1473
+ flexDirection: "column",
1474
+ gap: 1,
1475
+ children: renderStatusMessage()
1476
+ }, undefined, false, undefined, this)
1477
+ ]
1478
+ }, undefined, true, undefined, this);
1479
+ }
1480
+ var import_react5, jsx_dev_runtime10, PASTE_HERE_MSG = "Paste code here if prompted > ";
1481
+ var init_OAuthFlowStep = __esm(() => {
1482
+ init_analytics();
1483
+ init_src();
1484
+ init_Spinner();
1485
+ init_TextInput();
1486
+ init_useTerminalSize();
1487
+ init_src();
1488
+ init_oauth();
1489
+ init_auth();
1490
+ init_log();
1491
+ import_react5 = __toESM(require_react(), 1);
1492
+ jsx_dev_runtime10 = __toESM(require_jsx_dev_runtime(), 1);
1493
+ });
1494
+
1495
+ // src/commands/install-github-app/SuccessStep.tsx
1496
+ function SuccessStep({
1497
+ secretExists,
1498
+ useExistingSecret,
1499
+ secretName,
1500
+ skipWorkflow = false
1501
+ }) {
1502
+ return /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(jsx_dev_runtime11.Fragment, {
1503
+ children: [
1504
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedBox_default, {
1505
+ flexDirection: "column",
1506
+ borderStyle: "round",
1507
+ paddingX: 1,
1508
+ children: [
1509
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedBox_default, {
1510
+ flexDirection: "column",
1511
+ marginBottom: 1,
1512
+ children: [
1513
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1514
+ bold: true,
1515
+ children: "Install GitHub App"
1516
+ }, undefined, false, undefined, this),
1517
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1518
+ dimColor: true,
1519
+ children: "Success"
1520
+ }, undefined, false, undefined, this)
1521
+ ]
1522
+ }, undefined, true, undefined, this),
1523
+ !skipWorkflow && /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1524
+ color: "success",
1525
+ children: "\u2713 GitHub Actions workflow created!"
1526
+ }, undefined, false, undefined, this),
1527
+ secretExists && useExistingSecret && /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedBox_default, {
1528
+ marginTop: 1,
1529
+ children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1530
+ color: "success",
1531
+ children: "\u2713 Using existing ANTHROPIC_API_KEY secret"
1532
+ }, undefined, false, undefined, this)
1533
+ }, undefined, false, undefined, this),
1534
+ (!secretExists || !useExistingSecret) && /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedBox_default, {
1535
+ marginTop: 1,
1536
+ children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1537
+ color: "success",
1538
+ children: [
1539
+ "\u2713 API key saved as ",
1540
+ secretName,
1541
+ " secret"
1542
+ ]
1543
+ }, undefined, true, undefined, this)
1544
+ }, undefined, false, undefined, this),
1545
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedBox_default, {
1546
+ marginTop: 1,
1547
+ children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1548
+ children: "Next steps:"
1549
+ }, undefined, false, undefined, this)
1550
+ }, undefined, false, undefined, this),
1551
+ skipWorkflow ? /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(jsx_dev_runtime11.Fragment, {
1552
+ children: [
1553
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1554
+ children: "1. Install the Claude GitHub App if you haven't already"
1555
+ }, undefined, false, undefined, this),
1556
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1557
+ children: "2. Your workflow file was kept unchanged"
1558
+ }, undefined, false, undefined, this),
1559
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1560
+ children: "3. API key is configured and ready to use"
1561
+ }, undefined, false, undefined, this)
1562
+ ]
1563
+ }, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(jsx_dev_runtime11.Fragment, {
1564
+ children: [
1565
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1566
+ children: "1. A pre-filled PR page has been created"
1567
+ }, undefined, false, undefined, this),
1568
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1569
+ children: "2. Install the Claude GitHub App if you haven't already"
1570
+ }, undefined, false, undefined, this),
1571
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1572
+ children: "3. Merge the PR to enable Claude PR assistance"
1573
+ }, undefined, false, undefined, this)
1574
+ ]
1575
+ }, undefined, true, undefined, this)
1576
+ ]
1577
+ }, undefined, true, undefined, this),
1578
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedBox_default, {
1579
+ marginLeft: 3,
1580
+ children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1581
+ dimColor: true,
1582
+ children: "Press any key to exit"
1583
+ }, undefined, false, undefined, this)
1584
+ }, undefined, false, undefined, this)
1585
+ ]
1586
+ }, undefined, true, undefined, this);
1587
+ }
1588
+ var jsx_dev_runtime11;
1589
+ var init_SuccessStep = __esm(() => {
1590
+ init_src();
1591
+ jsx_dev_runtime11 = __toESM(require_jsx_dev_runtime(), 1);
1592
+ });
1593
+
1594
+ // src/commands/install-github-app/setupGitHubActions.ts
1595
+ async function createWorkflowFile(repoName, branchName, workflowPath, workflowContent, secretName, message, context) {
1596
+ const checkFileResult = await execFileNoThrow("gh", [
1597
+ "api",
1598
+ `repos/${repoName}/contents/${workflowPath}`,
1599
+ "--jq",
1600
+ ".sha"
1601
+ ]);
1602
+ let fileSha = null;
1603
+ if (checkFileResult.code === 0) {
1604
+ fileSha = checkFileResult.stdout.trim();
1605
+ }
1606
+ let content = workflowContent;
1607
+ if (secretName === "CLAUDE_CODE_OAUTH_TOKEN") {
1608
+ content = workflowContent.replace(/anthropic_api_key: \$\{\{ secrets\.ANTHROPIC_API_KEY \}\}/g, `claude_code_oauth_token: \${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}`);
1609
+ } else if (secretName !== "ANTHROPIC_API_KEY") {
1610
+ content = workflowContent.replace(/anthropic_api_key: \$\{\{ secrets\.ANTHROPIC_API_KEY \}\}/g, `anthropic_api_key: \${{ secrets.${secretName} }}`);
1611
+ }
1612
+ const base64Content = Buffer.from(content).toString("base64");
1613
+ const apiParams = [
1614
+ "api",
1615
+ "--method",
1616
+ "PUT",
1617
+ `repos/${repoName}/contents/${workflowPath}`,
1618
+ "-f",
1619
+ `message=${fileSha ? `"Update ${message}"` : `"${message}"`}`,
1620
+ "-f",
1621
+ `content=${base64Content}`,
1622
+ "-f",
1623
+ `branch=${branchName}`
1624
+ ];
1625
+ if (fileSha) {
1626
+ apiParams.push("-f", `sha=${fileSha}`);
1627
+ }
1628
+ const createFileResult = await execFileNoThrow("gh", apiParams);
1629
+ if (createFileResult.code !== 0) {
1630
+ if (createFileResult.stderr.includes("422") && createFileResult.stderr.includes("sha")) {
1631
+ logEvent("tengu_setup_github_actions_failed", {
1632
+ reason: "failed_to_create_workflow_file",
1633
+ exit_code: createFileResult.code,
1634
+ ...context
1635
+ });
1636
+ throw new Error(`Failed to create workflow file ${workflowPath}: A Claude workflow file already exists in this repository. Please remove it first or update it manually.`);
1637
+ }
1638
+ logEvent("tengu_setup_github_actions_failed", {
1639
+ reason: "failed_to_create_workflow_file",
1640
+ exit_code: createFileResult.code,
1641
+ ...context
1642
+ });
1643
+ const helpText = `
1644
+
1645
+ Need help? Common issues:
1646
+ ` + `\xB7 Permission denied \u2192 Run: gh auth refresh -h github.com -s repo,workflow
1647
+ ` + `\xB7 Not authorized \u2192 Ensure you have admin access to the repository
1648
+ ` + "\xB7 For manual setup \u2192 Visit: https://github.com/anthropics/claude-code-action";
1649
+ throw new Error(`Failed to create workflow file ${workflowPath}: ${createFileResult.stderr}${helpText}`);
1650
+ }
1651
+ }
1652
+ async function setupGitHubActions(repoName, apiKeyOrOAuthToken, secretName, updateProgress, skipWorkflow = false, selectedWorkflows, authType, context) {
1653
+ try {
1654
+ logEvent("tengu_setup_github_actions_started", {
1655
+ skip_workflow: skipWorkflow,
1656
+ has_api_key: !!apiKeyOrOAuthToken,
1657
+ using_default_secret_name: secretName === "ANTHROPIC_API_KEY",
1658
+ selected_claude_workflow: selectedWorkflows.includes("claude"),
1659
+ selected_claude_review_workflow: selectedWorkflows.includes("claude-review"),
1660
+ ...context
1661
+ });
1662
+ const repoCheckResult = await execFileNoThrow("gh", [
1663
+ "api",
1664
+ `repos/${repoName}`,
1665
+ "--jq",
1666
+ ".id"
1667
+ ]);
1668
+ if (repoCheckResult.code !== 0) {
1669
+ logEvent("tengu_setup_github_actions_failed", {
1670
+ reason: "repo_not_found",
1671
+ exit_code: repoCheckResult.code,
1672
+ ...context
1673
+ });
1674
+ throw new Error(`Failed to access repository ${repoName}: ${repoCheckResult.stderr}`);
1675
+ }
1676
+ const defaultBranchResult = await execFileNoThrow("gh", [
1677
+ "api",
1678
+ `repos/${repoName}`,
1679
+ "--jq",
1680
+ ".default_branch"
1681
+ ]);
1682
+ if (defaultBranchResult.code !== 0) {
1683
+ logEvent("tengu_setup_github_actions_failed", {
1684
+ reason: "failed_to_get_default_branch",
1685
+ exit_code: defaultBranchResult.code,
1686
+ ...context
1687
+ });
1688
+ throw new Error(`Failed to get default branch: ${defaultBranchResult.stderr}`);
1689
+ }
1690
+ const defaultBranch = defaultBranchResult.stdout.trim();
1691
+ const shaResult = await execFileNoThrow("gh", [
1692
+ "api",
1693
+ `repos/${repoName}/git/ref/heads/${defaultBranch}`,
1694
+ "--jq",
1695
+ ".object.sha"
1696
+ ]);
1697
+ if (shaResult.code !== 0) {
1698
+ logEvent("tengu_setup_github_actions_failed", {
1699
+ reason: "failed_to_get_branch_sha",
1700
+ exit_code: shaResult.code,
1701
+ ...context
1702
+ });
1703
+ throw new Error(`Failed to get branch SHA: ${shaResult.stderr}`);
1704
+ }
1705
+ const sha = shaResult.stdout.trim();
1706
+ let branchName = null;
1707
+ if (!skipWorkflow) {
1708
+ updateProgress();
1709
+ branchName = `add-claude-github-actions-${Date.now()}`;
1710
+ const createBranchResult = await execFileNoThrow("gh", [
1711
+ "api",
1712
+ "--method",
1713
+ "POST",
1714
+ `repos/${repoName}/git/refs`,
1715
+ "-f",
1716
+ `ref=refs/heads/${branchName}`,
1717
+ "-f",
1718
+ `sha=${sha}`
1719
+ ]);
1720
+ if (createBranchResult.code !== 0) {
1721
+ logEvent("tengu_setup_github_actions_failed", {
1722
+ reason: "failed_to_create_branch",
1723
+ exit_code: createBranchResult.code,
1724
+ ...context
1725
+ });
1726
+ throw new Error(`Failed to create branch: ${createBranchResult.stderr}`);
1727
+ }
1728
+ updateProgress();
1729
+ const workflows = [];
1730
+ if (selectedWorkflows.includes("claude")) {
1731
+ workflows.push({
1732
+ path: ".github/workflows/claude.yml",
1733
+ content: WORKFLOW_CONTENT,
1734
+ message: "Claude PR Assistant workflow"
1735
+ });
1736
+ }
1737
+ if (selectedWorkflows.includes("claude-review")) {
1738
+ workflows.push({
1739
+ path: ".github/workflows/claude-code-review.yml",
1740
+ content: CODE_REVIEW_PLUGIN_WORKFLOW_CONTENT,
1741
+ message: "Claude Code Review workflow"
1742
+ });
1743
+ }
1744
+ for (const workflow of workflows) {
1745
+ await createWorkflowFile(repoName, branchName, workflow.path, workflow.content, secretName, workflow.message, context);
1746
+ }
1747
+ }
1748
+ updateProgress();
1749
+ if (apiKeyOrOAuthToken) {
1750
+ const setSecretResult = await execFileNoThrow("gh", [
1751
+ "secret",
1752
+ "set",
1753
+ secretName,
1754
+ "--body",
1755
+ apiKeyOrOAuthToken,
1756
+ "--repo",
1757
+ repoName
1758
+ ]);
1759
+ if (setSecretResult.code !== 0) {
1760
+ logEvent("tengu_setup_github_actions_failed", {
1761
+ reason: "failed_to_set_api_key_secret",
1762
+ exit_code: setSecretResult.code,
1763
+ ...context
1764
+ });
1765
+ const helpText = `
1766
+
1767
+ Need help? Common issues:
1768
+ ` + `\xB7 Permission denied \u2192 Run: gh auth refresh -h github.com -s repo
1769
+ ` + `\xB7 Not authorized \u2192 Ensure you have admin access to the repository
1770
+ ` + "\xB7 For manual setup \u2192 Visit: https://github.com/anthropics/claude-code-action";
1771
+ throw new Error(`Failed to set API key secret: ${setSecretResult.stderr || "Unknown error"}${helpText}`);
1772
+ }
1773
+ }
1774
+ if (!skipWorkflow && branchName) {
1775
+ updateProgress();
1776
+ const compareUrl = `https://github.com/${repoName}/compare/${defaultBranch}...${branchName}?quick_pull=1&title=${encodeURIComponent(PR_TITLE)}&body=${encodeURIComponent(PR_BODY)}`;
1777
+ await openBrowser(compareUrl);
1778
+ }
1779
+ logEvent("tengu_setup_github_actions_completed", {
1780
+ skip_workflow: skipWorkflow,
1781
+ has_api_key: !!apiKeyOrOAuthToken,
1782
+ auth_type: authType,
1783
+ using_default_secret_name: secretName === "ANTHROPIC_API_KEY",
1784
+ selected_claude_workflow: selectedWorkflows.includes("claude"),
1785
+ selected_claude_review_workflow: selectedWorkflows.includes("claude-review"),
1786
+ ...context
1787
+ });
1788
+ saveGlobalConfig((current) => ({
1789
+ ...current,
1790
+ githubActionSetupCount: (current.githubActionSetupCount ?? 0) + 1
1791
+ }));
1792
+ } catch (error) {
1793
+ if (!error || !(error instanceof Error) || !error.message.includes("Failed to")) {
1794
+ logEvent("tengu_setup_github_actions_failed", {
1795
+ reason: "unexpected_error",
1796
+ ...context
1797
+ });
1798
+ }
1799
+ if (error instanceof Error) {
1800
+ logError(error);
1801
+ }
1802
+ throw error;
1803
+ }
1804
+ }
1805
+ var init_setupGitHubActions = __esm(() => {
1806
+ init_analytics();
1807
+ init_config();
1808
+ init_github_app();
1809
+ init_browser();
1810
+ init_execFileNoThrow();
1811
+ init_log();
1812
+ });
1813
+
1814
+ // src/commands/install-github-app/WarningsStep.tsx
1815
+ function WarningsStep({ warnings, onContinue }) {
1816
+ useKeybinding("confirm:yes", onContinue, { context: "Confirmation" });
1817
+ return /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(jsx_dev_runtime12.Fragment, {
1818
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
1819
+ flexDirection: "column",
1820
+ borderStyle: "round",
1821
+ paddingX: 1,
1822
+ children: [
1823
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
1824
+ flexDirection: "column",
1825
+ marginBottom: 1,
1826
+ children: [
1827
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
1828
+ bold: true,
1829
+ children: [
1830
+ figures_default.warning,
1831
+ " Setup Warnings"
1832
+ ]
1833
+ }, undefined, true, undefined, this),
1834
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
1835
+ dimColor: true,
1836
+ children: "We found some potential issues, but you can continue anyway"
1837
+ }, undefined, false, undefined, this)
1838
+ ]
1839
+ }, undefined, true, undefined, this),
1840
+ warnings.map((warning, index) => /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
1841
+ flexDirection: "column",
1842
+ marginBottom: 1,
1843
+ children: [
1844
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
1845
+ color: "warning",
1846
+ bold: true,
1847
+ children: warning.title
1848
+ }, undefined, false, undefined, this),
1849
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
1850
+ children: warning.message
1851
+ }, undefined, false, undefined, this),
1852
+ warning.instructions.length > 0 && /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
1853
+ flexDirection: "column",
1854
+ marginLeft: 2,
1855
+ marginTop: 1,
1856
+ children: warning.instructions.map((instruction, i) => /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
1857
+ dimColor: true,
1858
+ children: [
1859
+ "\u2022 ",
1860
+ instruction
1861
+ ]
1862
+ }, i, true, undefined, this))
1863
+ }, undefined, false, undefined, this)
1864
+ ]
1865
+ }, index, true, undefined, this)),
1866
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
1867
+ marginTop: 1,
1868
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
1869
+ bold: true,
1870
+ color: "permission",
1871
+ children: "Press Enter to continue anyway, or Ctrl+C to exit and fix issues"
1872
+ }, undefined, false, undefined, this)
1873
+ }, undefined, false, undefined, this),
1874
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
1875
+ marginTop: 1,
1876
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
1877
+ dimColor: true,
1878
+ children: [
1879
+ "You can also try the manual setup steps if needed:",
1880
+ " ",
1881
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
1882
+ color: "claude",
1883
+ children: GITHUB_ACTION_SETUP_DOCS_URL
1884
+ }, undefined, false, undefined, this)
1885
+ ]
1886
+ }, undefined, true, undefined, this)
1887
+ }, undefined, false, undefined, this)
1888
+ ]
1889
+ }, undefined, true, undefined, this)
1890
+ }, undefined, false, undefined, this);
1891
+ }
1892
+ var jsx_dev_runtime12;
1893
+ var init_WarningsStep = __esm(() => {
1894
+ init_figures();
1895
+ init_github_app();
1896
+ init_src();
1897
+ init_useKeybinding();
1898
+ jsx_dev_runtime12 = __toESM(require_jsx_dev_runtime(), 1);
1899
+ });
1900
+
1901
+ // src/commands/install-github-app/install-github-app.tsx
1902
+ function InstallGitHubApp(props) {
1903
+ const [existingApiKey] = import_react6.useState(() => getAnthropicApiKey());
1904
+ const [state, setState] = import_react6.useState({
1905
+ ...INITIAL_STATE,
1906
+ useExistingKey: !!existingApiKey,
1907
+ selectedApiKeyOption: existingApiKey ? "existing" : isAnthropicAuthEnabled() ? "oauth" : "new"
1908
+ });
1909
+ useExitOnCtrlCDWithKeybindings();
1910
+ import_react6.default.useEffect(() => {
1911
+ logEvent("tengu_install_github_app_started", {});
1912
+ }, []);
1913
+ const checkGitHubCLI = import_react6.useCallback(async () => {
1914
+ const warnings = [];
1915
+ const ghVersionResult = await execa("gh --version", {
1916
+ shell: true,
1917
+ reject: false
1918
+ });
1919
+ if (ghVersionResult.exitCode !== 0) {
1920
+ warnings.push({
1921
+ title: "GitHub CLI not found",
1922
+ message: "GitHub CLI (gh) does not appear to be installed or accessible.",
1923
+ instructions: [
1924
+ "Install GitHub CLI from https://cli.github.com/",
1925
+ "macOS: brew install gh",
1926
+ "Windows: winget install --id GitHub.cli",
1927
+ "Linux: See installation instructions at https://github.com/cli/cli#installation"
1928
+ ]
1929
+ });
1930
+ }
1931
+ const authResult = await execa("gh auth status -a", {
1932
+ shell: true,
1933
+ reject: false
1934
+ });
1935
+ if (authResult.exitCode !== 0) {
1936
+ warnings.push({
1937
+ title: "GitHub CLI not authenticated",
1938
+ message: "GitHub CLI does not appear to be authenticated.",
1939
+ instructions: [
1940
+ "Run: gh auth login",
1941
+ "Follow the prompts to authenticate with GitHub",
1942
+ "Or set up authentication using environment variables or other methods"
1943
+ ]
1944
+ });
1945
+ } else {
1946
+ const tokenScopesMatch = authResult.stdout.match(/Token scopes:.*$/m);
1947
+ if (tokenScopesMatch) {
1948
+ const scopes = tokenScopesMatch[0];
1949
+ const missingScopes = [];
1950
+ if (!scopes.includes("repo")) {
1951
+ missingScopes.push("repo");
1952
+ }
1953
+ if (!scopes.includes("workflow")) {
1954
+ missingScopes.push("workflow");
1955
+ }
1956
+ if (missingScopes.length > 0) {
1957
+ setState((prev) => ({
1958
+ ...prev,
1959
+ step: "error",
1960
+ error: `GitHub CLI is missing required permissions: ${missingScopes.join(", ")}.`,
1961
+ errorReason: "Missing required scopes",
1962
+ errorInstructions: [
1963
+ `Your GitHub CLI authentication is missing the "${missingScopes.join('" and "')}" ${plural(missingScopes.length, "scope")} needed to manage GitHub Actions and secrets.`,
1964
+ "",
1965
+ "To fix this, run:",
1966
+ " gh auth refresh -h github.com -s repo,workflow",
1967
+ "",
1968
+ "This will add the necessary permissions to manage workflows and secrets."
1969
+ ]
1970
+ }));
1971
+ return;
1972
+ }
1973
+ }
1974
+ }
1975
+ const currentRepo = await getGithubRepo() ?? "";
1976
+ logEvent("tengu_install_github_app_step_completed", {
1977
+ step: "check-gh"
1978
+ });
1979
+ setState((prev) => ({
1980
+ ...prev,
1981
+ warnings,
1982
+ currentRepo,
1983
+ selectedRepoName: currentRepo,
1984
+ useCurrentRepo: !!currentRepo,
1985
+ step: warnings.length > 0 ? "warnings" : "choose-repo"
1986
+ }));
1987
+ }, []);
1988
+ import_react6.default.useEffect(() => {
1989
+ if (state.step === "check-gh") {
1990
+ checkGitHubCLI();
1991
+ }
1992
+ }, [state.step, checkGitHubCLI]);
1993
+ const runSetupGitHubActions = import_react6.useCallback(async (apiKeyOrOAuthToken, secretName) => {
1994
+ setState((prev) => ({
1995
+ ...prev,
1996
+ step: "creating",
1997
+ currentWorkflowInstallStep: 0
1998
+ }));
1999
+ try {
2000
+ await setupGitHubActions(state.selectedRepoName, apiKeyOrOAuthToken, secretName, () => {
2001
+ setState((prev) => ({
2002
+ ...prev,
2003
+ currentWorkflowInstallStep: prev.currentWorkflowInstallStep + 1
2004
+ }));
2005
+ }, state.workflowAction === "skip", state.selectedWorkflows, state.authType, {
2006
+ useCurrentRepo: state.useCurrentRepo,
2007
+ workflowExists: state.workflowExists,
2008
+ secretExists: state.secretExists
2009
+ });
2010
+ logEvent("tengu_install_github_app_step_completed", {
2011
+ step: "creating"
2012
+ });
2013
+ setState((prev) => ({ ...prev, step: "success" }));
2014
+ } catch (error) {
2015
+ const errorMessage = error instanceof Error ? error.message : "Failed to set up GitHub Actions";
2016
+ if (errorMessage.includes("workflow file already exists")) {
2017
+ logEvent("tengu_install_github_app_error", {
2018
+ reason: "workflow_file_exists"
2019
+ });
2020
+ setState((prev) => ({
2021
+ ...prev,
2022
+ step: "error",
2023
+ error: "A Claude workflow file already exists in this repository.",
2024
+ errorReason: "Workflow file conflict",
2025
+ errorInstructions: [
2026
+ "The file .github/workflows/claude.yml already exists",
2027
+ "You can either:",
2028
+ " 1. Delete the existing file and run this command again",
2029
+ " 2. Update the existing file manually using the template from:",
2030
+ ` ${GITHUB_ACTION_SETUP_DOCS_URL}`
2031
+ ]
2032
+ }));
2033
+ } else {
2034
+ logEvent("tengu_install_github_app_error", {
2035
+ reason: "setup_github_actions_failed"
2036
+ });
2037
+ setState((prev) => ({
2038
+ ...prev,
2039
+ step: "error",
2040
+ error: errorMessage,
2041
+ errorReason: "GitHub Actions setup failed",
2042
+ errorInstructions: []
2043
+ }));
2044
+ }
2045
+ }
2046
+ }, [
2047
+ state.selectedRepoName,
2048
+ state.workflowAction,
2049
+ state.selectedWorkflows,
2050
+ state.useCurrentRepo,
2051
+ state.workflowExists,
2052
+ state.secretExists,
2053
+ state.authType
2054
+ ]);
2055
+ async function openGitHubAppInstallation() {
2056
+ const installUrl = "https://github.com/apps/claude";
2057
+ await openBrowser(installUrl);
2058
+ }
2059
+ async function checkRepositoryPermissions(repoName) {
2060
+ try {
2061
+ const result = await execFileNoThrow("gh", [
2062
+ "api",
2063
+ `repos/${repoName}`,
2064
+ "--jq",
2065
+ ".permissions.admin"
2066
+ ]);
2067
+ if (result.code === 0) {
2068
+ const hasAdmin = result.stdout.trim() === "true";
2069
+ return { hasAccess: hasAdmin };
2070
+ }
2071
+ if (result.stderr.includes("404") || result.stderr.includes("Not Found")) {
2072
+ return {
2073
+ hasAccess: false,
2074
+ error: "repository_not_found"
2075
+ };
2076
+ }
2077
+ return { hasAccess: false };
2078
+ } catch {
2079
+ return { hasAccess: false };
2080
+ }
2081
+ }
2082
+ async function checkExistingWorkflowFile(repoName) {
2083
+ const checkFileResult = await execFileNoThrow("gh", [
2084
+ "api",
2085
+ `repos/${repoName}/contents/.github/workflows/claude.yml`,
2086
+ "--jq",
2087
+ ".sha"
2088
+ ]);
2089
+ return checkFileResult.code === 0;
2090
+ }
2091
+ async function checkExistingSecret() {
2092
+ const checkSecretsResult = await execFileNoThrow("gh", [
2093
+ "secret",
2094
+ "list",
2095
+ "--app",
2096
+ "actions",
2097
+ "--repo",
2098
+ state.selectedRepoName
2099
+ ]);
2100
+ if (checkSecretsResult.code === 0) {
2101
+ const lines = checkSecretsResult.stdout.split(`
2102
+ `);
2103
+ const hasAnthropicKey = lines.some((line) => {
2104
+ return /^ANTHROPIC_API_KEY\s+/.test(line);
2105
+ });
2106
+ if (hasAnthropicKey) {
2107
+ setState((prev) => ({
2108
+ ...prev,
2109
+ secretExists: true,
2110
+ step: "check-existing-secret"
2111
+ }));
2112
+ } else {
2113
+ if (existingApiKey) {
2114
+ setState((prev) => ({
2115
+ ...prev,
2116
+ apiKeyOrOAuthToken: existingApiKey,
2117
+ useExistingKey: true
2118
+ }));
2119
+ await runSetupGitHubActions(existingApiKey, state.secretName);
2120
+ } else {
2121
+ setState((prev) => ({ ...prev, step: "api-key" }));
2122
+ }
2123
+ }
2124
+ } else {
2125
+ if (existingApiKey) {
2126
+ setState((prev) => ({
2127
+ ...prev,
2128
+ apiKeyOrOAuthToken: existingApiKey,
2129
+ useExistingKey: true
2130
+ }));
2131
+ await runSetupGitHubActions(existingApiKey, state.secretName);
2132
+ } else {
2133
+ setState((prev) => ({ ...prev, step: "api-key" }));
2134
+ }
2135
+ }
2136
+ }
2137
+ const handleSubmit = async () => {
2138
+ if (state.step === "warnings") {
2139
+ logEvent("tengu_install_github_app_step_completed", {
2140
+ step: "warnings"
2141
+ });
2142
+ setState((prev) => ({ ...prev, step: "install-app" }));
2143
+ setTimeout(openGitHubAppInstallation, 0);
2144
+ } else if (state.step === "choose-repo") {
2145
+ let repoName = state.useCurrentRepo ? state.currentRepo : state.selectedRepoName;
2146
+ if (!repoName.trim()) {
2147
+ return;
2148
+ }
2149
+ const repoWarnings = [];
2150
+ if (repoName.includes("github.com")) {
2151
+ const match = repoName.match(/github\.com[:/]([^/]+\/[^/]+)(\.git)?$/);
2152
+ if (!match) {
2153
+ repoWarnings.push({
2154
+ title: "Invalid GitHub URL format",
2155
+ message: "The repository URL format appears to be invalid.",
2156
+ instructions: [
2157
+ "Use format: owner/repo or https://github.com/owner/repo",
2158
+ "Example: anthropics/claude-cli"
2159
+ ]
2160
+ });
2161
+ } else {
2162
+ repoName = match[1]?.replace(/\.git$/, "") || "";
2163
+ }
2164
+ }
2165
+ if (!repoName.includes("/")) {
2166
+ repoWarnings.push({
2167
+ title: "Repository format warning",
2168
+ message: 'Repository should be in format "owner/repo"',
2169
+ instructions: [
2170
+ "Use format: owner/repo",
2171
+ "Example: anthropics/claude-cli"
2172
+ ]
2173
+ });
2174
+ }
2175
+ const permissionCheck = await checkRepositoryPermissions(repoName);
2176
+ if (permissionCheck.error === "repository_not_found") {
2177
+ repoWarnings.push({
2178
+ title: "Repository not found",
2179
+ message: `Repository ${repoName} was not found or you don't have access.`,
2180
+ instructions: [
2181
+ `Check that the repository name is correct: ${repoName}`,
2182
+ "Ensure you have access to this repository",
2183
+ 'For private repositories, make sure your GitHub token has the "repo" scope',
2184
+ "You can add the repo scope with: gh auth refresh -h github.com -s repo,workflow"
2185
+ ]
2186
+ });
2187
+ } else if (!permissionCheck.hasAccess) {
2188
+ repoWarnings.push({
2189
+ title: "Admin permissions required",
2190
+ message: `You might need admin permissions on ${repoName} to set up GitHub Actions.`,
2191
+ instructions: [
2192
+ "Repository admins can install GitHub Apps and set secrets",
2193
+ "Ask a repository admin to run this command if setup fails",
2194
+ "Alternatively, you can use the manual setup instructions"
2195
+ ]
2196
+ });
2197
+ }
2198
+ const workflowExists = await checkExistingWorkflowFile(repoName);
2199
+ if (repoWarnings.length > 0) {
2200
+ const allWarnings = [...state.warnings, ...repoWarnings];
2201
+ setState((prev) => ({
2202
+ ...prev,
2203
+ selectedRepoName: repoName,
2204
+ workflowExists,
2205
+ warnings: allWarnings,
2206
+ step: "warnings"
2207
+ }));
2208
+ } else {
2209
+ logEvent("tengu_install_github_app_step_completed", {
2210
+ step: "choose-repo"
2211
+ });
2212
+ setState((prev) => ({
2213
+ ...prev,
2214
+ selectedRepoName: repoName,
2215
+ workflowExists,
2216
+ step: "install-app"
2217
+ }));
2218
+ setTimeout(openGitHubAppInstallation, 0);
2219
+ }
2220
+ } else if (state.step === "install-app") {
2221
+ logEvent("tengu_install_github_app_step_completed", {
2222
+ step: "install-app"
2223
+ });
2224
+ if (state.workflowExists) {
2225
+ setState((prev) => ({ ...prev, step: "check-existing-workflow" }));
2226
+ } else {
2227
+ setState((prev) => ({ ...prev, step: "select-workflows" }));
2228
+ }
2229
+ } else if (state.step === "check-existing-workflow") {
2230
+ return;
2231
+ } else if (state.step === "select-workflows") {
2232
+ return;
2233
+ } else if (state.step === "check-existing-secret") {
2234
+ logEvent("tengu_install_github_app_step_completed", {
2235
+ step: "check-existing-secret"
2236
+ });
2237
+ if (state.useExistingSecret) {
2238
+ await runSetupGitHubActions(null, state.secretName);
2239
+ } else {
2240
+ await runSetupGitHubActions(state.apiKeyOrOAuthToken, state.secretName);
2241
+ }
2242
+ } else if (state.step === "api-key") {
2243
+ if (state.selectedApiKeyOption === "oauth") {
2244
+ return;
2245
+ }
2246
+ const apiKeyToUse = state.selectedApiKeyOption === "existing" ? existingApiKey : state.apiKeyOrOAuthToken;
2247
+ if (!apiKeyToUse) {
2248
+ logEvent("tengu_install_github_app_error", {
2249
+ reason: "api_key_missing"
2250
+ });
2251
+ setState((prev) => ({
2252
+ ...prev,
2253
+ step: "error",
2254
+ error: "API key is required"
2255
+ }));
2256
+ return;
2257
+ }
2258
+ setState((prev) => ({
2259
+ ...prev,
2260
+ apiKeyOrOAuthToken: apiKeyToUse,
2261
+ useExistingKey: state.selectedApiKeyOption === "existing"
2262
+ }));
2263
+ const checkSecretsResult = await execFileNoThrow("gh", [
2264
+ "secret",
2265
+ "list",
2266
+ "--app",
2267
+ "actions",
2268
+ "--repo",
2269
+ state.selectedRepoName
2270
+ ]);
2271
+ if (checkSecretsResult.code === 0) {
2272
+ const lines = checkSecretsResult.stdout.split(`
2273
+ `);
2274
+ const hasAnthropicKey = lines.some((line) => {
2275
+ return /^ANTHROPIC_API_KEY\s+/.test(line);
2276
+ });
2277
+ if (hasAnthropicKey) {
2278
+ logEvent("tengu_install_github_app_step_completed", {
2279
+ step: "api-key"
2280
+ });
2281
+ setState((prev) => ({
2282
+ ...prev,
2283
+ secretExists: true,
2284
+ step: "check-existing-secret"
2285
+ }));
2286
+ } else {
2287
+ logEvent("tengu_install_github_app_step_completed", {
2288
+ step: "api-key"
2289
+ });
2290
+ await runSetupGitHubActions(apiKeyToUse, state.secretName);
2291
+ }
2292
+ } else {
2293
+ logEvent("tengu_install_github_app_step_completed", {
2294
+ step: "api-key"
2295
+ });
2296
+ await runSetupGitHubActions(apiKeyToUse, state.secretName);
2297
+ }
2298
+ }
2299
+ };
2300
+ const handleRepoUrlChange = (value) => {
2301
+ setState((prev) => ({ ...prev, selectedRepoName: value }));
2302
+ };
2303
+ const handleApiKeyChange = (value) => {
2304
+ setState((prev) => ({ ...prev, apiKeyOrOAuthToken: value }));
2305
+ };
2306
+ const handleApiKeyOptionChange = (option) => {
2307
+ setState((prev) => ({ ...prev, selectedApiKeyOption: option }));
2308
+ };
2309
+ const handleCreateOAuthToken = import_react6.useCallback(() => {
2310
+ logEvent("tengu_install_github_app_step_completed", {
2311
+ step: "api-key"
2312
+ });
2313
+ setState((prev) => ({ ...prev, step: "oauth-flow" }));
2314
+ }, []);
2315
+ const handleOAuthSuccess = import_react6.useCallback((token) => {
2316
+ logEvent("tengu_install_github_app_step_completed", {
2317
+ step: "oauth-flow"
2318
+ });
2319
+ setState((prev) => ({
2320
+ ...prev,
2321
+ apiKeyOrOAuthToken: token,
2322
+ useExistingKey: false,
2323
+ secretName: "CLAUDE_CODE_OAUTH_TOKEN",
2324
+ authType: "oauth_token"
2325
+ }));
2326
+ runSetupGitHubActions(token, "CLAUDE_CODE_OAUTH_TOKEN");
2327
+ }, [runSetupGitHubActions]);
2328
+ const handleOAuthCancel = import_react6.useCallback(() => {
2329
+ setState((prev) => ({ ...prev, step: "api-key" }));
2330
+ }, []);
2331
+ const handleSecretNameChange = (value) => {
2332
+ if (value && !/^[a-zA-Z0-9_]+$/.test(value))
2333
+ return;
2334
+ setState((prev) => ({ ...prev, secretName: value }));
2335
+ };
2336
+ const handleToggleUseCurrentRepo = (useCurrentRepo) => {
2337
+ setState((prev) => ({
2338
+ ...prev,
2339
+ useCurrentRepo,
2340
+ selectedRepoName: useCurrentRepo ? prev.currentRepo : ""
2341
+ }));
2342
+ };
2343
+ const handleToggleUseExistingKey = (useExistingKey) => {
2344
+ setState((prev) => ({ ...prev, useExistingKey }));
2345
+ };
2346
+ const handleToggleUseExistingSecret = (useExistingSecret) => {
2347
+ setState((prev) => ({
2348
+ ...prev,
2349
+ useExistingSecret,
2350
+ secretName: useExistingSecret ? "ANTHROPIC_API_KEY" : ""
2351
+ }));
2352
+ };
2353
+ const handleWorkflowAction = async (action) => {
2354
+ if (action === "exit") {
2355
+ props.onDone("Installation cancelled by user");
2356
+ return;
2357
+ }
2358
+ logEvent("tengu_install_github_app_step_completed", {
2359
+ step: "check-existing-workflow"
2360
+ });
2361
+ setState((prev) => ({ ...prev, workflowAction: action }));
2362
+ if (action === "skip" || action === "update") {
2363
+ if (existingApiKey) {
2364
+ await checkExistingSecret();
2365
+ } else {
2366
+ setState((prev) => ({ ...prev, step: "api-key" }));
2367
+ }
2368
+ }
2369
+ };
2370
+ function handleDismissKeyDown(e) {
2371
+ e.preventDefault();
2372
+ if (state.step === "success") {
2373
+ logEvent("tengu_install_github_app_completed", {});
2374
+ }
2375
+ props.onDone(state.step === "success" ? "GitHub Actions setup complete!" : state.error ? `Couldn't install GitHub App: ${state.error}
2376
+ For manual setup instructions, see: ${GITHUB_ACTION_SETUP_DOCS_URL}` : `GitHub App installation failed
2377
+ For manual setup instructions, see: ${GITHUB_ACTION_SETUP_DOCS_URL}`);
2378
+ }
2379
+ switch (state.step) {
2380
+ case "check-gh":
2381
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(CheckGitHubStep, {}, undefined, false, undefined, this);
2382
+ case "warnings":
2383
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(WarningsStep, {
2384
+ warnings: state.warnings,
2385
+ onContinue: handleSubmit
2386
+ }, undefined, false, undefined, this);
2387
+ case "choose-repo":
2388
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ChooseRepoStep, {
2389
+ currentRepo: state.currentRepo,
2390
+ useCurrentRepo: state.useCurrentRepo,
2391
+ repoUrl: state.selectedRepoName,
2392
+ onRepoUrlChange: handleRepoUrlChange,
2393
+ onToggleUseCurrentRepo: handleToggleUseCurrentRepo,
2394
+ onSubmit: handleSubmit
2395
+ }, undefined, false, undefined, this);
2396
+ case "install-app":
2397
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(InstallAppStep, {
2398
+ repoUrl: state.selectedRepoName,
2399
+ onSubmit: handleSubmit
2400
+ }, undefined, false, undefined, this);
2401
+ case "check-existing-workflow":
2402
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ExistingWorkflowStep, {
2403
+ repoName: state.selectedRepoName,
2404
+ onSelectAction: handleWorkflowAction
2405
+ }, undefined, false, undefined, this);
2406
+ case "check-existing-secret":
2407
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(CheckExistingSecretStep, {
2408
+ useExistingSecret: state.useExistingSecret,
2409
+ secretName: state.secretName,
2410
+ onToggleUseExistingSecret: handleToggleUseExistingSecret,
2411
+ onSecretNameChange: handleSecretNameChange,
2412
+ onSubmit: handleSubmit
2413
+ }, undefined, false, undefined, this);
2414
+ case "api-key":
2415
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ApiKeyStep, {
2416
+ existingApiKey,
2417
+ useExistingKey: state.useExistingKey,
2418
+ apiKeyOrOAuthToken: state.apiKeyOrOAuthToken,
2419
+ onApiKeyChange: handleApiKeyChange,
2420
+ onToggleUseExistingKey: handleToggleUseExistingKey,
2421
+ onSubmit: handleSubmit,
2422
+ onCreateOAuthToken: isAnthropicAuthEnabled() ? handleCreateOAuthToken : undefined,
2423
+ selectedOption: state.selectedApiKeyOption,
2424
+ onSelectOption: handleApiKeyOptionChange
2425
+ }, undefined, false, undefined, this);
2426
+ case "creating":
2427
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(CreatingStep, {
2428
+ currentWorkflowInstallStep: state.currentWorkflowInstallStep,
2429
+ secretExists: state.secretExists,
2430
+ useExistingSecret: state.useExistingSecret,
2431
+ secretName: state.secretName,
2432
+ skipWorkflow: state.workflowAction === "skip",
2433
+ selectedWorkflows: state.selectedWorkflows
2434
+ }, undefined, false, undefined, this);
2435
+ case "success":
2436
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
2437
+ tabIndex: 0,
2438
+ autoFocus: true,
2439
+ onKeyDown: handleDismissKeyDown,
2440
+ children: /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(SuccessStep, {
2441
+ secretExists: state.secretExists,
2442
+ useExistingSecret: state.useExistingSecret,
2443
+ secretName: state.secretName,
2444
+ skipWorkflow: state.workflowAction === "skip"
2445
+ }, undefined, false, undefined, this)
2446
+ }, undefined, false, undefined, this);
2447
+ case "error":
2448
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
2449
+ tabIndex: 0,
2450
+ autoFocus: true,
2451
+ onKeyDown: handleDismissKeyDown,
2452
+ children: /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ErrorStep, {
2453
+ error: state.error,
2454
+ errorReason: state.errorReason,
2455
+ errorInstructions: state.errorInstructions
2456
+ }, undefined, false, undefined, this)
2457
+ }, undefined, false, undefined, this);
2458
+ case "select-workflows":
2459
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(WorkflowMultiselectDialog, {
2460
+ defaultSelections: state.selectedWorkflows,
2461
+ onSubmit: (selectedWorkflows) => {
2462
+ logEvent("tengu_install_github_app_step_completed", {
2463
+ step: "select-workflows"
2464
+ });
2465
+ setState((prev) => ({
2466
+ ...prev,
2467
+ selectedWorkflows
2468
+ }));
2469
+ if (existingApiKey) {
2470
+ checkExistingSecret();
2471
+ } else {
2472
+ setState((prev) => ({ ...prev, step: "api-key" }));
2473
+ }
2474
+ }
2475
+ }, undefined, false, undefined, this);
2476
+ case "oauth-flow":
2477
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(OAuthFlowStep, {
2478
+ onSuccess: handleOAuthSuccess,
2479
+ onCancel: handleOAuthCancel
2480
+ }, undefined, false, undefined, this);
2481
+ }
2482
+ }
2483
+ async function call(onDone) {
2484
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(InstallGitHubApp, {
2485
+ onDone
2486
+ }, undefined, false, undefined, this);
2487
+ }
2488
+ var import_react6, jsx_dev_runtime13, INITIAL_STATE;
2489
+ var init_install_github_app = __esm(() => {
2490
+ init_execa();
2491
+ init_analytics();
2492
+ init_WorkflowMultiselectDialog();
2493
+ init_github_app();
2494
+ init_useExitOnCtrlCDWithKeybindings();
2495
+ init_src();
2496
+ init_auth();
2497
+ init_browser();
2498
+ init_execFileNoThrow();
2499
+ init_git();
2500
+ init_stringUtils();
2501
+ init_ApiKeyStep();
2502
+ init_CheckExistingSecretStep();
2503
+ init_CheckGitHubStep();
2504
+ init_ChooseRepoStep();
2505
+ init_CreatingStep();
2506
+ init_ErrorStep();
2507
+ init_ExistingWorkflowStep();
2508
+ init_InstallAppStep();
2509
+ init_OAuthFlowStep();
2510
+ init_SuccessStep();
2511
+ init_setupGitHubActions();
2512
+ init_WarningsStep();
2513
+ import_react6 = __toESM(require_react(), 1);
2514
+ jsx_dev_runtime13 = __toESM(require_jsx_dev_runtime(), 1);
2515
+ INITIAL_STATE = {
2516
+ step: "check-gh",
2517
+ selectedRepoName: "",
2518
+ currentRepo: "",
2519
+ useCurrentRepo: false,
2520
+ apiKeyOrOAuthToken: "",
2521
+ useExistingKey: true,
2522
+ currentWorkflowInstallStep: 0,
2523
+ warnings: [],
2524
+ secretExists: false,
2525
+ secretName: "ANTHROPIC_API_KEY",
2526
+ useExistingSecret: true,
2527
+ workflowExists: false,
2528
+ selectedWorkflows: ["claude", "claude-review"],
2529
+ selectedApiKeyOption: "new",
2530
+ authType: "api_key"
2531
+ };
2532
+ });
2533
+ init_install_github_app();
2534
+
2535
+ export {
2536
+ call
2537
+ };