jialing-code 1.1.0

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