claude-code-best 1.0.3

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