@foxclicom/foxcli 2.1.89

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