@redscope-ai/redscope 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (619) hide show
  1. package/README.md +224 -0
  2. package/dist/chunk-090920rk.js +288 -0
  3. package/dist/chunk-0afb2r78.js +141 -0
  4. package/dist/chunk-0d4ekx1g.js +73 -0
  5. package/dist/chunk-0g6nwbhq.js +15 -0
  6. package/dist/chunk-0qj905nt.js +18 -0
  7. package/dist/chunk-0s5btnn1.js +186 -0
  8. package/dist/chunk-0s8fars0.js +91 -0
  9. package/dist/chunk-10ev3dvh.js +312 -0
  10. package/dist/chunk-10k5jfc5.js +1295 -0
  11. package/dist/chunk-12tspwqa.js +240 -0
  12. package/dist/chunk-13qesvnw.js +17 -0
  13. package/dist/chunk-143eh1e0.js +121 -0
  14. package/dist/chunk-14p6wvsq.js +39 -0
  15. package/dist/chunk-19f3zb1m.js +342 -0
  16. package/dist/chunk-1a5cep8h.js +145 -0
  17. package/dist/chunk-1abw9kkn.js +34 -0
  18. package/dist/chunk-1aer7c78.js +118 -0
  19. package/dist/chunk-1dazz4g6.js +154 -0
  20. package/dist/chunk-1fcf4ty1.js +142 -0
  21. package/dist/chunk-1gnxhyf8.js +62 -0
  22. package/dist/chunk-1he3944e.js +8124 -0
  23. package/dist/chunk-1jpayz7y.js +952 -0
  24. package/dist/chunk-1qd6f6vk.js +269 -0
  25. package/dist/chunk-1v0kpe62.js +2547 -0
  26. package/dist/chunk-1w20m7gw.js +445 -0
  27. package/dist/chunk-1y7kp51j.js +72 -0
  28. package/dist/chunk-1ycb5sxt.js +247 -0
  29. package/dist/chunk-1zbwhcbt.js +1124 -0
  30. package/dist/chunk-20psem54.js +116 -0
  31. package/dist/chunk-23h69r5b.js +30 -0
  32. package/dist/chunk-23x86ptv.js +473 -0
  33. package/dist/chunk-24fyv3jz.js +378 -0
  34. package/dist/chunk-24kv69g3.js +97 -0
  35. package/dist/chunk-2azx8zsc.js +125 -0
  36. package/dist/chunk-2d1gwzz9.js +524 -0
  37. package/dist/chunk-2g0ytd9d.js +29058 -0
  38. package/dist/chunk-2hfp9kat.js +21 -0
  39. package/dist/chunk-2j875eq6.js +37 -0
  40. package/dist/chunk-2kcgxnvp.js +39 -0
  41. package/dist/chunk-2kz09j2s.js +23 -0
  42. package/dist/chunk-2mwnwp0n.js +17 -0
  43. package/dist/chunk-2p1cqhcn.js +921 -0
  44. package/dist/chunk-2p369q9z.js +61 -0
  45. package/dist/chunk-2rf6asgf.js +151 -0
  46. package/dist/chunk-2vr7mqx1.js +384 -0
  47. package/dist/chunk-2xcg933e.js +205 -0
  48. package/dist/chunk-2ypwckbz.js +40310 -0
  49. package/dist/chunk-30wnahyg.js +626 -0
  50. package/dist/chunk-326zehp8.js +204 -0
  51. package/dist/chunk-32s6jzgw.js +183 -0
  52. package/dist/chunk-35yzt1a7.js +202 -0
  53. package/dist/chunk-38frkej6.js +62 -0
  54. package/dist/chunk-3abaq08g.js +34 -0
  55. package/dist/chunk-3h59ttr5.js +32 -0
  56. package/dist/chunk-3nk9q8dr.js +154 -0
  57. package/dist/chunk-3prrxevm.js +224 -0
  58. package/dist/chunk-3tv8p9xw.js +127 -0
  59. package/dist/chunk-3txyekes.js +19 -0
  60. package/dist/chunk-3vfxjn7g.js +19 -0
  61. package/dist/chunk-3w9sye8h.js +81 -0
  62. package/dist/chunk-3y69j7y8.js +24 -0
  63. package/dist/chunk-3zwjpkjh.js +1603 -0
  64. package/dist/chunk-40t1d75v.js +3442 -0
  65. package/dist/chunk-470kmby4.js +318 -0
  66. package/dist/chunk-47jc141z.js +335 -0
  67. package/dist/chunk-48rz50ct.js +868 -0
  68. package/dist/chunk-49wv03ts.js +232 -0
  69. package/dist/chunk-4a189mn2.js +103 -0
  70. package/dist/chunk-4c4fmh7a.js +15 -0
  71. package/dist/chunk-4ct8dsj5.js +49 -0
  72. package/dist/chunk-4kqt1pm1.js +100 -0
  73. package/dist/chunk-4ng0xy0e.js +802 -0
  74. package/dist/chunk-4spgkgr3.js +43 -0
  75. package/dist/chunk-4tjdwtyy.js +19 -0
  76. package/dist/chunk-4tr60273.js +370 -0
  77. package/dist/chunk-4vnaeng5.js +29 -0
  78. package/dist/chunk-4wbqpeaw.js +871 -0
  79. package/dist/chunk-4wgkv3fv.js +1140 -0
  80. package/dist/chunk-4yjskjb6.js +40 -0
  81. package/dist/chunk-50m3a23z.js +35 -0
  82. package/dist/chunk-511f79az.js +182 -0
  83. package/dist/chunk-51sgztvv.js +161 -0
  84. package/dist/chunk-563fcpv1.js +290 -0
  85. package/dist/chunk-564cnq6v.js +735 -0
  86. package/dist/chunk-569r8cxc.js +31 -0
  87. package/dist/chunk-570x55d4.js +12 -0
  88. package/dist/chunk-571556cm.js +80 -0
  89. package/dist/chunk-59t4c56e.js +63 -0
  90. package/dist/chunk-5axjhkma.js +36 -0
  91. package/dist/chunk-5b188q5e.js +157 -0
  92. package/dist/chunk-5dmn1865.js +439 -0
  93. package/dist/chunk-5ks4829r.js +267 -0
  94. package/dist/chunk-5mmhfbxb.js +1078 -0
  95. package/dist/chunk-5rdt14hy.js +742 -0
  96. package/dist/chunk-5ssryexj.js +121 -0
  97. package/dist/chunk-5v95pnq4.js +15 -0
  98. package/dist/chunk-5xvjt2t9.js +68 -0
  99. package/dist/chunk-5zyq6t1q.js +118 -0
  100. package/dist/chunk-60fkafk2.js +15 -0
  101. package/dist/chunk-62fjkf5q.js +46 -0
  102. package/dist/chunk-64gazrrb.js +8067 -0
  103. package/dist/chunk-65tq2yjx.js +126 -0
  104. package/dist/chunk-65zbgg1n.js +14 -0
  105. package/dist/chunk-66v8mty3.js +264 -0
  106. package/dist/chunk-6acx5heq.js +292 -0
  107. package/dist/chunk-6hr7742d.js +61 -0
  108. package/dist/chunk-6hygvrhn.js +143 -0
  109. package/dist/chunk-6kjh280m.js +128 -0
  110. package/dist/chunk-6s0q1s5r.js +66 -0
  111. package/dist/chunk-6x35ffpx.js +690 -0
  112. package/dist/chunk-71jfy1hh.js +570 -0
  113. package/dist/chunk-71sdcaq6.js +15 -0
  114. package/dist/chunk-754qdxs5.js +92 -0
  115. package/dist/chunk-79v5bkj4.js +1176 -0
  116. package/dist/chunk-7br0w7j5.js +151 -0
  117. package/dist/chunk-7cjgrzz1.js +298 -0
  118. package/dist/chunk-7d41ks0y.js +133 -0
  119. package/dist/chunk-7f40pmtr.js +71 -0
  120. package/dist/chunk-7g15x8hm.js +131 -0
  121. package/dist/chunk-7gtnzdet.js +120 -0
  122. package/dist/chunk-7h0z4aqx.js +702 -0
  123. package/dist/chunk-7h7e5a7d.js +25 -0
  124. package/dist/chunk-7m2cznwr.js +40 -0
  125. package/dist/chunk-7nvday0n.js +252 -0
  126. package/dist/chunk-7qey87th.js +145 -0
  127. package/dist/chunk-7qx3xhv3.js +9076 -0
  128. package/dist/chunk-7tfdhkpy.js +61 -0
  129. package/dist/chunk-80m511j6.js +121 -0
  130. package/dist/chunk-80ysxfe9.js +784 -0
  131. package/dist/chunk-8375zk8t.js +17200 -0
  132. package/dist/chunk-85bpkyy9.js +412 -0
  133. package/dist/chunk-85tcn547.js +876 -0
  134. package/dist/chunk-85vqgbc8.js +13 -0
  135. package/dist/chunk-86626jb4.js +49 -0
  136. package/dist/chunk-87ms17f6.js +444 -0
  137. package/dist/chunk-87mz239c.js +118 -0
  138. package/dist/chunk-89vdzt4e.js +254 -0
  139. package/dist/chunk-89z3e99z.js +159 -0
  140. package/dist/chunk-8cwrz1dd.js +1806 -0
  141. package/dist/chunk-8gv2pjby.js +21 -0
  142. package/dist/chunk-8hdevr3s.js +140 -0
  143. package/dist/chunk-8hdsk6qc.js +710 -0
  144. package/dist/chunk-8kct9arg.js +724 -0
  145. package/dist/chunk-8kf8h7xf.js +23 -0
  146. package/dist/chunk-8qed8ymj.js +605 -0
  147. package/dist/chunk-8sdgr592.js +101 -0
  148. package/dist/chunk-8we9w8pw.js +111 -0
  149. package/dist/chunk-8xnm5637.js +72 -0
  150. package/dist/chunk-8y3q0eqy.js +67 -0
  151. package/dist/chunk-8yvsnrkr.js +3449 -0
  152. package/dist/chunk-8zz4z1q3.js +42 -0
  153. package/dist/chunk-90eyff3k.js +119 -0
  154. package/dist/chunk-92bjkrf2.js +121 -0
  155. package/dist/chunk-92zrc7c6.js +327 -0
  156. package/dist/chunk-935nrvdb.js +13 -0
  157. package/dist/chunk-94pfyv6a.js +48 -0
  158. package/dist/chunk-9568p8se.js +115 -0
  159. package/dist/chunk-96km1ywr.js +37 -0
  160. package/dist/chunk-980bg4w4.js +163 -0
  161. package/dist/chunk-9a9g5hbj.js +205 -0
  162. package/dist/chunk-9cm4725d.js +4395 -0
  163. package/dist/chunk-9ds3vzq8.js +847 -0
  164. package/dist/chunk-9ffc9n60.js +618 -0
  165. package/dist/chunk-9fstrwv2.js +184 -0
  166. package/dist/chunk-9gt0g0qe.js +153 -0
  167. package/dist/chunk-9h9k5vz3.js +2761 -0
  168. package/dist/chunk-9he8bmhy.js +17 -0
  169. package/dist/chunk-9hn8e6h1.js +12 -0
  170. package/dist/chunk-9j0n3g8e.js +179 -0
  171. package/dist/chunk-9j6pa3ft.js +251 -0
  172. package/dist/chunk-9jpg9dn7.js +122 -0
  173. package/dist/chunk-9mycnwj5.js +46 -0
  174. package/dist/chunk-9npy2c17.js +517 -0
  175. package/dist/chunk-9p6sec8n.js +34 -0
  176. package/dist/chunk-9pnym83h.js +4584 -0
  177. package/dist/chunk-9skwrnd2.js +25 -0
  178. package/dist/chunk-9tsfaqr8.js +459 -0
  179. package/dist/chunk-9tsw3cqv.js +5924 -0
  180. package/dist/chunk-9w6ckyk4.js +49 -0
  181. package/dist/chunk-a15bwzv6.js +147 -0
  182. package/dist/chunk-a9t6cp69.js +28 -0
  183. package/dist/chunk-ad2yk19p.js +102 -0
  184. package/dist/chunk-ad4cw4nw.js +336 -0
  185. package/dist/chunk-ad69fbsk.js +347 -0
  186. package/dist/chunk-ae76ded0.js +30 -0
  187. package/dist/chunk-aeysytks.js +216 -0
  188. package/dist/chunk-ag81m9bq.js +61 -0
  189. package/dist/chunk-ahx7gp6r.js +4448 -0
  190. package/dist/chunk-aj4tk4tk.js +23 -0
  191. package/dist/chunk-an82t9jc.js +104 -0
  192. package/dist/chunk-apg95qd7.js +1393 -0
  193. package/dist/chunk-aq5n2adz.js +27 -0
  194. package/dist/chunk-aw4s3a99.js +208 -0
  195. package/dist/chunk-awgdfggg.js +14 -0
  196. package/dist/chunk-ayymxgn1.js +164 -0
  197. package/dist/chunk-azbab59e.js +637 -0
  198. package/dist/chunk-azdxq2a3.js +293 -0
  199. package/dist/chunk-b0tjx3k1.js +523 -0
  200. package/dist/chunk-b5pp4g2g.js +371 -0
  201. package/dist/chunk-b5zm8dt6.js +26 -0
  202. package/dist/chunk-bcnye5a0.js +109 -0
  203. package/dist/chunk-beqz3k49.js +190 -0
  204. package/dist/chunk-bf906wpw.js +147 -0
  205. package/dist/chunk-bgan4cpf.js +13 -0
  206. package/dist/chunk-bhzp13h7.js +1178 -0
  207. package/dist/chunk-bk403kpw.js +142 -0
  208. package/dist/chunk-bmq4c135.js +489 -0
  209. package/dist/chunk-bprbeda7.js +35 -0
  210. package/dist/chunk-bst7czdd.js +888 -0
  211. package/dist/chunk-bths4xgn.js +111 -0
  212. package/dist/chunk-btjn3qby.js +13 -0
  213. package/dist/chunk-bwb1vxnt.js +120 -0
  214. package/dist/chunk-bxa6tw4m.js +643 -0
  215. package/dist/chunk-bxfjr8qb.js +27 -0
  216. package/dist/chunk-bxpzhrej.js +73 -0
  217. package/dist/chunk-bzyzrq0k.js +51 -0
  218. package/dist/chunk-c0k7b0jw.js +4265 -0
  219. package/dist/chunk-c17f0h2s.js +16 -0
  220. package/dist/chunk-c1yc761e.js +6748 -0
  221. package/dist/chunk-c5g9shkw.js +298 -0
  222. package/dist/chunk-c696122m.js +69 -0
  223. package/dist/chunk-c92b3yxx.js +109 -0
  224. package/dist/chunk-c9aqz56y.js +143 -0
  225. package/dist/chunk-cba7c5w3.js +345 -0
  226. package/dist/chunk-cbcxbbe6.js +6543 -0
  227. package/dist/chunk-cdfjb87h.js +11 -0
  228. package/dist/chunk-ce8zjt1y.js +136 -0
  229. package/dist/chunk-cep7e37k.js +22740 -0
  230. package/dist/chunk-chs5qm8d.js +258 -0
  231. package/dist/chunk-ckydq33g.js +144 -0
  232. package/dist/chunk-cnge6wpj.js +514 -0
  233. package/dist/chunk-cpnsvqf1.js +13 -0
  234. package/dist/chunk-cqqebkv4.js +32 -0
  235. package/dist/chunk-cvqpp7dk.js +627 -0
  236. package/dist/chunk-cwc33j40.js +65 -0
  237. package/dist/chunk-cypvrq2a.js +155 -0
  238. package/dist/chunk-d1ha0swn.js +475 -0
  239. package/dist/chunk-d2an0138.js +35 -0
  240. package/dist/chunk-d2tt72ck.js +343 -0
  241. package/dist/chunk-d6wvcqrw.js +9507 -0
  242. package/dist/chunk-d7ys2kka.js +991 -0
  243. package/dist/chunk-dbts5q5p.js +122 -0
  244. package/dist/chunk-dct29ggs.js +295 -0
  245. package/dist/chunk-de0qnnf7.js +1059 -0
  246. package/dist/chunk-dep72ce4.js +513 -0
  247. package/dist/chunk-dgpvgy8x.js +47 -0
  248. package/dist/chunk-dhhd7dtc.js +20 -0
  249. package/dist/chunk-dhzpmxv6.js +594 -0
  250. package/dist/chunk-djes4da7.js +413 -0
  251. package/dist/chunk-dnhv3vx7.js +166 -0
  252. package/dist/chunk-dqtvafan.js +2365 -0
  253. package/dist/chunk-dr4a3tcp.js +60 -0
  254. package/dist/chunk-dz2xk9kb.js +100 -0
  255. package/dist/chunk-dz7nc6rf.js +15 -0
  256. package/dist/chunk-e3abfxpy.js +1486 -0
  257. package/dist/chunk-e3cq9z89.js +85 -0
  258. package/dist/chunk-e3j7m7k2.js +642 -0
  259. package/dist/chunk-e4dsy4g1.js +9951 -0
  260. package/dist/chunk-e5592pnn.js +197 -0
  261. package/dist/chunk-e55hdegh.js +129 -0
  262. package/dist/chunk-e5r5r04e.js +1030 -0
  263. package/dist/chunk-e60zztbt.js +442 -0
  264. package/dist/chunk-e7qq6vn0.js +372 -0
  265. package/dist/chunk-e9aat7xw.js +80 -0
  266. package/dist/chunk-e9d5v3zs.js +143 -0
  267. package/dist/chunk-eax32zk4.js +87 -0
  268. package/dist/chunk-ebfwmbx1.js +117 -0
  269. package/dist/chunk-ec71pb8t.js +971 -0
  270. package/dist/chunk-eemjb825.js +17252 -0
  271. package/dist/chunk-ees8xdhd.js +256 -0
  272. package/dist/chunk-eewg66y1.js +112 -0
  273. package/dist/chunk-eg22v12d.js +266 -0
  274. package/dist/chunk-enzzk67f.js +313 -0
  275. package/dist/chunk-eskhp70f.js +117 -0
  276. package/dist/chunk-ewx6z4g8.js +55 -0
  277. package/dist/chunk-eyvx461k.js +76 -0
  278. package/dist/chunk-eztq2b5f.js +94 -0
  279. package/dist/chunk-f0ffwzdd.js +321 -0
  280. package/dist/chunk-f80n68mf.js +119 -0
  281. package/dist/chunk-fae2hjxp.js +99 -0
  282. package/dist/chunk-fbtfp370.js +60 -0
  283. package/dist/chunk-fc6ndtgf.js +94 -0
  284. package/dist/chunk-fdwabr8p.js +13870 -0
  285. package/dist/chunk-fejeqe61.js +785 -0
  286. package/dist/chunk-fh0d6mvk.js +168 -0
  287. package/dist/chunk-fh19zcaf.js +304 -0
  288. package/dist/chunk-fh8bd39r.js +186 -0
  289. package/dist/chunk-fj2ebbpn.js +33 -0
  290. package/dist/chunk-fjn632v7.js +194 -0
  291. package/dist/chunk-fncpkzs5.js +1389 -0
  292. package/dist/chunk-fpd1gpt8.js +332 -0
  293. package/dist/chunk-fq9snrnh.js +295 -0
  294. package/dist/chunk-fqcfzg3j.js +207 -0
  295. package/dist/chunk-ftt3vqj2.js +1919 -0
  296. package/dist/chunk-g06pm4n9.js +395 -0
  297. package/dist/chunk-g4m5pf4g.js +8 -0
  298. package/dist/chunk-g72h52y6.js +36 -0
  299. package/dist/chunk-g79ej71s.js +1627 -0
  300. package/dist/chunk-g7fwk59d.js +19 -0
  301. package/dist/chunk-g9jnkrtm.js +663 -0
  302. package/dist/chunk-g9vg5d7t.js +38 -0
  303. package/dist/chunk-ga1jkyqy.js +1636 -0
  304. package/dist/chunk-gaaap2nk.js +676 -0
  305. package/dist/chunk-gc6erq5q.js +483 -0
  306. package/dist/chunk-gjrcmf0a.js +752 -0
  307. package/dist/chunk-gmdy2w3z.js +238999 -0
  308. package/dist/chunk-gsz4yrrk.js +81 -0
  309. package/dist/chunk-gy47rjy8.js +3830 -0
  310. package/dist/chunk-h12a4f4x.js +11 -0
  311. package/dist/chunk-h1yratmg.js +725 -0
  312. package/dist/chunk-h9y0jnsy.js +155 -0
  313. package/dist/chunk-hbhs3mwy.js +133 -0
  314. package/dist/chunk-hbs8cmb4.js +8 -0
  315. package/dist/chunk-hdk0t1ht.js +940 -0
  316. package/dist/chunk-hef8dx4s.js +178 -0
  317. package/dist/chunk-hgsca8mt.js +381 -0
  318. package/dist/chunk-hhsxm2yr.js +67 -0
  319. package/dist/chunk-hj5tzzpd.js +39 -0
  320. package/dist/chunk-hjxqmtg5.js +94 -0
  321. package/dist/chunk-hn4w9pkj.js +68 -0
  322. package/dist/chunk-hnprkjgp.js +25 -0
  323. package/dist/chunk-hq3n5ex7.js +183 -0
  324. package/dist/chunk-hqjspfma.js +158 -0
  325. package/dist/chunk-hqxp6b72.js +1198 -0
  326. package/dist/chunk-hs6nrmq6.js +94 -0
  327. package/dist/chunk-hwba5xdc.js +267 -0
  328. package/dist/chunk-hy566ev3.js +430 -0
  329. package/dist/chunk-hzmzwte2.js +153 -0
  330. package/dist/chunk-hzxzvzw8.js +274 -0
  331. package/dist/chunk-j139fzgs.js +114 -0
  332. package/dist/chunk-j1mep9ck.js +62 -0
  333. package/dist/chunk-j3xveeg4.js +273 -0
  334. package/dist/chunk-j5y1s11j.js +100 -0
  335. package/dist/chunk-j9475b46.js +26 -0
  336. package/dist/chunk-j9rgqs8m.js +1192 -0
  337. package/dist/chunk-jccjaddz.js +74 -0
  338. package/dist/chunk-jdkwfy9e.js +35 -0
  339. package/dist/chunk-jdqp0r4h.js +6157 -0
  340. package/dist/chunk-jdzk4zwn.js +587 -0
  341. package/dist/chunk-jfafmkte.js +49 -0
  342. package/dist/chunk-jg3r989b.js +16 -0
  343. package/dist/chunk-jhtccjc9.js +54 -0
  344. package/dist/chunk-jj2ff1pr.js +688 -0
  345. package/dist/chunk-jmv7k0jn.js +37 -0
  346. package/dist/chunk-jmxzmwpw.js +65 -0
  347. package/dist/chunk-jnjxdqyr.js +353 -0
  348. package/dist/chunk-jsbbez9j.js +138 -0
  349. package/dist/chunk-jvpt2dc0.js +424 -0
  350. package/dist/chunk-jwd7cka0.js +34 -0
  351. package/dist/chunk-jy5er3st.js +15 -0
  352. package/dist/chunk-jyby79z5.js +121 -0
  353. package/dist/chunk-jzyr6j5n.js +332 -0
  354. package/dist/chunk-k49xc781.js +63 -0
  355. package/dist/chunk-k7dt2g4a.js +41 -0
  356. package/dist/chunk-k7hexw3v.js +969 -0
  357. package/dist/chunk-k7wwkraa.js +117 -0
  358. package/dist/chunk-kb3758f7.js +51 -0
  359. package/dist/chunk-kc67kt75.js +3119 -0
  360. package/dist/chunk-kdhmfxmh.js +3149 -0
  361. package/dist/chunk-kejdd6zc.js +51 -0
  362. package/dist/chunk-kekrjeem.js +402 -0
  363. package/dist/chunk-kez5r0zz.js +280 -0
  364. package/dist/chunk-kfsvcs5t.js +75 -0
  365. package/dist/chunk-khtvffc4.js +285 -0
  366. package/dist/chunk-kkz4w1tv.js +64 -0
  367. package/dist/chunk-kmywng0j.js +272 -0
  368. package/dist/chunk-kq6vcpdr.js +224 -0
  369. package/dist/chunk-kqzdszcc.js +37 -0
  370. package/dist/chunk-ktxpp02w.js +435 -0
  371. package/dist/chunk-kwcvhbtz.js +26 -0
  372. package/dist/chunk-kx0cm9qr.js +128 -0
  373. package/dist/chunk-kxcmqz10.js +120 -0
  374. package/dist/chunk-kxwava1g.js +14 -0
  375. package/dist/chunk-kywtr3jg.js +825 -0
  376. package/dist/chunk-kzwg923p.js +8 -0
  377. package/dist/chunk-m1eq3sgv.js +255 -0
  378. package/dist/chunk-m21h5zb4.js +119 -0
  379. package/dist/chunk-m2c3bjv1.js +111 -0
  380. package/dist/chunk-m41e19ms.js +42 -0
  381. package/dist/chunk-m7ka36ex.js +97 -0
  382. package/dist/chunk-m81w8tbm.js +259 -0
  383. package/dist/chunk-m95ggkax.js +281 -0
  384. package/dist/chunk-manx26xa.js +145 -0
  385. package/dist/chunk-mdxh3pk2.js +298 -0
  386. package/dist/chunk-mhbfkcja.js +311 -0
  387. package/dist/chunk-mjnr5erm.js +173 -0
  388. package/dist/chunk-mngvnmwp.js +135 -0
  389. package/dist/chunk-mvfqanv5.js +63 -0
  390. package/dist/chunk-mw1nesq1.js +140 -0
  391. package/dist/chunk-mx168925.js +661 -0
  392. package/dist/chunk-mxwvj18g.js +795 -0
  393. package/dist/chunk-my7r5mba.js +257 -0
  394. package/dist/chunk-myaa1kkf.js +17 -0
  395. package/dist/chunk-myypc3tn.js +46 -0
  396. package/dist/chunk-mzcnmnpq.js +3379 -0
  397. package/dist/chunk-mznav6d1.js +194 -0
  398. package/dist/chunk-n0qxskpr.js +24 -0
  399. package/dist/chunk-n6a6hgtp.js +394 -0
  400. package/dist/chunk-n6d5fgx0.js +254 -0
  401. package/dist/chunk-n6ym3n03.js +120 -0
  402. package/dist/chunk-n9g24mwe.js +104 -0
  403. package/dist/chunk-naamqdf9.js +185 -0
  404. package/dist/chunk-nb2jk7zj.js +15 -0
  405. package/dist/chunk-nbkbq9en.js +67 -0
  406. package/dist/chunk-ndttd6es.js +38 -0
  407. package/dist/chunk-nfygaaxg.js +133 -0
  408. package/dist/chunk-ngdzpszd.js +454 -0
  409. package/dist/chunk-nmfwksa4.js +1297 -0
  410. package/dist/chunk-nt837qt9.js +21 -0
  411. package/dist/chunk-nwc3v0vp.js +691 -0
  412. package/dist/chunk-nz8ha95p.js +3610 -0
  413. package/dist/chunk-nzxfj0gq.js +2007 -0
  414. package/dist/chunk-p0r8887g.js +6932 -0
  415. package/dist/chunk-p1seyqdm.js +120 -0
  416. package/dist/chunk-p425zbgw.js +726 -0
  417. package/dist/chunk-p7hamd2c.js +146 -0
  418. package/dist/chunk-pdvg91cg.js +32 -0
  419. package/dist/chunk-pecy49yr.js +14649 -0
  420. package/dist/chunk-pfxrg89f.js +547 -0
  421. package/dist/chunk-pfyw3155.js +2750 -0
  422. package/dist/chunk-pr8m11pm.js +1192 -0
  423. package/dist/chunk-ptxteaeh.js +1591 -0
  424. package/dist/chunk-pv164mac.js +394 -0
  425. package/dist/chunk-pxxhtxf5.js +10154 -0
  426. package/dist/chunk-q0e485mg.js +61 -0
  427. package/dist/chunk-q1vrhh0q.js +458 -0
  428. package/dist/chunk-q2h79ncs.js +370 -0
  429. package/dist/chunk-q3b4n194.js +56 -0
  430. package/dist/chunk-q44zc68f.js +4301 -0
  431. package/dist/chunk-q8gknbdx.js +352 -0
  432. package/dist/chunk-q8xk3kdj.js +11 -0
  433. package/dist/chunk-qak46xtp.js +119 -0
  434. package/dist/chunk-qfq7absv.js +95 -0
  435. package/dist/chunk-qfsn720k.js +151 -0
  436. package/dist/chunk-qg4811f6.js +228 -0
  437. package/dist/chunk-qgzn3qps.js +90 -0
  438. package/dist/chunk-qhaggqkt.js +113 -0
  439. package/dist/chunk-qjjp27z8.js +195 -0
  440. package/dist/chunk-qxp0nye6.js +34 -0
  441. package/dist/chunk-qy3nagaq.js +4957 -0
  442. package/dist/chunk-qz2meav1.js +1452 -0
  443. package/dist/chunk-r50hne7m.js +63 -0
  444. package/dist/chunk-r6m0vgnv.js +80 -0
  445. package/dist/chunk-r7yw38vf.js +22864 -0
  446. package/dist/chunk-r8xc618w.js +42 -0
  447. package/dist/chunk-r961r5kj.js +87 -0
  448. package/dist/chunk-r9b5xrh0.js +66 -0
  449. package/dist/chunk-rcn2pd6q.js +477 -0
  450. package/dist/chunk-rdeh8p3y.js +148 -0
  451. package/dist/chunk-rg9x1742.js +542 -0
  452. package/dist/chunk-rgyzsbs3.js +39 -0
  453. package/dist/chunk-rk2fsxtz.js +16 -0
  454. package/dist/chunk-rkchkwv9.js +40 -0
  455. package/dist/chunk-rp8whpb3.js +478 -0
  456. package/dist/chunk-rpkxdtgr.js +68 -0
  457. package/dist/chunk-rpmntgyh.js +394 -0
  458. package/dist/chunk-rpshz4dy.js +614 -0
  459. package/dist/chunk-rqd60ay5.js +133 -0
  460. package/dist/chunk-rrsjf2ea.js +229 -0
  461. package/dist/chunk-rtjk8c8e.js +173 -0
  462. package/dist/chunk-rw0y2wdf.js +1017 -0
  463. package/dist/chunk-rx5w7ess.js +663 -0
  464. package/dist/chunk-rx8t9d35.js +1947 -0
  465. package/dist/chunk-rxcazxgf.js +195 -0
  466. package/dist/chunk-rxg6q3bp.js +1413 -0
  467. package/dist/chunk-rxrb7xnd.js +71 -0
  468. package/dist/chunk-rxrzxff3.js +118 -0
  469. package/dist/chunk-ryqjc943.js +71 -0
  470. package/dist/chunk-rzk9k2rf.js +81 -0
  471. package/dist/chunk-s2qv0nht.js +119 -0
  472. package/dist/chunk-s3hafnk3.js +2285 -0
  473. package/dist/chunk-s4a496tt.js +226 -0
  474. package/dist/chunk-s4d1h3ka.js +35 -0
  475. package/dist/chunk-sm3k3ze4.js +16525 -0
  476. package/dist/chunk-sn0bja82.js +385 -0
  477. package/dist/chunk-sngjggw1.js +4227 -0
  478. package/dist/chunk-sq047n34.js +364 -0
  479. package/dist/chunk-sttwe2tw.js +8584 -0
  480. package/dist/chunk-sw8qx1r0.js +86 -0
  481. package/dist/chunk-swstah6a.js +240 -0
  482. package/dist/chunk-syrkr0mf.js +63 -0
  483. package/dist/chunk-sz206bd9.js +26 -0
  484. package/dist/chunk-t09669cj.js +333 -0
  485. package/dist/chunk-t5f8e30k.js +602 -0
  486. package/dist/chunk-t5m78mc8.js +432 -0
  487. package/dist/chunk-t5x1dqwn.js +143 -0
  488. package/dist/chunk-t877ea0w.js +168 -0
  489. package/dist/chunk-t91hb71c.js +17 -0
  490. package/dist/chunk-tb636bcf.js +942 -0
  491. package/dist/chunk-tb8sykbr.js +426 -0
  492. package/dist/chunk-tbdkekz3.js +125 -0
  493. package/dist/chunk-td2gsz7s.js +225 -0
  494. package/dist/chunk-tenvxbyh.js +20 -0
  495. package/dist/chunk-texg4qqt.js +317 -0
  496. package/dist/chunk-teymzz80.js +266 -0
  497. package/dist/chunk-tj26qpf7.js +153 -0
  498. package/dist/chunk-tk85ec4p.js +395 -0
  499. package/dist/chunk-tq205h01.js +164 -0
  500. package/dist/chunk-tqzddjzg.js +61 -0
  501. package/dist/chunk-trqrj23e.js +134 -0
  502. package/dist/chunk-tw1hfsxv.js +2477 -0
  503. package/dist/chunk-txxdfq83.js +122 -0
  504. package/dist/chunk-v0yhe582.js +31 -0
  505. package/dist/chunk-v14184xm.js +15 -0
  506. package/dist/chunk-v1h9z4hw.js +138 -0
  507. package/dist/chunk-v3ey5j7f.js +329 -0
  508. package/dist/chunk-v3nh1sfn.js +208 -0
  509. package/dist/chunk-v3x8tcc0.js +45 -0
  510. package/dist/chunk-v4nqnvqq.js +3984 -0
  511. package/dist/chunk-v4ypszbb.js +15 -0
  512. package/dist/chunk-v7wbqcx9.js +63 -0
  513. package/dist/chunk-v8r5fev3.js +341 -0
  514. package/dist/chunk-v9zg5kzx.js +2810 -0
  515. package/dist/chunk-va1wh5ss.js +24 -0
  516. package/dist/chunk-vbfswhht.js +42 -0
  517. package/dist/chunk-ve7x2tfq.js +124 -0
  518. package/dist/chunk-vfz8k89y.js +485 -0
  519. package/dist/chunk-vgm5k14x.js +35678 -0
  520. package/dist/chunk-vh9pej3c.js +247 -0
  521. package/dist/chunk-vjxqyt6f.js +3820 -0
  522. package/dist/chunk-vpb1xstn.js +178 -0
  523. package/dist/chunk-vqt79tj8.js +110 -0
  524. package/dist/chunk-vr0n9pv9.js +152 -0
  525. package/dist/chunk-vrejmja5.js +90 -0
  526. package/dist/chunk-vrxasmdw.js +449 -0
  527. package/dist/chunk-vrxb946v.js +125 -0
  528. package/dist/chunk-vv4kj0q8.js +98 -0
  529. package/dist/chunk-vvpfng7w.js +8 -0
  530. package/dist/chunk-vw6ybyew.js +2007 -0
  531. package/dist/chunk-vwenx8ke.js +17 -0
  532. package/dist/chunk-vwfa0s5a.js +155 -0
  533. package/dist/chunk-vx71j8xe.js +63 -0
  534. package/dist/chunk-vxbjzggp.js +43 -0
  535. package/dist/chunk-vxjxtz8w.js +440 -0
  536. package/dist/chunk-vy0c1bwp.js +9 -0
  537. package/dist/chunk-w3zczyse.js +14 -0
  538. package/dist/chunk-w4p5t920.js +655 -0
  539. package/dist/chunk-w68wc625.js +287 -0
  540. package/dist/chunk-w9ddp3yf.js +96 -0
  541. package/dist/chunk-wcggm5ja.js +125 -0
  542. package/dist/chunk-wgnyph3q.js +1306 -0
  543. package/dist/chunk-wjm5pc1e.js +134 -0
  544. package/dist/chunk-wnve0drm.js +131 -0
  545. package/dist/chunk-wp27ev2k.js +135 -0
  546. package/dist/chunk-wyvy8a4x.js +131 -0
  547. package/dist/chunk-x671y4dk.js +129 -0
  548. package/dist/chunk-xbj5keyy.js +22 -0
  549. package/dist/chunk-xf4fzms8.js +39 -0
  550. package/dist/chunk-xf59k3zg.js +65 -0
  551. package/dist/chunk-xgzc4w49.js +204 -0
  552. package/dist/chunk-xhj7g13b.js +2149 -0
  553. package/dist/chunk-xjp0cd00.js +56 -0
  554. package/dist/chunk-xkhnmhqs.js +74 -0
  555. package/dist/chunk-xkrkqx61.js +55 -0
  556. package/dist/chunk-xmpgmeb8.js +114 -0
  557. package/dist/chunk-xrw80zgd.js +4249 -0
  558. package/dist/chunk-xrzc96g0.js +202 -0
  559. package/dist/chunk-xt76sm44.js +318 -0
  560. package/dist/chunk-xwet3awb.js +20 -0
  561. package/dist/chunk-xyg1sk2w.js +78 -0
  562. package/dist/chunk-y0jpkqb0.js +180 -0
  563. package/dist/chunk-y1q7rt9n.js +102 -0
  564. package/dist/chunk-y67ntyek.js +258 -0
  565. package/dist/chunk-ybk37qp9.js +37 -0
  566. package/dist/chunk-yc1stfve.js +5386 -0
  567. package/dist/chunk-ychjpjef.js +62 -0
  568. package/dist/chunk-yez8fa9g.js +276 -0
  569. package/dist/chunk-ygm7xszr.js +90 -0
  570. package/dist/chunk-ym11azkj.js +37 -0
  571. package/dist/chunk-ympz2h15.js +578 -0
  572. package/dist/chunk-yqx3az3n.js +129 -0
  573. package/dist/chunk-yt3nfhcc.js +152 -0
  574. package/dist/chunk-yy8q0n8s.js +120 -0
  575. package/dist/chunk-yzb92zxv.js +8 -0
  576. package/dist/chunk-yzet6xyr.js +119 -0
  577. package/dist/chunk-yzm97qp1.js +226 -0
  578. package/dist/chunk-z0jgeax8.js +35 -0
  579. package/dist/chunk-z1r3z6w6.js +29 -0
  580. package/dist/chunk-z2dp53wn.js +17 -0
  581. package/dist/chunk-z79355gz.js +308 -0
  582. package/dist/chunk-z7e94hxz.js +251 -0
  583. package/dist/chunk-z8cqdcec.js +173 -0
  584. package/dist/chunk-z99tbg45.js +148 -0
  585. package/dist/chunk-z9nsjcht.js +37 -0
  586. package/dist/chunk-za3k6h2h.js +470 -0
  587. package/dist/chunk-zacynq5p.js +265 -0
  588. package/dist/chunk-zb0x40az.js +1785 -0
  589. package/dist/chunk-zbxtzycc.js +274 -0
  590. package/dist/chunk-zga50181.js +342 -0
  591. package/dist/chunk-zhb2pns1.js +44 -0
  592. package/dist/chunk-zkch6trx.js +231 -0
  593. package/dist/chunk-znf3z4qt.js +954 -0
  594. package/dist/chunk-zp8zwdgq.js +72 -0
  595. package/dist/chunk-ztjd8pyf.js +120 -0
  596. package/dist/chunk-ztmb7geg.js +173 -0
  597. package/dist/chunk-zvr4snzv.js +887 -0
  598. package/dist/chunk-zw62m6n3.js +34858 -0
  599. package/dist/chunk-zwwdebd0.js +65 -0
  600. package/dist/chunk-zxc6x9w8.js +340 -0
  601. package/dist/chunk-zy2e7sz0.js +8 -0
  602. package/dist/chunk-zzf074w3.js +196 -0
  603. package/dist/chunk-zzz0nwb5.js +310 -0
  604. package/dist/cli-bun.js +2 -0
  605. package/dist/cli-node.js +2 -0
  606. package/dist/cli.js +218 -0
  607. package/dist/vendor/audio-capture/arm64-darwin/audio-capture.node +0 -0
  608. package/dist/vendor/audio-capture/arm64-linux/audio-capture.node +0 -0
  609. package/dist/vendor/audio-capture/arm64-win32/audio-capture.node +0 -0
  610. package/dist/vendor/audio-capture/x64-darwin/audio-capture.node +0 -0
  611. package/dist/vendor/audio-capture/x64-linux/audio-capture.node +0 -0
  612. package/dist/vendor/audio-capture/x64-win32/audio-capture.node +0 -0
  613. package/dist/vendor/ripgrep/x64-win32/rg.exe +0 -0
  614. package/package.json +243 -0
  615. package/scripts/chrome-mcp-bridge-resolver.mjs +43 -0
  616. package/scripts/chrome-mcp-env.mjs +19 -0
  617. package/scripts/postinstall.cjs +339 -0
  618. package/scripts/run-parallel.mjs +10 -0
  619. package/scripts/setup-chrome-mcp.mjs +69 -0
@@ -0,0 +1,2547 @@
1
+ // @bun
2
+ import {
3
+ ConfigurableShortcutHint,
4
+ OAuthService,
5
+ Select,
6
+ SelectMulti,
7
+ Spinner,
8
+ TextInput,
9
+ init_ConfigurableShortcutHint,
10
+ init_CustomSelect,
11
+ init_SelectMulti,
12
+ init_Spinner,
13
+ init_TextInput,
14
+ init_oauth,
15
+ init_useTerminalSize
16
+ } from "./chunk-gmdy2w3z.js";
17
+ import"./chunk-q0e485mg.js";
18
+ import"./chunk-2kcgxnvp.js";
19
+ import"./chunk-14p6wvsq.js";
20
+ import"./chunk-6s0q1s5r.js";
21
+ import"./chunk-3w9sye8h.js";
22
+ import"./chunk-nzxfj0gq.js";
23
+ import"./chunk-vr0n9pv9.js";
24
+ import"./chunk-9a9g5hbj.js";
25
+ import"./chunk-ptxteaeh.js";
26
+ import"./chunk-w4p5t920.js";
27
+ import"./chunk-rgyzsbs3.js";
28
+ import"./chunk-q3b4n194.js";
29
+ import"./chunk-kywtr3jg.js";
30
+ import"./chunk-eewg66y1.js";
31
+ import"./chunk-71sdcaq6.js";
32
+ import"./chunk-9hn8e6h1.js";
33
+ import"./chunk-7qey87th.js";
34
+ import"./chunk-zw62m6n3.js";
35
+ import"./chunk-1w20m7gw.js";
36
+ import"./chunk-zzf074w3.js";
37
+ import"./chunk-rpmntgyh.js";
38
+ import"./chunk-24kv69g3.js";
39
+ import {
40
+ init_useExitOnCtrlCDWithKeybindings,
41
+ useExitOnCtrlCDWithKeybindings
42
+ } from "./chunk-hzxzvzw8.js";
43
+ import"./chunk-30wnahyg.js";
44
+ import"./chunk-ztmb7geg.js";
45
+ import"./chunk-tbdkekz3.js";
46
+ import {
47
+ init_useKeybinding
48
+ } from "./chunk-65zbgg1n.js";
49
+ import"./chunk-4spgkgr3.js";
50
+ import"./chunk-60fkafk2.js";
51
+ import"./chunk-50m3a23z.js";
52
+ import"./chunk-6hygvrhn.js";
53
+ import"./chunk-7tfdhkpy.js";
54
+ import"./chunk-8gv2pjby.js";
55
+ import"./chunk-g06pm4n9.js";
56
+ import"./chunk-2p369q9z.js";
57
+ import"./chunk-z0jgeax8.js";
58
+ import"./chunk-w68wc625.js";
59
+ import {
60
+ init_browser,
61
+ openBrowser
62
+ } from "./chunk-6hr7742d.js";
63
+ import"./chunk-xyg1sk2w.js";
64
+ import"./chunk-935nrvdb.js";
65
+ import"./chunk-8zz4z1q3.js";
66
+ import"./chunk-fncpkzs5.js";
67
+ import"./chunk-hqxp6b72.js";
68
+ import"./chunk-m2c3bjv1.js";
69
+ import"./chunk-jhtccjc9.js";
70
+ import"./chunk-7nvday0n.js";
71
+ import"./chunk-vxbjzggp.js";
72
+ import"./chunk-yc1stfve.js";
73
+ import"./chunk-8yvsnrkr.js";
74
+ import"./chunk-5mmhfbxb.js";
75
+ import {
76
+ getAnthropicApiKey,
77
+ init_auth,
78
+ init_config1 as init_config,
79
+ init_stringUtils,
80
+ isAnthropicAuthEnabled,
81
+ plural,
82
+ saveGlobalConfig,
83
+ saveOAuthTokensIfNeeded
84
+ } from "./chunk-eemjb825.js";
85
+ import"./chunk-ga1jkyqy.js";
86
+ import"./chunk-y1q7rt9n.js";
87
+ import"./chunk-8kct9arg.js";
88
+ import"./chunk-k7hexw3v.js";
89
+ import"./chunk-trqrj23e.js";
90
+ import"./chunk-za3k6h2h.js";
91
+ import"./chunk-8kf8h7xf.js";
92
+ import"./chunk-bgan4cpf.js";
93
+ import"./chunk-jmv7k0jn.js";
94
+ import"./chunk-hjxqmtg5.js";
95
+ import"./chunk-bzyzrq0k.js";
96
+ import"./chunk-vwenx8ke.js";
97
+ import"./chunk-q2h79ncs.js";
98
+ import"./chunk-v4ypszbb.js";
99
+ import"./chunk-qfsn720k.js";
100
+ import"./chunk-7qx3xhv3.js";
101
+ import"./chunk-j9475b46.js";
102
+ import"./chunk-fdwabr8p.js";
103
+ import"./chunk-e4dsy4g1.js";
104
+ import"./chunk-326zehp8.js";
105
+ import"./chunk-kc67kt75.js";
106
+ import"./chunk-40t1d75v.js";
107
+ import"./chunk-dbts5q5p.js";
108
+ import"./chunk-e3abfxpy.js";
109
+ import"./chunk-q44zc68f.js";
110
+ import"./chunk-fejeqe61.js";
111
+ import"./chunk-q1vrhh0q.js";
112
+ import"./chunk-hn4w9pkj.js";
113
+ import {
114
+ Byline,
115
+ Dialog,
116
+ KeyboardShortcutHint,
117
+ Link,
118
+ ThemedBox_default,
119
+ ThemedText,
120
+ color,
121
+ init_src,
122
+ setClipboard,
123
+ useKeybinding,
124
+ useKeybindings,
125
+ useTerminalSize,
126
+ useTheme
127
+ } from "./chunk-2g0ytd9d.js";
128
+ import {
129
+ require_jsx_dev_runtime,
130
+ require_react
131
+ } from "./chunk-de0qnnf7.js";
132
+ import {
133
+ init_analytics,
134
+ logEvent
135
+ } from "./chunk-j1mep9ck.js";
136
+ import"./chunk-6x35ffpx.js";
137
+ import"./chunk-1zbwhcbt.js";
138
+ import"./chunk-92bjkrf2.js";
139
+ import {
140
+ getGithubRepo,
141
+ init_git
142
+ } from "./chunk-10k5jfc5.js";
143
+ import"./chunk-n9g24mwe.js";
144
+ import"./chunk-e3j7m7k2.js";
145
+ import {
146
+ execFileNoThrow,
147
+ init_execFileNoThrow
148
+ } from "./chunk-hzmzwte2.js";
149
+ import"./chunk-pdvg91cg.js";
150
+ import"./chunk-c696122m.js";
151
+ import"./chunk-xbj5keyy.js";
152
+ import {
153
+ execa,
154
+ init_execa
155
+ } from "./chunk-c1yc761e.js";
156
+ import {
157
+ figures_default,
158
+ init_figures
159
+ } from "./chunk-c5g9shkw.js";
160
+ import"./chunk-aeysytks.js";
161
+ import {
162
+ init_log,
163
+ logError
164
+ } from "./chunk-s3hafnk3.js";
165
+ import"./chunk-kb3758f7.js";
166
+ import"./chunk-9h9k5vz3.js";
167
+ import"./chunk-xmpgmeb8.js";
168
+ import"./chunk-2kz09j2s.js";
169
+ import"./chunk-c0k7b0jw.js";
170
+ import"./chunk-pecy49yr.js";
171
+ import"./chunk-azbab59e.js";
172
+ import"./chunk-3nk9q8dr.js";
173
+ import {
174
+ __esm,
175
+ __toESM
176
+ } from "./chunk-hhsxm2yr.js";
177
+
178
+ // src/components/WorkflowMultiselectDialog.tsx
179
+ function renderInputGuide(exitState) {
180
+ if (exitState.pending) {
181
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
182
+ children: [
183
+ "Press ",
184
+ exitState.keyName,
185
+ " again to exit"
186
+ ]
187
+ }, undefined, true, undefined, this);
188
+ }
189
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Byline, {
190
+ children: [
191
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(KeyboardShortcutHint, {
192
+ shortcut: "\u2191\u2193",
193
+ action: "navigate"
194
+ }, undefined, false, undefined, this),
195
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(KeyboardShortcutHint, {
196
+ shortcut: "Space",
197
+ action: "toggle"
198
+ }, undefined, false, undefined, this),
199
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(KeyboardShortcutHint, {
200
+ shortcut: "Enter",
201
+ action: "confirm"
202
+ }, undefined, false, undefined, this),
203
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ConfigurableShortcutHint, {
204
+ action: "confirm:no",
205
+ context: "Confirmation",
206
+ fallback: "Esc",
207
+ description: "cancel"
208
+ }, undefined, false, undefined, this)
209
+ ]
210
+ }, undefined, true, undefined, this);
211
+ }
212
+ function WorkflowMultiselectDialog({
213
+ onSubmit,
214
+ defaultSelections
215
+ }) {
216
+ const [showError, setShowError] = import_react.useState(false);
217
+ const handleSubmit = import_react.useCallback((selectedValues) => {
218
+ if (selectedValues.length === 0) {
219
+ setShowError(true);
220
+ return;
221
+ }
222
+ setShowError(false);
223
+ onSubmit(selectedValues);
224
+ }, [onSubmit]);
225
+ const handleChange = import_react.useCallback(() => {
226
+ setShowError(false);
227
+ }, []);
228
+ const handleCancel = import_react.useCallback(() => {
229
+ setShowError(true);
230
+ }, []);
231
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Dialog, {
232
+ title: "Select GitHub workflows to install",
233
+ subtitle: "We'll create a workflow file in your repository for each one you select.",
234
+ onCancel: handleCancel,
235
+ inputGuide: renderInputGuide,
236
+ children: [
237
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedBox_default, {
238
+ children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
239
+ dimColor: true,
240
+ children: [
241
+ "More workflow examples (issue triage, CI fixes, etc.) at:",
242
+ " ",
243
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Link, {
244
+ url: "https://github.com/anthropics/claude-code-action/blob/main/examples/",
245
+ children: "https://github.com/anthropics/claude-code-action/blob/main/examples/"
246
+ }, undefined, false, undefined, this)
247
+ ]
248
+ }, undefined, true, undefined, this)
249
+ }, undefined, false, undefined, this),
250
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(SelectMulti, {
251
+ options: WORKFLOWS.map((workflow) => ({
252
+ label: workflow.label,
253
+ value: workflow.value
254
+ })),
255
+ defaultValue: defaultSelections,
256
+ onSubmit: handleSubmit,
257
+ onChange: handleChange,
258
+ onCancel: handleCancel,
259
+ hideIndexes: true
260
+ }, undefined, false, undefined, this),
261
+ showError && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedBox_default, {
262
+ children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ThemedText, {
263
+ color: "error",
264
+ children: "You must select at least one workflow to continue"
265
+ }, undefined, false, undefined, this)
266
+ }, undefined, false, undefined, this)
267
+ ]
268
+ }, undefined, true, undefined, this);
269
+ }
270
+ var import_react, jsx_dev_runtime, WORKFLOWS;
271
+ var init_WorkflowMultiselectDialog = __esm(() => {
272
+ init_src();
273
+ init_ConfigurableShortcutHint();
274
+ init_SelectMulti();
275
+ import_react = __toESM(require_react(), 1);
276
+ jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
277
+ WORKFLOWS = [
278
+ {
279
+ value: "claude",
280
+ label: "@RedScope AI - Tag @claude in issues and PR comments"
281
+ },
282
+ {
283
+ value: "claude-review",
284
+ label: "RedScope AI Review - Automated code review on new PRs"
285
+ }
286
+ ];
287
+ });
288
+
289
+ // src/constants/github-app.ts
290
+ var PR_TITLE = "Add RedScope AI GitHub Workflow", GITHUB_ACTION_SETUP_DOCS_URL = "https://github.com/anthropics/claude-code-action/blob/main/docs/setup.md", WORKFLOW_CONTENT = `name: RedScope AI
291
+
292
+ on:
293
+ issue_comment:
294
+ types: [created]
295
+ pull_request_review_comment:
296
+ types: [created]
297
+ issues:
298
+ types: [opened, assigned]
299
+ pull_request_review:
300
+ types: [submitted]
301
+
302
+ jobs:
303
+ claude:
304
+ if: |
305
+ (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
306
+ (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
307
+ (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
308
+ (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
309
+ runs-on: ubuntu-latest
310
+ permissions:
311
+ contents: read
312
+ pull-requests: read
313
+ issues: read
314
+ id-token: write
315
+ actions: read # Required for Claude to read CI results on PRs
316
+ steps:
317
+ - name: Checkout repository
318
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2, 2026-04-25
319
+ with:
320
+ fetch-depth: 1
321
+
322
+ - name: Run RedScope AI
323
+ id: claude
324
+ uses: anthropics/claude-code-action@567fe954a4527e81f132d87d1bdbcc94f7737434 # v1, 2026-04-25
325
+ with:
326
+ anthropic_api_key: \${{ secrets.ANTHROPIC_API_KEY }}
327
+
328
+ # This is an optional setting that allows Claude to read CI results on PRs
329
+ additional_permissions: |
330
+ actions: read
331
+
332
+ # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
333
+ # prompt: 'Update the pull request description to include a summary of changes.'
334
+
335
+ # Optional: Add claude_args to customize behavior and configuration
336
+ # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
337
+ # or https://code.claude.com/docs/en/cli-reference for available options
338
+ # claude_args: '--allowed-tools Bash(gh pr:*)'
339
+
340
+ `, PR_BODY = `## \uD83E\uDD16 Installing RedScope AI GitHub App
341
+
342
+ This PR adds a GitHub Actions workflow that enables RedScope AI integration in our repository.
343
+
344
+ ### What is RedScope AI?
345
+
346
+ [RedScope AI](https://claude.com/claude-code) is an AI coding agent that can help with:
347
+ - Bug fixes and improvements
348
+ - Documentation updates
349
+ - Implementing new features
350
+ - Code reviews and suggestions
351
+ - Writing tests
352
+ - And more!
353
+
354
+ ### How it works
355
+
356
+ Once this PR is merged, we'll be able to interact with Claude by mentioning @claude in a pull request or issue comment.
357
+ Once the workflow is triggered, Claude will analyze the comment and surrounding context, and execute on the request in a GitHub action.
358
+
359
+ ### Important Notes
360
+
361
+ - **This workflow won't take effect until this PR is merged**
362
+ - **@claude mentions won't work until after the merge is complete**
363
+ - The workflow runs automatically whenever RedScope is mentioned in PR or issue comments
364
+ - Claude gets access to the entire PR or issue context including files, diffs, and previous comments
365
+
366
+ ### Security
367
+
368
+ - Our Anthropic API key is securely stored as a GitHub Actions secret
369
+ - Only users with write access to the repository can trigger the workflow
370
+ - All Claude runs are stored in the GitHub Actions run history
371
+ - RedScope's default tools are limited to reading/writing files and interacting with our repo by creating comments, branches, and commits.
372
+ - We can add more allowed tools by adding them to the workflow file like:
373
+
374
+ \`\`\`
375
+ allowed_tools: Bash(npm install),Bash(npm run build),Bash(npm run lint),Bash(npm run test)
376
+ \`\`\`
377
+
378
+ There's more information in the [RedScope AI action repo](https://github.com/anthropics/claude-code-action).
379
+
380
+ After merging this PR, let's try mentioning @claude in a comment on any PR to get started!`, CODE_REVIEW_PLUGIN_WORKFLOW_CONTENT = `name: RedScope AI Review
381
+
382
+ on:
383
+ pull_request:
384
+ types: [opened, synchronize, ready_for_review, reopened]
385
+ # Optional: Only run on specific file changes
386
+ # paths:
387
+ # - "src/**/*.ts"
388
+ # - "src/**/*.tsx"
389
+ # - "src/**/*.js"
390
+ # - "src/**/*.jsx"
391
+
392
+ jobs:
393
+ claude-review:
394
+ # Optional: Filter by PR author
395
+ # if: |
396
+ # github.event.pull_request.user.login == 'external-contributor' ||
397
+ # github.event.pull_request.user.login == 'new-developer' ||
398
+ # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
399
+
400
+ runs-on: ubuntu-latest
401
+ permissions:
402
+ contents: read
403
+ pull-requests: read
404
+ issues: read
405
+ id-token: write
406
+
407
+ steps:
408
+ - name: Checkout repository
409
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2, 2026-04-25
410
+ with:
411
+ fetch-depth: 1
412
+
413
+ - name: Run RedScope AI Review
414
+ id: claude-review
415
+ uses: anthropics/claude-code-action@567fe954a4527e81f132d87d1bdbcc94f7737434 # v1, 2026-04-25
416
+ with:
417
+ anthropic_api_key: \${{ secrets.ANTHROPIC_API_KEY }}
418
+ plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
419
+ plugins: 'code-review@claude-code-plugins'
420
+ prompt: '/code-review:code-review \${{ github.repository }}/pull/\${{ github.event.pull_request.number }}'
421
+ # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
422
+ # or https://code.claude.com/docs/en/cli-reference for available options
423
+
424
+ `;
425
+ var init_github_app = () => {};
426
+
427
+ // src/commands/install-github-app/ApiKeyStep.tsx
428
+ function ApiKeyStep({
429
+ existingApiKey,
430
+ apiKeyOrOAuthToken,
431
+ onApiKeyChange,
432
+ onSubmit,
433
+ onToggleUseExistingKey,
434
+ onCreateOAuthToken,
435
+ selectedOption = existingApiKey ? "existing" : onCreateOAuthToken ? "oauth" : "new",
436
+ onSelectOption
437
+ }) {
438
+ const [cursorOffset, setCursorOffset] = import_react2.useState(0);
439
+ const terminalSize = useTerminalSize();
440
+ const [theme] = useTheme();
441
+ const handlePrevious = import_react2.useCallback(() => {
442
+ if (selectedOption === "new" && onCreateOAuthToken) {
443
+ onSelectOption?.("oauth");
444
+ } else if (selectedOption === "oauth" && existingApiKey) {
445
+ onSelectOption?.("existing");
446
+ onToggleUseExistingKey(true);
447
+ }
448
+ }, [
449
+ selectedOption,
450
+ onCreateOAuthToken,
451
+ existingApiKey,
452
+ onSelectOption,
453
+ onToggleUseExistingKey
454
+ ]);
455
+ const handleNext = import_react2.useCallback(() => {
456
+ if (selectedOption === "existing") {
457
+ onSelectOption?.(onCreateOAuthToken ? "oauth" : "new");
458
+ onToggleUseExistingKey(false);
459
+ } else if (selectedOption === "oauth") {
460
+ onSelectOption?.("new");
461
+ }
462
+ }, [
463
+ selectedOption,
464
+ onCreateOAuthToken,
465
+ onSelectOption,
466
+ onToggleUseExistingKey
467
+ ]);
468
+ const handleConfirm = import_react2.useCallback(() => {
469
+ if (selectedOption === "oauth" && onCreateOAuthToken) {
470
+ onCreateOAuthToken();
471
+ } else {
472
+ onSubmit();
473
+ }
474
+ }, [selectedOption, onCreateOAuthToken, onSubmit]);
475
+ const isTextInputVisible = selectedOption === "new";
476
+ useKeybindings({
477
+ "confirm:previous": handlePrevious,
478
+ "confirm:next": handleNext,
479
+ "confirm:yes": handleConfirm
480
+ }, { context: "Confirmation", isActive: !isTextInputVisible });
481
+ useKeybindings({
482
+ "confirm:previous": handlePrevious,
483
+ "confirm:next": handleNext
484
+ }, { context: "Confirmation", isActive: isTextInputVisible });
485
+ return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(jsx_dev_runtime2.Fragment, {
486
+ children: [
487
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
488
+ flexDirection: "column",
489
+ borderStyle: "round",
490
+ paddingX: 1,
491
+ children: [
492
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
493
+ flexDirection: "column",
494
+ marginBottom: 1,
495
+ children: [
496
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
497
+ bold: true,
498
+ children: "Install GitHub App"
499
+ }, undefined, false, undefined, this),
500
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
501
+ dimColor: true,
502
+ children: "Choose API key"
503
+ }, undefined, false, undefined, this)
504
+ ]
505
+ }, undefined, true, undefined, this),
506
+ existingApiKey && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
507
+ marginBottom: 1,
508
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
509
+ children: [
510
+ selectedOption === "existing" ? color("success", theme)("> ") : " ",
511
+ "Use your existing RedScope AI API key"
512
+ ]
513
+ }, undefined, true, undefined, this)
514
+ }, undefined, false, undefined, this),
515
+ onCreateOAuthToken && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
516
+ marginBottom: 1,
517
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
518
+ children: [
519
+ selectedOption === "oauth" ? color("success", theme)("> ") : " ",
520
+ "Create a long-lived token with your RedScope subscription"
521
+ ]
522
+ }, undefined, true, undefined, this)
523
+ }, undefined, false, undefined, this),
524
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
525
+ marginBottom: 1,
526
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
527
+ children: [
528
+ selectedOption === "new" ? color("success", theme)("> ") : " ",
529
+ "Enter a new API key"
530
+ ]
531
+ }, undefined, true, undefined, this)
532
+ }, undefined, false, undefined, this),
533
+ selectedOption === "new" && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(TextInput, {
534
+ value: apiKeyOrOAuthToken,
535
+ onChange: onApiKeyChange,
536
+ onSubmit,
537
+ onPaste: onApiKeyChange,
538
+ focus: true,
539
+ placeholder: "sk-ant\u2026 (Create a new key at https://platform.claude.com/settings/keys)",
540
+ mask: "*",
541
+ columns: terminalSize.columns,
542
+ cursorOffset,
543
+ onChangeCursorOffset: setCursorOffset,
544
+ showCursor: true
545
+ }, undefined, false, undefined, this)
546
+ ]
547
+ }, undefined, true, undefined, this),
548
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedBox_default, {
549
+ marginLeft: 3,
550
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
551
+ dimColor: true,
552
+ children: "\u2191/\u2193 to select \xB7 Enter to continue"
553
+ }, undefined, false, undefined, this)
554
+ }, undefined, false, undefined, this)
555
+ ]
556
+ }, undefined, true, undefined, this);
557
+ }
558
+ var import_react2, jsx_dev_runtime2;
559
+ var init_ApiKeyStep = __esm(() => {
560
+ init_TextInput();
561
+ init_useTerminalSize();
562
+ init_src();
563
+ init_useKeybinding();
564
+ import_react2 = __toESM(require_react(), 1);
565
+ jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
566
+ });
567
+
568
+ // src/commands/install-github-app/CheckExistingSecretStep.tsx
569
+ function CheckExistingSecretStep({
570
+ useExistingSecret,
571
+ secretName,
572
+ onToggleUseExistingSecret,
573
+ onSecretNameChange,
574
+ onSubmit
575
+ }) {
576
+ const [cursorOffset, setCursorOffset] = import_react3.useState(0);
577
+ const terminalSize = useTerminalSize();
578
+ const [theme] = useTheme();
579
+ const handlePrevious = import_react3.useCallback(() => onToggleUseExistingSecret(true), [onToggleUseExistingSecret]);
580
+ const handleNext = import_react3.useCallback(() => onToggleUseExistingSecret(false), [onToggleUseExistingSecret]);
581
+ useKeybindings({
582
+ "confirm:previous": handlePrevious,
583
+ "confirm:next": handleNext,
584
+ "confirm:yes": onSubmit
585
+ }, { context: "Confirmation", isActive: useExistingSecret });
586
+ useKeybindings({
587
+ "confirm:previous": handlePrevious,
588
+ "confirm:next": handleNext
589
+ }, { context: "Confirmation", isActive: !useExistingSecret });
590
+ return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(jsx_dev_runtime3.Fragment, {
591
+ children: [
592
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
593
+ flexDirection: "column",
594
+ borderStyle: "round",
595
+ paddingX: 1,
596
+ children: [
597
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
598
+ flexDirection: "column",
599
+ marginBottom: 1,
600
+ children: [
601
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
602
+ bold: true,
603
+ children: "Install GitHub App"
604
+ }, undefined, false, undefined, this),
605
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
606
+ dimColor: true,
607
+ children: "Setup API key secret"
608
+ }, undefined, false, undefined, this)
609
+ ]
610
+ }, undefined, true, undefined, this),
611
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
612
+ marginBottom: 1,
613
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
614
+ color: "warning",
615
+ children: "ANTHROPIC_API_KEY already exists in repository secrets!"
616
+ }, undefined, false, undefined, this)
617
+ }, undefined, false, undefined, this),
618
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
619
+ marginBottom: 1,
620
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
621
+ children: "Would you like to:"
622
+ }, undefined, false, undefined, this)
623
+ }, undefined, false, undefined, this),
624
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
625
+ marginBottom: 1,
626
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
627
+ children: [
628
+ useExistingSecret ? color("success", theme)("> ") : " ",
629
+ "Use the existing API key"
630
+ ]
631
+ }, undefined, true, undefined, this)
632
+ }, undefined, false, undefined, this),
633
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
634
+ marginBottom: 1,
635
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
636
+ children: [
637
+ !useExistingSecret ? color("success", theme)("> ") : " ",
638
+ "Create a new secret with a different name"
639
+ ]
640
+ }, undefined, true, undefined, this)
641
+ }, undefined, false, undefined, this),
642
+ !useExistingSecret && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(jsx_dev_runtime3.Fragment, {
643
+ children: [
644
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
645
+ marginBottom: 1,
646
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
647
+ children: "Enter new secret name (alphanumeric with underscores):"
648
+ }, undefined, false, undefined, this)
649
+ }, undefined, false, undefined, this),
650
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(TextInput, {
651
+ value: secretName,
652
+ onChange: onSecretNameChange,
653
+ onSubmit,
654
+ focus: true,
655
+ placeholder: "e.g., CLAUDE_API_KEY",
656
+ columns: terminalSize.columns,
657
+ cursorOffset,
658
+ onChangeCursorOffset: setCursorOffset,
659
+ showCursor: true
660
+ }, undefined, false, undefined, this)
661
+ ]
662
+ }, undefined, true, undefined, this)
663
+ ]
664
+ }, undefined, true, undefined, this),
665
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
666
+ marginLeft: 3,
667
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedText, {
668
+ dimColor: true,
669
+ children: "\u2191/\u2193 to select \xB7 Enter to continue"
670
+ }, undefined, false, undefined, this)
671
+ }, undefined, false, undefined, this)
672
+ ]
673
+ }, undefined, true, undefined, this);
674
+ }
675
+ var import_react3, jsx_dev_runtime3;
676
+ var init_CheckExistingSecretStep = __esm(() => {
677
+ init_TextInput();
678
+ init_useTerminalSize();
679
+ init_src();
680
+ init_useKeybinding();
681
+ import_react3 = __toESM(require_react(), 1);
682
+ jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
683
+ });
684
+
685
+ // src/commands/install-github-app/CheckGitHubStep.tsx
686
+ function CheckGitHubStep() {
687
+ return /* @__PURE__ */ jsx_dev_runtime4.jsxDEV(ThemedText, {
688
+ children: "Checking GitHub CLI installation\u2026"
689
+ }, undefined, false, undefined, this);
690
+ }
691
+ var jsx_dev_runtime4;
692
+ var init_CheckGitHubStep = __esm(() => {
693
+ init_src();
694
+ jsx_dev_runtime4 = __toESM(require_jsx_dev_runtime(), 1);
695
+ });
696
+
697
+ // src/commands/install-github-app/ChooseRepoStep.tsx
698
+ function ChooseRepoStep({
699
+ currentRepo,
700
+ useCurrentRepo,
701
+ repoUrl,
702
+ onRepoUrlChange,
703
+ onSubmit,
704
+ onToggleUseCurrentRepo
705
+ }) {
706
+ const [cursorOffset, setCursorOffset] = import_react4.useState(0);
707
+ const [showEmptyError, setShowEmptyError] = import_react4.useState(false);
708
+ const terminalSize = useTerminalSize();
709
+ const textInputColumns = terminalSize.columns;
710
+ const handleSubmit = import_react4.useCallback(() => {
711
+ const repoName = useCurrentRepo ? currentRepo : repoUrl;
712
+ if (!repoName?.trim()) {
713
+ setShowEmptyError(true);
714
+ return;
715
+ }
716
+ onSubmit();
717
+ }, [useCurrentRepo, currentRepo, repoUrl, onSubmit]);
718
+ const isTextInputVisible = !useCurrentRepo || !currentRepo;
719
+ const handlePrevious = import_react4.useCallback(() => {
720
+ onToggleUseCurrentRepo(true);
721
+ setShowEmptyError(false);
722
+ }, [onToggleUseCurrentRepo]);
723
+ const handleNext = import_react4.useCallback(() => {
724
+ onToggleUseCurrentRepo(false);
725
+ setShowEmptyError(false);
726
+ }, [onToggleUseCurrentRepo]);
727
+ useKeybindings({
728
+ "confirm:previous": handlePrevious,
729
+ "confirm:next": handleNext,
730
+ "confirm:yes": handleSubmit
731
+ }, { context: "Confirmation", isActive: !isTextInputVisible });
732
+ useKeybindings({
733
+ "confirm:previous": handlePrevious,
734
+ "confirm:next": handleNext
735
+ }, { context: "Confirmation", isActive: isTextInputVisible });
736
+ return /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(jsx_dev_runtime5.Fragment, {
737
+ children: [
738
+ /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
739
+ flexDirection: "column",
740
+ borderStyle: "round",
741
+ paddingX: 1,
742
+ children: [
743
+ /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
744
+ flexDirection: "column",
745
+ marginBottom: 1,
746
+ children: [
747
+ /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
748
+ bold: true,
749
+ children: "Install GitHub App"
750
+ }, undefined, false, undefined, this),
751
+ /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
752
+ dimColor: true,
753
+ children: "Select GitHub repository"
754
+ }, undefined, false, undefined, this)
755
+ ]
756
+ }, undefined, true, undefined, this),
757
+ currentRepo && /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
758
+ marginBottom: 1,
759
+ children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
760
+ bold: useCurrentRepo,
761
+ color: useCurrentRepo ? "permission" : undefined,
762
+ children: [
763
+ useCurrentRepo ? "> " : " ",
764
+ "Use current repository: ",
765
+ currentRepo
766
+ ]
767
+ }, undefined, true, undefined, this)
768
+ }, undefined, false, undefined, this),
769
+ /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
770
+ marginBottom: 1,
771
+ children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
772
+ bold: !useCurrentRepo || !currentRepo,
773
+ color: !useCurrentRepo || !currentRepo ? "permission" : undefined,
774
+ children: [
775
+ !useCurrentRepo || !currentRepo ? "> " : " ",
776
+ currentRepo ? "Enter a different repository" : "Enter repository"
777
+ ]
778
+ }, undefined, true, undefined, this)
779
+ }, undefined, false, undefined, this),
780
+ (!useCurrentRepo || !currentRepo) && /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
781
+ marginLeft: 2,
782
+ marginBottom: 1,
783
+ children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(TextInput, {
784
+ value: repoUrl,
785
+ onChange: (value) => {
786
+ onRepoUrlChange(value);
787
+ setShowEmptyError(false);
788
+ },
789
+ onSubmit: handleSubmit,
790
+ focus: true,
791
+ placeholder: "Enter a repo as owner/repo or https://github.com/owner/repo\u2026",
792
+ columns: textInputColumns,
793
+ cursorOffset,
794
+ onChangeCursorOffset: setCursorOffset,
795
+ showCursor: true
796
+ }, undefined, false, undefined, this)
797
+ }, undefined, false, undefined, this)
798
+ ]
799
+ }, undefined, true, undefined, this),
800
+ showEmptyError && /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
801
+ marginLeft: 3,
802
+ marginBottom: 1,
803
+ children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
804
+ color: "error",
805
+ children: "Please enter a repository name to continue"
806
+ }, undefined, false, undefined, this)
807
+ }, undefined, false, undefined, this),
808
+ /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedBox_default, {
809
+ marginLeft: 3,
810
+ children: /* @__PURE__ */ jsx_dev_runtime5.jsxDEV(ThemedText, {
811
+ dimColor: true,
812
+ children: [
813
+ currentRepo ? "\u2191/\u2193 to select \xB7 " : "",
814
+ "Enter to continue"
815
+ ]
816
+ }, undefined, true, undefined, this)
817
+ }, undefined, false, undefined, this)
818
+ ]
819
+ }, undefined, true, undefined, this);
820
+ }
821
+ var import_react4, jsx_dev_runtime5;
822
+ var init_ChooseRepoStep = __esm(() => {
823
+ init_TextInput();
824
+ init_useTerminalSize();
825
+ init_src();
826
+ init_useKeybinding();
827
+ import_react4 = __toESM(require_react(), 1);
828
+ jsx_dev_runtime5 = __toESM(require_jsx_dev_runtime(), 1);
829
+ });
830
+
831
+ // src/commands/install-github-app/CreatingStep.tsx
832
+ function CreatingStep({
833
+ currentWorkflowInstallStep,
834
+ secretExists,
835
+ useExistingSecret,
836
+ secretName,
837
+ skipWorkflow = false,
838
+ selectedWorkflows
839
+ }) {
840
+ const progressSteps = skipWorkflow ? [
841
+ "Getting repository information",
842
+ secretExists && useExistingSecret ? "Using existing API key secret" : `Setting up ${secretName} secret`
843
+ ] : [
844
+ "Getting repository information",
845
+ "Creating branch",
846
+ selectedWorkflows.length > 1 ? "Creating workflow files" : "Creating workflow file",
847
+ secretExists && useExistingSecret ? "Using existing API key secret" : `Setting up ${secretName} secret`,
848
+ "Opening pull request page"
849
+ ];
850
+ return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(jsx_dev_runtime6.Fragment, {
851
+ children: /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedBox_default, {
852
+ flexDirection: "column",
853
+ borderStyle: "round",
854
+ paddingX: 1,
855
+ children: [
856
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedBox_default, {
857
+ flexDirection: "column",
858
+ marginBottom: 1,
859
+ children: [
860
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedText, {
861
+ bold: true,
862
+ children: "Install GitHub App"
863
+ }, undefined, false, undefined, this),
864
+ /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedText, {
865
+ dimColor: true,
866
+ children: "Create GitHub Actions workflow"
867
+ }, undefined, false, undefined, this)
868
+ ]
869
+ }, undefined, true, undefined, this),
870
+ progressSteps.map((stepText, index) => {
871
+ let status = "pending";
872
+ if (index < currentWorkflowInstallStep) {
873
+ status = "completed";
874
+ } else if (index === currentWorkflowInstallStep) {
875
+ status = "in-progress";
876
+ }
877
+ return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedBox_default, {
878
+ children: /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(ThemedText, {
879
+ color: status === "completed" ? "success" : status === "in-progress" ? "warning" : undefined,
880
+ children: [
881
+ status === "completed" ? "\u2713 " : "",
882
+ stepText,
883
+ status === "in-progress" ? "\u2026" : ""
884
+ ]
885
+ }, undefined, true, undefined, this)
886
+ }, index, false, undefined, this);
887
+ })
888
+ ]
889
+ }, undefined, true, undefined, this)
890
+ }, undefined, false, undefined, this);
891
+ }
892
+ var jsx_dev_runtime6;
893
+ var init_CreatingStep = __esm(() => {
894
+ init_src();
895
+ jsx_dev_runtime6 = __toESM(require_jsx_dev_runtime(), 1);
896
+ });
897
+
898
+ // src/commands/install-github-app/ErrorStep.tsx
899
+ function ErrorStep({
900
+ error,
901
+ errorReason,
902
+ errorInstructions
903
+ }) {
904
+ return /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(jsx_dev_runtime7.Fragment, {
905
+ children: [
906
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
907
+ flexDirection: "column",
908
+ borderStyle: "round",
909
+ paddingX: 1,
910
+ children: [
911
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
912
+ flexDirection: "column",
913
+ marginBottom: 1,
914
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
915
+ bold: true,
916
+ children: "Install GitHub App"
917
+ }, undefined, false, undefined, this)
918
+ }, undefined, false, undefined, this),
919
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
920
+ color: "error",
921
+ children: [
922
+ "Error: ",
923
+ error
924
+ ]
925
+ }, undefined, true, undefined, this),
926
+ errorReason && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
927
+ marginTop: 1,
928
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
929
+ dimColor: true,
930
+ children: [
931
+ "Reason: ",
932
+ errorReason
933
+ ]
934
+ }, undefined, true, undefined, this)
935
+ }, undefined, false, undefined, this),
936
+ errorInstructions && errorInstructions.length > 0 && /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
937
+ flexDirection: "column",
938
+ marginTop: 1,
939
+ children: [
940
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
941
+ dimColor: true,
942
+ children: "How to fix:"
943
+ }, undefined, false, undefined, this),
944
+ errorInstructions.map((instruction, index) => /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
945
+ marginLeft: 2,
946
+ children: [
947
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
948
+ dimColor: true,
949
+ children: "\u2022 "
950
+ }, undefined, false, undefined, this),
951
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
952
+ children: instruction
953
+ }, undefined, false, undefined, this)
954
+ ]
955
+ }, index, true, undefined, this))
956
+ ]
957
+ }, undefined, true, undefined, this),
958
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
959
+ marginTop: 1,
960
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
961
+ dimColor: true,
962
+ children: [
963
+ "For manual setup instructions, see:",
964
+ " ",
965
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
966
+ color: "claude",
967
+ children: GITHUB_ACTION_SETUP_DOCS_URL
968
+ }, undefined, false, undefined, this)
969
+ ]
970
+ }, undefined, true, undefined, this)
971
+ }, undefined, false, undefined, this)
972
+ ]
973
+ }, undefined, true, undefined, this),
974
+ /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedBox_default, {
975
+ marginLeft: 3,
976
+ children: /* @__PURE__ */ jsx_dev_runtime7.jsxDEV(ThemedText, {
977
+ dimColor: true,
978
+ children: "Press any key to exit"
979
+ }, undefined, false, undefined, this)
980
+ }, undefined, false, undefined, this)
981
+ ]
982
+ }, undefined, true, undefined, this);
983
+ }
984
+ var jsx_dev_runtime7;
985
+ var init_ErrorStep = __esm(() => {
986
+ init_github_app();
987
+ init_src();
988
+ jsx_dev_runtime7 = __toESM(require_jsx_dev_runtime(), 1);
989
+ });
990
+
991
+ // src/commands/install-github-app/ExistingWorkflowStep.tsx
992
+ function ExistingWorkflowStep({
993
+ repoName,
994
+ onSelectAction
995
+ }) {
996
+ const options = [
997
+ {
998
+ label: "Update workflow file with latest version",
999
+ value: "update"
1000
+ },
1001
+ {
1002
+ label: "Skip workflow update (configure secrets only)",
1003
+ value: "skip"
1004
+ },
1005
+ {
1006
+ label: "Exit without making changes",
1007
+ value: "exit"
1008
+ }
1009
+ ];
1010
+ const handleSelect = (value) => {
1011
+ onSelectAction(value);
1012
+ };
1013
+ const handleCancel = () => {
1014
+ onSelectAction("exit");
1015
+ };
1016
+ return /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedBox_default, {
1017
+ flexDirection: "column",
1018
+ borderStyle: "round",
1019
+ borderDimColor: true,
1020
+ paddingX: 1,
1021
+ children: [
1022
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedBox_default, {
1023
+ flexDirection: "column",
1024
+ marginBottom: 1,
1025
+ children: [
1026
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1027
+ bold: true,
1028
+ children: "Existing Workflow Found"
1029
+ }, undefined, false, undefined, this),
1030
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1031
+ dimColor: true,
1032
+ children: [
1033
+ "Repository: ",
1034
+ repoName
1035
+ ]
1036
+ }, undefined, true, undefined, this)
1037
+ ]
1038
+ }, undefined, true, undefined, this),
1039
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedBox_default, {
1040
+ flexDirection: "column",
1041
+ marginBottom: 1,
1042
+ children: [
1043
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1044
+ children: [
1045
+ "A RedScope workflow file already exists at",
1046
+ " ",
1047
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1048
+ color: "claude",
1049
+ children: ".github/workflows/claude.yml"
1050
+ }, undefined, false, undefined, this)
1051
+ ]
1052
+ }, undefined, true, undefined, this),
1053
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1054
+ dimColor: true,
1055
+ children: "What would you like to do?"
1056
+ }, undefined, false, undefined, this)
1057
+ ]
1058
+ }, undefined, true, undefined, this),
1059
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedBox_default, {
1060
+ flexDirection: "column",
1061
+ children: /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Select, {
1062
+ options,
1063
+ onChange: handleSelect,
1064
+ onCancel: handleCancel
1065
+ }, undefined, false, undefined, this)
1066
+ }, undefined, false, undefined, this),
1067
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedBox_default, {
1068
+ marginTop: 1,
1069
+ children: /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1070
+ dimColor: true,
1071
+ children: [
1072
+ "View the latest workflow template at:",
1073
+ " ",
1074
+ /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(ThemedText, {
1075
+ color: "claude",
1076
+ children: "https://github.com/anthropics/claude-code-action/blob/main/examples/claude.yml"
1077
+ }, undefined, false, undefined, this)
1078
+ ]
1079
+ }, undefined, true, undefined, this)
1080
+ }, undefined, false, undefined, this)
1081
+ ]
1082
+ }, undefined, true, undefined, this);
1083
+ }
1084
+ var jsx_dev_runtime8;
1085
+ var init_ExistingWorkflowStep = __esm(() => {
1086
+ init_CustomSelect();
1087
+ init_src();
1088
+ jsx_dev_runtime8 = __toESM(require_jsx_dev_runtime(), 1);
1089
+ });
1090
+
1091
+ // src/commands/install-github-app/InstallAppStep.tsx
1092
+ function InstallAppStep({ repoUrl, onSubmit }) {
1093
+ useKeybinding("confirm:yes", onSubmit, { context: "Confirmation" });
1094
+ return /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1095
+ flexDirection: "column",
1096
+ borderStyle: "round",
1097
+ borderDimColor: true,
1098
+ paddingX: 1,
1099
+ children: [
1100
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1101
+ flexDirection: "column",
1102
+ marginBottom: 1,
1103
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1104
+ bold: true,
1105
+ children: "Install the RedScope GitHub App"
1106
+ }, undefined, false, undefined, this)
1107
+ }, undefined, false, undefined, this),
1108
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1109
+ marginBottom: 1,
1110
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1111
+ children: "Opening browser to install the RedScope GitHub App\u2026"
1112
+ }, undefined, false, undefined, this)
1113
+ }, undefined, false, undefined, this),
1114
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1115
+ marginBottom: 1,
1116
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1117
+ children: "If your browser doesn't open automatically, visit:"
1118
+ }, undefined, false, undefined, this)
1119
+ }, undefined, false, undefined, this),
1120
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1121
+ marginBottom: 1,
1122
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1123
+ underline: true,
1124
+ children: "https://github.com/apps/claude"
1125
+ }, undefined, false, undefined, this)
1126
+ }, undefined, false, undefined, this),
1127
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1128
+ marginBottom: 1,
1129
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1130
+ children: [
1131
+ "Please install the app for repository: ",
1132
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1133
+ bold: true,
1134
+ children: repoUrl
1135
+ }, undefined, false, undefined, this)
1136
+ ]
1137
+ }, undefined, true, undefined, this)
1138
+ }, undefined, false, undefined, this),
1139
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1140
+ marginBottom: 1,
1141
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1142
+ dimColor: true,
1143
+ children: "Important: Make sure to grant access to this specific repository"
1144
+ }, undefined, false, undefined, this)
1145
+ }, undefined, false, undefined, this),
1146
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1147
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1148
+ bold: true,
1149
+ color: "permission",
1150
+ children: [
1151
+ "Press Enter once you've installed the app",
1152
+ figures_default.ellipsis
1153
+ ]
1154
+ }, undefined, true, undefined, this)
1155
+ }, undefined, false, undefined, this),
1156
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedBox_default, {
1157
+ marginTop: 1,
1158
+ children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1159
+ dimColor: true,
1160
+ children: [
1161
+ "Having trouble? See manual setup instructions at:",
1162
+ " ",
1163
+ /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(ThemedText, {
1164
+ color: "claude",
1165
+ children: GITHUB_ACTION_SETUP_DOCS_URL
1166
+ }, undefined, false, undefined, this)
1167
+ ]
1168
+ }, undefined, true, undefined, this)
1169
+ }, undefined, false, undefined, this)
1170
+ ]
1171
+ }, undefined, true, undefined, this);
1172
+ }
1173
+ var jsx_dev_runtime9;
1174
+ var init_InstallAppStep = __esm(() => {
1175
+ init_figures();
1176
+ init_github_app();
1177
+ init_src();
1178
+ init_useKeybinding();
1179
+ jsx_dev_runtime9 = __toESM(require_jsx_dev_runtime(), 1);
1180
+ });
1181
+
1182
+ // src/commands/install-github-app/OAuthFlowStep.tsx
1183
+ function OAuthFlowStep({
1184
+ onSuccess,
1185
+ onCancel
1186
+ }) {
1187
+ const [oauthStatus, setOAuthStatus] = import_react5.useState({
1188
+ state: "starting"
1189
+ });
1190
+ const [oauthService] = import_react5.useState(() => new OAuthService);
1191
+ const [pastedCode, setPastedCode] = import_react5.useState("");
1192
+ const [cursorOffset, setCursorOffset] = import_react5.useState(0);
1193
+ const [showPastePrompt, setShowPastePrompt] = import_react5.useState(false);
1194
+ const [urlCopied, setUrlCopied] = import_react5.useState(false);
1195
+ const timersRef = import_react5.useRef(new Set);
1196
+ const urlCopiedTimerRef = import_react5.useRef(undefined);
1197
+ const terminalSize = useTerminalSize();
1198
+ const textInputColumns = Math.max(50, terminalSize.columns - PASTE_HERE_MSG.length - 4);
1199
+ function handleKeyDown(e) {
1200
+ if (oauthStatus.state !== "error")
1201
+ return;
1202
+ e.preventDefault();
1203
+ if (e.key === "return" && oauthStatus.toRetry) {
1204
+ setPastedCode("");
1205
+ setCursorOffset(0);
1206
+ setOAuthStatus({
1207
+ state: "about_to_retry",
1208
+ nextState: oauthStatus.toRetry
1209
+ });
1210
+ } else {
1211
+ onCancel();
1212
+ }
1213
+ }
1214
+ async function handleSubmitCode(value, url) {
1215
+ try {
1216
+ const [authorizationCode, state] = value.split("#");
1217
+ if (!authorizationCode || !state) {
1218
+ setOAuthStatus({
1219
+ state: "error",
1220
+ message: "Invalid code. Please make sure the full code was copied",
1221
+ toRetry: { state: "waiting_for_login", url }
1222
+ });
1223
+ return;
1224
+ }
1225
+ logEvent("tengu_oauth_manual_entry", {});
1226
+ oauthService.handleManualAuthCodeInput({
1227
+ authorizationCode,
1228
+ state
1229
+ });
1230
+ } catch (err) {
1231
+ logError(err);
1232
+ setOAuthStatus({
1233
+ state: "error",
1234
+ message: err.message,
1235
+ toRetry: { state: "waiting_for_login", url }
1236
+ });
1237
+ }
1238
+ }
1239
+ const startOAuth = import_react5.useCallback(async () => {
1240
+ timersRef.current.forEach((timer) => clearTimeout(timer));
1241
+ timersRef.current.clear();
1242
+ try {
1243
+ const result = await oauthService.startOAuthFlow(async (url) => {
1244
+ setOAuthStatus({ state: "waiting_for_login", url });
1245
+ const timer = setTimeout(setShowPastePrompt, 3000, true);
1246
+ timersRef.current.add(timer);
1247
+ }, {
1248
+ loginWithClaudeAi: true,
1249
+ inferenceOnly: true,
1250
+ expiresIn: 365 * 24 * 60 * 60
1251
+ });
1252
+ setOAuthStatus({ state: "processing" });
1253
+ saveOAuthTokensIfNeeded(result);
1254
+ const timer1 = setTimeout((setOAuthStatus2, accessToken, onSuccess2, timersRef2) => {
1255
+ setOAuthStatus2({ state: "success", token: accessToken });
1256
+ const timer2 = setTimeout(onSuccess2, 1000, accessToken);
1257
+ timersRef2.current.add(timer2);
1258
+ }, 100, setOAuthStatus, result.accessToken, onSuccess, timersRef);
1259
+ timersRef.current.add(timer1);
1260
+ } catch (err) {
1261
+ const errorMessage = err.message;
1262
+ setOAuthStatus({
1263
+ state: "error",
1264
+ message: errorMessage,
1265
+ toRetry: { state: "starting" }
1266
+ });
1267
+ logError(err);
1268
+ logEvent("tengu_oauth_error", {
1269
+ error: errorMessage
1270
+ });
1271
+ }
1272
+ }, [oauthService, onSuccess]);
1273
+ import_react5.useEffect(() => {
1274
+ if (oauthStatus.state === "starting") {
1275
+ startOAuth();
1276
+ }
1277
+ }, [oauthStatus.state, startOAuth]);
1278
+ import_react5.useEffect(() => {
1279
+ if (oauthStatus.state === "about_to_retry") {
1280
+ const timer = setTimeout((nextState, setShowPastePrompt2, setOAuthStatus2) => {
1281
+ setShowPastePrompt2(nextState.state === "waiting_for_login");
1282
+ setOAuthStatus2(nextState);
1283
+ }, 500, oauthStatus.nextState, setShowPastePrompt, setOAuthStatus);
1284
+ timersRef.current.add(timer);
1285
+ }
1286
+ }, [oauthStatus]);
1287
+ import_react5.useEffect(() => {
1288
+ if (pastedCode === "c" && oauthStatus.state === "waiting_for_login" && showPastePrompt && !urlCopied) {
1289
+ setClipboard(oauthStatus.url).then((raw) => {
1290
+ if (raw)
1291
+ process.stdout.write(raw);
1292
+ setUrlCopied(true);
1293
+ clearTimeout(urlCopiedTimerRef.current);
1294
+ urlCopiedTimerRef.current = setTimeout(setUrlCopied, 2000, false);
1295
+ });
1296
+ setPastedCode("");
1297
+ }
1298
+ }, [pastedCode, oauthStatus, showPastePrompt, urlCopied]);
1299
+ import_react5.useEffect(() => {
1300
+ const timers = timersRef.current;
1301
+ return () => {
1302
+ oauthService.cleanup();
1303
+ timers.forEach((timer) => clearTimeout(timer));
1304
+ timers.clear();
1305
+ clearTimeout(urlCopiedTimerRef.current);
1306
+ };
1307
+ }, [oauthService]);
1308
+ function renderStatusMessage() {
1309
+ switch (oauthStatus.state) {
1310
+ case "starting":
1311
+ return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1312
+ children: [
1313
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Spinner, {}, undefined, false, undefined, this),
1314
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1315
+ children: "Starting authentication\u2026"
1316
+ }, undefined, false, undefined, this)
1317
+ ]
1318
+ }, undefined, true, undefined, this);
1319
+ case "waiting_for_login":
1320
+ return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1321
+ flexDirection: "column",
1322
+ gap: 1,
1323
+ children: [
1324
+ !showPastePrompt && /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1325
+ children: [
1326
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Spinner, {}, undefined, false, undefined, this),
1327
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1328
+ children: "Opening browser to sign in with your RedScope account\u2026"
1329
+ }, undefined, false, undefined, this)
1330
+ ]
1331
+ }, undefined, true, undefined, this),
1332
+ showPastePrompt && /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1333
+ children: [
1334
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1335
+ children: PASTE_HERE_MSG
1336
+ }, undefined, false, undefined, this),
1337
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(TextInput, {
1338
+ value: pastedCode,
1339
+ onChange: setPastedCode,
1340
+ onSubmit: (value) => handleSubmitCode(value, oauthStatus.url),
1341
+ cursorOffset,
1342
+ onChangeCursorOffset: setCursorOffset,
1343
+ columns: textInputColumns
1344
+ }, undefined, false, undefined, this)
1345
+ ]
1346
+ }, undefined, true, undefined, this)
1347
+ ]
1348
+ }, undefined, true, undefined, this);
1349
+ case "processing":
1350
+ return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1351
+ children: [
1352
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Spinner, {}, undefined, false, undefined, this),
1353
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1354
+ children: "Processing authentication\u2026"
1355
+ }, undefined, false, undefined, this)
1356
+ ]
1357
+ }, undefined, true, undefined, this);
1358
+ case "success":
1359
+ return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1360
+ flexDirection: "column",
1361
+ gap: 1,
1362
+ children: [
1363
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1364
+ color: "success",
1365
+ children: "\u2713 Authentication token created successfully!"
1366
+ }, undefined, false, undefined, this),
1367
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1368
+ dimColor: true,
1369
+ children: "Using token for GitHub Actions setup\u2026"
1370
+ }, undefined, false, undefined, this)
1371
+ ]
1372
+ }, undefined, true, undefined, this);
1373
+ case "error":
1374
+ return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1375
+ flexDirection: "column",
1376
+ gap: 1,
1377
+ children: [
1378
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1379
+ color: "error",
1380
+ children: [
1381
+ "OAuth error: ",
1382
+ oauthStatus.message
1383
+ ]
1384
+ }, undefined, true, undefined, this),
1385
+ oauthStatus.toRetry ? /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1386
+ dimColor: true,
1387
+ children: "Press Enter to try again, or any other key to cancel"
1388
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1389
+ dimColor: true,
1390
+ children: "Press any key to return to API key selection"
1391
+ }, undefined, false, undefined, this)
1392
+ ]
1393
+ }, undefined, true, undefined, this);
1394
+ case "about_to_retry":
1395
+ return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1396
+ flexDirection: "column",
1397
+ gap: 1,
1398
+ children: /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1399
+ color: "permission",
1400
+ children: "Retrying\u2026"
1401
+ }, undefined, false, undefined, this)
1402
+ }, undefined, false, undefined, this);
1403
+ default:
1404
+ return null;
1405
+ }
1406
+ }
1407
+ return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1408
+ flexDirection: "column",
1409
+ gap: 1,
1410
+ tabIndex: 0,
1411
+ autoFocus: true,
1412
+ onKeyDown: handleKeyDown,
1413
+ children: [
1414
+ oauthStatus.state === "starting" && /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1415
+ flexDirection: "column",
1416
+ gap: 1,
1417
+ paddingBottom: 1,
1418
+ children: [
1419
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1420
+ bold: true,
1421
+ children: "Create Authentication Token"
1422
+ }, undefined, false, undefined, this),
1423
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1424
+ dimColor: true,
1425
+ children: "Creating a long-lived token for GitHub Actions"
1426
+ }, undefined, false, undefined, this)
1427
+ ]
1428
+ }, undefined, true, undefined, this),
1429
+ oauthStatus.state !== "success" && oauthStatus.state !== "starting" && oauthStatus.state !== "processing" && /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1430
+ flexDirection: "column",
1431
+ gap: 1,
1432
+ paddingBottom: 1,
1433
+ children: [
1434
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1435
+ bold: true,
1436
+ children: "Create Authentication Token"
1437
+ }, undefined, false, undefined, this),
1438
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1439
+ dimColor: true,
1440
+ children: "Creating a long-lived token for GitHub Actions"
1441
+ }, undefined, false, undefined, this)
1442
+ ]
1443
+ }, "header", true, undefined, this),
1444
+ oauthStatus.state === "waiting_for_login" && showPastePrompt && /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1445
+ flexDirection: "column",
1446
+ gap: 1,
1447
+ paddingBottom: 1,
1448
+ children: [
1449
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1450
+ paddingX: 1,
1451
+ children: [
1452
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1453
+ dimColor: true,
1454
+ children: [
1455
+ "Browser didn't open? Use the url below to sign in",
1456
+ " "
1457
+ ]
1458
+ }, undefined, true, undefined, this),
1459
+ urlCopied ? /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1460
+ color: "success",
1461
+ children: "(Copied!)"
1462
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1463
+ dimColor: true,
1464
+ children: /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(KeyboardShortcutHint, {
1465
+ shortcut: "c",
1466
+ action: "copy",
1467
+ parens: true
1468
+ }, undefined, false, undefined, this)
1469
+ }, undefined, false, undefined, this)
1470
+ ]
1471
+ }, undefined, true, undefined, this),
1472
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Link, {
1473
+ url: oauthStatus.url,
1474
+ children: /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedText, {
1475
+ dimColor: true,
1476
+ children: oauthStatus.url
1477
+ }, undefined, false, undefined, this)
1478
+ }, undefined, false, undefined, this)
1479
+ ]
1480
+ }, "urlToCopy", true, undefined, this),
1481
+ /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(ThemedBox_default, {
1482
+ paddingLeft: 1,
1483
+ flexDirection: "column",
1484
+ gap: 1,
1485
+ children: renderStatusMessage()
1486
+ }, undefined, false, undefined, this)
1487
+ ]
1488
+ }, undefined, true, undefined, this);
1489
+ }
1490
+ var import_react5, jsx_dev_runtime10, PASTE_HERE_MSG = "Paste code here if prompted > ";
1491
+ var init_OAuthFlowStep = __esm(() => {
1492
+ init_analytics();
1493
+ init_src();
1494
+ init_Spinner();
1495
+ init_TextInput();
1496
+ init_useTerminalSize();
1497
+ init_src();
1498
+ init_oauth();
1499
+ init_auth();
1500
+ init_log();
1501
+ import_react5 = __toESM(require_react(), 1);
1502
+ jsx_dev_runtime10 = __toESM(require_jsx_dev_runtime(), 1);
1503
+ });
1504
+
1505
+ // src/commands/install-github-app/SuccessStep.tsx
1506
+ function SuccessStep({
1507
+ secretExists,
1508
+ useExistingSecret,
1509
+ secretName,
1510
+ skipWorkflow = false
1511
+ }) {
1512
+ return /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(jsx_dev_runtime11.Fragment, {
1513
+ children: [
1514
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedBox_default, {
1515
+ flexDirection: "column",
1516
+ borderStyle: "round",
1517
+ paddingX: 1,
1518
+ children: [
1519
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedBox_default, {
1520
+ flexDirection: "column",
1521
+ marginBottom: 1,
1522
+ children: [
1523
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1524
+ bold: true,
1525
+ children: "Install GitHub App"
1526
+ }, undefined, false, undefined, this),
1527
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1528
+ dimColor: true,
1529
+ children: "Success"
1530
+ }, undefined, false, undefined, this)
1531
+ ]
1532
+ }, undefined, true, undefined, this),
1533
+ !skipWorkflow && /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1534
+ color: "success",
1535
+ children: "\u2713 GitHub Actions workflow created!"
1536
+ }, undefined, false, undefined, this),
1537
+ secretExists && useExistingSecret && /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedBox_default, {
1538
+ marginTop: 1,
1539
+ children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1540
+ color: "success",
1541
+ children: "\u2713 Using existing ANTHROPIC_API_KEY secret"
1542
+ }, undefined, false, undefined, this)
1543
+ }, undefined, false, undefined, this),
1544
+ (!secretExists || !useExistingSecret) && /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedBox_default, {
1545
+ marginTop: 1,
1546
+ children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1547
+ color: "success",
1548
+ children: [
1549
+ "\u2713 API key saved as ",
1550
+ secretName,
1551
+ " secret"
1552
+ ]
1553
+ }, undefined, true, undefined, this)
1554
+ }, undefined, false, undefined, this),
1555
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedBox_default, {
1556
+ marginTop: 1,
1557
+ children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1558
+ children: "Next steps:"
1559
+ }, undefined, false, undefined, this)
1560
+ }, undefined, false, undefined, this),
1561
+ skipWorkflow ? /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(jsx_dev_runtime11.Fragment, {
1562
+ children: [
1563
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1564
+ children: "1. Install the RedScope GitHub App if you haven't already"
1565
+ }, undefined, false, undefined, this),
1566
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1567
+ children: "2. Your workflow file was kept unchanged"
1568
+ }, undefined, false, undefined, this),
1569
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1570
+ children: "3. API key is configured and ready to use"
1571
+ }, undefined, false, undefined, this)
1572
+ ]
1573
+ }, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(jsx_dev_runtime11.Fragment, {
1574
+ children: [
1575
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1576
+ children: "1. A pre-filled PR page has been created"
1577
+ }, undefined, false, undefined, this),
1578
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1579
+ children: "2. Install the RedScope GitHub App if you haven't already"
1580
+ }, undefined, false, undefined, this),
1581
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1582
+ children: "3. Merge the PR to enable RedScope PR assistance"
1583
+ }, undefined, false, undefined, this)
1584
+ ]
1585
+ }, undefined, true, undefined, this)
1586
+ ]
1587
+ }, undefined, true, undefined, this),
1588
+ /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedBox_default, {
1589
+ marginLeft: 3,
1590
+ children: /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(ThemedText, {
1591
+ dimColor: true,
1592
+ children: "Press any key to exit"
1593
+ }, undefined, false, undefined, this)
1594
+ }, undefined, false, undefined, this)
1595
+ ]
1596
+ }, undefined, true, undefined, this);
1597
+ }
1598
+ var jsx_dev_runtime11;
1599
+ var init_SuccessStep = __esm(() => {
1600
+ init_src();
1601
+ jsx_dev_runtime11 = __toESM(require_jsx_dev_runtime(), 1);
1602
+ });
1603
+
1604
+ // src/commands/install-github-app/setupGitHubActions.ts
1605
+ async function createWorkflowFile(repoName, branchName, workflowPath, workflowContent, secretName, message, context) {
1606
+ const checkFileResult = await execFileNoThrow("gh", [
1607
+ "api",
1608
+ `repos/${repoName}/contents/${workflowPath}`,
1609
+ "--jq",
1610
+ ".sha"
1611
+ ]);
1612
+ let fileSha = null;
1613
+ if (checkFileResult.code === 0) {
1614
+ fileSha = checkFileResult.stdout.trim();
1615
+ }
1616
+ let content = workflowContent;
1617
+ if (secretName === "CLAUDE_CODE_OAUTH_TOKEN") {
1618
+ content = workflowContent.replace(/anthropic_api_key: \$\{\{ secrets\.ANTHROPIC_API_KEY \}\}/g, `claude_code_oauth_token: \${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}`);
1619
+ } else if (secretName !== "ANTHROPIC_API_KEY") {
1620
+ content = workflowContent.replace(/anthropic_api_key: \$\{\{ secrets\.ANTHROPIC_API_KEY \}\}/g, `anthropic_api_key: \${{ secrets.${secretName} }}`);
1621
+ }
1622
+ const base64Content = Buffer.from(content).toString("base64");
1623
+ const apiParams = [
1624
+ "api",
1625
+ "--method",
1626
+ "PUT",
1627
+ `repos/${repoName}/contents/${workflowPath}`,
1628
+ "-f",
1629
+ `message=${fileSha ? `"Update ${message}"` : `"${message}"`}`,
1630
+ "-f",
1631
+ `content=${base64Content}`,
1632
+ "-f",
1633
+ `branch=${branchName}`
1634
+ ];
1635
+ if (fileSha) {
1636
+ apiParams.push("-f", `sha=${fileSha}`);
1637
+ }
1638
+ const createFileResult = await execFileNoThrow("gh", apiParams);
1639
+ if (createFileResult.code !== 0) {
1640
+ if (createFileResult.stderr.includes("422") && createFileResult.stderr.includes("sha")) {
1641
+ logEvent("tengu_setup_github_actions_failed", {
1642
+ reason: "failed_to_create_workflow_file",
1643
+ exit_code: createFileResult.code,
1644
+ ...context
1645
+ });
1646
+ throw new Error(`Failed to create workflow file ${workflowPath}: A RedScope workflow file already exists in this repository. Please remove it first or update it manually.`);
1647
+ }
1648
+ logEvent("tengu_setup_github_actions_failed", {
1649
+ reason: "failed_to_create_workflow_file",
1650
+ exit_code: createFileResult.code,
1651
+ ...context
1652
+ });
1653
+ const helpText = `
1654
+
1655
+ Need help? Common issues:
1656
+ ` + `\xB7 Permission denied \u2192 Run: gh auth refresh -h github.com -s repo,workflow
1657
+ ` + `\xB7 Not authorized \u2192 Ensure you have admin access to the repository
1658
+ ` + "\xB7 For manual setup \u2192 Visit: https://github.com/anthropics/claude-code-action";
1659
+ throw new Error(`Failed to create workflow file ${workflowPath}: ${createFileResult.stderr}${helpText}`);
1660
+ }
1661
+ }
1662
+ async function setupGitHubActions(repoName, apiKeyOrOAuthToken, secretName, updateProgress, skipWorkflow = false, selectedWorkflows, authType, context) {
1663
+ try {
1664
+ logEvent("tengu_setup_github_actions_started", {
1665
+ skip_workflow: skipWorkflow,
1666
+ has_api_key: !!apiKeyOrOAuthToken,
1667
+ using_default_secret_name: secretName === "ANTHROPIC_API_KEY",
1668
+ selected_claude_workflow: selectedWorkflows.includes("claude"),
1669
+ selected_claude_review_workflow: selectedWorkflows.includes("claude-review"),
1670
+ ...context
1671
+ });
1672
+ const repoCheckResult = await execFileNoThrow("gh", [
1673
+ "api",
1674
+ `repos/${repoName}`,
1675
+ "--jq",
1676
+ ".id"
1677
+ ]);
1678
+ if (repoCheckResult.code !== 0) {
1679
+ logEvent("tengu_setup_github_actions_failed", {
1680
+ reason: "repo_not_found",
1681
+ exit_code: repoCheckResult.code,
1682
+ ...context
1683
+ });
1684
+ throw new Error(`Failed to access repository ${repoName}: ${repoCheckResult.stderr}`);
1685
+ }
1686
+ const defaultBranchResult = await execFileNoThrow("gh", [
1687
+ "api",
1688
+ `repos/${repoName}`,
1689
+ "--jq",
1690
+ ".default_branch"
1691
+ ]);
1692
+ if (defaultBranchResult.code !== 0) {
1693
+ logEvent("tengu_setup_github_actions_failed", {
1694
+ reason: "failed_to_get_default_branch",
1695
+ exit_code: defaultBranchResult.code,
1696
+ ...context
1697
+ });
1698
+ throw new Error(`Failed to get default branch: ${defaultBranchResult.stderr}`);
1699
+ }
1700
+ const defaultBranch = defaultBranchResult.stdout.trim();
1701
+ const shaResult = await execFileNoThrow("gh", [
1702
+ "api",
1703
+ `repos/${repoName}/git/ref/heads/${defaultBranch}`,
1704
+ "--jq",
1705
+ ".object.sha"
1706
+ ]);
1707
+ if (shaResult.code !== 0) {
1708
+ logEvent("tengu_setup_github_actions_failed", {
1709
+ reason: "failed_to_get_branch_sha",
1710
+ exit_code: shaResult.code,
1711
+ ...context
1712
+ });
1713
+ throw new Error(`Failed to get branch SHA: ${shaResult.stderr}`);
1714
+ }
1715
+ const sha = shaResult.stdout.trim();
1716
+ let branchName = null;
1717
+ if (!skipWorkflow) {
1718
+ updateProgress();
1719
+ branchName = `add-claude-github-actions-${Date.now()}`;
1720
+ const createBranchResult = await execFileNoThrow("gh", [
1721
+ "api",
1722
+ "--method",
1723
+ "POST",
1724
+ `repos/${repoName}/git/refs`,
1725
+ "-f",
1726
+ `ref=refs/heads/${branchName}`,
1727
+ "-f",
1728
+ `sha=${sha}`
1729
+ ]);
1730
+ if (createBranchResult.code !== 0) {
1731
+ logEvent("tengu_setup_github_actions_failed", {
1732
+ reason: "failed_to_create_branch",
1733
+ exit_code: createBranchResult.code,
1734
+ ...context
1735
+ });
1736
+ throw new Error(`Failed to create branch: ${createBranchResult.stderr}`);
1737
+ }
1738
+ updateProgress();
1739
+ const workflows = [];
1740
+ if (selectedWorkflows.includes("claude")) {
1741
+ workflows.push({
1742
+ path: ".github/workflows/claude.yml",
1743
+ content: WORKFLOW_CONTENT,
1744
+ message: "Claude PR Assistant workflow"
1745
+ });
1746
+ }
1747
+ if (selectedWorkflows.includes("claude-review")) {
1748
+ workflows.push({
1749
+ path: ".github/workflows/claude-code-review.yml",
1750
+ content: CODE_REVIEW_PLUGIN_WORKFLOW_CONTENT,
1751
+ message: "RedScope AI Review workflow"
1752
+ });
1753
+ }
1754
+ for (const workflow of workflows) {
1755
+ await createWorkflowFile(repoName, branchName, workflow.path, workflow.content, secretName, workflow.message, context);
1756
+ }
1757
+ }
1758
+ updateProgress();
1759
+ if (apiKeyOrOAuthToken) {
1760
+ const setSecretResult = await execFileNoThrow("gh", [
1761
+ "secret",
1762
+ "set",
1763
+ secretName,
1764
+ "--body",
1765
+ apiKeyOrOAuthToken,
1766
+ "--repo",
1767
+ repoName
1768
+ ]);
1769
+ if (setSecretResult.code !== 0) {
1770
+ logEvent("tengu_setup_github_actions_failed", {
1771
+ reason: "failed_to_set_api_key_secret",
1772
+ exit_code: setSecretResult.code,
1773
+ ...context
1774
+ });
1775
+ const helpText = `
1776
+
1777
+ Need help? Common issues:
1778
+ ` + `\xB7 Permission denied \u2192 Run: gh auth refresh -h github.com -s repo
1779
+ ` + `\xB7 Not authorized \u2192 Ensure you have admin access to the repository
1780
+ ` + "\xB7 For manual setup \u2192 Visit: https://github.com/anthropics/claude-code-action";
1781
+ throw new Error(`Failed to set API key secret: ${setSecretResult.stderr || "Unknown error"}${helpText}`);
1782
+ }
1783
+ }
1784
+ if (!skipWorkflow && branchName) {
1785
+ updateProgress();
1786
+ const compareUrl = `https://github.com/${repoName}/compare/${defaultBranch}...${branchName}?quick_pull=1&title=${encodeURIComponent(PR_TITLE)}&body=${encodeURIComponent(PR_BODY)}`;
1787
+ await openBrowser(compareUrl);
1788
+ }
1789
+ logEvent("tengu_setup_github_actions_completed", {
1790
+ skip_workflow: skipWorkflow,
1791
+ has_api_key: !!apiKeyOrOAuthToken,
1792
+ auth_type: authType,
1793
+ using_default_secret_name: secretName === "ANTHROPIC_API_KEY",
1794
+ selected_claude_workflow: selectedWorkflows.includes("claude"),
1795
+ selected_claude_review_workflow: selectedWorkflows.includes("claude-review"),
1796
+ ...context
1797
+ });
1798
+ saveGlobalConfig((current) => ({
1799
+ ...current,
1800
+ githubActionSetupCount: (current.githubActionSetupCount ?? 0) + 1
1801
+ }));
1802
+ } catch (error) {
1803
+ if (!error || !(error instanceof Error) || !error.message.includes("Failed to")) {
1804
+ logEvent("tengu_setup_github_actions_failed", {
1805
+ reason: "unexpected_error",
1806
+ ...context
1807
+ });
1808
+ }
1809
+ if (error instanceof Error) {
1810
+ logError(error);
1811
+ }
1812
+ throw error;
1813
+ }
1814
+ }
1815
+ var init_setupGitHubActions = __esm(() => {
1816
+ init_analytics();
1817
+ init_config();
1818
+ init_github_app();
1819
+ init_browser();
1820
+ init_execFileNoThrow();
1821
+ init_log();
1822
+ });
1823
+
1824
+ // src/commands/install-github-app/WarningsStep.tsx
1825
+ function WarningsStep({ warnings, onContinue }) {
1826
+ useKeybinding("confirm:yes", onContinue, { context: "Confirmation" });
1827
+ return /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(jsx_dev_runtime12.Fragment, {
1828
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
1829
+ flexDirection: "column",
1830
+ borderStyle: "round",
1831
+ paddingX: 1,
1832
+ children: [
1833
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
1834
+ flexDirection: "column",
1835
+ marginBottom: 1,
1836
+ children: [
1837
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
1838
+ bold: true,
1839
+ children: [
1840
+ figures_default.warning,
1841
+ " Setup Warnings"
1842
+ ]
1843
+ }, undefined, true, undefined, this),
1844
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
1845
+ dimColor: true,
1846
+ children: "We found some potential issues, but you can continue anyway"
1847
+ }, undefined, false, undefined, this)
1848
+ ]
1849
+ }, undefined, true, undefined, this),
1850
+ warnings.map((warning, index) => /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
1851
+ flexDirection: "column",
1852
+ marginBottom: 1,
1853
+ children: [
1854
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
1855
+ color: "warning",
1856
+ bold: true,
1857
+ children: warning.title
1858
+ }, undefined, false, undefined, this),
1859
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
1860
+ children: warning.message
1861
+ }, undefined, false, undefined, this),
1862
+ warning.instructions.length > 0 && /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
1863
+ flexDirection: "column",
1864
+ marginLeft: 2,
1865
+ marginTop: 1,
1866
+ children: warning.instructions.map((instruction, i) => /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
1867
+ dimColor: true,
1868
+ children: [
1869
+ "\u2022 ",
1870
+ instruction
1871
+ ]
1872
+ }, i, true, undefined, this))
1873
+ }, undefined, false, undefined, this)
1874
+ ]
1875
+ }, index, true, undefined, this)),
1876
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
1877
+ marginTop: 1,
1878
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
1879
+ bold: true,
1880
+ color: "permission",
1881
+ children: "Press Enter to continue anyway, or Ctrl+C to exit and fix issues"
1882
+ }, undefined, false, undefined, this)
1883
+ }, undefined, false, undefined, this),
1884
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedBox_default, {
1885
+ marginTop: 1,
1886
+ children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
1887
+ dimColor: true,
1888
+ children: [
1889
+ "You can also try the manual setup steps if needed:",
1890
+ " ",
1891
+ /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(ThemedText, {
1892
+ color: "claude",
1893
+ children: GITHUB_ACTION_SETUP_DOCS_URL
1894
+ }, undefined, false, undefined, this)
1895
+ ]
1896
+ }, undefined, true, undefined, this)
1897
+ }, undefined, false, undefined, this)
1898
+ ]
1899
+ }, undefined, true, undefined, this)
1900
+ }, undefined, false, undefined, this);
1901
+ }
1902
+ var jsx_dev_runtime12;
1903
+ var init_WarningsStep = __esm(() => {
1904
+ init_figures();
1905
+ init_github_app();
1906
+ init_src();
1907
+ init_useKeybinding();
1908
+ jsx_dev_runtime12 = __toESM(require_jsx_dev_runtime(), 1);
1909
+ });
1910
+
1911
+ // src/commands/install-github-app/install-github-app.tsx
1912
+ function InstallGitHubApp(props) {
1913
+ const [existingApiKey] = import_react6.useState(() => getAnthropicApiKey());
1914
+ const [state, setState] = import_react6.useState({
1915
+ ...INITIAL_STATE,
1916
+ useExistingKey: !!existingApiKey,
1917
+ selectedApiKeyOption: existingApiKey ? "existing" : isAnthropicAuthEnabled() ? "oauth" : "new"
1918
+ });
1919
+ useExitOnCtrlCDWithKeybindings();
1920
+ import_react6.default.useEffect(() => {
1921
+ logEvent("tengu_install_github_app_started", {});
1922
+ }, []);
1923
+ const checkGitHubCLI = import_react6.useCallback(async () => {
1924
+ const warnings = [];
1925
+ const ghVersionResult = await execa("gh --version", {
1926
+ shell: true,
1927
+ reject: false
1928
+ });
1929
+ if (ghVersionResult.exitCode !== 0) {
1930
+ warnings.push({
1931
+ title: "GitHub CLI not found",
1932
+ message: "GitHub CLI (gh) does not appear to be installed or accessible.",
1933
+ instructions: [
1934
+ "Install GitHub CLI from https://cli.github.com/",
1935
+ "macOS: brew install gh",
1936
+ "Windows: winget install --id GitHub.cli",
1937
+ "Linux: See installation instructions at https://github.com/cli/cli#installation"
1938
+ ]
1939
+ });
1940
+ }
1941
+ const authResult = await execa("gh auth status -a", {
1942
+ shell: true,
1943
+ reject: false
1944
+ });
1945
+ if (authResult.exitCode !== 0) {
1946
+ warnings.push({
1947
+ title: "GitHub CLI not authenticated",
1948
+ message: "GitHub CLI does not appear to be authenticated.",
1949
+ instructions: [
1950
+ "Run: gh auth login",
1951
+ "Follow the prompts to authenticate with GitHub",
1952
+ "Or set up authentication using environment variables or other methods"
1953
+ ]
1954
+ });
1955
+ } else {
1956
+ const tokenScopesMatch = authResult.stdout.match(/Token scopes:.*$/m);
1957
+ if (tokenScopesMatch) {
1958
+ const scopes = tokenScopesMatch[0];
1959
+ const missingScopes = [];
1960
+ if (!scopes.includes("repo")) {
1961
+ missingScopes.push("repo");
1962
+ }
1963
+ if (!scopes.includes("workflow")) {
1964
+ missingScopes.push("workflow");
1965
+ }
1966
+ if (missingScopes.length > 0) {
1967
+ setState((prev) => ({
1968
+ ...prev,
1969
+ step: "error",
1970
+ error: `GitHub CLI is missing required permissions: ${missingScopes.join(", ")}.`,
1971
+ errorReason: "Missing required scopes",
1972
+ errorInstructions: [
1973
+ `Your GitHub CLI authentication is missing the "${missingScopes.join('" and "')}" ${plural(missingScopes.length, "scope")} needed to manage GitHub Actions and secrets.`,
1974
+ "",
1975
+ "To fix this, run:",
1976
+ " gh auth refresh -h github.com -s repo,workflow",
1977
+ "",
1978
+ "This will add the necessary permissions to manage workflows and secrets."
1979
+ ]
1980
+ }));
1981
+ return;
1982
+ }
1983
+ }
1984
+ }
1985
+ const currentRepo = await getGithubRepo() ?? "";
1986
+ logEvent("tengu_install_github_app_step_completed", {
1987
+ step: "check-gh"
1988
+ });
1989
+ setState((prev) => ({
1990
+ ...prev,
1991
+ warnings,
1992
+ currentRepo,
1993
+ selectedRepoName: currentRepo,
1994
+ useCurrentRepo: !!currentRepo,
1995
+ step: warnings.length > 0 ? "warnings" : "choose-repo"
1996
+ }));
1997
+ }, []);
1998
+ import_react6.default.useEffect(() => {
1999
+ if (state.step === "check-gh") {
2000
+ checkGitHubCLI();
2001
+ }
2002
+ }, [state.step, checkGitHubCLI]);
2003
+ const runSetupGitHubActions = import_react6.useCallback(async (apiKeyOrOAuthToken, secretName) => {
2004
+ setState((prev) => ({
2005
+ ...prev,
2006
+ step: "creating",
2007
+ currentWorkflowInstallStep: 0
2008
+ }));
2009
+ try {
2010
+ await setupGitHubActions(state.selectedRepoName, apiKeyOrOAuthToken, secretName, () => {
2011
+ setState((prev) => ({
2012
+ ...prev,
2013
+ currentWorkflowInstallStep: prev.currentWorkflowInstallStep + 1
2014
+ }));
2015
+ }, state.workflowAction === "skip", state.selectedWorkflows, state.authType, {
2016
+ useCurrentRepo: state.useCurrentRepo,
2017
+ workflowExists: state.workflowExists,
2018
+ secretExists: state.secretExists
2019
+ });
2020
+ logEvent("tengu_install_github_app_step_completed", {
2021
+ step: "creating"
2022
+ });
2023
+ setState((prev) => ({ ...prev, step: "success" }));
2024
+ } catch (error) {
2025
+ const errorMessage = error instanceof Error ? error.message : "Failed to set up GitHub Actions";
2026
+ if (errorMessage.includes("workflow file already exists")) {
2027
+ logEvent("tengu_install_github_app_error", {
2028
+ reason: "workflow_file_exists"
2029
+ });
2030
+ setState((prev) => ({
2031
+ ...prev,
2032
+ step: "error",
2033
+ error: "A RedScope workflow file already exists in this repository.",
2034
+ errorReason: "Workflow file conflict",
2035
+ errorInstructions: [
2036
+ "The file .github/workflows/claude.yml already exists",
2037
+ "You can either:",
2038
+ " 1. Delete the existing file and run this command again",
2039
+ " 2. Update the existing file manually using the template from:",
2040
+ ` ${GITHUB_ACTION_SETUP_DOCS_URL}`
2041
+ ]
2042
+ }));
2043
+ } else {
2044
+ logEvent("tengu_install_github_app_error", {
2045
+ reason: "setup_github_actions_failed"
2046
+ });
2047
+ setState((prev) => ({
2048
+ ...prev,
2049
+ step: "error",
2050
+ error: errorMessage,
2051
+ errorReason: "GitHub Actions setup failed",
2052
+ errorInstructions: []
2053
+ }));
2054
+ }
2055
+ }
2056
+ }, [
2057
+ state.selectedRepoName,
2058
+ state.workflowAction,
2059
+ state.selectedWorkflows,
2060
+ state.useCurrentRepo,
2061
+ state.workflowExists,
2062
+ state.secretExists,
2063
+ state.authType
2064
+ ]);
2065
+ async function openGitHubAppInstallation() {
2066
+ const installUrl = "https://github.com/apps/claude";
2067
+ await openBrowser(installUrl);
2068
+ }
2069
+ async function checkRepositoryPermissions(repoName) {
2070
+ try {
2071
+ const result = await execFileNoThrow("gh", [
2072
+ "api",
2073
+ `repos/${repoName}`,
2074
+ "--jq",
2075
+ ".permissions.admin"
2076
+ ]);
2077
+ if (result.code === 0) {
2078
+ const hasAdmin = result.stdout.trim() === "true";
2079
+ return { hasAccess: hasAdmin };
2080
+ }
2081
+ if (result.stderr.includes("404") || result.stderr.includes("Not Found")) {
2082
+ return {
2083
+ hasAccess: false,
2084
+ error: "repository_not_found"
2085
+ };
2086
+ }
2087
+ return { hasAccess: false };
2088
+ } catch {
2089
+ return { hasAccess: false };
2090
+ }
2091
+ }
2092
+ async function checkExistingWorkflowFile(repoName) {
2093
+ const checkFileResult = await execFileNoThrow("gh", [
2094
+ "api",
2095
+ `repos/${repoName}/contents/.github/workflows/claude.yml`,
2096
+ "--jq",
2097
+ ".sha"
2098
+ ]);
2099
+ return checkFileResult.code === 0;
2100
+ }
2101
+ async function checkExistingSecret() {
2102
+ const checkSecretsResult = await execFileNoThrow("gh", [
2103
+ "secret",
2104
+ "list",
2105
+ "--app",
2106
+ "actions",
2107
+ "--repo",
2108
+ state.selectedRepoName
2109
+ ]);
2110
+ if (checkSecretsResult.code === 0) {
2111
+ const lines = checkSecretsResult.stdout.split(`
2112
+ `);
2113
+ const hasAnthropicKey = lines.some((line) => {
2114
+ return /^ANTHROPIC_API_KEY\s+/.test(line);
2115
+ });
2116
+ if (hasAnthropicKey) {
2117
+ setState((prev) => ({
2118
+ ...prev,
2119
+ secretExists: true,
2120
+ step: "check-existing-secret"
2121
+ }));
2122
+ } else {
2123
+ if (existingApiKey) {
2124
+ setState((prev) => ({
2125
+ ...prev,
2126
+ apiKeyOrOAuthToken: existingApiKey,
2127
+ useExistingKey: true
2128
+ }));
2129
+ await runSetupGitHubActions(existingApiKey, state.secretName);
2130
+ } else {
2131
+ setState((prev) => ({ ...prev, step: "api-key" }));
2132
+ }
2133
+ }
2134
+ } else {
2135
+ if (existingApiKey) {
2136
+ setState((prev) => ({
2137
+ ...prev,
2138
+ apiKeyOrOAuthToken: existingApiKey,
2139
+ useExistingKey: true
2140
+ }));
2141
+ await runSetupGitHubActions(existingApiKey, state.secretName);
2142
+ } else {
2143
+ setState((prev) => ({ ...prev, step: "api-key" }));
2144
+ }
2145
+ }
2146
+ }
2147
+ const handleSubmit = async () => {
2148
+ if (state.step === "warnings") {
2149
+ logEvent("tengu_install_github_app_step_completed", {
2150
+ step: "warnings"
2151
+ });
2152
+ setState((prev) => ({ ...prev, step: "install-app" }));
2153
+ setTimeout(openGitHubAppInstallation, 0);
2154
+ } else if (state.step === "choose-repo") {
2155
+ let repoName = state.useCurrentRepo ? state.currentRepo : state.selectedRepoName;
2156
+ if (!repoName.trim()) {
2157
+ return;
2158
+ }
2159
+ const repoWarnings = [];
2160
+ if (repoName.includes("github.com")) {
2161
+ const match = repoName.match(/github\.com[:/]([^/]+\/[^/]+)(\.git)?$/);
2162
+ if (!match) {
2163
+ repoWarnings.push({
2164
+ title: "Invalid GitHub URL format",
2165
+ message: "The repository URL format appears to be invalid.",
2166
+ instructions: [
2167
+ "Use format: owner/repo or https://github.com/owner/repo",
2168
+ "Example: anthropics/claude-cli"
2169
+ ]
2170
+ });
2171
+ } else {
2172
+ repoName = match[1]?.replace(/\.git$/, "") || "";
2173
+ }
2174
+ }
2175
+ if (!repoName.includes("/")) {
2176
+ repoWarnings.push({
2177
+ title: "Repository format warning",
2178
+ message: 'Repository should be in format "owner/repo"',
2179
+ instructions: [
2180
+ "Use format: owner/repo",
2181
+ "Example: anthropics/claude-cli"
2182
+ ]
2183
+ });
2184
+ }
2185
+ const permissionCheck = await checkRepositoryPermissions(repoName);
2186
+ if (permissionCheck.error === "repository_not_found") {
2187
+ repoWarnings.push({
2188
+ title: "Repository not found",
2189
+ message: `Repository ${repoName} was not found or you don't have access.`,
2190
+ instructions: [
2191
+ `Check that the repository name is correct: ${repoName}`,
2192
+ "Ensure you have access to this repository",
2193
+ 'For private repositories, make sure your GitHub token has the "repo" scope',
2194
+ "You can add the repo scope with: gh auth refresh -h github.com -s repo,workflow"
2195
+ ]
2196
+ });
2197
+ } else if (!permissionCheck.hasAccess) {
2198
+ repoWarnings.push({
2199
+ title: "Admin permissions required",
2200
+ message: `You might need admin permissions on ${repoName} to set up GitHub Actions.`,
2201
+ instructions: [
2202
+ "Repository admins can install GitHub Apps and set secrets",
2203
+ "Ask a repository admin to run this command if setup fails",
2204
+ "Alternatively, you can use the manual setup instructions"
2205
+ ]
2206
+ });
2207
+ }
2208
+ const workflowExists = await checkExistingWorkflowFile(repoName);
2209
+ if (repoWarnings.length > 0) {
2210
+ const allWarnings = [...state.warnings, ...repoWarnings];
2211
+ setState((prev) => ({
2212
+ ...prev,
2213
+ selectedRepoName: repoName,
2214
+ workflowExists,
2215
+ warnings: allWarnings,
2216
+ step: "warnings"
2217
+ }));
2218
+ } else {
2219
+ logEvent("tengu_install_github_app_step_completed", {
2220
+ step: "choose-repo"
2221
+ });
2222
+ setState((prev) => ({
2223
+ ...prev,
2224
+ selectedRepoName: repoName,
2225
+ workflowExists,
2226
+ step: "install-app"
2227
+ }));
2228
+ setTimeout(openGitHubAppInstallation, 0);
2229
+ }
2230
+ } else if (state.step === "install-app") {
2231
+ logEvent("tengu_install_github_app_step_completed", {
2232
+ step: "install-app"
2233
+ });
2234
+ if (state.workflowExists) {
2235
+ setState((prev) => ({ ...prev, step: "check-existing-workflow" }));
2236
+ } else {
2237
+ setState((prev) => ({ ...prev, step: "select-workflows" }));
2238
+ }
2239
+ } else if (state.step === "check-existing-workflow") {
2240
+ return;
2241
+ } else if (state.step === "select-workflows") {
2242
+ return;
2243
+ } else if (state.step === "check-existing-secret") {
2244
+ logEvent("tengu_install_github_app_step_completed", {
2245
+ step: "check-existing-secret"
2246
+ });
2247
+ if (state.useExistingSecret) {
2248
+ await runSetupGitHubActions(null, state.secretName);
2249
+ } else {
2250
+ await runSetupGitHubActions(state.apiKeyOrOAuthToken, state.secretName);
2251
+ }
2252
+ } else if (state.step === "api-key") {
2253
+ if (state.selectedApiKeyOption === "oauth") {
2254
+ return;
2255
+ }
2256
+ const apiKeyToUse = state.selectedApiKeyOption === "existing" ? existingApiKey : state.apiKeyOrOAuthToken;
2257
+ if (!apiKeyToUse) {
2258
+ logEvent("tengu_install_github_app_error", {
2259
+ reason: "api_key_missing"
2260
+ });
2261
+ setState((prev) => ({
2262
+ ...prev,
2263
+ step: "error",
2264
+ error: "API key is required"
2265
+ }));
2266
+ return;
2267
+ }
2268
+ setState((prev) => ({
2269
+ ...prev,
2270
+ apiKeyOrOAuthToken: apiKeyToUse,
2271
+ useExistingKey: state.selectedApiKeyOption === "existing"
2272
+ }));
2273
+ const checkSecretsResult = await execFileNoThrow("gh", [
2274
+ "secret",
2275
+ "list",
2276
+ "--app",
2277
+ "actions",
2278
+ "--repo",
2279
+ state.selectedRepoName
2280
+ ]);
2281
+ if (checkSecretsResult.code === 0) {
2282
+ const lines = checkSecretsResult.stdout.split(`
2283
+ `);
2284
+ const hasAnthropicKey = lines.some((line) => {
2285
+ return /^ANTHROPIC_API_KEY\s+/.test(line);
2286
+ });
2287
+ if (hasAnthropicKey) {
2288
+ logEvent("tengu_install_github_app_step_completed", {
2289
+ step: "api-key"
2290
+ });
2291
+ setState((prev) => ({
2292
+ ...prev,
2293
+ secretExists: true,
2294
+ step: "check-existing-secret"
2295
+ }));
2296
+ } else {
2297
+ logEvent("tengu_install_github_app_step_completed", {
2298
+ step: "api-key"
2299
+ });
2300
+ await runSetupGitHubActions(apiKeyToUse, state.secretName);
2301
+ }
2302
+ } else {
2303
+ logEvent("tengu_install_github_app_step_completed", {
2304
+ step: "api-key"
2305
+ });
2306
+ await runSetupGitHubActions(apiKeyToUse, state.secretName);
2307
+ }
2308
+ }
2309
+ };
2310
+ const handleRepoUrlChange = (value) => {
2311
+ setState((prev) => ({ ...prev, selectedRepoName: value }));
2312
+ };
2313
+ const handleApiKeyChange = (value) => {
2314
+ setState((prev) => ({ ...prev, apiKeyOrOAuthToken: value }));
2315
+ };
2316
+ const handleApiKeyOptionChange = (option) => {
2317
+ setState((prev) => ({ ...prev, selectedApiKeyOption: option }));
2318
+ };
2319
+ const handleCreateOAuthToken = import_react6.useCallback(() => {
2320
+ logEvent("tengu_install_github_app_step_completed", {
2321
+ step: "api-key"
2322
+ });
2323
+ setState((prev) => ({ ...prev, step: "oauth-flow" }));
2324
+ }, []);
2325
+ const handleOAuthSuccess = import_react6.useCallback((token) => {
2326
+ logEvent("tengu_install_github_app_step_completed", {
2327
+ step: "oauth-flow"
2328
+ });
2329
+ setState((prev) => ({
2330
+ ...prev,
2331
+ apiKeyOrOAuthToken: token,
2332
+ useExistingKey: false,
2333
+ secretName: "CLAUDE_CODE_OAUTH_TOKEN",
2334
+ authType: "oauth_token"
2335
+ }));
2336
+ runSetupGitHubActions(token, "CLAUDE_CODE_OAUTH_TOKEN");
2337
+ }, [runSetupGitHubActions]);
2338
+ const handleOAuthCancel = import_react6.useCallback(() => {
2339
+ setState((prev) => ({ ...prev, step: "api-key" }));
2340
+ }, []);
2341
+ const handleSecretNameChange = (value) => {
2342
+ if (value && !/^[a-zA-Z0-9_]+$/.test(value))
2343
+ return;
2344
+ setState((prev) => ({ ...prev, secretName: value }));
2345
+ };
2346
+ const handleToggleUseCurrentRepo = (useCurrentRepo) => {
2347
+ setState((prev) => ({
2348
+ ...prev,
2349
+ useCurrentRepo,
2350
+ selectedRepoName: useCurrentRepo ? prev.currentRepo : ""
2351
+ }));
2352
+ };
2353
+ const handleToggleUseExistingKey = (useExistingKey) => {
2354
+ setState((prev) => ({ ...prev, useExistingKey }));
2355
+ };
2356
+ const handleToggleUseExistingSecret = (useExistingSecret) => {
2357
+ setState((prev) => ({
2358
+ ...prev,
2359
+ useExistingSecret,
2360
+ secretName: useExistingSecret ? "ANTHROPIC_API_KEY" : ""
2361
+ }));
2362
+ };
2363
+ const handleWorkflowAction = async (action) => {
2364
+ if (action === "exit") {
2365
+ props.onDone("Installation cancelled by user");
2366
+ return;
2367
+ }
2368
+ logEvent("tengu_install_github_app_step_completed", {
2369
+ step: "check-existing-workflow"
2370
+ });
2371
+ setState((prev) => ({ ...prev, workflowAction: action }));
2372
+ if (action === "skip" || action === "update") {
2373
+ if (existingApiKey) {
2374
+ await checkExistingSecret();
2375
+ } else {
2376
+ setState((prev) => ({ ...prev, step: "api-key" }));
2377
+ }
2378
+ }
2379
+ };
2380
+ function handleDismissKeyDown(e) {
2381
+ e.preventDefault();
2382
+ if (state.step === "success") {
2383
+ logEvent("tengu_install_github_app_completed", {});
2384
+ }
2385
+ props.onDone(state.step === "success" ? "GitHub Actions setup complete!" : state.error ? `Couldn't install GitHub App: ${state.error}
2386
+ For manual setup instructions, see: ${GITHUB_ACTION_SETUP_DOCS_URL}` : `GitHub App installation failed
2387
+ For manual setup instructions, see: ${GITHUB_ACTION_SETUP_DOCS_URL}`);
2388
+ }
2389
+ switch (state.step) {
2390
+ case "check-gh":
2391
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(CheckGitHubStep, {}, undefined, false, undefined, this);
2392
+ case "warnings":
2393
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(WarningsStep, {
2394
+ warnings: state.warnings,
2395
+ onContinue: handleSubmit
2396
+ }, undefined, false, undefined, this);
2397
+ case "choose-repo":
2398
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ChooseRepoStep, {
2399
+ currentRepo: state.currentRepo,
2400
+ useCurrentRepo: state.useCurrentRepo,
2401
+ repoUrl: state.selectedRepoName,
2402
+ onRepoUrlChange: handleRepoUrlChange,
2403
+ onToggleUseCurrentRepo: handleToggleUseCurrentRepo,
2404
+ onSubmit: handleSubmit
2405
+ }, undefined, false, undefined, this);
2406
+ case "install-app":
2407
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(InstallAppStep, {
2408
+ repoUrl: state.selectedRepoName,
2409
+ onSubmit: handleSubmit
2410
+ }, undefined, false, undefined, this);
2411
+ case "check-existing-workflow":
2412
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ExistingWorkflowStep, {
2413
+ repoName: state.selectedRepoName,
2414
+ onSelectAction: handleWorkflowAction
2415
+ }, undefined, false, undefined, this);
2416
+ case "check-existing-secret":
2417
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(CheckExistingSecretStep, {
2418
+ useExistingSecret: state.useExistingSecret,
2419
+ secretName: state.secretName,
2420
+ onToggleUseExistingSecret: handleToggleUseExistingSecret,
2421
+ onSecretNameChange: handleSecretNameChange,
2422
+ onSubmit: handleSubmit
2423
+ }, undefined, false, undefined, this);
2424
+ case "api-key":
2425
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ApiKeyStep, {
2426
+ existingApiKey,
2427
+ useExistingKey: state.useExistingKey,
2428
+ apiKeyOrOAuthToken: state.apiKeyOrOAuthToken,
2429
+ onApiKeyChange: handleApiKeyChange,
2430
+ onToggleUseExistingKey: handleToggleUseExistingKey,
2431
+ onSubmit: handleSubmit,
2432
+ onCreateOAuthToken: isAnthropicAuthEnabled() ? handleCreateOAuthToken : undefined,
2433
+ selectedOption: state.selectedApiKeyOption,
2434
+ onSelectOption: handleApiKeyOptionChange
2435
+ }, undefined, false, undefined, this);
2436
+ case "creating":
2437
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(CreatingStep, {
2438
+ currentWorkflowInstallStep: state.currentWorkflowInstallStep,
2439
+ secretExists: state.secretExists,
2440
+ useExistingSecret: state.useExistingSecret,
2441
+ secretName: state.secretName,
2442
+ skipWorkflow: state.workflowAction === "skip",
2443
+ selectedWorkflows: state.selectedWorkflows
2444
+ }, undefined, false, undefined, this);
2445
+ case "success":
2446
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
2447
+ tabIndex: 0,
2448
+ autoFocus: true,
2449
+ onKeyDown: handleDismissKeyDown,
2450
+ children: /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(SuccessStep, {
2451
+ secretExists: state.secretExists,
2452
+ useExistingSecret: state.useExistingSecret,
2453
+ secretName: state.secretName,
2454
+ skipWorkflow: state.workflowAction === "skip"
2455
+ }, undefined, false, undefined, this)
2456
+ }, undefined, false, undefined, this);
2457
+ case "error":
2458
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ThemedBox_default, {
2459
+ tabIndex: 0,
2460
+ autoFocus: true,
2461
+ onKeyDown: handleDismissKeyDown,
2462
+ children: /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(ErrorStep, {
2463
+ error: state.error,
2464
+ errorReason: state.errorReason,
2465
+ errorInstructions: state.errorInstructions
2466
+ }, undefined, false, undefined, this)
2467
+ }, undefined, false, undefined, this);
2468
+ case "select-workflows":
2469
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(WorkflowMultiselectDialog, {
2470
+ defaultSelections: state.selectedWorkflows,
2471
+ onSubmit: (selectedWorkflows) => {
2472
+ logEvent("tengu_install_github_app_step_completed", {
2473
+ step: "select-workflows"
2474
+ });
2475
+ setState((prev) => ({
2476
+ ...prev,
2477
+ selectedWorkflows
2478
+ }));
2479
+ if (existingApiKey) {
2480
+ checkExistingSecret();
2481
+ } else {
2482
+ setState((prev) => ({ ...prev, step: "api-key" }));
2483
+ }
2484
+ }
2485
+ }, undefined, false, undefined, this);
2486
+ case "oauth-flow":
2487
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(OAuthFlowStep, {
2488
+ onSuccess: handleOAuthSuccess,
2489
+ onCancel: handleOAuthCancel
2490
+ }, undefined, false, undefined, this);
2491
+ }
2492
+ }
2493
+ async function call(onDone) {
2494
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(InstallGitHubApp, {
2495
+ onDone
2496
+ }, undefined, false, undefined, this);
2497
+ }
2498
+ var import_react6, jsx_dev_runtime13, INITIAL_STATE;
2499
+ var init_install_github_app = __esm(() => {
2500
+ init_execa();
2501
+ init_analytics();
2502
+ init_WorkflowMultiselectDialog();
2503
+ init_github_app();
2504
+ init_useExitOnCtrlCDWithKeybindings();
2505
+ init_src();
2506
+ init_auth();
2507
+ init_browser();
2508
+ init_execFileNoThrow();
2509
+ init_git();
2510
+ init_stringUtils();
2511
+ init_ApiKeyStep();
2512
+ init_CheckExistingSecretStep();
2513
+ init_CheckGitHubStep();
2514
+ init_ChooseRepoStep();
2515
+ init_CreatingStep();
2516
+ init_ErrorStep();
2517
+ init_ExistingWorkflowStep();
2518
+ init_InstallAppStep();
2519
+ init_OAuthFlowStep();
2520
+ init_SuccessStep();
2521
+ init_setupGitHubActions();
2522
+ init_WarningsStep();
2523
+ import_react6 = __toESM(require_react(), 1);
2524
+ jsx_dev_runtime13 = __toESM(require_jsx_dev_runtime(), 1);
2525
+ INITIAL_STATE = {
2526
+ step: "check-gh",
2527
+ selectedRepoName: "",
2528
+ currentRepo: "",
2529
+ useCurrentRepo: false,
2530
+ apiKeyOrOAuthToken: "",
2531
+ useExistingKey: true,
2532
+ currentWorkflowInstallStep: 0,
2533
+ warnings: [],
2534
+ secretExists: false,
2535
+ secretName: "ANTHROPIC_API_KEY",
2536
+ useExistingSecret: true,
2537
+ workflowExists: false,
2538
+ selectedWorkflows: ["claude", "claude-review"],
2539
+ selectedApiKeyOption: "new",
2540
+ authType: "api_key"
2541
+ };
2542
+ });
2543
+ init_install_github_app();
2544
+
2545
+ export {
2546
+ call
2547
+ };