@zyycn/claudex 1.0.3-fork.0cb3e59

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 (456) hide show
  1. package/LICENSE.md +5 -0
  2. package/README.md +515 -0
  3. package/bin/claudex.js +40 -0
  4. package/dist/chunk-00xcm9ma.js +21933 -0
  5. package/dist/chunk-02gx6hwz.js +655 -0
  6. package/dist/chunk-06saje2v.js +39 -0
  7. package/dist/chunk-0731m51q.js +8 -0
  8. package/dist/chunk-08gaq1e6.js +253 -0
  9. package/dist/chunk-0dc7sstd.js +112 -0
  10. package/dist/chunk-0et2fwnm.js +169 -0
  11. package/dist/chunk-0fzmdbg5.js +216 -0
  12. package/dist/chunk-0gby1zjm.js +98 -0
  13. package/dist/chunk-0npyf61x.js +91 -0
  14. package/dist/chunk-0paqc2yw.js +15 -0
  15. package/dist/chunk-0phtbe2q.js +458 -0
  16. package/dist/chunk-0q2xkmse.js +58 -0
  17. package/dist/chunk-0sdqeyab.js +116 -0
  18. package/dist/chunk-0vkfrmqm.js +690 -0
  19. package/dist/chunk-0xjaqda8.js +1124 -0
  20. package/dist/chunk-0zqd56e7.js +86 -0
  21. package/dist/chunk-1141xmr4.js +8 -0
  22. package/dist/chunk-13n2g124.js +83 -0
  23. package/dist/chunk-14jv3jm7.js +17 -0
  24. package/dist/chunk-17ke93s2.js +91 -0
  25. package/dist/chunk-1bwnpgmv.js +644 -0
  26. package/dist/chunk-1cbn5kxf.js +7 -0
  27. package/dist/chunk-1h2famwb.js +49 -0
  28. package/dist/chunk-1j23x6pe.js +198 -0
  29. package/dist/chunk-1vh98qr0.js +4521 -0
  30. package/dist/chunk-1xkekb9y.js +19 -0
  31. package/dist/chunk-238g70xa.js +36 -0
  32. package/dist/chunk-2534gszj.js +95 -0
  33. package/dist/chunk-27xc1csx.js +104 -0
  34. package/dist/chunk-29heyb0a.js +654 -0
  35. package/dist/chunk-2a42s11t.js +412 -0
  36. package/dist/chunk-2eykm0j0.js +20 -0
  37. package/dist/chunk-2fwze72g.js +24 -0
  38. package/dist/chunk-2gzv8nrw.js +205 -0
  39. package/dist/chunk-2jhpjejz.js +605 -0
  40. package/dist/chunk-2k995y2x.js +880 -0
  41. package/dist/chunk-2m0wm5mn.js +756 -0
  42. package/dist/chunk-2nayx6q1.js +63 -0
  43. package/dist/chunk-2remehvd.js +6110 -0
  44. package/dist/chunk-2t1frg13.js +716 -0
  45. package/dist/chunk-2t3vw4tx.js +22820 -0
  46. package/dist/chunk-2tfdd2x0.js +95 -0
  47. package/dist/chunk-2yneprmc.js +87 -0
  48. package/dist/chunk-2zcggr61.js +33312 -0
  49. package/dist/chunk-30rst83v.js +168 -0
  50. package/dist/chunk-328dhq0p.js +208 -0
  51. package/dist/chunk-32q1kp1y.js +197 -0
  52. package/dist/chunk-32remjv9.js +5020 -0
  53. package/dist/chunk-3322z7nj.js +250 -0
  54. package/dist/chunk-35wnmznv.js +339 -0
  55. package/dist/chunk-36zeg659.js +90 -0
  56. package/dist/chunk-38700exh.js +42 -0
  57. package/dist/chunk-3c25bcsw.js +17 -0
  58. package/dist/chunk-3h8a89gy.js +46 -0
  59. package/dist/chunk-3nk79af8.js +8 -0
  60. package/dist/chunk-3peatsdv.js +41 -0
  61. package/dist/chunk-3vs3nm7w.js +31 -0
  62. package/dist/chunk-3w6s9m5w.js +16 -0
  63. package/dist/chunk-3xba7r34.js +469 -0
  64. package/dist/chunk-41fv13be.js +131 -0
  65. package/dist/chunk-44fpr6jq.js +434 -0
  66. package/dist/chunk-46bzfjbb.js +83 -0
  67. package/dist/chunk-46xsszyy.js +154 -0
  68. package/dist/chunk-483649rh.js +3418 -0
  69. package/dist/chunk-48nen4vg.js +41634 -0
  70. package/dist/chunk-495d85x1.js +8066 -0
  71. package/dist/chunk-4f6xmap7.js +153 -0
  72. package/dist/chunk-4g3v8y12.js +23 -0
  73. package/dist/chunk-4j2pg3ms.js +338 -0
  74. package/dist/chunk-4jm600zv.js +13 -0
  75. package/dist/chunk-4ka7s9ee.js +115 -0
  76. package/dist/chunk-4q95g821.js +460 -0
  77. package/dist/chunk-4qz9vbs1.js +349 -0
  78. package/dist/chunk-4t19tx5p.js +109 -0
  79. package/dist/chunk-4zfkzkt6.js +37 -0
  80. package/dist/chunk-4zjtn4vd.js +108 -0
  81. package/dist/chunk-50f017g0.js +849 -0
  82. package/dist/chunk-51kecgmn.js +168 -0
  83. package/dist/chunk-54ea16pv.js +155 -0
  84. package/dist/chunk-54ycqnh3.js +275 -0
  85. package/dist/chunk-55wgxwa9.js +13877 -0
  86. package/dist/chunk-56jgazae.js +28 -0
  87. package/dist/chunk-5bfzxa5p.js +300 -0
  88. package/dist/chunk-5eecpt8g.js +173807 -0
  89. package/dist/chunk-5j35ewt6.js +277 -0
  90. package/dist/chunk-5wrm5rwf.js +202 -0
  91. package/dist/chunk-5zrajk5c.js +328 -0
  92. package/dist/chunk-63grvbnw.js +373 -0
  93. package/dist/chunk-65s8h28p.js +123 -0
  94. package/dist/chunk-66pc6ar2.js +229 -0
  95. package/dist/chunk-6bd8brc4.js +48 -0
  96. package/dist/chunk-6dj5t602.js +341 -0
  97. package/dist/chunk-6g31pd6r.js +535 -0
  98. package/dist/chunk-6gr3c3w9.js +378 -0
  99. package/dist/chunk-6n15fb31.js +130 -0
  100. package/dist/chunk-6n2qgm9v.js +8 -0
  101. package/dist/chunk-6p9kb0sw.js +281 -0
  102. package/dist/chunk-6tq2v3rk.js +186 -0
  103. package/dist/chunk-6va3sq9g.js +500 -0
  104. package/dist/chunk-6vkpgtyn.js +101 -0
  105. package/dist/chunk-6w5bpt04.js +267 -0
  106. package/dist/chunk-73rpbt04.js +1947 -0
  107. package/dist/chunk-74bkpcta.js +850 -0
  108. package/dist/chunk-758rh65t.js +223 -0
  109. package/dist/chunk-760252na.js +101 -0
  110. package/dist/chunk-76xdyehq.js +84 -0
  111. package/dist/chunk-7739pg2c.js +4261 -0
  112. package/dist/chunk-78ja94ve.js +400 -0
  113. package/dist/chunk-7aw745vx.js +40175 -0
  114. package/dist/chunk-7e6ahfxz.js +61 -0
  115. package/dist/chunk-7m2nd8da.js +110 -0
  116. package/dist/chunk-7mmew3dp.js +54 -0
  117. package/dist/chunk-7mw85a2s.js +1155 -0
  118. package/dist/chunk-7q18p7bc.js +288 -0
  119. package/dist/chunk-7q237ftq.js +1585 -0
  120. package/dist/chunk-7wm5s02e.js +216 -0
  121. package/dist/chunk-7xyswgjh.js +8 -0
  122. package/dist/chunk-7zaxrfnt.js +42 -0
  123. package/dist/chunk-83hfzbx3.js +10 -0
  124. package/dist/chunk-83y7b98g.js +421 -0
  125. package/dist/chunk-85tc0rn1.js +212 -0
  126. package/dist/chunk-869898a3.js +765 -0
  127. package/dist/chunk-89f4afyz.js +117 -0
  128. package/dist/chunk-8bedvdm1.js +32 -0
  129. package/dist/chunk-8hq5kk3y.js +44 -0
  130. package/dist/chunk-8hw9w1wm.js +3446 -0
  131. package/dist/chunk-8k6q5mnn.js +26 -0
  132. package/dist/chunk-8ktxqpch.js +3060 -0
  133. package/dist/chunk-8ma0b3en.js +674 -0
  134. package/dist/chunk-8qmmgwm9.js +269 -0
  135. package/dist/chunk-8rjvjb5t.js +779 -0
  136. package/dist/chunk-8tnsngw2.js +31 -0
  137. package/dist/chunk-8y12jxg8.js +10 -0
  138. package/dist/chunk-8ymf4e6z.js +48 -0
  139. package/dist/chunk-90wp6wez.js +10510 -0
  140. package/dist/chunk-91q08khb.js +5954 -0
  141. package/dist/chunk-93mnvd83.js +274 -0
  142. package/dist/chunk-988f7f5d.js +192 -0
  143. package/dist/chunk-9c2way1p.js +106 -0
  144. package/dist/chunk-9gbamk79.js +93 -0
  145. package/dist/chunk-9k27xdmg.js +542 -0
  146. package/dist/chunk-9k2drwej.js +106 -0
  147. package/dist/chunk-9mh799n8.js +319 -0
  148. package/dist/chunk-9vqxfdra.js +102 -0
  149. package/dist/chunk-9x5zgy22.js +12 -0
  150. package/dist/chunk-a4zg3cnt.js +90 -0
  151. package/dist/chunk-a6xzz4qc.js +60 -0
  152. package/dist/chunk-a7rt19gv.js +2645 -0
  153. package/dist/chunk-a8ejc632.js +3094 -0
  154. package/dist/chunk-a8x7bb4n.js +372 -0
  155. package/dist/chunk-a900qr4e.js +120 -0
  156. package/dist/chunk-a9pjza30.js +128 -0
  157. package/dist/chunk-a9vdeb6y.js +258 -0
  158. package/dist/chunk-a9zh40sj.js +48 -0
  159. package/dist/chunk-aa3rx320.js +26840 -0
  160. package/dist/chunk-ab89rmm2.js +155 -0
  161. package/dist/chunk-aj6461xm.js +284 -0
  162. package/dist/chunk-any9980a.js +69 -0
  163. package/dist/chunk-ar1vk71q.js +220 -0
  164. package/dist/chunk-ar42apnb.js +692 -0
  165. package/dist/chunk-ass81j08.js +245 -0
  166. package/dist/chunk-b3r6mj2e.js +306 -0
  167. package/dist/chunk-b4wg70y1.js +54 -0
  168. package/dist/chunk-b75fzr8e.js +969 -0
  169. package/dist/chunk-b7cywkg9.js +908 -0
  170. package/dist/chunk-b8x1gk3y.js +1299 -0
  171. package/dist/chunk-b9kme9pv.js +38 -0
  172. package/dist/chunk-bc8tzdm6.js +98 -0
  173. package/dist/chunk-bf2yj476.js +523 -0
  174. package/dist/chunk-bjqw6798.js +328 -0
  175. package/dist/chunk-bm1qb16p.js +17 -0
  176. package/dist/chunk-bqfnp99q.js +477 -0
  177. package/dist/chunk-bt6pjwk8.js +53 -0
  178. package/dist/chunk-bvp4dgm4.js +182 -0
  179. package/dist/chunk-bxqv04xx.js +69 -0
  180. package/dist/chunk-c0hb3epj.js +1556 -0
  181. package/dist/chunk-c7ctgdbk.js +225 -0
  182. package/dist/chunk-cdz5yb0r.js +57 -0
  183. package/dist/chunk-cfv996bs.js +22 -0
  184. package/dist/chunk-cgfdkzhb.js +12 -0
  185. package/dist/chunk-ckj99whh.js +93 -0
  186. package/dist/chunk-cs5excdt.js +10476 -0
  187. package/dist/chunk-ctw3ccd6.js +584 -0
  188. package/dist/chunk-cveeqv76.js +91 -0
  189. package/dist/chunk-czensfac.js +476 -0
  190. package/dist/chunk-czvztj44.js +224 -0
  191. package/dist/chunk-d1r095gm.js +699 -0
  192. package/dist/chunk-d1x7cza8.js +445 -0
  193. package/dist/chunk-d3vvfd8r.js +106 -0
  194. package/dist/chunk-d9kz373t.js +122 -0
  195. package/dist/chunk-d9y2zh54.js +463 -0
  196. package/dist/chunk-ddz739ks.js +441 -0
  197. package/dist/chunk-de4kzjb1.js +1552 -0
  198. package/dist/chunk-dgqrcy74.js +48 -0
  199. package/dist/chunk-dnh7jtpb.js +37 -0
  200. package/dist/chunk-ds5nkfg0.js +1095 -0
  201. package/dist/chunk-dstxhxsx.js +121 -0
  202. package/dist/chunk-dv1wfr85.js +6373 -0
  203. package/dist/chunk-e5pntxye.js +37 -0
  204. package/dist/chunk-e77n3wgc.js +765 -0
  205. package/dist/chunk-e7ksgwbq.js +120 -0
  206. package/dist/chunk-ebkahz1j.js +24 -0
  207. package/dist/chunk-eebcvtbb.js +1646 -0
  208. package/dist/chunk-ehtwnxpg.js +1591 -0
  209. package/dist/chunk-eqp1rfft.js +17 -0
  210. package/dist/chunk-ewadzrm8.js +103 -0
  211. package/dist/chunk-ewhachv2.js +120 -0
  212. package/dist/chunk-excnajfs.js +108 -0
  213. package/dist/chunk-ez6gfswn.js +348 -0
  214. package/dist/chunk-ezf1ppbj.js +208 -0
  215. package/dist/chunk-f58ec6xk.js +91 -0
  216. package/dist/chunk-f5ma3nh5.js +3436 -0
  217. package/dist/chunk-f7q4yc1j.js +675 -0
  218. package/dist/chunk-f7qqfve4.js +160 -0
  219. package/dist/chunk-f9yjwf9r.js +1322 -0
  220. package/dist/chunk-fbpftpf0.js +69 -0
  221. package/dist/chunk-fbv4apne.js +51 -0
  222. package/dist/chunk-fd7nt73r.js +117 -0
  223. package/dist/chunk-ffk8cg49.js +61 -0
  224. package/dist/chunk-fpcjbens.js +184 -0
  225. package/dist/chunk-fvt4y30r.js +1319 -0
  226. package/dist/chunk-fyc5fepv.js +10 -0
  227. package/dist/chunk-g0j0t6qk.js +26 -0
  228. package/dist/chunk-g338npwr.js +1061 -0
  229. package/dist/chunk-g3t0act8.js +8 -0
  230. package/dist/chunk-gj2rs1h5.js +182 -0
  231. package/dist/chunk-gmaybtrd.js +726 -0
  232. package/dist/chunk-gmpyhcdr.js +567 -0
  233. package/dist/chunk-gq0kzj2c.js +195 -0
  234. package/dist/chunk-gq1sc60w.js +5398 -0
  235. package/dist/chunk-gr76xkdb.js +266 -0
  236. package/dist/chunk-gv0tqhg0.js +118 -0
  237. package/dist/chunk-gvx0ghfc.js +156 -0
  238. package/dist/chunk-gyj242zr.js +20 -0
  239. package/dist/chunk-gz4etn3r.js +102 -0
  240. package/dist/chunk-gzzfhtdv.js +7189 -0
  241. package/dist/chunk-h0qngp9w.js +157 -0
  242. package/dist/chunk-h0rbjg6x.js +55 -0
  243. package/dist/chunk-h20nxmw7.js +97 -0
  244. package/dist/chunk-h2bvdmje.js +111 -0
  245. package/dist/chunk-h5r7m7ze.js +727 -0
  246. package/dist/chunk-h6he4c34.js +71 -0
  247. package/dist/chunk-h8k6be74.js +528 -0
  248. package/dist/chunk-h9xcymwn.js +71 -0
  249. package/dist/chunk-hakdhagh.js +16606 -0
  250. package/dist/chunk-hdwqy5n7.js +146 -0
  251. package/dist/chunk-hgba8zda.js +16453 -0
  252. package/dist/chunk-hgfabxva.js +713 -0
  253. package/dist/chunk-hh7cmy4k.js +20 -0
  254. package/dist/chunk-hhwvfv1c.js +2337 -0
  255. package/dist/chunk-hhxc0wcy.js +103 -0
  256. package/dist/chunk-hj63t9sr.js +92 -0
  257. package/dist/chunk-hjd7rv7x.js +108 -0
  258. package/dist/chunk-hk9xz7gk.js +118 -0
  259. package/dist/chunk-hp1dhvmv.js +74 -0
  260. package/dist/chunk-hqmz36b3.js +552 -0
  261. package/dist/chunk-hzhe8ygc.js +547 -0
  262. package/dist/chunk-j2k4p94p.js +55 -0
  263. package/dist/chunk-j3a4p81y.js +184 -0
  264. package/dist/chunk-j5hc27hv.js +444 -0
  265. package/dist/chunk-j64ga6ta.js +8035 -0
  266. package/dist/chunk-jce5r25x.js +18 -0
  267. package/dist/chunk-jcyvmtj2.js +160 -0
  268. package/dist/chunk-jd32zbps.js +15 -0
  269. package/dist/chunk-jdgeec04.js +4249 -0
  270. package/dist/chunk-jgyff58b.js +258 -0
  271. package/dist/chunk-jjr5r7w7.js +92 -0
  272. package/dist/chunk-jn0mpjqf.js +333 -0
  273. package/dist/chunk-jnhkref0.js +30 -0
  274. package/dist/chunk-jpggn642.js +432 -0
  275. package/dist/chunk-jpp9dqv4.js +6956 -0
  276. package/dist/chunk-jx817w05.js +11 -0
  277. package/dist/chunk-jxtre36y.js +40 -0
  278. package/dist/chunk-jzmz18nn.js +65 -0
  279. package/dist/chunk-k0p9w03v.js +4957 -0
  280. package/dist/chunk-k0zwdngv.js +490 -0
  281. package/dist/chunk-k2aj61ee.js +27 -0
  282. package/dist/chunk-k8w1ezmk.js +90 -0
  283. package/dist/chunk-kcsn5yw7.js +44 -0
  284. package/dist/chunk-kdqsfmc5.js +196 -0
  285. package/dist/chunk-ke1tnbrn.js +377 -0
  286. package/dist/chunk-kjzy2qna.js +107 -0
  287. package/dist/chunk-kpm9svs6.js +95 -0
  288. package/dist/chunk-kwekc97v.js +18 -0
  289. package/dist/chunk-ky45jk6r.js +3205 -0
  290. package/dist/chunk-m0t8da6q.js +117 -0
  291. package/dist/chunk-m2j40h9c.js +9200 -0
  292. package/dist/chunk-mbaff8kf.js +146 -0
  293. package/dist/chunk-mhgvx0zj.js +73 -0
  294. package/dist/chunk-mk4gn915.js +470 -0
  295. package/dist/chunk-mt25echc.js +6157 -0
  296. package/dist/chunk-mt5bv97a.js +438 -0
  297. package/dist/chunk-mx28h61f.js +1147 -0
  298. package/dist/chunk-mzxce5mm.js +88 -0
  299. package/dist/chunk-n0qaeaa5.js +256 -0
  300. package/dist/chunk-n2pzg3mt.js +59 -0
  301. package/dist/chunk-n5k4xha0.js +32 -0
  302. package/dist/chunk-n7ttdtk0.js +641 -0
  303. package/dist/chunk-nc0gdh9t.js +606 -0
  304. package/dist/chunk-nj17bhkh.js +125 -0
  305. package/dist/chunk-nka1g8f4.js +773 -0
  306. package/dist/chunk-nnzxefrw.js +87 -0
  307. package/dist/chunk-nq0fxyxh.js +752 -0
  308. package/dist/chunk-nswvw0j4.js +473 -0
  309. package/dist/chunk-nt837qt9.js +21 -0
  310. package/dist/chunk-nw5zdpcj.js +802 -0
  311. package/dist/chunk-nwsmn6zm.js +15 -0
  312. package/dist/chunk-p2816w9z.js +1486 -0
  313. package/dist/chunk-p2d5nh3g.js +342 -0
  314. package/dist/chunk-p331ghzg.js +391 -0
  315. package/dist/chunk-p664cp33.js +99 -0
  316. package/dist/chunk-pak5mb7s.js +42 -0
  317. package/dist/chunk-pe6w0anj.js +780 -0
  318. package/dist/chunk-pkm43mwf.js +282 -0
  319. package/dist/chunk-pm3ng0bm.js +70 -0
  320. package/dist/chunk-pmsp9ed2.js +34 -0
  321. package/dist/chunk-ppwjyveh.js +8 -0
  322. package/dist/chunk-ps49ymvj.js +43 -0
  323. package/dist/chunk-pwwa7s62.js +11 -0
  324. package/dist/chunk-py5y9jh1.js +38 -0
  325. package/dist/chunk-pyesx3a8.js +140 -0
  326. package/dist/chunk-q0q2tsae.js +63 -0
  327. package/dist/chunk-q0sq5qtt.js +606 -0
  328. package/dist/chunk-q1by1vax.js +54 -0
  329. package/dist/chunk-q25bjaev.js +15 -0
  330. package/dist/chunk-q2hty1hy.js +61 -0
  331. package/dist/chunk-q7bxdsfd.js +22 -0
  332. package/dist/chunk-qbt1tq74.js +145 -0
  333. package/dist/chunk-qetzwv5m.js +28 -0
  334. package/dist/chunk-qnfx3qtx.js +617 -0
  335. package/dist/chunk-qp2qdcda.js +100 -0
  336. package/dist/chunk-qqfa0dqg.js +2343 -0
  337. package/dist/chunk-qz2x630m.js +49145 -0
  338. package/dist/chunk-r3ecyyb3.js +642 -0
  339. package/dist/chunk-r3pxqd84.js +89 -0
  340. package/dist/chunk-r53sxdq1.js +513 -0
  341. package/dist/chunk-r6b58y3x.js +17 -0
  342. package/dist/chunk-r6dahdmd.js +62 -0
  343. package/dist/chunk-r9xapwyb.js +745 -0
  344. package/dist/chunk-ra06qpba.js +132 -0
  345. package/dist/chunk-raq35wpc.js +1922 -0
  346. package/dist/chunk-raqgs410.js +116 -0
  347. package/dist/chunk-res15ktd.js +18 -0
  348. package/dist/chunk-rgwhsqte.js +348 -0
  349. package/dist/chunk-rn0v1hk8.js +34 -0
  350. package/dist/chunk-rtgznsee.js +43 -0
  351. package/dist/chunk-rtt7r7pp.js +93 -0
  352. package/dist/chunk-rwqp8zag.js +539 -0
  353. package/dist/chunk-ryydxc3f.js +931 -0
  354. package/dist/chunk-rzeekzsp.js +87 -0
  355. package/dist/chunk-s3pzvdss.js +50 -0
  356. package/dist/chunk-s4c5a2td.js +40 -0
  357. package/dist/chunk-s5n2qgaz.js +258 -0
  358. package/dist/chunk-s87dt0fj.js +1493 -0
  359. package/dist/chunk-sbbj6ta3.js +1711 -0
  360. package/dist/chunk-sc47b62f.js +165 -0
  361. package/dist/chunk-sd36yzx8.js +954 -0
  362. package/dist/chunk-sdj9b9wh.js +782 -0
  363. package/dist/chunk-shb6nvk6.js +27 -0
  364. package/dist/chunk-sn49y8be.js +99 -0
  365. package/dist/chunk-sp8wb67m.js +703 -0
  366. package/dist/chunk-sxa8b5t8.js +124 -0
  367. package/dist/chunk-szj5wvdy.js +28 -0
  368. package/dist/chunk-szqvjwww.js +96 -0
  369. package/dist/chunk-t0rgmccj.js +39 -0
  370. package/dist/chunk-t311b37r.js +163 -0
  371. package/dist/chunk-t3360k46.js +75 -0
  372. package/dist/chunk-t63re27d.js +38 -0
  373. package/dist/chunk-t6j5es92.js +134 -0
  374. package/dist/chunk-tag6m3ab.js +308 -0
  375. package/dist/chunk-tdgkxc3j.js +287 -0
  376. package/dist/chunk-tgw8v0sq.js +98 -0
  377. package/dist/chunk-th93qf0c.js +93 -0
  378. package/dist/chunk-tjk56vh8.js +81 -0
  379. package/dist/chunk-ts2p6bv1.js +224 -0
  380. package/dist/chunk-ttk5dzz8.js +25 -0
  381. package/dist/chunk-v073zhk5.js +40 -0
  382. package/dist/chunk-v1kzp02e.js +785 -0
  383. package/dist/chunk-v78fj8by.js +145 -0
  384. package/dist/chunk-v90xv5n9.js +157 -0
  385. package/dist/chunk-v9nt9zq6.js +648 -0
  386. package/dist/chunk-v9smspw2.js +4301 -0
  387. package/dist/chunk-vd3bb2zh.js +173 -0
  388. package/dist/chunk-vest0y6x.js +3830 -0
  389. package/dist/chunk-vf5sd1nq.js +12 -0
  390. package/dist/chunk-vhjx5fag.js +56 -0
  391. package/dist/chunk-vqk1n5qr.js +63 -0
  392. package/dist/chunk-vqn6x094.js +229 -0
  393. package/dist/chunk-vqvd3qz0.js +151 -0
  394. package/dist/chunk-vs89tkvk.js +92 -0
  395. package/dist/chunk-vtapv44m.js +165 -0
  396. package/dist/chunk-vyjeh50y.js +2149 -0
  397. package/dist/chunk-w100pzs6.js +41 -0
  398. package/dist/chunk-w2yzntwd.js +826 -0
  399. package/dist/chunk-w62fme7p.js +86 -0
  400. package/dist/chunk-w7993vfy.js +71 -0
  401. package/dist/chunk-w8gahavr.js +496 -0
  402. package/dist/chunk-wc4aza46.js +79 -0
  403. package/dist/chunk-wewayn8z.js +1016 -0
  404. package/dist/chunk-weydtrhz.js +791 -0
  405. package/dist/chunk-wfz0qffj.js +3939 -0
  406. package/dist/chunk-wgcssf6v.js +722 -0
  407. package/dist/chunk-whkhe74c.js +266 -0
  408. package/dist/chunk-wn2268qd.js +335 -0
  409. package/dist/chunk-wq5q81g4.js +1582 -0
  410. package/dist/chunk-wrhhmkf7.js +16 -0
  411. package/dist/chunk-wspjz9er.js +214 -0
  412. package/dist/chunk-wtpx8wcx.js +1874 -0
  413. package/dist/chunk-wyp16717.js +302 -0
  414. package/dist/chunk-wzpdet3m.js +843 -0
  415. package/dist/chunk-x0ypwxsz.js +104 -0
  416. package/dist/chunk-x67ffx2k.js +270 -0
  417. package/dist/chunk-x6r4v44b.js +8 -0
  418. package/dist/chunk-x8b7vft8.js +132 -0
  419. package/dist/chunk-x9k4fdvw.js +32 -0
  420. package/dist/chunk-xbsf7t5r.js +173 -0
  421. package/dist/chunk-xbtacp2f.js +4389 -0
  422. package/dist/chunk-xffq0yyv.js +79 -0
  423. package/dist/chunk-xm1c1mzd.js +56 -0
  424. package/dist/chunk-xq4cfvpn.js +213 -0
  425. package/dist/chunk-xq9wsyp9.js +48 -0
  426. package/dist/chunk-xqy6f112.js +277 -0
  427. package/dist/chunk-xsq9ae7x.js +90 -0
  428. package/dist/chunk-xszk7n10.js +14358 -0
  429. package/dist/chunk-xv3era3s.js +8 -0
  430. package/dist/chunk-xy0ep5zm.js +118 -0
  431. package/dist/chunk-xzxf08w0.js +247 -0
  432. package/dist/chunk-y1784krc.js +19 -0
  433. package/dist/chunk-y4cvymbk.js +2838 -0
  434. package/dist/chunk-y88sk42h.js +388 -0
  435. package/dist/chunk-y953qcc7.js +66 -0
  436. package/dist/chunk-ycgvqt42.js +178 -0
  437. package/dist/chunk-ycpq7mn5.js +644 -0
  438. package/dist/chunk-yfb6k7aw.js +94 -0
  439. package/dist/chunk-yp69m4qn.js +94 -0
  440. package/dist/chunk-ysvwcdav.js +9300 -0
  441. package/dist/chunk-ytvzxnx2.js +862 -0
  442. package/dist/chunk-ywxd4qw4.js +22 -0
  443. package/dist/chunk-yysj6sxt.js +336 -0
  444. package/dist/chunk-z2dp53wn.js +17 -0
  445. package/dist/chunk-zagmz9sy.js +247 -0
  446. package/dist/chunk-zbpm3xad.js +998 -0
  447. package/dist/chunk-zc6g0qqe.js +29 -0
  448. package/dist/chunk-zfavvrhe.js +753 -0
  449. package/dist/chunk-zk2wsm7d.js +15 -0
  450. package/dist/chunk-zrw9ava1.js +1391 -0
  451. package/dist/chunk-zsfxha74.js +17655 -0
  452. package/dist/chunk-ztmjzgq7.js +524 -0
  453. package/dist/chunk-zx7pgp71.js +20 -0
  454. package/dist/chunk-zz9km6hr.js +127 -0
  455. package/dist/cli.js +92 -0
  456. package/package.json +36 -0
@@ -0,0 +1,3446 @@
1
+ // @bun
2
+ import {
3
+ OAuthService,
4
+ Select,
5
+ SelectMulti,
6
+ Spinner,
7
+ TextInput,
8
+ init_CustomSelect,
9
+ init_SelectMulti,
10
+ init_Spinner,
11
+ init_TextInput,
12
+ init_oauth
13
+ } from "./chunk-5eecpt8g.js";
14
+ import"./chunk-czvztj44.js";
15
+ import"./chunk-46xsszyy.js";
16
+ import"./chunk-2zcggr61.js";
17
+ import"./chunk-q0q2tsae.js";
18
+ import"./chunk-t0rgmccj.js";
19
+ import {
20
+ Byline,
21
+ ConfigurableShortcutHint,
22
+ Dialog,
23
+ KeyboardShortcutHint,
24
+ init_Byline,
25
+ init_ConfigurableShortcutHint,
26
+ init_Dialog,
27
+ init_KeyboardShortcutHint
28
+ } from "./chunk-d9y2zh54.js";
29
+ import"./chunk-2gzv8nrw.js";
30
+ import"./chunk-ehtwnxpg.js";
31
+ import"./chunk-xffq0yyv.js";
32
+ import"./chunk-02gx6hwz.js";
33
+ import"./chunk-vhjx5fag.js";
34
+ import"./chunk-w2yzntwd.js";
35
+ import"./chunk-kdqsfmc5.js";
36
+ import"./chunk-j5hc27hv.js";
37
+ import"./chunk-cgfdkzhb.js";
38
+ import"./chunk-0fzmdbg5.js";
39
+ import {
40
+ init_useExitOnCtrlCDWithKeybindings,
41
+ useExitOnCtrlCDWithKeybindings
42
+ } from "./chunk-sn49y8be.js";
43
+ import"./chunk-9gbamk79.js";
44
+ import"./chunk-8rjvjb5t.js";
45
+ import"./chunk-gv0tqhg0.js";
46
+ import {
47
+ init_useKeybinding,
48
+ init_useTerminalSize,
49
+ useKeybinding,
50
+ useKeybindings,
51
+ useTerminalSize
52
+ } from "./chunk-nw5zdpcj.js";
53
+ import {
54
+ Link,
55
+ ThemedBox_default,
56
+ ThemedText,
57
+ color,
58
+ init_ink,
59
+ init_osc,
60
+ require_compiler_runtime,
61
+ setClipboard,
62
+ useTheme
63
+ } from "./chunk-aa3rx320.js";
64
+ import"./chunk-7m2nd8da.js";
65
+ import"./chunk-ps49ymvj.js";
66
+ import {
67
+ require_jsx_dev_runtime,
68
+ require_react
69
+ } from "./chunk-g338npwr.js";
70
+ import"./chunk-n2pzg3mt.js";
71
+ import"./chunk-zk2wsm7d.js";
72
+ import"./chunk-tdgkxc3j.js";
73
+ import {
74
+ init_browser,
75
+ openBrowser
76
+ } from "./chunk-7e6ahfxz.js";
77
+ import"./chunk-zrw9ava1.js";
78
+ import"./chunk-mx28h61f.js";
79
+ import {
80
+ getAnthropicApiKey,
81
+ init_auth,
82
+ init_config1 as init_config,
83
+ init_stringUtils,
84
+ isAnthropicAuthEnabled,
85
+ plural,
86
+ saveGlobalConfig,
87
+ saveOAuthTokensIfNeeded
88
+ } from "./chunk-hgba8zda.js";
89
+ import"./chunk-eebcvtbb.js";
90
+ import"./chunk-xq4cfvpn.js";
91
+ import"./chunk-4qz9vbs1.js";
92
+ import"./chunk-gmaybtrd.js";
93
+ import"./chunk-b75fzr8e.js";
94
+ import"./chunk-g0j0t6qk.js";
95
+ import"./chunk-3c25bcsw.js";
96
+ import"./chunk-nj17bhkh.js";
97
+ import"./chunk-55wgxwa9.js";
98
+ import"./chunk-vqk1n5qr.js";
99
+ import"./chunk-4jm600zv.js";
100
+ import"./chunk-wn2268qd.js";
101
+ import"./chunk-vqvd3qz0.js";
102
+ import"./chunk-f5ma3nh5.js";
103
+ import"./chunk-qz2x630m.js";
104
+ import"./chunk-d9kz373t.js";
105
+ import"./chunk-p2816w9z.js";
106
+ import"./chunk-v9smspw2.js";
107
+ import"./chunk-v1kzp02e.js";
108
+ import"./chunk-0vkfrmqm.js";
109
+ import"./chunk-0xjaqda8.js";
110
+ import"./chunk-res15ktd.js";
111
+ import"./chunk-wgcssf6v.js";
112
+ import"./chunk-cdz5yb0r.js";
113
+ import {
114
+ init_analytics,
115
+ logEvent
116
+ } from "./chunk-h0rbjg6x.js";
117
+ import"./chunk-dstxhxsx.js";
118
+ import {
119
+ getGithubRepo,
120
+ init_git
121
+ } from "./chunk-b8x1gk3y.js";
122
+ import"./chunk-9k2drwej.js";
123
+ import"./chunk-qnfx3qtx.js";
124
+ import"./chunk-fbpftpf0.js";
125
+ import"./chunk-3vs3nm7w.js";
126
+ import {
127
+ execFileNoThrow,
128
+ execa,
129
+ figures_default,
130
+ init_execFileNoThrow,
131
+ init_execa,
132
+ init_figures
133
+ } from "./chunk-gzzfhtdv.js";
134
+ import {
135
+ init_log,
136
+ logError
137
+ } from "./chunk-yysj6sxt.js";
138
+ import"./chunk-8tnsngw2.js";
139
+ import"./chunk-8bedvdm1.js";
140
+ import"./chunk-7wm5s02e.js";
141
+ import"./chunk-sbbj6ta3.js";
142
+ import"./chunk-fbv4apne.js";
143
+ import"./chunk-raqgs410.js";
144
+ import"./chunk-qqfa0dqg.js";
145
+ import"./chunk-hqmz36b3.js";
146
+ import"./chunk-4g3v8y12.js";
147
+ import"./chunk-7739pg2c.js";
148
+ import"./chunk-xszk7n10.js";
149
+ import"./chunk-sdj9b9wh.js";
150
+ import {
151
+ __esm,
152
+ __toESM
153
+ } from "./chunk-qp2qdcda.js";
154
+
155
+ // src/components/WorkflowMultiselectDialog.tsx
156
+ function renderInputGuide(exitState) {
157
+ if (exitState.pending) {
158
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
159
+ children: [
160
+ "Press ",
161
+ exitState.keyName,
162
+ " again to exit"
163
+ ]
164
+ }, undefined, true, undefined, this);
165
+ }
166
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Byline, {
167
+ children: [
168
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(KeyboardShortcutHint, {
169
+ shortcut: "\u2191\u2193",
170
+ action: "navigate"
171
+ }, undefined, false, undefined, this),
172
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(KeyboardShortcutHint, {
173
+ shortcut: "Space",
174
+ action: "toggle"
175
+ }, undefined, false, undefined, this),
176
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(KeyboardShortcutHint, {
177
+ shortcut: "Enter",
178
+ action: "confirm"
179
+ }, undefined, false, undefined, this),
180
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ConfigurableShortcutHint, {
181
+ action: "confirm:no",
182
+ context: "Confirmation",
183
+ fallback: "Esc",
184
+ description: "cancel"
185
+ }, undefined, false, undefined, this)
186
+ ]
187
+ }, undefined, true, undefined, this);
188
+ }
189
+ function WorkflowMultiselectDialog(t0) {
190
+ const $ = import_compiler_runtime.c(14);
191
+ const {
192
+ onSubmit,
193
+ defaultSelections
194
+ } = t0;
195
+ const [showError, setShowError] = import_react.useState(false);
196
+ let t1;
197
+ if ($[0] !== onSubmit) {
198
+ t1 = (selectedValues) => {
199
+ if (selectedValues.length === 0) {
200
+ setShowError(true);
201
+ return;
202
+ }
203
+ setShowError(false);
204
+ onSubmit(selectedValues);
205
+ };
206
+ $[0] = onSubmit;
207
+ $[1] = t1;
208
+ } else {
209
+ t1 = $[1];
210
+ }
211
+ const handleSubmit = t1;
212
+ let t2;
213
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
214
+ t2 = () => {
215
+ setShowError(false);
216
+ };
217
+ $[2] = t2;
218
+ } else {
219
+ t2 = $[2];
220
+ }
221
+ const handleChange = t2;
222
+ let t3;
223
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
224
+ t3 = () => {
225
+ setShowError(true);
226
+ };
227
+ $[3] = t3;
228
+ } else {
229
+ t3 = $[3];
230
+ }
231
+ const handleCancel = t3;
232
+ let t4;
233
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
234
+ t4 = /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedBox_default, {
235
+ children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
236
+ dimColor: true,
237
+ children: [
238
+ "More workflow examples (issue triage, CI fixes, etc.) at:",
239
+ " ",
240
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Link, {
241
+ url: "https://github.com/anthropics/claude-code-action/blob/main/examples/",
242
+ children: "https://github.com/anthropics/claude-code-action/blob/main/examples/"
243
+ }, undefined, false, undefined, this)
244
+ ]
245
+ }, undefined, true, undefined, this)
246
+ }, undefined, false, undefined, this);
247
+ $[4] = t4;
248
+ } else {
249
+ t4 = $[4];
250
+ }
251
+ let t5;
252
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
253
+ t5 = WORKFLOWS.map(_temp);
254
+ $[5] = t5;
255
+ } else {
256
+ t5 = $[5];
257
+ }
258
+ let t6;
259
+ if ($[6] !== defaultSelections || $[7] !== handleSubmit) {
260
+ t6 = /* @__PURE__ */ jsx_dev_runtime.jsxDEV(SelectMulti, {
261
+ options: t5,
262
+ defaultValue: defaultSelections,
263
+ onSubmit: handleSubmit,
264
+ onChange: handleChange,
265
+ onCancel: handleCancel,
266
+ hideIndexes: true
267
+ }, undefined, false, undefined, this);
268
+ $[6] = defaultSelections;
269
+ $[7] = handleSubmit;
270
+ $[8] = t6;
271
+ } else {
272
+ t6 = $[8];
273
+ }
274
+ let t7;
275
+ if ($[9] !== showError) {
276
+ t7 = showError && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedBox_default, {
277
+ children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
278
+ color: "error",
279
+ children: "You must select at least one workflow to continue"
280
+ }, undefined, false, undefined, this)
281
+ }, undefined, false, undefined, this);
282
+ $[9] = showError;
283
+ $[10] = t7;
284
+ } else {
285
+ t7 = $[10];
286
+ }
287
+ let t8;
288
+ if ($[11] !== t6 || $[12] !== t7) {
289
+ t8 = /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Dialog, {
290
+ title: "Select GitHub workflows to install",
291
+ subtitle: "We'll create a workflow file in your repository for each one you select.",
292
+ onCancel: handleCancel,
293
+ inputGuide: renderInputGuide,
294
+ children: [
295
+ t4,
296
+ t6,
297
+ t7
298
+ ]
299
+ }, undefined, true, undefined, this);
300
+ $[11] = t6;
301
+ $[12] = t7;
302
+ $[13] = t8;
303
+ } else {
304
+ t8 = $[13];
305
+ }
306
+ return t8;
307
+ }
308
+ function _temp(workflow) {
309
+ return {
310
+ label: workflow.label,
311
+ value: workflow.value
312
+ };
313
+ }
314
+ var import_compiler_runtime, import_react, jsx_dev_runtime, WORKFLOWS;
315
+ var init_WorkflowMultiselectDialog = __esm(() => {
316
+ init_ink();
317
+ init_ConfigurableShortcutHint();
318
+ init_SelectMulti();
319
+ init_Byline();
320
+ init_Dialog();
321
+ init_KeyboardShortcutHint();
322
+ import_compiler_runtime = __toESM(require_compiler_runtime(), 1);
323
+ import_react = __toESM(require_react(), 1);
324
+ jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
325
+ WORKFLOWS = [{
326
+ value: "claude",
327
+ label: "@Claude Code - Tag @claude in issues and PR comments"
328
+ }, {
329
+ value: "claude-review",
330
+ label: "Claude Code Review - Automated code review on new PRs"
331
+ }];
332
+ });
333
+
334
+ // src/constants/github-app.ts
335
+ 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
336
+
337
+ on:
338
+ issue_comment:
339
+ types: [created]
340
+ pull_request_review_comment:
341
+ types: [created]
342
+ issues:
343
+ types: [opened, assigned]
344
+ pull_request_review:
345
+ types: [submitted]
346
+
347
+ jobs:
348
+ claude:
349
+ if: |
350
+ (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
351
+ (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
352
+ (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
353
+ (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
354
+ runs-on: ubuntu-latest
355
+ permissions:
356
+ contents: read
357
+ pull-requests: read
358
+ issues: read
359
+ id-token: write
360
+ actions: read # Required for Claude to read CI results on PRs
361
+ steps:
362
+ - name: Checkout repository
363
+ uses: actions/checkout@v4
364
+ with:
365
+ fetch-depth: 1
366
+
367
+ - name: Run Claude Code
368
+ id: claude
369
+ uses: anthropics/claude-code-action@v1
370
+ with:
371
+ anthropic_api_key: \${{ secrets.ANTHROPIC_API_KEY }}
372
+
373
+ # This is an optional setting that allows Claude to read CI results on PRs
374
+ additional_permissions: |
375
+ actions: read
376
+
377
+ # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
378
+ # prompt: 'Update the pull request description to include a summary of changes.'
379
+
380
+ # Optional: Add claude_args to customize behavior and configuration
381
+ # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
382
+ # or https://code.claude.com/docs/en/cli-reference for available options
383
+ # claude_args: '--allowed-tools Bash(gh pr:*)'
384
+
385
+ `, PR_BODY = `## \uD83E\uDD16 Installing Claude Code GitHub App
386
+
387
+ This PR adds a GitHub Actions workflow that enables Claude Code integration in our repository.
388
+
389
+ ### What is Claude Code?
390
+
391
+ [Claude Code](https://claude.com/claude-code) is an AI coding agent that can help with:
392
+ - Bug fixes and improvements
393
+ - Documentation updates
394
+ - Implementing new features
395
+ - Code reviews and suggestions
396
+ - Writing tests
397
+ - And more!
398
+
399
+ ### How it works
400
+
401
+ Once this PR is merged, we'll be able to interact with Claude by mentioning @claude in a pull request or issue comment.
402
+ Once the workflow is triggered, Claude will analyze the comment and surrounding context, and execute on the request in a GitHub action.
403
+
404
+ ### Important Notes
405
+
406
+ - **This workflow won't take effect until this PR is merged**
407
+ - **@claude mentions won't work until after the merge is complete**
408
+ - The workflow runs automatically whenever Claude is mentioned in PR or issue comments
409
+ - Claude gets access to the entire PR or issue context including files, diffs, and previous comments
410
+
411
+ ### Security
412
+
413
+ - Our Anthropic API key is securely stored as a GitHub Actions secret
414
+ - Only users with write access to the repository can trigger the workflow
415
+ - All Claude runs are stored in the GitHub Actions run history
416
+ - Claude's default tools are limited to reading/writing files and interacting with our repo by creating comments, branches, and commits.
417
+ - We can add more allowed tools by adding them to the workflow file like:
418
+
419
+ \`\`\`
420
+ allowed_tools: Bash(npm install),Bash(npm run build),Bash(npm run lint),Bash(npm run test)
421
+ \`\`\`
422
+
423
+ There's more information in the [Claude Code action repo](https://github.com/anthropics/claude-code-action).
424
+
425
+ 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
426
+
427
+ on:
428
+ pull_request:
429
+ types: [opened, synchronize, ready_for_review, reopened]
430
+ # Optional: Only run on specific file changes
431
+ # paths:
432
+ # - "src/**/*.ts"
433
+ # - "src/**/*.tsx"
434
+ # - "src/**/*.js"
435
+ # - "src/**/*.jsx"
436
+
437
+ jobs:
438
+ claude-review:
439
+ # Optional: Filter by PR author
440
+ # if: |
441
+ # github.event.pull_request.user.login == 'external-contributor' ||
442
+ # github.event.pull_request.user.login == 'new-developer' ||
443
+ # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
444
+
445
+ runs-on: ubuntu-latest
446
+ permissions:
447
+ contents: read
448
+ pull-requests: read
449
+ issues: read
450
+ id-token: write
451
+
452
+ steps:
453
+ - name: Checkout repository
454
+ uses: actions/checkout@v4
455
+ with:
456
+ fetch-depth: 1
457
+
458
+ - name: Run Claude Code Review
459
+ id: claude-review
460
+ uses: anthropics/claude-code-action@v1
461
+ with:
462
+ anthropic_api_key: \${{ secrets.ANTHROPIC_API_KEY }}
463
+ plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
464
+ plugins: 'code-review@claude-code-plugins'
465
+ prompt: '/code-review:code-review \${{ github.repository }}/pull/\${{ github.event.pull_request.number }}'
466
+ # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
467
+ # or https://code.claude.com/docs/en/cli-reference for available options
468
+
469
+ `;
470
+ var init_github_app = () => {};
471
+
472
+ // src/commands/install-github-app/ApiKeyStep.tsx
473
+ function ApiKeyStep(t0) {
474
+ const $ = import_compiler_runtime2.c(55);
475
+ const {
476
+ existingApiKey,
477
+ apiKeyOrOAuthToken,
478
+ onApiKeyChange,
479
+ onSubmit,
480
+ onToggleUseExistingKey,
481
+ onCreateOAuthToken,
482
+ selectedOption: t1,
483
+ onSelectOption
484
+ } = t0;
485
+ const selectedOption = t1 === undefined ? existingApiKey ? "existing" : onCreateOAuthToken ? "oauth" : "new" : t1;
486
+ const [cursorOffset, setCursorOffset] = import_react2.useState(0);
487
+ const terminalSize = useTerminalSize();
488
+ const [theme] = useTheme();
489
+ let t2;
490
+ if ($[0] !== existingApiKey || $[1] !== onCreateOAuthToken || $[2] !== onSelectOption || $[3] !== onToggleUseExistingKey || $[4] !== selectedOption) {
491
+ t2 = () => {
492
+ if (selectedOption === "new" && onCreateOAuthToken) {
493
+ onSelectOption?.("oauth");
494
+ } else {
495
+ if (selectedOption === "oauth" && existingApiKey) {
496
+ onSelectOption?.("existing");
497
+ onToggleUseExistingKey(true);
498
+ }
499
+ }
500
+ };
501
+ $[0] = existingApiKey;
502
+ $[1] = onCreateOAuthToken;
503
+ $[2] = onSelectOption;
504
+ $[3] = onToggleUseExistingKey;
505
+ $[4] = selectedOption;
506
+ $[5] = t2;
507
+ } else {
508
+ t2 = $[5];
509
+ }
510
+ const handlePrevious = t2;
511
+ let t3;
512
+ if ($[6] !== onCreateOAuthToken || $[7] !== onSelectOption || $[8] !== onToggleUseExistingKey || $[9] !== selectedOption) {
513
+ t3 = () => {
514
+ if (selectedOption === "existing") {
515
+ onSelectOption?.(onCreateOAuthToken ? "oauth" : "new");
516
+ onToggleUseExistingKey(false);
517
+ } else {
518
+ if (selectedOption === "oauth") {
519
+ onSelectOption?.("new");
520
+ }
521
+ }
522
+ };
523
+ $[6] = onCreateOAuthToken;
524
+ $[7] = onSelectOption;
525
+ $[8] = onToggleUseExistingKey;
526
+ $[9] = selectedOption;
527
+ $[10] = t3;
528
+ } else {
529
+ t3 = $[10];
530
+ }
531
+ const handleNext = t3;
532
+ let t4;
533
+ if ($[11] !== onCreateOAuthToken || $[12] !== onSubmit || $[13] !== selectedOption) {
534
+ t4 = () => {
535
+ if (selectedOption === "oauth" && onCreateOAuthToken) {
536
+ onCreateOAuthToken();
537
+ } else {
538
+ onSubmit();
539
+ }
540
+ };
541
+ $[11] = onCreateOAuthToken;
542
+ $[12] = onSubmit;
543
+ $[13] = selectedOption;
544
+ $[14] = t4;
545
+ } else {
546
+ t4 = $[14];
547
+ }
548
+ const handleConfirm = t4;
549
+ const isTextInputVisible = selectedOption === "new";
550
+ let t5;
551
+ if ($[15] !== handleConfirm || $[16] !== handleNext || $[17] !== handlePrevious) {
552
+ t5 = {
553
+ "confirm:previous": handlePrevious,
554
+ "confirm:next": handleNext,
555
+ "confirm:yes": handleConfirm
556
+ };
557
+ $[15] = handleConfirm;
558
+ $[16] = handleNext;
559
+ $[17] = handlePrevious;
560
+ $[18] = t5;
561
+ } else {
562
+ t5 = $[18];
563
+ }
564
+ const t6 = !isTextInputVisible;
565
+ let t7;
566
+ if ($[19] !== t6) {
567
+ t7 = {
568
+ context: "Confirmation",
569
+ isActive: t6
570
+ };
571
+ $[19] = t6;
572
+ $[20] = t7;
573
+ } else {
574
+ t7 = $[20];
575
+ }
576
+ useKeybindings(t5, t7);
577
+ let t8;
578
+ if ($[21] !== handleNext || $[22] !== handlePrevious) {
579
+ t8 = {
580
+ "confirm:previous": handlePrevious,
581
+ "confirm:next": handleNext
582
+ };
583
+ $[21] = handleNext;
584
+ $[22] = handlePrevious;
585
+ $[23] = t8;
586
+ } else {
587
+ t8 = $[23];
588
+ }
589
+ let t9;
590
+ if ($[24] !== isTextInputVisible) {
591
+ t9 = {
592
+ context: "Confirmation",
593
+ isActive: isTextInputVisible
594
+ };
595
+ $[24] = isTextInputVisible;
596
+ $[25] = t9;
597
+ } else {
598
+ t9 = $[25];
599
+ }
600
+ useKeybindings(t8, t9);
601
+ let t10;
602
+ if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
603
+ t10 = /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
604
+ flexDirection: "column",
605
+ marginBottom: 1,
606
+ children: [
607
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
608
+ bold: true,
609
+ children: "Install GitHub App"
610
+ }, undefined, false, undefined, this),
611
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
612
+ dimColor: true,
613
+ children: "Choose API key"
614
+ }, undefined, false, undefined, this)
615
+ ]
616
+ }, undefined, true, undefined, this);
617
+ $[26] = t10;
618
+ } else {
619
+ t10 = $[26];
620
+ }
621
+ let t11;
622
+ if ($[27] !== existingApiKey || $[28] !== selectedOption || $[29] !== theme) {
623
+ t11 = existingApiKey && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
624
+ marginBottom: 1,
625
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
626
+ children: [
627
+ selectedOption === "existing" ? color("success", theme)("> ") : " ",
628
+ "Use your existing Claude Code API key"
629
+ ]
630
+ }, undefined, true, undefined, this)
631
+ }, undefined, false, undefined, this);
632
+ $[27] = existingApiKey;
633
+ $[28] = selectedOption;
634
+ $[29] = theme;
635
+ $[30] = t11;
636
+ } else {
637
+ t11 = $[30];
638
+ }
639
+ let t12;
640
+ if ($[31] !== onCreateOAuthToken || $[32] !== selectedOption || $[33] !== theme) {
641
+ t12 = onCreateOAuthToken && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
642
+ marginBottom: 1,
643
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
644
+ children: [
645
+ selectedOption === "oauth" ? color("success", theme)("> ") : " ",
646
+ "Create a long-lived token with your Claude subscription"
647
+ ]
648
+ }, undefined, true, undefined, this)
649
+ }, undefined, false, undefined, this);
650
+ $[31] = onCreateOAuthToken;
651
+ $[32] = selectedOption;
652
+ $[33] = theme;
653
+ $[34] = t12;
654
+ } else {
655
+ t12 = $[34];
656
+ }
657
+ let t13;
658
+ if ($[35] !== selectedOption || $[36] !== theme) {
659
+ t13 = selectedOption === "new" ? color("success", theme)("> ") : " ";
660
+ $[35] = selectedOption;
661
+ $[36] = theme;
662
+ $[37] = t13;
663
+ } else {
664
+ t13 = $[37];
665
+ }
666
+ let t14;
667
+ if ($[38] !== t13) {
668
+ t14 = /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
669
+ marginBottom: 1,
670
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
671
+ children: [
672
+ t13,
673
+ "Enter a new API key"
674
+ ]
675
+ }, undefined, true, undefined, this)
676
+ }, undefined, false, undefined, this);
677
+ $[38] = t13;
678
+ $[39] = t14;
679
+ } else {
680
+ t14 = $[39];
681
+ }
682
+ let t15;
683
+ if ($[40] !== apiKeyOrOAuthToken || $[41] !== cursorOffset || $[42] !== onApiKeyChange || $[43] !== onSubmit || $[44] !== selectedOption || $[45] !== terminalSize) {
684
+ t15 = selectedOption === "new" && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(TextInput, {
685
+ value: apiKeyOrOAuthToken,
686
+ onChange: onApiKeyChange,
687
+ onSubmit,
688
+ onPaste: onApiKeyChange,
689
+ focus: true,
690
+ placeholder: "sk-ant\u2026 (Create a new key at https://platform.claude.com/settings/keys)",
691
+ mask: "*",
692
+ columns: terminalSize.columns,
693
+ cursorOffset,
694
+ onChangeCursorOffset: setCursorOffset,
695
+ showCursor: true
696
+ }, undefined, false, undefined, this);
697
+ $[40] = apiKeyOrOAuthToken;
698
+ $[41] = cursorOffset;
699
+ $[42] = onApiKeyChange;
700
+ $[43] = onSubmit;
701
+ $[44] = selectedOption;
702
+ $[45] = terminalSize;
703
+ $[46] = t15;
704
+ } else {
705
+ t15 = $[46];
706
+ }
707
+ let t16;
708
+ if ($[47] !== t11 || $[48] !== t12 || $[49] !== t14 || $[50] !== t15) {
709
+ t16 = /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
710
+ flexDirection: "column",
711
+ borderStyle: "round",
712
+ paddingX: 1,
713
+ children: [
714
+ t10,
715
+ t11,
716
+ t12,
717
+ t14,
718
+ t15
719
+ ]
720
+ }, undefined, true, undefined, this);
721
+ $[47] = t11;
722
+ $[48] = t12;
723
+ $[49] = t14;
724
+ $[50] = t15;
725
+ $[51] = t16;
726
+ } else {
727
+ t16 = $[51];
728
+ }
729
+ let t17;
730
+ if ($[52] === Symbol.for("react.memo_cache_sentinel")) {
731
+ t17 = /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
732
+ marginLeft: 3,
733
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
734
+ dimColor: true,
735
+ children: "\u2191/\u2193 to select \xB7 Enter to continue"
736
+ }, undefined, false, undefined, this)
737
+ }, undefined, false, undefined, this);
738
+ $[52] = t17;
739
+ } else {
740
+ t17 = $[52];
741
+ }
742
+ let t18;
743
+ if ($[53] !== t16) {
744
+ t18 = /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(jsx_dev_runtime2.Fragment, {
745
+ children: [
746
+ t16,
747
+ t17
748
+ ]
749
+ }, undefined, true, undefined, this);
750
+ $[53] = t16;
751
+ $[54] = t18;
752
+ } else {
753
+ t18 = $[54];
754
+ }
755
+ return t18;
756
+ }
757
+ var import_compiler_runtime2, import_react2, jsx_dev_runtime2;
758
+ var init_ApiKeyStep = __esm(() => {
759
+ init_TextInput();
760
+ init_useTerminalSize();
761
+ init_ink();
762
+ init_useKeybinding();
763
+ import_compiler_runtime2 = __toESM(require_compiler_runtime(), 1);
764
+ import_react2 = __toESM(require_react(), 1);
765
+ jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
766
+ });
767
+
768
+ // src/commands/install-github-app/CheckExistingSecretStep.tsx
769
+ function CheckExistingSecretStep(t0) {
770
+ const $ = import_compiler_runtime3.c(42);
771
+ const {
772
+ useExistingSecret,
773
+ secretName,
774
+ onToggleUseExistingSecret,
775
+ onSecretNameChange,
776
+ onSubmit
777
+ } = t0;
778
+ const [cursorOffset, setCursorOffset] = import_react3.useState(0);
779
+ const terminalSize = useTerminalSize();
780
+ const [theme] = useTheme();
781
+ let t1;
782
+ if ($[0] !== onToggleUseExistingSecret) {
783
+ t1 = () => onToggleUseExistingSecret(true);
784
+ $[0] = onToggleUseExistingSecret;
785
+ $[1] = t1;
786
+ } else {
787
+ t1 = $[1];
788
+ }
789
+ const handlePrevious = t1;
790
+ let t2;
791
+ if ($[2] !== onToggleUseExistingSecret) {
792
+ t2 = () => onToggleUseExistingSecret(false);
793
+ $[2] = onToggleUseExistingSecret;
794
+ $[3] = t2;
795
+ } else {
796
+ t2 = $[3];
797
+ }
798
+ const handleNext = t2;
799
+ let t3;
800
+ if ($[4] !== handleNext || $[5] !== handlePrevious || $[6] !== onSubmit) {
801
+ t3 = {
802
+ "confirm:previous": handlePrevious,
803
+ "confirm:next": handleNext,
804
+ "confirm:yes": onSubmit
805
+ };
806
+ $[4] = handleNext;
807
+ $[5] = handlePrevious;
808
+ $[6] = onSubmit;
809
+ $[7] = t3;
810
+ } else {
811
+ t3 = $[7];
812
+ }
813
+ let t4;
814
+ if ($[8] !== useExistingSecret) {
815
+ t4 = {
816
+ context: "Confirmation",
817
+ isActive: useExistingSecret
818
+ };
819
+ $[8] = useExistingSecret;
820
+ $[9] = t4;
821
+ } else {
822
+ t4 = $[9];
823
+ }
824
+ useKeybindings(t3, t4);
825
+ let t5;
826
+ if ($[10] !== handleNext || $[11] !== handlePrevious) {
827
+ t5 = {
828
+ "confirm:previous": handlePrevious,
829
+ "confirm:next": handleNext
830
+ };
831
+ $[10] = handleNext;
832
+ $[11] = handlePrevious;
833
+ $[12] = t5;
834
+ } else {
835
+ t5 = $[12];
836
+ }
837
+ const t6 = !useExistingSecret;
838
+ let t7;
839
+ if ($[13] !== t6) {
840
+ t7 = {
841
+ context: "Confirmation",
842
+ isActive: t6
843
+ };
844
+ $[13] = t6;
845
+ $[14] = t7;
846
+ } else {
847
+ t7 = $[14];
848
+ }
849
+ useKeybindings(t5, t7);
850
+ let t8;
851
+ if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
852
+ t8 = /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
853
+ flexDirection: "column",
854
+ marginBottom: 1,
855
+ children: [
856
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
857
+ bold: true,
858
+ children: "Install GitHub App"
859
+ }, undefined, false, undefined, this),
860
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
861
+ dimColor: true,
862
+ children: "Setup API key secret"
863
+ }, undefined, false, undefined, this)
864
+ ]
865
+ }, undefined, true, undefined, this);
866
+ $[15] = t8;
867
+ } else {
868
+ t8 = $[15];
869
+ }
870
+ let t9;
871
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
872
+ t9 = /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
873
+ marginBottom: 1,
874
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
875
+ color: "warning",
876
+ children: "ANTHROPIC_API_KEY already exists in repository secrets!"
877
+ }, undefined, false, undefined, this)
878
+ }, undefined, false, undefined, this);
879
+ $[16] = t9;
880
+ } else {
881
+ t9 = $[16];
882
+ }
883
+ let t10;
884
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
885
+ t10 = /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
886
+ marginBottom: 1,
887
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
888
+ children: "Would you like to:"
889
+ }, undefined, false, undefined, this)
890
+ }, undefined, false, undefined, this);
891
+ $[17] = t10;
892
+ } else {
893
+ t10 = $[17];
894
+ }
895
+ let t11;
896
+ if ($[18] !== theme || $[19] !== useExistingSecret) {
897
+ t11 = useExistingSecret ? color("success", theme)("> ") : " ";
898
+ $[18] = theme;
899
+ $[19] = useExistingSecret;
900
+ $[20] = t11;
901
+ } else {
902
+ t11 = $[20];
903
+ }
904
+ let t12;
905
+ if ($[21] !== t11) {
906
+ t12 = /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
907
+ marginBottom: 1,
908
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
909
+ children: [
910
+ t11,
911
+ "Use the existing API key"
912
+ ]
913
+ }, undefined, true, undefined, this)
914
+ }, undefined, false, undefined, this);
915
+ $[21] = t11;
916
+ $[22] = t12;
917
+ } else {
918
+ t12 = $[22];
919
+ }
920
+ let t13;
921
+ if ($[23] !== theme || $[24] !== useExistingSecret) {
922
+ t13 = !useExistingSecret ? color("success", theme)("> ") : " ";
923
+ $[23] = theme;
924
+ $[24] = useExistingSecret;
925
+ $[25] = t13;
926
+ } else {
927
+ t13 = $[25];
928
+ }
929
+ let t14;
930
+ if ($[26] !== t13) {
931
+ t14 = /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
932
+ marginBottom: 1,
933
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
934
+ children: [
935
+ t13,
936
+ "Create a new secret with a different name"
937
+ ]
938
+ }, undefined, true, undefined, this)
939
+ }, undefined, false, undefined, this);
940
+ $[26] = t13;
941
+ $[27] = t14;
942
+ } else {
943
+ t14 = $[27];
944
+ }
945
+ let t15;
946
+ if ($[28] !== cursorOffset || $[29] !== onSecretNameChange || $[30] !== onSubmit || $[31] !== secretName || $[32] !== terminalSize || $[33] !== useExistingSecret) {
947
+ t15 = !useExistingSecret && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(jsx_dev_runtime3.Fragment, {
948
+ children: [
949
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
950
+ marginBottom: 1,
951
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
952
+ children: "Enter new secret name (alphanumeric with underscores):"
953
+ }, undefined, false, undefined, this)
954
+ }, undefined, false, undefined, this),
955
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(TextInput, {
956
+ value: secretName,
957
+ onChange: onSecretNameChange,
958
+ onSubmit,
959
+ focus: true,
960
+ placeholder: "e.g., CLAUDE_API_KEY",
961
+ columns: terminalSize.columns,
962
+ cursorOffset,
963
+ onChangeCursorOffset: setCursorOffset,
964
+ showCursor: true
965
+ }, undefined, false, undefined, this)
966
+ ]
967
+ }, undefined, true, undefined, this);
968
+ $[28] = cursorOffset;
969
+ $[29] = onSecretNameChange;
970
+ $[30] = onSubmit;
971
+ $[31] = secretName;
972
+ $[32] = terminalSize;
973
+ $[33] = useExistingSecret;
974
+ $[34] = t15;
975
+ } else {
976
+ t15 = $[34];
977
+ }
978
+ let t16;
979
+ if ($[35] !== t12 || $[36] !== t14 || $[37] !== t15) {
980
+ t16 = /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
981
+ flexDirection: "column",
982
+ borderStyle: "round",
983
+ paddingX: 1,
984
+ children: [
985
+ t8,
986
+ t9,
987
+ t10,
988
+ t12,
989
+ t14,
990
+ t15
991
+ ]
992
+ }, undefined, true, undefined, this);
993
+ $[35] = t12;
994
+ $[36] = t14;
995
+ $[37] = t15;
996
+ $[38] = t16;
997
+ } else {
998
+ t16 = $[38];
999
+ }
1000
+ let t17;
1001
+ if ($[39] === Symbol.for("react.memo_cache_sentinel")) {
1002
+ t17 = /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
1003
+ marginLeft: 3,
1004
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
1005
+ dimColor: true,
1006
+ children: "\u2191/\u2193 to select \xB7 Enter to continue"
1007
+ }, undefined, false, undefined, this)
1008
+ }, undefined, false, undefined, this);
1009
+ $[39] = t17;
1010
+ } else {
1011
+ t17 = $[39];
1012
+ }
1013
+ let t18;
1014
+ if ($[40] !== t16) {
1015
+ t18 = /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(jsx_dev_runtime3.Fragment, {
1016
+ children: [
1017
+ t16,
1018
+ t17
1019
+ ]
1020
+ }, undefined, true, undefined, this);
1021
+ $[40] = t16;
1022
+ $[41] = t18;
1023
+ } else {
1024
+ t18 = $[41];
1025
+ }
1026
+ return t18;
1027
+ }
1028
+ var import_compiler_runtime3, import_react3, jsx_dev_runtime3;
1029
+ var init_CheckExistingSecretStep = __esm(() => {
1030
+ init_TextInput();
1031
+ init_useTerminalSize();
1032
+ init_ink();
1033
+ init_useKeybinding();
1034
+ import_compiler_runtime3 = __toESM(require_compiler_runtime(), 1);
1035
+ import_react3 = __toESM(require_react(), 1);
1036
+ jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
1037
+ });
1038
+
1039
+ // src/commands/install-github-app/CheckGitHubStep.tsx
1040
+ function CheckGitHubStep() {
1041
+ const $ = import_compiler_runtime4.c(1);
1042
+ let t0;
1043
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1044
+ t0 = /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedText, {
1045
+ children: "Checking GitHub CLI installation\u2026"
1046
+ }, undefined, false, undefined, this);
1047
+ $[0] = t0;
1048
+ } else {
1049
+ t0 = $[0];
1050
+ }
1051
+ return t0;
1052
+ }
1053
+ var import_compiler_runtime4, jsx_dev_runtime4;
1054
+ var init_CheckGitHubStep = __esm(() => {
1055
+ init_ink();
1056
+ import_compiler_runtime4 = __toESM(require_compiler_runtime(), 1);
1057
+ jsx_dev_runtime4 = __toESM(require_jsx_dev_runtime(), 1);
1058
+ });
1059
+
1060
+ // src/commands/install-github-app/ChooseRepoStep.tsx
1061
+ function ChooseRepoStep(t0) {
1062
+ const $ = import_compiler_runtime5.c(49);
1063
+ const {
1064
+ currentRepo,
1065
+ useCurrentRepo,
1066
+ repoUrl,
1067
+ onRepoUrlChange,
1068
+ onSubmit,
1069
+ onToggleUseCurrentRepo
1070
+ } = t0;
1071
+ const [cursorOffset, setCursorOffset] = import_react4.useState(0);
1072
+ const [showEmptyError, setShowEmptyError] = import_react4.useState(false);
1073
+ const terminalSize = useTerminalSize();
1074
+ const textInputColumns = terminalSize.columns;
1075
+ let t1;
1076
+ if ($[0] !== currentRepo || $[1] !== onSubmit || $[2] !== repoUrl || $[3] !== useCurrentRepo) {
1077
+ t1 = () => {
1078
+ const repoName = useCurrentRepo ? currentRepo : repoUrl;
1079
+ if (!repoName?.trim()) {
1080
+ setShowEmptyError(true);
1081
+ return;
1082
+ }
1083
+ onSubmit();
1084
+ };
1085
+ $[0] = currentRepo;
1086
+ $[1] = onSubmit;
1087
+ $[2] = repoUrl;
1088
+ $[3] = useCurrentRepo;
1089
+ $[4] = t1;
1090
+ } else {
1091
+ t1 = $[4];
1092
+ }
1093
+ const handleSubmit = t1;
1094
+ const isTextInputVisible = !useCurrentRepo || !currentRepo;
1095
+ let t2;
1096
+ if ($[5] !== onToggleUseCurrentRepo) {
1097
+ t2 = () => {
1098
+ onToggleUseCurrentRepo(true);
1099
+ setShowEmptyError(false);
1100
+ };
1101
+ $[5] = onToggleUseCurrentRepo;
1102
+ $[6] = t2;
1103
+ } else {
1104
+ t2 = $[6];
1105
+ }
1106
+ const handlePrevious = t2;
1107
+ let t3;
1108
+ if ($[7] !== onToggleUseCurrentRepo) {
1109
+ t3 = () => {
1110
+ onToggleUseCurrentRepo(false);
1111
+ setShowEmptyError(false);
1112
+ };
1113
+ $[7] = onToggleUseCurrentRepo;
1114
+ $[8] = t3;
1115
+ } else {
1116
+ t3 = $[8];
1117
+ }
1118
+ const handleNext = t3;
1119
+ let t4;
1120
+ if ($[9] !== handleNext || $[10] !== handlePrevious || $[11] !== handleSubmit) {
1121
+ t4 = {
1122
+ "confirm:previous": handlePrevious,
1123
+ "confirm:next": handleNext,
1124
+ "confirm:yes": handleSubmit
1125
+ };
1126
+ $[9] = handleNext;
1127
+ $[10] = handlePrevious;
1128
+ $[11] = handleSubmit;
1129
+ $[12] = t4;
1130
+ } else {
1131
+ t4 = $[12];
1132
+ }
1133
+ const t5 = !isTextInputVisible;
1134
+ let t6;
1135
+ if ($[13] !== t5) {
1136
+ t6 = {
1137
+ context: "Confirmation",
1138
+ isActive: t5
1139
+ };
1140
+ $[13] = t5;
1141
+ $[14] = t6;
1142
+ } else {
1143
+ t6 = $[14];
1144
+ }
1145
+ useKeybindings(t4, t6);
1146
+ let t7;
1147
+ if ($[15] !== handleNext || $[16] !== handlePrevious) {
1148
+ t7 = {
1149
+ "confirm:previous": handlePrevious,
1150
+ "confirm:next": handleNext
1151
+ };
1152
+ $[15] = handleNext;
1153
+ $[16] = handlePrevious;
1154
+ $[17] = t7;
1155
+ } else {
1156
+ t7 = $[17];
1157
+ }
1158
+ let t8;
1159
+ if ($[18] !== isTextInputVisible) {
1160
+ t8 = {
1161
+ context: "Confirmation",
1162
+ isActive: isTextInputVisible
1163
+ };
1164
+ $[18] = isTextInputVisible;
1165
+ $[19] = t8;
1166
+ } else {
1167
+ t8 = $[19];
1168
+ }
1169
+ useKeybindings(t7, t8);
1170
+ let t9;
1171
+ if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
1172
+ t9 = /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
1173
+ flexDirection: "column",
1174
+ marginBottom: 1,
1175
+ children: [
1176
+ /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
1177
+ bold: true,
1178
+ children: "Install GitHub App"
1179
+ }, undefined, false, undefined, this),
1180
+ /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
1181
+ dimColor: true,
1182
+ children: "Select GitHub repository"
1183
+ }, undefined, false, undefined, this)
1184
+ ]
1185
+ }, undefined, true, undefined, this);
1186
+ $[20] = t9;
1187
+ } else {
1188
+ t9 = $[20];
1189
+ }
1190
+ let t10;
1191
+ if ($[21] !== currentRepo || $[22] !== useCurrentRepo) {
1192
+ t10 = currentRepo && /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
1193
+ marginBottom: 1,
1194
+ children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
1195
+ bold: useCurrentRepo,
1196
+ color: useCurrentRepo ? "permission" : undefined,
1197
+ children: [
1198
+ useCurrentRepo ? "> " : " ",
1199
+ "Use current repository: ",
1200
+ currentRepo
1201
+ ]
1202
+ }, undefined, true, undefined, this)
1203
+ }, undefined, false, undefined, this);
1204
+ $[21] = currentRepo;
1205
+ $[22] = useCurrentRepo;
1206
+ $[23] = t10;
1207
+ } else {
1208
+ t10 = $[23];
1209
+ }
1210
+ const t11 = !useCurrentRepo || !currentRepo;
1211
+ const t12 = !useCurrentRepo || !currentRepo ? "permission" : undefined;
1212
+ const t13 = !useCurrentRepo || !currentRepo ? "> " : " ";
1213
+ const t14 = currentRepo ? "Enter a different repository" : "Enter repository";
1214
+ let t15;
1215
+ if ($[24] !== t11 || $[25] !== t12 || $[26] !== t13 || $[27] !== t14) {
1216
+ t15 = /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
1217
+ marginBottom: 1,
1218
+ children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
1219
+ bold: t11,
1220
+ color: t12,
1221
+ children: [
1222
+ t13,
1223
+ t14
1224
+ ]
1225
+ }, undefined, true, undefined, this)
1226
+ }, undefined, false, undefined, this);
1227
+ $[24] = t11;
1228
+ $[25] = t12;
1229
+ $[26] = t13;
1230
+ $[27] = t14;
1231
+ $[28] = t15;
1232
+ } else {
1233
+ t15 = $[28];
1234
+ }
1235
+ let t16;
1236
+ if ($[29] !== currentRepo || $[30] !== cursorOffset || $[31] !== handleSubmit || $[32] !== onRepoUrlChange || $[33] !== repoUrl || $[34] !== textInputColumns || $[35] !== useCurrentRepo) {
1237
+ t16 = (!useCurrentRepo || !currentRepo) && /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
1238
+ marginLeft: 2,
1239
+ marginBottom: 1,
1240
+ children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(TextInput, {
1241
+ value: repoUrl,
1242
+ onChange: (value) => {
1243
+ onRepoUrlChange(value);
1244
+ setShowEmptyError(false);
1245
+ },
1246
+ onSubmit: handleSubmit,
1247
+ focus: true,
1248
+ placeholder: "Enter a repo as owner/repo or https://github.com/owner/repo\u2026",
1249
+ columns: textInputColumns,
1250
+ cursorOffset,
1251
+ onChangeCursorOffset: setCursorOffset,
1252
+ showCursor: true
1253
+ }, undefined, false, undefined, this)
1254
+ }, undefined, false, undefined, this);
1255
+ $[29] = currentRepo;
1256
+ $[30] = cursorOffset;
1257
+ $[31] = handleSubmit;
1258
+ $[32] = onRepoUrlChange;
1259
+ $[33] = repoUrl;
1260
+ $[34] = textInputColumns;
1261
+ $[35] = useCurrentRepo;
1262
+ $[36] = t16;
1263
+ } else {
1264
+ t16 = $[36];
1265
+ }
1266
+ let t17;
1267
+ if ($[37] !== t10 || $[38] !== t15 || $[39] !== t16) {
1268
+ t17 = /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
1269
+ flexDirection: "column",
1270
+ borderStyle: "round",
1271
+ paddingX: 1,
1272
+ children: [
1273
+ t9,
1274
+ t10,
1275
+ t15,
1276
+ t16
1277
+ ]
1278
+ }, undefined, true, undefined, this);
1279
+ $[37] = t10;
1280
+ $[38] = t15;
1281
+ $[39] = t16;
1282
+ $[40] = t17;
1283
+ } else {
1284
+ t17 = $[40];
1285
+ }
1286
+ let t18;
1287
+ if ($[41] !== showEmptyError) {
1288
+ t18 = showEmptyError && /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
1289
+ marginLeft: 3,
1290
+ marginBottom: 1,
1291
+ children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
1292
+ color: "error",
1293
+ children: "Please enter a repository name to continue"
1294
+ }, undefined, false, undefined, this)
1295
+ }, undefined, false, undefined, this);
1296
+ $[41] = showEmptyError;
1297
+ $[42] = t18;
1298
+ } else {
1299
+ t18 = $[42];
1300
+ }
1301
+ const t19 = currentRepo ? "\u2191/\u2193 to select \xB7 " : "";
1302
+ let t20;
1303
+ if ($[43] !== t19) {
1304
+ t20 = /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
1305
+ marginLeft: 3,
1306
+ children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
1307
+ dimColor: true,
1308
+ children: [
1309
+ t19,
1310
+ "Enter to continue"
1311
+ ]
1312
+ }, undefined, true, undefined, this)
1313
+ }, undefined, false, undefined, this);
1314
+ $[43] = t19;
1315
+ $[44] = t20;
1316
+ } else {
1317
+ t20 = $[44];
1318
+ }
1319
+ let t21;
1320
+ if ($[45] !== t17 || $[46] !== t18 || $[47] !== t20) {
1321
+ t21 = /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(jsx_dev_runtime5.Fragment, {
1322
+ children: [
1323
+ t17,
1324
+ t18,
1325
+ t20
1326
+ ]
1327
+ }, undefined, true, undefined, this);
1328
+ $[45] = t17;
1329
+ $[46] = t18;
1330
+ $[47] = t20;
1331
+ $[48] = t21;
1332
+ } else {
1333
+ t21 = $[48];
1334
+ }
1335
+ return t21;
1336
+ }
1337
+ var import_compiler_runtime5, import_react4, jsx_dev_runtime5;
1338
+ var init_ChooseRepoStep = __esm(() => {
1339
+ init_TextInput();
1340
+ init_useTerminalSize();
1341
+ init_ink();
1342
+ init_useKeybinding();
1343
+ import_compiler_runtime5 = __toESM(require_compiler_runtime(), 1);
1344
+ import_react4 = __toESM(require_react(), 1);
1345
+ jsx_dev_runtime5 = __toESM(require_jsx_dev_runtime(), 1);
1346
+ });
1347
+
1348
+ // src/commands/install-github-app/CreatingStep.tsx
1349
+ function CreatingStep(t0) {
1350
+ const $ = import_compiler_runtime6.c(10);
1351
+ const {
1352
+ currentWorkflowInstallStep,
1353
+ secretExists,
1354
+ useExistingSecret,
1355
+ secretName,
1356
+ skipWorkflow: t1,
1357
+ selectedWorkflows
1358
+ } = t0;
1359
+ const skipWorkflow = t1 === undefined ? false : t1;
1360
+ let t2;
1361
+ if ($[0] !== secretExists || $[1] !== secretName || $[2] !== selectedWorkflows || $[3] !== skipWorkflow || $[4] !== useExistingSecret) {
1362
+ t2 = skipWorkflow ? ["Getting repository information", secretExists && useExistingSecret ? "Using existing API key secret" : `Setting up ${secretName} secret`] : ["Getting repository information", "Creating branch", selectedWorkflows.length > 1 ? "Creating workflow files" : "Creating workflow file", secretExists && useExistingSecret ? "Using existing API key secret" : `Setting up ${secretName} secret`, "Opening pull request page"];
1363
+ $[0] = secretExists;
1364
+ $[1] = secretName;
1365
+ $[2] = selectedWorkflows;
1366
+ $[3] = skipWorkflow;
1367
+ $[4] = useExistingSecret;
1368
+ $[5] = t2;
1369
+ } else {
1370
+ t2 = $[5];
1371
+ }
1372
+ const progressSteps = t2;
1373
+ let t3;
1374
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
1375
+ t3 = /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedBox_default, {
1376
+ flexDirection: "column",
1377
+ marginBottom: 1,
1378
+ children: [
1379
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedText, {
1380
+ bold: true,
1381
+ children: "Install GitHub App"
1382
+ }, undefined, false, undefined, this),
1383
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedText, {
1384
+ dimColor: true,
1385
+ children: "Create GitHub Actions workflow"
1386
+ }, undefined, false, undefined, this)
1387
+ ]
1388
+ }, undefined, true, undefined, this);
1389
+ $[6] = t3;
1390
+ } else {
1391
+ t3 = $[6];
1392
+ }
1393
+ let t4;
1394
+ if ($[7] !== currentWorkflowInstallStep || $[8] !== progressSteps) {
1395
+ t4 = /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(jsx_dev_runtime6.Fragment, {
1396
+ children: /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedBox_default, {
1397
+ flexDirection: "column",
1398
+ borderStyle: "round",
1399
+ paddingX: 1,
1400
+ children: [
1401
+ t3,
1402
+ progressSteps.map((stepText, index) => {
1403
+ let status = "pending";
1404
+ if (index < currentWorkflowInstallStep) {
1405
+ status = "completed";
1406
+ } else {
1407
+ if (index === currentWorkflowInstallStep) {
1408
+ status = "in-progress";
1409
+ }
1410
+ }
1411
+ return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedBox_default, {
1412
+ children: /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedText, {
1413
+ color: status === "completed" ? "success" : status === "in-progress" ? "warning" : undefined,
1414
+ children: [
1415
+ status === "completed" ? "\u2713 " : "",
1416
+ stepText,
1417
+ status === "in-progress" ? "\u2026" : ""
1418
+ ]
1419
+ }, undefined, true, undefined, this)
1420
+ }, index, false, undefined, this);
1421
+ })
1422
+ ]
1423
+ }, undefined, true, undefined, this)
1424
+ }, undefined, false, undefined, this);
1425
+ $[7] = currentWorkflowInstallStep;
1426
+ $[8] = progressSteps;
1427
+ $[9] = t4;
1428
+ } else {
1429
+ t4 = $[9];
1430
+ }
1431
+ return t4;
1432
+ }
1433
+ var import_compiler_runtime6, jsx_dev_runtime6;
1434
+ var init_CreatingStep = __esm(() => {
1435
+ init_ink();
1436
+ import_compiler_runtime6 = __toESM(require_compiler_runtime(), 1);
1437
+ jsx_dev_runtime6 = __toESM(require_jsx_dev_runtime(), 1);
1438
+ });
1439
+
1440
+ // src/commands/install-github-app/ErrorStep.tsx
1441
+ function ErrorStep(t0) {
1442
+ const $ = import_compiler_runtime7.c(15);
1443
+ const {
1444
+ error,
1445
+ errorReason,
1446
+ errorInstructions
1447
+ } = t0;
1448
+ let t1;
1449
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1450
+ t1 = /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1451
+ flexDirection: "column",
1452
+ marginBottom: 1,
1453
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1454
+ bold: true,
1455
+ children: "Install GitHub App"
1456
+ }, undefined, false, undefined, this)
1457
+ }, undefined, false, undefined, this);
1458
+ $[0] = t1;
1459
+ } else {
1460
+ t1 = $[0];
1461
+ }
1462
+ let t2;
1463
+ if ($[1] !== error) {
1464
+ t2 = /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1465
+ color: "error",
1466
+ children: [
1467
+ "Error: ",
1468
+ error
1469
+ ]
1470
+ }, undefined, true, undefined, this);
1471
+ $[1] = error;
1472
+ $[2] = t2;
1473
+ } else {
1474
+ t2 = $[2];
1475
+ }
1476
+ let t3;
1477
+ if ($[3] !== errorReason) {
1478
+ t3 = errorReason && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1479
+ marginTop: 1,
1480
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1481
+ dimColor: true,
1482
+ children: [
1483
+ "Reason: ",
1484
+ errorReason
1485
+ ]
1486
+ }, undefined, true, undefined, this)
1487
+ }, undefined, false, undefined, this);
1488
+ $[3] = errorReason;
1489
+ $[4] = t3;
1490
+ } else {
1491
+ t3 = $[4];
1492
+ }
1493
+ let t4;
1494
+ if ($[5] !== errorInstructions) {
1495
+ t4 = errorInstructions && errorInstructions.length > 0 && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1496
+ flexDirection: "column",
1497
+ marginTop: 1,
1498
+ children: [
1499
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1500
+ dimColor: true,
1501
+ children: "How to fix:"
1502
+ }, undefined, false, undefined, this),
1503
+ errorInstructions.map(_temp2)
1504
+ ]
1505
+ }, undefined, true, undefined, this);
1506
+ $[5] = errorInstructions;
1507
+ $[6] = t4;
1508
+ } else {
1509
+ t4 = $[6];
1510
+ }
1511
+ let t5;
1512
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
1513
+ t5 = /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1514
+ marginTop: 1,
1515
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1516
+ dimColor: true,
1517
+ children: [
1518
+ "For manual setup instructions, see:",
1519
+ " ",
1520
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1521
+ color: "claude",
1522
+ children: GITHUB_ACTION_SETUP_DOCS_URL
1523
+ }, undefined, false, undefined, this)
1524
+ ]
1525
+ }, undefined, true, undefined, this)
1526
+ }, undefined, false, undefined, this);
1527
+ $[7] = t5;
1528
+ } else {
1529
+ t5 = $[7];
1530
+ }
1531
+ let t6;
1532
+ if ($[8] !== t2 || $[9] !== t3 || $[10] !== t4) {
1533
+ t6 = /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1534
+ flexDirection: "column",
1535
+ borderStyle: "round",
1536
+ paddingX: 1,
1537
+ children: [
1538
+ t1,
1539
+ t2,
1540
+ t3,
1541
+ t4,
1542
+ t5
1543
+ ]
1544
+ }, undefined, true, undefined, this);
1545
+ $[8] = t2;
1546
+ $[9] = t3;
1547
+ $[10] = t4;
1548
+ $[11] = t6;
1549
+ } else {
1550
+ t6 = $[11];
1551
+ }
1552
+ let t7;
1553
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
1554
+ t7 = /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1555
+ marginLeft: 3,
1556
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1557
+ dimColor: true,
1558
+ children: "Press any key to exit"
1559
+ }, undefined, false, undefined, this)
1560
+ }, undefined, false, undefined, this);
1561
+ $[12] = t7;
1562
+ } else {
1563
+ t7 = $[12];
1564
+ }
1565
+ let t8;
1566
+ if ($[13] !== t6) {
1567
+ t8 = /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
1568
+ children: [
1569
+ t6,
1570
+ t7
1571
+ ]
1572
+ }, undefined, true, undefined, this);
1573
+ $[13] = t6;
1574
+ $[14] = t8;
1575
+ } else {
1576
+ t8 = $[14];
1577
+ }
1578
+ return t8;
1579
+ }
1580
+ function _temp2(instruction, index) {
1581
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
1582
+ marginLeft: 2,
1583
+ children: [
1584
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1585
+ dimColor: true,
1586
+ children: "\u2022 "
1587
+ }, undefined, false, undefined, this),
1588
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
1589
+ children: instruction
1590
+ }, undefined, false, undefined, this)
1591
+ ]
1592
+ }, index, true, undefined, this);
1593
+ }
1594
+ var import_compiler_runtime7, jsx_dev_runtime7;
1595
+ var init_ErrorStep = __esm(() => {
1596
+ init_github_app();
1597
+ init_ink();
1598
+ import_compiler_runtime7 = __toESM(require_compiler_runtime(), 1);
1599
+ jsx_dev_runtime7 = __toESM(require_jsx_dev_runtime(), 1);
1600
+ });
1601
+
1602
+ // src/commands/install-github-app/ExistingWorkflowStep.tsx
1603
+ function ExistingWorkflowStep(t0) {
1604
+ const $ = import_compiler_runtime8.c(16);
1605
+ const {
1606
+ repoName,
1607
+ onSelectAction
1608
+ } = t0;
1609
+ let t1;
1610
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1611
+ t1 = [{
1612
+ label: "Update workflow file with latest version",
1613
+ value: "update"
1614
+ }, {
1615
+ label: "Skip workflow update (configure secrets only)",
1616
+ value: "skip"
1617
+ }, {
1618
+ label: "Exit without making changes",
1619
+ value: "exit"
1620
+ }];
1621
+ $[0] = t1;
1622
+ } else {
1623
+ t1 = $[0];
1624
+ }
1625
+ const options = t1;
1626
+ let t2;
1627
+ if ($[1] !== onSelectAction) {
1628
+ t2 = (value) => {
1629
+ onSelectAction(value);
1630
+ };
1631
+ $[1] = onSelectAction;
1632
+ $[2] = t2;
1633
+ } else {
1634
+ t2 = $[2];
1635
+ }
1636
+ const handleSelect = t2;
1637
+ let t3;
1638
+ if ($[3] !== onSelectAction) {
1639
+ t3 = () => {
1640
+ onSelectAction("exit");
1641
+ };
1642
+ $[3] = onSelectAction;
1643
+ $[4] = t3;
1644
+ } else {
1645
+ t3 = $[4];
1646
+ }
1647
+ const handleCancel = t3;
1648
+ let t4;
1649
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
1650
+ t4 = /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1651
+ bold: true,
1652
+ children: "Existing Workflow Found"
1653
+ }, undefined, false, undefined, this);
1654
+ $[5] = t4;
1655
+ } else {
1656
+ t4 = $[5];
1657
+ }
1658
+ let t5;
1659
+ if ($[6] !== repoName) {
1660
+ t5 = /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedBox_default, {
1661
+ flexDirection: "column",
1662
+ marginBottom: 1,
1663
+ children: [
1664
+ t4,
1665
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1666
+ dimColor: true,
1667
+ children: [
1668
+ "Repository: ",
1669
+ repoName
1670
+ ]
1671
+ }, undefined, true, undefined, this)
1672
+ ]
1673
+ }, undefined, true, undefined, this);
1674
+ $[6] = repoName;
1675
+ $[7] = t5;
1676
+ } else {
1677
+ t5 = $[7];
1678
+ }
1679
+ let t6;
1680
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
1681
+ t6 = /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedBox_default, {
1682
+ flexDirection: "column",
1683
+ marginBottom: 1,
1684
+ children: [
1685
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1686
+ children: [
1687
+ "A Claude workflow file already exists at",
1688
+ " ",
1689
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1690
+ color: "claude",
1691
+ children: ".github/workflows/claude.yml"
1692
+ }, undefined, false, undefined, this)
1693
+ ]
1694
+ }, undefined, true, undefined, this),
1695
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1696
+ dimColor: true,
1697
+ children: "What would you like to do?"
1698
+ }, undefined, false, undefined, this)
1699
+ ]
1700
+ }, undefined, true, undefined, this);
1701
+ $[8] = t6;
1702
+ } else {
1703
+ t6 = $[8];
1704
+ }
1705
+ let t7;
1706
+ if ($[9] !== handleCancel || $[10] !== handleSelect) {
1707
+ t7 = /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedBox_default, {
1708
+ flexDirection: "column",
1709
+ children: /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Select, {
1710
+ options,
1711
+ onChange: handleSelect,
1712
+ onCancel: handleCancel
1713
+ }, undefined, false, undefined, this)
1714
+ }, undefined, false, undefined, this);
1715
+ $[9] = handleCancel;
1716
+ $[10] = handleSelect;
1717
+ $[11] = t7;
1718
+ } else {
1719
+ t7 = $[11];
1720
+ }
1721
+ let t8;
1722
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
1723
+ t8 = /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedBox_default, {
1724
+ marginTop: 1,
1725
+ children: /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1726
+ dimColor: true,
1727
+ children: [
1728
+ "View the latest workflow template at:",
1729
+ " ",
1730
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1731
+ color: "claude",
1732
+ children: "https://github.com/anthropics/claude-code-action/blob/main/examples/claude.yml"
1733
+ }, undefined, false, undefined, this)
1734
+ ]
1735
+ }, undefined, true, undefined, this)
1736
+ }, undefined, false, undefined, this);
1737
+ $[12] = t8;
1738
+ } else {
1739
+ t8 = $[12];
1740
+ }
1741
+ let t9;
1742
+ if ($[13] !== t5 || $[14] !== t7) {
1743
+ t9 = /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedBox_default, {
1744
+ flexDirection: "column",
1745
+ borderStyle: "round",
1746
+ borderDimColor: true,
1747
+ paddingX: 1,
1748
+ children: [
1749
+ t5,
1750
+ t6,
1751
+ t7,
1752
+ t8
1753
+ ]
1754
+ }, undefined, true, undefined, this);
1755
+ $[13] = t5;
1756
+ $[14] = t7;
1757
+ $[15] = t9;
1758
+ } else {
1759
+ t9 = $[15];
1760
+ }
1761
+ return t9;
1762
+ }
1763
+ var import_compiler_runtime8, jsx_dev_runtime8;
1764
+ var init_ExistingWorkflowStep = __esm(() => {
1765
+ init_CustomSelect();
1766
+ init_ink();
1767
+ import_compiler_runtime8 = __toESM(require_compiler_runtime(), 1);
1768
+ jsx_dev_runtime8 = __toESM(require_jsx_dev_runtime(), 1);
1769
+ });
1770
+
1771
+ // src/commands/install-github-app/InstallAppStep.tsx
1772
+ function InstallAppStep(t0) {
1773
+ const $ = import_compiler_runtime9.c(12);
1774
+ const {
1775
+ repoUrl,
1776
+ onSubmit
1777
+ } = t0;
1778
+ let t1;
1779
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1780
+ t1 = {
1781
+ context: "Confirmation"
1782
+ };
1783
+ $[0] = t1;
1784
+ } else {
1785
+ t1 = $[0];
1786
+ }
1787
+ useKeybinding("confirm:yes", onSubmit, t1);
1788
+ let t2;
1789
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
1790
+ t2 = /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1791
+ flexDirection: "column",
1792
+ marginBottom: 1,
1793
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1794
+ bold: true,
1795
+ children: "Install the Claude GitHub App"
1796
+ }, undefined, false, undefined, this)
1797
+ }, undefined, false, undefined, this);
1798
+ $[1] = t2;
1799
+ } else {
1800
+ t2 = $[1];
1801
+ }
1802
+ let t3;
1803
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
1804
+ t3 = /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1805
+ marginBottom: 1,
1806
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1807
+ children: "Opening browser to install the Claude GitHub App\u2026"
1808
+ }, undefined, false, undefined, this)
1809
+ }, undefined, false, undefined, this);
1810
+ $[2] = t3;
1811
+ } else {
1812
+ t3 = $[2];
1813
+ }
1814
+ let t4;
1815
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
1816
+ t4 = /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1817
+ marginBottom: 1,
1818
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1819
+ children: "If your browser doesn't open automatically, visit:"
1820
+ }, undefined, false, undefined, this)
1821
+ }, undefined, false, undefined, this);
1822
+ $[3] = t4;
1823
+ } else {
1824
+ t4 = $[3];
1825
+ }
1826
+ let t5;
1827
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
1828
+ t5 = /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1829
+ marginBottom: 1,
1830
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1831
+ underline: true,
1832
+ children: "https://github.com/apps/claude"
1833
+ }, undefined, false, undefined, this)
1834
+ }, undefined, false, undefined, this);
1835
+ $[4] = t5;
1836
+ } else {
1837
+ t5 = $[4];
1838
+ }
1839
+ let t6;
1840
+ if ($[5] !== repoUrl) {
1841
+ t6 = /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1842
+ marginBottom: 1,
1843
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1844
+ children: [
1845
+ "Please install the app for repository: ",
1846
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1847
+ bold: true,
1848
+ children: repoUrl
1849
+ }, undefined, false, undefined, this)
1850
+ ]
1851
+ }, undefined, true, undefined, this)
1852
+ }, undefined, false, undefined, this);
1853
+ $[5] = repoUrl;
1854
+ $[6] = t6;
1855
+ } else {
1856
+ t6 = $[6];
1857
+ }
1858
+ let t7;
1859
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
1860
+ t7 = /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1861
+ marginBottom: 1,
1862
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1863
+ dimColor: true,
1864
+ children: "Important: Make sure to grant access to this specific repository"
1865
+ }, undefined, false, undefined, this)
1866
+ }, undefined, false, undefined, this);
1867
+ $[7] = t7;
1868
+ } else {
1869
+ t7 = $[7];
1870
+ }
1871
+ let t8;
1872
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
1873
+ t8 = /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1874
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1875
+ bold: true,
1876
+ color: "permission",
1877
+ children: [
1878
+ "Press Enter once you've installed the app",
1879
+ figures_default.ellipsis
1880
+ ]
1881
+ }, undefined, true, undefined, this)
1882
+ }, undefined, false, undefined, this);
1883
+ $[8] = t8;
1884
+ } else {
1885
+ t8 = $[8];
1886
+ }
1887
+ let t9;
1888
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
1889
+ t9 = /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1890
+ marginTop: 1,
1891
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1892
+ dimColor: true,
1893
+ children: [
1894
+ "Having trouble? See manual setup instructions at:",
1895
+ " ",
1896
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1897
+ color: "claude",
1898
+ children: GITHUB_ACTION_SETUP_DOCS_URL
1899
+ }, undefined, false, undefined, this)
1900
+ ]
1901
+ }, undefined, true, undefined, this)
1902
+ }, undefined, false, undefined, this);
1903
+ $[9] = t9;
1904
+ } else {
1905
+ t9 = $[9];
1906
+ }
1907
+ let t10;
1908
+ if ($[10] !== t6) {
1909
+ t10 = /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1910
+ flexDirection: "column",
1911
+ borderStyle: "round",
1912
+ borderDimColor: true,
1913
+ paddingX: 1,
1914
+ children: [
1915
+ t2,
1916
+ t3,
1917
+ t4,
1918
+ t5,
1919
+ t6,
1920
+ t7,
1921
+ t8,
1922
+ t9
1923
+ ]
1924
+ }, undefined, true, undefined, this);
1925
+ $[10] = t6;
1926
+ $[11] = t10;
1927
+ } else {
1928
+ t10 = $[11];
1929
+ }
1930
+ return t10;
1931
+ }
1932
+ var import_compiler_runtime9, jsx_dev_runtime9;
1933
+ var init_InstallAppStep = __esm(() => {
1934
+ init_figures();
1935
+ init_github_app();
1936
+ init_ink();
1937
+ init_useKeybinding();
1938
+ import_compiler_runtime9 = __toESM(require_compiler_runtime(), 1);
1939
+ jsx_dev_runtime9 = __toESM(require_jsx_dev_runtime(), 1);
1940
+ });
1941
+
1942
+ // src/commands/install-github-app/OAuthFlowStep.tsx
1943
+ function OAuthFlowStep({
1944
+ onSuccess,
1945
+ onCancel
1946
+ }) {
1947
+ const [oauthStatus, setOAuthStatus] = import_react5.useState({
1948
+ state: "starting"
1949
+ });
1950
+ const [oauthService] = import_react5.useState(() => new OAuthService);
1951
+ const [pastedCode, setPastedCode] = import_react5.useState("");
1952
+ const [cursorOffset, setCursorOffset] = import_react5.useState(0);
1953
+ const [showPastePrompt, setShowPastePrompt] = import_react5.useState(false);
1954
+ const [urlCopied, setUrlCopied] = import_react5.useState(false);
1955
+ const timersRef = import_react5.useRef(new Set);
1956
+ const urlCopiedTimerRef = import_react5.useRef(undefined);
1957
+ const terminalSize = useTerminalSize();
1958
+ const textInputColumns = Math.max(50, terminalSize.columns - PASTE_HERE_MSG.length - 4);
1959
+ function handleKeyDown(e) {
1960
+ if (oauthStatus.state !== "error")
1961
+ return;
1962
+ e.preventDefault();
1963
+ if (e.key === "return" && oauthStatus.toRetry) {
1964
+ setPastedCode("");
1965
+ setCursorOffset(0);
1966
+ setOAuthStatus({
1967
+ state: "about_to_retry",
1968
+ nextState: oauthStatus.toRetry
1969
+ });
1970
+ } else {
1971
+ onCancel();
1972
+ }
1973
+ }
1974
+ async function handleSubmitCode(value, url) {
1975
+ try {
1976
+ const [authorizationCode, state] = value.split("#");
1977
+ if (!authorizationCode || !state) {
1978
+ setOAuthStatus({
1979
+ state: "error",
1980
+ message: "Invalid code. Please make sure the full code was copied",
1981
+ toRetry: {
1982
+ state: "waiting_for_login",
1983
+ url
1984
+ }
1985
+ });
1986
+ return;
1987
+ }
1988
+ logEvent("tengu_oauth_manual_entry", {});
1989
+ oauthService.handleManualAuthCodeInput({
1990
+ authorizationCode,
1991
+ state
1992
+ });
1993
+ } catch (err) {
1994
+ logError(err);
1995
+ setOAuthStatus({
1996
+ state: "error",
1997
+ message: err.message,
1998
+ toRetry: {
1999
+ state: "waiting_for_login",
2000
+ url
2001
+ }
2002
+ });
2003
+ }
2004
+ }
2005
+ const startOAuth = import_react5.useCallback(async () => {
2006
+ timersRef.current.forEach((timer) => clearTimeout(timer));
2007
+ timersRef.current.clear();
2008
+ try {
2009
+ const result = await oauthService.startOAuthFlow(async (url_0) => {
2010
+ setOAuthStatus({
2011
+ state: "waiting_for_login",
2012
+ url: url_0
2013
+ });
2014
+ const timer_0 = setTimeout(setShowPastePrompt, 3000, true);
2015
+ timersRef.current.add(timer_0);
2016
+ }, {
2017
+ loginWithClaudeAi: true,
2018
+ inferenceOnly: true,
2019
+ expiresIn: 365 * 24 * 60 * 60
2020
+ });
2021
+ setOAuthStatus({
2022
+ state: "processing"
2023
+ });
2024
+ saveOAuthTokensIfNeeded(result);
2025
+ const timer1 = setTimeout((setOAuthStatus_0, accessToken, onSuccess_0, timersRef_0) => {
2026
+ setOAuthStatus_0({
2027
+ state: "success",
2028
+ token: accessToken
2029
+ });
2030
+ const timer2 = setTimeout(onSuccess_0, 1000, accessToken);
2031
+ timersRef_0.current.add(timer2);
2032
+ }, 100, setOAuthStatus, result.accessToken, onSuccess, timersRef);
2033
+ timersRef.current.add(timer1);
2034
+ } catch (err_0) {
2035
+ const errorMessage = err_0.message;
2036
+ setOAuthStatus({
2037
+ state: "error",
2038
+ message: errorMessage,
2039
+ toRetry: {
2040
+ state: "starting"
2041
+ }
2042
+ });
2043
+ logError(err_0);
2044
+ logEvent("tengu_oauth_error", {
2045
+ error: errorMessage
2046
+ });
2047
+ }
2048
+ }, [oauthService, onSuccess]);
2049
+ import_react5.useEffect(() => {
2050
+ if (oauthStatus.state === "starting") {
2051
+ startOAuth();
2052
+ }
2053
+ }, [oauthStatus.state, startOAuth]);
2054
+ import_react5.useEffect(() => {
2055
+ if (oauthStatus.state === "about_to_retry") {
2056
+ const timer_1 = setTimeout((nextState, setShowPastePrompt_0, setOAuthStatus_1) => {
2057
+ setShowPastePrompt_0(nextState.state === "waiting_for_login");
2058
+ setOAuthStatus_1(nextState);
2059
+ }, 500, oauthStatus.nextState, setShowPastePrompt, setOAuthStatus);
2060
+ timersRef.current.add(timer_1);
2061
+ }
2062
+ }, [oauthStatus]);
2063
+ import_react5.useEffect(() => {
2064
+ if (pastedCode === "c" && oauthStatus.state === "waiting_for_login" && showPastePrompt && !urlCopied) {
2065
+ setClipboard(oauthStatus.url).then((raw) => {
2066
+ if (raw)
2067
+ process.stdout.write(raw);
2068
+ setUrlCopied(true);
2069
+ clearTimeout(urlCopiedTimerRef.current);
2070
+ urlCopiedTimerRef.current = setTimeout(setUrlCopied, 2000, false);
2071
+ });
2072
+ setPastedCode("");
2073
+ }
2074
+ }, [pastedCode, oauthStatus, showPastePrompt, urlCopied]);
2075
+ import_react5.useEffect(() => {
2076
+ const timers = timersRef.current;
2077
+ return () => {
2078
+ oauthService.cleanup();
2079
+ timers.forEach((timer_2) => clearTimeout(timer_2));
2080
+ timers.clear();
2081
+ clearTimeout(urlCopiedTimerRef.current);
2082
+ };
2083
+ }, [oauthService]);
2084
+ function renderStatusMessage() {
2085
+ switch (oauthStatus.state) {
2086
+ case "starting":
2087
+ return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
2088
+ children: [
2089
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Spinner, {}, undefined, false, undefined, this),
2090
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
2091
+ children: "Starting authentication\u2026"
2092
+ }, undefined, false, undefined, this)
2093
+ ]
2094
+ }, undefined, true, undefined, this);
2095
+ case "waiting_for_login":
2096
+ return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
2097
+ flexDirection: "column",
2098
+ gap: 1,
2099
+ children: [
2100
+ !showPastePrompt && /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
2101
+ children: [
2102
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Spinner, {}, undefined, false, undefined, this),
2103
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
2104
+ children: "Opening browser to sign in with your Claude account\u2026"
2105
+ }, undefined, false, undefined, this)
2106
+ ]
2107
+ }, undefined, true, undefined, this),
2108
+ showPastePrompt && /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
2109
+ children: [
2110
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
2111
+ children: PASTE_HERE_MSG
2112
+ }, undefined, false, undefined, this),
2113
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(TextInput, {
2114
+ value: pastedCode,
2115
+ onChange: setPastedCode,
2116
+ onSubmit: (value_0) => handleSubmitCode(value_0, oauthStatus.url),
2117
+ cursorOffset,
2118
+ onChangeCursorOffset: setCursorOffset,
2119
+ columns: textInputColumns
2120
+ }, undefined, false, undefined, this)
2121
+ ]
2122
+ }, undefined, true, undefined, this)
2123
+ ]
2124
+ }, undefined, true, undefined, this);
2125
+ case "processing":
2126
+ return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
2127
+ children: [
2128
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Spinner, {}, undefined, false, undefined, this),
2129
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
2130
+ children: "Processing authentication\u2026"
2131
+ }, undefined, false, undefined, this)
2132
+ ]
2133
+ }, undefined, true, undefined, this);
2134
+ case "success":
2135
+ return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
2136
+ flexDirection: "column",
2137
+ gap: 1,
2138
+ children: [
2139
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
2140
+ color: "success",
2141
+ children: "\u2713 Authentication token created successfully!"
2142
+ }, undefined, false, undefined, this),
2143
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
2144
+ dimColor: true,
2145
+ children: "Using token for GitHub Actions setup\u2026"
2146
+ }, undefined, false, undefined, this)
2147
+ ]
2148
+ }, undefined, true, undefined, this);
2149
+ case "error":
2150
+ return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
2151
+ flexDirection: "column",
2152
+ gap: 1,
2153
+ children: [
2154
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
2155
+ color: "error",
2156
+ children: [
2157
+ "OAuth error: ",
2158
+ oauthStatus.message
2159
+ ]
2160
+ }, undefined, true, undefined, this),
2161
+ oauthStatus.toRetry ? /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
2162
+ dimColor: true,
2163
+ children: "Press Enter to try again, or any other key to cancel"
2164
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
2165
+ dimColor: true,
2166
+ children: "Press any key to return to API key selection"
2167
+ }, undefined, false, undefined, this)
2168
+ ]
2169
+ }, undefined, true, undefined, this);
2170
+ case "about_to_retry":
2171
+ return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
2172
+ flexDirection: "column",
2173
+ gap: 1,
2174
+ children: /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
2175
+ color: "permission",
2176
+ children: "Retrying\u2026"
2177
+ }, undefined, false, undefined, this)
2178
+ }, undefined, false, undefined, this);
2179
+ default:
2180
+ return null;
2181
+ }
2182
+ }
2183
+ return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
2184
+ flexDirection: "column",
2185
+ gap: 1,
2186
+ tabIndex: 0,
2187
+ autoFocus: true,
2188
+ onKeyDown: handleKeyDown,
2189
+ children: [
2190
+ oauthStatus.state === "starting" && /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
2191
+ flexDirection: "column",
2192
+ gap: 1,
2193
+ paddingBottom: 1,
2194
+ children: [
2195
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
2196
+ bold: true,
2197
+ children: "Create Authentication Token"
2198
+ }, undefined, false, undefined, this),
2199
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
2200
+ dimColor: true,
2201
+ children: "Creating a long-lived token for GitHub Actions"
2202
+ }, undefined, false, undefined, this)
2203
+ ]
2204
+ }, undefined, true, undefined, this),
2205
+ oauthStatus.state !== "success" && oauthStatus.state !== "starting" && oauthStatus.state !== "processing" && /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
2206
+ flexDirection: "column",
2207
+ gap: 1,
2208
+ paddingBottom: 1,
2209
+ children: [
2210
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
2211
+ bold: true,
2212
+ children: "Create Authentication Token"
2213
+ }, undefined, false, undefined, this),
2214
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
2215
+ dimColor: true,
2216
+ children: "Creating a long-lived token for GitHub Actions"
2217
+ }, undefined, false, undefined, this)
2218
+ ]
2219
+ }, "header", true, undefined, this),
2220
+ oauthStatus.state === "waiting_for_login" && showPastePrompt && /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
2221
+ flexDirection: "column",
2222
+ gap: 1,
2223
+ paddingBottom: 1,
2224
+ children: [
2225
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
2226
+ paddingX: 1,
2227
+ children: [
2228
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
2229
+ dimColor: true,
2230
+ children: [
2231
+ "Browser didn't open? Use the url below to sign in",
2232
+ " "
2233
+ ]
2234
+ }, undefined, true, undefined, this),
2235
+ urlCopied ? /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
2236
+ color: "success",
2237
+ children: "(Copied!)"
2238
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
2239
+ dimColor: true,
2240
+ children: /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(KeyboardShortcutHint, {
2241
+ shortcut: "c",
2242
+ action: "copy",
2243
+ parens: true
2244
+ }, undefined, false, undefined, this)
2245
+ }, undefined, false, undefined, this)
2246
+ ]
2247
+ }, undefined, true, undefined, this),
2248
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Link, {
2249
+ url: oauthStatus.url,
2250
+ children: /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
2251
+ dimColor: true,
2252
+ children: oauthStatus.url
2253
+ }, undefined, false, undefined, this)
2254
+ }, undefined, false, undefined, this)
2255
+ ]
2256
+ }, "urlToCopy", true, undefined, this),
2257
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
2258
+ paddingLeft: 1,
2259
+ flexDirection: "column",
2260
+ gap: 1,
2261
+ children: renderStatusMessage()
2262
+ }, undefined, false, undefined, this)
2263
+ ]
2264
+ }, undefined, true, undefined, this);
2265
+ }
2266
+ var import_react5, jsx_dev_runtime10, PASTE_HERE_MSG = "Paste code here if prompted > ";
2267
+ var init_OAuthFlowStep = __esm(() => {
2268
+ init_analytics();
2269
+ init_KeyboardShortcutHint();
2270
+ init_Spinner();
2271
+ init_TextInput();
2272
+ init_useTerminalSize();
2273
+ init_osc();
2274
+ init_ink();
2275
+ init_oauth();
2276
+ init_auth();
2277
+ init_log();
2278
+ import_react5 = __toESM(require_react(), 1);
2279
+ jsx_dev_runtime10 = __toESM(require_jsx_dev_runtime(), 1);
2280
+ });
2281
+
2282
+ // src/commands/install-github-app/SuccessStep.tsx
2283
+ function SuccessStep(t0) {
2284
+ const $ = import_compiler_runtime10.c(21);
2285
+ const {
2286
+ secretExists,
2287
+ useExistingSecret,
2288
+ secretName,
2289
+ skipWorkflow: t1
2290
+ } = t0;
2291
+ const skipWorkflow = t1 === undefined ? false : t1;
2292
+ let t2;
2293
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2294
+ t2 = /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedBox_default, {
2295
+ flexDirection: "column",
2296
+ marginBottom: 1,
2297
+ children: [
2298
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
2299
+ bold: true,
2300
+ children: "Install GitHub App"
2301
+ }, undefined, false, undefined, this),
2302
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
2303
+ dimColor: true,
2304
+ children: "Success"
2305
+ }, undefined, false, undefined, this)
2306
+ ]
2307
+ }, undefined, true, undefined, this);
2308
+ $[0] = t2;
2309
+ } else {
2310
+ t2 = $[0];
2311
+ }
2312
+ let t3;
2313
+ if ($[1] !== skipWorkflow) {
2314
+ t3 = !skipWorkflow && /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
2315
+ color: "success",
2316
+ children: "\u2713 GitHub Actions workflow created!"
2317
+ }, undefined, false, undefined, this);
2318
+ $[1] = skipWorkflow;
2319
+ $[2] = t3;
2320
+ } else {
2321
+ t3 = $[2];
2322
+ }
2323
+ let t4;
2324
+ if ($[3] !== secretExists || $[4] !== useExistingSecret) {
2325
+ t4 = secretExists && useExistingSecret && /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedBox_default, {
2326
+ marginTop: 1,
2327
+ children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
2328
+ color: "success",
2329
+ children: "\u2713 Using existing ANTHROPIC_API_KEY secret"
2330
+ }, undefined, false, undefined, this)
2331
+ }, undefined, false, undefined, this);
2332
+ $[3] = secretExists;
2333
+ $[4] = useExistingSecret;
2334
+ $[5] = t4;
2335
+ } else {
2336
+ t4 = $[5];
2337
+ }
2338
+ let t5;
2339
+ if ($[6] !== secretExists || $[7] !== secretName || $[8] !== useExistingSecret) {
2340
+ t5 = (!secretExists || !useExistingSecret) && /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedBox_default, {
2341
+ marginTop: 1,
2342
+ children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
2343
+ color: "success",
2344
+ children: [
2345
+ "\u2713 API key saved as ",
2346
+ secretName,
2347
+ " secret"
2348
+ ]
2349
+ }, undefined, true, undefined, this)
2350
+ }, undefined, false, undefined, this);
2351
+ $[6] = secretExists;
2352
+ $[7] = secretName;
2353
+ $[8] = useExistingSecret;
2354
+ $[9] = t5;
2355
+ } else {
2356
+ t5 = $[9];
2357
+ }
2358
+ let t6;
2359
+ if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
2360
+ t6 = /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedBox_default, {
2361
+ marginTop: 1,
2362
+ children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
2363
+ children: "Next steps:"
2364
+ }, undefined, false, undefined, this)
2365
+ }, undefined, false, undefined, this);
2366
+ $[10] = t6;
2367
+ } else {
2368
+ t6 = $[10];
2369
+ }
2370
+ let t7;
2371
+ if ($[11] !== skipWorkflow) {
2372
+ t7 = skipWorkflow ? /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(jsx_dev_runtime11.Fragment, {
2373
+ children: [
2374
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
2375
+ children: "1. Install the Claude GitHub App if you haven't already"
2376
+ }, undefined, false, undefined, this),
2377
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
2378
+ children: "2. Your workflow file was kept unchanged"
2379
+ }, undefined, false, undefined, this),
2380
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
2381
+ children: "3. API key is configured and ready to use"
2382
+ }, undefined, false, undefined, this)
2383
+ ]
2384
+ }, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(jsx_dev_runtime11.Fragment, {
2385
+ children: [
2386
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
2387
+ children: "1. A pre-filled PR page has been created"
2388
+ }, undefined, false, undefined, this),
2389
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
2390
+ children: "2. Install the Claude GitHub App if you haven't already"
2391
+ }, undefined, false, undefined, this),
2392
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
2393
+ children: "3. Merge the PR to enable Claude PR assistance"
2394
+ }, undefined, false, undefined, this)
2395
+ ]
2396
+ }, undefined, true, undefined, this);
2397
+ $[11] = skipWorkflow;
2398
+ $[12] = t7;
2399
+ } else {
2400
+ t7 = $[12];
2401
+ }
2402
+ let t8;
2403
+ if ($[13] !== t3 || $[14] !== t4 || $[15] !== t5 || $[16] !== t7) {
2404
+ t8 = /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedBox_default, {
2405
+ flexDirection: "column",
2406
+ borderStyle: "round",
2407
+ paddingX: 1,
2408
+ children: [
2409
+ t2,
2410
+ t3,
2411
+ t4,
2412
+ t5,
2413
+ t6,
2414
+ t7
2415
+ ]
2416
+ }, undefined, true, undefined, this);
2417
+ $[13] = t3;
2418
+ $[14] = t4;
2419
+ $[15] = t5;
2420
+ $[16] = t7;
2421
+ $[17] = t8;
2422
+ } else {
2423
+ t8 = $[17];
2424
+ }
2425
+ let t9;
2426
+ if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
2427
+ t9 = /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedBox_default, {
2428
+ marginLeft: 3,
2429
+ children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
2430
+ dimColor: true,
2431
+ children: "Press any key to exit"
2432
+ }, undefined, false, undefined, this)
2433
+ }, undefined, false, undefined, this);
2434
+ $[18] = t9;
2435
+ } else {
2436
+ t9 = $[18];
2437
+ }
2438
+ let t10;
2439
+ if ($[19] !== t8) {
2440
+ t10 = /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(jsx_dev_runtime11.Fragment, {
2441
+ children: [
2442
+ t8,
2443
+ t9
2444
+ ]
2445
+ }, undefined, true, undefined, this);
2446
+ $[19] = t8;
2447
+ $[20] = t10;
2448
+ } else {
2449
+ t10 = $[20];
2450
+ }
2451
+ return t10;
2452
+ }
2453
+ var import_compiler_runtime10, jsx_dev_runtime11;
2454
+ var init_SuccessStep = __esm(() => {
2455
+ init_ink();
2456
+ import_compiler_runtime10 = __toESM(require_compiler_runtime(), 1);
2457
+ jsx_dev_runtime11 = __toESM(require_jsx_dev_runtime(), 1);
2458
+ });
2459
+
2460
+ // src/commands/install-github-app/setupGitHubActions.ts
2461
+ async function createWorkflowFile(repoName, branchName, workflowPath, workflowContent, secretName, message, context) {
2462
+ const checkFileResult = await execFileNoThrow("gh", [
2463
+ "api",
2464
+ `repos/${repoName}/contents/${workflowPath}`,
2465
+ "--jq",
2466
+ ".sha"
2467
+ ]);
2468
+ let fileSha = null;
2469
+ if (checkFileResult.code === 0) {
2470
+ fileSha = checkFileResult.stdout.trim();
2471
+ }
2472
+ let content = workflowContent;
2473
+ if (secretName === "CLAUDE_CODE_OAUTH_TOKEN") {
2474
+ content = workflowContent.replace(/anthropic_api_key: \$\{\{ secrets\.ANTHROPIC_API_KEY \}\}/g, `claude_code_oauth_token: \${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}`);
2475
+ } else if (secretName !== "ANTHROPIC_API_KEY") {
2476
+ content = workflowContent.replace(/anthropic_api_key: \$\{\{ secrets\.ANTHROPIC_API_KEY \}\}/g, `anthropic_api_key: \${{ secrets.${secretName} }}`);
2477
+ }
2478
+ const base64Content = Buffer.from(content).toString("base64");
2479
+ const apiParams = [
2480
+ "api",
2481
+ "--method",
2482
+ "PUT",
2483
+ `repos/${repoName}/contents/${workflowPath}`,
2484
+ "-f",
2485
+ `message=${fileSha ? `"Update ${message}"` : `"${message}"`}`,
2486
+ "-f",
2487
+ `content=${base64Content}`,
2488
+ "-f",
2489
+ `branch=${branchName}`
2490
+ ];
2491
+ if (fileSha) {
2492
+ apiParams.push("-f", `sha=${fileSha}`);
2493
+ }
2494
+ const createFileResult = await execFileNoThrow("gh", apiParams);
2495
+ if (createFileResult.code !== 0) {
2496
+ if (createFileResult.stderr.includes("422") && createFileResult.stderr.includes("sha")) {
2497
+ logEvent("tengu_setup_github_actions_failed", {
2498
+ reason: "failed_to_create_workflow_file",
2499
+ exit_code: createFileResult.code,
2500
+ ...context
2501
+ });
2502
+ 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.`);
2503
+ }
2504
+ logEvent("tengu_setup_github_actions_failed", {
2505
+ reason: "failed_to_create_workflow_file",
2506
+ exit_code: createFileResult.code,
2507
+ ...context
2508
+ });
2509
+ const helpText = `
2510
+
2511
+ Need help? Common issues:
2512
+ ` + `\xB7 Permission denied \u2192 Run: gh auth refresh -h github.com -s repo,workflow
2513
+ ` + `\xB7 Not authorized \u2192 Ensure you have admin access to the repository
2514
+ ` + "\xB7 For manual setup \u2192 Visit: https://github.com/anthropics/claude-code-action";
2515
+ throw new Error(`Failed to create workflow file ${workflowPath}: ${createFileResult.stderr}${helpText}`);
2516
+ }
2517
+ }
2518
+ async function setupGitHubActions(repoName, apiKeyOrOAuthToken, secretName, updateProgress, skipWorkflow = false, selectedWorkflows, authType, context) {
2519
+ try {
2520
+ logEvent("tengu_setup_github_actions_started", {
2521
+ skip_workflow: skipWorkflow,
2522
+ has_api_key: !!apiKeyOrOAuthToken,
2523
+ using_default_secret_name: secretName === "ANTHROPIC_API_KEY",
2524
+ selected_claude_workflow: selectedWorkflows.includes("claude"),
2525
+ selected_claude_review_workflow: selectedWorkflows.includes("claude-review"),
2526
+ ...context
2527
+ });
2528
+ const repoCheckResult = await execFileNoThrow("gh", [
2529
+ "api",
2530
+ `repos/${repoName}`,
2531
+ "--jq",
2532
+ ".id"
2533
+ ]);
2534
+ if (repoCheckResult.code !== 0) {
2535
+ logEvent("tengu_setup_github_actions_failed", {
2536
+ reason: "repo_not_found",
2537
+ exit_code: repoCheckResult.code,
2538
+ ...context
2539
+ });
2540
+ throw new Error(`Failed to access repository ${repoName}: ${repoCheckResult.stderr}`);
2541
+ }
2542
+ const defaultBranchResult = await execFileNoThrow("gh", [
2543
+ "api",
2544
+ `repos/${repoName}`,
2545
+ "--jq",
2546
+ ".default_branch"
2547
+ ]);
2548
+ if (defaultBranchResult.code !== 0) {
2549
+ logEvent("tengu_setup_github_actions_failed", {
2550
+ reason: "failed_to_get_default_branch",
2551
+ exit_code: defaultBranchResult.code,
2552
+ ...context
2553
+ });
2554
+ throw new Error(`Failed to get default branch: ${defaultBranchResult.stderr}`);
2555
+ }
2556
+ const defaultBranch = defaultBranchResult.stdout.trim();
2557
+ const shaResult = await execFileNoThrow("gh", [
2558
+ "api",
2559
+ `repos/${repoName}/git/ref/heads/${defaultBranch}`,
2560
+ "--jq",
2561
+ ".object.sha"
2562
+ ]);
2563
+ if (shaResult.code !== 0) {
2564
+ logEvent("tengu_setup_github_actions_failed", {
2565
+ reason: "failed_to_get_branch_sha",
2566
+ exit_code: shaResult.code,
2567
+ ...context
2568
+ });
2569
+ throw new Error(`Failed to get branch SHA: ${shaResult.stderr}`);
2570
+ }
2571
+ const sha = shaResult.stdout.trim();
2572
+ let branchName = null;
2573
+ if (!skipWorkflow) {
2574
+ updateProgress();
2575
+ branchName = `add-claude-github-actions-${Date.now()}`;
2576
+ const createBranchResult = await execFileNoThrow("gh", [
2577
+ "api",
2578
+ "--method",
2579
+ "POST",
2580
+ `repos/${repoName}/git/refs`,
2581
+ "-f",
2582
+ `ref=refs/heads/${branchName}`,
2583
+ "-f",
2584
+ `sha=${sha}`
2585
+ ]);
2586
+ if (createBranchResult.code !== 0) {
2587
+ logEvent("tengu_setup_github_actions_failed", {
2588
+ reason: "failed_to_create_branch",
2589
+ exit_code: createBranchResult.code,
2590
+ ...context
2591
+ });
2592
+ throw new Error(`Failed to create branch: ${createBranchResult.stderr}`);
2593
+ }
2594
+ updateProgress();
2595
+ const workflows = [];
2596
+ if (selectedWorkflows.includes("claude")) {
2597
+ workflows.push({
2598
+ path: ".github/workflows/claude.yml",
2599
+ content: WORKFLOW_CONTENT,
2600
+ message: "Claude PR Assistant workflow"
2601
+ });
2602
+ }
2603
+ if (selectedWorkflows.includes("claude-review")) {
2604
+ workflows.push({
2605
+ path: ".github/workflows/claude-code-review.yml",
2606
+ content: CODE_REVIEW_PLUGIN_WORKFLOW_CONTENT,
2607
+ message: "Claude Code Review workflow"
2608
+ });
2609
+ }
2610
+ for (const workflow of workflows) {
2611
+ await createWorkflowFile(repoName, branchName, workflow.path, workflow.content, secretName, workflow.message, context);
2612
+ }
2613
+ }
2614
+ updateProgress();
2615
+ if (apiKeyOrOAuthToken) {
2616
+ const setSecretResult = await execFileNoThrow("gh", [
2617
+ "secret",
2618
+ "set",
2619
+ secretName,
2620
+ "--body",
2621
+ apiKeyOrOAuthToken,
2622
+ "--repo",
2623
+ repoName
2624
+ ]);
2625
+ if (setSecretResult.code !== 0) {
2626
+ logEvent("tengu_setup_github_actions_failed", {
2627
+ reason: "failed_to_set_api_key_secret",
2628
+ exit_code: setSecretResult.code,
2629
+ ...context
2630
+ });
2631
+ const helpText = `
2632
+
2633
+ Need help? Common issues:
2634
+ ` + `\xB7 Permission denied \u2192 Run: gh auth refresh -h github.com -s repo
2635
+ ` + `\xB7 Not authorized \u2192 Ensure you have admin access to the repository
2636
+ ` + "\xB7 For manual setup \u2192 Visit: https://github.com/anthropics/claude-code-action";
2637
+ throw new Error(`Failed to set API key secret: ${setSecretResult.stderr || "Unknown error"}${helpText}`);
2638
+ }
2639
+ }
2640
+ if (!skipWorkflow && branchName) {
2641
+ updateProgress();
2642
+ const compareUrl = `https://github.com/${repoName}/compare/${defaultBranch}...${branchName}?quick_pull=1&title=${encodeURIComponent(PR_TITLE)}&body=${encodeURIComponent(PR_BODY)}`;
2643
+ await openBrowser(compareUrl);
2644
+ }
2645
+ logEvent("tengu_setup_github_actions_completed", {
2646
+ skip_workflow: skipWorkflow,
2647
+ has_api_key: !!apiKeyOrOAuthToken,
2648
+ auth_type: authType,
2649
+ using_default_secret_name: secretName === "ANTHROPIC_API_KEY",
2650
+ selected_claude_workflow: selectedWorkflows.includes("claude"),
2651
+ selected_claude_review_workflow: selectedWorkflows.includes("claude-review"),
2652
+ ...context
2653
+ });
2654
+ saveGlobalConfig((current) => ({
2655
+ ...current,
2656
+ githubActionSetupCount: (current.githubActionSetupCount ?? 0) + 1
2657
+ }));
2658
+ } catch (error) {
2659
+ if (!error || !(error instanceof Error) || !error.message.includes("Failed to")) {
2660
+ logEvent("tengu_setup_github_actions_failed", {
2661
+ reason: "unexpected_error",
2662
+ ...context
2663
+ });
2664
+ }
2665
+ if (error instanceof Error) {
2666
+ logError(error);
2667
+ }
2668
+ throw error;
2669
+ }
2670
+ }
2671
+ var init_setupGitHubActions = __esm(() => {
2672
+ init_analytics();
2673
+ init_config();
2674
+ init_github_app();
2675
+ init_browser();
2676
+ init_execFileNoThrow();
2677
+ init_log();
2678
+ });
2679
+
2680
+ // src/commands/install-github-app/WarningsStep.tsx
2681
+ function WarningsStep(t0) {
2682
+ const $ = import_compiler_runtime11.c(8);
2683
+ const {
2684
+ warnings,
2685
+ onContinue
2686
+ } = t0;
2687
+ let t1;
2688
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2689
+ t1 = {
2690
+ context: "Confirmation"
2691
+ };
2692
+ $[0] = t1;
2693
+ } else {
2694
+ t1 = $[0];
2695
+ }
2696
+ useKeybinding("confirm:yes", onContinue, t1);
2697
+ let t2;
2698
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
2699
+ t2 = /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
2700
+ flexDirection: "column",
2701
+ marginBottom: 1,
2702
+ children: [
2703
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2704
+ bold: true,
2705
+ children: [
2706
+ figures_default.warning,
2707
+ " Setup Warnings"
2708
+ ]
2709
+ }, undefined, true, undefined, this),
2710
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2711
+ dimColor: true,
2712
+ children: "We found some potential issues, but you can continue anyway"
2713
+ }, undefined, false, undefined, this)
2714
+ ]
2715
+ }, undefined, true, undefined, this);
2716
+ $[1] = t2;
2717
+ } else {
2718
+ t2 = $[1];
2719
+ }
2720
+ let t3;
2721
+ if ($[2] !== warnings) {
2722
+ t3 = warnings.map(_temp22);
2723
+ $[2] = warnings;
2724
+ $[3] = t3;
2725
+ } else {
2726
+ t3 = $[3];
2727
+ }
2728
+ let t4;
2729
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
2730
+ t4 = /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
2731
+ marginTop: 1,
2732
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2733
+ bold: true,
2734
+ color: "permission",
2735
+ children: "Press Enter to continue anyway, or Ctrl+C to exit and fix issues"
2736
+ }, undefined, false, undefined, this)
2737
+ }, undefined, false, undefined, this);
2738
+ $[4] = t4;
2739
+ } else {
2740
+ t4 = $[4];
2741
+ }
2742
+ let t5;
2743
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
2744
+ t5 = /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
2745
+ marginTop: 1,
2746
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2747
+ dimColor: true,
2748
+ children: [
2749
+ "You can also try the manual setup steps if needed:",
2750
+ " ",
2751
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2752
+ color: "claude",
2753
+ children: GITHUB_ACTION_SETUP_DOCS_URL
2754
+ }, undefined, false, undefined, this)
2755
+ ]
2756
+ }, undefined, true, undefined, this)
2757
+ }, undefined, false, undefined, this);
2758
+ $[5] = t5;
2759
+ } else {
2760
+ t5 = $[5];
2761
+ }
2762
+ let t6;
2763
+ if ($[6] !== t3) {
2764
+ t6 = /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(jsx_dev_runtime12.Fragment, {
2765
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
2766
+ flexDirection: "column",
2767
+ borderStyle: "round",
2768
+ paddingX: 1,
2769
+ children: [
2770
+ t2,
2771
+ t3,
2772
+ t4,
2773
+ t5
2774
+ ]
2775
+ }, undefined, true, undefined, this)
2776
+ }, undefined, false, undefined, this);
2777
+ $[6] = t3;
2778
+ $[7] = t6;
2779
+ } else {
2780
+ t6 = $[7];
2781
+ }
2782
+ return t6;
2783
+ }
2784
+ function _temp22(warning, index) {
2785
+ return /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
2786
+ flexDirection: "column",
2787
+ marginBottom: 1,
2788
+ children: [
2789
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2790
+ color: "warning",
2791
+ bold: true,
2792
+ children: warning.title
2793
+ }, undefined, false, undefined, this),
2794
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2795
+ children: warning.message
2796
+ }, undefined, false, undefined, this),
2797
+ warning.instructions.length > 0 && /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
2798
+ flexDirection: "column",
2799
+ marginLeft: 2,
2800
+ marginTop: 1,
2801
+ children: warning.instructions.map(_temp3)
2802
+ }, undefined, false, undefined, this)
2803
+ ]
2804
+ }, index, true, undefined, this);
2805
+ }
2806
+ function _temp3(instruction, i) {
2807
+ return /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
2808
+ dimColor: true,
2809
+ children: [
2810
+ "\u2022 ",
2811
+ instruction
2812
+ ]
2813
+ }, i, true, undefined, this);
2814
+ }
2815
+ var import_compiler_runtime11, jsx_dev_runtime12;
2816
+ var init_WarningsStep = __esm(() => {
2817
+ init_figures();
2818
+ init_github_app();
2819
+ init_ink();
2820
+ init_useKeybinding();
2821
+ import_compiler_runtime11 = __toESM(require_compiler_runtime(), 1);
2822
+ jsx_dev_runtime12 = __toESM(require_jsx_dev_runtime(), 1);
2823
+ });
2824
+
2825
+ // src/commands/install-github-app/install-github-app.tsx
2826
+ function InstallGitHubApp(props) {
2827
+ const [existingApiKey] = import_react6.useState(() => getAnthropicApiKey());
2828
+ const [state, setState] = import_react6.useState({
2829
+ ...INITIAL_STATE,
2830
+ useExistingKey: !!existingApiKey,
2831
+ selectedApiKeyOption: existingApiKey ? "existing" : isAnthropicAuthEnabled() ? "oauth" : "new"
2832
+ });
2833
+ useExitOnCtrlCDWithKeybindings();
2834
+ import_react6.default.useEffect(() => {
2835
+ logEvent("tengu_install_github_app_started", {});
2836
+ }, []);
2837
+ const checkGitHubCLI = import_react6.useCallback(async () => {
2838
+ const warnings = [];
2839
+ const ghVersionResult = await execa("gh --version", {
2840
+ shell: true,
2841
+ reject: false
2842
+ });
2843
+ if (ghVersionResult.exitCode !== 0) {
2844
+ warnings.push({
2845
+ title: "GitHub CLI not found",
2846
+ message: "GitHub CLI (gh) does not appear to be installed or accessible.",
2847
+ instructions: ["Install GitHub CLI from https://cli.github.com/", "macOS: brew install gh", "Windows: winget install --id GitHub.cli", "Linux: See installation instructions at https://github.com/cli/cli#installation"]
2848
+ });
2849
+ }
2850
+ const authResult = await execa("gh auth status -a", {
2851
+ shell: true,
2852
+ reject: false
2853
+ });
2854
+ if (authResult.exitCode !== 0) {
2855
+ warnings.push({
2856
+ title: "GitHub CLI not authenticated",
2857
+ message: "GitHub CLI does not appear to be authenticated.",
2858
+ instructions: ["Run: gh auth login", "Follow the prompts to authenticate with GitHub", "Or set up authentication using environment variables or other methods"]
2859
+ });
2860
+ } else {
2861
+ const tokenScopesMatch = authResult.stdout.match(/Token scopes:.*$/m);
2862
+ if (tokenScopesMatch) {
2863
+ const scopes = tokenScopesMatch[0];
2864
+ const missingScopes = [];
2865
+ if (!scopes.includes("repo")) {
2866
+ missingScopes.push("repo");
2867
+ }
2868
+ if (!scopes.includes("workflow")) {
2869
+ missingScopes.push("workflow");
2870
+ }
2871
+ if (missingScopes.length > 0) {
2872
+ setState((prev) => ({
2873
+ ...prev,
2874
+ step: "error",
2875
+ error: `GitHub CLI is missing required permissions: ${missingScopes.join(", ")}.`,
2876
+ errorReason: "Missing required scopes",
2877
+ errorInstructions: [`Your GitHub CLI authentication is missing the "${missingScopes.join('" and "')}" ${plural(missingScopes.length, "scope")} needed to manage GitHub Actions and secrets.`, "", "To fix this, run:", " gh auth refresh -h github.com -s repo,workflow", "", "This will add the necessary permissions to manage workflows and secrets."]
2878
+ }));
2879
+ return;
2880
+ }
2881
+ }
2882
+ }
2883
+ const currentRepo = await getGithubRepo() ?? "";
2884
+ logEvent("tengu_install_github_app_step_completed", {
2885
+ step: "check-gh"
2886
+ });
2887
+ setState((prev_0) => ({
2888
+ ...prev_0,
2889
+ warnings,
2890
+ currentRepo,
2891
+ selectedRepoName: currentRepo,
2892
+ useCurrentRepo: !!currentRepo,
2893
+ step: warnings.length > 0 ? "warnings" : "choose-repo"
2894
+ }));
2895
+ }, []);
2896
+ import_react6.default.useEffect(() => {
2897
+ if (state.step === "check-gh") {
2898
+ checkGitHubCLI();
2899
+ }
2900
+ }, [state.step, checkGitHubCLI]);
2901
+ const runSetupGitHubActions = import_react6.useCallback(async (apiKeyOrOAuthToken, secretName) => {
2902
+ setState((prev_1) => ({
2903
+ ...prev_1,
2904
+ step: "creating",
2905
+ currentWorkflowInstallStep: 0
2906
+ }));
2907
+ try {
2908
+ await setupGitHubActions(state.selectedRepoName, apiKeyOrOAuthToken, secretName, () => {
2909
+ setState((prev_4) => ({
2910
+ ...prev_4,
2911
+ currentWorkflowInstallStep: prev_4.currentWorkflowInstallStep + 1
2912
+ }));
2913
+ }, state.workflowAction === "skip", state.selectedWorkflows, state.authType, {
2914
+ useCurrentRepo: state.useCurrentRepo,
2915
+ workflowExists: state.workflowExists,
2916
+ secretExists: state.secretExists
2917
+ });
2918
+ logEvent("tengu_install_github_app_step_completed", {
2919
+ step: "creating"
2920
+ });
2921
+ setState((prev_5) => ({
2922
+ ...prev_5,
2923
+ step: "success"
2924
+ }));
2925
+ } catch (error) {
2926
+ const errorMessage = error instanceof Error ? error.message : "Failed to set up GitHub Actions";
2927
+ if (errorMessage.includes("workflow file already exists")) {
2928
+ logEvent("tengu_install_github_app_error", {
2929
+ reason: "workflow_file_exists"
2930
+ });
2931
+ setState((prev_2) => ({
2932
+ ...prev_2,
2933
+ step: "error",
2934
+ error: "A Claude workflow file already exists in this repository.",
2935
+ errorReason: "Workflow file conflict",
2936
+ errorInstructions: ["The file .github/workflows/claude.yml already exists", "You can either:", " 1. Delete the existing file and run this command again", " 2. Update the existing file manually using the template from:", ` ${GITHUB_ACTION_SETUP_DOCS_URL}`]
2937
+ }));
2938
+ } else {
2939
+ logEvent("tengu_install_github_app_error", {
2940
+ reason: "setup_github_actions_failed"
2941
+ });
2942
+ setState((prev_3) => ({
2943
+ ...prev_3,
2944
+ step: "error",
2945
+ error: errorMessage,
2946
+ errorReason: "GitHub Actions setup failed",
2947
+ errorInstructions: []
2948
+ }));
2949
+ }
2950
+ }
2951
+ }, [state.selectedRepoName, state.workflowAction, state.selectedWorkflows, state.useCurrentRepo, state.workflowExists, state.secretExists, state.authType]);
2952
+ async function openGitHubAppInstallation() {
2953
+ const installUrl = "https://github.com/apps/claude";
2954
+ await openBrowser(installUrl);
2955
+ }
2956
+ async function checkRepositoryPermissions(repoName) {
2957
+ try {
2958
+ const result = await execFileNoThrow("gh", ["api", `repos/${repoName}`, "--jq", ".permissions.admin"]);
2959
+ if (result.code === 0) {
2960
+ const hasAdmin = result.stdout.trim() === "true";
2961
+ return {
2962
+ hasAccess: hasAdmin
2963
+ };
2964
+ }
2965
+ if (result.stderr.includes("404") || result.stderr.includes("Not Found")) {
2966
+ return {
2967
+ hasAccess: false,
2968
+ error: "repository_not_found"
2969
+ };
2970
+ }
2971
+ return {
2972
+ hasAccess: false
2973
+ };
2974
+ } catch {
2975
+ return {
2976
+ hasAccess: false
2977
+ };
2978
+ }
2979
+ }
2980
+ async function checkExistingWorkflowFile(repoName_0) {
2981
+ const checkFileResult = await execFileNoThrow("gh", ["api", `repos/${repoName_0}/contents/.github/workflows/claude.yml`, "--jq", ".sha"]);
2982
+ return checkFileResult.code === 0;
2983
+ }
2984
+ async function checkExistingSecret() {
2985
+ const checkSecretsResult = await execFileNoThrow("gh", ["secret", "list", "--app", "actions", "--repo", state.selectedRepoName]);
2986
+ if (checkSecretsResult.code === 0) {
2987
+ const lines = checkSecretsResult.stdout.split(`
2988
+ `);
2989
+ const hasAnthropicKey = lines.some((line) => {
2990
+ return /^ANTHROPIC_API_KEY\s+/.test(line);
2991
+ });
2992
+ if (hasAnthropicKey) {
2993
+ setState((prev_6) => ({
2994
+ ...prev_6,
2995
+ secretExists: true,
2996
+ step: "check-existing-secret"
2997
+ }));
2998
+ } else {
2999
+ if (existingApiKey) {
3000
+ setState((prev_7) => ({
3001
+ ...prev_7,
3002
+ apiKeyOrOAuthToken: existingApiKey,
3003
+ useExistingKey: true
3004
+ }));
3005
+ await runSetupGitHubActions(existingApiKey, state.secretName);
3006
+ } else {
3007
+ setState((prev_8) => ({
3008
+ ...prev_8,
3009
+ step: "api-key"
3010
+ }));
3011
+ }
3012
+ }
3013
+ } else {
3014
+ if (existingApiKey) {
3015
+ setState((prev_9) => ({
3016
+ ...prev_9,
3017
+ apiKeyOrOAuthToken: existingApiKey,
3018
+ useExistingKey: true
3019
+ }));
3020
+ await runSetupGitHubActions(existingApiKey, state.secretName);
3021
+ } else {
3022
+ setState((prev_10) => ({
3023
+ ...prev_10,
3024
+ step: "api-key"
3025
+ }));
3026
+ }
3027
+ }
3028
+ }
3029
+ const handleSubmit = async () => {
3030
+ if (state.step === "warnings") {
3031
+ logEvent("tengu_install_github_app_step_completed", {
3032
+ step: "warnings"
3033
+ });
3034
+ setState((prev_11) => ({
3035
+ ...prev_11,
3036
+ step: "install-app"
3037
+ }));
3038
+ setTimeout(openGitHubAppInstallation, 0);
3039
+ } else if (state.step === "choose-repo") {
3040
+ let repoName_1 = state.useCurrentRepo ? state.currentRepo : state.selectedRepoName;
3041
+ if (!repoName_1.trim()) {
3042
+ return;
3043
+ }
3044
+ const repoWarnings = [];
3045
+ if (repoName_1.includes("github.com")) {
3046
+ const match = repoName_1.match(/github\.com[:/]([^/]+\/[^/]+)(\.git)?$/);
3047
+ if (!match) {
3048
+ repoWarnings.push({
3049
+ title: "Invalid GitHub URL format",
3050
+ message: "The repository URL format appears to be invalid.",
3051
+ instructions: ["Use format: owner/repo or https://github.com/owner/repo", "Example: anthropics/claude-cli"]
3052
+ });
3053
+ } else {
3054
+ repoName_1 = match[1]?.replace(/\.git$/, "") || "";
3055
+ }
3056
+ }
3057
+ if (!repoName_1.includes("/")) {
3058
+ repoWarnings.push({
3059
+ title: "Repository format warning",
3060
+ message: 'Repository should be in format "owner/repo"',
3061
+ instructions: ["Use format: owner/repo", "Example: anthropics/claude-cli"]
3062
+ });
3063
+ }
3064
+ const permissionCheck = await checkRepositoryPermissions(repoName_1);
3065
+ if (permissionCheck.error === "repository_not_found") {
3066
+ repoWarnings.push({
3067
+ title: "Repository not found",
3068
+ message: `Repository ${repoName_1} was not found or you don't have access.`,
3069
+ instructions: [`Check that the repository name is correct: ${repoName_1}`, "Ensure you have access to this repository", 'For private repositories, make sure your GitHub token has the "repo" scope', "You can add the repo scope with: gh auth refresh -h github.com -s repo,workflow"]
3070
+ });
3071
+ } else if (!permissionCheck.hasAccess) {
3072
+ repoWarnings.push({
3073
+ title: "Admin permissions required",
3074
+ message: `You might need admin permissions on ${repoName_1} to set up GitHub Actions.`,
3075
+ instructions: ["Repository admins can install GitHub Apps and set secrets", "Ask a repository admin to run this command if setup fails", "Alternatively, you can use the manual setup instructions"]
3076
+ });
3077
+ }
3078
+ const workflowExists = await checkExistingWorkflowFile(repoName_1);
3079
+ if (repoWarnings.length > 0) {
3080
+ const allWarnings = [...state.warnings, ...repoWarnings];
3081
+ setState((prev_12) => ({
3082
+ ...prev_12,
3083
+ selectedRepoName: repoName_1,
3084
+ workflowExists,
3085
+ warnings: allWarnings,
3086
+ step: "warnings"
3087
+ }));
3088
+ } else {
3089
+ logEvent("tengu_install_github_app_step_completed", {
3090
+ step: "choose-repo"
3091
+ });
3092
+ setState((prev_13) => ({
3093
+ ...prev_13,
3094
+ selectedRepoName: repoName_1,
3095
+ workflowExists,
3096
+ step: "install-app"
3097
+ }));
3098
+ setTimeout(openGitHubAppInstallation, 0);
3099
+ }
3100
+ } else if (state.step === "install-app") {
3101
+ logEvent("tengu_install_github_app_step_completed", {
3102
+ step: "install-app"
3103
+ });
3104
+ if (state.workflowExists) {
3105
+ setState((prev_14) => ({
3106
+ ...prev_14,
3107
+ step: "check-existing-workflow"
3108
+ }));
3109
+ } else {
3110
+ setState((prev_15) => ({
3111
+ ...prev_15,
3112
+ step: "select-workflows"
3113
+ }));
3114
+ }
3115
+ } else if (state.step === "check-existing-workflow") {
3116
+ return;
3117
+ } else if (state.step === "select-workflows") {
3118
+ return;
3119
+ } else if (state.step === "check-existing-secret") {
3120
+ logEvent("tengu_install_github_app_step_completed", {
3121
+ step: "check-existing-secret"
3122
+ });
3123
+ if (state.useExistingSecret) {
3124
+ await runSetupGitHubActions(null, state.secretName);
3125
+ } else {
3126
+ await runSetupGitHubActions(state.apiKeyOrOAuthToken, state.secretName);
3127
+ }
3128
+ } else if (state.step === "api-key") {
3129
+ if (state.selectedApiKeyOption === "oauth") {
3130
+ return;
3131
+ }
3132
+ const apiKeyToUse = state.selectedApiKeyOption === "existing" ? existingApiKey : state.apiKeyOrOAuthToken;
3133
+ if (!apiKeyToUse) {
3134
+ logEvent("tengu_install_github_app_error", {
3135
+ reason: "api_key_missing"
3136
+ });
3137
+ setState((prev_16) => ({
3138
+ ...prev_16,
3139
+ step: "error",
3140
+ error: "API key is required"
3141
+ }));
3142
+ return;
3143
+ }
3144
+ setState((prev_17) => ({
3145
+ ...prev_17,
3146
+ apiKeyOrOAuthToken: apiKeyToUse,
3147
+ useExistingKey: state.selectedApiKeyOption === "existing"
3148
+ }));
3149
+ const checkSecretsResult_0 = await execFileNoThrow("gh", ["secret", "list", "--app", "actions", "--repo", state.selectedRepoName]);
3150
+ if (checkSecretsResult_0.code === 0) {
3151
+ const lines_0 = checkSecretsResult_0.stdout.split(`
3152
+ `);
3153
+ const hasAnthropicKey_0 = lines_0.some((line_0) => {
3154
+ return /^ANTHROPIC_API_KEY\s+/.test(line_0);
3155
+ });
3156
+ if (hasAnthropicKey_0) {
3157
+ logEvent("tengu_install_github_app_step_completed", {
3158
+ step: "api-key"
3159
+ });
3160
+ setState((prev_18) => ({
3161
+ ...prev_18,
3162
+ secretExists: true,
3163
+ step: "check-existing-secret"
3164
+ }));
3165
+ } else {
3166
+ logEvent("tengu_install_github_app_step_completed", {
3167
+ step: "api-key"
3168
+ });
3169
+ await runSetupGitHubActions(apiKeyToUse, state.secretName);
3170
+ }
3171
+ } else {
3172
+ logEvent("tengu_install_github_app_step_completed", {
3173
+ step: "api-key"
3174
+ });
3175
+ await runSetupGitHubActions(apiKeyToUse, state.secretName);
3176
+ }
3177
+ }
3178
+ };
3179
+ const handleRepoUrlChange = (value) => {
3180
+ setState((prev_19) => ({
3181
+ ...prev_19,
3182
+ selectedRepoName: value
3183
+ }));
3184
+ };
3185
+ const handleApiKeyChange = (value_0) => {
3186
+ setState((prev_20) => ({
3187
+ ...prev_20,
3188
+ apiKeyOrOAuthToken: value_0
3189
+ }));
3190
+ };
3191
+ const handleApiKeyOptionChange = (option) => {
3192
+ setState((prev_21) => ({
3193
+ ...prev_21,
3194
+ selectedApiKeyOption: option
3195
+ }));
3196
+ };
3197
+ const handleCreateOAuthToken = import_react6.useCallback(() => {
3198
+ logEvent("tengu_install_github_app_step_completed", {
3199
+ step: "api-key"
3200
+ });
3201
+ setState((prev_22) => ({
3202
+ ...prev_22,
3203
+ step: "oauth-flow"
3204
+ }));
3205
+ }, []);
3206
+ const handleOAuthSuccess = import_react6.useCallback((token) => {
3207
+ logEvent("tengu_install_github_app_step_completed", {
3208
+ step: "oauth-flow"
3209
+ });
3210
+ setState((prev_23) => ({
3211
+ ...prev_23,
3212
+ apiKeyOrOAuthToken: token,
3213
+ useExistingKey: false,
3214
+ secretName: "CLAUDE_CODE_OAUTH_TOKEN",
3215
+ authType: "oauth_token"
3216
+ }));
3217
+ runSetupGitHubActions(token, "CLAUDE_CODE_OAUTH_TOKEN");
3218
+ }, [runSetupGitHubActions]);
3219
+ const handleOAuthCancel = import_react6.useCallback(() => {
3220
+ setState((prev_24) => ({
3221
+ ...prev_24,
3222
+ step: "api-key"
3223
+ }));
3224
+ }, []);
3225
+ const handleSecretNameChange = (value_1) => {
3226
+ if (value_1 && !/^[a-zA-Z0-9_]+$/.test(value_1))
3227
+ return;
3228
+ setState((prev_25) => ({
3229
+ ...prev_25,
3230
+ secretName: value_1
3231
+ }));
3232
+ };
3233
+ const handleToggleUseCurrentRepo = (useCurrentRepo) => {
3234
+ setState((prev_26) => ({
3235
+ ...prev_26,
3236
+ useCurrentRepo,
3237
+ selectedRepoName: useCurrentRepo ? prev_26.currentRepo : ""
3238
+ }));
3239
+ };
3240
+ const handleToggleUseExistingKey = (useExistingKey) => {
3241
+ setState((prev_27) => ({
3242
+ ...prev_27,
3243
+ useExistingKey
3244
+ }));
3245
+ };
3246
+ const handleToggleUseExistingSecret = (useExistingSecret) => {
3247
+ setState((prev_28) => ({
3248
+ ...prev_28,
3249
+ useExistingSecret,
3250
+ secretName: useExistingSecret ? "ANTHROPIC_API_KEY" : ""
3251
+ }));
3252
+ };
3253
+ const handleWorkflowAction = async (action) => {
3254
+ if (action === "exit") {
3255
+ props.onDone("Installation cancelled by user");
3256
+ return;
3257
+ }
3258
+ logEvent("tengu_install_github_app_step_completed", {
3259
+ step: "check-existing-workflow"
3260
+ });
3261
+ setState((prev_29) => ({
3262
+ ...prev_29,
3263
+ workflowAction: action
3264
+ }));
3265
+ if (action === "skip" || action === "update") {
3266
+ if (existingApiKey) {
3267
+ await checkExistingSecret();
3268
+ } else {
3269
+ setState((prev_30) => ({
3270
+ ...prev_30,
3271
+ step: "api-key"
3272
+ }));
3273
+ }
3274
+ }
3275
+ };
3276
+ function handleDismissKeyDown(e) {
3277
+ e.preventDefault();
3278
+ if (state.step === "success") {
3279
+ logEvent("tengu_install_github_app_completed", {});
3280
+ }
3281
+ props.onDone(state.step === "success" ? "GitHub Actions setup complete!" : state.error ? `Couldn't install GitHub App: ${state.error}
3282
+ For manual setup instructions, see: ${GITHUB_ACTION_SETUP_DOCS_URL}` : `GitHub App installation failed
3283
+ For manual setup instructions, see: ${GITHUB_ACTION_SETUP_DOCS_URL}`);
3284
+ }
3285
+ switch (state.step) {
3286
+ case "check-gh":
3287
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(CheckGitHubStep, {}, undefined, false, undefined, this);
3288
+ case "warnings":
3289
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(WarningsStep, {
3290
+ warnings: state.warnings,
3291
+ onContinue: handleSubmit
3292
+ }, undefined, false, undefined, this);
3293
+ case "choose-repo":
3294
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ChooseRepoStep, {
3295
+ currentRepo: state.currentRepo,
3296
+ useCurrentRepo: state.useCurrentRepo,
3297
+ repoUrl: state.selectedRepoName,
3298
+ onRepoUrlChange: handleRepoUrlChange,
3299
+ onToggleUseCurrentRepo: handleToggleUseCurrentRepo,
3300
+ onSubmit: handleSubmit
3301
+ }, undefined, false, undefined, this);
3302
+ case "install-app":
3303
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(InstallAppStep, {
3304
+ repoUrl: state.selectedRepoName,
3305
+ onSubmit: handleSubmit
3306
+ }, undefined, false, undefined, this);
3307
+ case "check-existing-workflow":
3308
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ExistingWorkflowStep, {
3309
+ repoName: state.selectedRepoName,
3310
+ onSelectAction: handleWorkflowAction
3311
+ }, undefined, false, undefined, this);
3312
+ case "check-existing-secret":
3313
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(CheckExistingSecretStep, {
3314
+ useExistingSecret: state.useExistingSecret,
3315
+ secretName: state.secretName,
3316
+ onToggleUseExistingSecret: handleToggleUseExistingSecret,
3317
+ onSecretNameChange: handleSecretNameChange,
3318
+ onSubmit: handleSubmit
3319
+ }, undefined, false, undefined, this);
3320
+ case "api-key":
3321
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ApiKeyStep, {
3322
+ existingApiKey,
3323
+ useExistingKey: state.useExistingKey,
3324
+ apiKeyOrOAuthToken: state.apiKeyOrOAuthToken,
3325
+ onApiKeyChange: handleApiKeyChange,
3326
+ onToggleUseExistingKey: handleToggleUseExistingKey,
3327
+ onSubmit: handleSubmit,
3328
+ onCreateOAuthToken: isAnthropicAuthEnabled() ? handleCreateOAuthToken : undefined,
3329
+ selectedOption: state.selectedApiKeyOption,
3330
+ onSelectOption: handleApiKeyOptionChange
3331
+ }, undefined, false, undefined, this);
3332
+ case "creating":
3333
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(CreatingStep, {
3334
+ currentWorkflowInstallStep: state.currentWorkflowInstallStep,
3335
+ secretExists: state.secretExists,
3336
+ useExistingSecret: state.useExistingSecret,
3337
+ secretName: state.secretName,
3338
+ skipWorkflow: state.workflowAction === "skip",
3339
+ selectedWorkflows: state.selectedWorkflows
3340
+ }, undefined, false, undefined, this);
3341
+ case "success":
3342
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
3343
+ tabIndex: 0,
3344
+ autoFocus: true,
3345
+ onKeyDown: handleDismissKeyDown,
3346
+ children: /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(SuccessStep, {
3347
+ secretExists: state.secretExists,
3348
+ useExistingSecret: state.useExistingSecret,
3349
+ secretName: state.secretName,
3350
+ skipWorkflow: state.workflowAction === "skip"
3351
+ }, undefined, false, undefined, this)
3352
+ }, undefined, false, undefined, this);
3353
+ case "error":
3354
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
3355
+ tabIndex: 0,
3356
+ autoFocus: true,
3357
+ onKeyDown: handleDismissKeyDown,
3358
+ children: /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ErrorStep, {
3359
+ error: state.error,
3360
+ errorReason: state.errorReason,
3361
+ errorInstructions: state.errorInstructions
3362
+ }, undefined, false, undefined, this)
3363
+ }, undefined, false, undefined, this);
3364
+ case "select-workflows":
3365
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(WorkflowMultiselectDialog, {
3366
+ defaultSelections: state.selectedWorkflows,
3367
+ onSubmit: (selectedWorkflows) => {
3368
+ logEvent("tengu_install_github_app_step_completed", {
3369
+ step: "select-workflows"
3370
+ });
3371
+ setState((prev_31) => ({
3372
+ ...prev_31,
3373
+ selectedWorkflows
3374
+ }));
3375
+ if (existingApiKey) {
3376
+ checkExistingSecret();
3377
+ } else {
3378
+ setState((prev_32) => ({
3379
+ ...prev_32,
3380
+ step: "api-key"
3381
+ }));
3382
+ }
3383
+ }
3384
+ }, undefined, false, undefined, this);
3385
+ case "oauth-flow":
3386
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(OAuthFlowStep, {
3387
+ onSuccess: handleOAuthSuccess,
3388
+ onCancel: handleOAuthCancel
3389
+ }, undefined, false, undefined, this);
3390
+ }
3391
+ }
3392
+ async function call(onDone) {
3393
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(InstallGitHubApp, {
3394
+ onDone
3395
+ }, undefined, false, undefined, this);
3396
+ }
3397
+ var import_react6, jsx_dev_runtime13, INITIAL_STATE;
3398
+ var init_install_github_app = __esm(() => {
3399
+ init_execa();
3400
+ init_analytics();
3401
+ init_WorkflowMultiselectDialog();
3402
+ init_github_app();
3403
+ init_useExitOnCtrlCDWithKeybindings();
3404
+ init_ink();
3405
+ init_auth();
3406
+ init_browser();
3407
+ init_execFileNoThrow();
3408
+ init_git();
3409
+ init_stringUtils();
3410
+ init_ApiKeyStep();
3411
+ init_CheckExistingSecretStep();
3412
+ init_CheckGitHubStep();
3413
+ init_ChooseRepoStep();
3414
+ init_CreatingStep();
3415
+ init_ErrorStep();
3416
+ init_ExistingWorkflowStep();
3417
+ init_InstallAppStep();
3418
+ init_OAuthFlowStep();
3419
+ init_SuccessStep();
3420
+ init_setupGitHubActions();
3421
+ init_WarningsStep();
3422
+ import_react6 = __toESM(require_react(), 1);
3423
+ jsx_dev_runtime13 = __toESM(require_jsx_dev_runtime(), 1);
3424
+ INITIAL_STATE = {
3425
+ step: "check-gh",
3426
+ selectedRepoName: "",
3427
+ currentRepo: "",
3428
+ useCurrentRepo: false,
3429
+ apiKeyOrOAuthToken: "",
3430
+ useExistingKey: true,
3431
+ currentWorkflowInstallStep: 0,
3432
+ warnings: [],
3433
+ secretExists: false,
3434
+ secretName: "ANTHROPIC_API_KEY",
3435
+ useExistingSecret: true,
3436
+ workflowExists: false,
3437
+ selectedWorkflows: ["claude", "claude-review"],
3438
+ selectedApiKeyOption: "new",
3439
+ authType: "api_key"
3440
+ };
3441
+ });
3442
+ init_install_github_app();
3443
+
3444
+ export {
3445
+ call
3446
+ };