claude-code-best 1.0.3 → 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 (522) hide show
  1. package/README.md +104 -369
  2. package/dist/{chunk-5wxspfct.js → chunk-01qzvbp3.js} +8 -2
  3. package/dist/chunk-053bj0m0.js +247 -0
  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-52n4py3b.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-by7ezad6.js → chunk-0rn4v8sg.js} +42 -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-15y014gg.js +102 -0
  17. package/dist/{chunk-44fpr6jq.js → chunk-168xb8v1.js} +4 -2
  18. package/dist/{chunk-8fmbf525.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-36k3f7pn.js → chunk-1ebqpwhn.js} +79 -59
  24. package/dist/{chunk-ap2a2er6.js → chunk-1mh5vt6v.js} +102 -80
  25. package/dist/chunk-1qf125vg.js +123 -0
  26. package/dist/{chunk-fcz5eche.js → chunk-1sp6713v.js} +139 -170
  27. package/dist/{chunk-d18z9pna.js → chunk-1thgdca1.js} +2 -2
  28. package/dist/chunk-1z1gfx2c.js +443 -0
  29. package/dist/{chunk-7z8j9qfn.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-5r3ak65p.js → chunk-2bw5nqsw.js} +4 -4
  36. package/dist/chunk-2mxstrx5.js +445 -0
  37. package/dist/{chunk-w2z5pqd3.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-k9c3888e.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-2kbk09sb.js → chunk-3cvcwgsr.js} +79 -59
  44. package/dist/{chunk-rs45skes.js → chunk-3xv7rjsy.js} +15 -11
  45. package/dist/chunk-42x5tjk2.js +42 -0
  46. package/dist/{chunk-n78qmqpq.js → chunk-436r0x2n.js} +8 -8
  47. package/dist/{chunk-k3vpzx3c.js → chunk-44q4jkwa.js} +27 -67
  48. package/dist/{chunk-qnbdekts.js → chunk-44w22kyx.js} +111 -132
  49. package/dist/{chunk-7m2nd8da.js → chunk-46fcr28b.js} +31 -10
  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-48w0df8a.js +32 -0
  53. package/dist/chunk-4cp6193g.js +9076 -0
  54. package/dist/chunk-4d0de73v.js +436 -0
  55. package/dist/chunk-4eecm90d.js +1030 -0
  56. package/dist/{chunk-jfv3zczw.js → chunk-4f4ccg1h.js} +10 -115
  57. package/dist/chunk-4h102wt5.js +65 -0
  58. package/dist/{chunk-6n2qgm9v.js → chunk-4hv90qcz.js} +1 -1
  59. package/dist/{chunk-4gj6zzg1.js → chunk-4jcqmf9w.js} +43 -29
  60. package/dist/{chunk-067wa5sn.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-nrp9yaq6.js → chunk-4xy0c1dz.js} +16 -12
  64. package/dist/{chunk-77g09znh.js → chunk-53c9gb9c.js} +23 -16
  65. package/dist/{chunk-03nqtgyr.js → chunk-53zsn91p.js} +42 -30
  66. package/dist/{chunk-gkrx7ptx.js → chunk-548g1d6z.js} +113 -114
  67. package/dist/chunk-559yvwh1.js +63 -0
  68. package/dist/chunk-5a6ahhvy.js +594 -0
  69. package/dist/{chunk-h2j4t3fk.js → chunk-5c6man70.js} +9692 -17630
  70. package/dist/chunk-5hb5ev7b.js +74 -0
  71. package/dist/{chunk-hx2tr4ep.js → chunk-5z28bqne.js} +34 -475
  72. package/dist/{chunk-p7g7pf3f.js → chunk-61ahbn23.js} +8 -6
  73. package/dist/chunk-64c1avct.js +13 -0
  74. package/dist/{chunk-0sb5scxx.js → chunk-652wnf1z.js} +5 -5
  75. package/dist/{chunk-1w361mz1.js → chunk-66jkaz3q.js} +109 -213
  76. package/dist/{chunk-q25bjaev.js → chunk-677as3nh.js} +2 -2
  77. package/dist/chunk-68ksfahx.js +386 -0
  78. package/dist/{chunk-xs0hwvpa.js → chunk-68pfxvxt.js} +14 -9
  79. package/dist/{chunk-epmheefa.js → chunk-69hys77v.js} +8 -8
  80. package/dist/{chunk-404wc7d4.js → chunk-6ayqcq3h.js} +126 -119
  81. package/dist/chunk-6kpbgc5w.js +23 -0
  82. package/dist/chunk-6mpsxxsf.js +362 -0
  83. package/dist/chunk-6nze0g86.js +119 -0
  84. package/dist/{chunk-v1mgv1et.js → chunk-6p4cyhb3.js} +4 -3
  85. package/dist/{chunk-w2qfgzzh.js → chunk-6t62dbnb.js} +61 -100
  86. package/dist/chunk-6t87a3q6.js +2842 -0
  87. package/dist/{chunk-q6av622g.js → chunk-6xana182.js} +18 -13
  88. package/dist/{chunk-fpf4cgbt.js → chunk-7bfach0x.js} +9 -9
  89. package/dist/{chunk-g6e1ab2k.js → chunk-7f1ggjr2.js} +81 -61
  90. package/dist/chunk-7fxjmmfw.js +1172 -0
  91. package/dist/{chunk-ckcagq32.js → chunk-7gqf9wej.js} +5 -5
  92. package/dist/chunk-7j3dkjqq.js +38 -0
  93. package/dist/chunk-7ns74x0q.js +475 -0
  94. package/dist/chunk-7qmknpkq.js +272 -0
  95. package/dist/chunk-7rzepn9c.js +83 -0
  96. package/dist/chunk-7tdcwje9.js +68 -0
  97. package/dist/{chunk-201dvaa3.js → chunk-8201tnhf.js} +11 -5
  98. package/dist/{chunk-dv1wfr85.js → chunk-8225arm6.js} +5 -4
  99. package/dist/chunk-822wfv88.js +70 -0
  100. package/dist/chunk-837tm8ht.js +183 -0
  101. package/dist/chunk-8a2ajt5d.js +878 -0
  102. package/dist/{chunk-drv8qvwz.js → chunk-8bymxfn4.js} +43 -29
  103. package/dist/chunk-8cwbzk7h.js +118 -0
  104. package/dist/chunk-8d0ev0m2.js +111 -0
  105. package/dist/chunk-8g5pe1gr.js +37 -0
  106. package/dist/{chunk-g0j0t6qk.js → chunk-8g747a8x.js} +1 -1
  107. package/dist/chunk-8kfwb79z.js +436 -0
  108. package/dist/{chunk-xyqr1cww.js → chunk-8me0yq6v.js} +12 -12
  109. package/dist/{chunk-qdrwxg3e.js → chunk-8n8285ax.js} +91 -71
  110. package/dist/{chunk-sdj9b9wh.js → chunk-8pn8tvgg.js} +9 -154
  111. package/dist/{chunk-ha0xq3e9.js → chunk-8qhr4n77.js} +64 -106
  112. package/dist/{chunk-fpjzr5jj.js → chunk-8s9bbk3r.js} +62 -45
  113. package/dist/{chunk-e3g8q4cn.js → chunk-905d2hee.js} +10 -8
  114. package/dist/{chunk-3psth3ez.js → chunk-91xq5y4a.js} +9 -9
  115. package/dist/{chunk-rq1kckze.js → chunk-93xsyzsp.js} +1 -1
  116. package/dist/chunk-99pmbfqp.js +230 -0
  117. package/dist/chunk-9f14bkn9.js +33068 -0
  118. package/dist/{chunk-ex978bsn.js → chunk-9m78gjpd.js} +1 -1
  119. package/dist/{chunk-hpwa620w.js → chunk-9pm2d2gv.js} +251 -306
  120. package/dist/chunk-a136cvvz.js +27 -0
  121. package/dist/{chunk-n5t9m8h9.js → chunk-a1bjde7d.js} +7 -7
  122. package/dist/chunk-a2evk7n1.js +168 -0
  123. package/dist/{chunk-6heqkcjx.js → chunk-a3k4w4cm.js} +42 -28
  124. package/dist/chunk-a3mcc1sb.js +1403 -0
  125. package/dist/{chunk-8hq5kk3y.js → chunk-a4twdmhf.js} +3 -2
  126. package/dist/chunk-a8eaey19.js +66 -0
  127. package/dist/chunk-abkb5pw6.js +426 -0
  128. package/dist/chunk-ae76ded0.js +30 -0
  129. package/dist/{chunk-2v1br2x0.js → chunk-agx5w9ce.js} +14 -8
  130. package/dist/chunk-ah46h8rp.js +70 -0
  131. package/dist/chunk-aj3azy6z.js +409 -0
  132. package/dist/chunk-an6z4rzv.js +158 -0
  133. package/dist/{chunk-r6b58y3x.js → chunk-ase86y73.js} +1 -3
  134. package/dist/{chunk-e6s36z54.js → chunk-avfjb6pd.js} +17 -557
  135. package/dist/{chunk-1hhdpn3t.js → chunk-az5x70pn.js} +8 -5
  136. package/dist/{chunk-91gk0g2y.js → chunk-b6rg3egp.js} +33 -18
  137. package/dist/chunk-b73r6ngr.js +125 -0
  138. package/dist/{chunk-8bedvdm1.js → chunk-b81hd3m6.js} +1 -1
  139. package/dist/{chunk-ebfsjcvm.js → chunk-b9mhpc0v.js} +3 -3
  140. package/dist/chunk-b9ndqcdv.js +139 -0
  141. package/dist/{chunk-w7wgpqcp.js → chunk-bd8zk9tn.js} +7 -7
  142. package/dist/chunk-bdy6n17s.js +343 -0
  143. package/dist/{chunk-s8y2tfzf.js → chunk-bf1j3azq.js} +156 -119
  144. package/dist/{chunk-j5j6nrfq.js → chunk-bfcet2mw.js} +2 -2
  145. package/dist/{chunk-jy35mvy3.js → chunk-bmjmrk76.js} +7 -7
  146. package/dist/{chunk-ra0r65nx.js → chunk-bsj8e2mb.js} +11 -11
  147. package/dist/{chunk-jce5r25x.js → chunk-bt64sq5y.js} +5 -4
  148. package/dist/{chunk-vyc0rjyx.js → chunk-bwg7582d.js} +1 -1
  149. package/dist/{chunk-3be7ka25.js → chunk-bxcfz5gy.js} +1 -1
  150. package/dist/{chunk-7wm1rjfm.js → chunk-c1k9tg7h.js} +518 -810
  151. package/dist/{chunk-qwvrkydc.js → chunk-c5pxerks.js} +13 -11
  152. package/dist/chunk-c6sjhj89.js +1284 -0
  153. package/dist/{chunk-brcnd1j0.js → chunk-c9q0phsg.js} +9 -6
  154. package/dist/chunk-caj0ab74.js +129 -0
  155. package/dist/chunk-chsyvavm.js +3435 -0
  156. package/dist/chunk-cjpt035a.js +269 -0
  157. package/dist/chunk-cmcbatgz.js +147 -0
  158. package/dist/chunk-cnsj3vq2.js +35 -0
  159. package/dist/chunk-cqjmxeqv.js +269 -0
  160. package/dist/{chunk-cdz5yb0r.js → chunk-crmjpsqe.js} +13 -2
  161. package/dist/{chunk-2mcp388c.js → chunk-cvb1v08x.js} +38 -32
  162. package/dist/{chunk-w0r5627q.js → chunk-cxhvyf7c.js} +234 -363
  163. package/dist/{chunk-s0wvh65m.js → chunk-cxx0e4nv.js} +1343 -2839
  164. package/dist/chunk-cy2hswr1.js +15 -0
  165. package/dist/{chunk-g9q2cznf.js → chunk-cy6ezb6j.js} +125994 -138958
  166. package/dist/{chunk-ks0m9njy.js → chunk-d2jekryq.js} +8 -8
  167. package/dist/chunk-d4mdda98.js +94 -0
  168. package/dist/{chunk-hgtf13es.js → chunk-d6ve5pze.js} +10 -10
  169. package/dist/{chunk-55wgxwa9.js → chunk-d7886r6a.js} +6928 -6935
  170. package/dist/{chunk-4bgz02m1.js → chunk-d83tmb5h.js} +87 -64
  171. package/dist/{chunk-hdwh7ncw.js → chunk-d8meetqc.js} +84 -63
  172. package/dist/{chunk-128nh5j9.js → chunk-d8r0q4ps.js} +547 -866
  173. package/dist/chunk-d95k8xkm.js +84 -0
  174. package/dist/chunk-dd4m7t1v.js +112 -0
  175. package/dist/{chunk-rcdpvnxh.js → chunk-dekbr08w.js} +24 -20
  176. package/dist/{chunk-cvge4pvp.js → chunk-dk8287aa.js} +1 -1
  177. package/dist/chunk-dm3n2qgd.js +24 -0
  178. package/dist/{chunk-b0105v1f.js → chunk-dmxte86x.js} +3 -3
  179. package/dist/{chunk-zkmxtgc3.js → chunk-dqvwn28p.js} +19 -15
  180. package/dist/chunk-drkm8yx2.js +34 -0
  181. package/dist/chunk-dsbewdgm.js +148 -0
  182. package/dist/{chunk-w7h2yphx.js → chunk-dwekpr47.js} +2 -2
  183. package/dist/{chunk-hg776v69.js → chunk-e3299veq.js} +16 -68
  184. package/dist/{chunk-wqpr7002.js → chunk-e5hcyxae.js} +132 -18
  185. package/dist/chunk-e7h0nd5w.js +106 -0
  186. package/dist/{chunk-7qwme3ab.js → chunk-eaemyebz.js} +5 -5
  187. package/dist/{chunk-hjhc4cpt.js → chunk-edzkkadh.js} +2 -2
  188. package/dist/chunk-em99fnet.js +128 -0
  189. package/dist/{chunk-hfzj1m07.js → chunk-epyaq1z0.js} +13 -4
  190. package/dist/{chunk-r8f13sz1.js → chunk-eqmkajs4.js} +102 -195
  191. package/dist/{chunk-gax0fcbx.js → chunk-ergam9ft.js} +5 -5
  192. package/dist/chunk-es2fdse0.js +63 -0
  193. package/dist/{chunk-grdvmq7q.js → chunk-esn3tgm2.js} +8 -6
  194. package/dist/{chunk-ptmcaxqn.js → chunk-et8ybmt2.js} +9 -7
  195. package/dist/chunk-ew9rp41b.js +300 -0
  196. package/dist/{chunk-dvfb4qwt.js → chunk-ewx6xfzb.js} +2 -2
  197. package/dist/chunk-eyjtbtt0.js +137 -0
  198. package/dist/chunk-f0jd2p9n.js +797 -0
  199. package/dist/{chunk-vzqrbsd1.js → chunk-f69rgsm2.js} +5 -5
  200. package/dist/{chunk-45kxdsp8.js → chunk-f6rbj3gz.js} +17 -12
  201. package/dist/chunk-fbhyqxdg.js +1182 -0
  202. package/dist/chunk-feyzykye.js +10 -0
  203. package/dist/chunk-ffhejx56.js +107 -0
  204. package/dist/{chunk-cpe70sxw.js → chunk-fhx6nt2a.js} +42 -28
  205. package/dist/chunk-fkkysfev.js +158 -0
  206. package/dist/chunk-fn510gqw.js +216 -0
  207. package/dist/chunk-ftsg8bjm.js +117 -0
  208. package/dist/{chunk-s39js2d3.js → chunk-fyts9grb.js} +2 -2
  209. package/dist/{chunk-bjqw6798.js → chunk-fz0ch109.js} +6 -5
  210. package/dist/{chunk-q1e6pzwh.js → chunk-g1jarkx9.js} +38 -8
  211. package/dist/chunk-g9f19ttm.js +15 -0
  212. package/dist/chunk-g9qte35t.js +341 -0
  213. package/dist/chunk-gaav53dc.js +105 -0
  214. package/dist/chunk-gfx3cwrk.js +75 -0
  215. package/dist/chunk-gk2d1x2a.js +946 -0
  216. package/dist/chunk-gkbat1p9.js +121 -0
  217. package/dist/{chunk-cg43nnpk.js → chunk-gmnyk2t8.js} +8 -6
  218. package/dist/{chunk-m23b51r2.js → chunk-gnmdprq3.js} +191 -338
  219. package/dist/{chunk-bq6x1ehp.js → chunk-gpz0ddyz.js} +8 -8
  220. package/dist/{chunk-yt6z8030.js → chunk-gv1csnc3.js} +217 -355
  221. package/dist/{chunk-nx6nds18.js → chunk-gv37c8ax.js} +3 -3
  222. package/dist/{chunk-h6c8cms4.js → chunk-gzr2601k.js} +10 -10
  223. package/dist/{chunk-2tkt52mz.js → chunk-h3pda469.js} +37 -82
  224. package/dist/{chunk-qqfa0dqg.js → chunk-h4b85amj.js} +20 -32
  225. package/dist/chunk-h5zv78zq.js +352 -0
  226. package/dist/{chunk-2x3gmbws.js → chunk-h7edytkc.js} +5 -5
  227. package/dist/{chunk-as261f01.js → chunk-ha0wbzc3.js} +13 -11
  228. package/dist/{chunk-nxsh6de2.js → chunk-hcgkak1j.js} +20 -125
  229. package/dist/{chunk-tjaqa99q.js → chunk-hezj20qy.js} +3 -3
  230. package/dist/{chunk-7ahman84.js → chunk-hf85ht0m.js} +2 -2
  231. package/dist/{chunk-w0hx9v3y.js → chunk-ht1nfygk.js} +42 -28
  232. package/dist/chunk-j316jjby.js +108 -0
  233. package/dist/chunk-j3fge71v.js +115 -0
  234. package/dist/{chunk-v4h5psgs.js → chunk-j4x0t6k2.js} +46 -31
  235. package/dist/{chunk-9gbamk79.js → chunk-j5bth84e.js} +5 -1
  236. package/dist/chunk-j783d5af.js +134 -0
  237. package/dist/chunk-j7pbwf9x.js +108 -0
  238. package/dist/{chunk-rf2w4x97.js → chunk-j8rnrm5n.js} +120 -142
  239. package/dist/{chunk-vratq94g.js → chunk-j9gxwbe3.js} +1 -1
  240. package/dist/{chunk-3r24h7t6.js → chunk-jaaxk89e.js} +1 -1
  241. package/dist/{chunk-y47cg3kz.js → chunk-jaew3662.js} +18 -13
  242. package/dist/{chunk-q1txr206.js → chunk-jbbj16w2.js} +128 -185
  243. package/dist/chunk-jerew25v.js +148 -0
  244. package/dist/{chunk-v399mzxk.js → chunk-jf0p00fz.js} +2 -2
  245. package/dist/{chunk-97r68x5g.js → chunk-jfsah2w3.js} +1065 -1762
  246. package/dist/{chunk-av73dywf.js → chunk-jna2tcvj.js} +8 -8
  247. package/dist/{chunk-yym1e1dr.js → chunk-jng0mb4r.js} +10 -10
  248. package/dist/chunk-jrrmwfp4.js +66 -0
  249. package/dist/{chunk-0rc2rn3b.js → chunk-jt6fa514.js} +14 -12
  250. package/dist/chunk-jvkyx1b7.js +911 -0
  251. package/dist/{chunk-41xeh3t9.js → chunk-jy6c07wa.js} +4 -4
  252. package/dist/chunk-k1fvb16y.js +269 -0
  253. package/dist/{chunk-bqfnp99q.js → chunk-k3s4yk22.js} +1 -1
  254. package/dist/{chunk-madfgr3n.js → chunk-k46gxg21.js} +68 -8
  255. package/dist/chunk-k8wwyz2t.js +110 -0
  256. package/dist/{chunk-mnx3wyv4.js → chunk-ka3fdfyb.js} +83 -62
  257. package/dist/{chunk-k5c8ssc6.js → chunk-ka4x7mhn.js} +42 -28
  258. package/dist/chunk-kb99zpps.js +216 -0
  259. package/dist/{chunk-1dyeexvn.js → chunk-kd3mmsd2.js} +4 -4
  260. package/dist/{chunk-1xkekb9y.js → chunk-kfd89dsd.js} +5 -3
  261. package/dist/{chunk-g7fxbqsc.js → chunk-km1wcchx.js} +87 -68
  262. package/dist/{chunk-248szg6m.js → chunk-kmhwx18d.js} +3 -3
  263. package/dist/{chunk-pabnr66n.js → chunk-kq91dwkq.js} +8 -6
  264. package/dist/chunk-m17m84b7.js +111 -0
  265. package/dist/chunk-m1a0s9fd.js +1070 -0
  266. package/dist/{chunk-jafes477.js → chunk-m2bcpk8j.js} +4 -3
  267. package/dist/{chunk-t0brxw87.js → chunk-m7jtn7dk.js} +80 -60
  268. package/dist/chunk-mq2mgyt9.js +103 -0
  269. package/dist/chunk-msv3w4qp.js +1811 -0
  270. package/dist/chunk-mx28h61f.js +1147 -0
  271. package/dist/{chunk-wf7yz2j0.js → chunk-mxe1f4jg.js} +13 -11
  272. package/dist/{chunk-n5crdyay.js → chunk-mzwjvfr2.js} +137 -124
  273. package/dist/{chunk-gf96dtb6.js → chunk-n2n0sq7r.js} +71 -77
  274. package/dist/{chunk-m06q12hg.js → chunk-n8mpqdje.js} +1 -1
  275. package/dist/chunk-n9e984ba.js +132 -0
  276. package/dist/chunk-netzwgv1.js +154 -0
  277. package/dist/{chunk-xszk7n10.js → chunk-nh3cd07f.js} +1 -1
  278. package/dist/chunk-njrz6mbe.js +66 -0
  279. package/dist/{chunk-sb2sew2f.js → chunk-nv7pfr7k.js} +2 -2
  280. package/dist/{chunk-g9xf7jc4.js → chunk-nwd8pb55.js} +85 -65
  281. package/dist/{chunk-5hva0tsg.js → chunk-p2yv7m0g.js} +6 -6
  282. package/dist/chunk-p5t2vy90.js +259 -0
  283. package/dist/{chunk-zk2wsm7d.js → chunk-p7vkh4wx.js} +2 -2
  284. package/dist/{chunk-da4ve9t5.js → chunk-p8crqj70.js} +10 -10
  285. package/dist/{chunk-02y0y853.js → chunk-pcngtzr8.js} +12 -6
  286. package/dist/{chunk-3vpqaqc6.js → chunk-pdjem6h1.js} +53 -71
  287. package/dist/{chunk-7rgwp44r.js → chunk-pmxdzjq0.js} +11 -9
  288. package/dist/{chunk-3s5r02ps.js → chunk-pnkcecq2.js} +31 -57
  289. package/dist/{chunk-zsfxha74.js → chunk-pshjyzq4.js} +8 -7
  290. package/dist/chunk-pt1yj9zf.js +107 -0
  291. package/dist/{chunk-rxwb7b78.js → chunk-py6b9d5b.js} +2331 -4219
  292. package/dist/chunk-q7n8d91g.js +67 -0
  293. package/dist/{chunk-e5pntxye.js → chunk-q7tpyeb3.js} +6 -4
  294. package/dist/{chunk-7ymfj7m3.js → chunk-q82r31er.js} +1 -1
  295. package/dist/chunk-qajrkk97.js +298 -0
  296. package/dist/chunk-qbrh24cn.js +119 -0
  297. package/dist/chunk-qd9ntz7c.js +230 -0
  298. package/dist/chunk-qfr5tcd5.js +2537 -0
  299. package/dist/chunk-qpzfmkct.js +456 -0
  300. package/dist/{chunk-ywxd4qw4.js → chunk-qtfc6wdh.js} +2 -5
  301. package/dist/chunk-r032587e.js +83 -0
  302. package/dist/chunk-r2k2jy0y.js +51 -0
  303. package/dist/{chunk-8mqwac85.js → chunk-r4dnnggx.js} +22 -16
  304. package/dist/{chunk-5wnn3t3a.js → chunk-r5n8fvw0.js} +7 -7
  305. package/dist/{chunk-pxvatg16.js → chunk-r7kh03er.js} +231 -190
  306. package/dist/{chunk-z4wtem3z.js → chunk-rfs0mfg8.js} +147 -151
  307. package/dist/{chunk-hrzerbfw.js → chunk-rgbbtszq.js} +14 -14
  308. package/dist/{chunk-ctw5jwcd.js → chunk-rkak3kjw.js} +10 -10
  309. package/dist/chunk-rp568bfw.js +111 -0
  310. package/dist/chunk-rtv718sv.js +146 -0
  311. package/dist/{chunk-8d5eyjse.js → chunk-rvkvehat.js} +5284 -3093
  312. package/dist/chunk-s1baskk7.js +14 -0
  313. package/dist/{chunk-tse7q7k1.js → chunk-s1eb67v3.js} +79 -59
  314. package/dist/{chunk-7rn4t7tx.js → chunk-s59kx26r.js} +87 -64
  315. package/dist/chunk-s6yk6m3b.js +109 -0
  316. package/dist/{chunk-bsk44136.js → chunk-sca71yv8.js} +11 -9
  317. package/dist/chunk-sfrwm87k.js +151 -0
  318. package/dist/chunk-sgaknx21.js +123 -0
  319. package/dist/{chunk-4y62603j.js → chunk-snyaz093.js} +9 -15
  320. package/dist/{chunk-ytg914ra.js → chunk-sq8wkk3z.js} +1 -3
  321. package/dist/chunk-sxqj7s2h.js +54 -0
  322. package/dist/chunk-t2m6cjp1.js +264 -0
  323. package/dist/chunk-t6hmvb6k.js +1021 -0
  324. package/dist/chunk-t72x960a.js +125 -0
  325. package/dist/chunk-t9kashay.js +440 -0
  326. package/dist/chunk-t9wzf009.js +151 -0
  327. package/dist/chunk-ta1dgyj1.js +154 -0
  328. package/dist/chunk-tavxhayf.js +149 -0
  329. package/dist/{chunk-2tw2ve8h.js → chunk-tcdv4gp8.js} +18 -12
  330. package/dist/chunk-td3b74vm.js +362 -0
  331. package/dist/{chunk-mt25echc.js → chunk-tezak8rx.js} +1 -1
  332. package/dist/chunk-tgcw0rzx.js +262 -0
  333. package/dist/{chunk-9rcbyag3.js → chunk-tmdbrszg.js} +2 -2
  334. package/dist/{chunk-avwewk4v.js → chunk-v17qee2y.js} +12 -8
  335. package/dist/{chunk-njtjmsx7.js → chunk-v1jd31dw.js} +2 -2
  336. package/dist/chunk-var1et7e.js +66 -0
  337. package/dist/{chunk-j5zq8axt.js → chunk-ve9wswz4.js} +7 -131
  338. package/dist/{chunk-hqmz36b3.js → chunk-vf612n57.js} +21 -101
  339. package/dist/chunk-vfhabc5j.js +109 -0
  340. package/dist/{chunk-wszmas1q.js → chunk-vgy0w6tt.js} +2 -2
  341. package/dist/chunk-vh02fvz1.js +375 -0
  342. package/dist/{chunk-jz6sqm8m.js → chunk-vm935era.js} +1083 -881
  343. package/dist/{chunk-e7393td6.js → chunk-vtb8z6as.js} +14 -9
  344. package/dist/chunk-w2kf9sxn.js +115 -0
  345. package/dist/chunk-w7trx259.js +132 -0
  346. package/dist/chunk-w92b262y.js +1072 -0
  347. package/dist/chunk-w9zqjhvm.js +103 -0
  348. package/dist/{chunk-0he1tqj5.js → chunk-wb2fvy1k.js} +81 -61
  349. package/dist/chunk-ws2d81aj.js +123 -0
  350. package/dist/{chunk-k808gmhk.js → chunk-wssgdcck.js} +2 -2
  351. package/dist/{chunk-t9z6njcr.js → chunk-wtycm8km.js} +9 -9
  352. package/dist/chunk-wz0d8mna.js +108 -0
  353. package/dist/chunk-x01wtn3p.js +144 -0
  354. package/dist/{chunk-ze747xz6.js → chunk-x2sp7rcv.js} +73 -105
  355. package/dist/{chunk-7vtykt4v.js → chunk-xbprynsc.js} +18 -46
  356. package/dist/{chunk-p196v9d0.js → chunk-xext3y2y.js} +8 -6
  357. package/dist/{chunk-r66hz8j6.js → chunk-xycy3c8q.js} +15 -12
  358. package/dist/{chunk-npv8q5qr.js → chunk-y01ys1vm.js} +25 -74
  359. package/dist/{chunk-spqaamnc.js → chunk-y78t50v0.js} +2 -2
  360. package/dist/chunk-y9bgt2k1.js +78 -0
  361. package/dist/{chunk-j8rw3m89.js → chunk-ydm0nfsv.js} +6 -6
  362. package/dist/{chunk-3cn070p7.js → chunk-yetebjek.js} +291 -502
  363. package/dist/chunk-ym5r3jnk.js +2007 -0
  364. package/dist/chunk-ysks0ewj.js +237 -0
  365. package/dist/chunk-yv3evkgg.js +68 -0
  366. package/dist/chunk-yw79dz62.js +164 -0
  367. package/dist/{chunk-ea18z8vr.js → chunk-yy59gvs4.js} +159 -183
  368. package/dist/{chunk-def1dc97.js → chunk-yyax4hdg.js} +10 -8
  369. package/dist/chunk-yzx3mhfd.js +110 -0
  370. package/dist/chunk-z0q85m5f.js +108 -0
  371. package/dist/chunk-z1bs6d7k.js +24 -0
  372. package/dist/chunk-z6e5jp2w.js +119 -0
  373. package/dist/chunk-z7ssqvt6.js +6886 -0
  374. package/dist/chunk-z95yxwyb.js +61 -0
  375. package/dist/{chunk-5a3cw988.js → chunk-z9aqj026.js} +5 -5
  376. package/dist/chunk-zc6dxhk9.js +169 -0
  377. package/dist/{chunk-2t3vw4tx.js → chunk-ze6zvkg6.js} +10 -10
  378. package/dist/{chunk-t0rgmccj.js → chunk-zejm280k.js} +1 -1
  379. package/dist/chunk-zfapazzd.js +37 -0
  380. package/dist/chunk-zj4fqmnc.js +219 -0
  381. package/dist/chunk-zkrpbswn.js +1608 -0
  382. package/dist/chunk-zktbb38m.js +112 -0
  383. package/dist/{chunk-2mcrd0rj.js → chunk-zptcqa7t.js} +92 -71
  384. package/dist/{chunk-a3csma98.js → chunk-zvnsjbt8.js} +1 -1
  385. package/dist/chunk-zwaanw8y.js +110 -0
  386. package/dist/{chunk-g3t0act8.js → chunk-zzm33q8x.js} +1 -1
  387. package/dist/{chunk-3gqdqmzb.js → chunk-zzzc1ead.js} +17 -12
  388. package/dist/cli.js +39 -10
  389. package/dist/download-ripgrep.js +24821 -0
  390. package/dist/vendor/audio-capture/arm64-darwin/audio-capture.node +0 -0
  391. package/dist/vendor/audio-capture/arm64-linux/audio-capture.node +0 -0
  392. package/dist/vendor/audio-capture/arm64-win32/audio-capture.node +0 -0
  393. package/dist/vendor/audio-capture/x64-darwin/audio-capture.node +0 -0
  394. package/dist/vendor/audio-capture/x64-linux/audio-capture.node +0 -0
  395. package/dist/vendor/audio-capture/x64-win32/audio-capture.node +0 -0
  396. package/package.json +25 -15
  397. package/scripts/download-ripgrep.ts +335 -0
  398. package/scripts/postinstall.cjs +319 -0
  399. package/dist/chunk-07ysf2mw.js +0 -184
  400. package/dist/chunk-0ewgfms5.js +0 -117
  401. package/dist/chunk-165b9y9k.js +0 -70
  402. package/dist/chunk-17g3drrw.js +0 -121
  403. package/dist/chunk-1jv1ckhg.js +0 -1152
  404. package/dist/chunk-1pxd1xfp.js +0 -103
  405. package/dist/chunk-1tzexy7d.js +0 -258
  406. package/dist/chunk-271zt54b.js +0 -1871
  407. package/dist/chunk-2a27tvzp.js +0 -281
  408. package/dist/chunk-2g1zxpt7.js +0 -2833
  409. package/dist/chunk-2jb48txn.js +0 -98
  410. package/dist/chunk-2kc13eta.js +0 -88
  411. package/dist/chunk-2tme3s1c.js +0 -114
  412. package/dist/chunk-4491abz9.js +0 -99
  413. package/dist/chunk-4dfmgx6h.js +0 -69
  414. package/dist/chunk-4fbyr2hm.js +0 -279
  415. package/dist/chunk-5dsvtbwb.js +0 -87
  416. package/dist/chunk-5t59fqg3.js +0 -127
  417. package/dist/chunk-60nc5bh3.js +0 -1579
  418. package/dist/chunk-6dcq96a3.js +0 -128
  419. package/dist/chunk-6tm5941a.js +0 -152
  420. package/dist/chunk-79zmgkg5.js +0 -750
  421. package/dist/chunk-7d35rxr3.js +0 -69
  422. package/dist/chunk-7enxknwt.js +0 -442
  423. package/dist/chunk-7j0wpf4m.js +0 -89
  424. package/dist/chunk-7q6pjeyp.js +0 -1493
  425. package/dist/chunk-7whgbwhx.js +0 -584
  426. package/dist/chunk-9egdc8n4.js +0 -463
  427. package/dist/chunk-9rr0wepz.js +0 -56
  428. package/dist/chunk-ajp7hmws.js +0 -422
  429. package/dist/chunk-bm1qb16p.js +0 -17
  430. package/dist/chunk-bmvzacx5.js +0 -998
  431. package/dist/chunk-bw093kge.js +0 -129
  432. package/dist/chunk-c4q9x8t2.js +0 -105
  433. package/dist/chunk-c6421kme.js +0 -54
  434. package/dist/chunk-cdajcgne.js +0 -195
  435. package/dist/chunk-ch8avrbh.js +0 -86
  436. package/dist/chunk-chkyv40s.js +0 -2642
  437. package/dist/chunk-d049dd11.js +0 -348
  438. package/dist/chunk-d7tw94h4.js +0 -114
  439. package/dist/chunk-daeav7vb.js +0 -418
  440. package/dist/chunk-dxnv8hfn.js +0 -536
  441. package/dist/chunk-dy3tzxgq.js +0 -91
  442. package/dist/chunk-exy9bnjf.js +0 -212
  443. package/dist/chunk-f1f3dmd5.js +0 -713
  444. package/dist/chunk-f7yg1atj.js +0 -47
  445. package/dist/chunk-fakajzny.js +0 -372
  446. package/dist/chunk-ftrm87vt.js +0 -467
  447. package/dist/chunk-ftsp0cj3.js +0 -105
  448. package/dist/chunk-fv7hhcns.js +0 -345
  449. package/dist/chunk-fvcwxb8x.js +0 -83
  450. package/dist/chunk-g00hs992.js +0 -90
  451. package/dist/chunk-g5fpkpeg.js +0 -520
  452. package/dist/chunk-g9qyg278.js +0 -88
  453. package/dist/chunk-gkjdjqfs.js +0 -112
  454. package/dist/chunk-gqk545se.js +0 -6107
  455. package/dist/chunk-gyj242zr.js +0 -20
  456. package/dist/chunk-gzmjp1eb.js +0 -696
  457. package/dist/chunk-hbh17tng.js +0 -1013
  458. package/dist/chunk-hdfzyzk4.js +0 -85
  459. package/dist/chunk-hdtb5jce.js +0 -101
  460. package/dist/chunk-j99mjxam.js +0 -220
  461. package/dist/chunk-jaqg0k7h.js +0 -271
  462. package/dist/chunk-jdew773m.js +0 -115
  463. package/dist/chunk-jjsx6t78.js +0 -169
  464. package/dist/chunk-jpr8js4w.js +0 -328
  465. package/dist/chunk-jx817w05.js +0 -11
  466. package/dist/chunk-k0g3jve7.js +0 -89
  467. package/dist/chunk-k1g3g183.js +0 -128
  468. package/dist/chunk-k1p54aq6.js +0 -54
  469. package/dist/chunk-kexj9c6y.js +0 -5398
  470. package/dist/chunk-kgg1gq3t.js +0 -113
  471. package/dist/chunk-kwkrek4t.js +0 -95
  472. package/dist/chunk-m4gcjpj3.js +0 -103
  473. package/dist/chunk-m6rk1r6q.js +0 -194
  474. package/dist/chunk-mb2xmb0d.js +0 -53
  475. package/dist/chunk-mv1pbf3a.js +0 -297
  476. package/dist/chunk-my7r0cca.js +0 -469
  477. package/dist/chunk-nprycdaa.js +0 -525
  478. package/dist/chunk-p2pztr2r.js +0 -104
  479. package/dist/chunk-p68nf56z.js +0 -92
  480. package/dist/chunk-p6pc9xrz.js +0 -3443
  481. package/dist/chunk-p7skftb4.js +0 -108
  482. package/dist/chunk-pa2235xc.js +0 -160
  483. package/dist/chunk-pmzbyaat.js +0 -99
  484. package/dist/chunk-pqzk7nbh.js +0 -91
  485. package/dist/chunk-pvvew193.js +0 -802
  486. package/dist/chunk-pvx0x5zm.js +0 -2057
  487. package/dist/chunk-py77warv.js +0 -66
  488. package/dist/chunk-q43gccx5.js +0 -92
  489. package/dist/chunk-rse6x10x.js +0 -89
  490. package/dist/chunk-rxdhy7ve.js +0 -131
  491. package/dist/chunk-scb48p4v.js +0 -496
  492. package/dist/chunk-sjqtqj35.js +0 -28
  493. package/dist/chunk-sq0wf7jj.js +0 -1919
  494. package/dist/chunk-sy1hkkty.js +0 -400
  495. package/dist/chunk-sy9jf9v2.js +0 -109
  496. package/dist/chunk-t2km9bn3.js +0 -87
  497. package/dist/chunk-t4afbt2j.js +0 -88
  498. package/dist/chunk-t4c5qtdc.js +0 -42
  499. package/dist/chunk-t94jxd0x.js +0 -100
  500. package/dist/chunk-tb2g2bba.js +0 -192
  501. package/dist/chunk-tdpvdzbf.js +0 -97
  502. package/dist/chunk-tf4dw2e2.js +0 -142
  503. package/dist/chunk-tp40437d.js +0 -90
  504. package/dist/chunk-vabm7x8v.js +0 -61
  505. package/dist/chunk-veaq13qy.js +0 -490
  506. package/dist/chunk-vmz3wcnv.js +0 -641
  507. package/dist/chunk-vsgv16zj.js +0 -756
  508. package/dist/chunk-vxa0avb0.js +0 -105
  509. package/dist/chunk-x14dq3v1.js +0 -722
  510. package/dist/chunk-x6bg700t.js +0 -88
  511. package/dist/chunk-x8b7vft8.js +0 -132
  512. package/dist/chunk-xmdcxa8r.js +0 -374
  513. package/dist/chunk-y42a2xmv.js +0 -1316
  514. package/dist/chunk-y56ckcf8.js +0 -44
  515. package/dist/chunk-ybgghjqa.js +0 -602
  516. package/dist/chunk-zacq47b2.js +0 -84
  517. package/dist/chunk-zv3hxg5y.js +0 -267
  518. package/dist/chunk-zw2x3xxq.js +0 -96
  519. package/dist/chunk-zyf9epwn.js +0 -642
  520. package/dist/{chunk-whvdag1y.js → chunk-3bfs3x0h.js} +9 -9
  521. package/dist/{chunk-27xc1csx.js → chunk-dggvswz1.js} +3 -3
  522. package/dist/{chunk-0wftg29n.js → chunk-f9nt10jh.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
+ };