@jayjiang/open-cc 0.2.1

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